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.33 by cebix, 2001-02-10T15:29:01Z vs.
Revision 1.55 by gbeauche, 2002-03-16T10:51:17Z

# Line 1 | Line 1
1   dnl Process this file with autoconf to produce a configure script.
2 < dnl Written in 1999 by Christian Bauer et al.
2 > dnl Written in 2002 by Christian Bauer et al.
3  
4   AC_INIT(main_unix.cpp)
5   AC_PREREQ(2.12)
6   AC_CONFIG_HEADER(config.h)
7  
8 + dnl These defines are necessary to get 64-bit file size support.
9 + AC_DEFINE(_USE_LARGEFILE_SOURCE, 1, [Get more functions for correct standard I/O])
10 + AC_DEFINE(_FILE_OFFSET_BITS, 64, [Get 64-bit file size support])
11 +
12   dnl Options.
13   AC_ARG_ENABLE(xf86-dga,      [  --enable-xf86-dga       use the XFree86 DGA extension [default=yes]], [WANT_XF86_DGA=$enableval], [WANT_XF86_DGA=yes])
14   AC_ARG_ENABLE(xf86-vidmode,  [  --enable-xf86-vidmode   use the XFree86 VidMode extension [default=yes]], [WANT_XF86_VIDMODE=$enableval], [WANT_XF86_VIDMODE=yes])
15   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])
16 < AC_ARG_ENABLE(vosf,          [  --enable-vosf           enable video on SEGV signals [default=no]], [WANT_VOSF=$enableval], [WANT_VOSF=no])
16 > AC_ARG_ENABLE(vosf,          [  --enable-vosf           enable video on SEGV signals [default=yes]], [WANT_VOSF=$enableval], [WANT_VOSF=yes])
17 >
18 > dnl FPU emulation core.
19 > AC_ARG_ENABLE(fpe,
20 > [  --enable-fpe=which      specify which fpu emulator to use [default=opt]],
21 > [ case "$enableval" in
22 >    default)    FPE_CORE="default";; dnl fpu_x86.cpp if i386 architecture, fpu_uae.cpp otherwise
23 >        uae)            FPE_CORE="uae";;
24 >        *)                      AC_MSG_ERROR([--enable-fpe takes only one of the following values: default, uae]);;
25 >  esac
26 > ],
27 > [ FPE_CORE="default"
28 > ])
29  
30   dnl Addressing modes.
31   AC_ARG_ENABLE(addressing,
# Line 40 | Line 56 | case "$target_os" in
56    netbsd*)      OS_TYPE=netbsd;;
57    freebsd*)     OS_TYPE=freebsd;;
58    solaris*)     OS_TYPE=solaris;;
59 <  *)            OS_TYPE=`echo $target_os | sed -e 's/-/_/' | sed -e 's/\./_/'`;;
59 >  darwin*)      OS_TYPE=darwin;;
60 >  *)            OS_TYPE=`echo $target_os | sed -e 's/-/_/g' | sed -e 's/\./_/g'`;;
61   esac
62   DEFINES="$DEFINES -DOS_$OS_TYPE"
63  
# Line 54 | Line 71 | case "$target_cpu" in
71    m68k* ) CPU_TYPE=m68k HAVE_M68K=yes;;
72    sparc* ) CPU_TYPE=sparc HAVE_SPARC=yes;;
73    powerpc* ) CPU_TYPE=powerpc HAVE_POWERPC=yes;;
74 <  *) CPU_TYPE=`echo $target_cpu | sed -e 's/-/_/'`;;
74 >  *) CPU_TYPE=`echo $target_cpu | sed -e 's/-/_/g'`;;
75   esac
76   DEFINES="$DEFINES -DCPU_$CPU_TYPE"
77  
# Line 74 | Line 91 | if [[ "x$WANT_MON" = "xyes" ]]; then
91    if grep mon_init $mon_srcdir/mon.h >/dev/null 2>/dev/null; then
92      AC_MSG_RESULT(yes)
93      AC_DEFINE(ENABLE_MON)
94 <    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"
94 >    MONSRCS="$mon_srcdir/mon.cpp $mon_srcdir/mon_6502.cpp $mon_srcdir/mon_z80.cpp $mon_srcdir/mon_cmd.cpp $mon_srcdir/mon_disass.cpp $mon_srcdir/mon_ppc.cpp $mon_srcdir/mon_lowmem.cpp $mon_srcdir/disass/floatformat.c $mon_srcdir/disass/i386-dis.c $mon_srcdir/disass/m68k-dis.c $mon_srcdir/disass/m68k-opc.c"
95      CXXFLAGS="$CXXFLAGS -I$mon_srcdir -I$mon_srcdir/disass"
96      AC_CHECK_LIB(readline, readline)
97      AC_CHECK_LIB(termcap, tputs)
# Line 88 | Line 105 | fi
105  
106   dnl Checks for libraries.
107   AC_CHECK_LIB(posix4, sem_init)
108 + AC_CHECK_LIB(rt, timer_create)
109  
110   dnl We need X11.
111   AC_PATH_XTRA
# Line 111 | Line 129 | if [[ "x$HAVE_PTHREADS" = "xyes" ]]; the
129    AC_DEFINE(HAVE_PTHREADS)
130   fi
131   AC_CHECK_FUNCS(pthread_cancel)
132 + AC_CHECK_FUNCS(pthread_mutexattr_setprotocol)
133 + AC_CHECK_FUNCS(pthread_mutexattr_settype)
134  
135   dnl If POSIX.4 semaphores are not available, we emulate them with pthread mutexes.
136   SEMSRC=
# Line 154 | Line 174 | UISRCS=../dummy/prefs_editor_dummy.cpp
174   if [[ "x$WANT_GTK" = "xyes" ]]; then
175    AM_PATH_GTK(1.2.0, [
176      AC_DEFINE(ENABLE_GTK)
157    CFLAGS="$CFLAGS $GTK_CFLAGS"
177      CXXFLAGS="$CXXFLAGS $GTK_CFLAGS"
178      LIBS="$LIBS $GTK_LIBS"
179      UISRCS=prefs_editor_gtk.cpp
180 +    B2_PATH_GNOMEUI([
181 +      AC_DEFINE(HAVE_GNOMEUI)
182 +      CXXFLAGS="$CXXFLAGS $GNOMEUI_CFLAGS"
183 +      LIBS="$LIBS $GNOMEUI_LIBS"
184 +    ], [])
185    ], [
186      AC_MSG_WARN([Could not find GTK+, disabling user interface.])
187      WANT_GTK=no
# Line 179 | Line 203 | fi
203  
204   dnl Checks for header files.
205   AC_HEADER_STDC
206 < AC_CHECK_HEADERS(unistd.h fcntl.h sys/time.h)
206 > AC_CHECK_HEADERS(unistd.h fcntl.h sys/time.h sys/mman.h)
207  
208   dnl Checks for typedefs, structures, and compiler characteristics.
209   AC_C_BIGENDIAN
# Line 192 | Line 216 | AC_CHECK_SIZEOF(long long, 8)
216   AC_CHECK_SIZEOF(void *, 4)
217   AC_TYPE_OFF_T
218   AC_CHECK_TYPE(loff_t, off_t)
219 + AC_CHECK_TYPE(caddr_t, [char *])
220   AC_TYPE_SIZE_T
221   AC_TYPE_SIGNAL
222   AC_HEADER_TIME
223   AC_STRUCT_TM
224  
225 + dnl Check whether sys/socket.h defines type socklen_t.
226 + dnl (extracted from ac-archive/Miscellaneous)
227 + AC_CACHE_CHECK("for socklen_t",
228 +  ac_cv_type_socklen_t, [
229 +  AC_TRY_COMPILE([
230 +    #include <sys/types.h>
231 +    #include <sys/socket.h>
232 +  ], [socklen_t len = 42; return 0;],
233 +  ac_cv_type_socklen_t=yes, ac_cv_type_socklen_t=no,
234 +  dnl When cross-compiling, do not assume anything.
235 +  ac_cv_type_socklen_t="guessing no"
236 +  )
237 + ])
238 + if [[ "x$ac_cv_type_socklen_t" != "xyes" ]]; then
239 +  AC_DEFINE(socklen_t, int)
240 + fi
241 +
242   dnl Checks for library functions.
243   AC_CHECK_FUNCS(strdup cfmakeraw)
244   AC_CHECK_FUNCS(clock_gettime timer_create)
245 + AC_CHECK_FUNCS(sigaction signal)
246 + AC_CHECK_FUNCS(mmap mprotect munmap)
247 + AC_CHECK_FUNCS(vm_allocate vm_deallocate vm_protect)
248 +
249 + dnl Darwin seems to define mach_task_self() instead of task_self().
250 + AC_CHECK_FUNCS(mach_task_self task_self)
251  
252   dnl Select system-dependant source files.
253   SERIALSRC=serial_unix.cpp
# Line 210 | Line 258 | EXTRASYSSRCS=
258   CAN_NATIVE_M68K=no
259   case "$target_os" in
260   linux*)
261 <  ETHERSRC=Linux/ether_linux.cpp
214 <  SCSISRC=Linux/scsi_linux.cpp
261 >  ETHERSRC=ether_unix.cpp
262    AUDIOSRC=audio_oss_esd.cpp
263 +  SCSISRC=Linux/scsi_linux.cpp
264    ;;
265 < freebsd*3.*)
265 > freebsd*)
266 >  ETHERSRC=ether_unix.cpp
267    AUDIOSRC=audio_oss_esd.cpp
268    DEFINES="$DEFINES -DBSD_COMP"
269 +  CXXFLAGS="$CXXFLAGS -fpermissive"
270    dnl Check for the CAM library
271    AC_CHECK_LIB(cam, cam_open_btl, HAVE_LIBCAM=yes, HAVE_LIBCAM=no)
272    if [[ "x$HAVE_LIBCAM" = "xno" ]]; then
273      AC_MSG_WARN([Cannot find libcam for SCSI management, disabling SCSI support.])
274    else
275      dnl Check for the sys kernel includes
276 <    AC_CHECK_HEADER(/sys/cam/cam.h)
277 <    if [[ "x$ac_cv_header__sys_cam_cam_h" = "xno" ]]; then
276 >    AC_CHECK_HEADER(camlib.h)
277 >    if [[ "x$ac_cv_header_camlib_h" = "xno" ]]; then
278        dnl In this case I should fix this thing including a "patch"
279        dnl to access directly to the functions in the kernel :) --Orlando
280 <      AC_MSG_WARN([Cannot find kernel includes for CAM library, disabling SCSI support.])
280 >      AC_MSG_WARN([Cannot find includes for CAM library, disabling SCSI support.])
281      else
282        SCSISRC=FreeBSD/scsi_freebsd.cpp
233      CXXFLAGS="$CXXFLAGS -I/sys"
234      CFLAGS="$CFLAGS -I/sys"
283        LIBS="$LIBS -lcam"
284        DEFINES="$DEFINES -DCAM"
285      fi
286    fi
287    ;;
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  ;;
288   netbsd*)
289    CAN_NATIVE_M68K=yes
290    ;;
# Line 262 | Line 293 | solaris*)
293    DEFINES="$DEFINES -DBSD_COMP -D_POSIX_PTHREAD_SEMANTICS"
294    ;;
295   irix*)
296 +  ETHERSRC=ether_unix.cpp
297    AUDIOSRC=Irix/audio_irix.cpp
298    EXTRASYSSRCS=Irix/unaligned.c
299    dnl IRIX headers work fine, but somehow don't define or use "STDC_HEADERS"
300    DEFINES="$DEFINES -DCRTSCTS=CNEW_RTSCTS -DB230400=B115200 -DSTDC_HEADERS"
301    LIBS="$LIBS -laudio"
302 +  WANT_ESD=no
303 +
304 +  dnl Check if our compiler supports -Ofast (MIPSPro)
305 +  HAVE_OFAST=no
306 +  ocflags="$CFLAGS"
307 +  CFLAGS=`echo $CFLAGS | sed -e 's/ -g / -Ofast /;s/^-g /-Ofast /;s/-g$/ -Ofast/;s/^-g$/-Ofast/'`
308 +  AC_MSG_CHECKING(if "-Ofast" works)
309 +  dnl Do a test compile of an empty function
310 +  AC_TRY_COMPILE(,, [AC_MSG_RESULT(yes); HAVE_OFAST=yes], AC_MSG_RESULT(no))
311 +  CFLAGS="$ocflags"
312 +
313    ;;
314   esac
315  
# Line 291 | Line 334 | dnl to be put into the config.h file
334   dnl $1 -- the macro to define
335   dnl $2 -- the value to translate
336   AC_DEFUN(AC_TRANSLATE_DEFINE, [
337 <    if [[ "x$2" = "xyes" ]]; then
337 >    if [[ "x$2" = "xyes" -o "x$2" = "xguessing yes" ]]; then
338          AC_DEFINE($1)
339      fi
340   ])
341  
342 + dnl Various checks if the system supports vm_allocate() and the like functions.
343 + have_mach_vm=no
344 + if [[ "x$ac_cv_func_vm_allocate" = "xyes" -a "x$ac_cv_func_vm_deallocate" = "xyes" -a \
345 +      "x$ac_cv_func_vm_protect" = "xyes" ]]; then
346 +  have_mach_vm=yes
347 + fi
348 + AC_TRANSLATE_DEFINE(HAVE_MACH_VM, "$have_mach_vm")
349 +
350 + dnl Check that vm_allocate(), vm_protect() work
351 + if [[ "x$have_mach_vm" = "xyes" ]]; then
352 +
353 + AC_CACHE_CHECK("whether vm_protect works",
354 +  ac_cv_vm_protect_works, [
355 +  AC_LANG_SAVE
356 +  AC_LANG_CPLUSPLUS
357 +  ac_cv_vm_protect_works=yes
358 +  dnl First the tests that should segfault
359 +  for test_def in NONE_READ NONE_WRITE READ_WRITE; do
360 +    AC_TRY_RUN([
361 +      #define CONFIGURE_TEST_VM_MAP
362 +      #define TEST_VM_PROT_$test_def
363 +      #include "vm_alloc.cpp"
364 +    ], ac_cv_vm_protect_works=no, rm -f core,
365 +    dnl When cross-compiling, do not assume anything
366 +    ac_cv_vm_protect_works="guessing no"
367 +    )
368 +  done
369 +  AC_TRY_RUN([
370 +    #define CONFIGURE_TEST_VM_MAP
371 +    #define TEST_VM_PROT_RDWR_WRITE
372 +    #include "vm_alloc.cpp"
373 +  ], , ac_cv_vm_protect_works=no,
374 +  dnl When cross-compiling, do not assume anything
375 +  ac_cv_vm_protect_works="guessing no"
376 +  )
377 +  AC_LANG_RESTORE
378 +  ]
379 + )
380 +
381 + dnl Remove support for vm_allocate() if vm_protect() does not work
382 + if [[ "x$have_mach_vm" = "xyes" ]]; then
383 +  case $ac_cv_vm_protect_works in
384 +    *yes) have_mach_vm=yes;;
385 +    *no) have_mach_vm=no;;
386 +  esac
387 + fi
388 + AC_TRANSLATE_DEFINE(HAVE_MACH_VM, "$have_mach_vm")
389 +
390 + fi dnl HAVE_MACH_VM
391 +
392 + dnl Various checks if the system supports mmap() and the like functions.
393 + dnl ... and Mach memory allocators are not supported
394 + have_mmap_vm=no
395 + if [[ "x$ac_cv_func_mmap" = "xyes" -a "x$ac_cv_func_munmap" = "xyes" -a \
396 +      "x$ac_cv_func_mprotect" = "xyes" ]]; then
397 +  if [[ "x$have_mach_vm" = "xno" ]]; then
398 +    have_mmap_vm=yes
399 +  fi
400 + fi
401 + AC_TRANSLATE_DEFINE(HAVE_MMAP_VM, "$have_mmap_vm")
402 +
403 + dnl Check that mmap() and associated functions work.
404 + if [[ "x$have_mmap_vm" = "xyes" ]]; then
405 +
406 + dnl Check if we have a working anonymous mmap()
407 + AC_CACHE_CHECK("whether mmap supports MAP_ANON",
408 +  ac_cv_mmap_anon, [
409 +  AC_LANG_SAVE
410 +  AC_LANG_CPLUSPLUS
411 +  AC_TRY_RUN([
412 +    #define HAVE_MMAP_ANON
413 +    #define CONFIGURE_TEST_VM_MAP
414 +    #define TEST_VM_MMAP_ANON
415 +    #include "vm_alloc.cpp"
416 +  ], ac_cv_mmap_anon=yes, ac_cv_mmap_anon=no,
417 +  dnl When cross-compiling, do not assume anything.
418 +  ac_cv_mmap_anon="guessing no"
419 +  )
420 +  AC_LANG_RESTORE
421 +  ]
422 + )
423 + AC_TRANSLATE_DEFINE(HAVE_MMAP_ANON, "$ac_cv_mmap_anon")
424 +
425 + AC_CACHE_CHECK("whether mmap supports MAP_ANONYMOUS",
426 +  ac_cv_mmap_anonymous, [
427 +  AC_LANG_SAVE
428 +  AC_LANG_CPLUSPLUS
429 +  AC_TRY_RUN([
430 +    #define HAVE_MMAP_ANONYMOUS
431 +    #define CONFIGURE_TEST_VM_MAP
432 +    #define TEST_VM_MMAP_ANON
433 +    #include "vm_alloc.cpp"
434 +  ], ac_cv_mmap_anonymous=yes, ac_cv_mmap_anonymous=no,
435 +  dnl When cross-compiling, do not assume anything.
436 +  ac_cv_mmap_anonymous="guessing no"
437 +  )
438 +  AC_LANG_RESTORE
439 +  ]
440 + )
441 + AC_TRANSLATE_DEFINE(HAVE_MMAP_ANONYMOUS, "$ac_cv_mmap_anonymous")
442 +
443 + AC_CACHE_CHECK("whether mprotect works",
444 +  ac_cv_mprotect_works, [
445 +  AC_LANG_SAVE
446 +  AC_LANG_CPLUSPLUS
447 +  ac_cv_mprotect_works=yes
448 +  dnl First the tests that should segfault
449 +  for test_def in NONE_READ NONE_WRITE READ_WRITE; do
450 +    AC_TRY_RUN([
451 +      #define CONFIGURE_TEST_VM_MAP
452 +      #define TEST_VM_PROT_$test_def
453 +      #include "vm_alloc.cpp"
454 +    ], ac_cv_mprotect_works=no, rm -f core,
455 +    dnl When cross-compiling, do not assume anything
456 +    ac_cv_mprotect_works="guessing no"
457 +    )
458 +  done
459 +  AC_TRY_RUN([
460 +    #define CONFIGURE_TEST_VM_MAP
461 +    #define TEST_VM_PROT_RDWR_WRITE
462 +    #include "vm_alloc.cpp"
463 +  ], , ac_cv_mprotect_works=no,
464 +  dnl When cross-compiling, do not assume anything
465 +  ac_cv_mprotect_works="guessing no"
466 +  )
467 +  AC_LANG_RESTORE
468 +  ]
469 + )
470 +
471 + dnl Remove support for mmap() if mprotect() does not work
472 + if [[ "x$have_mmap_vm" = "xyes" ]]; then
473 +  case $ac_cv_mprotect_works in
474 +    *yes) have_mmap_vm=yes;;
475 +    *no) have_mmap_vm=no;;
476 +  esac
477 + fi
478 + AC_TRANSLATE_DEFINE(HAVE_MMAP_VM, $have_mmap_vm)
479 +
480 + fi dnl HAVE_MMAP_VM
481 +
482   dnl Check if we can mmap 0x2000 bytes from 0x0000
483   AC_CACHE_CHECK("whether we can map Low Memory area 0x0000-0x2000",
484    ac_cv_can_map_lm, [
485    AC_LANG_SAVE
486    AC_LANG_CPLUSPLUS
487    AC_TRY_RUN([
488 <    #include <unistd.h>
489 <    #include <fcntl.h>
490 <    #include <sys/mman.h>
491 <    
492 <    int main()
493 <    { int zero_fd; char * lm;
494 <      if ((zero_fd = open("/dev/zero", O_RDWR)) < 0) exit(1);
495 <      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);
488 >    #include "vm_alloc.cpp"
489 >    int main(void) { /* returns 0 if we could map the lowmem globals */
490 >      volatile char * lm;
491 >      if (vm_init() < 0) exit(1);
492 >      if ((lm = (volatile char *)vm_acquire_fixed(0, 0x2000)) == VM_MAP_FAILED) exit(1);
493 >      lm[0] = 'z';
494 >      if (vm_release((char *)lm, 0x2000) < 0) exit(1);
495 >      vm_exit(); exit(0);
496      }
497 <  ],
498 <  [ac_cv_can_map_lm=yes],
499 <  [ac_cv_can_map_lm=no]
497 >  ], ac_cv_can_map_lm=yes, ac_cv_can_map_lm=no,
498 >  dnl When cross-compiling, do not assume anything.
499 >  ac_cv_can_map_lm="guessing no"
500    )
501    AC_LANG_RESTORE
502    ]
503   )
504  
505 < dnl Check if extended signals are supported.
506 < AC_CACHE_CHECK("whether your system supports extended signal handlers",
507 <  ac_cv_have_extended_signals, [
505 > dnl Check signal handlers need to be reinstalled
506 > AC_CACHE_CHECK("whether signal handlers need to be reinstalled",
507 >  ac_cv_signal_need_reinstall, [
508    AC_LANG_SAVE
509    AC_LANG_CPLUSPLUS
510    AC_TRY_RUN([
332    #include <unistd.h>
511      #include <stdlib.h>
512 +    #ifdef HAVE_UNISTD_H
513 +    #include <unistd.h>
514 +    #endif
515      #include <signal.h>
516 <    #include <fcntl.h>
517 <    #include <sys/mman.h>
518 <
519 <    static volatile caddr_t mem = 0;
520 <    static int zero_fd = -1;
516 >    static int handled_signal = 0;
517 >    RETSIGTYPE sigusr1_handler(int) { handled_signal++; }
518 >    int main(void) { /* returns 0 if signals need not to be reinstalled */
519 >      signal(SIGUSR1, sigusr1_handler); raise(SIGUSR1); raise(SIGUSR1);
520 >      exit(handled_signal == 2);
521 >    }
522 >  ], ac_cv_signal_need_reinstall=yes, ac_cv_signal_need_reinstall=no,
523 >  dnl When cross-compiling, do not assume anything.
524 >  ac_cv_signal_need_reinstall="guessing yes"
525 >  )
526 >  AC_LANG_RESTORE
527 >  ]
528 > )
529 > AC_TRANSLATE_DEFINE(SIGNAL_NEED_REINSTALL, "$ac_cv_signal_need_reinstall")
530  
531 <    static RETSIGTYPE segfault_handler(int, siginfo_t * sip, void *)
532 <    { if ((caddr_t)(sip->si_addr) != mem) exit(1);
533 <      munmap(mem, getpagesize()); close(zero_fd); exit(0); }
534 <
535 <    int main()
536 <    { if ((zero_fd = open("/dev/zero", O_RDWR)) < 0) exit(1);
537 <      if ((mem = (caddr_t)mmap(0, getpagesize(), PROT_READ, MAP_PRIVATE, zero_fd, 0)) == (caddr_t)MAP_FAILED) exit(1);
538 <      struct sigaction sa; sa.sa_sigaction = segfault_handler; sa.sa_flags = SA_SIGINFO;
539 <      sigaction(SIGSEGV, &sa, 0);
540 <      mem[0] = 0;
541 <      exit(1); // should not be reached
531 > dnl Check if sigaction handlers need to be reinstalled
532 > AC_CACHE_CHECK("whether sigaction handlers need to be reinstalled",
533 >  ac_cv_sigaction_need_reinstall, [
534 >  AC_LANG_SAVE
535 >  AC_LANG_CPLUSPLUS
536 >  AC_TRY_RUN([
537 >    #include <stdlib.h>
538 >    #ifdef HAVE_UNISTD_H
539 >    #include <unistd.h>
540 >    #endif
541 >    #include <signal.h>
542 >    static int handled_signal = 0;
543 >    RETSIGTYPE sigusr1_handler(int) { handled_signal++; }
544 >    typedef RETSIGTYPE (*signal_handler)(int);
545 >    static signal_handler mysignal(int sig, signal_handler handler) {
546 >      struct sigaction old_sa;
547 >      struct sigaction new_sa;
548 >      new_sa.sa_handler = handler;
549 >      return ((sigaction(sig,&new_sa,&old_sa) < 0) ? SIG_IGN : old_sa.sa_handler);
550      }
551 <  ],
552 <  [ac_cv_have_extended_signals=yes],
553 <  [ac_cv_have_extended_signals=no]
551 >    int main(void) { /* returns 0 if signals need not to be reinstalled */
552 >      mysignal(SIGUSR1, sigusr1_handler); raise(SIGUSR1); raise(SIGUSR1);
553 >      exit(handled_signal == 2);
554 >    }
555 >  ], ac_cv_sigaction_need_reinstall=yes, ac_cv_sigaction_need_reinstall=no,
556 >  dnl When cross-compiling, do not assume anything.
557 >  ac_cv_sigaction_need_reinstall="guessing yes"
558 >  )
559 >  AC_LANG_RESTORE
560 >  ]
561 > )
562 > AC_TRANSLATE_DEFINE(SIGACTION_NEED_REINSTALL, "$ac_cv_sigaction_need_reinstall")
563 >
564 > dnl Check if extended signals are supported.
565 > AC_CACHE_CHECK("whether your system supports extended signal handlers",
566 >  ac_cv_have_extended_signals, [
567 >  AC_LANG_SAVE
568 >  AC_LANG_CPLUSPLUS
569 >  AC_TRY_RUN([
570 >    #define HAVE_SIGINFO_T 1
571 >    #define CONFIGURE_TEST_SIGSEGV_RECOVERY
572 >    #include "vm_alloc.cpp"
573 >    #include "sigsegv.cpp"
574 >  ], ac_cv_have_extended_signals=yes, ac_cv_have_extended_signals=no,
575 >  dnl When cross-compiling, do not assume anything.
576 >  ac_cv_have_extended_signals=no
577    )
578    AC_LANG_RESTORE
579    ]
# Line 361 | Line 582 | AC_TRANSLATE_DEFINE(HAVE_SIGINFO_T, "$ac
582  
583   dnl Otherwise, check for subterfuges.
584   if [[ "x$ac_cv_have_extended_signals" = "xno" ]]; then
585 <  case "$target_os" in
586 <    linux*)
587 <      if [[ "x$HAVE_I386" = "xyes" ]]; then
588 <        AC_CACHE_CHECK("whether we then have a subterfuge for your system",
589 <                  ac_cv_have_sigcontext_hack, [
590 <          AC_LANG_SAVE
591 <          AC_LANG_CPLUSPLUS
592 <          AC_TRY_RUN([
593 <            #include <unistd.h>
594 <            #include <signal.h>
595 <            #include <fcntl.h>
596 <            #include <sys/mman.h>
597 <
598 <            static volatile caddr_t mem = 0;
599 <            static int zero_fd = -1;
600 <
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
585 >  AC_CACHE_CHECK("whether we then have a subterfuge for your system",
586 >  ac_cv_have_sigcontext_hack, [
587 >    AC_LANG_SAVE
588 >    AC_LANG_CPLUSPLUS
589 >    AC_TRY_RUN([
590 >      #define HAVE_SIGCONTEXT_SUBTERFUGE 1
591 >      #define CONFIGURE_TEST_SIGSEGV_RECOVERY
592 >      #include "vm_alloc.cpp"
593 >      #include "sigsegv.cpp"
594 >    ], ac_cv_have_sigcontext_hack=yes, ac_cv_have_sigcontext_hack=no,
595 >    dnl When cross-compiling, do not assume anything.
596 >    ac_cv_have_sigcontext_hack=no
597 >    )
598 >    AC_LANG_RESTORE
599 >  ])
600 >  AC_TRANSLATE_DEFINE(HAVE_SIGCONTEXT_SUBTERFUGE, "$ac_cv_have_sigcontext_hack")
601   fi
602  
603   dnl Can we do Video on SEGV Signals ?
# Line 553 | Line 680 | AC_EGREP_CPP(yes,
680   #endif
681   ], [AC_MSG_RESULT(yes); HAVE_GCC27=yes], AC_MSG_RESULT(no))
682  
683 + dnl Check for GCC 3.0 or higher.
684 + HAVE_GCC30=no
685 + AC_MSG_CHECKING(for GCC 3.0 or higher)
686 + AC_EGREP_CPP(yes,
687 + [#if __GNUC__ >= 3
688 +  yes
689 + #endif
690 + ], [AC_MSG_RESULT(yes); HAVE_GCC30=yes], AC_MSG_RESULT(no))
691 +
692   dnl Set "-fomit-frame-pointer" on i386 GCC 2.7 or higher.
693 + dnl Also set "-fno-exceptions" for C++ because exception handling requires
694 + dnl the frame pointer.
695   if [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_I386" = "xyes" ]]; then
696    CFLAGS="$CFLAGS -fomit-frame-pointer"
697 <  CXXFLAGS="$CXXFLAGS -fomit-frame-pointer"
697 >  CXXFLAGS="$CXXFLAGS -fomit-frame-pointer -fno-exceptions"
698 > fi
699 >
700 > dnl (gb) Do not merge constants since it breaks fpu/fpu_x86.cpp.
701 > dnl As of 2001/08/02, this affects the following compilers:
702 > dnl Official: probably gcc-3.1 (mainline CVS)
703 > dnl Mandrake: gcc-2.96 >= 0.59mdk, gcc-3.0.1 >= 0.1mdk
704 > dnl Red Hat : gcc-2.96 >= 89, gcc-3.0 >= 1
705 > if [[ "x$HAVE_GCC27" = "xyes" ]]; then
706 >  SAVED_CXXFLAGS="$CXXFLAGS"
707 >  CXXFLAGS="$CXXFLAGS -fno-merge-constants"
708 >  AC_CACHE_CHECK([whether GCC supports constants merging], ac_cv_gcc_constants_merging, [
709 >    AC_LANG_SAVE
710 >    AC_LANG_CPLUSPLUS
711 >    AC_TRY_COMPILE([],[],[ac_cv_gcc_constants_merging=yes],[ac_cv_gcc_constants_merging=no])
712 >    AC_LANG_RESTORE
713 >  ])
714 >  if [[ "x$ac_cv_gcc_constants_merging" != "xyes" ]]; then
715 >    CXXFLAGS="$SAVED_CXXFLAGS"
716 >  fi
717   fi
718  
719   dnl Select appropriate CPU source and REGPARAM define.
720   ASM_OPTIMIZATIONS=none
721   CPUSRCS="cpuemu1.cpp cpuemu2.cpp cpuemu3.cpp cpuemu4.cpp cpuemu5.cpp cpuemu6.cpp cpuemu7.cpp cpuemu8.cpp"
722 < FPUSRCS="../uae_cpu/fpp.cpp"
723 < if [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_I386" = "xyes" ]]; then
722 > FPUSRCS="../uae_cpu/fpu/fpu_uae.cpp"
723 > if [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_I386" = "xyes" -a "x$OS_TYPE" != "xfreebsd" ]]; then
724    dnl i386 CPU
725    DEFINES="$DEFINES -DREGPARAM=\"__attribute__((regparm(3)))\""
726    if [[ "x$HAVE_GAS" = "xyes" ]]; then
727      ASM_OPTIMIZATIONS=i386
728      DEFINES="$DEFINES -DX86_ASSEMBLY -DUNALIGNED_PROFITABLE -DOPTIMIZED_FLAGS"
729 <    CPUSRCS="../uae_cpu/compiler.cpp cpufast1.s cpufast2.s cpufast3.s cpufast4.s cpufast5.s cpufast6.s cpufast7.s cpufast8.s"
729 >    CPUSRCS="cpufast1.s cpufast2.s cpufast3.s cpufast4.s cpufast5.s cpufast6.s cpufast7.s cpufast8.s"
730      FPUSRCS="../uae_cpu/fpu_x86.cpp"
731    fi
732   elif [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_SPARC" = "xyes" -a "x$HAVE_GAS" = "xyes" ]]; then
# Line 601 | Line 758 | elif [[ "x$WANT_NATIVE_M68K" = "xyes" ]]
758    CPUSRCS="asm_support.s"
759   fi
760  
761 + dnl Select appropriate FPU source.
762 + dnl 1. Optimized X86 assembly core if target is i386 architecture
763 + SAVED_DEFINES=$DEFINES
764 + if [[ "x$FPE_CORE" = "xdefault" ]]; then
765 +  if [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_I386" = "xyes" -a "x$HAVE_GAS" = "xyes" ]]; then
766 +    DEFINES="$DEFINES -DFPU_X86"
767 +    FPE_CORE_STR="i386 optimized core"
768 +    FPUSRCS="../uae_cpu/fpu/fpu_x86.cpp"
769 +    FPE_CORE="i386"
770 +  else
771 +    FPE_CORE="uae"
772 +  fi
773 + fi
774 +
775 + dnl 2. JIT-FPU only supports IEEE-based implementation.
776 + if [[ "x$WANT_JIT_FPU" = "xyes" -a "x$FPE_CORE" != "xieee" ]]; then
777 +  AC_MSG_WARN([Sorry, JIT-FPU supports only the "ieee" FPE implementation])
778 +  FPE_CORE="ieee"
779 +  dnl Restore previous variables. FPE_CORE_STR and FPUSRCS are overwritten
780 +  DEFINES=$SAVED_DEFINES
781 + fi
782 +
783 + dnl 3. Choose either IEEE-based implementation or the old UAE core
784 + if [[ "x$FPE_CORE" = "xieee" ]]; then
785 +  AC_CHECK_HEADERS(fenv.h)
786 +  AC_CHECK_FUNCS(feclearexcept fegetexceptflag feraiseexcept fesetexceptflag fetestexcept)
787 +  AC_CHECK_FUNCS(fegetround fesetround)
788 +  DEFINES="$DEFINES -DFPU_IEEE"
789 +  FPE_CORE_STR="ieee-based fpu core"
790 +  FPUSRCS="../uae_cpu/fpu/fpu_ieee.cpp"
791 + elif [[ "x$FPE_CORE" = "xuae" ]]; then
792 +  DEFINES="$DEFINES -DFPU_UAE"
793 +  FPE_CORE_STR="original uae core"
794 +  FPUSRCS="../uae_cpu/fpu/fpu_uae.cpp"
795 + fi
796 +
797 + dnl Check for certain math functions
798 + AC_CHECK_FUNCS(atanh)
799 + AC_CHECK_FUNCS(isnan isinf)             dnl C99
800 + AC_CHECK_FUNCS(isnanl isinfl)   dnl IEEE ?
801 +
802   dnl UAE CPU sources for all non-m68k-native architectures.
803   if [[ "x$WANT_NATIVE_M68K" = "xno" ]]; then
804    CPUINCLUDES="-I../uae_cpu"
# Line 609 | Line 807 | fi
807  
808   dnl Remove the "-g" option if set for GCC.
809   if [[ "x$HAVE_GCC27" = "xyes" ]]; then
810 <  dnl gb-- Probably not the cleanest way to take
811 <  CFLAGS=`echo $CFLAGS | sed -e 's/ -g / /;s/^-g / /;s/ -g$/ /;s/^-g$//'`
812 <  CXXFLAGS=`echo $CXXFLAGS | sed -e 's/ -g / /;s/^-g / /;s/ -g$/ /;s/^-g$//'`
810 >  CFLAGS=`echo $CFLAGS | sed -e 's/-g//g'`
811 >  CXXFLAGS=`echo $CXXFLAGS | sed -e 's/-g//g'`
812 > fi
813 >
814 > dnl Or if we have -Ofast
815 > if [[ "x$HAVE_OFAST" = "xyes" ]]; then
816 >  CFLAGS="`echo $CFLAGS | sed -e 's/-g//g'` -Ofast"
817 >  CXXFLAGS="`echo $CXXFLAGS | sed -e 's/-g//g'` -Ofast"
818 >  CXXFLAGS="-LANG:std $CXXFLAGS"
819 >  LDFLAGS="$LDFLAGS -Ofast"
820   fi
821  
822   dnl Generate Makefile.
# Line 633 | Line 838 | echo ESD sound support ................
838   echo GTK user interface ............... : $WANT_GTK
839   echo mon debugger support ............. : $WANT_MON
840   echo Running m68k code natively ....... : $WANT_NATIVE_M68K
841 + echo Floating-Point emulation core .... : $FPE_CORE_STR
842   echo Assembly optimizations ........... : $ASM_OPTIMIZATIONS
843   echo Addressing mode .................. : $ADDRESSING_MODE
844   echo

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines