1 |
|
dnl Process this file with autoconf to produce a configure script. |
2 |
< |
dnl Written in 1999 by Christian Bauer et al. |
2 |
> |
dnl Written in 2002 by Christian Bauer et al. |
3 |
|
|
4 |
|
AC_INIT(main_unix.cpp) |
5 |
|
AC_PREREQ(2.12) |
6 |
|
AC_CONFIG_HEADER(config.h) |
7 |
|
|
8 |
+ |
dnl These defines are necessary to get 64-bit file size support. |
9 |
+ |
AC_DEFINE(_USE_LARGEFILE_SOURCE, 1, [Get more functions for correct standard I/O]) |
10 |
+ |
AC_DEFINE(_FILE_OFFSET_BITS, 64, [Get 64-bit file size support]) |
11 |
+ |
|
12 |
|
dnl Options. |
13 |
|
AC_ARG_ENABLE(xf86-dga, [ --enable-xf86-dga use the XFree86 DGA extension [default=yes]], [WANT_XF86_DGA=$enableval], [WANT_XF86_DGA=yes]) |
14 |
|
AC_ARG_ENABLE(xf86-vidmode, [ --enable-xf86-vidmode use the XFree86 VidMode extension [default=yes]], [WANT_XF86_VIDMODE=$enableval], [WANT_XF86_VIDMODE=yes]) |
15 |
|
AC_ARG_ENABLE(fbdev-dga, [ --enable-fbdev-dga use direct frame buffer access via /dev/fb [default=yes]], [WANT_FBDEV_DGA=$enableval], [WANT_FBDEV_DGA=yes]) |
16 |
< |
AC_ARG_ENABLE(vosf, [ --enable-vosf enable video on SEGV signals [default=yes]], [WANT_VOSF=$enableval], [WANT_VOSF=no]) |
17 |
< |
AC_ARG_ENABLE(16bit-vidmode, [ --enable-16bit-vidmode enable 16-bit video if possible [default=yes]], [WANT_16BIT_VIDMODE=$enableval], [WANT_16BIT_VIDMODE=yes]) |
16 |
> |
AC_ARG_ENABLE(vosf, [ --enable-vosf enable video on SEGV signals [default=yes]], [WANT_VOSF=$enableval], [WANT_VOSF=yes]) |
17 |
> |
|
18 |
> |
dnl FPU emulation core. |
19 |
> |
AC_ARG_ENABLE(fpe, |
20 |
> |
[ --enable-fpe=which specify which fpu emulator to use [default=opt]], |
21 |
> |
[ case "$enableval" in |
22 |
> |
default) FPE_CORE="default";; dnl fpu_x86.cpp if i386 architecture, fpu_uae.cpp otherwise |
23 |
> |
uae) FPE_CORE="uae";; |
24 |
> |
*) AC_MSG_ERROR([--enable-fpe takes only one of the following values: default, uae]);; |
25 |
> |
esac |
26 |
> |
], |
27 |
> |
[ FPE_CORE="default" |
28 |
> |
]) |
29 |
> |
|
30 |
> |
dnl Addressing modes. |
31 |
|
AC_ARG_ENABLE(addressing, |
32 |
< |
[ --enable-addressing=mode specify the addressing mode to use [default=fastest]], |
32 |
> |
[ --enable-addressing=AM specify the addressing mode to use [default=fastest]], |
33 |
|
[ case "$enableval" in |
34 |
|
real) ADDRESSING_TEST_ORDER="real";; |
35 |
|
direct) ADDRESSING_TEST_ORDER="direct";; |
36 |
|
banks) ADDRESSING_TEST_ORDER="banks";; |
37 |
< |
dnl fastest) ADDRESSING_TEST_ORDER="real direct banks";; gb-- will enable later... |
38 |
< |
fastest) ADDRESSING_TEST_ORDER="direct banks";; |
22 |
< |
*) AC_MSG_ERROR([--enable-mem-addressing takes only one of the following values: fastest, real, direct, banks]);; |
37 |
> |
fastest)ADDRESSING_TEST_ORDER="direct banks";; |
38 |
> |
*) AC_MSG_ERROR([--enable-addressing takes only one of the following values: fastest, real, direct, banks]);; |
39 |
|
esac |
40 |
|
], |
25 |
– |
dnl [ ADDRESSING_TEST_ORDER="real direct banks" gb-- will probably reactivate later |
41 |
|
[ ADDRESSING_TEST_ORDER="direct banks" |
42 |
|
]) |
43 |
+ |
|
44 |
+ |
dnl External packages. |
45 |
|
AC_ARG_WITH(esd, [ --with-esd support ESD for sound under Linux/FreeBSD [default=yes]], [WANT_ESD=$withval], [WANT_ESD=yes]) |
46 |
|
AC_ARG_WITH(gtk, [ --with-gtk use GTK user interface [default=yes]], [WANT_GTK=$withval], [WANT_GTK=yes]) |
47 |
|
AC_ARG_WITH(mon, [ --with-mon use mon as debugger [default=yes]], [WANT_MON=$withval], [WANT_MON=yes]) |
56 |
|
netbsd*) OS_TYPE=netbsd;; |
57 |
|
freebsd*) OS_TYPE=freebsd;; |
58 |
|
solaris*) OS_TYPE=solaris;; |
59 |
< |
*) OS_TYPE=`echo $target_os | sed -e 's/-/_/'`;; |
59 |
> |
darwin*) OS_TYPE=darwin;; |
60 |
> |
*) OS_TYPE=`echo $target_os | sed -e 's/-/_/g' | sed -e 's/\./_/g'`;; |
61 |
|
esac |
62 |
|
DEFINES="$DEFINES -DOS_$OS_TYPE" |
63 |
|
|
65 |
|
HAVE_I386=no |
66 |
|
HAVE_M68K=no |
67 |
|
HAVE_SPARC=no |
68 |
+ |
HAVE_POWERPC=no |
69 |
|
case "$target_cpu" in |
70 |
|
i386* | i486* | i586* | i686* | i786* ) CPU_TYPE=i386 HAVE_I386=yes;; |
71 |
|
m68k* ) CPU_TYPE=m68k HAVE_M68K=yes;; |
72 |
|
sparc* ) CPU_TYPE=sparc HAVE_SPARC=yes;; |
73 |
< |
*) CPU_TYPE=`echo $target_cpu | sed -e 's/-/_/'`;; |
73 |
> |
powerpc* ) CPU_TYPE=powerpc HAVE_POWERPC=yes;; |
74 |
> |
*) CPU_TYPE=`echo $target_cpu | sed -e 's/-/_/g'`;; |
75 |
|
esac |
76 |
|
DEFINES="$DEFINES -DCPU_$CPU_TYPE" |
77 |
|
|
91 |
|
if grep mon_init $mon_srcdir/mon.h >/dev/null 2>/dev/null; then |
92 |
|
AC_MSG_RESULT(yes) |
93 |
|
AC_DEFINE(ENABLE_MON) |
94 |
< |
MONSRCS="$mon_srcdir/mon.cpp $mon_srcdir/mon_6502.cpp $mon_srcdir/mon_8080.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" |
94 |
> |
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" |
95 |
|
CXXFLAGS="$CXXFLAGS -I$mon_srcdir -I$mon_srcdir/disass" |
96 |
|
AC_CHECK_LIB(readline, readline) |
97 |
|
AC_CHECK_LIB(termcap, tputs) |
105 |
|
|
106 |
|
dnl Checks for libraries. |
107 |
|
AC_CHECK_LIB(posix4, sem_init) |
108 |
+ |
AC_CHECK_LIB(rt, timer_create) |
109 |
|
|
110 |
|
dnl We need X11. |
111 |
|
AC_PATH_XTRA |
129 |
|
AC_DEFINE(HAVE_PTHREADS) |
130 |
|
fi |
131 |
|
AC_CHECK_FUNCS(pthread_cancel) |
132 |
+ |
AC_CHECK_FUNCS(pthread_mutexattr_setprotocol) |
133 |
+ |
AC_CHECK_FUNCS(pthread_mutexattr_settype) |
134 |
|
|
135 |
|
dnl If POSIX.4 semaphores are not available, we emulate them with pthread mutexes. |
136 |
|
SEMSRC= |
137 |
|
AC_CHECK_FUNCS(sem_init, , [ |
138 |
< |
if [ "x$HAVE_PTHREADS" = "xyes" ]; then |
138 |
> |
if test "x$HAVE_PTHREADS" = "xyes"; then |
139 |
|
SEMSRC=posix_sem.cpp |
140 |
|
fi |
141 |
|
]) |
174 |
|
if [[ "x$WANT_GTK" = "xyes" ]]; then |
175 |
|
AM_PATH_GTK(1.2.0, [ |
176 |
|
AC_DEFINE(ENABLE_GTK) |
154 |
– |
CFLAGS="$CFLAGS $GTK_CFLAGS" |
177 |
|
CXXFLAGS="$CXXFLAGS $GTK_CFLAGS" |
178 |
|
LIBS="$LIBS $GTK_LIBS" |
179 |
|
UISRCS=prefs_editor_gtk.cpp |
180 |
+ |
B2_PATH_GNOMEUI([ |
181 |
+ |
AC_DEFINE(HAVE_GNOMEUI) |
182 |
+ |
CXXFLAGS="$CXXFLAGS $GNOMEUI_CFLAGS" |
183 |
+ |
LIBS="$LIBS $GNOMEUI_LIBS" |
184 |
+ |
], []) |
185 |
|
], [ |
186 |
|
AC_MSG_WARN([Could not find GTK+, disabling user interface.]) |
187 |
|
WANT_GTK=no |
203 |
|
|
204 |
|
dnl Checks for header files. |
205 |
|
AC_HEADER_STDC |
206 |
< |
AC_CHECK_HEADERS(unistd.h fcntl.h sys/time.h) |
206 |
> |
AC_CHECK_HEADERS(unistd.h fcntl.h sys/time.h sys/mman.h) |
207 |
|
|
208 |
|
dnl Checks for typedefs, structures, and compiler characteristics. |
209 |
|
AC_C_BIGENDIAN |
221 |
|
AC_HEADER_TIME |
222 |
|
AC_STRUCT_TM |
223 |
|
|
224 |
+ |
dnl Check whether sys/socket.h defines type socklen_t. |
225 |
+ |
dnl (extracted from ac-archive/Miscellaneous) |
226 |
+ |
AC_CACHE_CHECK("for socklen_t", |
227 |
+ |
ac_cv_type_socklen_t, [ |
228 |
+ |
AC_TRY_COMPILE([ |
229 |
+ |
#include <sys/types.h> |
230 |
+ |
#include <sys/socket.h> |
231 |
+ |
], [socklen_t len = 42; return 0;], |
232 |
+ |
ac_cv_type_socklen_t=yes, ac_cv_type_socklen_t=no, |
233 |
+ |
dnl When cross-compiling, do not assume anything. |
234 |
+ |
ac_cv_type_socklen_t="guessing no" |
235 |
+ |
) |
236 |
+ |
]) |
237 |
+ |
if [[ "x$ac_cv_type_socklen_t" != "xyes" ]]; then |
238 |
+ |
AC_DEFINE(socklen_t, int) |
239 |
+ |
fi |
240 |
+ |
|
241 |
|
dnl Checks for library functions. |
242 |
|
AC_CHECK_FUNCS(strdup cfmakeraw) |
243 |
|
AC_CHECK_FUNCS(clock_gettime timer_create) |
244 |
+ |
AC_CHECK_FUNCS(sigaction signal) |
245 |
+ |
AC_CHECK_FUNCS(mmap mprotect munmap) |
246 |
+ |
AC_CHECK_FUNCS(vm_allocate vm_deallocate vm_protect) |
247 |
+ |
|
248 |
+ |
dnl Darwin seems to define mach_task_self() instead of task_self(). |
249 |
+ |
AC_CHECK_FUNCS(mach_task_self task_self) |
250 |
|
|
251 |
|
dnl Select system-dependant source files. |
252 |
|
SERIALSRC=serial_unix.cpp |
254 |
|
SCSISRC=../dummy/scsi_dummy.cpp |
255 |
|
AUDIOSRC=../dummy/audio_dummy.cpp |
256 |
|
EXTRASYSSRCS= |
257 |
< |
SUPPORTS_NATIVE_M68K=no |
257 |
> |
CAN_NATIVE_M68K=no |
258 |
|
case "$target_os" in |
259 |
|
linux*) |
260 |
< |
ETHERSRC=Linux/ether_linux.cpp |
211 |
< |
SCSISRC=Linux/scsi_linux.cpp |
260 |
> |
ETHERSRC=ether_unix.cpp |
261 |
|
AUDIOSRC=audio_oss_esd.cpp |
262 |
+ |
SCSISRC=Linux/scsi_linux.cpp |
263 |
|
;; |
264 |
< |
freebsd*3.*) |
264 |
> |
freebsd*) |
265 |
> |
ETHERSRC=ether_unix.cpp |
266 |
|
AUDIOSRC=audio_oss_esd.cpp |
267 |
|
DEFINES="$DEFINES -DBSD_COMP" |
268 |
+ |
CXXFLAGS="$CXXFLAGS -fpermissive" |
269 |
|
dnl Check for the CAM library |
270 |
|
AC_CHECK_LIB(cam, cam_open_btl, HAVE_LIBCAM=yes, HAVE_LIBCAM=no) |
271 |
|
if [[ "x$HAVE_LIBCAM" = "xno" ]]; then |
272 |
|
AC_MSG_WARN([Cannot find libcam for SCSI management, disabling SCSI support.]) |
273 |
|
else |
274 |
|
dnl Check for the sys kernel includes |
275 |
< |
AC_CHECK_HEADER(/sys/cam/cam.h) |
276 |
< |
if [[ "x$ac_cv_header__sys_cam_cam_h" = "xno" ]]; then |
275 |
> |
AC_CHECK_HEADER(camlib.h) |
276 |
> |
if [[ "x$ac_cv_header_camlib_h" = "xno" ]]; then |
277 |
|
dnl In this case I should fix this thing including a "patch" |
278 |
|
dnl to access directly to the functions in the kernel :) --Orlando |
279 |
< |
AC_MSG_WARN([Cannot find kernel includes for CAM library, disabling SCSI support.]) |
279 |
> |
AC_MSG_WARN([Cannot find includes for CAM library, disabling SCSI support.]) |
280 |
|
else |
281 |
|
SCSISRC=FreeBSD/scsi_freebsd.cpp |
230 |
– |
CXXFLAGS="$CXXFLAGS -I/sys" |
231 |
– |
CFLAGS="$CFLAGS -I/sys" |
282 |
|
LIBS="$LIBS -lcam" |
283 |
|
DEFINES="$DEFINES -DCAM" |
284 |
|
fi |
285 |
|
fi |
286 |
|
;; |
237 |
– |
freebsd*) |
238 |
– |
DEFINES="$DEFINES -DBSD_COMP" |
239 |
– |
dnl Check for the SCSI library |
240 |
– |
AC_CHECK_LIB(scsi, scsi_open, HAVE_LIBSCSI=yes, HAVE_LIBSCSI=no) |
241 |
– |
if [[ "x$HAVE_LIBSCSI" = "xno" ]]; then |
242 |
– |
AC_MSG_WARN([Cannot find libscsi for SCSI management, disabling SCSI support.]) |
243 |
– |
else |
244 |
– |
dnl Check for the sys kernel includes |
245 |
– |
AC_CHECK_HEADER(scsi.h sys/scsiio.h) |
246 |
– |
if [[ "x$ac_cv_header_scsi_h" = "xno" ]]; then |
247 |
– |
AC_MSG_WARN([Cannot find includes for the SCSI library, disabling SCSI support.]) |
248 |
– |
else |
249 |
– |
SCSISRC=FreeBSD/scsi_freebsd.cpp |
250 |
– |
LIBS="$LIBS -lscsi" |
251 |
– |
fi |
252 |
– |
fi |
253 |
– |
;; |
287 |
|
netbsd*) |
288 |
< |
SUPPORTS_NATIVE_M68K=yes |
288 |
> |
CAN_NATIVE_M68K=yes |
289 |
|
;; |
290 |
|
solaris*) |
291 |
|
AUDIOSRC=Solaris/audio_solaris.cpp |
292 |
|
DEFINES="$DEFINES -DBSD_COMP -D_POSIX_PTHREAD_SEMANTICS" |
293 |
|
;; |
294 |
|
irix*) |
295 |
+ |
ETHERSRC=ether_unix.cpp |
296 |
+ |
AUDIOSRC=Irix/audio_irix.cpp |
297 |
|
EXTRASYSSRCS=Irix/unaligned.c |
298 |
< |
DEFINES="$DEFINES -DCRTSCTS=CNEW_RTSCTS -DB230400=B115200" |
299 |
< |
LIBS="$LIBS -lm" |
298 |
> |
dnl IRIX headers work fine, but somehow don't define or use "STDC_HEADERS" |
299 |
> |
DEFINES="$DEFINES -DCRTSCTS=CNEW_RTSCTS -DB230400=B115200 -DSTDC_HEADERS" |
300 |
> |
LIBS="$LIBS -laudio" |
301 |
> |
WANT_ESD=no |
302 |
> |
|
303 |
> |
dnl Check if our compiler supports -Ofast (MIPSPro) |
304 |
> |
HAVE_OFAST=no |
305 |
> |
ocflags="$CFLAGS" |
306 |
> |
CFLAGS=`echo $CFLAGS | sed -e 's/ -g / -Ofast /;s/^-g /-Ofast /;s/-g$/ -Ofast/;s/^-g$/-Ofast/'` |
307 |
> |
AC_MSG_CHECKING(if "-Ofast" works) |
308 |
> |
dnl Do a test compile of an empty function |
309 |
> |
AC_TRY_COMPILE(,, [AC_MSG_RESULT(yes); HAVE_OFAST=yes], AC_MSG_RESULT(no)) |
310 |
> |
CFLAGS="$ocflags" |
311 |
> |
|
312 |
|
;; |
313 |
|
esac |
314 |
|
|
315 |
+ |
dnl Use 68k CPU natively? |
316 |
+ |
WANT_NATIVE_M68K=no |
317 |
+ |
if [[ "x$HAVE_M68K" = "xyes" -a "x$CAN_NATIVE_M68K" = "xyes" ]]; then |
318 |
+ |
AC_DEFINE(ENABLE_NATIVE_M68K) |
319 |
+ |
WANT_NATIVE_M68K=yes |
320 |
+ |
fi |
321 |
+ |
|
322 |
|
if [[ "x$HAVE_PTHREADS" = "xno" ]]; then |
323 |
|
dnl Serial, ethernet and audio support needs pthreads |
324 |
|
AC_MSG_WARN([You don't have pthreads, disabling serial, ethernet and audio support.]) |
333 |
|
dnl $1 -- the macro to define |
334 |
|
dnl $2 -- the value to translate |
335 |
|
AC_DEFUN(AC_TRANSLATE_DEFINE, [ |
336 |
< |
if [[ "x$2" = "xyes" ]]; then |
336 |
> |
if [[ "x$2" = "xyes" -o "x$2" = "xguessing yes" ]]; then |
337 |
|
AC_DEFINE($1) |
338 |
|
fi |
339 |
|
]) |
340 |
|
|
341 |
+ |
dnl Various checks if the system supports vm_allocate() and the like functions. |
342 |
+ |
have_mach_vm=no |
343 |
+ |
if [[ "x$ac_cv_func_vm_allocate" = "xyes" -a "x$ac_cv_func_vm_deallocate" = "xyes" -a \ |
344 |
+ |
"x$ac_cv_func_vm_protect" = "xyes" ]]; then |
345 |
+ |
have_mach_vm=yes |
346 |
+ |
fi |
347 |
+ |
AC_TRANSLATE_DEFINE(HAVE_MACH_VM, "$have_mach_vm") |
348 |
+ |
|
349 |
+ |
dnl Check that vm_allocate(), vm_protect() work |
350 |
+ |
if [[ "x$have_mach_vm" = "xyes" ]]; then |
351 |
+ |
|
352 |
+ |
AC_CACHE_CHECK("whether vm_protect works", |
353 |
+ |
ac_cv_vm_protect_works, [ |
354 |
+ |
AC_LANG_SAVE |
355 |
+ |
AC_LANG_CPLUSPLUS |
356 |
+ |
ac_cv_vm_protect_works=yes |
357 |
+ |
dnl First the tests that should segfault |
358 |
+ |
for test_def in NONE_READ NONE_WRITE READ_WRITE; do |
359 |
+ |
AC_TRY_RUN([ |
360 |
+ |
#define CONFIGURE_TEST_VM_MAP |
361 |
+ |
#define TEST_VM_PROT_$test_def |
362 |
+ |
#include "vm_alloc.cpp" |
363 |
+ |
], ac_cv_vm_protect_works=no, rm -f core, |
364 |
+ |
dnl When cross-compiling, do not assume anything |
365 |
+ |
ac_cv_vm_protect_works="guessing no" |
366 |
+ |
) |
367 |
+ |
done |
368 |
+ |
AC_TRY_RUN([ |
369 |
+ |
#define CONFIGURE_TEST_VM_MAP |
370 |
+ |
#define TEST_VM_PROT_RDWR_WRITE |
371 |
+ |
#include "vm_alloc.cpp" |
372 |
+ |
], , ac_cv_vm_protect_works=no, |
373 |
+ |
dnl When cross-compiling, do not assume anything |
374 |
+ |
ac_cv_vm_protect_works="guessing no" |
375 |
+ |
) |
376 |
+ |
AC_LANG_RESTORE |
377 |
+ |
] |
378 |
+ |
) |
379 |
+ |
|
380 |
+ |
dnl Remove support for vm_allocate() if vm_protect() does not work |
381 |
+ |
if [[ "x$have_mach_vm" = "xyes" ]]; then |
382 |
+ |
case $ac_cv_vm_protect_works in |
383 |
+ |
*yes) have_mach_vm=yes;; |
384 |
+ |
*no) have_mach_vm=no;; |
385 |
+ |
esac |
386 |
+ |
fi |
387 |
+ |
AC_TRANSLATE_DEFINE(HAVE_MACH_VM, "$have_mach_vm") |
388 |
+ |
|
389 |
+ |
fi dnl HAVE_MACH_VM |
390 |
+ |
|
391 |
+ |
dnl Various checks if the system supports mmap() and the like functions. |
392 |
+ |
dnl ... and Mach memory allocators are not supported |
393 |
+ |
have_mmap_vm=no |
394 |
+ |
if [[ "x$ac_cv_func_mmap" = "xyes" -a "x$ac_cv_func_munmap" = "xyes" -a \ |
395 |
+ |
"x$ac_cv_func_mprotect" = "xyes" ]]; then |
396 |
+ |
if [[ "x$have_mach_vm" = "xno" ]]; then |
397 |
+ |
have_mmap_vm=yes |
398 |
+ |
fi |
399 |
+ |
fi |
400 |
+ |
AC_TRANSLATE_DEFINE(HAVE_MMAP_VM, "$have_mmap_vm") |
401 |
+ |
|
402 |
+ |
dnl Check that mmap() and associated functions work. |
403 |
+ |
if [[ "x$have_mmap_vm" = "xyes" ]]; then |
404 |
+ |
|
405 |
+ |
dnl Check if we have a working anonymous mmap() |
406 |
+ |
AC_CACHE_CHECK("whether mmap supports MAP_ANON", |
407 |
+ |
ac_cv_mmap_anon, [ |
408 |
+ |
AC_LANG_SAVE |
409 |
+ |
AC_LANG_CPLUSPLUS |
410 |
+ |
AC_TRY_RUN([ |
411 |
+ |
#define HAVE_MMAP_ANON |
412 |
+ |
#define CONFIGURE_TEST_VM_MAP |
413 |
+ |
#define TEST_VM_MMAP_ANON |
414 |
+ |
#include "vm_alloc.cpp" |
415 |
+ |
], ac_cv_mmap_anon=yes, ac_cv_mmap_anon=no, |
416 |
+ |
dnl When cross-compiling, do not assume anything. |
417 |
+ |
ac_cv_mmap_anon="guessing no" |
418 |
+ |
) |
419 |
+ |
AC_LANG_RESTORE |
420 |
+ |
] |
421 |
+ |
) |
422 |
+ |
AC_TRANSLATE_DEFINE(HAVE_MMAP_ANON, "$ac_cv_mmap_anon") |
423 |
+ |
|
424 |
+ |
AC_CACHE_CHECK("whether mmap supports MAP_ANONYMOUS", |
425 |
+ |
ac_cv_mmap_anonymous, [ |
426 |
+ |
AC_LANG_SAVE |
427 |
+ |
AC_LANG_CPLUSPLUS |
428 |
+ |
AC_TRY_RUN([ |
429 |
+ |
#define HAVE_MMAP_ANONYMOUS |
430 |
+ |
#define CONFIGURE_TEST_VM_MAP |
431 |
+ |
#define TEST_VM_MMAP_ANON |
432 |
+ |
#include "vm_alloc.cpp" |
433 |
+ |
], ac_cv_mmap_anonymous=yes, ac_cv_mmap_anonymous=no, |
434 |
+ |
dnl When cross-compiling, do not assume anything. |
435 |
+ |
ac_cv_mmap_anonymous="guessing no" |
436 |
+ |
) |
437 |
+ |
AC_LANG_RESTORE |
438 |
+ |
] |
439 |
+ |
) |
440 |
+ |
AC_TRANSLATE_DEFINE(HAVE_MMAP_ANONYMOUS, "$ac_cv_mmap_anonymous") |
441 |
+ |
|
442 |
+ |
AC_CACHE_CHECK("whether mprotect works", |
443 |
+ |
ac_cv_mprotect_works, [ |
444 |
+ |
AC_LANG_SAVE |
445 |
+ |
AC_LANG_CPLUSPLUS |
446 |
+ |
ac_cv_mprotect_works=yes |
447 |
+ |
dnl First the tests that should segfault |
448 |
+ |
for test_def in NONE_READ NONE_WRITE READ_WRITE; do |
449 |
+ |
AC_TRY_RUN([ |
450 |
+ |
#define CONFIGURE_TEST_VM_MAP |
451 |
+ |
#define TEST_VM_PROT_$test_def |
452 |
+ |
#include "vm_alloc.cpp" |
453 |
+ |
], ac_cv_mprotect_works=no, rm -f core, |
454 |
+ |
dnl When cross-compiling, do not assume anything |
455 |
+ |
ac_cv_mprotect_works="guessing no" |
456 |
+ |
) |
457 |
+ |
done |
458 |
+ |
AC_TRY_RUN([ |
459 |
+ |
#define CONFIGURE_TEST_VM_MAP |
460 |
+ |
#define TEST_VM_PROT_RDWR_WRITE |
461 |
+ |
#include "vm_alloc.cpp" |
462 |
+ |
], , ac_cv_mprotect_works=no, |
463 |
+ |
dnl When cross-compiling, do not assume anything |
464 |
+ |
ac_cv_mprotect_works="guessing no" |
465 |
+ |
) |
466 |
+ |
AC_LANG_RESTORE |
467 |
+ |
] |
468 |
+ |
) |
469 |
+ |
|
470 |
+ |
dnl Remove support for mmap() if mprotect() does not work |
471 |
+ |
if [[ "x$have_mmap_vm" = "xyes" ]]; then |
472 |
+ |
case $ac_cv_mprotect_works in |
473 |
+ |
*yes) have_mmap_vm=yes;; |
474 |
+ |
*no) have_mmap_vm=no;; |
475 |
+ |
esac |
476 |
+ |
fi |
477 |
+ |
AC_TRANSLATE_DEFINE(HAVE_MMAP_VM, $have_mmap_vm) |
478 |
+ |
|
479 |
+ |
fi dnl HAVE_MMAP_VM |
480 |
+ |
|
481 |
|
dnl Check if we can mmap 0x2000 bytes from 0x0000 |
482 |
|
AC_CACHE_CHECK("whether we can map Low Memory area 0x0000-0x2000", |
483 |
|
ac_cv_can_map_lm, [ |
484 |
|
AC_LANG_SAVE |
485 |
|
AC_LANG_CPLUSPLUS |
486 |
|
AC_TRY_RUN([ |
487 |
< |
#include <unistd.h> |
488 |
< |
#include <fcntl.h> |
489 |
< |
#include <sys/mman.h> |
490 |
< |
|
491 |
< |
int main() |
492 |
< |
{ int zero_fd; char * lm; |
493 |
< |
if ((zero_fd = open("/dev/zero", O_RDWR)) < 0) exit(1); |
494 |
< |
if ((lm = (char *)mmap((caddr_t)0x0000, 0x2000, PROT_READ | PROT_WRITE, MAP_FIXED | MAP_PRIVATE, zero_fd, 0)) == MAP_FAILED) exit(1); |
301 |
< |
lm[0] = 0x12; |
302 |
< |
munmap(lm, 0x2000); |
303 |
< |
close(zero_fd); |
304 |
< |
exit(0); |
487 |
> |
#include "vm_alloc.cpp" |
488 |
> |
int main(void) { /* returns 0 if we could map the lowmem globals */ |
489 |
> |
volatile char * lm; |
490 |
> |
if (vm_init() < 0) exit(1); |
491 |
> |
if ((lm = (volatile char *)vm_acquire_fixed(0, 0x2000)) == VM_MAP_FAILED) exit(1); |
492 |
> |
lm[0] = 'z'; |
493 |
> |
if (vm_release((char *)lm, 0x2000) < 0) exit(1); |
494 |
> |
vm_exit(); exit(0); |
495 |
|
} |
496 |
< |
], |
497 |
< |
[ac_cv_can_map_lm=yes], |
498 |
< |
[ac_cv_can_map_lm=no] |
496 |
> |
], ac_cv_can_map_lm=yes, ac_cv_can_map_lm=no, |
497 |
> |
dnl When cross-compiling, do not assume anything. |
498 |
> |
ac_cv_can_map_lm="guessing no" |
499 |
|
) |
500 |
|
AC_LANG_RESTORE |
501 |
|
] |
502 |
|
) |
503 |
|
|
504 |
< |
dnl Check if extended signals are supported. |
505 |
< |
AC_CACHE_CHECK("whether your system supports extended signal handlers", |
506 |
< |
ac_cv_have_extended_signals, [ |
504 |
> |
dnl Check signal handlers need to be reinstalled |
505 |
> |
AC_CACHE_CHECK("whether signal handlers need to be reinstalled", |
506 |
> |
ac_cv_signal_need_reinstall, [ |
507 |
|
AC_LANG_SAVE |
508 |
|
AC_LANG_CPLUSPLUS |
509 |
|
AC_TRY_RUN([ |
510 |
+ |
#include <stdlib.h> |
511 |
+ |
#ifdef HAVE_UNISTD_H |
512 |
|
#include <unistd.h> |
513 |
+ |
#endif |
514 |
|
#include <signal.h> |
515 |
< |
#include <fcntl.h> |
516 |
< |
#include <sys/mman.h> |
517 |
< |
|
518 |
< |
static volatile caddr_t mem = 0; |
519 |
< |
static int zero_fd = -1; |
515 |
> |
static int handled_signal = 0; |
516 |
> |
RETSIGTYPE sigusr1_handler(int) { handled_signal++; } |
517 |
> |
int main(void) { /* returns 0 if signals need not to be reinstalled */ |
518 |
> |
signal(SIGUSR1, sigusr1_handler); raise(SIGUSR1); raise(SIGUSR1); |
519 |
> |
exit(handled_signal == 2); |
520 |
> |
} |
521 |
> |
], ac_cv_signal_need_reinstall=yes, ac_cv_signal_need_reinstall=no, |
522 |
> |
dnl When cross-compiling, do not assume anything. |
523 |
> |
ac_cv_signal_need_reinstall="guessing yes" |
524 |
> |
) |
525 |
> |
AC_LANG_RESTORE |
526 |
> |
] |
527 |
> |
) |
528 |
> |
AC_TRANSLATE_DEFINE(SIGNAL_NEED_REINSTALL, "$ac_cv_signal_need_reinstall") |
529 |
|
|
530 |
< |
static RETSIGTYPE segfault_handler(int, siginfo_t * sip, void *) |
531 |
< |
{ if ((caddr_t)(sip->si_addr) != mem) exit(1); |
532 |
< |
munmap(mem, getpagesize()); close(zero_fd); exit(0); } |
533 |
< |
|
534 |
< |
int main() |
535 |
< |
{ if ((zero_fd = open("/dev/zero", O_RDWR)) < 0) exit(1); |
536 |
< |
if ((mem = (caddr_t)mmap(0, getpagesize(), PROT_READ, MAP_PRIVATE, zero_fd, 0)) == (caddr_t)MAP_FAILED) exit(1); |
537 |
< |
struct sigaction sa; sa.sa_sigaction = segfault_handler; sa.sa_flags = 0; |
538 |
< |
sigaction(SIGSEGV, &sa, 0); |
539 |
< |
mem[0] = 0; |
540 |
< |
exit(1); // should not be reached |
530 |
> |
dnl Check if sigaction handlers need to be reinstalled |
531 |
> |
AC_CACHE_CHECK("whether sigaction handlers need to be reinstalled", |
532 |
> |
ac_cv_sigaction_need_reinstall, [ |
533 |
> |
AC_LANG_SAVE |
534 |
> |
AC_LANG_CPLUSPLUS |
535 |
> |
AC_TRY_RUN([ |
536 |
> |
#include <stdlib.h> |
537 |
> |
#ifdef HAVE_UNISTD_H |
538 |
> |
#include <unistd.h> |
539 |
> |
#endif |
540 |
> |
#include <signal.h> |
541 |
> |
static int handled_signal = 0; |
542 |
> |
RETSIGTYPE sigusr1_handler(int) { handled_signal++; } |
543 |
> |
typedef RETSIGTYPE (*signal_handler)(int); |
544 |
> |
static signal_handler mysignal(int sig, signal_handler handler) { |
545 |
> |
struct sigaction old_sa; |
546 |
> |
struct sigaction new_sa; |
547 |
> |
new_sa.sa_handler = handler; |
548 |
> |
return ((sigaction(sig,&new_sa,&old_sa) < 0) ? SIG_IGN : old_sa.sa_handler); |
549 |
> |
} |
550 |
> |
int main(void) { /* returns 0 if signals need not to be reinstalled */ |
551 |
> |
mysignal(SIGUSR1, sigusr1_handler); raise(SIGUSR1); raise(SIGUSR1); |
552 |
> |
exit(handled_signal == 2); |
553 |
|
} |
554 |
< |
], |
555 |
< |
[ac_cv_have_extended_signals=yes], |
556 |
< |
[ac_cv_have_extended_signals=no] |
554 |
> |
], ac_cv_sigaction_need_reinstall=yes, ac_cv_sigaction_need_reinstall=no, |
555 |
> |
dnl When cross-compiling, do not assume anything. |
556 |
> |
ac_cv_sigaction_need_reinstall="guessing yes" |
557 |
> |
) |
558 |
> |
AC_LANG_RESTORE |
559 |
> |
] |
560 |
> |
) |
561 |
> |
AC_TRANSLATE_DEFINE(SIGACTION_NEED_REINSTALL, "$ac_cv_sigaction_need_reinstall") |
562 |
> |
|
563 |
> |
dnl Check if extended signals are supported. |
564 |
> |
AC_CACHE_CHECK("whether your system supports extended signal handlers", |
565 |
> |
ac_cv_have_extended_signals, [ |
566 |
> |
AC_LANG_SAVE |
567 |
> |
AC_LANG_CPLUSPLUS |
568 |
> |
AC_TRY_RUN([ |
569 |
> |
#define HAVE_SIGINFO_T 1 |
570 |
> |
#define CONFIGURE_TEST_SIGSEGV_RECOVERY |
571 |
> |
#include "vm_alloc.cpp" |
572 |
> |
#include "sigsegv.cpp" |
573 |
> |
], ac_cv_have_extended_signals=yes, ac_cv_have_extended_signals=no, |
574 |
> |
dnl When cross-compiling, do not assume anything. |
575 |
> |
ac_cv_have_extended_signals=no |
576 |
|
) |
577 |
|
AC_LANG_RESTORE |
578 |
|
] |
581 |
|
|
582 |
|
dnl Otherwise, check for subterfuges. |
583 |
|
if [[ "x$ac_cv_have_extended_signals" = "xno" ]]; then |
584 |
< |
case "$target_os" in |
585 |
< |
linux*) |
586 |
< |
if [[ "x$HAVE_I386" = "xyes" ]]; then |
587 |
< |
AC_CACHE_CHECK("whether we then have a subterfuge for your system", |
588 |
< |
ac_cv_have_sigcontext_hack, [ |
589 |
< |
AC_LANG_SAVE |
590 |
< |
AC_LANG_CPLUSPLUS |
591 |
< |
AC_TRY_RUN([ |
592 |
< |
#include <unistd.h> |
593 |
< |
#include <signal.h> |
594 |
< |
#include <fcntl.h> |
595 |
< |
#include <sys/mman.h> |
596 |
< |
|
597 |
< |
static volatile caddr_t mem = 0; |
598 |
< |
static int zero_fd = -1; |
599 |
< |
|
367 |
< |
static RETSIGTYPE segfault_handler(int, struct sigcontext scs) |
368 |
< |
{ if ((caddr_t)(scs.cr2) != mem) exit(1); |
369 |
< |
munmap(mem, getpagesize()); close(zero_fd); exit(0); } |
370 |
< |
|
371 |
< |
int main() |
372 |
< |
{ if ((zero_fd = open("/dev/zero", O_RDWR)) < 0) exit(1); |
373 |
< |
if ((mem = (caddr_t)mmap(0, getpagesize(), PROT_READ, MAP_PRIVATE, zero_fd, 0)) == (caddr_t)MAP_FAILED) exit(1); |
374 |
< |
struct sigaction sa; sa.sa_flags = 0; |
375 |
< |
sa.sa_handler = (RETSIGTYPE (*)(int))segfault_handler; |
376 |
< |
sigaction(SIGSEGV, &sa, 0); |
377 |
< |
mem[0] = 0; |
378 |
< |
exit(1); // should not be reached |
379 |
< |
} |
380 |
< |
], |
381 |
< |
[ac_cv_have_sigcontext_hack=yes], |
382 |
< |
[ac_cv_have_sigcontext_hack=no] |
383 |
< |
) |
384 |
< |
AC_LANG_RESTORE |
385 |
< |
]) |
386 |
< |
AC_TRANSLATE_DEFINE(HAVE_SIGCONTEXT_SUBTERFUGE, $ac_cv_have_sigcontext_hack) |
387 |
< |
fi |
388 |
< |
;; |
389 |
< |
esac |
584 |
> |
AC_CACHE_CHECK("whether we then have a subterfuge for your system", |
585 |
> |
ac_cv_have_sigcontext_hack, [ |
586 |
> |
AC_LANG_SAVE |
587 |
> |
AC_LANG_CPLUSPLUS |
588 |
> |
AC_TRY_RUN([ |
589 |
> |
#define HAVE_SIGCONTEXT_SUBTERFUGE 1 |
590 |
> |
#define CONFIGURE_TEST_SIGSEGV_RECOVERY |
591 |
> |
#include "vm_alloc.cpp" |
592 |
> |
#include "sigsegv.cpp" |
593 |
> |
], ac_cv_have_sigcontext_hack=yes, ac_cv_have_sigcontext_hack=no, |
594 |
> |
dnl When cross-compiling, do not assume anything. |
595 |
> |
ac_cv_have_sigcontext_hack=no |
596 |
> |
) |
597 |
> |
AC_LANG_RESTORE |
598 |
> |
]) |
599 |
> |
AC_TRANSLATE_DEFINE(HAVE_SIGCONTEXT_SUBTERFUGE, "$ac_cv_have_sigcontext_hack") |
600 |
|
fi |
601 |
|
|
602 |
|
dnl Can we do Video on SEGV Signals ? |
606 |
|
fi |
607 |
|
|
608 |
|
dnl Determine the addressing mode to use |
609 |
< |
ADDRESSING_MODE="" |
610 |
< |
AC_MSG_CHECKING([for the addressing mode to use]) |
611 |
< |
for am in $ADDRESSING_TEST_ORDER; do |
612 |
< |
case $am in |
613 |
< |
real) |
614 |
< |
dnl Requires ability to mmap Low Memory globals. |
615 |
< |
if [[ "x$ac_cv_can_map_lm" = "xno" ]]; then |
616 |
< |
continue |
617 |
< |
fi |
618 |
< |
if [[ "x$ac_cv_c_bigendian" = "xyes" ]]; then |
619 |
< |
dnl Requires only VOSF if 16-bit vidmode enable |
410 |
< |
if [[ "x$WANT_16BIT_VIDMODE" = "xyes" ]]; then |
411 |
< |
if [[ "x$CAN_VOSF" = "xno" ]]; then |
412 |
< |
continue |
413 |
< |
fi |
414 |
< |
else |
415 |
< |
DEFINES="$DEFINES -DDISABLE_16BIT_VIDMODE" |
609 |
> |
if [[ "x$WANT_NATIVE_M68K" = "xyes" ]]; then |
610 |
> |
ADDRESSING_MODE="real" |
611 |
> |
else |
612 |
> |
ADDRESSING_MODE="" |
613 |
> |
AC_MSG_CHECKING([for the addressing mode to use]) |
614 |
> |
for am in $ADDRESSING_TEST_ORDER; do |
615 |
> |
case $am in |
616 |
> |
real) |
617 |
> |
dnl Requires ability to mmap() Low Memory globals |
618 |
> |
if [[ "x$ac_cv_can_map_lm" = "xno" ]]; then |
619 |
> |
continue |
620 |
|
fi |
621 |
< |
else |
418 |
< |
dnl Requires VOSF |
621 |
> |
dnl Requires VOSF screen updates |
622 |
|
if [[ "x$CAN_VOSF" = "xno" ]]; then |
623 |
|
continue |
624 |
|
fi |
625 |
< |
fi |
626 |
< |
dnl Real addressing will probably work |
424 |
< |
ADDRESSING_MODE="real" |
425 |
< |
WANT_VOSF=yes dnl we can use VOSF and we need it actually |
426 |
< |
DEFINES="$DEFINES -DREAL_ADDRESSING" |
427 |
< |
break |
428 |
< |
;; |
429 |
< |
direct) |
430 |
< |
dnl Requires VOSF |
431 |
< |
if [[ "x$CAN_VOSF" = "xyes" ]]; then |
432 |
< |
ADDRESSING_MODE="direct" |
625 |
> |
dnl Real addressing will probably work. |
626 |
> |
ADDRESSING_MODE="real" |
627 |
|
WANT_VOSF=yes dnl we can use VOSF and we need it actually |
628 |
< |
DEFINES="$DEFINES -DDIRECT_ADDRESSING" |
628 |
> |
DEFINES="$DEFINES -DREAL_ADDRESSING" |
629 |
|
break |
630 |
< |
fi |
631 |
< |
;; |
632 |
< |
banks) |
633 |
< |
dnl Default addressing mode |
630 |
> |
;; |
631 |
> |
direct) |
632 |
> |
dnl Requires VOSF screen updates |
633 |
> |
if [[ "x$CAN_VOSF" = "xyes" ]]; then |
634 |
> |
ADDRESSING_MODE="direct" |
635 |
> |
WANT_VOSF=yes dnl we can use VOSF and we need it actually |
636 |
> |
DEFINES="$DEFINES -DDIRECT_ADDRESSING" |
637 |
> |
break |
638 |
> |
fi |
639 |
> |
;; |
640 |
> |
banks) |
641 |
> |
dnl Default addressing mode |
642 |
> |
ADDRESSING_MODE="memory banks" |
643 |
> |
break |
644 |
> |
;; |
645 |
> |
*) |
646 |
> |
AC_MSG_ERROR([Internal configure.in script error for $am addressing mode]) |
647 |
> |
esac |
648 |
> |
done |
649 |
> |
AC_MSG_RESULT($ADDRESSING_MODE) |
650 |
> |
if [[ "x$ADDRESSING_MODE" = "x" ]]; then |
651 |
> |
AC_MSG_WARN([Sorry, no suitable addressing mode in $ADDRESSING_TEST_ORDER]) |
652 |
|
ADDRESSING_MODE="memory banks" |
653 |
< |
break |
442 |
< |
;; |
443 |
< |
*) |
444 |
< |
AC_MSG_ERROR([Internal configure.in script error for $am addressing mode]) |
445 |
< |
esac |
446 |
< |
done |
447 |
< |
AC_MSG_RESULT($ADDRESSING_MODE) |
448 |
< |
if [[ "x$ADDRESSING_MODE" = "x" ]]; then |
449 |
< |
AC_MSG_WARN([Sorry, no suitable addressing mode in $ADDRESSING_TEST_ORDER]) |
450 |
< |
ADDRESSING_MODE="memory banks" |
653 |
> |
fi |
654 |
|
fi |
655 |
|
|
656 |
< |
dnl Since real and direct addressing modes automatically activate VOSF, |
657 |
< |
dnl I put this test here. |
455 |
< |
if [[ "x$WANT_VOSF" = "xyes" ]]; then |
456 |
< |
if [[ "x$CAN_VOSF" = "xno" ]]; then |
457 |
< |
AC_MSG_WARN([Sorry, your system does not support Video on SEGV signals]) |
458 |
< |
WANT_VOSF=no |
459 |
< |
else |
656 |
> |
dnl Enable VOSF screen updates with this feature is requested and feasible |
657 |
> |
if [[ "x$WANT_VOSF" = "xyes" -a "x$CAN_VOSF" = "xyes" ]]; then |
658 |
|
AC_DEFINE(ENABLE_VOSF) |
659 |
< |
fi |
659 |
> |
else |
660 |
> |
WANT_VOSF=no |
661 |
|
fi |
662 |
|
|
663 |
|
dnl Check for GAS. |
679 |
|
#endif |
680 |
|
], [AC_MSG_RESULT(yes); HAVE_GCC27=yes], AC_MSG_RESULT(no)) |
681 |
|
|
682 |
+ |
dnl Check for GCC 3.0 or higher. |
683 |
+ |
HAVE_GCC30=no |
684 |
+ |
AC_MSG_CHECKING(for GCC 3.0 or higher) |
685 |
+ |
AC_EGREP_CPP(yes, |
686 |
+ |
[#if __GNUC__ >= 3 |
687 |
+ |
yes |
688 |
+ |
#endif |
689 |
+ |
], [AC_MSG_RESULT(yes); HAVE_GCC30=yes], AC_MSG_RESULT(no)) |
690 |
+ |
|
691 |
|
dnl Set "-fomit-frame-pointer" on i386 GCC 2.7 or higher. |
692 |
+ |
dnl Also set "-fno-exceptions" for C++ because exception handling requires |
693 |
+ |
dnl the frame pointer. |
694 |
|
if [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_I386" = "xyes" ]]; then |
695 |
|
CFLAGS="$CFLAGS -fomit-frame-pointer" |
696 |
< |
CXXFLAGS="$CXXFLAGS -fomit-frame-pointer" |
696 |
> |
CXXFLAGS="$CXXFLAGS -fomit-frame-pointer -fno-exceptions" |
697 |
> |
fi |
698 |
> |
|
699 |
> |
dnl (gb) Do not merge constants since it breaks fpu/fpu_x86.cpp. |
700 |
> |
dnl As of 2001/08/02, this affects the following compilers: |
701 |
> |
dnl Official: probably gcc-3.1 (mainline CVS) |
702 |
> |
dnl Mandrake: gcc-2.96 >= 0.59mdk, gcc-3.0.1 >= 0.1mdk |
703 |
> |
dnl Red Hat : gcc-2.96 >= 89, gcc-3.0 >= 1 |
704 |
> |
if [[ "x$HAVE_GCC27" = "xyes" ]]; then |
705 |
> |
SAVED_CXXFLAGS="$CXXFLAGS" |
706 |
> |
CXXFLAGS="$CXXFLAGS -fno-merge-constants" |
707 |
> |
AC_CACHE_CHECK([whether GCC supports constants merging], ac_cv_gcc_constants_merging, [ |
708 |
> |
AC_LANG_SAVE |
709 |
> |
AC_LANG_CPLUSPLUS |
710 |
> |
AC_TRY_COMPILE([],[],[ac_cv_gcc_constants_merging=yes],[ac_cv_gcc_constants_merging=no]) |
711 |
> |
AC_LANG_RESTORE |
712 |
> |
]) |
713 |
> |
if [[ "x$ac_cv_gcc_constants_merging" != "xyes" ]]; then |
714 |
> |
CXXFLAGS="$SAVED_CXXFLAGS" |
715 |
> |
fi |
716 |
|
fi |
717 |
|
|
718 |
|
dnl Select appropriate CPU source and REGPARAM define. |
719 |
|
ASM_OPTIMIZATIONS=none |
491 |
– |
WANT_NATIVE_M68K=no |
720 |
|
CPUSRCS="cpuemu1.cpp cpuemu2.cpp cpuemu3.cpp cpuemu4.cpp cpuemu5.cpp cpuemu6.cpp cpuemu7.cpp cpuemu8.cpp" |
721 |
< |
FPUSRCS="../uae_cpu/fpp.cpp" |
722 |
< |
if [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_I386" = "xyes" ]]; then |
721 |
> |
FPUSRCS="../uae_cpu/fpu/fpu_uae.cpp" |
722 |
> |
if [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_I386" = "xyes" -a "x$OS_TYPE" != "xfreebsd" ]]; then |
723 |
|
dnl i386 CPU |
724 |
|
DEFINES="$DEFINES -DREGPARAM=\"__attribute__((regparm(3)))\"" |
725 |
|
if [[ "x$HAVE_GAS" = "xyes" ]]; then |
726 |
|
ASM_OPTIMIZATIONS=i386 |
727 |
< |
DEFINES="$DEFINES -DX86_ASSEMBLY -DOPTFLAGS" |
728 |
< |
CPUSRCS="../uae_cpu/compiler.cpp cpufast1.s cpufast2.s cpufast3.s cpufast4.s cpufast5.s cpufast6.s cpufast7.s cpufast8.s" |
727 |
> |
DEFINES="$DEFINES -DX86_ASSEMBLY -DUNALIGNED_PROFITABLE -DOPTIMIZED_FLAGS" |
728 |
> |
CPUSRCS="cpufast1.s cpufast2.s cpufast3.s cpufast4.s cpufast5.s cpufast6.s cpufast7.s cpufast8.s" |
729 |
|
FPUSRCS="../uae_cpu/fpu_x86.cpp" |
730 |
|
fi |
731 |
|
elif [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_SPARC" = "xyes" -a "x$HAVE_GAS" = "xyes" ]]; then |
737 |
|
AC_MSG_RESULT($SPARC_TYPE) |
738 |
|
case "$SPARC_TYPE" in |
739 |
|
SPARC_V8) |
740 |
< |
ASM_OPTIMIZATIONS="SPARC V8 architecture" |
741 |
< |
DEFINES="$DEFINES -DSPARC_V8_ASSEMBLY" dnl -DOPTFLAGS" |
740 |
> |
ASM_OPTIMIZATIONS="SPARC V8 architecture" |
741 |
> |
DEFINES="$DEFINES -DSPARC_V8_ASSEMBLY" dnl -DOPTIMIZED_FLAGS" |
742 |
|
CFLAGS="$CFLAGS -Wa,-Av8" |
743 |
|
CXXFLAGS="$CXXFLAGS -Wa,-Av8" |
744 |
|
;; |
745 |
|
SPARC_V9) |
746 |
< |
ASM_OPTIMIZATIONS="SPARC V9 architecture" |
747 |
< |
DEFINES="$DEFINES -DSPARC_V9_ASSEMBLY" dnl -DOPTFLAGS" |
746 |
> |
ASM_OPTIMIZATIONS="SPARC V9 architecture" |
747 |
> |
DEFINES="$DEFINES -DSPARC_V9_ASSEMBLY" dnl -DOPTIMIZED_FLAGS" |
748 |
|
CFLAGS="$CFLAGS -Wa,-Av9" |
749 |
|
CXXFLAGS="$CXXFLAGS -Wa,-Av9" |
750 |
|
;; |
751 |
|
esac |
752 |
|
;; |
753 |
|
esac |
754 |
< |
elif [[ "x$HAVE_M68K" = "xyes" -a "x$SUPPORTS_NATIVE_M68K" = "xyes" ]]; then |
754 |
> |
elif [[ "x$WANT_NATIVE_M68K" = "xyes" ]]; then |
755 |
|
dnl Native m68k, no emulation |
756 |
< |
CPUSRCS="" |
757 |
< |
AC_DEFINE(ENABLE_NATIVE_M68K) |
530 |
< |
WANT_NATIVE_M68K=yes |
756 |
> |
CPUINCLUDES="-I../native_cpu" |
757 |
> |
CPUSRCS="asm_support.s" |
758 |
|
fi |
759 |
|
|
760 |
+ |
dnl Select appropriate FPU source. |
761 |
+ |
dnl 1. Optimized X86 assembly core if target is i386 architecture |
762 |
+ |
SAVED_DEFINES=$DEFINES |
763 |
+ |
if [[ "x$FPE_CORE" = "xdefault" ]]; then |
764 |
+ |
if [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_I386" = "xyes" -a "x$HAVE_GAS" = "xyes" ]]; then |
765 |
+ |
DEFINES="$DEFINES -DFPU_X86" |
766 |
+ |
FPE_CORE_STR="i386 optimized core" |
767 |
+ |
FPUSRCS="../uae_cpu/fpu/fpu_x86.cpp" |
768 |
+ |
FPE_CORE="i386" |
769 |
+ |
else |
770 |
+ |
FPE_CORE="uae" |
771 |
+ |
fi |
772 |
+ |
fi |
773 |
+ |
|
774 |
+ |
dnl 2. JIT-FPU only supports IEEE-based implementation. |
775 |
+ |
if [[ "x$WANT_JIT_FPU" = "xyes" -a "x$FPE_CORE" != "xieee" ]]; then |
776 |
+ |
AC_MSG_WARN([Sorry, JIT-FPU supports only the "ieee" FPE implementation]) |
777 |
+ |
FPE_CORE="ieee" |
778 |
+ |
dnl Restore previous variables. FPE_CORE_STR and FPUSRCS are overwritten |
779 |
+ |
DEFINES=$SAVED_DEFINES |
780 |
+ |
fi |
781 |
+ |
|
782 |
+ |
dnl 3. Choose either IEEE-based implementation or the old UAE core |
783 |
+ |
if [[ "x$FPE_CORE" = "xieee" ]]; then |
784 |
+ |
AC_CHECK_HEADERS(fenv.h) |
785 |
+ |
AC_CHECK_FUNCS(feclearexcept fegetexceptflag feraiseexcept fesetexceptflag fetestexcept) |
786 |
+ |
AC_CHECK_FUNCS(fegetround fesetround) |
787 |
+ |
DEFINES="$DEFINES -DFPU_IEEE" |
788 |
+ |
FPE_CORE_STR="ieee-based fpu core" |
789 |
+ |
FPUSRCS="../uae_cpu/fpu/fpu_ieee.cpp" |
790 |
+ |
elif [[ "x$FPE_CORE" = "xuae" ]]; then |
791 |
+ |
DEFINES="$DEFINES -DFPU_UAE" |
792 |
+ |
FPE_CORE_STR="original uae core" |
793 |
+ |
FPUSRCS="../uae_cpu/fpu/fpu_uae.cpp" |
794 |
+ |
fi |
795 |
+ |
|
796 |
+ |
dnl Check for certain math functions |
797 |
+ |
AC_CHECK_FUNCS(atanh) |
798 |
+ |
AC_CHECK_FUNCS(isnan isinf) dnl C99 |
799 |
+ |
AC_CHECK_FUNCS(isnanl isinfl) dnl IEEE ? |
800 |
+ |
|
801 |
|
dnl UAE CPU sources for all non-m68k-native architectures. |
802 |
|
if [[ "x$WANT_NATIVE_M68K" = "xno" ]]; then |
803 |
|
CPUINCLUDES="-I../uae_cpu" |
804 |
|
CPUSRCS="../uae_cpu/basilisk_glue.cpp ../uae_cpu/memory.cpp ../uae_cpu/newcpu.cpp ../uae_cpu/readcpu.cpp $FPUSRCS cpustbl.cpp cpudefs.cpp $CPUSRCS" |
537 |
– |
else |
538 |
– |
CPUINCLUDES="-I../native_cpu" |
539 |
– |
CPUSRCS="asm_support.s" |
805 |
|
fi |
806 |
|
|
807 |
|
dnl Remove the "-g" option if set for GCC. |
808 |
|
if [[ "x$HAVE_GCC27" = "xyes" ]]; then |
809 |
< |
dnl gb-- Probably not the cleanest way to take |
810 |
< |
CFLAGS=`echo $CFLAGS | sed -e 's/ -g / /;s/^-g / /;s/ -g$/ /;s/^-g$//'` |
811 |
< |
CXXFLAGS=`echo $CXXFLAGS | sed -e 's/ -g / /;s/^-g / /;s/ -g$/ /;s/^-g$//'` |
809 |
> |
CFLAGS=`echo $CFLAGS | sed -e 's/-g//g'` |
810 |
> |
CXXFLAGS=`echo $CXXFLAGS | sed -e 's/-g//g'` |
811 |
> |
fi |
812 |
> |
|
813 |
> |
dnl Or if we have -Ofast |
814 |
> |
if [[ "x$HAVE_OFAST" = "xyes" ]]; then |
815 |
> |
CFLAGS="`echo $CFLAGS | sed -e 's/-g//g'` -Ofast" |
816 |
> |
CXXFLAGS="`echo $CXXFLAGS | sed -e 's/-g//g'` -Ofast" |
817 |
> |
CXXFLAGS="-LANG:std $CXXFLAGS" |
818 |
> |
LDFLAGS="$LDFLAGS -Ofast" |
819 |
|
fi |
820 |
|
|
821 |
|
dnl Generate Makefile. |
837 |
|
echo GTK user interface ............... : $WANT_GTK |
838 |
|
echo mon debugger support ............. : $WANT_MON |
839 |
|
echo Running m68k code natively ....... : $WANT_NATIVE_M68K |
840 |
+ |
echo Floating-Point emulation core .... : $FPE_CORE_STR |
841 |
|
echo Assembly optimizations ........... : $ASM_OPTIMIZATIONS |
842 |
|
echo Addressing mode .................. : $ADDRESSING_MODE |
843 |
|
echo |