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

Comparing SheepShaver/src/Unix/configure.ac (file contents):
Revision 1.8 by gbeauche, 2004-11-13T14:09:15Z vs.
Revision 1.36 by gbeauche, 2005-07-06T05:26:01Z

# Line 14 | Line 14 | dnl Some systems do not put corefiles in
14   dnl cores for the configure tests since some are intended to dump core.
15   ulimit -c 0
16  
17 + dnl Invite Cygwin users to build within the Windows/ directory
18 + case $target_os in
19 + *cygwin* | *mingw32*)
20 +  AC_MSG_ERROR([You can only build the Windows version from its directory, Cygwin/X11 is not supported.])
21 +  ;;
22 + esac
23 +
24   dnl Options.
25   AC_ARG_ENABLE(jit,          [  --enable-jit            enable JIT compiler [default=yes]], [WANT_JIT=$enableval], [WANT_JIT=yes])
26   AC_ARG_ENABLE(ppc-emulator, [  --enable-ppc-emulator   use the selected PowerPC emulator [default=auto]], [WANT_EMULATED_PPC=$enableval], [WANT_EMULATED_PPC=auto])
27 + AC_ARG_ENABLE(fbdev-dga,    [  --enable-fbdev-dga      use direct frame buffer access via /dev/fb0 [default=yes]], [WANT_FBDEV_DGA=$enableval], [WANT_FBDEV_DGA=yes])
28   AC_ARG_ENABLE(xf86-dga,     [  --enable-xf86-dga       use the XFree86 DGA extension [default=yes]], [WANT_XF86_DGA=$enableval], [WANT_XF86_DGA=yes])
29 < AC_ARG_ENABLE(xf86-vidmode, [  --enable-xf86-vidmode   use the XFree86 VidMode extension [default=no]], [WANT_XF86_VIDMODE=$enableval], [WANT_XF86_VIDMODE=no])
29 > AC_ARG_ENABLE(xf86-vidmode, [  --enable-xf86-vidmode   use the XFree86 VidMode extension [default=yes]], [WANT_XF86_VIDMODE=$enableval], [WANT_XF86_VIDMODE=yes])
30   AC_ARG_ENABLE(vosf,         [  --enable-vosf           enable video on SEGV signals [default=yes]], [WANT_VOSF=$enableval], [WANT_VOSF=yes])
31   AC_ARG_WITH(esd,            [  --with-esd              support ESD for sound under Linux/FreeBSD [default=yes]], [WANT_ESD=$withval], [WANT_ESD=yes])
32 < AC_ARG_WITH(gtk,            [  --with-gtk              use GTK user interface [default=yes]], [WANT_GTK=$withval], [WANT_GTK=yes])
32 > AC_ARG_WITH(gtk,            [  --with-gtk              use GTK user interface [default=yes]],
33 >  [case "$withval" in
34 >   gtk1)      WANT_GTK="gtk";;
35 >   gtk|gtk2)  WANT_GTK="$withval";;
36 >   yes)       WANT_GTK="gtk2 gtk";;
37 >   *)         WANT_GTK="no";;
38 >   esac],
39 >  [WANT_GTK="gtk2 gtk"])
40   AC_ARG_WITH(mon,            [  --with-mon              use mon as debugger [default=yes]], [WANT_MON=$withval], [WANT_MON=yes])
41   AC_ARG_WITH(dgcc,           [  --with-dgcc=COMPILER    use C++ COMPILER to compile synthetic opcodes], [DYNGEN_CC=$withval])
42  
# Line 31 | Line 46 | AC_ARG_ENABLE(addressing,
46    [case "$enableval" in
47     real)        WANT_ADDRESSING_MODE="real";;
48     direct)      WANT_ADDRESSING_MODE="direct";;
49 <   direct,0x*)  WANT_ADDRESSING_MODE="direct"; NATMEM_OFFSET=`echo "$enableval" | sed -n '/direct,\(0[[xX]][[0-9A-Fa-f]]*\)/s//\1/p'`;;
49 >   direct,0x*)  WANT_ADDRESSING_MODE="direct"; NATMEM_OFFSET=`echo "$enableval" | sed -n '/direct,\(0[[xX]][[0-9A-Fa-f]]*\([[UuLl]]\{1,2\}\)\?\)$/s//\1/p'`;;
50     esac],
51    [WANT_ADDRESSING_MODE="real"]
52   )
# Line 48 | Line 63 | AC_PROG_CXX
63   AC_PROG_MAKE_SET
64   AC_PROG_INSTALL
65   AC_PROG_EGREP
66 + AC_PATH_PROGS(FILE, [file false])
67 + AC_PATH_PROG(PERL, [perl])
68  
69   dnl Check for PowerPC target CPU.
70   HAVE_PPC=no
# Line 104 | Line 121 | if [[ "x$WANT_MON" = "xyes" ]]; then
121      WANT_MON=no
122    fi
123   fi
124 + AC_SUBST(MONSRCS)
125  
126   dnl Checks for libraries.
127   AC_CHECK_LIB(posix4, sem_init)
# Line 135 | Line 153 | if [[ "x$WANT_SDL" = "xyes" ]]; then
153      LIBS="$LIBS $sdl_libs"
154    else
155      WANT_SDL=no
156 +    WANT_SDL_VIDEO=no
157 +    WANT_SDL_AUDIO=no
158    fi
159    SDL_SUPPORT=`echo "$SDL_SUPPORT" | sed -e "s/^ //"`
160   else
# Line 142 | Line 162 | else
162   fi
163  
164   dnl We need X11, if not using SDL.
165 < if [[ "x$WANT_SDL" = "xno" ]]; then
165 > if [[ "x$WANT_SDL_VIDEO" != "xyes" ]]; then
166    AC_PATH_XTRA
167    if [[ "x$no_x" = "xyes" ]]; then
168      AC_MSG_ERROR([You need X11 to run SheepShaver.])
# Line 155 | Line 175 | fi
175   dnl We need pthreads on non-PowerPC systems. Try libpthread first, then libc_r (FreeBSD), then PTL.
176   HAVE_PTHREADS=yes
177   case $EMULATED_PPC:$target_os in
178 < no:linux*)
178 > no:linux*|no:netbsd*)
179    dnl We do have our own pthread_cancel() implementation
180    AC_DEFINE(HAVE_PTHREAD_CANCEL, 1, [Define if you have the pthread_cancel function.])
181    ;;
# Line 163 | Line 183 | no:linux*)
183    AC_CHECK_LIB(pthread, pthread_create, , [
184      AC_CHECK_LIB(c_r, pthread_create, , [
185        AC_CHECK_LIB(PTL, pthread_create, , [
186 <        AC_MSG_ERROR([You need pthreads to run Basilisk II.])
186 >        dnl XXX remove when no pthreads case is merged
187 >        AC_MSG_ERROR([You need pthreads to run SheepShaver.])
188 >        HAVE_PTHREADS=no
189        ])
190      ])
191    ])
192    AC_CHECK_FUNCS(pthread_cancel)
193 +  AC_CHECK_FUNCS(pthread_cond_init pthread_testcancel)
194    AC_CHECK_FUNCS(pthread_mutexattr_setprotocol)
195    AC_CHECK_FUNCS(pthread_mutexattr_settype)
196    AC_CHECK_FUNCS(pthread_mutexattr_setpshared)
174  if [[ "x$HAVE_PTHREADS" = "xyes" ]]; then
175    AC_DEFINE(HAVE_PTHREADS, 1, [Define if pthreads are available.])
176  fi
197    dnl If POSIX.4 semaphores are not available, we emulate them with pthread mutexes.
198    SEMSRC=
199    AC_CHECK_FUNCS(sem_init, , [
# Line 183 | Line 203 | no:linux*)
203    ])
204    ;;
205   esac
206 + if [[ "x$HAVE_PTHREADS" = "xyes" ]]; then
207 +  AC_DEFINE(HAVE_PTHREADS, 1, [Define if pthreads are available.])
208 + fi
209 +
210 + dnl We use FBDev DGA if possible.
211 + if [[ "x$WANT_FBDEV_DGA" = "xyes" ]]; then
212 +  AC_CHECK_HEADER(linux/fb.h, [
213 +    AC_DEFINE(ENABLE_FBDEV_DGA, 1, [Define if using Linux fbdev extension.])
214 +  ], [
215 +    AC_MSG_WARN([Could not find Linux FBDev extension, ignoring --enable-fbdev-dga.])
216 +    WANT_FBDEV_DGA=no
217 +  ])
218 + fi
219  
220   dnl We use XFree86 DGA if possible.
221   if [[ "x$WANT_XF86_DGA" = "xyes" ]]; then
# Line 208 | Line 241 | fi
241  
242   dnl We use GTK+ if possible.
243   UISRCS=../dummy/prefs_editor_dummy.cpp
244 < if [[ "x$WANT_GTK" = "xyes" ]]; then
244 > case "x$WANT_GTK" in
245 > xgtk2*)
246 >  AM_PATH_GTK_2_0(1.3.15, [
247 >    AC_DEFINE(ENABLE_GTK, 1, [Define if using GTK.])
248 >    CFLAGS="$CFLAGS $GTK_CFLAGS"
249 >    CXXFLAGS="$CXXFLAGS $GTK_CFLAGS"
250 >    LIBS="$LIBS $GTK_LIBS"
251 >    UISRCS=prefs_editor_gtk.cpp
252 >    WANT_GTK=gtk2
253 >  ], [
254 >    case "x${WANT_GTK}x" in
255 >    *gtkx)
256 >      AC_MSG_WARN([Could not find GTK+ 2.0, trying with GTK+ 1.2.])
257 >      WANT_GTK=gtk
258 >      ;;
259 >    *)
260 >      AC_MSG_WARN([Could not find GTK+, disabling user interface.])
261 >      WANT_GTK=no
262 >      ;;
263 >    esac
264 >  ])
265 >  ;;
266 > esac
267 > if [[ "x$WANT_GTK" = "xgtk" ]]; then
268    AM_PATH_GTK(1.2.0, [
269      AC_DEFINE(ENABLE_GTK, 1, [Define if using GTK.])
270      CFLAGS="$CFLAGS $GTK_CFLAGS"
# Line 240 | Line 296 | AC_SYS_LARGEFILE
296   dnl Checks for header files.
297   AC_HEADER_STDC
298   AC_HEADER_SYS_WAIT
299 + AC_CHECK_HEADERS(malloc.h stdint.h)
300   AC_CHECK_HEADERS(mach/vm_map.h mach/mach_init.h sys/mman.h)
244 AC_CHECK_HEADERS(sys/time.h sys/times.h sys/socket.h)
301   AC_CHECK_HEADERS(unistd.h fcntl.h byteswap.h dirent.h)
302 < AC_CHECK_HEADERS(linux/if.h, [], [], [
303 < #if HAVE_SYS_SOCKET_H
304 < # include <sys/socket.h>
302 > AC_CHECK_HEADERS(sys/socket.h sys/ioctl.h sys/filio.h sys/bitypes.h sys/wait.h)
303 > AC_CHECK_HEADERS(sys/time.h sys/poll.h sys/select.h arpa/inet.h)
304 > AC_CHECK_HEADERS(linux/if.h linux/if_tun.h net/if.h net/if_tun.h, [], [], [
305 > #ifdef HAVE_SYS_TYPES_H
306 > #include <sys/types.h>
307 > #endif
308 > #ifdef HAVE_SYS_SOCKET_H
309 > #include <sys/socket.h>
310   #endif
311   ])
312 < AC_CHECK_HEADERS(linux/if_tun.h net/if.h net/if_tun.h)
312 > AC_CHECK_HEADERS(AvailabilityMacros.h)
313 > AC_CHECK_HEADERS(IOKit/storage/IOBlockStorageDevice.h)
314 > AC_CHECK_HEADERS(fenv.h)
315  
316   dnl Checks for typedefs, structures, and compiler characteristics.
317   AC_C_BIGENDIAN
# Line 268 | Line 331 | AC_TYPE_SIGNAL
331   AC_HEADER_TIME
332   AC_STRUCT_TM
333  
334 + dnl Check whether sys/socket.h defines type socklen_t.
335 + dnl (extracted from ac-archive/Miscellaneous)
336 + AC_CACHE_CHECK([for socklen_t],
337 +  ac_cv_type_socklen_t, [
338 +  AC_TRY_COMPILE([
339 +    #include <sys/types.h>
340 +    #include <sys/socket.h>
341 +  ], [socklen_t len = 42; return 0;],
342 +  ac_cv_type_socklen_t=yes, ac_cv_type_socklen_t=no,
343 +  dnl When cross-compiling, do not assume anything.
344 +  ac_cv_type_socklen_t="guessing no"
345 +  )
346 + ])
347 + if [[ "x$ac_cv_type_socklen_t" != "xyes" ]]; then
348 +  AC_DEFINE(socklen_t, int, [Define to 'int' if <sys/types.h> doesn't define.])
349 + fi
350 +
351   dnl Check whether struct sigaction has sa_restorer member.
352   AC_CACHE_CHECK([whether struct sigaction has sa_restorer],
353    ac_cv_signal_sa_restorer, [
# Line 284 | Line 364 | if [[ "x$ac_cv_signal_sa_restorer" = "xy
364   fi
365  
366   dnl Checks for library functions.
367 < AC_CHECK_FUNCS(strdup strlcpy cfmakeraw)
367 > AC_CHECK_FUNCS(strdup strerror strlcpy cfmakeraw)
368   AC_CHECK_FUNCS(nanosleep)
369   AC_CHECK_FUNCS(sigaction signal)
370   AC_CHECK_FUNCS(mmap mprotect munmap)
371   AC_CHECK_FUNCS(vm_allocate vm_deallocate vm_protect)
372 < AC_CHECK_FUNCS(posix_memalign memalign valloc)
372 > AC_CHECK_FUNCS(exp2f log2f exp2 log2)
373 > AC_CHECK_FUNCS(floorf roundf ceilf truncf floor round ceil trunc)
374 > AC_CHECK_FUNCS(poll inet_aton)
375  
376   dnl Darwin seems to define mach_task_self() instead of task_self().
377   AC_CHECK_FUNCS(mach_task_self task_self)
# Line 301 | Line 383 | no:linux*)
383    ;;
384   *:*)
385    AC_SEARCH_LIBS(clock_gettime, [rt posix4])
386 <  AC_CHECK_FUNCS(clock_gettime)
386 >  AC_CHECK_FUNCS(clock_gettime clock_nanosleep)
387    ;;
388   esac
389  
390 + dnl Check for headers and functions related to pty support (sshpty.c)
391 + dnl From openssh-3.2.2p1 configure.ac
392 + AC_CHECK_HEADERS(strings.h login.h sys/bsdtty.h sys/stat.h util.h pty.h)
393 + AC_CHECK_FUNCS(_getpty vhangup strlcpy)
394 +
395 + case "$host" in
396 + *-*-hpux10.26)
397 +        disable_ptmx_check=yes
398 +        ;;
399 + *-*-linux*)
400 +        no_dev_ptmx=1
401 +        ;;
402 + mips-sony-bsd|mips-sony-newsos4)
403 +        AC_DEFINE(HAVE_NEWS4, 1, [Define if you are on NEWS-OS (additions from openssh-3.2.2p1, for sshpty.c).])
404 +        ;;
405 + *-*-sco3.2v4*)
406 +        no_dev_ptmx=1
407 +        ;;
408 + *-*-sco3.2v5*)
409 +        no_dev_ptmx=1
410 +        ;;
411 + *-*-cygwin*)
412 +        no_dev_ptmx=1
413 +        ;;
414 + esac
415 +
416 + if test -z "$no_dev_ptmx" ; then
417 +        if test "x$disable_ptmx_check" != "xyes" ; then
418 +                AC_CHECK_FILE([/dev/ptmx],
419 +                        [
420 +                                AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX, 1, [Define if you have /dev/ptmx.])
421 +                                have_dev_ptmx=1
422 +                        ]
423 +                )
424 +        fi
425 + fi
426 + AC_CHECK_FILE([/dev/ptc],
427 +        [
428 +                AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC, 1, [Define if you have /dev/ptc.])
429 +                have_dev_ptc=1
430 +        ]
431 + )
432 + dnl (end of code from openssh-3.2.2p1 configure.ac)
433 +
434   dnl AC_CHECK_FRAMEWORK($1=NAME, $2=INCLUDES)
435   AC_DEFUN(AC_CHECK_FRAMEWORK, [
436    AS_VAR_PUSHDEF([ac_Framework], [ac_cv_framework_$1])dnl
# Line 336 | Line 462 | EXTFSSRC=extfs_unix.cpp
462   EXTRASYSSRCS=
463   case "$target_os" in
464   linux*)
465 <  ETHERSRC=Linux/ether_linux.cpp
465 >  ETHERSRC=ether_unix.cpp
466    AUDIOSRC=audio_oss_esd.cpp
467    SCSISRC=Linux/scsi_linux.cpp
468    if [[ "x$EMULATED_PPC" = "xno" ]]; then
469 <    EXTRASYSSRCS="Linux/paranoia.cpp Linux/sheepthreads.c Linux/asm_linux.S"
469 >    EXTRASYSSRCS="paranoia.cpp Linux/sheepthreads.c ppc_asm.S"
470 >  fi
471 >  ;;
472 > freebsd*)
473 >  ETHERSRC=ether_unix.cpp
474 >  ;;
475 > netbsd*)
476 >  ETHERSRC=ether_unix.cpp
477 >  if [[ "x$EMULATED_PPC" = "xno" ]]; then
478 >    EXTRASYSSRCS="paranoia.cpp NetBSD/sheepthreads.c ppc_asm.S"
479    fi
480    ;;
481   darwin*)
482 +  ETHERSRC=ether_unix.cpp
483    if [[ "x$EMULATED_PPC" = "xno" ]]; then
484 <    EXTRASYSSRCS="Darwin/paranoia.cpp Linux/asm_linux.S"
484 >    EXTRASYSSRCS="paranoia.cpp ppc_asm.S"
485    fi
486    if [[ "x$ac_cv_framework_IOKit" = "xyes" ]]; then
487      EXTRASYSSRCS="$EXTRASYSSRCS ../MacOSX/sys_darwin.cpp"
# Line 356 | Line 492 | darwin*)
492    ;;
493   esac
494  
495 + dnl Is the slirp library supported?
496 + if [[ "x$ETHERSRC" = "xether_unix.cpp" ]]; then
497 +  AC_DEFINE(HAVE_SLIRP, 1, [Define if slirp library is supported])
498 +  SLIRP_SRCS="\
499 +    ../slirp/bootp.c     ../slirp/ip_output.c  ../slirp/tcp_input.c  \
500 +    ../slirp/cksum.c     ../slirp/mbuf.c       ../slirp/tcp_output.c \
501 +    ../slirp/debug.c     ../slirp/misc.c       ../slirp/tcp_subr.c   \
502 +    ../slirp/if.c        ../slirp/sbuf.c       ../slirp/tcp_timer.c  \
503 +    ../slirp/ip_icmp.c   ../slirp/slirp.c      ../slirp/tftp.c       \
504 +    ../slirp/ip_input.c  ../slirp/socket.c     ../slirp/udp.c"
505 + fi
506 + AC_SUBST(SLIRP_SRCS)
507 +
508   dnl SDL overrides
509   if [[ "x$WANT_SDL" = "xyes" ]]; then
510    AC_DEFINE(USE_SDL, 1, [Define to enble SDL support.])
# Line 379 | Line 528 | if [[ "x$WANT_SDL_AUDIO" = "xyes" ]]; th
528    AUDIOSRC="../SDL/audio_sdl.cpp"
529   fi
530  
531 < SYSSRCS="$VIDEOSRCS $EXTFSSRC $SERIALSRC $ETHERSRC $SCSISRC $AUDIOSRC $SEMSRC $UISRCS $MONSRCS $EXTRASYSSRCS"
531 > SYSSRCS="$VIDEOSRCS $EXTFSSRC $SERIALSRC $ETHERSRC $SCSISRC $AUDIOSRC $SEMSRC $UISRCS $EXTRASYSSRCS"
532  
533   dnl Define a macro that translates a yesno-variable into a C macro definition
534   dnl to be put into the config.h file
# Line 683 | Line 832 | fi
832   AC_TRANSLATE_DEFINE(HAVE_MACH_EXCEPTIONS, "$ac_cv_have_mach_exceptions",
833    [Define if your system supports Mach exceptions.])
834  
835 + dnl Check if Windows exceptions are supported.
836 + AC_CACHE_CHECK([whether your system supports Windows exceptions],
837 +  ac_cv_have_win32_exceptions, [
838 +  AC_LANG_SAVE
839 +  AC_LANG_CPLUSPLUS
840 +  AC_TRY_RUN([
841 +    #define HAVE_WIN32_EXCEPTIONS 1
842 +    #define CONFIGURE_TEST_SIGSEGV_RECOVERY
843 +    #include "vm_alloc.cpp"
844 +    #include "sigsegv.cpp"
845 +  ], [
846 +  sigsegv_recovery=win32
847 +  ac_cv_have_win32_exceptions=yes
848 +  ],
849 +  ac_cv_have_win32_exceptions=no,
850 +  dnl When cross-compiling, do not assume anything.
851 +  ac_cv_have_win32_exceptions=no
852 +  )
853 +  AC_LANG_RESTORE
854 +  ]
855 + )
856 + AC_TRANSLATE_DEFINE(HAVE_WIN32_EXCEPTIONS, "$ac_cv_have_win32_exceptions",
857 +  [Define if your system supports Windows exceptions.])
858 +
859   dnl Otherwise, check if extended signals are supported.
860   if [[ -z "$sigsegv_recovery" ]]; then
861    AC_CACHE_CHECK([whether your system supports extended signal handlers],
# Line 821 | Line 994 | int main(void)
994                  memset(m, 0, ranges[[i]].size);
995                  vm_release(m, ranges[[i]].size);
996                  if (i == n_ranges - 1) {
997 <                        printf("0x%08x\n", ofs);
997 >                        if (sizeof(void *) == 8 && ofs > 0xffffffff)
998 >                                printf("0x%lxul\n", ofs);
999 >                        else
1000 >                                printf("0x%08x\n", ofs);
1001                          return 0;
1002                  }
1003          }
# Line 833 | Line 1009 | EOF
1009    doit='$CXX conftest.$ac_ext -o conftest.$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS $LIBS $NATMEM_OFFSET_DEF >& AS_MESSAGE_LOG_FD'
1010    if AC_TRY_EVAL(doit); then
1011      NATMEM_OFFSET=`./conftest.$ac_exeext`
1012 <    if [[ -z "$NATMEM_OFFSET" ]]; then
1013 <      AC_MSG_ERROR([could not determine a sensible NATMEM_OFFSET value])
838 <    else
839 <      WANT_ADDRESSING_MODE="direct,$NATMEM_OFFSET"
840 <    fi
1012 >  else
1013 >    NATMEM_OFFSET=
1014    fi
1015    rm -f conftest*
1016    AC_LANG_RESTORE
1017 +
1018 +  if [[ -z "$NATMEM_OFFSET" ]]; then
1019 +    AC_MSG_ERROR([could not determine a sensible NATMEM_OFFSET value])
1020 +  else
1021 +    WANT_ADDRESSING_MODE="direct,$NATMEM_OFFSET"
1022 +    AC_DEFINE_UNQUOTED(NATMEM_OFFSET, $NATMEM_OFFSET,
1023 +      [Define constant offset for Mac address translation])
1024 +  fi
1025   fi
1026   AC_MSG_RESULT($WANT_ADDRESSING_MODE)
1027  
1028 < if [[ -z "$NATMEM_OFFSET" ]]; then
1029 <  NATMEM_OFFSET=0
1028 > dnl Utility macro used by next two tests.
1029 > dnl AC_EXAMINE_OBJECT(C source code,
1030 > dnl     commands examining object file,
1031 > dnl     [commands to run if compile failed]):
1032 > dnl
1033 > dnl Compile the source code to an object file; then convert it into a
1034 > dnl printable representation.  All unprintable characters and
1035 > dnl asterisks (*) are replaced by dots (.).  All white space is
1036 > dnl deleted.  Newlines (ASCII 0x10) in the input are preserved in the
1037 > dnl output, but runs of newlines are compressed to a single newline.
1038 > dnl Finally, line breaks are forcibly inserted so that no line is
1039 > dnl longer than 80 columns and the file ends with a newline.  The
1040 > dnl result of all this processing is in the file conftest.dmp, which
1041 > dnl may be examined by the commands in the second argument.
1042 > dnl
1043 > AC_DEFUN([gcc_AC_EXAMINE_OBJECT],
1044 > [AC_LANG_SAVE
1045 > AC_LANG_C
1046 > dnl Next bit cribbed from AC_TRY_COMPILE.
1047 > cat > conftest.$ac_ext <<EOF
1048 > [#line __oline__ "configure"
1049 > #include "confdefs.h"
1050 > $1
1051 > ]EOF
1052 > if AC_TRY_EVAL(ac_compile); then
1053 >  od -c conftest.o |
1054 >    sed ['s/^[0-7]*[    ]*/ /
1055 >          s/\*/./g
1056 >          s/ \\n/*/g
1057 >          s/ [0-9][0-9][0-9]/./g
1058 >          s/  \\[^ ]/./g'] |
1059 >    tr -d '
1060 > ' | tr -s '*' '
1061 > ' | fold | sed '$a\
1062 > ' > conftest.dmp
1063 >  $2
1064 > ifelse($3, , , else
1065 >  $3
1066 > )dnl
1067 > fi
1068 > rm -rf conftest*
1069 > AC_LANG_RESTORE])
1070 >
1071 > dnl Floating point format probe.
1072 > dnl The basic concept is the same as the above: grep the object
1073 > dnl file for an interesting string.  We have to watch out for
1074 > dnl rounding changing the values in the object, however; this is
1075 > dnl handled by ignoring the least significant byte of the float.
1076 > dnl
1077 > dnl Does not know about VAX G-float or C4x idiosyncratic format.
1078 > dnl It does know about PDP-10 idiosyncratic format, but this is
1079 > dnl not presently supported by GCC.  S/390 "binary floating point"
1080 > dnl is in fact IEEE (but maybe we should have that in EBCDIC as well
1081 > dnl as ASCII?)
1082 > dnl
1083 > AC_DEFUN([gcc_AC_C_FLOAT_FORMAT],
1084 > [AC_CACHE_CHECK(floating point format, ac_cv_c_float_format,
1085 > [gcc_AC_EXAMINE_OBJECT(
1086 > [/* This will not work unless sizeof(double) == 8.  */
1087 > extern char sizeof_double_must_be_8 [sizeof(double) == 8 ? 1 : -1];
1088 >
1089 > /* This structure must have no internal padding.  */
1090 > struct possibility {
1091 >  char prefix[8];
1092 >  double candidate;
1093 >  char postfix[8];
1094 > };
1095 >
1096 > #define C(cand) { "\nformat:", cand, ":tamrof\n" }
1097 > struct possibility table [] =
1098 > {
1099 >  C( 3.25724264705901305206e+01), /* @@IEEEFP - IEEE 754 */
1100 >  C( 3.53802595280598432000e+18), /* D__float - VAX */
1101 >  C( 5.32201830133125317057e-19), /* D.PDP-10 - PDP-10 - the dot is 0x13a */
1102 >  C( 1.77977764695171661377e+10), /* IBMHEXFP - s/390 format, ascii */
1103 >  C(-5.22995989424860458374e+10)  /* IBMHEXFP - s/390 format, EBCDIC */
1104 > };],
1105 > [if   grep 'format:.@IEEEF.:tamrof' conftest.dmp >/dev/null 2>&1; then
1106 >    ac_cv_c_float_format='IEEE (big-endian)'
1107 >  elif grep 'format:.I@@PFE.:tamrof' conftest.dmp >/dev/null 2>&1; then
1108 >    ac_cv_c_float_format='IEEE (big-endian)'
1109 >  elif grep 'format:.FEEEI@.:tamrof' conftest.dmp >/dev/null 2>&1; then
1110 >    ac_cv_c_float_format='IEEE (little-endian)'
1111 >  elif grep 'format:.EFP@@I.:tamrof' conftest.dmp >/dev/null 2>&1; then
1112 >    ac_cv_c_float_format='IEEE (little-endian)'
1113 >  elif grep 'format:.__floa.:tamrof' conftest.dmp >/dev/null 2>&1; then
1114 >    ac_cv_c_float_format='VAX D-float'
1115 >  elif grep 'format:..PDP-1.:tamrof' conftest.dmp >/dev/null 2>&1; then
1116 >    ac_cv_c_float_format='PDP-10'
1117 >  elif grep 'format:.BMHEXF.:tamrof' conftest.dmp >/dev/null 2>&1; then
1118 >    ac_cv_c_float_format='IBM 370 hex'
1119 >  else
1120 >    AC_MSG_ERROR(Unknown floating point format)
1121 >  fi],
1122 >  [AC_MSG_ERROR(compile failed)])
1123 > ])
1124 > # IEEE is the default format.  If the float endianness isn't the same
1125 > # as the integer endianness, we have to set FLOAT_WORDS_BIG_ENDIAN
1126 > # (which is a tristate: yes, no, default).  This is only an issue with
1127 > # IEEE; the other formats are only supported by a few machines each,
1128 > # all with the same endianness.
1129 > format=IEEE_FLOAT_FORMAT
1130 > fbigend=
1131 > case $ac_cv_c_float_format in
1132 >    'IEEE (big-endian)' )
1133 >        if test $ac_cv_c_bigendian = no; then
1134 >            fbigend=1
1135 >        fi
1136 >        ;;
1137 >    'IEEE (little-endian)' )
1138 >        if test $ac_cv_c_bigendian = yes; then
1139 >            fbigend=0
1140 >        fi
1141 >        ;;
1142 >    'VAX D-float' )
1143 >        format=VAX_FLOAT_FORMAT
1144 >        ;;
1145 >    'PDP-10' )
1146 >        format=PDP10_FLOAT_FORMAT
1147 >        ;;
1148 >    'IBM 370 hex' )
1149 >        format=IBM_FLOAT_FORMAT
1150 >        ;;
1151 > esac
1152 > AC_DEFINE_UNQUOTED(HOST_FLOAT_FORMAT, $format,
1153 >  [Define to the floating point format of the host machine.])
1154 > if test -n "$fbigend"; then
1155 >        AC_DEFINE_UNQUOTED(HOST_FLOAT_WORDS_BIG_ENDIAN, $fbigend,
1156 >  [Define to 1 if the host machine stores floating point numbers in
1157 >   memory with the word containing the sign bit at the lowest address,
1158 >   or to 0 if it does it the other way around.
1159 >
1160 >   This macro should not be defined if the ordering is the same as for
1161 >   multi-word integers.])
1162   fi
1163 < AC_DEFINE_UNQUOTED(NATMEM_OFFSET, $NATMEM_OFFSET,
1164 <  [Define constant offset for Mac address translation])
1163 > ])
1164 >
1165 > dnl Check for host float format
1166 > gcc_AC_C_FLOAT_FORMAT
1167  
1168   dnl Platform specific binary postprocessor
1169   AC_PATH_PROG(BLESS, "true")
# Line 860 | Line 1175 | fi
1175   dnl Check for GCC 2.7 or higher.
1176   HAVE_GCC27=no
1177   AC_MSG_CHECKING(for GCC 2.7 or higher)
1178 < AC_EGREP_CPP(xyes,
1179 < [#if __GNUC__ - 1 > 1 || __GNUC_MINOR__ - 1 > 5
1180 <  xyes
1181 < #endif
1182 < ], [AC_MSG_RESULT(yes); HAVE_GCC27=yes], AC_MSG_RESULT(no))
1178 > AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#if ! (__GNUC__ - 1 > 1 || __GNUC_MINOR__ - 1 > 5)
1179 >                                     # error gcc < 2.7
1180 >                                     #endif
1181 >                                   ]])],
1182 >                  [AC_MSG_RESULT(yes); HAVE_GCC27=yes],
1183 >                  [AC_MSG_RESULT(no)])
1184  
1185   dnl Check for GCC 3.0 or higher.
1186   HAVE_GCC30=no
1187   AC_MSG_CHECKING(for GCC 3.0 or higher)
1188 < AC_EGREP_CPP(xyes,
1189 < [#if __GNUC__ >= 3
1190 <  xyes
1191 < #endif
1192 < ], [AC_MSG_RESULT(yes); HAVE_GCC30=yes], AC_MSG_RESULT(no))
1188 > AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#if ! (__GNUC__ >= 3)
1189 >                                     # error gcc < 3
1190 >                                     #endif
1191 >                                   ]])],
1192 >                  [AC_MSG_RESULT(yes); HAVE_GCC30=yes],
1193 >                  [AC_MSG_RESULT(no)])
1194  
1195   dnl Check for ICC.
1196   AC_MSG_CHECKING(for ICC)
# Line 883 | Line 1200 | if $CXX -V -v 2>&1 | grep -q "Intel(R) C
1200   fi
1201   AC_MSG_RESULT($HAVE_ICC)
1202  
1203 < dnl Test if the compiler can generate ELF objects
1204 < AC_CACHE_CHECK([whether the compiler can generate ELF objects],
1205 <  ac_cv_elf_objects, [
1203 > dnl Determine the generated object format
1204 > AC_CACHE_CHECK([the format of compiler generated objects],
1205 >  ac_cv_object_format, [
1206    echo 'int i;' > conftest.$ac_ext
1207 <  ac_cv_elf_objects=no
1207 >  ac_cv_object_format=no
1208    if AC_TRY_EVAL(ac_compile); then
1209      case `/usr/bin/file conftest.$ac_objext` in
1210      *"ELF"*)
1211 <      ac_cv_elf_objects=yes
1211 >      ac_cv_object_format=elf
1212 >      ;;
1213 >    *"Mach-O"*)
1214 >      ac_cv_object_format=mach
1215 >      ;;
1216 >    *)
1217 >      ac_cv_object_format=unknown
1218        ;;
1219      esac
1220    fi
1221    rm -rf conftest*
1222   ])
1223 < ELF_OBJECTS=$ac_cv_elf_objects
1223 >
1224 > dnl Add -fno-strict-aliasing for slirp sources
1225 > if [[ "x$HAVE_GCC30" = "xyes" ]]; then
1226 >  SAVED_CFLAGS="$CFLAGS"
1227 >  CFLAGS="$CFLAGS -fno-strict-aliasing"
1228 >  AC_CACHE_CHECK([whether the compiler supports -fno-strict-aliasing],
1229 >    ac_cv_gcc_no_strict_aliasing, [
1230 >    AC_TRY_COMPILE([],[],
1231 >      [ac_cv_gcc_no_strict_aliasing=yes; AC_SUBST(SLIRP_CFLAGS, "-fno-strict-aliasing")],
1232 >      [ac_cv_gcc_no_strict_aliasing=no])
1233 >  ])
1234 >  CFLAGS="$SAVED_CFLAGS"
1235 > fi
1236 >
1237 > dnl Add -mdynamic-no-pic for MacOS X
1238 > if [[ "x$HAVE_GCC30" = "xyes" ]]; then
1239 >  SAVED_CFLAGS="$CFLAGS"
1240 >  CFLAGS="$CFLAGS -mdynamic-no-pic"
1241 >  AC_CACHE_CHECK([whether the compiler supports -mdynamic-no-pic],
1242 >    ac_cv_gcc_mdynamic_no_pic, [
1243 >    AC_TRY_COMPILE([],[],[ac_cv_gcc_mdynamic_no_pic=yes],[ac_cv_gcc_mdynamic_no_pic=no])
1244 >  ])
1245 >  if [[ "x$ac_cv_gcc_mdynamic_no_pic" = "xyes" ]]; then
1246 >    CXXFLAGS="$CXXFLAGS -mdynamic-no-pic"
1247 >  else
1248 >    CFLAGS="$SAVED_CFLAGS"
1249 >  fi
1250 > fi
1251  
1252   dnl CPU emulator sources
1253   if [[ "x$EMULATED_PPC" = "xyes" ]]; then
1254    CPUSRCS="\
1255 +    ../kpx_cpu/src/mathlib/ieeefp.cpp \
1256 +    ../kpx_cpu/src/mathlib/mathlib.cpp \
1257      ../kpx_cpu/src/cpu/ppc/ppc-cpu.cpp \
1258      ../kpx_cpu/src/cpu/ppc/ppc-decode.cpp \
1259      ../kpx_cpu/src/cpu/ppc/ppc-execute.cpp \
# Line 912 | Line 1264 | if [[ "x$EMULATED_PPC" = "xyes" ]]; then
1264    if [[ "x$WANT_JIT" = "xyes" ]]; then
1265      AC_CACHE_CHECK([whether dyngen can be used],
1266        ac_cv_use_dyngen, [
1267 <      case $host_cpu:$ELF_OBJECTS in
1268 <      powerpc:yes)
1267 >      case $host_cpu:$ac_cv_object_format in
1268 >      powerpc:elf)
1269 >        ac_cv_use_dyngen=yes
1270 >        ;;
1271 >      x86_64:elf)
1272          ac_cv_use_dyngen=yes
1273          ;;
1274 <      x86_64:yes)
1274 >      i?86:elf)
1275          ac_cv_use_dyngen=yes
1276          ;;
1277 <      i?86:yes)
1277 >      powerpc:mach)
1278          ac_cv_use_dyngen=yes
1279          ;;
1280        *:*)
# Line 939 | Line 1294 | if [[ "x$EMULATED_PPC" = "xyes" ]]; then
1294            done
1295          fi
1296        fi
1297 <      if [[ -z "$DYNGEN_CC" ]] || ! { echo '#include <limits>' | $DYNGEN_CC -xc++ -c -o /dev/null - >& /dev/null; }; then
1297 >      if [[ -z "$DYNGEN_CC" ]]; then
1298          ac_cv_use_dyngen=no
1299        fi
1300      ])
# Line 947 | Line 1302 | if [[ "x$EMULATED_PPC" = "xyes" ]]; then
1302        case $host_cpu in
1303        i?86)
1304          DYNGEN_OP_FLAGS="-fomit-frame-pointer -mpreferred-stack-boundary=2"
950        if [[ "x$HAVE_GCC30" = "xyes" ]]; then
951          DYNGEN_OP_FLAGS="$DYNGEN_OP_FLAGS -falign-functions=0"
952        else
953          DYNGEN_OP_FLAGS="$DYNGEN_OP_FLAGS -malign-functions=0"
954        fi
955        saved_CPPFLAGS=$CPPFLAGS
956        CPPFLAGS="$CPPFLAGS -mmmx"
957        AC_CHECK_HEADERS(mmintrin.h,  [DYNGEN_OP_FLAGS="$DYNGEN_OP_FLAGS -mmmx"])
958        CPPFLAGS="$CPPFLAGS -msse"
959        AC_CHECK_HEADERS(xmmintrin.h, [DYNGEN_OP_FLAGS="$DYNGEN_OP_FLAGS -msse"])
960        CPPFLAGS="$CPPFLAGS -msse2"
961        AC_CHECK_HEADERS(emmintrin.h, [DYNGEN_OP_FLAGS="$DYNGEN_OP_FLAGS -msse2"])
962        CPPFLAGS=$saved_CPPFLAGS
1305          ;;
1306 <      x86_64)
1307 <        AC_CHECK_HEADERS(mmintrin.h xmmintrin.h emmintrin.h)
1306 >      powerpc)
1307 >        if [[ "x$ac_cv_object_format" = "xmach" ]]; then
1308 >          DYNGEN_OP_FLAGS="-mdynamic-no-pic"
1309 >        fi
1310          ;;
1311        esac
1312 <      DYNGEN_OP_FLAGS="$DYNGEN_OP_FLAGS -finline-limit=10000"
1312 >      if [[ "x$HAVE_GCC30" = "xyes" ]]; then
1313 >        DYNGEN_OP_FLAGS="$DYNGEN_OP_FLAGS -falign-functions=0"
1314 >      else
1315 >        DYNGEN_OP_FLAGS="$DYNGEN_OP_FLAGS -malign-functions=0"
1316 >      fi
1317 >      DYNGEN_OP_FLAGS="$DYNGEN_OP_FLAGS -finline-limit=10000 -fno-exceptions -g0"
1318        if [[ "x$HAVE_GCC30" = "xyes" ]]; then
1319          DYNGEN_OP_FLAGS="$DYNGEN_OP_FLAGS -fno-reorder-blocks -fno-optimize-sibling-calls"
1320        fi
# Line 991 | Line 1340 | if [[ "x$ac_cv_use_dyngen" = "xyes" ]];
1340    AC_CACHE_CHECK([whether static data regions are executable],
1341      ac_cv_have_static_data_exec, [
1342      AC_TRY_RUN([int main(void) {
1343 < #if defined(__powerpc__)
1343 > #if defined(__powerpc__) || defined(__ppc__)
1344        static unsigned int p[8] = {0x4e800020,};
1345        asm volatile("dcbst 0,%0" : : "r" (p) : "memory");
1346        asm volatile("sync" : : : "memory");
# Line 1007 | Line 1356 | if [[ "x$ac_cv_use_dyngen" = "xyes" ]];
1356      ac_cv_have_static_data_exec=no
1357      )
1358    ])
1359 + else
1360 +  ac_cv_use_dyngen=no
1361   fi
1362   AC_TRANSLATE_DEFINE(HAVE_STATIC_DATA_EXEC, "$ac_cv_have_static_data_exec",
1363    [Define if your system marks static data pages as executable.])
# Line 1016 | Line 1367 | if [[ "x$WANT_JIT" = "xyes" ]]; then
1367   fi
1368  
1369   dnl Generate Makefile.
1370 + AC_SUBST(PERL)
1371 + AC_SUBST(USE_DYNGEN, [$ac_cv_use_dyngen])
1372   AC_SUBST(DYNGENSRCS)
1373   AC_SUBST(DYNGEN_CC)
1374   AC_SUBST(DYNGEN_OP_FLAGS)
# Line 1033 | Line 1386 | echo
1386   echo SheepShaver configuration summary:
1387   echo
1388   echo SDL support ...................... : $SDL_SUPPORT
1389 + echo FBDev DGA support ................ : $WANT_FBDEV_DGA
1390   echo XFree86 DGA support .............. : $WANT_XF86_DGA
1391   echo XFree86 VidMode support .......... : $WANT_XF86_VIDMODE
1392   echo Using PowerPC emulator ........... : $EMULATED_PPC

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines