1 |
nigel |
1.10 |
dnl Mac OS X configuration driver |
2 |
nigel |
1.12 |
dnl $Id: configure.in,v 1.11 2003/08/02 06:22:54 nigel Exp $ |
3 |
nigel |
1.1 |
dnl Process this file with autoconf to produce a configure script. |
4 |
|
|
dnl Based on Unix/configure.in |
5 |
|
|
dnl Written in 1999 by Christian Bauer et al. |
6 |
|
|
|
7 |
nigel |
1.11 |
dnl autoconf on 10.1 doesn't understand these |
8 |
|
|
dnl AC_INIT([Basilisk II], 1.0, [Christian.Bauer@uni-mainz.de], BasiliskII) |
9 |
|
|
dnl AC_CONFIG_SRCDIR(main_macosx.mm) |
10 |
nigel |
1.1 |
AC_INIT(main_macosx.mm) |
11 |
|
|
AC_PREREQ(2.12) |
12 |
|
|
AC_CONFIG_HEADER(config.h) |
13 |
|
|
|
14 |
nigel |
1.5 |
dnl Video options. |
15 |
nigel |
1.1 |
AC_ARG_ENABLE(multiwin, |
16 |
nigel |
1.8 |
[ --enable-multiwin allow multiple emulator windows [default=no]], [ENABLE_MULTIPLE=$enableval], [ENABLE_MULTIPLE=no]) |
17 |
nigel |
1.1 |
|
18 |
nigel |
1.5 |
dnl JIT compiler options. |
19 |
|
|
AC_ARG_ENABLE(jit-compiler, [ --enable-jit-compiler enable JIT compiler [default=no]], [WANT_JIT=$enableval], [WANT_JIT=no]) |
20 |
|
|
AC_ARG_ENABLE(jit-debug, [ --enable-jit-debug activate native code disassemblers [default=no]], [WANT_JIT_DEBUG=$enableval], [WANT_JIT_DEBUG=no]) |
21 |
|
|
|
22 |
nigel |
1.1 |
dnl FPU emulation core. |
23 |
|
|
AC_ARG_ENABLE(fpe, |
24 |
nigel |
1.5 |
[ --enable-fpe=FPE specify which fpu emulator to use [default=auto]], |
25 |
nigel |
1.1 |
[ case "$enableval" in |
26 |
nigel |
1.5 |
dnl default is always ieee, if architecture has this fp format |
27 |
|
|
auto) FPE_CORE_TEST_ORDER="ieee uae";; |
28 |
|
|
ieee) FPE_CORE_TEST_ORDER="ieee";; |
29 |
|
|
uae) FPE_CORE_TEST_ORDER="uae";; |
30 |
|
|
x86) FPE_CORE_TEST_ORDER="x86";; |
31 |
nigel |
1.10 |
*) AC_MSG_ERROR([--enable-fpe takes only one of the following values: auto, x86, ieee, uae]);; |
32 |
nigel |
1.1 |
esac |
33 |
|
|
], |
34 |
nigel |
1.5 |
[ FPE_CORE_TEST_ORDER="ieee uae" |
35 |
nigel |
1.1 |
]) |
36 |
|
|
|
37 |
|
|
dnl Addressing modes. |
38 |
|
|
AC_ARG_ENABLE(addressing, |
39 |
|
|
[ --enable-addressing=AM specify the addressing mode to use [default=fastest]], |
40 |
|
|
[ case "$enableval" in |
41 |
|
|
real) ADDRESSING_TEST_ORDER="real";; |
42 |
|
|
direct) ADDRESSING_TEST_ORDER="direct";; |
43 |
|
|
banks) ADDRESSING_TEST_ORDER="banks";; |
44 |
|
|
fastest)ADDRESSING_TEST_ORDER="direct banks";; |
45 |
|
|
*) AC_MSG_ERROR([--enable-addressing takes only one of the following values: fastest, real, direct, banks]);; |
46 |
|
|
esac |
47 |
|
|
], |
48 |
|
|
[ ADDRESSING_TEST_ORDER="direct banks" |
49 |
|
|
]) |
50 |
|
|
|
51 |
|
|
dnl External packages. |
52 |
|
|
AC_ARG_WITH(mon, [ --with-mon use mon as debugger [default=yes]], [WANT_MON=$withval], [WANT_MON=yes]) |
53 |
|
|
|
54 |
|
|
dnl Canonical system information. |
55 |
|
|
AC_CANONICAL_HOST |
56 |
|
|
AC_CANONICAL_TARGET |
57 |
|
|
|
58 |
|
|
dnl Target OS type |
59 |
|
|
OS_TYPE=darwin |
60 |
|
|
DEFINES="$DEFINES -DOS_$OS_TYPE" |
61 |
|
|
|
62 |
|
|
dnl Target CPU type. |
63 |
|
|
HAVE_I386=no |
64 |
|
|
HAVE_M68K=no |
65 |
|
|
HAVE_SPARC=no |
66 |
|
|
HAVE_POWERPC=no |
67 |
nigel |
1.10 |
HAVE_X86_64=no |
68 |
nigel |
1.1 |
case "$target_cpu" in |
69 |
nigel |
1.10 |
i386* | i486* | i586* | i686* | i786* ) HAVE_I386=yes;; |
70 |
|
|
m68k* ) HAVE_M68K=yes;; |
71 |
|
|
sparc* ) HAVE_SPARC=yes;; |
72 |
|
|
powerpc* ) HAVE_POWERPC=yes;; |
73 |
|
|
x86_64* ) HAVE_X86_64=yes;; |
74 |
nigel |
1.1 |
esac |
75 |
|
|
|
76 |
|
|
dnl Checks for programs. |
77 |
|
|
AC_PROG_CC |
78 |
|
|
AC_PROG_CC_C_O |
79 |
|
|
AC_PROG_CPP |
80 |
|
|
AC_PROG_CXX |
81 |
|
|
AC_PROG_MAKE_SET |
82 |
|
|
AC_PROG_INSTALL |
83 |
|
|
|
84 |
nigel |
1.8 |
dnl MacOS 10.2 (and later?) have a particular header for defining the OS version |
85 |
nigel |
1.7 |
AC_CHECK_HEADER(AvailabilityMacros.h) |
86 |
|
|
if [[ "x$ac_cv_header_AvailabilityMacros_h" = "xyes" ]]; then |
87 |
nigel |
1.8 |
AC_DEFINE(AVAILABILITYMACROS, 1, [Header specific to 10.2 and later.]) |
88 |
nigel |
1.7 |
fi |
89 |
|
|
|
90 |
nigel |
1.1 |
dnl We use mon if possible. |
91 |
|
|
MONSRCS= |
92 |
|
|
if [[ "x$WANT_MON" = "xyes" ]]; then |
93 |
|
|
AC_MSG_CHECKING(for mon) |
94 |
|
|
mon_srcdir=../../../mon/src |
95 |
|
|
if grep mon_init $mon_srcdir/mon.h >/dev/null 2>/dev/null; then |
96 |
|
|
AC_MSG_RESULT(yes) |
97 |
nigel |
1.5 |
AC_DEFINE(ENABLE_MON, 1, [Define if using "mon".]) |
98 |
|
|
MONSRCS="$mon_srcdir/mon.cpp $mon_srcdir/mon_6502.cpp $mon_srcdir/mon_z80.cpp $mon_srcdir/mon_cmd.cpp $mon_srcdir/mon_disass.cpp $mon_srcdir/mon_ppc.cpp $mon_srcdir/mon_lowmem.cpp $mon_srcdir/disass/floatformat.c $mon_srcdir/disass/i386-dis.c $mon_srcdir/disass/m68k-dis.c $mon_srcdir/disass/m68k-opc.c" |
99 |
nigel |
1.1 |
CXXFLAGS="$CXXFLAGS -I$mon_srcdir -I$mon_srcdir/disass" |
100 |
nigel |
1.10 |
AC_CHECK_LIB(ncurses, tgetent, , |
101 |
|
|
AC_CHECK_LIB(termcap, tgetent, , |
102 |
|
|
AC_CHECK_LIB(termlib, tgetent, , |
103 |
|
|
AC_CHECK_LIB(terminfo, tgetent, , |
104 |
|
|
AC_CHECK_LIB(Hcurses, tgetent, , |
105 |
|
|
AC_CHECK_LIB(curses, tgetent)))))) |
106 |
nigel |
1.1 |
AC_CHECK_LIB(readline, readline) |
107 |
|
|
else |
108 |
|
|
AC_MSG_RESULT(no) |
109 |
|
|
AC_MSG_WARN([Could not find mon, ignoring --with-mon.]) |
110 |
|
|
WANT_MON=no |
111 |
|
|
fi |
112 |
|
|
fi |
113 |
|
|
|
114 |
|
|
dnl We want pthreads. |
115 |
|
|
HAVE_PTHREADS=yes |
116 |
|
|
AC_CHECK_FUNCS(pthread_cancel) |
117 |
nigel |
1.3 |
AC_CHECK_FUNCS(pthread_mutexattr_setprotocol) |
118 |
|
|
AC_CHECK_FUNCS(pthread_mutexattr_settype) |
119 |
nigel |
1.5 |
AC_CHECK_FUNCS(pthread_mutexattr_setpshared) |
120 |
nigel |
1.1 |
|
121 |
|
|
dnl If POSIX.4 semaphores are not available, we emulate them with pthread mutexes. |
122 |
|
|
SEMSRC= |
123 |
|
|
AC_CHECK_FUNCS(sem_init, , [ |
124 |
|
|
if test "x$HAVE_PTHREADS" = "xyes"; then |
125 |
|
|
SEMSRC=posix_sem.cpp |
126 |
|
|
fi |
127 |
|
|
]) |
128 |
|
|
|
129 |
nigel |
1.5 |
dnl We want to enable multiple window support if possible |
130 |
nigel |
1.1 |
if [[ "x$WANT_MWIN" = "xyes" ]]; then |
131 |
|
|
WANT_MWIN=yes |
132 |
|
|
DEFINES="$DEFINES -DENABLE_MULTIPLE" |
133 |
|
|
fi |
134 |
|
|
|
135 |
nigel |
1.5 |
dnl We use 64-bit file size support if possible. |
136 |
|
|
AC_SYS_LARGEFILE |
137 |
|
|
|
138 |
nigel |
1.1 |
dnl Checks for header files. |
139 |
|
|
AC_HEADER_STDC |
140 |
|
|
AC_CHECK_HEADERS(unistd.h fcntl.h sys/time.h sys/mman.h) |
141 |
nigel |
1.12 |
AC_CHECK_HEADERS(readline.h history.h readline/readline.h readline/history.h) |
142 |
nigel |
1.1 |
|
143 |
|
|
dnl Checks for typedefs, structures, and compiler characteristics. |
144 |
|
|
AC_C_BIGENDIAN |
145 |
|
|
AC_C_CONST |
146 |
|
|
AC_C_INLINE |
147 |
|
|
AC_CHECK_SIZEOF(short, 2) |
148 |
|
|
AC_CHECK_SIZEOF(int, 4) |
149 |
|
|
AC_CHECK_SIZEOF(long, 4) |
150 |
|
|
AC_CHECK_SIZEOF(long long, 8) |
151 |
nigel |
1.5 |
AC_CHECK_SIZEOF(float, 4) |
152 |
|
|
AC_CHECK_SIZEOF(double, 8) |
153 |
|
|
AC_CHECK_SIZEOF(long double, 12) |
154 |
nigel |
1.1 |
AC_CHECK_SIZEOF(void *, 4) |
155 |
nigel |
1.10 |
AC_TYPE_OFF_T |
156 |
nigel |
1.8 |
dnl These two symbols are not defined in 10.1's autoconf files: |
157 |
|
|
dnl AC_CHECK_TYPE(loff_t, off_t) |
158 |
|
|
dnl AC_CHECK_TYPE(caddr_t, [char *]) |
159 |
|
|
dnl which causes problems for autoheader. |
160 |
|
|
dnl We define loff_t as a typedef of off_t in sysdeps.h if we don't have LOFF_T |
161 |
nigel |
1.1 |
AC_TYPE_SIZE_T |
162 |
|
|
AC_TYPE_SIGNAL |
163 |
|
|
AC_HEADER_TIME |
164 |
|
|
AC_STRUCT_TM |
165 |
|
|
|
166 |
nigel |
1.5 |
dnl Check whether sys/socket.h defines type socklen_t. |
167 |
|
|
dnl (extracted from ac-archive/Miscellaneous) |
168 |
|
|
AC_CACHE_CHECK([for socklen_t], |
169 |
|
|
ac_cv_type_socklen_t, [ |
170 |
|
|
AC_TRY_COMPILE([ |
171 |
|
|
#include <sys/types.h> |
172 |
|
|
#include <sys/socket.h> |
173 |
|
|
], [socklen_t len = 42; return 0;], |
174 |
|
|
ac_cv_type_socklen_t=yes, ac_cv_type_socklen_t=no, |
175 |
|
|
dnl When cross-compiling, do not assume anything. |
176 |
|
|
ac_cv_type_socklen_t="guessing no" |
177 |
|
|
) |
178 |
|
|
]) |
179 |
|
|
if [[ "x$ac_cv_type_socklen_t" != "xyes" ]]; then |
180 |
|
|
AC_DEFINE(socklen_t, int, [Define to 'int' if <sys/types.h> doesn't define.]) |
181 |
|
|
fi |
182 |
|
|
|
183 |
nigel |
1.1 |
dnl Checks for library functions. |
184 |
|
|
AC_CHECK_FUNCS(strdup cfmakeraw) |
185 |
|
|
AC_CHECK_FUNCS(clock_gettime timer_create) |
186 |
|
|
AC_CHECK_FUNCS(sigaction signal) |
187 |
|
|
AC_CHECK_FUNCS(mmap mprotect munmap) |
188 |
|
|
AC_CHECK_FUNCS(vm_allocate vm_deallocate vm_protect) |
189 |
|
|
|
190 |
|
|
dnl Darwin seems to define mach_task_self() instead of task_self(). |
191 |
|
|
AC_CHECK_FUNCS(mach_task_self task_self) |
192 |
|
|
|
193 |
|
|
dnl Select system-dependant source files. |
194 |
|
|
DEFINES="$DEFINES -DBSD_COMP" |
195 |
|
|
dnl Check for the CAM library |
196 |
nigel |
1.5 |
AC_CHECK_LIB(cam, cam_open_btl, HAVE_LIBCAM=yes, HAVE_LIBCAM=no) |
197 |
nigel |
1.1 |
if [[ "x$HAVE_LIBCAM" = "xno" ]]; then |
198 |
|
|
AC_MSG_WARN([Cannot find libcam for SCSI management, disabling SCSI support.]) |
199 |
nigel |
1.5 |
else |
200 |
|
|
dnl Check for the sys kernel includes |
201 |
nigel |
1.1 |
AC_CHECK_HEADER(camlib.h) |
202 |
|
|
if [[ "x$ac_cv_header_camlib_h" = "xno" ]]; then |
203 |
|
|
dnl In this case I should fix this thing including a "patch" |
204 |
|
|
dnl to access directly to the functions in the kernel :) --Orlando |
205 |
|
|
AC_MSG_WARN([Cannot find includes for CAM library, disabling SCSI support.]) |
206 |
|
|
else |
207 |
|
|
SCSISRC=FreeBSD/scsi_freebsd.cpp |
208 |
|
|
LIBS="$LIBS -lcam" |
209 |
|
|
DEFINES="$DEFINES -DCAM" |
210 |
|
|
fi |
211 |
|
|
fi |
212 |
|
|
|
213 |
|
|
dnl Use 68k CPU natively? |
214 |
|
|
WANT_NATIVE_M68K=no |
215 |
|
|
|
216 |
|
|
|
217 |
|
|
dnl Define a macro that translates a yesno-variable into a C macro definition |
218 |
|
|
dnl to be put into the config.h file |
219 |
|
|
dnl $1 -- the macro to define |
220 |
|
|
dnl $2 -- the value to translate |
221 |
nigel |
1.5 |
dnl $3 -- template name |
222 |
nigel |
1.1 |
AC_DEFUN(AC_TRANSLATE_DEFINE, [ |
223 |
|
|
if [[ "x$2" = "xyes" -o "x$2" = "xguessing yes" ]]; then |
224 |
nigel |
1.5 |
AC_DEFINE($1, 1, $3) |
225 |
nigel |
1.1 |
fi |
226 |
|
|
]) |
227 |
|
|
|
228 |
|
|
dnl Various checks if the system supports vm_allocate() and the like functions. |
229 |
|
|
have_mach_vm=no |
230 |
|
|
if [[ "x$ac_cv_func_vm_allocate" = "xyes" -a "x$ac_cv_func_vm_deallocate" = "xyes" -a \ |
231 |
|
|
"x$ac_cv_func_vm_protect" = "xyes" ]]; then |
232 |
|
|
have_mach_vm=yes |
233 |
|
|
fi |
234 |
nigel |
1.5 |
AC_TRANSLATE_DEFINE(HAVE_MACH_VM, "$have_mach_vm", |
235 |
|
|
[Define if your system has a working vm_allocate()-based memory allocator.]) |
236 |
nigel |
1.1 |
|
237 |
|
|
dnl Check that vm_allocate(), vm_protect() work |
238 |
|
|
if [[ "x$have_mach_vm" = "xyes" ]]; then |
239 |
|
|
|
240 |
nigel |
1.5 |
AC_CACHE_CHECK([whether vm_protect works], |
241 |
nigel |
1.1 |
ac_cv_vm_protect_works, [ |
242 |
|
|
AC_LANG_SAVE |
243 |
|
|
AC_LANG_CPLUSPLUS |
244 |
|
|
ac_cv_vm_protect_works=yes |
245 |
|
|
dnl First the tests that should segfault |
246 |
|
|
for test_def in NONE_READ NONE_WRITE READ_WRITE; do |
247 |
|
|
AC_TRY_RUN([ |
248 |
|
|
#define CONFIGURE_TEST_VM_MAP |
249 |
|
|
#define TEST_VM_PROT_$test_def |
250 |
nigel |
1.6 |
#include "../Unix/vm_alloc.cpp" |
251 |
nigel |
1.1 |
], ac_cv_vm_protect_works=no, rm -f core, |
252 |
|
|
dnl When cross-compiling, do not assume anything |
253 |
|
|
ac_cv_vm_protect_works="guessing no" |
254 |
|
|
) |
255 |
|
|
done |
256 |
|
|
AC_TRY_RUN([ |
257 |
|
|
#define CONFIGURE_TEST_VM_MAP |
258 |
|
|
#define TEST_VM_PROT_RDWR_WRITE |
259 |
nigel |
1.6 |
#include "../Unix/vm_alloc.cpp" |
260 |
nigel |
1.1 |
], , ac_cv_vm_protect_works=no, |
261 |
|
|
dnl When cross-compiling, do not assume anything |
262 |
|
|
ac_cv_vm_protect_works="guessing no" |
263 |
|
|
) |
264 |
|
|
AC_LANG_RESTORE |
265 |
|
|
] |
266 |
|
|
) |
267 |
|
|
|
268 |
|
|
dnl Remove support for vm_allocate() if vm_protect() does not work |
269 |
|
|
if [[ "x$have_mach_vm" = "xyes" ]]; then |
270 |
|
|
case $ac_cv_vm_protect_works in |
271 |
|
|
*yes) have_mach_vm=yes;; |
272 |
|
|
*no) have_mach_vm=no;; |
273 |
|
|
esac |
274 |
|
|
fi |
275 |
nigel |
1.5 |
AC_TRANSLATE_DEFINE(HAVE_MACH_VM, "$have_mach_vm", |
276 |
|
|
[Define if your system has a working vm_allocate()-based memory allocator.]) |
277 |
nigel |
1.1 |
|
278 |
|
|
fi dnl HAVE_MACH_VM |
279 |
|
|
|
280 |
|
|
dnl Various checks if the system supports mmap() and the like functions. |
281 |
|
|
dnl ... and Mach memory allocators are not supported |
282 |
|
|
have_mmap_vm=no |
283 |
|
|
if [[ "x$ac_cv_func_mmap" = "xyes" -a "x$ac_cv_func_munmap" = "xyes" -a \ |
284 |
|
|
"x$ac_cv_func_mprotect" = "xyes" ]]; then |
285 |
|
|
if [[ "x$have_mach_vm" = "xno" ]]; then |
286 |
|
|
have_mmap_vm=yes |
287 |
|
|
fi |
288 |
|
|
fi |
289 |
nigel |
1.5 |
AC_TRANSLATE_DEFINE(HAVE_MMAP_VM, "$have_mmap_vm", |
290 |
|
|
[Define if your system has a working mmap()-based memory allocator.]) |
291 |
nigel |
1.1 |
|
292 |
|
|
dnl Check that mmap() and associated functions work. |
293 |
|
|
if [[ "x$have_mmap_vm" = "xyes" ]]; then |
294 |
|
|
|
295 |
|
|
dnl Check if we have a working anonymous mmap() |
296 |
nigel |
1.5 |
AC_CACHE_CHECK([whether mmap supports MAP_ANON], |
297 |
nigel |
1.1 |
ac_cv_mmap_anon, [ |
298 |
|
|
AC_LANG_SAVE |
299 |
|
|
AC_LANG_CPLUSPLUS |
300 |
|
|
AC_TRY_RUN([ |
301 |
|
|
#define HAVE_MMAP_ANON |
302 |
|
|
#define CONFIGURE_TEST_VM_MAP |
303 |
|
|
#define TEST_VM_MMAP_ANON |
304 |
nigel |
1.6 |
#include "../Unix/vm_alloc.cpp" |
305 |
nigel |
1.1 |
], ac_cv_mmap_anon=yes, ac_cv_mmap_anon=no, |
306 |
|
|
dnl When cross-compiling, do not assume anything. |
307 |
|
|
ac_cv_mmap_anon="guessing no" |
308 |
|
|
) |
309 |
|
|
AC_LANG_RESTORE |
310 |
|
|
] |
311 |
|
|
) |
312 |
nigel |
1.5 |
AC_TRANSLATE_DEFINE(HAVE_MMAP_ANON, "$ac_cv_mmap_anon", |
313 |
|
|
[Define if <sys/mman.h> defines MAP_ANON and mmap()'ing with MAP_ANON works.]) |
314 |
nigel |
1.1 |
|
315 |
nigel |
1.5 |
AC_CACHE_CHECK([whether mmap supports MAP_ANONYMOUS], |
316 |
nigel |
1.1 |
ac_cv_mmap_anonymous, [ |
317 |
|
|
AC_LANG_SAVE |
318 |
|
|
AC_LANG_CPLUSPLUS |
319 |
|
|
AC_TRY_RUN([ |
320 |
|
|
#define HAVE_MMAP_ANONYMOUS |
321 |
|
|
#define CONFIGURE_TEST_VM_MAP |
322 |
|
|
#define TEST_VM_MMAP_ANON |
323 |
nigel |
1.6 |
#include "../Unix/vm_alloc.cpp" |
324 |
nigel |
1.1 |
], ac_cv_mmap_anonymous=yes, ac_cv_mmap_anonymous=no, |
325 |
|
|
dnl When cross-compiling, do not assume anything. |
326 |
|
|
ac_cv_mmap_anonymous="guessing no" |
327 |
|
|
) |
328 |
|
|
AC_LANG_RESTORE |
329 |
|
|
] |
330 |
|
|
) |
331 |
nigel |
1.5 |
AC_TRANSLATE_DEFINE(HAVE_MMAP_ANONYMOUS, "$ac_cv_mmap_anonymous", |
332 |
|
|
[Define if <sys/mman.h> defines MAP_ANONYMOUS and mmap()'ing with MAP_ANONYMOUS works.]) |
333 |
nigel |
1.1 |
|
334 |
nigel |
1.5 |
AC_CACHE_CHECK([whether mprotect works], |
335 |
nigel |
1.1 |
ac_cv_mprotect_works, [ |
336 |
|
|
AC_LANG_SAVE |
337 |
|
|
AC_LANG_CPLUSPLUS |
338 |
|
|
ac_cv_mprotect_works=yes |
339 |
|
|
dnl First the tests that should segfault |
340 |
|
|
for test_def in NONE_READ NONE_WRITE READ_WRITE; do |
341 |
|
|
AC_TRY_RUN([ |
342 |
|
|
#define CONFIGURE_TEST_VM_MAP |
343 |
|
|
#define TEST_VM_PROT_$test_def |
344 |
nigel |
1.6 |
#include "../Unix/vm_alloc.cpp" |
345 |
nigel |
1.1 |
], ac_cv_mprotect_works=no, rm -f core, |
346 |
|
|
dnl When cross-compiling, do not assume anything |
347 |
|
|
ac_cv_mprotect_works="guessing no" |
348 |
|
|
) |
349 |
|
|
done |
350 |
|
|
AC_TRY_RUN([ |
351 |
|
|
#define CONFIGURE_TEST_VM_MAP |
352 |
|
|
#define TEST_VM_PROT_RDWR_WRITE |
353 |
nigel |
1.6 |
#include "../Unix/vm_alloc.cpp" |
354 |
nigel |
1.1 |
], , ac_cv_mprotect_works=no, |
355 |
|
|
dnl When cross-compiling, do not assume anything |
356 |
|
|
ac_cv_mprotect_works="guessing no" |
357 |
|
|
) |
358 |
|
|
AC_LANG_RESTORE |
359 |
|
|
] |
360 |
|
|
) |
361 |
|
|
|
362 |
|
|
dnl Remove support for mmap() if mprotect() does not work |
363 |
|
|
if [[ "x$have_mmap_vm" = "xyes" ]]; then |
364 |
|
|
case $ac_cv_mprotect_works in |
365 |
|
|
*yes) have_mmap_vm=yes;; |
366 |
|
|
*no) have_mmap_vm=no;; |
367 |
|
|
esac |
368 |
|
|
fi |
369 |
nigel |
1.5 |
AC_TRANSLATE_DEFINE(HAVE_MMAP_VM, $have_mmap_vm, |
370 |
|
|
[Define if your system has a working mmap()-based memory allocator.]) |
371 |
nigel |
1.1 |
|
372 |
|
|
fi dnl HAVE_MMAP_VM |
373 |
|
|
|
374 |
nigel |
1.12 |
dnl Check if we can modify the __PAGEZERO segment for use as Low Memory |
375 |
|
|
AC_CACHE_CHECK([whether __PAGEZERO can be Low Memory area 0x0000-0x2000], |
376 |
|
|
ac_cv_pagezero_hack, [ |
377 |
|
|
ac_cv_pagezero_hack=no |
378 |
|
|
if AC_TRY_COMMAND([Darwin/testlmem.sh 0x2000]); then |
379 |
|
|
ac_cv_pagezero_hack=yes |
380 |
|
|
dnl might as well skip the test for mmap-able low memory |
381 |
|
|
ac_cv_can_map_lm=no |
382 |
|
|
fi |
383 |
|
|
]) |
384 |
|
|
AC_TRANSLATE_DEFINE(PAGEZERO_HACK, "$ac_cv_pagezero_hack", |
385 |
|
|
[Define if the __PAGEZERO Mach-O Low Memory Globals hack works on this system.]) |
386 |
|
|
|
387 |
nigel |
1.1 |
dnl Check if we can mmap 0x2000 bytes from 0x0000 |
388 |
nigel |
1.5 |
AC_CACHE_CHECK([whether we can map Low Memory area 0x0000-0x2000], |
389 |
nigel |
1.1 |
ac_cv_can_map_lm, [ |
390 |
|
|
AC_LANG_SAVE |
391 |
|
|
AC_LANG_CPLUSPLUS |
392 |
|
|
AC_TRY_RUN([ |
393 |
nigel |
1.6 |
#include "../Unix/vm_alloc.cpp" |
394 |
nigel |
1.1 |
int main(void) { /* returns 0 if we could map the lowmem globals */ |
395 |
nigel |
1.11 |
volatile char * lm = 0; |
396 |
nigel |
1.1 |
if (vm_init() < 0) exit(1); |
397 |
nigel |
1.12 |
if (vm_acquire_fixed(0, 0x2000) < 0) exit(1); |
398 |
nigel |
1.1 |
lm[0] = 'z'; |
399 |
|
|
if (vm_release((char *)lm, 0x2000) < 0) exit(1); |
400 |
|
|
vm_exit(); exit(0); |
401 |
|
|
} |
402 |
|
|
], ac_cv_can_map_lm=yes, ac_cv_can_map_lm=no, |
403 |
|
|
dnl When cross-compiling, do not assume anything. |
404 |
|
|
ac_cv_can_map_lm="guessing no" |
405 |
|
|
) |
406 |
|
|
AC_LANG_RESTORE |
407 |
|
|
] |
408 |
|
|
) |
409 |
|
|
|
410 |
|
|
dnl Check signal handlers need to be reinstalled |
411 |
nigel |
1.5 |
AC_CACHE_CHECK([whether signal handlers need to be reinstalled], |
412 |
nigel |
1.1 |
ac_cv_signal_need_reinstall, [ |
413 |
|
|
AC_LANG_SAVE |
414 |
|
|
AC_LANG_CPLUSPLUS |
415 |
|
|
AC_TRY_RUN([ |
416 |
|
|
#include <stdlib.h> |
417 |
|
|
#ifdef HAVE_UNISTD_H |
418 |
|
|
#include <unistd.h> |
419 |
|
|
#endif |
420 |
|
|
#include <signal.h> |
421 |
|
|
static int handled_signal = 0; |
422 |
|
|
RETSIGTYPE sigusr1_handler(int) { handled_signal++; } |
423 |
|
|
int main(void) { /* returns 0 if signals need not to be reinstalled */ |
424 |
|
|
signal(SIGUSR1, sigusr1_handler); raise(SIGUSR1); raise(SIGUSR1); |
425 |
|
|
exit(handled_signal == 2); |
426 |
|
|
} |
427 |
|
|
], ac_cv_signal_need_reinstall=yes, ac_cv_signal_need_reinstall=no, |
428 |
|
|
dnl When cross-compiling, do not assume anything. |
429 |
|
|
ac_cv_signal_need_reinstall="guessing yes" |
430 |
|
|
) |
431 |
|
|
AC_LANG_RESTORE |
432 |
|
|
] |
433 |
|
|
) |
434 |
nigel |
1.5 |
AC_TRANSLATE_DEFINE(SIGNAL_NEED_REINSTALL, "$ac_cv_signal_need_reinstall", |
435 |
|
|
[Define if your system requires signals to be reinstalled.]) |
436 |
nigel |
1.1 |
|
437 |
|
|
dnl Check if sigaction handlers need to be reinstalled |
438 |
nigel |
1.5 |
AC_CACHE_CHECK([whether sigaction handlers need to be reinstalled], |
439 |
nigel |
1.1 |
ac_cv_sigaction_need_reinstall, [ |
440 |
|
|
AC_LANG_SAVE |
441 |
|
|
AC_LANG_CPLUSPLUS |
442 |
|
|
AC_TRY_RUN([ |
443 |
|
|
#include <stdlib.h> |
444 |
|
|
#ifdef HAVE_UNISTD_H |
445 |
|
|
#include <unistd.h> |
446 |
|
|
#endif |
447 |
|
|
#include <signal.h> |
448 |
|
|
static int handled_signal = 0; |
449 |
|
|
RETSIGTYPE sigusr1_handler(int) { handled_signal++; } |
450 |
|
|
typedef RETSIGTYPE (*signal_handler)(int); |
451 |
|
|
static signal_handler mysignal(int sig, signal_handler handler) { |
452 |
|
|
struct sigaction old_sa; |
453 |
|
|
struct sigaction new_sa; |
454 |
|
|
new_sa.sa_handler = handler; |
455 |
|
|
return ((sigaction(sig,&new_sa,&old_sa) < 0) ? SIG_IGN : old_sa.sa_handler); |
456 |
|
|
} |
457 |
|
|
int main(void) { /* returns 0 if signals need not to be reinstalled */ |
458 |
|
|
mysignal(SIGUSR1, sigusr1_handler); raise(SIGUSR1); raise(SIGUSR1); |
459 |
|
|
exit(handled_signal == 2); |
460 |
|
|
} |
461 |
|
|
], ac_cv_sigaction_need_reinstall=yes, ac_cv_sigaction_need_reinstall=no, |
462 |
|
|
dnl When cross-compiling, do not assume anything. |
463 |
|
|
ac_cv_sigaction_need_reinstall="guessing yes" |
464 |
|
|
) |
465 |
|
|
AC_LANG_RESTORE |
466 |
|
|
] |
467 |
|
|
) |
468 |
nigel |
1.5 |
AC_TRANSLATE_DEFINE(SIGACTION_NEED_REINSTALL, "$ac_cv_sigaction_need_reinstall", |
469 |
|
|
[Define if your system requires sigactions to be reinstalled.]) |
470 |
nigel |
1.1 |
|
471 |
nigel |
1.12 |
dnl Check if Mach exceptions supported. |
472 |
|
|
AC_CACHE_CHECK([whether your system supports Mach exceptions], |
473 |
|
|
ac_cv_have_mach_exceptions, [ |
474 |
nigel |
1.1 |
AC_LANG_SAVE |
475 |
|
|
AC_LANG_CPLUSPLUS |
476 |
|
|
AC_TRY_RUN([ |
477 |
nigel |
1.12 |
#define HAVE_MACH_EXCEPTIONS 1 |
478 |
nigel |
1.1 |
#define CONFIGURE_TEST_SIGSEGV_RECOVERY |
479 |
nigel |
1.12 |
#include "vm_alloc.cpp" |
480 |
|
|
#include "sigsegv.cpp" |
481 |
|
|
], [ |
482 |
|
|
sigsegv_recovery=mach |
483 |
|
|
ac_cv_have_mach_exceptions=yes |
484 |
|
|
], |
485 |
|
|
ac_cv_have_mach_exceptions=no, |
486 |
nigel |
1.1 |
dnl When cross-compiling, do not assume anything. |
487 |
nigel |
1.12 |
ac_cv_have_mach_exceptions=no |
488 |
nigel |
1.1 |
) |
489 |
|
|
AC_LANG_RESTORE |
490 |
|
|
] |
491 |
|
|
) |
492 |
nigel |
1.12 |
AC_TRANSLATE_DEFINE(HAVE_MACH_EXCEPTIONS, "$ac_cv_have_mach_exceptions", |
493 |
|
|
[Define if your system supports Mach exceptions.]) |
494 |
|
|
|
495 |
|
|
dnl Otherwise, check if extended signals are supported. |
496 |
|
|
if [[ -z "$sigsegv_recovery" ]]; then |
497 |
|
|
AC_CACHE_CHECK([whether your system supports extended signal handlers], |
498 |
|
|
ac_cv_have_extended_signals, [ |
499 |
|
|
AC_LANG_SAVE |
500 |
|
|
AC_LANG_CPLUSPLUS |
501 |
|
|
AC_TRY_RUN([ |
502 |
|
|
#define HAVE_SIGINFO_T 1 |
503 |
|
|
#define CONFIGURE_TEST_SIGSEGV_RECOVERY |
504 |
|
|
#include "../Unix/vm_alloc.cpp" |
505 |
|
|
#include "../Unix/sigsegv.cpp" |
506 |
|
|
], [ |
507 |
|
|
sigsegv_recovery=siginfo |
508 |
|
|
ac_cv_have_extended_signals=yes |
509 |
|
|
], |
510 |
|
|
ac_cv_have_extended_signals=no, |
511 |
|
|
dnl When cross-compiling, do not assume anything. |
512 |
|
|
ac_cv_have_extended_signals=no |
513 |
|
|
) |
514 |
|
|
AC_LANG_RESTORE |
515 |
|
|
] |
516 |
|
|
) |
517 |
|
|
AC_TRANSLATE_DEFINE(HAVE_SIGINFO_T, "$ac_cv_have_extended_signals", |
518 |
|
|
[Define if your system support extended signals.]) |
519 |
|
|
fi |
520 |
nigel |
1.5 |
|
521 |
nigel |
1.6 |
dnl This program never returns (exits) on OS X |
522 |
nigel |
1.1 |
dnl Otherwise, check for subterfuges. |
523 |
nigel |
1.6 |
dnl if [[ "x$ac_cv_have_extended_signals" = "xno" ]]; then |
524 |
|
|
dnl AC_CACHE_CHECK([whether we then have a subterfuge for your system], |
525 |
|
|
dnl ac_cv_have_sigcontext_hack, [ |
526 |
|
|
dnl AC_LANG_SAVE |
527 |
|
|
dnl AC_LANG_CPLUSPLUS |
528 |
|
|
dnl AC_TRY_RUN([ |
529 |
|
|
dnl #define HAVE_SIGCONTEXT_SUBTERFUGE 1 |
530 |
|
|
dnl #define CONFIGURE_TEST_SIGSEGV_RECOVERY |
531 |
|
|
dnl #include "../Unix/vm_alloc.cpp" |
532 |
|
|
dnl #include "../Unix/sigsegv.cpp" |
533 |
nigel |
1.12 |
dnl ], [ |
534 |
|
|
dnl sigsegv_recovery=sigcontext |
535 |
|
|
dnl ac_cv_have_sigcontext_hack=yes |
536 |
|
|
dnl ], |
537 |
|
|
dnl ac_cv_have_sigcontext_hack=no, |
538 |
nigel |
1.6 |
dnl dnl When cross-compiling, do not assume anything. |
539 |
|
|
dnl ac_cv_have_sigcontext_hack=no |
540 |
|
|
dnl ) |
541 |
|
|
dnl AC_LANG_RESTORE |
542 |
|
|
dnl ]) |
543 |
|
|
dnl AC_TRANSLATE_DEFINE(HAVE_SIGCONTEXT_SUBTERFUGE, "$ac_cv_have_sigcontext_hack", |
544 |
|
|
dnl [Define if we know a hack to replace siginfo_t->si_addr member.]) |
545 |
|
|
dnl fi |
546 |
nigel |
1.1 |
|
547 |
nigel |
1.5 |
dnl Check if we can ignore the fault (instruction skipping in SIGSEGV handler) |
548 |
|
|
AC_CACHE_CHECK([whether we can skip instruction in SIGSEGV handler], |
549 |
|
|
ac_cv_have_skip_instruction, [ |
550 |
|
|
AC_LANG_SAVE |
551 |
|
|
AC_LANG_CPLUSPLUS |
552 |
|
|
AC_TRY_RUN([ |
553 |
|
|
#define HAVE_SIGSEGV_SKIP_INSTRUCTION 1 |
554 |
|
|
#define CONFIGURE_TEST_SIGSEGV_RECOVERY |
555 |
nigel |
1.6 |
#include "../Unix/vm_alloc.cpp" |
556 |
|
|
#include "../Unix/sigsegv.cpp" |
557 |
nigel |
1.5 |
], ac_cv_have_skip_instruction=yes, ac_cv_have_skip_instruction=no, |
558 |
|
|
dnl When cross-compiling, do not assume anything. |
559 |
|
|
ac_cv_have_skip_instruction=no |
560 |
|
|
) |
561 |
|
|
AC_LANG_RESTORE |
562 |
|
|
] |
563 |
|
|
) |
564 |
|
|
AC_TRANSLATE_DEFINE(HAVE_SIGSEGV_SKIP_INSTRUCTION, "$ac_cv_have_skip_instruction", |
565 |
|
|
[Define if we can ignore the fault (instruction skipping in SIGSEGV handler).]) |
566 |
|
|
|
567 |
nigel |
1.1 |
dnl Can we do Video on SEGV Signals ? |
568 |
|
|
CAN_VOSF=no |
569 |
nigel |
1.12 |
if [[ -n "$sigsegv_recovery" ]]; then |
570 |
nigel |
1.1 |
CAN_VOSF=yes |
571 |
|
|
fi |
572 |
|
|
|
573 |
nigel |
1.12 |
dnl A dummy program that returns always true |
574 |
|
|
BLESS=/bin/true |
575 |
|
|
|
576 |
nigel |
1.1 |
dnl Determine the addressing mode to use |
577 |
|
|
if [[ "x$WANT_NATIVE_M68K" = "xyes" ]]; then |
578 |
|
|
ADDRESSING_MODE="real" |
579 |
|
|
else |
580 |
|
|
ADDRESSING_MODE="" |
581 |
|
|
AC_MSG_CHECKING([for the addressing mode to use]) |
582 |
|
|
for am in $ADDRESSING_TEST_ORDER; do |
583 |
|
|
case $am in |
584 |
|
|
real) |
585 |
|
|
dnl Requires ability to mmap() Low Memory globals |
586 |
nigel |
1.12 |
if [[ "x$ac_cv_can_map_lm$ac_cv_pagezero_hack" = "xnono" ]]; then |
587 |
nigel |
1.1 |
continue |
588 |
|
|
fi |
589 |
nigel |
1.12 |
dnl Requires VOSF screen updates |
590 |
nigel |
1.1 |
if [[ "x$CAN_VOSF" = "xno" ]]; then |
591 |
|
|
continue |
592 |
|
|
fi |
593 |
|
|
dnl Real addressing will probably work. |
594 |
|
|
ADDRESSING_MODE="real" |
595 |
|
|
WANT_VOSF=yes dnl we can use VOSF and we need it actually |
596 |
|
|
DEFINES="$DEFINES -DREAL_ADDRESSING" |
597 |
nigel |
1.12 |
if [[ "x$ac_cv_pagezero_hack" = "xyes" ]]; then |
598 |
|
|
BLESS=Darwin/lowmem |
599 |
|
|
LDFLAGS="$LDFLAGS -pagezero_size 0x2000" |
600 |
|
|
fi |
601 |
nigel |
1.1 |
break |
602 |
|
|
;; |
603 |
|
|
direct) |
604 |
|
|
dnl Requires VOSF screen updates |
605 |
|
|
if [[ "x$CAN_VOSF" = "xyes" ]]; then |
606 |
|
|
ADDRESSING_MODE="direct" |
607 |
|
|
WANT_VOSF=yes dnl we can use VOSF and we need it actually |
608 |
|
|
DEFINES="$DEFINES -DDIRECT_ADDRESSING" |
609 |
|
|
break |
610 |
|
|
fi |
611 |
|
|
;; |
612 |
|
|
banks) |
613 |
|
|
dnl Default addressing mode |
614 |
|
|
ADDRESSING_MODE="memory banks" |
615 |
|
|
break |
616 |
|
|
;; |
617 |
|
|
*) |
618 |
|
|
AC_MSG_ERROR([Internal configure.in script error for $am addressing mode]) |
619 |
|
|
esac |
620 |
|
|
done |
621 |
|
|
AC_MSG_RESULT($ADDRESSING_MODE) |
622 |
|
|
if [[ "x$ADDRESSING_MODE" = "x" ]]; then |
623 |
|
|
AC_MSG_WARN([Sorry, no suitable addressing mode in $ADDRESSING_TEST_ORDER]) |
624 |
|
|
ADDRESSING_MODE="memory banks" |
625 |
|
|
fi |
626 |
|
|
fi |
627 |
|
|
|
628 |
nigel |
1.5 |
dnl Banked Memory Addressing mode is not supported by the JIT compiler |
629 |
|
|
if [[ "x$WANT_JIT" = "xyes" -a "x$ADDRESSING_MODE" = "xmemory banks" ]]; then |
630 |
|
|
AC_MSG_ERROR([Sorry, the JIT Compiler requires Direct Addressing, at least]) |
631 |
|
|
fi |
632 |
|
|
|
633 |
nigel |
1.1 |
dnl Enable VOSF screen updates with this feature is requested and feasible |
634 |
|
|
if [[ "x$WANT_VOSF" = "xyes" -a "x$CAN_VOSF" = "xyes" ]]; then |
635 |
nigel |
1.5 |
AC_DEFINE(ENABLE_VOSF, 1, [Define if using video enabled on SEGV signals.]) |
636 |
nigel |
1.1 |
else |
637 |
|
|
WANT_VOSF=no |
638 |
|
|
fi |
639 |
|
|
|
640 |
|
|
dnl Check for GAS. |
641 |
|
|
HAVE_GAS=no |
642 |
|
|
AC_MSG_CHECKING(for GAS .p2align feature) |
643 |
|
|
cat >conftest.S << EOF |
644 |
|
|
.text |
645 |
|
|
.p2align 5 |
646 |
|
|
EOF |
647 |
|
|
if $CC conftest.S -c -o conftest.o >/dev/null 2>&1 ; then HAVE_GAS=yes; fi |
648 |
|
|
AC_MSG_RESULT($HAVE_GAS) |
649 |
|
|
|
650 |
|
|
dnl Check for GCC 2.7 or higher. |
651 |
|
|
HAVE_GCC27=no |
652 |
|
|
AC_MSG_CHECKING(for GCC 2.7 or higher) |
653 |
nigel |
1.11 |
AC_EGREP_CPP(xyes, |
654 |
nigel |
1.1 |
[#if __GNUC__ - 1 > 1 || __GNUC_MINOR__ - 1 > 5 |
655 |
nigel |
1.11 |
xyes |
656 |
nigel |
1.1 |
#endif |
657 |
|
|
], [AC_MSG_RESULT(yes); HAVE_GCC27=yes], AC_MSG_RESULT(no)) |
658 |
|
|
|
659 |
|
|
dnl Check for GCC 3.0 or higher. |
660 |
|
|
HAVE_GCC30=no |
661 |
|
|
AC_MSG_CHECKING(for GCC 3.0 or higher) |
662 |
nigel |
1.11 |
AC_EGREP_CPP(xyes, |
663 |
nigel |
1.1 |
[#if __GNUC__ >= 3 |
664 |
nigel |
1.11 |
xyes |
665 |
nigel |
1.1 |
#endif |
666 |
|
|
], [AC_MSG_RESULT(yes); HAVE_GCC30=yes], AC_MSG_RESULT(no)) |
667 |
|
|
|
668 |
|
|
dnl Set "-fomit-frame-pointer" on i386 GCC 2.7 or higher. |
669 |
nigel |
1.3 |
dnl Also set "-fno-exceptions" for C++ because exception handling requires |
670 |
|
|
dnl the frame pointer. |
671 |
nigel |
1.1 |
if [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_I386" = "xyes" ]]; then |
672 |
|
|
CFLAGS="$CFLAGS -fomit-frame-pointer" |
673 |
nigel |
1.3 |
CXXFLAGS="$CXXFLAGS -fomit-frame-pointer -fno-exceptions" |
674 |
nigel |
1.1 |
fi |
675 |
|
|
|
676 |
|
|
dnl (gb) Do not merge constants since it breaks fpu/fpu_x86.cpp. |
677 |
|
|
dnl As of 2001/08/02, this affects the following compilers: |
678 |
|
|
dnl Official: probably gcc-3.1 (mainline CVS) |
679 |
|
|
dnl Mandrake: gcc-2.96 >= 0.59mdk, gcc-3.0.1 >= 0.1mdk |
680 |
|
|
dnl Red Hat : gcc-2.96 >= 89, gcc-3.0 >= 1 |
681 |
|
|
if [[ "x$HAVE_GCC27" = "xyes" ]]; then |
682 |
|
|
SAVED_CXXFLAGS="$CXXFLAGS" |
683 |
|
|
CXXFLAGS="$CXXFLAGS -fno-merge-constants" |
684 |
|
|
AC_CACHE_CHECK([whether GCC supports constants merging], ac_cv_gcc_constants_merging, [ |
685 |
|
|
AC_LANG_SAVE |
686 |
|
|
AC_LANG_CPLUSPLUS |
687 |
|
|
AC_TRY_COMPILE([],[],[ac_cv_gcc_constants_merging=yes],[ac_cv_gcc_constants_merging=no]) |
688 |
|
|
AC_LANG_RESTORE |
689 |
|
|
]) |
690 |
|
|
if [[ "x$ac_cv_gcc_constants_merging" != "xyes" ]]; then |
691 |
|
|
CXXFLAGS="$SAVED_CXXFLAGS" |
692 |
|
|
fi |
693 |
|
|
fi |
694 |
|
|
|
695 |
|
|
dnl Select appropriate CPU source and REGPARAM define. |
696 |
|
|
ASM_OPTIMIZATIONS=none |
697 |
|
|
CPUSRCS="cpuemu1.cpp cpuemu2.cpp cpuemu3.cpp cpuemu4.cpp cpuemu5.cpp cpuemu6.cpp cpuemu7.cpp cpuemu8.cpp" |
698 |
nigel |
1.5 |
|
699 |
|
|
dnl (gb) JITSRCS will be emptied later if the JIT is not available |
700 |
|
|
dnl Other platforms should define their own set of noflags file variants |
701 |
|
|
CAN_JIT=no |
702 |
|
|
JITSRCS="compemu1.cpp compemu2.cpp compemu3.cpp compemu4.cpp compemu5.cpp compemu6.cpp compemu7.cpp compemu8.cpp" |
703 |
|
|
|
704 |
nigel |
1.10 |
if [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_I386" = "xyes" ]]; then |
705 |
nigel |
1.1 |
dnl i386 CPU |
706 |
nigel |
1.5 |
DEFINES="$DEFINES -DUNALIGNED_PROFITABLE -DREGPARAM=\"__attribute__((regparm(3)))\"" |
707 |
nigel |
1.1 |
if [[ "x$HAVE_GAS" = "xyes" ]]; then |
708 |
|
|
ASM_OPTIMIZATIONS=i386 |
709 |
nigel |
1.5 |
DEFINES="$DEFINES -DX86_ASSEMBLY -DOPTIMIZED_FLAGS -DSAHF_SETO_PROFITABLE" |
710 |
nigel |
1.10 |
JITSRCS="cpuemu1_nf.cpp cpuemu2_nf.cpp cpuemu3_nf.cpp cpuemu4_nf.cpp cpuemu5_nf.cpp cpuemu6_nf.cpp cpuemu7_nf.cpp cpuemu8_nf.cpp $JITSRCS" |
711 |
|
|
CAN_JIT=yes |
712 |
|
|
fi |
713 |
|
|
elif [[ "x$HAVE_GCC30" = "xyes" -a "x$HAVE_X86_64" = "xyes" ]]; then |
714 |
|
|
dnl x86-64 CPU |
715 |
|
|
DEFINES="$DEFINES -DUNALIGNED_PROFITABLE" |
716 |
|
|
if [[ "x$HAVE_GAS" = "xyes" ]]; then |
717 |
|
|
ASM_OPTIMIZATIONS="x86-64" |
718 |
|
|
DEFINES="$DEFINES -DX86_64_ASSEMBLY -DOPTIMIZED_FLAGS" |
719 |
nigel |
1.1 |
fi |
720 |
|
|
elif [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_SPARC" = "xyes" -a "x$HAVE_GAS" = "xyes" ]]; then |
721 |
|
|
dnl SPARC CPU |
722 |
|
|
case "$target_os" in |
723 |
|
|
solaris*) |
724 |
|
|
AC_MSG_CHECKING(SPARC CPU architecture) |
725 |
|
|
SPARC_TYPE=`Solaris/which_sparc` |
726 |
|
|
AC_MSG_RESULT($SPARC_TYPE) |
727 |
|
|
case "$SPARC_TYPE" in |
728 |
|
|
SPARC_V8) |
729 |
|
|
ASM_OPTIMIZATIONS="SPARC V8 architecture" |
730 |
|
|
DEFINES="$DEFINES -DSPARC_V8_ASSEMBLY" dnl -DOPTIMIZED_FLAGS" |
731 |
|
|
CFLAGS="$CFLAGS -Wa,-Av8" |
732 |
|
|
CXXFLAGS="$CXXFLAGS -Wa,-Av8" |
733 |
|
|
;; |
734 |
|
|
SPARC_V9) |
735 |
|
|
ASM_OPTIMIZATIONS="SPARC V9 architecture" |
736 |
|
|
DEFINES="$DEFINES -DSPARC_V9_ASSEMBLY" dnl -DOPTIMIZED_FLAGS" |
737 |
|
|
CFLAGS="$CFLAGS -Wa,-Av9" |
738 |
|
|
CXXFLAGS="$CXXFLAGS -Wa,-Av9" |
739 |
|
|
;; |
740 |
|
|
esac |
741 |
|
|
;; |
742 |
|
|
esac |
743 |
|
|
elif [[ "x$WANT_NATIVE_M68K" = "xyes" ]]; then |
744 |
|
|
dnl Native m68k, no emulation |
745 |
|
|
CPUINCLUDES="-I../native_cpu" |
746 |
|
|
CPUSRCS="asm_support.s" |
747 |
|
|
fi |
748 |
|
|
|
749 |
nigel |
1.5 |
dnl Enable JIT compiler, if possible. |
750 |
|
|
if [[ "x$WANT_JIT" = "xyes" -a "x$CAN_JIT" ]]; then |
751 |
|
|
JITSRCS="$JITSRCS ../uae_cpu/compiler/compemu_support.cpp ../uae_cpu/compiler/compemu_fpp.cpp compstbl.o cpustbl_nf.o" |
752 |
|
|
DEFINES="$DEFINES -DUSE_JIT -DUSE_JIT_FPU" |
753 |
|
|
|
754 |
|
|
if [[ "x$WANT_JIT_DEBUG" = "xyes" ]]; then |
755 |
|
|
if [[ "x$WANT_MON" = "xyes" ]]; then |
756 |
|
|
DEFINES="$DEFINES -DJIT_DEBUG=1" |
757 |
|
|
else |
758 |
|
|
AC_MSG_WARN([cxmon not found, ignoring --enable-jit-debug]) |
759 |
|
|
WANT_JIT_DEBUG=no |
760 |
|
|
fi |
761 |
|
|
fi |
762 |
|
|
|
763 |
|
|
dnl IEEE core is the only FPU emulator to use with the JIT compiler |
764 |
|
|
case $FPE_CORE_TEST_ORDER in |
765 |
|
|
ieee*) ;; |
766 |
|
|
*) AC_MSG_WARN([Forcing use of the IEEE FPU core, as the JIT compiler supports only this one.]) ;; |
767 |
|
|
esac |
768 |
|
|
FPE_CORE_TEST_ORDER="ieee" |
769 |
|
|
else |
770 |
|
|
WANT_JIT=no |
771 |
|
|
WANT_JIT_DEBUG=no |
772 |
|
|
JITSRCS="" |
773 |
|
|
fi |
774 |
|
|
|
775 |
|
|
dnl Utility macro used by next two tests. |
776 |
|
|
dnl AC_EXAMINE_OBJECT(C source code, |
777 |
|
|
dnl commands examining object file, |
778 |
|
|
dnl [commands to run if compile failed]): |
779 |
|
|
dnl |
780 |
|
|
dnl Compile the source code to an object file; then convert it into a |
781 |
|
|
dnl printable representation. All unprintable characters and |
782 |
|
|
dnl asterisks (*) are replaced by dots (.). All white space is |
783 |
|
|
dnl deleted. Newlines (ASCII 0x10) in the input are preserved in the |
784 |
|
|
dnl output, but runs of newlines are compressed to a single newline. |
785 |
|
|
dnl Finally, line breaks are forcibly inserted so that no line is |
786 |
|
|
dnl longer than 80 columns and the file ends with a newline. The |
787 |
|
|
dnl result of all this processing is in the file conftest.dmp, which |
788 |
|
|
dnl may be examined by the commands in the second argument. |
789 |
|
|
dnl |
790 |
|
|
AC_DEFUN([gcc_AC_EXAMINE_OBJECT], |
791 |
|
|
[AC_LANG_SAVE |
792 |
|
|
AC_LANG_C |
793 |
|
|
dnl Next bit cribbed from AC_TRY_COMPILE. |
794 |
|
|
cat > conftest.$ac_ext <<EOF |
795 |
|
|
[#line __oline__ "configure" |
796 |
|
|
#include "confdefs.h" |
797 |
|
|
$1 |
798 |
|
|
]EOF |
799 |
|
|
if AC_TRY_EVAL(ac_compile); then |
800 |
|
|
od -c conftest.o | |
801 |
|
|
sed ['s/^[0-7]*[ ]*/ / |
802 |
|
|
s/\*/./g |
803 |
|
|
s/ \\n/*/g |
804 |
|
|
s/ [0-9][0-9][0-9]/./g |
805 |
|
|
s/ \\[^ ]/./g'] | |
806 |
|
|
tr -d ' |
807 |
|
|
' | tr -s '*' ' |
808 |
|
|
' | fold | sed '$a\ |
809 |
|
|
' > conftest.dmp |
810 |
|
|
$2 |
811 |
|
|
ifelse($3, , , else |
812 |
|
|
$3 |
813 |
|
|
)dnl |
814 |
|
|
fi |
815 |
|
|
rm -rf conftest* |
816 |
|
|
AC_LANG_RESTORE]) |
817 |
|
|
|
818 |
|
|
dnl Floating point format probe. |
819 |
|
|
dnl The basic concept is the same as the above: grep the object |
820 |
|
|
dnl file for an interesting string. We have to watch out for |
821 |
|
|
dnl rounding changing the values in the object, however; this is |
822 |
|
|
dnl handled by ignoring the least significant byte of the float. |
823 |
|
|
dnl |
824 |
|
|
dnl Does not know about VAX G-float or C4x idiosyncratic format. |
825 |
|
|
dnl It does know about PDP-10 idiosyncratic format, but this is |
826 |
|
|
dnl not presently supported by GCC. S/390 "binary floating point" |
827 |
|
|
dnl is in fact IEEE (but maybe we should have that in EBCDIC as well |
828 |
|
|
dnl as ASCII?) |
829 |
|
|
dnl |
830 |
|
|
AC_DEFUN([gcc_AC_C_FLOAT_FORMAT], |
831 |
|
|
[AC_CACHE_CHECK(floating point format, ac_cv_c_float_format, |
832 |
|
|
[gcc_AC_EXAMINE_OBJECT( |
833 |
|
|
[/* This will not work unless sizeof(double) == 8. */ |
834 |
|
|
extern char sizeof_double_must_be_8 [sizeof(double) == 8 ? 1 : -1]; |
835 |
|
|
|
836 |
|
|
/* This structure must have no internal padding. */ |
837 |
|
|
struct possibility { |
838 |
|
|
char prefix[8]; |
839 |
|
|
double candidate; |
840 |
|
|
char postfix[8]; |
841 |
|
|
}; |
842 |
|
|
|
843 |
|
|
#define C(cand) { "\nformat:", cand, ":tamrof\n" } |
844 |
|
|
struct possibility table [] = |
845 |
|
|
{ |
846 |
|
|
C( 3.25724264705901305206e+01), /* @@IEEEFP - IEEE 754 */ |
847 |
|
|
C( 3.53802595280598432000e+18), /* D__float - VAX */ |
848 |
|
|
C( 5.32201830133125317057e-19), /* D.PDP-10 - PDP-10 - the dot is 0x13a */ |
849 |
|
|
C( 1.77977764695171661377e+10), /* IBMHEXFP - s/390 format, ascii */ |
850 |
|
|
C(-5.22995989424860458374e+10) /* IBMHEXFP - s/390 format, EBCDIC */ |
851 |
|
|
};], |
852 |
|
|
[if grep 'format:.@IEEEF.:tamrof' conftest.dmp >/dev/null 2>&1; then |
853 |
|
|
ac_cv_c_float_format='IEEE (big-endian)' |
854 |
|
|
elif grep 'format:.I@@PFE.:tamrof' conftest.dmp >/dev/null 2>&1; then |
855 |
|
|
ac_cv_c_float_format='IEEE (big-endian)' |
856 |
|
|
elif grep 'format:.FEEEI@.:tamrof' conftest.dmp >/dev/null 2>&1; then |
857 |
|
|
ac_cv_c_float_format='IEEE (little-endian)' |
858 |
|
|
elif grep 'format:.EFP@@I.:tamrof' conftest.dmp >/dev/null 2>&1; then |
859 |
|
|
ac_cv_c_float_format='IEEE (little-endian)' |
860 |
|
|
elif grep 'format:.__floa.:tamrof' conftest.dmp >/dev/null 2>&1; then |
861 |
|
|
ac_cv_c_float_format='VAX D-float' |
862 |
|
|
elif grep 'format:..PDP-1.:tamrof' conftest.dmp >/dev/null 2>&1; then |
863 |
|
|
ac_cv_c_float_format='PDP-10' |
864 |
|
|
elif grep 'format:.BMHEXF.:tamrof' conftest.dmp >/dev/null 2>&1; then |
865 |
|
|
ac_cv_c_float_format='IBM 370 hex' |
866 |
nigel |
1.1 |
else |
867 |
nigel |
1.5 |
AC_MSG_ERROR(Unknown floating point format) |
868 |
|
|
fi], |
869 |
|
|
[AC_MSG_ERROR(compile failed)]) |
870 |
|
|
]) |
871 |
|
|
# IEEE is the default format. If the float endianness isn't the same |
872 |
|
|
# as the integer endianness, we have to set FLOAT_WORDS_BIG_ENDIAN |
873 |
|
|
# (which is a tristate: yes, no, default). This is only an issue with |
874 |
|
|
# IEEE; the other formats are only supported by a few machines each, |
875 |
|
|
# all with the same endianness. |
876 |
|
|
format=IEEE_FLOAT_FORMAT |
877 |
|
|
fbigend= |
878 |
|
|
case $ac_cv_c_float_format in |
879 |
|
|
'IEEE (big-endian)' ) |
880 |
|
|
if test $ac_cv_c_bigendian = no; then |
881 |
|
|
fbigend=1 |
882 |
|
|
fi |
883 |
|
|
;; |
884 |
|
|
'IEEE (little-endian)' ) |
885 |
|
|
if test $ac_cv_c_bigendian = yes; then |
886 |
|
|
fbigend=0 |
887 |
|
|
fi |
888 |
|
|
;; |
889 |
|
|
'VAX D-float' ) |
890 |
|
|
format=VAX_FLOAT_FORMAT |
891 |
|
|
;; |
892 |
|
|
'PDP-10' ) |
893 |
|
|
format=PDP10_FLOAT_FORMAT |
894 |
|
|
;; |
895 |
|
|
'IBM 370 hex' ) |
896 |
|
|
format=IBM_FLOAT_FORMAT |
897 |
|
|
;; |
898 |
|
|
esac |
899 |
|
|
AC_DEFINE_UNQUOTED(HOST_FLOAT_FORMAT, $format, |
900 |
|
|
[Define to the floating point format of the host machine.]) |
901 |
|
|
if test -n "$fbigend"; then |
902 |
|
|
AC_DEFINE_UNQUOTED(HOST_FLOAT_WORDS_BIG_ENDIAN, $fbigend, |
903 |
|
|
[Define to 1 if the host machine stores floating point numbers in |
904 |
|
|
memory with the word containing the sign bit at the lowest address, |
905 |
|
|
or to 0 if it does it the other way around. |
906 |
|
|
|
907 |
|
|
This macro should not be defined if the ordering is the same as for |
908 |
|
|
multi-word integers.]) |
909 |
nigel |
1.1 |
fi |
910 |
nigel |
1.5 |
]) |
911 |
nigel |
1.1 |
|
912 |
nigel |
1.5 |
dnl Select appropriate FPU source. |
913 |
|
|
gcc_AC_C_FLOAT_FORMAT |
914 |
|
|
AC_CHECK_HEADERS(ieee754.h ieeefp.h floatingpoint.h nan.h) |
915 |
|
|
|
916 |
|
|
for fpe in $FPE_CORE_TEST_ORDER; do |
917 |
|
|
case $fpe in |
918 |
|
|
ieee) |
919 |
|
|
case $ac_cv_c_float_format in |
920 |
|
|
IEEE*) |
921 |
|
|
FPE_CORE="IEEE fpu core" |
922 |
|
|
DEFINES="$DEFINES -DFPU_IEEE" |
923 |
|
|
FPUSRCS="../uae_cpu/fpu/fpu_ieee.cpp" |
924 |
|
|
dnl Math functions not mandated by C99 standard |
925 |
|
|
AC_CHECK_FUNCS(isnanl isinfl) |
926 |
|
|
dnl Math functions required by C99 standard, but probably not |
927 |
|
|
dnl implemented everywhere. In that case, we fall back to the |
928 |
|
|
dnl regular variant for doubles. |
929 |
|
|
AC_CHECK_FUNCS(logl log10l expl powl fabsl sqrtl) |
930 |
|
|
AC_CHECK_FUNCS(sinl cosl tanl sinhl coshl tanhl) |
931 |
|
|
AC_CHECK_FUNCS(asinl acosl atanl asinhl acoshl atanhl) |
932 |
|
|
AC_CHECK_FUNCS(floorl ceill) |
933 |
|
|
break |
934 |
|
|
;; |
935 |
|
|
esac |
936 |
|
|
;; |
937 |
|
|
x86) |
938 |
|
|
if [[ ":$HAVE_GCC27:$HAVE_I386:$HAVE_GAS:" = ":yes:yes:yes:" ]]; then |
939 |
|
|
FPE_CORE="i387 fpu core" |
940 |
|
|
DEFINES="$DEFINES -DFPU_X86" |
941 |
|
|
FPUSRCS="../uae_cpu/fpu/fpu_x86.cpp" |
942 |
|
|
break |
943 |
|
|
fi |
944 |
|
|
;; |
945 |
|
|
uae) |
946 |
|
|
FPE_CORE="uae fpu core" |
947 |
|
|
DEFINES="$DEFINES -DFPU_UAE" |
948 |
|
|
FPUSRCS="../uae_cpu/fpu/fpu_uae.cpp" |
949 |
|
|
break |
950 |
|
|
;; |
951 |
|
|
*) |
952 |
|
|
AC_MSG_ERROR([Internal configure.in script error for $fpe fpu core]) |
953 |
|
|
;; |
954 |
|
|
esac |
955 |
|
|
done |
956 |
|
|
if [[ "x$FPE_CORE" = "x" ]]; then |
957 |
|
|
AC_MSG_ERROR([Sorry, no suitable FPU core found in $FPE_CORE_TEST_ORDER]) |
958 |
nigel |
1.1 |
fi |
959 |
|
|
|
960 |
|
|
dnl Check for certain math functions |
961 |
|
|
AC_CHECK_FUNCS(atanh) |
962 |
nigel |
1.5 |
AC_CHECK_FUNCS(isnan isinf finite isnormal signbit) |
963 |
nigel |
1.1 |
|
964 |
|
|
dnl UAE CPU sources for all non-m68k-native architectures. |
965 |
|
|
if [[ "x$WANT_NATIVE_M68K" = "xno" ]]; then |
966 |
|
|
CPUINCLUDES="-I../uae_cpu" |
967 |
nigel |
1.5 |
CPUSRCS="../uae_cpu/basilisk_glue.cpp ../uae_cpu/memory.cpp ../uae_cpu/newcpu.cpp ../uae_cpu/readcpu.cpp $FPUSRCS cpustbl.cpp cpudefs.cpp $CPUSRCS $JITSRCS" |
968 |
nigel |
1.1 |
fi |
969 |
|
|
|
970 |
|
|
dnl Remove the "-g" option if set for GCC. |
971 |
|
|
if [[ "x$HAVE_GCC27" = "xyes" ]]; then |
972 |
|
|
CFLAGS=`echo $CFLAGS | sed -e 's/-g//g'` |
973 |
|
|
CXXFLAGS=`echo $CXXFLAGS | sed -e 's/-g//g'` |
974 |
|
|
fi |
975 |
|
|
|
976 |
nigel |
1.10 |
dnl Or if we have -IPA (MIPSPro compilers) |
977 |
|
|
if [[ "x$HAVE_IPA" = "xyes" ]]; then |
978 |
|
|
CFLAGS="`echo $CFLAGS | sed -e 's/-g//g'` -O3 -OPT:Olimit=0 -IPA" |
979 |
|
|
CXXFLAGS="`echo $CXXFLAGS | sed -e 's/-g//g'` -O3 -OPT:Olimit=0 -IPA" |
980 |
nigel |
1.1 |
CXXFLAGS="-LANG:std $CXXFLAGS" |
981 |
nigel |
1.10 |
LDFLAGS="$LDFLAGS -O3 -OPT:Olimit=0 -IPA" |
982 |
nigel |
1.1 |
fi |
983 |
|
|
|
984 |
|
|
dnl Generate Makefile. |
985 |
|
|
AC_SUBST(DEFINES) |
986 |
|
|
AC_SUBST(SYSSRCS) |
987 |
|
|
AC_SUBST(CPUINCLUDES) |
988 |
|
|
AC_SUBST(CPUSRCS) |
989 |
nigel |
1.12 |
AC_SUBST(BLESS) |
990 |
nigel |
1.11 |
dnl autoconf on 10.1 doesn't understand these |
991 |
|
|
dnl AC_CONFIG_FILES([Makefile]) |
992 |
|
|
dnl AC_OUTPUT |
993 |
nigel |
1.1 |
AC_OUTPUT(Makefile) |
994 |
|
|
|
995 |
|
|
dnl Print summary. |
996 |
|
|
echo |
997 |
|
|
echo Basilisk II configuration summary: |
998 |
|
|
echo |
999 |
nigel |
1.8 |
echo Multiple emulator windows .............. : $ENABLE_MULTIPLE |
1000 |
nigel |
1.5 |
echo Enable video on SEGV signals ........... : $WANT_VOSF |
1001 |
|
|
echo mon debugger support ................... : $WANT_MON |
1002 |
|
|
echo Use JIT compiler ....................... : $WANT_JIT |
1003 |
|
|
echo JIT debug mode ......................... : $WANT_JIT_DEBUG |
1004 |
|
|
echo Floating-Point emulation core .......... : $FPE_CORE |
1005 |
|
|
echo Assembly optimizations ................. : $ASM_OPTIMIZATIONS |
1006 |
|
|
echo Addressing mode ........................ : $ADDRESSING_MODE |
1007 |
nigel |
1.12 |
echo Bad memory access recovery type ........ : $sigsegv_recovery |
1008 |
nigel |
1.1 |
echo |
1009 |
nigel |
1.2 |
echo "Configuration done. Now type \"make\" (or \"make ide\")." |