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