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.8 by gbeauche, 2003-09-28T21:19:06Z

# Line 6 | Line 6 | AC_PREREQ(2.12)
6   AC_CONFIG_HEADER(config.h)
7  
8   dnl Options.
9 + AC_ARG_ENABLE(ppc-emulator, [  --enable-ppc-emulator   use the selected PowerPC emulator [default=auto]], [WANT_EMULATED_PPC=$enableval], [WANT_EMULATED_PPC=auto])
10   AC_ARG_ENABLE(xf86-dga,     [  --enable-xf86-dga       use the XFree86 DGA extension [default=yes]], [WANT_XF86_DGA=$enableval], [WANT_XF86_DGA=yes])
11   AC_ARG_ENABLE(xf86-vidmode, [  --enable-xf86-vidmode   use the XFree86 VidMode extension [default=yes]], [WANT_XF86_VIDMODE=$enableval], [WANT_XF86_VIDMODE=yes])
12 + AC_ARG_ENABLE(vosf,         [  --enable-vosf           enable video on SEGV signals [default=yes]], [WANT_VOSF=$enableval], [WANT_VOSF=yes])
13   AC_ARG_WITH(esd,            [  --with-esd              support ESD for sound under Linux/FreeBSD [default=yes]], [WANT_ESD=$withval], [WANT_ESD=yes])
14   AC_ARG_WITH(gtk,            [  --with-gtk              use GTK user interface [default=yes]], [WANT_GTK=$withval], [WANT_GTK=yes])
15   AC_ARG_WITH(mon,            [  --with-mon              use mon as debugger [default=yes]], [WANT_MON=$withval], [WANT_MON=yes])
# Line 29 | Line 31 | AC_EGREP_CPP(yes,
31   #endif
32   ], [AC_MSG_RESULT(yes); HAVE_PPC=yes], AC_MSG_RESULT(no))
33  
34 + dnl We use native CPU if possible.
35 + EMULATED_PPC=yes
36 + case $WANT_EMULATED_PPC in
37 +  auto) [[ "x$HAVE_PPC" = "xyes" ]] && EMULATED_PPC=no;;
38 +  no)   EMULATED_PPC=no;;
39 + esac
40 + if [[ "x$EMULATED_PPC" = "xyes" ]]; then
41 +  AC_DEFINE(EMULATED_PPC)
42 + fi
43 +
44   dnl We use mon if possible.
45   MONSRCS=
46   if [[ "x$WANT_MON" = "xyes" ]]; then
# Line 68 | Line 80 | LIBS="$LIBS $X_PRE_LIBS $X_LIBS -lX11 -l
80  
81   dnl We need pthreads on non-PowerPC systems. Try libpthread first, then libc_r (FreeBSD), then PTL.
82   HAVE_PTHREADS=yes
83 < if [[ "x$HAVE_PPC" = "xno" ]]; then
83 > if [[ "x$EMULATED_PPC" = "xyes" ]]; then
84    AC_CHECK_LIB(pthread, pthread_create, , [
85      AC_CHECK_LIB(c_r, pthread_create, , [
86        AC_CHECK_LIB(PTL, pthread_create, , [
# Line 77 | Line 89 | if [[ "x$HAVE_PPC" = "xno" ]]; then
89      ])
90    ])
91    AC_CHECK_FUNCS(pthread_cancel)
92 +  if [[ "x$HAVE_PTHREADS" = "xyes" ]]; then
93 +    AC_DEFINE(HAVE_PTHREADS, 1, [Define if pthreads are available.])
94 +  fi
95   fi
96  
97   dnl If POSIX.4 semaphores are not available, we emulate them with pthread mutexes.
98   SEMSRC=
99   AC_CHECK_FUNCS(sem_init, , [
100 <  if [[ "x$HAVE_PTHREADS" = "xyes" ]]; then
100 >  if test "x$HAVE_PTHREADS" = "xyes"; then
101      SEMSRC=posix_sem.cpp
102    fi
103   ])
# Line 140 | Line 155 | fi
155   dnl Checks for header files.
156   AC_HEADER_STDC
157   AC_HEADER_SYS_WAIT
158 < AC_CHECK_HEADERS(unistd.h fcntl.h sys/time.h)
158 > AC_CHECK_HEADERS(mach/vm_map.h mach/mach_init.h sys/mman.h)
159 > AC_CHECK_HEADERS(sys/time.h sys/times.h)
160 > AC_CHECK_HEADERS(unistd.h fcntl.h byteswap.h)
161  
162   dnl Checks for typedefs, structures, and compiler characteristics.
163   AC_C_BIGENDIAN
# Line 150 | Line 167 | AC_CHECK_SIZEOF(short, 2)
167   AC_CHECK_SIZEOF(int, 4)
168   AC_CHECK_SIZEOF(long, 4)
169   AC_CHECK_SIZEOF(long long, 8)
170 + AC_CHECK_SIZEOF(float, 4)
171 + AC_CHECK_SIZEOF(double, 8)
172 + AC_CHECK_SIZEOF(void *, 4)
173   AC_TYPE_OFF_T
174   AC_CHECK_TYPE(loff_t, off_t)
175   AC_TYPE_SIZE_T
176 + AC_TYPE_SIGNAL
177   AC_HEADER_TIME
178   AC_STRUCT_TM
179  
180   dnl Checks for library functions.
181   AC_CHECK_FUNCS(strdup cfmakeraw)
182   AC_CHECK_FUNCS(nanosleep clock_gettime timer_create)
183 + AC_CHECK_FUNCS(sigaction signal)
184 + AC_CHECK_FUNCS(mmap mprotect munmap)
185 + AC_CHECK_FUNCS(vm_allocate vm_deallocate vm_protect)
186  
187   dnl Select system-dependant sources.
188 < if [[ "x$HAVE_PPC" = "xyes" ]]; then
188 > if [[ "x$EMULATED_PPC" = "xno" ]]; then
189    SYSSRCS="Linux/paranoia.cpp Linux/sheepthreads.c Linux/asm_linux.S"
190   else
191 <  SYSSRCS="../emul_ppc/emul_ppc.cpp"
191 >  SYSSRCS="../kpx_cpu/sheepshaver_glue.cpp \
192 >        ../kpx_cpu/src/cpu/ppc/ppc-cpu.cpp \
193 >        ../kpx_cpu/src/cpu/ppc/ppc-decode.cpp \
194 >        ../kpx_cpu/src/cpu/ppc/ppc-execute.cpp"
195 >  CPPFLAGS="$CPPFLAGS -I../kpx_cpu/include -I../kpx_cpu/src"
196   fi
197   SYSSRCS="$SYSSRCS $SEMSRCS $UISRCS $MONSRCS"
198  
199 + dnl Define a macro that translates a yesno-variable into a C macro definition
200 + dnl to be put into the config.h file
201 + dnl $1 -- the macro to define
202 + dnl $2 -- the value to translate
203 + dnl $3 -- template name
204 + AC_DEFUN(AC_TRANSLATE_DEFINE, [
205 +    if [[ "x$2" = "xyes" -o "x$2" = "xguessing yes" ]]; then
206 +        AC_DEFINE($1, 1, $3)
207 +    fi
208 + ])
209 +
210 + dnl Various checks if the system supports vm_allocate() and the like functions.
211 + have_mach_vm=no
212 + if [[ "x$ac_cv_func_vm_allocate" = "xyes" -a "x$ac_cv_func_vm_deallocate" = "xyes" -a \
213 +      "x$ac_cv_func_vm_protect" = "xyes" ]]; then
214 +  have_mach_vm=yes
215 + fi
216 + AC_TRANSLATE_DEFINE(HAVE_MACH_VM, "$have_mach_vm",
217 +  [Define if your system has a working vm_allocate()-based memory allocator.])
218 +
219 + dnl Check that vm_allocate(), vm_protect() work
220 + if [[ "x$have_mach_vm" = "xyes" ]]; then
221 +
222 + AC_CACHE_CHECK([whether vm_protect works],
223 +  ac_cv_vm_protect_works, [
224 +  AC_LANG_SAVE
225 +  AC_LANG_CPLUSPLUS
226 +  ac_cv_vm_protect_works=yes
227 +  dnl First the tests that should segfault
228 +  for test_def in NONE_READ NONE_WRITE READ_WRITE; do
229 +    AC_TRY_RUN([
230 +      #define CONFIGURE_TEST_VM_MAP
231 +      #define TEST_VM_PROT_$test_def
232 +      #include "vm_alloc.cpp"
233 +    ], ac_cv_vm_protect_works=no, rm -f core,
234 +    dnl When cross-compiling, do not assume anything
235 +    ac_cv_vm_protect_works="guessing no"
236 +    )
237 +  done
238 +  AC_TRY_RUN([
239 +    #define CONFIGURE_TEST_VM_MAP
240 +    #define TEST_VM_PROT_RDWR_WRITE
241 +    #include "vm_alloc.cpp"
242 +  ], , ac_cv_vm_protect_works=no,
243 +  dnl When cross-compiling, do not assume anything
244 +  ac_cv_vm_protect_works="guessing no"
245 +  )
246 +  AC_LANG_RESTORE
247 +  ]
248 + )
249 +
250 + dnl Remove support for vm_allocate() if vm_protect() does not work
251 + if [[ "x$have_mach_vm" = "xyes" ]]; then
252 +  case $ac_cv_vm_protect_works in
253 +    *yes) have_mach_vm=yes;;
254 +    *no) have_mach_vm=no;;
255 +  esac
256 + fi
257 + AC_TRANSLATE_DEFINE(HAVE_MACH_VM, "$have_mach_vm",
258 +  [Define if your system has a working vm_allocate()-based memory allocator.])
259 +
260 + fi dnl HAVE_MACH_VM
261 +
262 + dnl Various checks if the system supports mmap() and the like functions.
263 + dnl ... and Mach memory allocators are not supported
264 + have_mmap_vm=no
265 + if [[ "x$ac_cv_func_mmap" = "xyes" -a "x$ac_cv_func_munmap" = "xyes" -a \
266 +      "x$ac_cv_func_mprotect" = "xyes" ]]; then
267 +  if [[ "x$have_mach_vm" = "xno" ]]; then
268 +    have_mmap_vm=yes
269 +  fi
270 + fi
271 + AC_TRANSLATE_DEFINE(HAVE_MMAP_VM, "$have_mmap_vm",
272 +  [Define if your system has a working mmap()-based memory allocator.])
273 +
274 + dnl Check that mmap() and associated functions work.
275 + if [[ "x$have_mmap_vm" = "xyes" ]]; then
276 +
277 + dnl Check if we have a working anonymous mmap()
278 + AC_CACHE_CHECK([whether mmap supports MAP_ANON],
279 +  ac_cv_mmap_anon, [
280 +  AC_LANG_SAVE
281 +  AC_LANG_CPLUSPLUS
282 +  AC_TRY_RUN([
283 +    #define HAVE_MMAP_ANON
284 +    #define CONFIGURE_TEST_VM_MAP
285 +    #define TEST_VM_MMAP_ANON
286 +    #include "vm_alloc.cpp"
287 +  ], ac_cv_mmap_anon=yes, ac_cv_mmap_anon=no,
288 +  dnl When cross-compiling, do not assume anything.
289 +  ac_cv_mmap_anon="guessing no"
290 +  )
291 +  AC_LANG_RESTORE
292 +  ]
293 + )
294 + AC_TRANSLATE_DEFINE(HAVE_MMAP_ANON, "$ac_cv_mmap_anon",
295 +  [Define if <sys/mman.h> defines MAP_ANON and mmap()'ing with MAP_ANON works.])
296 +
297 + AC_CACHE_CHECK([whether mmap supports MAP_ANONYMOUS],
298 +  ac_cv_mmap_anonymous, [
299 +  AC_LANG_SAVE
300 +  AC_LANG_CPLUSPLUS
301 +  AC_TRY_RUN([
302 +    #define HAVE_MMAP_ANONYMOUS
303 +    #define CONFIGURE_TEST_VM_MAP
304 +    #define TEST_VM_MMAP_ANON
305 +    #include "vm_alloc.cpp"
306 +  ], ac_cv_mmap_anonymous=yes, ac_cv_mmap_anonymous=no,
307 +  dnl When cross-compiling, do not assume anything.
308 +  ac_cv_mmap_anonymous="guessing no"
309 +  )
310 +  AC_LANG_RESTORE
311 +  ]
312 + )
313 + AC_TRANSLATE_DEFINE(HAVE_MMAP_ANONYMOUS, "$ac_cv_mmap_anonymous",
314 +  [Define if <sys/mman.h> defines MAP_ANONYMOUS and mmap()'ing with MAP_ANONYMOUS works.])
315 +
316 + AC_CACHE_CHECK([whether mprotect works],
317 +  ac_cv_mprotect_works, [
318 +  AC_LANG_SAVE
319 +  AC_LANG_CPLUSPLUS
320 +  ac_cv_mprotect_works=yes
321 +  dnl First the tests that should segfault
322 +  for test_def in NONE_READ NONE_WRITE READ_WRITE; do
323 +    AC_TRY_RUN([
324 +      #define CONFIGURE_TEST_VM_MAP
325 +      #define TEST_VM_PROT_$test_def
326 +      #include "vm_alloc.cpp"
327 +    ], ac_cv_mprotect_works=no, rm -f core,
328 +    dnl When cross-compiling, do not assume anything
329 +    ac_cv_mprotect_works="guessing no"
330 +    )
331 +  done
332 +  AC_TRY_RUN([
333 +    #define CONFIGURE_TEST_VM_MAP
334 +    #define TEST_VM_PROT_RDWR_WRITE
335 +    #include "vm_alloc.cpp"
336 +  ], , ac_cv_mprotect_works=no,
337 +  dnl When cross-compiling, do not assume anything
338 +  ac_cv_mprotect_works="guessing no"
339 +  )
340 +  AC_LANG_RESTORE
341 +  ]
342 + )
343 +
344 + dnl Remove support for mmap() if mprotect() does not work
345 + if [[ "x$have_mmap_vm" = "xyes" ]]; then
346 +  case $ac_cv_mprotect_works in
347 +    *yes) have_mmap_vm=yes;;
348 +    *no) have_mmap_vm=no;;
349 +  esac
350 + fi
351 + AC_TRANSLATE_DEFINE(HAVE_MMAP_VM, $have_mmap_vm,
352 +  [Define if your system has a working mmap()-based memory allocator.])
353 +
354 + fi dnl HAVE_MMAP_VM
355 +
356 + dnl Check if we can mmap 0x2000 bytes from 0x0000
357 + AC_CACHE_CHECK([whether we can map Low Memory area 0x0000-0x2000],
358 +  ac_cv_can_map_lm, [
359 +  AC_LANG_SAVE
360 +  AC_LANG_CPLUSPLUS
361 +  AC_TRY_RUN([
362 +    #include "vm_alloc.cpp"
363 +    int main(void) { /* returns 0 if we could map the lowmem globals */
364 +      volatile char * lm = 0;
365 +      if (vm_init() < 0) exit(1);
366 +      if (vm_acquire_fixed(0, 0x2000) < 0) exit(1);
367 +      lm[0] = 'z';
368 +      if (vm_release((char *)lm, 0x2000) < 0) exit(1);
369 +      vm_exit(); exit(0);
370 +    }
371 +  ], ac_cv_can_map_lm=yes, ac_cv_can_map_lm=no,
372 +  dnl When cross-compiling, do not assume anything.
373 +  ac_cv_can_map_lm="guessing no"
374 +  )
375 +  AC_LANG_RESTORE
376 +  ]
377 + )
378 +
379 + dnl Check signal handlers need to be reinstalled
380 + AC_CACHE_CHECK([whether signal handlers need to be reinstalled],
381 +  ac_cv_signal_need_reinstall, [
382 +  AC_LANG_SAVE
383 +  AC_LANG_CPLUSPLUS
384 +  AC_TRY_RUN([
385 +    #include <stdlib.h>
386 +    #ifdef HAVE_UNISTD_H
387 +    #include <unistd.h>
388 +    #endif
389 +    #include <signal.h>
390 +    static int handled_signal = 0;
391 +    RETSIGTYPE sigusr1_handler(int) { handled_signal++; }
392 +    int main(void) { /* returns 0 if signals need not to be reinstalled */
393 +      signal(SIGUSR1, sigusr1_handler); raise(SIGUSR1); raise(SIGUSR1);
394 +      exit(handled_signal == 2);
395 +    }
396 +  ], ac_cv_signal_need_reinstall=yes, ac_cv_signal_need_reinstall=no,
397 +  dnl When cross-compiling, do not assume anything.
398 +  ac_cv_signal_need_reinstall="guessing yes"
399 +  )
400 +  AC_LANG_RESTORE
401 +  ]
402 + )
403 + AC_TRANSLATE_DEFINE(SIGNAL_NEED_REINSTALL, "$ac_cv_signal_need_reinstall",
404 +  [Define if your system requires signals to be reinstalled.])
405 +
406 + dnl Check if sigaction handlers need to be reinstalled
407 + AC_CACHE_CHECK([whether sigaction handlers need to be reinstalled],
408 +  ac_cv_sigaction_need_reinstall, [
409 +  AC_LANG_SAVE
410 +  AC_LANG_CPLUSPLUS
411 +  AC_TRY_RUN([
412 +    #include <stdlib.h>
413 +    #ifdef HAVE_UNISTD_H
414 +    #include <unistd.h>
415 +    #endif
416 +    #include <signal.h>
417 +    static int handled_signal = 0;
418 +    RETSIGTYPE sigusr1_handler(int) { handled_signal++; }
419 +    typedef RETSIGTYPE (*signal_handler)(int);
420 +    static signal_handler mysignal(int sig, signal_handler handler) {
421 +      struct sigaction old_sa;
422 +      struct sigaction new_sa;
423 +      new_sa.sa_handler = handler;
424 +      return ((sigaction(sig,&new_sa,&old_sa) < 0) ? SIG_IGN : old_sa.sa_handler);
425 +    }
426 +    int main(void) { /* returns 0 if signals need not to be reinstalled */
427 +      mysignal(SIGUSR1, sigusr1_handler); raise(SIGUSR1); raise(SIGUSR1);
428 +      exit(handled_signal == 2);
429 +    }
430 +  ], ac_cv_sigaction_need_reinstall=yes, ac_cv_sigaction_need_reinstall=no,
431 +  dnl When cross-compiling, do not assume anything.
432 +  ac_cv_sigaction_need_reinstall="guessing yes"
433 +  )
434 +  AC_LANG_RESTORE
435 +  ]
436 + )
437 + AC_TRANSLATE_DEFINE(SIGACTION_NEED_REINSTALL, "$ac_cv_sigaction_need_reinstall",
438 +  [Define if your system requires sigactions to be reinstalled.])
439 +
440 + dnl Check if extended signals are supported.
441 + AC_CACHE_CHECK([whether your system supports extended signal handlers],
442 +  ac_cv_have_extended_signals, [
443 +  AC_LANG_SAVE
444 +  AC_LANG_CPLUSPLUS
445 +  AC_TRY_RUN([
446 +    #define HAVE_SIGINFO_T 1
447 +    #define CONFIGURE_TEST_SIGSEGV_RECOVERY
448 +    #include "vm_alloc.cpp"
449 +    #include "sigsegv.cpp"
450 +  ], ac_cv_have_extended_signals=yes, ac_cv_have_extended_signals=no,
451 +  dnl When cross-compiling, do not assume anything.
452 +  ac_cv_have_extended_signals=no
453 +  )
454 +  AC_LANG_RESTORE
455 +  ]
456 + )
457 + AC_TRANSLATE_DEFINE(HAVE_SIGINFO_T, "$ac_cv_have_extended_signals",
458 +  [Define if your system support extended signals.])
459 +
460 + dnl Otherwise, check for subterfuges.
461 + if [[ "x$ac_cv_have_extended_signals" = "xno" ]]; then
462 +  AC_CACHE_CHECK([whether we then have a subterfuge for your system],
463 +  ac_cv_have_sigcontext_hack, [
464 +    AC_LANG_SAVE
465 +    AC_LANG_CPLUSPLUS
466 +    AC_TRY_RUN([
467 +      #define HAVE_SIGCONTEXT_SUBTERFUGE 1
468 +      #define CONFIGURE_TEST_SIGSEGV_RECOVERY
469 +      #include "vm_alloc.cpp"
470 +      #include "sigsegv.cpp"
471 +    ], ac_cv_have_sigcontext_hack=yes, ac_cv_have_sigcontext_hack=no,
472 +    dnl When cross-compiling, do not assume anything.
473 +    ac_cv_have_sigcontext_hack=no
474 +    )
475 +    AC_LANG_RESTORE
476 +  ])
477 +  AC_TRANSLATE_DEFINE(HAVE_SIGCONTEXT_SUBTERFUGE, "$ac_cv_have_sigcontext_hack",
478 +    [Define if we know a hack to replace siginfo_t->si_addr member.])
479 + fi
480 +
481 + dnl Check if we can ignore the fault (instruction skipping in SIGSEGV handler)
482 + AC_CACHE_CHECK([whether we can skip instruction in SIGSEGV handler],
483 +  ac_cv_have_skip_instruction, [
484 +  AC_LANG_SAVE
485 +  AC_LANG_CPLUSPLUS
486 +  AC_TRY_RUN([
487 +    #define HAVE_SIGSEGV_SKIP_INSTRUCTION 1
488 +    #define CONFIGURE_TEST_SIGSEGV_RECOVERY
489 +    #include "vm_alloc.cpp"
490 +    #include "sigsegv.cpp"
491 +  ], ac_cv_have_skip_instruction=yes, ac_cv_have_skip_instruction=no,
492 +  dnl When cross-compiling, do not assume anything.
493 +  ac_cv_have_skip_instruction=no
494 +  )
495 +  AC_LANG_RESTORE
496 +  ]
497 + )
498 + AC_TRANSLATE_DEFINE(HAVE_SIGSEGV_SKIP_INSTRUCTION, "$ac_cv_have_skip_instruction",
499 +  [Define if we can ignore the fault (instruction skipping in SIGSEGV handler).])
500 +
501 + dnl Can we do Video on SEGV Signals ?
502 + CAN_VOSF=no
503 + if [[ "$ac_cv_have_extended_signals" = "yes" -o "$ac_cv_have_sigcontext_hack" = "yes" ]]; then
504 +  CAN_VOSF=yes
505 + fi
506 +
507 + dnl Enable VOSF screen updates with this feature is requested and feasible
508 + if [[ "x$WANT_VOSF" = "xyes" -a "x$CAN_VOSF" = "xyes" ]]; then
509 +    AC_DEFINE(ENABLE_VOSF, 1, [Define if using video enabled on SEGV signals.])
510 + else
511 +    WANT_VOSF=no
512 + fi
513 +
514   dnl Generate Makefile.
515   AC_SUBST(SYSSRCS)
516   AC_OUTPUT(Makefile)
# Line 178 | Line 521 | echo SheepShaver configuration summary:
521   echo
522   echo XFree86 DGA support .............. : $WANT_XF86_DGA
523   echo XFree86 VidMode support .......... : $WANT_XF86_VIDMODE
524 + echo Using PowerPC emulator ........... : $EMULATED_PPC
525 + echo Enable video on SEGV signals ..... : $WANT_VOSF
526   echo ESD sound support ................ : $WANT_ESD
527   echo GTK user interface ............... : $WANT_GTK
528   echo mon debugger support ............. : $WANT_MON

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines