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