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