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 |
|
|
dnl These defines are necessary to get 64-bit file size support. |
10 |
|
|
AC_DEFINE(_USE_LARGEFILE_SOURCE, 1, [Get more functions for correct standard I/O]) |
11 |
|
|
AC_DEFINE(_FILE_OFFSET_BITS, 64, [Get 64-bit file size support]) |
12 |
|
|
|
13 |
|
|
dnl Options. |
14 |
|
|
AC_ARG_ENABLE(full, |
15 |
|
|
[ --enable-full use full screen mode [default=no]], [WANT_FULL=$enableval], [WANT_FULL=no]) |
16 |
|
|
AC_ARG_ENABLE(multiwin, |
17 |
|
|
[ --enable-multiwin allow multiple emulator windows [default=no]], [WANT_MWIN=$enableval], [WANT_MWIN=no]) |
18 |
|
|
|
19 |
|
|
dnl FPU emulation core. |
20 |
|
|
AC_ARG_ENABLE(fpe, |
21 |
|
|
[ --enable-fpe=which specify which fpu emulator to use [default=opt]], |
22 |
|
|
[ case "$enableval" in |
23 |
|
|
default) FPE_CORE="default";; dnl fpu_x86.cpp if i386 architecture, fpu_uae.cpp otherwise |
24 |
|
|
uae) FPE_CORE="uae";; |
25 |
|
|
*) AC_MSG_ERROR([--enable-fpe takes only one of the following values: default, uae]);; |
26 |
|
|
esac |
27 |
|
|
], |
28 |
|
|
[ FPE_CORE="default" |
29 |
|
|
]) |
30 |
|
|
|
31 |
|
|
dnl Addressing modes. |
32 |
|
|
AC_ARG_ENABLE(addressing, |
33 |
|
|
[ --enable-addressing=AM specify the addressing mode to use [default=fastest]], |
34 |
|
|
[ case "$enableval" in |
35 |
|
|
real) ADDRESSING_TEST_ORDER="real";; |
36 |
|
|
direct) ADDRESSING_TEST_ORDER="direct";; |
37 |
|
|
banks) ADDRESSING_TEST_ORDER="banks";; |
38 |
|
|
fastest)ADDRESSING_TEST_ORDER="direct banks";; |
39 |
|
|
*) AC_MSG_ERROR([--enable-addressing takes only one of the following values: fastest, real, direct, banks]);; |
40 |
|
|
esac |
41 |
|
|
], |
42 |
|
|
[ ADDRESSING_TEST_ORDER="direct banks" |
43 |
|
|
]) |
44 |
|
|
|
45 |
|
|
dnl External packages. |
46 |
|
|
AC_ARG_WITH(mon, [ --with-mon use mon as debugger [default=yes]], [WANT_MON=$withval], [WANT_MON=yes]) |
47 |
|
|
|
48 |
|
|
dnl Canonical system information. |
49 |
|
|
AC_CANONICAL_HOST |
50 |
|
|
AC_CANONICAL_TARGET |
51 |
|
|
|
52 |
|
|
dnl Target OS type |
53 |
|
|
OS_TYPE=darwin |
54 |
|
|
DEFINES="$DEFINES -DOS_$OS_TYPE" |
55 |
|
|
|
56 |
|
|
dnl Target CPU type. |
57 |
|
|
HAVE_I386=no |
58 |
|
|
HAVE_M68K=no |
59 |
|
|
HAVE_SPARC=no |
60 |
|
|
HAVE_POWERPC=no |
61 |
|
|
case "$target_cpu" in |
62 |
|
|
i386* | i486* | i586* | i686* | i786* ) CPU_TYPE=i386 HAVE_I386=yes;; |
63 |
|
|
m68k* ) CPU_TYPE=m68k HAVE_M68K=yes;; |
64 |
|
|
sparc* ) CPU_TYPE=sparc HAVE_SPARC=yes;; |
65 |
|
|
powerpc* ) CPU_TYPE=powerpc HAVE_POWERPC=yes;; |
66 |
|
|
*) CPU_TYPE=`echo $target_cpu | sed -e 's/-/_/g'`;; |
67 |
|
|
esac |
68 |
|
|
DEFINES="$DEFINES -DCPU_$CPU_TYPE" |
69 |
|
|
|
70 |
|
|
dnl Checks for programs. |
71 |
|
|
AC_PROG_CC |
72 |
|
|
AC_PROG_CC_C_O |
73 |
|
|
AC_PROG_CPP |
74 |
|
|
AC_PROG_CXX |
75 |
|
|
AC_PROG_MAKE_SET |
76 |
|
|
AC_PROG_INSTALL |
77 |
|
|
|
78 |
|
|
dnl We use mon if possible. |
79 |
|
|
MONSRCS= |
80 |
|
|
if [[ "x$WANT_MON" = "xyes" ]]; then |
81 |
|
|
AC_MSG_CHECKING(for mon) |
82 |
|
|
mon_srcdir=../../../mon/src |
83 |
|
|
if grep mon_init $mon_srcdir/mon.h >/dev/null 2>/dev/null; then |
84 |
|
|
AC_MSG_RESULT(yes) |
85 |
|
|
AC_DEFINE(ENABLE_MON) |
86 |
|
|
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/disass/floatformat.c $mon_srcdir/disass/i386-dis.c $mon_srcdir/disass/m68k-dis.c $mon_srcdir/disass/m68k-opc.c" |
87 |
|
|
CXXFLAGS="$CXXFLAGS -I$mon_srcdir -I$mon_srcdir/disass" |
88 |
|
|
AC_CHECK_LIB(readline, readline) |
89 |
|
|
AC_CHECK_LIB(termcap, tputs) |
90 |
|
|
AC_CHECK_HEADERS(readline.h history.h readline/readline.h readline/history.h) |
91 |
|
|
else |
92 |
|
|
AC_MSG_RESULT(no) |
93 |
|
|
AC_MSG_WARN([Could not find mon, ignoring --with-mon.]) |
94 |
|
|
WANT_MON=no |
95 |
|
|
fi |
96 |
|
|
fi |
97 |
|
|
|
98 |
|
|
dnl We want pthreads. |
99 |
|
|
HAVE_PTHREADS=yes |
100 |
|
|
AC_CHECK_FUNCS(pthread_cancel) |
101 |
nigel |
1.3 |
AC_CHECK_FUNCS(pthread_mutexattr_setprotocol) |
102 |
|
|
AC_CHECK_FUNCS(pthread_mutexattr_settype) |
103 |
nigel |
1.1 |
|
104 |
|
|
dnl If POSIX.4 semaphores are not available, we emulate them with pthread mutexes. |
105 |
|
|
SEMSRC= |
106 |
|
|
AC_CHECK_FUNCS(sem_init, , [ |
107 |
|
|
if test "x$HAVE_PTHREADS" = "xyes"; then |
108 |
|
|
SEMSRC=posix_sem.cpp |
109 |
|
|
fi |
110 |
|
|
]) |
111 |
|
|
|
112 |
|
|
dnl We allow full screen mode if possible. |
113 |
|
|
if [[ "x$WANT_FULL" = "xyes" ]]; then |
114 |
|
|
WANT_FULL=yes |
115 |
|
|
DEFINES="$DEFINES -DENABLE_FULL=1" |
116 |
|
|
LIBS="$LIBS $FRMWKS/QuickTime.framework/QuickTime" |
117 |
|
|
else |
118 |
|
|
DEFINES="$DEFINES -DENABLE_FULL=0" |
119 |
|
|
fi |
120 |
|
|
|
121 |
|
|
|
122 |
|
|
dnl Ditto for multiple window support |
123 |
|
|
if [[ "x$WANT_MWIN" = "xyes" ]]; then |
124 |
|
|
WANT_MWIN=yes |
125 |
|
|
DEFINES="$DEFINES -DENABLE_MULTIPLE" |
126 |
|
|
fi |
127 |
|
|
|
128 |
|
|
dnl Checks for header files. |
129 |
|
|
AC_HEADER_STDC |
130 |
|
|
AC_CHECK_HEADERS(unistd.h fcntl.h sys/time.h sys/mman.h) |
131 |
|
|
|
132 |
|
|
dnl Checks for typedefs, structures, and compiler characteristics. |
133 |
|
|
AC_C_BIGENDIAN |
134 |
|
|
AC_C_CONST |
135 |
|
|
AC_C_INLINE |
136 |
|
|
AC_CHECK_SIZEOF(short, 2) |
137 |
|
|
AC_CHECK_SIZEOF(int, 4) |
138 |
|
|
AC_CHECK_SIZEOF(long, 4) |
139 |
|
|
AC_CHECK_SIZEOF(long long, 8) |
140 |
|
|
AC_CHECK_SIZEOF(void *, 4) |
141 |
|
|
AC_TYPE_OFF_T |
142 |
|
|
AC_CHECK_TYPE(loff_t, off_t) |
143 |
nigel |
1.4 |
AC_CHECK_TYPE(caddr_t, [char *]) |
144 |
nigel |
1.1 |
dnl TYPE_SOCKLEN_T |
145 |
|
|
AC_CHECK_TYPE(socklen_t) |
146 |
|
|
AC_TYPE_SIZE_T |
147 |
|
|
AC_TYPE_SIGNAL |
148 |
|
|
AC_HEADER_TIME |
149 |
|
|
AC_STRUCT_TM |
150 |
|
|
|
151 |
|
|
dnl Checks for library functions. |
152 |
|
|
AC_CHECK_FUNCS(strdup cfmakeraw) |
153 |
|
|
AC_CHECK_FUNCS(clock_gettime timer_create) |
154 |
|
|
AC_CHECK_FUNCS(sigaction signal) |
155 |
|
|
AC_CHECK_FUNCS(mmap mprotect munmap) |
156 |
|
|
AC_CHECK_FUNCS(vm_allocate vm_deallocate vm_protect) |
157 |
|
|
|
158 |
|
|
dnl Darwin seems to define mach_task_self() instead of task_self(). |
159 |
|
|
AC_CHECK_FUNCS(mach_task_self task_self) |
160 |
|
|
|
161 |
|
|
dnl Select system-dependant source files. |
162 |
|
|
DEFINES="$DEFINES -DBSD_COMP" |
163 |
|
|
dnl Check for the CAM library |
164 |
|
|
AC_CHECK_LIB(cam, cam_open_btl, HAVE_LIBCAM=yes, HAVE_LIBCAM=no) |
165 |
|
|
if [[ "x$HAVE_LIBCAM" = "xno" ]]; then |
166 |
|
|
AC_MSG_WARN([Cannot find libcam for SCSI management, disabling SCSI support.]) |
167 |
|
|
else |
168 |
|
|
dnl Check for the sys kernel includes |
169 |
|
|
AC_CHECK_HEADER(camlib.h) |
170 |
|
|
if [[ "x$ac_cv_header_camlib_h" = "xno" ]]; then |
171 |
|
|
dnl In this case I should fix this thing including a "patch" |
172 |
|
|
dnl to access directly to the functions in the kernel :) --Orlando |
173 |
|
|
AC_MSG_WARN([Cannot find includes for CAM library, disabling SCSI support.]) |
174 |
|
|
else |
175 |
|
|
SCSISRC=FreeBSD/scsi_freebsd.cpp |
176 |
|
|
LIBS="$LIBS -lcam" |
177 |
|
|
DEFINES="$DEFINES -DCAM" |
178 |
|
|
fi |
179 |
|
|
fi |
180 |
|
|
|
181 |
|
|
dnl Use 68k CPU natively? |
182 |
|
|
WANT_NATIVE_M68K=no |
183 |
|
|
|
184 |
|
|
SYSSRCS=$SCSISRC |
185 |
|
|
|
186 |
|
|
dnl Define a macro that translates a yesno-variable into a C macro definition |
187 |
|
|
dnl to be put into the config.h file |
188 |
|
|
dnl $1 -- the macro to define |
189 |
|
|
dnl $2 -- the value to translate |
190 |
|
|
AC_DEFUN(AC_TRANSLATE_DEFINE, [ |
191 |
|
|
if [[ "x$2" = "xyes" -o "x$2" = "xguessing yes" ]]; then |
192 |
|
|
AC_DEFINE($1) |
193 |
|
|
fi |
194 |
|
|
]) |
195 |
|
|
|
196 |
|
|
dnl Various checks if the system supports vm_allocate() and the like functions. |
197 |
|
|
have_mach_vm=no |
198 |
|
|
if [[ "x$ac_cv_func_vm_allocate" = "xyes" -a "x$ac_cv_func_vm_deallocate" = "xyes" -a \ |
199 |
|
|
"x$ac_cv_func_vm_protect" = "xyes" ]]; then |
200 |
|
|
have_mach_vm=yes |
201 |
|
|
fi |
202 |
|
|
AC_TRANSLATE_DEFINE(HAVE_MACH_VM, "$have_mach_vm") |
203 |
|
|
|
204 |
|
|
dnl Check that vm_allocate(), vm_protect() work |
205 |
|
|
if [[ "x$have_mach_vm" = "xyes" ]]; then |
206 |
|
|
|
207 |
|
|
AC_CACHE_CHECK("whether vm_protect works", |
208 |
|
|
ac_cv_vm_protect_works, [ |
209 |
|
|
AC_LANG_SAVE |
210 |
|
|
AC_LANG_CPLUSPLUS |
211 |
|
|
ac_cv_vm_protect_works=yes |
212 |
|
|
dnl First the tests that should segfault |
213 |
|
|
for test_def in NONE_READ NONE_WRITE READ_WRITE; do |
214 |
|
|
AC_TRY_RUN([ |
215 |
|
|
#define CONFIGURE_TEST_VM_MAP |
216 |
|
|
#define TEST_VM_PROT_$test_def |
217 |
|
|
#include "vm_alloc.cpp" |
218 |
|
|
], ac_cv_vm_protect_works=no, rm -f core, |
219 |
|
|
dnl When cross-compiling, do not assume anything |
220 |
|
|
ac_cv_vm_protect_works="guessing no" |
221 |
|
|
) |
222 |
|
|
done |
223 |
|
|
AC_TRY_RUN([ |
224 |
|
|
#define CONFIGURE_TEST_VM_MAP |
225 |
|
|
#define TEST_VM_PROT_RDWR_WRITE |
226 |
|
|
#include "vm_alloc.cpp" |
227 |
|
|
], , ac_cv_vm_protect_works=no, |
228 |
|
|
dnl When cross-compiling, do not assume anything |
229 |
|
|
ac_cv_vm_protect_works="guessing no" |
230 |
|
|
) |
231 |
|
|
AC_LANG_RESTORE |
232 |
|
|
] |
233 |
|
|
) |
234 |
|
|
|
235 |
|
|
dnl Remove support for vm_allocate() if vm_protect() does not work |
236 |
|
|
if [[ "x$have_mach_vm" = "xyes" ]]; then |
237 |
|
|
case $ac_cv_vm_protect_works in |
238 |
|
|
*yes) have_mach_vm=yes;; |
239 |
|
|
*no) have_mach_vm=no;; |
240 |
|
|
esac |
241 |
|
|
fi |
242 |
|
|
AC_TRANSLATE_DEFINE(HAVE_MACH_VM, "$have_mach_vm") |
243 |
|
|
|
244 |
|
|
fi dnl HAVE_MACH_VM |
245 |
|
|
|
246 |
|
|
dnl Various checks if the system supports mmap() and the like functions. |
247 |
|
|
dnl ... and Mach memory allocators are not supported |
248 |
|
|
have_mmap_vm=no |
249 |
|
|
if [[ "x$ac_cv_func_mmap" = "xyes" -a "x$ac_cv_func_munmap" = "xyes" -a \ |
250 |
|
|
"x$ac_cv_func_mprotect" = "xyes" ]]; then |
251 |
|
|
if [[ "x$have_mach_vm" = "xno" ]]; then |
252 |
|
|
have_mmap_vm=yes |
253 |
|
|
fi |
254 |
|
|
fi |
255 |
|
|
AC_TRANSLATE_DEFINE(HAVE_MMAP_VM, "$have_mmap_vm") |
256 |
|
|
|
257 |
|
|
dnl Check that mmap() and associated functions work. |
258 |
|
|
if [[ "x$have_mmap_vm" = "xyes" ]]; then |
259 |
|
|
|
260 |
|
|
dnl Check if we have a working anonymous mmap() |
261 |
|
|
AC_CACHE_CHECK("whether mmap supports MAP_ANON", |
262 |
|
|
ac_cv_mmap_anon, [ |
263 |
|
|
AC_LANG_SAVE |
264 |
|
|
AC_LANG_CPLUSPLUS |
265 |
|
|
AC_TRY_RUN([ |
266 |
|
|
#define HAVE_MMAP_ANON |
267 |
|
|
#define CONFIGURE_TEST_VM_MAP |
268 |
|
|
#define TEST_VM_MMAP_ANON |
269 |
|
|
#include "vm_alloc.cpp" |
270 |
|
|
], ac_cv_mmap_anon=yes, ac_cv_mmap_anon=no, |
271 |
|
|
dnl When cross-compiling, do not assume anything. |
272 |
|
|
ac_cv_mmap_anon="guessing no" |
273 |
|
|
) |
274 |
|
|
AC_LANG_RESTORE |
275 |
|
|
] |
276 |
|
|
) |
277 |
|
|
AC_TRANSLATE_DEFINE(HAVE_MMAP_ANON, "$ac_cv_mmap_anon") |
278 |
|
|
|
279 |
|
|
AC_CACHE_CHECK("whether mmap supports MAP_ANONYMOUS", |
280 |
|
|
ac_cv_mmap_anonymous, [ |
281 |
|
|
AC_LANG_SAVE |
282 |
|
|
AC_LANG_CPLUSPLUS |
283 |
|
|
AC_TRY_RUN([ |
284 |
|
|
#define HAVE_MMAP_ANONYMOUS |
285 |
|
|
#define CONFIGURE_TEST_VM_MAP |
286 |
|
|
#define TEST_VM_MMAP_ANON |
287 |
|
|
#include "vm_alloc.cpp" |
288 |
|
|
], ac_cv_mmap_anonymous=yes, ac_cv_mmap_anonymous=no, |
289 |
|
|
dnl When cross-compiling, do not assume anything. |
290 |
|
|
ac_cv_mmap_anonymous="guessing no" |
291 |
|
|
) |
292 |
|
|
AC_LANG_RESTORE |
293 |
|
|
] |
294 |
|
|
) |
295 |
|
|
AC_TRANSLATE_DEFINE(HAVE_MMAP_ANONYMOUS, "$ac_cv_mmap_anonymous") |
296 |
|
|
|
297 |
|
|
AC_CACHE_CHECK("whether mprotect works", |
298 |
|
|
ac_cv_mprotect_works, [ |
299 |
|
|
AC_LANG_SAVE |
300 |
|
|
AC_LANG_CPLUSPLUS |
301 |
|
|
ac_cv_mprotect_works=yes |
302 |
|
|
dnl First the tests that should segfault |
303 |
|
|
for test_def in NONE_READ NONE_WRITE READ_WRITE; do |
304 |
|
|
AC_TRY_RUN([ |
305 |
|
|
#define CONFIGURE_TEST_VM_MAP |
306 |
|
|
#define TEST_VM_PROT_$test_def |
307 |
|
|
#include "vm_alloc.cpp" |
308 |
|
|
], ac_cv_mprotect_works=no, rm -f core, |
309 |
|
|
dnl When cross-compiling, do not assume anything |
310 |
|
|
ac_cv_mprotect_works="guessing no" |
311 |
|
|
) |
312 |
|
|
done |
313 |
|
|
AC_TRY_RUN([ |
314 |
|
|
#define CONFIGURE_TEST_VM_MAP |
315 |
|
|
#define TEST_VM_PROT_RDWR_WRITE |
316 |
|
|
#include "vm_alloc.cpp" |
317 |
|
|
], , ac_cv_mprotect_works=no, |
318 |
|
|
dnl When cross-compiling, do not assume anything |
319 |
|
|
ac_cv_mprotect_works="guessing no" |
320 |
|
|
) |
321 |
|
|
AC_LANG_RESTORE |
322 |
|
|
] |
323 |
|
|
) |
324 |
|
|
|
325 |
|
|
dnl Remove support for mmap() if mprotect() does not work |
326 |
|
|
if [[ "x$have_mmap_vm" = "xyes" ]]; then |
327 |
|
|
case $ac_cv_mprotect_works in |
328 |
|
|
*yes) have_mmap_vm=yes;; |
329 |
|
|
*no) have_mmap_vm=no;; |
330 |
|
|
esac |
331 |
|
|
fi |
332 |
|
|
AC_TRANSLATE_DEFINE(HAVE_MMAP_VM, $have_mmap_vm) |
333 |
|
|
|
334 |
|
|
fi dnl HAVE_MMAP_VM |
335 |
|
|
|
336 |
|
|
dnl Check if we can mmap 0x2000 bytes from 0x0000 |
337 |
|
|
AC_CACHE_CHECK("whether we can map Low Memory area 0x0000-0x2000", |
338 |
|
|
ac_cv_can_map_lm, [ |
339 |
|
|
AC_LANG_SAVE |
340 |
|
|
AC_LANG_CPLUSPLUS |
341 |
|
|
AC_TRY_RUN([ |
342 |
|
|
#include "vm_alloc.cpp" |
343 |
|
|
int main(void) { /* returns 0 if we could map the lowmem globals */ |
344 |
|
|
volatile char * lm; |
345 |
|
|
if (vm_init() < 0) exit(1); |
346 |
|
|
if ((lm = (volatile char *)vm_acquire_fixed(0, 0x2000)) == VM_MAP_FAILED) exit(1); |
347 |
|
|
lm[0] = 'z'; |
348 |
|
|
if (vm_release((char *)lm, 0x2000) < 0) exit(1); |
349 |
|
|
vm_exit(); exit(0); |
350 |
|
|
} |
351 |
|
|
], ac_cv_can_map_lm=yes, ac_cv_can_map_lm=no, |
352 |
|
|
dnl When cross-compiling, do not assume anything. |
353 |
|
|
ac_cv_can_map_lm="guessing no" |
354 |
|
|
) |
355 |
|
|
AC_LANG_RESTORE |
356 |
|
|
] |
357 |
|
|
) |
358 |
|
|
|
359 |
|
|
dnl Check signal handlers need to be reinstalled |
360 |
|
|
AC_CACHE_CHECK("whether signal handlers need to be reinstalled", |
361 |
|
|
ac_cv_signal_need_reinstall, [ |
362 |
|
|
AC_LANG_SAVE |
363 |
|
|
AC_LANG_CPLUSPLUS |
364 |
|
|
AC_TRY_RUN([ |
365 |
|
|
#include <stdlib.h> |
366 |
|
|
#ifdef HAVE_UNISTD_H |
367 |
|
|
#include <unistd.h> |
368 |
|
|
#endif |
369 |
|
|
#include <signal.h> |
370 |
|
|
static int handled_signal = 0; |
371 |
|
|
RETSIGTYPE sigusr1_handler(int) { handled_signal++; } |
372 |
|
|
int main(void) { /* returns 0 if signals need not to be reinstalled */ |
373 |
|
|
signal(SIGUSR1, sigusr1_handler); raise(SIGUSR1); raise(SIGUSR1); |
374 |
|
|
exit(handled_signal == 2); |
375 |
|
|
} |
376 |
|
|
], ac_cv_signal_need_reinstall=yes, ac_cv_signal_need_reinstall=no, |
377 |
|
|
dnl When cross-compiling, do not assume anything. |
378 |
|
|
ac_cv_signal_need_reinstall="guessing yes" |
379 |
|
|
) |
380 |
|
|
AC_LANG_RESTORE |
381 |
|
|
] |
382 |
|
|
) |
383 |
|
|
AC_TRANSLATE_DEFINE(SIGNAL_NEED_REINSTALL, "$ac_cv_signal_need_reinstall") |
384 |
|
|
|
385 |
|
|
dnl Check if sigaction handlers need to be reinstalled |
386 |
|
|
AC_CACHE_CHECK("whether sigaction handlers need to be reinstalled", |
387 |
|
|
ac_cv_sigaction_need_reinstall, [ |
388 |
|
|
AC_LANG_SAVE |
389 |
|
|
AC_LANG_CPLUSPLUS |
390 |
|
|
AC_TRY_RUN([ |
391 |
|
|
#include <stdlib.h> |
392 |
|
|
#ifdef HAVE_UNISTD_H |
393 |
|
|
#include <unistd.h> |
394 |
|
|
#endif |
395 |
|
|
#include <signal.h> |
396 |
|
|
static int handled_signal = 0; |
397 |
|
|
RETSIGTYPE sigusr1_handler(int) { handled_signal++; } |
398 |
|
|
typedef RETSIGTYPE (*signal_handler)(int); |
399 |
|
|
static signal_handler mysignal(int sig, signal_handler handler) { |
400 |
|
|
struct sigaction old_sa; |
401 |
|
|
struct sigaction new_sa; |
402 |
|
|
new_sa.sa_handler = handler; |
403 |
|
|
return ((sigaction(sig,&new_sa,&old_sa) < 0) ? SIG_IGN : old_sa.sa_handler); |
404 |
|
|
} |
405 |
|
|
int main(void) { /* returns 0 if signals need not to be reinstalled */ |
406 |
|
|
mysignal(SIGUSR1, sigusr1_handler); raise(SIGUSR1); raise(SIGUSR1); |
407 |
|
|
exit(handled_signal == 2); |
408 |
|
|
} |
409 |
|
|
], ac_cv_sigaction_need_reinstall=yes, ac_cv_sigaction_need_reinstall=no, |
410 |
|
|
dnl When cross-compiling, do not assume anything. |
411 |
|
|
ac_cv_sigaction_need_reinstall="guessing yes" |
412 |
|
|
) |
413 |
|
|
AC_LANG_RESTORE |
414 |
|
|
] |
415 |
|
|
) |
416 |
|
|
AC_TRANSLATE_DEFINE(SIGACTION_NEED_REINSTALL, "$ac_cv_sigaction_need_reinstall") |
417 |
|
|
|
418 |
|
|
dnl Check if extended signals are supported. |
419 |
|
|
AC_CACHE_CHECK("whether your system supports extended signal handlers", |
420 |
|
|
ac_cv_have_extended_signals, [ |
421 |
|
|
AC_LANG_SAVE |
422 |
|
|
AC_LANG_CPLUSPLUS |
423 |
|
|
AC_TRY_RUN([ |
424 |
|
|
#define HAVE_SIGINFO_T 1 |
425 |
|
|
#define CONFIGURE_TEST_SIGSEGV_RECOVERY |
426 |
|
|
#include "vm_alloc.cpp" |
427 |
|
|
#include "sigsegv.cpp" |
428 |
|
|
], ac_cv_have_extended_signals=yes, ac_cv_have_extended_signals=no, |
429 |
|
|
dnl When cross-compiling, do not assume anything. |
430 |
|
|
ac_cv_have_extended_signals=no |
431 |
|
|
) |
432 |
|
|
AC_LANG_RESTORE |
433 |
|
|
] |
434 |
|
|
) |
435 |
|
|
AC_TRANSLATE_DEFINE(HAVE_SIGINFO_T, "$ac_cv_have_extended_signals") |
436 |
|
|
|
437 |
|
|
dnl Otherwise, check for subterfuges. |
438 |
|
|
if [[ "x$ac_cv_have_extended_signals" = "xno" ]]; then |
439 |
|
|
AC_CACHE_CHECK("whether we then have a subterfuge for your system", |
440 |
|
|
ac_cv_have_sigcontext_hack, [ |
441 |
|
|
AC_LANG_SAVE |
442 |
|
|
AC_LANG_CPLUSPLUS |
443 |
|
|
AC_TRY_RUN([ |
444 |
|
|
#define HAVE_SIGCONTEXT_SUBTERFUGE 1 |
445 |
|
|
#define CONFIGURE_TEST_SIGSEGV_RECOVERY |
446 |
|
|
#include "vm_alloc.cpp" |
447 |
|
|
#include "sigsegv.cpp" |
448 |
|
|
], ac_cv_have_sigcontext_hack=yes, ac_cv_have_sigcontext_hack=no, |
449 |
|
|
dnl When cross-compiling, do not assume anything. |
450 |
|
|
ac_cv_have_sigcontext_hack=no |
451 |
|
|
) |
452 |
|
|
AC_LANG_RESTORE |
453 |
|
|
]) |
454 |
|
|
AC_TRANSLATE_DEFINE(HAVE_SIGCONTEXT_SUBTERFUGE, "$ac_cv_have_sigcontext_hack") |
455 |
|
|
fi |
456 |
|
|
|
457 |
|
|
dnl Can we do Video on SEGV Signals ? |
458 |
|
|
CAN_VOSF=no |
459 |
|
|
if [[ "$ac_cv_have_extended_signals" = "yes" -o "$ac_cv_have_sigcontext_hack" = "yes" ]]; then |
460 |
|
|
CAN_VOSF=yes |
461 |
|
|
fi |
462 |
|
|
|
463 |
|
|
dnl Determine the addressing mode to use |
464 |
|
|
if [[ "x$WANT_NATIVE_M68K" = "xyes" ]]; then |
465 |
|
|
ADDRESSING_MODE="real" |
466 |
|
|
else |
467 |
|
|
ADDRESSING_MODE="" |
468 |
|
|
AC_MSG_CHECKING([for the addressing mode to use]) |
469 |
|
|
for am in $ADDRESSING_TEST_ORDER; do |
470 |
|
|
case $am in |
471 |
|
|
real) |
472 |
|
|
dnl Requires ability to mmap() Low Memory globals |
473 |
|
|
if [[ "x$ac_cv_can_map_lm" = "xno" ]]; then |
474 |
|
|
continue |
475 |
|
|
fi |
476 |
|
|
dnl Requires VOSF screen updates |
477 |
|
|
if [[ "x$CAN_VOSF" = "xno" ]]; then |
478 |
|
|
continue |
479 |
|
|
fi |
480 |
|
|
dnl Real addressing will probably work. |
481 |
|
|
ADDRESSING_MODE="real" |
482 |
|
|
WANT_VOSF=yes dnl we can use VOSF and we need it actually |
483 |
|
|
DEFINES="$DEFINES -DREAL_ADDRESSING" |
484 |
|
|
break |
485 |
|
|
;; |
486 |
|
|
direct) |
487 |
|
|
dnl Requires VOSF screen updates |
488 |
|
|
if [[ "x$CAN_VOSF" = "xyes" ]]; then |
489 |
|
|
ADDRESSING_MODE="direct" |
490 |
|
|
WANT_VOSF=yes dnl we can use VOSF and we need it actually |
491 |
|
|
DEFINES="$DEFINES -DDIRECT_ADDRESSING" |
492 |
|
|
break |
493 |
|
|
fi |
494 |
|
|
;; |
495 |
|
|
banks) |
496 |
|
|
dnl Default addressing mode |
497 |
|
|
ADDRESSING_MODE="memory banks" |
498 |
|
|
break |
499 |
|
|
;; |
500 |
|
|
*) |
501 |
|
|
AC_MSG_ERROR([Internal configure.in script error for $am addressing mode]) |
502 |
|
|
esac |
503 |
|
|
done |
504 |
|
|
AC_MSG_RESULT($ADDRESSING_MODE) |
505 |
|
|
if [[ "x$ADDRESSING_MODE" = "x" ]]; then |
506 |
|
|
AC_MSG_WARN([Sorry, no suitable addressing mode in $ADDRESSING_TEST_ORDER]) |
507 |
|
|
ADDRESSING_MODE="memory banks" |
508 |
|
|
fi |
509 |
|
|
fi |
510 |
|
|
|
511 |
|
|
dnl Enable VOSF screen updates with this feature is requested and feasible |
512 |
|
|
if [[ "x$WANT_VOSF" = "xyes" -a "x$CAN_VOSF" = "xyes" ]]; then |
513 |
|
|
AC_DEFINE(ENABLE_VOSF) |
514 |
|
|
else |
515 |
|
|
WANT_VOSF=no |
516 |
|
|
fi |
517 |
|
|
|
518 |
|
|
dnl Check for GAS. |
519 |
|
|
HAVE_GAS=no |
520 |
|
|
AC_MSG_CHECKING(for GAS .p2align feature) |
521 |
|
|
cat >conftest.S << EOF |
522 |
|
|
.text |
523 |
|
|
.p2align 5 |
524 |
|
|
EOF |
525 |
|
|
if $CC conftest.S -c -o conftest.o >/dev/null 2>&1 ; then HAVE_GAS=yes; fi |
526 |
|
|
AC_MSG_RESULT($HAVE_GAS) |
527 |
|
|
|
528 |
|
|
dnl Check for GCC 2.7 or higher. |
529 |
|
|
HAVE_GCC27=no |
530 |
|
|
AC_MSG_CHECKING(for GCC 2.7 or higher) |
531 |
|
|
AC_EGREP_CPP(yes, |
532 |
|
|
[#if __GNUC__ - 1 > 1 || __GNUC_MINOR__ - 1 > 5 |
533 |
|
|
yes |
534 |
|
|
#endif |
535 |
|
|
], [AC_MSG_RESULT(yes); HAVE_GCC27=yes], AC_MSG_RESULT(no)) |
536 |
|
|
|
537 |
|
|
dnl Check for GCC 3.0 or higher. |
538 |
|
|
HAVE_GCC30=no |
539 |
|
|
AC_MSG_CHECKING(for GCC 3.0 or higher) |
540 |
|
|
AC_EGREP_CPP(yes, |
541 |
|
|
[#if __GNUC__ >= 3 |
542 |
|
|
yes |
543 |
|
|
#endif |
544 |
|
|
], [AC_MSG_RESULT(yes); HAVE_GCC30=yes], AC_MSG_RESULT(no)) |
545 |
|
|
|
546 |
|
|
dnl Set "-fomit-frame-pointer" on i386 GCC 2.7 or higher. |
547 |
nigel |
1.3 |
dnl Also set "-fno-exceptions" for C++ because exception handling requires |
548 |
|
|
dnl the frame pointer. |
549 |
nigel |
1.1 |
if [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_I386" = "xyes" ]]; then |
550 |
|
|
CFLAGS="$CFLAGS -fomit-frame-pointer" |
551 |
nigel |
1.3 |
CXXFLAGS="$CXXFLAGS -fomit-frame-pointer -fno-exceptions" |
552 |
nigel |
1.1 |
fi |
553 |
|
|
|
554 |
|
|
dnl (gb) Do not merge constants since it breaks fpu/fpu_x86.cpp. |
555 |
|
|
dnl As of 2001/08/02, this affects the following compilers: |
556 |
|
|
dnl Official: probably gcc-3.1 (mainline CVS) |
557 |
|
|
dnl Mandrake: gcc-2.96 >= 0.59mdk, gcc-3.0.1 >= 0.1mdk |
558 |
|
|
dnl Red Hat : gcc-2.96 >= 89, gcc-3.0 >= 1 |
559 |
|
|
if [[ "x$HAVE_GCC27" = "xyes" ]]; then |
560 |
|
|
SAVED_CXXFLAGS="$CXXFLAGS" |
561 |
|
|
CXXFLAGS="$CXXFLAGS -fno-merge-constants" |
562 |
|
|
AC_CACHE_CHECK([whether GCC supports constants merging], ac_cv_gcc_constants_merging, [ |
563 |
|
|
AC_LANG_SAVE |
564 |
|
|
AC_LANG_CPLUSPLUS |
565 |
|
|
AC_TRY_COMPILE([],[],[ac_cv_gcc_constants_merging=yes],[ac_cv_gcc_constants_merging=no]) |
566 |
|
|
AC_LANG_RESTORE |
567 |
|
|
]) |
568 |
|
|
if [[ "x$ac_cv_gcc_constants_merging" != "xyes" ]]; then |
569 |
|
|
CXXFLAGS="$SAVED_CXXFLAGS" |
570 |
|
|
fi |
571 |
|
|
fi |
572 |
|
|
|
573 |
|
|
dnl Select appropriate CPU source and REGPARAM define. |
574 |
|
|
ASM_OPTIMIZATIONS=none |
575 |
|
|
CPUSRCS="cpuemu1.cpp cpuemu2.cpp cpuemu3.cpp cpuemu4.cpp cpuemu5.cpp cpuemu6.cpp cpuemu7.cpp cpuemu8.cpp" |
576 |
|
|
FPUSRCS="../uae_cpu/fpu/fpu_uae.cpp" |
577 |
|
|
if [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_I386" = "xyes" -a "x$OS_TYPE" != "xfreebsd" ]]; then |
578 |
|
|
dnl i386 CPU |
579 |
|
|
DEFINES="$DEFINES -DREGPARAM=\"__attribute__((regparm(3)))\"" |
580 |
|
|
if [[ "x$HAVE_GAS" = "xyes" ]]; then |
581 |
|
|
ASM_OPTIMIZATIONS=i386 |
582 |
|
|
DEFINES="$DEFINES -DX86_ASSEMBLY -DUNALIGNED_PROFITABLE -DOPTIMIZED_FLAGS" |
583 |
|
|
CPUSRCS="cpufast1.s cpufast2.s cpufast3.s cpufast4.s cpufast5.s cpufast6.s cpufast7.s cpufast8.s" |
584 |
|
|
FPUSRCS="../uae_cpu/fpu_x86.cpp" |
585 |
|
|
fi |
586 |
|
|
elif [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_SPARC" = "xyes" -a "x$HAVE_GAS" = "xyes" ]]; then |
587 |
|
|
dnl SPARC CPU |
588 |
|
|
case "$target_os" in |
589 |
|
|
solaris*) |
590 |
|
|
AC_MSG_CHECKING(SPARC CPU architecture) |
591 |
|
|
SPARC_TYPE=`Solaris/which_sparc` |
592 |
|
|
AC_MSG_RESULT($SPARC_TYPE) |
593 |
|
|
case "$SPARC_TYPE" in |
594 |
|
|
SPARC_V8) |
595 |
|
|
ASM_OPTIMIZATIONS="SPARC V8 architecture" |
596 |
|
|
DEFINES="$DEFINES -DSPARC_V8_ASSEMBLY" dnl -DOPTIMIZED_FLAGS" |
597 |
|
|
CFLAGS="$CFLAGS -Wa,-Av8" |
598 |
|
|
CXXFLAGS="$CXXFLAGS -Wa,-Av8" |
599 |
|
|
;; |
600 |
|
|
SPARC_V9) |
601 |
|
|
ASM_OPTIMIZATIONS="SPARC V9 architecture" |
602 |
|
|
DEFINES="$DEFINES -DSPARC_V9_ASSEMBLY" dnl -DOPTIMIZED_FLAGS" |
603 |
|
|
CFLAGS="$CFLAGS -Wa,-Av9" |
604 |
|
|
CXXFLAGS="$CXXFLAGS -Wa,-Av9" |
605 |
|
|
;; |
606 |
|
|
esac |
607 |
|
|
;; |
608 |
|
|
esac |
609 |
|
|
elif [[ "x$WANT_NATIVE_M68K" = "xyes" ]]; then |
610 |
|
|
dnl Native m68k, no emulation |
611 |
|
|
CPUINCLUDES="-I../native_cpu" |
612 |
|
|
CPUSRCS="asm_support.s" |
613 |
|
|
fi |
614 |
|
|
|
615 |
|
|
dnl Select appropriate FPU source. |
616 |
|
|
dnl 1. Optimized X86 assembly core if target is i386 architecture |
617 |
|
|
SAVED_DEFINES=$DEFINES |
618 |
|
|
if [[ "x$FPE_CORE" = "xdefault" ]]; then |
619 |
|
|
if [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_I386" = "xyes" -a "x$HAVE_GAS" = "xyes" ]]; then |
620 |
|
|
DEFINES="$DEFINES -DFPU_X86" |
621 |
|
|
FPE_CORE_STR="i386 optimized core" |
622 |
|
|
FPUSRCS="../uae_cpu/fpu/fpu_x86.cpp" |
623 |
|
|
FPE_CORE="i386" |
624 |
|
|
else |
625 |
|
|
FPE_CORE="uae" |
626 |
|
|
fi |
627 |
|
|
fi |
628 |
|
|
|
629 |
|
|
dnl 2. JIT-FPU only supports IEEE-based implementation. |
630 |
|
|
if [[ "x$WANT_JIT_FPU" = "xyes" -a "x$FPE_CORE" != "xieee" ]]; then |
631 |
|
|
AC_MSG_WARN([Sorry, JIT-FPU supports only the "ieee" FPE implementation]) |
632 |
|
|
FPE_CORE="ieee" |
633 |
|
|
dnl Restore previous variables. FPE_CORE_STR and FPUSRCS are overwritten |
634 |
|
|
DEFINES=$SAVED_DEFINES |
635 |
|
|
fi |
636 |
|
|
|
637 |
|
|
dnl 3. Choose either IEEE-based implementation or the old UAE core |
638 |
|
|
if [[ "x$FPE_CORE" = "xieee" ]]; then |
639 |
|
|
AC_CHECK_HEADERS(fenv.h) |
640 |
|
|
AC_CHECK_FUNCS(feclearexcept fegetexceptflag feraiseexcept fesetexceptflag fetestexcept) |
641 |
|
|
AC_CHECK_FUNCS(fegetround fesetround) |
642 |
|
|
DEFINES="$DEFINES -DFPU_IEEE" |
643 |
|
|
FPE_CORE_STR="ieee-based fpu core" |
644 |
|
|
FPUSRCS="../uae_cpu/fpu/fpu_ieee.cpp" |
645 |
|
|
elif [[ "x$FPE_CORE" = "xuae" ]]; then |
646 |
|
|
DEFINES="$DEFINES -DFPU_UAE" |
647 |
|
|
FPE_CORE_STR="original uae core" |
648 |
|
|
FPUSRCS="../uae_cpu/fpu/fpu_uae.cpp" |
649 |
|
|
fi |
650 |
|
|
|
651 |
|
|
dnl Check for certain math functions |
652 |
|
|
AC_CHECK_FUNCS(atanh) |
653 |
|
|
AC_CHECK_FUNCS(isnan isinf) dnl C99 |
654 |
|
|
AC_CHECK_FUNCS(isnanl isinfl) dnl IEEE ? |
655 |
|
|
|
656 |
|
|
dnl UAE CPU sources for all non-m68k-native architectures. |
657 |
|
|
if [[ "x$WANT_NATIVE_M68K" = "xno" ]]; then |
658 |
|
|
CPUINCLUDES="-I../uae_cpu" |
659 |
|
|
CPUSRCS="../uae_cpu/basilisk_glue.cpp ../uae_cpu/memory.cpp ../uae_cpu/newcpu.cpp ../uae_cpu/readcpu.cpp $FPUSRCS cpustbl.cpp cpudefs.cpp $CPUSRCS" |
660 |
|
|
fi |
661 |
|
|
|
662 |
|
|
dnl Remove the "-g" option if set for GCC. |
663 |
|
|
if [[ "x$HAVE_GCC27" = "xyes" ]]; then |
664 |
|
|
CFLAGS=`echo $CFLAGS | sed -e 's/-g//g'` |
665 |
|
|
CXXFLAGS=`echo $CXXFLAGS | sed -e 's/-g//g'` |
666 |
|
|
fi |
667 |
|
|
|
668 |
|
|
dnl Or if we have -Ofast |
669 |
|
|
if [[ "x$HAVE_OFAST" = "xyes" ]]; then |
670 |
|
|
CFLAGS="`echo $CFLAGS | sed -e 's/-g//g'` -Ofast" |
671 |
|
|
CXXFLAGS="`echo $CXXFLAGS | sed -e 's/-g//g'` -Ofast" |
672 |
|
|
CXXFLAGS="-LANG:std $CXXFLAGS" |
673 |
|
|
LDFLAGS="$LDFLAGS -Ofast" |
674 |
|
|
fi |
675 |
|
|
|
676 |
|
|
dnl Generate Makefile. |
677 |
|
|
AC_SUBST(DEFINES) |
678 |
|
|
AC_SUBST(SYSSRCS) |
679 |
|
|
AC_SUBST(CPUINCLUDES) |
680 |
|
|
AC_SUBST(CPUSRCS) |
681 |
|
|
AC_OUTPUT(Makefile) |
682 |
|
|
|
683 |
|
|
dnl Print summary. |
684 |
|
|
echo |
685 |
|
|
echo Basilisk II configuration summary: |
686 |
|
|
echo |
687 |
|
|
echo Full screen support .............. : $WANT_FULL |
688 |
|
|
echo Multiple emulator windows ........ : $WANT_MWIN |
689 |
|
|
echo Enable video on SEGV signals ..... : $WANT_VOSF |
690 |
|
|
echo mon debugger support ............. : $WANT_MON |
691 |
|
|
echo Floating-Point emulation core .... : $FPE_CORE_STR |
692 |
|
|
echo Assembly optimizations ........... : $ASM_OPTIMIZATIONS |
693 |
|
|
echo Addressing mode .................. : $ADDRESSING_MODE |
694 |
|
|
echo |
695 |
nigel |
1.2 |
echo "Configuration done. Now type \"make\" (or \"make ide\")." |