1999-10-03 14:16:26 +00:00
dnl Process this file with autoconf to produce a configure script.
2002-01-15 14:58:43 +00:00
dnl Written in 2002 by Christian Bauer et al.
1999-10-03 14:16:26 +00:00
2003-07-01 18:10:38 +00:00
AC_INIT([Basilisk II], 1.0, [Christian.Bauer@uni-mainz.de], BasiliskII)
AC_CONFIG_SRCDIR(main_unix.cpp)
2002-09-16 13:29:33 +00:00
AC_PREREQ(2.52)
1999-10-03 14:16:26 +00:00
AC_CONFIG_HEADER(config.h)
2003-08-17 10:35:18 +00:00
dnl Aliases for PACKAGE and VERSION macros.
2003-10-12 21:58:02 +00:00
AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE_NAME", [Define this program name.])
AC_DEFINE_UNQUOTED(VERSION, "$PACKAGE_VERSION", [Define this program version.])
2003-08-17 10:35:18 +00:00
2003-10-12 15:56:00 +00:00
dnl Some systems do not put corefiles in the currect directory, avoid saving
dnl cores for the configure tests since some are intended to dump core.
ulimit -c 0
2006-04-16 16:32:45 +00:00
AC_ARG_ENABLE(standalone-gui,[ --enable-standalone-gui enable a standalone GUI prefs editor [default=no]], [WANT_STANDALONE_GUI=$enableval], [WANT_STANDALONE_GUI=no])
2002-09-17 16:08:41 +00:00
dnl Video options.
1999-11-03 21:04:23 +00:00
AC_ARG_ENABLE(xf86-dga, [ --enable-xf86-dga use the XFree86 DGA extension [default=yes]], [WANT_XF86_DGA=$enableval], [WANT_XF86_DGA=yes])
AC_ARG_ENABLE(xf86-vidmode, [ --enable-xf86-vidmode use the XFree86 VidMode extension [default=yes]], [WANT_XF86_VIDMODE=$enableval], [WANT_XF86_VIDMODE=yes])
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])
2001-05-24 15:06:13 +00:00
AC_ARG_ENABLE(vosf, [ --enable-vosf enable video on SEGV signals [default=yes]], [WANT_VOSF=$enableval], [WANT_VOSF=yes])
2001-01-28 14:04:32 +00:00
2004-06-23 14:30:48 +00:00
dnl SDL options.
2005-05-13 17:32:13 +00:00
AC_ARG_ENABLE(sdl-static, [ --enable-sdl-static use SDL static libraries for linking [default=no]], [WANT_SDL_STATIC=$enableval], [WANT_SDL_STATIC=no])
2004-06-23 14:30:48 +00:00
AC_ARG_ENABLE(sdl-video, [ --enable-sdl-video use SDL for video graphics [default=no]], [WANT_SDL_VIDEO=$enableval], [WANT_SDL_VIDEO=no])
2004-07-19 19:25:07 +00:00
AC_ARG_ENABLE(sdl-audio, [ --enable-sdl-audio use SDL for audio [default=no]], [WANT_SDL_AUDIO=$enableval], [WANT_SDL_AUDIO=no])
2009-03-03 08:07:22 +00:00
AC_ARG_ENABLE(sdl-framework, [ --enable-sdl-framework use SDL framework [default=no]], [WANT_SDL_FRAMEWORK=$enableval], [WANT_SDL_FRAMEWORK=no])
AC_ARG_ENABLE(sdl-framework-prefix, [ --enable-sdl-framework-prefix=PFX default=/Library/Frameworks], [SDL_FRAMEWORK="$enableval"], [SDL_FRAMEWORK=/Library/Frameworks])
2004-06-23 14:30:48 +00:00
2002-09-17 16:08:41 +00:00
dnl JIT compiler options.
AC_ARG_ENABLE(jit-compiler, [ --enable-jit-compiler enable JIT compiler [default=no]], [WANT_JIT=$enableval], [WANT_JIT=no])
AC_ARG_ENABLE(jit-debug, [ --enable-jit-debug activate native code disassemblers [default=no]], [WANT_JIT_DEBUG=$enableval], [WANT_JIT_DEBUG=no])
2001-03-20 18:05:36 +00:00
dnl FPU emulation core.
AC_ARG_ENABLE(fpe,
2002-09-16 12:03:07 +00:00
[ --enable-fpe=FPE specify which fpu emulator to use [default=auto]],
2001-03-20 18:05:36 +00:00
[ case "$enableval" in
2002-09-16 12:03:07 +00:00
dnl default is always ieee, if architecture has this fp format
auto) FPE_CORE_TEST_ORDER="ieee uae";;
ieee) FPE_CORE_TEST_ORDER="ieee";;
uae) FPE_CORE_TEST_ORDER="uae";;
x86) FPE_CORE_TEST_ORDER="x86";;
*) AC_MSG_ERROR([--enable-fpe takes only one of the following values: auto, x86, ieee, uae]);;
2001-03-20 18:05:36 +00:00
esac
],
2002-09-16 12:03:07 +00:00
[ FPE_CORE_TEST_ORDER="ieee uae"
2001-03-20 18:05:36 +00:00
])
2001-01-28 14:04:32 +00:00
dnl Addressing modes.
2000-09-22 17:14:04 +00:00
AC_ARG_ENABLE(addressing,
2001-01-28 14:04:32 +00:00
[ --enable-addressing=AM specify the addressing mode to use [default=fastest]],
2000-09-22 17:14:04 +00:00
[ case "$enableval" in
2000-09-25 17:54:01 +00:00
real) ADDRESSING_TEST_ORDER="real";;
direct) ADDRESSING_TEST_ORDER="direct";;
banks) ADDRESSING_TEST_ORDER="banks";;
2001-01-28 14:04:32 +00:00
fastest)ADDRESSING_TEST_ORDER="direct banks";;
*) AC_MSG_ERROR([--enable-addressing takes only one of the following values: fastest, real, direct, banks]);;
2000-09-22 17:14:04 +00:00
esac
],
[ ADDRESSING_TEST_ORDER="direct banks"
])
2001-01-28 14:04:32 +00:00
dnl External packages.
1999-11-03 21:04:23 +00:00
AC_ARG_WITH(esd, [ --with-esd support ESD for sound under Linux/FreeBSD [default=yes]], [WANT_ESD=$withval], [WANT_ESD=yes])
2005-06-19 15:52:09 +00:00
AC_ARG_WITH(gtk, [ --with-gtk use GTK user interface [default=yes]],
[case "$withval" in
gtk1) WANT_GTK="gtk";;
gtk|gtk2) WANT_GTK="$withval";;
yes) WANT_GTK="gtk2 gtk";;
*) WANT_GTK="no";;
esac],
[WANT_GTK="gtk2 gtk"])
1999-11-03 21:04:23 +00:00
AC_ARG_WITH(mon, [ --with-mon use mon as debugger [default=yes]], [WANT_MON=$withval], [WANT_MON=yes])
1999-10-03 14:16:26 +00:00
2010-10-06 00:30:23 +00:00
AC_ARG_WITH(bincue,
AS_HELP_STRING([--with-bincue], [Allow cdrom image files in bin/cue mode]))
2000-09-22 17:14:04 +00:00
dnl Canonical system information.
AC_CANONICAL_HOST
AC_CANONICAL_TARGET
dnl Target OS type (target is host if not cross-compiling).
case "$target_os" in
linux*) OS_TYPE=linux;;
netbsd*) OS_TYPE=netbsd;;
freebsd*) OS_TYPE=freebsd;;
solaris*) OS_TYPE=solaris;;
2001-06-26 22:35:42 +00:00
darwin*) OS_TYPE=darwin;;
*) OS_TYPE=`echo $target_os | sed -e 's/-/_/g' | sed -e 's/\./_/g'`;;
2000-09-22 17:14:04 +00:00
esac
DEFINES="$DEFINES -DOS_$OS_TYPE"
dnl Target CPU type.
HAVE_I386=no
HAVE_M68K=no
HAVE_SPARC=no
2001-02-10 15:29:01 +00:00
HAVE_POWERPC=no
2002-11-05 11:58:40 +00:00
HAVE_X86_64=no
2000-09-22 17:14:04 +00:00
case "$target_cpu" in
2002-11-05 10:32:42 +00:00
i386* | i486* | i586* | i686* | i786* ) HAVE_I386=yes;;
m68k* ) HAVE_M68K=yes;;
sparc* ) HAVE_SPARC=yes;;
powerpc* ) HAVE_POWERPC=yes;;
2002-11-05 11:58:40 +00:00
x86_64* ) HAVE_X86_64=yes;;
2000-09-22 17:14:04 +00:00
esac
2010-07-28 01:07:45 +00:00
dnl Check if we should really be assuming x86_64 even if we detected HAVE_I386 above.
if [[ "x$HAVE_I386" = "xyes" ]]; then
AC_TRY_RUN([
int main(void) {
#if defined(__x86_64__)
return 0;
#else
return 1;
#endif
}
], [
HAVE_I386=no
HAVE_X86_64=yes
])
fi
1999-10-03 14:16:26 +00:00
dnl Checks for programs.
AC_PROG_CC
2000-09-22 17:14:04 +00:00
AC_PROG_CC_C_O
1999-10-05 18:38:50 +00:00
AC_PROG_CPP
1999-10-03 14:16:26 +00:00
AC_PROG_CXX
AC_PROG_MAKE_SET
AC_PROG_INSTALL
2004-11-14 23:24:51 +00:00
AC_PROG_EGREP
1999-10-03 14:16:26 +00:00
1999-10-25 08:07:58 +00:00
dnl We use mon if possible.
MONSRCS=
2000-04-14 18:46:05 +00:00
if [[ "x$WANT_MON" = "xyes" ]]; then
AC_MSG_CHECKING(for mon)
2000-09-25 17:54:01 +00:00
mon_srcdir=../../../mon/src
if grep mon_init $mon_srcdir/mon.h >/dev/null 2>/dev/null; then
2000-04-14 18:46:05 +00:00
AC_MSG_RESULT(yes)
2002-09-16 13:29:33 +00:00
AC_DEFINE(ENABLE_MON, 1, [Define if using "mon".])
2007-06-07 11:52:14 +00:00
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"
2000-09-25 17:54:01 +00:00
CXXFLAGS="$CXXFLAGS -I$mon_srcdir -I$mon_srcdir/disass"
2002-03-18 13:30:07 +00:00
AC_CHECK_LIB(ncurses, tgetent, ,
2010-03-07 00:45:10 +00:00
[AC_CHECK_LIB(termcap, tgetent, ,
[AC_CHECK_LIB(termlib, tgetent, ,
[AC_CHECK_LIB(terminfo, tgetent, ,
[AC_CHECK_LIB(Hcurses, tgetent, ,
[AC_CHECK_LIB(curses, tgetent)])])])])])
2002-03-18 12:59:44 +00:00
AC_CHECK_LIB(readline, readline)
2000-04-14 18:46:05 +00:00
else
AC_MSG_RESULT(no)
AC_MSG_WARN([Could not find mon, ignoring --with-mon.])
WANT_MON=no
fi
1999-10-25 08:07:58 +00:00
fi
1999-10-03 14:16:26 +00:00
dnl Checks for libraries.
1999-10-23 17:58:00 +00:00
AC_CHECK_LIB(posix4, sem_init)
2001-07-01 14:38:03 +00:00
AC_CHECK_LIB(rt, timer_create)
2004-11-08 21:07:07 +00:00
AC_CHECK_LIB(rt, shm_open)
2005-12-04 15:45:09 +00:00
AC_CHECK_LIB(m, cos)
1999-10-23 17:58:00 +00:00
2009-03-03 08:07:22 +00:00
dnl AC_CHECK_SDLFRAMEWORK($1=NAME, $2=INCLUDES)
dnl AC_TRY_LINK uses main() but SDL needs main to take args,
dnl therefore main is undefined with #undef.
dnl Framework can be in an custom location.
AC_DEFUN([AC_CHECK_SDLFRAMEWORK], [
AS_VAR_PUSHDEF([ac_Framework], [ac_cv_framework_$1])
AC_CACHE_CHECK([whether compiler supports framework $1],
ac_Framework, [
saved_LIBS="$LIBS"
LIBS="$LIBS -framework $1"
if [[ "x$SDL_FRAMEWORK" != "x/Library/Frameworks" ]]; then
if [[ "x$SDL_FRAMEWORK" != "x/System/Library/Frameworks" ]]; then
LIBS="$saved_LIBS -F$SDL_FRAMEWORK -framework $1"
fi
fi
saved_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS -I$SDL_FRAMEWORK/SDL.framework/Headers"
AC_TRY_LINK(
[$2
#undef main], [],
[AS_VAR_SET(ac_Framework, yes)], [AS_VAR_SET(ac_Framework, no);
LIBS="$saved_LIBS"; CPPFLAGS="$saved_CPPFLAGS"]
)
])
AS_IF([test AS_VAR_GET(ac_Framework) = yes],
[AC_DEFINE(AS_TR_CPP(HAVE_FRAMEWORK_$1), 1, [Define if framework $1 is available.])]
)
AS_VAR_POPDEF([ac_Framework])
])
2004-06-23 14:30:48 +00:00
dnl Do we need SDL?
WANT_SDL=no
if [[ "x$WANT_SDL_VIDEO" = "xyes" ]]; then
WANT_SDL=yes
WANT_XF86_DGA=no
WANT_XF86_VIDMODE=no
WANT_FBDEV_DGA=no
2004-07-19 19:25:07 +00:00
SDL_SUPPORT="$SDL_SUPPORT video"
fi
if [[ "x$WANT_SDL_AUDIO" = "xyes" ]]; then
WANT_SDL=yes
SDL_SUPPORT="$SDL_SUPPORT audio"
2004-06-23 14:30:48 +00:00
fi
if [[ "x$WANT_SDL" = "xyes" ]]; then
2009-03-03 08:07:22 +00:00
if [[ "x$WANT_SDL_FRAMEWORK" = "xyes" ]]; then
AC_CHECK_SDLFRAMEWORK(SDL, [#include <SDL.h>])
2004-06-23 14:30:48 +00:00
else
2009-03-03 08:07:22 +00:00
ac_cv_framework_SDL=no
fi
if [[ "x$ac_cv_framework_SDL" = "xno" ]]; then
AC_PATH_PROG(sdl_config, "sdl-config")
if [[ -n "$sdl_config" ]]; then
case $target_os in
# Special treatment for Cygwin so that we can still use the POSIX layer
*cygwin*)
sdl_cflags="-I`$sdl_config --prefix`/include/SDL"
sdl_libs="-L`$sdl_config --exec-prefix`/lib -lSDL"
;;
*)
sdl_cflags=`$sdl_config --cflags`
if [[ "x$WANT_SDL_STATIC" = "xyes" ]]; then
sdl_libs=`$sdl_config --static-libs`
else
sdl_libs=`$sdl_config --libs`
fi
;;
esac
CFLAGS="$CFLAGS $sdl_cflags"
CXXFLAGS="$CXXFLAGS $sdl_cflags"
LIBS="$LIBS $sdl_libs"
else
WANT_SDL=no
fi
2004-06-23 14:30:48 +00:00
fi
2004-07-19 19:25:07 +00:00
SDL_SUPPORT=`echo "$SDL_SUPPORT" | sed -e "s/^ //"`
else
SDL_SUPPORT="none"
2004-06-23 14:30:48 +00:00
fi
dnl We need X11, if not using SDL.
if [[ "x$WANT_SDL" = "xno" ]]; then
AC_PATH_XTRA
if [[ "x$no_x" = "xyes" ]]; then
AC_MSG_ERROR([You need X11 to run Basilisk II.])
fi
CFLAGS="$CFLAGS $X_CFLAGS"
CXXFLAGS="$CXXFLAGS $X_CFLAGS"
LIBS="$LIBS $X_PRE_LIBS $X_LIBS -lX11 -lXext $X_EXTRA_LIBS"
1999-10-03 14:16:26 +00:00
fi
2010-10-06 00:30:23 +00:00
dnl BINCUE
AS_IF([test "x$with_bincue" = "xyes" ], [have_bincue=yes], [have_bincue=no])
AS_IF([test "x$have_bincue" = "xyes" ], [
if [[ "x$WANT_SDL_AUDIO" = "xyes" ]]; then
DEFINES="$DEFINES -DBINCUE"
else
AC_MSG_ERROR([You need SDL Audio to use BINCUE support.])
fi
])
2000-07-13 13:47:12 +00:00
dnl We want pthreads. Try libpthread first, then libc_r (FreeBSD), then PTL.
HAVE_PTHREADS=yes
1999-10-23 17:58:00 +00:00
AC_CHECK_LIB(pthread, pthread_create, , [
AC_CHECK_LIB(c_r, pthread_create, , [
AC_CHECK_LIB(PTL, pthread_create, , [
2000-07-13 13:47:12 +00:00
HAVE_PTHREADS=no
1999-10-23 17:58:00 +00:00
])
])
])
2000-07-13 13:47:12 +00:00
if [[ "x$HAVE_PTHREADS" = "xyes" ]]; then
2002-09-16 13:29:33 +00:00
AC_DEFINE(HAVE_PTHREADS, 1, [Define if pthreads are available.])
2000-07-13 13:47:12 +00:00
fi
2005-06-30 10:20:18 +00:00
AC_CHECK_FUNCS(pthread_cond_init)
2005-05-15 17:22:12 +00:00
AC_CHECK_FUNCS(pthread_cancel pthread_testcancel)
2002-02-07 16:10:57 +00:00
AC_CHECK_FUNCS(pthread_mutexattr_setprotocol)
AC_CHECK_FUNCS(pthread_mutexattr_settype)
2002-09-16 15:06:24 +00:00
AC_CHECK_FUNCS(pthread_mutexattr_setpshared)
1999-10-23 17:58:00 +00:00
dnl If POSIX.4 semaphores are not available, we emulate them with pthread mutexes.
2000-07-13 13:47:12 +00:00
SEMSRC=
1999-10-23 17:58:00 +00:00
AC_CHECK_FUNCS(sem_init, , [
2000-10-09 17:05:17 +00:00
if test "x$HAVE_PTHREADS" = "xyes"; then
2000-07-13 13:47:12 +00:00
SEMSRC=posix_sem.cpp
fi
1999-10-23 17:58:00 +00:00
])
1999-10-03 14:16:26 +00:00
1999-10-23 17:58:00 +00:00
dnl We use DGA (XFree86 or fbdev) if possible.
1999-10-21 13:19:27 +00:00
if [[ "x$WANT_XF86_DGA" = "xyes" ]]; then
1999-10-23 17:58:00 +00:00
AC_CHECK_LIB(Xxf86dga, XF86DGAQueryExtension, [
2002-09-16 13:29:33 +00:00
AC_DEFINE(ENABLE_XF86_DGA, 1, [Define if using XFree86 DGA extension.])
1999-10-03 14:16:26 +00:00
LIBS="$LIBS -lXxf86dga"
1999-10-21 13:19:27 +00:00
if [[ "x$WANT_FBDEV_DGA" = "xyes" ]]; then
AC_MSG_WARN([Cannot have both --enable-xf86-dga and --enable-fbdev-dga, ignoring --enable-fbdev-dga.])
WANT_FBDEV_DGA=no
fi
1999-10-23 17:58:00 +00:00
], [
AC_MSG_WARN([Could not find XFree86 DGA extension, ignoring --enable-xf86-dga.])
1999-10-25 20:52:12 +00:00
WANT_XF86_DGA=no
1999-10-23 17:58:00 +00:00
])
1999-10-21 13:19:27 +00:00
fi
if [[ "x$WANT_FBDEV_DGA" = "xyes" ]]; then
2002-09-16 13:29:33 +00:00
AC_DEFINE(ENABLE_FBDEV_DGA, 1, [Define if using DGA with framebuffer device.])
1999-10-03 14:16:26 +00:00
fi
1999-11-03 21:04:23 +00:00
dnl We use XFree86 VidMode if possible.
if [[ "x$WANT_XF86_VIDMODE" = "xyes" ]]; then
AC_CHECK_LIB(Xxf86vm, XF86VidModeQueryExtension, [
2002-09-16 13:29:33 +00:00
AC_DEFINE(ENABLE_XF86_VIDMODE, 1, [Define if using XFree86 DGA extension.])
1999-11-03 21:04:23 +00:00
LIBS="$LIBS -lXxf86vm"
], [
AC_MSG_WARN([Could not find XFree86 VidMode extension, ignoring --enable-xf86-vidmode.])
WANT_XF86_VIDMODE=no
])
fi
1999-10-03 14:16:26 +00:00
dnl We use GTK+ if possible.
1999-10-23 17:58:00 +00:00
UISRCS=../dummy/prefs_editor_dummy.cpp
2005-06-19 15:52:09 +00:00
case "x$WANT_GTK" in
xgtk2*)
AM_PATH_GTK_2_0(1.3.15, [
2006-04-16 21:25:41 +00:00
GUI_CFLAGS="$GTK_CFLAGS"
GUI_LIBS="$GTK_LIBS"
2005-06-19 15:52:09 +00:00
WANT_GTK=gtk2
], [
case "x${WANT_GTK}x" in
*gtkx)
AC_MSG_WARN([Could not find GTK+ 2.0, trying with GTK+ 1.2.])
WANT_GTK=gtk
;;
*)
AC_MSG_WARN([Could not find GTK+, disabling user interface.])
WANT_GTK=no
;;
esac
])
;;
esac
if [[ "x$WANT_GTK" = "xgtk" ]]; then
1999-10-23 17:58:00 +00:00
AM_PATH_GTK(1.2.0, [
2006-04-16 21:25:41 +00:00
GUI_CFLAGS="$GTK_CFLAGS"
GUI_LIBS="$GTK_LIBS"
2003-08-17 10:16:23 +00:00
dnl somehow, <gnome-i18n.h> would redefine gettext() to nothing if
dnl ENABLE_NLS is not set, thusly conflicting with C++ <string> which
dnl includes <libintl.h>
AM_GNU_GETTEXT
2002-01-22 17:15:10 +00:00
B2_PATH_GNOMEUI([
2002-09-16 13:29:33 +00:00
AC_DEFINE(HAVE_GNOMEUI, 1, [Define if libgnomeui is available.])
2006-04-16 21:25:41 +00:00
GUI_CFLAGS="$GUI_CFLAGS $GNOMEUI_CFLAGS"
GUI_LIBS="$GUI_LIBS $GNOMEUI_LIBS"
2002-01-22 17:15:10 +00:00
], [])
1999-10-23 17:58:00 +00:00
], [
AC_MSG_WARN([Could not find GTK+, disabling user interface.])
1999-10-26 16:28:38 +00:00
WANT_GTK=no
1999-10-23 17:58:00 +00:00
])
1999-10-03 14:16:26 +00:00
fi
2006-05-02 05:36:42 +00:00
if [[ "x$WANT_GTK" != "xno" -a "x$WANT_STANDALONE_GUI" = "xno" ]]; then
AC_DEFINE(ENABLE_GTK, 1, [Define if using GTK.])
UISRCS=prefs_editor_gtk.cpp
fi
2006-04-16 21:25:41 +00:00
AC_SUBST(GUI_CFLAGS)
AC_SUBST(GUI_LIBS)
1999-10-03 14:16:26 +00:00
2006-04-19 06:55:54 +00:00
dnl Build external GUI if requested.
2006-04-16 16:32:45 +00:00
if [[ "$WANT_STANDALONE_GUI" != "yes" ]]; then
WANT_STANDALONE_GUI=no
fi
if [[ "$WANT_GTK" = "no" ]]; then
WANT_STANDALONE_GUI=no
fi
AC_SUBST(STANDALONE_GUI, [$WANT_STANDALONE_GUI])
1999-10-23 17:58:00 +00:00
dnl We use ESD if possible.
if [[ "x$WANT_ESD" = "xyes" ]]; then
AM_PATH_ESD(0.2.8, [
2002-09-16 13:29:33 +00:00
AC_DEFINE(ENABLE_ESD, 1, [Define is using ESD.])
1999-10-23 17:58:00 +00:00
CFLAGS="$CFLAGS $ESD_CFLAGS"
CXXFLAGS="$CXXFLAGS $ESD_CFLAGS"
LIBS="$LIBS $ESD_LIBS"
], [
AC_MSG_WARN([Could not find ESD, disabling ESD support.])
WANT_ESD=no
])
1999-10-03 14:16:26 +00:00
fi
2002-03-16 10:58:22 +00:00
dnl We use 64-bit file size support if possible.
2002-09-16 13:29:33 +00:00
AC_SYS_LARGEFILE
2002-03-16 10:58:22 +00:00
1999-10-03 14:16:26 +00:00
dnl Checks for header files.
AC_HEADER_STDC
2005-07-01 05:57:07 +00:00
AC_CHECK_HEADERS(stdlib.h stdint.h)
AC_CHECK_HEADERS(unistd.h fcntl.h sys/types.h sys/time.h sys/mman.h mach/mach.h)
2003-08-17 11:58:00 +00:00
AC_CHECK_HEADERS(readline.h history.h readline/readline.h readline/history.h)
2005-05-13 17:43:38 +00:00
AC_CHECK_HEADERS(sys/socket.h sys/ioctl.h sys/filio.h sys/bitypes.h sys/wait.h)
AC_CHECK_HEADERS(sys/poll.h sys/select.h)
2005-05-13 09:21:21 +00:00
AC_CHECK_HEADERS(arpa/inet.h)
2004-11-10 07:33:15 +00:00
AC_CHECK_HEADERS(linux/if.h linux/if_tun.h net/if.h net/if_tun.h, [], [], [
2005-05-13 17:43:38 +00:00
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
2004-11-10 07:33:15 +00:00
#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
])
2004-06-27 22:06:02 +00:00
AC_CHECK_HEADERS(AvailabilityMacros.h)
2005-06-12 23:36:34 +00:00
AC_CHECK_HEADERS(IOKit/storage/IOBlockStorageDevice.h)
1999-10-03 14:16:26 +00:00
dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_BIGENDIAN
AC_C_CONST
AC_C_INLINE
AC_CHECK_SIZEOF(short, 2)
AC_CHECK_SIZEOF(int, 4)
AC_CHECK_SIZEOF(long, 4)
AC_CHECK_SIZEOF(long long, 8)
2002-09-13 12:51:24 +00:00
AC_CHECK_SIZEOF(float, 4)
AC_CHECK_SIZEOF(double, 8)
AC_CHECK_SIZEOF(long double, 12)
2000-09-22 17:14:04 +00:00
AC_CHECK_SIZEOF(void *, 4)
1999-10-03 14:16:26 +00:00
AC_TYPE_OFF_T
2003-11-21 14:16:02 +00:00
AC_CHECK_TYPES(loff_t)
AC_CHECK_TYPES(caddr_t)
1999-10-03 14:16:26 +00:00
AC_TYPE_SIZE_T
2000-09-22 17:14:04 +00:00
AC_TYPE_SIGNAL
1999-10-03 14:16:26 +00:00
AC_HEADER_TIME
AC_STRUCT_TM
2002-03-16 10:12:49 +00:00
dnl Check whether sys/socket.h defines type socklen_t.
dnl (extracted from ac-archive/Miscellaneous)
2002-09-16 13:29:33 +00:00
AC_CACHE_CHECK([for socklen_t],
2002-03-16 10:12:49 +00:00
ac_cv_type_socklen_t, [
AC_TRY_COMPILE([
#include <sys/types.h>
#include <sys/socket.h>
], [socklen_t len = 42; return 0;],
ac_cv_type_socklen_t=yes, ac_cv_type_socklen_t=no,
dnl When cross-compiling, do not assume anything.
ac_cv_type_socklen_t="guessing no"
)
])
if [[ "x$ac_cv_type_socklen_t" != "xyes" ]]; then
2002-09-16 13:29:33 +00:00
AC_DEFINE(socklen_t, int, [Define to 'int' if <sys/types.h> doesn't define.])
2002-03-16 10:12:49 +00:00
fi
1999-10-03 14:16:26 +00:00
dnl Checks for library functions.
2005-05-13 09:21:21 +00:00
AC_CHECK_FUNCS(strdup strerror cfmakeraw)
2000-07-22 18:12:35 +00:00
AC_CHECK_FUNCS(clock_gettime timer_create)
2001-05-20 20:31:50 +00:00
AC_CHECK_FUNCS(sigaction signal)
2001-06-26 22:35:42 +00:00
AC_CHECK_FUNCS(mmap mprotect munmap)
AC_CHECK_FUNCS(vm_allocate vm_deallocate vm_protect)
2005-05-13 17:43:38 +00:00
AC_CHECK_FUNCS(poll inet_aton)
2001-06-26 22:35:42 +00:00
dnl Darwin seems to define mach_task_self() instead of task_self().
AC_CHECK_FUNCS(mach_task_self task_self)
1999-10-03 14:16:26 +00:00
2002-07-31 16:46:14 +00:00
dnl Check for headers and functions related to pty support (sshpty.c)
dnl From openssh-3.2.2p1 configure.ac
AC_CHECK_HEADERS(strings.h login.h sys/bsdtty.h sys/stat.h util.h pty.h)
AC_CHECK_FUNCS(_getpty vhangup strlcpy)
case "$host" in
*-*-hpux10.26)
disable_ptmx_check=yes
;;
*-*-linux*)
no_dev_ptmx=1
;;
mips-sony-bsd|mips-sony-newsos4)
2002-09-16 13:29:33 +00:00
AC_DEFINE(HAVE_NEWS4, 1, [Define if you are on NEWS-OS (additions from openssh-3.2.2p1, for sshpty.c).])
2002-07-31 16:46:14 +00:00
;;
*-*-sco3.2v4*)
no_dev_ptmx=1
;;
*-*-sco3.2v5*)
no_dev_ptmx=1
;;
2004-11-14 23:24:51 +00:00
*-*-cygwin*)
no_dev_ptmx=1
;;
2008-12-09 18:03:35 +00:00
*-*-darwin*)
no_dev_ptmx=1
;;
2002-07-31 16:46:14 +00:00
esac
if test -z "$no_dev_ptmx" ; then
if test "x$disable_ptmx_check" != "xyes" ; then
2002-09-16 13:29:33 +00:00
AC_CHECK_FILE([/dev/ptmx],
2002-07-31 16:46:14 +00:00
[
2002-09-16 13:29:33 +00:00
AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX, 1, [Define if you have /dev/ptmx.])
2002-07-31 16:46:14 +00:00
have_dev_ptmx=1
]
)
fi
fi
2002-09-16 13:29:33 +00:00
AC_CHECK_FILE([/dev/ptc],
2002-07-31 16:46:14 +00:00
[
2002-09-16 13:29:33 +00:00
AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC, 1, [Define if you have /dev/ptc.])
2002-07-31 16:46:14 +00:00
have_dev_ptc=1
]
)
dnl (end of code from openssh-3.2.2p1 configure.ac)
2006-01-24 23:46:19 +00:00
dnl Check for systems where POSIX-style non-blocking I/O (O_NONBLOCK)
dnl doesn't work or is unimplemented. On these systems (mostly older
dnl ones), use the old BSD-style FIONBIO approach instead. [tcl.m4]
AC_CACHE_CHECK([FIONBIO vs. O_NONBLOCK for non-blocking I/O],
ac_cv_nonblocking_io, [
case "$host" in
*-*-osf*)
ac_cv_nonblocking_io=FIONBIO
;;
*-*-sunos4*)
ac_cv_nonblocking_io=FIONBIO
;;
*-*-ultrix*)
ac_cv_nonblocking_io=FIONBIO
;;
*)
ac_cv_nonblocking_io=O_NONBLOCK
;;
esac
])
if [[ "$ac_cv_nonblocking_io" = "FIONBIO" ]]; then
AC_DEFINE(USE_FIONBIO, 1, [Define if BSD-style non-blocking I/O is to be used])
fi
2006-01-27 23:41:43 +00:00
dnl Check whether compiler supports byte bit-fields
AC_CACHE_CHECK([whether compiler supports byte bit-fields],
ac_cv_have_byte_bitfields, [
AC_LANG_SAVE
AC_LANG_CPLUSPLUS
AC_TRY_RUN([
struct A {
unsigned char b1:4;
unsigned char b2:4;
unsigned char c;
unsigned short s;
unsigned char a[4];
};
int main(void) {
A a;
return ! (sizeof(A) == 8 && &a.c == ((unsigned char *)&a + 1));
}],
[ac_cv_have_byte_bitfields=yes],
[ac_cv_have_byte_bitfields=no],
dnl When cross-compiling, assume only GCC supports this
[if [[ "$GCC" = "yes" ]]; then
ac_cv_have_byte_bitfields="guessing yes"
else
ac_cv_have_byte_bitfields="guessing no"
fi]
)
AC_LANG_RESTORE
])
2006-01-24 23:46:19 +00:00
2004-06-27 22:06:02 +00:00
dnl AC_CHECK_FRAMEWORK($1=NAME, $2=INCLUDES)
2005-06-30 21:25:26 +00:00
AC_DEFUN([AC_CHECK_FRAMEWORK], [
2004-06-27 22:06:02 +00:00
AS_VAR_PUSHDEF([ac_Framework], [ac_cv_framework_$1])dnl
AC_CACHE_CHECK([whether compiler supports framework $1],
ac_Framework, [
saved_LIBS="$LIBS"
LIBS="$LIBS -framework $1"
AC_TRY_LINK(
2006-01-15 11:38:41 +00:00
[$2], [],
2004-06-27 22:06:02 +00:00
[AS_VAR_SET(ac_Framework, yes)], [AS_VAR_SET(ac_Framework, no); LIBS="$saved_LIBS"]
)
])
AS_IF([test AS_VAR_GET(ac_Framework) = yes],
[AC_DEFINE(AS_TR_CPP(HAVE_FRAMEWORK_$1), 1, [Define if framework $1 is available.])]
)
AS_VAR_POPDEF([ac_Framework])dnl
])
dnl Check for some MacOS X frameworks
2006-03-14 22:14:13 +00:00
AC_CHECK_FRAMEWORK(AppKit, [])
2004-06-27 22:06:02 +00:00
AC_CHECK_FRAMEWORK(Carbon, [#include <Carbon/Carbon.h>])
AC_CHECK_FRAMEWORK(IOKit, [#include <IOKit/IOKitLib.h>])
2005-06-12 23:36:34 +00:00
AC_CHECK_FRAMEWORK(CoreFoundation, [#include <CoreFoundation/CoreFoundation.h>])
2004-06-27 22:06:02 +00:00
1999-10-03 14:16:26 +00:00
dnl Select system-dependant source files.
2000-07-13 13:47:12 +00:00
SERIALSRC=serial_unix.cpp
ETHERSRC=../dummy/ether_dummy.cpp
SCSISRC=../dummy/scsi_dummy.cpp
AUDIOSRC=../dummy/audio_dummy.cpp
2005-05-13 17:32:13 +00:00
EXTFSSRC=extfs_unix.cpp
2000-07-13 13:47:12 +00:00
EXTRASYSSRCS=
2000-10-11 17:55:06 +00:00
CAN_NATIVE_M68K=no
2000-09-22 17:14:04 +00:00
case "$target_os" in
linux*)
2001-03-29 14:20:55 +00:00
ETHERSRC=ether_unix.cpp
2000-09-22 17:14:04 +00:00
AUDIOSRC=audio_oss_esd.cpp
2001-03-29 14:20:55 +00:00
SCSISRC=Linux/scsi_linux.cpp
2000-09-22 17:14:04 +00:00
;;
2001-03-29 14:20:55 +00:00
freebsd*)
ETHERSRC=ether_unix.cpp
2000-09-22 17:14:04 +00:00
AUDIOSRC=audio_oss_esd.cpp
DEFINES="$DEFINES -DBSD_COMP"
2001-03-29 14:20:55 +00:00
CXXFLAGS="$CXXFLAGS -fpermissive"
2000-09-22 17:14:04 +00:00
dnl Check for the CAM library
AC_CHECK_LIB(cam, cam_open_btl, HAVE_LIBCAM=yes, HAVE_LIBCAM=no)
if [[ "x$HAVE_LIBCAM" = "xno" ]]; then
AC_MSG_WARN([Cannot find libcam for SCSI management, disabling SCSI support.])
else
dnl Check for the sys kernel includes
2001-03-29 14:20:55 +00:00
AC_CHECK_HEADER(camlib.h)
if [[ "x$ac_cv_header_camlib_h" = "xno" ]]; then
2000-09-22 17:14:04 +00:00
dnl In this case I should fix this thing including a "patch"
dnl to access directly to the functions in the kernel :) --Orlando
2001-03-29 14:20:55 +00:00
AC_MSG_WARN([Cannot find includes for CAM library, disabling SCSI support.])
1999-10-03 14:16:26 +00:00
else
2000-09-22 17:14:04 +00:00
SCSISRC=FreeBSD/scsi_freebsd.cpp
LIBS="$LIBS -lcam"
DEFINES="$DEFINES -DCAM"
1999-10-03 14:16:26 +00:00
fi
2000-09-22 17:14:04 +00:00
fi
;;
netbsd*)
2000-10-11 17:55:06 +00:00
CAN_NATIVE_M68K=yes
2005-05-14 08:42:39 +00:00
ETHERSRC=ether_unix.cpp
2000-09-22 17:14:04 +00:00
;;
solaris*)
AUDIOSRC=Solaris/audio_solaris.cpp
DEFINES="$DEFINES -DBSD_COMP -D_POSIX_PTHREAD_SEMANTICS"
;;
irix*)
2000-11-02 14:45:17 +00:00
AUDIOSRC=Irix/audio_irix.cpp
2000-09-22 17:14:04 +00:00
EXTRASYSSRCS=Irix/unaligned.c
2000-11-02 14:45:17 +00:00
LIBS="$LIBS -laudio"
2001-09-02 13:50:05 +00:00
WANT_ESD=no
2001-03-28 16:53:39 +00:00
2002-11-24 20:07:25 +00:00
dnl Check if our compiler supports -IPA (MIPSPro)
HAVE_IPA=no
2001-03-28 16:53:39 +00:00
ocflags="$CFLAGS"
2002-11-24 20:07:25 +00:00
CFLAGS=`echo "$CFLAGS -IPA" | sed -e "s/-g//g"`
AC_MSG_CHECKING(if "-IPA" works)
2001-03-28 16:53:39 +00:00
dnl Do a test compile of an empty function
2005-12-04 15:45:09 +00:00
AC_TRY_COMPILE([#if defined __GNUC__
# error GCC does not support IPA yet
#endif],, [AC_MSG_RESULT(yes); HAVE_IPA=yes], AC_MSG_RESULT(no))
2001-03-28 16:53:39 +00:00
CFLAGS="$ocflags"
2004-06-27 22:06:02 +00:00
;;
darwin*)
2005-05-14 17:40:05 +00:00
ETHERSRC=ether_unix.cpp
2005-06-12 23:36:34 +00:00
if [[ "x$ac_cv_framework_IOKit" = "xyes" -a "x$ac_cv_framework_CoreFoundation" = "xyes" ]]; then
2004-06-27 22:06:02 +00:00
EXTRASYSSRCS="../MacOSX/sys_darwin.cpp"
fi
2005-05-13 17:32:13 +00:00
if [[ "x$ac_cv_framework_Carbon" = "xyes" ]]; then
2007-11-01 15:33:22 +00:00
EXTFSSRC=../MacOSX/extfs_macosx.cpp
2005-05-13 17:32:13 +00:00
fi
2000-09-22 17:14:04 +00:00
;;
2004-11-14 23:24:51 +00:00
cygwin*)
SERIALSRC="../dummy/serial_dummy.cpp"
2004-11-15 00:07:54 +00:00
EXTRASYSSRCS="../Windows/BasiliskII.rc"
2004-11-14 23:24:51 +00:00
;;
2000-09-22 17:14:04 +00:00
esac
2005-05-14 08:10:49 +00:00
dnl Is the slirp library supported?
2006-01-27 23:41:43 +00:00
case "$ac_cv_have_byte_bitfields" in
yes|"guessing yes")
2006-01-27 23:49:01 +00:00
CAN_SLIRP=yes
2006-01-27 23:41:43 +00:00
ETHERSRC=ether_unix.cpp
;;
esac
2006-01-27 23:49:01 +00:00
if [[ -n "$CAN_SLIRP" ]]; then
2005-05-14 08:10:49 +00:00
AC_DEFINE(HAVE_SLIRP, 1, [Define if slirp library is supported])
SLIRP_SRCS="\
../slirp/bootp.c ../slirp/ip_output.c ../slirp/tcp_input.c \
../slirp/cksum.c ../slirp/mbuf.c ../slirp/tcp_output.c \
../slirp/debug.c ../slirp/misc.c ../slirp/tcp_subr.c \
../slirp/if.c ../slirp/sbuf.c ../slirp/tcp_timer.c \
../slirp/ip_icmp.c ../slirp/slirp.c ../slirp/tftp.c \
../slirp/ip_input.c ../slirp/socket.c ../slirp/udp.c"
fi
AC_SUBST(SLIRP_SRCS)
2004-06-23 14:30:48 +00:00
dnl SDL overrides
if [[ "x$WANT_SDL" = "xyes" ]]; then
AC_DEFINE(USE_SDL, 1, [Define to enble SDL support])
2009-03-03 08:07:22 +00:00
if [[ "x$WANT_SDL_FRAMEWORK" = "xyes" ]]; then
EXTRASYSSRCS="$EXTRASYSSRCS ../SDL/SDLMain.m"
fi
2004-06-23 14:30:48 +00:00
fi
if [[ "x$WANT_SDL_VIDEO" = "xyes" ]]; then
AC_DEFINE(USE_SDL_VIDEO, 1, [Define to enable SDL video graphics support])
2004-07-19 19:25:07 +00:00
VIDEOSRCS="../SDL/video_sdl.cpp"
2004-06-27 18:14:43 +00:00
KEYCODES="../SDL/keycodes"
2004-06-27 22:06:02 +00:00
if [[ "x$ac_cv_framework_Carbon" = "xyes" ]]; then
EXTRASYSSRCS="$EXTRASYSSRCS ../MacOSX/clip_macosx.cpp"
else
2004-11-17 00:59:04 +00:00
case "$target_os" in
cygwin*)
EXTRASYSSRCS="$EXTRASYSSRCS ../Windows/clip_windows.cpp"
;;
*)
EXTRASYSSRCS="$EXTRASYSSRCS ../dummy/clip_dummy.cpp"
;;
esac
2004-06-27 22:06:02 +00:00
fi
2004-06-23 14:30:48 +00:00
else
2004-06-27 22:06:02 +00:00
VIDEOSRCS="video_x.cpp"
2004-06-27 18:14:43 +00:00
KEYCODES="keycodes"
2004-06-27 22:06:02 +00:00
EXTRASYSSRCS="$EXTRASYSSRCS clip_unix.cpp"
2004-06-23 14:30:48 +00:00
fi
2004-07-19 19:25:07 +00:00
if [[ "x$WANT_SDL_AUDIO" = "xyes" ]]; then
AC_DEFINE(USE_SDL_AUDIO, 1, [Define to enable SDL audio support])
AUDIOSRC="../SDL/audio_sdl.cpp"
fi
2000-09-22 17:14:04 +00:00
2010-10-06 00:30:23 +00:00
dnl BINCUE overrides
if [[ "x$have_bincue" = "xyes" ]]; then
EXTRASYSSRCS="$EXTRASYSSRCS bincue_unix.cpp"
fi
2000-10-11 17:55:06 +00:00
dnl Use 68k CPU natively?
WANT_NATIVE_M68K=no
if [[ "x$HAVE_M68K" = "xyes" -a "x$CAN_NATIVE_M68K" = "xyes" ]]; then
2002-09-16 13:29:33 +00:00
AC_DEFINE(ENABLE_NATIVE_M68K, 1, [Define if using native 68k mode.])
2000-10-11 17:55:06 +00:00
WANT_NATIVE_M68K=yes
fi
2000-07-13 13:47:12 +00:00
if [[ "x$HAVE_PTHREADS" = "xno" ]]; then
dnl Serial, ethernet and audio support needs pthreads
AC_MSG_WARN([You don't have pthreads, disabling serial, ethernet and audio support.])
SERIALSRC=../dummy/serial_dummy.cpp
ETHERSRC=../dummy/ether_dummy.cpp
AUDIOSRC=../dummy/audio_dummy.cpp
fi
2005-05-13 17:32:13 +00:00
SYSSRCS="$VIDEOSRCS $EXTFSSRC $SERIALSRC $ETHERSRC $SCSISRC $AUDIOSRC $SEMSRC $UISRCS $MONSRCS $EXTRASYSSRCS"
1999-10-21 15:14:42 +00:00
2000-09-22 17:14:04 +00:00
dnl Define a macro that translates a yesno-variable into a C macro definition
dnl to be put into the config.h file
dnl $1 -- the macro to define
dnl $2 -- the value to translate
2002-09-16 13:29:33 +00:00
dnl $3 -- template name
2005-06-30 21:25:26 +00:00
AC_DEFUN([AC_TRANSLATE_DEFINE], [
2001-06-26 22:35:42 +00:00
if [[ "x$2" = "xyes" -o "x$2" = "xguessing yes" ]]; then
2002-09-16 13:29:33 +00:00
AC_DEFINE($1, 1, $3)
2000-09-22 17:14:04 +00:00
fi
])
2004-05-09 16:16:05 +00:00
dnl Check that the host supports TUN/TAP devices
AC_CACHE_CHECK([whether TUN/TAP is supported],
ac_cv_tun_tap_support, [
AC_TRY_COMPILE([
#if defined(HAVE_LINUX_IF_H) && defined(HAVE_LINUX_IF_TUN_H)
#include <linux/if.h>
#include <linux/if_tun.h>
#endif
#if defined(HAVE_NET_IF_H) && defined(HAVE_NET_IF_TUN_H)
#include <net/if.h>
#include <net/if_tun.h>
#endif
], [
struct ifreq ifr;
memset(&ifr, 0, sizeof(ifr));
ifr.ifr_flags = IFF_TAP | IFF_NO_PI;
],
ac_cv_tun_tap_support=yes, ac_cv_tun_tap_support=no
)
])
AC_TRANSLATE_DEFINE(ENABLE_TUNTAP, "$ac_cv_tun_tap_support",
[Define if your system supports TUN/TAP devices.])
2000-09-22 17:14:04 +00:00
2001-06-26 22:35:42 +00:00
dnl Various checks if the system supports vm_allocate() and the like functions.
have_mach_vm=no
if [[ "x$ac_cv_func_vm_allocate" = "xyes" -a "x$ac_cv_func_vm_deallocate" = "xyes" -a \
"x$ac_cv_func_vm_protect" = "xyes" ]]; then
have_mach_vm=yes
fi
2002-09-16 13:29:33 +00:00
AC_TRANSLATE_DEFINE(HAVE_MACH_VM, "$have_mach_vm",
[Define if your system has a working vm_allocate()-based memory allocator.])
2001-06-26 22:35:42 +00:00
dnl Check that vm_allocate(), vm_protect() work
if [[ "x$have_mach_vm" = "xyes" ]]; then
2002-09-16 13:29:33 +00:00
AC_CACHE_CHECK([whether vm_protect works],
2001-06-26 22:35:42 +00:00
ac_cv_vm_protect_works, [
AC_LANG_SAVE
AC_LANG_CPLUSPLUS
ac_cv_vm_protect_works=yes
dnl First the tests that should segfault
for test_def in NONE_READ NONE_WRITE READ_WRITE; do
AC_TRY_RUN([
#define CONFIGURE_TEST_VM_MAP
#define TEST_VM_PROT_$test_def
#include "vm_alloc.cpp"
], ac_cv_vm_protect_works=no, rm -f core,
dnl When cross-compiling, do not assume anything
ac_cv_vm_protect_works="guessing no"
)
done
AC_TRY_RUN([
#define CONFIGURE_TEST_VM_MAP
#define TEST_VM_PROT_RDWR_WRITE
#include "vm_alloc.cpp"
], , ac_cv_vm_protect_works=no,
dnl When cross-compiling, do not assume anything
ac_cv_vm_protect_works="guessing no"
)
AC_LANG_RESTORE
]
)
dnl Remove support for vm_allocate() if vm_protect() does not work
if [[ "x$have_mach_vm" = "xyes" ]]; then
case $ac_cv_vm_protect_works in
*yes) have_mach_vm=yes;;
*no) have_mach_vm=no;;
esac
fi
2002-09-16 13:29:33 +00:00
AC_TRANSLATE_DEFINE(HAVE_MACH_VM, "$have_mach_vm",
[Define if your system has a working vm_allocate()-based memory allocator.])
2001-06-26 22:35:42 +00:00
fi dnl HAVE_MACH_VM
dnl Various checks if the system supports mmap() and the like functions.
dnl ... and Mach memory allocators are not supported
have_mmap_vm=no
if [[ "x$ac_cv_func_mmap" = "xyes" -a "x$ac_cv_func_munmap" = "xyes" -a \
"x$ac_cv_func_mprotect" = "xyes" ]]; then
if [[ "x$have_mach_vm" = "xno" ]]; then
have_mmap_vm=yes
fi
fi
2002-09-16 13:29:33 +00:00
AC_TRANSLATE_DEFINE(HAVE_MMAP_VM, "$have_mmap_vm",
[Define if your system has a working mmap()-based memory allocator.])
2001-06-26 22:35:42 +00:00
dnl Check that mmap() and associated functions work.
if [[ "x$have_mmap_vm" = "xyes" ]]; then
dnl Check if we have a working anonymous mmap()
2002-09-16 13:29:33 +00:00
AC_CACHE_CHECK([whether mmap supports MAP_ANON],
2001-06-26 22:35:42 +00:00
ac_cv_mmap_anon, [
AC_LANG_SAVE
AC_LANG_CPLUSPLUS
AC_TRY_RUN([
#define HAVE_MMAP_ANON
#define CONFIGURE_TEST_VM_MAP
#define TEST_VM_MMAP_ANON
#include "vm_alloc.cpp"
], ac_cv_mmap_anon=yes, ac_cv_mmap_anon=no,
dnl When cross-compiling, do not assume anything.
ac_cv_mmap_anon="guessing no"
)
AC_LANG_RESTORE
]
)
2002-09-16 13:29:33 +00:00
AC_TRANSLATE_DEFINE(HAVE_MMAP_ANON, "$ac_cv_mmap_anon",
[Define if <sys/mman.h> defines MAP_ANON and mmap()'ing with MAP_ANON works.])
2001-06-26 22:35:42 +00:00
2002-09-16 13:29:33 +00:00
AC_CACHE_CHECK([whether mmap supports MAP_ANONYMOUS],
2001-06-26 22:35:42 +00:00
ac_cv_mmap_anonymous, [
AC_LANG_SAVE
AC_LANG_CPLUSPLUS
AC_TRY_RUN([
#define HAVE_MMAP_ANONYMOUS
#define CONFIGURE_TEST_VM_MAP
#define TEST_VM_MMAP_ANON
#include "vm_alloc.cpp"
], ac_cv_mmap_anonymous=yes, ac_cv_mmap_anonymous=no,
dnl When cross-compiling, do not assume anything.
ac_cv_mmap_anonymous="guessing no"
)
AC_LANG_RESTORE
]
)
2002-09-16 13:29:33 +00:00
AC_TRANSLATE_DEFINE(HAVE_MMAP_ANONYMOUS, "$ac_cv_mmap_anonymous",
[Define if <sys/mman.h> defines MAP_ANONYMOUS and mmap()'ing with MAP_ANONYMOUS works.])
2001-06-26 22:35:42 +00:00
2002-09-16 13:29:33 +00:00
AC_CACHE_CHECK([whether mprotect works],
2001-06-26 22:35:42 +00:00
ac_cv_mprotect_works, [
AC_LANG_SAVE
AC_LANG_CPLUSPLUS
ac_cv_mprotect_works=yes
dnl First the tests that should segfault
for test_def in NONE_READ NONE_WRITE READ_WRITE; do
AC_TRY_RUN([
#define CONFIGURE_TEST_VM_MAP
#define TEST_VM_PROT_$test_def
#include "vm_alloc.cpp"
], ac_cv_mprotect_works=no, rm -f core,
dnl When cross-compiling, do not assume anything
ac_cv_mprotect_works="guessing no"
)
done
AC_TRY_RUN([
#define CONFIGURE_TEST_VM_MAP
#define TEST_VM_PROT_RDWR_WRITE
#include "vm_alloc.cpp"
], , ac_cv_mprotect_works=no,
dnl When cross-compiling, do not assume anything
ac_cv_mprotect_works="guessing no"
)
AC_LANG_RESTORE
]
)
dnl Remove support for mmap() if mprotect() does not work
if [[ "x$have_mmap_vm" = "xyes" ]]; then
case $ac_cv_mprotect_works in
*yes) have_mmap_vm=yes;;
*no) have_mmap_vm=no;;
esac
fi
2002-09-16 13:29:33 +00:00
AC_TRANSLATE_DEFINE(HAVE_MMAP_VM, $have_mmap_vm,
[Define if your system has a working mmap()-based memory allocator.])
2001-06-26 22:35:42 +00:00
fi dnl HAVE_MMAP_VM
2003-10-12 22:39:59 +00:00
dnl Check if we can modify the __PAGEZERO segment for use as Low Memory
AC_CACHE_CHECK([whether __PAGEZERO can be Low Memory area 0x0000-0x2000],
ac_cv_pagezero_hack, [
ac_cv_pagezero_hack=no
if AC_TRY_COMMAND([Darwin/testlmem.sh 0x2000]); then
ac_cv_pagezero_hack=yes
dnl might as well skip the test for mmap-able low memory
ac_cv_can_map_lm=no
fi
])
AC_TRANSLATE_DEFINE(PAGEZERO_HACK, "$ac_cv_pagezero_hack",
[Define if the __PAGEZERO Mach-O Low Memory Globals hack works on this system.])
2000-09-22 17:14:04 +00:00
dnl Check if we can mmap 0x2000 bytes from 0x0000
2002-09-16 13:29:33 +00:00
AC_CACHE_CHECK([whether we can map Low Memory area 0x0000-0x2000],
2000-09-22 17:14:04 +00:00
ac_cv_can_map_lm, [
AC_LANG_SAVE
AC_LANG_CPLUSPLUS
AC_TRY_RUN([
2001-06-26 22:35:42 +00:00
#include "vm_alloc.cpp"
int main(void) { /* returns 0 if we could map the lowmem globals */
2003-05-13 16:33:06 +00:00
volatile char * lm = 0;
2001-06-26 22:35:42 +00:00
if (vm_init() < 0) exit(1);
2003-05-13 16:33:06 +00:00
if (vm_acquire_fixed(0, 0x2000) < 0) exit(1);
2001-06-26 22:35:42 +00:00
lm[0] = 'z';
if (vm_release((char *)lm, 0x2000) < 0) exit(1);
vm_exit(); exit(0);
2000-09-22 17:14:04 +00:00
}
2001-06-26 22:35:42 +00:00
], ac_cv_can_map_lm=yes, ac_cv_can_map_lm=no,
dnl When cross-compiling, do not assume anything.
ac_cv_can_map_lm="guessing no"
2000-09-22 17:14:04 +00:00
)
AC_LANG_RESTORE
]
)
2001-05-20 20:31:50 +00:00
dnl Check signal handlers need to be reinstalled
2002-09-16 13:29:33 +00:00
AC_CACHE_CHECK([whether signal handlers need to be reinstalled],
2001-06-26 22:35:42 +00:00
ac_cv_signal_need_reinstall, [
AC_LANG_SAVE
AC_LANG_CPLUSPLUS
AC_TRY_RUN([
#include <stdlib.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <signal.h>
static int handled_signal = 0;
RETSIGTYPE sigusr1_handler(int) { handled_signal++; }
int main(void) { /* returns 0 if signals need not to be reinstalled */
signal(SIGUSR1, sigusr1_handler); raise(SIGUSR1); raise(SIGUSR1);
exit(handled_signal == 2);
}
], ac_cv_signal_need_reinstall=yes, ac_cv_signal_need_reinstall=no,
dnl When cross-compiling, do not assume anything.
ac_cv_signal_need_reinstall="guessing yes"
)
AC_LANG_RESTORE
]
2001-05-20 20:31:50 +00:00
)
2002-09-16 13:29:33 +00:00
AC_TRANSLATE_DEFINE(SIGNAL_NEED_REINSTALL, "$ac_cv_signal_need_reinstall",
[Define if your system requires signals to be reinstalled.])
2001-05-20 20:31:50 +00:00
dnl Check if sigaction handlers need to be reinstalled
2002-09-16 13:29:33 +00:00
AC_CACHE_CHECK([whether sigaction handlers need to be reinstalled],
2001-05-20 20:31:50 +00:00
ac_cv_sigaction_need_reinstall, [
2000-09-22 17:14:04 +00:00
AC_LANG_SAVE
AC_LANG_CPLUSPLUS
AC_TRY_RUN([
2000-10-08 18:41:35 +00:00
#include <stdlib.h>
2001-05-20 20:31:50 +00:00
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
2000-09-22 17:14:04 +00:00
#include <signal.h>
2001-05-20 20:31:50 +00:00
static int handled_signal = 0;
RETSIGTYPE sigusr1_handler(int) { handled_signal++; }
typedef RETSIGTYPE (*signal_handler)(int);
static signal_handler mysignal(int sig, signal_handler handler) {
struct sigaction old_sa;
struct sigaction new_sa;
new_sa.sa_handler = handler;
return ((sigaction(sig,&new_sa,&old_sa) < 0) ? SIG_IGN : old_sa.sa_handler);
}
int main(void) { /* returns 0 if signals need not to be reinstalled */
mysignal(SIGUSR1, sigusr1_handler); raise(SIGUSR1); raise(SIGUSR1);
exit(handled_signal == 2);
2000-09-22 17:14:04 +00:00
}
2001-06-26 22:35:42 +00:00
], ac_cv_sigaction_need_reinstall=yes, ac_cv_sigaction_need_reinstall=no,
dnl When cross-compiling, do not assume anything.
ac_cv_sigaction_need_reinstall="guessing yes"
2001-05-20 20:31:50 +00:00
)
AC_LANG_RESTORE
]
)
2002-09-16 13:29:33 +00:00
AC_TRANSLATE_DEFINE(SIGACTION_NEED_REINSTALL, "$ac_cv_sigaction_need_reinstall",
[Define if your system requires sigactions to be reinstalled.])
2001-05-20 20:31:50 +00:00
2003-10-12 15:56:00 +00:00
dnl Check if Mach exceptions supported.
AC_CACHE_CHECK([whether your system supports Mach exceptions],
ac_cv_have_mach_exceptions, [
2001-05-20 20:31:50 +00:00
AC_LANG_SAVE
AC_LANG_CPLUSPLUS
AC_TRY_RUN([
2010-07-28 01:10:24 +00:00
#define HAVE_UNISTD_H 1
2010-07-27 22:52:33 +00:00
#define HAVE_MACH_VM 1
#define HAVE_MACH_TASK_SELF 1
2003-10-12 15:56:00 +00:00
#define HAVE_MACH_EXCEPTIONS 1
2001-06-26 22:35:42 +00:00
#define CONFIGURE_TEST_SIGSEGV_RECOVERY
#include "vm_alloc.cpp"
2001-05-20 20:31:50 +00:00
#include "sigsegv.cpp"
2003-10-12 15:56:00 +00:00
], [
sigsegv_recovery=mach
ac_cv_have_mach_exceptions=yes
],
ac_cv_have_mach_exceptions=no,
2001-06-26 22:35:42 +00:00
dnl When cross-compiling, do not assume anything.
2003-10-12 15:56:00 +00:00
ac_cv_have_mach_exceptions=no
2000-09-22 17:14:04 +00:00
)
AC_LANG_RESTORE
]
)
2003-10-12 15:56:00 +00:00
AC_TRANSLATE_DEFINE(HAVE_MACH_EXCEPTIONS, "$ac_cv_have_mach_exceptions",
[Define if your system supports Mach exceptions.])
2004-11-14 23:24:51 +00:00
dnl Check if Windows exceptions are supported.
AC_CACHE_CHECK([whether your system supports Windows exceptions],
ac_cv_have_win32_exceptions, [
AC_LANG_SAVE
AC_LANG_CPLUSPLUS
AC_TRY_RUN([
#define HAVE_WIN32_EXCEPTIONS 1
#define CONFIGURE_TEST_SIGSEGV_RECOVERY
#include "vm_alloc.cpp"
#include "sigsegv.cpp"
], [
sigsegv_recovery=win32
ac_cv_have_win32_exceptions=yes
],
ac_cv_have_win32_exceptions=no,
dnl When cross-compiling, do not assume anything.
ac_cv_have_win32_exceptions=no
)
AC_LANG_RESTORE
]
)
AC_TRANSLATE_DEFINE(HAVE_WIN32_EXCEPTIONS, "$ac_cv_have_win32_exceptions",
[Define if your system supports Windows exceptions.])
2003-10-12 15:56:00 +00:00
dnl Otherwise, check if extended signals are supported.
if [[ -z "$sigsegv_recovery" ]]; then
AC_CACHE_CHECK([whether your system supports extended signal handlers],
ac_cv_have_extended_signals, [
AC_LANG_SAVE
AC_LANG_CPLUSPLUS
AC_TRY_RUN([
#define HAVE_SIGINFO_T 1
#define CONFIGURE_TEST_SIGSEGV_RECOVERY
#include "vm_alloc.cpp"
#include "sigsegv.cpp"
], [
sigsegv_recovery=siginfo
ac_cv_have_extended_signals=yes
],
ac_cv_have_extended_signals=no,
dnl When cross-compiling, do not assume anything.
ac_cv_have_extended_signals=no
)
AC_LANG_RESTORE
]
)
AC_TRANSLATE_DEFINE(HAVE_SIGINFO_T, "$ac_cv_have_extended_signals",
[Define if your system support extended signals.])
fi
2002-05-12 11:10:50 +00:00
2000-09-22 17:14:04 +00:00
dnl Otherwise, check for subterfuges.
2003-10-12 15:56:00 +00:00
if [[ -z "$sigsegv_recovery" ]]; then
2002-09-16 13:29:33 +00:00
AC_CACHE_CHECK([whether we then have a subterfuge for your system],
2001-05-20 20:31:50 +00:00
ac_cv_have_sigcontext_hack, [
AC_LANG_SAVE
AC_LANG_CPLUSPLUS
AC_TRY_RUN([
#define HAVE_SIGCONTEXT_SUBTERFUGE 1
2001-06-26 22:35:42 +00:00
#define CONFIGURE_TEST_SIGSEGV_RECOVERY
#include "vm_alloc.cpp"
2001-05-20 20:31:50 +00:00
#include "sigsegv.cpp"
2003-10-12 15:56:00 +00:00
], [
sigsegv_recovery=sigcontext
ac_cv_have_sigcontext_hack=yes
],
ac_cv_have_sigcontext_hack=no,
2001-06-26 22:35:42 +00:00
dnl When cross-compiling, do not assume anything.
ac_cv_have_sigcontext_hack=no
2001-05-20 20:31:50 +00:00
)
AC_LANG_RESTORE
])
2002-09-16 13:29:33 +00:00
AC_TRANSLATE_DEFINE(HAVE_SIGCONTEXT_SUBTERFUGE, "$ac_cv_have_sigcontext_hack",
[Define if we know a hack to replace siginfo_t->si_addr member.])
2000-09-22 17:14:04 +00:00
fi
2002-05-12 11:10:50 +00:00
dnl Check if we can ignore the fault (instruction skipping in SIGSEGV handler)
2002-09-16 13:29:33 +00:00
AC_CACHE_CHECK([whether we can skip instruction in SIGSEGV handler],
2002-05-12 11:10:50 +00:00
ac_cv_have_skip_instruction, [
AC_LANG_SAVE
AC_LANG_CPLUSPLUS
AC_TRY_RUN([
#define HAVE_SIGSEGV_SKIP_INSTRUCTION 1
#define CONFIGURE_TEST_SIGSEGV_RECOVERY
#include "vm_alloc.cpp"
#include "sigsegv.cpp"
], ac_cv_have_skip_instruction=yes, ac_cv_have_skip_instruction=no,
dnl When cross-compiling, do not assume anything.
ac_cv_have_skip_instruction=no
)
AC_LANG_RESTORE
]
)
2002-09-16 13:29:33 +00:00
AC_TRANSLATE_DEFINE(HAVE_SIGSEGV_SKIP_INSTRUCTION, "$ac_cv_have_skip_instruction",
[Define if we can ignore the fault (instruction skipping in SIGSEGV handler).])
2002-05-12 11:10:50 +00:00
2000-09-22 17:14:04 +00:00
dnl Can we do Video on SEGV Signals ?
CAN_VOSF=no
2003-10-12 15:56:00 +00:00
if [[ -n "$sigsegv_recovery" ]]; then
2000-09-22 17:14:04 +00:00
CAN_VOSF=yes
fi
2003-10-12 22:39:59 +00:00
dnl A dummy program that returns always true
2004-06-24 22:34:43 +00:00
AC_PATH_PROG([BLESS], "true")
2003-10-12 22:39:59 +00:00
2006-02-27 00:11:49 +00:00
dnl Check for linker script support
case $target_os:$target_cpu in
linux*:i?86) LINKER_SCRIPT_FLAGS="-Wl,-T,ldscripts/linux-i386.ld";;
linux*:x86_64) LINKER_SCRIPT_FLAGS="-Wl,-T,ldscripts/linux-x86_64.ld";;
2006-03-25 07:08:50 +00:00
linux*:powerpc) LINKER_SCRIPT_FLAGS="-Wl,-T,ldscripts/linux-ppc.ld";;
2006-03-15 06:54:07 +00:00
netbsd*:i?86) LINKER_SCRIPT_FLAGS="-Wl,-T,ldscripts/linux-i386.ld";;
freebsd*:i?86) LINKER_SCRIPT_FLAGS="-Wl,-T,ldscripts/freebsd-i386.ld";;
2006-03-25 07:08:50 +00:00
darwin*:*) LINKER_SCRIPT_FLAGS="-Wl,-seg1addr,0x78048000";;
2006-02-27 00:11:49 +00:00
esac
if [[ -n "$LINKER_SCRIPT_FLAGS" ]]; then
AC_CACHE_CHECK([whether linker script is usable],
ac_cv_linker_script_works, [
AC_LANG_SAVE
AC_LANG_CPLUSPLUS
saved_LDFLAGS="$LDFLAGS"
LDFLAGS="$LDFLAGS $LINKER_SCRIPT_FLAGS"
AC_TRY_RUN(
[int main() {if ((char *)&main < (char *)0x70000000) return 1;}],
[ac_cv_linker_script_works=yes],
[ac_cv_linker_script_works=no],
dnl When cross-compiling, assume it works
[ac_cv_linker_script_works="guessing yes"]
)
AC_LANG_RESTORE
if [[ "$ac_cv_linker_script_works" = "no" ]]; then
LDFLAGS="$saved_LDFLAGS"
LINKER_SCRIPT_FLAGS=""
fi
])
fi
AC_TRANSLATE_DEFINE(HAVE_LINKER_SCRIPT, "$ac_cv_linker_script_works",
[Define if there is a linker script to relocate the executable above 0x70000000.])
2000-09-22 17:14:04 +00:00
dnl Determine the addressing mode to use
2000-10-11 17:55:06 +00:00
if [[ "x$WANT_NATIVE_M68K" = "xyes" ]]; then
ADDRESSING_MODE="real"
else
ADDRESSING_MODE=""
AC_MSG_CHECKING([for the addressing mode to use])
for am in $ADDRESSING_TEST_ORDER; do
case $am in
real)
2001-01-28 14:04:32 +00:00
dnl Requires ability to mmap() Low Memory globals
2003-10-12 22:39:59 +00:00
if [[ "x$ac_cv_can_map_lm$ac_cv_pagezero_hack" = "xnono" ]]; then
2000-10-11 17:55:06 +00:00
continue
fi
2003-10-12 22:39:59 +00:00
dnl Requires VOSF screen updates
2001-01-28 14:04:32 +00:00
if [[ "x$CAN_VOSF" = "xno" ]]; then
continue
2000-09-22 17:14:04 +00:00
fi
2001-01-28 14:04:32 +00:00
dnl Real addressing will probably work.
2000-10-11 17:55:06 +00:00
ADDRESSING_MODE="real"
WANT_VOSF=yes dnl we can use VOSF and we need it actually
DEFINES="$DEFINES -DREAL_ADDRESSING"
2003-10-12 22:39:59 +00:00
if [[ "x$ac_cv_pagezero_hack" = "xyes" ]]; then
BLESS=Darwin/lowmem
LDFLAGS="$LDFLAGS -pagezero_size 0x2000"
fi
2000-10-11 17:55:06 +00:00
break
;;
direct)
2001-01-28 14:04:32 +00:00
dnl Requires VOSF screen updates
2000-10-11 17:55:06 +00:00
if [[ "x$CAN_VOSF" = "xyes" ]]; then
ADDRESSING_MODE="direct"
WANT_VOSF=yes dnl we can use VOSF and we need it actually
DEFINES="$DEFINES -DDIRECT_ADDRESSING"
break
2000-09-22 17:14:04 +00:00
fi
2000-10-11 17:55:06 +00:00
;;
banks)
dnl Default addressing mode
ADDRESSING_MODE="memory banks"
2000-09-22 17:14:04 +00:00
break
2000-10-11 17:55:06 +00:00
;;
*)
AC_MSG_ERROR([Internal configure.in script error for $am addressing mode])
esac
done
AC_MSG_RESULT($ADDRESSING_MODE)
if [[ "x$ADDRESSING_MODE" = "x" ]]; then
AC_MSG_WARN([Sorry, no suitable addressing mode in $ADDRESSING_TEST_ORDER])
2000-09-22 17:14:04 +00:00
ADDRESSING_MODE="memory banks"
2000-10-11 17:55:06 +00:00
fi
2000-09-22 17:14:04 +00:00
fi
2002-09-17 16:08:41 +00:00
dnl Banked Memory Addressing mode is not supported by the JIT compiler
if [[ "x$WANT_JIT" = "xyes" -a "x$ADDRESSING_MODE" = "xmemory banks" ]]; then
AC_MSG_ERROR([Sorry, the JIT Compiler requires Direct Addressing, at least])
fi
2001-01-28 14:04:32 +00:00
dnl Enable VOSF screen updates with this feature is requested and feasible
if [[ "x$WANT_VOSF" = "xyes" -a "x$CAN_VOSF" = "xyes" ]]; then
2002-09-16 13:29:33 +00:00
AC_DEFINE(ENABLE_VOSF, 1, [Define if using video enabled on SEGV signals.])
2001-01-28 14:04:32 +00:00
else
WANT_VOSF=no
2000-09-22 17:14:04 +00:00
fi
1999-10-05 15:29:04 +00:00
dnl Check for GAS.
1999-10-03 14:16:26 +00:00
HAVE_GAS=no
AC_MSG_CHECKING(for GAS .p2align feature)
cat >conftest.S << EOF
.text
.p2align 5
EOF
if $CC conftest.S -c -o conftest.o >/dev/null 2>&1 ; then HAVE_GAS=yes; fi
AC_MSG_RESULT($HAVE_GAS)
1999-10-05 15:29:04 +00:00
dnl Check for GCC 2.7 or higher.
1999-10-03 14:16:26 +00:00
HAVE_GCC27=no
AC_MSG_CHECKING(for GCC 2.7 or higher)
2005-07-06 05:25:05 +00:00
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#if ! (__GNUC__ - 1 > 1 || __GNUC_MINOR__ - 1 > 5)
# error gcc < 2.7
#endif
]])],
[AC_MSG_RESULT(yes); HAVE_GCC27=yes],
[AC_MSG_RESULT(no)])
1999-10-03 14:16:26 +00:00
2001-08-02 13:52:24 +00:00
dnl Check for GCC 3.0 or higher.
HAVE_GCC30=no
AC_MSG_CHECKING(for GCC 3.0 or higher)
2005-07-06 05:25:05 +00:00
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#if ! (__GNUC__ >= 3)
# error gcc < 3
#endif
]])],
[AC_MSG_RESULT(yes); HAVE_GCC30=yes],
[AC_MSG_RESULT(no)])
2001-08-02 13:52:24 +00:00
2005-05-13 09:21:21 +00:00
dnl Check for ICC.
AC_MSG_CHECKING(for ICC)
HAVE_ICC=no
if $CXX -V -v 2>&1 | grep -q "Intel(R) C++ Compiler"; then
HAVE_ICC=yes
fi
AC_MSG_RESULT($HAVE_ICC)
2000-07-13 13:47:12 +00:00
dnl Set "-fomit-frame-pointer" on i386 GCC 2.7 or higher.
2002-02-07 16:10:57 +00:00
dnl Also set "-fno-exceptions" for C++ because exception handling requires
dnl the frame pointer.
2000-07-13 13:47:12 +00:00
if [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_I386" = "xyes" ]]; then
1999-10-03 14:16:26 +00:00
CFLAGS="$CFLAGS -fomit-frame-pointer"
2002-02-07 16:10:57 +00:00
CXXFLAGS="$CXXFLAGS -fomit-frame-pointer -fno-exceptions"
1999-10-03 14:16:26 +00:00
fi
2001-08-02 13:52:24 +00:00
dnl (gb) Do not merge constants since it breaks fpu/fpu_x86.cpp.
dnl As of 2001/08/02, this affects the following compilers:
dnl Official: probably gcc-3.1 (mainline CVS)
dnl Mandrake: gcc-2.96 >= 0.59mdk, gcc-3.0.1 >= 0.1mdk
dnl Red Hat : gcc-2.96 >= 89, gcc-3.0 >= 1
2005-05-13 09:21:21 +00:00
if [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_ICC" = "xno" ]]; then
2001-08-02 13:52:24 +00:00
SAVED_CXXFLAGS="$CXXFLAGS"
2001-08-19 16:18:30 +00:00
CXXFLAGS="$CXXFLAGS -fno-merge-constants"
2001-08-02 13:52:24 +00:00
AC_CACHE_CHECK([whether GCC supports constants merging], ac_cv_gcc_constants_merging, [
AC_LANG_SAVE
AC_LANG_CPLUSPLUS
AC_TRY_COMPILE([],[],[ac_cv_gcc_constants_merging=yes],[ac_cv_gcc_constants_merging=no])
AC_LANG_RESTORE
])
if [[ "x$ac_cv_gcc_constants_merging" != "xyes" ]]; then
CXXFLAGS="$SAVED_CXXFLAGS"
fi
fi
2004-11-02 20:40:54 +00:00
dnl Store motion was introduced in 3.3-hammer branch and any gcc >= 3.4
dnl However, there are some corner cases exposed on x86-64
2005-05-13 09:21:21 +00:00
if [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_ICC" = "xno" ]]; then
2004-11-02 20:40:54 +00:00
SAVED_CXXFLAGS="$CXXFLAGS"
CXXFLAGS="$CXXFLAGS -fno-gcse-sm"
AC_CACHE_CHECK([whether GCC supports store motion], ac_cv_gcc_store_motion, [
AC_LANG_SAVE
AC_LANG_CPLUSPLUS
AC_TRY_COMPILE([],[],[ac_cv_gcc_store_motion=yes],[ac_cv_gcc_store_motion=no])
AC_LANG_RESTORE
])
if [[ "x$ac_cv_gcc_store_motion" != "xyes" ]]; then
CXXFLAGS="$SAVED_CXXFLAGS"
fi
fi
2005-05-13 09:21:21 +00:00
dnl Add -fno-strict-aliasing for slirp sources
if [[ "x$HAVE_GCC30" = "xyes" ]]; then
2005-05-13 11:13:26 +00:00
SAVED_CFLAGS="$CFLAGS"
2005-05-13 09:21:21 +00:00
CFLAGS="$CFLAGS -fno-strict-aliasing"
AC_CACHE_CHECK([whether the compiler supports -fno-strict-aliasing],
ac_cv_gcc_no_strict_aliasing, [
AC_TRY_COMPILE([],[],
2005-06-06 19:31:22 +00:00
[ac_cv_gcc_no_strict_aliasing=yes; AC_SUBST(SLIRP_CFLAGS, "-fno-strict-aliasing")],
2005-05-13 09:21:21 +00:00
[ac_cv_gcc_no_strict_aliasing=no])
])
CFLAGS="$SAVED_CFLAGS"
fi
2005-08-18 22:10:15 +00:00
dnl Add -mdynamic-no-pic for MacOS X (XXX icc10 will support MacOS X)
if [[ "x$HAVE_GCC30" = "xyes" -a "x$HAVE_ICC" = "xno" ]]; then
2005-07-01 05:57:07 +00:00
SAVED_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -mdynamic-no-pic"
AC_CACHE_CHECK([whether the compiler supports -mdynamic-no-pic],
ac_cv_gcc_mdynamic_no_pic, [
AC_TRY_COMPILE([],[],[ac_cv_gcc_mdynamic_no_pic=yes],[ac_cv_gcc_mdynamic_no_pic=no])
])
if [[ "x$ac_cv_gcc_mdynamic_no_pic" = "xyes" ]]; then
CXXFLAGS="$CXXFLAGS -mdynamic-no-pic"
else
CFLAGS="$SAVED_CFLAGS"
fi
fi
1999-10-05 15:29:04 +00:00
dnl Select appropriate CPU source and REGPARAM define.
2000-09-22 17:14:04 +00:00
ASM_OPTIMIZATIONS=none
1999-10-21 15:14:42 +00:00
CPUSRCS="cpuemu1.cpp cpuemu2.cpp cpuemu3.cpp cpuemu4.cpp cpuemu5.cpp cpuemu6.cpp cpuemu7.cpp cpuemu8.cpp"
2002-09-17 16:08:41 +00:00
dnl (gb) JITSRCS will be emptied later if the JIT is not available
dnl Other platforms should define their own set of noflags file variants
CAN_JIT=no
JITSRCS="compemu1.cpp compemu2.cpp compemu3.cpp compemu4.cpp compemu5.cpp compemu6.cpp compemu7.cpp compemu8.cpp"
2002-10-01 09:58:08 +00:00
if [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_I386" = "xyes" ]]; then
1999-10-21 15:14:42 +00:00
dnl i386 CPU
2002-09-18 11:41:56 +00:00
DEFINES="$DEFINES -DUNALIGNED_PROFITABLE -DREGPARAM=\"__attribute__((regparm(3)))\""
1999-10-03 14:16:26 +00:00
if [[ "x$HAVE_GAS" = "xyes" ]]; then
2000-09-22 17:14:04 +00:00
ASM_OPTIMIZATIONS=i386
2010-07-28 01:10:24 +00:00
DEFINES="$DEFINES -DX86_ASSEMBLY -DOPTIMIZED_FLAGS -DSAHF_SETO_PROFITABLE"
2002-10-01 09:51:09 +00:00
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"
2002-10-01 09:58:08 +00:00
CAN_JIT=yes
1999-10-03 14:16:26 +00:00
fi
2002-11-05 11:58:40 +00:00
elif [[ "x$HAVE_GCC30" = "xyes" -a "x$HAVE_X86_64" = "xyes" ]]; then
dnl x86-64 CPU
DEFINES="$DEFINES -DUNALIGNED_PROFITABLE"
if [[ "x$HAVE_GAS" = "xyes" ]]; then
ASM_OPTIMIZATIONS="x86-64"
2010-07-28 01:10:24 +00:00
DEFINES="$DEFINES -DX86_64_ASSEMBLY -DOPTIMIZED_FLAGS"
2004-11-01 16:07:39 +00:00
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"
CAN_JIT=yes
2002-11-05 11:58:40 +00:00
fi
1999-10-21 15:14:42 +00:00
elif [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_SPARC" = "xyes" -a "x$HAVE_GAS" = "xyes" ]]; then
dnl SPARC CPU
2000-09-22 17:14:04 +00:00
case "$target_os" in
solaris*)
1999-10-21 15:14:42 +00:00
AC_MSG_CHECKING(SPARC CPU architecture)
SPARC_TYPE=`Solaris/which_sparc`
AC_MSG_RESULT($SPARC_TYPE)
case "$SPARC_TYPE" in
SPARC_V8)
2000-10-09 17:05:17 +00:00
ASM_OPTIMIZATIONS="SPARC V8 architecture"
2001-01-11 16:39:25 +00:00
DEFINES="$DEFINES -DSPARC_V8_ASSEMBLY" dnl -DOPTIMIZED_FLAGS"
1999-10-21 15:14:42 +00:00
CFLAGS="$CFLAGS -Wa,-Av8"
CXXFLAGS="$CXXFLAGS -Wa,-Av8"
;;
SPARC_V9)
2000-10-09 17:05:17 +00:00
ASM_OPTIMIZATIONS="SPARC V9 architecture"
2001-01-11 16:39:25 +00:00
DEFINES="$DEFINES -DSPARC_V9_ASSEMBLY" dnl -DOPTIMIZED_FLAGS"
1999-10-21 15:14:42 +00:00
CFLAGS="$CFLAGS -Wa,-Av9"
CXXFLAGS="$CXXFLAGS -Wa,-Av9"
;;
esac
;;
esac
2000-10-11 17:55:06 +00:00
elif [[ "x$WANT_NATIVE_M68K" = "xyes" ]]; then
2000-07-13 13:47:12 +00:00
dnl Native m68k, no emulation
2000-10-11 17:55:06 +00:00
CPUINCLUDES="-I../native_cpu"
CPUSRCS="asm_support.s"
1999-10-03 14:16:26 +00:00
fi
2002-09-17 16:08:41 +00:00
dnl Enable JIT compiler, if possible.
if [[ "x$WANT_JIT" = "xyes" -a "x$CAN_JIT" ]]; then
JITSRCS="$JITSRCS ../uae_cpu/compiler/compemu_support.cpp ../uae_cpu/compiler/compemu_fpp.cpp compstbl.o cpustbl_nf.o"
DEFINES="$DEFINES -DUSE_JIT -DUSE_JIT_FPU"
if [[ "x$WANT_JIT_DEBUG" = "xyes" ]]; then
if [[ "x$WANT_MON" = "xyes" ]]; then
DEFINES="$DEFINES -DJIT_DEBUG=1"
else
AC_MSG_WARN([cxmon not found, ignoring --enable-jit-debug])
WANT_JIT_DEBUG=no
fi
fi
2002-09-18 13:06:49 +00:00
dnl IEEE core is the only FPU emulator to use with the JIT compiler
case $FPE_CORE_TEST_ORDER in
ieee*) ;;
*) AC_MSG_WARN([Forcing use of the IEEE FPU core, as the JIT compiler supports only this one.]) ;;
esac
FPE_CORE_TEST_ORDER="ieee"
2002-09-17 16:08:41 +00:00
else
WANT_JIT=no
WANT_JIT_DEBUG=no
JITSRCS=""
fi
2002-09-16 12:03:07 +00:00
dnl Utility macro used by next two tests.
dnl AC_EXAMINE_OBJECT(C source code,
dnl commands examining object file,
dnl [commands to run if compile failed]):
dnl
dnl Compile the source code to an object file; then convert it into a
dnl printable representation. All unprintable characters and
dnl asterisks (*) are replaced by dots (.). All white space is
dnl deleted. Newlines (ASCII 0x10) in the input are preserved in the
dnl output, but runs of newlines are compressed to a single newline.
dnl Finally, line breaks are forcibly inserted so that no line is
dnl longer than 80 columns and the file ends with a newline. The
dnl result of all this processing is in the file conftest.dmp, which
dnl may be examined by the commands in the second argument.
dnl
AC_DEFUN([gcc_AC_EXAMINE_OBJECT],
[AC_LANG_SAVE
AC_LANG_C
dnl Next bit cribbed from AC_TRY_COMPILE.
cat > conftest.$ac_ext <<EOF
[#line __oline__ "configure"
#include "confdefs.h"
$1
]EOF
if AC_TRY_EVAL(ac_compile); then
od -c conftest.o |
sed ['s/^[0-7]*[ ]*/ /
s/\*/./g
s/ \\n/*/g
s/ [0-9][0-9][0-9]/./g
s/ \\[^ ]/./g'] |
tr -d '
' | tr -s '*' '
' | fold | sed '$a\
' > conftest.dmp
$2
ifelse($3, , , else
$3
)dnl
2001-03-20 18:05:36 +00:00
fi
2002-09-16 12:03:07 +00:00
rm -rf conftest*
AC_LANG_RESTORE])
dnl Floating point format probe.
dnl The basic concept is the same as the above: grep the object
dnl file for an interesting string. We have to watch out for
dnl rounding changing the values in the object, however; this is
dnl handled by ignoring the least significant byte of the float.
dnl
dnl Does not know about VAX G-float or C4x idiosyncratic format.
dnl It does know about PDP-10 idiosyncratic format, but this is
dnl not presently supported by GCC. S/390 "binary floating point"
dnl is in fact IEEE (but maybe we should have that in EBCDIC as well
dnl as ASCII?)
dnl
AC_DEFUN([gcc_AC_C_FLOAT_FORMAT],
[AC_CACHE_CHECK(floating point format, ac_cv_c_float_format,
[gcc_AC_EXAMINE_OBJECT(
[/* This will not work unless sizeof(double) == 8. */
extern char sizeof_double_must_be_8 [sizeof(double) == 8 ? 1 : -1];
/* This structure must have no internal padding. */
struct possibility {
char prefix[8];
double candidate;
char postfix[8];
};
#define C(cand) { "\nformat:", cand, ":tamrof\n" }
struct possibility table [] =
{
C( 3.25724264705901305206e+01), /* @@IEEEFP - IEEE 754 */
C( 3.53802595280598432000e+18), /* D__float - VAX */
C( 5.32201830133125317057e-19), /* D.PDP-10 - PDP-10 - the dot is 0x13a */
C( 1.77977764695171661377e+10), /* IBMHEXFP - s/390 format, ascii */
C(-5.22995989424860458374e+10) /* IBMHEXFP - s/390 format, EBCDIC */
};],
[if grep 'format:.@IEEEF.:tamrof' conftest.dmp >/dev/null 2>&1; then
ac_cv_c_float_format='IEEE (big-endian)'
elif grep 'format:.I@@PFE.:tamrof' conftest.dmp >/dev/null 2>&1; then
ac_cv_c_float_format='IEEE (big-endian)'
elif grep 'format:.FEEEI@.:tamrof' conftest.dmp >/dev/null 2>&1; then
ac_cv_c_float_format='IEEE (little-endian)'
elif grep 'format:.EFP@@I.:tamrof' conftest.dmp >/dev/null 2>&1; then
ac_cv_c_float_format='IEEE (little-endian)'
elif grep 'format:.__floa.:tamrof' conftest.dmp >/dev/null 2>&1; then
ac_cv_c_float_format='VAX D-float'
elif grep 'format:..PDP-1.:tamrof' conftest.dmp >/dev/null 2>&1; then
ac_cv_c_float_format='PDP-10'
elif grep 'format:.BMHEXF.:tamrof' conftest.dmp >/dev/null 2>&1; then
ac_cv_c_float_format='IBM 370 hex'
else
AC_MSG_ERROR(Unknown floating point format)
fi],
[AC_MSG_ERROR(compile failed)])
])
# IEEE is the default format. If the float endianness isn't the same
# as the integer endianness, we have to set FLOAT_WORDS_BIG_ENDIAN
# (which is a tristate: yes, no, default). This is only an issue with
# IEEE; the other formats are only supported by a few machines each,
# all with the same endianness.
format=IEEE_FLOAT_FORMAT
fbigend=
case $ac_cv_c_float_format in
'IEEE (big-endian)' )
if test $ac_cv_c_bigendian = no; then
fbigend=1
fi
;;
'IEEE (little-endian)' )
if test $ac_cv_c_bigendian = yes; then
fbigend=0
fi
;;
'VAX D-float' )
format=VAX_FLOAT_FORMAT
;;
'PDP-10' )
format=PDP10_FLOAT_FORMAT
;;
'IBM 370 hex' )
format=IBM_FLOAT_FORMAT
;;
esac
AC_DEFINE_UNQUOTED(HOST_FLOAT_FORMAT, $format,
[Define to the floating point format of the host machine.])
if test -n "$fbigend"; then
AC_DEFINE_UNQUOTED(HOST_FLOAT_WORDS_BIG_ENDIAN, $fbigend,
[Define to 1 if the host machine stores floating point numbers in
memory with the word containing the sign bit at the lowest address,
or to 0 if it does it the other way around.
This macro should not be defined if the ordering is the same as for
multi-word integers.])
2001-03-20 18:05:36 +00:00
fi
2002-09-16 12:03:07 +00:00
])
2001-03-20 18:05:36 +00:00
2002-09-16 12:03:07 +00:00
dnl Select appropriate FPU source.
gcc_AC_C_FLOAT_FORMAT
AC_CHECK_HEADERS(ieee754.h ieeefp.h floatingpoint.h nan.h)
for fpe in $FPE_CORE_TEST_ORDER; do
case $fpe in
ieee)
2002-09-16 14:17:20 +00:00
case $ac_cv_c_float_format in
IEEE*)
2002-09-16 12:03:07 +00:00
FPE_CORE="IEEE fpu core"
DEFINES="$DEFINES -DFPU_IEEE"
FPUSRCS="../uae_cpu/fpu/fpu_ieee.cpp"
2002-09-16 15:40:48 +00:00
dnl Math functions not mandated by C99 standard
AC_CHECK_FUNCS(isnanl isinfl)
dnl Math functions required by C99 standard, but probably not
dnl implemented everywhere. In that case, we fall back to the
dnl regular variant for doubles.
AC_CHECK_FUNCS(logl log10l expl powl fabsl sqrtl)
AC_CHECK_FUNCS(sinl cosl tanl sinhl coshl tanhl)
AC_CHECK_FUNCS(asinl acosl atanl asinhl acoshl atanhl)
AC_CHECK_FUNCS(floorl ceill)
2002-09-16 12:03:07 +00:00
break
2002-09-16 14:17:20 +00:00
;;
esac
2002-09-16 12:03:07 +00:00
;;
x86)
if [[ ":$HAVE_GCC27:$HAVE_I386:$HAVE_GAS:" = ":yes:yes:yes:" ]]; then
FPE_CORE="i387 fpu core"
DEFINES="$DEFINES -DFPU_X86"
FPUSRCS="../uae_cpu/fpu/fpu_x86.cpp"
break
fi
;;
uae)
FPE_CORE="uae fpu core"
DEFINES="$DEFINES -DFPU_UAE"
FPUSRCS="../uae_cpu/fpu/fpu_uae.cpp"
break
;;
*)
AC_MSG_ERROR([Internal configure.in script error for $fpe fpu core])
;;
esac
done
if [[ "x$FPE_CORE" = "x" ]]; then
AC_MSG_ERROR([Sorry, no suitable FPU core found in $FPE_CORE_TEST_ORDER])
2001-03-20 18:05:36 +00:00
fi
dnl Check for certain math functions
AC_CHECK_FUNCS(atanh)
2002-09-16 15:40:48 +00:00
AC_CHECK_FUNCS(isnan isinf finite isnormal signbit)
2001-03-20 18:05:36 +00:00
2000-07-13 13:47:12 +00:00
dnl UAE CPU sources for all non-m68k-native architectures.
if [[ "x$WANT_NATIVE_M68K" = "xno" ]]; then
2000-07-13 16:12:33 +00:00
CPUINCLUDES="-I../uae_cpu"
2002-09-17 16:08:41 +00:00
CPUSRCS="../uae_cpu/basilisk_glue.cpp ../uae_cpu/memory.cpp ../uae_cpu/newcpu.cpp ../uae_cpu/readcpu.cpp $FPUSRCS cpustbl.cpp cpudefs.cpp $CPUSRCS $JITSRCS"
2000-07-13 13:47:12 +00:00
fi
1999-10-21 15:14:42 +00:00
2000-09-22 17:14:04 +00:00
dnl Remove the "-g" option if set for GCC.
if [[ "x$HAVE_GCC27" = "xyes" ]]; then
2004-11-02 20:40:54 +00:00
CFLAGS=`echo $CFLAGS | sed -e 's/-g\b//g'`
CXXFLAGS=`echo $CXXFLAGS | sed -e 's/-g\b//g'`
2000-09-22 17:14:04 +00:00
fi
2002-11-24 20:07:25 +00:00
dnl Or if we have -IPA (MIPSPro compilers)
if [[ "x$HAVE_IPA" = "xyes" ]]; then
CFLAGS="`echo $CFLAGS | sed -e 's/-g//g'` -O3 -OPT:Olimit=0 -IPA"
CXXFLAGS="`echo $CXXFLAGS | sed -e 's/-g//g'` -O3 -OPT:Olimit=0 -IPA"
2001-03-28 16:53:39 +00:00
CXXFLAGS="-LANG:std $CXXFLAGS"
2002-11-24 20:07:25 +00:00
LDFLAGS="$LDFLAGS -O3 -OPT:Olimit=0 -IPA"
2001-03-28 16:53:39 +00:00
fi
1999-10-05 15:29:04 +00:00
dnl Generate Makefile.
1999-10-03 14:16:26 +00:00
AC_SUBST(DEFINES)
AC_SUBST(SYSSRCS)
AC_SUBST(CPUINCLUDES)
AC_SUBST(CPUSRCS)
2003-10-12 22:39:59 +00:00
AC_SUBST(BLESS)
2004-06-27 18:14:43 +00:00
AC_SUBST(KEYCODES)
2003-07-01 18:10:38 +00:00
AC_CONFIG_FILES([Makefile])
AC_OUTPUT
1999-10-25 19:01:43 +00:00
dnl Print summary.
echo
echo Basilisk II configuration summary:
echo
2004-06-23 14:30:48 +00:00
echo SDL support ............................ : $SDL_SUPPORT
2010-10-06 00:30:23 +00:00
echo BINCUE support ......................... : $have_bincue
2002-09-13 12:51:24 +00:00
echo XFree86 DGA support .................... : $WANT_XF86_DGA
echo XFree86 VidMode support ................ : $WANT_XF86_VIDMODE
echo fbdev DGA support ...................... : $WANT_FBDEV_DGA
echo Enable video on SEGV signals ........... : $WANT_VOSF
echo ESD sound support ...................... : $WANT_ESD
echo GTK user interface ..................... : $WANT_GTK
echo mon debugger support ................... : $WANT_MON
echo Running m68k code natively ............. : $WANT_NATIVE_M68K
2002-09-17 16:08:41 +00:00
echo Use JIT compiler ....................... : $WANT_JIT
echo JIT debug mode ......................... : $WANT_JIT_DEBUG
2002-09-16 12:03:07 +00:00
echo Floating-Point emulation core .......... : $FPE_CORE
2002-09-13 12:51:24 +00:00
echo Assembly optimizations ................. : $ASM_OPTIMIZATIONS
echo Addressing mode ........................ : $ADDRESSING_MODE
2003-10-12 15:56:00 +00:00
echo Bad memory access recovery type ........ : $sigsegv_recovery
1999-10-25 19:01:43 +00:00
echo
2000-07-13 13:47:12 +00:00
echo "Configuration done. Now type \"make\" (or \"gmake\")."