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]) |
21 |
+ |
AC_ARG_WITH(dgcc, [ --with-dgcc=COMPILER use C++ COMPILER to compile synthetic opcodes], [DYNGEN_CC=$withval]) |
22 |
|
|
23 |
|
dnl Checks for programs. |
24 |
|
AC_PROG_CC |
35 |
|
#ifdef __powerpc__ |
36 |
|
yes |
37 |
|
#endif |
38 |
+ |
#ifdef __ppc__ |
39 |
+ |
yes |
40 |
+ |
#endif |
41 |
|
], [AC_MSG_RESULT(yes); HAVE_PPC=yes], AC_MSG_RESULT(no)) |
42 |
|
|
43 |
|
dnl We use native CPU if possible. |
97 |
|
|
98 |
|
dnl We need pthreads on non-PowerPC systems. Try libpthread first, then libc_r (FreeBSD), then PTL. |
99 |
|
HAVE_PTHREADS=yes |
100 |
< |
if [[ "x$EMULATED_PPC" = "xyes" ]]; then |
100 |
> |
case $EMULATED_PPC:$target_os in |
101 |
> |
no:linux*) |
102 |
> |
dnl We do have our own pthread_cancel() implementation |
103 |
> |
AC_DEFINE(HAVE_PTHREAD_CANCEL, 1, [Define if you have the pthread_cancel function.]) |
104 |
> |
;; |
105 |
> |
*:*) |
106 |
|
AC_CHECK_LIB(pthread, pthread_create, , [ |
107 |
|
AC_CHECK_LIB(c_r, pthread_create, , [ |
108 |
|
AC_CHECK_LIB(PTL, pthread_create, , [ |
111 |
|
]) |
112 |
|
]) |
113 |
|
AC_CHECK_FUNCS(pthread_cancel) |
114 |
+ |
AC_CHECK_FUNCS(pthread_mutexattr_setprotocol) |
115 |
+ |
AC_CHECK_FUNCS(pthread_mutexattr_settype) |
116 |
+ |
AC_CHECK_FUNCS(pthread_mutexattr_setpshared) |
117 |
|
if [[ "x$HAVE_PTHREADS" = "xyes" ]]; then |
118 |
|
AC_DEFINE(HAVE_PTHREADS, 1, [Define if pthreads are available.]) |
119 |
|
fi |
120 |
< |
else |
121 |
< |
dnl We do have our own pthread_cancel() implementation |
122 |
< |
AC_DEFINE(HAVE_PTHREAD_CANCEL, 1, [Define if you have the pthread_cancel function.]) |
111 |
< |
fi |
112 |
< |
|
113 |
< |
dnl If POSIX.4 semaphores are not available, we emulate them with pthread mutexes. |
114 |
< |
SEMSRC= |
115 |
< |
AC_CHECK_FUNCS(sem_init, , [ |
120 |
> |
dnl If POSIX.4 semaphores are not available, we emulate them with pthread mutexes. |
121 |
> |
SEMSRC= |
122 |
> |
AC_CHECK_FUNCS(sem_init, , [ |
123 |
|
if test "x$HAVE_PTHREADS" = "xyes"; then |
124 |
|
SEMSRC=posix_sem.cpp |
125 |
|
fi |
126 |
< |
]) |
126 |
> |
]) |
127 |
> |
;; |
128 |
> |
esac |
129 |
|
|
130 |
|
dnl We use XFree86 DGA if possible. |
131 |
|
if [[ "x$WANT_XF86_DGA" = "xyes" ]]; then |
150 |
|
fi |
151 |
|
|
152 |
|
dnl We use GTK+ if possible. |
153 |
< |
UISRCS= |
153 |
> |
UISRCS=../dummy/prefs_editor_dummy.cpp |
154 |
|
if [[ "x$WANT_GTK" = "xyes" ]]; then |
155 |
|
AM_PATH_GTK(1.2.0, [ |
156 |
|
AC_DEFINE(ENABLE_GTK) |
202 |
|
AC_HEADER_TIME |
203 |
|
AC_STRUCT_TM |
204 |
|
|
205 |
+ |
dnl Check whether struct sigaction has sa_restorer member. |
206 |
+ |
AC_CACHE_CHECK([whether struct sigaction has sa_restorer], |
207 |
+ |
ac_cv_signal_sa_restorer, [ |
208 |
+ |
AC_TRY_COMPILE([ |
209 |
+ |
#include <signal.h> |
210 |
+ |
], [struct sigaction sa; sa.sa_restorer = 0;], |
211 |
+ |
ac_cv_signal_sa_restorer=yes, ac_cv_signal_sa_restorer=no, |
212 |
+ |
dnl When cross-compiling, do not assume anything. |
213 |
+ |
ac_cv_signal_sa_restorer=no |
214 |
+ |
) |
215 |
+ |
]) |
216 |
+ |
if [[ "x$ac_cv_signal_sa_restorer" = "xyes" ]]; then |
217 |
+ |
AC_DEFINE(HAVE_SIGNAL_SA_RESTORER) |
218 |
+ |
fi |
219 |
+ |
|
220 |
|
dnl Checks for library functions. |
221 |
|
AC_CHECK_FUNCS(strdup cfmakeraw) |
222 |
< |
AC_CHECK_FUNCS(nanosleep clock_gettime timer_create) |
222 |
> |
AC_CHECK_FUNCS(nanosleep) |
223 |
|
AC_CHECK_FUNCS(sigaction signal) |
224 |
|
AC_CHECK_FUNCS(mmap mprotect munmap) |
225 |
|
AC_CHECK_FUNCS(vm_allocate vm_deallocate vm_protect) |
226 |
|
|
227 |
+ |
dnl Darwin seems to define mach_task_self() instead of task_self(). |
228 |
+ |
AC_CHECK_FUNCS(mach_task_self task_self) |
229 |
+ |
|
230 |
+ |
dnl We need clock_gettime() for better performance but it may drag |
231 |
+ |
dnl libpthread in, which we don't want for native ppc mode |
232 |
+ |
case $EMULATED_PPC:$target_os in |
233 |
+ |
no:linux*) |
234 |
+ |
;; |
235 |
+ |
*:*) |
236 |
+ |
AC_SEARCH_LIBS(clock_gettime, [rt posix4]) |
237 |
+ |
AC_CHECK_FUNCS(clock_gettime) |
238 |
+ |
;; |
239 |
+ |
esac |
240 |
+ |
|
241 |
|
dnl Select system-dependant sources. |
242 |
< |
if [[ "x$EMULATED_PPC" = "xno" ]]; then |
243 |
< |
SYSSRCS="Linux/paranoia.cpp Linux/sheepthreads.c Linux/asm_linux.S" |
244 |
< |
fi |
245 |
< |
SYSSRCS="$SYSSRCS $SEMSRCS $UISRCS $MONSRCS" |
242 |
> |
SERIALSRC=serial_unix.cpp |
243 |
> |
ETHERSRC=../dummy/ether_dummy.cpp |
244 |
> |
SCSISRC=../dummy/scsi_dummy.cpp |
245 |
> |
AUDIOSRC=../dummy/audio_dummy.cpp |
246 |
> |
EXTRASYSSRCS= |
247 |
> |
case "$target_os" in |
248 |
> |
linux*) |
249 |
> |
ETHERSRC=Linux/ether_linux.cpp |
250 |
> |
AUDIOSRC=audio_oss_esd.cpp |
251 |
> |
SCSISRC=Linux/scsi_linux.cpp |
252 |
> |
if [[ "x$EMULATED_PPC" = "xno" ]]; then |
253 |
> |
EXTRASYSSRCS="Linux/paranoia.cpp Linux/sheepthreads.c Linux/asm_linux.S" |
254 |
> |
fi |
255 |
> |
;; |
256 |
> |
darwin*) |
257 |
> |
if [[ "x$EMULATED_PPC" = "xno" ]]; then |
258 |
> |
EXTRASYSSRCS="Darwin/paranoia.cpp Linux/asm_linux.S" |
259 |
> |
fi |
260 |
> |
;; |
261 |
> |
esac |
262 |
> |
SYSSRCS="$SERIALSRC $ETHERSRC $SCSISRC $AUDIOSRC $SEMSRC $UISRCS $MONSRCS $EXTRASYSSRCS" |
263 |
|
|
264 |
|
dnl Define a macro that translates a yesno-variable into a C macro definition |
265 |
|
dnl to be put into the config.h file |
418 |
|
|
419 |
|
fi dnl HAVE_MMAP_VM |
420 |
|
|
421 |
< |
dnl Check if we can mmap 0x2000 bytes from 0x0000 |
422 |
< |
AC_CACHE_CHECK([whether we can map Low Memory area 0x0000-0x2000], |
421 |
> |
dnl Check if we can modify the __PAGEZERO segment for use as Low Memory |
422 |
> |
AC_CACHE_CHECK([whether __PAGEZERO can be Low Memory area 0x0000-0x3000], |
423 |
> |
ac_cv_pagezero_hack, [ |
424 |
> |
ac_cv_pagezero_hack=no |
425 |
> |
if AC_TRY_COMMAND([Darwin/testlmem.sh 0x3000]); then |
426 |
> |
ac_cv_pagezero_hack=yes |
427 |
> |
dnl might as well skip the test for mmap-able low memory |
428 |
> |
ac_cv_can_map_lm=no |
429 |
> |
fi |
430 |
> |
]) |
431 |
> |
AC_TRANSLATE_DEFINE(PAGEZERO_HACK, "$ac_cv_pagezero_hack", |
432 |
> |
[Define if the __PAGEZERO Mach-O Low Memory Globals hack works on this system.]) |
433 |
> |
|
434 |
> |
dnl Check if we can mmap 0x3000 bytes from 0x0000 |
435 |
> |
AC_CACHE_CHECK([whether we can map Low Memory area 0x0000-0x3000], |
436 |
|
ac_cv_can_map_lm, [ |
437 |
|
AC_LANG_SAVE |
438 |
|
AC_LANG_CPLUSPLUS |
515 |
|
AC_TRANSLATE_DEFINE(SIGACTION_NEED_REINSTALL, "$ac_cv_sigaction_need_reinstall", |
516 |
|
[Define if your system requires sigactions to be reinstalled.]) |
517 |
|
|
518 |
< |
dnl Check if extended signals are supported. |
519 |
< |
AC_CACHE_CHECK([whether your system supports extended signal handlers], |
520 |
< |
ac_cv_have_extended_signals, [ |
518 |
> |
dnl Check if Mach exceptions supported. |
519 |
> |
AC_CACHE_CHECK([whether your system supports Mach exceptions], |
520 |
> |
ac_cv_have_mach_exceptions, [ |
521 |
|
AC_LANG_SAVE |
522 |
|
AC_LANG_CPLUSPLUS |
523 |
|
AC_TRY_RUN([ |
524 |
< |
#define HAVE_SIGINFO_T 1 |
524 |
> |
#define HAVE_MACH_EXCEPTIONS 1 |
525 |
|
#define CONFIGURE_TEST_SIGSEGV_RECOVERY |
526 |
|
#include "vm_alloc.cpp" |
527 |
|
#include "sigsegv.cpp" |
528 |
< |
], ac_cv_have_extended_signals=yes, ac_cv_have_extended_signals=no, |
528 |
> |
], [ |
529 |
> |
sigsegv_recovery=mach |
530 |
> |
ac_cv_have_mach_exceptions=yes |
531 |
> |
], |
532 |
> |
ac_cv_have_mach_exceptions=no, |
533 |
|
dnl When cross-compiling, do not assume anything. |
534 |
< |
ac_cv_have_extended_signals=no |
534 |
> |
ac_cv_have_mach_exceptions=no |
535 |
|
) |
536 |
|
AC_LANG_RESTORE |
537 |
|
] |
538 |
|
) |
539 |
< |
AC_TRANSLATE_DEFINE(HAVE_SIGINFO_T, "$ac_cv_have_extended_signals", |
540 |
< |
[Define if your system support extended signals.]) |
539 |
> |
AC_TRANSLATE_DEFINE(HAVE_MACH_EXCEPTIONS, "$ac_cv_have_mach_exceptions", |
540 |
> |
[Define if your system supports Mach exceptions.]) |
541 |
> |
|
542 |
> |
dnl Otherwise, check if extended signals are supported. |
543 |
> |
if [[ -z "$sigsegv_recovery" ]]; then |
544 |
> |
AC_CACHE_CHECK([whether your system supports extended signal handlers], |
545 |
> |
ac_cv_have_extended_signals, [ |
546 |
> |
AC_LANG_SAVE |
547 |
> |
AC_LANG_CPLUSPLUS |
548 |
> |
AC_TRY_RUN([ |
549 |
> |
#define HAVE_SIGINFO_T 1 |
550 |
> |
#define CONFIGURE_TEST_SIGSEGV_RECOVERY |
551 |
> |
#include "vm_alloc.cpp" |
552 |
> |
#include "sigsegv.cpp" |
553 |
> |
], [ |
554 |
> |
sigsegv_recovery=siginfo |
555 |
> |
ac_cv_have_extended_signals=yes |
556 |
> |
], |
557 |
> |
ac_cv_have_extended_signals=no, |
558 |
> |
dnl When cross-compiling, do not assume anything. |
559 |
> |
ac_cv_have_extended_signals=no |
560 |
> |
) |
561 |
> |
AC_LANG_RESTORE |
562 |
> |
] |
563 |
> |
) |
564 |
> |
AC_TRANSLATE_DEFINE(HAVE_SIGINFO_T, "$ac_cv_have_extended_signals", |
565 |
> |
[Define if your system support extended signals.]) |
566 |
> |
fi |
567 |
|
|
568 |
|
dnl Otherwise, check for subterfuges. |
569 |
< |
if [[ "x$ac_cv_have_extended_signals" = "xno" ]]; then |
569 |
> |
if [[ -z "$sigsegv_recovery" ]]; then |
570 |
|
AC_CACHE_CHECK([whether we then have a subterfuge for your system], |
571 |
|
ac_cv_have_sigcontext_hack, [ |
572 |
|
AC_LANG_SAVE |
576 |
|
#define CONFIGURE_TEST_SIGSEGV_RECOVERY |
577 |
|
#include "vm_alloc.cpp" |
578 |
|
#include "sigsegv.cpp" |
579 |
< |
], ac_cv_have_sigcontext_hack=yes, ac_cv_have_sigcontext_hack=no, |
579 |
> |
], [ |
580 |
> |
sigsegv_recovery=sigcontext |
581 |
> |
ac_cv_have_sigcontext_hack=yes |
582 |
> |
], |
583 |
> |
ac_cv_have_sigcontext_hack=no, |
584 |
|
dnl When cross-compiling, do not assume anything. |
585 |
|
ac_cv_have_sigcontext_hack=no |
586 |
|
) |
612 |
|
|
613 |
|
dnl Can we do Video on SEGV Signals ? |
614 |
|
CAN_VOSF=no |
615 |
< |
if [[ "$ac_cv_have_extended_signals" = "yes" -o "$ac_cv_have_sigcontext_hack" = "yes" ]]; then |
615 |
> |
if [[ -n "$sigsegv_recovery" ]]; then |
616 |
|
CAN_VOSF=yes |
617 |
|
fi |
618 |
|
|
623 |
|
WANT_VOSF=no |
624 |
|
fi |
625 |
|
|
626 |
+ |
dnl Platform specific binary postprocessor |
627 |
+ |
BLESS=/bin/true |
628 |
+ |
if [[ "x$ac_cv_pagezero_hack" = "xyes" ]]; then |
629 |
+ |
BLESS=Darwin/lowmem |
630 |
+ |
LDFLAGS="$LDFLAGS -pagezero_size 0x3000" |
631 |
+ |
fi |
632 |
+ |
|
633 |
|
dnl Check for GCC 2.7 or higher. |
634 |
|
HAVE_GCC27=no |
635 |
|
AC_MSG_CHECKING(for GCC 2.7 or higher) |
648 |
|
#endif |
649 |
|
], [AC_MSG_RESULT(yes); HAVE_GCC30=yes], AC_MSG_RESULT(no)) |
650 |
|
|
651 |
+ |
dnl Check for ICC. |
652 |
+ |
AC_MSG_CHECKING(for ICC) |
653 |
+ |
HAVE_ICC=no |
654 |
+ |
if $CXX -V -v 2>&1 | grep -q "Intel(R) C++ Compiler"; then |
655 |
+ |
HAVE_ICC=yes |
656 |
+ |
fi |
657 |
+ |
AC_MSG_RESULT($HAVE_ICC) |
658 |
+ |
|
659 |
|
# Test if the compiler can generate ELF objects |
660 |
|
AC_CACHE_CHECK([whether the compiler can generate ELF objects], |
661 |
|
ac_cv_elf_objects, [ |
699 |
|
ac_cv_use_dyngen=no |
700 |
|
;; |
701 |
|
esac |
702 |
+ |
dnl Check for a suitable synthetic opcodes compiler (icc is faking itself as gcc 3.2.2) |
703 |
+ |
if [[ -z "$DYNGEN_CC" ]]; then |
704 |
+ |
if [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_ICC" = "xno" ]]; then |
705 |
+ |
DYNGEN_CC=$CXX |
706 |
+ |
else |
707 |
+ |
for p in /usr/bin /usr/local/bin; do |
708 |
+ |
gxx="$p/g++" |
709 |
+ |
if [[ -x "$gxx" ]]; then |
710 |
+ |
DYNGEN_CC="$gxx" |
711 |
+ |
fi |
712 |
+ |
done |
713 |
+ |
fi |
714 |
+ |
fi |
715 |
+ |
if [[ -z "$DYNGEN_CC" ]] || ! { echo '#include <limits>' | $DYNGEN_CC -xc++ -c -o /dev/null - >& /dev/null; }; then |
716 |
+ |
ac_cv_use_dyngen=no |
717 |
+ |
fi |
718 |
|
]) |
719 |
|
if [[ "x$ac_cv_use_dyngen" = "xyes" ]]; then |
720 |
|
case $host_cpu in |
779 |
|
|
780 |
|
dnl Generate Makefile. |
781 |
|
AC_SUBST(DYNGENSRCS) |
782 |
+ |
AC_SUBST(DYNGEN_CC) |
783 |
|
AC_SUBST(DYNGEN_OP_FLAGS) |
784 |
|
AC_SUBST(SYSSRCS) |
785 |
|
AC_SUBST(CPUSRCS) |
786 |
+ |
AC_SUBST(BLESS) |
787 |
|
AC_OUTPUT(Makefile) |
788 |
|
|
789 |
|
dnl Print summary. |
798 |
|
echo ESD sound support ................ : $WANT_ESD |
799 |
|
echo GTK user interface ............... : $WANT_GTK |
800 |
|
echo mon debugger support ............. : $WANT_MON |
801 |
+ |
echo Bad memory access recovery type .. : $sigsegv_recovery |
802 |
|
echo |
803 |
|
echo "Configuration done. Now type \"make\"." |