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.20 by gbeauche, 2005-03-19T09:59:30Z vs.
Revision 1.53 by gbeauche, 2006-07-06T00:07:47Z

# 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_ENABLE(standalone-gui,[  --enable-standalone-gui enable a standalone GUI prefs editor [default=no]], [WANT_STANDALONE_GUI=$enableval], [WANT_STANDALONE_GUI=no])
32   AC_ARG_WITH(esd,            [  --with-esd              support ESD for sound under Linux/FreeBSD [default=yes]], [WANT_ESD=$withval], [WANT_ESD=yes])
33   AC_ARG_WITH(gtk,            [  --with-gtk              use GTK user interface [default=yes]],
34    [case "$withval" in
# Line 117 | Line 126 | AC_SUBST(MONSRCS)
126  
127   dnl Checks for libraries.
128   AC_CHECK_LIB(posix4, sem_init)
129 + AC_CHECK_LIB(m, cos)
130  
131   dnl Do we need SDL?
132   WANT_SDL=no
# Line 134 | Line 144 | fi
144   if [[ "x$WANT_SDL" = "xyes" ]]; then
145    AC_PATH_PROG(sdl_config, "sdl-config")
146    if [[ -n "$sdl_config" ]]; then
147 <    case $target_os in
148 <    # Special treatment for Cygwin so that we can still use the POSIX layer
149 <    *cygwin*)
150 <      sdl_cflags="-I`$sdl_config --prefix`/include/SDL"
151 <      sdl_libs="-L`$sdl_config --exec-prefix`/lib -lSDL"
152 <      ;;
143 <    *)
144 <      sdl_cflags=`$sdl_config --cflags`
145 <      if [[ "x$WANT_SDL_STATIC" = "xyes" ]]; then
146 <        sdl_libs=`$sdl_config --static-libs`
147 <      else
148 <        sdl_libs=`$sdl_config --libs`
149 <      fi
150 <      ;;
151 <    esac
147 >    sdl_cflags=`$sdl_config --cflags`
148 >    if [[ "x$WANT_SDL_STATIC" = "xyes" ]]; then
149 >      sdl_libs=`$sdl_config --static-libs`
150 >    else
151 >      sdl_libs=`$sdl_config --libs`
152 >    fi
153      CFLAGS="$CFLAGS $sdl_cflags"
154      CXXFLAGS="$CXXFLAGS $sdl_cflags"
155      LIBS="$LIBS $sdl_libs"
# Line 184 | Line 185 | no:linux*|no:netbsd*)
185    AC_CHECK_LIB(pthread, pthread_create, , [
186      AC_CHECK_LIB(c_r, pthread_create, , [
187        AC_CHECK_LIB(PTL, pthread_create, , [
188 <        AC_MSG_ERROR([You need pthreads to run Basilisk II.])
188 >        dnl XXX remove when no pthreads case is merged
189 >        AC_MSG_ERROR([You need pthreads to run SheepShaver.])
190 >        HAVE_PTHREADS=no
191        ])
192      ])
193    ])
194    AC_CHECK_FUNCS(pthread_cancel)
195 +  AC_CHECK_FUNCS(pthread_cond_init pthread_testcancel)
196    AC_CHECK_FUNCS(pthread_mutexattr_setprotocol)
197    AC_CHECK_FUNCS(pthread_mutexattr_settype)
198    AC_CHECK_FUNCS(pthread_mutexattr_setpshared)
195  if [[ "x$HAVE_PTHREADS" = "xyes" ]]; then
196    AC_DEFINE(HAVE_PTHREADS, 1, [Define if pthreads are available.])
197  fi
199    dnl If POSIX.4 semaphores are not available, we emulate them with pthread mutexes.
200    SEMSRC=
201    AC_CHECK_FUNCS(sem_init, , [
# Line 204 | Line 205 | no:linux*|no:netbsd*)
205    ])
206    ;;
207   esac
208 + if [[ "x$HAVE_PTHREADS" = "xyes" ]]; then
209 +  AC_DEFINE(HAVE_PTHREADS, 1, [Define if pthreads are available.])
210 + fi
211 +
212 + dnl We use FBDev DGA if possible.
213 + if [[ "x$WANT_FBDEV_DGA" = "xyes" ]]; then
214 +  AC_CHECK_HEADER(linux/fb.h, [
215 +    AC_DEFINE(ENABLE_FBDEV_DGA, 1, [Define if using Linux fbdev extension.])
216 +  ], [
217 +    AC_MSG_WARN([Could not find Linux FBDev extension, ignoring --enable-fbdev-dga.])
218 +    WANT_FBDEV_DGA=no
219 +  ])
220 + fi
221  
222   dnl We use XFree86 DGA if possible.
223   if [[ "x$WANT_XF86_DGA" = "xyes" ]]; then
# Line 232 | Line 246 | UISRCS=../dummy/prefs_editor_dummy.cpp
246   case "x$WANT_GTK" in
247   xgtk2*)
248    AM_PATH_GTK_2_0(1.3.15, [
249 <    AC_DEFINE(ENABLE_GTK, 1, [Define if using GTK.])
250 <    CFLAGS="$CFLAGS $GTK_CFLAGS"
237 <    CXXFLAGS="$CXXFLAGS $GTK_CFLAGS"
238 <    LIBS="$LIBS $GTK_LIBS"
239 <    UISRCS=prefs_editor_gtk.cpp
249 >    GUI_CFLAGS="$GTK_CFLAGS"
250 >    GUI_LIBS="$GTK_LIBS"
251      WANT_GTK=gtk2
252    ], [
253      case "x${WANT_GTK}x" in
# Line 254 | Line 265 | xgtk2*)
265   esac
266   if [[ "x$WANT_GTK" = "xgtk" ]]; then
267    AM_PATH_GTK(1.2.0, [
268 <    AC_DEFINE(ENABLE_GTK, 1, [Define if using GTK.])
269 <    CFLAGS="$CFLAGS $GTK_CFLAGS"
259 <    CXXFLAGS="$CXXFLAGS $GTK_CFLAGS"
260 <    LIBS="$LIBS $GTK_LIBS"
261 <    UISRCS=prefs_editor_gtk.cpp
268 >    GUI_CFLAGS="$GTK_CFLAGS"
269 >    GUI_LIBS="$GTK_LIBS"
270    ], [
271      AC_MSG_WARN([Could not find GTK+, disabling user interface.])
272      WANT_GTK=no
273    ])
274   fi
275 + if [[ "x$WANT_GTK" != "xno" -a "x$WANT_STANDALONE_GUI" = "xno" ]]; then
276 +  AC_DEFINE(ENABLE_GTK, 1, [Define if using GTK.])
277 +  UISRCS=prefs_editor_gtk.cpp
278 + fi
279 + AC_SUBST(GUI_CFLAGS)
280 + AC_SUBST(GUI_LIBS)
281 +
282 + dnl Build external GUI if requested.
283 + if [[ "$WANT_STANDALONE_GUI" != "yes" ]]; then
284 +  WANT_STANDALONE_GUI=no
285 + fi
286 + if [[ "$WANT_GTK" = "no" ]]; then
287 +  WANT_STANDALONE_GUI=no
288 + fi
289 + AC_SUBST(STANDALONE_GUI, [$WANT_STANDALONE_GUI])
290  
291   dnl We use ESD if possible.
292   if [[ "x$WANT_ESD" = "xyes" ]]; then
# Line 284 | Line 307 | AC_SYS_LARGEFILE
307   dnl Checks for header files.
308   AC_HEADER_STDC
309   AC_HEADER_SYS_WAIT
310 < AC_CHECK_HEADERS(malloc.h)
310 > AC_CHECK_HEADERS(malloc.h stdint.h)
311   AC_CHECK_HEADERS(mach/vm_map.h mach/mach_init.h sys/mman.h)
289 AC_CHECK_HEADERS(sys/time.h sys/times.h sys/socket.h)
312   AC_CHECK_HEADERS(unistd.h fcntl.h byteswap.h dirent.h)
313 < AC_CHECK_HEADERS(linux/if.h, [], [], [
314 < #if HAVE_SYS_SOCKET_H
315 < # include <sys/socket.h>
313 > AC_CHECK_HEADERS(sys/socket.h sys/ioctl.h sys/filio.h sys/bitypes.h sys/wait.h)
314 > AC_CHECK_HEADERS(sys/time.h sys/poll.h sys/select.h arpa/inet.h)
315 > AC_CHECK_HEADERS(linux/if.h linux/if_tun.h net/if.h net/if_tun.h, [], [], [
316 > #ifdef HAVE_SYS_TYPES_H
317 > #include <sys/types.h>
318 > #endif
319 > #ifdef HAVE_SYS_SOCKET_H
320 > #include <sys/socket.h>
321   #endif
322   ])
323 < AC_CHECK_HEADERS(linux/if_tun.h net/if.h net/if_tun.h)
323 > AC_CHECK_HEADERS(AvailabilityMacros.h)
324 > AC_CHECK_HEADERS(IOKit/storage/IOBlockStorageDevice.h)
325   AC_CHECK_HEADERS(fenv.h)
326  
327   dnl Checks for typedefs, structures, and compiler characteristics.
# Line 314 | Line 342 | AC_TYPE_SIGNAL
342   AC_HEADER_TIME
343   AC_STRUCT_TM
344  
345 + dnl Check whether sys/socket.h defines type socklen_t.
346 + dnl (extracted from ac-archive/Miscellaneous)
347 + AC_CACHE_CHECK([for socklen_t],
348 +  ac_cv_type_socklen_t, [
349 +  AC_TRY_COMPILE([
350 +    #include <sys/types.h>
351 +    #include <sys/socket.h>
352 +  ], [socklen_t len = 42; return 0;],
353 +  ac_cv_type_socklen_t=yes, ac_cv_type_socklen_t=no,
354 +  dnl When cross-compiling, do not assume anything.
355 +  ac_cv_type_socklen_t="guessing no"
356 +  )
357 + ])
358 + if [[ "x$ac_cv_type_socklen_t" != "xyes" ]]; then
359 +  AC_DEFINE(socklen_t, int, [Define to 'int' if <sys/types.h> doesn't define.])
360 + fi
361 +
362   dnl Check whether struct sigaction has sa_restorer member.
363   AC_CACHE_CHECK([whether struct sigaction has sa_restorer],
364    ac_cv_signal_sa_restorer, [
# Line 330 | Line 375 | if [[ "x$ac_cv_signal_sa_restorer" = "xy
375   fi
376  
377   dnl Checks for library functions.
378 < AC_CHECK_FUNCS(strdup strlcpy cfmakeraw)
378 > AC_CHECK_FUNCS(strdup strerror strlcpy cfmakeraw)
379   AC_CHECK_FUNCS(nanosleep)
380   AC_CHECK_FUNCS(sigaction signal)
381   AC_CHECK_FUNCS(mmap mprotect munmap)
382   AC_CHECK_FUNCS(vm_allocate vm_deallocate vm_protect)
383 < AC_CHECK_FUNCS(posix_memalign memalign valloc)
384 < AC_CHECK_FUNCS(exp2f log2f exp2 log2 trunc)
383 > AC_CHECK_FUNCS(exp2f log2f exp2 log2)
384 > AC_CHECK_FUNCS(floorf roundf ceilf truncf floor round ceil trunc)
385 > AC_CHECK_FUNCS(poll inet_aton)
386  
387   dnl Darwin seems to define mach_task_self() instead of task_self().
388   AC_CHECK_FUNCS(mach_task_self task_self)
# Line 396 | Line 442 | AC_CHECK_FILE([/dev/ptc],
442   )
443   dnl (end of code from openssh-3.2.2p1 configure.ac)
444  
445 + dnl Check for systems where POSIX-style non-blocking I/O (O_NONBLOCK)
446 + dnl doesn't work or is unimplemented. On these systems (mostly older
447 + dnl ones), use the old BSD-style FIONBIO approach instead. [tcl.m4]
448 + AC_CACHE_CHECK([FIONBIO vs. O_NONBLOCK for non-blocking I/O],
449 +  ac_cv_nonblocking_io, [
450 +  case "$host" in
451 +  *-*-osf*)
452 +    ac_cv_nonblocking_io=FIONBIO
453 +    ;;
454 +  *-*-sunos4*)
455 +    ac_cv_nonblocking_io=FIONBIO
456 +    ;;
457 +  *-*-ultrix*)
458 +    ac_cv_nonblocking_io=FIONBIO
459 +    ;;
460 +  *)
461 +    ac_cv_nonblocking_io=O_NONBLOCK
462 +    ;;
463 +  esac
464 + ])
465 + if [[ "$ac_cv_nonblocking_io" = "FIONBIO" ]]; then
466 +  AC_DEFINE(USE_FIONBIO, 1, [Define if BSD-style non-blocking I/O is to be used])
467 + fi
468 +
469 + dnl Check whether compiler supports byte bit-fields
470 + AC_CACHE_CHECK([whether compiler supports byte bit-fields],
471 +  ac_cv_have_byte_bitfields, [
472 +  AC_LANG_SAVE
473 +  AC_LANG_CPLUSPLUS
474 +  AC_TRY_RUN([
475 +    struct A {
476 +      unsigned char b1:4;
477 +      unsigned char b2:4;
478 +      unsigned char c;
479 +      unsigned short s;
480 +      unsigned char a[4];
481 +    };
482 +
483 +    int main(void) {
484 +      A a;
485 +      return ! (sizeof(A) == 8 && &a.c == ((unsigned char *)&a + 1));
486 +    }],
487 +    [ac_cv_have_byte_bitfields=yes],
488 +    [ac_cv_have_byte_bitfields=no],
489 +    dnl When cross-compiling, assume only GCC supports this
490 +    [if [[ "$GCC" = "yes" ]]; then
491 +      ac_cv_have_byte_bitfields="guessing yes"
492 +    else
493 +      ac_cv_have_byte_bitfields="guessing no"
494 +    fi]
495 +    )
496 +  AC_LANG_RESTORE
497 + ])
498 +
499   dnl AC_CHECK_FRAMEWORK($1=NAME, $2=INCLUDES)
500 < AC_DEFUN(AC_CHECK_FRAMEWORK, [
500 > AC_DEFUN([AC_CHECK_FRAMEWORK], [
501    AS_VAR_PUSHDEF([ac_Framework], [ac_cv_framework_$1])dnl
502    AC_CACHE_CHECK([whether compiler supports framework $1],
503      ac_Framework, [
504      saved_LIBS="$LIBS"
505      LIBS="$LIBS -framework $1"
506      AC_TRY_LINK(
507 <      [$2], [int main(void) { return 0; }],
507 >      [$2], [],
508        [AS_VAR_SET(ac_Framework, yes)], [AS_VAR_SET(ac_Framework, no); LIBS="$saved_LIBS"]
509      )
510    ])
# Line 417 | Line 517 | AC_DEFUN(AC_CHECK_FRAMEWORK, [
517   dnl Check for some MacOS X frameworks
518   AC_CHECK_FRAMEWORK(Carbon, [#include <Carbon/Carbon.h>])
519   AC_CHECK_FRAMEWORK(IOKit, [#include <IOKit/IOKitLib.h>])
520 + AC_CHECK_FRAMEWORK(CoreFoundation, [#include <CoreFoundation/CoreFoundation.h>])
521  
522   dnl Select system-dependant sources.
523   SERIALSRC=serial_unix.cpp
# Line 427 | Line 528 | EXTFSSRC=extfs_unix.cpp
528   EXTRASYSSRCS=
529   case "$target_os" in
530   linux*)
531 <  ETHERSRC=Linux/ether_linux.cpp
531 >  ETHERSRC=ether_unix.cpp
532    AUDIOSRC=audio_oss_esd.cpp
533    SCSISRC=Linux/scsi_linux.cpp
534    if [[ "x$EMULATED_PPC" = "xno" ]]; then
535 <    EXTRASYSSRCS="Linux/paranoia.cpp Linux/sheepthreads.c ppc_asm.S"
535 >    EXTRASYSSRCS="paranoia.cpp Linux/sheepthreads.c ppc_asm.S"
536    fi
537    ;;
538 + freebsd*)
539 +  ETHERSRC=ether_unix.cpp
540 +  ;;
541   netbsd*)
542 +  ETHERSRC=ether_unix.cpp
543    if [[ "x$EMULATED_PPC" = "xno" ]]; then
544 <    EXTRASYSSRCS="NetBSD/paranoia.cpp NetBSD/sheepthreads.c ppc_asm.S"
544 >    EXTRASYSSRCS="paranoia.cpp NetBSD/sheepthreads.c ppc_asm.S"
545    fi
546    ;;
547   darwin*)
548 +  ETHERSRC=ether_unix.cpp
549    if [[ "x$EMULATED_PPC" = "xno" ]]; then
550 <    EXTRASYSSRCS="Darwin/paranoia.cpp ppc_asm.S"
550 >    EXTRASYSSRCS="paranoia.cpp ppc_asm.S"
551    fi
552 <  if [[ "x$ac_cv_framework_IOKit" = "xyes" ]]; then
552 >  if [[ "x$ac_cv_framework_IOKit" = "xyes" -a "x$ac_cv_framework_CoreFoundation" = "xyes" ]]; then
553      EXTRASYSSRCS="$EXTRASYSSRCS ../MacOSX/sys_darwin.cpp"
554    fi
555    if [[ "x$ac_cv_framework_Carbon" = "xyes" ]]; then
556      EXTFSSRC=../MacOSX/extfs_macosx.mm
557    fi
558    ;;
559 < cygwin*)
560 <  SERIALSRC="../dummy/serial_dummy.cpp"
559 > irix*)
560 >  AUDIOSRC=Irix/audio_irix.cpp
561 >  LIBS="$LIBS -laudio"
562 >  WANT_ESD=no
563 >
564 >  dnl Check if our compiler supports -IPA (MIPSPro)
565 >  HAVE_IPA=no
566 >  ocflags="$CFLAGS"
567 >  CFLAGS=`echo " $CFLAGS -IPA" | sed -e "s/ -g //g"`
568 >  AC_MSG_CHECKING(if "-IPA" works)
569 >  dnl Do a test compile of an empty function
570 >  AC_TRY_COMPILE([#if defined __GNUC__
571 >                  # error GCC does not support IPA yet
572 >                  #endif],, [AC_MSG_RESULT(yes); HAVE_IPA=yes], AC_MSG_RESULT(no))
573 >  CFLAGS="$ocflags"
574    ;;
575   esac
576  
577 + dnl Is the slirp library supported?
578 + case "$ac_cv_have_byte_bitfields" in
579 + yes|"guessing yes")
580 +  CAN_SLIRP=yes
581 +  ETHERSRC=ether_unix.cpp
582 +  ;;
583 + esac
584 + if [[ -n "$CAN_SLIRP" ]]; then
585 +  AC_DEFINE(HAVE_SLIRP, 1, [Define if slirp library is supported])
586 +  SLIRP_SRCS="\
587 +    ../slirp/bootp.c     ../slirp/ip_output.c  ../slirp/tcp_input.c  \
588 +    ../slirp/cksum.c     ../slirp/mbuf.c       ../slirp/tcp_output.c \
589 +    ../slirp/debug.c     ../slirp/misc.c       ../slirp/tcp_subr.c   \
590 +    ../slirp/if.c        ../slirp/sbuf.c       ../slirp/tcp_timer.c  \
591 +    ../slirp/ip_icmp.c   ../slirp/slirp.c      ../slirp/tftp.c       \
592 +    ../slirp/ip_input.c  ../slirp/socket.c     ../slirp/udp.c"
593 + fi
594 + AC_SUBST(SLIRP_SRCS)
595 +
596   dnl SDL overrides
597   if [[ "x$WANT_SDL" = "xyes" ]]; then
598    AC_DEFINE(USE_SDL, 1, [Define to enble SDL support.])
# Line 466 | Line 604 | if [[ "x$WANT_SDL_VIDEO" = "xyes" ]]; th
604    if [[ "x$ac_cv_framework_Carbon" = "xyes" ]]; then
605      EXTRASYSSRCS="$EXTRASYSSRCS ../MacOSX/clip_macosx.cpp"
606    else
607 <    case "$target_os" in
470 <    cygwin*)
471 <      EXTRASYSSRCS="$EXTRASYSSRCS ../Windows/clip_windows.cpp"
472 <      ;;
473 <    *)
474 <      EXTRASYSSRCS="$EXTRASYSSRCS ../dummy/clip_dummy.cpp"
475 <      ;;
476 <    esac
607 >    EXTRASYSSRCS="$EXTRASYSSRCS ../dummy/clip_dummy.cpp"
608    fi
609   else
610    VIDEOSRCS="video_x.cpp"
# Line 492 | Line 623 | dnl to be put into the config.h file
623   dnl $1 -- the macro to define
624   dnl $2 -- the value to translate
625   dnl $3 -- template name
626 < AC_DEFUN(AC_TRANSLATE_DEFINE, [
626 > AC_DEFUN([AC_TRANSLATE_DEFINE], [
627      if [[ "x$2" = "xyes" -o "x$2" = "xguessing yes" ]]; then
628          AC_DEFINE($1, 1, $3)
629      fi
# Line 901 | Line 1032 | fi
1032  
1033   dnl Check addressing mode to use
1034   AC_MSG_CHECKING([for addressing mode to use])
904 case "$os_target" in
905 cygwin*)
906  WANT_ADDRESSING_MODE="direct,cygwin-hack"
907  NATMEM_OFFSET=
908  ;;
909 esac
1035   if [[ "$EMULATED_PPC" != "yes" ]]; then
1036    if [[ "$WANT_ADDRESSING_MODE" != "real" ]]; then
1037      AC_MSG_WARN([Running in native PowerPC mode, force use of Real Addressing.])
# Line 988 | Line 1113 | EOF
1113   fi
1114   AC_MSG_RESULT($WANT_ADDRESSING_MODE)
1115  
1116 + dnl Utility macro used by next two tests.
1117 + dnl AC_EXAMINE_OBJECT(C source code,
1118 + dnl     commands examining object file,
1119 + dnl     [commands to run if compile failed]):
1120 + dnl
1121 + dnl Compile the source code to an object file; then convert it into a
1122 + dnl printable representation.  All unprintable characters and
1123 + dnl asterisks (*) are replaced by dots (.).  All white space is
1124 + dnl deleted.  Newlines (ASCII 0x10) in the input are preserved in the
1125 + dnl output, but runs of newlines are compressed to a single newline.
1126 + dnl Finally, line breaks are forcibly inserted so that no line is
1127 + dnl longer than 80 columns and the file ends with a newline.  The
1128 + dnl result of all this processing is in the file conftest.dmp, which
1129 + dnl may be examined by the commands in the second argument.
1130 + dnl
1131 + AC_DEFUN([gcc_AC_EXAMINE_OBJECT],
1132 + [AC_LANG_SAVE
1133 + AC_LANG_C
1134 + dnl Next bit cribbed from AC_TRY_COMPILE.
1135 + cat > conftest.$ac_ext <<EOF
1136 + [#line __oline__ "configure"
1137 + #include "confdefs.h"
1138 + $1
1139 + ]EOF
1140 + if AC_TRY_EVAL(ac_compile); then
1141 +  od -c conftest.o |
1142 +    sed ['s/^[0-7]*[    ]*/ /
1143 +          s/\*/./g
1144 +          s/ \\n/*/g
1145 +          s/ [0-9][0-9][0-9]/./g
1146 +          s/  \\[^ ]/./g'] |
1147 +    tr -d '
1148 + ' | tr -s '*' '
1149 + ' | fold | sed '$a\
1150 + ' > conftest.dmp
1151 +  $2
1152 + ifelse($3, , , else
1153 +  $3
1154 + )dnl
1155 + fi
1156 + rm -rf conftest*
1157 + AC_LANG_RESTORE])
1158 +
1159 + dnl Floating point format probe.
1160 + dnl The basic concept is the same as the above: grep the object
1161 + dnl file for an interesting string.  We have to watch out for
1162 + dnl rounding changing the values in the object, however; this is
1163 + dnl handled by ignoring the least significant byte of the float.
1164 + dnl
1165 + dnl Does not know about VAX G-float or C4x idiosyncratic format.
1166 + dnl It does know about PDP-10 idiosyncratic format, but this is
1167 + dnl not presently supported by GCC.  S/390 "binary floating point"
1168 + dnl is in fact IEEE (but maybe we should have that in EBCDIC as well
1169 + dnl as ASCII?)
1170 + dnl
1171 + AC_DEFUN([gcc_AC_C_FLOAT_FORMAT],
1172 + [AC_CACHE_CHECK(floating point format, ac_cv_c_float_format,
1173 + [gcc_AC_EXAMINE_OBJECT(
1174 + [/* This will not work unless sizeof(double) == 8.  */
1175 + extern char sizeof_double_must_be_8 [sizeof(double) == 8 ? 1 : -1];
1176 +
1177 + /* This structure must have no internal padding.  */
1178 + struct possibility {
1179 +  char prefix[8];
1180 +  double candidate;
1181 +  char postfix[8];
1182 + };
1183 +
1184 + #define C(cand) { "\nformat:", cand, ":tamrof\n" }
1185 + struct possibility table [] =
1186 + {
1187 +  C( 3.25724264705901305206e+01), /* @@IEEEFP - IEEE 754 */
1188 +  C( 3.53802595280598432000e+18), /* D__float - VAX */
1189 +  C( 5.32201830133125317057e-19), /* D.PDP-10 - PDP-10 - the dot is 0x13a */
1190 +  C( 1.77977764695171661377e+10), /* IBMHEXFP - s/390 format, ascii */
1191 +  C(-5.22995989424860458374e+10)  /* IBMHEXFP - s/390 format, EBCDIC */
1192 + };],
1193 + [if   grep 'format:.@IEEEF.:tamrof' conftest.dmp >/dev/null 2>&1; then
1194 +    ac_cv_c_float_format='IEEE (big-endian)'
1195 +  elif grep 'format:.I@@PFE.:tamrof' conftest.dmp >/dev/null 2>&1; then
1196 +    ac_cv_c_float_format='IEEE (big-endian)'
1197 +  elif grep 'format:.FEEEI@.:tamrof' conftest.dmp >/dev/null 2>&1; then
1198 +    ac_cv_c_float_format='IEEE (little-endian)'
1199 +  elif grep 'format:.EFP@@I.:tamrof' conftest.dmp >/dev/null 2>&1; then
1200 +    ac_cv_c_float_format='IEEE (little-endian)'
1201 +  elif grep 'format:.__floa.:tamrof' conftest.dmp >/dev/null 2>&1; then
1202 +    ac_cv_c_float_format='VAX D-float'
1203 +  elif grep 'format:..PDP-1.:tamrof' conftest.dmp >/dev/null 2>&1; then
1204 +    ac_cv_c_float_format='PDP-10'
1205 +  elif grep 'format:.BMHEXF.:tamrof' conftest.dmp >/dev/null 2>&1; then
1206 +    ac_cv_c_float_format='IBM 370 hex'
1207 +  else
1208 +    AC_MSG_ERROR(Unknown floating point format)
1209 +  fi],
1210 +  [AC_MSG_ERROR(compile failed)])
1211 + ])
1212 + # IEEE is the default format.  If the float endianness isn't the same
1213 + # as the integer endianness, we have to set FLOAT_WORDS_BIG_ENDIAN
1214 + # (which is a tristate: yes, no, default).  This is only an issue with
1215 + # IEEE; the other formats are only supported by a few machines each,
1216 + # all with the same endianness.
1217 + format=IEEE_FLOAT_FORMAT
1218 + fbigend=
1219 + case $ac_cv_c_float_format in
1220 +    'IEEE (big-endian)' )
1221 +        if test $ac_cv_c_bigendian = no; then
1222 +            fbigend=1
1223 +        fi
1224 +        ;;
1225 +    'IEEE (little-endian)' )
1226 +        if test $ac_cv_c_bigendian = yes; then
1227 +            fbigend=0
1228 +        fi
1229 +        ;;
1230 +    'VAX D-float' )
1231 +        format=VAX_FLOAT_FORMAT
1232 +        ;;
1233 +    'PDP-10' )
1234 +        format=PDP10_FLOAT_FORMAT
1235 +        ;;
1236 +    'IBM 370 hex' )
1237 +        format=IBM_FLOAT_FORMAT
1238 +        ;;
1239 + esac
1240 + AC_DEFINE_UNQUOTED(HOST_FLOAT_FORMAT, $format,
1241 +  [Define to the floating point format of the host machine.])
1242 + if test -n "$fbigend"; then
1243 +        AC_DEFINE_UNQUOTED(HOST_FLOAT_WORDS_BIG_ENDIAN, $fbigend,
1244 +  [Define to 1 if the host machine stores floating point numbers in
1245 +   memory with the word containing the sign bit at the lowest address,
1246 +   or to 0 if it does it the other way around.
1247 +
1248 +   This macro should not be defined if the ordering is the same as for
1249 +   multi-word integers.])
1250 + fi
1251 + ])
1252 +
1253 + dnl Check for host float format
1254 + gcc_AC_C_FLOAT_FORMAT
1255 +
1256   dnl Platform specific binary postprocessor
1257   AC_PATH_PROG(BLESS, "true")
1258   if [[ "x$ac_cv_pagezero_hack" = "xyes" ]]; then
# Line 998 | Line 1263 | fi
1263   dnl Check for GCC 2.7 or higher.
1264   HAVE_GCC27=no
1265   AC_MSG_CHECKING(for GCC 2.7 or higher)
1266 < AC_EGREP_CPP(xyes,
1267 < [#if __GNUC__ - 1 > 1 || __GNUC_MINOR__ - 1 > 5
1268 <  xyes
1269 < #endif
1270 < ], [AC_MSG_RESULT(yes); HAVE_GCC27=yes], AC_MSG_RESULT(no))
1266 > AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#if ! (__GNUC__ - 1 > 1 || __GNUC_MINOR__ - 1 > 5)
1267 >                                     # error gcc < 2.7
1268 >                                     typedef syntax error;
1269 >                                     #endif
1270 >                                   ]])],
1271 >                  [AC_MSG_RESULT(yes); HAVE_GCC27=yes],
1272 >                  [AC_MSG_RESULT(no)])
1273  
1274   dnl Check for GCC 3.0 or higher.
1275   HAVE_GCC30=no
1276   AC_MSG_CHECKING(for GCC 3.0 or higher)
1277 < AC_EGREP_CPP(xyes,
1278 < [#if __GNUC__ >= 3
1279 <  xyes
1280 < #endif
1281 < ], [AC_MSG_RESULT(yes); HAVE_GCC30=yes], AC_MSG_RESULT(no))
1277 > AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#if ! (__GNUC__ >= 3)
1278 >                                     # error gcc < 3
1279 >                                     typedef syntax error;
1280 >                                     #endif
1281 >                                   ]])],
1282 >                  [AC_MSG_RESULT(yes); HAVE_GCC30=yes],
1283 >                  [AC_MSG_RESULT(no)])
1284  
1285   dnl Check for ICC.
1286   AC_MSG_CHECKING(for ICC)
# Line 1022 | Line 1291 | fi
1291   AC_MSG_RESULT($HAVE_ICC)
1292  
1293   dnl Determine the generated object format
1294 < AC_CACHE_CHECK([whether the compiler can generate ELF objects],
1294 > AC_CACHE_CHECK([the format of compiler generated objects],
1295    ac_cv_object_format, [
1296    echo 'int i;' > conftest.$ac_ext
1297    ac_cv_object_format=no
# Line 1031 | Line 1300 | AC_CACHE_CHECK([whether the compiler can
1300      *"ELF"*)
1301        ac_cv_object_format=elf
1302        ;;
1303 +    *"Mach-O"*)
1304 +      ac_cv_object_format=mach
1305 +      ;;
1306      *)
1307        ac_cv_object_format=unknown
1308        ;;
# Line 1039 | Line 1311 | AC_CACHE_CHECK([whether the compiler can
1311    rm -rf conftest*
1312   ])
1313  
1314 + dnl Add -fno-strict-aliasing for slirp sources
1315 + if [[ "x$HAVE_GCC30" = "xyes" ]]; then
1316 +  SAVED_CFLAGS="$CFLAGS"
1317 +  CFLAGS="$CFLAGS -fno-strict-aliasing"
1318 +  AC_CACHE_CHECK([whether the compiler supports -fno-strict-aliasing],
1319 +    ac_cv_gcc_no_strict_aliasing, [
1320 +    AC_TRY_COMPILE([],[],
1321 +      [ac_cv_gcc_no_strict_aliasing=yes; AC_SUBST(SLIRP_CFLAGS, "-fno-strict-aliasing")],
1322 +      [ac_cv_gcc_no_strict_aliasing=no])
1323 +  ])
1324 +  CFLAGS="$SAVED_CFLAGS"
1325 + fi
1326 +
1327 + dnl Add -mdynamic-no-pic for MacOS X (XXX icc10 will support MacOS X)
1328 + if [[ "x$HAVE_GCC30" = "xyes" -a "x$HAVE_ICC" = "xno" ]]; then
1329 +  SAVED_CFLAGS="$CFLAGS"
1330 +  CFLAGS="$CFLAGS -mdynamic-no-pic"
1331 +  AC_CACHE_CHECK([whether the compiler supports -mdynamic-no-pic],
1332 +    ac_cv_gcc_mdynamic_no_pic, [
1333 +    AC_TRY_COMPILE([],[],[ac_cv_gcc_mdynamic_no_pic=yes],[ac_cv_gcc_mdynamic_no_pic=no])
1334 +  ])
1335 +  if [[ "x$ac_cv_gcc_mdynamic_no_pic" = "xyes" ]]; then
1336 +    CXXFLAGS="$CXXFLAGS -mdynamic-no-pic"
1337 +  else
1338 +    CFLAGS="$SAVED_CFLAGS"
1339 +  fi
1340 + fi
1341 +
1342   dnl CPU emulator sources
1343   if [[ "x$EMULATED_PPC" = "xyes" ]]; then
1344    CPUSRCS="\
1345      ../kpx_cpu/src/mathlib/ieeefp.cpp \
1346 +    ../kpx_cpu/src/mathlib/mathlib.cpp \
1347      ../kpx_cpu/src/cpu/ppc/ppc-cpu.cpp \
1348      ../kpx_cpu/src/cpu/ppc/ppc-decode.cpp \
1349      ../kpx_cpu/src/cpu/ppc/ppc-execute.cpp \
# Line 1063 | Line 1364 | if [[ "x$EMULATED_PPC" = "xyes" ]]; then
1364        i?86:elf)
1365          ac_cv_use_dyngen=yes
1366          ;;
1367 +      mips:elf)
1368 +        ac_cv_use_dyngen=yes
1369 +        ;;
1370 +      powerpc:mach)
1371 +        ac_cv_use_dyngen=yes
1372 +        ;;
1373 +      i?86:mach)
1374 +        ac_cv_use_dyngen=yes
1375 +        ;;
1376        *:*)
1377          ac_cv_use_dyngen=no
1378          ;;
# Line 1072 | Line 1382 | if [[ "x$EMULATED_PPC" = "xyes" ]]; then
1382          if [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_ICC" = "xno" ]]; then
1383            DYNGEN_CC=$CXX
1384          else
1385 <          for p in /usr/bin /usr/local/bin; do
1385 >          for p in /usr/bin /usr/local/bin /usr/freeware/bin; do
1386              gxx="$p/g++"
1387              if [[ -x "$gxx" ]]; then
1388                DYNGEN_CC="$gxx"
# Line 1080 | Line 1390 | if [[ "x$EMULATED_PPC" = "xyes" ]]; then
1390            done
1391          fi
1392        fi
1393 <      if [[ -z "$DYNGEN_CC" ]] || ! { echo '#include <limits>' | $DYNGEN_CC -xc++ -c -o /dev/null - >& /dev/null; }; then
1393 >      if [[ -z "$DYNGEN_CC" ]]; then
1394          ac_cv_use_dyngen=no
1395        fi
1396      ])
1397      if [[ "x$ac_cv_use_dyngen" = "xyes" ]]; then
1398        case $host_cpu in
1399        i?86)
1400 <        DYNGEN_OP_FLAGS="-fomit-frame-pointer -mpreferred-stack-boundary=2"
1401 <        if [[ "x$HAVE_GCC30" = "xyes" ]]; then
1402 <          DYNGEN_OP_FLAGS="$DYNGEN_OP_FLAGS -falign-functions=0"
1403 <        else
1404 <          DYNGEN_OP_FLAGS="$DYNGEN_OP_FLAGS -malign-functions=0"
1400 >        DYNGEN_OP_FLAGS="-fomit-frame-pointer"
1401 >        ;;
1402 >      mips)
1403 >        DYNGEN_OP_FLAGS="-fno-delayed-branch -mno-abicalls"
1404 >        ;;
1405 >      powerpc)
1406 >        if [[ "x$ac_cv_object_format" = "xmach" ]]; then
1407 >          DYNGEN_OP_FLAGS="-mdynamic-no-pic"
1408          fi
1409          ;;
1410        esac
1411 <      DYNGEN_OP_FLAGS="$DYNGEN_OP_FLAGS -finline-limit=10000 -g0"
1412 <      if [[ "x$HAVE_GCC30" = "xyes" ]]; then
1411 >      have_dyngen_gcc3=no
1412 >      case "x`$DYNGEN_CC -dumpversion`" in
1413 >      x[12].*) ;;
1414 >      x*) have_dyngen_gcc3=yes ;;
1415 >      esac
1416 >      if [[ "x$have_dyngen_gcc3" = "xyes" ]]; then
1417 >        DYNGEN_OP_FLAGS="$DYNGEN_OP_FLAGS -fno-align-functions"
1418 >      else
1419 >        DYNGEN_OP_FLAGS="$DYNGEN_OP_FLAGS -malign-functions=0"
1420 >      fi
1421 >      DYNGEN_OP_FLAGS="$DYNGEN_OP_FLAGS -finline-functions -finline-limit=10000 -fno-exceptions -g0"
1422 >      if [[ "x$have_dyngen_gcc3" = "xyes" ]]; then
1423          DYNGEN_OP_FLAGS="$DYNGEN_OP_FLAGS -fno-reorder-blocks -fno-optimize-sibling-calls"
1424        fi
1425 +      if [[ "x$DYNGEN_CC" != "x$CXX" ]]; then
1426 +        DYNGEN_CFLAGS="-O2 $CFLAGS"
1427 +        DYNGEN_CXXFLAGS="-O2 $CXXFLAGS"
1428 +      else
1429 +        DYNGEN_CFLAGS="\$(CFLAGS)"
1430 +        DYNGEN_CXXFLAGS="\$(CXXFLAGS)"
1431 +      fi
1432      else
1433        WANT_JIT=no
1434      fi
# Line 1121 | Line 1451 | if [[ "x$ac_cv_use_dyngen" = "xyes" ]];
1451    AC_CACHE_CHECK([whether static data regions are executable],
1452      ac_cv_have_static_data_exec, [
1453      AC_TRY_RUN([int main(void) {
1454 < #if defined(__powerpc__)
1454 > #if defined(__powerpc__) || defined(__ppc__)
1455        static unsigned int p[8] = {0x4e800020,};
1456        asm volatile("dcbst 0,%0" : : "r" (p) : "memory");
1457        asm volatile("sync" : : : "memory");
# Line 1147 | Line 1477 | if [[ "x$WANT_JIT" = "xyes" ]]; then
1477    CPPFLAGS="$CPPFLAGS -DUSE_JIT"
1478   fi
1479  
1480 + dnl Higher level optimizations with MIPSPro compilers are possible
1481 + if [[ "x$HAVE_IPA" = "xyes" ]]; then
1482 +  CFLAGS="`echo $CFLAGS | sed -e 's/-g//g'` -O3 -OPT:Olimit=0 -IPA"
1483 +  CXXFLAGS="`echo $CXXFLAGS | sed -e 's/-g//g'` -O3 -OPT:Olimit=0 -IPA"
1484 +  CXXFLAGS="-LANG:std $CXXFLAGS"
1485 +  LDFLAGS="$LDFLAGS -O3 -OPT:Olimit=0 -IPA"
1486 + fi
1487 +
1488 + dnl Check for linker script support
1489 + case $target_os:$target_cpu in
1490 + linux*:i?86)    LINKER_SCRIPT_FLAGS="-Wl,-T,ldscripts/linux-i386.ld";;
1491 + linux*:x86_64)  LINKER_SCRIPT_FLAGS="-Wl,-T,ldscripts/linux-x86_64.ld";;
1492 + linux*:powerpc) LINKER_SCRIPT_FLAGS="-Wl,-T,ldscripts/linux-ppc.ld";;
1493 + netbsd*:i?86)   LINKER_SCRIPT_FLAGS="-Wl,-T,ldscripts/linux-i386.ld";;
1494 + freebsd*:i?86)  LINKER_SCRIPT_FLAGS="-Wl,-T,ldscripts/freebsd-i386.ld";;
1495 + darwin*:*)      LINKER_SCRIPT_FLAGS="-Wl,-seg1addr,0x78048000";;
1496 + esac
1497 + if [[ -n "$LINKER_SCRIPT_FLAGS" ]]; then
1498 +  AC_CACHE_CHECK([whether linker script is usable],
1499 +    ac_cv_linker_script_works, [
1500 +    AC_LANG_SAVE
1501 +    AC_LANG_CPLUSPLUS
1502 +    saved_LDFLAGS="$LDFLAGS"
1503 +    LDFLAGS="$LDFLAGS $LINKER_SCRIPT_FLAGS"
1504 +    AC_TRY_RUN(
1505 +      [int main() {if ((char *)&main < (char *)0x70000000) return 1;}],
1506 +      [ac_cv_linker_script_works=yes],
1507 +      [ac_cv_linker_script_works=no],
1508 +      dnl When cross-compiling, assume it works
1509 +      [ac_cv_linker_script_works="guessing yes"]
1510 +    )
1511 +    AC_LANG_RESTORE
1512 +    if [[ "$ac_cv_linker_script_works" = "no" ]]; then
1513 +      LDFLAGS="$saved_LDFLAGS"
1514 +      LINKER_SCRIPT_FLAGS=""
1515 +    fi
1516 +  ])
1517 + fi
1518 + AC_TRANSLATE_DEFINE(HAVE_LINKER_SCRIPT, "$ac_cv_linker_script_works",
1519 +  [Define if there is a linker script to relocate the executable above 0x70000000.])
1520 +
1521   dnl Generate Makefile.
1522   AC_SUBST(PERL)
1523   AC_SUBST(USE_DYNGEN, [$ac_cv_use_dyngen])
1524   AC_SUBST(DYNGENSRCS)
1525   AC_SUBST(DYNGEN_CC)
1526 + AC_SUBST(DYNGEN_CFLAGS)
1527 + AC_SUBST(DYNGEN_CXXFLAGS)
1528   AC_SUBST(DYNGEN_OP_FLAGS)
1529   AC_SUBST(SYSSRCS)
1530   AC_SUBST(CPUSRCS)
# Line 1167 | Line 1540 | echo
1540   echo SheepShaver configuration summary:
1541   echo
1542   echo SDL support ...................... : $SDL_SUPPORT
1543 + echo FBDev DGA support ................ : $WANT_FBDEV_DGA
1544   echo XFree86 DGA support .............. : $WANT_XF86_DGA
1545   echo XFree86 VidMode support .......... : $WANT_XF86_VIDMODE
1546   echo Using PowerPC emulator ........... : $EMULATED_PPC

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines