1 |
gbeauche |
1.1 |
dnl Process this file with autoconf to produce a configure script. |
2 |
|
|
dnl Written in 2002 by Christian Bauer |
3 |
|
|
|
4 |
gbeauche |
1.40 |
AC_INIT([SheepShaver], 2.3, [Christian.Bauer@uni-mainz.de], SheepShaver) |
5 |
gbeauche |
1.1 |
AC_CONFIG_SRCDIR(main_unix.cpp) |
6 |
|
|
AC_PREREQ(2.52) |
7 |
|
|
AC_CONFIG_HEADER(config.h) |
8 |
|
|
|
9 |
|
|
dnl Canonical system information. |
10 |
|
|
AC_CANONICAL_HOST |
11 |
|
|
AC_CANONICAL_TARGET |
12 |
|
|
|
13 |
gbeauche |
1.2 |
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 |
gbeauche |
1.33 |
dnl Invite Cygwin users to build within the Windows/ directory |
18 |
|
|
case $target_os in |
19 |
|
|
*cygwin* | *mingw32*) |
20 |
|
|
AC_MSG_ERROR([You can only build the Windows version from its directory, Cygwin/X11 is not supported.]) |
21 |
|
|
;; |
22 |
|
|
esac |
23 |
|
|
|
24 |
gbeauche |
1.1 |
dnl Options. |
25 |
|
|
AC_ARG_ENABLE(jit, [ --enable-jit enable JIT compiler [default=yes]], [WANT_JIT=$enableval], [WANT_JIT=yes]) |
26 |
|
|
AC_ARG_ENABLE(ppc-emulator, [ --enable-ppc-emulator use the selected PowerPC emulator [default=auto]], [WANT_EMULATED_PPC=$enableval], [WANT_EMULATED_PPC=auto]) |
27 |
gbeauche |
1.21 |
AC_ARG_ENABLE(fbdev-dga, [ --enable-fbdev-dga use direct frame buffer access via /dev/fb0 [default=yes]], [WANT_FBDEV_DGA=$enableval], [WANT_FBDEV_DGA=yes]) |
28 |
gbeauche |
1.1 |
AC_ARG_ENABLE(xf86-dga, [ --enable-xf86-dga use the XFree86 DGA extension [default=yes]], [WANT_XF86_DGA=$enableval], [WANT_XF86_DGA=yes]) |
29 |
gbeauche |
1.22 |
AC_ARG_ENABLE(xf86-vidmode, [ --enable-xf86-vidmode use the XFree86 VidMode extension [default=yes]], [WANT_XF86_VIDMODE=$enableval], [WANT_XF86_VIDMODE=yes]) |
30 |
gbeauche |
1.1 |
AC_ARG_ENABLE(vosf, [ --enable-vosf enable video on SEGV signals [default=yes]], [WANT_VOSF=$enableval], [WANT_VOSF=yes]) |
31 |
gbeauche |
1.50 |
AC_ARG_ENABLE(standalone-gui,[ --enable-standalone-gui enable a standalone GUI prefs editor [default=no]], [WANT_STANDALONE_GUI=$enableval], [WANT_STANDALONE_GUI=no]) |
32 |
gbeauche |
1.1 |
AC_ARG_WITH(esd, [ --with-esd support ESD for sound under Linux/FreeBSD [default=yes]], [WANT_ESD=$withval], [WANT_ESD=yes]) |
33 |
gbeauche |
1.20 |
AC_ARG_WITH(gtk, [ --with-gtk use GTK user interface [default=yes]], |
34 |
|
|
[case "$withval" in |
35 |
|
|
gtk1) WANT_GTK="gtk";; |
36 |
|
|
gtk|gtk2) WANT_GTK="$withval";; |
37 |
|
|
yes) WANT_GTK="gtk2 gtk";; |
38 |
|
|
*) WANT_GTK="no";; |
39 |
|
|
esac], |
40 |
|
|
[WANT_GTK="gtk2 gtk"]) |
41 |
gbeauche |
1.1 |
AC_ARG_WITH(mon, [ --with-mon use mon as debugger [default=yes]], [WANT_MON=$withval], [WANT_MON=yes]) |
42 |
|
|
AC_ARG_WITH(dgcc, [ --with-dgcc=COMPILER use C++ COMPILER to compile synthetic opcodes], [DYNGEN_CC=$withval]) |
43 |
|
|
|
44 |
asvitkine |
1.68 |
AC_ARG_WITH(bincue, |
45 |
|
|
AS_HELP_STRING([--with-bincue], [Allow cdrom image files in bin/cue mode])) |
46 |
|
|
|
47 |
|
|
|
48 |
gbeauche |
1.8 |
dnl Addressing mode |
49 |
|
|
AC_ARG_ENABLE(addressing, |
50 |
|
|
[ --enable-addressing=AM set the addressing mode to use [default=real]], |
51 |
|
|
[case "$enableval" in |
52 |
|
|
real) WANT_ADDRESSING_MODE="real";; |
53 |
|
|
direct) WANT_ADDRESSING_MODE="direct";; |
54 |
gbeauche |
1.13 |
direct,0x*) WANT_ADDRESSING_MODE="direct"; NATMEM_OFFSET=`echo "$enableval" | sed -n '/direct,\(0[[xX]][[0-9A-Fa-f]]*\([[UuLl]]\{1,2\}\)\?\)$/s//\1/p'`;; |
55 |
gbeauche |
1.8 |
esac], |
56 |
|
|
[WANT_ADDRESSING_MODE="real"] |
57 |
|
|
) |
58 |
|
|
|
59 |
gbeauche |
1.1 |
dnl SDL options. |
60 |
|
|
AC_ARG_ENABLE(sdl-static, [ --enable-sdl-static use SDL static libraries for linking [default=no]], [WANT_SDL_STATIC=$enableval], [WANT_SDL_STATIC=no]) |
61 |
|
|
AC_ARG_ENABLE(sdl-video, [ --enable-sdl-video use SDL for video graphics [default=no]], [WANT_SDL_VIDEO=$enableval], [WANT_SDL_VIDEO=no]) |
62 |
gbeauche |
1.7 |
AC_ARG_ENABLE(sdl-audio, [ --enable-sdl-audio use SDL for audio [default=no]], [WANT_SDL_AUDIO=$enableval], [WANT_SDL_AUDIO=no]) |
63 |
asvitkine |
1.64 |
AC_ARG_ENABLE(sdl-framework, [ --enable-sdl-framework use SDL framework [default=no]], [WANT_SDL_FRAMEWORK=$enableval], [WANT_SDL_FRAMEWORK=no]) |
64 |
|
|
AC_ARG_ENABLE(sdl-framework-prefix, [ --enable-sdl-framework-prefix=PFX default=/Library/Frameworks], [SDL_FRAMEWORK="$enableval"], [SDL_FRAMEWORK=/Library/Frameworks]) |
65 |
gbeauche |
1.1 |
|
66 |
|
|
dnl Checks for programs. |
67 |
|
|
AC_PROG_CC |
68 |
|
|
AC_PROG_CPP |
69 |
|
|
AC_PROG_CXX |
70 |
|
|
AC_PROG_MAKE_SET |
71 |
|
|
AC_PROG_INSTALL |
72 |
gbeauche |
1.3 |
AC_PROG_EGREP |
73 |
gbeauche |
1.16 |
AC_PATH_PROGS(FILE, [file false]) |
74 |
|
|
AC_PATH_PROG(PERL, [perl]) |
75 |
gbeauche |
1.1 |
|
76 |
|
|
dnl Check for PowerPC target CPU. |
77 |
|
|
HAVE_PPC=no |
78 |
|
|
AC_MSG_CHECKING(for PowerPC target CPU) |
79 |
|
|
AC_EGREP_CPP(yes, |
80 |
|
|
[ |
81 |
|
|
#ifdef __powerpc__ |
82 |
|
|
yes |
83 |
|
|
#endif |
84 |
|
|
#ifdef __ppc__ |
85 |
|
|
yes |
86 |
|
|
#endif |
87 |
|
|
], [AC_MSG_RESULT(yes); HAVE_PPC=yes], AC_MSG_RESULT(no)) |
88 |
|
|
|
89 |
|
|
dnl We use native CPU if possible. |
90 |
|
|
EMULATED_PPC=yes |
91 |
|
|
case $WANT_EMULATED_PPC in |
92 |
|
|
auto) [[ "x$HAVE_PPC" = "xyes" ]] && EMULATED_PPC=no;; |
93 |
|
|
no) EMULATED_PPC=no;; |
94 |
|
|
esac |
95 |
|
|
if [[ "x$EMULATED_PPC" = "xyes" ]]; then |
96 |
|
|
AC_DEFINE(EMULATED_PPC, 1, [Define if using a PowerPC CPU emulator.]) |
97 |
|
|
fi |
98 |
|
|
|
99 |
|
|
dnl We use mon if possible. |
100 |
|
|
MONSRCS= |
101 |
|
|
case "x$WANT_MON" in |
102 |
|
|
x/* | x.*) |
103 |
|
|
mon_srcdir=$WANT_MON |
104 |
|
|
WANT_MON=yes |
105 |
|
|
;; |
106 |
|
|
xyes) |
107 |
|
|
mon_srcdir=../../../mon/src |
108 |
|
|
;; |
109 |
|
|
esac |
110 |
|
|
if [[ "x$WANT_MON" = "xyes" ]]; then |
111 |
|
|
AC_MSG_CHECKING(for mon) |
112 |
|
|
if grep mon_init $mon_srcdir/mon.h >/dev/null 2>/dev/null; then |
113 |
|
|
AC_MSG_RESULT(yes) |
114 |
|
|
AC_DEFINE(ENABLE_MON, 1, [Define if using "mon".]) |
115 |
gbeauche |
1.58 |
MONSRCS="$mon_srcdir/mon.cpp $mon_srcdir/mon_6502.cpp $mon_srcdir/mon_z80.cpp $mon_srcdir/mon_cmd.cpp $mon_srcdir/mon_lowmem.cpp $mon_srcdir/mon_disass.cpp $mon_srcdir/mon_ppc.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" |
116 |
gbeauche |
1.1 |
CXXFLAGS="$CXXFLAGS -I$mon_srcdir -I$mon_srcdir/disass" |
117 |
|
|
AC_CHECK_LIB(ncurses, tgetent, , |
118 |
asvitkine |
1.67 |
[AC_CHECK_LIB(termcap, tgetent, , |
119 |
|
|
[AC_CHECK_LIB(termlib, tgetent, , |
120 |
|
|
[AC_CHECK_LIB(terminfo, tgetent, , |
121 |
|
|
[AC_CHECK_LIB(Hcurses, tgetent, , |
122 |
|
|
[AC_CHECK_LIB(curses, tgetent)])])])])]) |
123 |
gbeauche |
1.1 |
AC_CHECK_LIB(readline, readline) |
124 |
|
|
AC_CHECK_HEADERS(readline.h history.h readline/readline.h readline/history.h) |
125 |
|
|
else |
126 |
|
|
AC_MSG_RESULT(no) |
127 |
|
|
AC_MSG_WARN([Could not find mon, ignoring --with-mon.]) |
128 |
|
|
WANT_MON=no |
129 |
|
|
fi |
130 |
|
|
fi |
131 |
gbeauche |
1.11 |
AC_SUBST(MONSRCS) |
132 |
gbeauche |
1.1 |
|
133 |
|
|
dnl Checks for libraries. |
134 |
|
|
AC_CHECK_LIB(posix4, sem_init) |
135 |
gbeauche |
1.42 |
AC_CHECK_LIB(m, cos) |
136 |
gbeauche |
1.1 |
|
137 |
asvitkine |
1.64 |
dnl AC_CHECK_SDLFRAMEWORK($1=NAME, $2=INCLUDES) |
138 |
|
|
dnl AC_TRY_LINK uses main() but SDL needs main to take args, |
139 |
|
|
dnl therefore main is undefined with #undef. |
140 |
|
|
dnl Framework can be in an custom location. |
141 |
|
|
AC_DEFUN([AC_CHECK_SDLFRAMEWORK], [ |
142 |
|
|
AS_VAR_PUSHDEF([ac_Framework], [ac_cv_framework_$1]) |
143 |
|
|
AC_CACHE_CHECK([whether compiler supports framework $1], |
144 |
|
|
ac_Framework, [ |
145 |
|
|
saved_LIBS="$LIBS" |
146 |
|
|
LIBS="$LIBS -framework $1" |
147 |
|
|
if [[ "x$SDL_FRAMEWORK" != "x/Library/Frameworks" ]]; then |
148 |
|
|
if [[ "x$SDL_FRAMEWORK" != "x/System/Library/Frameworks" ]]; then |
149 |
|
|
LIBS="$saved_LIBS -F$SDL_FRAMEWORK -framework $1" |
150 |
|
|
fi |
151 |
|
|
fi |
152 |
|
|
saved_CPPFLAGS="$CPPFLAGS" |
153 |
|
|
CPPFLAGS="$CPPFLAGS -I$SDL_FRAMEWORK/SDL.framework/Headers" |
154 |
|
|
AC_TRY_LINK( |
155 |
|
|
[$2 |
156 |
|
|
#undef main], [], |
157 |
|
|
[AS_VAR_SET(ac_Framework, yes)], [AS_VAR_SET(ac_Framework, no); |
158 |
|
|
LIBS="$saved_LIBS"; CPPFLAGS="$saved_CPPFLAGS"] |
159 |
|
|
) |
160 |
|
|
]) |
161 |
|
|
AS_IF([test AS_VAR_GET(ac_Framework) = yes], |
162 |
|
|
[AC_DEFINE(AS_TR_CPP(HAVE_FRAMEWORK_$1), 1, [Define if framework $1 is available.])] |
163 |
|
|
) |
164 |
|
|
AS_VAR_POPDEF([ac_Framework]) |
165 |
|
|
]) |
166 |
|
|
|
167 |
gbeauche |
1.1 |
dnl Do we need SDL? |
168 |
|
|
WANT_SDL=no |
169 |
|
|
if [[ "x$WANT_SDL_VIDEO" = "xyes" ]]; then |
170 |
|
|
WANT_SDL=yes |
171 |
|
|
WANT_XF86_DGA=no |
172 |
|
|
WANT_XF86_VIDMODE=no |
173 |
|
|
WANT_FBDEV_DGA=no |
174 |
gbeauche |
1.7 |
SDL_SUPPORT="$SDL_SUPPORT video" |
175 |
|
|
fi |
176 |
|
|
if [[ "x$WANT_SDL_AUDIO" = "xyes" ]]; then |
177 |
|
|
WANT_SDL=yes |
178 |
|
|
SDL_SUPPORT="$SDL_SUPPORT audio" |
179 |
gbeauche |
1.1 |
fi |
180 |
|
|
if [[ "x$WANT_SDL" = "xyes" ]]; then |
181 |
asvitkine |
1.64 |
if [[ "x$WANT_SDL_FRAMEWORK" = "xyes" ]]; then |
182 |
|
|
AC_CHECK_SDLFRAMEWORK(SDL, [#include <SDL.h>]) |
183 |
|
|
else |
184 |
|
|
ac_cv_framework_SDL=no |
185 |
|
|
fi |
186 |
|
|
if [[ "x$ac_cv_framework_SDL" = "xno" ]]; then |
187 |
|
|
AC_PATH_PROG(sdl_config, "sdl-config") |
188 |
|
|
if [[ -n "$sdl_config" ]]; then |
189 |
|
|
sdl_cflags=`$sdl_config --cflags` |
190 |
|
|
if [[ "x$WANT_SDL_STATIC" = "xyes" ]]; then |
191 |
|
|
sdl_libs=`$sdl_config --static-libs` |
192 |
|
|
else |
193 |
|
|
sdl_libs=`$sdl_config --libs` |
194 |
|
|
fi |
195 |
|
|
CFLAGS="$CFLAGS $sdl_cflags" |
196 |
|
|
CXXFLAGS="$CXXFLAGS $sdl_cflags" |
197 |
|
|
LIBS="$LIBS $sdl_libs" |
198 |
gbeauche |
1.33 |
else |
199 |
asvitkine |
1.64 |
WANT_SDL=no |
200 |
|
|
WANT_SDL_VIDEO=no |
201 |
|
|
WANT_SDL_AUDIO=no |
202 |
gbeauche |
1.33 |
fi |
203 |
gbeauche |
1.1 |
fi |
204 |
gbeauche |
1.7 |
SDL_SUPPORT=`echo "$SDL_SUPPORT" | sed -e "s/^ //"` |
205 |
|
|
else |
206 |
|
|
SDL_SUPPORT="none" |
207 |
gbeauche |
1.1 |
fi |
208 |
|
|
|
209 |
|
|
dnl We need X11, if not using SDL. |
210 |
gbeauche |
1.15 |
if [[ "x$WANT_SDL_VIDEO" != "xyes" ]]; then |
211 |
gbeauche |
1.1 |
AC_PATH_XTRA |
212 |
|
|
if [[ "x$no_x" = "xyes" ]]; then |
213 |
|
|
AC_MSG_ERROR([You need X11 to run SheepShaver.]) |
214 |
|
|
fi |
215 |
|
|
CFLAGS="$CFLAGS $X_CFLAGS" |
216 |
|
|
CXXFLAGS="$CXXFLAGS $X_CFLAGS" |
217 |
|
|
LIBS="$LIBS $X_PRE_LIBS $X_LIBS -lX11 -lXext $X_EXTRA_LIBS" |
218 |
|
|
fi |
219 |
|
|
|
220 |
asvitkine |
1.68 |
|
221 |
|
|
|
222 |
gbeauche |
1.1 |
dnl We need pthreads on non-PowerPC systems. Try libpthread first, then libc_r (FreeBSD), then PTL. |
223 |
|
|
HAVE_PTHREADS=yes |
224 |
|
|
case $EMULATED_PPC:$target_os in |
225 |
gbeauche |
1.17 |
no:linux*|no:netbsd*) |
226 |
gbeauche |
1.1 |
dnl We do have our own pthread_cancel() implementation |
227 |
|
|
AC_DEFINE(HAVE_PTHREAD_CANCEL, 1, [Define if you have the pthread_cancel function.]) |
228 |
|
|
;; |
229 |
|
|
*:*) |
230 |
|
|
AC_CHECK_LIB(pthread, pthread_create, , [ |
231 |
|
|
AC_CHECK_LIB(c_r, pthread_create, , [ |
232 |
|
|
AC_CHECK_LIB(PTL, pthread_create, , [ |
233 |
gbeauche |
1.29 |
dnl XXX remove when no pthreads case is merged |
234 |
|
|
AC_MSG_ERROR([You need pthreads to run SheepShaver.]) |
235 |
|
|
HAVE_PTHREADS=no |
236 |
gbeauche |
1.1 |
]) |
237 |
|
|
]) |
238 |
|
|
]) |
239 |
|
|
AC_CHECK_FUNCS(pthread_cancel) |
240 |
gbeauche |
1.34 |
AC_CHECK_FUNCS(pthread_cond_init pthread_testcancel) |
241 |
gbeauche |
1.1 |
AC_CHECK_FUNCS(pthread_mutexattr_setprotocol) |
242 |
|
|
AC_CHECK_FUNCS(pthread_mutexattr_settype) |
243 |
|
|
AC_CHECK_FUNCS(pthread_mutexattr_setpshared) |
244 |
|
|
dnl If POSIX.4 semaphores are not available, we emulate them with pthread mutexes. |
245 |
|
|
SEMSRC= |
246 |
|
|
AC_CHECK_FUNCS(sem_init, , [ |
247 |
|
|
if test "x$HAVE_PTHREADS" = "xyes"; then |
248 |
|
|
SEMSRC=posix_sem.cpp |
249 |
|
|
fi |
250 |
|
|
]) |
251 |
|
|
;; |
252 |
|
|
esac |
253 |
gbeauche |
1.29 |
if [[ "x$HAVE_PTHREADS" = "xyes" ]]; then |
254 |
|
|
AC_DEFINE(HAVE_PTHREADS, 1, [Define if pthreads are available.]) |
255 |
|
|
fi |
256 |
gbeauche |
1.1 |
|
257 |
gbeauche |
1.21 |
dnl We use FBDev DGA if possible. |
258 |
|
|
if [[ "x$WANT_FBDEV_DGA" = "xyes" ]]; then |
259 |
|
|
AC_CHECK_HEADER(linux/fb.h, [ |
260 |
|
|
AC_DEFINE(ENABLE_FBDEV_DGA, 1, [Define if using Linux fbdev extension.]) |
261 |
|
|
], [ |
262 |
|
|
AC_MSG_WARN([Could not find Linux FBDev extension, ignoring --enable-fbdev-dga.]) |
263 |
|
|
WANT_FBDEV_DGA=no |
264 |
|
|
]) |
265 |
|
|
fi |
266 |
|
|
|
267 |
gbeauche |
1.1 |
dnl We use XFree86 DGA if possible. |
268 |
|
|
if [[ "x$WANT_XF86_DGA" = "xyes" ]]; then |
269 |
|
|
AC_CHECK_LIB(Xxf86dga, XF86DGAQueryExtension, [ |
270 |
|
|
AC_DEFINE(ENABLE_XF86_DGA, 1, [Define if using XFree86 DGA extension.]) |
271 |
|
|
LIBS="$LIBS -lXxf86dga" |
272 |
|
|
], [ |
273 |
|
|
AC_MSG_WARN([Could not find XFree86 DGA extension, ignoring --enable-xf86-dga.]) |
274 |
|
|
WANT_XF86_DGA=no |
275 |
|
|
]) |
276 |
|
|
fi |
277 |
|
|
|
278 |
|
|
dnl We use XFree86 VidMode if possible. |
279 |
|
|
if [[ "x$WANT_XF86_VIDMODE" = "xyes" ]]; then |
280 |
|
|
AC_CHECK_LIB(Xxf86vm, XF86VidModeQueryExtension, [ |
281 |
|
|
AC_DEFINE(ENABLE_XF86_VIDMODE, 1, [Define if using XFree86 DGA extension.]) |
282 |
|
|
LIBS="$LIBS -lXxf86vm" |
283 |
|
|
], [ |
284 |
|
|
AC_MSG_WARN([Could not find XFree86 VidMode extension, ignoring --enable-xf86-vidmode.]) |
285 |
|
|
WANT_XF86_VIDMODE=no |
286 |
|
|
]) |
287 |
|
|
fi |
288 |
|
|
|
289 |
|
|
dnl We use GTK+ if possible. |
290 |
|
|
UISRCS=../dummy/prefs_editor_dummy.cpp |
291 |
gbeauche |
1.20 |
case "x$WANT_GTK" in |
292 |
|
|
xgtk2*) |
293 |
asvitkine |
1.56 |
WANT_GTK=no |
294 |
gbeauche |
1.20 |
AM_PATH_GTK_2_0(1.3.15, [ |
295 |
gbeauche |
1.50 |
GUI_CFLAGS="$GTK_CFLAGS" |
296 |
|
|
GUI_LIBS="$GTK_LIBS" |
297 |
gbeauche |
1.20 |
WANT_GTK=gtk2 |
298 |
|
|
], [ |
299 |
|
|
case "x${WANT_GTK}x" in |
300 |
|
|
*gtkx) |
301 |
|
|
AC_MSG_WARN([Could not find GTK+ 2.0, trying with GTK+ 1.2.]) |
302 |
|
|
WANT_GTK=gtk |
303 |
|
|
;; |
304 |
|
|
*) |
305 |
|
|
AC_MSG_WARN([Could not find GTK+, disabling user interface.]) |
306 |
|
|
WANT_GTK=no |
307 |
asvitkine |
1.56 |
;; |
308 |
gbeauche |
1.20 |
esac |
309 |
gbeauche |
1.57 |
]) |
310 |
|
|
;; |
311 |
gbeauche |
1.20 |
esac |
312 |
|
|
if [[ "x$WANT_GTK" = "xgtk" ]]; then |
313 |
asvitkine |
1.56 |
WANT_GTK=no |
314 |
gbeauche |
1.1 |
AM_PATH_GTK(1.2.0, [ |
315 |
gbeauche |
1.50 |
GUI_CFLAGS="$GTK_CFLAGS" |
316 |
|
|
GUI_LIBS="$GTK_LIBS" |
317 |
asvitkine |
1.56 |
WANT_GTK=gtk |
318 |
gbeauche |
1.1 |
], [ |
319 |
|
|
AC_MSG_WARN([Could not find GTK+, disabling user interface.]) |
320 |
gbeauche |
1.57 |
]) |
321 |
gbeauche |
1.1 |
fi |
322 |
gbeauche |
1.51 |
if [[ "x$WANT_GTK" != "xno" -a "x$WANT_STANDALONE_GUI" = "xno" ]]; then |
323 |
|
|
AC_DEFINE(ENABLE_GTK, 1, [Define if using GTK.]) |
324 |
|
|
UISRCS=prefs_editor_gtk.cpp |
325 |
|
|
fi |
326 |
gbeauche |
1.50 |
AC_SUBST(GUI_CFLAGS) |
327 |
|
|
AC_SUBST(GUI_LIBS) |
328 |
|
|
|
329 |
|
|
dnl Build external GUI if requested. |
330 |
|
|
if [[ "$WANT_STANDALONE_GUI" != "yes" ]]; then |
331 |
|
|
WANT_STANDALONE_GUI=no |
332 |
|
|
fi |
333 |
|
|
if [[ "$WANT_GTK" = "no" ]]; then |
334 |
|
|
WANT_STANDALONE_GUI=no |
335 |
|
|
fi |
336 |
|
|
AC_SUBST(STANDALONE_GUI, [$WANT_STANDALONE_GUI]) |
337 |
gbeauche |
1.1 |
|
338 |
|
|
dnl We use ESD if possible. |
339 |
|
|
if [[ "x$WANT_ESD" = "xyes" ]]; then |
340 |
asvitkine |
1.56 |
WANT_ESD=no |
341 |
gbeauche |
1.1 |
AM_PATH_ESD(0.2.8, [ |
342 |
|
|
AC_DEFINE(ENABLE_ESD, 1, [Define is using ESD.]) |
343 |
|
|
CFLAGS="$CFLAGS $ESD_CFLAGS" |
344 |
|
|
CXXFLAGS="$CXXFLAGS $ESD_CFLAGS" |
345 |
|
|
LIBS="$LIBS $ESD_LIBS" |
346 |
asvitkine |
1.56 |
WANT_ESD=yes |
347 |
gbeauche |
1.1 |
], [ |
348 |
|
|
AC_MSG_WARN([Could not find ESD, disabling ESD support.]) |
349 |
gbeauche |
1.57 |
]) |
350 |
gbeauche |
1.1 |
fi |
351 |
|
|
|
352 |
gbeauche |
1.2 |
dnl We use 64-bit file size support if possible. |
353 |
|
|
AC_SYS_LARGEFILE |
354 |
|
|
|
355 |
gbeauche |
1.1 |
dnl Checks for header files. |
356 |
|
|
AC_HEADER_STDC |
357 |
|
|
AC_HEADER_SYS_WAIT |
358 |
gbeauche |
1.31 |
AC_CHECK_HEADERS(malloc.h stdint.h) |
359 |
gbeauche |
1.1 |
AC_CHECK_HEADERS(mach/vm_map.h mach/mach_init.h sys/mman.h) |
360 |
gbeauche |
1.4 |
AC_CHECK_HEADERS(unistd.h fcntl.h byteswap.h dirent.h) |
361 |
gbeauche |
1.32 |
AC_CHECK_HEADERS(sys/socket.h sys/ioctl.h sys/filio.h sys/bitypes.h sys/wait.h) |
362 |
|
|
AC_CHECK_HEADERS(sys/time.h sys/poll.h sys/select.h arpa/inet.h) |
363 |
|
|
AC_CHECK_HEADERS(linux/if.h linux/if_tun.h net/if.h net/if_tun.h, [], [], [ |
364 |
|
|
#ifdef HAVE_SYS_TYPES_H |
365 |
|
|
#include <sys/types.h> |
366 |
|
|
#endif |
367 |
|
|
#ifdef HAVE_SYS_SOCKET_H |
368 |
|
|
#include <sys/socket.h> |
369 |
gbeauche |
1.1 |
#endif |
370 |
|
|
]) |
371 |
gbeauche |
1.32 |
AC_CHECK_HEADERS(AvailabilityMacros.h) |
372 |
|
|
AC_CHECK_HEADERS(IOKit/storage/IOBlockStorageDevice.h) |
373 |
gbeauche |
1.10 |
AC_CHECK_HEADERS(fenv.h) |
374 |
gbeauche |
1.1 |
|
375 |
|
|
dnl Checks for typedefs, structures, and compiler characteristics. |
376 |
|
|
AC_C_BIGENDIAN |
377 |
|
|
AC_C_CONST |
378 |
|
|
AC_C_INLINE |
379 |
|
|
AC_CHECK_SIZEOF(short, 2) |
380 |
|
|
AC_CHECK_SIZEOF(int, 4) |
381 |
|
|
AC_CHECK_SIZEOF(long, 4) |
382 |
|
|
AC_CHECK_SIZEOF(long long, 8) |
383 |
|
|
AC_CHECK_SIZEOF(float, 4) |
384 |
|
|
AC_CHECK_SIZEOF(double, 8) |
385 |
|
|
AC_CHECK_SIZEOF(void *, 4) |
386 |
|
|
AC_TYPE_OFF_T |
387 |
|
|
AC_CHECK_TYPE(loff_t, off_t) |
388 |
|
|
AC_TYPE_SIZE_T |
389 |
|
|
AC_TYPE_SIGNAL |
390 |
|
|
AC_HEADER_TIME |
391 |
|
|
AC_STRUCT_TM |
392 |
|
|
|
393 |
gbeauche |
1.34 |
dnl Check whether sys/socket.h defines type socklen_t. |
394 |
|
|
dnl (extracted from ac-archive/Miscellaneous) |
395 |
|
|
AC_CACHE_CHECK([for socklen_t], |
396 |
|
|
ac_cv_type_socklen_t, [ |
397 |
|
|
AC_TRY_COMPILE([ |
398 |
|
|
#include <sys/types.h> |
399 |
|
|
#include <sys/socket.h> |
400 |
|
|
], [socklen_t len = 42; return 0;], |
401 |
|
|
ac_cv_type_socklen_t=yes, ac_cv_type_socklen_t=no, |
402 |
|
|
dnl When cross-compiling, do not assume anything. |
403 |
|
|
ac_cv_type_socklen_t="guessing no" |
404 |
|
|
) |
405 |
|
|
]) |
406 |
|
|
if [[ "x$ac_cv_type_socklen_t" != "xyes" ]]; then |
407 |
|
|
AC_DEFINE(socklen_t, int, [Define to 'int' if <sys/types.h> doesn't define.]) |
408 |
|
|
fi |
409 |
|
|
|
410 |
gbeauche |
1.1 |
dnl Check whether struct sigaction has sa_restorer member. |
411 |
|
|
AC_CACHE_CHECK([whether struct sigaction has sa_restorer], |
412 |
|
|
ac_cv_signal_sa_restorer, [ |
413 |
|
|
AC_TRY_COMPILE([ |
414 |
|
|
#include <signal.h> |
415 |
|
|
], [struct sigaction sa; sa.sa_restorer = 0;], |
416 |
|
|
ac_cv_signal_sa_restorer=yes, ac_cv_signal_sa_restorer=no, |
417 |
|
|
dnl When cross-compiling, do not assume anything. |
418 |
|
|
ac_cv_signal_sa_restorer=no |
419 |
|
|
) |
420 |
|
|
]) |
421 |
|
|
if [[ "x$ac_cv_signal_sa_restorer" = "xyes" ]]; then |
422 |
|
|
AC_DEFINE(HAVE_SIGNAL_SA_RESTORER, 1, [Define if sa_restorer is available in struct sigaction.]) |
423 |
|
|
fi |
424 |
|
|
|
425 |
|
|
dnl Checks for library functions. |
426 |
gbeauche |
1.32 |
AC_CHECK_FUNCS(strdup strerror strlcpy cfmakeraw) |
427 |
gbeauche |
1.1 |
AC_CHECK_FUNCS(nanosleep) |
428 |
|
|
AC_CHECK_FUNCS(sigaction signal) |
429 |
|
|
AC_CHECK_FUNCS(mmap mprotect munmap) |
430 |
|
|
AC_CHECK_FUNCS(vm_allocate vm_deallocate vm_protect) |
431 |
gbeauche |
1.26 |
AC_CHECK_FUNCS(exp2f log2f exp2 log2) |
432 |
|
|
AC_CHECK_FUNCS(floorf roundf ceilf truncf floor round ceil trunc) |
433 |
gbeauche |
1.32 |
AC_CHECK_FUNCS(poll inet_aton) |
434 |
gbeauche |
1.1 |
|
435 |
|
|
dnl Darwin seems to define mach_task_self() instead of task_self(). |
436 |
|
|
AC_CHECK_FUNCS(mach_task_self task_self) |
437 |
|
|
|
438 |
|
|
dnl We need clock_gettime() for better performance but it may drag |
439 |
|
|
dnl libpthread in, which we don't want for native ppc mode |
440 |
|
|
case $EMULATED_PPC:$target_os in |
441 |
|
|
no:linux*) |
442 |
|
|
;; |
443 |
|
|
*:*) |
444 |
|
|
AC_SEARCH_LIBS(clock_gettime, [rt posix4]) |
445 |
gbeauche |
1.18 |
AC_CHECK_FUNCS(clock_gettime clock_nanosleep) |
446 |
gbeauche |
1.1 |
;; |
447 |
|
|
esac |
448 |
|
|
|
449 |
gbeauche |
1.9 |
dnl Check for headers and functions related to pty support (sshpty.c) |
450 |
|
|
dnl From openssh-3.2.2p1 configure.ac |
451 |
|
|
AC_CHECK_HEADERS(strings.h login.h sys/bsdtty.h sys/stat.h util.h pty.h) |
452 |
|
|
AC_CHECK_FUNCS(_getpty vhangup strlcpy) |
453 |
|
|
|
454 |
|
|
case "$host" in |
455 |
|
|
*-*-hpux10.26) |
456 |
|
|
disable_ptmx_check=yes |
457 |
|
|
;; |
458 |
|
|
*-*-linux*) |
459 |
|
|
no_dev_ptmx=1 |
460 |
|
|
;; |
461 |
|
|
mips-sony-bsd|mips-sony-newsos4) |
462 |
|
|
AC_DEFINE(HAVE_NEWS4, 1, [Define if you are on NEWS-OS (additions from openssh-3.2.2p1, for sshpty.c).]) |
463 |
|
|
;; |
464 |
|
|
*-*-sco3.2v4*) |
465 |
|
|
no_dev_ptmx=1 |
466 |
|
|
;; |
467 |
|
|
*-*-sco3.2v5*) |
468 |
|
|
no_dev_ptmx=1 |
469 |
|
|
;; |
470 |
|
|
*-*-cygwin*) |
471 |
|
|
no_dev_ptmx=1 |
472 |
|
|
;; |
473 |
asvitkine |
1.62 |
*-*-darwin*) |
474 |
|
|
no_dev_ptmx=1 |
475 |
|
|
;; |
476 |
gbeauche |
1.9 |
esac |
477 |
|
|
|
478 |
|
|
if test -z "$no_dev_ptmx" ; then |
479 |
|
|
if test "x$disable_ptmx_check" != "xyes" ; then |
480 |
|
|
AC_CHECK_FILE([/dev/ptmx], |
481 |
|
|
[ |
482 |
|
|
AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX, 1, [Define if you have /dev/ptmx.]) |
483 |
|
|
have_dev_ptmx=1 |
484 |
|
|
] |
485 |
|
|
) |
486 |
|
|
fi |
487 |
|
|
fi |
488 |
|
|
AC_CHECK_FILE([/dev/ptc], |
489 |
|
|
[ |
490 |
|
|
AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC, 1, [Define if you have /dev/ptc.]) |
491 |
|
|
have_dev_ptc=1 |
492 |
|
|
] |
493 |
|
|
) |
494 |
|
|
dnl (end of code from openssh-3.2.2p1 configure.ac) |
495 |
|
|
|
496 |
gbeauche |
1.47 |
dnl Check for systems where POSIX-style non-blocking I/O (O_NONBLOCK) |
497 |
|
|
dnl doesn't work or is unimplemented. On these systems (mostly older |
498 |
|
|
dnl ones), use the old BSD-style FIONBIO approach instead. [tcl.m4] |
499 |
|
|
AC_CACHE_CHECK([FIONBIO vs. O_NONBLOCK for non-blocking I/O], |
500 |
|
|
ac_cv_nonblocking_io, [ |
501 |
|
|
case "$host" in |
502 |
|
|
*-*-osf*) |
503 |
|
|
ac_cv_nonblocking_io=FIONBIO |
504 |
|
|
;; |
505 |
|
|
*-*-sunos4*) |
506 |
|
|
ac_cv_nonblocking_io=FIONBIO |
507 |
|
|
;; |
508 |
|
|
*-*-ultrix*) |
509 |
|
|
ac_cv_nonblocking_io=FIONBIO |
510 |
|
|
;; |
511 |
|
|
*) |
512 |
|
|
ac_cv_nonblocking_io=O_NONBLOCK |
513 |
|
|
;; |
514 |
|
|
esac |
515 |
|
|
]) |
516 |
|
|
if [[ "$ac_cv_nonblocking_io" = "FIONBIO" ]]; then |
517 |
|
|
AC_DEFINE(USE_FIONBIO, 1, [Define if BSD-style non-blocking I/O is to be used]) |
518 |
|
|
fi |
519 |
|
|
|
520 |
gbeauche |
1.48 |
dnl Check whether compiler supports byte bit-fields |
521 |
|
|
AC_CACHE_CHECK([whether compiler supports byte bit-fields], |
522 |
|
|
ac_cv_have_byte_bitfields, [ |
523 |
|
|
AC_LANG_SAVE |
524 |
|
|
AC_LANG_CPLUSPLUS |
525 |
|
|
AC_TRY_RUN([ |
526 |
|
|
struct A { |
527 |
|
|
unsigned char b1:4; |
528 |
|
|
unsigned char b2:4; |
529 |
|
|
unsigned char c; |
530 |
|
|
unsigned short s; |
531 |
|
|
unsigned char a[4]; |
532 |
|
|
}; |
533 |
|
|
|
534 |
|
|
int main(void) { |
535 |
|
|
A a; |
536 |
|
|
return ! (sizeof(A) == 8 && &a.c == ((unsigned char *)&a + 1)); |
537 |
|
|
}], |
538 |
|
|
[ac_cv_have_byte_bitfields=yes], |
539 |
|
|
[ac_cv_have_byte_bitfields=no], |
540 |
|
|
dnl When cross-compiling, assume only GCC supports this |
541 |
|
|
[if [[ "$GCC" = "yes" ]]; then |
542 |
|
|
ac_cv_have_byte_bitfields="guessing yes" |
543 |
|
|
else |
544 |
|
|
ac_cv_have_byte_bitfields="guessing no" |
545 |
|
|
fi] |
546 |
|
|
) |
547 |
|
|
AC_LANG_RESTORE |
548 |
|
|
]) |
549 |
|
|
|
550 |
gbeauche |
1.1 |
dnl AC_CHECK_FRAMEWORK($1=NAME, $2=INCLUDES) |
551 |
gbeauche |
1.49 |
AC_DEFUN([AC_CHECK_FRAMEWORK], [ |
552 |
gbeauche |
1.1 |
AS_VAR_PUSHDEF([ac_Framework], [ac_cv_framework_$1])dnl |
553 |
|
|
AC_CACHE_CHECK([whether compiler supports framework $1], |
554 |
|
|
ac_Framework, [ |
555 |
|
|
saved_LIBS="$LIBS" |
556 |
|
|
LIBS="$LIBS -framework $1" |
557 |
|
|
AC_TRY_LINK( |
558 |
gbeauche |
1.45 |
[$2], [], |
559 |
gbeauche |
1.1 |
[AS_VAR_SET(ac_Framework, yes)], [AS_VAR_SET(ac_Framework, no); LIBS="$saved_LIBS"] |
560 |
|
|
) |
561 |
|
|
]) |
562 |
|
|
AS_IF([test AS_VAR_GET(ac_Framework) = yes], |
563 |
|
|
[AC_DEFINE(AS_TR_CPP(HAVE_FRAMEWORK_$1), 1, [Define if framework $1 is available.])] |
564 |
|
|
) |
565 |
|
|
AS_VAR_POPDEF([ac_Framework])dnl |
566 |
|
|
]) |
567 |
|
|
|
568 |
|
|
dnl Check for some MacOS X frameworks |
569 |
|
|
AC_CHECK_FRAMEWORK(Carbon, [#include <Carbon/Carbon.h>]) |
570 |
|
|
AC_CHECK_FRAMEWORK(IOKit, [#include <IOKit/IOKitLib.h>]) |
571 |
gbeauche |
1.37 |
AC_CHECK_FRAMEWORK(CoreFoundation, [#include <CoreFoundation/CoreFoundation.h>]) |
572 |
gbeauche |
1.59 |
AC_CHECK_FRAMEWORK(CoreAudio, [#include <CoreAudio/CoreAudio.h>]) |
573 |
|
|
AC_CHECK_FRAMEWORK(AudioUnit, [#include <AudioUnit/AudioUnit.h>]) |
574 |
|
|
AC_CHECK_FRAMEWORK(AudioToolbox, [#include <AudioToolbox/AudioToolbox.h>]) |
575 |
asvitkine |
1.63 |
AC_CHECK_FRAMEWORK(AppKit, []) |
576 |
gbeauche |
1.1 |
|
577 |
|
|
dnl Select system-dependant sources. |
578 |
|
|
SERIALSRC=serial_unix.cpp |
579 |
|
|
ETHERSRC=../dummy/ether_dummy.cpp |
580 |
|
|
SCSISRC=../dummy/scsi_dummy.cpp |
581 |
|
|
AUDIOSRC=../dummy/audio_dummy.cpp |
582 |
asvitkine |
1.60 |
PREFSSRC=../dummy/prefs_dummy.cpp |
583 |
gbeauche |
1.6 |
EXTFSSRC=extfs_unix.cpp |
584 |
gbeauche |
1.1 |
EXTRASYSSRCS= |
585 |
|
|
case "$target_os" in |
586 |
|
|
linux*) |
587 |
gbeauche |
1.32 |
ETHERSRC=ether_unix.cpp |
588 |
gbeauche |
1.1 |
AUDIOSRC=audio_oss_esd.cpp |
589 |
|
|
SCSISRC=Linux/scsi_linux.cpp |
590 |
|
|
if [[ "x$EMULATED_PPC" = "xno" ]]; then |
591 |
gbeauche |
1.35 |
EXTRASYSSRCS="paranoia.cpp Linux/sheepthreads.c ppc_asm.S" |
592 |
gbeauche |
1.17 |
fi |
593 |
|
|
;; |
594 |
gbeauche |
1.32 |
freebsd*) |
595 |
|
|
ETHERSRC=ether_unix.cpp |
596 |
|
|
;; |
597 |
gbeauche |
1.17 |
netbsd*) |
598 |
gbeauche |
1.32 |
ETHERSRC=ether_unix.cpp |
599 |
gbeauche |
1.17 |
if [[ "x$EMULATED_PPC" = "xno" ]]; then |
600 |
gbeauche |
1.35 |
EXTRASYSSRCS="paranoia.cpp NetBSD/sheepthreads.c ppc_asm.S" |
601 |
gbeauche |
1.1 |
fi |
602 |
|
|
;; |
603 |
|
|
darwin*) |
604 |
gbeauche |
1.32 |
ETHERSRC=ether_unix.cpp |
605 |
gbeauche |
1.1 |
if [[ "x$EMULATED_PPC" = "xno" ]]; then |
606 |
gbeauche |
1.35 |
EXTRASYSSRCS="paranoia.cpp ppc_asm.S" |
607 |
gbeauche |
1.1 |
fi |
608 |
gbeauche |
1.37 |
if [[ "x$ac_cv_framework_IOKit" = "xyes" -a "x$ac_cv_framework_CoreFoundation" = "xyes" ]]; then |
609 |
gbeauche |
1.1 |
EXTRASYSSRCS="$EXTRASYSSRCS ../MacOSX/sys_darwin.cpp" |
610 |
|
|
fi |
611 |
gbeauche |
1.6 |
if [[ "x$ac_cv_framework_Carbon" = "xyes" ]]; then |
612 |
gbeauche |
1.61 |
EXTFSSRC=../MacOSX/extfs_macosx.cpp |
613 |
asvitkine |
1.65 |
if [[ "x$ac_cv_framework_AppKit" = "xyes" -a "x$WANT_GTK" = "xno" ]]; then |
614 |
asvitkine |
1.66 |
PREFSSRC="../MacOSX/prefs_macosx.mm ../MacOSX/Launcher/VMSettingsController.mm" |
615 |
|
|
CPPFLAGS="$CPPFLAGS -I../MacOSX/Launcher" |
616 |
asvitkine |
1.63 |
fi |
617 |
|
|
fi |
618 |
asvitkine |
1.64 |
if [[ "x$WANT_ESD" = "xno" -a "x$ac_cv_framework_CoreAudio" = "xyes" -a "x$WANT_SDL_AUDIO" = "xno" ]]; then |
619 |
gbeauche |
1.59 |
AUDIOSRC="../MacOSX/audio_macosx.cpp ../MacOSX/AudioBackEnd.cpp ../MacOSX/AudioDevice.cpp ../MacOSX/MacOSX_sound_if.cpp" |
620 |
asvitkine |
1.68 |
OSX_CORE_AUDIO="-DOSX_CORE_AUDIO" |
621 |
gbeauche |
1.59 |
fi |
622 |
gbeauche |
1.1 |
;; |
623 |
gbeauche |
1.42 |
irix*) |
624 |
|
|
AUDIOSRC=Irix/audio_irix.cpp |
625 |
|
|
LIBS="$LIBS -laudio" |
626 |
|
|
WANT_ESD=no |
627 |
gbeauche |
1.43 |
|
628 |
|
|
dnl Check if our compiler supports -IPA (MIPSPro) |
629 |
|
|
HAVE_IPA=no |
630 |
|
|
ocflags="$CFLAGS" |
631 |
|
|
CFLAGS=`echo " $CFLAGS -IPA" | sed -e "s/ -g //g"` |
632 |
|
|
AC_MSG_CHECKING(if "-IPA" works) |
633 |
|
|
dnl Do a test compile of an empty function |
634 |
|
|
AC_TRY_COMPILE([#if defined __GNUC__ |
635 |
|
|
# error GCC does not support IPA yet |
636 |
|
|
#endif],, [AC_MSG_RESULT(yes); HAVE_IPA=yes], AC_MSG_RESULT(no)) |
637 |
|
|
CFLAGS="$ocflags" |
638 |
gbeauche |
1.42 |
;; |
639 |
gbeauche |
1.1 |
esac |
640 |
|
|
|
641 |
asvitkine |
1.68 |
dnl BINCUE |
642 |
|
|
AS_IF([test "x$with_bincue" = "xyes" ], [have_bincue=yes], [have_bincue=no]) |
643 |
|
|
AS_IF([test "x$have_bincue" = "xyes" ], [ |
644 |
|
|
if [[ "xOSX_CORE_AUDIO" = "xno" -a "x$WANT_SDL_AUDIO"="xno"]]; then |
645 |
|
|
AC_MSG_ERROR([You need SDL or OSX Core Audio to use BINCUE support.]) |
646 |
|
|
else |
647 |
|
|
CPPFLAGS="$CPPFLAGS -DBINCUE $OSX_CORE_AUDIO" |
648 |
|
|
fi |
649 |
|
|
]) |
650 |
|
|
|
651 |
|
|
|
652 |
gbeauche |
1.32 |
dnl Is the slirp library supported? |
653 |
gbeauche |
1.48 |
case "$ac_cv_have_byte_bitfields" in |
654 |
|
|
yes|"guessing yes") |
655 |
|
|
CAN_SLIRP=yes |
656 |
|
|
ETHERSRC=ether_unix.cpp |
657 |
|
|
;; |
658 |
|
|
esac |
659 |
|
|
if [[ -n "$CAN_SLIRP" ]]; then |
660 |
gbeauche |
1.32 |
AC_DEFINE(HAVE_SLIRP, 1, [Define if slirp library is supported]) |
661 |
|
|
SLIRP_SRCS="\ |
662 |
|
|
../slirp/bootp.c ../slirp/ip_output.c ../slirp/tcp_input.c \ |
663 |
|
|
../slirp/cksum.c ../slirp/mbuf.c ../slirp/tcp_output.c \ |
664 |
|
|
../slirp/debug.c ../slirp/misc.c ../slirp/tcp_subr.c \ |
665 |
|
|
../slirp/if.c ../slirp/sbuf.c ../slirp/tcp_timer.c \ |
666 |
|
|
../slirp/ip_icmp.c ../slirp/slirp.c ../slirp/tftp.c \ |
667 |
|
|
../slirp/ip_input.c ../slirp/socket.c ../slirp/udp.c" |
668 |
|
|
fi |
669 |
|
|
AC_SUBST(SLIRP_SRCS) |
670 |
|
|
|
671 |
gbeauche |
1.1 |
dnl SDL overrides |
672 |
|
|
if [[ "x$WANT_SDL" = "xyes" ]]; then |
673 |
|
|
AC_DEFINE(USE_SDL, 1, [Define to enble SDL support.]) |
674 |
asvitkine |
1.64 |
if [[ "x$WANT_SDL_FRAMEWORK" = "xyes" ]]; then |
675 |
|
|
EXTRASYSSRCS="$EXTRASYSSRCS ../SDL/SDLMain.m" |
676 |
|
|
fi |
677 |
gbeauche |
1.1 |
fi |
678 |
|
|
if [[ "x$WANT_SDL_VIDEO" = "xyes" ]]; then |
679 |
gbeauche |
1.7 |
AC_DEFINE(USE_SDL_VIDEO, 1, [Define to enable SDL video graphics support.]) |
680 |
gbeauche |
1.1 |
VIDEOSRCS="../SDL/video_sdl.cpp" |
681 |
|
|
KEYCODES="../SDL/keycodes" |
682 |
|
|
if [[ "x$ac_cv_framework_Carbon" = "xyes" ]]; then |
683 |
|
|
EXTRASYSSRCS="$EXTRASYSSRCS ../MacOSX/clip_macosx.cpp" |
684 |
|
|
else |
685 |
gbeauche |
1.33 |
EXTRASYSSRCS="$EXTRASYSSRCS ../dummy/clip_dummy.cpp" |
686 |
gbeauche |
1.1 |
fi |
687 |
|
|
else |
688 |
|
|
VIDEOSRCS="video_x.cpp" |
689 |
|
|
KEYCODES="keycodes" |
690 |
|
|
EXTRASYSSRCS="$EXTRASYSSRCS clip_unix.cpp" |
691 |
|
|
fi |
692 |
gbeauche |
1.7 |
if [[ "x$WANT_SDL_AUDIO" = "xyes" ]]; then |
693 |
|
|
AC_DEFINE(USE_SDL_AUDIO, 1, [Define to enable SDL audio support]) |
694 |
|
|
AUDIOSRC="../SDL/audio_sdl.cpp" |
695 |
|
|
fi |
696 |
gbeauche |
1.1 |
|
697 |
asvitkine |
1.68 |
dnl BINCUE overrides |
698 |
|
|
|
699 |
|
|
if [[ "x$have_bincue" = "xyes" ]]; then |
700 |
|
|
EXTRASYSSRCS="$EXTRASYSSRCS bincue_unix.cpp" |
701 |
|
|
fi |
702 |
|
|
|
703 |
|
|
|
704 |
asvitkine |
1.60 |
SYSSRCS="$VIDEOSRCS $EXTFSSRC $PREFSSRC $SERIALSRC $ETHERSRC $SCSISRC $AUDIOSRC $SEMSRC $UISRCS $EXTRASYSSRCS" |
705 |
gbeauche |
1.1 |
|
706 |
|
|
dnl Define a macro that translates a yesno-variable into a C macro definition |
707 |
|
|
dnl to be put into the config.h file |
708 |
|
|
dnl $1 -- the macro to define |
709 |
|
|
dnl $2 -- the value to translate |
710 |
|
|
dnl $3 -- template name |
711 |
gbeauche |
1.49 |
AC_DEFUN([AC_TRANSLATE_DEFINE], [ |
712 |
gbeauche |
1.1 |
if [[ "x$2" = "xyes" -o "x$2" = "xguessing yes" ]]; then |
713 |
|
|
AC_DEFINE($1, 1, $3) |
714 |
|
|
fi |
715 |
|
|
]) |
716 |
|
|
|
717 |
|
|
dnl Check that the host supports TUN/TAP devices |
718 |
|
|
AC_CACHE_CHECK([whether TUN/TAP is supported], |
719 |
|
|
ac_cv_tun_tap_support, [ |
720 |
|
|
AC_TRY_COMPILE([ |
721 |
|
|
#if defined(HAVE_LINUX_IF_H) && defined(HAVE_LINUX_IF_TUN_H) |
722 |
|
|
#include <linux/if.h> |
723 |
|
|
#include <linux/if_tun.h> |
724 |
|
|
#endif |
725 |
|
|
#if defined(HAVE_NET_IF_H) && defined(HAVE_NET_IF_TUN_H) |
726 |
|
|
#include <net/if.h> |
727 |
|
|
#include <net/if_tun.h> |
728 |
|
|
#endif |
729 |
|
|
], [ |
730 |
|
|
struct ifreq ifr; |
731 |
|
|
memset(&ifr, 0, sizeof(ifr)); |
732 |
|
|
ifr.ifr_flags = IFF_TAP | IFF_NO_PI; |
733 |
|
|
], |
734 |
|
|
ac_cv_tun_tap_support=yes, ac_cv_tun_tap_support=no |
735 |
|
|
) |
736 |
|
|
]) |
737 |
|
|
AC_TRANSLATE_DEFINE(ENABLE_TUNTAP, "$ac_cv_tun_tap_support", |
738 |
|
|
[Define if your system supports TUN/TAP devices.]) |
739 |
|
|
|
740 |
|
|
dnl Various checks if the system supports vm_allocate() and the like functions. |
741 |
|
|
have_mach_vm=no |
742 |
|
|
if [[ "x$ac_cv_func_vm_allocate" = "xyes" -a "x$ac_cv_func_vm_deallocate" = "xyes" -a \ |
743 |
|
|
"x$ac_cv_func_vm_protect" = "xyes" ]]; then |
744 |
|
|
have_mach_vm=yes |
745 |
|
|
fi |
746 |
|
|
AC_TRANSLATE_DEFINE(HAVE_MACH_VM, "$have_mach_vm", |
747 |
|
|
[Define if your system has a working vm_allocate()-based memory allocator.]) |
748 |
|
|
|
749 |
|
|
dnl Check that vm_allocate(), vm_protect() work |
750 |
|
|
if [[ "x$have_mach_vm" = "xyes" ]]; then |
751 |
|
|
|
752 |
|
|
AC_CACHE_CHECK([whether vm_protect works], |
753 |
|
|
ac_cv_vm_protect_works, [ |
754 |
|
|
AC_LANG_SAVE |
755 |
|
|
AC_LANG_CPLUSPLUS |
756 |
|
|
ac_cv_vm_protect_works=yes |
757 |
|
|
dnl First the tests that should segfault |
758 |
|
|
for test_def in NONE_READ NONE_WRITE READ_WRITE; do |
759 |
|
|
AC_TRY_RUN([ |
760 |
|
|
#define CONFIGURE_TEST_VM_MAP |
761 |
|
|
#define TEST_VM_PROT_$test_def |
762 |
|
|
#include "vm_alloc.cpp" |
763 |
|
|
], ac_cv_vm_protect_works=no, rm -f core, |
764 |
|
|
dnl When cross-compiling, do not assume anything |
765 |
|
|
ac_cv_vm_protect_works="guessing no" |
766 |
|
|
) |
767 |
|
|
done |
768 |
|
|
AC_TRY_RUN([ |
769 |
|
|
#define CONFIGURE_TEST_VM_MAP |
770 |
|
|
#define TEST_VM_PROT_RDWR_WRITE |
771 |
|
|
#include "vm_alloc.cpp" |
772 |
|
|
], , ac_cv_vm_protect_works=no, |
773 |
|
|
dnl When cross-compiling, do not assume anything |
774 |
|
|
ac_cv_vm_protect_works="guessing no" |
775 |
|
|
) |
776 |
|
|
AC_LANG_RESTORE |
777 |
|
|
] |
778 |
|
|
) |
779 |
|
|
|
780 |
|
|
dnl Remove support for vm_allocate() if vm_protect() does not work |
781 |
|
|
if [[ "x$have_mach_vm" = "xyes" ]]; then |
782 |
|
|
case $ac_cv_vm_protect_works in |
783 |
|
|
*yes) have_mach_vm=yes;; |
784 |
|
|
*no) have_mach_vm=no;; |
785 |
|
|
esac |
786 |
|
|
fi |
787 |
|
|
AC_TRANSLATE_DEFINE(HAVE_MACH_VM, "$have_mach_vm", |
788 |
|
|
[Define if your system has a working vm_allocate()-based memory allocator.]) |
789 |
|
|
|
790 |
|
|
fi dnl HAVE_MACH_VM |
791 |
|
|
|
792 |
|
|
dnl Various checks if the system supports mmap() and the like functions. |
793 |
|
|
dnl ... and Mach memory allocators are not supported |
794 |
|
|
have_mmap_vm=no |
795 |
|
|
if [[ "x$ac_cv_func_mmap" = "xyes" -a "x$ac_cv_func_munmap" = "xyes" -a \ |
796 |
|
|
"x$ac_cv_func_mprotect" = "xyes" ]]; then |
797 |
|
|
if [[ "x$have_mach_vm" = "xno" ]]; then |
798 |
|
|
have_mmap_vm=yes |
799 |
|
|
fi |
800 |
|
|
fi |
801 |
|
|
AC_TRANSLATE_DEFINE(HAVE_MMAP_VM, "$have_mmap_vm", |
802 |
|
|
[Define if your system has a working mmap()-based memory allocator.]) |
803 |
|
|
|
804 |
|
|
dnl Check that mmap() and associated functions work. |
805 |
|
|
if [[ "x$have_mmap_vm" = "xyes" ]]; then |
806 |
|
|
|
807 |
|
|
dnl Check if we have a working anonymous mmap() |
808 |
|
|
AC_CACHE_CHECK([whether mmap supports MAP_ANON], |
809 |
|
|
ac_cv_mmap_anon, [ |
810 |
|
|
AC_LANG_SAVE |
811 |
|
|
AC_LANG_CPLUSPLUS |
812 |
|
|
AC_TRY_RUN([ |
813 |
|
|
#define HAVE_MMAP_ANON |
814 |
|
|
#define CONFIGURE_TEST_VM_MAP |
815 |
|
|
#define TEST_VM_MMAP_ANON |
816 |
|
|
#include "vm_alloc.cpp" |
817 |
|
|
], ac_cv_mmap_anon=yes, ac_cv_mmap_anon=no, |
818 |
|
|
dnl When cross-compiling, do not assume anything. |
819 |
|
|
ac_cv_mmap_anon="guessing no" |
820 |
|
|
) |
821 |
|
|
AC_LANG_RESTORE |
822 |
|
|
] |
823 |
|
|
) |
824 |
|
|
AC_TRANSLATE_DEFINE(HAVE_MMAP_ANON, "$ac_cv_mmap_anon", |
825 |
|
|
[Define if <sys/mman.h> defines MAP_ANON and mmap()'ing with MAP_ANON works.]) |
826 |
|
|
|
827 |
|
|
AC_CACHE_CHECK([whether mmap supports MAP_ANONYMOUS], |
828 |
|
|
ac_cv_mmap_anonymous, [ |
829 |
|
|
AC_LANG_SAVE |
830 |
|
|
AC_LANG_CPLUSPLUS |
831 |
|
|
AC_TRY_RUN([ |
832 |
|
|
#define HAVE_MMAP_ANONYMOUS |
833 |
|
|
#define CONFIGURE_TEST_VM_MAP |
834 |
|
|
#define TEST_VM_MMAP_ANON |
835 |
|
|
#include "vm_alloc.cpp" |
836 |
|
|
], ac_cv_mmap_anonymous=yes, ac_cv_mmap_anonymous=no, |
837 |
|
|
dnl When cross-compiling, do not assume anything. |
838 |
|
|
ac_cv_mmap_anonymous="guessing no" |
839 |
|
|
) |
840 |
|
|
AC_LANG_RESTORE |
841 |
|
|
] |
842 |
|
|
) |
843 |
|
|
AC_TRANSLATE_DEFINE(HAVE_MMAP_ANONYMOUS, "$ac_cv_mmap_anonymous", |
844 |
|
|
[Define if <sys/mman.h> defines MAP_ANONYMOUS and mmap()'ing with MAP_ANONYMOUS works.]) |
845 |
|
|
|
846 |
|
|
AC_CACHE_CHECK([whether mprotect works], |
847 |
|
|
ac_cv_mprotect_works, [ |
848 |
|
|
AC_LANG_SAVE |
849 |
|
|
AC_LANG_CPLUSPLUS |
850 |
|
|
ac_cv_mprotect_works=yes |
851 |
|
|
dnl First the tests that should segfault |
852 |
|
|
for test_def in NONE_READ NONE_WRITE READ_WRITE; do |
853 |
|
|
AC_TRY_RUN([ |
854 |
|
|
#define CONFIGURE_TEST_VM_MAP |
855 |
|
|
#define TEST_VM_PROT_$test_def |
856 |
|
|
#include "vm_alloc.cpp" |
857 |
|
|
], ac_cv_mprotect_works=no, rm -f core, |
858 |
|
|
dnl When cross-compiling, do not assume anything |
859 |
|
|
ac_cv_mprotect_works="guessing no" |
860 |
|
|
) |
861 |
|
|
done |
862 |
|
|
AC_TRY_RUN([ |
863 |
|
|
#define CONFIGURE_TEST_VM_MAP |
864 |
|
|
#define TEST_VM_PROT_RDWR_WRITE |
865 |
|
|
#include "vm_alloc.cpp" |
866 |
|
|
], , ac_cv_mprotect_works=no, |
867 |
|
|
dnl When cross-compiling, do not assume anything |
868 |
|
|
ac_cv_mprotect_works="guessing no" |
869 |
|
|
) |
870 |
|
|
AC_LANG_RESTORE |
871 |
|
|
] |
872 |
|
|
) |
873 |
|
|
|
874 |
|
|
dnl Remove support for mmap() if mprotect() does not work |
875 |
|
|
if [[ "x$have_mmap_vm" = "xyes" ]]; then |
876 |
|
|
case $ac_cv_mprotect_works in |
877 |
|
|
*yes) have_mmap_vm=yes;; |
878 |
|
|
*no) have_mmap_vm=no;; |
879 |
|
|
esac |
880 |
|
|
fi |
881 |
|
|
AC_TRANSLATE_DEFINE(HAVE_MMAP_VM, $have_mmap_vm, |
882 |
|
|
[Define if your system has a working mmap()-based memory allocator.]) |
883 |
|
|
|
884 |
|
|
fi dnl HAVE_MMAP_VM |
885 |
|
|
|
886 |
|
|
dnl Check if we can modify the __PAGEZERO segment for use as Low Memory |
887 |
|
|
AC_CACHE_CHECK([whether __PAGEZERO can be Low Memory area 0x0000-0x3000], |
888 |
|
|
ac_cv_pagezero_hack, [ |
889 |
|
|
ac_cv_pagezero_hack=no |
890 |
|
|
if AC_TRY_COMMAND([Darwin/testlmem.sh 0x3000]); then |
891 |
|
|
ac_cv_pagezero_hack=yes |
892 |
|
|
dnl might as well skip the test for mmap-able low memory |
893 |
|
|
ac_cv_can_map_lm=no |
894 |
|
|
fi |
895 |
|
|
]) |
896 |
|
|
AC_TRANSLATE_DEFINE(PAGEZERO_HACK, "$ac_cv_pagezero_hack", |
897 |
|
|
[Define if the __PAGEZERO Mach-O Low Memory Globals hack works on this system.]) |
898 |
|
|
|
899 |
|
|
dnl Check if we can mmap 0x3000 bytes from 0x0000 |
900 |
|
|
AC_CACHE_CHECK([whether we can map Low Memory area 0x0000-0x3000], |
901 |
|
|
ac_cv_can_map_lm, [ |
902 |
|
|
AC_LANG_SAVE |
903 |
|
|
AC_LANG_CPLUSPLUS |
904 |
|
|
AC_TRY_RUN([ |
905 |
|
|
#include "vm_alloc.cpp" |
906 |
|
|
int main(void) { /* returns 0 if we could map the lowmem globals */ |
907 |
|
|
volatile char * lm = 0; |
908 |
|
|
if (vm_init() < 0) exit(1); |
909 |
|
|
if (vm_acquire_fixed(0, 0x2000) < 0) exit(1); |
910 |
|
|
lm[0] = 'z'; |
911 |
|
|
if (vm_release((char *)lm, 0x2000) < 0) exit(1); |
912 |
|
|
vm_exit(); exit(0); |
913 |
|
|
} |
914 |
|
|
], ac_cv_can_map_lm=yes, ac_cv_can_map_lm=no, |
915 |
|
|
dnl When cross-compiling, do not assume anything. |
916 |
|
|
ac_cv_can_map_lm="guessing no" |
917 |
|
|
) |
918 |
|
|
AC_LANG_RESTORE |
919 |
|
|
] |
920 |
|
|
) |
921 |
|
|
|
922 |
|
|
dnl Check signal handlers need to be reinstalled |
923 |
|
|
AC_CACHE_CHECK([whether signal handlers need to be reinstalled], |
924 |
|
|
ac_cv_signal_need_reinstall, [ |
925 |
|
|
AC_LANG_SAVE |
926 |
|
|
AC_LANG_CPLUSPLUS |
927 |
|
|
AC_TRY_RUN([ |
928 |
|
|
#include <stdlib.h> |
929 |
|
|
#ifdef HAVE_UNISTD_H |
930 |
|
|
#include <unistd.h> |
931 |
|
|
#endif |
932 |
|
|
#include <signal.h> |
933 |
|
|
static int handled_signal = 0; |
934 |
|
|
RETSIGTYPE sigusr1_handler(int) { handled_signal++; } |
935 |
|
|
int main(void) { /* returns 0 if signals need not to be reinstalled */ |
936 |
|
|
signal(SIGUSR1, sigusr1_handler); raise(SIGUSR1); raise(SIGUSR1); |
937 |
|
|
exit(handled_signal == 2); |
938 |
|
|
} |
939 |
|
|
], ac_cv_signal_need_reinstall=yes, ac_cv_signal_need_reinstall=no, |
940 |
|
|
dnl When cross-compiling, do not assume anything. |
941 |
|
|
ac_cv_signal_need_reinstall="guessing yes" |
942 |
|
|
) |
943 |
|
|
AC_LANG_RESTORE |
944 |
|
|
] |
945 |
|
|
) |
946 |
|
|
AC_TRANSLATE_DEFINE(SIGNAL_NEED_REINSTALL, "$ac_cv_signal_need_reinstall", |
947 |
|
|
[Define if your system requires signals to be reinstalled.]) |
948 |
|
|
|
949 |
|
|
dnl Check if sigaction handlers need to be reinstalled |
950 |
|
|
AC_CACHE_CHECK([whether sigaction handlers need to be reinstalled], |
951 |
|
|
ac_cv_sigaction_need_reinstall, [ |
952 |
|
|
AC_LANG_SAVE |
953 |
|
|
AC_LANG_CPLUSPLUS |
954 |
|
|
AC_TRY_RUN([ |
955 |
|
|
#include <stdlib.h> |
956 |
|
|
#ifdef HAVE_UNISTD_H |
957 |
|
|
#include <unistd.h> |
958 |
|
|
#endif |
959 |
|
|
#include <signal.h> |
960 |
|
|
static int handled_signal = 0; |
961 |
|
|
RETSIGTYPE sigusr1_handler(int) { handled_signal++; } |
962 |
|
|
typedef RETSIGTYPE (*signal_handler)(int); |
963 |
|
|
static signal_handler mysignal(int sig, signal_handler handler) { |
964 |
|
|
struct sigaction old_sa; |
965 |
|
|
struct sigaction new_sa; |
966 |
|
|
new_sa.sa_handler = handler; |
967 |
|
|
return ((sigaction(sig,&new_sa,&old_sa) < 0) ? SIG_IGN : old_sa.sa_handler); |
968 |
|
|
} |
969 |
|
|
int main(void) { /* returns 0 if signals need not to be reinstalled */ |
970 |
|
|
mysignal(SIGUSR1, sigusr1_handler); raise(SIGUSR1); raise(SIGUSR1); |
971 |
|
|
exit(handled_signal == 2); |
972 |
|
|
} |
973 |
|
|
], ac_cv_sigaction_need_reinstall=yes, ac_cv_sigaction_need_reinstall=no, |
974 |
|
|
dnl When cross-compiling, do not assume anything. |
975 |
|
|
ac_cv_sigaction_need_reinstall="guessing yes" |
976 |
|
|
) |
977 |
|
|
AC_LANG_RESTORE |
978 |
|
|
] |
979 |
|
|
) |
980 |
|
|
AC_TRANSLATE_DEFINE(SIGACTION_NEED_REINSTALL, "$ac_cv_sigaction_need_reinstall", |
981 |
|
|
[Define if your system requires sigactions to be reinstalled.]) |
982 |
|
|
|
983 |
|
|
dnl Check if Mach exceptions supported. |
984 |
|
|
AC_CACHE_CHECK([whether your system supports Mach exceptions], |
985 |
|
|
ac_cv_have_mach_exceptions, [ |
986 |
|
|
AC_LANG_SAVE |
987 |
|
|
AC_LANG_CPLUSPLUS |
988 |
|
|
AC_TRY_RUN([ |
989 |
|
|
#define HAVE_MACH_EXCEPTIONS 1 |
990 |
|
|
#define CONFIGURE_TEST_SIGSEGV_RECOVERY |
991 |
|
|
#include "vm_alloc.cpp" |
992 |
|
|
#include "sigsegv.cpp" |
993 |
|
|
], |
994 |
|
|
ac_cv_have_mach_exceptions=yes, |
995 |
|
|
ac_cv_have_mach_exceptions=no, |
996 |
|
|
dnl When cross-compiling, do not assume anything. |
997 |
|
|
ac_cv_have_mach_exceptions=no |
998 |
|
|
) |
999 |
|
|
AC_LANG_RESTORE |
1000 |
|
|
] |
1001 |
|
|
) |
1002 |
|
|
if [[ "$ac_cv_have_mach_exceptions" = "yes" ]]; then |
1003 |
|
|
sigsegv_recovery=mach |
1004 |
|
|
fi |
1005 |
|
|
AC_TRANSLATE_DEFINE(HAVE_MACH_EXCEPTIONS, "$ac_cv_have_mach_exceptions", |
1006 |
|
|
[Define if your system supports Mach exceptions.]) |
1007 |
|
|
|
1008 |
gbeauche |
1.9 |
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 |
gbeauche |
1.1 |
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], |
1035 |
|
|
ac_cv_have_extended_signals, [ |
1036 |
|
|
AC_LANG_SAVE |
1037 |
|
|
AC_LANG_CPLUSPLUS |
1038 |
|
|
AC_TRY_RUN([ |
1039 |
|
|
#define HAVE_SIGINFO_T 1 |
1040 |
|
|
#define CONFIGURE_TEST_SIGSEGV_RECOVERY |
1041 |
|
|
#include "vm_alloc.cpp" |
1042 |
|
|
#include "sigsegv.cpp" |
1043 |
|
|
], |
1044 |
|
|
ac_cv_have_extended_signals=yes, |
1045 |
|
|
ac_cv_have_extended_signals=no, |
1046 |
|
|
dnl When cross-compiling, do not assume anything. |
1047 |
|
|
ac_cv_have_extended_signals=no |
1048 |
|
|
) |
1049 |
|
|
AC_LANG_RESTORE |
1050 |
|
|
] |
1051 |
|
|
) |
1052 |
|
|
if [[ "$ac_cv_have_extended_signals" = "yes" ]]; then |
1053 |
|
|
sigsegv_recovery=siginfo |
1054 |
|
|
fi |
1055 |
|
|
AC_TRANSLATE_DEFINE(HAVE_SIGINFO_T, "$ac_cv_have_extended_signals", |
1056 |
|
|
[Define if your system support extended signals.]) |
1057 |
|
|
fi |
1058 |
|
|
|
1059 |
|
|
dnl Otherwise, check for subterfuges. |
1060 |
|
|
if [[ -z "$sigsegv_recovery" ]]; then |
1061 |
|
|
AC_CACHE_CHECK([whether we then have a subterfuge for your system], |
1062 |
|
|
ac_cv_have_sigcontext_hack, [ |
1063 |
|
|
AC_LANG_SAVE |
1064 |
|
|
AC_LANG_CPLUSPLUS |
1065 |
|
|
AC_TRY_RUN([ |
1066 |
|
|
#define HAVE_SIGCONTEXT_SUBTERFUGE 1 |
1067 |
|
|
#define CONFIGURE_TEST_SIGSEGV_RECOVERY |
1068 |
|
|
#include "vm_alloc.cpp" |
1069 |
|
|
#include "sigsegv.cpp" |
1070 |
|
|
], |
1071 |
|
|
ac_cv_have_sigcontext_hack=yes, |
1072 |
|
|
ac_cv_have_sigcontext_hack=no, |
1073 |
|
|
dnl When cross-compiling, do not assume anything. |
1074 |
|
|
ac_cv_have_sigcontext_hack=no |
1075 |
|
|
) |
1076 |
|
|
AC_LANG_RESTORE |
1077 |
|
|
]) |
1078 |
|
|
if [[ "$ac_cv_have_sigcontext_hack" = "yes" ]]; then |
1079 |
|
|
sigsegv_recovery=sigcontext |
1080 |
|
|
fi |
1081 |
|
|
AC_TRANSLATE_DEFINE(HAVE_SIGCONTEXT_SUBTERFUGE, "$ac_cv_have_sigcontext_hack", |
1082 |
|
|
[Define if we know a hack to replace siginfo_t->si_addr member.]) |
1083 |
|
|
fi |
1084 |
|
|
|
1085 |
|
|
dnl Check if we can ignore the fault (instruction skipping in SIGSEGV handler) |
1086 |
|
|
AC_CACHE_CHECK([whether we can skip instruction in SIGSEGV handler], |
1087 |
|
|
ac_cv_have_skip_instruction, [ |
1088 |
|
|
AC_LANG_SAVE |
1089 |
|
|
AC_LANG_CPLUSPLUS |
1090 |
|
|
AC_TRY_RUN([ |
1091 |
|
|
#define HAVE_SIGSEGV_SKIP_INSTRUCTION 1 |
1092 |
|
|
#define CONFIGURE_TEST_SIGSEGV_RECOVERY |
1093 |
|
|
#include "vm_alloc.cpp" |
1094 |
|
|
#include "sigsegv.cpp" |
1095 |
|
|
], ac_cv_have_skip_instruction=yes, ac_cv_have_skip_instruction=no, |
1096 |
|
|
dnl When cross-compiling, do not assume anything. |
1097 |
|
|
ac_cv_have_skip_instruction=no |
1098 |
|
|
) |
1099 |
|
|
AC_LANG_RESTORE |
1100 |
|
|
] |
1101 |
|
|
) |
1102 |
|
|
AC_TRANSLATE_DEFINE(HAVE_SIGSEGV_SKIP_INSTRUCTION, "$ac_cv_have_skip_instruction", |
1103 |
|
|
[Define if we can ignore the fault (instruction skipping in SIGSEGV handler).]) |
1104 |
|
|
|
1105 |
|
|
dnl Can we do Video on SEGV Signals ? |
1106 |
|
|
CAN_VOSF=no |
1107 |
|
|
if [[ -n "$sigsegv_recovery" ]]; then |
1108 |
|
|
CAN_VOSF=yes |
1109 |
|
|
fi |
1110 |
|
|
|
1111 |
|
|
dnl Enable VOSF screen updates with this feature is requested and feasible |
1112 |
|
|
if [[ "x$WANT_VOSF" = "xyes" -a "x$CAN_VOSF" = "xyes" ]]; then |
1113 |
|
|
AC_DEFINE(ENABLE_VOSF, 1, [Define if using video enabled on SEGV signals.]) |
1114 |
|
|
else |
1115 |
|
|
WANT_VOSF=no |
1116 |
|
|
fi |
1117 |
|
|
|
1118 |
gbeauche |
1.8 |
dnl Check addressing mode to use |
1119 |
|
|
AC_MSG_CHECKING([for addressing mode to use]) |
1120 |
|
|
if [[ "$EMULATED_PPC" != "yes" ]]; then |
1121 |
|
|
if [[ "$WANT_ADDRESSING_MODE" != "real" ]]; then |
1122 |
|
|
AC_MSG_WARN([Running in native PowerPC mode, force use of Real Addressing.]) |
1123 |
|
|
WANT_ADDRESSING_MODE="real" |
1124 |
|
|
fi |
1125 |
|
|
fi |
1126 |
|
|
if [[ "$WANT_ADDRESSING_MODE" = "direct" ]]; then |
1127 |
|
|
if [[ -n "$NATMEM_OFFSET" ]]; then |
1128 |
|
|
NATMEM_OFFSET_DEF="-DNATMEM_OFFSET=$NATMEM_OFFSET" |
1129 |
|
|
fi |
1130 |
|
|
AC_LANG_SAVE |
1131 |
|
|
AC_LANG_CPLUSPLUS |
1132 |
|
|
cat confdefs.h > conftest.$ac_ext |
1133 |
|
|
cat >> conftest.$ac_ext << EOF |
1134 |
|
|
#include <stdio.h> |
1135 |
|
|
#include <string.h> |
1136 |
|
|
#include "vm_alloc.cpp" |
1137 |
|
|
|
1138 |
|
|
int main(void) |
1139 |
|
|
{ |
1140 |
|
|
if (vm_init() < 0) |
1141 |
|
|
return 1; |
1142 |
|
|
|
1143 |
|
|
static const struct { |
1144 |
|
|
unsigned long base; |
1145 |
|
|
unsigned int size; |
1146 |
|
|
} ranges[[]] = { |
1147 |
|
|
{ 0x00000000, 0x0003000 }, |
1148 |
|
|
{ 0x10000000, 0x2000000 }, |
1149 |
|
|
{ 0x40800000, 0x0400000 }, |
1150 |
|
|
{ 0x68070000, 0x0010000 }, |
1151 |
|
|
{ 0x69000000, 0x0080000 }, |
1152 |
|
|
{ 0x68ffe000, 0x0002000 }, |
1153 |
|
|
{ 0x5fffe000, 0x0002000 }, |
1154 |
|
|
{ 0x60000000, 0x0040000 }, |
1155 |
|
|
}; |
1156 |
|
|
const int n_ranges = sizeof(ranges)/ sizeof(ranges[[0]]); |
1157 |
|
|
|
1158 |
|
|
#ifdef NATMEM_OFFSET |
1159 |
|
|
unsigned long ofs = NATMEM_OFFSET; |
1160 |
|
|
#else |
1161 |
|
|
for (unsigned long ofs = 0x10000000; ofs <= 0x90000000; ofs += 0x10000000) |
1162 |
|
|
#endif |
1163 |
|
|
for (int i = 0; i < n_ranges; i++) { |
1164 |
|
|
char *m = (char *)(ranges[[i]].base + ofs); |
1165 |
|
|
if (vm_acquire_fixed(m, ranges[[i]].size) != 0) |
1166 |
|
|
break; |
1167 |
|
|
memset(m, 0, ranges[[i]].size); |
1168 |
|
|
vm_release(m, ranges[[i]].size); |
1169 |
|
|
if (i == n_ranges - 1) { |
1170 |
gbeauche |
1.13 |
if (sizeof(void *) == 8 && ofs > 0xffffffff) |
1171 |
|
|
printf("0x%lxul\n", ofs); |
1172 |
|
|
else |
1173 |
|
|
printf("0x%08x\n", ofs); |
1174 |
gbeauche |
1.8 |
return 0; |
1175 |
|
|
} |
1176 |
|
|
} |
1177 |
|
|
|
1178 |
|
|
vm_exit(); |
1179 |
|
|
return 1; |
1180 |
|
|
} |
1181 |
|
|
EOF |
1182 |
|
|
doit='$CXX conftest.$ac_ext -o conftest.$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS $LIBS $NATMEM_OFFSET_DEF >& AS_MESSAGE_LOG_FD' |
1183 |
|
|
if AC_TRY_EVAL(doit); then |
1184 |
|
|
NATMEM_OFFSET=`./conftest.$ac_exeext` |
1185 |
gbeauche |
1.9 |
else |
1186 |
|
|
NATMEM_OFFSET= |
1187 |
gbeauche |
1.8 |
fi |
1188 |
|
|
rm -f conftest* |
1189 |
|
|
AC_LANG_RESTORE |
1190 |
gbeauche |
1.9 |
|
1191 |
|
|
if [[ -z "$NATMEM_OFFSET" ]]; then |
1192 |
|
|
AC_MSG_ERROR([could not determine a sensible NATMEM_OFFSET value]) |
1193 |
|
|
else |
1194 |
|
|
WANT_ADDRESSING_MODE="direct,$NATMEM_OFFSET" |
1195 |
|
|
AC_DEFINE_UNQUOTED(NATMEM_OFFSET, $NATMEM_OFFSET, |
1196 |
|
|
[Define constant offset for Mac address translation]) |
1197 |
|
|
fi |
1198 |
gbeauche |
1.8 |
fi |
1199 |
|
|
AC_MSG_RESULT($WANT_ADDRESSING_MODE) |
1200 |
|
|
|
1201 |
gbeauche |
1.26 |
dnl Utility macro used by next two tests. |
1202 |
|
|
dnl AC_EXAMINE_OBJECT(C source code, |
1203 |
|
|
dnl commands examining object file, |
1204 |
|
|
dnl [commands to run if compile failed]): |
1205 |
|
|
dnl |
1206 |
|
|
dnl Compile the source code to an object file; then convert it into a |
1207 |
|
|
dnl printable representation. All unprintable characters and |
1208 |
|
|
dnl asterisks (*) are replaced by dots (.). All white space is |
1209 |
|
|
dnl deleted. Newlines (ASCII 0x10) in the input are preserved in the |
1210 |
|
|
dnl output, but runs of newlines are compressed to a single newline. |
1211 |
|
|
dnl Finally, line breaks are forcibly inserted so that no line is |
1212 |
|
|
dnl longer than 80 columns and the file ends with a newline. The |
1213 |
|
|
dnl result of all this processing is in the file conftest.dmp, which |
1214 |
|
|
dnl may be examined by the commands in the second argument. |
1215 |
|
|
dnl |
1216 |
|
|
AC_DEFUN([gcc_AC_EXAMINE_OBJECT], |
1217 |
|
|
[AC_LANG_SAVE |
1218 |
|
|
AC_LANG_C |
1219 |
|
|
dnl Next bit cribbed from AC_TRY_COMPILE. |
1220 |
|
|
cat > conftest.$ac_ext <<EOF |
1221 |
|
|
[#line __oline__ "configure" |
1222 |
|
|
#include "confdefs.h" |
1223 |
|
|
$1 |
1224 |
|
|
]EOF |
1225 |
|
|
if AC_TRY_EVAL(ac_compile); then |
1226 |
|
|
od -c conftest.o | |
1227 |
|
|
sed ['s/^[0-7]*[ ]*/ / |
1228 |
|
|
s/\*/./g |
1229 |
|
|
s/ \\n/*/g |
1230 |
|
|
s/ [0-9][0-9][0-9]/./g |
1231 |
|
|
s/ \\[^ ]/./g'] | |
1232 |
|
|
tr -d ' |
1233 |
|
|
' | tr -s '*' ' |
1234 |
|
|
' | fold | sed '$a\ |
1235 |
|
|
' > conftest.dmp |
1236 |
|
|
$2 |
1237 |
|
|
ifelse($3, , , else |
1238 |
|
|
$3 |
1239 |
|
|
)dnl |
1240 |
|
|
fi |
1241 |
|
|
rm -rf conftest* |
1242 |
|
|
AC_LANG_RESTORE]) |
1243 |
|
|
|
1244 |
|
|
dnl Floating point format probe. |
1245 |
|
|
dnl The basic concept is the same as the above: grep the object |
1246 |
|
|
dnl file for an interesting string. We have to watch out for |
1247 |
|
|
dnl rounding changing the values in the object, however; this is |
1248 |
|
|
dnl handled by ignoring the least significant byte of the float. |
1249 |
|
|
dnl |
1250 |
|
|
dnl Does not know about VAX G-float or C4x idiosyncratic format. |
1251 |
|
|
dnl It does know about PDP-10 idiosyncratic format, but this is |
1252 |
|
|
dnl not presently supported by GCC. S/390 "binary floating point" |
1253 |
|
|
dnl is in fact IEEE (but maybe we should have that in EBCDIC as well |
1254 |
|
|
dnl as ASCII?) |
1255 |
|
|
dnl |
1256 |
|
|
AC_DEFUN([gcc_AC_C_FLOAT_FORMAT], |
1257 |
|
|
[AC_CACHE_CHECK(floating point format, ac_cv_c_float_format, |
1258 |
|
|
[gcc_AC_EXAMINE_OBJECT( |
1259 |
|
|
[/* This will not work unless sizeof(double) == 8. */ |
1260 |
|
|
extern char sizeof_double_must_be_8 [sizeof(double) == 8 ? 1 : -1]; |
1261 |
|
|
|
1262 |
|
|
/* This structure must have no internal padding. */ |
1263 |
|
|
struct possibility { |
1264 |
|
|
char prefix[8]; |
1265 |
|
|
double candidate; |
1266 |
|
|
char postfix[8]; |
1267 |
|
|
}; |
1268 |
|
|
|
1269 |
|
|
#define C(cand) { "\nformat:", cand, ":tamrof\n" } |
1270 |
|
|
struct possibility table [] = |
1271 |
|
|
{ |
1272 |
|
|
C( 3.25724264705901305206e+01), /* @@IEEEFP - IEEE 754 */ |
1273 |
|
|
C( 3.53802595280598432000e+18), /* D__float - VAX */ |
1274 |
|
|
C( 5.32201830133125317057e-19), /* D.PDP-10 - PDP-10 - the dot is 0x13a */ |
1275 |
|
|
C( 1.77977764695171661377e+10), /* IBMHEXFP - s/390 format, ascii */ |
1276 |
|
|
C(-5.22995989424860458374e+10) /* IBMHEXFP - s/390 format, EBCDIC */ |
1277 |
|
|
};], |
1278 |
|
|
[if grep 'format:.@IEEEF.:tamrof' conftest.dmp >/dev/null 2>&1; then |
1279 |
|
|
ac_cv_c_float_format='IEEE (big-endian)' |
1280 |
|
|
elif grep 'format:.I@@PFE.:tamrof' conftest.dmp >/dev/null 2>&1; then |
1281 |
|
|
ac_cv_c_float_format='IEEE (big-endian)' |
1282 |
|
|
elif grep 'format:.FEEEI@.:tamrof' conftest.dmp >/dev/null 2>&1; then |
1283 |
|
|
ac_cv_c_float_format='IEEE (little-endian)' |
1284 |
|
|
elif grep 'format:.EFP@@I.:tamrof' conftest.dmp >/dev/null 2>&1; then |
1285 |
|
|
ac_cv_c_float_format='IEEE (little-endian)' |
1286 |
|
|
elif grep 'format:.__floa.:tamrof' conftest.dmp >/dev/null 2>&1; then |
1287 |
|
|
ac_cv_c_float_format='VAX D-float' |
1288 |
|
|
elif grep 'format:..PDP-1.:tamrof' conftest.dmp >/dev/null 2>&1; then |
1289 |
|
|
ac_cv_c_float_format='PDP-10' |
1290 |
|
|
elif grep 'format:.BMHEXF.:tamrof' conftest.dmp >/dev/null 2>&1; then |
1291 |
|
|
ac_cv_c_float_format='IBM 370 hex' |
1292 |
|
|
else |
1293 |
|
|
AC_MSG_ERROR(Unknown floating point format) |
1294 |
|
|
fi], |
1295 |
|
|
[AC_MSG_ERROR(compile failed)]) |
1296 |
|
|
]) |
1297 |
|
|
# IEEE is the default format. If the float endianness isn't the same |
1298 |
|
|
# as the integer endianness, we have to set FLOAT_WORDS_BIG_ENDIAN |
1299 |
|
|
# (which is a tristate: yes, no, default). This is only an issue with |
1300 |
|
|
# IEEE; the other formats are only supported by a few machines each, |
1301 |
|
|
# all with the same endianness. |
1302 |
|
|
format=IEEE_FLOAT_FORMAT |
1303 |
|
|
fbigend= |
1304 |
|
|
case $ac_cv_c_float_format in |
1305 |
|
|
'IEEE (big-endian)' ) |
1306 |
|
|
if test $ac_cv_c_bigendian = no; then |
1307 |
|
|
fbigend=1 |
1308 |
|
|
fi |
1309 |
|
|
;; |
1310 |
|
|
'IEEE (little-endian)' ) |
1311 |
|
|
if test $ac_cv_c_bigendian = yes; then |
1312 |
|
|
fbigend=0 |
1313 |
|
|
fi |
1314 |
|
|
;; |
1315 |
|
|
'VAX D-float' ) |
1316 |
|
|
format=VAX_FLOAT_FORMAT |
1317 |
|
|
;; |
1318 |
|
|
'PDP-10' ) |
1319 |
|
|
format=PDP10_FLOAT_FORMAT |
1320 |
|
|
;; |
1321 |
|
|
'IBM 370 hex' ) |
1322 |
|
|
format=IBM_FLOAT_FORMAT |
1323 |
|
|
;; |
1324 |
|
|
esac |
1325 |
|
|
AC_DEFINE_UNQUOTED(HOST_FLOAT_FORMAT, $format, |
1326 |
|
|
[Define to the floating point format of the host machine.]) |
1327 |
|
|
if test -n "$fbigend"; then |
1328 |
|
|
AC_DEFINE_UNQUOTED(HOST_FLOAT_WORDS_BIG_ENDIAN, $fbigend, |
1329 |
|
|
[Define to 1 if the host machine stores floating point numbers in |
1330 |
|
|
memory with the word containing the sign bit at the lowest address, |
1331 |
|
|
or to 0 if it does it the other way around. |
1332 |
|
|
|
1333 |
|
|
This macro should not be defined if the ordering is the same as for |
1334 |
|
|
multi-word integers.]) |
1335 |
|
|
fi |
1336 |
|
|
]) |
1337 |
|
|
|
1338 |
|
|
dnl Check for host float format |
1339 |
|
|
gcc_AC_C_FLOAT_FORMAT |
1340 |
|
|
|
1341 |
gbeauche |
1.1 |
dnl Platform specific binary postprocessor |
1342 |
|
|
AC_PATH_PROG(BLESS, "true") |
1343 |
|
|
if [[ "x$ac_cv_pagezero_hack" = "xyes" ]]; then |
1344 |
|
|
BLESS=Darwin/lowmem |
1345 |
|
|
LDFLAGS="$LDFLAGS -pagezero_size 0x3000" |
1346 |
|
|
fi |
1347 |
|
|
|
1348 |
|
|
dnl Check for GCC 2.7 or higher. |
1349 |
|
|
HAVE_GCC27=no |
1350 |
|
|
AC_MSG_CHECKING(for GCC 2.7 or higher) |
1351 |
gbeauche |
1.36 |
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#if ! (__GNUC__ - 1 > 1 || __GNUC_MINOR__ - 1 > 5) |
1352 |
|
|
# error gcc < 2.7 |
1353 |
gbeauche |
1.44 |
typedef syntax error; |
1354 |
gbeauche |
1.36 |
#endif |
1355 |
|
|
]])], |
1356 |
|
|
[AC_MSG_RESULT(yes); HAVE_GCC27=yes], |
1357 |
|
|
[AC_MSG_RESULT(no)]) |
1358 |
gbeauche |
1.1 |
|
1359 |
|
|
dnl Check for GCC 3.0 or higher. |
1360 |
|
|
HAVE_GCC30=no |
1361 |
|
|
AC_MSG_CHECKING(for GCC 3.0 or higher) |
1362 |
gbeauche |
1.36 |
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#if ! (__GNUC__ >= 3) |
1363 |
|
|
# error gcc < 3 |
1364 |
gbeauche |
1.44 |
typedef syntax error; |
1365 |
gbeauche |
1.36 |
#endif |
1366 |
|
|
]])], |
1367 |
|
|
[AC_MSG_RESULT(yes); HAVE_GCC30=yes], |
1368 |
|
|
[AC_MSG_RESULT(no)]) |
1369 |
gbeauche |
1.1 |
|
1370 |
|
|
dnl Check for ICC. |
1371 |
|
|
AC_MSG_CHECKING(for ICC) |
1372 |
|
|
HAVE_ICC=no |
1373 |
|
|
if $CXX -V -v 2>&1 | grep -q "Intel(R) C++ Compiler"; then |
1374 |
|
|
HAVE_ICC=yes |
1375 |
|
|
fi |
1376 |
|
|
AC_MSG_RESULT($HAVE_ICC) |
1377 |
|
|
|
1378 |
gbeauche |
1.9 |
dnl Determine the generated object format |
1379 |
gbeauche |
1.24 |
AC_CACHE_CHECK([the format of compiler generated objects], |
1380 |
gbeauche |
1.9 |
ac_cv_object_format, [ |
1381 |
gbeauche |
1.1 |
echo 'int i;' > conftest.$ac_ext |
1382 |
gbeauche |
1.9 |
ac_cv_object_format=no |
1383 |
gbeauche |
1.1 |
if AC_TRY_EVAL(ac_compile); then |
1384 |
|
|
case `/usr/bin/file conftest.$ac_objext` in |
1385 |
|
|
*"ELF"*) |
1386 |
gbeauche |
1.9 |
ac_cv_object_format=elf |
1387 |
|
|
;; |
1388 |
gbeauche |
1.24 |
*"Mach-O"*) |
1389 |
|
|
ac_cv_object_format=mach |
1390 |
|
|
;; |
1391 |
gbeauche |
1.9 |
*) |
1392 |
|
|
ac_cv_object_format=unknown |
1393 |
gbeauche |
1.1 |
;; |
1394 |
|
|
esac |
1395 |
|
|
fi |
1396 |
|
|
rm -rf conftest* |
1397 |
|
|
]) |
1398 |
|
|
|
1399 |
gbeauche |
1.32 |
dnl Add -fno-strict-aliasing for slirp sources |
1400 |
|
|
if [[ "x$HAVE_GCC30" = "xyes" ]]; then |
1401 |
|
|
SAVED_CFLAGS="$CFLAGS" |
1402 |
|
|
CFLAGS="$CFLAGS -fno-strict-aliasing" |
1403 |
|
|
AC_CACHE_CHECK([whether the compiler supports -fno-strict-aliasing], |
1404 |
|
|
ac_cv_gcc_no_strict_aliasing, [ |
1405 |
|
|
AC_TRY_COMPILE([],[], |
1406 |
|
|
[ac_cv_gcc_no_strict_aliasing=yes; AC_SUBST(SLIRP_CFLAGS, "-fno-strict-aliasing")], |
1407 |
|
|
[ac_cv_gcc_no_strict_aliasing=no]) |
1408 |
|
|
]) |
1409 |
|
|
CFLAGS="$SAVED_CFLAGS" |
1410 |
|
|
fi |
1411 |
|
|
|
1412 |
gbeauche |
1.39 |
dnl Add -mdynamic-no-pic for MacOS X (XXX icc10 will support MacOS X) |
1413 |
|
|
if [[ "x$HAVE_GCC30" = "xyes" -a "x$HAVE_ICC" = "xno" ]]; then |
1414 |
gbeauche |
1.31 |
SAVED_CFLAGS="$CFLAGS" |
1415 |
|
|
CFLAGS="$CFLAGS -mdynamic-no-pic" |
1416 |
|
|
AC_CACHE_CHECK([whether the compiler supports -mdynamic-no-pic], |
1417 |
|
|
ac_cv_gcc_mdynamic_no_pic, [ |
1418 |
|
|
AC_TRY_COMPILE([],[],[ac_cv_gcc_mdynamic_no_pic=yes],[ac_cv_gcc_mdynamic_no_pic=no]) |
1419 |
|
|
]) |
1420 |
|
|
if [[ "x$ac_cv_gcc_mdynamic_no_pic" = "xyes" ]]; then |
1421 |
|
|
CXXFLAGS="$CXXFLAGS -mdynamic-no-pic" |
1422 |
|
|
else |
1423 |
|
|
CFLAGS="$SAVED_CFLAGS" |
1424 |
|
|
fi |
1425 |
|
|
fi |
1426 |
|
|
|
1427 |
gbeauche |
1.1 |
dnl CPU emulator sources |
1428 |
|
|
if [[ "x$EMULATED_PPC" = "xyes" ]]; then |
1429 |
|
|
CPUSRCS="\ |
1430 |
gbeauche |
1.9 |
../kpx_cpu/src/mathlib/ieeefp.cpp \ |
1431 |
gbeauche |
1.26 |
../kpx_cpu/src/mathlib/mathlib.cpp \ |
1432 |
gbeauche |
1.1 |
../kpx_cpu/src/cpu/ppc/ppc-cpu.cpp \ |
1433 |
|
|
../kpx_cpu/src/cpu/ppc/ppc-decode.cpp \ |
1434 |
|
|
../kpx_cpu/src/cpu/ppc/ppc-execute.cpp \ |
1435 |
gbeauche |
1.55 |
../kpx_cpu/src/cpu/ppc/ppc-translate.cpp \ |
1436 |
|
|
../kpx_cpu/src/utils/utils-cpuinfo.cpp" |
1437 |
gbeauche |
1.1 |
CPPFLAGS="$CPPFLAGS -I../kpx_cpu/include -I../kpx_cpu/src" |
1438 |
|
|
|
1439 |
|
|
dnl Enable JIT compiler, if possible |
1440 |
|
|
if [[ "x$WANT_JIT" = "xyes" ]]; then |
1441 |
|
|
AC_CACHE_CHECK([whether dyngen can be used], |
1442 |
|
|
ac_cv_use_dyngen, [ |
1443 |
gbeauche |
1.9 |
case $host_cpu:$ac_cv_object_format in |
1444 |
|
|
powerpc:elf) |
1445 |
gbeauche |
1.1 |
ac_cv_use_dyngen=yes |
1446 |
|
|
;; |
1447 |
gbeauche |
1.9 |
x86_64:elf) |
1448 |
gbeauche |
1.1 |
ac_cv_use_dyngen=yes |
1449 |
|
|
;; |
1450 |
gbeauche |
1.9 |
i?86:elf) |
1451 |
gbeauche |
1.1 |
ac_cv_use_dyngen=yes |
1452 |
|
|
;; |
1453 |
gbeauche |
1.43 |
mips:elf) |
1454 |
|
|
ac_cv_use_dyngen=yes |
1455 |
|
|
;; |
1456 |
gbeauche |
1.24 |
powerpc:mach) |
1457 |
|
|
ac_cv_use_dyngen=yes |
1458 |
|
|
;; |
1459 |
gbeauche |
1.41 |
i?86:mach) |
1460 |
|
|
ac_cv_use_dyngen=yes |
1461 |
|
|
;; |
1462 |
gbeauche |
1.1 |
*:*) |
1463 |
|
|
ac_cv_use_dyngen=no |
1464 |
|
|
;; |
1465 |
|
|
esac |
1466 |
|
|
dnl Check for a suitable synthetic opcodes compiler (icc is faking itself as gcc 3.2.2) |
1467 |
|
|
if [[ -z "$DYNGEN_CC" ]]; then |
1468 |
|
|
if [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_ICC" = "xno" ]]; then |
1469 |
|
|
DYNGEN_CC=$CXX |
1470 |
|
|
else |
1471 |
gbeauche |
1.44 |
for p in /usr/bin /usr/local/bin /usr/freeware/bin; do |
1472 |
gbeauche |
1.1 |
gxx="$p/g++" |
1473 |
|
|
if [[ -x "$gxx" ]]; then |
1474 |
|
|
DYNGEN_CC="$gxx" |
1475 |
|
|
fi |
1476 |
|
|
done |
1477 |
|
|
fi |
1478 |
|
|
fi |
1479 |
gbeauche |
1.27 |
if [[ -z "$DYNGEN_CC" ]]; then |
1480 |
gbeauche |
1.1 |
ac_cv_use_dyngen=no |
1481 |
|
|
fi |
1482 |
|
|
]) |
1483 |
|
|
if [[ "x$ac_cv_use_dyngen" = "xyes" ]]; then |
1484 |
|
|
case $host_cpu in |
1485 |
|
|
i?86) |
1486 |
gbeauche |
1.46 |
DYNGEN_OP_FLAGS="-fomit-frame-pointer" |
1487 |
gbeauche |
1.24 |
;; |
1488 |
gbeauche |
1.43 |
mips) |
1489 |
|
|
DYNGEN_OP_FLAGS="-fno-delayed-branch -mno-abicalls" |
1490 |
|
|
;; |
1491 |
gbeauche |
1.24 |
powerpc) |
1492 |
|
|
if [[ "x$ac_cv_object_format" = "xmach" ]]; then |
1493 |
|
|
DYNGEN_OP_FLAGS="-mdynamic-no-pic" |
1494 |
gbeauche |
1.1 |
fi |
1495 |
|
|
;; |
1496 |
|
|
esac |
1497 |
gbeauche |
1.44 |
have_dyngen_gcc3=no |
1498 |
|
|
case "x`$DYNGEN_CC -dumpversion`" in |
1499 |
|
|
x[12].*) ;; |
1500 |
|
|
x*) have_dyngen_gcc3=yes ;; |
1501 |
|
|
esac |
1502 |
|
|
if [[ "x$have_dyngen_gcc3" = "xyes" ]]; then |
1503 |
gbeauche |
1.53 |
DYNGEN_OP_FLAGS="$DYNGEN_OP_FLAGS -fno-align-functions" |
1504 |
gbeauche |
1.24 |
else |
1505 |
|
|
DYNGEN_OP_FLAGS="$DYNGEN_OP_FLAGS -malign-functions=0" |
1506 |
|
|
fi |
1507 |
gbeauche |
1.38 |
DYNGEN_OP_FLAGS="$DYNGEN_OP_FLAGS -finline-functions -finline-limit=10000 -fno-exceptions -g0" |
1508 |
gbeauche |
1.44 |
if [[ "x$have_dyngen_gcc3" = "xyes" ]]; then |
1509 |
gbeauche |
1.1 |
DYNGEN_OP_FLAGS="$DYNGEN_OP_FLAGS -fno-reorder-blocks -fno-optimize-sibling-calls" |
1510 |
|
|
fi |
1511 |
gbeauche |
1.43 |
if [[ "x$DYNGEN_CC" != "x$CXX" ]]; then |
1512 |
|
|
DYNGEN_CFLAGS="-O2 $CFLAGS" |
1513 |
|
|
DYNGEN_CXXFLAGS="-O2 $CXXFLAGS" |
1514 |
|
|
else |
1515 |
|
|
DYNGEN_CFLAGS="\$(CFLAGS)" |
1516 |
|
|
DYNGEN_CXXFLAGS="\$(CXXFLAGS)" |
1517 |
|
|
fi |
1518 |
gbeauche |
1.1 |
else |
1519 |
|
|
WANT_JIT=no |
1520 |
|
|
fi |
1521 |
|
|
AC_TRANSLATE_DEFINE(ENABLE_DYNGEN, $ac_cv_use_dyngen, [Define to enable dyngen engine]) |
1522 |
|
|
if [[ "x$WANT_JIT" = "xyes" ]]; then |
1523 |
|
|
DYNGENSRCS="\ |
1524 |
|
|
../kpx_cpu/src/cpu/jit/dyngen.c \ |
1525 |
|
|
../kpx_cpu/src/cpu/jit/cxxdemangle.cpp" |
1526 |
|
|
CPUSRCS="\ |
1527 |
|
|
../kpx_cpu/src/cpu/jit/jit-cache.cpp \ |
1528 |
|
|
../kpx_cpu/src/cpu/jit/basic-dyngen.cpp \ |
1529 |
gbeauche |
1.55 |
../kpx_cpu/src/cpu/ppc/ppc-dyngen.cpp \ |
1530 |
|
|
../kpx_cpu/src/cpu/ppc/ppc-jit.cpp $CPUSRCS" |
1531 |
gbeauche |
1.1 |
fi |
1532 |
|
|
fi |
1533 |
|
|
CPUSRCS="$CPUSRCS ../kpx_cpu/sheepshaver_glue.cpp" |
1534 |
|
|
else |
1535 |
|
|
WANT_JIT=no |
1536 |
|
|
fi |
1537 |
|
|
if [[ "x$WANT_JIT" = "xyes" ]]; then |
1538 |
|
|
CPPFLAGS="$CPPFLAGS -DUSE_JIT" |
1539 |
|
|
fi |
1540 |
|
|
|
1541 |
gbeauche |
1.43 |
dnl Higher level optimizations with MIPSPro compilers are possible |
1542 |
|
|
if [[ "x$HAVE_IPA" = "xyes" ]]; then |
1543 |
|
|
CFLAGS="`echo $CFLAGS | sed -e 's/-g//g'` -O3 -OPT:Olimit=0 -IPA" |
1544 |
|
|
CXXFLAGS="`echo $CXXFLAGS | sed -e 's/-g//g'` -O3 -OPT:Olimit=0 -IPA" |
1545 |
|
|
CXXFLAGS="-LANG:std $CXXFLAGS" |
1546 |
|
|
LDFLAGS="$LDFLAGS -O3 -OPT:Olimit=0 -IPA" |
1547 |
|
|
fi |
1548 |
|
|
|
1549 |
gbeauche |
1.52 |
dnl Check for linker script support |
1550 |
|
|
case $target_os:$target_cpu in |
1551 |
|
|
linux*:i?86) LINKER_SCRIPT_FLAGS="-Wl,-T,ldscripts/linux-i386.ld";; |
1552 |
|
|
linux*:x86_64) LINKER_SCRIPT_FLAGS="-Wl,-T,ldscripts/linux-x86_64.ld";; |
1553 |
|
|
linux*:powerpc) LINKER_SCRIPT_FLAGS="-Wl,-T,ldscripts/linux-ppc.ld";; |
1554 |
|
|
netbsd*:i?86) LINKER_SCRIPT_FLAGS="-Wl,-T,ldscripts/linux-i386.ld";; |
1555 |
|
|
freebsd*:i?86) LINKER_SCRIPT_FLAGS="-Wl,-T,ldscripts/freebsd-i386.ld";; |
1556 |
|
|
darwin*:*) LINKER_SCRIPT_FLAGS="-Wl,-seg1addr,0x78048000";; |
1557 |
|
|
esac |
1558 |
|
|
if [[ -n "$LINKER_SCRIPT_FLAGS" ]]; then |
1559 |
|
|
AC_CACHE_CHECK([whether linker script is usable], |
1560 |
|
|
ac_cv_linker_script_works, [ |
1561 |
|
|
AC_LANG_SAVE |
1562 |
|
|
AC_LANG_CPLUSPLUS |
1563 |
|
|
saved_LDFLAGS="$LDFLAGS" |
1564 |
|
|
LDFLAGS="$LDFLAGS $LINKER_SCRIPT_FLAGS" |
1565 |
|
|
AC_TRY_RUN( |
1566 |
|
|
[int main() {if ((char *)&main < (char *)0x70000000) return 1;}], |
1567 |
|
|
[ac_cv_linker_script_works=yes], |
1568 |
|
|
[ac_cv_linker_script_works=no], |
1569 |
|
|
dnl When cross-compiling, assume it works |
1570 |
|
|
[ac_cv_linker_script_works="guessing yes"] |
1571 |
|
|
) |
1572 |
|
|
AC_LANG_RESTORE |
1573 |
|
|
if [[ "$ac_cv_linker_script_works" = "no" ]]; then |
1574 |
|
|
LDFLAGS="$saved_LDFLAGS" |
1575 |
|
|
LINKER_SCRIPT_FLAGS="" |
1576 |
|
|
fi |
1577 |
|
|
]) |
1578 |
|
|
fi |
1579 |
|
|
AC_TRANSLATE_DEFINE(HAVE_LINKER_SCRIPT, "$ac_cv_linker_script_works", |
1580 |
|
|
[Define if there is a linker script to relocate the executable above 0x70000000.]) |
1581 |
|
|
|
1582 |
gbeauche |
1.1 |
dnl Generate Makefile. |
1583 |
gbeauche |
1.16 |
AC_SUBST(PERL) |
1584 |
gbeauche |
1.14 |
AC_SUBST(USE_DYNGEN, [$ac_cv_use_dyngen]) |
1585 |
gbeauche |
1.1 |
AC_SUBST(DYNGENSRCS) |
1586 |
|
|
AC_SUBST(DYNGEN_CC) |
1587 |
gbeauche |
1.43 |
AC_SUBST(DYNGEN_CFLAGS) |
1588 |
|
|
AC_SUBST(DYNGEN_CXXFLAGS) |
1589 |
gbeauche |
1.1 |
AC_SUBST(DYNGEN_OP_FLAGS) |
1590 |
|
|
AC_SUBST(SYSSRCS) |
1591 |
|
|
AC_SUBST(CPUSRCS) |
1592 |
|
|
AC_SUBST(BLESS) |
1593 |
|
|
AC_SUBST(KEYCODES) |
1594 |
gbeauche |
1.5 |
AC_OUTPUT([ |
1595 |
|
|
Makefile |
1596 |
|
|
../MacOSX/Info.plist |
1597 |
|
|
]) |
1598 |
gbeauche |
1.1 |
|
1599 |
|
|
dnl Print summary. |
1600 |
|
|
echo |
1601 |
|
|
echo SheepShaver configuration summary: |
1602 |
|
|
echo |
1603 |
|
|
echo SDL support ...................... : $SDL_SUPPORT |
1604 |
asvitkine |
1.68 |
echo BINCUE support ................... : $have_bincue |
1605 |
gbeauche |
1.21 |
echo FBDev DGA support ................ : $WANT_FBDEV_DGA |
1606 |
gbeauche |
1.1 |
echo XFree86 DGA support .............. : $WANT_XF86_DGA |
1607 |
|
|
echo XFree86 VidMode support .......... : $WANT_XF86_VIDMODE |
1608 |
|
|
echo Using PowerPC emulator ........... : $EMULATED_PPC |
1609 |
|
|
echo Enable JIT compiler .............. : $WANT_JIT |
1610 |
|
|
echo Enable video on SEGV signals ..... : $WANT_VOSF |
1611 |
|
|
echo ESD sound support ................ : $WANT_ESD |
1612 |
|
|
echo GTK user interface ............... : $WANT_GTK |
1613 |
|
|
echo mon debugger support ............. : $WANT_MON |
1614 |
gbeauche |
1.8 |
echo Addressing mode .................. : $WANT_ADDRESSING_MODE |
1615 |
gbeauche |
1.1 |
echo Bad memory access recovery type .. : $sigsegv_recovery |
1616 |
|
|
echo |
1617 |
|
|
echo "Configuration done. Now type \"make\"." |