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.12 by gbeauche, 2004-12-18T23:45:33Z vs.
Revision 1.49 by gbeauche, 2006-04-06T22:36:43Z

# Line 1 | Line 1
1   dnl Process this file with autoconf to produce a configure script.
2   dnl Written in 2002 by Christian Bauer
3  
4 < AC_INIT([SheepShaver], 2.2, [Christian.Bauer@uni-mainz.de], SheepShaver)
4 > AC_INIT([SheepShaver], 2.3, [Christian.Bauer@uni-mainz.de], SheepShaver)
5   AC_CONFIG_SRCDIR(main_unix.cpp)
6   AC_PREREQ(2.52)
7   AC_CONFIG_HEADER(config.h)
# 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_CHECK_PROGS(FILE, [file false])
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 109 | Line 125 | AC_SUBST(MONSRCS)
125  
126   dnl Checks for libraries.
127   AC_CHECK_LIB(posix4, sem_init)
128 + AC_CHECK_LIB(m, cos)
129  
130   dnl Do we need SDL?
131   WANT_SDL=no
# Line 126 | Line 143 | fi
143   if [[ "x$WANT_SDL" = "xyes" ]]; then
144    AC_PATH_PROG(sdl_config, "sdl-config")
145    if [[ -n "$sdl_config" ]]; then
146 <    case $target_os in
147 <    # Special treatment for Cygwin so that we can still use the POSIX layer
148 <    *cygwin*)
149 <      sdl_cflags="-I`$sdl_config --prefix`/include/SDL"
150 <      sdl_libs="-L`$sdl_config --exec-prefix`/lib -lSDL"
151 <      ;;
135 <    *)
136 <      sdl_cflags=`$sdl_config --cflags`
137 <      if [[ "x$WANT_SDL_STATIC" = "xyes" ]]; then
138 <        sdl_libs=`$sdl_config --static-libs`
139 <      else
140 <        sdl_libs=`$sdl_config --libs`
141 <      fi
142 <      ;;
143 <    esac
146 >    sdl_cflags=`$sdl_config --cflags`
147 >    if [[ "x$WANT_SDL_STATIC" = "xyes" ]]; then
148 >      sdl_libs=`$sdl_config --static-libs`
149 >    else
150 >      sdl_libs=`$sdl_config --libs`
151 >    fi
152      CFLAGS="$CFLAGS $sdl_cflags"
153      CXXFLAGS="$CXXFLAGS $sdl_cflags"
154      LIBS="$LIBS $sdl_libs"
155    else
156      WANT_SDL=no
157 +    WANT_SDL_VIDEO=no
158 +    WANT_SDL_AUDIO=no
159    fi
160    SDL_SUPPORT=`echo "$SDL_SUPPORT" | sed -e "s/^ //"`
161   else
# Line 153 | Line 163 | else
163   fi
164  
165   dnl We need X11, if not using SDL.
166 < if [[ "x$WANT_SDL" = "xno" ]]; then
166 > if [[ "x$WANT_SDL_VIDEO" != "xyes" ]]; then
167    AC_PATH_XTRA
168    if [[ "x$no_x" = "xyes" ]]; then
169      AC_MSG_ERROR([You need X11 to run SheepShaver.])
# Line 166 | Line 176 | fi
176   dnl We need pthreads on non-PowerPC systems. Try libpthread first, then libc_r (FreeBSD), then PTL.
177   HAVE_PTHREADS=yes
178   case $EMULATED_PPC:$target_os in
179 < no:linux*)
179 > no:linux*|no:netbsd*)
180    dnl We do have our own pthread_cancel() implementation
181    AC_DEFINE(HAVE_PTHREAD_CANCEL, 1, [Define if you have the pthread_cancel function.])
182    ;;
# Line 174 | Line 184 | no:linux*)
184    AC_CHECK_LIB(pthread, pthread_create, , [
185      AC_CHECK_LIB(c_r, pthread_create, , [
186        AC_CHECK_LIB(PTL, pthread_create, , [
187 <        AC_MSG_ERROR([You need pthreads to run Basilisk II.])
187 >        dnl XXX remove when no pthreads case is merged
188 >        AC_MSG_ERROR([You need pthreads to run SheepShaver.])
189 >        HAVE_PTHREADS=no
190        ])
191      ])
192    ])
193    AC_CHECK_FUNCS(pthread_cancel)
194 +  AC_CHECK_FUNCS(pthread_cond_init pthread_testcancel)
195    AC_CHECK_FUNCS(pthread_mutexattr_setprotocol)
196    AC_CHECK_FUNCS(pthread_mutexattr_settype)
197    AC_CHECK_FUNCS(pthread_mutexattr_setpshared)
185  if [[ "x$HAVE_PTHREADS" = "xyes" ]]; then
186    AC_DEFINE(HAVE_PTHREADS, 1, [Define if pthreads are available.])
187  fi
198    dnl If POSIX.4 semaphores are not available, we emulate them with pthread mutexes.
199    SEMSRC=
200    AC_CHECK_FUNCS(sem_init, , [
# Line 194 | Line 204 | no:linux*)
204    ])
205    ;;
206   esac
207 + if [[ "x$HAVE_PTHREADS" = "xyes" ]]; then
208 +  AC_DEFINE(HAVE_PTHREADS, 1, [Define if pthreads are available.])
209 + fi
210 +
211 + dnl We use FBDev DGA if possible.
212 + if [[ "x$WANT_FBDEV_DGA" = "xyes" ]]; then
213 +  AC_CHECK_HEADER(linux/fb.h, [
214 +    AC_DEFINE(ENABLE_FBDEV_DGA, 1, [Define if using Linux fbdev extension.])
215 +  ], [
216 +    AC_MSG_WARN([Could not find Linux FBDev extension, ignoring --enable-fbdev-dga.])
217 +    WANT_FBDEV_DGA=no
218 +  ])
219 + fi
220  
221   dnl We use XFree86 DGA if possible.
222   if [[ "x$WANT_XF86_DGA" = "xyes" ]]; then
# Line 219 | Line 242 | fi
242  
243   dnl We use GTK+ if possible.
244   UISRCS=../dummy/prefs_editor_dummy.cpp
245 < if [[ "x$WANT_GTK" = "xyes" ]]; then
245 > case "x$WANT_GTK" in
246 > xgtk2*)
247 >  AM_PATH_GTK_2_0(1.3.15, [
248 >    AC_DEFINE(ENABLE_GTK, 1, [Define if using GTK.])
249 >    CFLAGS="$CFLAGS $GTK_CFLAGS"
250 >    CXXFLAGS="$CXXFLAGS $GTK_CFLAGS"
251 >    LIBS="$LIBS $GTK_LIBS"
252 >    UISRCS=prefs_editor_gtk.cpp
253 >    WANT_GTK=gtk2
254 >  ], [
255 >    case "x${WANT_GTK}x" in
256 >    *gtkx)
257 >      AC_MSG_WARN([Could not find GTK+ 2.0, trying with GTK+ 1.2.])
258 >      WANT_GTK=gtk
259 >      ;;
260 >    *)
261 >      AC_MSG_WARN([Could not find GTK+, disabling user interface.])
262 >      WANT_GTK=no
263 >      ;;
264 >    esac
265 >  ])
266 >  ;;
267 > esac
268 > if [[ "x$WANT_GTK" = "xgtk" ]]; then
269    AM_PATH_GTK(1.2.0, [
270      AC_DEFINE(ENABLE_GTK, 1, [Define if using GTK.])
271      CFLAGS="$CFLAGS $GTK_CFLAGS"
# Line 251 | Line 297 | AC_SYS_LARGEFILE
297   dnl Checks for header files.
298   AC_HEADER_STDC
299   AC_HEADER_SYS_WAIT
300 < AC_CHECK_HEADERS(malloc.h)
300 > AC_CHECK_HEADERS(malloc.h stdint.h)
301   AC_CHECK_HEADERS(mach/vm_map.h mach/mach_init.h sys/mman.h)
256 AC_CHECK_HEADERS(sys/time.h sys/times.h sys/socket.h)
302   AC_CHECK_HEADERS(unistd.h fcntl.h byteswap.h dirent.h)
303 < AC_CHECK_HEADERS(linux/if.h, [], [], [
304 < #if HAVE_SYS_SOCKET_H
305 < # include <sys/socket.h>
303 > AC_CHECK_HEADERS(sys/socket.h sys/ioctl.h sys/filio.h sys/bitypes.h sys/wait.h)
304 > AC_CHECK_HEADERS(sys/time.h sys/poll.h sys/select.h arpa/inet.h)
305 > AC_CHECK_HEADERS(linux/if.h linux/if_tun.h net/if.h net/if_tun.h, [], [], [
306 > #ifdef HAVE_SYS_TYPES_H
307 > #include <sys/types.h>
308 > #endif
309 > #ifdef HAVE_SYS_SOCKET_H
310 > #include <sys/socket.h>
311   #endif
312   ])
313 < AC_CHECK_HEADERS(linux/if_tun.h net/if.h net/if_tun.h)
313 > AC_CHECK_HEADERS(AvailabilityMacros.h)
314 > AC_CHECK_HEADERS(IOKit/storage/IOBlockStorageDevice.h)
315   AC_CHECK_HEADERS(fenv.h)
316  
317   dnl Checks for typedefs, structures, and compiler characteristics.
# Line 281 | Line 332 | AC_TYPE_SIGNAL
332   AC_HEADER_TIME
333   AC_STRUCT_TM
334  
335 + dnl Check whether sys/socket.h defines type socklen_t.
336 + dnl (extracted from ac-archive/Miscellaneous)
337 + AC_CACHE_CHECK([for socklen_t],
338 +  ac_cv_type_socklen_t, [
339 +  AC_TRY_COMPILE([
340 +    #include <sys/types.h>
341 +    #include <sys/socket.h>
342 +  ], [socklen_t len = 42; return 0;],
343 +  ac_cv_type_socklen_t=yes, ac_cv_type_socklen_t=no,
344 +  dnl When cross-compiling, do not assume anything.
345 +  ac_cv_type_socklen_t="guessing no"
346 +  )
347 + ])
348 + if [[ "x$ac_cv_type_socklen_t" != "xyes" ]]; then
349 +  AC_DEFINE(socklen_t, int, [Define to 'int' if <sys/types.h> doesn't define.])
350 + fi
351 +
352   dnl Check whether struct sigaction has sa_restorer member.
353   AC_CACHE_CHECK([whether struct sigaction has sa_restorer],
354    ac_cv_signal_sa_restorer, [
# Line 297 | Line 365 | if [[ "x$ac_cv_signal_sa_restorer" = "xy
365   fi
366  
367   dnl Checks for library functions.
368 < AC_CHECK_FUNCS(strdup strlcpy cfmakeraw)
368 > AC_CHECK_FUNCS(strdup strerror strlcpy cfmakeraw)
369   AC_CHECK_FUNCS(nanosleep)
370   AC_CHECK_FUNCS(sigaction signal)
371   AC_CHECK_FUNCS(mmap mprotect munmap)
372   AC_CHECK_FUNCS(vm_allocate vm_deallocate vm_protect)
305 AC_CHECK_FUNCS(posix_memalign memalign valloc)
373   AC_CHECK_FUNCS(exp2f log2f exp2 log2)
374 + AC_CHECK_FUNCS(floorf roundf ceilf truncf floor round ceil trunc)
375 + AC_CHECK_FUNCS(poll inet_aton)
376  
377   dnl Darwin seems to define mach_task_self() instead of task_self().
378   AC_CHECK_FUNCS(mach_task_self task_self)
# Line 315 | Line 384 | no:linux*)
384    ;;
385   *:*)
386    AC_SEARCH_LIBS(clock_gettime, [rt posix4])
387 <  AC_CHECK_FUNCS(clock_gettime)
387 >  AC_CHECK_FUNCS(clock_gettime clock_nanosleep)
388    ;;
389   esac
390  
# Line 363 | Line 432 | AC_CHECK_FILE([/dev/ptc],
432   )
433   dnl (end of code from openssh-3.2.2p1 configure.ac)
434  
435 + dnl Check for systems where POSIX-style non-blocking I/O (O_NONBLOCK)
436 + dnl doesn't work or is unimplemented. On these systems (mostly older
437 + dnl ones), use the old BSD-style FIONBIO approach instead. [tcl.m4]
438 + AC_CACHE_CHECK([FIONBIO vs. O_NONBLOCK for non-blocking I/O],
439 +  ac_cv_nonblocking_io, [
440 +  case "$host" in
441 +  *-*-osf*)
442 +    ac_cv_nonblocking_io=FIONBIO
443 +    ;;
444 +  *-*-sunos4*)
445 +    ac_cv_nonblocking_io=FIONBIO
446 +    ;;
447 +  *-*-ultrix*)
448 +    ac_cv_nonblocking_io=FIONBIO
449 +    ;;
450 +  *)
451 +    ac_cv_nonblocking_io=O_NONBLOCK
452 +    ;;
453 +  esac
454 + ])
455 + if [[ "$ac_cv_nonblocking_io" = "FIONBIO" ]]; then
456 +  AC_DEFINE(USE_FIONBIO, 1, [Define if BSD-style non-blocking I/O is to be used])
457 + fi
458 +
459 + dnl Check whether compiler supports byte bit-fields
460 + AC_CACHE_CHECK([whether compiler supports byte bit-fields],
461 +  ac_cv_have_byte_bitfields, [
462 +  AC_LANG_SAVE
463 +  AC_LANG_CPLUSPLUS
464 +  AC_TRY_RUN([
465 +    struct A {
466 +      unsigned char b1:4;
467 +      unsigned char b2:4;
468 +      unsigned char c;
469 +      unsigned short s;
470 +      unsigned char a[4];
471 +    };
472 +
473 +    int main(void) {
474 +      A a;
475 +      return ! (sizeof(A) == 8 && &a.c == ((unsigned char *)&a + 1));
476 +    }],
477 +    [ac_cv_have_byte_bitfields=yes],
478 +    [ac_cv_have_byte_bitfields=no],
479 +    dnl When cross-compiling, assume only GCC supports this
480 +    [if [[ "$GCC" = "yes" ]]; then
481 +      ac_cv_have_byte_bitfields="guessing yes"
482 +    else
483 +      ac_cv_have_byte_bitfields="guessing no"
484 +    fi]
485 +    )
486 +  AC_LANG_RESTORE
487 + ])
488 +
489   dnl AC_CHECK_FRAMEWORK($1=NAME, $2=INCLUDES)
490 < AC_DEFUN(AC_CHECK_FRAMEWORK, [
490 > AC_DEFUN([AC_CHECK_FRAMEWORK], [
491    AS_VAR_PUSHDEF([ac_Framework], [ac_cv_framework_$1])dnl
492    AC_CACHE_CHECK([whether compiler supports framework $1],
493      ac_Framework, [
494      saved_LIBS="$LIBS"
495      LIBS="$LIBS -framework $1"
496      AC_TRY_LINK(
497 <      [$2], [int main(void) { return 0; }],
497 >      [$2], [],
498        [AS_VAR_SET(ac_Framework, yes)], [AS_VAR_SET(ac_Framework, no); LIBS="$saved_LIBS"]
499      )
500    ])
# Line 384 | Line 507 | AC_DEFUN(AC_CHECK_FRAMEWORK, [
507   dnl Check for some MacOS X frameworks
508   AC_CHECK_FRAMEWORK(Carbon, [#include <Carbon/Carbon.h>])
509   AC_CHECK_FRAMEWORK(IOKit, [#include <IOKit/IOKitLib.h>])
510 + AC_CHECK_FRAMEWORK(CoreFoundation, [#include <CoreFoundation/CoreFoundation.h>])
511  
512   dnl Select system-dependant sources.
513   SERIALSRC=serial_unix.cpp
# Line 394 | Line 518 | EXTFSSRC=extfs_unix.cpp
518   EXTRASYSSRCS=
519   case "$target_os" in
520   linux*)
521 <  ETHERSRC=Linux/ether_linux.cpp
521 >  ETHERSRC=ether_unix.cpp
522    AUDIOSRC=audio_oss_esd.cpp
523    SCSISRC=Linux/scsi_linux.cpp
524    if [[ "x$EMULATED_PPC" = "xno" ]]; then
525 <    EXTRASYSSRCS="Linux/paranoia.cpp Linux/sheepthreads.c Linux/asm_linux.S"
525 >    EXTRASYSSRCS="paranoia.cpp Linux/sheepthreads.c ppc_asm.S"
526 >  fi
527 >  ;;
528 > freebsd*)
529 >  ETHERSRC=ether_unix.cpp
530 >  ;;
531 > netbsd*)
532 >  ETHERSRC=ether_unix.cpp
533 >  if [[ "x$EMULATED_PPC" = "xno" ]]; then
534 >    EXTRASYSSRCS="paranoia.cpp NetBSD/sheepthreads.c ppc_asm.S"
535    fi
536    ;;
537   darwin*)
538 +  ETHERSRC=ether_unix.cpp
539    if [[ "x$EMULATED_PPC" = "xno" ]]; then
540 <    EXTRASYSSRCS="Darwin/paranoia.cpp Linux/asm_linux.S"
540 >    EXTRASYSSRCS="paranoia.cpp ppc_asm.S"
541    fi
542 <  if [[ "x$ac_cv_framework_IOKit" = "xyes" ]]; then
542 >  if [[ "x$ac_cv_framework_IOKit" = "xyes" -a "x$ac_cv_framework_CoreFoundation" = "xyes" ]]; then
543      EXTRASYSSRCS="$EXTRASYSSRCS ../MacOSX/sys_darwin.cpp"
544    fi
545    if [[ "x$ac_cv_framework_Carbon" = "xyes" ]]; then
546      EXTFSSRC=../MacOSX/extfs_macosx.mm
547    fi
548    ;;
549 < cygwin*)
550 <  SERIALSRC="../dummy/serial_dummy.cpp"
549 > irix*)
550 >  AUDIOSRC=Irix/audio_irix.cpp
551 >  LIBS="$LIBS -laudio"
552 >  WANT_ESD=no
553 >
554 >  dnl Check if our compiler supports -IPA (MIPSPro)
555 >  HAVE_IPA=no
556 >  ocflags="$CFLAGS"
557 >  CFLAGS=`echo " $CFLAGS -IPA" | sed -e "s/ -g //g"`
558 >  AC_MSG_CHECKING(if "-IPA" works)
559 >  dnl Do a test compile of an empty function
560 >  AC_TRY_COMPILE([#if defined __GNUC__
561 >                  # error GCC does not support IPA yet
562 >                  #endif],, [AC_MSG_RESULT(yes); HAVE_IPA=yes], AC_MSG_RESULT(no))
563 >  CFLAGS="$ocflags"
564 >  ;;
565 > esac
566 >
567 > dnl Is the slirp library supported?
568 > case "$ac_cv_have_byte_bitfields" in
569 > yes|"guessing yes")
570 >  CAN_SLIRP=yes
571 >  ETHERSRC=ether_unix.cpp
572    ;;
573   esac
574 + if [[ -n "$CAN_SLIRP" ]]; then
575 +  AC_DEFINE(HAVE_SLIRP, 1, [Define if slirp library is supported])
576 +  SLIRP_SRCS="\
577 +    ../slirp/bootp.c     ../slirp/ip_output.c  ../slirp/tcp_input.c  \
578 +    ../slirp/cksum.c     ../slirp/mbuf.c       ../slirp/tcp_output.c \
579 +    ../slirp/debug.c     ../slirp/misc.c       ../slirp/tcp_subr.c   \
580 +    ../slirp/if.c        ../slirp/sbuf.c       ../slirp/tcp_timer.c  \
581 +    ../slirp/ip_icmp.c   ../slirp/slirp.c      ../slirp/tftp.c       \
582 +    ../slirp/ip_input.c  ../slirp/socket.c     ../slirp/udp.c"
583 + fi
584 + AC_SUBST(SLIRP_SRCS)
585  
586   dnl SDL overrides
587   if [[ "x$WANT_SDL" = "xyes" ]]; then
# Line 428 | Line 594 | if [[ "x$WANT_SDL_VIDEO" = "xyes" ]]; th
594    if [[ "x$ac_cv_framework_Carbon" = "xyes" ]]; then
595      EXTRASYSSRCS="$EXTRASYSSRCS ../MacOSX/clip_macosx.cpp"
596    else
597 <    case "$target_os" in
432 <    cygwin*)
433 <      EXTRASYSSRCS="$EXTRASYSSRCS ../Windows/clip_windows.cpp"
434 <      ;;
435 <    *)
436 <      EXTRASYSSRCS="$EXTRASYSSRCS ../dummy/clip_dummy.cpp"
437 <      ;;
438 <    esac
597 >    EXTRASYSSRCS="$EXTRASYSSRCS ../dummy/clip_dummy.cpp"
598    fi
599   else
600    VIDEOSRCS="video_x.cpp"
# Line 454 | Line 613 | dnl to be put into the config.h file
613   dnl $1 -- the macro to define
614   dnl $2 -- the value to translate
615   dnl $3 -- template name
616 < AC_DEFUN(AC_TRANSLATE_DEFINE, [
616 > AC_DEFUN([AC_TRANSLATE_DEFINE], [
617      if [[ "x$2" = "xyes" -o "x$2" = "xguessing yes" ]]; then
618          AC_DEFINE($1, 1, $3)
619      fi
# Line 863 | Line 1022 | fi
1022  
1023   dnl Check addressing mode to use
1024   AC_MSG_CHECKING([for addressing mode to use])
866 case "$os_target" in
867 cygwin*)
868  WANT_ADDRESSING_MODE="direct,cygwin-hack"
869  NATMEM_OFFSET=
870  ;;
871 esac
1025   if [[ "$EMULATED_PPC" != "yes" ]]; then
1026    if [[ "$WANT_ADDRESSING_MODE" != "real" ]]; then
1027      AC_MSG_WARN([Running in native PowerPC mode, force use of Real Addressing.])
# Line 919 | Line 1072 | int main(void)
1072                  memset(m, 0, ranges[[i]].size);
1073                  vm_release(m, ranges[[i]].size);
1074                  if (i == n_ranges - 1) {
1075 <                        printf("0x%08x\n", ofs);
1075 >                        if (sizeof(void *) == 8 && ofs > 0xffffffff)
1076 >                                printf("0x%lxul\n", ofs);
1077 >                        else
1078 >                                printf("0x%08x\n", ofs);
1079                          return 0;
1080                  }
1081          }
# Line 947 | Line 1103 | EOF
1103   fi
1104   AC_MSG_RESULT($WANT_ADDRESSING_MODE)
1105  
1106 + dnl Utility macro used by next two tests.
1107 + dnl AC_EXAMINE_OBJECT(C source code,
1108 + dnl     commands examining object file,
1109 + dnl     [commands to run if compile failed]):
1110 + dnl
1111 + dnl Compile the source code to an object file; then convert it into a
1112 + dnl printable representation.  All unprintable characters and
1113 + dnl asterisks (*) are replaced by dots (.).  All white space is
1114 + dnl deleted.  Newlines (ASCII 0x10) in the input are preserved in the
1115 + dnl output, but runs of newlines are compressed to a single newline.
1116 + dnl Finally, line breaks are forcibly inserted so that no line is
1117 + dnl longer than 80 columns and the file ends with a newline.  The
1118 + dnl result of all this processing is in the file conftest.dmp, which
1119 + dnl may be examined by the commands in the second argument.
1120 + dnl
1121 + AC_DEFUN([gcc_AC_EXAMINE_OBJECT],
1122 + [AC_LANG_SAVE
1123 + AC_LANG_C
1124 + dnl Next bit cribbed from AC_TRY_COMPILE.
1125 + cat > conftest.$ac_ext <<EOF
1126 + [#line __oline__ "configure"
1127 + #include "confdefs.h"
1128 + $1
1129 + ]EOF
1130 + if AC_TRY_EVAL(ac_compile); then
1131 +  od -c conftest.o |
1132 +    sed ['s/^[0-7]*[    ]*/ /
1133 +          s/\*/./g
1134 +          s/ \\n/*/g
1135 +          s/ [0-9][0-9][0-9]/./g
1136 +          s/  \\[^ ]/./g'] |
1137 +    tr -d '
1138 + ' | tr -s '*' '
1139 + ' | fold | sed '$a\
1140 + ' > conftest.dmp
1141 +  $2
1142 + ifelse($3, , , else
1143 +  $3
1144 + )dnl
1145 + fi
1146 + rm -rf conftest*
1147 + AC_LANG_RESTORE])
1148 +
1149 + dnl Floating point format probe.
1150 + dnl The basic concept is the same as the above: grep the object
1151 + dnl file for an interesting string.  We have to watch out for
1152 + dnl rounding changing the values in the object, however; this is
1153 + dnl handled by ignoring the least significant byte of the float.
1154 + dnl
1155 + dnl Does not know about VAX G-float or C4x idiosyncratic format.
1156 + dnl It does know about PDP-10 idiosyncratic format, but this is
1157 + dnl not presently supported by GCC.  S/390 "binary floating point"
1158 + dnl is in fact IEEE (but maybe we should have that in EBCDIC as well
1159 + dnl as ASCII?)
1160 + dnl
1161 + AC_DEFUN([gcc_AC_C_FLOAT_FORMAT],
1162 + [AC_CACHE_CHECK(floating point format, ac_cv_c_float_format,
1163 + [gcc_AC_EXAMINE_OBJECT(
1164 + [/* This will not work unless sizeof(double) == 8.  */
1165 + extern char sizeof_double_must_be_8 [sizeof(double) == 8 ? 1 : -1];
1166 +
1167 + /* This structure must have no internal padding.  */
1168 + struct possibility {
1169 +  char prefix[8];
1170 +  double candidate;
1171 +  char postfix[8];
1172 + };
1173 +
1174 + #define C(cand) { "\nformat:", cand, ":tamrof\n" }
1175 + struct possibility table [] =
1176 + {
1177 +  C( 3.25724264705901305206e+01), /* @@IEEEFP - IEEE 754 */
1178 +  C( 3.53802595280598432000e+18), /* D__float - VAX */
1179 +  C( 5.32201830133125317057e-19), /* D.PDP-10 - PDP-10 - the dot is 0x13a */
1180 +  C( 1.77977764695171661377e+10), /* IBMHEXFP - s/390 format, ascii */
1181 +  C(-5.22995989424860458374e+10)  /* IBMHEXFP - s/390 format, EBCDIC */
1182 + };],
1183 + [if   grep 'format:.@IEEEF.:tamrof' conftest.dmp >/dev/null 2>&1; then
1184 +    ac_cv_c_float_format='IEEE (big-endian)'
1185 +  elif grep 'format:.I@@PFE.:tamrof' conftest.dmp >/dev/null 2>&1; then
1186 +    ac_cv_c_float_format='IEEE (big-endian)'
1187 +  elif grep 'format:.FEEEI@.:tamrof' conftest.dmp >/dev/null 2>&1; then
1188 +    ac_cv_c_float_format='IEEE (little-endian)'
1189 +  elif grep 'format:.EFP@@I.:tamrof' conftest.dmp >/dev/null 2>&1; then
1190 +    ac_cv_c_float_format='IEEE (little-endian)'
1191 +  elif grep 'format:.__floa.:tamrof' conftest.dmp >/dev/null 2>&1; then
1192 +    ac_cv_c_float_format='VAX D-float'
1193 +  elif grep 'format:..PDP-1.:tamrof' conftest.dmp >/dev/null 2>&1; then
1194 +    ac_cv_c_float_format='PDP-10'
1195 +  elif grep 'format:.BMHEXF.:tamrof' conftest.dmp >/dev/null 2>&1; then
1196 +    ac_cv_c_float_format='IBM 370 hex'
1197 +  else
1198 +    AC_MSG_ERROR(Unknown floating point format)
1199 +  fi],
1200 +  [AC_MSG_ERROR(compile failed)])
1201 + ])
1202 + # IEEE is the default format.  If the float endianness isn't the same
1203 + # as the integer endianness, we have to set FLOAT_WORDS_BIG_ENDIAN
1204 + # (which is a tristate: yes, no, default).  This is only an issue with
1205 + # IEEE; the other formats are only supported by a few machines each,
1206 + # all with the same endianness.
1207 + format=IEEE_FLOAT_FORMAT
1208 + fbigend=
1209 + case $ac_cv_c_float_format in
1210 +    'IEEE (big-endian)' )
1211 +        if test $ac_cv_c_bigendian = no; then
1212 +            fbigend=1
1213 +        fi
1214 +        ;;
1215 +    'IEEE (little-endian)' )
1216 +        if test $ac_cv_c_bigendian = yes; then
1217 +            fbigend=0
1218 +        fi
1219 +        ;;
1220 +    'VAX D-float' )
1221 +        format=VAX_FLOAT_FORMAT
1222 +        ;;
1223 +    'PDP-10' )
1224 +        format=PDP10_FLOAT_FORMAT
1225 +        ;;
1226 +    'IBM 370 hex' )
1227 +        format=IBM_FLOAT_FORMAT
1228 +        ;;
1229 + esac
1230 + AC_DEFINE_UNQUOTED(HOST_FLOAT_FORMAT, $format,
1231 +  [Define to the floating point format of the host machine.])
1232 + if test -n "$fbigend"; then
1233 +        AC_DEFINE_UNQUOTED(HOST_FLOAT_WORDS_BIG_ENDIAN, $fbigend,
1234 +  [Define to 1 if the host machine stores floating point numbers in
1235 +   memory with the word containing the sign bit at the lowest address,
1236 +   or to 0 if it does it the other way around.
1237 +
1238 +   This macro should not be defined if the ordering is the same as for
1239 +   multi-word integers.])
1240 + fi
1241 + ])
1242 +
1243 + dnl Check for host float format
1244 + gcc_AC_C_FLOAT_FORMAT
1245 +
1246   dnl Platform specific binary postprocessor
1247   AC_PATH_PROG(BLESS, "true")
1248   if [[ "x$ac_cv_pagezero_hack" = "xyes" ]]; then
# Line 957 | Line 1253 | fi
1253   dnl Check for GCC 2.7 or higher.
1254   HAVE_GCC27=no
1255   AC_MSG_CHECKING(for GCC 2.7 or higher)
1256 < AC_EGREP_CPP(xyes,
1257 < [#if __GNUC__ - 1 > 1 || __GNUC_MINOR__ - 1 > 5
1258 <  xyes
1259 < #endif
1260 < ], [AC_MSG_RESULT(yes); HAVE_GCC27=yes], AC_MSG_RESULT(no))
1256 > AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#if ! (__GNUC__ - 1 > 1 || __GNUC_MINOR__ - 1 > 5)
1257 >                                     # error gcc < 2.7
1258 >                                     typedef syntax error;
1259 >                                     #endif
1260 >                                   ]])],
1261 >                  [AC_MSG_RESULT(yes); HAVE_GCC27=yes],
1262 >                  [AC_MSG_RESULT(no)])
1263  
1264   dnl Check for GCC 3.0 or higher.
1265   HAVE_GCC30=no
1266   AC_MSG_CHECKING(for GCC 3.0 or higher)
1267 < AC_EGREP_CPP(xyes,
1268 < [#if __GNUC__ >= 3
1269 <  xyes
1270 < #endif
1271 < ], [AC_MSG_RESULT(yes); HAVE_GCC30=yes], AC_MSG_RESULT(no))
1267 > AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#if ! (__GNUC__ >= 3)
1268 >                                     # error gcc < 3
1269 >                                     typedef syntax error;
1270 >                                     #endif
1271 >                                   ]])],
1272 >                  [AC_MSG_RESULT(yes); HAVE_GCC30=yes],
1273 >                  [AC_MSG_RESULT(no)])
1274  
1275   dnl Check for ICC.
1276   AC_MSG_CHECKING(for ICC)
# Line 981 | Line 1281 | fi
1281   AC_MSG_RESULT($HAVE_ICC)
1282  
1283   dnl Determine the generated object format
1284 < AC_CACHE_CHECK([whether the compiler can generate ELF objects],
1284 > AC_CACHE_CHECK([the format of compiler generated objects],
1285    ac_cv_object_format, [
1286    echo 'int i;' > conftest.$ac_ext
1287    ac_cv_object_format=no
# Line 990 | Line 1290 | AC_CACHE_CHECK([whether the compiler can
1290      *"ELF"*)
1291        ac_cv_object_format=elf
1292        ;;
1293 +    *"Mach-O"*)
1294 +      ac_cv_object_format=mach
1295 +      ;;
1296      *)
1297        ac_cv_object_format=unknown
1298        ;;
# Line 998 | Line 1301 | AC_CACHE_CHECK([whether the compiler can
1301    rm -rf conftest*
1302   ])
1303  
1304 + dnl Add -fno-strict-aliasing for slirp sources
1305 + if [[ "x$HAVE_GCC30" = "xyes" ]]; then
1306 +  SAVED_CFLAGS="$CFLAGS"
1307 +  CFLAGS="$CFLAGS -fno-strict-aliasing"
1308 +  AC_CACHE_CHECK([whether the compiler supports -fno-strict-aliasing],
1309 +    ac_cv_gcc_no_strict_aliasing, [
1310 +    AC_TRY_COMPILE([],[],
1311 +      [ac_cv_gcc_no_strict_aliasing=yes; AC_SUBST(SLIRP_CFLAGS, "-fno-strict-aliasing")],
1312 +      [ac_cv_gcc_no_strict_aliasing=no])
1313 +  ])
1314 +  CFLAGS="$SAVED_CFLAGS"
1315 + fi
1316 +
1317 + dnl Add -mdynamic-no-pic for MacOS X (XXX icc10 will support MacOS X)
1318 + if [[ "x$HAVE_GCC30" = "xyes" -a "x$HAVE_ICC" = "xno" ]]; then
1319 +  SAVED_CFLAGS="$CFLAGS"
1320 +  CFLAGS="$CFLAGS -mdynamic-no-pic"
1321 +  AC_CACHE_CHECK([whether the compiler supports -mdynamic-no-pic],
1322 +    ac_cv_gcc_mdynamic_no_pic, [
1323 +    AC_TRY_COMPILE([],[],[ac_cv_gcc_mdynamic_no_pic=yes],[ac_cv_gcc_mdynamic_no_pic=no])
1324 +  ])
1325 +  if [[ "x$ac_cv_gcc_mdynamic_no_pic" = "xyes" ]]; then
1326 +    CXXFLAGS="$CXXFLAGS -mdynamic-no-pic"
1327 +  else
1328 +    CFLAGS="$SAVED_CFLAGS"
1329 +  fi
1330 + fi
1331 +
1332   dnl CPU emulator sources
1333   if [[ "x$EMULATED_PPC" = "xyes" ]]; then
1334    CPUSRCS="\
1335      ../kpx_cpu/src/mathlib/ieeefp.cpp \
1336 +    ../kpx_cpu/src/mathlib/mathlib.cpp \
1337      ../kpx_cpu/src/cpu/ppc/ppc-cpu.cpp \
1338      ../kpx_cpu/src/cpu/ppc/ppc-decode.cpp \
1339      ../kpx_cpu/src/cpu/ppc/ppc-execute.cpp \
# Line 1022 | Line 1354 | if [[ "x$EMULATED_PPC" = "xyes" ]]; then
1354        i?86:elf)
1355          ac_cv_use_dyngen=yes
1356          ;;
1357 +      mips:elf)
1358 +        ac_cv_use_dyngen=yes
1359 +        ;;
1360 +      powerpc:mach)
1361 +        ac_cv_use_dyngen=yes
1362 +        ;;
1363 +      i?86:mach)
1364 +        ac_cv_use_dyngen=yes
1365 +        ;;
1366        *:*)
1367          ac_cv_use_dyngen=no
1368          ;;
# Line 1031 | Line 1372 | if [[ "x$EMULATED_PPC" = "xyes" ]]; then
1372          if [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_ICC" = "xno" ]]; then
1373            DYNGEN_CC=$CXX
1374          else
1375 <          for p in /usr/bin /usr/local/bin; do
1375 >          for p in /usr/bin /usr/local/bin /usr/freeware/bin; do
1376              gxx="$p/g++"
1377              if [[ -x "$gxx" ]]; then
1378                DYNGEN_CC="$gxx"
# Line 1039 | Line 1380 | if [[ "x$EMULATED_PPC" = "xyes" ]]; then
1380            done
1381          fi
1382        fi
1383 <      if [[ -z "$DYNGEN_CC" ]] || ! { echo '#include <limits>' | $DYNGEN_CC -xc++ -c -o /dev/null - >& /dev/null; }; then
1383 >      if [[ -z "$DYNGEN_CC" ]]; then
1384          ac_cv_use_dyngen=no
1385        fi
1386      ])
1387      if [[ "x$ac_cv_use_dyngen" = "xyes" ]]; then
1388        case $host_cpu in
1389        i?86)
1390 <        DYNGEN_OP_FLAGS="-fomit-frame-pointer -mpreferred-stack-boundary=2"
1050 <        if [[ "x$HAVE_GCC30" = "xyes" ]]; then
1051 <          DYNGEN_OP_FLAGS="$DYNGEN_OP_FLAGS -falign-functions=0"
1052 <        else
1053 <          DYNGEN_OP_FLAGS="$DYNGEN_OP_FLAGS -malign-functions=0"
1054 <        fi
1055 <        saved_CPPFLAGS=$CPPFLAGS
1056 <        CPPFLAGS="$CPPFLAGS -mmmx"
1057 <        AC_CHECK_HEADERS(mmintrin.h,  [DYNGEN_OP_FLAGS="$DYNGEN_OP_FLAGS -mmmx"])
1058 <        CPPFLAGS="$CPPFLAGS -msse"
1059 <        AC_CHECK_HEADERS(xmmintrin.h, [DYNGEN_OP_FLAGS="$DYNGEN_OP_FLAGS -msse"])
1060 <        CPPFLAGS="$CPPFLAGS -msse2"
1061 <        AC_CHECK_HEADERS(emmintrin.h, [DYNGEN_OP_FLAGS="$DYNGEN_OP_FLAGS -msse2"])
1062 <        CPPFLAGS=$saved_CPPFLAGS
1390 >        DYNGEN_OP_FLAGS="-fomit-frame-pointer"
1391          ;;
1392 <      x86_64)
1393 <        AC_CHECK_HEADERS(mmintrin.h xmmintrin.h emmintrin.h)
1392 >      mips)
1393 >        DYNGEN_OP_FLAGS="-fno-delayed-branch -mno-abicalls"
1394          ;;
1395 +      powerpc)
1396 +        if [[ "x$ac_cv_object_format" = "xmach" ]]; then
1397 +          DYNGEN_OP_FLAGS="-mdynamic-no-pic"
1398 +        fi
1399 +        ;;
1400 +      esac
1401 +      have_dyngen_gcc3=no
1402 +      case "x`$DYNGEN_CC -dumpversion`" in
1403 +      x[12].*) ;;
1404 +      x*) have_dyngen_gcc3=yes ;;
1405        esac
1406 <      DYNGEN_OP_FLAGS="$DYNGEN_OP_FLAGS -finline-limit=10000"
1407 <      if [[ "x$HAVE_GCC30" = "xyes" ]]; then
1406 >      if [[ "x$have_dyngen_gcc3" = "xyes" ]]; then
1407 >        DYNGEN_OP_FLAGS="$DYNGEN_OP_FLAGS -falign-functions=0"
1408 >      else
1409 >        DYNGEN_OP_FLAGS="$DYNGEN_OP_FLAGS -malign-functions=0"
1410 >      fi
1411 >      DYNGEN_OP_FLAGS="$DYNGEN_OP_FLAGS -finline-functions -finline-limit=10000 -fno-exceptions -g0"
1412 >      if [[ "x$have_dyngen_gcc3" = "xyes" ]]; then
1413          DYNGEN_OP_FLAGS="$DYNGEN_OP_FLAGS -fno-reorder-blocks -fno-optimize-sibling-calls"
1414        fi
1415 +      if [[ "x$DYNGEN_CC" != "x$CXX" ]]; then
1416 +        DYNGEN_CFLAGS="-O2 $CFLAGS"
1417 +        DYNGEN_CXXFLAGS="-O2 $CXXFLAGS"
1418 +      else
1419 +        DYNGEN_CFLAGS="\$(CFLAGS)"
1420 +        DYNGEN_CXXFLAGS="\$(CXXFLAGS)"
1421 +      fi
1422      else
1423        WANT_JIT=no
1424      fi
# Line 1091 | Line 1441 | if [[ "x$ac_cv_use_dyngen" = "xyes" ]];
1441    AC_CACHE_CHECK([whether static data regions are executable],
1442      ac_cv_have_static_data_exec, [
1443      AC_TRY_RUN([int main(void) {
1444 < #if defined(__powerpc__)
1444 > #if defined(__powerpc__) || defined(__ppc__)
1445        static unsigned int p[8] = {0x4e800020,};
1446        asm volatile("dcbst 0,%0" : : "r" (p) : "memory");
1447        asm volatile("sync" : : : "memory");
# Line 1107 | Line 1457 | if [[ "x$ac_cv_use_dyngen" = "xyes" ]];
1457      ac_cv_have_static_data_exec=no
1458      )
1459    ])
1460 + else
1461 +  ac_cv_use_dyngen=no
1462   fi
1463   AC_TRANSLATE_DEFINE(HAVE_STATIC_DATA_EXEC, "$ac_cv_have_static_data_exec",
1464    [Define if your system marks static data pages as executable.])
# Line 1115 | Line 1467 | if [[ "x$WANT_JIT" = "xyes" ]]; then
1467    CPPFLAGS="$CPPFLAGS -DUSE_JIT"
1468   fi
1469  
1470 + dnl Higher level optimizations with MIPSPro compilers are possible
1471 + if [[ "x$HAVE_IPA" = "xyes" ]]; then
1472 +  CFLAGS="`echo $CFLAGS | sed -e 's/-g//g'` -O3 -OPT:Olimit=0 -IPA"
1473 +  CXXFLAGS="`echo $CXXFLAGS | sed -e 's/-g//g'` -O3 -OPT:Olimit=0 -IPA"
1474 +  CXXFLAGS="-LANG:std $CXXFLAGS"
1475 +  LDFLAGS="$LDFLAGS -O3 -OPT:Olimit=0 -IPA"
1476 + fi
1477 +
1478   dnl Generate Makefile.
1479 + AC_SUBST(PERL)
1480 + AC_SUBST(USE_DYNGEN, [$ac_cv_use_dyngen])
1481   AC_SUBST(DYNGENSRCS)
1482   AC_SUBST(DYNGEN_CC)
1483 + AC_SUBST(DYNGEN_CFLAGS)
1484 + AC_SUBST(DYNGEN_CXXFLAGS)
1485   AC_SUBST(DYNGEN_OP_FLAGS)
1486   AC_SUBST(SYSSRCS)
1487   AC_SUBST(CPUSRCS)
# Line 1133 | Line 1497 | echo
1497   echo SheepShaver configuration summary:
1498   echo
1499   echo SDL support ...................... : $SDL_SUPPORT
1500 + echo FBDev DGA support ................ : $WANT_FBDEV_DGA
1501   echo XFree86 DGA support .............. : $WANT_XF86_DGA
1502   echo XFree86 VidMode support .......... : $WANT_XF86_VIDMODE
1503   echo Using PowerPC emulator ........... : $EMULATED_PPC

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines