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 |
|
|
AC_ARG_ENABLE(xf86-dga, [ --enable-xf86-dga use the XFree86 DGA extension [default=yes]], [WANT_XF86_DGA=$enableval], [WANT_XF86_DGA=yes]) |
21 |
|
|
AC_ARG_ENABLE(xf86-vidmode, [ --enable-xf86-vidmode use the XFree86 VidMode extension [default=no]], [WANT_XF86_VIDMODE=$enableval], [WANT_XF86_VIDMODE=no]) |
22 |
|
|
AC_ARG_ENABLE(vosf, [ --enable-vosf enable video on SEGV signals [default=yes]], [WANT_VOSF=$enableval], [WANT_VOSF=yes]) |
23 |
|
|
AC_ARG_WITH(esd, [ --with-esd support ESD for sound under Linux/FreeBSD [default=yes]], [WANT_ESD=$withval], [WANT_ESD=yes]) |
24 |
|
|
AC_ARG_WITH(gtk, [ --with-gtk use GTK user interface [default=yes]], [WANT_GTK=$withval], [WANT_GTK=yes]) |
25 |
|
|
AC_ARG_WITH(mon, [ --with-mon use mon as debugger [default=yes]], [WANT_MON=$withval], [WANT_MON=yes]) |
26 |
|
|
AC_ARG_WITH(dgcc, [ --with-dgcc=COMPILER use C++ COMPILER to compile synthetic opcodes], [DYNGEN_CC=$withval]) |
27 |
|
|
|
28 |
|
|
dnl SDL options. |
29 |
|
|
AC_ARG_ENABLE(sdl-static, [ --enable-sdl-static use SDL static libraries for linking [default=no]], [WANT_SDL_STATIC=$enableval], [WANT_SDL_STATIC=no]) |
30 |
|
|
AC_ARG_ENABLE(sdl-video, [ --enable-sdl-video use SDL for video graphics [default=no]], [WANT_SDL_VIDEO=$enableval], [WANT_SDL_VIDEO=no]) |
31 |
|
|
|
32 |
|
|
dnl Checks for programs. |
33 |
|
|
AC_PROG_CC |
34 |
|
|
AC_PROG_CPP |
35 |
|
|
AC_PROG_CXX |
36 |
|
|
AC_PROG_MAKE_SET |
37 |
|
|
AC_PROG_INSTALL |
38 |
gbeauche |
1.3 |
AC_PROG_EGREP |
39 |
gbeauche |
1.1 |
|
40 |
|
|
dnl Check for PowerPC target CPU. |
41 |
|
|
HAVE_PPC=no |
42 |
|
|
AC_MSG_CHECKING(for PowerPC target CPU) |
43 |
|
|
AC_EGREP_CPP(yes, |
44 |
|
|
[ |
45 |
|
|
#ifdef __powerpc__ |
46 |
|
|
yes |
47 |
|
|
#endif |
48 |
|
|
#ifdef __ppc__ |
49 |
|
|
yes |
50 |
|
|
#endif |
51 |
|
|
], [AC_MSG_RESULT(yes); HAVE_PPC=yes], AC_MSG_RESULT(no)) |
52 |
|
|
|
53 |
|
|
dnl We use native CPU if possible. |
54 |
|
|
EMULATED_PPC=yes |
55 |
|
|
case $WANT_EMULATED_PPC in |
56 |
|
|
auto) [[ "x$HAVE_PPC" = "xyes" ]] && EMULATED_PPC=no;; |
57 |
|
|
no) EMULATED_PPC=no;; |
58 |
|
|
esac |
59 |
|
|
if [[ "x$EMULATED_PPC" = "xyes" ]]; then |
60 |
|
|
AC_DEFINE(EMULATED_PPC, 1, [Define if using a PowerPC CPU emulator.]) |
61 |
|
|
fi |
62 |
|
|
|
63 |
|
|
dnl We use mon if possible. |
64 |
|
|
MONSRCS= |
65 |
|
|
case "x$WANT_MON" in |
66 |
|
|
x/* | x.*) |
67 |
|
|
mon_srcdir=$WANT_MON |
68 |
|
|
WANT_MON=yes |
69 |
|
|
;; |
70 |
|
|
xyes) |
71 |
|
|
mon_srcdir=../../../mon/src |
72 |
|
|
;; |
73 |
|
|
esac |
74 |
|
|
if [[ "x$WANT_MON" = "xyes" ]]; then |
75 |
|
|
AC_MSG_CHECKING(for mon) |
76 |
|
|
if grep mon_init $mon_srcdir/mon.h >/dev/null 2>/dev/null; then |
77 |
|
|
AC_MSG_RESULT(yes) |
78 |
|
|
AC_DEFINE(ENABLE_MON, 1, [Define if using "mon".]) |
79 |
|
|
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" |
80 |
|
|
CXXFLAGS="$CXXFLAGS -I$mon_srcdir -I$mon_srcdir/disass" |
81 |
|
|
AC_CHECK_LIB(ncurses, tgetent, , |
82 |
|
|
AC_CHECK_LIB(termcap, tgetent, , |
83 |
|
|
AC_CHECK_LIB(termlib, tgetent, , |
84 |
|
|
AC_CHECK_LIB(terminfo, tgetent, , |
85 |
|
|
AC_CHECK_LIB(Hcurses, tgetent, , |
86 |
|
|
AC_CHECK_LIB(curses, tgetent)))))) |
87 |
|
|
AC_CHECK_LIB(readline, readline) |
88 |
|
|
AC_CHECK_HEADERS(readline.h history.h readline/readline.h readline/history.h) |
89 |
|
|
else |
90 |
|
|
AC_MSG_RESULT(no) |
91 |
|
|
AC_MSG_WARN([Could not find mon, ignoring --with-mon.]) |
92 |
|
|
WANT_MON=no |
93 |
|
|
fi |
94 |
|
|
fi |
95 |
|
|
|
96 |
|
|
dnl Checks for libraries. |
97 |
|
|
AC_CHECK_LIB(posix4, sem_init) |
98 |
|
|
|
99 |
|
|
dnl Do we need SDL? |
100 |
|
|
WANT_SDL=no |
101 |
|
|
SDL_SUPPORT="none" |
102 |
|
|
if [[ "x$WANT_SDL_VIDEO" = "xyes" ]]; then |
103 |
|
|
WANT_SDL=yes |
104 |
|
|
WANT_XF86_DGA=no |
105 |
|
|
WANT_XF86_VIDMODE=no |
106 |
|
|
WANT_FBDEV_DGA=no |
107 |
|
|
SDL_SUPPORT="video" |
108 |
|
|
fi |
109 |
|
|
if [[ "x$WANT_SDL" = "xyes" ]]; then |
110 |
|
|
AC_PATH_PROG(sdl_config, "sdl-config") |
111 |
|
|
if [[ -n "$sdl_config" ]]; then |
112 |
|
|
sdl_cflags=`$sdl_config --cflags` |
113 |
|
|
if [[ "x$WANT_SDL_STATIC" = "xyes" ]]; then |
114 |
|
|
sdl_libs=`$sdl_config --static-libs` |
115 |
|
|
else |
116 |
|
|
sdl_libs=`$sdl_config --libs` |
117 |
|
|
fi |
118 |
|
|
CFLAGS="$CFLAGS $sdl_cflags" |
119 |
|
|
CXXFLAGS="$CXXFLAGS $sdl_cflags" |
120 |
|
|
LIBS="$LIBS $sdl_libs" |
121 |
|
|
else |
122 |
|
|
WANT_SDL=no |
123 |
|
|
fi |
124 |
|
|
fi |
125 |
|
|
|
126 |
|
|
dnl We need X11, if not using SDL. |
127 |
|
|
if [[ "x$WANT_SDL" = "xno" ]]; then |
128 |
|
|
AC_PATH_XTRA |
129 |
|
|
if [[ "x$no_x" = "xyes" ]]; then |
130 |
|
|
AC_MSG_ERROR([You need X11 to run SheepShaver.]) |
131 |
|
|
fi |
132 |
|
|
CFLAGS="$CFLAGS $X_CFLAGS" |
133 |
|
|
CXXFLAGS="$CXXFLAGS $X_CFLAGS" |
134 |
|
|
LIBS="$LIBS $X_PRE_LIBS $X_LIBS -lX11 -lXext $X_EXTRA_LIBS" |
135 |
|
|
fi |
136 |
|
|
|
137 |
|
|
dnl We need pthreads on non-PowerPC systems. Try libpthread first, then libc_r (FreeBSD), then PTL. |
138 |
|
|
HAVE_PTHREADS=yes |
139 |
|
|
case $EMULATED_PPC:$target_os in |
140 |
|
|
no:linux*) |
141 |
|
|
dnl We do have our own pthread_cancel() implementation |
142 |
|
|
AC_DEFINE(HAVE_PTHREAD_CANCEL, 1, [Define if you have the pthread_cancel function.]) |
143 |
|
|
;; |
144 |
|
|
*:*) |
145 |
|
|
AC_CHECK_LIB(pthread, pthread_create, , [ |
146 |
|
|
AC_CHECK_LIB(c_r, pthread_create, , [ |
147 |
|
|
AC_CHECK_LIB(PTL, pthread_create, , [ |
148 |
|
|
AC_MSG_ERROR([You need pthreads to run Basilisk II.]) |
149 |
|
|
]) |
150 |
|
|
]) |
151 |
|
|
]) |
152 |
|
|
AC_CHECK_FUNCS(pthread_cancel) |
153 |
|
|
AC_CHECK_FUNCS(pthread_mutexattr_setprotocol) |
154 |
|
|
AC_CHECK_FUNCS(pthread_mutexattr_settype) |
155 |
|
|
AC_CHECK_FUNCS(pthread_mutexattr_setpshared) |
156 |
|
|
if [[ "x$HAVE_PTHREADS" = "xyes" ]]; then |
157 |
|
|
AC_DEFINE(HAVE_PTHREADS, 1, [Define if pthreads are available.]) |
158 |
|
|
fi |
159 |
|
|
dnl If POSIX.4 semaphores are not available, we emulate them with pthread mutexes. |
160 |
|
|
SEMSRC= |
161 |
|
|
AC_CHECK_FUNCS(sem_init, , [ |
162 |
|
|
if test "x$HAVE_PTHREADS" = "xyes"; then |
163 |
|
|
SEMSRC=posix_sem.cpp |
164 |
|
|
fi |
165 |
|
|
]) |
166 |
|
|
;; |
167 |
|
|
esac |
168 |
|
|
|
169 |
|
|
dnl We use XFree86 DGA if possible. |
170 |
|
|
if [[ "x$WANT_XF86_DGA" = "xyes" ]]; then |
171 |
|
|
AC_CHECK_LIB(Xxf86dga, XF86DGAQueryExtension, [ |
172 |
|
|
AC_DEFINE(ENABLE_XF86_DGA, 1, [Define if using XFree86 DGA extension.]) |
173 |
|
|
LIBS="$LIBS -lXxf86dga" |
174 |
|
|
], [ |
175 |
|
|
AC_MSG_WARN([Could not find XFree86 DGA extension, ignoring --enable-xf86-dga.]) |
176 |
|
|
WANT_XF86_DGA=no |
177 |
|
|
]) |
178 |
|
|
fi |
179 |
|
|
|
180 |
|
|
dnl We use XFree86 VidMode if possible. |
181 |
|
|
if [[ "x$WANT_XF86_VIDMODE" = "xyes" ]]; then |
182 |
|
|
AC_CHECK_LIB(Xxf86vm, XF86VidModeQueryExtension, [ |
183 |
|
|
AC_DEFINE(ENABLE_XF86_VIDMODE, 1, [Define if using XFree86 DGA extension.]) |
184 |
|
|
LIBS="$LIBS -lXxf86vm" |
185 |
|
|
], [ |
186 |
|
|
AC_MSG_WARN([Could not find XFree86 VidMode extension, ignoring --enable-xf86-vidmode.]) |
187 |
|
|
WANT_XF86_VIDMODE=no |
188 |
|
|
]) |
189 |
|
|
fi |
190 |
|
|
|
191 |
|
|
dnl We use GTK+ if possible. |
192 |
|
|
UISRCS=../dummy/prefs_editor_dummy.cpp |
193 |
|
|
if [[ "x$WANT_GTK" = "xyes" ]]; then |
194 |
|
|
AM_PATH_GTK(1.2.0, [ |
195 |
|
|
AC_DEFINE(ENABLE_GTK, 1, [Define if using GTK.]) |
196 |
|
|
CFLAGS="$CFLAGS $GTK_CFLAGS" |
197 |
|
|
CXXFLAGS="$CXXFLAGS $GTK_CFLAGS" |
198 |
|
|
LIBS="$LIBS $GTK_LIBS" |
199 |
|
|
UISRCS=prefs_editor_gtk.cpp |
200 |
|
|
], [ |
201 |
|
|
AC_MSG_WARN([Could not find GTK+, disabling user interface.]) |
202 |
|
|
WANT_GTK=no |
203 |
|
|
]) |
204 |
|
|
fi |
205 |
|
|
|
206 |
|
|
dnl We use ESD if possible. |
207 |
|
|
if [[ "x$WANT_ESD" = "xyes" ]]; then |
208 |
|
|
AM_PATH_ESD(0.2.8, [ |
209 |
|
|
AC_DEFINE(ENABLE_ESD, 1, [Define is using ESD.]) |
210 |
|
|
CFLAGS="$CFLAGS $ESD_CFLAGS" |
211 |
|
|
CXXFLAGS="$CXXFLAGS $ESD_CFLAGS" |
212 |
|
|
LIBS="$LIBS $ESD_LIBS" |
213 |
|
|
], [ |
214 |
|
|
AC_MSG_WARN([Could not find ESD, disabling ESD support.]) |
215 |
|
|
WANT_ESD=no |
216 |
|
|
]) |
217 |
|
|
fi |
218 |
|
|
|
219 |
gbeauche |
1.2 |
dnl We use 64-bit file size support if possible. |
220 |
|
|
AC_SYS_LARGEFILE |
221 |
|
|
|
222 |
gbeauche |
1.1 |
dnl Checks for header files. |
223 |
|
|
AC_HEADER_STDC |
224 |
|
|
AC_HEADER_SYS_WAIT |
225 |
|
|
AC_CHECK_HEADERS(mach/vm_map.h mach/mach_init.h sys/mman.h) |
226 |
|
|
AC_CHECK_HEADERS(sys/time.h sys/times.h sys/socket.h) |
227 |
|
|
AC_CHECK_HEADERS(unistd.h fcntl.h byteswap.h) |
228 |
|
|
AC_CHECK_HEADERS(linux/if.h, [], [], [ |
229 |
|
|
#if HAVE_SYS_SOCKET_H |
230 |
|
|
# include <sys/socket.h> |
231 |
|
|
#endif |
232 |
|
|
]) |
233 |
|
|
AC_CHECK_HEADERS(linux/if_tun.h net/if.h net/if_tun.h) |
234 |
|
|
|
235 |
|
|
dnl Checks for typedefs, structures, and compiler characteristics. |
236 |
|
|
AC_C_BIGENDIAN |
237 |
|
|
AC_C_CONST |
238 |
|
|
AC_C_INLINE |
239 |
|
|
AC_CHECK_SIZEOF(short, 2) |
240 |
|
|
AC_CHECK_SIZEOF(int, 4) |
241 |
|
|
AC_CHECK_SIZEOF(long, 4) |
242 |
|
|
AC_CHECK_SIZEOF(long long, 8) |
243 |
|
|
AC_CHECK_SIZEOF(float, 4) |
244 |
|
|
AC_CHECK_SIZEOF(double, 8) |
245 |
|
|
AC_CHECK_SIZEOF(void *, 4) |
246 |
|
|
AC_TYPE_OFF_T |
247 |
|
|
AC_CHECK_TYPE(loff_t, off_t) |
248 |
|
|
AC_TYPE_SIZE_T |
249 |
|
|
AC_TYPE_SIGNAL |
250 |
|
|
AC_HEADER_TIME |
251 |
|
|
AC_STRUCT_TM |
252 |
|
|
|
253 |
|
|
dnl Check whether struct sigaction has sa_restorer member. |
254 |
|
|
AC_CACHE_CHECK([whether struct sigaction has sa_restorer], |
255 |
|
|
ac_cv_signal_sa_restorer, [ |
256 |
|
|
AC_TRY_COMPILE([ |
257 |
|
|
#include <signal.h> |
258 |
|
|
], [struct sigaction sa; sa.sa_restorer = 0;], |
259 |
|
|
ac_cv_signal_sa_restorer=yes, ac_cv_signal_sa_restorer=no, |
260 |
|
|
dnl When cross-compiling, do not assume anything. |
261 |
|
|
ac_cv_signal_sa_restorer=no |
262 |
|
|
) |
263 |
|
|
]) |
264 |
|
|
if [[ "x$ac_cv_signal_sa_restorer" = "xyes" ]]; then |
265 |
|
|
AC_DEFINE(HAVE_SIGNAL_SA_RESTORER, 1, [Define if sa_restorer is available in struct sigaction.]) |
266 |
|
|
fi |
267 |
|
|
|
268 |
|
|
dnl Checks for library functions. |
269 |
|
|
AC_CHECK_FUNCS(strdup strlcpy cfmakeraw) |
270 |
|
|
AC_CHECK_FUNCS(nanosleep) |
271 |
|
|
AC_CHECK_FUNCS(sigaction signal) |
272 |
|
|
AC_CHECK_FUNCS(mmap mprotect munmap) |
273 |
|
|
AC_CHECK_FUNCS(vm_allocate vm_deallocate vm_protect) |
274 |
|
|
AC_CHECK_FUNCS(posix_memalign memalign valloc) |
275 |
|
|
|
276 |
|
|
dnl Darwin seems to define mach_task_self() instead of task_self(). |
277 |
|
|
AC_CHECK_FUNCS(mach_task_self task_self) |
278 |
|
|
|
279 |
|
|
dnl We need clock_gettime() for better performance but it may drag |
280 |
|
|
dnl libpthread in, which we don't want for native ppc mode |
281 |
|
|
case $EMULATED_PPC:$target_os in |
282 |
|
|
no:linux*) |
283 |
|
|
;; |
284 |
|
|
*:*) |
285 |
|
|
AC_SEARCH_LIBS(clock_gettime, [rt posix4]) |
286 |
|
|
AC_CHECK_FUNCS(clock_gettime) |
287 |
|
|
;; |
288 |
|
|
esac |
289 |
|
|
|
290 |
|
|
dnl AC_CHECK_FRAMEWORK($1=NAME, $2=INCLUDES) |
291 |
|
|
AC_DEFUN(AC_CHECK_FRAMEWORK, [ |
292 |
|
|
AS_VAR_PUSHDEF([ac_Framework], [ac_cv_framework_$1])dnl |
293 |
|
|
AC_CACHE_CHECK([whether compiler supports framework $1], |
294 |
|
|
ac_Framework, [ |
295 |
|
|
saved_LIBS="$LIBS" |
296 |
|
|
LIBS="$LIBS -framework $1" |
297 |
|
|
AC_TRY_LINK( |
298 |
|
|
[$2], [int main(void) { return 0; }], |
299 |
|
|
[AS_VAR_SET(ac_Framework, yes)], [AS_VAR_SET(ac_Framework, no); LIBS="$saved_LIBS"] |
300 |
|
|
) |
301 |
|
|
]) |
302 |
|
|
AS_IF([test AS_VAR_GET(ac_Framework) = yes], |
303 |
|
|
[AC_DEFINE(AS_TR_CPP(HAVE_FRAMEWORK_$1), 1, [Define if framework $1 is available.])] |
304 |
|
|
) |
305 |
|
|
AS_VAR_POPDEF([ac_Framework])dnl |
306 |
|
|
]) |
307 |
|
|
|
308 |
|
|
dnl Check for some MacOS X frameworks |
309 |
|
|
AC_CHECK_FRAMEWORK(Carbon, [#include <Carbon/Carbon.h>]) |
310 |
|
|
AC_CHECK_FRAMEWORK(IOKit, [#include <IOKit/IOKitLib.h>]) |
311 |
|
|
|
312 |
|
|
dnl Select system-dependant sources. |
313 |
|
|
SERIALSRC=serial_unix.cpp |
314 |
|
|
ETHERSRC=../dummy/ether_dummy.cpp |
315 |
|
|
SCSISRC=../dummy/scsi_dummy.cpp |
316 |
|
|
AUDIOSRC=../dummy/audio_dummy.cpp |
317 |
|
|
EXTRASYSSRCS= |
318 |
|
|
case "$target_os" in |
319 |
|
|
linux*) |
320 |
|
|
ETHERSRC=Linux/ether_linux.cpp |
321 |
|
|
AUDIOSRC=audio_oss_esd.cpp |
322 |
|
|
SCSISRC=Linux/scsi_linux.cpp |
323 |
|
|
if [[ "x$EMULATED_PPC" = "xno" ]]; then |
324 |
|
|
EXTRASYSSRCS="Linux/paranoia.cpp Linux/sheepthreads.c Linux/asm_linux.S" |
325 |
|
|
fi |
326 |
|
|
;; |
327 |
|
|
darwin*) |
328 |
|
|
if [[ "x$EMULATED_PPC" = "xno" ]]; then |
329 |
|
|
EXTRASYSSRCS="Darwin/paranoia.cpp Linux/asm_linux.S" |
330 |
|
|
fi |
331 |
|
|
if [[ "x$ac_cv_framework_IOKit" = "xyes" ]]; then |
332 |
|
|
EXTRASYSSRCS="$EXTRASYSSRCS ../MacOSX/sys_darwin.cpp" |
333 |
|
|
fi |
334 |
|
|
;; |
335 |
|
|
esac |
336 |
|
|
|
337 |
|
|
dnl SDL overrides |
338 |
|
|
if [[ "x$WANT_SDL" = "xyes" ]]; then |
339 |
|
|
AC_DEFINE(USE_SDL, 1, [Define to enble SDL support.]) |
340 |
|
|
fi |
341 |
|
|
if [[ "x$WANT_SDL_VIDEO" = "xyes" ]]; then |
342 |
|
|
VIDEOSRCS="../SDL/video_sdl.cpp" |
343 |
|
|
AC_DEFINE(USE_SDL_VIDEO, 1, [Define to enable SDL video graphics support.]) |
344 |
|
|
KEYCODES="../SDL/keycodes" |
345 |
|
|
if [[ "x$ac_cv_framework_Carbon" = "xyes" ]]; then |
346 |
|
|
EXTRASYSSRCS="$EXTRASYSSRCS ../MacOSX/clip_macosx.cpp" |
347 |
|
|
else |
348 |
|
|
EXTRASYSSRCS="$EXTRASYSSRCS ../dummy/clip_dummy.cpp" |
349 |
|
|
fi |
350 |
|
|
else |
351 |
|
|
VIDEOSRCS="video_x.cpp" |
352 |
|
|
KEYCODES="keycodes" |
353 |
|
|
EXTRASYSSRCS="$EXTRASYSSRCS clip_unix.cpp" |
354 |
|
|
fi |
355 |
|
|
|
356 |
|
|
SYSSRCS="$VIDEOSRCS $SERIALSRC $ETHERSRC $SCSISRC $AUDIOSRC $SEMSRC $UISRCS $MONSRCS $EXTRASYSSRCS" |
357 |
|
|
|
358 |
|
|
dnl Define a macro that translates a yesno-variable into a C macro definition |
359 |
|
|
dnl to be put into the config.h file |
360 |
|
|
dnl $1 -- the macro to define |
361 |
|
|
dnl $2 -- the value to translate |
362 |
|
|
dnl $3 -- template name |
363 |
|
|
AC_DEFUN(AC_TRANSLATE_DEFINE, [ |
364 |
|
|
if [[ "x$2" = "xyes" -o "x$2" = "xguessing yes" ]]; then |
365 |
|
|
AC_DEFINE($1, 1, $3) |
366 |
|
|
fi |
367 |
|
|
]) |
368 |
|
|
|
369 |
|
|
dnl Check that the host supports TUN/TAP devices |
370 |
|
|
AC_CACHE_CHECK([whether TUN/TAP is supported], |
371 |
|
|
ac_cv_tun_tap_support, [ |
372 |
|
|
AC_TRY_COMPILE([ |
373 |
|
|
#if defined(HAVE_LINUX_IF_H) && defined(HAVE_LINUX_IF_TUN_H) |
374 |
|
|
#include <linux/if.h> |
375 |
|
|
#include <linux/if_tun.h> |
376 |
|
|
#endif |
377 |
|
|
#if defined(HAVE_NET_IF_H) && defined(HAVE_NET_IF_TUN_H) |
378 |
|
|
#include <net/if.h> |
379 |
|
|
#include <net/if_tun.h> |
380 |
|
|
#endif |
381 |
|
|
], [ |
382 |
|
|
struct ifreq ifr; |
383 |
|
|
memset(&ifr, 0, sizeof(ifr)); |
384 |
|
|
ifr.ifr_flags = IFF_TAP | IFF_NO_PI; |
385 |
|
|
], |
386 |
|
|
ac_cv_tun_tap_support=yes, ac_cv_tun_tap_support=no |
387 |
|
|
) |
388 |
|
|
]) |
389 |
|
|
AC_TRANSLATE_DEFINE(ENABLE_TUNTAP, "$ac_cv_tun_tap_support", |
390 |
|
|
[Define if your system supports TUN/TAP devices.]) |
391 |
|
|
|
392 |
|
|
dnl Various checks if the system supports vm_allocate() and the like functions. |
393 |
|
|
have_mach_vm=no |
394 |
|
|
if [[ "x$ac_cv_func_vm_allocate" = "xyes" -a "x$ac_cv_func_vm_deallocate" = "xyes" -a \ |
395 |
|
|
"x$ac_cv_func_vm_protect" = "xyes" ]]; then |
396 |
|
|
have_mach_vm=yes |
397 |
|
|
fi |
398 |
|
|
AC_TRANSLATE_DEFINE(HAVE_MACH_VM, "$have_mach_vm", |
399 |
|
|
[Define if your system has a working vm_allocate()-based memory allocator.]) |
400 |
|
|
|
401 |
|
|
dnl Check that vm_allocate(), vm_protect() work |
402 |
|
|
if [[ "x$have_mach_vm" = "xyes" ]]; then |
403 |
|
|
|
404 |
|
|
AC_CACHE_CHECK([whether vm_protect works], |
405 |
|
|
ac_cv_vm_protect_works, [ |
406 |
|
|
AC_LANG_SAVE |
407 |
|
|
AC_LANG_CPLUSPLUS |
408 |
|
|
ac_cv_vm_protect_works=yes |
409 |
|
|
dnl First the tests that should segfault |
410 |
|
|
for test_def in NONE_READ NONE_WRITE READ_WRITE; do |
411 |
|
|
AC_TRY_RUN([ |
412 |
|
|
#define CONFIGURE_TEST_VM_MAP |
413 |
|
|
#define TEST_VM_PROT_$test_def |
414 |
|
|
#include "vm_alloc.cpp" |
415 |
|
|
], ac_cv_vm_protect_works=no, rm -f core, |
416 |
|
|
dnl When cross-compiling, do not assume anything |
417 |
|
|
ac_cv_vm_protect_works="guessing no" |
418 |
|
|
) |
419 |
|
|
done |
420 |
|
|
AC_TRY_RUN([ |
421 |
|
|
#define CONFIGURE_TEST_VM_MAP |
422 |
|
|
#define TEST_VM_PROT_RDWR_WRITE |
423 |
|
|
#include "vm_alloc.cpp" |
424 |
|
|
], , ac_cv_vm_protect_works=no, |
425 |
|
|
dnl When cross-compiling, do not assume anything |
426 |
|
|
ac_cv_vm_protect_works="guessing no" |
427 |
|
|
) |
428 |
|
|
AC_LANG_RESTORE |
429 |
|
|
] |
430 |
|
|
) |
431 |
|
|
|
432 |
|
|
dnl Remove support for vm_allocate() if vm_protect() does not work |
433 |
|
|
if [[ "x$have_mach_vm" = "xyes" ]]; then |
434 |
|
|
case $ac_cv_vm_protect_works in |
435 |
|
|
*yes) have_mach_vm=yes;; |
436 |
|
|
*no) have_mach_vm=no;; |
437 |
|
|
esac |
438 |
|
|
fi |
439 |
|
|
AC_TRANSLATE_DEFINE(HAVE_MACH_VM, "$have_mach_vm", |
440 |
|
|
[Define if your system has a working vm_allocate()-based memory allocator.]) |
441 |
|
|
|
442 |
|
|
fi dnl HAVE_MACH_VM |
443 |
|
|
|
444 |
|
|
dnl Various checks if the system supports mmap() and the like functions. |
445 |
|
|
dnl ... and Mach memory allocators are not supported |
446 |
|
|
have_mmap_vm=no |
447 |
|
|
if [[ "x$ac_cv_func_mmap" = "xyes" -a "x$ac_cv_func_munmap" = "xyes" -a \ |
448 |
|
|
"x$ac_cv_func_mprotect" = "xyes" ]]; then |
449 |
|
|
if [[ "x$have_mach_vm" = "xno" ]]; then |
450 |
|
|
have_mmap_vm=yes |
451 |
|
|
fi |
452 |
|
|
fi |
453 |
|
|
AC_TRANSLATE_DEFINE(HAVE_MMAP_VM, "$have_mmap_vm", |
454 |
|
|
[Define if your system has a working mmap()-based memory allocator.]) |
455 |
|
|
|
456 |
|
|
dnl Check that mmap() and associated functions work. |
457 |
|
|
if [[ "x$have_mmap_vm" = "xyes" ]]; then |
458 |
|
|
|
459 |
|
|
dnl Check if we have a working anonymous mmap() |
460 |
|
|
AC_CACHE_CHECK([whether mmap supports MAP_ANON], |
461 |
|
|
ac_cv_mmap_anon, [ |
462 |
|
|
AC_LANG_SAVE |
463 |
|
|
AC_LANG_CPLUSPLUS |
464 |
|
|
AC_TRY_RUN([ |
465 |
|
|
#define HAVE_MMAP_ANON |
466 |
|
|
#define CONFIGURE_TEST_VM_MAP |
467 |
|
|
#define TEST_VM_MMAP_ANON |
468 |
|
|
#include "vm_alloc.cpp" |
469 |
|
|
], ac_cv_mmap_anon=yes, ac_cv_mmap_anon=no, |
470 |
|
|
dnl When cross-compiling, do not assume anything. |
471 |
|
|
ac_cv_mmap_anon="guessing no" |
472 |
|
|
) |
473 |
|
|
AC_LANG_RESTORE |
474 |
|
|
] |
475 |
|
|
) |
476 |
|
|
AC_TRANSLATE_DEFINE(HAVE_MMAP_ANON, "$ac_cv_mmap_anon", |
477 |
|
|
[Define if <sys/mman.h> defines MAP_ANON and mmap()'ing with MAP_ANON works.]) |
478 |
|
|
|
479 |
|
|
AC_CACHE_CHECK([whether mmap supports MAP_ANONYMOUS], |
480 |
|
|
ac_cv_mmap_anonymous, [ |
481 |
|
|
AC_LANG_SAVE |
482 |
|
|
AC_LANG_CPLUSPLUS |
483 |
|
|
AC_TRY_RUN([ |
484 |
|
|
#define HAVE_MMAP_ANONYMOUS |
485 |
|
|
#define CONFIGURE_TEST_VM_MAP |
486 |
|
|
#define TEST_VM_MMAP_ANON |
487 |
|
|
#include "vm_alloc.cpp" |
488 |
|
|
], ac_cv_mmap_anonymous=yes, ac_cv_mmap_anonymous=no, |
489 |
|
|
dnl When cross-compiling, do not assume anything. |
490 |
|
|
ac_cv_mmap_anonymous="guessing no" |
491 |
|
|
) |
492 |
|
|
AC_LANG_RESTORE |
493 |
|
|
] |
494 |
|
|
) |
495 |
|
|
AC_TRANSLATE_DEFINE(HAVE_MMAP_ANONYMOUS, "$ac_cv_mmap_anonymous", |
496 |
|
|
[Define if <sys/mman.h> defines MAP_ANONYMOUS and mmap()'ing with MAP_ANONYMOUS works.]) |
497 |
|
|
|
498 |
|
|
AC_CACHE_CHECK([whether mprotect works], |
499 |
|
|
ac_cv_mprotect_works, [ |
500 |
|
|
AC_LANG_SAVE |
501 |
|
|
AC_LANG_CPLUSPLUS |
502 |
|
|
ac_cv_mprotect_works=yes |
503 |
|
|
dnl First the tests that should segfault |
504 |
|
|
for test_def in NONE_READ NONE_WRITE READ_WRITE; do |
505 |
|
|
AC_TRY_RUN([ |
506 |
|
|
#define CONFIGURE_TEST_VM_MAP |
507 |
|
|
#define TEST_VM_PROT_$test_def |
508 |
|
|
#include "vm_alloc.cpp" |
509 |
|
|
], ac_cv_mprotect_works=no, rm -f core, |
510 |
|
|
dnl When cross-compiling, do not assume anything |
511 |
|
|
ac_cv_mprotect_works="guessing no" |
512 |
|
|
) |
513 |
|
|
done |
514 |
|
|
AC_TRY_RUN([ |
515 |
|
|
#define CONFIGURE_TEST_VM_MAP |
516 |
|
|
#define TEST_VM_PROT_RDWR_WRITE |
517 |
|
|
#include "vm_alloc.cpp" |
518 |
|
|
], , ac_cv_mprotect_works=no, |
519 |
|
|
dnl When cross-compiling, do not assume anything |
520 |
|
|
ac_cv_mprotect_works="guessing no" |
521 |
|
|
) |
522 |
|
|
AC_LANG_RESTORE |
523 |
|
|
] |
524 |
|
|
) |
525 |
|
|
|
526 |
|
|
dnl Remove support for mmap() if mprotect() does not work |
527 |
|
|
if [[ "x$have_mmap_vm" = "xyes" ]]; then |
528 |
|
|
case $ac_cv_mprotect_works in |
529 |
|
|
*yes) have_mmap_vm=yes;; |
530 |
|
|
*no) have_mmap_vm=no;; |
531 |
|
|
esac |
532 |
|
|
fi |
533 |
|
|
AC_TRANSLATE_DEFINE(HAVE_MMAP_VM, $have_mmap_vm, |
534 |
|
|
[Define if your system has a working mmap()-based memory allocator.]) |
535 |
|
|
|
536 |
|
|
fi dnl HAVE_MMAP_VM |
537 |
|
|
|
538 |
|
|
dnl Check if we can modify the __PAGEZERO segment for use as Low Memory |
539 |
|
|
AC_CACHE_CHECK([whether __PAGEZERO can be Low Memory area 0x0000-0x3000], |
540 |
|
|
ac_cv_pagezero_hack, [ |
541 |
|
|
ac_cv_pagezero_hack=no |
542 |
|
|
if AC_TRY_COMMAND([Darwin/testlmem.sh 0x3000]); then |
543 |
|
|
ac_cv_pagezero_hack=yes |
544 |
|
|
dnl might as well skip the test for mmap-able low memory |
545 |
|
|
ac_cv_can_map_lm=no |
546 |
|
|
fi |
547 |
|
|
]) |
548 |
|
|
AC_TRANSLATE_DEFINE(PAGEZERO_HACK, "$ac_cv_pagezero_hack", |
549 |
|
|
[Define if the __PAGEZERO Mach-O Low Memory Globals hack works on this system.]) |
550 |
|
|
|
551 |
|
|
dnl Check if we can mmap 0x3000 bytes from 0x0000 |
552 |
|
|
AC_CACHE_CHECK([whether we can map Low Memory area 0x0000-0x3000], |
553 |
|
|
ac_cv_can_map_lm, [ |
554 |
|
|
AC_LANG_SAVE |
555 |
|
|
AC_LANG_CPLUSPLUS |
556 |
|
|
AC_TRY_RUN([ |
557 |
|
|
#include "vm_alloc.cpp" |
558 |
|
|
int main(void) { /* returns 0 if we could map the lowmem globals */ |
559 |
|
|
volatile char * lm = 0; |
560 |
|
|
if (vm_init() < 0) exit(1); |
561 |
|
|
if (vm_acquire_fixed(0, 0x2000) < 0) exit(1); |
562 |
|
|
lm[0] = 'z'; |
563 |
|
|
if (vm_release((char *)lm, 0x2000) < 0) exit(1); |
564 |
|
|
vm_exit(); exit(0); |
565 |
|
|
} |
566 |
|
|
], ac_cv_can_map_lm=yes, ac_cv_can_map_lm=no, |
567 |
|
|
dnl When cross-compiling, do not assume anything. |
568 |
|
|
ac_cv_can_map_lm="guessing no" |
569 |
|
|
) |
570 |
|
|
AC_LANG_RESTORE |
571 |
|
|
] |
572 |
|
|
) |
573 |
|
|
|
574 |
|
|
dnl Check signal handlers need to be reinstalled |
575 |
|
|
AC_CACHE_CHECK([whether signal handlers need to be reinstalled], |
576 |
|
|
ac_cv_signal_need_reinstall, [ |
577 |
|
|
AC_LANG_SAVE |
578 |
|
|
AC_LANG_CPLUSPLUS |
579 |
|
|
AC_TRY_RUN([ |
580 |
|
|
#include <stdlib.h> |
581 |
|
|
#ifdef HAVE_UNISTD_H |
582 |
|
|
#include <unistd.h> |
583 |
|
|
#endif |
584 |
|
|
#include <signal.h> |
585 |
|
|
static int handled_signal = 0; |
586 |
|
|
RETSIGTYPE sigusr1_handler(int) { handled_signal++; } |
587 |
|
|
int main(void) { /* returns 0 if signals need not to be reinstalled */ |
588 |
|
|
signal(SIGUSR1, sigusr1_handler); raise(SIGUSR1); raise(SIGUSR1); |
589 |
|
|
exit(handled_signal == 2); |
590 |
|
|
} |
591 |
|
|
], ac_cv_signal_need_reinstall=yes, ac_cv_signal_need_reinstall=no, |
592 |
|
|
dnl When cross-compiling, do not assume anything. |
593 |
|
|
ac_cv_signal_need_reinstall="guessing yes" |
594 |
|
|
) |
595 |
|
|
AC_LANG_RESTORE |
596 |
|
|
] |
597 |
|
|
) |
598 |
|
|
AC_TRANSLATE_DEFINE(SIGNAL_NEED_REINSTALL, "$ac_cv_signal_need_reinstall", |
599 |
|
|
[Define if your system requires signals to be reinstalled.]) |
600 |
|
|
|
601 |
|
|
dnl Check if sigaction handlers need to be reinstalled |
602 |
|
|
AC_CACHE_CHECK([whether sigaction handlers need to be reinstalled], |
603 |
|
|
ac_cv_sigaction_need_reinstall, [ |
604 |
|
|
AC_LANG_SAVE |
605 |
|
|
AC_LANG_CPLUSPLUS |
606 |
|
|
AC_TRY_RUN([ |
607 |
|
|
#include <stdlib.h> |
608 |
|
|
#ifdef HAVE_UNISTD_H |
609 |
|
|
#include <unistd.h> |
610 |
|
|
#endif |
611 |
|
|
#include <signal.h> |
612 |
|
|
static int handled_signal = 0; |
613 |
|
|
RETSIGTYPE sigusr1_handler(int) { handled_signal++; } |
614 |
|
|
typedef RETSIGTYPE (*signal_handler)(int); |
615 |
|
|
static signal_handler mysignal(int sig, signal_handler handler) { |
616 |
|
|
struct sigaction old_sa; |
617 |
|
|
struct sigaction new_sa; |
618 |
|
|
new_sa.sa_handler = handler; |
619 |
|
|
return ((sigaction(sig,&new_sa,&old_sa) < 0) ? SIG_IGN : old_sa.sa_handler); |
620 |
|
|
} |
621 |
|
|
int main(void) { /* returns 0 if signals need not to be reinstalled */ |
622 |
|
|
mysignal(SIGUSR1, sigusr1_handler); raise(SIGUSR1); raise(SIGUSR1); |
623 |
|
|
exit(handled_signal == 2); |
624 |
|
|
} |
625 |
|
|
], ac_cv_sigaction_need_reinstall=yes, ac_cv_sigaction_need_reinstall=no, |
626 |
|
|
dnl When cross-compiling, do not assume anything. |
627 |
|
|
ac_cv_sigaction_need_reinstall="guessing yes" |
628 |
|
|
) |
629 |
|
|
AC_LANG_RESTORE |
630 |
|
|
] |
631 |
|
|
) |
632 |
|
|
AC_TRANSLATE_DEFINE(SIGACTION_NEED_REINSTALL, "$ac_cv_sigaction_need_reinstall", |
633 |
|
|
[Define if your system requires sigactions to be reinstalled.]) |
634 |
|
|
|
635 |
|
|
dnl Check if Mach exceptions supported. |
636 |
|
|
AC_CACHE_CHECK([whether your system supports Mach exceptions], |
637 |
|
|
ac_cv_have_mach_exceptions, [ |
638 |
|
|
AC_LANG_SAVE |
639 |
|
|
AC_LANG_CPLUSPLUS |
640 |
|
|
AC_TRY_RUN([ |
641 |
|
|
#define HAVE_MACH_EXCEPTIONS 1 |
642 |
|
|
#define CONFIGURE_TEST_SIGSEGV_RECOVERY |
643 |
|
|
#include "vm_alloc.cpp" |
644 |
|
|
#include "sigsegv.cpp" |
645 |
|
|
], |
646 |
|
|
ac_cv_have_mach_exceptions=yes, |
647 |
|
|
ac_cv_have_mach_exceptions=no, |
648 |
|
|
dnl When cross-compiling, do not assume anything. |
649 |
|
|
ac_cv_have_mach_exceptions=no |
650 |
|
|
) |
651 |
|
|
AC_LANG_RESTORE |
652 |
|
|
] |
653 |
|
|
) |
654 |
|
|
if [[ "$ac_cv_have_mach_exceptions" = "yes" ]]; then |
655 |
|
|
sigsegv_recovery=mach |
656 |
|
|
fi |
657 |
|
|
AC_TRANSLATE_DEFINE(HAVE_MACH_EXCEPTIONS, "$ac_cv_have_mach_exceptions", |
658 |
|
|
[Define if your system supports Mach exceptions.]) |
659 |
|
|
|
660 |
|
|
dnl Otherwise, check if extended signals are supported. |
661 |
|
|
if [[ -z "$sigsegv_recovery" ]]; then |
662 |
|
|
AC_CACHE_CHECK([whether your system supports extended signal handlers], |
663 |
|
|
ac_cv_have_extended_signals, [ |
664 |
|
|
AC_LANG_SAVE |
665 |
|
|
AC_LANG_CPLUSPLUS |
666 |
|
|
AC_TRY_RUN([ |
667 |
|
|
#define HAVE_SIGINFO_T 1 |
668 |
|
|
#define CONFIGURE_TEST_SIGSEGV_RECOVERY |
669 |
|
|
#include "vm_alloc.cpp" |
670 |
|
|
#include "sigsegv.cpp" |
671 |
|
|
], |
672 |
|
|
ac_cv_have_extended_signals=yes, |
673 |
|
|
ac_cv_have_extended_signals=no, |
674 |
|
|
dnl When cross-compiling, do not assume anything. |
675 |
|
|
ac_cv_have_extended_signals=no |
676 |
|
|
) |
677 |
|
|
AC_LANG_RESTORE |
678 |
|
|
] |
679 |
|
|
) |
680 |
|
|
if [[ "$ac_cv_have_extended_signals" = "yes" ]]; then |
681 |
|
|
sigsegv_recovery=siginfo |
682 |
|
|
fi |
683 |
|
|
AC_TRANSLATE_DEFINE(HAVE_SIGINFO_T, "$ac_cv_have_extended_signals", |
684 |
|
|
[Define if your system support extended signals.]) |
685 |
|
|
fi |
686 |
|
|
|
687 |
|
|
dnl Otherwise, check for subterfuges. |
688 |
|
|
if [[ -z "$sigsegv_recovery" ]]; then |
689 |
|
|
AC_CACHE_CHECK([whether we then have a subterfuge for your system], |
690 |
|
|
ac_cv_have_sigcontext_hack, [ |
691 |
|
|
AC_LANG_SAVE |
692 |
|
|
AC_LANG_CPLUSPLUS |
693 |
|
|
AC_TRY_RUN([ |
694 |
|
|
#define HAVE_SIGCONTEXT_SUBTERFUGE 1 |
695 |
|
|
#define CONFIGURE_TEST_SIGSEGV_RECOVERY |
696 |
|
|
#include "vm_alloc.cpp" |
697 |
|
|
#include "sigsegv.cpp" |
698 |
|
|
], |
699 |
|
|
ac_cv_have_sigcontext_hack=yes, |
700 |
|
|
ac_cv_have_sigcontext_hack=no, |
701 |
|
|
dnl When cross-compiling, do not assume anything. |
702 |
|
|
ac_cv_have_sigcontext_hack=no |
703 |
|
|
) |
704 |
|
|
AC_LANG_RESTORE |
705 |
|
|
]) |
706 |
|
|
if [[ "$ac_cv_have_sigcontext_hack" = "yes" ]]; then |
707 |
|
|
sigsegv_recovery=sigcontext |
708 |
|
|
fi |
709 |
|
|
AC_TRANSLATE_DEFINE(HAVE_SIGCONTEXT_SUBTERFUGE, "$ac_cv_have_sigcontext_hack", |
710 |
|
|
[Define if we know a hack to replace siginfo_t->si_addr member.]) |
711 |
|
|
fi |
712 |
|
|
|
713 |
|
|
dnl Check if we can ignore the fault (instruction skipping in SIGSEGV handler) |
714 |
|
|
AC_CACHE_CHECK([whether we can skip instruction in SIGSEGV handler], |
715 |
|
|
ac_cv_have_skip_instruction, [ |
716 |
|
|
AC_LANG_SAVE |
717 |
|
|
AC_LANG_CPLUSPLUS |
718 |
|
|
AC_TRY_RUN([ |
719 |
|
|
#define HAVE_SIGSEGV_SKIP_INSTRUCTION 1 |
720 |
|
|
#define CONFIGURE_TEST_SIGSEGV_RECOVERY |
721 |
|
|
#include "vm_alloc.cpp" |
722 |
|
|
#include "sigsegv.cpp" |
723 |
|
|
], ac_cv_have_skip_instruction=yes, ac_cv_have_skip_instruction=no, |
724 |
|
|
dnl When cross-compiling, do not assume anything. |
725 |
|
|
ac_cv_have_skip_instruction=no |
726 |
|
|
) |
727 |
|
|
AC_LANG_RESTORE |
728 |
|
|
] |
729 |
|
|
) |
730 |
|
|
AC_TRANSLATE_DEFINE(HAVE_SIGSEGV_SKIP_INSTRUCTION, "$ac_cv_have_skip_instruction", |
731 |
|
|
[Define if we can ignore the fault (instruction skipping in SIGSEGV handler).]) |
732 |
|
|
|
733 |
|
|
dnl Can we do Video on SEGV Signals ? |
734 |
|
|
CAN_VOSF=no |
735 |
|
|
if [[ -n "$sigsegv_recovery" ]]; then |
736 |
|
|
CAN_VOSF=yes |
737 |
|
|
fi |
738 |
|
|
|
739 |
|
|
dnl Enable VOSF screen updates with this feature is requested and feasible |
740 |
|
|
if [[ "x$WANT_VOSF" = "xyes" -a "x$CAN_VOSF" = "xyes" ]]; then |
741 |
|
|
AC_DEFINE(ENABLE_VOSF, 1, [Define if using video enabled on SEGV signals.]) |
742 |
|
|
else |
743 |
|
|
WANT_VOSF=no |
744 |
|
|
fi |
745 |
|
|
|
746 |
|
|
dnl Platform specific binary postprocessor |
747 |
|
|
AC_PATH_PROG(BLESS, "true") |
748 |
|
|
if [[ "x$ac_cv_pagezero_hack" = "xyes" ]]; then |
749 |
|
|
BLESS=Darwin/lowmem |
750 |
|
|
LDFLAGS="$LDFLAGS -pagezero_size 0x3000" |
751 |
|
|
fi |
752 |
|
|
|
753 |
|
|
dnl Check for GCC 2.7 or higher. |
754 |
|
|
HAVE_GCC27=no |
755 |
|
|
AC_MSG_CHECKING(for GCC 2.7 or higher) |
756 |
|
|
AC_EGREP_CPP(xyes, |
757 |
|
|
[#if __GNUC__ - 1 > 1 || __GNUC_MINOR__ - 1 > 5 |
758 |
|
|
xyes |
759 |
|
|
#endif |
760 |
|
|
], [AC_MSG_RESULT(yes); HAVE_GCC27=yes], AC_MSG_RESULT(no)) |
761 |
|
|
|
762 |
|
|
dnl Check for GCC 3.0 or higher. |
763 |
|
|
HAVE_GCC30=no |
764 |
|
|
AC_MSG_CHECKING(for GCC 3.0 or higher) |
765 |
|
|
AC_EGREP_CPP(xyes, |
766 |
|
|
[#if __GNUC__ >= 3 |
767 |
|
|
xyes |
768 |
|
|
#endif |
769 |
|
|
], [AC_MSG_RESULT(yes); HAVE_GCC30=yes], AC_MSG_RESULT(no)) |
770 |
|
|
|
771 |
|
|
dnl Check for ICC. |
772 |
|
|
AC_MSG_CHECKING(for ICC) |
773 |
|
|
HAVE_ICC=no |
774 |
|
|
if $CXX -V -v 2>&1 | grep -q "Intel(R) C++ Compiler"; then |
775 |
|
|
HAVE_ICC=yes |
776 |
|
|
fi |
777 |
|
|
AC_MSG_RESULT($HAVE_ICC) |
778 |
|
|
|
779 |
|
|
# Test if the compiler can generate ELF objects |
780 |
|
|
AC_CACHE_CHECK([whether the compiler can generate ELF objects], |
781 |
|
|
ac_cv_elf_objects, [ |
782 |
|
|
echo 'int i;' > conftest.$ac_ext |
783 |
|
|
ac_cv_elf_objects=no |
784 |
|
|
if AC_TRY_EVAL(ac_compile); then |
785 |
|
|
case `/usr/bin/file conftest.$ac_objext` in |
786 |
|
|
*"ELF"*) |
787 |
|
|
ac_cv_elf_objects=yes |
788 |
|
|
;; |
789 |
|
|
esac |
790 |
|
|
fi |
791 |
|
|
rm -rf conftest* |
792 |
|
|
]) |
793 |
|
|
ELF_OBJECTS=$ac_cv_elf_objects |
794 |
|
|
|
795 |
|
|
dnl CPU emulator sources |
796 |
|
|
if [[ "x$EMULATED_PPC" = "xyes" ]]; then |
797 |
|
|
CPUSRCS="\ |
798 |
|
|
../kpx_cpu/src/cpu/ppc/ppc-cpu.cpp \ |
799 |
|
|
../kpx_cpu/src/cpu/ppc/ppc-decode.cpp \ |
800 |
|
|
../kpx_cpu/src/cpu/ppc/ppc-execute.cpp \ |
801 |
|
|
../kpx_cpu/src/cpu/ppc/ppc-translate.cpp" |
802 |
|
|
CPPFLAGS="$CPPFLAGS -I../kpx_cpu/include -I../kpx_cpu/src" |
803 |
|
|
|
804 |
|
|
dnl Enable JIT compiler, if possible |
805 |
|
|
if [[ "x$WANT_JIT" = "xyes" ]]; then |
806 |
|
|
AC_CACHE_CHECK([whether dyngen can be used], |
807 |
|
|
ac_cv_use_dyngen, [ |
808 |
|
|
case $host_cpu:$ELF_OBJECTS in |
809 |
|
|
powerpc:yes) |
810 |
|
|
ac_cv_use_dyngen=yes |
811 |
|
|
;; |
812 |
|
|
x86_64:yes) |
813 |
|
|
ac_cv_use_dyngen=yes |
814 |
|
|
;; |
815 |
|
|
i?86:yes) |
816 |
|
|
ac_cv_use_dyngen=yes |
817 |
|
|
;; |
818 |
|
|
*:*) |
819 |
|
|
ac_cv_use_dyngen=no |
820 |
|
|
;; |
821 |
|
|
esac |
822 |
|
|
dnl Check for a suitable synthetic opcodes compiler (icc is faking itself as gcc 3.2.2) |
823 |
|
|
if [[ -z "$DYNGEN_CC" ]]; then |
824 |
|
|
if [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_ICC" = "xno" ]]; then |
825 |
|
|
DYNGEN_CC=$CXX |
826 |
|
|
else |
827 |
|
|
for p in /usr/bin /usr/local/bin; do |
828 |
|
|
gxx="$p/g++" |
829 |
|
|
if [[ -x "$gxx" ]]; then |
830 |
|
|
DYNGEN_CC="$gxx" |
831 |
|
|
fi |
832 |
|
|
done |
833 |
|
|
fi |
834 |
|
|
fi |
835 |
|
|
if [[ -z "$DYNGEN_CC" ]] || ! { echo '#include <limits>' | $DYNGEN_CC -xc++ -c -o /dev/null - >& /dev/null; }; then |
836 |
|
|
ac_cv_use_dyngen=no |
837 |
|
|
fi |
838 |
|
|
]) |
839 |
|
|
if [[ "x$ac_cv_use_dyngen" = "xyes" ]]; then |
840 |
|
|
case $host_cpu in |
841 |
|
|
i?86) |
842 |
|
|
DYNGEN_OP_FLAGS="-fomit-frame-pointer -mpreferred-stack-boundary=2" |
843 |
|
|
if [[ "x$HAVE_GCC30" = "xyes" ]]; then |
844 |
|
|
DYNGEN_OP_FLAGS="$DYNGEN_OP_FLAGS -falign-functions=0" |
845 |
|
|
else |
846 |
|
|
DYNGEN_OP_FLAGS="$DYNGEN_OP_FLAGS -malign-functions=0" |
847 |
|
|
fi |
848 |
|
|
saved_CPPFLAGS=$CPPFLAGS |
849 |
|
|
CPPFLAGS="$CPPFLAGS -mmmx" |
850 |
|
|
AC_CHECK_HEADERS(mmintrin.h, [DYNGEN_OP_FLAGS="$DYNGEN_OP_FLAGS -mmmx"]) |
851 |
|
|
CPPFLAGS="$CPPFLAGS -msse" |
852 |
|
|
AC_CHECK_HEADERS(xmmintrin.h, [DYNGEN_OP_FLAGS="$DYNGEN_OP_FLAGS -msse"]) |
853 |
|
|
CPPFLAGS="$CPPFLAGS -msse2" |
854 |
|
|
AC_CHECK_HEADERS(emmintrin.h, [DYNGEN_OP_FLAGS="$DYNGEN_OP_FLAGS -msse2"]) |
855 |
|
|
CPPFLAGS=$saved_CPPFLAGS |
856 |
|
|
;; |
857 |
|
|
x86_64) |
858 |
|
|
AC_CHECK_HEADERS(mmintrin.h xmmintrin.h emmintrin.h) |
859 |
|
|
;; |
860 |
|
|
esac |
861 |
|
|
DYNGEN_OP_FLAGS="$DYNGEN_OP_FLAGS -finline-limit=10000" |
862 |
|
|
if [[ "x$HAVE_GCC30" = "xyes" ]]; then |
863 |
|
|
DYNGEN_OP_FLAGS="$DYNGEN_OP_FLAGS -fno-reorder-blocks -fno-optimize-sibling-calls" |
864 |
|
|
fi |
865 |
|
|
else |
866 |
|
|
WANT_JIT=no |
867 |
|
|
fi |
868 |
|
|
AC_TRANSLATE_DEFINE(ENABLE_DYNGEN, $ac_cv_use_dyngen, [Define to enable dyngen engine]) |
869 |
|
|
if [[ "x$WANT_JIT" = "xyes" ]]; then |
870 |
|
|
DYNGENSRCS="\ |
871 |
|
|
../kpx_cpu/src/cpu/jit/dyngen.c \ |
872 |
|
|
../kpx_cpu/src/cpu/jit/cxxdemangle.cpp" |
873 |
|
|
CPUSRCS="\ |
874 |
|
|
../kpx_cpu/src/cpu/jit/jit-cache.cpp \ |
875 |
|
|
../kpx_cpu/src/cpu/jit/basic-dyngen.cpp \ |
876 |
|
|
../kpx_cpu/src/cpu/ppc/ppc-dyngen.cpp $CPUSRCS" |
877 |
|
|
fi |
878 |
|
|
fi |
879 |
|
|
CPUSRCS="$CPUSRCS ../kpx_cpu/sheepshaver_glue.cpp" |
880 |
|
|
else |
881 |
|
|
WANT_JIT=no |
882 |
|
|
fi |
883 |
|
|
if [[ "x$ac_cv_use_dyngen" = "xyes" ]]; then |
884 |
|
|
AC_CACHE_CHECK([whether static data regions are executable], |
885 |
|
|
ac_cv_have_static_data_exec, [ |
886 |
|
|
AC_TRY_RUN([int main(void) { |
887 |
|
|
#if defined(__powerpc__) |
888 |
|
|
static unsigned int p[8] = {0x4e800020,}; |
889 |
|
|
asm volatile("dcbst 0,%0" : : "r" (p) : "memory"); |
890 |
|
|
asm volatile("sync" : : : "memory"); |
891 |
|
|
asm volatile("icbi 0,%0" : : "r" (p) : "memory"); |
892 |
|
|
asm volatile("sync" : : : "memory"); |
893 |
|
|
asm volatile("isync" : : : "memory"); |
894 |
|
|
((void (*)(void))p)(); |
895 |
|
|
return 0; |
896 |
|
|
#endif |
897 |
|
|
return 1; |
898 |
|
|
}], ac_cv_have_static_data_exec=yes, ac_cv_have_static_data_exec=no, |
899 |
|
|
dnl When cross-compiling, do not assume anything. |
900 |
|
|
ac_cv_have_static_data_exec=no |
901 |
|
|
) |
902 |
|
|
]) |
903 |
|
|
fi |
904 |
|
|
AC_TRANSLATE_DEFINE(HAVE_STATIC_DATA_EXEC, "$ac_cv_have_static_data_exec", |
905 |
|
|
[Define if your system marks static data pages as executable.]) |
906 |
|
|
|
907 |
|
|
if [[ "x$WANT_JIT" = "xyes" ]]; then |
908 |
|
|
CPPFLAGS="$CPPFLAGS -DUSE_JIT" |
909 |
|
|
fi |
910 |
|
|
|
911 |
|
|
dnl Generate Makefile. |
912 |
|
|
AC_SUBST(DYNGENSRCS) |
913 |
|
|
AC_SUBST(DYNGEN_CC) |
914 |
|
|
AC_SUBST(DYNGEN_OP_FLAGS) |
915 |
|
|
AC_SUBST(SYSSRCS) |
916 |
|
|
AC_SUBST(CPUSRCS) |
917 |
|
|
AC_SUBST(BLESS) |
918 |
|
|
AC_SUBST(KEYCODES) |
919 |
|
|
AC_OUTPUT(Makefile) |
920 |
|
|
|
921 |
|
|
dnl Print summary. |
922 |
|
|
echo |
923 |
|
|
echo SheepShaver configuration summary: |
924 |
|
|
echo |
925 |
|
|
echo SDL support ...................... : $SDL_SUPPORT |
926 |
|
|
echo XFree86 DGA support .............. : $WANT_XF86_DGA |
927 |
|
|
echo XFree86 VidMode support .......... : $WANT_XF86_VIDMODE |
928 |
|
|
echo Using PowerPC emulator ........... : $EMULATED_PPC |
929 |
|
|
echo Enable JIT compiler .............. : $WANT_JIT |
930 |
|
|
echo Enable video on SEGV signals ..... : $WANT_VOSF |
931 |
|
|
echo ESD sound support ................ : $WANT_ESD |
932 |
|
|
echo GTK user interface ............... : $WANT_GTK |
933 |
|
|
echo mon debugger support ............. : $WANT_MON |
934 |
|
|
echo Bad memory access recovery type .. : $sigsegv_recovery |
935 |
|
|
echo |
936 |
|
|
echo "Configuration done. Now type \"make\"." |