5 |
|
AC_PREREQ(2.12) |
6 |
|
AC_CONFIG_HEADER(config.h) |
7 |
|
|
8 |
+ |
dnl Canonical system information. |
9 |
+ |
AC_CANONICAL_HOST |
10 |
+ |
AC_CANONICAL_TARGET |
11 |
+ |
|
12 |
|
dnl Options. |
13 |
+ |
AC_ARG_ENABLE(jit, [ --enable-jit enable JIT compiler [default=yes]], [WANT_JIT=$enableval], [WANT_JIT=yes]) |
14 |
+ |
AC_ARG_ENABLE(ppc-emulator, [ --enable-ppc-emulator use the selected PowerPC emulator [default=auto]], [WANT_EMULATED_PPC=$enableval], [WANT_EMULATED_PPC=auto]) |
15 |
|
AC_ARG_ENABLE(xf86-dga, [ --enable-xf86-dga use the XFree86 DGA extension [default=yes]], [WANT_XF86_DGA=$enableval], [WANT_XF86_DGA=yes]) |
16 |
|
AC_ARG_ENABLE(xf86-vidmode, [ --enable-xf86-vidmode use the XFree86 VidMode extension [default=yes]], [WANT_XF86_VIDMODE=$enableval], [WANT_XF86_VIDMODE=yes]) |
17 |
+ |
AC_ARG_ENABLE(vosf, [ --enable-vosf enable video on SEGV signals [default=yes]], [WANT_VOSF=$enableval], [WANT_VOSF=yes]) |
18 |
|
AC_ARG_WITH(esd, [ --with-esd support ESD for sound under Linux/FreeBSD [default=yes]], [WANT_ESD=$withval], [WANT_ESD=yes]) |
19 |
|
AC_ARG_WITH(gtk, [ --with-gtk use GTK user interface [default=yes]], [WANT_GTK=$withval], [WANT_GTK=yes]) |
20 |
|
AC_ARG_WITH(mon, [ --with-mon use mon as debugger [default=yes]], [WANT_MON=$withval], [WANT_MON=yes]) |
36 |
|
#endif |
37 |
|
], [AC_MSG_RESULT(yes); HAVE_PPC=yes], AC_MSG_RESULT(no)) |
38 |
|
|
39 |
+ |
dnl We use native CPU if possible. |
40 |
+ |
EMULATED_PPC=yes |
41 |
+ |
case $WANT_EMULATED_PPC in |
42 |
+ |
auto) [[ "x$HAVE_PPC" = "xyes" ]] && EMULATED_PPC=no;; |
43 |
+ |
no) EMULATED_PPC=no;; |
44 |
+ |
esac |
45 |
+ |
if [[ "x$EMULATED_PPC" = "xyes" ]]; then |
46 |
+ |
AC_DEFINE(EMULATED_PPC) |
47 |
+ |
fi |
48 |
+ |
|
49 |
|
dnl We use mon if possible. |
50 |
|
MONSRCS= |
51 |
|
if [[ "x$WANT_MON" = "xyes" ]]; then |
85 |
|
|
86 |
|
dnl We need pthreads on non-PowerPC systems. Try libpthread first, then libc_r (FreeBSD), then PTL. |
87 |
|
HAVE_PTHREADS=yes |
88 |
< |
if [[ "x$HAVE_PPC" = "xno" ]]; then |
88 |
> |
if [[ "x$EMULATED_PPC" = "xyes" ]]; then |
89 |
|
AC_CHECK_LIB(pthread, pthread_create, , [ |
90 |
|
AC_CHECK_LIB(c_r, pthread_create, , [ |
91 |
|
AC_CHECK_LIB(PTL, pthread_create, , [ |
94 |
|
]) |
95 |
|
]) |
96 |
|
AC_CHECK_FUNCS(pthread_cancel) |
97 |
+ |
if [[ "x$HAVE_PTHREADS" = "xyes" ]]; then |
98 |
+ |
AC_DEFINE(HAVE_PTHREADS, 1, [Define if pthreads are available.]) |
99 |
+ |
fi |
100 |
|
fi |
101 |
|
|
102 |
|
dnl If POSIX.4 semaphores are not available, we emulate them with pthread mutexes. |
103 |
|
SEMSRC= |
104 |
|
AC_CHECK_FUNCS(sem_init, , [ |
105 |
< |
if [[ "x$HAVE_PTHREADS" = "xyes" ]]; then |
105 |
> |
if test "x$HAVE_PTHREADS" = "xyes"; then |
106 |
|
SEMSRC=posix_sem.cpp |
107 |
|
fi |
108 |
|
]) |
160 |
|
dnl Checks for header files. |
161 |
|
AC_HEADER_STDC |
162 |
|
AC_HEADER_SYS_WAIT |
163 |
< |
AC_CHECK_HEADERS(unistd.h fcntl.h sys/time.h) |
163 |
> |
AC_CHECK_HEADERS(mach/vm_map.h mach/mach_init.h sys/mman.h) |
164 |
> |
AC_CHECK_HEADERS(sys/time.h sys/times.h) |
165 |
> |
AC_CHECK_HEADERS(unistd.h fcntl.h byteswap.h) |
166 |
|
|
167 |
|
dnl Checks for typedefs, structures, and compiler characteristics. |
168 |
|
AC_C_BIGENDIAN |
172 |
|
AC_CHECK_SIZEOF(int, 4) |
173 |
|
AC_CHECK_SIZEOF(long, 4) |
174 |
|
AC_CHECK_SIZEOF(long long, 8) |
175 |
+ |
AC_CHECK_SIZEOF(float, 4) |
176 |
+ |
AC_CHECK_SIZEOF(double, 8) |
177 |
|
AC_CHECK_SIZEOF(void *, 4) |
178 |
|
AC_TYPE_OFF_T |
179 |
|
AC_CHECK_TYPE(loff_t, off_t) |
180 |
|
AC_TYPE_SIZE_T |
181 |
+ |
AC_TYPE_SIGNAL |
182 |
|
AC_HEADER_TIME |
183 |
|
AC_STRUCT_TM |
184 |
|
|
185 |
|
dnl Checks for library functions. |
186 |
|
AC_CHECK_FUNCS(strdup cfmakeraw) |
187 |
|
AC_CHECK_FUNCS(nanosleep clock_gettime timer_create) |
188 |
+ |
AC_CHECK_FUNCS(sigaction signal) |
189 |
+ |
AC_CHECK_FUNCS(mmap mprotect munmap) |
190 |
+ |
AC_CHECK_FUNCS(vm_allocate vm_deallocate vm_protect) |
191 |
|
|
192 |
|
dnl Select system-dependant sources. |
193 |
< |
if [[ "x$HAVE_PPC" = "xyes" ]]; then |
193 |
> |
if [[ "x$EMULATED_PPC" = "xno" ]]; then |
194 |
|
SYSSRCS="Linux/paranoia.cpp Linux/sheepthreads.c Linux/asm_linux.S" |
167 |
– |
else |
168 |
– |
SYSSRCS="../emul_ppc/emul_ppc.cpp" |
195 |
|
fi |
196 |
|
SYSSRCS="$SYSSRCS $SEMSRCS $UISRCS $MONSRCS" |
197 |
|
|
198 |
+ |
dnl Define a macro that translates a yesno-variable into a C macro definition |
199 |
+ |
dnl to be put into the config.h file |
200 |
+ |
dnl $1 -- the macro to define |
201 |
+ |
dnl $2 -- the value to translate |
202 |
+ |
dnl $3 -- template name |
203 |
+ |
AC_DEFUN(AC_TRANSLATE_DEFINE, [ |
204 |
+ |
if [[ "x$2" = "xyes" -o "x$2" = "xguessing yes" ]]; then |
205 |
+ |
AC_DEFINE($1, 1, $3) |
206 |
+ |
fi |
207 |
+ |
]) |
208 |
+ |
|
209 |
+ |
dnl Various checks if the system supports vm_allocate() and the like functions. |
210 |
+ |
have_mach_vm=no |
211 |
+ |
if [[ "x$ac_cv_func_vm_allocate" = "xyes" -a "x$ac_cv_func_vm_deallocate" = "xyes" -a \ |
212 |
+ |
"x$ac_cv_func_vm_protect" = "xyes" ]]; then |
213 |
+ |
have_mach_vm=yes |
214 |
+ |
fi |
215 |
+ |
AC_TRANSLATE_DEFINE(HAVE_MACH_VM, "$have_mach_vm", |
216 |
+ |
[Define if your system has a working vm_allocate()-based memory allocator.]) |
217 |
+ |
|
218 |
+ |
dnl Check that vm_allocate(), vm_protect() work |
219 |
+ |
if [[ "x$have_mach_vm" = "xyes" ]]; then |
220 |
+ |
|
221 |
+ |
AC_CACHE_CHECK([whether vm_protect works], |
222 |
+ |
ac_cv_vm_protect_works, [ |
223 |
+ |
AC_LANG_SAVE |
224 |
+ |
AC_LANG_CPLUSPLUS |
225 |
+ |
ac_cv_vm_protect_works=yes |
226 |
+ |
dnl First the tests that should segfault |
227 |
+ |
for test_def in NONE_READ NONE_WRITE READ_WRITE; do |
228 |
+ |
AC_TRY_RUN([ |
229 |
+ |
#define CONFIGURE_TEST_VM_MAP |
230 |
+ |
#define TEST_VM_PROT_$test_def |
231 |
+ |
#include "vm_alloc.cpp" |
232 |
+ |
], ac_cv_vm_protect_works=no, rm -f core, |
233 |
+ |
dnl When cross-compiling, do not assume anything |
234 |
+ |
ac_cv_vm_protect_works="guessing no" |
235 |
+ |
) |
236 |
+ |
done |
237 |
+ |
AC_TRY_RUN([ |
238 |
+ |
#define CONFIGURE_TEST_VM_MAP |
239 |
+ |
#define TEST_VM_PROT_RDWR_WRITE |
240 |
+ |
#include "vm_alloc.cpp" |
241 |
+ |
], , ac_cv_vm_protect_works=no, |
242 |
+ |
dnl When cross-compiling, do not assume anything |
243 |
+ |
ac_cv_vm_protect_works="guessing no" |
244 |
+ |
) |
245 |
+ |
AC_LANG_RESTORE |
246 |
+ |
] |
247 |
+ |
) |
248 |
+ |
|
249 |
+ |
dnl Remove support for vm_allocate() if vm_protect() does not work |
250 |
+ |
if [[ "x$have_mach_vm" = "xyes" ]]; then |
251 |
+ |
case $ac_cv_vm_protect_works in |
252 |
+ |
*yes) have_mach_vm=yes;; |
253 |
+ |
*no) have_mach_vm=no;; |
254 |
+ |
esac |
255 |
+ |
fi |
256 |
+ |
AC_TRANSLATE_DEFINE(HAVE_MACH_VM, "$have_mach_vm", |
257 |
+ |
[Define if your system has a working vm_allocate()-based memory allocator.]) |
258 |
+ |
|
259 |
+ |
fi dnl HAVE_MACH_VM |
260 |
+ |
|
261 |
+ |
dnl Various checks if the system supports mmap() and the like functions. |
262 |
+ |
dnl ... and Mach memory allocators are not supported |
263 |
+ |
have_mmap_vm=no |
264 |
+ |
if [[ "x$ac_cv_func_mmap" = "xyes" -a "x$ac_cv_func_munmap" = "xyes" -a \ |
265 |
+ |
"x$ac_cv_func_mprotect" = "xyes" ]]; then |
266 |
+ |
if [[ "x$have_mach_vm" = "xno" ]]; then |
267 |
+ |
have_mmap_vm=yes |
268 |
+ |
fi |
269 |
+ |
fi |
270 |
+ |
AC_TRANSLATE_DEFINE(HAVE_MMAP_VM, "$have_mmap_vm", |
271 |
+ |
[Define if your system has a working mmap()-based memory allocator.]) |
272 |
+ |
|
273 |
+ |
dnl Check that mmap() and associated functions work. |
274 |
+ |
if [[ "x$have_mmap_vm" = "xyes" ]]; then |
275 |
+ |
|
276 |
+ |
dnl Check if we have a working anonymous mmap() |
277 |
+ |
AC_CACHE_CHECK([whether mmap supports MAP_ANON], |
278 |
+ |
ac_cv_mmap_anon, [ |
279 |
+ |
AC_LANG_SAVE |
280 |
+ |
AC_LANG_CPLUSPLUS |
281 |
+ |
AC_TRY_RUN([ |
282 |
+ |
#define HAVE_MMAP_ANON |
283 |
+ |
#define CONFIGURE_TEST_VM_MAP |
284 |
+ |
#define TEST_VM_MMAP_ANON |
285 |
+ |
#include "vm_alloc.cpp" |
286 |
+ |
], ac_cv_mmap_anon=yes, ac_cv_mmap_anon=no, |
287 |
+ |
dnl When cross-compiling, do not assume anything. |
288 |
+ |
ac_cv_mmap_anon="guessing no" |
289 |
+ |
) |
290 |
+ |
AC_LANG_RESTORE |
291 |
+ |
] |
292 |
+ |
) |
293 |
+ |
AC_TRANSLATE_DEFINE(HAVE_MMAP_ANON, "$ac_cv_mmap_anon", |
294 |
+ |
[Define if <sys/mman.h> defines MAP_ANON and mmap()'ing with MAP_ANON works.]) |
295 |
+ |
|
296 |
+ |
AC_CACHE_CHECK([whether mmap supports MAP_ANONYMOUS], |
297 |
+ |
ac_cv_mmap_anonymous, [ |
298 |
+ |
AC_LANG_SAVE |
299 |
+ |
AC_LANG_CPLUSPLUS |
300 |
+ |
AC_TRY_RUN([ |
301 |
+ |
#define HAVE_MMAP_ANONYMOUS |
302 |
+ |
#define CONFIGURE_TEST_VM_MAP |
303 |
+ |
#define TEST_VM_MMAP_ANON |
304 |
+ |
#include "vm_alloc.cpp" |
305 |
+ |
], ac_cv_mmap_anonymous=yes, ac_cv_mmap_anonymous=no, |
306 |
+ |
dnl When cross-compiling, do not assume anything. |
307 |
+ |
ac_cv_mmap_anonymous="guessing no" |
308 |
+ |
) |
309 |
+ |
AC_LANG_RESTORE |
310 |
+ |
] |
311 |
+ |
) |
312 |
+ |
AC_TRANSLATE_DEFINE(HAVE_MMAP_ANONYMOUS, "$ac_cv_mmap_anonymous", |
313 |
+ |
[Define if <sys/mman.h> defines MAP_ANONYMOUS and mmap()'ing with MAP_ANONYMOUS works.]) |
314 |
+ |
|
315 |
+ |
AC_CACHE_CHECK([whether mprotect works], |
316 |
+ |
ac_cv_mprotect_works, [ |
317 |
+ |
AC_LANG_SAVE |
318 |
+ |
AC_LANG_CPLUSPLUS |
319 |
+ |
ac_cv_mprotect_works=yes |
320 |
+ |
dnl First the tests that should segfault |
321 |
+ |
for test_def in NONE_READ NONE_WRITE READ_WRITE; do |
322 |
+ |
AC_TRY_RUN([ |
323 |
+ |
#define CONFIGURE_TEST_VM_MAP |
324 |
+ |
#define TEST_VM_PROT_$test_def |
325 |
+ |
#include "vm_alloc.cpp" |
326 |
+ |
], ac_cv_mprotect_works=no, rm -f core, |
327 |
+ |
dnl When cross-compiling, do not assume anything |
328 |
+ |
ac_cv_mprotect_works="guessing no" |
329 |
+ |
) |
330 |
+ |
done |
331 |
+ |
AC_TRY_RUN([ |
332 |
+ |
#define CONFIGURE_TEST_VM_MAP |
333 |
+ |
#define TEST_VM_PROT_RDWR_WRITE |
334 |
+ |
#include "vm_alloc.cpp" |
335 |
+ |
], , ac_cv_mprotect_works=no, |
336 |
+ |
dnl When cross-compiling, do not assume anything |
337 |
+ |
ac_cv_mprotect_works="guessing no" |
338 |
+ |
) |
339 |
+ |
AC_LANG_RESTORE |
340 |
+ |
] |
341 |
+ |
) |
342 |
+ |
|
343 |
+ |
dnl Remove support for mmap() if mprotect() does not work |
344 |
+ |
if [[ "x$have_mmap_vm" = "xyes" ]]; then |
345 |
+ |
case $ac_cv_mprotect_works in |
346 |
+ |
*yes) have_mmap_vm=yes;; |
347 |
+ |
*no) have_mmap_vm=no;; |
348 |
+ |
esac |
349 |
+ |
fi |
350 |
+ |
AC_TRANSLATE_DEFINE(HAVE_MMAP_VM, $have_mmap_vm, |
351 |
+ |
[Define if your system has a working mmap()-based memory allocator.]) |
352 |
+ |
|
353 |
+ |
fi dnl HAVE_MMAP_VM |
354 |
+ |
|
355 |
+ |
dnl Check if we can mmap 0x2000 bytes from 0x0000 |
356 |
+ |
AC_CACHE_CHECK([whether we can map Low Memory area 0x0000-0x2000], |
357 |
+ |
ac_cv_can_map_lm, [ |
358 |
+ |
AC_LANG_SAVE |
359 |
+ |
AC_LANG_CPLUSPLUS |
360 |
+ |
AC_TRY_RUN([ |
361 |
+ |
#include "vm_alloc.cpp" |
362 |
+ |
int main(void) { /* returns 0 if we could map the lowmem globals */ |
363 |
+ |
volatile char * lm = 0; |
364 |
+ |
if (vm_init() < 0) exit(1); |
365 |
+ |
if (vm_acquire_fixed(0, 0x2000) < 0) exit(1); |
366 |
+ |
lm[0] = 'z'; |
367 |
+ |
if (vm_release((char *)lm, 0x2000) < 0) exit(1); |
368 |
+ |
vm_exit(); exit(0); |
369 |
+ |
} |
370 |
+ |
], ac_cv_can_map_lm=yes, ac_cv_can_map_lm=no, |
371 |
+ |
dnl When cross-compiling, do not assume anything. |
372 |
+ |
ac_cv_can_map_lm="guessing no" |
373 |
+ |
) |
374 |
+ |
AC_LANG_RESTORE |
375 |
+ |
] |
376 |
+ |
) |
377 |
+ |
|
378 |
+ |
dnl Check signal handlers need to be reinstalled |
379 |
+ |
AC_CACHE_CHECK([whether signal handlers need to be reinstalled], |
380 |
+ |
ac_cv_signal_need_reinstall, [ |
381 |
+ |
AC_LANG_SAVE |
382 |
+ |
AC_LANG_CPLUSPLUS |
383 |
+ |
AC_TRY_RUN([ |
384 |
+ |
#include <stdlib.h> |
385 |
+ |
#ifdef HAVE_UNISTD_H |
386 |
+ |
#include <unistd.h> |
387 |
+ |
#endif |
388 |
+ |
#include <signal.h> |
389 |
+ |
static int handled_signal = 0; |
390 |
+ |
RETSIGTYPE sigusr1_handler(int) { handled_signal++; } |
391 |
+ |
int main(void) { /* returns 0 if signals need not to be reinstalled */ |
392 |
+ |
signal(SIGUSR1, sigusr1_handler); raise(SIGUSR1); raise(SIGUSR1); |
393 |
+ |
exit(handled_signal == 2); |
394 |
+ |
} |
395 |
+ |
], ac_cv_signal_need_reinstall=yes, ac_cv_signal_need_reinstall=no, |
396 |
+ |
dnl When cross-compiling, do not assume anything. |
397 |
+ |
ac_cv_signal_need_reinstall="guessing yes" |
398 |
+ |
) |
399 |
+ |
AC_LANG_RESTORE |
400 |
+ |
] |
401 |
+ |
) |
402 |
+ |
AC_TRANSLATE_DEFINE(SIGNAL_NEED_REINSTALL, "$ac_cv_signal_need_reinstall", |
403 |
+ |
[Define if your system requires signals to be reinstalled.]) |
404 |
+ |
|
405 |
+ |
dnl Check if sigaction handlers need to be reinstalled |
406 |
+ |
AC_CACHE_CHECK([whether sigaction handlers need to be reinstalled], |
407 |
+ |
ac_cv_sigaction_need_reinstall, [ |
408 |
+ |
AC_LANG_SAVE |
409 |
+ |
AC_LANG_CPLUSPLUS |
410 |
+ |
AC_TRY_RUN([ |
411 |
+ |
#include <stdlib.h> |
412 |
+ |
#ifdef HAVE_UNISTD_H |
413 |
+ |
#include <unistd.h> |
414 |
+ |
#endif |
415 |
+ |
#include <signal.h> |
416 |
+ |
static int handled_signal = 0; |
417 |
+ |
RETSIGTYPE sigusr1_handler(int) { handled_signal++; } |
418 |
+ |
typedef RETSIGTYPE (*signal_handler)(int); |
419 |
+ |
static signal_handler mysignal(int sig, signal_handler handler) { |
420 |
+ |
struct sigaction old_sa; |
421 |
+ |
struct sigaction new_sa; |
422 |
+ |
new_sa.sa_handler = handler; |
423 |
+ |
return ((sigaction(sig,&new_sa,&old_sa) < 0) ? SIG_IGN : old_sa.sa_handler); |
424 |
+ |
} |
425 |
+ |
int main(void) { /* returns 0 if signals need not to be reinstalled */ |
426 |
+ |
mysignal(SIGUSR1, sigusr1_handler); raise(SIGUSR1); raise(SIGUSR1); |
427 |
+ |
exit(handled_signal == 2); |
428 |
+ |
} |
429 |
+ |
], ac_cv_sigaction_need_reinstall=yes, ac_cv_sigaction_need_reinstall=no, |
430 |
+ |
dnl When cross-compiling, do not assume anything. |
431 |
+ |
ac_cv_sigaction_need_reinstall="guessing yes" |
432 |
+ |
) |
433 |
+ |
AC_LANG_RESTORE |
434 |
+ |
] |
435 |
+ |
) |
436 |
+ |
AC_TRANSLATE_DEFINE(SIGACTION_NEED_REINSTALL, "$ac_cv_sigaction_need_reinstall", |
437 |
+ |
[Define if your system requires sigactions to be reinstalled.]) |
438 |
+ |
|
439 |
+ |
dnl Check if extended signals are supported. |
440 |
+ |
AC_CACHE_CHECK([whether your system supports extended signal handlers], |
441 |
+ |
ac_cv_have_extended_signals, [ |
442 |
+ |
AC_LANG_SAVE |
443 |
+ |
AC_LANG_CPLUSPLUS |
444 |
+ |
AC_TRY_RUN([ |
445 |
+ |
#define HAVE_SIGINFO_T 1 |
446 |
+ |
#define CONFIGURE_TEST_SIGSEGV_RECOVERY |
447 |
+ |
#include "vm_alloc.cpp" |
448 |
+ |
#include "sigsegv.cpp" |
449 |
+ |
], ac_cv_have_extended_signals=yes, ac_cv_have_extended_signals=no, |
450 |
+ |
dnl When cross-compiling, do not assume anything. |
451 |
+ |
ac_cv_have_extended_signals=no |
452 |
+ |
) |
453 |
+ |
AC_LANG_RESTORE |
454 |
+ |
] |
455 |
+ |
) |
456 |
+ |
AC_TRANSLATE_DEFINE(HAVE_SIGINFO_T, "$ac_cv_have_extended_signals", |
457 |
+ |
[Define if your system support extended signals.]) |
458 |
+ |
|
459 |
+ |
dnl Otherwise, check for subterfuges. |
460 |
+ |
if [[ "x$ac_cv_have_extended_signals" = "xno" ]]; then |
461 |
+ |
AC_CACHE_CHECK([whether we then have a subterfuge for your system], |
462 |
+ |
ac_cv_have_sigcontext_hack, [ |
463 |
+ |
AC_LANG_SAVE |
464 |
+ |
AC_LANG_CPLUSPLUS |
465 |
+ |
AC_TRY_RUN([ |
466 |
+ |
#define HAVE_SIGCONTEXT_SUBTERFUGE 1 |
467 |
+ |
#define CONFIGURE_TEST_SIGSEGV_RECOVERY |
468 |
+ |
#include "vm_alloc.cpp" |
469 |
+ |
#include "sigsegv.cpp" |
470 |
+ |
], ac_cv_have_sigcontext_hack=yes, ac_cv_have_sigcontext_hack=no, |
471 |
+ |
dnl When cross-compiling, do not assume anything. |
472 |
+ |
ac_cv_have_sigcontext_hack=no |
473 |
+ |
) |
474 |
+ |
AC_LANG_RESTORE |
475 |
+ |
]) |
476 |
+ |
AC_TRANSLATE_DEFINE(HAVE_SIGCONTEXT_SUBTERFUGE, "$ac_cv_have_sigcontext_hack", |
477 |
+ |
[Define if we know a hack to replace siginfo_t->si_addr member.]) |
478 |
+ |
fi |
479 |
+ |
|
480 |
+ |
dnl Check if we can ignore the fault (instruction skipping in SIGSEGV handler) |
481 |
+ |
AC_CACHE_CHECK([whether we can skip instruction in SIGSEGV handler], |
482 |
+ |
ac_cv_have_skip_instruction, [ |
483 |
+ |
AC_LANG_SAVE |
484 |
+ |
AC_LANG_CPLUSPLUS |
485 |
+ |
AC_TRY_RUN([ |
486 |
+ |
#define HAVE_SIGSEGV_SKIP_INSTRUCTION 1 |
487 |
+ |
#define CONFIGURE_TEST_SIGSEGV_RECOVERY |
488 |
+ |
#include "vm_alloc.cpp" |
489 |
+ |
#include "sigsegv.cpp" |
490 |
+ |
], ac_cv_have_skip_instruction=yes, ac_cv_have_skip_instruction=no, |
491 |
+ |
dnl When cross-compiling, do not assume anything. |
492 |
+ |
ac_cv_have_skip_instruction=no |
493 |
+ |
) |
494 |
+ |
AC_LANG_RESTORE |
495 |
+ |
] |
496 |
+ |
) |
497 |
+ |
AC_TRANSLATE_DEFINE(HAVE_SIGSEGV_SKIP_INSTRUCTION, "$ac_cv_have_skip_instruction", |
498 |
+ |
[Define if we can ignore the fault (instruction skipping in SIGSEGV handler).]) |
499 |
+ |
|
500 |
+ |
dnl Can we do Video on SEGV Signals ? |
501 |
+ |
CAN_VOSF=no |
502 |
+ |
if [[ "$ac_cv_have_extended_signals" = "yes" -o "$ac_cv_have_sigcontext_hack" = "yes" ]]; then |
503 |
+ |
CAN_VOSF=yes |
504 |
+ |
fi |
505 |
+ |
|
506 |
+ |
dnl Enable VOSF screen updates with this feature is requested and feasible |
507 |
+ |
if [[ "x$WANT_VOSF" = "xyes" -a "x$CAN_VOSF" = "xyes" ]]; then |
508 |
+ |
AC_DEFINE(ENABLE_VOSF, 1, [Define if using video enabled on SEGV signals.]) |
509 |
+ |
else |
510 |
+ |
WANT_VOSF=no |
511 |
+ |
fi |
512 |
+ |
|
513 |
+ |
dnl Check for GCC 2.7 or higher. |
514 |
+ |
HAVE_GCC27=no |
515 |
+ |
AC_MSG_CHECKING(for GCC 2.7 or higher) |
516 |
+ |
AC_EGREP_CPP(xyes, |
517 |
+ |
[#if __GNUC__ - 1 > 1 || __GNUC_MINOR__ - 1 > 5 |
518 |
+ |
xyes |
519 |
+ |
#endif |
520 |
+ |
], [AC_MSG_RESULT(yes); HAVE_GCC27=yes], AC_MSG_RESULT(no)) |
521 |
+ |
|
522 |
+ |
dnl Check for GCC 3.0 or higher. |
523 |
+ |
HAVE_GCC30=no |
524 |
+ |
AC_MSG_CHECKING(for GCC 3.0 or higher) |
525 |
+ |
AC_EGREP_CPP(xyes, |
526 |
+ |
[#if __GNUC__ >= 3 |
527 |
+ |
xyes |
528 |
+ |
#endif |
529 |
+ |
], [AC_MSG_RESULT(yes); HAVE_GCC30=yes], AC_MSG_RESULT(no)) |
530 |
+ |
|
531 |
+ |
# Test if the compiler can generate ELF objects |
532 |
+ |
AC_CACHE_CHECK([whether the compiler can generate ELF objects], |
533 |
+ |
ac_cv_elf_objects, [ |
534 |
+ |
echo 'int i;' > conftest.$ac_ext |
535 |
+ |
ac_cv_elf_objects=no |
536 |
+ |
if AC_TRY_EVAL(ac_compile); then |
537 |
+ |
case `/usr/bin/file conftest.$ac_objext` in |
538 |
+ |
*"ELF"*) |
539 |
+ |
ac_cv_elf_objects=yes |
540 |
+ |
;; |
541 |
+ |
esac |
542 |
+ |
fi |
543 |
+ |
rm -rf conftest* |
544 |
+ |
]) |
545 |
+ |
ELF_OBJECTS=$ac_cv_elf_objects |
546 |
+ |
|
547 |
+ |
dnl FIXME: forcibly disable JIT for now |
548 |
+ |
WANT_JIT=no |
549 |
+ |
|
550 |
+ |
dnl CPU emulator sources |
551 |
+ |
if [[ "x$EMULATED_PPC" = "xyes" ]]; then |
552 |
+ |
CPUSRCS="\ |
553 |
+ |
../kpx_cpu/src/cpu/ppc/ppc-cpu.cpp \ |
554 |
+ |
../kpx_cpu/src/cpu/ppc/ppc-decode.cpp \ |
555 |
+ |
../kpx_cpu/src/cpu/ppc/ppc-execute.cpp \ |
556 |
+ |
../kpx_cpu/src/cpu/ppc/ppc-translate.cpp" |
557 |
+ |
CPPFLAGS="$CPPFLAGS -I../kpx_cpu/include -I../kpx_cpu/src" |
558 |
+ |
|
559 |
+ |
dnl Enable JIT compiler, if possible |
560 |
+ |
if [[ "x$WANT_JIT" = "xyes" ]]; then |
561 |
+ |
AC_CACHE_CHECK([whether dyngen can be used], |
562 |
+ |
ac_cv_use_dyngen, [ |
563 |
+ |
case $host_cpu:$ELF_OBJECTS in |
564 |
+ |
powerpc:yes) |
565 |
+ |
ac_cv_use_dyngen=yes |
566 |
+ |
;; |
567 |
+ |
x86_64:yes) |
568 |
+ |
ac_cv_use_dyngen=yes |
569 |
+ |
;; |
570 |
+ |
i?86:yes) |
571 |
+ |
ac_cv_use_dyngen=yes |
572 |
+ |
;; |
573 |
+ |
*:*) |
574 |
+ |
ac_cv_use_dyngen=no |
575 |
+ |
;; |
576 |
+ |
esac |
577 |
+ |
]) |
578 |
+ |
if [[ "x$ac_cv_use_dyngen" = "xyes" ]]; then |
579 |
+ |
case $host_cpu in |
580 |
+ |
i?86:yes) |
581 |
+ |
DYNGEN_OP_FLAGS="-fomit-frame-pointer -mpreferred-stack-boundary=2" |
582 |
+ |
if [[ "x$HAVE_GCC30" = "xyes" ]]; then |
583 |
+ |
DYNGEN_OP_FLAGS="$DYNGEN_OP_FLAGS -falign-functions=0" |
584 |
+ |
else |
585 |
+ |
DYNGEN_OP_FLAGS="$DYNGEN_OP_FLAGS -malign-functions=0" |
586 |
+ |
fi |
587 |
+ |
;; |
588 |
+ |
esac |
589 |
+ |
DYNGEN_OP_FLAGS="$DYNGEN_OP_FLAGS -finline-limit=2000" |
590 |
+ |
if [[ "x$HAVE_GCC30" = "xyes" ]]; then |
591 |
+ |
DYNGEN_OP_FLAGS="$DYNGEN_OP_FLAGS -fno-reorder-blocks -fno-optimize-sibling-calls" |
592 |
+ |
fi |
593 |
+ |
else |
594 |
+ |
WANT_JIT=no |
595 |
+ |
fi |
596 |
+ |
AC_TRANSLATE_DEFINE(ENABLE_DYNGEN, $ac_cv_use_dyngen, [Define to enable dyngen engine]) |
597 |
+ |
if [[ "x$WANT_JIT" = "xyes" ]]; then |
598 |
+ |
DYNGENSRCS="\ |
599 |
+ |
../kpx_cpu/src/cpu/jit/dyngen.c \ |
600 |
+ |
../kpx_cpu/src/cpu/jit/cxxdemangle.cpp" |
601 |
+ |
CPUSRCS="\ |
602 |
+ |
../kpx_cpu/src/cpu/jit/jit-cache.cpp \ |
603 |
+ |
../kpx_cpu/src/cpu/jit/basic-dyngen.cpp \ |
604 |
+ |
../kpx_cpu/src/cpu/ppc/ppc-dyngen.cpp $CPUSRCS" |
605 |
+ |
fi |
606 |
+ |
fi |
607 |
+ |
CPUSRCS="$CPUSRCS ../kpx_cpu/sheepshaver_glue.cpp" |
608 |
+ |
fi |
609 |
+ |
|
610 |
|
dnl Generate Makefile. |
611 |
+ |
AC_SUBST(DYNGENSRCS) |
612 |
+ |
AC_SUBST(DYNGEN_OP_FLAGS) |
613 |
|
AC_SUBST(SYSSRCS) |
614 |
+ |
AC_SUBST(CPUSRCS) |
615 |
|
AC_OUTPUT(Makefile) |
616 |
|
|
617 |
|
dnl Print summary. |
620 |
|
echo |
621 |
|
echo XFree86 DGA support .............. : $WANT_XF86_DGA |
622 |
|
echo XFree86 VidMode support .......... : $WANT_XF86_VIDMODE |
623 |
+ |
echo Using PowerPC emulator ........... : $EMULATED_PPC |
624 |
+ |
echo Enable JIT compiler .............. : $WANT_JIT |
625 |
+ |
echo Enable video on SEGV signals ..... : $WANT_VOSF |
626 |
|
echo ESD sound support ................ : $WANT_ESD |
627 |
|
echo GTK user interface ............... : $WANT_GTK |
628 |
|
echo mon debugger support ............. : $WANT_MON |