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

Comparing BasiliskII/src/Unix/configure.ac (file contents):
Revision 1.34 by gbeauche, 2004-11-08T21:07:07Z vs.
Revision 1.78 by asvitkine, 2010-07-28T01:07:45Z

# 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 + AC_ARG_ENABLE(standalone-gui,[  --enable-standalone-gui enable a standalone GUI prefs editor [default=no]], [WANT_STANDALONE_GUI=$enableval], [WANT_STANDALONE_GUI=no])
18 +
19   dnl Video options.
20   AC_ARG_ENABLE(xf86-dga,      [  --enable-xf86-dga       use the XFree86 DGA extension [default=yes]], [WANT_XF86_DGA=$enableval], [WANT_XF86_DGA=yes])
21   AC_ARG_ENABLE(xf86-vidmode,  [  --enable-xf86-vidmode   use the XFree86 VidMode extension [default=yes]], [WANT_XF86_VIDMODE=$enableval], [WANT_XF86_VIDMODE=yes])
# Line 21 | Line 23 | AC_ARG_ENABLE(fbdev-dga,     [  --enable
23   AC_ARG_ENABLE(vosf,          [  --enable-vosf           enable video on SEGV signals [default=yes]], [WANT_VOSF=$enableval], [WANT_VOSF=yes])
24  
25   dnl SDL options.
26 + AC_ARG_ENABLE(sdl-static,    [  --enable-sdl-static     use SDL static libraries for linking [default=no]], [WANT_SDL_STATIC=$enableval], [WANT_SDL_STATIC=no])
27   AC_ARG_ENABLE(sdl-video,     [  --enable-sdl-video      use SDL for video graphics [default=no]], [WANT_SDL_VIDEO=$enableval], [WANT_SDL_VIDEO=no])
28   AC_ARG_ENABLE(sdl-audio,     [  --enable-sdl-audio      use SDL for audio [default=no]], [WANT_SDL_AUDIO=$enableval], [WANT_SDL_AUDIO=no])
29 + AC_ARG_ENABLE(sdl-framework,    [  --enable-sdl-framework  use SDL framework [default=no]], [WANT_SDL_FRAMEWORK=$enableval], [WANT_SDL_FRAMEWORK=no])
30 + AC_ARG_ENABLE(sdl-framework-prefix,    [  --enable-sdl-framework-prefix=PFX    default=/Library/Frameworks], [SDL_FRAMEWORK="$enableval"], [SDL_FRAMEWORK=/Library/Frameworks])
31  
32   dnl JIT compiler options.
33   AC_ARG_ENABLE(jit-compiler,  [  --enable-jit-compiler   enable JIT compiler [default=no]], [WANT_JIT=$enableval], [WANT_JIT=no])
# Line 59 | Line 64 | AC_ARG_ENABLE(addressing,
64  
65   dnl External packages.
66   AC_ARG_WITH(esd,             [  --with-esd              support ESD for sound under Linux/FreeBSD [default=yes]], [WANT_ESD=$withval], [WANT_ESD=yes])
67 < AC_ARG_WITH(gtk,             [  --with-gtk              use GTK user interface [default=yes]], [WANT_GTK=$withval], [WANT_GTK=yes])
67 > AC_ARG_WITH(gtk,             [  --with-gtk              use GTK user interface [default=yes]],
68 >  [case "$withval" in
69 >   gtk1)      WANT_GTK="gtk";;
70 >   gtk|gtk2)  WANT_GTK="$withval";;
71 >   yes)       WANT_GTK="gtk2 gtk";;
72 >   *)         WANT_GTK="no";;
73 >   esac],
74 >  [WANT_GTK="gtk2 gtk"])
75   AC_ARG_WITH(mon,             [  --with-mon              use mon as debugger [default=yes]], [WANT_MON=$withval], [WANT_MON=yes])
76  
77   dnl Canonical system information.
# Line 91 | Line 103 | case "$target_cpu" in
103    x86_64* ) HAVE_X86_64=yes;;
104   esac
105  
106 + dnl Check if we should really be assuming x86_64 even if we detected HAVE_I386 above.
107 + if [[ "x$HAVE_I386" = "xyes" ]]; then
108 +  AC_TRY_RUN([
109 +    int main(void) {
110 +        #if defined(__x86_64__)
111 +                return 0;
112 +        #else
113 +                return 1;
114 +        #endif
115 +    }
116 +  ], [
117 +    HAVE_I386=no
118 +    HAVE_X86_64=yes
119 +  ])
120 + fi
121 +
122 + dnl Check if we should really be assuming x86_64 even if we detected HAVE_I386 above.
123 + if [[ "x$HAVE_I386" = "xyes" ]]; then
124 +  AC_TRY_RUN([
125 +    int main(void) {
126 +        #if defined(__x86_64__)
127 +                return 0;
128 +        #else
129 +                return 1;
130 +        #endif
131 +    }
132 +  ], [
133 +    HAVE_I386=no
134 +    HAVE_X86_64=yes
135 +  ])
136 + fi
137 +
138   dnl Checks for programs.
139   AC_PROG_CC
140   AC_PROG_CC_C_O
# Line 98 | Line 142 | AC_PROG_CPP
142   AC_PROG_CXX
143   AC_PROG_MAKE_SET
144   AC_PROG_INSTALL
145 + AC_PROG_EGREP
146  
147   dnl We use mon if possible.
148   MONSRCS=
# Line 107 | Line 152 | if [[ "x$WANT_MON" = "xyes" ]]; then
152    if grep mon_init $mon_srcdir/mon.h >/dev/null 2>/dev/null; then
153      AC_MSG_RESULT(yes)
154      AC_DEFINE(ENABLE_MON, 1, [Define if using "mon".])
155 <    MONSRCS="$mon_srcdir/mon.cpp $mon_srcdir/mon_6502.cpp $mon_srcdir/mon_z80.cpp $mon_srcdir/mon_cmd.cpp $mon_srcdir/mon_disass.cpp $mon_srcdir/mon_ppc.cpp $mon_srcdir/mon_lowmem.cpp $mon_srcdir/disass/floatformat.c $mon_srcdir/disass/i386-dis.c $mon_srcdir/disass/m68k-dis.c $mon_srcdir/disass/m68k-opc.c"
155 >    MONSRCS="$mon_srcdir/mon.cpp $mon_srcdir/mon_6502.cpp $mon_srcdir/mon_z80.cpp $mon_srcdir/mon_cmd.cpp $mon_srcdir/mon_disass.cpp $mon_srcdir/mon_ppc.cpp $mon_srcdir/mon_lowmem.cpp $mon_srcdir/disass/floatformat.c $mon_srcdir/disass/i386-dis.c $mon_srcdir/disass/m68k-dis.c $mon_srcdir/disass/m68k-opc.c $mon_srcdir/disass/mips-dis.c $mon_srcdir/disass/mips-opc.c $mon_srcdir/disass/mips16-opc.c"
156      CXXFLAGS="$CXXFLAGS -I$mon_srcdir -I$mon_srcdir/disass"
157      AC_CHECK_LIB(ncurses, tgetent, ,
158 <      AC_CHECK_LIB(termcap, tgetent, ,
159 <        AC_CHECK_LIB(termlib, tgetent, ,
160 <          AC_CHECK_LIB(terminfo, tgetent, ,
161 <            AC_CHECK_LIB(Hcurses, tgetent, ,
162 <              AC_CHECK_LIB(curses, tgetent))))))
158 >      [AC_CHECK_LIB(termcap, tgetent, ,
159 >        [AC_CHECK_LIB(termlib, tgetent, ,
160 >          [AC_CHECK_LIB(terminfo, tgetent, ,
161 >            [AC_CHECK_LIB(Hcurses, tgetent, ,
162 >              [AC_CHECK_LIB(curses, tgetent)])])])])])
163      AC_CHECK_LIB(readline, readline)
164    else
165      AC_MSG_RESULT(no)
# Line 127 | Line 172 | dnl Checks for libraries.
172   AC_CHECK_LIB(posix4, sem_init)
173   AC_CHECK_LIB(rt, timer_create)
174   AC_CHECK_LIB(rt, shm_open)
175 + AC_CHECK_LIB(m, cos)
176 +
177 + dnl AC_CHECK_SDLFRAMEWORK($1=NAME, $2=INCLUDES)
178 + dnl AC_TRY_LINK uses main() but SDL needs main to take args,
179 + dnl therefore main is undefined with #undef.
180 + dnl Framework can be in an custom location.
181 + AC_DEFUN([AC_CHECK_SDLFRAMEWORK], [
182 +  AS_VAR_PUSHDEF([ac_Framework], [ac_cv_framework_$1])
183 +  AC_CACHE_CHECK([whether compiler supports framework $1],
184 +    ac_Framework, [
185 +    saved_LIBS="$LIBS"
186 +    LIBS="$LIBS -framework $1"
187 +    if [[ "x$SDL_FRAMEWORK" != "x/Library/Frameworks" ]]; then
188 +      if [[ "x$SDL_FRAMEWORK" != "x/System/Library/Frameworks" ]]; then
189 +        LIBS="$saved_LIBS -F$SDL_FRAMEWORK -framework $1"
190 +      fi
191 +    fi
192 +    saved_CPPFLAGS="$CPPFLAGS"
193 +    CPPFLAGS="$CPPFLAGS -I$SDL_FRAMEWORK/SDL.framework/Headers"
194 +    AC_TRY_LINK(
195 +      [$2
196 + #undef main], [],
197 +      [AS_VAR_SET(ac_Framework, yes)], [AS_VAR_SET(ac_Framework, no);
198 + LIBS="$saved_LIBS"; CPPFLAGS="$saved_CPPFLAGS"]
199 +    )
200 +  ])
201 +  AS_IF([test AS_VAR_GET(ac_Framework) = yes],
202 +    [AC_DEFINE(AS_TR_CPP(HAVE_FRAMEWORK_$1), 1, [Define if framework $1 is available.])]
203 +  )
204 +  AS_VAR_POPDEF([ac_Framework])
205 + ])
206  
207   dnl Do we need SDL?
208   WANT_SDL=no
# Line 142 | Line 218 | if [[ "x$WANT_SDL_AUDIO" = "xyes" ]]; th
218    SDL_SUPPORT="$SDL_SUPPORT audio"
219   fi
220   if [[ "x$WANT_SDL" = "xyes" ]]; then
221 <  AC_PATH_PROG(sdl_config, "sdl-config")
222 <  if [[ -n "$sdl_config" ]]; then
147 <    sdl_cflags=`$sdl_config --cflags`
148 <    sdl_libs=`$sdl_config --libs`
149 <    CFLAGS="$CFLAGS $sdl_cflags"
150 <    CXXFLAGS="$CXXFLAGS $sdl_cflags"
151 <    LIBS="$LIBS $sdl_libs"
221 >  if [[ "x$WANT_SDL_FRAMEWORK" = "xyes" ]]; then
222 >    AC_CHECK_SDLFRAMEWORK(SDL, [#include <SDL.h>])
223    else
224 <    WANT_SDL=no
224 >    ac_cv_framework_SDL=no
225 >  fi
226 >  if [[ "x$ac_cv_framework_SDL" = "xno" ]]; then
227 >    AC_PATH_PROG(sdl_config, "sdl-config")
228 >    if [[ -n "$sdl_config" ]]; then
229 >      case $target_os in
230 >      # Special treatment for Cygwin so that we can still use the POSIX layer
231 >      *cygwin*)
232 >        sdl_cflags="-I`$sdl_config --prefix`/include/SDL"
233 >        sdl_libs="-L`$sdl_config --exec-prefix`/lib -lSDL"
234 >        ;;
235 >      *)
236 >        sdl_cflags=`$sdl_config --cflags`
237 >        if [[ "x$WANT_SDL_STATIC" = "xyes" ]]; then
238 >          sdl_libs=`$sdl_config --static-libs`
239 >        else
240 >          sdl_libs=`$sdl_config --libs`
241 >        fi
242 >        ;;
243 >      esac
244 >      CFLAGS="$CFLAGS $sdl_cflags"
245 >      CXXFLAGS="$CXXFLAGS $sdl_cflags"
246 >      LIBS="$LIBS $sdl_libs"
247 >    else
248 >      WANT_SDL=no
249 >    fi
250    fi
251    SDL_SUPPORT=`echo "$SDL_SUPPORT" | sed -e "s/^ //"`
252   else
# Line 180 | Line 276 | AC_CHECK_LIB(pthread, pthread_create, ,
276   if [[ "x$HAVE_PTHREADS" = "xyes" ]]; then
277    AC_DEFINE(HAVE_PTHREADS, 1, [Define if pthreads are available.])
278   fi
279 < AC_CHECK_FUNCS(pthread_cancel)
279 > AC_CHECK_FUNCS(pthread_cond_init)
280 > AC_CHECK_FUNCS(pthread_cancel pthread_testcancel)
281   AC_CHECK_FUNCS(pthread_mutexattr_setprotocol)
282   AC_CHECK_FUNCS(pthread_mutexattr_settype)
283   AC_CHECK_FUNCS(pthread_mutexattr_setpshared)
# Line 224 | Line 321 | fi
321  
322   dnl We use GTK+ if possible.
323   UISRCS=../dummy/prefs_editor_dummy.cpp
324 < if [[ "x$WANT_GTK" = "xyes" ]]; then
324 > case "x$WANT_GTK" in
325 > xgtk2*)
326 >  AM_PATH_GTK_2_0(1.3.15, [
327 >    GUI_CFLAGS="$GTK_CFLAGS"
328 >    GUI_LIBS="$GTK_LIBS"
329 >    WANT_GTK=gtk2
330 >  ], [
331 >    case "x${WANT_GTK}x" in
332 >    *gtkx)
333 >      AC_MSG_WARN([Could not find GTK+ 2.0, trying with GTK+ 1.2.])
334 >      WANT_GTK=gtk
335 >      ;;
336 >    *)
337 >      AC_MSG_WARN([Could not find GTK+, disabling user interface.])
338 >      WANT_GTK=no
339 >      ;;
340 >    esac
341 >  ])
342 >  ;;
343 > esac
344 > if [[ "x$WANT_GTK" = "xgtk" ]]; then
345    AM_PATH_GTK(1.2.0, [
346 <    AC_DEFINE(ENABLE_GTK, 1, [Define if using GTK.])
347 <    CXXFLAGS="$CXXFLAGS $GTK_CFLAGS"
231 <    LIBS="$LIBS $GTK_LIBS"
232 <    UISRCS=prefs_editor_gtk.cpp
346 >    GUI_CFLAGS="$GTK_CFLAGS"
347 >    GUI_LIBS="$GTK_LIBS"
348      dnl somehow, <gnome-i18n.h> would redefine gettext() to nothing if
349      dnl ENABLE_NLS is not set, thusly conflicting with C++ <string> which
350      dnl includes <libintl.h>
351      AM_GNU_GETTEXT
352      B2_PATH_GNOMEUI([
353        AC_DEFINE(HAVE_GNOMEUI, 1, [Define if libgnomeui is available.])
354 <      CXXFLAGS="$CXXFLAGS $GNOMEUI_CFLAGS"
355 <      LIBS="$LIBS $GNOMEUI_LIBS"
354 >      GUI_CFLAGS="$GUI_CFLAGS $GNOMEUI_CFLAGS"
355 >      GUI_LIBS="$GUI_LIBS $GNOMEUI_LIBS"
356      ], [])
357    ], [
358      AC_MSG_WARN([Could not find GTK+, disabling user interface.])
359      WANT_GTK=no
360    ])
361   fi
362 + if [[ "x$WANT_GTK" != "xno" -a "x$WANT_STANDALONE_GUI" = "xno" ]]; then
363 +  AC_DEFINE(ENABLE_GTK, 1, [Define if using GTK.])
364 +  UISRCS=prefs_editor_gtk.cpp
365 + fi
366 + AC_SUBST(GUI_CFLAGS)
367 + AC_SUBST(GUI_LIBS)
368 +
369 + dnl Build external GUI if requested.
370 + if [[ "$WANT_STANDALONE_GUI" != "yes" ]]; then
371 +  WANT_STANDALONE_GUI=no
372 + fi
373 + if [[ "$WANT_GTK" = "no" ]]; then
374 +  WANT_STANDALONE_GUI=no
375 + fi
376 + AC_SUBST(STANDALONE_GUI, [$WANT_STANDALONE_GUI])
377  
378   dnl We use ESD if possible.
379   if [[ "x$WANT_ESD" = "xyes" ]]; then
# Line 263 | Line 393 | AC_SYS_LARGEFILE
393  
394   dnl Checks for header files.
395   AC_HEADER_STDC
396 + AC_CHECK_HEADERS(stdlib.h stdint.h)
397   AC_CHECK_HEADERS(unistd.h fcntl.h sys/types.h sys/time.h sys/mman.h mach/mach.h)
398   AC_CHECK_HEADERS(readline.h history.h readline/readline.h readline/history.h)
399 < AC_CHECK_HEADERS(linux/if.h linux/if_tun.h net/if.h net/if_tun.h)
399 > AC_CHECK_HEADERS(sys/socket.h sys/ioctl.h sys/filio.h sys/bitypes.h sys/wait.h)
400 > AC_CHECK_HEADERS(sys/poll.h sys/select.h)
401 > AC_CHECK_HEADERS(arpa/inet.h)
402 > AC_CHECK_HEADERS(linux/if.h linux/if_tun.h net/if.h net/if_tun.h, [], [], [
403 > #ifdef HAVE_SYS_TYPES_H
404 > #include <sys/types.h>
405 > #endif
406 > #ifdef HAVE_SYS_SOCKET_H
407 > #include <sys/socket.h>
408 > #endif
409 > ])
410   AC_CHECK_HEADERS(AvailabilityMacros.h)
411 + AC_CHECK_HEADERS(IOKit/storage/IOBlockStorageDevice.h)
412  
413   dnl Checks for typedefs, structures, and compiler characteristics.
414   AC_C_BIGENDIAN
# Line 306 | Line 448 | if [[ "x$ac_cv_type_socklen_t" != "xyes"
448   fi
449  
450   dnl Checks for library functions.
451 < AC_CHECK_FUNCS(strdup cfmakeraw)
451 > AC_CHECK_FUNCS(strdup strerror cfmakeraw)
452   AC_CHECK_FUNCS(clock_gettime timer_create)
453   AC_CHECK_FUNCS(sigaction signal)
454   AC_CHECK_FUNCS(mmap mprotect munmap)
455   AC_CHECK_FUNCS(vm_allocate vm_deallocate vm_protect)
456 + AC_CHECK_FUNCS(poll inet_aton)
457  
458   dnl Darwin seems to define mach_task_self() instead of task_self().
459   AC_CHECK_FUNCS(mach_task_self task_self)
# Line 337 | Line 480 | mips-sony-bsd|mips-sony-newsos4)
480   *-*-sco3.2v5*)
481          no_dev_ptmx=1
482          ;;
483 + *-*-cygwin*)
484 +        no_dev_ptmx=1
485 +        ;;
486 + *-*-darwin*)
487 +        no_dev_ptmx=1
488 +        ;;
489   esac
490  
491   if test -z "$no_dev_ptmx" ; then
# Line 355 | Line 504 | AC_CHECK_FILE([/dev/ptc],
504                  have_dev_ptc=1
505          ]
506   )
358
507   dnl (end of code from openssh-3.2.2p1 configure.ac)
508  
509 + dnl Check for systems where POSIX-style non-blocking I/O (O_NONBLOCK)
510 + dnl doesn't work or is unimplemented. On these systems (mostly older
511 + dnl ones), use the old BSD-style FIONBIO approach instead. [tcl.m4]
512 + AC_CACHE_CHECK([FIONBIO vs. O_NONBLOCK for non-blocking I/O],
513 +  ac_cv_nonblocking_io, [
514 +  case "$host" in
515 +  *-*-osf*)
516 +    ac_cv_nonblocking_io=FIONBIO
517 +    ;;
518 +  *-*-sunos4*)
519 +    ac_cv_nonblocking_io=FIONBIO
520 +    ;;
521 +  *-*-ultrix*)
522 +    ac_cv_nonblocking_io=FIONBIO
523 +    ;;
524 +  *)
525 +    ac_cv_nonblocking_io=O_NONBLOCK
526 +    ;;
527 +  esac
528 + ])
529 + if [[ "$ac_cv_nonblocking_io" = "FIONBIO" ]]; then
530 +  AC_DEFINE(USE_FIONBIO, 1, [Define if BSD-style non-blocking I/O is to be used])
531 + fi
532 +
533 + dnl Check whether compiler supports byte bit-fields
534 + AC_CACHE_CHECK([whether compiler supports byte bit-fields],
535 +  ac_cv_have_byte_bitfields, [
536 +  AC_LANG_SAVE
537 +  AC_LANG_CPLUSPLUS
538 +  AC_TRY_RUN([
539 +    struct A {
540 +      unsigned char b1:4;
541 +      unsigned char b2:4;
542 +      unsigned char c;
543 +      unsigned short s;
544 +      unsigned char a[4];
545 +    };
546 +
547 +    int main(void) {
548 +      A a;
549 +      return ! (sizeof(A) == 8 && &a.c == ((unsigned char *)&a + 1));
550 +    }],
551 +    [ac_cv_have_byte_bitfields=yes],
552 +    [ac_cv_have_byte_bitfields=no],
553 +    dnl When cross-compiling, assume only GCC supports this
554 +    [if [[ "$GCC" = "yes" ]]; then
555 +      ac_cv_have_byte_bitfields="guessing yes"
556 +    else
557 +      ac_cv_have_byte_bitfields="guessing no"
558 +    fi]
559 +    )
560 +  AC_LANG_RESTORE
561 + ])
562  
563   dnl AC_CHECK_FRAMEWORK($1=NAME, $2=INCLUDES)
564 < AC_DEFUN(AC_CHECK_FRAMEWORK, [
564 > AC_DEFUN([AC_CHECK_FRAMEWORK], [
565    AS_VAR_PUSHDEF([ac_Framework], [ac_cv_framework_$1])dnl
566    AC_CACHE_CHECK([whether compiler supports framework $1],
567      ac_Framework, [
568      saved_LIBS="$LIBS"
569      LIBS="$LIBS -framework $1"
570      AC_TRY_LINK(
571 <      [$2], [int main(void) { return 0; }],
571 >      [$2], [],
572        [AS_VAR_SET(ac_Framework, yes)], [AS_VAR_SET(ac_Framework, no); LIBS="$saved_LIBS"]
573      )
574    ])
# Line 378 | Line 579 | AC_DEFUN(AC_CHECK_FRAMEWORK, [
579   ])
580  
581   dnl Check for some MacOS X frameworks
582 + AC_CHECK_FRAMEWORK(AppKit, [])
583   AC_CHECK_FRAMEWORK(Carbon, [#include <Carbon/Carbon.h>])
584   AC_CHECK_FRAMEWORK(IOKit, [#include <IOKit/IOKitLib.h>])
585 + AC_CHECK_FRAMEWORK(CoreFoundation, [#include <CoreFoundation/CoreFoundation.h>])
586  
587   dnl Select system-dependant source files.
588   SERIALSRC=serial_unix.cpp
589   ETHERSRC=../dummy/ether_dummy.cpp
590   SCSISRC=../dummy/scsi_dummy.cpp
591   AUDIOSRC=../dummy/audio_dummy.cpp
592 + EXTFSSRC=extfs_unix.cpp
593   EXTRASYSSRCS=
594   CAN_NATIVE_M68K=no
595   case "$target_os" in
# Line 419 | Line 623 | freebsd*)
623    ;;
624   netbsd*)
625    CAN_NATIVE_M68K=yes
626 +  ETHERSRC=ether_unix.cpp
627    ;;
628   solaris*)
629    AUDIOSRC=Solaris/audio_solaris.cpp
630    DEFINES="$DEFINES -DBSD_COMP -D_POSIX_PTHREAD_SEMANTICS"
631    ;;
632   irix*)
428  ETHERSRC=ether_unix.cpp
633    AUDIOSRC=Irix/audio_irix.cpp
634    EXTRASYSSRCS=Irix/unaligned.c
431  dnl IRIX headers work fine, but somehow don't define or use "STDC_HEADERS"
432  DEFINES="$DEFINES -DCRTSCTS=CNEW_RTSCTS -DB230400=B115200 -DSTDC_HEADERS"
635    LIBS="$LIBS -laudio"
636    WANT_ESD=no
637  
# Line 439 | Line 641 | irix*)
641    CFLAGS=`echo "$CFLAGS -IPA" | sed -e "s/-g//g"`
642    AC_MSG_CHECKING(if "-IPA" works)
643    dnl Do a test compile of an empty function
644 <  AC_TRY_COMPILE(,, [AC_MSG_RESULT(yes); HAVE_IPA=yes], AC_MSG_RESULT(no))
644 >  AC_TRY_COMPILE([#if defined __GNUC__
645 >                  # error GCC does not support IPA yet
646 >                  #endif],, [AC_MSG_RESULT(yes); HAVE_IPA=yes], AC_MSG_RESULT(no))
647    CFLAGS="$ocflags"
648    ;;
649   darwin*)
650 <  if [[ "x$ac_cv_framework_IOKit" = "xyes" ]]; then
650 >  ETHERSRC=ether_unix.cpp
651 >  if [[ "x$ac_cv_framework_IOKit" = "xyes" -a "x$ac_cv_framework_CoreFoundation" = "xyes" ]]; then
652      EXTRASYSSRCS="../MacOSX/sys_darwin.cpp"
653    fi
654 +  if [[ "x$ac_cv_framework_Carbon" = "xyes" ]]; then
655 +    EXTFSSRC=../MacOSX/extfs_macosx.cpp
656 +  fi
657 +  ;;
658 + cygwin*)
659 +  SERIALSRC="../dummy/serial_dummy.cpp"
660 +  EXTRASYSSRCS="../Windows/BasiliskII.rc"
661    ;;
662   esac
663 +
664 + dnl Is the slirp library supported?
665 + case "$ac_cv_have_byte_bitfields" in
666 + yes|"guessing yes")
667 +  CAN_SLIRP=yes
668 +  ETHERSRC=ether_unix.cpp
669 +  ;;
670 + esac
671 + if [[ -n "$CAN_SLIRP" ]]; then
672 +  AC_DEFINE(HAVE_SLIRP, 1, [Define if slirp library is supported])
673 +  SLIRP_SRCS="\
674 +    ../slirp/bootp.c     ../slirp/ip_output.c  ../slirp/tcp_input.c  \
675 +    ../slirp/cksum.c     ../slirp/mbuf.c       ../slirp/tcp_output.c \
676 +    ../slirp/debug.c     ../slirp/misc.c       ../slirp/tcp_subr.c   \
677 +    ../slirp/if.c        ../slirp/sbuf.c       ../slirp/tcp_timer.c  \
678 +    ../slirp/ip_icmp.c   ../slirp/slirp.c      ../slirp/tftp.c       \
679 +    ../slirp/ip_input.c  ../slirp/socket.c     ../slirp/udp.c"
680 + fi
681 + AC_SUBST(SLIRP_SRCS)
682 +
683   dnl SDL overrides
684   if [[ "x$WANT_SDL" = "xyes" ]]; then
685    AC_DEFINE(USE_SDL, 1, [Define to enble SDL support])
686 +  if [[ "x$WANT_SDL_FRAMEWORK" = "xyes" ]]; then
687 +    EXTRASYSSRCS="$EXTRASYSSRCS ../SDL/SDLMain.m"
688 +  fi
689   fi
690   if [[ "x$WANT_SDL_VIDEO" = "xyes" ]]; then
691    AC_DEFINE(USE_SDL_VIDEO, 1, [Define to enable SDL video graphics support])
# Line 459 | Line 694 | if [[ "x$WANT_SDL_VIDEO" = "xyes" ]]; th
694    if [[ "x$ac_cv_framework_Carbon" = "xyes" ]]; then
695      EXTRASYSSRCS="$EXTRASYSSRCS ../MacOSX/clip_macosx.cpp"
696    else
697 <    EXTRASYSSRCS="$EXTRASYSSRCS ../dummy/clip_dummy.cpp"
697 >    case "$target_os" in
698 >    cygwin*)
699 >      EXTRASYSSRCS="$EXTRASYSSRCS ../Windows/clip_windows.cpp"
700 >      ;;
701 >    *)
702 >      EXTRASYSSRCS="$EXTRASYSSRCS ../dummy/clip_dummy.cpp"
703 >      ;;
704 >    esac
705    fi
706   else
707    VIDEOSRCS="video_x.cpp"
# Line 485 | Line 727 | if [[ "x$HAVE_PTHREADS" = "xno" ]]; then
727    ETHERSRC=../dummy/ether_dummy.cpp
728    AUDIOSRC=../dummy/audio_dummy.cpp
729   fi
730 < SYSSRCS="$VIDEOSRCS $SERIALSRC $ETHERSRC $SCSISRC $AUDIOSRC $SEMSRC $UISRCS $MONSRCS $EXTRASYSSRCS"
730 > SYSSRCS="$VIDEOSRCS $EXTFSSRC $SERIALSRC $ETHERSRC $SCSISRC $AUDIOSRC $SEMSRC $UISRCS $MONSRCS $EXTRASYSSRCS"
731  
732   dnl Define a macro that translates a yesno-variable into a C macro definition
733   dnl to be put into the config.h file
734   dnl $1 -- the macro to define
735   dnl $2 -- the value to translate
736   dnl $3 -- template name
737 < AC_DEFUN(AC_TRANSLATE_DEFINE, [
737 > AC_DEFUN([AC_TRANSLATE_DEFINE], [
738      if [[ "x$2" = "xyes" -o "x$2" = "xguessing yes" ]]; then
739          AC_DEFINE($1, 1, $3)
740      fi
# Line 703 | Line 945 | AC_CACHE_CHECK([whether we can map Low M
945    ]
946   )
947  
706 dnl Check if we have POSIX shared memory support
707 AC_CACHE_CHECK([whether POSIX shared memory is working],
708  ac_cv_have_posix_shm, [
709  AC_LANG_SAVE
710  AC_LANG_CPLUSPLUS
711  AC_TRY_RUN([
712    #define HAVE_POSIX_SHM
713    #include "vm_alloc.cpp"
714    int main(void) { /* returns 0 if we have working POSIX shm */
715      if (vm_init() < 0) exit(2);
716      char *m1 = (char *)vm_acquire(32768, VM_MAP_DEFAULT | VM_MAP_33BIT);
717      if (m1 == VM_MAP_FAILED) exit(3);
718      vm_exit(); exit(0);
719    }
720  ], ac_cv_have_posix_shm=yes, ac_cv_have_posix_shm=no,
721  dnl When cross-compiling, do not assume anything.
722  ac_cv_have_posix_shm="guessing no"
723  )
724  AC_LANG_RESTORE
725  ]
726 )
727 AC_TRANSLATE_DEFINE(HAVE_POSIX_SHM, "$ac_cv_have_posix_shm",
728  [Define if your system supports POSIX shared memory.])
729
730 dnl Check if we have working 33-bit memory addressing
731 AC_CACHE_CHECK([whether 33-bit memory addressing is working],
732  ac_cv_have_33bit_addressing, [
733  AC_LANG_SAVE
734  AC_LANG_CPLUSPLUS
735  AC_TRY_RUN([
736    #define USE_33BIT_ADDRESSING 1
737    #include "vm_alloc.cpp"
738    int main(void) { /* returns 0 if we have working 33-bit addressing */
739      if (sizeof(void *) < 8) exit(1);
740      if (vm_init() < 0) exit(2);
741      char *m1 = (char *)vm_acquire(32768, VM_MAP_DEFAULT | VM_MAP_33BIT);
742      if (m1 == VM_MAP_FAILED) exit(3);
743      char *m2 = m1 + (1L << 32);
744      m1[0] = 0x12; if (m2[0] != 0x12) exit(4);
745      m2[0] = 0x34; if (m1[0] != 0x34) exit(5);
746      vm_exit(); exit(0);
747    }
748  ], ac_cv_have_33bit_addressing=yes, ac_cv_have_33bit_addressing=no,
749  dnl When cross-compiling, do not assume anything.
750  ac_cv_have_33bit_addressing="guessing no"
751  )
752  AC_LANG_RESTORE
753  ]
754 )
755
948   dnl Check signal handlers need to be reinstalled
949   AC_CACHE_CHECK([whether signal handlers need to be reinstalled],
950    ac_cv_signal_need_reinstall, [
# Line 820 | Line 1012 | AC_CACHE_CHECK([whether your system supp
1012    AC_LANG_SAVE
1013    AC_LANG_CPLUSPLUS
1014    AC_TRY_RUN([
1015 +    #define HAVE_MACH_VM 1
1016 +    #define HAVE_MACH_TASK_SELF 1
1017      #define HAVE_MACH_EXCEPTIONS 1
1018      #define CONFIGURE_TEST_SIGSEGV_RECOVERY
1019      #include "vm_alloc.cpp"
# Line 838 | Line 1032 | AC_CACHE_CHECK([whether your system supp
1032   AC_TRANSLATE_DEFINE(HAVE_MACH_EXCEPTIONS, "$ac_cv_have_mach_exceptions",
1033    [Define if your system supports Mach exceptions.])
1034  
1035 + dnl Check if Windows exceptions are supported.
1036 + AC_CACHE_CHECK([whether your system supports Windows exceptions],
1037 +  ac_cv_have_win32_exceptions, [
1038 +  AC_LANG_SAVE
1039 +  AC_LANG_CPLUSPLUS
1040 +  AC_TRY_RUN([
1041 +    #define HAVE_WIN32_EXCEPTIONS 1
1042 +    #define CONFIGURE_TEST_SIGSEGV_RECOVERY
1043 +    #include "vm_alloc.cpp"
1044 +    #include "sigsegv.cpp"
1045 +  ], [
1046 +  sigsegv_recovery=win32
1047 +  ac_cv_have_win32_exceptions=yes
1048 +  ],
1049 +  ac_cv_have_win32_exceptions=no,
1050 +  dnl When cross-compiling, do not assume anything.
1051 +  ac_cv_have_win32_exceptions=no
1052 +  )
1053 +  AC_LANG_RESTORE
1054 +  ]
1055 + )
1056 + AC_TRANSLATE_DEFINE(HAVE_WIN32_EXCEPTIONS, "$ac_cv_have_win32_exceptions",
1057 +  [Define if your system supports Windows exceptions.])
1058 +
1059   dnl Otherwise, check if extended signals are supported.
1060   if [[ -z "$sigsegv_recovery" ]]; then
1061    AC_CACHE_CHECK([whether your system supports extended signal handlers],
# Line 918 | Line 1136 | fi
1136   dnl A dummy program that returns always true
1137   AC_PATH_PROG([BLESS], "true")
1138  
1139 + dnl Check for linker script support
1140 + case $target_os:$target_cpu in
1141 + linux*:i?86)    LINKER_SCRIPT_FLAGS="-Wl,-T,ldscripts/linux-i386.ld";;
1142 + linux*:x86_64)  LINKER_SCRIPT_FLAGS="-Wl,-T,ldscripts/linux-x86_64.ld";;
1143 + linux*:powerpc) LINKER_SCRIPT_FLAGS="-Wl,-T,ldscripts/linux-ppc.ld";;
1144 + netbsd*:i?86)   LINKER_SCRIPT_FLAGS="-Wl,-T,ldscripts/linux-i386.ld";;
1145 + freebsd*:i?86)  LINKER_SCRIPT_FLAGS="-Wl,-T,ldscripts/freebsd-i386.ld";;
1146 + darwin*:*)      LINKER_SCRIPT_FLAGS="-Wl,-seg1addr,0x78048000";;
1147 + esac
1148 + if [[ -n "$LINKER_SCRIPT_FLAGS" ]]; then
1149 +  AC_CACHE_CHECK([whether linker script is usable],
1150 +    ac_cv_linker_script_works, [
1151 +    AC_LANG_SAVE
1152 +    AC_LANG_CPLUSPLUS
1153 +    saved_LDFLAGS="$LDFLAGS"
1154 +    LDFLAGS="$LDFLAGS $LINKER_SCRIPT_FLAGS"
1155 +    AC_TRY_RUN(
1156 +      [int main() {if ((char *)&main < (char *)0x70000000) return 1;}],
1157 +      [ac_cv_linker_script_works=yes],
1158 +      [ac_cv_linker_script_works=no],
1159 +      dnl When cross-compiling, assume it works
1160 +      [ac_cv_linker_script_works="guessing yes"]
1161 +    )
1162 +    AC_LANG_RESTORE
1163 +    if [[ "$ac_cv_linker_script_works" = "no" ]]; then
1164 +      LDFLAGS="$saved_LDFLAGS"
1165 +      LINKER_SCRIPT_FLAGS=""
1166 +    fi
1167 +  ])
1168 + fi
1169 + AC_TRANSLATE_DEFINE(HAVE_LINKER_SCRIPT, "$ac_cv_linker_script_works",
1170 +  [Define if there is a linker script to relocate the executable above 0x70000000.])
1171 +
1172   dnl Determine the addressing mode to use
1173   if [[ "x$WANT_NATIVE_M68K" = "xyes" ]]; then
1174    ADDRESSING_MODE="real"
# Line 995 | Line 1246 | AC_MSG_RESULT($HAVE_GAS)
1246   dnl Check for GCC 2.7 or higher.
1247   HAVE_GCC27=no
1248   AC_MSG_CHECKING(for GCC 2.7 or higher)
1249 < AC_EGREP_CPP(xyes,
1250 < [#if __GNUC__ - 1 > 1 || __GNUC_MINOR__ - 1 > 5
1251 <  xyes
1252 < #endif
1253 < ], [AC_MSG_RESULT(yes); HAVE_GCC27=yes], AC_MSG_RESULT(no))
1249 > AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#if ! (__GNUC__ - 1 > 1 || __GNUC_MINOR__ - 1 > 5)
1250 >                                     # error gcc < 2.7
1251 >                                     #endif
1252 >                                   ]])],
1253 >                  [AC_MSG_RESULT(yes); HAVE_GCC27=yes],
1254 >                  [AC_MSG_RESULT(no)])
1255  
1256   dnl Check for GCC 3.0 or higher.
1257   HAVE_GCC30=no
1258   AC_MSG_CHECKING(for GCC 3.0 or higher)
1259 < AC_EGREP_CPP(xyes,
1260 < [#if __GNUC__ >= 3
1261 <  xyes
1262 < #endif
1263 < ], [AC_MSG_RESULT(yes); HAVE_GCC30=yes], AC_MSG_RESULT(no))
1259 > AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#if ! (__GNUC__ >= 3)
1260 >                                     # error gcc < 3
1261 >                                     #endif
1262 >                                   ]])],
1263 >                  [AC_MSG_RESULT(yes); HAVE_GCC30=yes],
1264 >                  [AC_MSG_RESULT(no)])
1265 >
1266 > dnl Check for ICC.
1267 > AC_MSG_CHECKING(for ICC)
1268 > HAVE_ICC=no
1269 > if $CXX -V -v 2>&1 | grep -q "Intel(R) C++ Compiler"; then
1270 >  HAVE_ICC=yes
1271 > fi
1272 > AC_MSG_RESULT($HAVE_ICC)
1273  
1274   dnl Set "-fomit-frame-pointer" on i386 GCC 2.7 or higher.
1275   dnl Also set "-fno-exceptions" for C++ because exception handling requires
# Line 1023 | Line 1284 | dnl As of 2001/08/02, this affects the f
1284   dnl Official: probably gcc-3.1 (mainline CVS)
1285   dnl Mandrake: gcc-2.96 >= 0.59mdk, gcc-3.0.1 >= 0.1mdk
1286   dnl Red Hat : gcc-2.96 >= 89, gcc-3.0 >= 1
1287 < if [[ "x$HAVE_GCC27" = "xyes" ]]; then
1287 > if [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_ICC" = "xno" ]]; then
1288    SAVED_CXXFLAGS="$CXXFLAGS"
1289    CXXFLAGS="$CXXFLAGS -fno-merge-constants"
1290    AC_CACHE_CHECK([whether GCC supports constants merging], ac_cv_gcc_constants_merging, [
# Line 1039 | Line 1300 | fi
1300  
1301   dnl Store motion was introduced in 3.3-hammer branch and any gcc >= 3.4
1302   dnl However, there are some corner cases exposed on x86-64
1303 < if [[ "x$HAVE_GCC27" = "xyes" ]]; then
1303 > if [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_ICC" = "xno" ]]; then
1304    SAVED_CXXFLAGS="$CXXFLAGS"
1305    CXXFLAGS="$CXXFLAGS -fno-gcse-sm"
1306    AC_CACHE_CHECK([whether GCC supports store motion], ac_cv_gcc_store_motion, [
# Line 1053 | Line 1314 | if [[ "x$HAVE_GCC27" = "xyes" ]]; then
1314    fi
1315   fi
1316  
1317 + dnl Add -fno-strict-aliasing for slirp sources
1318 + if [[ "x$HAVE_GCC30" = "xyes" ]]; then
1319 +  SAVED_CFLAGS="$CFLAGS"
1320 +  CFLAGS="$CFLAGS -fno-strict-aliasing"
1321 +  AC_CACHE_CHECK([whether the compiler supports -fno-strict-aliasing],
1322 +    ac_cv_gcc_no_strict_aliasing, [
1323 +    AC_TRY_COMPILE([],[],
1324 +      [ac_cv_gcc_no_strict_aliasing=yes; AC_SUBST(SLIRP_CFLAGS, "-fno-strict-aliasing")],
1325 +      [ac_cv_gcc_no_strict_aliasing=no])
1326 +  ])
1327 +  CFLAGS="$SAVED_CFLAGS"
1328 + fi
1329 +
1330 + dnl Add -mdynamic-no-pic for MacOS X (XXX icc10 will support MacOS X)
1331 + if [[ "x$HAVE_GCC30" = "xyes" -a "x$HAVE_ICC" = "xno" ]]; then
1332 +  SAVED_CFLAGS="$CFLAGS"
1333 +  CFLAGS="$CFLAGS -mdynamic-no-pic"
1334 +  AC_CACHE_CHECK([whether the compiler supports -mdynamic-no-pic],
1335 +    ac_cv_gcc_mdynamic_no_pic, [
1336 +    AC_TRY_COMPILE([],[],[ac_cv_gcc_mdynamic_no_pic=yes],[ac_cv_gcc_mdynamic_no_pic=no])
1337 +  ])
1338 +  if [[ "x$ac_cv_gcc_mdynamic_no_pic" = "xyes" ]]; then
1339 +    CXXFLAGS="$CXXFLAGS -mdynamic-no-pic"
1340 +  else
1341 +    CFLAGS="$SAVED_CFLAGS"
1342 +  fi
1343 + fi
1344 +
1345   dnl Select appropriate CPU source and REGPARAM define.
1346   ASM_OPTIMIZATIONS=none
1347   CPUSRCS="cpuemu1.cpp cpuemu2.cpp cpuemu3.cpp cpuemu4.cpp cpuemu5.cpp cpuemu6.cpp cpuemu7.cpp cpuemu8.cpp"
# Line 1067 | Line 1356 | if [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE
1356    DEFINES="$DEFINES -DUNALIGNED_PROFITABLE -DREGPARAM=\"__attribute__((regparm(3)))\""
1357    if [[ "x$HAVE_GAS" = "xyes" ]]; then
1358      ASM_OPTIMIZATIONS=i386
1359 <    DEFINES="$DEFINES -DX86_ASSEMBLY -DOPTIMIZED_FLAGS -DSAHF_SETO_PROFITABLE"
1359 >    DEFINES="-m32 $DEFINES -DX86_ASSEMBLY -DOPTIMIZED_FLAGS -DSAHF_SETO_PROFITABLE"
1360      JITSRCS="cpuemu1_nf.cpp cpuemu2_nf.cpp cpuemu3_nf.cpp cpuemu4_nf.cpp cpuemu5_nf.cpp cpuemu6_nf.cpp cpuemu7_nf.cpp cpuemu8_nf.cpp $JITSRCS"
1361      CAN_JIT=yes
1362    fi
# Line 1076 | Line 1365 | elif [[ "x$HAVE_GCC30" = "xyes" -a "x$HA
1365    DEFINES="$DEFINES -DUNALIGNED_PROFITABLE"
1366    if [[ "x$HAVE_GAS" = "xyes" ]]; then
1367      ASM_OPTIMIZATIONS="x86-64"
1368 <    DEFINES="$DEFINES -DX86_64_ASSEMBLY -DOPTIMIZED_FLAGS"
1368 >    DEFINES="-m64 $DEFINES -DX86_64_ASSEMBLY -DOPTIMIZED_FLAGS"
1369      JITSRCS="cpuemu1_nf.cpp cpuemu2_nf.cpp cpuemu3_nf.cpp cpuemu4_nf.cpp cpuemu5_nf.cpp cpuemu6_nf.cpp cpuemu7_nf.cpp cpuemu8_nf.cpp $JITSRCS"
1370      CAN_JIT=yes
1082    WANT_33BIT_ADDRESSING=yes
1371    fi
1372   elif [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_SPARC" = "xyes" -a "x$HAVE_GAS" = "xyes" ]]; then
1373    dnl SPARC CPU
# Line 1136 | Line 1424 | else
1424    JITSRCS=""
1425   fi
1426  
1139 dnl Use 33-bit memory addressing?
1140 if [[ "$ac_cv_have_33bit_addressing:$WANT_33BIT_ADDRESSING" = "yes:yes" ]]; then
1141  use_33bit_addressing=yes
1142 fi
1143 AC_TRANSLATE_DEFINE(USE_33BIT_ADDRESSING, "$use_33bit_addressing",
1144  [Define to use 33-bit memory addressing on 64-bit JIT capable systems.])
1145
1427   dnl Utility macro used by next two tests.
1428   dnl AC_EXAMINE_OBJECT(C source code,
1429   dnl     commands examining object file,

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines