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.4 by gbeauche, 2003-05-13T16:59:57Z vs.
Revision 1.14 by gbeauche, 2004-01-04T18:36:47Z

# 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])
# Line 29 | Line 36 | AC_EGREP_CPP(yes,
36   #endif
37   ], [AC_MSG_RESULT(yes); HAVE_PPC=yes], AC_MSG_RESULT(no))
38  
39 + dnl We use native CPU if possible.
40 + EMULATED_PPC=yes
41 + case $WANT_EMULATED_PPC in
42 +  auto) [[ "x$HAVE_PPC" = "xyes" ]] && EMULATED_PPC=no;;
43 +  no)   EMULATED_PPC=no;;
44 + esac
45 + if [[ "x$EMULATED_PPC" = "xyes" ]]; then
46 +  AC_DEFINE(EMULATED_PPC)
47 + fi
48 +
49   dnl We use mon if possible.
50   MONSRCS=
51 + case "x$WANT_MON" in
52 + x/* | x.*)
53 +  mon_srcdir=$WANT_MON
54 +  WANT_MON=yes
55 +  ;;
56 + yes)
57 +  mon_srcdir=../../../mon/src
58 +  ;;
59 + esac
60   if [[ "x$WANT_MON" = "xyes" ]]; then
61    AC_MSG_CHECKING(for mon)
36  mon_srcdir=../../../mon/src
62    if grep mon_init $mon_srcdir/mon.h >/dev/null 2>/dev/null; then
63      AC_MSG_RESULT(yes)
64      AC_DEFINE(ENABLE_MON)
# Line 68 | Line 93 | LIBS="$LIBS $X_PRE_LIBS $X_LIBS -lX11 -l
93  
94   dnl We need pthreads on non-PowerPC systems. Try libpthread first, then libc_r (FreeBSD), then PTL.
95   HAVE_PTHREADS=yes
96 < if [[ "x$HAVE_PPC" = "xno" ]]; then
96 > if [[ "x$EMULATED_PPC" = "xyes" ]]; then
97    AC_CHECK_LIB(pthread, pthread_create, , [
98      AC_CHECK_LIB(c_r, pthread_create, , [
99        AC_CHECK_LIB(PTL, pthread_create, , [
# Line 77 | Line 102 | if [[ "x$HAVE_PPC" = "xno" ]]; then
102      ])
103    ])
104    AC_CHECK_FUNCS(pthread_cancel)
105 +  if [[ "x$HAVE_PTHREADS" = "xyes" ]]; then
106 +    AC_DEFINE(HAVE_PTHREADS, 1, [Define if pthreads are available.])
107 +  fi
108 + else
109 +  dnl We do have our own pthread_cancel() implementation
110 +  AC_DEFINE(HAVE_PTHREAD_CANCEL, 1, [Define if you have the pthread_cancel function.])
111   fi
112  
113   dnl If POSIX.4 semaphores are not available, we emulate them with pthread mutexes.
# Line 140 | Line 171 | fi
171   dnl Checks for header files.
172   AC_HEADER_STDC
173   AC_HEADER_SYS_WAIT
174 < AC_CHECK_HEADERS(unistd.h fcntl.h sys/time.h sys/mman.h)
174 > AC_CHECK_HEADERS(mach/vm_map.h mach/mach_init.h sys/mman.h)
175 > AC_CHECK_HEADERS(sys/time.h sys/times.h)
176 > AC_CHECK_HEADERS(unistd.h fcntl.h byteswap.h)
177  
178   dnl Checks for typedefs, structures, and compiler characteristics.
179   AC_C_BIGENDIAN
# Line 168 | Line 201 | AC_CHECK_FUNCS(mmap mprotect munmap)
201   AC_CHECK_FUNCS(vm_allocate vm_deallocate vm_protect)
202  
203   dnl Select system-dependant sources.
204 < if [[ "x$HAVE_PPC" = "xyes" ]]; then
204 > if [[ "x$EMULATED_PPC" = "xno" ]]; then
205    SYSSRCS="Linux/paranoia.cpp Linux/sheepthreads.c Linux/asm_linux.S"
173 else
174  SYSSRCS="../emul_ppc/emul_ppc.cpp"
206   fi
207   SYSSRCS="$SYSSRCS $SEMSRCS $UISRCS $MONSRCS"
208  
# Line 477 | Line 508 | AC_CACHE_CHECK([whether we can skip inst
508   AC_TRANSLATE_DEFINE(HAVE_SIGSEGV_SKIP_INSTRUCTION, "$ac_cv_have_skip_instruction",
509    [Define if we can ignore the fault (instruction skipping in SIGSEGV handler).])
510  
511 + dnl Can we do Video on SEGV Signals ?
512 + CAN_VOSF=no
513 + if [[ "$ac_cv_have_extended_signals" = "yes" -o "$ac_cv_have_sigcontext_hack" = "yes" ]]; then
514 +  CAN_VOSF=yes
515 + fi
516 +
517 + dnl Enable VOSF screen updates with this feature is requested and feasible
518 + if [[ "x$WANT_VOSF" = "xyes" -a "x$CAN_VOSF" = "xyes" ]]; then
519 +    AC_DEFINE(ENABLE_VOSF, 1, [Define if using video enabled on SEGV signals.])
520 + else
521 +    WANT_VOSF=no
522 + fi
523 +
524 + dnl Check for GCC 2.7 or higher.
525 + HAVE_GCC27=no
526 + AC_MSG_CHECKING(for GCC 2.7 or higher)
527 + AC_EGREP_CPP(xyes,
528 + [#if __GNUC__ - 1 > 1 || __GNUC_MINOR__ - 1 > 5
529 +  xyes
530 + #endif
531 + ], [AC_MSG_RESULT(yes); HAVE_GCC27=yes], AC_MSG_RESULT(no))
532 +
533 + dnl Check for GCC 3.0 or higher.
534 + HAVE_GCC30=no
535 + AC_MSG_CHECKING(for GCC 3.0 or higher)
536 + AC_EGREP_CPP(xyes,
537 + [#if __GNUC__ >= 3
538 +  xyes
539 + #endif
540 + ], [AC_MSG_RESULT(yes); HAVE_GCC30=yes], AC_MSG_RESULT(no))
541 +
542 + # Test if the compiler can generate ELF objects
543 + AC_CACHE_CHECK([whether the compiler can generate ELF objects],
544 +  ac_cv_elf_objects, [
545 +  echo 'int i;' > conftest.$ac_ext
546 +  ac_cv_elf_objects=no
547 +  if AC_TRY_EVAL(ac_compile); then
548 +    case `/usr/bin/file conftest.$ac_objext` in
549 +    *"ELF"*)
550 +      ac_cv_elf_objects=yes
551 +      ;;
552 +    esac
553 +  fi
554 +  rm -rf conftest*
555 + ])
556 + ELF_OBJECTS=$ac_cv_elf_objects
557 +
558 + dnl CPU emulator sources
559 + if [[ "x$EMULATED_PPC" = "xyes" ]]; then
560 +  CPUSRCS="\
561 +    ../kpx_cpu/src/cpu/ppc/ppc-cpu.cpp \
562 +    ../kpx_cpu/src/cpu/ppc/ppc-decode.cpp \
563 +    ../kpx_cpu/src/cpu/ppc/ppc-execute.cpp \
564 +    ../kpx_cpu/src/cpu/ppc/ppc-translate.cpp"
565 +  CPPFLAGS="$CPPFLAGS -I../kpx_cpu/include -I../kpx_cpu/src"
566 +
567 +  dnl Enable JIT compiler, if possible
568 +  if [[ "x$WANT_JIT" = "xyes" ]]; then
569 +    AC_CACHE_CHECK([whether dyngen can be used],
570 +      ac_cv_use_dyngen, [
571 +      case $host_cpu:$ELF_OBJECTS in
572 +      powerpc:yes)
573 +        ac_cv_use_dyngen=yes
574 +        ;;
575 +      x86_64:yes)
576 +        ac_cv_use_dyngen=yes
577 +        ;;
578 +      i?86:yes)
579 +        ac_cv_use_dyngen=yes
580 +        ;;
581 +      *:*)
582 +        ac_cv_use_dyngen=no
583 +        ;;
584 +      esac
585 +    ])
586 +    if [[ "x$ac_cv_use_dyngen" = "xyes" ]]; then
587 +      case $host_cpu in
588 +      i?86)
589 +        DYNGEN_OP_FLAGS="-fomit-frame-pointer -mpreferred-stack-boundary=2"
590 +        if [[ "x$HAVE_GCC30" = "xyes" ]]; then
591 +          DYNGEN_OP_FLAGS="$DYNGEN_OP_FLAGS -falign-functions=0"
592 +        else
593 +          DYNGEN_OP_FLAGS="$DYNGEN_OP_FLAGS -malign-functions=0"
594 +        fi
595 +        ;;
596 +      esac
597 +      DYNGEN_OP_FLAGS="$DYNGEN_OP_FLAGS -finline-limit=10000"
598 +      if [[ "x$HAVE_GCC30" = "xyes" ]]; then
599 +        DYNGEN_OP_FLAGS="$DYNGEN_OP_FLAGS -fno-reorder-blocks -fno-optimize-sibling-calls"
600 +      fi
601 +    else
602 +      WANT_JIT=no
603 +    fi
604 +    AC_TRANSLATE_DEFINE(ENABLE_DYNGEN, $ac_cv_use_dyngen, [Define to enable dyngen engine])
605 +    if [[ "x$WANT_JIT" = "xyes" ]]; then
606 +      DYNGENSRCS="\
607 +        ../kpx_cpu/src/cpu/jit/dyngen.c \
608 +        ../kpx_cpu/src/cpu/jit/cxxdemangle.cpp"
609 +      CPUSRCS="\
610 +        ../kpx_cpu/src/cpu/jit/jit-cache.cpp \
611 +        ../kpx_cpu/src/cpu/jit/basic-dyngen.cpp \
612 +        ../kpx_cpu/src/cpu/ppc/ppc-dyngen.cpp $CPUSRCS"
613 +    fi
614 +  fi
615 +  CPUSRCS="$CPUSRCS ../kpx_cpu/sheepshaver_glue.cpp"
616 + else
617 +  WANT_JIT=no
618 + fi
619 + if [[ "x$ac_cv_use_dyngen" = "xyes" ]]; then
620 +  AC_CACHE_CHECK([whether static data regions are executable],
621 +    ac_cv_have_static_data_exec, [
622 +    AC_TRY_RUN([int main(void) {
623 + #if defined(__powerpc__)
624 +      static unsigned int p[8] = {0x4e800020,};
625 +      asm volatile("dcbst 0,%0" : : "r" (p) : "memory");
626 +      asm volatile("sync" : : : "memory");
627 +      asm volatile("icbi 0,%0" : : "r" (p) : "memory");
628 +      asm volatile("sync" : : : "memory");
629 +      asm volatile("isync" : : : "memory");
630 +      ((void (*)(void))p)();
631 +      return 0;
632 + #endif
633 +      return 1;
634 +    }], ac_cv_have_static_data_exec=yes, ac_cv_have_static_data_exec=no,
635 +    dnl When cross-compiling, do not assume anything.
636 +    ac_cv_have_static_data_exec=no
637 +    )
638 +  ])
639 + fi
640 + AC_TRANSLATE_DEFINE(HAVE_STATIC_DATA_EXEC, "$ac_cv_have_static_data_exec",
641 +  [Define if your system marks static data pages as executable.])
642 +
643 + if [[ "x$WANT_JIT" = "xyes" ]]; then
644 +  CPPFLAGS="$CPPFLAGS -DUSE_JIT"
645 + fi
646 +
647   dnl Generate Makefile.
648 + AC_SUBST(DYNGENSRCS)
649 + AC_SUBST(DYNGEN_OP_FLAGS)
650   AC_SUBST(SYSSRCS)
651 + AC_SUBST(CPUSRCS)
652   AC_OUTPUT(Makefile)
653  
654   dnl Print summary.
# Line 487 | Line 657 | echo SheepShaver configuration summary:
657   echo
658   echo XFree86 DGA support .............. : $WANT_XF86_DGA
659   echo XFree86 VidMode support .......... : $WANT_XF86_VIDMODE
660 + echo Using PowerPC emulator ........... : $EMULATED_PPC
661 + echo Enable JIT compiler .............. : $WANT_JIT
662 + echo Enable video on SEGV signals ..... : $WANT_VOSF
663   echo ESD sound support ................ : $WANT_ESD
664   echo GTK user interface ............... : $WANT_GTK
665   echo mon debugger support ............. : $WANT_MON

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines