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.49 by gbeauche, 2002-01-06T08:22:08Z

# Line 5 | Line 5 | 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=yes]], [WANT_VOSF=$enableval], [WANT_VOSF=no])
17 < AC_ARG_ENABLE(16bit-vidmode, [  --enable-16bit-vidmode  enable 16-bit video if possible [default=yes]], [WANT_16BIT_VIDMODE=$enableval], [WANT_16BIT_VIDMODE=yes])
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,
32 < [  --enable-addressing=mode specify the addressing mode to use [default=fastest]],
32 > [  --enable-addressing=AM  specify the addressing mode to use [default=fastest]],
33   [ case "$enableval" in
34      real)       ADDRESSING_TEST_ORDER="real";;
35      direct)     ADDRESSING_TEST_ORDER="direct";;
36      banks)      ADDRESSING_TEST_ORDER="banks";;
37 < dnl fastest)    ADDRESSING_TEST_ORDER="real direct banks";; gb-- will enable later...
38 <    fastest)    ADDRESSING_TEST_ORDER="direct banks";;
22 <    *)          AC_MSG_ERROR([--enable-mem-addressing takes only one of the following values: fastest, real, direct, banks]);;
37 >    fastest)ADDRESSING_TEST_ORDER="direct banks";;
38 >    *)          AC_MSG_ERROR([--enable-addressing takes only one of the following values: fastest, real, direct, banks]);;
39    esac
40   ],
25 dnl [ ADDRESSING_TEST_ORDER="real direct banks" gb-- will probably reactivate later
41   [ ADDRESSING_TEST_ORDER="direct banks"
42   ])
43 +
44 + dnl External packages.
45   AC_ARG_WITH(esd,             [  --with-esd              support ESD for sound under Linux/FreeBSD [default=yes]], [WANT_ESD=$withval], [WANT_ESD=yes])
46   AC_ARG_WITH(gtk,             [  --with-gtk              use GTK user interface [default=yes]], [WANT_GTK=$withval], [WANT_GTK=yes])
47   AC_ARG_WITH(mon,             [  --with-mon              use mon as debugger [default=yes]], [WANT_MON=$withval], [WANT_MON=yes])
# Line 39 | 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/-/_/'`;;
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 47 | Line 65 | dnl Target CPU type.
65   HAVE_I386=no
66   HAVE_M68K=no
67   HAVE_SPARC=no
68 + HAVE_POWERPC=no
69   case "$target_cpu" in
70    i386* | i486* | i586* | i686* | i786* ) CPU_TYPE=i386 HAVE_I386=yes;;
71    m68k* ) CPU_TYPE=m68k HAVE_M68K=yes;;
72    sparc* ) CPU_TYPE=sparc HAVE_SPARC=yes;;
73 <  *) CPU_TYPE=`echo $target_cpu | sed -e 's/-/_/'`;;
73 >  powerpc* ) CPU_TYPE=powerpc HAVE_POWERPC=yes;;
74 >  *) CPU_TYPE=`echo $target_cpu | sed -e 's/-/_/g'`;;
75   esac
76   DEFINES="$DEFINES -DCPU_$CPU_TYPE"
77  
# Line 71 | 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_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"
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"
95      CXXFLAGS="$CXXFLAGS -I$mon_srcdir -I$mon_srcdir/disass"
96      AC_CHECK_LIB(readline, readline)
97      AC_CHECK_LIB(termcap, tputs)
# Line 85 | 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 112 | Line 133 | AC_CHECK_FUNCS(pthread_cancel)
133   dnl If POSIX.4 semaphores are not available, we emulate them with pthread mutexes.
134   SEMSRC=
135   AC_CHECK_FUNCS(sem_init, , [
136 <  if [ "x$HAVE_PTHREADS" = "xyes" ]; then
136 >  if test "x$HAVE_PTHREADS" = "xyes"; then
137      SEMSRC=posix_sem.cpp
138    fi
139   ])
# Line 176 | Line 197 | fi
197  
198   dnl Checks for header files.
199   AC_HEADER_STDC
200 < AC_CHECK_HEADERS(unistd.h fcntl.h sys/time.h)
200 > AC_CHECK_HEADERS(unistd.h fcntl.h sys/time.h sys/mman.h)
201  
202   dnl Checks for typedefs, structures, and compiler characteristics.
203   AC_C_BIGENDIAN
# Line 189 | Line 210 | AC_CHECK_SIZEOF(long long, 8)
210   AC_CHECK_SIZEOF(void *, 4)
211   AC_TYPE_OFF_T
212   AC_CHECK_TYPE(loff_t, off_t)
213 + TYPE_SOCKLEN_T
214   AC_TYPE_SIZE_T
215   AC_TYPE_SIGNAL
216   AC_HEADER_TIME
# Line 197 | Line 219 | AC_STRUCT_TM
219   dnl Checks for library functions.
220   AC_CHECK_FUNCS(strdup cfmakeraw)
221   AC_CHECK_FUNCS(clock_gettime timer_create)
222 + AC_CHECK_FUNCS(sigaction signal)
223 + AC_CHECK_FUNCS(mmap mprotect munmap)
224 + AC_CHECK_FUNCS(vm_allocate vm_deallocate vm_protect)
225 +
226 + dnl Darwin seems to define mach_task_self() instead of task_self().
227 + AC_CHECK_FUNCS(mach_task_self task_self)
228  
229   dnl Select system-dependant source files.
230   SERIALSRC=serial_unix.cpp
# Line 204 | Line 232 | ETHERSRC=../dummy/ether_dummy.cpp
232   SCSISRC=../dummy/scsi_dummy.cpp
233   AUDIOSRC=../dummy/audio_dummy.cpp
234   EXTRASYSSRCS=
235 < SUPPORTS_NATIVE_M68K=no
235 > CAN_NATIVE_M68K=no
236   case "$target_os" in
237   linux*)
238 <  ETHERSRC=Linux/ether_linux.cpp
211 <  SCSISRC=Linux/scsi_linux.cpp
238 >  ETHERSRC=ether_unix.cpp
239    AUDIOSRC=audio_oss_esd.cpp
240 +  SCSISRC=Linux/scsi_linux.cpp
241    ;;
242 < freebsd*3.*)
242 > freebsd*)
243 >  ETHERSRC=ether_unix.cpp
244    AUDIOSRC=audio_oss_esd.cpp
245    DEFINES="$DEFINES -DBSD_COMP"
246 +  CXXFLAGS="$CXXFLAGS -fpermissive"
247    dnl Check for the CAM library
248    AC_CHECK_LIB(cam, cam_open_btl, HAVE_LIBCAM=yes, HAVE_LIBCAM=no)
249    if [[ "x$HAVE_LIBCAM" = "xno" ]]; then
250      AC_MSG_WARN([Cannot find libcam for SCSI management, disabling SCSI support.])
251    else
252      dnl Check for the sys kernel includes
253 <    AC_CHECK_HEADER(/sys/cam/cam.h)
254 <    if [[ "x$ac_cv_header__sys_cam_cam_h" = "xno" ]]; then
253 >    AC_CHECK_HEADER(camlib.h)
254 >    if [[ "x$ac_cv_header_camlib_h" = "xno" ]]; then
255        dnl In this case I should fix this thing including a "patch"
256        dnl to access directly to the functions in the kernel :) --Orlando
257 <      AC_MSG_WARN([Cannot find kernel includes for CAM library, disabling SCSI support.])
257 >      AC_MSG_WARN([Cannot find includes for CAM library, disabling SCSI support.])
258      else
259        SCSISRC=FreeBSD/scsi_freebsd.cpp
230      CXXFLAGS="$CXXFLAGS -I/sys"
231      CFLAGS="$CFLAGS -I/sys"
260        LIBS="$LIBS -lcam"
261        DEFINES="$DEFINES -DCAM"
262      fi
263    fi
264    ;;
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  ;;
265   netbsd*)
266 <  SUPPORTS_NATIVE_M68K=yes
266 >  CAN_NATIVE_M68K=yes
267    ;;
268   solaris*)
269    AUDIOSRC=Solaris/audio_solaris.cpp
270    DEFINES="$DEFINES -DBSD_COMP -D_POSIX_PTHREAD_SEMANTICS"
271    ;;
272   irix*)
273 +  ETHERSRC=ether_unix.cpp
274 +  AUDIOSRC=Irix/audio_irix.cpp
275    EXTRASYSSRCS=Irix/unaligned.c
276 <  DEFINES="$DEFINES -DCRTSCTS=CNEW_RTSCTS -DB230400=B115200"
277 <  LIBS="$LIBS -lm"
276 >  dnl IRIX headers work fine, but somehow don't define or use "STDC_HEADERS"
277 >  DEFINES="$DEFINES -DCRTSCTS=CNEW_RTSCTS -DB230400=B115200 -DSTDC_HEADERS"
278 >  LIBS="$LIBS -laudio"
279 >  WANT_ESD=no
280 >
281 >  dnl Check if our compiler supports -Ofast (MIPSPro)
282 >  HAVE_OFAST=no
283 >  ocflags="$CFLAGS"
284 >  CFLAGS=`echo $CFLAGS | sed -e 's/ -g / -Ofast /;s/^-g /-Ofast /;s/-g$/ -Ofast/;s/^-g$/-Ofast/'`
285 >  AC_MSG_CHECKING(if "-Ofast" works)
286 >  dnl Do a test compile of an empty function
287 >  AC_TRY_COMPILE(,, [AC_MSG_RESULT(yes); HAVE_OFAST=yes], AC_MSG_RESULT(no))
288 >  CFLAGS="$ocflags"
289 >
290    ;;
291   esac
292  
293 + dnl Use 68k CPU natively?
294 + WANT_NATIVE_M68K=no
295 + if [[ "x$HAVE_M68K" = "xyes" -a "x$CAN_NATIVE_M68K" = "xyes" ]]; then
296 +  AC_DEFINE(ENABLE_NATIVE_M68K)
297 +  WANT_NATIVE_M68K=yes
298 + fi
299 +
300   if [[ "x$HAVE_PTHREADS" = "xno" ]]; then
301    dnl Serial, ethernet and audio support needs pthreads
302    AC_MSG_WARN([You don't have pthreads, disabling serial, ethernet and audio support.])
# Line 279 | Line 311 | dnl to be put into the config.h file
311   dnl $1 -- the macro to define
312   dnl $2 -- the value to translate
313   AC_DEFUN(AC_TRANSLATE_DEFINE, [
314 <    if [[ "x$2" = "xyes" ]]; then
314 >    if [[ "x$2" = "xyes" -o "x$2" = "xguessing yes" ]]; then
315          AC_DEFINE($1)
316      fi
317   ])
318  
319 + dnl Various checks if the system supports vm_allocate() and the like functions.
320 + have_mach_vm=no
321 + if [[ "x$ac_cv_func_vm_allocate" = "xyes" -a "x$ac_cv_func_vm_deallocate" = "xyes" -a \
322 +      "x$ac_cv_func_vm_protect" = "xyes" ]]; then
323 +  have_mach_vm=yes
324 + fi
325 + AC_TRANSLATE_DEFINE(HAVE_MACH_VM, "$have_mach_vm")
326 +
327 + dnl Check that vm_allocate(), vm_protect() work
328 + if [[ "x$have_mach_vm" = "xyes" ]]; then
329 +
330 + AC_CACHE_CHECK("whether vm_protect works",
331 +  ac_cv_vm_protect_works, [
332 +  AC_LANG_SAVE
333 +  AC_LANG_CPLUSPLUS
334 +  ac_cv_vm_protect_works=yes
335 +  dnl First the tests that should segfault
336 +  for test_def in NONE_READ NONE_WRITE READ_WRITE; do
337 +    AC_TRY_RUN([
338 +      #define CONFIGURE_TEST_VM_MAP
339 +      #define TEST_VM_PROT_$test_def
340 +      #include "vm_alloc.cpp"
341 +    ], ac_cv_vm_protect_works=no, rm -f core,
342 +    dnl When cross-compiling, do not assume anything
343 +    ac_cv_vm_protect_works="guessing no"
344 +    )
345 +  done
346 +  AC_TRY_RUN([
347 +    #define CONFIGURE_TEST_VM_MAP
348 +    #define TEST_VM_PROT_RDWR_WRITE
349 +    #include "vm_alloc.cpp"
350 +  ], , ac_cv_vm_protect_works=no,
351 +  dnl When cross-compiling, do not assume anything
352 +  ac_cv_vm_protect_works="guessing no"
353 +  )
354 +  AC_LANG_RESTORE
355 +  ]
356 + )
357 +
358 + dnl Remove support for vm_allocate() if vm_protect() does not work
359 + if [[ "x$have_mach_vm" = "xyes" ]]; then
360 +  case $ac_cv_vm_protect_works in
361 +    *yes) have_mach_vm=yes;;
362 +    *no) have_mach_vm=no;;
363 +  esac
364 + fi
365 + AC_TRANSLATE_DEFINE(HAVE_MACH_VM, "$have_mach_vm")
366 +
367 + fi dnl HAVE_MACH_VM
368 +
369 + dnl Various checks if the system supports mmap() and the like functions.
370 + dnl ... and Mach memory allocators are not supported
371 + have_mmap_vm=no
372 + if [[ "x$ac_cv_func_mmap" = "xyes" -a "x$ac_cv_func_munmap" = "xyes" -a \
373 +      "x$ac_cv_func_mprotect" = "xyes" ]]; then
374 +  if [[ "x$have_mach_vm" = "xno" ]]; then
375 +    have_mmap_vm=yes
376 +  fi
377 + fi
378 + AC_TRANSLATE_DEFINE(HAVE_MMAP_VM, "$have_mmap_vm")
379 +
380 + dnl Check that mmap() and associated functions work.
381 + if [[ "x$have_mmap_vm" = "xyes" ]]; then
382 +
383 + dnl Check if we have a working anonymous mmap()
384 + AC_CACHE_CHECK("whether mmap supports MAP_ANON",
385 +  ac_cv_mmap_anon, [
386 +  AC_LANG_SAVE
387 +  AC_LANG_CPLUSPLUS
388 +  AC_TRY_RUN([
389 +    #define HAVE_MMAP_ANON
390 +    #define CONFIGURE_TEST_VM_MAP
391 +    #define TEST_VM_MMAP_ANON
392 +    #include "vm_alloc.cpp"
393 +  ], ac_cv_mmap_anon=yes, ac_cv_mmap_anon=no,
394 +  dnl When cross-compiling, do not assume anything.
395 +  ac_cv_mmap_anon="guessing no"
396 +  )
397 +  AC_LANG_RESTORE
398 +  ]
399 + )
400 + AC_TRANSLATE_DEFINE(HAVE_MMAP_ANON, "$ac_cv_mmap_anon")
401 +
402 + AC_CACHE_CHECK("whether mmap supports MAP_ANONYMOUS",
403 +  ac_cv_mmap_anonymous, [
404 +  AC_LANG_SAVE
405 +  AC_LANG_CPLUSPLUS
406 +  AC_TRY_RUN([
407 +    #define HAVE_MMAP_ANONYMOUS
408 +    #define CONFIGURE_TEST_VM_MAP
409 +    #define TEST_VM_MMAP_ANON
410 +    #include "vm_alloc.cpp"
411 +  ], ac_cv_mmap_anonymous=yes, ac_cv_mmap_anonymous=no,
412 +  dnl When cross-compiling, do not assume anything.
413 +  ac_cv_mmap_anonymous="guessing no"
414 +  )
415 +  AC_LANG_RESTORE
416 +  ]
417 + )
418 + AC_TRANSLATE_DEFINE(HAVE_MMAP_ANONYMOUS, "$ac_cv_mmap_anonymous")
419 +
420 + AC_CACHE_CHECK("whether mprotect works",
421 +  ac_cv_mprotect_works, [
422 +  AC_LANG_SAVE
423 +  AC_LANG_CPLUSPLUS
424 +  ac_cv_mprotect_works=yes
425 +  dnl First the tests that should segfault
426 +  for test_def in NONE_READ NONE_WRITE READ_WRITE; do
427 +    AC_TRY_RUN([
428 +      #define CONFIGURE_TEST_VM_MAP
429 +      #define TEST_VM_PROT_$test_def
430 +      #include "vm_alloc.cpp"
431 +    ], ac_cv_mprotect_works=no, rm -f core,
432 +    dnl When cross-compiling, do not assume anything
433 +    ac_cv_mprotect_works="guessing no"
434 +    )
435 +  done
436 +  AC_TRY_RUN([
437 +    #define CONFIGURE_TEST_VM_MAP
438 +    #define TEST_VM_PROT_RDWR_WRITE
439 +    #include "vm_alloc.cpp"
440 +  ], , ac_cv_mprotect_works=no,
441 +  dnl When cross-compiling, do not assume anything
442 +  ac_cv_mprotect_works="guessing no"
443 +  )
444 +  AC_LANG_RESTORE
445 +  ]
446 + )
447 +
448 + dnl Remove support for mmap() if mprotect() does not work
449 + if [[ "x$have_mmap_vm" = "xyes" ]]; then
450 +  case $ac_cv_mprotect_works in
451 +    *yes) have_mmap_vm=yes;;
452 +    *no) have_mmap_vm=no;;
453 +  esac
454 + fi
455 + AC_TRANSLATE_DEFINE(HAVE_MMAP_VM, $have_mmap_vm)
456 +
457 + fi dnl HAVE_MMAP_VM
458 +
459   dnl Check if we can mmap 0x2000 bytes from 0x0000
460   AC_CACHE_CHECK("whether we can map Low Memory area 0x0000-0x2000",
461    ac_cv_can_map_lm, [
462    AC_LANG_SAVE
463    AC_LANG_CPLUSPLUS
464    AC_TRY_RUN([
465 <    #include <unistd.h>
466 <    #include <fcntl.h>
467 <    #include <sys/mman.h>
468 <    
469 <    int main()
470 <    { int zero_fd; char * lm;
471 <      if ((zero_fd = open("/dev/zero", O_RDWR)) < 0) exit(1);
472 <      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);
465 >    #include "vm_alloc.cpp"
466 >    int main(void) { /* returns 0 if we could map the lowmem globals */
467 >      volatile char * lm;
468 >      if (vm_init() < 0) exit(1);
469 >      if ((lm = (volatile char *)vm_acquire_fixed(0, 0x2000)) == VM_MAP_FAILED) exit(1);
470 >      lm[0] = 'z';
471 >      if (vm_release((char *)lm, 0x2000) < 0) exit(1);
472 >      vm_exit(); exit(0);
473      }
474 <  ],
475 <  [ac_cv_can_map_lm=yes],
476 <  [ac_cv_can_map_lm=no]
474 >  ], ac_cv_can_map_lm=yes, ac_cv_can_map_lm=no,
475 >  dnl When cross-compiling, do not assume anything.
476 >  ac_cv_can_map_lm="guessing no"
477    )
478    AC_LANG_RESTORE
479    ]
480   )
481  
482 < dnl Check if extended signals are supported.
483 < AC_CACHE_CHECK("whether your system supports extended signal handlers",
484 <  ac_cv_have_extended_signals, [
482 > dnl Check signal handlers need to be reinstalled
483 > AC_CACHE_CHECK("whether signal handlers need to be reinstalled",
484 >  ac_cv_signal_need_reinstall, [
485    AC_LANG_SAVE
486    AC_LANG_CPLUSPLUS
487    AC_TRY_RUN([
488 +    #include <stdlib.h>
489 +    #ifdef HAVE_UNISTD_H
490      #include <unistd.h>
491 +    #endif
492      #include <signal.h>
493 <    #include <fcntl.h>
494 <    #include <sys/mman.h>
495 <
496 <    static volatile caddr_t mem = 0;
497 <    static int zero_fd = -1;
493 >    static int handled_signal = 0;
494 >    RETSIGTYPE sigusr1_handler(int) { handled_signal++; }
495 >    int main(void) { /* returns 0 if signals need not to be reinstalled */
496 >      signal(SIGUSR1, sigusr1_handler); raise(SIGUSR1); raise(SIGUSR1);
497 >      exit(handled_signal == 2);
498 >    }
499 >  ], ac_cv_signal_need_reinstall=yes, ac_cv_signal_need_reinstall=no,
500 >  dnl When cross-compiling, do not assume anything.
501 >  ac_cv_signal_need_reinstall="guessing yes"
502 >  )
503 >  AC_LANG_RESTORE
504 >  ]
505 > )
506 > AC_TRANSLATE_DEFINE(SIGNAL_NEED_REINSTALL, "$ac_cv_signal_need_reinstall")
507  
508 <    static RETSIGTYPE segfault_handler(int, siginfo_t * sip, void *)
509 <    { if ((caddr_t)(sip->si_addr) != mem) exit(1);
510 <      munmap(mem, getpagesize()); close(zero_fd); exit(0); }
511 <
512 <    int main()
513 <    { if ((zero_fd = open("/dev/zero", O_RDWR)) < 0) exit(1);
514 <      if ((mem = (caddr_t)mmap(0, getpagesize(), PROT_READ, MAP_PRIVATE, zero_fd, 0)) == (caddr_t)MAP_FAILED) exit(1);
515 <      struct sigaction sa; sa.sa_sigaction = segfault_handler; sa.sa_flags = 0;
516 <      sigaction(SIGSEGV, &sa, 0);
517 <      mem[0] = 0;
518 <      exit(1); // should not be reached
508 > dnl Check if sigaction handlers need to be reinstalled
509 > AC_CACHE_CHECK("whether sigaction handlers need to be reinstalled",
510 >  ac_cv_sigaction_need_reinstall, [
511 >  AC_LANG_SAVE
512 >  AC_LANG_CPLUSPLUS
513 >  AC_TRY_RUN([
514 >    #include <stdlib.h>
515 >    #ifdef HAVE_UNISTD_H
516 >    #include <unistd.h>
517 >    #endif
518 >    #include <signal.h>
519 >    static int handled_signal = 0;
520 >    RETSIGTYPE sigusr1_handler(int) { handled_signal++; }
521 >    typedef RETSIGTYPE (*signal_handler)(int);
522 >    static signal_handler mysignal(int sig, signal_handler handler) {
523 >      struct sigaction old_sa;
524 >      struct sigaction new_sa;
525 >      new_sa.sa_handler = handler;
526 >      return ((sigaction(sig,&new_sa,&old_sa) < 0) ? SIG_IGN : old_sa.sa_handler);
527 >    }
528 >    int main(void) { /* returns 0 if signals need not to be reinstalled */
529 >      mysignal(SIGUSR1, sigusr1_handler); raise(SIGUSR1); raise(SIGUSR1);
530 >      exit(handled_signal == 2);
531      }
532 <  ],
533 <  [ac_cv_have_extended_signals=yes],
534 <  [ac_cv_have_extended_signals=no]
532 >  ], ac_cv_sigaction_need_reinstall=yes, ac_cv_sigaction_need_reinstall=no,
533 >  dnl When cross-compiling, do not assume anything.
534 >  ac_cv_sigaction_need_reinstall="guessing yes"
535 >  )
536 >  AC_LANG_RESTORE
537 >  ]
538 > )
539 > AC_TRANSLATE_DEFINE(SIGACTION_NEED_REINSTALL, "$ac_cv_sigaction_need_reinstall")
540 >
541 > dnl Check if extended signals are supported.
542 > AC_CACHE_CHECK("whether your system supports extended signal handlers",
543 >  ac_cv_have_extended_signals, [
544 >  AC_LANG_SAVE
545 >  AC_LANG_CPLUSPLUS
546 >  AC_TRY_RUN([
547 >    #define HAVE_SIGINFO_T 1
548 >    #define CONFIGURE_TEST_SIGSEGV_RECOVERY
549 >    #include "vm_alloc.cpp"
550 >    #include "sigsegv.cpp"
551 >  ], ac_cv_have_extended_signals=yes, ac_cv_have_extended_signals=no,
552 >  dnl When cross-compiling, do not assume anything.
553 >  ac_cv_have_extended_signals=no
554    )
555    AC_LANG_RESTORE
556    ]
# Line 348 | Line 559 | AC_TRANSLATE_DEFINE(HAVE_SIGINFO_T, "$ac
559  
560   dnl Otherwise, check for subterfuges.
561   if [[ "x$ac_cv_have_extended_signals" = "xno" ]]; then
562 <  case "$target_os" in
563 <    linux*)
564 <      if [[ "x$HAVE_I386" = "xyes" ]]; then
565 <        AC_CACHE_CHECK("whether we then have a subterfuge for your system",
566 <                  ac_cv_have_sigcontext_hack, [
567 <          AC_LANG_SAVE
568 <          AC_LANG_CPLUSPLUS
569 <          AC_TRY_RUN([
570 <            #include <unistd.h>
571 <            #include <signal.h>
572 <            #include <fcntl.h>
573 <            #include <sys/mman.h>
574 <
575 <            static volatile caddr_t mem = 0;
576 <            static int zero_fd = -1;
577 <
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
562 >  AC_CACHE_CHECK("whether we then have a subterfuge for your system",
563 >  ac_cv_have_sigcontext_hack, [
564 >    AC_LANG_SAVE
565 >    AC_LANG_CPLUSPLUS
566 >    AC_TRY_RUN([
567 >      #define HAVE_SIGCONTEXT_SUBTERFUGE 1
568 >      #define CONFIGURE_TEST_SIGSEGV_RECOVERY
569 >      #include "vm_alloc.cpp"
570 >      #include "sigsegv.cpp"
571 >    ], ac_cv_have_sigcontext_hack=yes, ac_cv_have_sigcontext_hack=no,
572 >    dnl When cross-compiling, do not assume anything.
573 >    ac_cv_have_sigcontext_hack=no
574 >    )
575 >    AC_LANG_RESTORE
576 >  ])
577 >  AC_TRANSLATE_DEFINE(HAVE_SIGCONTEXT_SUBTERFUGE, "$ac_cv_have_sigcontext_hack")
578   fi
579  
580   dnl Can we do Video on SEGV Signals ?
# Line 396 | Line 584 | if [[ "$ac_cv_have_extended_signals" = "
584   fi
585  
586   dnl Determine the addressing mode to use
587 < ADDRESSING_MODE=""
588 < AC_MSG_CHECKING([for the addressing mode to use])
589 < for am in $ADDRESSING_TEST_ORDER; do
590 <  case $am in
591 <  real)
592 <    dnl Requires ability to mmap Low Memory globals.
593 <    if [[ "x$ac_cv_can_map_lm" = "xno" ]]; then
594 <      continue
595 <    fi
596 <    if [[ "x$ac_cv_c_bigendian" = "xyes" ]]; then
597 <      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"
587 > if [[ "x$WANT_NATIVE_M68K" = "xyes" ]]; then
588 >  ADDRESSING_MODE="real"
589 > else
590 >  ADDRESSING_MODE=""
591 >  AC_MSG_CHECKING([for the addressing mode to use])
592 >  for am in $ADDRESSING_TEST_ORDER; do
593 >    case $am in
594 >    real)
595 >      dnl Requires ability to mmap() Low Memory globals
596 >      if [[ "x$ac_cv_can_map_lm" = "xno" ]]; then
597 >        continue
598        fi
599 <    else
418 <      dnl Requires VOSF
599 >          dnl Requires VOSF screen updates
600        if [[ "x$CAN_VOSF" = "xno" ]]; then
601          continue
602        fi
603 <    fi
604 <    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"
603 >      dnl Real addressing will probably work.
604 >      ADDRESSING_MODE="real"
605        WANT_VOSF=yes dnl we can use VOSF and we need it actually
606 <      DEFINES="$DEFINES -DDIRECT_ADDRESSING"
606 >      DEFINES="$DEFINES -DREAL_ADDRESSING"
607        break
608 <    fi
609 <    ;;
610 <  banks)
611 <    dnl Default addressing mode
608 >      ;;
609 >    direct)
610 >      dnl Requires VOSF screen updates
611 >      if [[ "x$CAN_VOSF" = "xyes" ]]; then
612 >        ADDRESSING_MODE="direct"
613 >        WANT_VOSF=yes dnl we can use VOSF and we need it actually
614 >        DEFINES="$DEFINES -DDIRECT_ADDRESSING"
615 >        break
616 >      fi
617 >      ;;
618 >    banks)
619 >      dnl Default addressing mode
620 >      ADDRESSING_MODE="memory banks"
621 >      break
622 >      ;;
623 >    *)
624 >      AC_MSG_ERROR([Internal configure.in script error for $am addressing mode])
625 >    esac
626 >  done
627 >  AC_MSG_RESULT($ADDRESSING_MODE)
628 >  if [[ "x$ADDRESSING_MODE" = "x" ]]; then
629 >    AC_MSG_WARN([Sorry, no suitable addressing mode in $ADDRESSING_TEST_ORDER])
630      ADDRESSING_MODE="memory banks"
631 <    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"
631 >  fi
632   fi
633  
634 < dnl Since real and direct addressing modes automatically activate VOSF,
635 < 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
634 > dnl Enable VOSF screen updates with this feature is requested and feasible
635 > if [[ "x$WANT_VOSF" = "xyes" -a "x$CAN_VOSF" = "xyes" ]]; then
636      AC_DEFINE(ENABLE_VOSF)
637 <  fi
637 > else
638 >    WANT_VOSF=no
639   fi
640  
641   dnl Check for GAS.
# Line 480 | Line 657 | AC_EGREP_CPP(yes,
657   #endif
658   ], [AC_MSG_RESULT(yes); HAVE_GCC27=yes], AC_MSG_RESULT(no))
659  
660 + dnl Check for GCC 3.0 or higher.
661 + HAVE_GCC30=no
662 + AC_MSG_CHECKING(for GCC 3.0 or higher)
663 + AC_EGREP_CPP(yes,
664 + [#if __GNUC__ >= 3
665 +  yes
666 + #endif
667 + ], [AC_MSG_RESULT(yes); HAVE_GCC30=yes], AC_MSG_RESULT(no))
668 +
669   dnl Set "-fomit-frame-pointer" on i386 GCC 2.7 or higher.
670   if [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_I386" = "xyes" ]]; then
671    CFLAGS="$CFLAGS -fomit-frame-pointer"
672    CXXFLAGS="$CXXFLAGS -fomit-frame-pointer"
673   fi
674  
675 + dnl (gb) Do not merge constants since it breaks fpu/fpu_x86.cpp.
676 + dnl As of 2001/08/02, this affects the following compilers:
677 + dnl Official: probably gcc-3.1 (mainline CVS)
678 + dnl Mandrake: gcc-2.96 >= 0.59mdk, gcc-3.0.1 >= 0.1mdk
679 + dnl Red Hat : gcc-2.96 >= 89, gcc-3.0 >= 1
680 + if [[ "x$HAVE_GCC27" = "xyes" ]]; then
681 +  SAVED_CXXFLAGS="$CXXFLAGS"
682 +  CXXFLAGS="$CXXFLAGS -fno-merge-constants"
683 +  AC_CACHE_CHECK([whether GCC supports constants merging], ac_cv_gcc_constants_merging, [
684 +    AC_LANG_SAVE
685 +    AC_LANG_CPLUSPLUS
686 +    AC_TRY_COMPILE([],[],[ac_cv_gcc_constants_merging=yes],[ac_cv_gcc_constants_merging=no])
687 +    AC_LANG_RESTORE
688 +  ])
689 +  if [[ "x$ac_cv_gcc_constants_merging" != "xyes" ]]; then
690 +    CXXFLAGS="$SAVED_CXXFLAGS"
691 +  fi
692 + fi
693 +
694   dnl Select appropriate CPU source and REGPARAM define.
695   ASM_OPTIMIZATIONS=none
491 WANT_NATIVE_M68K=no
696   CPUSRCS="cpuemu1.cpp cpuemu2.cpp cpuemu3.cpp cpuemu4.cpp cpuemu5.cpp cpuemu6.cpp cpuemu7.cpp cpuemu8.cpp"
697 < FPUSRCS="../uae_cpu/fpp.cpp"
698 < if [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_I386" = "xyes" ]]; then
697 > FPUSRCS="../uae_cpu/fpu/fpu_uae.cpp"
698 > if [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_I386" = "xyes" -a "x$OS_TYPE" != "xfreebsd" ]]; then
699    dnl i386 CPU
700    DEFINES="$DEFINES -DREGPARAM=\"__attribute__((regparm(3)))\""
701    if [[ "x$HAVE_GAS" = "xyes" ]]; then
702      ASM_OPTIMIZATIONS=i386
703 <    DEFINES="$DEFINES -DX86_ASSEMBLY -DOPTFLAGS"
704 <    CPUSRCS="../uae_cpu/compiler.cpp cpufast1.s cpufast2.s cpufast3.s cpufast4.s cpufast5.s cpufast6.s cpufast7.s cpufast8.s"
703 >    DEFINES="$DEFINES -DX86_ASSEMBLY -DUNALIGNED_PROFITABLE -DOPTIMIZED_FLAGS"
704 >    CPUSRCS="cpufast1.s cpufast2.s cpufast3.s cpufast4.s cpufast5.s cpufast6.s cpufast7.s cpufast8.s"
705      FPUSRCS="../uae_cpu/fpu_x86.cpp"
706    fi
707   elif [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_SPARC" = "xyes" -a "x$HAVE_GAS" = "xyes" ]]; then
# Line 509 | Line 713 | elif [[ "x$HAVE_GCC27" = "xyes" -a "x$HA
713      AC_MSG_RESULT($SPARC_TYPE)
714      case "$SPARC_TYPE" in
715      SPARC_V8)
716 <          ASM_OPTIMIZATIONS="SPARC V8 architecture"
717 <      DEFINES="$DEFINES -DSPARC_V8_ASSEMBLY" dnl -DOPTFLAGS"
716 >      ASM_OPTIMIZATIONS="SPARC V8 architecture"
717 >      DEFINES="$DEFINES -DSPARC_V8_ASSEMBLY" dnl -DOPTIMIZED_FLAGS"
718        CFLAGS="$CFLAGS -Wa,-Av8"
719        CXXFLAGS="$CXXFLAGS -Wa,-Av8"
720        ;;
721      SPARC_V9)
722 <          ASM_OPTIMIZATIONS="SPARC V9 architecture"
723 <      DEFINES="$DEFINES -DSPARC_V9_ASSEMBLY" dnl -DOPTFLAGS"
722 >      ASM_OPTIMIZATIONS="SPARC V9 architecture"
723 >      DEFINES="$DEFINES -DSPARC_V9_ASSEMBLY" dnl -DOPTIMIZED_FLAGS"
724        CFLAGS="$CFLAGS -Wa,-Av9"
725        CXXFLAGS="$CXXFLAGS -Wa,-Av9"
726        ;;
727      esac
728      ;;
729    esac
730 < elif [[ "x$HAVE_M68K" = "xyes" -a "x$SUPPORTS_NATIVE_M68K" = "xyes" ]]; then
730 > elif [[ "x$WANT_NATIVE_M68K" = "xyes" ]]; then
731    dnl Native m68k, no emulation
732 <  CPUSRCS=""
733 <  AC_DEFINE(ENABLE_NATIVE_M68K)
530 <  WANT_NATIVE_M68K=yes
732 >  CPUINCLUDES="-I../native_cpu"
733 >  CPUSRCS="asm_support.s"
734   fi
735  
736 + dnl Select appropriate FPU source.
737 + dnl 1. Optimized X86 assembly core if target is i386 architecture
738 + SAVED_DEFINES=$DEFINES
739 + if [[ "x$FPE_CORE" = "xdefault" ]]; then
740 +  if [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_I386" = "xyes" -a "x$HAVE_GAS" = "xyes" ]]; then
741 +    DEFINES="$DEFINES -DFPU_X86"
742 +    FPE_CORE_STR="i386 optimized core"
743 +    FPUSRCS="../uae_cpu/fpu/fpu_x86.cpp"
744 +    FPE_CORE="i386"
745 +  else
746 +    FPE_CORE="uae"
747 +  fi
748 + fi
749 +
750 + dnl 2. JIT-FPU only supports IEEE-based implementation.
751 + if [[ "x$WANT_JIT_FPU" = "xyes" -a "x$FPE_CORE" != "xieee" ]]; then
752 +  AC_MSG_WARN([Sorry, JIT-FPU supports only the "ieee" FPE implementation])
753 +  FPE_CORE="ieee"
754 +  dnl Restore previous variables. FPE_CORE_STR and FPUSRCS are overwritten
755 +  DEFINES=$SAVED_DEFINES
756 + fi
757 +
758 + dnl 3. Choose either IEEE-based implementation or the old UAE core
759 + if [[ "x$FPE_CORE" = "xieee" ]]; then
760 +  AC_CHECK_HEADERS(fenv.h)
761 +  AC_CHECK_FUNCS(feclearexcept fegetexceptflag feraiseexcept fesetexceptflag fetestexcept)
762 +  AC_CHECK_FUNCS(fegetround fesetround)
763 +  DEFINES="$DEFINES -DFPU_IEEE"
764 +  FPE_CORE_STR="ieee-based fpu core"
765 +  FPUSRCS="../uae_cpu/fpu/fpu_ieee.cpp"
766 + elif [[ "x$FPE_CORE" = "xuae" ]]; then
767 +  DEFINES="$DEFINES -DFPU_UAE"
768 +  FPE_CORE_STR="original uae core"
769 +  FPUSRCS="../uae_cpu/fpu/fpu_uae.cpp"
770 + fi
771 +
772 + dnl Check for certain math functions
773 + AC_CHECK_FUNCS(atanh)
774 + AC_CHECK_FUNCS(isnan isinf)             dnl C99
775 + AC_CHECK_FUNCS(isnanl isinfl)   dnl IEEE ?
776 +
777   dnl UAE CPU sources for all non-m68k-native architectures.
778   if [[ "x$WANT_NATIVE_M68K" = "xno" ]]; then
779    CPUINCLUDES="-I../uae_cpu"
780    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"
781   fi
782  
783   dnl Remove the "-g" option if set for GCC.
784   if [[ "x$HAVE_GCC27" = "xyes" ]]; then
785 <        dnl gb-- Probably not the cleanest way to take
786 <        CFLAGS=`echo $CFLAGS | sed -e 's/ -g / /;s/^-g / /;s/ -g$/ /;s/^-g$//'`
787 <        CXXFLAGS=`echo $CXXFLAGS | sed -e 's/ -g / /;s/^-g / /;s/ -g$/ /;s/^-g$//'`
785 >  CFLAGS=`echo $CFLAGS | sed -e 's/-g//g'`
786 >  CXXFLAGS=`echo $CXXFLAGS | sed -e 's/-g//g'`
787 > fi
788 >
789 > dnl Or if we have -Ofast
790 > if [[ "x$HAVE_OFAST" = "xyes" ]]; then
791 >  CFLAGS="`echo $CFLAGS | sed -e 's/-g//g'` -Ofast"
792 >  CXXFLAGS="`echo $CXXFLAGS | sed -e 's/-g//g'` -Ofast"
793 >  CXXFLAGS="-LANG:std $CXXFLAGS"
794 >  LDFLAGS="$LDFLAGS -Ofast"
795   fi
796  
797   dnl Generate Makefile.
# Line 565 | Line 813 | echo ESD sound support ................
813   echo GTK user interface ............... : $WANT_GTK
814   echo mon debugger support ............. : $WANT_MON
815   echo Running m68k code natively ....... : $WANT_NATIVE_M68K
816 + echo Floating-Point emulation core .... : $FPE_CORE_STR
817   echo Assembly optimizations ........... : $ASM_OPTIMIZATIONS
818   echo Addressing mode .................. : $ADDRESSING_MODE
819   echo

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines