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