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.24 by gbeauche, 2005-06-14T06:32:52Z vs.
Revision 1.46 by gbeauche, 2006-01-22T00:08:32Z

# 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])
# Line 118 | 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 135 | 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 <      ;;
144 <    *)
145 <      sdl_cflags=`$sdl_config --cflags`
146 <      if [[ "x$WANT_SDL_STATIC" = "xyes" ]]; then
147 <        sdl_libs=`$sdl_config --static-libs`
148 <      else
149 <        sdl_libs=`$sdl_config --libs`
150 <      fi
151 <      ;;
152 <    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"
# Line 185 | Line 184 | no:linux*|no:netbsd*)
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)
196  if [[ "x$HAVE_PTHREADS" = "xyes" ]]; then
197    AC_DEFINE(HAVE_PTHREADS, 1, [Define if pthreads are available.])
198  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 205 | Line 204 | no:linux*|no:netbsd*)
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
# Line 295 | 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)
300 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 325 | 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 341 | 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)
373 < AC_CHECK_FUNCS(posix_memalign memalign valloc)
374 < AC_CHECK_FUNCS(exp2f log2f exp2 log2 trunc)
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 415 | Line 440 | AC_DEFUN(AC_CHECK_FRAMEWORK, [
440      saved_LIBS="$LIBS"
441      LIBS="$LIBS -framework $1"
442      AC_TRY_LINK(
443 <      [$2], [int main(void) { return 0; }],
443 >      [$2], [],
444        [AS_VAR_SET(ac_Framework, yes)], [AS_VAR_SET(ac_Framework, no); LIBS="$saved_LIBS"]
445      )
446    ])
# Line 428 | Line 453 | AC_DEFUN(AC_CHECK_FRAMEWORK, [
453   dnl Check for some MacOS X frameworks
454   AC_CHECK_FRAMEWORK(Carbon, [#include <Carbon/Carbon.h>])
455   AC_CHECK_FRAMEWORK(IOKit, [#include <IOKit/IOKitLib.h>])
456 + AC_CHECK_FRAMEWORK(CoreFoundation, [#include <CoreFoundation/CoreFoundation.h>])
457  
458   dnl Select system-dependant sources.
459   SERIALSRC=serial_unix.cpp
# Line 438 | Line 464 | EXTFSSRC=extfs_unix.cpp
464   EXTRASYSSRCS=
465   case "$target_os" in
466   linux*)
467 <  ETHERSRC=Linux/ether_linux.cpp
467 >  ETHERSRC=ether_unix.cpp
468    AUDIOSRC=audio_oss_esd.cpp
469    SCSISRC=Linux/scsi_linux.cpp
470    if [[ "x$EMULATED_PPC" = "xno" ]]; then
471 <    EXTRASYSSRCS="Linux/paranoia.cpp Linux/sheepthreads.c ppc_asm.S"
471 >    EXTRASYSSRCS="paranoia.cpp Linux/sheepthreads.c ppc_asm.S"
472    fi
473    ;;
474 + freebsd*)
475 +  ETHERSRC=ether_unix.cpp
476 +  ;;
477   netbsd*)
478 +  ETHERSRC=ether_unix.cpp
479    if [[ "x$EMULATED_PPC" = "xno" ]]; then
480 <    EXTRASYSSRCS="NetBSD/paranoia.cpp NetBSD/sheepthreads.c ppc_asm.S"
480 >    EXTRASYSSRCS="paranoia.cpp NetBSD/sheepthreads.c ppc_asm.S"
481    fi
482    ;;
483   darwin*)
484 +  ETHERSRC=ether_unix.cpp
485    if [[ "x$EMULATED_PPC" = "xno" ]]; then
486 <    EXTRASYSSRCS="Darwin/paranoia.cpp ppc_asm.S"
486 >    EXTRASYSSRCS="paranoia.cpp ppc_asm.S"
487    fi
488 <  if [[ "x$ac_cv_framework_IOKit" = "xyes" ]]; then
488 >  if [[ "x$ac_cv_framework_IOKit" = "xyes" -a "x$ac_cv_framework_CoreFoundation" = "xyes" ]]; then
489      EXTRASYSSRCS="$EXTRASYSSRCS ../MacOSX/sys_darwin.cpp"
490    fi
491    if [[ "x$ac_cv_framework_Carbon" = "xyes" ]]; then
492      EXTFSSRC=../MacOSX/extfs_macosx.mm
493    fi
494    ;;
495 < cygwin*)
496 <  SERIALSRC="../dummy/serial_dummy.cpp"
495 > irix*)
496 >  ETHERSRC=ether_unix.cpp
497 >  AUDIOSRC=Irix/audio_irix.cpp
498 >  LIBS="$LIBS -laudio"
499 >  WANT_ESD=no
500 >
501 >  dnl Check if our compiler supports -IPA (MIPSPro)
502 >  HAVE_IPA=no
503 >  ocflags="$CFLAGS"
504 >  CFLAGS=`echo " $CFLAGS -IPA" | sed -e "s/ -g //g"`
505 >  AC_MSG_CHECKING(if "-IPA" works)
506 >  dnl Do a test compile of an empty function
507 >  AC_TRY_COMPILE([#if defined __GNUC__
508 >                  # error GCC does not support IPA yet
509 >                  #endif],, [AC_MSG_RESULT(yes); HAVE_IPA=yes], AC_MSG_RESULT(no))
510 >  CFLAGS="$ocflags"
511    ;;
512   esac
513  
514 + dnl Is the slirp library supported?
515 + if [[ "x$ETHERSRC" = "xether_unix.cpp" ]]; then
516 +  AC_DEFINE(HAVE_SLIRP, 1, [Define if slirp library is supported])
517 +  SLIRP_SRCS="\
518 +    ../slirp/bootp.c     ../slirp/ip_output.c  ../slirp/tcp_input.c  \
519 +    ../slirp/cksum.c     ../slirp/mbuf.c       ../slirp/tcp_output.c \
520 +    ../slirp/debug.c     ../slirp/misc.c       ../slirp/tcp_subr.c   \
521 +    ../slirp/if.c        ../slirp/sbuf.c       ../slirp/tcp_timer.c  \
522 +    ../slirp/ip_icmp.c   ../slirp/slirp.c      ../slirp/tftp.c       \
523 +    ../slirp/ip_input.c  ../slirp/socket.c     ../slirp/udp.c"
524 + fi
525 + AC_SUBST(SLIRP_SRCS)
526 +
527   dnl SDL overrides
528   if [[ "x$WANT_SDL" = "xyes" ]]; then
529    AC_DEFINE(USE_SDL, 1, [Define to enble SDL support.])
# Line 477 | Line 535 | if [[ "x$WANT_SDL_VIDEO" = "xyes" ]]; th
535    if [[ "x$ac_cv_framework_Carbon" = "xyes" ]]; then
536      EXTRASYSSRCS="$EXTRASYSSRCS ../MacOSX/clip_macosx.cpp"
537    else
538 <    case "$target_os" in
481 <    cygwin*)
482 <      EXTRASYSSRCS="$EXTRASYSSRCS ../Windows/clip_windows.cpp"
483 <      ;;
484 <    *)
485 <      EXTRASYSSRCS="$EXTRASYSSRCS ../dummy/clip_dummy.cpp"
486 <      ;;
487 <    esac
538 >    EXTRASYSSRCS="$EXTRASYSSRCS ../dummy/clip_dummy.cpp"
539    fi
540   else
541    VIDEOSRCS="video_x.cpp"
# Line 912 | Line 963 | fi
963  
964   dnl Check addressing mode to use
965   AC_MSG_CHECKING([for addressing mode to use])
915 case "$os_target" in
916 cygwin*)
917  WANT_ADDRESSING_MODE="direct,cygwin-hack"
918  NATMEM_OFFSET=
919  ;;
920 esac
966   if [[ "$EMULATED_PPC" != "yes" ]]; then
967    if [[ "$WANT_ADDRESSING_MODE" != "real" ]]; then
968      AC_MSG_WARN([Running in native PowerPC mode, force use of Real Addressing.])
# Line 999 | Line 1044 | EOF
1044   fi
1045   AC_MSG_RESULT($WANT_ADDRESSING_MODE)
1046  
1047 + dnl Utility macro used by next two tests.
1048 + dnl AC_EXAMINE_OBJECT(C source code,
1049 + dnl     commands examining object file,
1050 + dnl     [commands to run if compile failed]):
1051 + dnl
1052 + dnl Compile the source code to an object file; then convert it into a
1053 + dnl printable representation.  All unprintable characters and
1054 + dnl asterisks (*) are replaced by dots (.).  All white space is
1055 + dnl deleted.  Newlines (ASCII 0x10) in the input are preserved in the
1056 + dnl output, but runs of newlines are compressed to a single newline.
1057 + dnl Finally, line breaks are forcibly inserted so that no line is
1058 + dnl longer than 80 columns and the file ends with a newline.  The
1059 + dnl result of all this processing is in the file conftest.dmp, which
1060 + dnl may be examined by the commands in the second argument.
1061 + dnl
1062 + AC_DEFUN([gcc_AC_EXAMINE_OBJECT],
1063 + [AC_LANG_SAVE
1064 + AC_LANG_C
1065 + dnl Next bit cribbed from AC_TRY_COMPILE.
1066 + cat > conftest.$ac_ext <<EOF
1067 + [#line __oline__ "configure"
1068 + #include "confdefs.h"
1069 + $1
1070 + ]EOF
1071 + if AC_TRY_EVAL(ac_compile); then
1072 +  od -c conftest.o |
1073 +    sed ['s/^[0-7]*[    ]*/ /
1074 +          s/\*/./g
1075 +          s/ \\n/*/g
1076 +          s/ [0-9][0-9][0-9]/./g
1077 +          s/  \\[^ ]/./g'] |
1078 +    tr -d '
1079 + ' | tr -s '*' '
1080 + ' | fold | sed '$a\
1081 + ' > conftest.dmp
1082 +  $2
1083 + ifelse($3, , , else
1084 +  $3
1085 + )dnl
1086 + fi
1087 + rm -rf conftest*
1088 + AC_LANG_RESTORE])
1089 +
1090 + dnl Floating point format probe.
1091 + dnl The basic concept is the same as the above: grep the object
1092 + dnl file for an interesting string.  We have to watch out for
1093 + dnl rounding changing the values in the object, however; this is
1094 + dnl handled by ignoring the least significant byte of the float.
1095 + dnl
1096 + dnl Does not know about VAX G-float or C4x idiosyncratic format.
1097 + dnl It does know about PDP-10 idiosyncratic format, but this is
1098 + dnl not presently supported by GCC.  S/390 "binary floating point"
1099 + dnl is in fact IEEE (but maybe we should have that in EBCDIC as well
1100 + dnl as ASCII?)
1101 + dnl
1102 + AC_DEFUN([gcc_AC_C_FLOAT_FORMAT],
1103 + [AC_CACHE_CHECK(floating point format, ac_cv_c_float_format,
1104 + [gcc_AC_EXAMINE_OBJECT(
1105 + [/* This will not work unless sizeof(double) == 8.  */
1106 + extern char sizeof_double_must_be_8 [sizeof(double) == 8 ? 1 : -1];
1107 +
1108 + /* This structure must have no internal padding.  */
1109 + struct possibility {
1110 +  char prefix[8];
1111 +  double candidate;
1112 +  char postfix[8];
1113 + };
1114 +
1115 + #define C(cand) { "\nformat:", cand, ":tamrof\n" }
1116 + struct possibility table [] =
1117 + {
1118 +  C( 3.25724264705901305206e+01), /* @@IEEEFP - IEEE 754 */
1119 +  C( 3.53802595280598432000e+18), /* D__float - VAX */
1120 +  C( 5.32201830133125317057e-19), /* D.PDP-10 - PDP-10 - the dot is 0x13a */
1121 +  C( 1.77977764695171661377e+10), /* IBMHEXFP - s/390 format, ascii */
1122 +  C(-5.22995989424860458374e+10)  /* IBMHEXFP - s/390 format, EBCDIC */
1123 + };],
1124 + [if   grep 'format:.@IEEEF.:tamrof' conftest.dmp >/dev/null 2>&1; then
1125 +    ac_cv_c_float_format='IEEE (big-endian)'
1126 +  elif grep 'format:.I@@PFE.:tamrof' conftest.dmp >/dev/null 2>&1; then
1127 +    ac_cv_c_float_format='IEEE (big-endian)'
1128 +  elif grep 'format:.FEEEI@.:tamrof' conftest.dmp >/dev/null 2>&1; then
1129 +    ac_cv_c_float_format='IEEE (little-endian)'
1130 +  elif grep 'format:.EFP@@I.:tamrof' conftest.dmp >/dev/null 2>&1; then
1131 +    ac_cv_c_float_format='IEEE (little-endian)'
1132 +  elif grep 'format:.__floa.:tamrof' conftest.dmp >/dev/null 2>&1; then
1133 +    ac_cv_c_float_format='VAX D-float'
1134 +  elif grep 'format:..PDP-1.:tamrof' conftest.dmp >/dev/null 2>&1; then
1135 +    ac_cv_c_float_format='PDP-10'
1136 +  elif grep 'format:.BMHEXF.:tamrof' conftest.dmp >/dev/null 2>&1; then
1137 +    ac_cv_c_float_format='IBM 370 hex'
1138 +  else
1139 +    AC_MSG_ERROR(Unknown floating point format)
1140 +  fi],
1141 +  [AC_MSG_ERROR(compile failed)])
1142 + ])
1143 + # IEEE is the default format.  If the float endianness isn't the same
1144 + # as the integer endianness, we have to set FLOAT_WORDS_BIG_ENDIAN
1145 + # (which is a tristate: yes, no, default).  This is only an issue with
1146 + # IEEE; the other formats are only supported by a few machines each,
1147 + # all with the same endianness.
1148 + format=IEEE_FLOAT_FORMAT
1149 + fbigend=
1150 + case $ac_cv_c_float_format in
1151 +    'IEEE (big-endian)' )
1152 +        if test $ac_cv_c_bigendian = no; then
1153 +            fbigend=1
1154 +        fi
1155 +        ;;
1156 +    'IEEE (little-endian)' )
1157 +        if test $ac_cv_c_bigendian = yes; then
1158 +            fbigend=0
1159 +        fi
1160 +        ;;
1161 +    'VAX D-float' )
1162 +        format=VAX_FLOAT_FORMAT
1163 +        ;;
1164 +    'PDP-10' )
1165 +        format=PDP10_FLOAT_FORMAT
1166 +        ;;
1167 +    'IBM 370 hex' )
1168 +        format=IBM_FLOAT_FORMAT
1169 +        ;;
1170 + esac
1171 + AC_DEFINE_UNQUOTED(HOST_FLOAT_FORMAT, $format,
1172 +  [Define to the floating point format of the host machine.])
1173 + if test -n "$fbigend"; then
1174 +        AC_DEFINE_UNQUOTED(HOST_FLOAT_WORDS_BIG_ENDIAN, $fbigend,
1175 +  [Define to 1 if the host machine stores floating point numbers in
1176 +   memory with the word containing the sign bit at the lowest address,
1177 +   or to 0 if it does it the other way around.
1178 +
1179 +   This macro should not be defined if the ordering is the same as for
1180 +   multi-word integers.])
1181 + fi
1182 + ])
1183 +
1184 + dnl Check for host float format
1185 + gcc_AC_C_FLOAT_FORMAT
1186 +
1187   dnl Platform specific binary postprocessor
1188   AC_PATH_PROG(BLESS, "true")
1189   if [[ "x$ac_cv_pagezero_hack" = "xyes" ]]; then
# Line 1009 | Line 1194 | fi
1194   dnl Check for GCC 2.7 or higher.
1195   HAVE_GCC27=no
1196   AC_MSG_CHECKING(for GCC 2.7 or higher)
1197 < AC_EGREP_CPP(xyes,
1198 < [#if __GNUC__ - 1 > 1 || __GNUC_MINOR__ - 1 > 5
1199 <  xyes
1200 < #endif
1201 < ], [AC_MSG_RESULT(yes); HAVE_GCC27=yes], AC_MSG_RESULT(no))
1197 > AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#if ! (__GNUC__ - 1 > 1 || __GNUC_MINOR__ - 1 > 5)
1198 >                                     # error gcc < 2.7
1199 >                                     typedef syntax error;
1200 >                                     #endif
1201 >                                   ]])],
1202 >                  [AC_MSG_RESULT(yes); HAVE_GCC27=yes],
1203 >                  [AC_MSG_RESULT(no)])
1204  
1205   dnl Check for GCC 3.0 or higher.
1206   HAVE_GCC30=no
1207   AC_MSG_CHECKING(for GCC 3.0 or higher)
1208 < AC_EGREP_CPP(xyes,
1209 < [#if __GNUC__ >= 3
1210 <  xyes
1211 < #endif
1212 < ], [AC_MSG_RESULT(yes); HAVE_GCC30=yes], AC_MSG_RESULT(no))
1208 > AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#if ! (__GNUC__ >= 3)
1209 >                                     # error gcc < 3
1210 >                                     typedef syntax error;
1211 >                                     #endif
1212 >                                   ]])],
1213 >                  [AC_MSG_RESULT(yes); HAVE_GCC30=yes],
1214 >                  [AC_MSG_RESULT(no)])
1215  
1216   dnl Check for ICC.
1217   AC_MSG_CHECKING(for ICC)
# Line 1053 | Line 1242 | AC_CACHE_CHECK([the format of compiler g
1242    rm -rf conftest*
1243   ])
1244  
1245 + dnl Add -fno-strict-aliasing for slirp sources
1246 + if [[ "x$HAVE_GCC30" = "xyes" ]]; then
1247 +  SAVED_CFLAGS="$CFLAGS"
1248 +  CFLAGS="$CFLAGS -fno-strict-aliasing"
1249 +  AC_CACHE_CHECK([whether the compiler supports -fno-strict-aliasing],
1250 +    ac_cv_gcc_no_strict_aliasing, [
1251 +    AC_TRY_COMPILE([],[],
1252 +      [ac_cv_gcc_no_strict_aliasing=yes; AC_SUBST(SLIRP_CFLAGS, "-fno-strict-aliasing")],
1253 +      [ac_cv_gcc_no_strict_aliasing=no])
1254 +  ])
1255 +  CFLAGS="$SAVED_CFLAGS"
1256 + fi
1257 +
1258 + dnl Add -mdynamic-no-pic for MacOS X (XXX icc10 will support MacOS X)
1259 + if [[ "x$HAVE_GCC30" = "xyes" -a "x$HAVE_ICC" = "xno" ]]; then
1260 +  SAVED_CFLAGS="$CFLAGS"
1261 +  CFLAGS="$CFLAGS -mdynamic-no-pic"
1262 +  AC_CACHE_CHECK([whether the compiler supports -mdynamic-no-pic],
1263 +    ac_cv_gcc_mdynamic_no_pic, [
1264 +    AC_TRY_COMPILE([],[],[ac_cv_gcc_mdynamic_no_pic=yes],[ac_cv_gcc_mdynamic_no_pic=no])
1265 +  ])
1266 +  if [[ "x$ac_cv_gcc_mdynamic_no_pic" = "xyes" ]]; then
1267 +    CXXFLAGS="$CXXFLAGS -mdynamic-no-pic"
1268 +  else
1269 +    CFLAGS="$SAVED_CFLAGS"
1270 +  fi
1271 + fi
1272 +
1273   dnl CPU emulator sources
1274   if [[ "x$EMULATED_PPC" = "xyes" ]]; then
1275    CPUSRCS="\
1276      ../kpx_cpu/src/mathlib/ieeefp.cpp \
1277 +    ../kpx_cpu/src/mathlib/mathlib.cpp \
1278      ../kpx_cpu/src/cpu/ppc/ppc-cpu.cpp \
1279      ../kpx_cpu/src/cpu/ppc/ppc-decode.cpp \
1280      ../kpx_cpu/src/cpu/ppc/ppc-execute.cpp \
# Line 1077 | Line 1295 | if [[ "x$EMULATED_PPC" = "xyes" ]]; then
1295        i?86:elf)
1296          ac_cv_use_dyngen=yes
1297          ;;
1298 +      mips:elf)
1299 +        ac_cv_use_dyngen=yes
1300 +        ;;
1301        powerpc:mach)
1302          ac_cv_use_dyngen=yes
1303          ;;
1304 +      i?86:mach)
1305 +        ac_cv_use_dyngen=yes
1306 +        ;;
1307        *:*)
1308          ac_cv_use_dyngen=no
1309          ;;
# Line 1089 | Line 1313 | if [[ "x$EMULATED_PPC" = "xyes" ]]; then
1313          if [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_ICC" = "xno" ]]; then
1314            DYNGEN_CC=$CXX
1315          else
1316 <          for p in /usr/bin /usr/local/bin; do
1316 >          for p in /usr/bin /usr/local/bin /usr/freeware/bin; do
1317              gxx="$p/g++"
1318              if [[ -x "$gxx" ]]; then
1319                DYNGEN_CC="$gxx"
# Line 1097 | Line 1321 | if [[ "x$EMULATED_PPC" = "xyes" ]]; then
1321            done
1322          fi
1323        fi
1324 <      if [[ -z "$DYNGEN_CC" ]] || ! { echo '#include <limits>' | $DYNGEN_CC -xc++ -c -o /dev/null - >& /dev/null; }; then
1324 >      if [[ -z "$DYNGEN_CC" ]]; then
1325          ac_cv_use_dyngen=no
1326        fi
1327      ])
1328      if [[ "x$ac_cv_use_dyngen" = "xyes" ]]; then
1329        case $host_cpu in
1330        i?86)
1331 <        DYNGEN_OP_FLAGS="-fomit-frame-pointer -mpreferred-stack-boundary=2"
1331 >        DYNGEN_OP_FLAGS="-fomit-frame-pointer"
1332 >        ;;
1333 >      mips)
1334 >        DYNGEN_OP_FLAGS="-fno-delayed-branch -mno-abicalls"
1335          ;;
1336        powerpc)
1337          if [[ "x$ac_cv_object_format" = "xmach" ]]; then
# Line 1112 | Line 1339 | if [[ "x$EMULATED_PPC" = "xyes" ]]; then
1339          fi
1340          ;;
1341        esac
1342 <      if [[ "x$HAVE_GCC30" = "xyes" ]]; then
1342 >      have_dyngen_gcc3=no
1343 >      case "x`$DYNGEN_CC -dumpversion`" in
1344 >      x[12].*) ;;
1345 >      x*) have_dyngen_gcc3=yes ;;
1346 >      esac
1347 >      if [[ "x$have_dyngen_gcc3" = "xyes" ]]; then
1348          DYNGEN_OP_FLAGS="$DYNGEN_OP_FLAGS -falign-functions=0"
1349        else
1350          DYNGEN_OP_FLAGS="$DYNGEN_OP_FLAGS -malign-functions=0"
1351        fi
1352 <      DYNGEN_OP_FLAGS="$DYNGEN_OP_FLAGS -finline-limit=10000 -fno-exceptions -g0"
1353 <      if [[ "x$HAVE_GCC30" = "xyes" ]]; then
1352 >      DYNGEN_OP_FLAGS="$DYNGEN_OP_FLAGS -finline-functions -finline-limit=10000 -fno-exceptions -g0"
1353 >      if [[ "x$have_dyngen_gcc3" = "xyes" ]]; then
1354          DYNGEN_OP_FLAGS="$DYNGEN_OP_FLAGS -fno-reorder-blocks -fno-optimize-sibling-calls"
1355        fi
1356 +      if [[ "x$DYNGEN_CC" != "x$CXX" ]]; then
1357 +        DYNGEN_CFLAGS="-O2 $CFLAGS"
1358 +        DYNGEN_CXXFLAGS="-O2 $CXXFLAGS"
1359 +      else
1360 +        DYNGEN_CFLAGS="\$(CFLAGS)"
1361 +        DYNGEN_CXXFLAGS="\$(CXXFLAGS)"
1362 +      fi
1363      else
1364        WANT_JIT=no
1365      fi
# Line 1143 | Line 1382 | if [[ "x$ac_cv_use_dyngen" = "xyes" ]];
1382    AC_CACHE_CHECK([whether static data regions are executable],
1383      ac_cv_have_static_data_exec, [
1384      AC_TRY_RUN([int main(void) {
1385 < #if defined(__powerpc__)
1385 > #if defined(__powerpc__) || defined(__ppc__)
1386        static unsigned int p[8] = {0x4e800020,};
1387        asm volatile("dcbst 0,%0" : : "r" (p) : "memory");
1388        asm volatile("sync" : : : "memory");
# Line 1169 | Line 1408 | if [[ "x$WANT_JIT" = "xyes" ]]; then
1408    CPPFLAGS="$CPPFLAGS -DUSE_JIT"
1409   fi
1410  
1411 + dnl Higher level optimizations with MIPSPro compilers are possible
1412 + if [[ "x$HAVE_IPA" = "xyes" ]]; then
1413 +  CFLAGS="`echo $CFLAGS | sed -e 's/-g//g'` -O3 -OPT:Olimit=0 -IPA"
1414 +  CXXFLAGS="`echo $CXXFLAGS | sed -e 's/-g//g'` -O3 -OPT:Olimit=0 -IPA"
1415 +  CXXFLAGS="-LANG:std $CXXFLAGS"
1416 +  LDFLAGS="$LDFLAGS -O3 -OPT:Olimit=0 -IPA"
1417 + fi
1418 +
1419   dnl Generate Makefile.
1420   AC_SUBST(PERL)
1421   AC_SUBST(USE_DYNGEN, [$ac_cv_use_dyngen])
1422   AC_SUBST(DYNGENSRCS)
1423   AC_SUBST(DYNGEN_CC)
1424 + AC_SUBST(DYNGEN_CFLAGS)
1425 + AC_SUBST(DYNGEN_CXXFLAGS)
1426   AC_SUBST(DYNGEN_OP_FLAGS)
1427   AC_SUBST(SYSSRCS)
1428   AC_SUBST(CPUSRCS)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines