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.1 by cebix, 2002-02-04T16:58:13Z vs.
Revision 1.19 by gbeauche, 2004-02-20T17:21:08Z

# 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])
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)
69      MONSRCS="$mon_srcdir/mon.cpp $mon_srcdir/mon_6502.cpp $mon_srcdir/mon_z80.cpp $mon_srcdir/mon_cmd.cpp $mon_srcdir/mon_lowmem.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"
70      CXXFLAGS="$CXXFLAGS -I$mon_srcdir -I$mon_srcdir/disass"
71 +    AC_CHECK_LIB(ncurses, tgetent, ,
72 +      AC_CHECK_LIB(termcap, tgetent, ,
73 +        AC_CHECK_LIB(termlib, tgetent, ,
74 +          AC_CHECK_LIB(terminfo, tgetent, ,
75 +            AC_CHECK_LIB(Hcurses, tgetent, ,
76 +              AC_CHECK_LIB(curses, tgetent))))))
77      AC_CHECK_LIB(readline, readline)
43    AC_CHECK_LIB(termcap, tputs)
78      AC_CHECK_HEADERS(readline.h history.h readline/readline.h readline/history.h)
79    else
80      AC_MSG_RESULT(no)
# Line 63 | 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 72 | 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.
78 < SEMSRC=
79 < 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 105 | 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 135 | 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_HEADER(mmintrin.h, [have_mmintrin_h=yes])
187 > AC_CHECK_HEADER(xmmintrin.h, [have_xmmintrin_h=yes])
188 > AC_CHECK_HEADER(emmintrin.h, [have_emmintrin_h=yes])
189  
190   dnl Checks for typedefs, structures, and compiler characteristics.
191   AC_C_BIGENDIAN
# Line 145 | Line 195 | AC_CHECK_SIZEOF(short, 2)
195   AC_CHECK_SIZEOF(int, 4)
196   AC_CHECK_SIZEOF(long, 4)
197   AC_CHECK_SIZEOF(long long, 8)
198 + AC_CHECK_SIZEOF(float, 4)
199 + AC_CHECK_SIZEOF(double, 8)
200 + AC_CHECK_SIZEOF(void *, 4)
201   AC_TYPE_OFF_T
202   AC_CHECK_TYPE(loff_t, off_t)
203   AC_TYPE_SIZE_T
204 + AC_TYPE_SIGNAL
205   AC_HEADER_TIME
206   AC_STRUCT_TM
207  
208 + dnl Check whether struct sigaction has sa_restorer member.
209 + AC_CACHE_CHECK([whether struct sigaction has sa_restorer],
210 +  ac_cv_signal_sa_restorer, [
211 +  AC_TRY_COMPILE([
212 +    #include <signal.h>
213 +  ], [struct sigaction sa; sa.sa_restorer = 0;],
214 +  ac_cv_signal_sa_restorer=yes, ac_cv_signal_sa_restorer=no,
215 +  dnl When cross-compiling, do not assume anything.
216 +  ac_cv_signal_sa_restorer=no
217 +  )
218 + ])
219 + if [[ "x$ac_cv_signal_sa_restorer" = "xyes" ]]; then
220 +  AC_DEFINE(HAVE_SIGNAL_SA_RESTORER)
221 + fi
222 +
223   dnl Checks for library functions.
224   AC_CHECK_FUNCS(strdup cfmakeraw)
225 < AC_CHECK_FUNCS(nanosleep clock_gettime timer_create)
225 > AC_CHECK_FUNCS(nanosleep)
226 > AC_CHECK_FUNCS(sigaction signal)
227 > AC_CHECK_FUNCS(mmap mprotect munmap)
228 > AC_CHECK_FUNCS(vm_allocate vm_deallocate vm_protect)
229 >
230 > dnl Darwin seems to define mach_task_self() instead of task_self().
231 > AC_CHECK_FUNCS(mach_task_self task_self)
232 >
233 > dnl We need clock_gettime() for better performance but it may drag
234 > dnl libpthread in, which we don't want for native ppc mode
235 > case $EMULATED_PPC:$target_os in
236 > no:linux*)
237 >  ;;
238 > *:*)
239 >  AC_SEARCH_LIBS(clock_gettime, [rt posix4])
240 >  AC_CHECK_FUNCS(clock_gettime)
241 >  ;;
242 > esac
243  
244   dnl Select system-dependant sources.
245 < if [[ "x$HAVE_PPC" = "xyes" ]]; then
246 <  SYSSRCS="Linux/paranoia.cpp Linux/sheepthreads.c Linux/asm_linux.S"
245 > SERIALSRC=serial_unix.cpp
246 > ETHERSRC=../dummy/ether_dummy.cpp
247 > SCSISRC=../dummy/scsi_dummy.cpp
248 > AUDIOSRC=../dummy/audio_dummy.cpp
249 > EXTRASYSSRCS=
250 > case "$target_os" in
251 > linux*)
252 >  ETHERSRC=Linux/ether_linux.cpp
253 >  AUDIOSRC=audio_oss_esd.cpp
254 >  SCSISRC=Linux/scsi_linux.cpp
255 >  if [[ "x$EMULATED_PPC" = "xno" ]]; then
256 >    EXTRASYSSRCS="Linux/paranoia.cpp Linux/sheepthreads.c Linux/asm_linux.S"
257 >  fi
258 >  ;;
259 > darwin*)
260 >  if [[ "x$EMULATED_PPC" = "xno" ]]; then
261 >    EXTRASYSSRCS="Darwin/paranoia.cpp Linux/asm_linux.S"
262 >  fi
263 >  ;;
264 > esac
265 > SYSSRCS="$SERIALSRC $ETHERSRC $SCSISRC $AUDIOSRC $SEMSRC $UISRCS $MONSRCS $EXTRASYSSRCS"
266 >
267 > dnl Define a macro that translates a yesno-variable into a C macro definition
268 > dnl to be put into the config.h file
269 > dnl $1 -- the macro to define
270 > dnl $2 -- the value to translate
271 > dnl $3 -- template name
272 > AC_DEFUN(AC_TRANSLATE_DEFINE, [
273 >    if [[ "x$2" = "xyes" -o "x$2" = "xguessing yes" ]]; then
274 >        AC_DEFINE($1, 1, $3)
275 >    fi
276 > ])
277 >
278 > dnl Various checks if the system supports vm_allocate() and the like functions.
279 > have_mach_vm=no
280 > if [[ "x$ac_cv_func_vm_allocate" = "xyes" -a "x$ac_cv_func_vm_deallocate" = "xyes" -a \
281 >      "x$ac_cv_func_vm_protect" = "xyes" ]]; then
282 >  have_mach_vm=yes
283 > fi
284 > AC_TRANSLATE_DEFINE(HAVE_MACH_VM, "$have_mach_vm",
285 >  [Define if your system has a working vm_allocate()-based memory allocator.])
286 >
287 > dnl Check that vm_allocate(), vm_protect() work
288 > if [[ "x$have_mach_vm" = "xyes" ]]; then
289 >
290 > AC_CACHE_CHECK([whether vm_protect works],
291 >  ac_cv_vm_protect_works, [
292 >  AC_LANG_SAVE
293 >  AC_LANG_CPLUSPLUS
294 >  ac_cv_vm_protect_works=yes
295 >  dnl First the tests that should segfault
296 >  for test_def in NONE_READ NONE_WRITE READ_WRITE; do
297 >    AC_TRY_RUN([
298 >      #define CONFIGURE_TEST_VM_MAP
299 >      #define TEST_VM_PROT_$test_def
300 >      #include "vm_alloc.cpp"
301 >    ], ac_cv_vm_protect_works=no, rm -f core,
302 >    dnl When cross-compiling, do not assume anything
303 >    ac_cv_vm_protect_works="guessing no"
304 >    )
305 >  done
306 >  AC_TRY_RUN([
307 >    #define CONFIGURE_TEST_VM_MAP
308 >    #define TEST_VM_PROT_RDWR_WRITE
309 >    #include "vm_alloc.cpp"
310 >  ], , ac_cv_vm_protect_works=no,
311 >  dnl When cross-compiling, do not assume anything
312 >  ac_cv_vm_protect_works="guessing no"
313 >  )
314 >  AC_LANG_RESTORE
315 >  ]
316 > )
317 >
318 > dnl Remove support for vm_allocate() if vm_protect() does not work
319 > if [[ "x$have_mach_vm" = "xyes" ]]; then
320 >  case $ac_cv_vm_protect_works in
321 >    *yes) have_mach_vm=yes;;
322 >    *no) have_mach_vm=no;;
323 >  esac
324 > fi
325 > AC_TRANSLATE_DEFINE(HAVE_MACH_VM, "$have_mach_vm",
326 >  [Define if your system has a working vm_allocate()-based memory allocator.])
327 >
328 > fi dnl HAVE_MACH_VM
329 >
330 > dnl Various checks if the system supports mmap() and the like functions.
331 > dnl ... and Mach memory allocators are not supported
332 > have_mmap_vm=no
333 > if [[ "x$ac_cv_func_mmap" = "xyes" -a "x$ac_cv_func_munmap" = "xyes" -a \
334 >      "x$ac_cv_func_mprotect" = "xyes" ]]; then
335 >  if [[ "x$have_mach_vm" = "xno" ]]; then
336 >    have_mmap_vm=yes
337 >  fi
338 > fi
339 > AC_TRANSLATE_DEFINE(HAVE_MMAP_VM, "$have_mmap_vm",
340 >  [Define if your system has a working mmap()-based memory allocator.])
341 >
342 > dnl Check that mmap() and associated functions work.
343 > if [[ "x$have_mmap_vm" = "xyes" ]]; then
344 >
345 > dnl Check if we have a working anonymous mmap()
346 > AC_CACHE_CHECK([whether mmap supports MAP_ANON],
347 >  ac_cv_mmap_anon, [
348 >  AC_LANG_SAVE
349 >  AC_LANG_CPLUSPLUS
350 >  AC_TRY_RUN([
351 >    #define HAVE_MMAP_ANON
352 >    #define CONFIGURE_TEST_VM_MAP
353 >    #define TEST_VM_MMAP_ANON
354 >    #include "vm_alloc.cpp"
355 >  ], ac_cv_mmap_anon=yes, ac_cv_mmap_anon=no,
356 >  dnl When cross-compiling, do not assume anything.
357 >  ac_cv_mmap_anon="guessing no"
358 >  )
359 >  AC_LANG_RESTORE
360 >  ]
361 > )
362 > AC_TRANSLATE_DEFINE(HAVE_MMAP_ANON, "$ac_cv_mmap_anon",
363 >  [Define if <sys/mman.h> defines MAP_ANON and mmap()'ing with MAP_ANON works.])
364 >
365 > AC_CACHE_CHECK([whether mmap supports MAP_ANONYMOUS],
366 >  ac_cv_mmap_anonymous, [
367 >  AC_LANG_SAVE
368 >  AC_LANG_CPLUSPLUS
369 >  AC_TRY_RUN([
370 >    #define HAVE_MMAP_ANONYMOUS
371 >    #define CONFIGURE_TEST_VM_MAP
372 >    #define TEST_VM_MMAP_ANON
373 >    #include "vm_alloc.cpp"
374 >  ], ac_cv_mmap_anonymous=yes, ac_cv_mmap_anonymous=no,
375 >  dnl When cross-compiling, do not assume anything.
376 >  ac_cv_mmap_anonymous="guessing no"
377 >  )
378 >  AC_LANG_RESTORE
379 >  ]
380 > )
381 > AC_TRANSLATE_DEFINE(HAVE_MMAP_ANONYMOUS, "$ac_cv_mmap_anonymous",
382 >  [Define if <sys/mman.h> defines MAP_ANONYMOUS and mmap()'ing with MAP_ANONYMOUS works.])
383 >
384 > AC_CACHE_CHECK([whether mprotect works],
385 >  ac_cv_mprotect_works, [
386 >  AC_LANG_SAVE
387 >  AC_LANG_CPLUSPLUS
388 >  ac_cv_mprotect_works=yes
389 >  dnl First the tests that should segfault
390 >  for test_def in NONE_READ NONE_WRITE READ_WRITE; do
391 >    AC_TRY_RUN([
392 >      #define CONFIGURE_TEST_VM_MAP
393 >      #define TEST_VM_PROT_$test_def
394 >      #include "vm_alloc.cpp"
395 >    ], ac_cv_mprotect_works=no, rm -f core,
396 >    dnl When cross-compiling, do not assume anything
397 >    ac_cv_mprotect_works="guessing no"
398 >    )
399 >  done
400 >  AC_TRY_RUN([
401 >    #define CONFIGURE_TEST_VM_MAP
402 >    #define TEST_VM_PROT_RDWR_WRITE
403 >    #include "vm_alloc.cpp"
404 >  ], , ac_cv_mprotect_works=no,
405 >  dnl When cross-compiling, do not assume anything
406 >  ac_cv_mprotect_works="guessing no"
407 >  )
408 >  AC_LANG_RESTORE
409 >  ]
410 > )
411 >
412 > dnl Remove support for mmap() if mprotect() does not work
413 > if [[ "x$have_mmap_vm" = "xyes" ]]; then
414 >  case $ac_cv_mprotect_works in
415 >    *yes) have_mmap_vm=yes;;
416 >    *no) have_mmap_vm=no;;
417 >  esac
418 > fi
419 > AC_TRANSLATE_DEFINE(HAVE_MMAP_VM, $have_mmap_vm,
420 >  [Define if your system has a working mmap()-based memory allocator.])
421 >
422 > fi dnl HAVE_MMAP_VM
423 >
424 > dnl Check if we can modify the __PAGEZERO segment for use as Low Memory
425 > AC_CACHE_CHECK([whether __PAGEZERO can be Low Memory area 0x0000-0x3000],
426 >  ac_cv_pagezero_hack, [
427 >  ac_cv_pagezero_hack=no
428 >  if AC_TRY_COMMAND([Darwin/testlmem.sh 0x3000]); then
429 >    ac_cv_pagezero_hack=yes
430 >    dnl might as well skip the test for mmap-able low memory
431 >    ac_cv_can_map_lm=no
432 >  fi
433 > ])
434 > AC_TRANSLATE_DEFINE(PAGEZERO_HACK, "$ac_cv_pagezero_hack",
435 >  [Define if the __PAGEZERO Mach-O Low Memory Globals hack works on this system.])
436 >
437 > dnl Check if we can mmap 0x3000 bytes from 0x0000
438 > AC_CACHE_CHECK([whether we can map Low Memory area 0x0000-0x3000],
439 >  ac_cv_can_map_lm, [
440 >  AC_LANG_SAVE
441 >  AC_LANG_CPLUSPLUS
442 >  AC_TRY_RUN([
443 >    #include "vm_alloc.cpp"
444 >    int main(void) { /* returns 0 if we could map the lowmem globals */
445 >      volatile char * lm = 0;
446 >      if (vm_init() < 0) exit(1);
447 >      if (vm_acquire_fixed(0, 0x2000) < 0) exit(1);
448 >      lm[0] = 'z';
449 >      if (vm_release((char *)lm, 0x2000) < 0) exit(1);
450 >      vm_exit(); exit(0);
451 >    }
452 >  ], ac_cv_can_map_lm=yes, ac_cv_can_map_lm=no,
453 >  dnl When cross-compiling, do not assume anything.
454 >  ac_cv_can_map_lm="guessing no"
455 >  )
456 >  AC_LANG_RESTORE
457 >  ]
458 > )
459 >
460 > dnl Check signal handlers need to be reinstalled
461 > AC_CACHE_CHECK([whether signal handlers need to be reinstalled],
462 >  ac_cv_signal_need_reinstall, [
463 >  AC_LANG_SAVE
464 >  AC_LANG_CPLUSPLUS
465 >  AC_TRY_RUN([
466 >    #include <stdlib.h>
467 >    #ifdef HAVE_UNISTD_H
468 >    #include <unistd.h>
469 >    #endif
470 >    #include <signal.h>
471 >    static int handled_signal = 0;
472 >    RETSIGTYPE sigusr1_handler(int) { handled_signal++; }
473 >    int main(void) { /* returns 0 if signals need not to be reinstalled */
474 >      signal(SIGUSR1, sigusr1_handler); raise(SIGUSR1); raise(SIGUSR1);
475 >      exit(handled_signal == 2);
476 >    }
477 >  ], ac_cv_signal_need_reinstall=yes, ac_cv_signal_need_reinstall=no,
478 >  dnl When cross-compiling, do not assume anything.
479 >  ac_cv_signal_need_reinstall="guessing yes"
480 >  )
481 >  AC_LANG_RESTORE
482 >  ]
483 > )
484 > AC_TRANSLATE_DEFINE(SIGNAL_NEED_REINSTALL, "$ac_cv_signal_need_reinstall",
485 >  [Define if your system requires signals to be reinstalled.])
486 >
487 > dnl Check if sigaction handlers need to be reinstalled
488 > AC_CACHE_CHECK([whether sigaction handlers need to be reinstalled],
489 >  ac_cv_sigaction_need_reinstall, [
490 >  AC_LANG_SAVE
491 >  AC_LANG_CPLUSPLUS
492 >  AC_TRY_RUN([
493 >    #include <stdlib.h>
494 >    #ifdef HAVE_UNISTD_H
495 >    #include <unistd.h>
496 >    #endif
497 >    #include <signal.h>
498 >    static int handled_signal = 0;
499 >    RETSIGTYPE sigusr1_handler(int) { handled_signal++; }
500 >    typedef RETSIGTYPE (*signal_handler)(int);
501 >    static signal_handler mysignal(int sig, signal_handler handler) {
502 >      struct sigaction old_sa;
503 >      struct sigaction new_sa;
504 >      new_sa.sa_handler = handler;
505 >      return ((sigaction(sig,&new_sa,&old_sa) < 0) ? SIG_IGN : old_sa.sa_handler);
506 >    }
507 >    int main(void) { /* returns 0 if signals need not to be reinstalled */
508 >      mysignal(SIGUSR1, sigusr1_handler); raise(SIGUSR1); raise(SIGUSR1);
509 >      exit(handled_signal == 2);
510 >    }
511 >  ], ac_cv_sigaction_need_reinstall=yes, ac_cv_sigaction_need_reinstall=no,
512 >  dnl When cross-compiling, do not assume anything.
513 >  ac_cv_sigaction_need_reinstall="guessing yes"
514 >  )
515 >  AC_LANG_RESTORE
516 >  ]
517 > )
518 > AC_TRANSLATE_DEFINE(SIGACTION_NEED_REINSTALL, "$ac_cv_sigaction_need_reinstall",
519 >  [Define if your system requires sigactions to be reinstalled.])
520 >
521 > dnl Check if Mach exceptions supported.
522 > AC_CACHE_CHECK([whether your system supports Mach exceptions],
523 >  ac_cv_have_mach_exceptions, [
524 >  AC_LANG_SAVE
525 >  AC_LANG_CPLUSPLUS
526 >  AC_TRY_RUN([
527 >    #define HAVE_MACH_EXCEPTIONS 1
528 >    #define CONFIGURE_TEST_SIGSEGV_RECOVERY
529 >    #include "vm_alloc.cpp"
530 >    #include "sigsegv.cpp"
531 >  ], [
532 >  sigsegv_recovery=mach
533 >  ac_cv_have_mach_exceptions=yes
534 >  ],
535 >  ac_cv_have_mach_exceptions=no,
536 >  dnl When cross-compiling, do not assume anything.
537 >  ac_cv_have_mach_exceptions=no
538 >  )
539 >  AC_LANG_RESTORE
540 >  ]
541 > )
542 > AC_TRANSLATE_DEFINE(HAVE_MACH_EXCEPTIONS, "$ac_cv_have_mach_exceptions",
543 >  [Define if your system supports Mach exceptions.])
544 >
545 > dnl Otherwise, check if extended signals are supported.
546 > if [[ -z "$sigsegv_recovery" ]]; then
547 >  AC_CACHE_CHECK([whether your system supports extended signal handlers],
548 >    ac_cv_have_extended_signals, [
549 >    AC_LANG_SAVE
550 >    AC_LANG_CPLUSPLUS
551 >    AC_TRY_RUN([
552 >      #define HAVE_SIGINFO_T 1
553 >      #define CONFIGURE_TEST_SIGSEGV_RECOVERY
554 >      #include "vm_alloc.cpp"
555 >      #include "sigsegv.cpp"
556 >    ], [
557 >    sigsegv_recovery=siginfo
558 >    ac_cv_have_extended_signals=yes
559 >    ],
560 >    ac_cv_have_extended_signals=no,
561 >    dnl When cross-compiling, do not assume anything.
562 >    ac_cv_have_extended_signals=no
563 >    )
564 >    AC_LANG_RESTORE
565 >    ]
566 >  )
567 >  AC_TRANSLATE_DEFINE(HAVE_SIGINFO_T, "$ac_cv_have_extended_signals",
568 >    [Define if your system support extended signals.])
569 > fi
570 >
571 > dnl Otherwise, check for subterfuges.
572 > if [[ -z "$sigsegv_recovery" ]]; then
573 >  AC_CACHE_CHECK([whether we then have a subterfuge for your system],
574 >  ac_cv_have_sigcontext_hack, [
575 >    AC_LANG_SAVE
576 >    AC_LANG_CPLUSPLUS
577 >    AC_TRY_RUN([
578 >      #define HAVE_SIGCONTEXT_SUBTERFUGE 1
579 >      #define CONFIGURE_TEST_SIGSEGV_RECOVERY
580 >      #include "vm_alloc.cpp"
581 >      #include "sigsegv.cpp"
582 >    ], [
583 >    sigsegv_recovery=sigcontext
584 >    ac_cv_have_sigcontext_hack=yes
585 >    ],
586 >    ac_cv_have_sigcontext_hack=no,
587 >    dnl When cross-compiling, do not assume anything.
588 >    ac_cv_have_sigcontext_hack=no
589 >    )
590 >    AC_LANG_RESTORE
591 >  ])
592 >  AC_TRANSLATE_DEFINE(HAVE_SIGCONTEXT_SUBTERFUGE, "$ac_cv_have_sigcontext_hack",
593 >    [Define if we know a hack to replace siginfo_t->si_addr member.])
594 > fi
595 >
596 > dnl Check if we can ignore the fault (instruction skipping in SIGSEGV handler)
597 > AC_CACHE_CHECK([whether we can skip instruction in SIGSEGV handler],
598 >  ac_cv_have_skip_instruction, [
599 >  AC_LANG_SAVE
600 >  AC_LANG_CPLUSPLUS
601 >  AC_TRY_RUN([
602 >    #define HAVE_SIGSEGV_SKIP_INSTRUCTION 1
603 >    #define CONFIGURE_TEST_SIGSEGV_RECOVERY
604 >    #include "vm_alloc.cpp"
605 >    #include "sigsegv.cpp"
606 >  ], ac_cv_have_skip_instruction=yes, ac_cv_have_skip_instruction=no,
607 >  dnl When cross-compiling, do not assume anything.
608 >  ac_cv_have_skip_instruction=no
609 >  )
610 >  AC_LANG_RESTORE
611 >  ]
612 > )
613 > AC_TRANSLATE_DEFINE(HAVE_SIGSEGV_SKIP_INSTRUCTION, "$ac_cv_have_skip_instruction",
614 >  [Define if we can ignore the fault (instruction skipping in SIGSEGV handler).])
615 >
616 > dnl Can we do Video on SEGV Signals ?
617 > CAN_VOSF=no
618 > if [[ -n "$sigsegv_recovery" ]]; then
619 >  CAN_VOSF=yes
620 > fi
621 >
622 > dnl Enable VOSF screen updates with this feature is requested and feasible
623 > if [[ "x$WANT_VOSF" = "xyes" -a "x$CAN_VOSF" = "xyes" ]]; then
624 >    AC_DEFINE(ENABLE_VOSF, 1, [Define if using video enabled on SEGV signals.])
625 > else
626 >    WANT_VOSF=no
627 > fi
628 >
629 > dnl Platform specific binary postprocessor
630 > BLESS=/bin/true
631 > if [[ "x$ac_cv_pagezero_hack" = "xyes" ]]; then
632 >  BLESS=Darwin/lowmem
633 >  LDFLAGS="$LDFLAGS -pagezero_size 0x3000"
634 > fi
635 >
636 > dnl Check for GCC 2.7 or higher.
637 > HAVE_GCC27=no
638 > AC_MSG_CHECKING(for GCC 2.7 or higher)
639 > AC_EGREP_CPP(xyes,
640 > [#if __GNUC__ - 1 > 1 || __GNUC_MINOR__ - 1 > 5
641 >  xyes
642 > #endif
643 > ], [AC_MSG_RESULT(yes); HAVE_GCC27=yes], AC_MSG_RESULT(no))
644 >
645 > dnl Check for GCC 3.0 or higher.
646 > HAVE_GCC30=no
647 > AC_MSG_CHECKING(for GCC 3.0 or higher)
648 > AC_EGREP_CPP(xyes,
649 > [#if __GNUC__ >= 3
650 >  xyes
651 > #endif
652 > ], [AC_MSG_RESULT(yes); HAVE_GCC30=yes], AC_MSG_RESULT(no))
653 >
654 > dnl Check for ICC.
655 > AC_MSG_CHECKING(for ICC)
656 > HAVE_ICC=no
657 > if $CXX -V -v 2>&1 | grep -q "Intel(R) C++ Compiler"; then
658 >  HAVE_ICC=yes
659 > fi
660 > AC_MSG_RESULT($HAVE_ICC)
661 >
662 > # Test if the compiler can generate ELF objects
663 > AC_CACHE_CHECK([whether the compiler can generate ELF objects],
664 >  ac_cv_elf_objects, [
665 >  echo 'int i;' > conftest.$ac_ext
666 >  ac_cv_elf_objects=no
667 >  if AC_TRY_EVAL(ac_compile); then
668 >    case `/usr/bin/file conftest.$ac_objext` in
669 >    *"ELF"*)
670 >      ac_cv_elf_objects=yes
671 >      ;;
672 >    esac
673 >  fi
674 >  rm -rf conftest*
675 > ])
676 > ELF_OBJECTS=$ac_cv_elf_objects
677 >
678 > dnl CPU emulator sources
679 > if [[ "x$EMULATED_PPC" = "xyes" ]]; then
680 >  CPUSRCS="\
681 >    ../kpx_cpu/src/cpu/ppc/ppc-cpu.cpp \
682 >    ../kpx_cpu/src/cpu/ppc/ppc-decode.cpp \
683 >    ../kpx_cpu/src/cpu/ppc/ppc-execute.cpp \
684 >    ../kpx_cpu/src/cpu/ppc/ppc-translate.cpp"
685 >  CPPFLAGS="$CPPFLAGS -I../kpx_cpu/include -I../kpx_cpu/src"
686 >
687 >  dnl Enable JIT compiler, if possible
688 >  if [[ "x$WANT_JIT" = "xyes" ]]; then
689 >    AC_CACHE_CHECK([whether dyngen can be used],
690 >      ac_cv_use_dyngen, [
691 >      case $host_cpu:$ELF_OBJECTS in
692 >      powerpc:yes)
693 >        ac_cv_use_dyngen=yes
694 >        ;;
695 >      x86_64:yes)
696 >        ac_cv_use_dyngen=yes
697 >        ;;
698 >      i?86:yes)
699 >        ac_cv_use_dyngen=yes
700 >        ;;
701 >      *:*)
702 >        ac_cv_use_dyngen=no
703 >        ;;
704 >      esac
705 >      dnl Check for a suitable synthetic opcodes compiler (icc is faking itself as gcc 3.2.2)
706 >      if [[ -z "$DYNGEN_CC" ]]; then
707 >        if [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_ICC" = "xno" ]]; then
708 >          DYNGEN_CC=$CXX
709 >        else
710 >          for p in /usr/bin /usr/local/bin; do
711 >            gxx="$p/g++"
712 >            if [[ -x "$gxx" ]]; then
713 >              DYNGEN_CC="$gxx"
714 >            fi
715 >          done
716 >        fi
717 >      fi
718 >      if [[ -z "$DYNGEN_CC" ]] || ! { echo '#include <limits>' | $DYNGEN_CC -xc++ -c -o /dev/null - >& /dev/null; }; then
719 >        ac_cv_use_dyngen=no
720 >      fi
721 >    ])
722 >    if [[ "x$ac_cv_use_dyngen" = "xyes" ]]; then
723 >      case $host_cpu in
724 >      i?86)
725 >        DYNGEN_OP_FLAGS="-fomit-frame-pointer -mpreferred-stack-boundary=2"
726 >        if [[ "x$HAVE_GCC30" = "xyes" ]]; then
727 >          DYNGEN_OP_FLAGS="$DYNGEN_OP_FLAGS -falign-functions=0"
728 >        else
729 >          DYNGEN_OP_FLAGS="$DYNGEN_OP_FLAGS -malign-functions=0"
730 >        fi
731 >        if [[ "x$have_mmintrin_h" = "xyes" ]]; then
732 >          DYNGEN_OP_FLAGS="$DYNGEN_OP_FLAGS -mmmx"
733 >        fi
734 >        if [[ "x$have_xmmintrin_h" = "xyes" ]]; then
735 >          DYNGEN_OP_FLAGS="$DYNGEN_OP_FLAGS -msse"
736 >        fi
737 >        if [[ "x$have_emmintrin_h" = "xyes" ]]; then
738 >          DYNGEN_OP_FLAGS="$DYNGEN_OP_FLAGS -msse2"
739 >        fi
740 >        ;;
741 >      esac
742 >      DYNGEN_OP_FLAGS="$DYNGEN_OP_FLAGS -finline-limit=10000"
743 >      if [[ "x$HAVE_GCC30" = "xyes" ]]; then
744 >        DYNGEN_OP_FLAGS="$DYNGEN_OP_FLAGS -fno-reorder-blocks -fno-optimize-sibling-calls"
745 >      fi
746 >    else
747 >      WANT_JIT=no
748 >    fi
749 >    AC_TRANSLATE_DEFINE(ENABLE_DYNGEN, $ac_cv_use_dyngen, [Define to enable dyngen engine])
750 >    if [[ "x$WANT_JIT" = "xyes" ]]; then
751 >      DYNGENSRCS="\
752 >        ../kpx_cpu/src/cpu/jit/dyngen.c \
753 >        ../kpx_cpu/src/cpu/jit/cxxdemangle.cpp"
754 >      CPUSRCS="\
755 >        ../kpx_cpu/src/cpu/jit/jit-cache.cpp \
756 >        ../kpx_cpu/src/cpu/jit/basic-dyngen.cpp \
757 >        ../kpx_cpu/src/cpu/ppc/ppc-dyngen.cpp $CPUSRCS"
758 >    fi
759 >  fi
760 >  CPUSRCS="$CPUSRCS ../kpx_cpu/sheepshaver_glue.cpp"
761   else
762 <  SYSSRCS="../emul_ppc/emul_ppc.cpp"
762 >  WANT_JIT=no
763 > fi
764 > if [[ "x$ac_cv_use_dyngen" = "xyes" ]]; then
765 >  AC_CACHE_CHECK([whether static data regions are executable],
766 >    ac_cv_have_static_data_exec, [
767 >    AC_TRY_RUN([int main(void) {
768 > #if defined(__powerpc__)
769 >      static unsigned int p[8] = {0x4e800020,};
770 >      asm volatile("dcbst 0,%0" : : "r" (p) : "memory");
771 >      asm volatile("sync" : : : "memory");
772 >      asm volatile("icbi 0,%0" : : "r" (p) : "memory");
773 >      asm volatile("sync" : : : "memory");
774 >      asm volatile("isync" : : : "memory");
775 >      ((void (*)(void))p)();
776 >      return 0;
777 > #endif
778 >      return 1;
779 >    }], ac_cv_have_static_data_exec=yes, ac_cv_have_static_data_exec=no,
780 >    dnl When cross-compiling, do not assume anything.
781 >    ac_cv_have_static_data_exec=no
782 >    )
783 >  ])
784 > fi
785 > AC_TRANSLATE_DEFINE(HAVE_STATIC_DATA_EXEC, "$ac_cv_have_static_data_exec",
786 >  [Define if your system marks static data pages as executable.])
787 >
788 > if [[ "x$WANT_JIT" = "xyes" ]]; then
789 >  CPPFLAGS="$CPPFLAGS -DUSE_JIT"
790   fi
164 SYSSRCS="$SYSSRCS $SEMSRCS $UISRCS $MONSRCS"
791  
792   dnl Generate Makefile.
793 + AC_SUBST(DYNGENSRCS)
794 + AC_SUBST(DYNGEN_CC)
795 + AC_SUBST(DYNGEN_OP_FLAGS)
796   AC_SUBST(SYSSRCS)
797 + AC_SUBST(CPUSRCS)
798 + AC_SUBST(BLESS)
799   AC_OUTPUT(Makefile)
800  
801   dnl Print summary.
# Line 173 | Line 804 | echo SheepShaver configuration summary:
804   echo
805   echo XFree86 DGA support .............. : $WANT_XF86_DGA
806   echo XFree86 VidMode support .......... : $WANT_XF86_VIDMODE
807 + echo Using PowerPC emulator ........... : $EMULATED_PPC
808 + echo Enable JIT compiler .............. : $WANT_JIT
809 + echo Enable video on SEGV signals ..... : $WANT_VOSF
810   echo ESD sound support ................ : $WANT_ESD
811   echo GTK user interface ............... : $WANT_GTK
812   echo mon debugger support ............. : $WANT_MON
813 + echo Bad memory access recovery type .. : $sigsegv_recovery
814   echo
815   echo "Configuration done. Now type \"make\"."

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines