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

Comparing SheepShaver/src/Unix/configure.in (file contents):
Revision 1.2 by gbeauche, 2002-04-21T11:21:26Z vs.
Revision 1.25 by gbeauche, 2004-06-22T22:41:44Z

# Line 5 | Line 5 | AC_INIT(main_unix.cpp)
5   AC_PREREQ(2.12)
6   AC_CONFIG_HEADER(config.h)
7  
8 + dnl Canonical system information.
9 + AC_CANONICAL_HOST
10 + AC_CANONICAL_TARGET
11 +
12   dnl Options.
13 + AC_ARG_ENABLE(jit,          [  --enable-jit            enable JIT compiler [default=yes]], [WANT_JIT=$enableval], [WANT_JIT=yes])
14 + AC_ARG_ENABLE(ppc-emulator, [  --enable-ppc-emulator   use the selected PowerPC emulator [default=auto]], [WANT_EMULATED_PPC=$enableval], [WANT_EMULATED_PPC=auto])
15   AC_ARG_ENABLE(xf86-dga,     [  --enable-xf86-dga       use the XFree86 DGA extension [default=yes]], [WANT_XF86_DGA=$enableval], [WANT_XF86_DGA=yes])
16 < AC_ARG_ENABLE(xf86-vidmode, [  --enable-xf86-vidmode   use the XFree86 VidMode extension [default=yes]], [WANT_XF86_VIDMODE=$enableval], [WANT_XF86_VIDMODE=yes])
16 > AC_ARG_ENABLE(xf86-vidmode, [  --enable-xf86-vidmode   use the XFree86 VidMode extension [default=no]], [WANT_XF86_VIDMODE=$enableval], [WANT_XF86_VIDMODE=no])
17 > AC_ARG_ENABLE(vosf,         [  --enable-vosf           enable video on SEGV signals [default=yes]], [WANT_VOSF=$enableval], [WANT_VOSF=yes])
18   AC_ARG_WITH(esd,            [  --with-esd              support ESD for sound under Linux/FreeBSD [default=yes]], [WANT_ESD=$withval], [WANT_ESD=yes])
19   AC_ARG_WITH(gtk,            [  --with-gtk              use GTK user interface [default=yes]], [WANT_GTK=$withval], [WANT_GTK=yes])
20   AC_ARG_WITH(mon,            [  --with-mon              use mon as debugger [default=yes]], [WANT_MON=$withval], [WANT_MON=yes])
21 + AC_ARG_WITH(dgcc,           [  --with-dgcc=COMPILER    use C++ COMPILER to compile synthetic opcodes], [DYNGEN_CC=$withval])
22  
23   dnl Checks for programs.
24   AC_PROG_CC
# Line 27 | Line 35 | AC_EGREP_CPP(yes,
35   #ifdef __powerpc__
36    yes
37   #endif
38 + #ifdef __ppc__
39 +  yes
40 + #endif
41   ], [AC_MSG_RESULT(yes); HAVE_PPC=yes], AC_MSG_RESULT(no))
42  
43 + dnl We use native CPU if possible.
44 + EMULATED_PPC=yes
45 + case $WANT_EMULATED_PPC in
46 +  auto) [[ "x$HAVE_PPC" = "xyes" ]] && EMULATED_PPC=no;;
47 +  no)   EMULATED_PPC=no;;
48 + esac
49 + if [[ "x$EMULATED_PPC" = "xyes" ]]; then
50 +  AC_DEFINE(EMULATED_PPC)
51 + fi
52 +
53   dnl We use mon if possible.
54   MONSRCS=
55 + case "x$WANT_MON" in
56 + x/* | x.*)
57 +  mon_srcdir=$WANT_MON
58 +  WANT_MON=yes
59 +  ;;
60 + xyes)
61 +  mon_srcdir=../../../mon/src
62 +  ;;
63 + esac
64   if [[ "x$WANT_MON" = "xyes" ]]; then
65    AC_MSG_CHECKING(for mon)
36  mon_srcdir=../../../mon/src
66    if grep mon_init $mon_srcdir/mon.h >/dev/null 2>/dev/null; then
67      AC_MSG_RESULT(yes)
68      AC_DEFINE(ENABLE_MON)
# Line 68 | Line 97 | LIBS="$LIBS $X_PRE_LIBS $X_LIBS -lX11 -l
97  
98   dnl We need pthreads on non-PowerPC systems. Try libpthread first, then libc_r (FreeBSD), then PTL.
99   HAVE_PTHREADS=yes
100 < if [[ "x$HAVE_PPC" = "xno" ]]; then
100 > case $EMULATED_PPC:$target_os in
101 > no:linux*)
102 >  dnl We do have our own pthread_cancel() implementation
103 >  AC_DEFINE(HAVE_PTHREAD_CANCEL, 1, [Define if you have the pthread_cancel function.])
104 >  ;;
105 > *:*)
106    AC_CHECK_LIB(pthread, pthread_create, , [
107      AC_CHECK_LIB(c_r, pthread_create, , [
108        AC_CHECK_LIB(PTL, pthread_create, , [
# Line 77 | Line 111 | if [[ "x$HAVE_PPC" = "xno" ]]; then
111      ])
112    ])
113    AC_CHECK_FUNCS(pthread_cancel)
114 < fi
115 <
116 < dnl If POSIX.4 semaphores are not available, we emulate them with pthread mutexes.
83 < SEMSRC=
84 < AC_CHECK_FUNCS(sem_init, , [
114 >  AC_CHECK_FUNCS(pthread_mutexattr_setprotocol)
115 >  AC_CHECK_FUNCS(pthread_mutexattr_settype)
116 >  AC_CHECK_FUNCS(pthread_mutexattr_setpshared)
117    if [[ "x$HAVE_PTHREADS" = "xyes" ]]; then
118 +    AC_DEFINE(HAVE_PTHREADS, 1, [Define if pthreads are available.])
119 +  fi
120 +  dnl If POSIX.4 semaphores are not available, we emulate them with pthread mutexes.
121 +  SEMSRC=
122 +  AC_CHECK_FUNCS(sem_init, , [
123 +  if test "x$HAVE_PTHREADS" = "xyes"; then
124      SEMSRC=posix_sem.cpp
125    fi
126 < ])
126 >  ])
127 >  ;;
128 > esac
129  
130   dnl We use XFree86 DGA if possible.
131   if [[ "x$WANT_XF86_DGA" = "xyes" ]]; then
# Line 110 | Line 150 | if [[ "x$WANT_XF86_VIDMODE" = "xyes" ]];
150   fi
151  
152   dnl We use GTK+ if possible.
153 < UISRCS=
153 > UISRCS=../dummy/prefs_editor_dummy.cpp
154   if [[ "x$WANT_GTK" = "xyes" ]]; then
155    AM_PATH_GTK(1.2.0, [
156      AC_DEFINE(ENABLE_GTK)
# Line 140 | Line 180 | fi
180   dnl Checks for header files.
181   AC_HEADER_STDC
182   AC_HEADER_SYS_WAIT
183 < AC_CHECK_HEADERS(unistd.h fcntl.h sys/time.h)
183 > AC_CHECK_HEADERS(mach/vm_map.h mach/mach_init.h sys/mman.h)
184 > AC_CHECK_HEADERS(sys/time.h sys/times.h)
185 > AC_CHECK_HEADERS(unistd.h fcntl.h byteswap.h)
186 > AC_CHECK_HEADERS(linux/if.h linux/if_tun.h net/if.h net/if_tun.h)
187  
188   dnl Checks for typedefs, structures, and compiler characteristics.
189   AC_C_BIGENDIAN
# Line 150 | Line 193 | AC_CHECK_SIZEOF(short, 2)
193   AC_CHECK_SIZEOF(int, 4)
194   AC_CHECK_SIZEOF(long, 4)
195   AC_CHECK_SIZEOF(long long, 8)
196 + AC_CHECK_SIZEOF(float, 4)
197 + AC_CHECK_SIZEOF(double, 8)
198 + AC_CHECK_SIZEOF(void *, 4)
199   AC_TYPE_OFF_T
200   AC_CHECK_TYPE(loff_t, off_t)
201   AC_TYPE_SIZE_T
202 + AC_TYPE_SIGNAL
203   AC_HEADER_TIME
204   AC_STRUCT_TM
205  
206 + dnl Check whether struct sigaction has sa_restorer member.
207 + AC_CACHE_CHECK([whether struct sigaction has sa_restorer],
208 +  ac_cv_signal_sa_restorer, [
209 +  AC_TRY_COMPILE([
210 +    #include <signal.h>
211 +  ], [struct sigaction sa; sa.sa_restorer = 0;],
212 +  ac_cv_signal_sa_restorer=yes, ac_cv_signal_sa_restorer=no,
213 +  dnl When cross-compiling, do not assume anything.
214 +  ac_cv_signal_sa_restorer=no
215 +  )
216 + ])
217 + if [[ "x$ac_cv_signal_sa_restorer" = "xyes" ]]; then
218 +  AC_DEFINE(HAVE_SIGNAL_SA_RESTORER)
219 + fi
220 +
221   dnl Checks for library functions.
222   AC_CHECK_FUNCS(strdup cfmakeraw)
223 < AC_CHECK_FUNCS(nanosleep clock_gettime timer_create)
223 > AC_CHECK_FUNCS(nanosleep)
224 > AC_CHECK_FUNCS(sigaction signal)
225 > AC_CHECK_FUNCS(mmap mprotect munmap)
226 > AC_CHECK_FUNCS(vm_allocate vm_deallocate vm_protect)
227 > AC_CHECK_FUNCS(posix_memalign memalign valloc)
228 >
229 > dnl Darwin seems to define mach_task_self() instead of task_self().
230 > AC_CHECK_FUNCS(mach_task_self task_self)
231 >
232 > dnl We need clock_gettime() for better performance but it may drag
233 > dnl libpthread in, which we don't want for native ppc mode
234 > case $EMULATED_PPC:$target_os in
235 > no:linux*)
236 >  ;;
237 > *:*)
238 >  AC_SEARCH_LIBS(clock_gettime, [rt posix4])
239 >  AC_CHECK_FUNCS(clock_gettime)
240 >  ;;
241 > esac
242  
243   dnl Select system-dependant sources.
244 < if [[ "x$HAVE_PPC" = "xyes" ]]; then
245 <  SYSSRCS="Linux/paranoia.cpp Linux/sheepthreads.c Linux/asm_linux.S"
244 > SERIALSRC=serial_unix.cpp
245 > ETHERSRC=../dummy/ether_dummy.cpp
246 > SCSISRC=../dummy/scsi_dummy.cpp
247 > AUDIOSRC=../dummy/audio_dummy.cpp
248 > EXTRASYSSRCS=
249 > case "$target_os" in
250 > linux*)
251 >  ETHERSRC=Linux/ether_linux.cpp
252 >  AUDIOSRC=audio_oss_esd.cpp
253 >  SCSISRC=Linux/scsi_linux.cpp
254 >  if [[ "x$EMULATED_PPC" = "xno" ]]; then
255 >    EXTRASYSSRCS="Linux/paranoia.cpp Linux/sheepthreads.c Linux/asm_linux.S"
256 >  fi
257 >  ;;
258 > darwin*)
259 >  if [[ "x$EMULATED_PPC" = "xno" ]]; then
260 >    EXTRASYSSRCS="Darwin/paranoia.cpp Linux/asm_linux.S"
261 >  fi
262 >  ;;
263 > esac
264 > SYSSRCS="$SERIALSRC $ETHERSRC $SCSISRC $AUDIOSRC $SEMSRC $UISRCS $MONSRCS $EXTRASYSSRCS"
265 >
266 > dnl Define a macro that translates a yesno-variable into a C macro definition
267 > dnl to be put into the config.h file
268 > dnl $1 -- the macro to define
269 > dnl $2 -- the value to translate
270 > dnl $3 -- template name
271 > AC_DEFUN(AC_TRANSLATE_DEFINE, [
272 >    if [[ "x$2" = "xyes" -o "x$2" = "xguessing yes" ]]; then
273 >        AC_DEFINE($1, 1, $3)
274 >    fi
275 > ])
276 >
277 > dnl Check that the host supports TUN/TAP devices
278 > AC_CACHE_CHECK([whether TUN/TAP is supported],
279 >  ac_cv_tun_tap_support, [
280 >  AC_TRY_COMPILE([
281 >    #if defined(HAVE_LINUX_IF_H) && defined(HAVE_LINUX_IF_TUN_H)
282 >    #include <linux/if.h>
283 >    #include <linux/if_tun.h>
284 >    #endif
285 >    #if defined(HAVE_NET_IF_H) && defined(HAVE_NET_IF_TUN_H)
286 >    #include <net/if.h>
287 >    #include <net/if_tun.h>
288 >    #endif
289 >  ], [
290 >    struct ifreq ifr;
291 >    memset(&ifr, 0, sizeof(ifr));
292 >    ifr.ifr_flags = IFF_TAP | IFF_NO_PI;
293 >  ],
294 >  ac_cv_tun_tap_support=yes, ac_cv_tun_tap_support=no
295 >  )
296 > ])
297 > AC_TRANSLATE_DEFINE(ENABLE_TUNTAP, "$ac_cv_tun_tap_support",
298 >  [Define if your system supports TUN/TAP devices.])
299 >
300 > dnl Various checks if the system supports vm_allocate() and the like functions.
301 > have_mach_vm=no
302 > if [[ "x$ac_cv_func_vm_allocate" = "xyes" -a "x$ac_cv_func_vm_deallocate" = "xyes" -a \
303 >      "x$ac_cv_func_vm_protect" = "xyes" ]]; then
304 >  have_mach_vm=yes
305 > fi
306 > AC_TRANSLATE_DEFINE(HAVE_MACH_VM, "$have_mach_vm",
307 >  [Define if your system has a working vm_allocate()-based memory allocator.])
308 >
309 > dnl Check that vm_allocate(), vm_protect() work
310 > if [[ "x$have_mach_vm" = "xyes" ]]; then
311 >
312 > AC_CACHE_CHECK([whether vm_protect works],
313 >  ac_cv_vm_protect_works, [
314 >  AC_LANG_SAVE
315 >  AC_LANG_CPLUSPLUS
316 >  ac_cv_vm_protect_works=yes
317 >  dnl First the tests that should segfault
318 >  for test_def in NONE_READ NONE_WRITE READ_WRITE; do
319 >    AC_TRY_RUN([
320 >      #define CONFIGURE_TEST_VM_MAP
321 >      #define TEST_VM_PROT_$test_def
322 >      #include "vm_alloc.cpp"
323 >    ], ac_cv_vm_protect_works=no, rm -f core,
324 >    dnl When cross-compiling, do not assume anything
325 >    ac_cv_vm_protect_works="guessing no"
326 >    )
327 >  done
328 >  AC_TRY_RUN([
329 >    #define CONFIGURE_TEST_VM_MAP
330 >    #define TEST_VM_PROT_RDWR_WRITE
331 >    #include "vm_alloc.cpp"
332 >  ], , ac_cv_vm_protect_works=no,
333 >  dnl When cross-compiling, do not assume anything
334 >  ac_cv_vm_protect_works="guessing no"
335 >  )
336 >  AC_LANG_RESTORE
337 >  ]
338 > )
339 >
340 > dnl Remove support for vm_allocate() if vm_protect() does not work
341 > if [[ "x$have_mach_vm" = "xyes" ]]; then
342 >  case $ac_cv_vm_protect_works in
343 >    *yes) have_mach_vm=yes;;
344 >    *no) have_mach_vm=no;;
345 >  esac
346 > fi
347 > AC_TRANSLATE_DEFINE(HAVE_MACH_VM, "$have_mach_vm",
348 >  [Define if your system has a working vm_allocate()-based memory allocator.])
349 >
350 > fi dnl HAVE_MACH_VM
351 >
352 > dnl Various checks if the system supports mmap() and the like functions.
353 > dnl ... and Mach memory allocators are not supported
354 > have_mmap_vm=no
355 > if [[ "x$ac_cv_func_mmap" = "xyes" -a "x$ac_cv_func_munmap" = "xyes" -a \
356 >      "x$ac_cv_func_mprotect" = "xyes" ]]; then
357 >  if [[ "x$have_mach_vm" = "xno" ]]; then
358 >    have_mmap_vm=yes
359 >  fi
360 > fi
361 > AC_TRANSLATE_DEFINE(HAVE_MMAP_VM, "$have_mmap_vm",
362 >  [Define if your system has a working mmap()-based memory allocator.])
363 >
364 > dnl Check that mmap() and associated functions work.
365 > if [[ "x$have_mmap_vm" = "xyes" ]]; then
366 >
367 > dnl Check if we have a working anonymous mmap()
368 > AC_CACHE_CHECK([whether mmap supports MAP_ANON],
369 >  ac_cv_mmap_anon, [
370 >  AC_LANG_SAVE
371 >  AC_LANG_CPLUSPLUS
372 >  AC_TRY_RUN([
373 >    #define HAVE_MMAP_ANON
374 >    #define CONFIGURE_TEST_VM_MAP
375 >    #define TEST_VM_MMAP_ANON
376 >    #include "vm_alloc.cpp"
377 >  ], ac_cv_mmap_anon=yes, ac_cv_mmap_anon=no,
378 >  dnl When cross-compiling, do not assume anything.
379 >  ac_cv_mmap_anon="guessing no"
380 >  )
381 >  AC_LANG_RESTORE
382 >  ]
383 > )
384 > AC_TRANSLATE_DEFINE(HAVE_MMAP_ANON, "$ac_cv_mmap_anon",
385 >  [Define if <sys/mman.h> defines MAP_ANON and mmap()'ing with MAP_ANON works.])
386 >
387 > AC_CACHE_CHECK([whether mmap supports MAP_ANONYMOUS],
388 >  ac_cv_mmap_anonymous, [
389 >  AC_LANG_SAVE
390 >  AC_LANG_CPLUSPLUS
391 >  AC_TRY_RUN([
392 >    #define HAVE_MMAP_ANONYMOUS
393 >    #define CONFIGURE_TEST_VM_MAP
394 >    #define TEST_VM_MMAP_ANON
395 >    #include "vm_alloc.cpp"
396 >  ], ac_cv_mmap_anonymous=yes, ac_cv_mmap_anonymous=no,
397 >  dnl When cross-compiling, do not assume anything.
398 >  ac_cv_mmap_anonymous="guessing no"
399 >  )
400 >  AC_LANG_RESTORE
401 >  ]
402 > )
403 > AC_TRANSLATE_DEFINE(HAVE_MMAP_ANONYMOUS, "$ac_cv_mmap_anonymous",
404 >  [Define if <sys/mman.h> defines MAP_ANONYMOUS and mmap()'ing with MAP_ANONYMOUS works.])
405 >
406 > AC_CACHE_CHECK([whether mprotect works],
407 >  ac_cv_mprotect_works, [
408 >  AC_LANG_SAVE
409 >  AC_LANG_CPLUSPLUS
410 >  ac_cv_mprotect_works=yes
411 >  dnl First the tests that should segfault
412 >  for test_def in NONE_READ NONE_WRITE READ_WRITE; do
413 >    AC_TRY_RUN([
414 >      #define CONFIGURE_TEST_VM_MAP
415 >      #define TEST_VM_PROT_$test_def
416 >      #include "vm_alloc.cpp"
417 >    ], ac_cv_mprotect_works=no, rm -f core,
418 >    dnl When cross-compiling, do not assume anything
419 >    ac_cv_mprotect_works="guessing no"
420 >    )
421 >  done
422 >  AC_TRY_RUN([
423 >    #define CONFIGURE_TEST_VM_MAP
424 >    #define TEST_VM_PROT_RDWR_WRITE
425 >    #include "vm_alloc.cpp"
426 >  ], , ac_cv_mprotect_works=no,
427 >  dnl When cross-compiling, do not assume anything
428 >  ac_cv_mprotect_works="guessing no"
429 >  )
430 >  AC_LANG_RESTORE
431 >  ]
432 > )
433 >
434 > dnl Remove support for mmap() if mprotect() does not work
435 > if [[ "x$have_mmap_vm" = "xyes" ]]; then
436 >  case $ac_cv_mprotect_works in
437 >    *yes) have_mmap_vm=yes;;
438 >    *no) have_mmap_vm=no;;
439 >  esac
440 > fi
441 > AC_TRANSLATE_DEFINE(HAVE_MMAP_VM, $have_mmap_vm,
442 >  [Define if your system has a working mmap()-based memory allocator.])
443 >
444 > fi dnl HAVE_MMAP_VM
445 >
446 > dnl Check if we can modify the __PAGEZERO segment for use as Low Memory
447 > AC_CACHE_CHECK([whether __PAGEZERO can be Low Memory area 0x0000-0x3000],
448 >  ac_cv_pagezero_hack, [
449 >  ac_cv_pagezero_hack=no
450 >  if AC_TRY_COMMAND([Darwin/testlmem.sh 0x3000]); then
451 >    ac_cv_pagezero_hack=yes
452 >    dnl might as well skip the test for mmap-able low memory
453 >    ac_cv_can_map_lm=no
454 >  fi
455 > ])
456 > AC_TRANSLATE_DEFINE(PAGEZERO_HACK, "$ac_cv_pagezero_hack",
457 >  [Define if the __PAGEZERO Mach-O Low Memory Globals hack works on this system.])
458 >
459 > dnl Check if we can mmap 0x3000 bytes from 0x0000
460 > AC_CACHE_CHECK([whether we can map Low Memory area 0x0000-0x3000],
461 >  ac_cv_can_map_lm, [
462 >  AC_LANG_SAVE
463 >  AC_LANG_CPLUSPLUS
464 >  AC_TRY_RUN([
465 >    #include "vm_alloc.cpp"
466 >    int main(void) { /* returns 0 if we could map the lowmem globals */
467 >      volatile char * lm = 0;
468 >      if (vm_init() < 0) exit(1);
469 >      if (vm_acquire_fixed(0, 0x2000) < 0) exit(1);
470 >      lm[0] = 'z';
471 >      if (vm_release((char *)lm, 0x2000) < 0) exit(1);
472 >      vm_exit(); exit(0);
473 >    }
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 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 >    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 >  [Define if your system requires signals to be reinstalled.])
508 >
509 > dnl Check if sigaction handlers need to be reinstalled
510 > AC_CACHE_CHECK([whether sigaction handlers need to be reinstalled],
511 >  ac_cv_sigaction_need_reinstall, [
512 >  AC_LANG_SAVE
513 >  AC_LANG_CPLUSPLUS
514 >  AC_TRY_RUN([
515 >    #include <stdlib.h>
516 >    #ifdef HAVE_UNISTD_H
517 >    #include <unistd.h>
518 >    #endif
519 >    #include <signal.h>
520 >    static int handled_signal = 0;
521 >    RETSIGTYPE sigusr1_handler(int) { handled_signal++; }
522 >    typedef RETSIGTYPE (*signal_handler)(int);
523 >    static signal_handler mysignal(int sig, signal_handler handler) {
524 >      struct sigaction old_sa;
525 >      struct sigaction new_sa;
526 >      new_sa.sa_handler = handler;
527 >      return ((sigaction(sig,&new_sa,&old_sa) < 0) ? SIG_IGN : old_sa.sa_handler);
528 >    }
529 >    int main(void) { /* returns 0 if signals need not to be reinstalled */
530 >      mysignal(SIGUSR1, sigusr1_handler); raise(SIGUSR1); raise(SIGUSR1);
531 >      exit(handled_signal == 2);
532 >    }
533 >  ], ac_cv_sigaction_need_reinstall=yes, ac_cv_sigaction_need_reinstall=no,
534 >  dnl When cross-compiling, do not assume anything.
535 >  ac_cv_sigaction_need_reinstall="guessing yes"
536 >  )
537 >  AC_LANG_RESTORE
538 >  ]
539 > )
540 > AC_TRANSLATE_DEFINE(SIGACTION_NEED_REINSTALL, "$ac_cv_sigaction_need_reinstall",
541 >  [Define if your system requires sigactions to be reinstalled.])
542 >
543 > dnl Check if Mach exceptions supported.
544 > AC_CACHE_CHECK([whether your system supports Mach exceptions],
545 >  ac_cv_have_mach_exceptions, [
546 >  AC_LANG_SAVE
547 >  AC_LANG_CPLUSPLUS
548 >  AC_TRY_RUN([
549 >    #define HAVE_MACH_EXCEPTIONS 1
550 >    #define CONFIGURE_TEST_SIGSEGV_RECOVERY
551 >    #include "vm_alloc.cpp"
552 >    #include "sigsegv.cpp"
553 >  ],
554 >  ac_cv_have_mach_exceptions=yes,
555 >  ac_cv_have_mach_exceptions=no,
556 >  dnl When cross-compiling, do not assume anything.
557 >  ac_cv_have_mach_exceptions=no
558 >  )
559 >  AC_LANG_RESTORE
560 >  ]
561 > )
562 > if [[ "$ac_cv_have_mach_exceptions" = "yes" ]]; then
563 >  sigsegv_recovery=mach
564 > fi
565 > AC_TRANSLATE_DEFINE(HAVE_MACH_EXCEPTIONS, "$ac_cv_have_mach_exceptions",
566 >  [Define if your system supports Mach exceptions.])
567 >
568 > dnl Otherwise, check if extended signals are supported.
569 > if [[ -z "$sigsegv_recovery" ]]; then
570 >  AC_CACHE_CHECK([whether your system supports extended signal handlers],
571 >    ac_cv_have_extended_signals, [
572 >    AC_LANG_SAVE
573 >    AC_LANG_CPLUSPLUS
574 >    AC_TRY_RUN([
575 >      #define HAVE_SIGINFO_T 1
576 >      #define CONFIGURE_TEST_SIGSEGV_RECOVERY
577 >      #include "vm_alloc.cpp"
578 >      #include "sigsegv.cpp"
579 >    ],
580 >    ac_cv_have_extended_signals=yes,
581 >    ac_cv_have_extended_signals=no,
582 >    dnl When cross-compiling, do not assume anything.
583 >    ac_cv_have_extended_signals=no
584 >    )
585 >    AC_LANG_RESTORE
586 >    ]
587 >  )
588 >  if [[ "$ac_cv_have_extended_signals" = "yes" ]]; then
589 >    sigsegv_recovery=siginfo
590 >  fi
591 >  AC_TRANSLATE_DEFINE(HAVE_SIGINFO_T, "$ac_cv_have_extended_signals",
592 >    [Define if your system support extended signals.])
593 > fi
594 >
595 > dnl Otherwise, check for subterfuges.
596 > if [[ -z "$sigsegv_recovery" ]]; then
597 >  AC_CACHE_CHECK([whether we then have a subterfuge for your system],
598 >  ac_cv_have_sigcontext_hack, [
599 >    AC_LANG_SAVE
600 >    AC_LANG_CPLUSPLUS
601 >    AC_TRY_RUN([
602 >      #define HAVE_SIGCONTEXT_SUBTERFUGE 1
603 >      #define CONFIGURE_TEST_SIGSEGV_RECOVERY
604 >      #include "vm_alloc.cpp"
605 >      #include "sigsegv.cpp"
606 >    ],
607 >    ac_cv_have_sigcontext_hack=yes,
608 >    ac_cv_have_sigcontext_hack=no,
609 >    dnl When cross-compiling, do not assume anything.
610 >    ac_cv_have_sigcontext_hack=no
611 >    )
612 >    AC_LANG_RESTORE
613 >  ])
614 >  if [[ "$ac_cv_have_sigcontext_hack" = "yes" ]]; then
615 >    sigsegv_recovery=sigcontext
616 >  fi
617 >  AC_TRANSLATE_DEFINE(HAVE_SIGCONTEXT_SUBTERFUGE, "$ac_cv_have_sigcontext_hack",
618 >    [Define if we know a hack to replace siginfo_t->si_addr member.])
619 > fi
620 >
621 > dnl Check if we can ignore the fault (instruction skipping in SIGSEGV handler)
622 > AC_CACHE_CHECK([whether we can skip instruction in SIGSEGV handler],
623 >  ac_cv_have_skip_instruction, [
624 >  AC_LANG_SAVE
625 >  AC_LANG_CPLUSPLUS
626 >  AC_TRY_RUN([
627 >    #define HAVE_SIGSEGV_SKIP_INSTRUCTION 1
628 >    #define CONFIGURE_TEST_SIGSEGV_RECOVERY
629 >    #include "vm_alloc.cpp"
630 >    #include "sigsegv.cpp"
631 >  ], ac_cv_have_skip_instruction=yes, ac_cv_have_skip_instruction=no,
632 >  dnl When cross-compiling, do not assume anything.
633 >  ac_cv_have_skip_instruction=no
634 >  )
635 >  AC_LANG_RESTORE
636 >  ]
637 > )
638 > AC_TRANSLATE_DEFINE(HAVE_SIGSEGV_SKIP_INSTRUCTION, "$ac_cv_have_skip_instruction",
639 >  [Define if we can ignore the fault (instruction skipping in SIGSEGV handler).])
640 >
641 > dnl Can we do Video on SEGV Signals ?
642 > CAN_VOSF=no
643 > if [[ -n "$sigsegv_recovery" ]]; then
644 >  CAN_VOSF=yes
645 >  case $target_os in
646 >  darwin*)
647 >    dnl Signal handlers in darwin are way too slow since the whole
648 >    dnl machine state (GPRs, FPRs, VRs) is forcibly saved.
649 >    dnl In other words, VOSF is slower than static window refreshes.
650 >    CAN_VOSF=no
651 >    ;;
652 >  esac
653 > fi
654 >
655 > dnl Enable VOSF screen updates with this feature is requested and feasible
656 > if [[ "x$WANT_VOSF" = "xyes" -a "x$CAN_VOSF" = "xyes" ]]; then
657 >    AC_DEFINE(ENABLE_VOSF, 1, [Define if using video enabled on SEGV signals.])
658   else
659 <  SYSSRCS="../emul_ppc/emul_ppc.cpp"
659 >    WANT_VOSF=no
660 > fi
661 >
662 > dnl Platform specific binary postprocessor
663 > BLESS=/bin/true
664 > if [[ "x$ac_cv_pagezero_hack" = "xyes" ]]; then
665 >  BLESS=Darwin/lowmem
666 >  LDFLAGS="$LDFLAGS -pagezero_size 0x3000"
667 > fi
668 >
669 > dnl Check for GCC 2.7 or higher.
670 > HAVE_GCC27=no
671 > AC_MSG_CHECKING(for GCC 2.7 or higher)
672 > AC_EGREP_CPP(xyes,
673 > [#if __GNUC__ - 1 > 1 || __GNUC_MINOR__ - 1 > 5
674 >  xyes
675 > #endif
676 > ], [AC_MSG_RESULT(yes); HAVE_GCC27=yes], AC_MSG_RESULT(no))
677 >
678 > dnl Check for GCC 3.0 or higher.
679 > HAVE_GCC30=no
680 > AC_MSG_CHECKING(for GCC 3.0 or higher)
681 > AC_EGREP_CPP(xyes,
682 > [#if __GNUC__ >= 3
683 >  xyes
684 > #endif
685 > ], [AC_MSG_RESULT(yes); HAVE_GCC30=yes], AC_MSG_RESULT(no))
686 >
687 > dnl Check for ICC.
688 > AC_MSG_CHECKING(for ICC)
689 > HAVE_ICC=no
690 > if $CXX -V -v 2>&1 | grep -q "Intel(R) C++ Compiler"; then
691 >  HAVE_ICC=yes
692 > fi
693 > AC_MSG_RESULT($HAVE_ICC)
694 >
695 > # Test if the compiler can generate ELF objects
696 > AC_CACHE_CHECK([whether the compiler can generate ELF objects],
697 >  ac_cv_elf_objects, [
698 >  echo 'int i;' > conftest.$ac_ext
699 >  ac_cv_elf_objects=no
700 >  if AC_TRY_EVAL(ac_compile); then
701 >    case `/usr/bin/file conftest.$ac_objext` in
702 >    *"ELF"*)
703 >      ac_cv_elf_objects=yes
704 >      ;;
705 >    esac
706 >  fi
707 >  rm -rf conftest*
708 > ])
709 > ELF_OBJECTS=$ac_cv_elf_objects
710 >
711 > dnl CPU emulator sources
712 > if [[ "x$EMULATED_PPC" = "xyes" ]]; then
713 >  CPUSRCS="\
714 >    ../kpx_cpu/src/cpu/ppc/ppc-cpu.cpp \
715 >    ../kpx_cpu/src/cpu/ppc/ppc-decode.cpp \
716 >    ../kpx_cpu/src/cpu/ppc/ppc-execute.cpp \
717 >    ../kpx_cpu/src/cpu/ppc/ppc-translate.cpp"
718 >  CPPFLAGS="$CPPFLAGS -I../kpx_cpu/include -I../kpx_cpu/src"
719 >
720 >  dnl Enable JIT compiler, if possible
721 >  if [[ "x$WANT_JIT" = "xyes" ]]; then
722 >    AC_CACHE_CHECK([whether dyngen can be used],
723 >      ac_cv_use_dyngen, [
724 >      case $host_cpu:$ELF_OBJECTS in
725 >      powerpc:yes)
726 >        ac_cv_use_dyngen=yes
727 >        ;;
728 >      x86_64:yes)
729 >        ac_cv_use_dyngen=yes
730 >        ;;
731 >      i?86:yes)
732 >        ac_cv_use_dyngen=yes
733 >        ;;
734 >      *:*)
735 >        ac_cv_use_dyngen=no
736 >        ;;
737 >      esac
738 >      dnl Check for a suitable synthetic opcodes compiler (icc is faking itself as gcc 3.2.2)
739 >      if [[ -z "$DYNGEN_CC" ]]; then
740 >        if [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_ICC" = "xno" ]]; then
741 >          DYNGEN_CC=$CXX
742 >        else
743 >          for p in /usr/bin /usr/local/bin; do
744 >            gxx="$p/g++"
745 >            if [[ -x "$gxx" ]]; then
746 >              DYNGEN_CC="$gxx"
747 >            fi
748 >          done
749 >        fi
750 >      fi
751 >      if [[ -z "$DYNGEN_CC" ]] || ! { echo '#include <limits>' | $DYNGEN_CC -xc++ -c -o /dev/null - >& /dev/null; }; then
752 >        ac_cv_use_dyngen=no
753 >      fi
754 >    ])
755 >    if [[ "x$ac_cv_use_dyngen" = "xyes" ]]; then
756 >      case $host_cpu in
757 >      i?86)
758 >        DYNGEN_OP_FLAGS="-fomit-frame-pointer -mpreferred-stack-boundary=2"
759 >        if [[ "x$HAVE_GCC30" = "xyes" ]]; then
760 >          DYNGEN_OP_FLAGS="$DYNGEN_OP_FLAGS -falign-functions=0"
761 >        else
762 >          DYNGEN_OP_FLAGS="$DYNGEN_OP_FLAGS -malign-functions=0"
763 >        fi
764 >        saved_CPPFLAGS=$CPPFLAGS
765 >        CPPFLAGS="$CPPFLAGS -mmmx"
766 >        AC_CHECK_HEADERS(mmintrin.h,  [DYNGEN_OP_FLAGS="$DYNGEN_OP_FLAGS -mmmx"])
767 >        CPPFLAGS="$CPPFLAGS -msse"
768 >        AC_CHECK_HEADERS(xmmintrin.h, [DYNGEN_OP_FLAGS="$DYNGEN_OP_FLAGS -msse"])
769 >        CPPFLAGS="$CPPFLAGS -msse2"
770 >        AC_CHECK_HEADERS(emmintrin.h, [DYNGEN_OP_FLAGS="$DYNGEN_OP_FLAGS -msse2"])
771 >        CPPFLAGS=$saved_CPPFLAGS
772 >        ;;
773 >      x86_64)
774 >        AC_CHECK_HEADERS(mmintrin.h xmmintrin.h emmintrin.h)
775 >        ;;
776 >      esac
777 >      DYNGEN_OP_FLAGS="$DYNGEN_OP_FLAGS -finline-limit=10000"
778 >      if [[ "x$HAVE_GCC30" = "xyes" ]]; then
779 >        DYNGEN_OP_FLAGS="$DYNGEN_OP_FLAGS -fno-reorder-blocks -fno-optimize-sibling-calls"
780 >      fi
781 >    else
782 >      WANT_JIT=no
783 >    fi
784 >    AC_TRANSLATE_DEFINE(ENABLE_DYNGEN, $ac_cv_use_dyngen, [Define to enable dyngen engine])
785 >    if [[ "x$WANT_JIT" = "xyes" ]]; then
786 >      DYNGENSRCS="\
787 >        ../kpx_cpu/src/cpu/jit/dyngen.c \
788 >        ../kpx_cpu/src/cpu/jit/cxxdemangle.cpp"
789 >      CPUSRCS="\
790 >        ../kpx_cpu/src/cpu/jit/jit-cache.cpp \
791 >        ../kpx_cpu/src/cpu/jit/basic-dyngen.cpp \
792 >        ../kpx_cpu/src/cpu/ppc/ppc-dyngen.cpp $CPUSRCS"
793 >    fi
794 >  fi
795 >  CPUSRCS="$CPUSRCS ../kpx_cpu/sheepshaver_glue.cpp"
796 > else
797 >  WANT_JIT=no
798 > fi
799 > if [[ "x$ac_cv_use_dyngen" = "xyes" ]]; then
800 >  AC_CACHE_CHECK([whether static data regions are executable],
801 >    ac_cv_have_static_data_exec, [
802 >    AC_TRY_RUN([int main(void) {
803 > #if defined(__powerpc__)
804 >      static unsigned int p[8] = {0x4e800020,};
805 >      asm volatile("dcbst 0,%0" : : "r" (p) : "memory");
806 >      asm volatile("sync" : : : "memory");
807 >      asm volatile("icbi 0,%0" : : "r" (p) : "memory");
808 >      asm volatile("sync" : : : "memory");
809 >      asm volatile("isync" : : : "memory");
810 >      ((void (*)(void))p)();
811 >      return 0;
812 > #endif
813 >      return 1;
814 >    }], ac_cv_have_static_data_exec=yes, ac_cv_have_static_data_exec=no,
815 >    dnl When cross-compiling, do not assume anything.
816 >    ac_cv_have_static_data_exec=no
817 >    )
818 >  ])
819 > fi
820 > AC_TRANSLATE_DEFINE(HAVE_STATIC_DATA_EXEC, "$ac_cv_have_static_data_exec",
821 >  [Define if your system marks static data pages as executable.])
822 >
823 > if [[ "x$WANT_JIT" = "xyes" ]]; then
824 >  CPPFLAGS="$CPPFLAGS -DUSE_JIT"
825   fi
169 SYSSRCS="$SYSSRCS $SEMSRCS $UISRCS $MONSRCS"
826  
827   dnl Generate Makefile.
828 + AC_SUBST(DYNGENSRCS)
829 + AC_SUBST(DYNGEN_CC)
830 + AC_SUBST(DYNGEN_OP_FLAGS)
831   AC_SUBST(SYSSRCS)
832 + AC_SUBST(CPUSRCS)
833 + AC_SUBST(BLESS)
834   AC_OUTPUT(Makefile)
835  
836   dnl Print summary.
# Line 178 | Line 839 | echo SheepShaver configuration summary:
839   echo
840   echo XFree86 DGA support .............. : $WANT_XF86_DGA
841   echo XFree86 VidMode support .......... : $WANT_XF86_VIDMODE
842 + echo Using PowerPC emulator ........... : $EMULATED_PPC
843 + echo Enable JIT compiler .............. : $WANT_JIT
844 + echo Enable video on SEGV signals ..... : $WANT_VOSF
845   echo ESD sound support ................ : $WANT_ESD
846   echo GTK user interface ............... : $WANT_GTK
847   echo mon debugger support ............. : $WANT_MON
848 + echo Bad memory access recovery type .. : $sigsegv_recovery
849   echo
850   echo "Configuration done. Now type \"make\"."

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines