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 |
|
|
AC_INIT([SheepShaver], 2.2, [Christian.Bauer@uni-mainz.de], SheepShaver) |
5 |
|
|
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.1 |
dnl Options. |
18 |
|
|
AC_ARG_ENABLE(jit, [ --enable-jit enable JIT compiler [default=yes]], [WANT_JIT=$enableval], [WANT_JIT=yes]) |
19 |
|
|
AC_ARG_ENABLE(ppc-emulator, [ --enable-ppc-emulator use the selected PowerPC emulator [default=auto]], [WANT_EMULATED_PPC=$enableval], [WANT_EMULATED_PPC=auto]) |
20 |
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]) |
21 |
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]) |
22 |
|
|
AC_ARG_ENABLE(xf86-vidmode, [ --enable-xf86-vidmode use the XFree86 VidMode extension [default=no]], [WANT_XF86_VIDMODE=$enableval], [WANT_XF86_VIDMODE=no]) |
23 |
|
|
AC_ARG_ENABLE(vosf, [ --enable-vosf enable video on SEGV signals [default=yes]], [WANT_VOSF=$enableval], [WANT_VOSF=yes]) |
24 |
|
|
AC_ARG_WITH(esd, [ --with-esd support ESD for sound under Linux/FreeBSD [default=yes]], [WANT_ESD=$withval], [WANT_ESD=yes]) |
25 |
gbeauche |
1.20 |
AC_ARG_WITH(gtk, [ --with-gtk use GTK user interface [default=yes]], |
26 |
|
|
[case "$withval" in |
27 |
|
|
gtk1) WANT_GTK="gtk";; |
28 |
|
|
gtk|gtk2) WANT_GTK="$withval";; |
29 |
|
|
yes) WANT_GTK="gtk2 gtk";; |
30 |
|
|
*) WANT_GTK="no";; |
31 |
|
|
esac], |
32 |
|
|
[WANT_GTK="gtk2 gtk"]) |
33 |
gbeauche |
1.1 |
AC_ARG_WITH(mon, [ --with-mon use mon as debugger [default=yes]], [WANT_MON=$withval], [WANT_MON=yes]) |
34 |
|
|
AC_ARG_WITH(dgcc, [ --with-dgcc=COMPILER use C++ COMPILER to compile synthetic opcodes], [DYNGEN_CC=$withval]) |
35 |
|
|
|
36 |
gbeauche |
1.8 |
dnl Addressing mode |
37 |
|
|
AC_ARG_ENABLE(addressing, |
38 |
|
|
[ --enable-addressing=AM set the addressing mode to use [default=real]], |
39 |
|
|
[case "$enableval" in |
40 |
|
|
real) WANT_ADDRESSING_MODE="real";; |
41 |
|
|
direct) WANT_ADDRESSING_MODE="direct";; |
42 |
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'`;; |
43 |
gbeauche |
1.8 |
esac], |
44 |
|
|
[WANT_ADDRESSING_MODE="real"] |
45 |
|
|
) |
46 |
|
|
|
47 |
gbeauche |
1.1 |
dnl SDL options. |
48 |
|
|
AC_ARG_ENABLE(sdl-static, [ --enable-sdl-static use SDL static libraries for linking [default=no]], [WANT_SDL_STATIC=$enableval], [WANT_SDL_STATIC=no]) |
49 |
|
|
AC_ARG_ENABLE(sdl-video, [ --enable-sdl-video use SDL for video graphics [default=no]], [WANT_SDL_VIDEO=$enableval], [WANT_SDL_VIDEO=no]) |
50 |
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]) |
51 |
gbeauche |
1.1 |
|
52 |
|
|
dnl Checks for programs. |
53 |
|
|
AC_PROG_CC |
54 |
|
|
AC_PROG_CPP |
55 |
|
|
AC_PROG_CXX |
56 |
|
|
AC_PROG_MAKE_SET |
57 |
|
|
AC_PROG_INSTALL |
58 |
gbeauche |
1.3 |
AC_PROG_EGREP |
59 |
gbeauche |
1.16 |
AC_PATH_PROGS(FILE, [file false]) |
60 |
|
|
AC_PATH_PROG(PERL, [perl]) |
61 |
gbeauche |
1.1 |
|
62 |
|
|
dnl Check for PowerPC target CPU. |
63 |
|
|
HAVE_PPC=no |
64 |
|
|
AC_MSG_CHECKING(for PowerPC target CPU) |
65 |
|
|
AC_EGREP_CPP(yes, |
66 |
|
|
[ |
67 |
|
|
#ifdef __powerpc__ |
68 |
|
|
yes |
69 |
|
|
#endif |
70 |
|
|
#ifdef __ppc__ |
71 |
|
|
yes |
72 |
|
|
#endif |
73 |
|
|
], [AC_MSG_RESULT(yes); HAVE_PPC=yes], AC_MSG_RESULT(no)) |
74 |
|
|
|
75 |
|
|
dnl We use native CPU if possible. |
76 |
|
|
EMULATED_PPC=yes |
77 |
|
|
case $WANT_EMULATED_PPC in |
78 |
|
|
auto) [[ "x$HAVE_PPC" = "xyes" ]] && EMULATED_PPC=no;; |
79 |
|
|
no) EMULATED_PPC=no;; |
80 |
|
|
esac |
81 |
|
|
if [[ "x$EMULATED_PPC" = "xyes" ]]; then |
82 |
|
|
AC_DEFINE(EMULATED_PPC, 1, [Define if using a PowerPC CPU emulator.]) |
83 |
|
|
fi |
84 |
|
|
|
85 |
|
|
dnl We use mon if possible. |
86 |
|
|
MONSRCS= |
87 |
|
|
case "x$WANT_MON" in |
88 |
|
|
x/* | x.*) |
89 |
|
|
mon_srcdir=$WANT_MON |
90 |
|
|
WANT_MON=yes |
91 |
|
|
;; |
92 |
|
|
xyes) |
93 |
|
|
mon_srcdir=../../../mon/src |
94 |
|
|
;; |
95 |
|
|
esac |
96 |
|
|
if [[ "x$WANT_MON" = "xyes" ]]; then |
97 |
|
|
AC_MSG_CHECKING(for mon) |
98 |
|
|
if grep mon_init $mon_srcdir/mon.h >/dev/null 2>/dev/null; then |
99 |
|
|
AC_MSG_RESULT(yes) |
100 |
|
|
AC_DEFINE(ENABLE_MON, 1, [Define if using "mon".]) |
101 |
|
|
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" |
102 |
|
|
CXXFLAGS="$CXXFLAGS -I$mon_srcdir -I$mon_srcdir/disass" |
103 |
|
|
AC_CHECK_LIB(ncurses, tgetent, , |
104 |
|
|
AC_CHECK_LIB(termcap, tgetent, , |
105 |
|
|
AC_CHECK_LIB(termlib, tgetent, , |
106 |
|
|
AC_CHECK_LIB(terminfo, tgetent, , |
107 |
|
|
AC_CHECK_LIB(Hcurses, tgetent, , |
108 |
|
|
AC_CHECK_LIB(curses, tgetent)))))) |
109 |
|
|
AC_CHECK_LIB(readline, readline) |
110 |
|
|
AC_CHECK_HEADERS(readline.h history.h readline/readline.h readline/history.h) |
111 |
|
|
else |
112 |
|
|
AC_MSG_RESULT(no) |
113 |
|
|
AC_MSG_WARN([Could not find mon, ignoring --with-mon.]) |
114 |
|
|
WANT_MON=no |
115 |
|
|
fi |
116 |
|
|
fi |
117 |
gbeauche |
1.11 |
AC_SUBST(MONSRCS) |
118 |
gbeauche |
1.1 |
|
119 |
|
|
dnl Checks for libraries. |
120 |
|
|
AC_CHECK_LIB(posix4, sem_init) |
121 |
|
|
|
122 |
|
|
dnl Do we need SDL? |
123 |
|
|
WANT_SDL=no |
124 |
|
|
if [[ "x$WANT_SDL_VIDEO" = "xyes" ]]; then |
125 |
|
|
WANT_SDL=yes |
126 |
gbeauche |
1.21 |
WANT_FBDEV_DGA=no |
127 |
gbeauche |
1.1 |
WANT_XF86_DGA=no |
128 |
|
|
WANT_XF86_VIDMODE=no |
129 |
|
|
WANT_FBDEV_DGA=no |
130 |
gbeauche |
1.7 |
SDL_SUPPORT="$SDL_SUPPORT video" |
131 |
|
|
fi |
132 |
|
|
if [[ "x$WANT_SDL_AUDIO" = "xyes" ]]; then |
133 |
|
|
WANT_SDL=yes |
134 |
|
|
SDL_SUPPORT="$SDL_SUPPORT audio" |
135 |
gbeauche |
1.1 |
fi |
136 |
|
|
if [[ "x$WANT_SDL" = "xyes" ]]; then |
137 |
|
|
AC_PATH_PROG(sdl_config, "sdl-config") |
138 |
|
|
if [[ -n "$sdl_config" ]]; then |
139 |
gbeauche |
1.9 |
case $target_os in |
140 |
|
|
# Special treatment for Cygwin so that we can still use the POSIX layer |
141 |
|
|
*cygwin*) |
142 |
|
|
sdl_cflags="-I`$sdl_config --prefix`/include/SDL" |
143 |
|
|
sdl_libs="-L`$sdl_config --exec-prefix`/lib -lSDL" |
144 |
|
|
;; |
145 |
|
|
*) |
146 |
|
|
sdl_cflags=`$sdl_config --cflags` |
147 |
|
|
if [[ "x$WANT_SDL_STATIC" = "xyes" ]]; then |
148 |
|
|
sdl_libs=`$sdl_config --static-libs` |
149 |
|
|
else |
150 |
|
|
sdl_libs=`$sdl_config --libs` |
151 |
|
|
fi |
152 |
|
|
;; |
153 |
|
|
esac |
154 |
gbeauche |
1.1 |
CFLAGS="$CFLAGS $sdl_cflags" |
155 |
|
|
CXXFLAGS="$CXXFLAGS $sdl_cflags" |
156 |
|
|
LIBS="$LIBS $sdl_libs" |
157 |
|
|
else |
158 |
|
|
WANT_SDL=no |
159 |
gbeauche |
1.15 |
WANT_SDL_VIDEO=no |
160 |
|
|
WANT_SDL_AUDIO=no |
161 |
gbeauche |
1.1 |
fi |
162 |
gbeauche |
1.7 |
SDL_SUPPORT=`echo "$SDL_SUPPORT" | sed -e "s/^ //"` |
163 |
|
|
else |
164 |
|
|
SDL_SUPPORT="none" |
165 |
gbeauche |
1.1 |
fi |
166 |
|
|
|
167 |
|
|
dnl We need X11, if not using SDL. |
168 |
gbeauche |
1.15 |
if [[ "x$WANT_SDL_VIDEO" != "xyes" ]]; then |
169 |
gbeauche |
1.1 |
AC_PATH_XTRA |
170 |
|
|
if [[ "x$no_x" = "xyes" ]]; then |
171 |
|
|
AC_MSG_ERROR([You need X11 to run SheepShaver.]) |
172 |
|
|
fi |
173 |
|
|
CFLAGS="$CFLAGS $X_CFLAGS" |
174 |
|
|
CXXFLAGS="$CXXFLAGS $X_CFLAGS" |
175 |
|
|
LIBS="$LIBS $X_PRE_LIBS $X_LIBS -lX11 -lXext $X_EXTRA_LIBS" |
176 |
|
|
fi |
177 |
|
|
|
178 |
|
|
dnl We need pthreads on non-PowerPC systems. Try libpthread first, then libc_r (FreeBSD), then PTL. |
179 |
|
|
HAVE_PTHREADS=yes |
180 |
|
|
case $EMULATED_PPC:$target_os in |
181 |
gbeauche |
1.17 |
no:linux*|no:netbsd*) |
182 |
gbeauche |
1.1 |
dnl We do have our own pthread_cancel() implementation |
183 |
|
|
AC_DEFINE(HAVE_PTHREAD_CANCEL, 1, [Define if you have the pthread_cancel function.]) |
184 |
|
|
;; |
185 |
|
|
*:*) |
186 |
|
|
AC_CHECK_LIB(pthread, pthread_create, , [ |
187 |
|
|
AC_CHECK_LIB(c_r, pthread_create, , [ |
188 |
|
|
AC_CHECK_LIB(PTL, pthread_create, , [ |
189 |
|
|
AC_MSG_ERROR([You need pthreads to run Basilisk II.]) |
190 |
|
|
]) |
191 |
|
|
]) |
192 |
|
|
]) |
193 |
|
|
AC_CHECK_FUNCS(pthread_cancel) |
194 |
|
|
AC_CHECK_FUNCS(pthread_mutexattr_setprotocol) |
195 |
|
|
AC_CHECK_FUNCS(pthread_mutexattr_settype) |
196 |
|
|
AC_CHECK_FUNCS(pthread_mutexattr_setpshared) |
197 |
|
|
if [[ "x$HAVE_PTHREADS" = "xyes" ]]; then |
198 |
|
|
AC_DEFINE(HAVE_PTHREADS, 1, [Define if pthreads are available.]) |
199 |
|
|
fi |
200 |
|
|
dnl If POSIX.4 semaphores are not available, we emulate them with pthread mutexes. |
201 |
|
|
SEMSRC= |
202 |
|
|
AC_CHECK_FUNCS(sem_init, , [ |
203 |
|
|
if test "x$HAVE_PTHREADS" = "xyes"; then |
204 |
|
|
SEMSRC=posix_sem.cpp |
205 |
|
|
fi |
206 |
|
|
]) |
207 |
|
|
;; |
208 |
|
|
esac |
209 |
|
|
|
210 |
gbeauche |
1.21 |
dnl We use FBDev DGA if possible. |
211 |
|
|
if [[ "x$WANT_FBDEV_DGA" = "xyes" ]]; then |
212 |
|
|
AC_CHECK_HEADER(linux/fb.h, [ |
213 |
|
|
AC_DEFINE(ENABLE_FBDEV_DGA, 1, [Define if using Linux fbdev extension.]) |
214 |
|
|
], [ |
215 |
|
|
AC_MSG_WARN([Could not find Linux FBDev extension, ignoring --enable-fbdev-dga.]) |
216 |
|
|
WANT_FBDEV_DGA=no |
217 |
|
|
]) |
218 |
|
|
fi |
219 |
|
|
|
220 |
gbeauche |
1.1 |
dnl We use XFree86 DGA if possible. |
221 |
|
|
if [[ "x$WANT_XF86_DGA" = "xyes" ]]; then |
222 |
|
|
AC_CHECK_LIB(Xxf86dga, XF86DGAQueryExtension, [ |
223 |
|
|
AC_DEFINE(ENABLE_XF86_DGA, 1, [Define if using XFree86 DGA extension.]) |
224 |
|
|
LIBS="$LIBS -lXxf86dga" |
225 |
|
|
], [ |
226 |
|
|
AC_MSG_WARN([Could not find XFree86 DGA extension, ignoring --enable-xf86-dga.]) |
227 |
|
|
WANT_XF86_DGA=no |
228 |
|
|
]) |
229 |
|
|
fi |
230 |
|
|
|
231 |
|
|
dnl We use XFree86 VidMode if possible. |
232 |
|
|
if [[ "x$WANT_XF86_VIDMODE" = "xyes" ]]; then |
233 |
|
|
AC_CHECK_LIB(Xxf86vm, XF86VidModeQueryExtension, [ |
234 |
|
|
AC_DEFINE(ENABLE_XF86_VIDMODE, 1, [Define if using XFree86 DGA extension.]) |
235 |
|
|
LIBS="$LIBS -lXxf86vm" |
236 |
|
|
], [ |
237 |
|
|
AC_MSG_WARN([Could not find XFree86 VidMode extension, ignoring --enable-xf86-vidmode.]) |
238 |
|
|
WANT_XF86_VIDMODE=no |
239 |
|
|
]) |
240 |
|
|
fi |
241 |
|
|
|
242 |
|
|
dnl We use GTK+ if possible. |
243 |
|
|
UISRCS=../dummy/prefs_editor_dummy.cpp |
244 |
gbeauche |
1.20 |
case "x$WANT_GTK" in |
245 |
|
|
xgtk2*) |
246 |
|
|
AM_PATH_GTK_2_0(1.3.15, [ |
247 |
|
|
AC_DEFINE(ENABLE_GTK, 1, [Define if using GTK.]) |
248 |
|
|
CFLAGS="$CFLAGS $GTK_CFLAGS" |
249 |
|
|
CXXFLAGS="$CXXFLAGS $GTK_CFLAGS" |
250 |
|
|
LIBS="$LIBS $GTK_LIBS" |
251 |
|
|
UISRCS=prefs_editor_gtk.cpp |
252 |
|
|
WANT_GTK=gtk2 |
253 |
|
|
], [ |
254 |
|
|
case "x${WANT_GTK}x" in |
255 |
|
|
*gtkx) |
256 |
|
|
AC_MSG_WARN([Could not find GTK+ 2.0, trying with GTK+ 1.2.]) |
257 |
|
|
WANT_GTK=gtk |
258 |
|
|
;; |
259 |
|
|
*) |
260 |
|
|
AC_MSG_WARN([Could not find GTK+, disabling user interface.]) |
261 |
|
|
WANT_GTK=no |
262 |
|
|
;; |
263 |
|
|
esac |
264 |
|
|
]) |
265 |
|
|
;; |
266 |
|
|
esac |
267 |
|
|
if [[ "x$WANT_GTK" = "xgtk" ]]; then |
268 |
gbeauche |
1.1 |
AM_PATH_GTK(1.2.0, [ |
269 |
|
|
AC_DEFINE(ENABLE_GTK, 1, [Define if using GTK.]) |
270 |
|
|
CFLAGS="$CFLAGS $GTK_CFLAGS" |
271 |
|
|
CXXFLAGS="$CXXFLAGS $GTK_CFLAGS" |
272 |
|
|
LIBS="$LIBS $GTK_LIBS" |
273 |
|
|
UISRCS=prefs_editor_gtk.cpp |
274 |
|
|
], [ |
275 |
|
|
AC_MSG_WARN([Could not find GTK+, disabling user interface.]) |
276 |
|
|
WANT_GTK=no |
277 |
|
|
]) |
278 |
|
|
fi |
279 |
|
|
|
280 |
|
|
dnl We use ESD if possible. |
281 |
|
|
if [[ "x$WANT_ESD" = "xyes" ]]; then |
282 |
|
|
AM_PATH_ESD(0.2.8, [ |
283 |
|
|
AC_DEFINE(ENABLE_ESD, 1, [Define is using ESD.]) |
284 |
|
|
CFLAGS="$CFLAGS $ESD_CFLAGS" |
285 |
|
|
CXXFLAGS="$CXXFLAGS $ESD_CFLAGS" |
286 |
|
|
LIBS="$LIBS $ESD_LIBS" |
287 |
|
|
], [ |
288 |
|
|
AC_MSG_WARN([Could not find ESD, disabling ESD support.]) |
289 |
|
|
WANT_ESD=no |
290 |
|
|
]) |
291 |
|
|
fi |
292 |
|
|
|
293 |
gbeauche |
1.2 |
dnl We use 64-bit file size support if possible. |
294 |
|
|
AC_SYS_LARGEFILE |
295 |
|
|
|
296 |
gbeauche |
1.1 |
dnl Checks for header files. |
297 |
|
|
AC_HEADER_STDC |
298 |
|
|
AC_HEADER_SYS_WAIT |
299 |
gbeauche |
1.9 |
AC_CHECK_HEADERS(malloc.h) |
300 |
gbeauche |
1.1 |
AC_CHECK_HEADERS(mach/vm_map.h mach/mach_init.h sys/mman.h) |
301 |
|
|
AC_CHECK_HEADERS(sys/time.h sys/times.h sys/socket.h) |
302 |
gbeauche |
1.4 |
AC_CHECK_HEADERS(unistd.h fcntl.h byteswap.h dirent.h) |
303 |
gbeauche |
1.1 |
AC_CHECK_HEADERS(linux/if.h, [], [], [ |
304 |
|
|
#if HAVE_SYS_SOCKET_H |
305 |
|
|
# include <sys/socket.h> |
306 |
|
|
#endif |
307 |
|
|
]) |
308 |
|
|
AC_CHECK_HEADERS(linux/if_tun.h net/if.h net/if_tun.h) |
309 |
gbeauche |
1.10 |
AC_CHECK_HEADERS(fenv.h) |
310 |
gbeauche |
1.1 |
|
311 |
|
|
dnl Checks for typedefs, structures, and compiler characteristics. |
312 |
|
|
AC_C_BIGENDIAN |
313 |
|
|
AC_C_CONST |
314 |
|
|
AC_C_INLINE |
315 |
|
|
AC_CHECK_SIZEOF(short, 2) |
316 |
|
|
AC_CHECK_SIZEOF(int, 4) |
317 |
|
|
AC_CHECK_SIZEOF(long, 4) |
318 |
|
|
AC_CHECK_SIZEOF(long long, 8) |
319 |
|
|
AC_CHECK_SIZEOF(float, 4) |
320 |
|
|
AC_CHECK_SIZEOF(double, 8) |
321 |
|
|
AC_CHECK_SIZEOF(void *, 4) |
322 |
|
|
AC_TYPE_OFF_T |
323 |
|
|
AC_CHECK_TYPE(loff_t, off_t) |
324 |
|
|
AC_TYPE_SIZE_T |
325 |
|
|
AC_TYPE_SIGNAL |
326 |
|
|
AC_HEADER_TIME |
327 |
|
|
AC_STRUCT_TM |
328 |
|
|
|
329 |
|
|
dnl Check whether struct sigaction has sa_restorer member. |
330 |
|
|
AC_CACHE_CHECK([whether struct sigaction has sa_restorer], |
331 |
|
|
ac_cv_signal_sa_restorer, [ |
332 |
|
|
AC_TRY_COMPILE([ |
333 |
|
|
#include <signal.h> |
334 |
|
|
], [struct sigaction sa; sa.sa_restorer = 0;], |
335 |
|
|
ac_cv_signal_sa_restorer=yes, ac_cv_signal_sa_restorer=no, |
336 |
|
|
dnl When cross-compiling, do not assume anything. |
337 |
|
|
ac_cv_signal_sa_restorer=no |
338 |
|
|
) |
339 |
|
|
]) |
340 |
|
|
if [[ "x$ac_cv_signal_sa_restorer" = "xyes" ]]; then |
341 |
|
|
AC_DEFINE(HAVE_SIGNAL_SA_RESTORER, 1, [Define if sa_restorer is available in struct sigaction.]) |
342 |
|
|
fi |
343 |
|
|
|
344 |
|
|
dnl Checks for library functions. |
345 |
|
|
AC_CHECK_FUNCS(strdup strlcpy cfmakeraw) |
346 |
|
|
AC_CHECK_FUNCS(nanosleep) |
347 |
|
|
AC_CHECK_FUNCS(sigaction signal) |
348 |
|
|
AC_CHECK_FUNCS(mmap mprotect munmap) |
349 |
|
|
AC_CHECK_FUNCS(vm_allocate vm_deallocate vm_protect) |
350 |
|
|
AC_CHECK_FUNCS(posix_memalign memalign valloc) |
351 |
gbeauche |
1.16 |
AC_CHECK_FUNCS(exp2f log2f exp2 log2 trunc) |
352 |
gbeauche |
1.1 |
|
353 |
|
|
dnl Darwin seems to define mach_task_self() instead of task_self(). |
354 |
|
|
AC_CHECK_FUNCS(mach_task_self task_self) |
355 |
|
|
|
356 |
|
|
dnl We need clock_gettime() for better performance but it may drag |
357 |
|
|
dnl libpthread in, which we don't want for native ppc mode |
358 |
|
|
case $EMULATED_PPC:$target_os in |
359 |
|
|
no:linux*) |
360 |
|
|
;; |
361 |
|
|
*:*) |
362 |
|
|
AC_SEARCH_LIBS(clock_gettime, [rt posix4]) |
363 |
gbeauche |
1.18 |
AC_CHECK_FUNCS(clock_gettime clock_nanosleep) |
364 |
gbeauche |
1.1 |
;; |
365 |
|
|
esac |
366 |
|
|
|
367 |
gbeauche |
1.9 |
dnl Check for headers and functions related to pty support (sshpty.c) |
368 |
|
|
dnl From openssh-3.2.2p1 configure.ac |
369 |
|
|
AC_CHECK_HEADERS(strings.h login.h sys/bsdtty.h sys/stat.h util.h pty.h) |
370 |
|
|
AC_CHECK_FUNCS(_getpty vhangup strlcpy) |
371 |
|
|
|
372 |
|
|
case "$host" in |
373 |
|
|
*-*-hpux10.26) |
374 |
|
|
disable_ptmx_check=yes |
375 |
|
|
;; |
376 |
|
|
*-*-linux*) |
377 |
|
|
no_dev_ptmx=1 |
378 |
|
|
;; |
379 |
|
|
mips-sony-bsd|mips-sony-newsos4) |
380 |
|
|
AC_DEFINE(HAVE_NEWS4, 1, [Define if you are on NEWS-OS (additions from openssh-3.2.2p1, for sshpty.c).]) |
381 |
|
|
;; |
382 |
|
|
*-*-sco3.2v4*) |
383 |
|
|
no_dev_ptmx=1 |
384 |
|
|
;; |
385 |
|
|
*-*-sco3.2v5*) |
386 |
|
|
no_dev_ptmx=1 |
387 |
|
|
;; |
388 |
|
|
*-*-cygwin*) |
389 |
|
|
no_dev_ptmx=1 |
390 |
|
|
;; |
391 |
|
|
esac |
392 |
|
|
|
393 |
|
|
if test -z "$no_dev_ptmx" ; then |
394 |
|
|
if test "x$disable_ptmx_check" != "xyes" ; then |
395 |
|
|
AC_CHECK_FILE([/dev/ptmx], |
396 |
|
|
[ |
397 |
|
|
AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX, 1, [Define if you have /dev/ptmx.]) |
398 |
|
|
have_dev_ptmx=1 |
399 |
|
|
] |
400 |
|
|
) |
401 |
|
|
fi |
402 |
|
|
fi |
403 |
|
|
AC_CHECK_FILE([/dev/ptc], |
404 |
|
|
[ |
405 |
|
|
AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC, 1, [Define if you have /dev/ptc.]) |
406 |
|
|
have_dev_ptc=1 |
407 |
|
|
] |
408 |
|
|
) |
409 |
|
|
dnl (end of code from openssh-3.2.2p1 configure.ac) |
410 |
|
|
|
411 |
gbeauche |
1.1 |
dnl AC_CHECK_FRAMEWORK($1=NAME, $2=INCLUDES) |
412 |
|
|
AC_DEFUN(AC_CHECK_FRAMEWORK, [ |
413 |
|
|
AS_VAR_PUSHDEF([ac_Framework], [ac_cv_framework_$1])dnl |
414 |
|
|
AC_CACHE_CHECK([whether compiler supports framework $1], |
415 |
|
|
ac_Framework, [ |
416 |
|
|
saved_LIBS="$LIBS" |
417 |
|
|
LIBS="$LIBS -framework $1" |
418 |
|
|
AC_TRY_LINK( |
419 |
|
|
[$2], [int main(void) { return 0; }], |
420 |
|
|
[AS_VAR_SET(ac_Framework, yes)], [AS_VAR_SET(ac_Framework, no); LIBS="$saved_LIBS"] |
421 |
|
|
) |
422 |
|
|
]) |
423 |
|
|
AS_IF([test AS_VAR_GET(ac_Framework) = yes], |
424 |
|
|
[AC_DEFINE(AS_TR_CPP(HAVE_FRAMEWORK_$1), 1, [Define if framework $1 is available.])] |
425 |
|
|
) |
426 |
|
|
AS_VAR_POPDEF([ac_Framework])dnl |
427 |
|
|
]) |
428 |
|
|
|
429 |
|
|
dnl Check for some MacOS X frameworks |
430 |
|
|
AC_CHECK_FRAMEWORK(Carbon, [#include <Carbon/Carbon.h>]) |
431 |
|
|
AC_CHECK_FRAMEWORK(IOKit, [#include <IOKit/IOKitLib.h>]) |
432 |
|
|
|
433 |
|
|
dnl Select system-dependant sources. |
434 |
|
|
SERIALSRC=serial_unix.cpp |
435 |
|
|
ETHERSRC=../dummy/ether_dummy.cpp |
436 |
|
|
SCSISRC=../dummy/scsi_dummy.cpp |
437 |
|
|
AUDIOSRC=../dummy/audio_dummy.cpp |
438 |
gbeauche |
1.6 |
EXTFSSRC=extfs_unix.cpp |
439 |
gbeauche |
1.1 |
EXTRASYSSRCS= |
440 |
|
|
case "$target_os" in |
441 |
|
|
linux*) |
442 |
|
|
ETHERSRC=Linux/ether_linux.cpp |
443 |
|
|
AUDIOSRC=audio_oss_esd.cpp |
444 |
|
|
SCSISRC=Linux/scsi_linux.cpp |
445 |
|
|
if [[ "x$EMULATED_PPC" = "xno" ]]; then |
446 |
gbeauche |
1.17 |
EXTRASYSSRCS="Linux/paranoia.cpp Linux/sheepthreads.c ppc_asm.S" |
447 |
|
|
fi |
448 |
|
|
;; |
449 |
|
|
netbsd*) |
450 |
|
|
if [[ "x$EMULATED_PPC" = "xno" ]]; then |
451 |
|
|
EXTRASYSSRCS="NetBSD/paranoia.cpp NetBSD/sheepthreads.c ppc_asm.S" |
452 |
gbeauche |
1.1 |
fi |
453 |
|
|
;; |
454 |
|
|
darwin*) |
455 |
|
|
if [[ "x$EMULATED_PPC" = "xno" ]]; then |
456 |
gbeauche |
1.17 |
EXTRASYSSRCS="Darwin/paranoia.cpp ppc_asm.S" |
457 |
gbeauche |
1.1 |
fi |
458 |
|
|
if [[ "x$ac_cv_framework_IOKit" = "xyes" ]]; then |
459 |
|
|
EXTRASYSSRCS="$EXTRASYSSRCS ../MacOSX/sys_darwin.cpp" |
460 |
|
|
fi |
461 |
gbeauche |
1.6 |
if [[ "x$ac_cv_framework_Carbon" = "xyes" ]]; then |
462 |
|
|
EXTFSSRC=../MacOSX/extfs_macosx.mm |
463 |
|
|
fi |
464 |
gbeauche |
1.1 |
;; |
465 |
gbeauche |
1.9 |
cygwin*) |
466 |
|
|
SERIALSRC="../dummy/serial_dummy.cpp" |
467 |
|
|
;; |
468 |
gbeauche |
1.1 |
esac |
469 |
|
|
|
470 |
|
|
dnl SDL overrides |
471 |
|
|
if [[ "x$WANT_SDL" = "xyes" ]]; then |
472 |
|
|
AC_DEFINE(USE_SDL, 1, [Define to enble SDL support.]) |
473 |
|
|
fi |
474 |
|
|
if [[ "x$WANT_SDL_VIDEO" = "xyes" ]]; then |
475 |
gbeauche |
1.7 |
AC_DEFINE(USE_SDL_VIDEO, 1, [Define to enable SDL video graphics support.]) |
476 |
gbeauche |
1.1 |
VIDEOSRCS="../SDL/video_sdl.cpp" |
477 |
|
|
KEYCODES="../SDL/keycodes" |
478 |
|
|
if [[ "x$ac_cv_framework_Carbon" = "xyes" ]]; then |
479 |
|
|
EXTRASYSSRCS="$EXTRASYSSRCS ../MacOSX/clip_macosx.cpp" |
480 |
|
|
else |
481 |
gbeauche |
1.9 |
case "$target_os" in |
482 |
|
|
cygwin*) |
483 |
|
|
EXTRASYSSRCS="$EXTRASYSSRCS ../Windows/clip_windows.cpp" |
484 |
|
|
;; |
485 |
|
|
*) |
486 |
|
|
EXTRASYSSRCS="$EXTRASYSSRCS ../dummy/clip_dummy.cpp" |
487 |
|
|
;; |
488 |
|
|
esac |
489 |
gbeauche |
1.1 |
fi |
490 |
|
|
else |
491 |
|
|
VIDEOSRCS="video_x.cpp" |
492 |
|
|
KEYCODES="keycodes" |
493 |
|
|
EXTRASYSSRCS="$EXTRASYSSRCS clip_unix.cpp" |
494 |
|
|
fi |
495 |
gbeauche |
1.7 |
if [[ "x$WANT_SDL_AUDIO" = "xyes" ]]; then |
496 |
|
|
AC_DEFINE(USE_SDL_AUDIO, 1, [Define to enable SDL audio support]) |
497 |
|
|
AUDIOSRC="../SDL/audio_sdl.cpp" |
498 |
|
|
fi |
499 |
gbeauche |
1.1 |
|
500 |
gbeauche |
1.11 |
SYSSRCS="$VIDEOSRCS $EXTFSSRC $SERIALSRC $ETHERSRC $SCSISRC $AUDIOSRC $SEMSRC $UISRCS $EXTRASYSSRCS" |
501 |
gbeauche |
1.1 |
|
502 |
|
|
dnl Define a macro that translates a yesno-variable into a C macro definition |
503 |
|
|
dnl to be put into the config.h file |
504 |
|
|
dnl $1 -- the macro to define |
505 |
|
|
dnl $2 -- the value to translate |
506 |
|
|
dnl $3 -- template name |
507 |
|
|
AC_DEFUN(AC_TRANSLATE_DEFINE, [ |
508 |
|
|
if [[ "x$2" = "xyes" -o "x$2" = "xguessing yes" ]]; then |
509 |
|
|
AC_DEFINE($1, 1, $3) |
510 |
|
|
fi |
511 |
|
|
]) |
512 |
|
|
|
513 |
|
|
dnl Check that the host supports TUN/TAP devices |
514 |
|
|
AC_CACHE_CHECK([whether TUN/TAP is supported], |
515 |
|
|
ac_cv_tun_tap_support, [ |
516 |
|
|
AC_TRY_COMPILE([ |
517 |
|
|
#if defined(HAVE_LINUX_IF_H) && defined(HAVE_LINUX_IF_TUN_H) |
518 |
|
|
#include <linux/if.h> |
519 |
|
|
#include <linux/if_tun.h> |
520 |
|
|
#endif |
521 |
|
|
#if defined(HAVE_NET_IF_H) && defined(HAVE_NET_IF_TUN_H) |
522 |
|
|
#include <net/if.h> |
523 |
|
|
#include <net/if_tun.h> |
524 |
|
|
#endif |
525 |
|
|
], [ |
526 |
|
|
struct ifreq ifr; |
527 |
|
|
memset(&ifr, 0, sizeof(ifr)); |
528 |
|
|
ifr.ifr_flags = IFF_TAP | IFF_NO_PI; |
529 |
|
|
], |
530 |
|
|
ac_cv_tun_tap_support=yes, ac_cv_tun_tap_support=no |
531 |
|
|
) |
532 |
|
|
]) |
533 |
|
|
AC_TRANSLATE_DEFINE(ENABLE_TUNTAP, "$ac_cv_tun_tap_support", |
534 |
|
|
[Define if your system supports TUN/TAP devices.]) |
535 |
|
|
|
536 |
|
|
dnl Various checks if the system supports vm_allocate() and the like functions. |
537 |
|
|
have_mach_vm=no |
538 |
|
|
if [[ "x$ac_cv_func_vm_allocate" = "xyes" -a "x$ac_cv_func_vm_deallocate" = "xyes" -a \ |
539 |
|
|
"x$ac_cv_func_vm_protect" = "xyes" ]]; then |
540 |
|
|
have_mach_vm=yes |
541 |
|
|
fi |
542 |
|
|
AC_TRANSLATE_DEFINE(HAVE_MACH_VM, "$have_mach_vm", |
543 |
|
|
[Define if your system has a working vm_allocate()-based memory allocator.]) |
544 |
|
|
|
545 |
|
|
dnl Check that vm_allocate(), vm_protect() work |
546 |
|
|
if [[ "x$have_mach_vm" = "xyes" ]]; then |
547 |
|
|
|
548 |
|
|
AC_CACHE_CHECK([whether vm_protect works], |
549 |
|
|
ac_cv_vm_protect_works, [ |
550 |
|
|
AC_LANG_SAVE |
551 |
|
|
AC_LANG_CPLUSPLUS |
552 |
|
|
ac_cv_vm_protect_works=yes |
553 |
|
|
dnl First the tests that should segfault |
554 |
|
|
for test_def in NONE_READ NONE_WRITE READ_WRITE; do |
555 |
|
|
AC_TRY_RUN([ |
556 |
|
|
#define CONFIGURE_TEST_VM_MAP |
557 |
|
|
#define TEST_VM_PROT_$test_def |
558 |
|
|
#include "vm_alloc.cpp" |
559 |
|
|
], ac_cv_vm_protect_works=no, rm -f core, |
560 |
|
|
dnl When cross-compiling, do not assume anything |
561 |
|
|
ac_cv_vm_protect_works="guessing no" |
562 |
|
|
) |
563 |
|
|
done |
564 |
|
|
AC_TRY_RUN([ |
565 |
|
|
#define CONFIGURE_TEST_VM_MAP |
566 |
|
|
#define TEST_VM_PROT_RDWR_WRITE |
567 |
|
|
#include "vm_alloc.cpp" |
568 |
|
|
], , ac_cv_vm_protect_works=no, |
569 |
|
|
dnl When cross-compiling, do not assume anything |
570 |
|
|
ac_cv_vm_protect_works="guessing no" |
571 |
|
|
) |
572 |
|
|
AC_LANG_RESTORE |
573 |
|
|
] |
574 |
|
|
) |
575 |
|
|
|
576 |
|
|
dnl Remove support for vm_allocate() if vm_protect() does not work |
577 |
|
|
if [[ "x$have_mach_vm" = "xyes" ]]; then |
578 |
|
|
case $ac_cv_vm_protect_works in |
579 |
|
|
*yes) have_mach_vm=yes;; |
580 |
|
|
*no) have_mach_vm=no;; |
581 |
|
|
esac |
582 |
|
|
fi |
583 |
|
|
AC_TRANSLATE_DEFINE(HAVE_MACH_VM, "$have_mach_vm", |
584 |
|
|
[Define if your system has a working vm_allocate()-based memory allocator.]) |
585 |
|
|
|
586 |
|
|
fi dnl HAVE_MACH_VM |
587 |
|
|
|
588 |
|
|
dnl Various checks if the system supports mmap() and the like functions. |
589 |
|
|
dnl ... and Mach memory allocators are not supported |
590 |
|
|
have_mmap_vm=no |
591 |
|
|
if [[ "x$ac_cv_func_mmap" = "xyes" -a "x$ac_cv_func_munmap" = "xyes" -a \ |
592 |
|
|
"x$ac_cv_func_mprotect" = "xyes" ]]; then |
593 |
|
|
if [[ "x$have_mach_vm" = "xno" ]]; then |
594 |
|
|
have_mmap_vm=yes |
595 |
|
|
fi |
596 |
|
|
fi |
597 |
|
|
AC_TRANSLATE_DEFINE(HAVE_MMAP_VM, "$have_mmap_vm", |
598 |
|
|
[Define if your system has a working mmap()-based memory allocator.]) |
599 |
|
|
|
600 |
|
|
dnl Check that mmap() and associated functions work. |
601 |
|
|
if [[ "x$have_mmap_vm" = "xyes" ]]; then |
602 |
|
|
|
603 |
|
|
dnl Check if we have a working anonymous mmap() |
604 |
|
|
AC_CACHE_CHECK([whether mmap supports MAP_ANON], |
605 |
|
|
ac_cv_mmap_anon, [ |
606 |
|
|
AC_LANG_SAVE |
607 |
|
|
AC_LANG_CPLUSPLUS |
608 |
|
|
AC_TRY_RUN([ |
609 |
|
|
#define HAVE_MMAP_ANON |
610 |
|
|
#define CONFIGURE_TEST_VM_MAP |
611 |
|
|
#define TEST_VM_MMAP_ANON |
612 |
|
|
#include "vm_alloc.cpp" |
613 |
|
|
], ac_cv_mmap_anon=yes, ac_cv_mmap_anon=no, |
614 |
|
|
dnl When cross-compiling, do not assume anything. |
615 |
|
|
ac_cv_mmap_anon="guessing no" |
616 |
|
|
) |
617 |
|
|
AC_LANG_RESTORE |
618 |
|
|
] |
619 |
|
|
) |
620 |
|
|
AC_TRANSLATE_DEFINE(HAVE_MMAP_ANON, "$ac_cv_mmap_anon", |
621 |
|
|
[Define if <sys/mman.h> defines MAP_ANON and mmap()'ing with MAP_ANON works.]) |
622 |
|
|
|
623 |
|
|
AC_CACHE_CHECK([whether mmap supports MAP_ANONYMOUS], |
624 |
|
|
ac_cv_mmap_anonymous, [ |
625 |
|
|
AC_LANG_SAVE |
626 |
|
|
AC_LANG_CPLUSPLUS |
627 |
|
|
AC_TRY_RUN([ |
628 |
|
|
#define HAVE_MMAP_ANONYMOUS |
629 |
|
|
#define CONFIGURE_TEST_VM_MAP |
630 |
|
|
#define TEST_VM_MMAP_ANON |
631 |
|
|
#include "vm_alloc.cpp" |
632 |
|
|
], ac_cv_mmap_anonymous=yes, ac_cv_mmap_anonymous=no, |
633 |
|
|
dnl When cross-compiling, do not assume anything. |
634 |
|
|
ac_cv_mmap_anonymous="guessing no" |
635 |
|
|
) |
636 |
|
|
AC_LANG_RESTORE |
637 |
|
|
] |
638 |
|
|
) |
639 |
|
|
AC_TRANSLATE_DEFINE(HAVE_MMAP_ANONYMOUS, "$ac_cv_mmap_anonymous", |
640 |
|
|
[Define if <sys/mman.h> defines MAP_ANONYMOUS and mmap()'ing with MAP_ANONYMOUS works.]) |
641 |
|
|
|
642 |
|
|
AC_CACHE_CHECK([whether mprotect works], |
643 |
|
|
ac_cv_mprotect_works, [ |
644 |
|
|
AC_LANG_SAVE |
645 |
|
|
AC_LANG_CPLUSPLUS |
646 |
|
|
ac_cv_mprotect_works=yes |
647 |
|
|
dnl First the tests that should segfault |
648 |
|
|
for test_def in NONE_READ NONE_WRITE READ_WRITE; do |
649 |
|
|
AC_TRY_RUN([ |
650 |
|
|
#define CONFIGURE_TEST_VM_MAP |
651 |
|
|
#define TEST_VM_PROT_$test_def |
652 |
|
|
#include "vm_alloc.cpp" |
653 |
|
|
], ac_cv_mprotect_works=no, rm -f core, |
654 |
|
|
dnl When cross-compiling, do not assume anything |
655 |
|
|
ac_cv_mprotect_works="guessing no" |
656 |
|
|
) |
657 |
|
|
done |
658 |
|
|
AC_TRY_RUN([ |
659 |
|
|
#define CONFIGURE_TEST_VM_MAP |
660 |
|
|
#define TEST_VM_PROT_RDWR_WRITE |
661 |
|
|
#include "vm_alloc.cpp" |
662 |
|
|
], , ac_cv_mprotect_works=no, |
663 |
|
|
dnl When cross-compiling, do not assume anything |
664 |
|
|
ac_cv_mprotect_works="guessing no" |
665 |
|
|
) |
666 |
|
|
AC_LANG_RESTORE |
667 |
|
|
] |
668 |
|
|
) |
669 |
|
|
|
670 |
|
|
dnl Remove support for mmap() if mprotect() does not work |
671 |
|
|
if [[ "x$have_mmap_vm" = "xyes" ]]; then |
672 |
|
|
case $ac_cv_mprotect_works in |
673 |
|
|
*yes) have_mmap_vm=yes;; |
674 |
|
|
*no) have_mmap_vm=no;; |
675 |
|
|
esac |
676 |
|
|
fi |
677 |
|
|
AC_TRANSLATE_DEFINE(HAVE_MMAP_VM, $have_mmap_vm, |
678 |
|
|
[Define if your system has a working mmap()-based memory allocator.]) |
679 |
|
|
|
680 |
|
|
fi dnl HAVE_MMAP_VM |
681 |
|
|
|
682 |
|
|
dnl Check if we can modify the __PAGEZERO segment for use as Low Memory |
683 |
|
|
AC_CACHE_CHECK([whether __PAGEZERO can be Low Memory area 0x0000-0x3000], |
684 |
|
|
ac_cv_pagezero_hack, [ |
685 |
|
|
ac_cv_pagezero_hack=no |
686 |
|
|
if AC_TRY_COMMAND([Darwin/testlmem.sh 0x3000]); then |
687 |
|
|
ac_cv_pagezero_hack=yes |
688 |
|
|
dnl might as well skip the test for mmap-able low memory |
689 |
|
|
ac_cv_can_map_lm=no |
690 |
|
|
fi |
691 |
|
|
]) |
692 |
|
|
AC_TRANSLATE_DEFINE(PAGEZERO_HACK, "$ac_cv_pagezero_hack", |
693 |
|
|
[Define if the __PAGEZERO Mach-O Low Memory Globals hack works on this system.]) |
694 |
|
|
|
695 |
|
|
dnl Check if we can mmap 0x3000 bytes from 0x0000 |
696 |
|
|
AC_CACHE_CHECK([whether we can map Low Memory area 0x0000-0x3000], |
697 |
|
|
ac_cv_can_map_lm, [ |
698 |
|
|
AC_LANG_SAVE |
699 |
|
|
AC_LANG_CPLUSPLUS |
700 |
|
|
AC_TRY_RUN([ |
701 |
|
|
#include "vm_alloc.cpp" |
702 |
|
|
int main(void) { /* returns 0 if we could map the lowmem globals */ |
703 |
|
|
volatile char * lm = 0; |
704 |
|
|
if (vm_init() < 0) exit(1); |
705 |
|
|
if (vm_acquire_fixed(0, 0x2000) < 0) exit(1); |
706 |
|
|
lm[0] = 'z'; |
707 |
|
|
if (vm_release((char *)lm, 0x2000) < 0) exit(1); |
708 |
|
|
vm_exit(); exit(0); |
709 |
|
|
} |
710 |
|
|
], ac_cv_can_map_lm=yes, ac_cv_can_map_lm=no, |
711 |
|
|
dnl When cross-compiling, do not assume anything. |
712 |
|
|
ac_cv_can_map_lm="guessing no" |
713 |
|
|
) |
714 |
|
|
AC_LANG_RESTORE |
715 |
|
|
] |
716 |
|
|
) |
717 |
|
|
|
718 |
|
|
dnl Check signal handlers need to be reinstalled |
719 |
|
|
AC_CACHE_CHECK([whether signal handlers need to be reinstalled], |
720 |
|
|
ac_cv_signal_need_reinstall, [ |
721 |
|
|
AC_LANG_SAVE |
722 |
|
|
AC_LANG_CPLUSPLUS |
723 |
|
|
AC_TRY_RUN([ |
724 |
|
|
#include <stdlib.h> |
725 |
|
|
#ifdef HAVE_UNISTD_H |
726 |
|
|
#include <unistd.h> |
727 |
|
|
#endif |
728 |
|
|
#include <signal.h> |
729 |
|
|
static int handled_signal = 0; |
730 |
|
|
RETSIGTYPE sigusr1_handler(int) { handled_signal++; } |
731 |
|
|
int main(void) { /* returns 0 if signals need not to be reinstalled */ |
732 |
|
|
signal(SIGUSR1, sigusr1_handler); raise(SIGUSR1); raise(SIGUSR1); |
733 |
|
|
exit(handled_signal == 2); |
734 |
|
|
} |
735 |
|
|
], ac_cv_signal_need_reinstall=yes, ac_cv_signal_need_reinstall=no, |
736 |
|
|
dnl When cross-compiling, do not assume anything. |
737 |
|
|
ac_cv_signal_need_reinstall="guessing yes" |
738 |
|
|
) |
739 |
|
|
AC_LANG_RESTORE |
740 |
|
|
] |
741 |
|
|
) |
742 |
|
|
AC_TRANSLATE_DEFINE(SIGNAL_NEED_REINSTALL, "$ac_cv_signal_need_reinstall", |
743 |
|
|
[Define if your system requires signals to be reinstalled.]) |
744 |
|
|
|
745 |
|
|
dnl Check if sigaction handlers need to be reinstalled |
746 |
|
|
AC_CACHE_CHECK([whether sigaction handlers need to be reinstalled], |
747 |
|
|
ac_cv_sigaction_need_reinstall, [ |
748 |
|
|
AC_LANG_SAVE |
749 |
|
|
AC_LANG_CPLUSPLUS |
750 |
|
|
AC_TRY_RUN([ |
751 |
|
|
#include <stdlib.h> |
752 |
|
|
#ifdef HAVE_UNISTD_H |
753 |
|
|
#include <unistd.h> |
754 |
|
|
#endif |
755 |
|
|
#include <signal.h> |
756 |
|
|
static int handled_signal = 0; |
757 |
|
|
RETSIGTYPE sigusr1_handler(int) { handled_signal++; } |
758 |
|
|
typedef RETSIGTYPE (*signal_handler)(int); |
759 |
|
|
static signal_handler mysignal(int sig, signal_handler handler) { |
760 |
|
|
struct sigaction old_sa; |
761 |
|
|
struct sigaction new_sa; |
762 |
|
|
new_sa.sa_handler = handler; |
763 |
|
|
return ((sigaction(sig,&new_sa,&old_sa) < 0) ? SIG_IGN : old_sa.sa_handler); |
764 |
|
|
} |
765 |
|
|
int main(void) { /* returns 0 if signals need not to be reinstalled */ |
766 |
|
|
mysignal(SIGUSR1, sigusr1_handler); raise(SIGUSR1); raise(SIGUSR1); |
767 |
|
|
exit(handled_signal == 2); |
768 |
|
|
} |
769 |
|
|
], ac_cv_sigaction_need_reinstall=yes, ac_cv_sigaction_need_reinstall=no, |
770 |
|
|
dnl When cross-compiling, do not assume anything. |
771 |
|
|
ac_cv_sigaction_need_reinstall="guessing yes" |
772 |
|
|
) |
773 |
|
|
AC_LANG_RESTORE |
774 |
|
|
] |
775 |
|
|
) |
776 |
|
|
AC_TRANSLATE_DEFINE(SIGACTION_NEED_REINSTALL, "$ac_cv_sigaction_need_reinstall", |
777 |
|
|
[Define if your system requires sigactions to be reinstalled.]) |
778 |
|
|
|
779 |
|
|
dnl Check if Mach exceptions supported. |
780 |
|
|
AC_CACHE_CHECK([whether your system supports Mach exceptions], |
781 |
|
|
ac_cv_have_mach_exceptions, [ |
782 |
|
|
AC_LANG_SAVE |
783 |
|
|
AC_LANG_CPLUSPLUS |
784 |
|
|
AC_TRY_RUN([ |
785 |
|
|
#define HAVE_MACH_EXCEPTIONS 1 |
786 |
|
|
#define CONFIGURE_TEST_SIGSEGV_RECOVERY |
787 |
|
|
#include "vm_alloc.cpp" |
788 |
|
|
#include "sigsegv.cpp" |
789 |
|
|
], |
790 |
|
|
ac_cv_have_mach_exceptions=yes, |
791 |
|
|
ac_cv_have_mach_exceptions=no, |
792 |
|
|
dnl When cross-compiling, do not assume anything. |
793 |
|
|
ac_cv_have_mach_exceptions=no |
794 |
|
|
) |
795 |
|
|
AC_LANG_RESTORE |
796 |
|
|
] |
797 |
|
|
) |
798 |
|
|
if [[ "$ac_cv_have_mach_exceptions" = "yes" ]]; then |
799 |
|
|
sigsegv_recovery=mach |
800 |
|
|
fi |
801 |
|
|
AC_TRANSLATE_DEFINE(HAVE_MACH_EXCEPTIONS, "$ac_cv_have_mach_exceptions", |
802 |
|
|
[Define if your system supports Mach exceptions.]) |
803 |
|
|
|
804 |
gbeauche |
1.9 |
dnl Check if Windows exceptions are supported. |
805 |
|
|
AC_CACHE_CHECK([whether your system supports Windows exceptions], |
806 |
|
|
ac_cv_have_win32_exceptions, [ |
807 |
|
|
AC_LANG_SAVE |
808 |
|
|
AC_LANG_CPLUSPLUS |
809 |
|
|
AC_TRY_RUN([ |
810 |
|
|
#define HAVE_WIN32_EXCEPTIONS 1 |
811 |
|
|
#define CONFIGURE_TEST_SIGSEGV_RECOVERY |
812 |
|
|
#include "vm_alloc.cpp" |
813 |
|
|
#include "sigsegv.cpp" |
814 |
|
|
], [ |
815 |
|
|
sigsegv_recovery=win32 |
816 |
|
|
ac_cv_have_win32_exceptions=yes |
817 |
|
|
], |
818 |
|
|
ac_cv_have_win32_exceptions=no, |
819 |
|
|
dnl When cross-compiling, do not assume anything. |
820 |
|
|
ac_cv_have_win32_exceptions=no |
821 |
|
|
) |
822 |
|
|
AC_LANG_RESTORE |
823 |
|
|
] |
824 |
|
|
) |
825 |
|
|
AC_TRANSLATE_DEFINE(HAVE_WIN32_EXCEPTIONS, "$ac_cv_have_win32_exceptions", |
826 |
|
|
[Define if your system supports Windows exceptions.]) |
827 |
|
|
|
828 |
gbeauche |
1.1 |
dnl Otherwise, check if extended signals are supported. |
829 |
|
|
if [[ -z "$sigsegv_recovery" ]]; then |
830 |
|
|
AC_CACHE_CHECK([whether your system supports extended signal handlers], |
831 |
|
|
ac_cv_have_extended_signals, [ |
832 |
|
|
AC_LANG_SAVE |
833 |
|
|
AC_LANG_CPLUSPLUS |
834 |
|
|
AC_TRY_RUN([ |
835 |
|
|
#define HAVE_SIGINFO_T 1 |
836 |
|
|
#define CONFIGURE_TEST_SIGSEGV_RECOVERY |
837 |
|
|
#include "vm_alloc.cpp" |
838 |
|
|
#include "sigsegv.cpp" |
839 |
|
|
], |
840 |
|
|
ac_cv_have_extended_signals=yes, |
841 |
|
|
ac_cv_have_extended_signals=no, |
842 |
|
|
dnl When cross-compiling, do not assume anything. |
843 |
|
|
ac_cv_have_extended_signals=no |
844 |
|
|
) |
845 |
|
|
AC_LANG_RESTORE |
846 |
|
|
] |
847 |
|
|
) |
848 |
|
|
if [[ "$ac_cv_have_extended_signals" = "yes" ]]; then |
849 |
|
|
sigsegv_recovery=siginfo |
850 |
|
|
fi |
851 |
|
|
AC_TRANSLATE_DEFINE(HAVE_SIGINFO_T, "$ac_cv_have_extended_signals", |
852 |
|
|
[Define if your system support extended signals.]) |
853 |
|
|
fi |
854 |
|
|
|
855 |
|
|
dnl Otherwise, check for subterfuges. |
856 |
|
|
if [[ -z "$sigsegv_recovery" ]]; then |
857 |
|
|
AC_CACHE_CHECK([whether we then have a subterfuge for your system], |
858 |
|
|
ac_cv_have_sigcontext_hack, [ |
859 |
|
|
AC_LANG_SAVE |
860 |
|
|
AC_LANG_CPLUSPLUS |
861 |
|
|
AC_TRY_RUN([ |
862 |
|
|
#define HAVE_SIGCONTEXT_SUBTERFUGE 1 |
863 |
|
|
#define CONFIGURE_TEST_SIGSEGV_RECOVERY |
864 |
|
|
#include "vm_alloc.cpp" |
865 |
|
|
#include "sigsegv.cpp" |
866 |
|
|
], |
867 |
|
|
ac_cv_have_sigcontext_hack=yes, |
868 |
|
|
ac_cv_have_sigcontext_hack=no, |
869 |
|
|
dnl When cross-compiling, do not assume anything. |
870 |
|
|
ac_cv_have_sigcontext_hack=no |
871 |
|
|
) |
872 |
|
|
AC_LANG_RESTORE |
873 |
|
|
]) |
874 |
|
|
if [[ "$ac_cv_have_sigcontext_hack" = "yes" ]]; then |
875 |
|
|
sigsegv_recovery=sigcontext |
876 |
|
|
fi |
877 |
|
|
AC_TRANSLATE_DEFINE(HAVE_SIGCONTEXT_SUBTERFUGE, "$ac_cv_have_sigcontext_hack", |
878 |
|
|
[Define if we know a hack to replace siginfo_t->si_addr member.]) |
879 |
|
|
fi |
880 |
|
|
|
881 |
|
|
dnl Check if we can ignore the fault (instruction skipping in SIGSEGV handler) |
882 |
|
|
AC_CACHE_CHECK([whether we can skip instruction in SIGSEGV handler], |
883 |
|
|
ac_cv_have_skip_instruction, [ |
884 |
|
|
AC_LANG_SAVE |
885 |
|
|
AC_LANG_CPLUSPLUS |
886 |
|
|
AC_TRY_RUN([ |
887 |
|
|
#define HAVE_SIGSEGV_SKIP_INSTRUCTION 1 |
888 |
|
|
#define CONFIGURE_TEST_SIGSEGV_RECOVERY |
889 |
|
|
#include "vm_alloc.cpp" |
890 |
|
|
#include "sigsegv.cpp" |
891 |
|
|
], ac_cv_have_skip_instruction=yes, ac_cv_have_skip_instruction=no, |
892 |
|
|
dnl When cross-compiling, do not assume anything. |
893 |
|
|
ac_cv_have_skip_instruction=no |
894 |
|
|
) |
895 |
|
|
AC_LANG_RESTORE |
896 |
|
|
] |
897 |
|
|
) |
898 |
|
|
AC_TRANSLATE_DEFINE(HAVE_SIGSEGV_SKIP_INSTRUCTION, "$ac_cv_have_skip_instruction", |
899 |
|
|
[Define if we can ignore the fault (instruction skipping in SIGSEGV handler).]) |
900 |
|
|
|
901 |
|
|
dnl Can we do Video on SEGV Signals ? |
902 |
|
|
CAN_VOSF=no |
903 |
|
|
if [[ -n "$sigsegv_recovery" ]]; then |
904 |
|
|
CAN_VOSF=yes |
905 |
|
|
fi |
906 |
|
|
|
907 |
|
|
dnl Enable VOSF screen updates with this feature is requested and feasible |
908 |
|
|
if [[ "x$WANT_VOSF" = "xyes" -a "x$CAN_VOSF" = "xyes" ]]; then |
909 |
|
|
AC_DEFINE(ENABLE_VOSF, 1, [Define if using video enabled on SEGV signals.]) |
910 |
|
|
else |
911 |
|
|
WANT_VOSF=no |
912 |
|
|
fi |
913 |
|
|
|
914 |
gbeauche |
1.8 |
dnl Check addressing mode to use |
915 |
|
|
AC_MSG_CHECKING([for addressing mode to use]) |
916 |
gbeauche |
1.9 |
case "$os_target" in |
917 |
|
|
cygwin*) |
918 |
|
|
WANT_ADDRESSING_MODE="direct,cygwin-hack" |
919 |
|
|
NATMEM_OFFSET= |
920 |
|
|
;; |
921 |
|
|
esac |
922 |
gbeauche |
1.8 |
if [[ "$EMULATED_PPC" != "yes" ]]; then |
923 |
|
|
if [[ "$WANT_ADDRESSING_MODE" != "real" ]]; then |
924 |
|
|
AC_MSG_WARN([Running in native PowerPC mode, force use of Real Addressing.]) |
925 |
|
|
WANT_ADDRESSING_MODE="real" |
926 |
|
|
fi |
927 |
|
|
fi |
928 |
|
|
if [[ "$WANT_ADDRESSING_MODE" = "direct" ]]; then |
929 |
|
|
if [[ -n "$NATMEM_OFFSET" ]]; then |
930 |
|
|
NATMEM_OFFSET_DEF="-DNATMEM_OFFSET=$NATMEM_OFFSET" |
931 |
|
|
fi |
932 |
|
|
AC_LANG_SAVE |
933 |
|
|
AC_LANG_CPLUSPLUS |
934 |
|
|
cat confdefs.h > conftest.$ac_ext |
935 |
|
|
cat >> conftest.$ac_ext << EOF |
936 |
|
|
#include <stdio.h> |
937 |
|
|
#include <string.h> |
938 |
|
|
#include "vm_alloc.cpp" |
939 |
|
|
|
940 |
|
|
int main(void) |
941 |
|
|
{ |
942 |
|
|
if (vm_init() < 0) |
943 |
|
|
return 1; |
944 |
|
|
|
945 |
|
|
static const struct { |
946 |
|
|
unsigned long base; |
947 |
|
|
unsigned int size; |
948 |
|
|
} ranges[[]] = { |
949 |
|
|
{ 0x00000000, 0x0003000 }, |
950 |
|
|
{ 0x10000000, 0x2000000 }, |
951 |
|
|
{ 0x40800000, 0x0400000 }, |
952 |
|
|
{ 0x68070000, 0x0010000 }, |
953 |
|
|
{ 0x69000000, 0x0080000 }, |
954 |
|
|
{ 0x68ffe000, 0x0002000 }, |
955 |
|
|
{ 0x5fffe000, 0x0002000 }, |
956 |
|
|
{ 0x60000000, 0x0040000 }, |
957 |
|
|
}; |
958 |
|
|
const int n_ranges = sizeof(ranges)/ sizeof(ranges[[0]]); |
959 |
|
|
|
960 |
|
|
#ifdef NATMEM_OFFSET |
961 |
|
|
unsigned long ofs = NATMEM_OFFSET; |
962 |
|
|
#else |
963 |
|
|
for (unsigned long ofs = 0x10000000; ofs <= 0x90000000; ofs += 0x10000000) |
964 |
|
|
#endif |
965 |
|
|
for (int i = 0; i < n_ranges; i++) { |
966 |
|
|
char *m = (char *)(ranges[[i]].base + ofs); |
967 |
|
|
if (vm_acquire_fixed(m, ranges[[i]].size) != 0) |
968 |
|
|
break; |
969 |
|
|
memset(m, 0, ranges[[i]].size); |
970 |
|
|
vm_release(m, ranges[[i]].size); |
971 |
|
|
if (i == n_ranges - 1) { |
972 |
gbeauche |
1.13 |
if (sizeof(void *) == 8 && ofs > 0xffffffff) |
973 |
|
|
printf("0x%lxul\n", ofs); |
974 |
|
|
else |
975 |
|
|
printf("0x%08x\n", ofs); |
976 |
gbeauche |
1.8 |
return 0; |
977 |
|
|
} |
978 |
|
|
} |
979 |
|
|
|
980 |
|
|
vm_exit(); |
981 |
|
|
return 1; |
982 |
|
|
} |
983 |
|
|
EOF |
984 |
|
|
doit='$CXX conftest.$ac_ext -o conftest.$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS $LIBS $NATMEM_OFFSET_DEF >& AS_MESSAGE_LOG_FD' |
985 |
|
|
if AC_TRY_EVAL(doit); then |
986 |
|
|
NATMEM_OFFSET=`./conftest.$ac_exeext` |
987 |
gbeauche |
1.9 |
else |
988 |
|
|
NATMEM_OFFSET= |
989 |
gbeauche |
1.8 |
fi |
990 |
|
|
rm -f conftest* |
991 |
|
|
AC_LANG_RESTORE |
992 |
gbeauche |
1.9 |
|
993 |
|
|
if [[ -z "$NATMEM_OFFSET" ]]; then |
994 |
|
|
AC_MSG_ERROR([could not determine a sensible NATMEM_OFFSET value]) |
995 |
|
|
else |
996 |
|
|
WANT_ADDRESSING_MODE="direct,$NATMEM_OFFSET" |
997 |
|
|
AC_DEFINE_UNQUOTED(NATMEM_OFFSET, $NATMEM_OFFSET, |
998 |
|
|
[Define constant offset for Mac address translation]) |
999 |
|
|
fi |
1000 |
gbeauche |
1.8 |
fi |
1001 |
|
|
AC_MSG_RESULT($WANT_ADDRESSING_MODE) |
1002 |
|
|
|
1003 |
gbeauche |
1.1 |
dnl Platform specific binary postprocessor |
1004 |
|
|
AC_PATH_PROG(BLESS, "true") |
1005 |
|
|
if [[ "x$ac_cv_pagezero_hack" = "xyes" ]]; then |
1006 |
|
|
BLESS=Darwin/lowmem |
1007 |
|
|
LDFLAGS="$LDFLAGS -pagezero_size 0x3000" |
1008 |
|
|
fi |
1009 |
|
|
|
1010 |
|
|
dnl Check for GCC 2.7 or higher. |
1011 |
|
|
HAVE_GCC27=no |
1012 |
|
|
AC_MSG_CHECKING(for GCC 2.7 or higher) |
1013 |
|
|
AC_EGREP_CPP(xyes, |
1014 |
|
|
[#if __GNUC__ - 1 > 1 || __GNUC_MINOR__ - 1 > 5 |
1015 |
|
|
xyes |
1016 |
|
|
#endif |
1017 |
|
|
], [AC_MSG_RESULT(yes); HAVE_GCC27=yes], AC_MSG_RESULT(no)) |
1018 |
|
|
|
1019 |
|
|
dnl Check for GCC 3.0 or higher. |
1020 |
|
|
HAVE_GCC30=no |
1021 |
|
|
AC_MSG_CHECKING(for GCC 3.0 or higher) |
1022 |
|
|
AC_EGREP_CPP(xyes, |
1023 |
|
|
[#if __GNUC__ >= 3 |
1024 |
|
|
xyes |
1025 |
|
|
#endif |
1026 |
|
|
], [AC_MSG_RESULT(yes); HAVE_GCC30=yes], AC_MSG_RESULT(no)) |
1027 |
|
|
|
1028 |
|
|
dnl Check for ICC. |
1029 |
|
|
AC_MSG_CHECKING(for ICC) |
1030 |
|
|
HAVE_ICC=no |
1031 |
|
|
if $CXX -V -v 2>&1 | grep -q "Intel(R) C++ Compiler"; then |
1032 |
|
|
HAVE_ICC=yes |
1033 |
|
|
fi |
1034 |
|
|
AC_MSG_RESULT($HAVE_ICC) |
1035 |
|
|
|
1036 |
gbeauche |
1.9 |
dnl Determine the generated object format |
1037 |
gbeauche |
1.1 |
AC_CACHE_CHECK([whether the compiler can generate ELF objects], |
1038 |
gbeauche |
1.9 |
ac_cv_object_format, [ |
1039 |
gbeauche |
1.1 |
echo 'int i;' > conftest.$ac_ext |
1040 |
gbeauche |
1.9 |
ac_cv_object_format=no |
1041 |
gbeauche |
1.1 |
if AC_TRY_EVAL(ac_compile); then |
1042 |
|
|
case `/usr/bin/file conftest.$ac_objext` in |
1043 |
|
|
*"ELF"*) |
1044 |
gbeauche |
1.9 |
ac_cv_object_format=elf |
1045 |
|
|
;; |
1046 |
|
|
*) |
1047 |
|
|
ac_cv_object_format=unknown |
1048 |
gbeauche |
1.1 |
;; |
1049 |
|
|
esac |
1050 |
|
|
fi |
1051 |
|
|
rm -rf conftest* |
1052 |
|
|
]) |
1053 |
|
|
|
1054 |
|
|
dnl CPU emulator sources |
1055 |
|
|
if [[ "x$EMULATED_PPC" = "xyes" ]]; then |
1056 |
|
|
CPUSRCS="\ |
1057 |
gbeauche |
1.9 |
../kpx_cpu/src/mathlib/ieeefp.cpp \ |
1058 |
gbeauche |
1.1 |
../kpx_cpu/src/cpu/ppc/ppc-cpu.cpp \ |
1059 |
|
|
../kpx_cpu/src/cpu/ppc/ppc-decode.cpp \ |
1060 |
|
|
../kpx_cpu/src/cpu/ppc/ppc-execute.cpp \ |
1061 |
|
|
../kpx_cpu/src/cpu/ppc/ppc-translate.cpp" |
1062 |
|
|
CPPFLAGS="$CPPFLAGS -I../kpx_cpu/include -I../kpx_cpu/src" |
1063 |
|
|
|
1064 |
|
|
dnl Enable JIT compiler, if possible |
1065 |
|
|
if [[ "x$WANT_JIT" = "xyes" ]]; then |
1066 |
|
|
AC_CACHE_CHECK([whether dyngen can be used], |
1067 |
|
|
ac_cv_use_dyngen, [ |
1068 |
gbeauche |
1.9 |
case $host_cpu:$ac_cv_object_format in |
1069 |
|
|
powerpc:elf) |
1070 |
gbeauche |
1.1 |
ac_cv_use_dyngen=yes |
1071 |
|
|
;; |
1072 |
gbeauche |
1.9 |
x86_64:elf) |
1073 |
gbeauche |
1.1 |
ac_cv_use_dyngen=yes |
1074 |
|
|
;; |
1075 |
gbeauche |
1.9 |
i?86:elf) |
1076 |
gbeauche |
1.1 |
ac_cv_use_dyngen=yes |
1077 |
|
|
;; |
1078 |
|
|
*:*) |
1079 |
|
|
ac_cv_use_dyngen=no |
1080 |
|
|
;; |
1081 |
|
|
esac |
1082 |
|
|
dnl Check for a suitable synthetic opcodes compiler (icc is faking itself as gcc 3.2.2) |
1083 |
|
|
if [[ -z "$DYNGEN_CC" ]]; then |
1084 |
|
|
if [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_ICC" = "xno" ]]; then |
1085 |
|
|
DYNGEN_CC=$CXX |
1086 |
|
|
else |
1087 |
|
|
for p in /usr/bin /usr/local/bin; do |
1088 |
|
|
gxx="$p/g++" |
1089 |
|
|
if [[ -x "$gxx" ]]; then |
1090 |
|
|
DYNGEN_CC="$gxx" |
1091 |
|
|
fi |
1092 |
|
|
done |
1093 |
|
|
fi |
1094 |
|
|
fi |
1095 |
|
|
if [[ -z "$DYNGEN_CC" ]] || ! { echo '#include <limits>' | $DYNGEN_CC -xc++ -c -o /dev/null - >& /dev/null; }; then |
1096 |
|
|
ac_cv_use_dyngen=no |
1097 |
|
|
fi |
1098 |
|
|
]) |
1099 |
|
|
if [[ "x$ac_cv_use_dyngen" = "xyes" ]]; then |
1100 |
|
|
case $host_cpu in |
1101 |
|
|
i?86) |
1102 |
|
|
DYNGEN_OP_FLAGS="-fomit-frame-pointer -mpreferred-stack-boundary=2" |
1103 |
|
|
if [[ "x$HAVE_GCC30" = "xyes" ]]; then |
1104 |
|
|
DYNGEN_OP_FLAGS="$DYNGEN_OP_FLAGS -falign-functions=0" |
1105 |
|
|
else |
1106 |
|
|
DYNGEN_OP_FLAGS="$DYNGEN_OP_FLAGS -malign-functions=0" |
1107 |
|
|
fi |
1108 |
|
|
;; |
1109 |
|
|
esac |
1110 |
gbeauche |
1.16 |
DYNGEN_OP_FLAGS="$DYNGEN_OP_FLAGS -finline-limit=10000 -g0" |
1111 |
gbeauche |
1.1 |
if [[ "x$HAVE_GCC30" = "xyes" ]]; then |
1112 |
|
|
DYNGEN_OP_FLAGS="$DYNGEN_OP_FLAGS -fno-reorder-blocks -fno-optimize-sibling-calls" |
1113 |
|
|
fi |
1114 |
|
|
else |
1115 |
|
|
WANT_JIT=no |
1116 |
|
|
fi |
1117 |
|
|
AC_TRANSLATE_DEFINE(ENABLE_DYNGEN, $ac_cv_use_dyngen, [Define to enable dyngen engine]) |
1118 |
|
|
if [[ "x$WANT_JIT" = "xyes" ]]; then |
1119 |
|
|
DYNGENSRCS="\ |
1120 |
|
|
../kpx_cpu/src/cpu/jit/dyngen.c \ |
1121 |
|
|
../kpx_cpu/src/cpu/jit/cxxdemangle.cpp" |
1122 |
|
|
CPUSRCS="\ |
1123 |
|
|
../kpx_cpu/src/cpu/jit/jit-cache.cpp \ |
1124 |
|
|
../kpx_cpu/src/cpu/jit/basic-dyngen.cpp \ |
1125 |
|
|
../kpx_cpu/src/cpu/ppc/ppc-dyngen.cpp $CPUSRCS" |
1126 |
|
|
fi |
1127 |
|
|
fi |
1128 |
|
|
CPUSRCS="$CPUSRCS ../kpx_cpu/sheepshaver_glue.cpp" |
1129 |
|
|
else |
1130 |
|
|
WANT_JIT=no |
1131 |
|
|
fi |
1132 |
|
|
if [[ "x$ac_cv_use_dyngen" = "xyes" ]]; then |
1133 |
|
|
AC_CACHE_CHECK([whether static data regions are executable], |
1134 |
|
|
ac_cv_have_static_data_exec, [ |
1135 |
|
|
AC_TRY_RUN([int main(void) { |
1136 |
|
|
#if defined(__powerpc__) |
1137 |
|
|
static unsigned int p[8] = {0x4e800020,}; |
1138 |
|
|
asm volatile("dcbst 0,%0" : : "r" (p) : "memory"); |
1139 |
|
|
asm volatile("sync" : : : "memory"); |
1140 |
|
|
asm volatile("icbi 0,%0" : : "r" (p) : "memory"); |
1141 |
|
|
asm volatile("sync" : : : "memory"); |
1142 |
|
|
asm volatile("isync" : : : "memory"); |
1143 |
|
|
((void (*)(void))p)(); |
1144 |
|
|
return 0; |
1145 |
|
|
#endif |
1146 |
|
|
return 1; |
1147 |
|
|
}], ac_cv_have_static_data_exec=yes, ac_cv_have_static_data_exec=no, |
1148 |
|
|
dnl When cross-compiling, do not assume anything. |
1149 |
|
|
ac_cv_have_static_data_exec=no |
1150 |
|
|
) |
1151 |
|
|
]) |
1152 |
gbeauche |
1.14 |
else |
1153 |
|
|
ac_cv_use_dyngen=no |
1154 |
gbeauche |
1.1 |
fi |
1155 |
|
|
AC_TRANSLATE_DEFINE(HAVE_STATIC_DATA_EXEC, "$ac_cv_have_static_data_exec", |
1156 |
|
|
[Define if your system marks static data pages as executable.]) |
1157 |
|
|
|
1158 |
|
|
if [[ "x$WANT_JIT" = "xyes" ]]; then |
1159 |
|
|
CPPFLAGS="$CPPFLAGS -DUSE_JIT" |
1160 |
|
|
fi |
1161 |
|
|
|
1162 |
|
|
dnl Generate Makefile. |
1163 |
gbeauche |
1.16 |
AC_SUBST(PERL) |
1164 |
gbeauche |
1.14 |
AC_SUBST(USE_DYNGEN, [$ac_cv_use_dyngen]) |
1165 |
gbeauche |
1.1 |
AC_SUBST(DYNGENSRCS) |
1166 |
|
|
AC_SUBST(DYNGEN_CC) |
1167 |
|
|
AC_SUBST(DYNGEN_OP_FLAGS) |
1168 |
|
|
AC_SUBST(SYSSRCS) |
1169 |
|
|
AC_SUBST(CPUSRCS) |
1170 |
|
|
AC_SUBST(BLESS) |
1171 |
|
|
AC_SUBST(KEYCODES) |
1172 |
gbeauche |
1.5 |
AC_OUTPUT([ |
1173 |
|
|
Makefile |
1174 |
|
|
../MacOSX/Info.plist |
1175 |
|
|
]) |
1176 |
gbeauche |
1.1 |
|
1177 |
|
|
dnl Print summary. |
1178 |
|
|
echo |
1179 |
|
|
echo SheepShaver configuration summary: |
1180 |
|
|
echo |
1181 |
|
|
echo SDL support ...................... : $SDL_SUPPORT |
1182 |
gbeauche |
1.21 |
echo FBDev DGA support ................ : $WANT_FBDEV_DGA |
1183 |
gbeauche |
1.1 |
echo XFree86 DGA support .............. : $WANT_XF86_DGA |
1184 |
|
|
echo XFree86 VidMode support .......... : $WANT_XF86_VIDMODE |
1185 |
|
|
echo Using PowerPC emulator ........... : $EMULATED_PPC |
1186 |
|
|
echo Enable JIT compiler .............. : $WANT_JIT |
1187 |
|
|
echo Enable video on SEGV signals ..... : $WANT_VOSF |
1188 |
|
|
echo ESD sound support ................ : $WANT_ESD |
1189 |
|
|
echo GTK user interface ............... : $WANT_GTK |
1190 |
|
|
echo mon debugger support ............. : $WANT_MON |
1191 |
gbeauche |
1.8 |
echo Addressing mode .................. : $WANT_ADDRESSING_MODE |
1192 |
gbeauche |
1.1 |
echo Bad memory access recovery type .. : $sigsegv_recovery |
1193 |
|
|
echo |
1194 |
|
|
echo "Configuration done. Now type \"make\"." |