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.6 by gbeauche, 2003-09-07T14:21:20Z

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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines