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.58 by gbeauche, 2002-03-18T13:30:07Z

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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines