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.21 by gbeauche, 2003-10-12T15:56:00Z vs.
Revision 1.68 by gbeauche, 2006-04-19T06:55:54Z

# Line 7 | Line 7 | AC_PREREQ(2.52)
7   AC_CONFIG_HEADER(config.h)
8  
9   dnl Aliases for PACKAGE and VERSION macros.
10 < AC_DEFINE(PACKAGE, PACKAGE_NAME, [Alias to PACKAGE for i18n.])
11 < AC_DEFINE(VERSION, PACKAGE_VERSION, [Alias to VERSION for i18n.])
10 > AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE_NAME", [Define this program name.])
11 > AC_DEFINE_UNQUOTED(VERSION, "$PACKAGE_VERSION", [Define this program version.])
12  
13   dnl Some systems do not put corefiles in the currect directory, avoid saving
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])
22   AC_ARG_ENABLE(fbdev-dga,     [  --enable-fbdev-dga      use direct frame buffer access via /dev/fb [default=yes]], [WANT_FBDEV_DGA=$enableval], [WANT_FBDEV_DGA=yes])
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 +
30   dnl JIT compiler options.
31   AC_ARG_ENABLE(jit-compiler,  [  --enable-jit-compiler   enable JIT compiler [default=no]], [WANT_JIT=$enableval], [WANT_JIT=no])
32   AC_ARG_ENABLE(jit-debug,     [  --enable-jit-debug      activate native code disassemblers [default=no]], [WANT_JIT_DEBUG=$enableval], [WANT_JIT_DEBUG=no])
# Line 55 | Line 62 | AC_ARG_ENABLE(addressing,
62  
63   dnl External packages.
64   AC_ARG_WITH(esd,             [  --with-esd              support ESD for sound under Linux/FreeBSD [default=yes]], [WANT_ESD=$withval], [WANT_ESD=yes])
65 < AC_ARG_WITH(gtk,             [  --with-gtk              use GTK user interface [default=yes]], [WANT_GTK=$withval], [WANT_GTK=yes])
65 > AC_ARG_WITH(gtk,             [  --with-gtk              use GTK user interface [default=yes]],
66 >  [case "$withval" in
67 >   gtk1)      WANT_GTK="gtk";;
68 >   gtk|gtk2)  WANT_GTK="$withval";;
69 >   yes)       WANT_GTK="gtk2 gtk";;
70 >   *)         WANT_GTK="no";;
71 >   esac],
72 >  [WANT_GTK="gtk2 gtk"])
73   AC_ARG_WITH(mon,             [  --with-mon              use mon as debugger [default=yes]], [WANT_MON=$withval], [WANT_MON=yes])
74  
75   dnl Canonical system information.
# Line 94 | Line 108 | AC_PROG_CPP
108   AC_PROG_CXX
109   AC_PROG_MAKE_SET
110   AC_PROG_INSTALL
111 + AC_PROG_EGREP
112  
113   dnl We use mon if possible.
114   MONSRCS=
# Line 122 | Line 137 | fi
137   dnl Checks for libraries.
138   AC_CHECK_LIB(posix4, sem_init)
139   AC_CHECK_LIB(rt, timer_create)
140 + AC_CHECK_LIB(rt, shm_open)
141 + AC_CHECK_LIB(m, cos)
142 +
143 + dnl Do we need SDL?
144 + WANT_SDL=no
145 + if [[ "x$WANT_SDL_VIDEO" = "xyes" ]]; then
146 +  WANT_SDL=yes
147 +  WANT_XF86_DGA=no
148 +  WANT_XF86_VIDMODE=no
149 +  WANT_FBDEV_DGA=no
150 +  SDL_SUPPORT="$SDL_SUPPORT video"
151 + fi
152 + if [[ "x$WANT_SDL_AUDIO" = "xyes" ]]; then
153 +  WANT_SDL=yes
154 +  SDL_SUPPORT="$SDL_SUPPORT audio"
155 + fi
156 + if [[ "x$WANT_SDL" = "xyes" ]]; then
157 +  AC_PATH_PROG(sdl_config, "sdl-config")
158 +  if [[ -n "$sdl_config" ]]; then
159 +    case $target_os in
160 +    # Special treatment for Cygwin so that we can still use the POSIX layer
161 +    *cygwin*)
162 +      sdl_cflags="-I`$sdl_config --prefix`/include/SDL"
163 +      sdl_libs="-L`$sdl_config --exec-prefix`/lib -lSDL"
164 +      ;;
165 +    *)
166 +      sdl_cflags=`$sdl_config --cflags`
167 +      if [[ "x$WANT_SDL_STATIC" = "xyes" ]]; then
168 +        sdl_libs=`$sdl_config --static-libs`
169 +      else
170 +        sdl_libs=`$sdl_config --libs`
171 +      fi
172 +      ;;
173 +    esac
174 +    CFLAGS="$CFLAGS $sdl_cflags"
175 +    CXXFLAGS="$CXXFLAGS $sdl_cflags"
176 +    LIBS="$LIBS $sdl_libs"
177 +  else
178 +    WANT_SDL=no
179 +  fi
180 +  SDL_SUPPORT=`echo "$SDL_SUPPORT" | sed -e "s/^ //"`
181 + else
182 +  SDL_SUPPORT="none"
183 + fi
184  
185 < dnl We need X11.
186 < AC_PATH_XTRA
187 < if [[ "x$no_x" = "xyes" ]]; then
188 <  AC_MSG_ERROR([You need X11 to run Basilisk II.])
189 < fi
190 < CFLAGS="$CFLAGS $X_CFLAGS"
191 < CXXFLAGS="$CXXFLAGS $X_CFLAGS"
192 < LIBS="$LIBS $X_PRE_LIBS $X_LIBS -lX11 -lXext $X_EXTRA_LIBS"
185 > dnl We need X11, if not using SDL.
186 > if [[ "x$WANT_SDL" = "xno" ]]; then
187 >  AC_PATH_XTRA
188 >  if [[ "x$no_x" = "xyes" ]]; then
189 >    AC_MSG_ERROR([You need X11 to run Basilisk II.])
190 >  fi
191 >  CFLAGS="$CFLAGS $X_CFLAGS"
192 >  CXXFLAGS="$CXXFLAGS $X_CFLAGS"
193 >  LIBS="$LIBS $X_PRE_LIBS $X_LIBS -lX11 -lXext $X_EXTRA_LIBS"
194 > fi
195  
196   dnl We want pthreads. Try libpthread first, then libc_r (FreeBSD), then PTL.
197   HAVE_PTHREADS=yes
# Line 144 | Line 205 | AC_CHECK_LIB(pthread, pthread_create, ,
205   if [[ "x$HAVE_PTHREADS" = "xyes" ]]; then
206    AC_DEFINE(HAVE_PTHREADS, 1, [Define if pthreads are available.])
207   fi
208 < AC_CHECK_FUNCS(pthread_cancel)
208 > AC_CHECK_FUNCS(pthread_cond_init)
209 > AC_CHECK_FUNCS(pthread_cancel pthread_testcancel)
210   AC_CHECK_FUNCS(pthread_mutexattr_setprotocol)
211   AC_CHECK_FUNCS(pthread_mutexattr_settype)
212   AC_CHECK_FUNCS(pthread_mutexattr_setpshared)
# Line 188 | Line 250 | fi
250  
251   dnl We use GTK+ if possible.
252   UISRCS=../dummy/prefs_editor_dummy.cpp
253 < if [[ "x$WANT_GTK" = "xyes" ]]; then
253 > case "x$WANT_GTK" in
254 > xgtk2*)
255 >  AM_PATH_GTK_2_0(1.3.15, [
256 >    AC_DEFINE(ENABLE_GTK, 1, [Define if using GTK.])
257 >    GUI_CFLAGS="$GTK_CFLAGS"
258 >    GUI_LIBS="$GTK_LIBS"
259 >    UISRCS=prefs_editor_gtk.cpp
260 >    WANT_GTK=gtk2
261 >  ], [
262 >    case "x${WANT_GTK}x" in
263 >    *gtkx)
264 >      AC_MSG_WARN([Could not find GTK+ 2.0, trying with GTK+ 1.2.])
265 >      WANT_GTK=gtk
266 >      ;;
267 >    *)
268 >      AC_MSG_WARN([Could not find GTK+, disabling user interface.])
269 >      WANT_GTK=no
270 >      ;;
271 >    esac
272 >  ])
273 >  ;;
274 > esac
275 > if [[ "x$WANT_GTK" = "xgtk" ]]; then
276    AM_PATH_GTK(1.2.0, [
277      AC_DEFINE(ENABLE_GTK, 1, [Define if using GTK.])
278 <    CXXFLAGS="$CXXFLAGS $GTK_CFLAGS"
279 <    LIBS="$LIBS $GTK_LIBS"
278 >    GUI_CFLAGS="$GTK_CFLAGS"
279 >    GUI_LIBS="$GTK_LIBS"
280      UISRCS=prefs_editor_gtk.cpp
281      dnl somehow, <gnome-i18n.h> would redefine gettext() to nothing if
282      dnl ENABLE_NLS is not set, thusly conflicting with C++ <string> which
# Line 200 | Line 284 | if [[ "x$WANT_GTK" = "xyes" ]]; then
284      AM_GNU_GETTEXT
285      B2_PATH_GNOMEUI([
286        AC_DEFINE(HAVE_GNOMEUI, 1, [Define if libgnomeui is available.])
287 <      CXXFLAGS="$CXXFLAGS $GNOMEUI_CFLAGS"
288 <      LIBS="$LIBS $GNOMEUI_LIBS"
287 >      GUI_CFLAGS="$GUI_CFLAGS $GNOMEUI_CFLAGS"
288 >      GUI_LIBS="$GUI_LIBS $GNOMEUI_LIBS"
289      ], [])
290    ], [
291      AC_MSG_WARN([Could not find GTK+, disabling user interface.])
292      WANT_GTK=no
293    ])
294   fi
295 + AC_SUBST(GUI_CFLAGS)
296 + AC_SUBST(GUI_LIBS)
297 +
298 + dnl Build external GUI if requested.
299 + if [[ "$WANT_STANDALONE_GUI" != "yes" ]]; then
300 +  WANT_STANDALONE_GUI=no
301 + fi
302 + if [[ "$WANT_GTK" = "no" ]]; then
303 +  WANT_STANDALONE_GUI=no
304 + fi
305 + AC_SUBST(STANDALONE_GUI, [$WANT_STANDALONE_GUI])
306  
307   dnl We use ESD if possible.
308   if [[ "x$WANT_ESD" = "xyes" ]]; then
# Line 227 | Line 322 | AC_SYS_LARGEFILE
322  
323   dnl Checks for header files.
324   AC_HEADER_STDC
325 < AC_CHECK_HEADERS(unistd.h fcntl.h sys/time.h sys/mman.h mach/mach.h)
325 > AC_CHECK_HEADERS(stdlib.h stdint.h)
326 > AC_CHECK_HEADERS(unistd.h fcntl.h sys/types.h sys/time.h sys/mman.h mach/mach.h)
327   AC_CHECK_HEADERS(readline.h history.h readline/readline.h readline/history.h)
328 + AC_CHECK_HEADERS(sys/socket.h sys/ioctl.h sys/filio.h sys/bitypes.h sys/wait.h)
329 + AC_CHECK_HEADERS(sys/poll.h sys/select.h)
330 + AC_CHECK_HEADERS(arpa/inet.h)
331 + AC_CHECK_HEADERS(linux/if.h linux/if_tun.h net/if.h net/if_tun.h, [], [], [
332 + #ifdef HAVE_SYS_TYPES_H
333 + #include <sys/types.h>
334 + #endif
335 + #ifdef HAVE_SYS_SOCKET_H
336 + #include <sys/socket.h>
337 + #endif
338 + ])
339 + AC_CHECK_HEADERS(AvailabilityMacros.h)
340 + AC_CHECK_HEADERS(IOKit/storage/IOBlockStorageDevice.h)
341  
342   dnl Checks for typedefs, structures, and compiler characteristics.
343   AC_C_BIGENDIAN
# Line 243 | Line 352 | AC_CHECK_SIZEOF(double, 8)
352   AC_CHECK_SIZEOF(long double, 12)
353   AC_CHECK_SIZEOF(void *, 4)
354   AC_TYPE_OFF_T
355 < AC_CHECK_TYPE(loff_t, off_t)
356 < AC_CHECK_TYPE(caddr_t, [char *])
355 > AC_CHECK_TYPES(loff_t)
356 > AC_CHECK_TYPES(caddr_t)
357   AC_TYPE_SIZE_T
358   AC_TYPE_SIGNAL
359   AC_HEADER_TIME
# Line 268 | Line 377 | if [[ "x$ac_cv_type_socklen_t" != "xyes"
377   fi
378  
379   dnl Checks for library functions.
380 < AC_CHECK_FUNCS(strdup cfmakeraw)
380 > AC_CHECK_FUNCS(strdup strerror cfmakeraw)
381   AC_CHECK_FUNCS(clock_gettime timer_create)
382   AC_CHECK_FUNCS(sigaction signal)
383   AC_CHECK_FUNCS(mmap mprotect munmap)
384   AC_CHECK_FUNCS(vm_allocate vm_deallocate vm_protect)
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 299 | Line 409 | mips-sony-bsd|mips-sony-newsos4)
409   *-*-sco3.2v5*)
410          no_dev_ptmx=1
411          ;;
412 + *-*-cygwin*)
413 +        no_dev_ptmx=1
414 +        ;;
415   esac
416  
417   if test -z "$no_dev_ptmx" ; then
# Line 321 | Line 434 | AC_CHECK_FILE([/dev/ptc],
434   dnl (end of code from openssh-3.2.2p1 configure.ac)
435  
436  
437 + dnl Check for systems where POSIX-style non-blocking I/O (O_NONBLOCK)
438 + dnl doesn't work or is unimplemented. On these systems (mostly older
439 + dnl ones), use the old BSD-style FIONBIO approach instead. [tcl.m4]
440 + AC_CACHE_CHECK([FIONBIO vs. O_NONBLOCK for non-blocking I/O],
441 +  ac_cv_nonblocking_io, [
442 +  case "$host" in
443 +  *-*-osf*)
444 +    ac_cv_nonblocking_io=FIONBIO
445 +    ;;
446 +  *-*-sunos4*)
447 +    ac_cv_nonblocking_io=FIONBIO
448 +    ;;
449 +  *-*-ultrix*)
450 +    ac_cv_nonblocking_io=FIONBIO
451 +    ;;
452 +  *)
453 +    ac_cv_nonblocking_io=O_NONBLOCK
454 +    ;;
455 +  esac
456 + ])
457 + if [[ "$ac_cv_nonblocking_io" = "FIONBIO" ]]; then
458 +  AC_DEFINE(USE_FIONBIO, 1, [Define if BSD-style non-blocking I/O is to be used])
459 + fi
460 +
461 + dnl Check whether compiler supports byte bit-fields
462 + AC_CACHE_CHECK([whether compiler supports byte bit-fields],
463 +  ac_cv_have_byte_bitfields, [
464 +  AC_LANG_SAVE
465 +  AC_LANG_CPLUSPLUS
466 +  AC_TRY_RUN([
467 +    struct A {
468 +      unsigned char b1:4;
469 +      unsigned char b2:4;
470 +      unsigned char c;
471 +      unsigned short s;
472 +      unsigned char a[4];
473 +    };
474 +
475 +    int main(void) {
476 +      A a;
477 +      return ! (sizeof(A) == 8 && &a.c == ((unsigned char *)&a + 1));
478 +    }],
479 +    [ac_cv_have_byte_bitfields=yes],
480 +    [ac_cv_have_byte_bitfields=no],
481 +    dnl When cross-compiling, assume only GCC supports this
482 +    [if [[ "$GCC" = "yes" ]]; then
483 +      ac_cv_have_byte_bitfields="guessing yes"
484 +    else
485 +      ac_cv_have_byte_bitfields="guessing no"
486 +    fi]
487 +    )
488 +  AC_LANG_RESTORE
489 + ])
490 +
491 + dnl AC_CHECK_FRAMEWORK($1=NAME, $2=INCLUDES)
492 + AC_DEFUN([AC_CHECK_FRAMEWORK], [
493 +  AS_VAR_PUSHDEF([ac_Framework], [ac_cv_framework_$1])dnl
494 +  AC_CACHE_CHECK([whether compiler supports framework $1],
495 +    ac_Framework, [
496 +    saved_LIBS="$LIBS"
497 +    LIBS="$LIBS -framework $1"
498 +    AC_TRY_LINK(
499 +      [$2], [],
500 +      [AS_VAR_SET(ac_Framework, yes)], [AS_VAR_SET(ac_Framework, no); LIBS="$saved_LIBS"]
501 +    )
502 +  ])
503 +  AS_IF([test AS_VAR_GET(ac_Framework) = yes],
504 +    [AC_DEFINE(AS_TR_CPP(HAVE_FRAMEWORK_$1), 1, [Define if framework $1 is available.])]
505 +  )
506 +  AS_VAR_POPDEF([ac_Framework])dnl
507 + ])
508 +
509 + dnl Check for some MacOS X frameworks
510 + AC_CHECK_FRAMEWORK(AppKit, [])
511 + AC_CHECK_FRAMEWORK(Carbon, [#include <Carbon/Carbon.h>])
512 + AC_CHECK_FRAMEWORK(IOKit, [#include <IOKit/IOKitLib.h>])
513 + AC_CHECK_FRAMEWORK(CoreFoundation, [#include <CoreFoundation/CoreFoundation.h>])
514 +
515   dnl Select system-dependant source files.
516   SERIALSRC=serial_unix.cpp
517   ETHERSRC=../dummy/ether_dummy.cpp
518   SCSISRC=../dummy/scsi_dummy.cpp
519   AUDIOSRC=../dummy/audio_dummy.cpp
520 + EXTFSSRC=extfs_unix.cpp
521   EXTRASYSSRCS=
522   CAN_NATIVE_M68K=no
523   case "$target_os" in
# Line 359 | Line 551 | freebsd*)
551    ;;
552   netbsd*)
553    CAN_NATIVE_M68K=yes
554 +  ETHERSRC=ether_unix.cpp
555    ;;
556   solaris*)
557    AUDIOSRC=Solaris/audio_solaris.cpp
558    DEFINES="$DEFINES -DBSD_COMP -D_POSIX_PTHREAD_SEMANTICS"
559    ;;
560   irix*)
368  ETHERSRC=ether_unix.cpp
561    AUDIOSRC=Irix/audio_irix.cpp
562    EXTRASYSSRCS=Irix/unaligned.c
371  dnl IRIX headers work fine, but somehow don't define or use "STDC_HEADERS"
372  DEFINES="$DEFINES -DCRTSCTS=CNEW_RTSCTS -DB230400=B115200 -DSTDC_HEADERS"
563    LIBS="$LIBS -laudio"
564    WANT_ESD=no
565  
# Line 379 | Line 569 | irix*)
569    CFLAGS=`echo "$CFLAGS -IPA" | sed -e "s/-g//g"`
570    AC_MSG_CHECKING(if "-IPA" works)
571    dnl Do a test compile of an empty function
572 <  AC_TRY_COMPILE(,, [AC_MSG_RESULT(yes); HAVE_IPA=yes], AC_MSG_RESULT(no))
572 >  AC_TRY_COMPILE([#if defined __GNUC__
573 >                  # error GCC does not support IPA yet
574 >                  #endif],, [AC_MSG_RESULT(yes); HAVE_IPA=yes], AC_MSG_RESULT(no))
575    CFLAGS="$ocflags"
576 +  ;;
577 + darwin*)
578 +  ETHERSRC=ether_unix.cpp
579 +  if [[ "x$ac_cv_framework_IOKit" = "xyes" -a "x$ac_cv_framework_CoreFoundation" = "xyes" ]]; then
580 +    EXTRASYSSRCS="../MacOSX/sys_darwin.cpp"
581 +  fi
582 +  if [[ "x$ac_cv_framework_Carbon" = "xyes" ]]; then
583 +    EXTFSSRC=../MacOSX/extfs_macosx.mm
584 +  fi
585 +  ;;
586 + cygwin*)
587 +  SERIALSRC="../dummy/serial_dummy.cpp"
588 +  EXTRASYSSRCS="../Windows/BasiliskII.rc"
589 +  ;;
590 + esac
591  
592 + dnl Is the slirp library supported?
593 + case "$ac_cv_have_byte_bitfields" in
594 + yes|"guessing yes")
595 +  CAN_SLIRP=yes
596 +  ETHERSRC=ether_unix.cpp
597    ;;
598   esac
599 + if [[ -n "$CAN_SLIRP" ]]; then
600 +  AC_DEFINE(HAVE_SLIRP, 1, [Define if slirp library is supported])
601 +  SLIRP_SRCS="\
602 +    ../slirp/bootp.c     ../slirp/ip_output.c  ../slirp/tcp_input.c  \
603 +    ../slirp/cksum.c     ../slirp/mbuf.c       ../slirp/tcp_output.c \
604 +    ../slirp/debug.c     ../slirp/misc.c       ../slirp/tcp_subr.c   \
605 +    ../slirp/if.c        ../slirp/sbuf.c       ../slirp/tcp_timer.c  \
606 +    ../slirp/ip_icmp.c   ../slirp/slirp.c      ../slirp/tftp.c       \
607 +    ../slirp/ip_input.c  ../slirp/socket.c     ../slirp/udp.c"
608 + fi
609 + AC_SUBST(SLIRP_SRCS)
610 +
611 + dnl SDL overrides
612 + if [[ "x$WANT_SDL" = "xyes" ]]; then
613 +  AC_DEFINE(USE_SDL, 1, [Define to enble SDL support])
614 + fi
615 + if [[ "x$WANT_SDL_VIDEO" = "xyes" ]]; then
616 +  AC_DEFINE(USE_SDL_VIDEO, 1, [Define to enable SDL video graphics support])
617 +  VIDEOSRCS="../SDL/video_sdl.cpp"
618 +  KEYCODES="../SDL/keycodes"
619 +  if [[ "x$ac_cv_framework_Carbon" = "xyes" ]]; then
620 +    EXTRASYSSRCS="$EXTRASYSSRCS ../MacOSX/clip_macosx.cpp"
621 +  else
622 +    case "$target_os" in
623 +    cygwin*)
624 +      EXTRASYSSRCS="$EXTRASYSSRCS ../Windows/clip_windows.cpp"
625 +      ;;
626 +    *)
627 +      EXTRASYSSRCS="$EXTRASYSSRCS ../dummy/clip_dummy.cpp"
628 +      ;;
629 +    esac
630 +  fi
631 + else
632 +  VIDEOSRCS="video_x.cpp"
633 +  KEYCODES="keycodes"
634 +  EXTRASYSSRCS="$EXTRASYSSRCS clip_unix.cpp"
635 + fi
636 + if [[ "x$WANT_SDL_AUDIO" = "xyes" ]]; then
637 +  AC_DEFINE(USE_SDL_AUDIO, 1, [Define to enable SDL audio support])
638 +  AUDIOSRC="../SDL/audio_sdl.cpp"
639 + fi
640  
641   dnl Use 68k CPU natively?
642   WANT_NATIVE_M68K=no
# Line 399 | Line 652 | if [[ "x$HAVE_PTHREADS" = "xno" ]]; then
652    ETHERSRC=../dummy/ether_dummy.cpp
653    AUDIOSRC=../dummy/audio_dummy.cpp
654   fi
655 < SYSSRCS="$SERIALSRC $ETHERSRC $SCSISRC $AUDIOSRC $SEMSRC $UISRCS $MONSRCS $EXTRASYSSRCS"
655 > SYSSRCS="$VIDEOSRCS $EXTFSSRC $SERIALSRC $ETHERSRC $SCSISRC $AUDIOSRC $SEMSRC $UISRCS $MONSRCS $EXTRASYSSRCS"
656  
657   dnl Define a macro that translates a yesno-variable into a C macro definition
658   dnl to be put into the config.h file
659   dnl $1 -- the macro to define
660   dnl $2 -- the value to translate
661   dnl $3 -- template name
662 < AC_DEFUN(AC_TRANSLATE_DEFINE, [
662 > AC_DEFUN([AC_TRANSLATE_DEFINE], [
663      if [[ "x$2" = "xyes" -o "x$2" = "xguessing yes" ]]; then
664          AC_DEFINE($1, 1, $3)
665      fi
666   ])
667  
668 + dnl Check that the host supports TUN/TAP devices
669 + AC_CACHE_CHECK([whether TUN/TAP is supported],
670 +  ac_cv_tun_tap_support, [
671 +  AC_TRY_COMPILE([
672 +    #if defined(HAVE_LINUX_IF_H) && defined(HAVE_LINUX_IF_TUN_H)
673 +    #include <linux/if.h>
674 +    #include <linux/if_tun.h>
675 +    #endif
676 +    #if defined(HAVE_NET_IF_H) && defined(HAVE_NET_IF_TUN_H)
677 +    #include <net/if.h>
678 +    #include <net/if_tun.h>
679 +    #endif
680 +  ], [
681 +    struct ifreq ifr;
682 +    memset(&ifr, 0, sizeof(ifr));
683 +    ifr.ifr_flags = IFF_TAP | IFF_NO_PI;
684 +  ],
685 +  ac_cv_tun_tap_support=yes, ac_cv_tun_tap_support=no
686 +  )
687 + ])
688 + AC_TRANSLATE_DEFINE(ENABLE_TUNTAP, "$ac_cv_tun_tap_support",
689 +  [Define if your system supports TUN/TAP devices.])
690 +
691   dnl Various checks if the system supports vm_allocate() and the like functions.
692   have_mach_vm=no
693   if [[ "x$ac_cv_func_vm_allocate" = "xyes" -a "x$ac_cv_func_vm_deallocate" = "xyes" -a \
# Line 558 | Line 834 | AC_TRANSLATE_DEFINE(HAVE_MMAP_VM, $have_
834  
835   fi dnl HAVE_MMAP_VM
836  
837 + dnl Check if we can modify the __PAGEZERO segment for use as Low Memory
838 + AC_CACHE_CHECK([whether __PAGEZERO can be Low Memory area 0x0000-0x2000],
839 +  ac_cv_pagezero_hack, [
840 +  ac_cv_pagezero_hack=no
841 +  if AC_TRY_COMMAND([Darwin/testlmem.sh 0x2000]); then
842 +    ac_cv_pagezero_hack=yes
843 +    dnl might as well skip the test for mmap-able low memory
844 +    ac_cv_can_map_lm=no
845 +  fi
846 + ])
847 + AC_TRANSLATE_DEFINE(PAGEZERO_HACK, "$ac_cv_pagezero_hack",
848 +  [Define if the __PAGEZERO Mach-O Low Memory Globals hack works on this system.])
849 +
850   dnl Check if we can mmap 0x2000 bytes from 0x0000
851   AC_CACHE_CHECK([whether we can map Low Memory area 0x0000-0x2000],
852    ac_cv_can_map_lm, [
# Line 581 | Line 870 | AC_CACHE_CHECK([whether we can map Low M
870    ]
871   )
872  
873 + dnl Check if we have POSIX shared memory support
874 + AC_CACHE_CHECK([whether POSIX shared memory is working],
875 +  ac_cv_have_posix_shm, [
876 +  AC_LANG_SAVE
877 +  AC_LANG_CPLUSPLUS
878 +  AC_TRY_RUN([
879 +    #define HAVE_POSIX_SHM
880 +    #include "vm_alloc.cpp"
881 +    int main(void) { /* returns 0 if we have working POSIX shm */
882 +      if (vm_init() < 0) exit(2);
883 +      char *m1 = (char *)vm_acquire(32768, VM_MAP_DEFAULT | VM_MAP_33BIT);
884 +      if (m1 == VM_MAP_FAILED) exit(3);
885 +      vm_exit(); exit(0);
886 +    }
887 +  ], ac_cv_have_posix_shm=yes, ac_cv_have_posix_shm=no,
888 +  dnl When cross-compiling, do not assume anything.
889 +  ac_cv_have_posix_shm="guessing no"
890 +  )
891 +  AC_LANG_RESTORE
892 +  ]
893 + )
894 + AC_TRANSLATE_DEFINE(HAVE_POSIX_SHM, "$ac_cv_have_posix_shm",
895 +  [Define if your system supports POSIX shared memory.])
896 +
897 + dnl Check if we have working 33-bit memory addressing
898 + AC_CACHE_CHECK([whether 33-bit memory addressing is working],
899 +  ac_cv_have_33bit_addressing, [
900 +  AC_LANG_SAVE
901 +  AC_LANG_CPLUSPLUS
902 +  AC_TRY_RUN([
903 +    #define USE_33BIT_ADDRESSING 1
904 +    #include "vm_alloc.cpp"
905 +    int main(void) { /* returns 0 if we have working 33-bit addressing */
906 +      if (sizeof(void *) < 8) exit(1);
907 +      if (vm_init() < 0) exit(2);
908 +      char *m1 = (char *)vm_acquire(32768, VM_MAP_DEFAULT | VM_MAP_33BIT);
909 +      if (m1 == VM_MAP_FAILED) exit(3);
910 +      char *m2 = m1 + (1L << 32);
911 +      m1[0] = 0x12; if (m2[0] != 0x12) exit(4);
912 +      m2[0] = 0x34; if (m1[0] != 0x34) exit(5);
913 +      vm_exit(); exit(0);
914 +    }
915 +  ], ac_cv_have_33bit_addressing=yes, ac_cv_have_33bit_addressing=no,
916 +  dnl When cross-compiling, do not assume anything.
917 +  ac_cv_have_33bit_addressing="guessing no"
918 +  )
919 +  AC_LANG_RESTORE
920 +  ]
921 + )
922 +
923   dnl Check signal handlers need to be reinstalled
924   AC_CACHE_CHECK([whether signal handlers need to be reinstalled],
925    ac_cv_signal_need_reinstall, [
# Line 666 | Line 1005 | AC_CACHE_CHECK([whether your system supp
1005   AC_TRANSLATE_DEFINE(HAVE_MACH_EXCEPTIONS, "$ac_cv_have_mach_exceptions",
1006    [Define if your system supports Mach exceptions.])
1007  
1008 + dnl Check if Windows exceptions are supported.
1009 + AC_CACHE_CHECK([whether your system supports Windows exceptions],
1010 +  ac_cv_have_win32_exceptions, [
1011 +  AC_LANG_SAVE
1012 +  AC_LANG_CPLUSPLUS
1013 +  AC_TRY_RUN([
1014 +    #define HAVE_WIN32_EXCEPTIONS 1
1015 +    #define CONFIGURE_TEST_SIGSEGV_RECOVERY
1016 +    #include "vm_alloc.cpp"
1017 +    #include "sigsegv.cpp"
1018 +  ], [
1019 +  sigsegv_recovery=win32
1020 +  ac_cv_have_win32_exceptions=yes
1021 +  ],
1022 +  ac_cv_have_win32_exceptions=no,
1023 +  dnl When cross-compiling, do not assume anything.
1024 +  ac_cv_have_win32_exceptions=no
1025 +  )
1026 +  AC_LANG_RESTORE
1027 +  ]
1028 + )
1029 + AC_TRANSLATE_DEFINE(HAVE_WIN32_EXCEPTIONS, "$ac_cv_have_win32_exceptions",
1030 +  [Define if your system supports Windows exceptions.])
1031 +
1032   dnl Otherwise, check if extended signals are supported.
1033   if [[ -z "$sigsegv_recovery" ]]; then
1034    AC_CACHE_CHECK([whether your system supports extended signal handlers],
# Line 743 | Line 1106 | if [[ -n "$sigsegv_recovery" ]]; then
1106    CAN_VOSF=yes
1107   fi
1108  
1109 + dnl A dummy program that returns always true
1110 + AC_PATH_PROG([BLESS], "true")
1111 +
1112 + dnl Check for linker script support
1113 + case $target_os:$target_cpu in
1114 + linux*:i?86)    LINKER_SCRIPT_FLAGS="-Wl,-T,ldscripts/linux-i386.ld";;
1115 + linux*:x86_64)  LINKER_SCRIPT_FLAGS="-Wl,-T,ldscripts/linux-x86_64.ld";;
1116 + linux*:powerpc) LINKER_SCRIPT_FLAGS="-Wl,-T,ldscripts/linux-ppc.ld";;
1117 + netbsd*:i?86)   LINKER_SCRIPT_FLAGS="-Wl,-T,ldscripts/linux-i386.ld";;
1118 + freebsd*:i?86)  LINKER_SCRIPT_FLAGS="-Wl,-T,ldscripts/freebsd-i386.ld";;
1119 + darwin*:*)      LINKER_SCRIPT_FLAGS="-Wl,-seg1addr,0x78048000";;
1120 + esac
1121 + if [[ -n "$LINKER_SCRIPT_FLAGS" ]]; then
1122 +  AC_CACHE_CHECK([whether linker script is usable],
1123 +    ac_cv_linker_script_works, [
1124 +    AC_LANG_SAVE
1125 +    AC_LANG_CPLUSPLUS
1126 +    saved_LDFLAGS="$LDFLAGS"
1127 +    LDFLAGS="$LDFLAGS $LINKER_SCRIPT_FLAGS"
1128 +    AC_TRY_RUN(
1129 +      [int main() {if ((char *)&main < (char *)0x70000000) return 1;}],
1130 +      [ac_cv_linker_script_works=yes],
1131 +      [ac_cv_linker_script_works=no],
1132 +      dnl When cross-compiling, assume it works
1133 +      [ac_cv_linker_script_works="guessing yes"]
1134 +    )
1135 +    AC_LANG_RESTORE
1136 +    if [[ "$ac_cv_linker_script_works" = "no" ]]; then
1137 +      LDFLAGS="$saved_LDFLAGS"
1138 +      LINKER_SCRIPT_FLAGS=""
1139 +    fi
1140 +  ])
1141 + fi
1142 + AC_TRANSLATE_DEFINE(HAVE_LINKER_SCRIPT, "$ac_cv_linker_script_works",
1143 +  [Define if there is a linker script to relocate the executable above 0x70000000.])
1144 +
1145   dnl Determine the addressing mode to use
1146   if [[ "x$WANT_NATIVE_M68K" = "xyes" ]]; then
1147    ADDRESSING_MODE="real"
# Line 753 | Line 1152 | else
1152      case $am in
1153      real)
1154        dnl Requires ability to mmap() Low Memory globals
1155 <      if [[ "x$ac_cv_can_map_lm" = "xno" ]]; then
1155 >      if [[ "x$ac_cv_can_map_lm$ac_cv_pagezero_hack" = "xnono" ]]; then
1156          continue
1157        fi
1158 <          dnl Requires VOSF screen updates
1158 >      dnl Requires VOSF screen updates
1159        if [[ "x$CAN_VOSF" = "xno" ]]; then
1160          continue
1161        fi
# Line 764 | Line 1163 | else
1163        ADDRESSING_MODE="real"
1164        WANT_VOSF=yes dnl we can use VOSF and we need it actually
1165        DEFINES="$DEFINES -DREAL_ADDRESSING"
1166 +      if [[ "x$ac_cv_pagezero_hack" = "xyes" ]]; then
1167 +        BLESS=Darwin/lowmem
1168 +        LDFLAGS="$LDFLAGS -pagezero_size 0x2000"
1169 +      fi
1170        break
1171        ;;
1172      direct)
# Line 816 | Line 1219 | AC_MSG_RESULT($HAVE_GAS)
1219   dnl Check for GCC 2.7 or higher.
1220   HAVE_GCC27=no
1221   AC_MSG_CHECKING(for GCC 2.7 or higher)
1222 < AC_EGREP_CPP(xyes,
1223 < [#if __GNUC__ - 1 > 1 || __GNUC_MINOR__ - 1 > 5
1224 <  xyes
1225 < #endif
1226 < ], [AC_MSG_RESULT(yes); HAVE_GCC27=yes], AC_MSG_RESULT(no))
1222 > AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#if ! (__GNUC__ - 1 > 1 || __GNUC_MINOR__ - 1 > 5)
1223 >                                     # error gcc < 2.7
1224 >                                     #endif
1225 >                                   ]])],
1226 >                  [AC_MSG_RESULT(yes); HAVE_GCC27=yes],
1227 >                  [AC_MSG_RESULT(no)])
1228  
1229   dnl Check for GCC 3.0 or higher.
1230   HAVE_GCC30=no
1231   AC_MSG_CHECKING(for GCC 3.0 or higher)
1232 < AC_EGREP_CPP(xyes,
1233 < [#if __GNUC__ >= 3
1234 <  xyes
1235 < #endif
1236 < ], [AC_MSG_RESULT(yes); HAVE_GCC30=yes], AC_MSG_RESULT(no))
1232 > AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#if ! (__GNUC__ >= 3)
1233 >                                     # error gcc < 3
1234 >                                     #endif
1235 >                                   ]])],
1236 >                  [AC_MSG_RESULT(yes); HAVE_GCC30=yes],
1237 >                  [AC_MSG_RESULT(no)])
1238 >
1239 > dnl Check for ICC.
1240 > AC_MSG_CHECKING(for ICC)
1241 > HAVE_ICC=no
1242 > if $CXX -V -v 2>&1 | grep -q "Intel(R) C++ Compiler"; then
1243 >  HAVE_ICC=yes
1244 > fi
1245 > AC_MSG_RESULT($HAVE_ICC)
1246  
1247   dnl Set "-fomit-frame-pointer" on i386 GCC 2.7 or higher.
1248   dnl Also set "-fno-exceptions" for C++ because exception handling requires
# Line 844 | Line 1257 | dnl As of 2001/08/02, this affects the f
1257   dnl Official: probably gcc-3.1 (mainline CVS)
1258   dnl Mandrake: gcc-2.96 >= 0.59mdk, gcc-3.0.1 >= 0.1mdk
1259   dnl Red Hat : gcc-2.96 >= 89, gcc-3.0 >= 1
1260 < if [[ "x$HAVE_GCC27" = "xyes" ]]; then
1260 > if [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_ICC" = "xno" ]]; then
1261    SAVED_CXXFLAGS="$CXXFLAGS"
1262    CXXFLAGS="$CXXFLAGS -fno-merge-constants"
1263    AC_CACHE_CHECK([whether GCC supports constants merging], ac_cv_gcc_constants_merging, [
# Line 858 | Line 1271 | if [[ "x$HAVE_GCC27" = "xyes" ]]; then
1271    fi
1272   fi
1273  
1274 + dnl Store motion was introduced in 3.3-hammer branch and any gcc >= 3.4
1275 + dnl However, there are some corner cases exposed on x86-64
1276 + if [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_ICC" = "xno" ]]; then
1277 +  SAVED_CXXFLAGS="$CXXFLAGS"
1278 +  CXXFLAGS="$CXXFLAGS -fno-gcse-sm"
1279 +  AC_CACHE_CHECK([whether GCC supports store motion], ac_cv_gcc_store_motion, [
1280 +    AC_LANG_SAVE
1281 +    AC_LANG_CPLUSPLUS
1282 +    AC_TRY_COMPILE([],[],[ac_cv_gcc_store_motion=yes],[ac_cv_gcc_store_motion=no])
1283 +    AC_LANG_RESTORE
1284 +  ])
1285 +  if [[ "x$ac_cv_gcc_store_motion" != "xyes" ]]; then
1286 +    CXXFLAGS="$SAVED_CXXFLAGS"
1287 +  fi
1288 + fi
1289 +
1290 + dnl Add -fno-strict-aliasing for slirp sources
1291 + if [[ "x$HAVE_GCC30" = "xyes" ]]; then
1292 +  SAVED_CFLAGS="$CFLAGS"
1293 +  CFLAGS="$CFLAGS -fno-strict-aliasing"
1294 +  AC_CACHE_CHECK([whether the compiler supports -fno-strict-aliasing],
1295 +    ac_cv_gcc_no_strict_aliasing, [
1296 +    AC_TRY_COMPILE([],[],
1297 +      [ac_cv_gcc_no_strict_aliasing=yes; AC_SUBST(SLIRP_CFLAGS, "-fno-strict-aliasing")],
1298 +      [ac_cv_gcc_no_strict_aliasing=no])
1299 +  ])
1300 +  CFLAGS="$SAVED_CFLAGS"
1301 + fi
1302 +
1303 + dnl Add -mdynamic-no-pic for MacOS X (XXX icc10 will support MacOS X)
1304 + if [[ "x$HAVE_GCC30" = "xyes" -a "x$HAVE_ICC" = "xno" ]]; then
1305 +  SAVED_CFLAGS="$CFLAGS"
1306 +  CFLAGS="$CFLAGS -mdynamic-no-pic"
1307 +  AC_CACHE_CHECK([whether the compiler supports -mdynamic-no-pic],
1308 +    ac_cv_gcc_mdynamic_no_pic, [
1309 +    AC_TRY_COMPILE([],[],[ac_cv_gcc_mdynamic_no_pic=yes],[ac_cv_gcc_mdynamic_no_pic=no])
1310 +  ])
1311 +  if [[ "x$ac_cv_gcc_mdynamic_no_pic" = "xyes" ]]; then
1312 +    CXXFLAGS="$CXXFLAGS -mdynamic-no-pic"
1313 +  else
1314 +    CFLAGS="$SAVED_CFLAGS"
1315 +  fi
1316 + fi
1317 +
1318   dnl Select appropriate CPU source and REGPARAM define.
1319   ASM_OPTIMIZATIONS=none
1320   CPUSRCS="cpuemu1.cpp cpuemu2.cpp cpuemu3.cpp cpuemu4.cpp cpuemu5.cpp cpuemu6.cpp cpuemu7.cpp cpuemu8.cpp"
# Line 882 | Line 1339 | elif [[ "x$HAVE_GCC30" = "xyes" -a "x$HA
1339    if [[ "x$HAVE_GAS" = "xyes" ]]; then
1340      ASM_OPTIMIZATIONS="x86-64"
1341      DEFINES="$DEFINES -DX86_64_ASSEMBLY -DOPTIMIZED_FLAGS"
1342 +    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"
1343 +    CAN_JIT=yes
1344 +    WANT_33BIT_ADDRESSING=yes
1345    fi
1346   elif [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_SPARC" = "xyes" -a "x$HAVE_GAS" = "xyes" ]]; then
1347    dnl SPARC CPU
# Line 938 | Line 1398 | else
1398    JITSRCS=""
1399   fi
1400  
1401 + dnl Use 33-bit memory addressing?
1402 + if [[ "$ac_cv_have_33bit_addressing:$WANT_33BIT_ADDRESSING" = "yes:yes" ]]; then
1403 +  use_33bit_addressing=yes
1404 + fi
1405 + AC_TRANSLATE_DEFINE(USE_33BIT_ADDRESSING, "$use_33bit_addressing",
1406 +  [Define to use 33-bit memory addressing on 64-bit JIT capable systems.])
1407 +
1408   dnl Utility macro used by next two tests.
1409   dnl AC_EXAMINE_OBJECT(C source code,
1410   dnl     commands examining object file,
# Line 1135 | Line 1602 | fi
1602  
1603   dnl Remove the "-g" option if set for GCC.
1604   if [[ "x$HAVE_GCC27" = "xyes" ]]; then
1605 <  CFLAGS=`echo $CFLAGS | sed -e 's/-g//g'`
1606 <  CXXFLAGS=`echo $CXXFLAGS | sed -e 's/-g//g'`
1605 >  CFLAGS=`echo $CFLAGS | sed -e 's/-g\b//g'`
1606 >  CXXFLAGS=`echo $CXXFLAGS | sed -e 's/-g\b//g'`
1607   fi
1608  
1609   dnl Or if we have -IPA (MIPSPro compilers)
# Line 1152 | Line 1619 | AC_SUBST(DEFINES)
1619   AC_SUBST(SYSSRCS)
1620   AC_SUBST(CPUINCLUDES)
1621   AC_SUBST(CPUSRCS)
1622 + AC_SUBST(BLESS)
1623 + AC_SUBST(KEYCODES)
1624   AC_CONFIG_FILES([Makefile])
1625   AC_OUTPUT
1626  
# Line 1159 | Line 1628 | dnl Print summary.
1628   echo
1629   echo Basilisk II configuration summary:
1630   echo
1631 + echo SDL support ............................ : $SDL_SUPPORT
1632   echo XFree86 DGA support .................... : $WANT_XF86_DGA
1633   echo XFree86 VidMode support ................ : $WANT_XF86_VIDMODE
1634   echo fbdev DGA support ...................... : $WANT_FBDEV_DGA

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines