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" |
92 |
+ |
AC_CHECK_LIB(ncurses, tgetent, , |
93 |
+ |
AC_CHECK_LIB(termcap, tgetent, , |
94 |
+ |
AC_CHECK_LIB(termlib, tgetent, , |
95 |
+ |
AC_CHECK_LIB(terminfo, tgetent, , |
96 |
+ |
AC_CHECK_LIB(Hcurses, tgetent, , |
97 |
+ |
AC_CHECK_LIB(curses, tgetent)))))) |
98 |
|
AC_CHECK_LIB(readline, readline) |
77 |
– |
AC_CHECK_LIB(termcap, tputs) |
99 |
|
AC_CHECK_HEADERS(readline.h history.h readline/readline.h readline/history.h) |
100 |
|
else |
101 |
|
AC_MSG_RESULT(no) |
106 |
|
|
107 |
|
dnl Checks for libraries. |
108 |
|
AC_CHECK_LIB(posix4, sem_init) |
109 |
+ |
AC_CHECK_LIB(rt, timer_create) |
110 |
|
|
111 |
|
dnl We need X11. |
112 |
|
AC_PATH_XTRA |
130 |
|
AC_DEFINE(HAVE_PTHREADS) |
131 |
|
fi |
132 |
|
AC_CHECK_FUNCS(pthread_cancel) |
133 |
+ |
AC_CHECK_FUNCS(pthread_mutexattr_setprotocol) |
134 |
+ |
AC_CHECK_FUNCS(pthread_mutexattr_settype) |
135 |
|
|
136 |
|
dnl If POSIX.4 semaphores are not available, we emulate them with pthread mutexes. |
137 |
|
SEMSRC= |
138 |
|
AC_CHECK_FUNCS(sem_init, , [ |
139 |
< |
if [ "x$HAVE_PTHREADS" = "xyes" ]; then |
139 |
> |
if test "x$HAVE_PTHREADS" = "xyes"; then |
140 |
|
SEMSRC=posix_sem.cpp |
141 |
|
fi |
142 |
|
]) |
175 |
|
if [[ "x$WANT_GTK" = "xyes" ]]; then |
176 |
|
AM_PATH_GTK(1.2.0, [ |
177 |
|
AC_DEFINE(ENABLE_GTK) |
154 |
– |
CFLAGS="$CFLAGS $GTK_CFLAGS" |
178 |
|
CXXFLAGS="$CXXFLAGS $GTK_CFLAGS" |
179 |
|
LIBS="$LIBS $GTK_LIBS" |
180 |
|
UISRCS=prefs_editor_gtk.cpp |
181 |
+ |
B2_PATH_GNOMEUI([ |
182 |
+ |
AC_DEFINE(HAVE_GNOMEUI) |
183 |
+ |
CXXFLAGS="$CXXFLAGS $GNOMEUI_CFLAGS" |
184 |
+ |
LIBS="$LIBS $GNOMEUI_LIBS" |
185 |
+ |
], []) |
186 |
|
], [ |
187 |
|
AC_MSG_WARN([Could not find GTK+, disabling user interface.]) |
188 |
|
WANT_GTK=no |
202 |
|
]) |
203 |
|
fi |
204 |
|
|
205 |
+ |
dnl We use 64-bit file size support if possible. |
206 |
+ |
dnl FIXME: Use AC_SYS_LARGEFILE from autoconf 2.5+ |
207 |
+ |
if [[ "x$OS_TYPE" = "xlinux" ]]; then |
208 |
+ |
AC_DEFINE(_USE_LARGEFILE_SOURCE, 1, [Get more functions for correct standard I/O]) |
209 |
+ |
AC_DEFINE(_FILE_OFFSET_BITS, 64, [Get 64-bit file size support]) |
210 |
+ |
fi |
211 |
+ |
|
212 |
|
dnl Checks for header files. |
213 |
|
AC_HEADER_STDC |
214 |
< |
AC_CHECK_HEADERS(unistd.h fcntl.h sys/time.h) |
214 |
> |
AC_CHECK_HEADERS(unistd.h fcntl.h sys/time.h sys/mman.h) |
215 |
|
|
216 |
|
dnl Checks for typedefs, structures, and compiler characteristics. |
217 |
|
AC_C_BIGENDIAN |
224 |
|
AC_CHECK_SIZEOF(void *, 4) |
225 |
|
AC_TYPE_OFF_T |
226 |
|
AC_CHECK_TYPE(loff_t, off_t) |
227 |
+ |
AC_CHECK_TYPE(caddr_t, [char *]) |
228 |
|
AC_TYPE_SIZE_T |
229 |
|
AC_TYPE_SIGNAL |
230 |
|
AC_HEADER_TIME |
231 |
|
AC_STRUCT_TM |
232 |
|
|
233 |
+ |
dnl Check whether sys/socket.h defines type socklen_t. |
234 |
+ |
dnl (extracted from ac-archive/Miscellaneous) |
235 |
+ |
AC_CACHE_CHECK("for socklen_t", |
236 |
+ |
ac_cv_type_socklen_t, [ |
237 |
+ |
AC_TRY_COMPILE([ |
238 |
+ |
#include <sys/types.h> |
239 |
+ |
#include <sys/socket.h> |
240 |
+ |
], [socklen_t len = 42; return 0;], |
241 |
+ |
ac_cv_type_socklen_t=yes, ac_cv_type_socklen_t=no, |
242 |
+ |
dnl When cross-compiling, do not assume anything. |
243 |
+ |
ac_cv_type_socklen_t="guessing no" |
244 |
+ |
) |
245 |
+ |
]) |
246 |
+ |
if [[ "x$ac_cv_type_socklen_t" != "xyes" ]]; then |
247 |
+ |
AC_DEFINE(socklen_t, int) |
248 |
+ |
fi |
249 |
+ |
|
250 |
|
dnl Checks for library functions. |
251 |
|
AC_CHECK_FUNCS(strdup cfmakeraw) |
252 |
|
AC_CHECK_FUNCS(clock_gettime timer_create) |
253 |
+ |
AC_CHECK_FUNCS(sigaction signal) |
254 |
+ |
AC_CHECK_FUNCS(mmap mprotect munmap) |
255 |
+ |
AC_CHECK_FUNCS(vm_allocate vm_deallocate vm_protect) |
256 |
+ |
|
257 |
+ |
dnl Darwin seems to define mach_task_self() instead of task_self(). |
258 |
+ |
AC_CHECK_FUNCS(mach_task_self task_self) |
259 |
+ |
|
260 |
+ |
dnl Check for headers and functions related to pty support (sshpty.c) |
261 |
+ |
dnl From openssh-3.2.2p1 configure.ac |
262 |
+ |
|
263 |
+ |
AC_CHECK_HEADERS(strings.h login.h sys/bsdtty.h sys/stat.h util.h pty.h) |
264 |
+ |
AC_CHECK_FUNCS(_getpty vhangup strlcpy) |
265 |
+ |
|
266 |
+ |
case "$host" in |
267 |
+ |
*-*-hpux10.26) |
268 |
+ |
disable_ptmx_check=yes |
269 |
+ |
;; |
270 |
+ |
*-*-linux*) |
271 |
+ |
no_dev_ptmx=1 |
272 |
+ |
;; |
273 |
+ |
mips-sony-bsd|mips-sony-newsos4) |
274 |
+ |
AC_DEFINE(HAVE_NEWS4) |
275 |
+ |
;; |
276 |
+ |
*-*-sco3.2v4*) |
277 |
+ |
no_dev_ptmx=1 |
278 |
+ |
;; |
279 |
+ |
*-*-sco3.2v5*) |
280 |
+ |
no_dev_ptmx=1 |
281 |
+ |
;; |
282 |
+ |
esac |
283 |
+ |
|
284 |
+ |
if test -z "$no_dev_ptmx" ; then |
285 |
+ |
if test "x$disable_ptmx_check" != "xyes" ; then |
286 |
+ |
AC_CHECK_FILE("/dev/ptmx", |
287 |
+ |
[ |
288 |
+ |
AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX) |
289 |
+ |
have_dev_ptmx=1 |
290 |
+ |
] |
291 |
+ |
) |
292 |
+ |
fi |
293 |
+ |
fi |
294 |
+ |
AC_CHECK_FILE("/dev/ptc", |
295 |
+ |
[ |
296 |
+ |
AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC) |
297 |
+ |
have_dev_ptc=1 |
298 |
+ |
] |
299 |
+ |
) |
300 |
+ |
|
301 |
+ |
dnl (end of code from openssh-3.2.2p1 configure.ac) |
302 |
+ |
|
303 |
|
|
304 |
|
dnl Select system-dependant source files. |
305 |
|
SERIALSRC=serial_unix.cpp |
307 |
|
SCSISRC=../dummy/scsi_dummy.cpp |
308 |
|
AUDIOSRC=../dummy/audio_dummy.cpp |
309 |
|
EXTRASYSSRCS= |
310 |
< |
SUPPORTS_NATIVE_M68K=no |
310 |
> |
CAN_NATIVE_M68K=no |
311 |
|
case "$target_os" in |
312 |
|
linux*) |
313 |
< |
ETHERSRC=Linux/ether_linux.cpp |
211 |
< |
SCSISRC=Linux/scsi_linux.cpp |
313 |
> |
ETHERSRC=ether_unix.cpp |
314 |
|
AUDIOSRC=audio_oss_esd.cpp |
315 |
+ |
SCSISRC=Linux/scsi_linux.cpp |
316 |
|
;; |
317 |
< |
freebsd*3.*) |
317 |
> |
freebsd*) |
318 |
> |
ETHERSRC=ether_unix.cpp |
319 |
|
AUDIOSRC=audio_oss_esd.cpp |
320 |
|
DEFINES="$DEFINES -DBSD_COMP" |
321 |
+ |
CXXFLAGS="$CXXFLAGS -fpermissive" |
322 |
|
dnl Check for the CAM library |
323 |
|
AC_CHECK_LIB(cam, cam_open_btl, HAVE_LIBCAM=yes, HAVE_LIBCAM=no) |
324 |
|
if [[ "x$HAVE_LIBCAM" = "xno" ]]; then |
325 |
|
AC_MSG_WARN([Cannot find libcam for SCSI management, disabling SCSI support.]) |
326 |
|
else |
327 |
|
dnl Check for the sys kernel includes |
328 |
< |
AC_CHECK_HEADER(/sys/cam/cam.h) |
329 |
< |
if [[ "x$ac_cv_header__sys_cam_cam_h" = "xno" ]]; then |
328 |
> |
AC_CHECK_HEADER(camlib.h) |
329 |
> |
if [[ "x$ac_cv_header_camlib_h" = "xno" ]]; then |
330 |
|
dnl In this case I should fix this thing including a "patch" |
331 |
|
dnl to access directly to the functions in the kernel :) --Orlando |
332 |
< |
AC_MSG_WARN([Cannot find kernel includes for CAM library, disabling SCSI support.]) |
332 |
> |
AC_MSG_WARN([Cannot find includes for CAM library, disabling SCSI support.]) |
333 |
|
else |
334 |
|
SCSISRC=FreeBSD/scsi_freebsd.cpp |
230 |
– |
CXXFLAGS="$CXXFLAGS -I/sys" |
231 |
– |
CFLAGS="$CFLAGS -I/sys" |
335 |
|
LIBS="$LIBS -lcam" |
336 |
|
DEFINES="$DEFINES -DCAM" |
337 |
|
fi |
338 |
|
fi |
339 |
|
;; |
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 |
– |
;; |
340 |
|
netbsd*) |
341 |
< |
SUPPORTS_NATIVE_M68K=yes |
341 |
> |
CAN_NATIVE_M68K=yes |
342 |
|
;; |
343 |
|
solaris*) |
344 |
|
AUDIOSRC=Solaris/audio_solaris.cpp |
345 |
|
DEFINES="$DEFINES -DBSD_COMP -D_POSIX_PTHREAD_SEMANTICS" |
346 |
|
;; |
347 |
|
irix*) |
348 |
+ |
ETHERSRC=ether_unix.cpp |
349 |
+ |
AUDIOSRC=Irix/audio_irix.cpp |
350 |
|
EXTRASYSSRCS=Irix/unaligned.c |
351 |
< |
DEFINES="$DEFINES -DCRTSCTS=CNEW_RTSCTS -DB230400=B115200" |
352 |
< |
LIBS="$LIBS -lm" |
351 |
> |
dnl IRIX headers work fine, but somehow don't define or use "STDC_HEADERS" |
352 |
> |
DEFINES="$DEFINES -DCRTSCTS=CNEW_RTSCTS -DB230400=B115200 -DSTDC_HEADERS" |
353 |
> |
LIBS="$LIBS -laudio" |
354 |
> |
WANT_ESD=no |
355 |
> |
|
356 |
> |
dnl Check if our compiler supports -Ofast (MIPSPro) |
357 |
> |
HAVE_OFAST=no |
358 |
> |
ocflags="$CFLAGS" |
359 |
> |
CFLAGS=`echo $CFLAGS | sed -e 's/ -g / -Ofast /;s/^-g /-Ofast /;s/-g$/ -Ofast/;s/^-g$/-Ofast/'` |
360 |
> |
AC_MSG_CHECKING(if "-Ofast" works) |
361 |
> |
dnl Do a test compile of an empty function |
362 |
> |
AC_TRY_COMPILE(,, [AC_MSG_RESULT(yes); HAVE_OFAST=yes], AC_MSG_RESULT(no)) |
363 |
> |
CFLAGS="$ocflags" |
364 |
> |
|
365 |
|
;; |
366 |
|
esac |
367 |
|
|
368 |
+ |
dnl Use 68k CPU natively? |
369 |
+ |
WANT_NATIVE_M68K=no |
370 |
+ |
if [[ "x$HAVE_M68K" = "xyes" -a "x$CAN_NATIVE_M68K" = "xyes" ]]; then |
371 |
+ |
AC_DEFINE(ENABLE_NATIVE_M68K) |
372 |
+ |
WANT_NATIVE_M68K=yes |
373 |
+ |
fi |
374 |
+ |
|
375 |
|
if [[ "x$HAVE_PTHREADS" = "xno" ]]; then |
376 |
|
dnl Serial, ethernet and audio support needs pthreads |
377 |
|
AC_MSG_WARN([You don't have pthreads, disabling serial, ethernet and audio support.]) |
386 |
|
dnl $1 -- the macro to define |
387 |
|
dnl $2 -- the value to translate |
388 |
|
AC_DEFUN(AC_TRANSLATE_DEFINE, [ |
389 |
< |
if [[ "x$2" = "xyes" ]]; then |
389 |
> |
if [[ "x$2" = "xyes" -o "x$2" = "xguessing yes" ]]; then |
390 |
|
AC_DEFINE($1) |
391 |
|
fi |
392 |
|
]) |
393 |
|
|
394 |
+ |
dnl Various checks if the system supports vm_allocate() and the like functions. |
395 |
+ |
have_mach_vm=no |
396 |
+ |
if [[ "x$ac_cv_func_vm_allocate" = "xyes" -a "x$ac_cv_func_vm_deallocate" = "xyes" -a \ |
397 |
+ |
"x$ac_cv_func_vm_protect" = "xyes" ]]; then |
398 |
+ |
have_mach_vm=yes |
399 |
+ |
fi |
400 |
+ |
AC_TRANSLATE_DEFINE(HAVE_MACH_VM, "$have_mach_vm") |
401 |
+ |
|
402 |
+ |
dnl Check that vm_allocate(), vm_protect() work |
403 |
+ |
if [[ "x$have_mach_vm" = "xyes" ]]; then |
404 |
+ |
|
405 |
+ |
AC_CACHE_CHECK("whether vm_protect works", |
406 |
+ |
ac_cv_vm_protect_works, [ |
407 |
+ |
AC_LANG_SAVE |
408 |
+ |
AC_LANG_CPLUSPLUS |
409 |
+ |
ac_cv_vm_protect_works=yes |
410 |
+ |
dnl First the tests that should segfault |
411 |
+ |
for test_def in NONE_READ NONE_WRITE READ_WRITE; do |
412 |
+ |
AC_TRY_RUN([ |
413 |
+ |
#define CONFIGURE_TEST_VM_MAP |
414 |
+ |
#define TEST_VM_PROT_$test_def |
415 |
+ |
#include "vm_alloc.cpp" |
416 |
+ |
], ac_cv_vm_protect_works=no, rm -f core, |
417 |
+ |
dnl When cross-compiling, do not assume anything |
418 |
+ |
ac_cv_vm_protect_works="guessing no" |
419 |
+ |
) |
420 |
+ |
done |
421 |
+ |
AC_TRY_RUN([ |
422 |
+ |
#define CONFIGURE_TEST_VM_MAP |
423 |
+ |
#define TEST_VM_PROT_RDWR_WRITE |
424 |
+ |
#include "vm_alloc.cpp" |
425 |
+ |
], , ac_cv_vm_protect_works=no, |
426 |
+ |
dnl When cross-compiling, do not assume anything |
427 |
+ |
ac_cv_vm_protect_works="guessing no" |
428 |
+ |
) |
429 |
+ |
AC_LANG_RESTORE |
430 |
+ |
] |
431 |
+ |
) |
432 |
+ |
|
433 |
+ |
dnl Remove support for vm_allocate() if vm_protect() does not work |
434 |
+ |
if [[ "x$have_mach_vm" = "xyes" ]]; then |
435 |
+ |
case $ac_cv_vm_protect_works in |
436 |
+ |
*yes) have_mach_vm=yes;; |
437 |
+ |
*no) have_mach_vm=no;; |
438 |
+ |
esac |
439 |
+ |
fi |
440 |
+ |
AC_TRANSLATE_DEFINE(HAVE_MACH_VM, "$have_mach_vm") |
441 |
+ |
|
442 |
+ |
fi dnl HAVE_MACH_VM |
443 |
+ |
|
444 |
+ |
dnl Various checks if the system supports mmap() and the like functions. |
445 |
+ |
dnl ... and Mach memory allocators are not supported |
446 |
+ |
have_mmap_vm=no |
447 |
+ |
if [[ "x$ac_cv_func_mmap" = "xyes" -a "x$ac_cv_func_munmap" = "xyes" -a \ |
448 |
+ |
"x$ac_cv_func_mprotect" = "xyes" ]]; then |
449 |
+ |
if [[ "x$have_mach_vm" = "xno" ]]; then |
450 |
+ |
have_mmap_vm=yes |
451 |
+ |
fi |
452 |
+ |
fi |
453 |
+ |
AC_TRANSLATE_DEFINE(HAVE_MMAP_VM, "$have_mmap_vm") |
454 |
+ |
|
455 |
+ |
dnl Check that mmap() and associated functions work. |
456 |
+ |
if [[ "x$have_mmap_vm" = "xyes" ]]; then |
457 |
+ |
|
458 |
+ |
dnl Check if we have a working anonymous mmap() |
459 |
+ |
AC_CACHE_CHECK("whether mmap supports MAP_ANON", |
460 |
+ |
ac_cv_mmap_anon, [ |
461 |
+ |
AC_LANG_SAVE |
462 |
+ |
AC_LANG_CPLUSPLUS |
463 |
+ |
AC_TRY_RUN([ |
464 |
+ |
#define HAVE_MMAP_ANON |
465 |
+ |
#define CONFIGURE_TEST_VM_MAP |
466 |
+ |
#define TEST_VM_MMAP_ANON |
467 |
+ |
#include "vm_alloc.cpp" |
468 |
+ |
], ac_cv_mmap_anon=yes, ac_cv_mmap_anon=no, |
469 |
+ |
dnl When cross-compiling, do not assume anything. |
470 |
+ |
ac_cv_mmap_anon="guessing no" |
471 |
+ |
) |
472 |
+ |
AC_LANG_RESTORE |
473 |
+ |
] |
474 |
+ |
) |
475 |
+ |
AC_TRANSLATE_DEFINE(HAVE_MMAP_ANON, "$ac_cv_mmap_anon") |
476 |
+ |
|
477 |
+ |
AC_CACHE_CHECK("whether mmap supports MAP_ANONYMOUS", |
478 |
+ |
ac_cv_mmap_anonymous, [ |
479 |
+ |
AC_LANG_SAVE |
480 |
+ |
AC_LANG_CPLUSPLUS |
481 |
+ |
AC_TRY_RUN([ |
482 |
+ |
#define HAVE_MMAP_ANONYMOUS |
483 |
+ |
#define CONFIGURE_TEST_VM_MAP |
484 |
+ |
#define TEST_VM_MMAP_ANON |
485 |
+ |
#include "vm_alloc.cpp" |
486 |
+ |
], ac_cv_mmap_anonymous=yes, ac_cv_mmap_anonymous=no, |
487 |
+ |
dnl When cross-compiling, do not assume anything. |
488 |
+ |
ac_cv_mmap_anonymous="guessing no" |
489 |
+ |
) |
490 |
+ |
AC_LANG_RESTORE |
491 |
+ |
] |
492 |
+ |
) |
493 |
+ |
AC_TRANSLATE_DEFINE(HAVE_MMAP_ANONYMOUS, "$ac_cv_mmap_anonymous") |
494 |
+ |
|
495 |
+ |
AC_CACHE_CHECK("whether mprotect works", |
496 |
+ |
ac_cv_mprotect_works, [ |
497 |
+ |
AC_LANG_SAVE |
498 |
+ |
AC_LANG_CPLUSPLUS |
499 |
+ |
ac_cv_mprotect_works=yes |
500 |
+ |
dnl First the tests that should segfault |
501 |
+ |
for test_def in NONE_READ NONE_WRITE READ_WRITE; do |
502 |
+ |
AC_TRY_RUN([ |
503 |
+ |
#define CONFIGURE_TEST_VM_MAP |
504 |
+ |
#define TEST_VM_PROT_$test_def |
505 |
+ |
#include "vm_alloc.cpp" |
506 |
+ |
], ac_cv_mprotect_works=no, rm -f core, |
507 |
+ |
dnl When cross-compiling, do not assume anything |
508 |
+ |
ac_cv_mprotect_works="guessing no" |
509 |
+ |
) |
510 |
+ |
done |
511 |
+ |
AC_TRY_RUN([ |
512 |
+ |
#define CONFIGURE_TEST_VM_MAP |
513 |
+ |
#define TEST_VM_PROT_RDWR_WRITE |
514 |
+ |
#include "vm_alloc.cpp" |
515 |
+ |
], , ac_cv_mprotect_works=no, |
516 |
+ |
dnl When cross-compiling, do not assume anything |
517 |
+ |
ac_cv_mprotect_works="guessing no" |
518 |
+ |
) |
519 |
+ |
AC_LANG_RESTORE |
520 |
+ |
] |
521 |
+ |
) |
522 |
+ |
|
523 |
+ |
dnl Remove support for mmap() if mprotect() does not work |
524 |
+ |
if [[ "x$have_mmap_vm" = "xyes" ]]; then |
525 |
+ |
case $ac_cv_mprotect_works in |
526 |
+ |
*yes) have_mmap_vm=yes;; |
527 |
+ |
*no) have_mmap_vm=no;; |
528 |
+ |
esac |
529 |
+ |
fi |
530 |
+ |
AC_TRANSLATE_DEFINE(HAVE_MMAP_VM, $have_mmap_vm) |
531 |
+ |
|
532 |
+ |
fi dnl HAVE_MMAP_VM |
533 |
+ |
|
534 |
|
dnl Check if we can mmap 0x2000 bytes from 0x0000 |
535 |
|
AC_CACHE_CHECK("whether we can map Low Memory area 0x0000-0x2000", |
536 |
|
ac_cv_can_map_lm, [ |
537 |
|
AC_LANG_SAVE |
538 |
|
AC_LANG_CPLUSPLUS |
539 |
|
AC_TRY_RUN([ |
540 |
< |
#include <unistd.h> |
541 |
< |
#include <fcntl.h> |
542 |
< |
#include <sys/mman.h> |
543 |
< |
|
544 |
< |
int main() |
545 |
< |
{ int zero_fd; char * lm; |
546 |
< |
if ((zero_fd = open("/dev/zero", O_RDWR)) < 0) exit(1); |
547 |
< |
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); |
540 |
> |
#include "vm_alloc.cpp" |
541 |
> |
int main(void) { /* returns 0 if we could map the lowmem globals */ |
542 |
> |
volatile char * lm; |
543 |
> |
if (vm_init() < 0) exit(1); |
544 |
> |
if ((lm = (volatile char *)vm_acquire_fixed(0, 0x2000)) == VM_MAP_FAILED) exit(1); |
545 |
> |
lm[0] = 'z'; |
546 |
> |
if (vm_release((char *)lm, 0x2000) < 0) exit(1); |
547 |
> |
vm_exit(); exit(0); |
548 |
|
} |
549 |
< |
], |
550 |
< |
[ac_cv_can_map_lm=yes], |
551 |
< |
[ac_cv_can_map_lm=no] |
549 |
> |
], ac_cv_can_map_lm=yes, ac_cv_can_map_lm=no, |
550 |
> |
dnl When cross-compiling, do not assume anything. |
551 |
> |
ac_cv_can_map_lm="guessing no" |
552 |
|
) |
553 |
|
AC_LANG_RESTORE |
554 |
|
] |
555 |
|
) |
556 |
|
|
557 |
< |
dnl Check if extended signals are supported. |
558 |
< |
AC_CACHE_CHECK("whether your system supports extended signal handlers", |
559 |
< |
ac_cv_have_extended_signals, [ |
557 |
> |
dnl Check signal handlers need to be reinstalled |
558 |
> |
AC_CACHE_CHECK("whether signal handlers need to be reinstalled", |
559 |
> |
ac_cv_signal_need_reinstall, [ |
560 |
|
AC_LANG_SAVE |
561 |
|
AC_LANG_CPLUSPLUS |
562 |
|
AC_TRY_RUN([ |
563 |
+ |
#include <stdlib.h> |
564 |
+ |
#ifdef HAVE_UNISTD_H |
565 |
|
#include <unistd.h> |
566 |
+ |
#endif |
567 |
|
#include <signal.h> |
568 |
< |
#include <fcntl.h> |
569 |
< |
#include <sys/mman.h> |
570 |
< |
|
571 |
< |
static volatile caddr_t mem = 0; |
572 |
< |
static int zero_fd = -1; |
568 |
> |
static int handled_signal = 0; |
569 |
> |
RETSIGTYPE sigusr1_handler(int) { handled_signal++; } |
570 |
> |
int main(void) { /* returns 0 if signals need not to be reinstalled */ |
571 |
> |
signal(SIGUSR1, sigusr1_handler); raise(SIGUSR1); raise(SIGUSR1); |
572 |
> |
exit(handled_signal == 2); |
573 |
> |
} |
574 |
> |
], ac_cv_signal_need_reinstall=yes, ac_cv_signal_need_reinstall=no, |
575 |
> |
dnl When cross-compiling, do not assume anything. |
576 |
> |
ac_cv_signal_need_reinstall="guessing yes" |
577 |
> |
) |
578 |
> |
AC_LANG_RESTORE |
579 |
> |
] |
580 |
> |
) |
581 |
> |
AC_TRANSLATE_DEFINE(SIGNAL_NEED_REINSTALL, "$ac_cv_signal_need_reinstall") |
582 |
|
|
583 |
< |
static RETSIGTYPE segfault_handler(int, siginfo_t * sip, void *) |
584 |
< |
{ if ((caddr_t)(sip->si_addr) != mem) exit(1); |
585 |
< |
munmap(mem, getpagesize()); close(zero_fd); exit(0); } |
586 |
< |
|
587 |
< |
int main() |
588 |
< |
{ if ((zero_fd = open("/dev/zero", O_RDWR)) < 0) exit(1); |
589 |
< |
if ((mem = (caddr_t)mmap(0, getpagesize(), PROT_READ, MAP_PRIVATE, zero_fd, 0)) == (caddr_t)MAP_FAILED) exit(1); |
590 |
< |
struct sigaction sa; sa.sa_sigaction = segfault_handler; sa.sa_flags = 0; |
591 |
< |
sigaction(SIGSEGV, &sa, 0); |
592 |
< |
mem[0] = 0; |
593 |
< |
exit(1); // should not be reached |
583 |
> |
dnl Check if sigaction handlers need to be reinstalled |
584 |
> |
AC_CACHE_CHECK("whether sigaction handlers need to be reinstalled", |
585 |
> |
ac_cv_sigaction_need_reinstall, [ |
586 |
> |
AC_LANG_SAVE |
587 |
> |
AC_LANG_CPLUSPLUS |
588 |
> |
AC_TRY_RUN([ |
589 |
> |
#include <stdlib.h> |
590 |
> |
#ifdef HAVE_UNISTD_H |
591 |
> |
#include <unistd.h> |
592 |
> |
#endif |
593 |
> |
#include <signal.h> |
594 |
> |
static int handled_signal = 0; |
595 |
> |
RETSIGTYPE sigusr1_handler(int) { handled_signal++; } |
596 |
> |
typedef RETSIGTYPE (*signal_handler)(int); |
597 |
> |
static signal_handler mysignal(int sig, signal_handler handler) { |
598 |
> |
struct sigaction old_sa; |
599 |
> |
struct sigaction new_sa; |
600 |
> |
new_sa.sa_handler = handler; |
601 |
> |
return ((sigaction(sig,&new_sa,&old_sa) < 0) ? SIG_IGN : old_sa.sa_handler); |
602 |
> |
} |
603 |
> |
int main(void) { /* returns 0 if signals need not to be reinstalled */ |
604 |
> |
mysignal(SIGUSR1, sigusr1_handler); raise(SIGUSR1); raise(SIGUSR1); |
605 |
> |
exit(handled_signal == 2); |
606 |
|
} |
607 |
< |
], |
608 |
< |
[ac_cv_have_extended_signals=yes], |
609 |
< |
[ac_cv_have_extended_signals=no] |
607 |
> |
], ac_cv_sigaction_need_reinstall=yes, ac_cv_sigaction_need_reinstall=no, |
608 |
> |
dnl When cross-compiling, do not assume anything. |
609 |
> |
ac_cv_sigaction_need_reinstall="guessing yes" |
610 |
> |
) |
611 |
> |
AC_LANG_RESTORE |
612 |
> |
] |
613 |
> |
) |
614 |
> |
AC_TRANSLATE_DEFINE(SIGACTION_NEED_REINSTALL, "$ac_cv_sigaction_need_reinstall") |
615 |
> |
|
616 |
> |
dnl Check if extended signals are supported. |
617 |
> |
AC_CACHE_CHECK("whether your system supports extended signal handlers", |
618 |
> |
ac_cv_have_extended_signals, [ |
619 |
> |
AC_LANG_SAVE |
620 |
> |
AC_LANG_CPLUSPLUS |
621 |
> |
AC_TRY_RUN([ |
622 |
> |
#define HAVE_SIGINFO_T 1 |
623 |
> |
#define CONFIGURE_TEST_SIGSEGV_RECOVERY |
624 |
> |
#include "vm_alloc.cpp" |
625 |
> |
#include "sigsegv.cpp" |
626 |
> |
], ac_cv_have_extended_signals=yes, ac_cv_have_extended_signals=no, |
627 |
> |
dnl When cross-compiling, do not assume anything. |
628 |
> |
ac_cv_have_extended_signals=no |
629 |
|
) |
630 |
|
AC_LANG_RESTORE |
631 |
|
] |
632 |
|
) |
633 |
|
AC_TRANSLATE_DEFINE(HAVE_SIGINFO_T, "$ac_cv_have_extended_signals") |
634 |
< |
|
634 |
> |
|
635 |
|
dnl Otherwise, check for subterfuges. |
636 |
|
if [[ "x$ac_cv_have_extended_signals" = "xno" ]]; then |
637 |
< |
case "$target_os" in |
638 |
< |
linux*) |
639 |
< |
if [[ "x$HAVE_I386" = "xyes" ]]; then |
640 |
< |
AC_CACHE_CHECK("whether we then have a subterfuge for your system", |
641 |
< |
ac_cv_have_sigcontext_hack, [ |
642 |
< |
AC_LANG_SAVE |
643 |
< |
AC_LANG_CPLUSPLUS |
644 |
< |
AC_TRY_RUN([ |
645 |
< |
#include <unistd.h> |
646 |
< |
#include <signal.h> |
647 |
< |
#include <fcntl.h> |
648 |
< |
#include <sys/mman.h> |
649 |
< |
|
650 |
< |
static volatile caddr_t mem = 0; |
651 |
< |
static int zero_fd = -1; |
652 |
< |
|
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 |
637 |
> |
AC_CACHE_CHECK("whether we then have a subterfuge for your system", |
638 |
> |
ac_cv_have_sigcontext_hack, [ |
639 |
> |
AC_LANG_SAVE |
640 |
> |
AC_LANG_CPLUSPLUS |
641 |
> |
AC_TRY_RUN([ |
642 |
> |
#define HAVE_SIGCONTEXT_SUBTERFUGE 1 |
643 |
> |
#define CONFIGURE_TEST_SIGSEGV_RECOVERY |
644 |
> |
#include "vm_alloc.cpp" |
645 |
> |
#include "sigsegv.cpp" |
646 |
> |
], ac_cv_have_sigcontext_hack=yes, ac_cv_have_sigcontext_hack=no, |
647 |
> |
dnl When cross-compiling, do not assume anything. |
648 |
> |
ac_cv_have_sigcontext_hack=no |
649 |
> |
) |
650 |
> |
AC_LANG_RESTORE |
651 |
> |
]) |
652 |
> |
AC_TRANSLATE_DEFINE(HAVE_SIGCONTEXT_SUBTERFUGE, "$ac_cv_have_sigcontext_hack") |
653 |
|
fi |
654 |
|
|
655 |
+ |
dnl Check if we can ignore the fault (instruction skipping in SIGSEGV handler) |
656 |
+ |
AC_CACHE_CHECK("whether we can skip instruction in SIGSEGV handler", |
657 |
+ |
ac_cv_have_skip_instruction, [ |
658 |
+ |
AC_LANG_SAVE |
659 |
+ |
AC_LANG_CPLUSPLUS |
660 |
+ |
AC_TRY_RUN([ |
661 |
+ |
#define HAVE_SIGSEGV_SKIP_INSTRUCTION 1 |
662 |
+ |
#define CONFIGURE_TEST_SIGSEGV_RECOVERY |
663 |
+ |
#include "vm_alloc.cpp" |
664 |
+ |
#include "sigsegv.cpp" |
665 |
+ |
], ac_cv_have_skip_instruction=yes, ac_cv_have_skip_instruction=no, |
666 |
+ |
dnl When cross-compiling, do not assume anything. |
667 |
+ |
ac_cv_have_skip_instruction=no |
668 |
+ |
) |
669 |
+ |
AC_LANG_RESTORE |
670 |
+ |
] |
671 |
+ |
) |
672 |
+ |
AC_TRANSLATE_DEFINE(HAVE_SIGSEGV_SKIP_INSTRUCTION, "$ac_cv_have_skip_instruction") |
673 |
+ |
|
674 |
|
dnl Can we do Video on SEGV Signals ? |
675 |
|
CAN_VOSF=no |
676 |
|
if [[ "$ac_cv_have_extended_signals" = "yes" -o "$ac_cv_have_sigcontext_hack" = "yes" ]]; then |
678 |
|
fi |
679 |
|
|
680 |
|
dnl Determine the addressing mode to use |
681 |
< |
ADDRESSING_MODE="" |
682 |
< |
AC_MSG_CHECKING([for the addressing mode to use]) |
683 |
< |
for am in $ADDRESSING_TEST_ORDER; do |
684 |
< |
case $am in |
685 |
< |
real) |
686 |
< |
dnl Requires ability to mmap Low Memory globals. |
687 |
< |
if [[ "x$ac_cv_can_map_lm" = "xno" ]]; then |
688 |
< |
continue |
689 |
< |
fi |
690 |
< |
if [[ "x$ac_cv_c_bigendian" = "xyes" ]]; then |
691 |
< |
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" |
681 |
> |
if [[ "x$WANT_NATIVE_M68K" = "xyes" ]]; then |
682 |
> |
ADDRESSING_MODE="real" |
683 |
> |
else |
684 |
> |
ADDRESSING_MODE="" |
685 |
> |
AC_MSG_CHECKING([for the addressing mode to use]) |
686 |
> |
for am in $ADDRESSING_TEST_ORDER; do |
687 |
> |
case $am in |
688 |
> |
real) |
689 |
> |
dnl Requires ability to mmap() Low Memory globals |
690 |
> |
if [[ "x$ac_cv_can_map_lm" = "xno" ]]; then |
691 |
> |
continue |
692 |
|
fi |
693 |
< |
else |
418 |
< |
dnl Requires VOSF |
693 |
> |
dnl Requires VOSF screen updates |
694 |
|
if [[ "x$CAN_VOSF" = "xno" ]]; then |
695 |
|
continue |
696 |
|
fi |
697 |
< |
fi |
698 |
< |
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" |
697 |
> |
dnl Real addressing will probably work. |
698 |
> |
ADDRESSING_MODE="real" |
699 |
|
WANT_VOSF=yes dnl we can use VOSF and we need it actually |
700 |
< |
DEFINES="$DEFINES -DDIRECT_ADDRESSING" |
700 |
> |
DEFINES="$DEFINES -DREAL_ADDRESSING" |
701 |
|
break |
702 |
< |
fi |
703 |
< |
;; |
704 |
< |
banks) |
705 |
< |
dnl Default addressing mode |
702 |
> |
;; |
703 |
> |
direct) |
704 |
> |
dnl Requires VOSF screen updates |
705 |
> |
if [[ "x$CAN_VOSF" = "xyes" ]]; then |
706 |
> |
ADDRESSING_MODE="direct" |
707 |
> |
WANT_VOSF=yes dnl we can use VOSF and we need it actually |
708 |
> |
DEFINES="$DEFINES -DDIRECT_ADDRESSING" |
709 |
> |
break |
710 |
> |
fi |
711 |
> |
;; |
712 |
> |
banks) |
713 |
> |
dnl Default addressing mode |
714 |
> |
ADDRESSING_MODE="memory banks" |
715 |
> |
break |
716 |
> |
;; |
717 |
> |
*) |
718 |
> |
AC_MSG_ERROR([Internal configure.in script error for $am addressing mode]) |
719 |
> |
esac |
720 |
> |
done |
721 |
> |
AC_MSG_RESULT($ADDRESSING_MODE) |
722 |
> |
if [[ "x$ADDRESSING_MODE" = "x" ]]; then |
723 |
> |
AC_MSG_WARN([Sorry, no suitable addressing mode in $ADDRESSING_TEST_ORDER]) |
724 |
|
ADDRESSING_MODE="memory banks" |
725 |
< |
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" |
725 |
> |
fi |
726 |
|
fi |
727 |
|
|
728 |
< |
dnl Since real and direct addressing modes automatically activate VOSF, |
729 |
< |
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 |
728 |
> |
dnl Enable VOSF screen updates with this feature is requested and feasible |
729 |
> |
if [[ "x$WANT_VOSF" = "xyes" -a "x$CAN_VOSF" = "xyes" ]]; then |
730 |
|
AC_DEFINE(ENABLE_VOSF) |
731 |
< |
fi |
731 |
> |
else |
732 |
> |
WANT_VOSF=no |
733 |
|
fi |
734 |
|
|
735 |
|
dnl Check for GAS. |
751 |
|
#endif |
752 |
|
], [AC_MSG_RESULT(yes); HAVE_GCC27=yes], AC_MSG_RESULT(no)) |
753 |
|
|
754 |
+ |
dnl Check for GCC 3.0 or higher. |
755 |
+ |
HAVE_GCC30=no |
756 |
+ |
AC_MSG_CHECKING(for GCC 3.0 or higher) |
757 |
+ |
AC_EGREP_CPP(yes, |
758 |
+ |
[#if __GNUC__ >= 3 |
759 |
+ |
yes |
760 |
+ |
#endif |
761 |
+ |
], [AC_MSG_RESULT(yes); HAVE_GCC30=yes], AC_MSG_RESULT(no)) |
762 |
+ |
|
763 |
|
dnl Set "-fomit-frame-pointer" on i386 GCC 2.7 or higher. |
764 |
+ |
dnl Also set "-fno-exceptions" for C++ because exception handling requires |
765 |
+ |
dnl the frame pointer. |
766 |
|
if [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_I386" = "xyes" ]]; then |
767 |
|
CFLAGS="$CFLAGS -fomit-frame-pointer" |
768 |
< |
CXXFLAGS="$CXXFLAGS -fomit-frame-pointer" |
768 |
> |
CXXFLAGS="$CXXFLAGS -fomit-frame-pointer -fno-exceptions" |
769 |
> |
fi |
770 |
> |
|
771 |
> |
dnl (gb) Do not merge constants since it breaks fpu/fpu_x86.cpp. |
772 |
> |
dnl As of 2001/08/02, this affects the following compilers: |
773 |
> |
dnl Official: probably gcc-3.1 (mainline CVS) |
774 |
> |
dnl Mandrake: gcc-2.96 >= 0.59mdk, gcc-3.0.1 >= 0.1mdk |
775 |
> |
dnl Red Hat : gcc-2.96 >= 89, gcc-3.0 >= 1 |
776 |
> |
if [[ "x$HAVE_GCC27" = "xyes" ]]; then |
777 |
> |
SAVED_CXXFLAGS="$CXXFLAGS" |
778 |
> |
CXXFLAGS="$CXXFLAGS -fno-merge-constants" |
779 |
> |
AC_CACHE_CHECK([whether GCC supports constants merging], ac_cv_gcc_constants_merging, [ |
780 |
> |
AC_LANG_SAVE |
781 |
> |
AC_LANG_CPLUSPLUS |
782 |
> |
AC_TRY_COMPILE([],[],[ac_cv_gcc_constants_merging=yes],[ac_cv_gcc_constants_merging=no]) |
783 |
> |
AC_LANG_RESTORE |
784 |
> |
]) |
785 |
> |
if [[ "x$ac_cv_gcc_constants_merging" != "xyes" ]]; then |
786 |
> |
CXXFLAGS="$SAVED_CXXFLAGS" |
787 |
> |
fi |
788 |
|
fi |
789 |
|
|
790 |
|
dnl Select appropriate CPU source and REGPARAM define. |
791 |
|
ASM_OPTIMIZATIONS=none |
491 |
– |
WANT_NATIVE_M68K=no |
792 |
|
CPUSRCS="cpuemu1.cpp cpuemu2.cpp cpuemu3.cpp cpuemu4.cpp cpuemu5.cpp cpuemu6.cpp cpuemu7.cpp cpuemu8.cpp" |
793 |
< |
FPUSRCS="../uae_cpu/fpp.cpp" |
794 |
< |
if [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_I386" = "xyes" ]]; then |
793 |
> |
FPUSRCS="../uae_cpu/fpu/fpu_uae.cpp" |
794 |
> |
if [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_I386" = "xyes" -a "x$OS_TYPE" != "xfreebsd" ]]; then |
795 |
|
dnl i386 CPU |
796 |
|
DEFINES="$DEFINES -DREGPARAM=\"__attribute__((regparm(3)))\"" |
797 |
|
if [[ "x$HAVE_GAS" = "xyes" ]]; then |
798 |
|
ASM_OPTIMIZATIONS=i386 |
799 |
< |
DEFINES="$DEFINES -DX86_ASSEMBLY -DOPTFLAGS" |
800 |
< |
CPUSRCS="../uae_cpu/compiler.cpp cpufast1.s cpufast2.s cpufast3.s cpufast4.s cpufast5.s cpufast6.s cpufast7.s cpufast8.s" |
799 |
> |
DEFINES="$DEFINES -DX86_ASSEMBLY -DUNALIGNED_PROFITABLE -DOPTIMIZED_FLAGS" |
800 |
> |
CPUSRCS="cpufast1.s cpufast2.s cpufast3.s cpufast4.s cpufast5.s cpufast6.s cpufast7.s cpufast8.s" |
801 |
|
FPUSRCS="../uae_cpu/fpu_x86.cpp" |
802 |
|
fi |
803 |
|
elif [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_SPARC" = "xyes" -a "x$HAVE_GAS" = "xyes" ]]; then |
809 |
|
AC_MSG_RESULT($SPARC_TYPE) |
810 |
|
case "$SPARC_TYPE" in |
811 |
|
SPARC_V8) |
812 |
< |
ASM_OPTIMIZATIONS="SPARC V8 architecture" |
813 |
< |
DEFINES="$DEFINES -DSPARC_V8_ASSEMBLY" dnl -DOPTFLAGS" |
812 |
> |
ASM_OPTIMIZATIONS="SPARC V8 architecture" |
813 |
> |
DEFINES="$DEFINES -DSPARC_V8_ASSEMBLY" dnl -DOPTIMIZED_FLAGS" |
814 |
|
CFLAGS="$CFLAGS -Wa,-Av8" |
815 |
|
CXXFLAGS="$CXXFLAGS -Wa,-Av8" |
816 |
|
;; |
817 |
|
SPARC_V9) |
818 |
< |
ASM_OPTIMIZATIONS="SPARC V9 architecture" |
819 |
< |
DEFINES="$DEFINES -DSPARC_V9_ASSEMBLY" dnl -DOPTFLAGS" |
818 |
> |
ASM_OPTIMIZATIONS="SPARC V9 architecture" |
819 |
> |
DEFINES="$DEFINES -DSPARC_V9_ASSEMBLY" dnl -DOPTIMIZED_FLAGS" |
820 |
|
CFLAGS="$CFLAGS -Wa,-Av9" |
821 |
|
CXXFLAGS="$CXXFLAGS -Wa,-Av9" |
822 |
|
;; |
823 |
|
esac |
824 |
|
;; |
825 |
|
esac |
826 |
< |
elif [[ "x$HAVE_M68K" = "xyes" -a "x$SUPPORTS_NATIVE_M68K" = "xyes" ]]; then |
826 |
> |
elif [[ "x$WANT_NATIVE_M68K" = "xyes" ]]; then |
827 |
|
dnl Native m68k, no emulation |
828 |
< |
CPUSRCS="" |
829 |
< |
AC_DEFINE(ENABLE_NATIVE_M68K) |
530 |
< |
WANT_NATIVE_M68K=yes |
828 |
> |
CPUINCLUDES="-I../native_cpu" |
829 |
> |
CPUSRCS="asm_support.s" |
830 |
|
fi |
831 |
|
|
832 |
+ |
dnl Select appropriate FPU source. |
833 |
+ |
dnl 1. Optimized X86 assembly core if target is i386 architecture |
834 |
+ |
SAVED_DEFINES=$DEFINES |
835 |
+ |
if [[ "x$FPE_CORE" = "xdefault" ]]; then |
836 |
+ |
if [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_I386" = "xyes" -a "x$HAVE_GAS" = "xyes" ]]; then |
837 |
+ |
DEFINES="$DEFINES -DFPU_X86" |
838 |
+ |
FPE_CORE_STR="i386 optimized core" |
839 |
+ |
FPUSRCS="../uae_cpu/fpu/fpu_x86.cpp" |
840 |
+ |
FPE_CORE="i386" |
841 |
+ |
else |
842 |
+ |
FPE_CORE="uae" |
843 |
+ |
fi |
844 |
+ |
fi |
845 |
+ |
|
846 |
+ |
dnl 2. JIT-FPU only supports IEEE-based implementation. |
847 |
+ |
if [[ "x$WANT_JIT_FPU" = "xyes" -a "x$FPE_CORE" != "xieee" ]]; then |
848 |
+ |
AC_MSG_WARN([Sorry, JIT-FPU supports only the "ieee" FPE implementation]) |
849 |
+ |
FPE_CORE="ieee" |
850 |
+ |
dnl Restore previous variables. FPE_CORE_STR and FPUSRCS are overwritten |
851 |
+ |
DEFINES=$SAVED_DEFINES |
852 |
+ |
fi |
853 |
+ |
|
854 |
+ |
dnl 3. Choose either IEEE-based implementation or the old UAE core |
855 |
+ |
if [[ "x$FPE_CORE" = "xieee" ]]; then |
856 |
+ |
AC_CHECK_HEADERS(fenv.h) |
857 |
+ |
AC_CHECK_FUNCS(feclearexcept fegetexceptflag feraiseexcept fesetexceptflag fetestexcept) |
858 |
+ |
AC_CHECK_FUNCS(fegetround fesetround) |
859 |
+ |
DEFINES="$DEFINES -DFPU_IEEE" |
860 |
+ |
FPE_CORE_STR="ieee-based fpu core" |
861 |
+ |
FPUSRCS="../uae_cpu/fpu/fpu_ieee.cpp" |
862 |
+ |
elif [[ "x$FPE_CORE" = "xuae" ]]; then |
863 |
+ |
DEFINES="$DEFINES -DFPU_UAE" |
864 |
+ |
FPE_CORE_STR="original uae core" |
865 |
+ |
FPUSRCS="../uae_cpu/fpu/fpu_uae.cpp" |
866 |
+ |
fi |
867 |
+ |
|
868 |
+ |
dnl Check for certain math functions |
869 |
+ |
AC_CHECK_FUNCS(atanh) |
870 |
+ |
AC_CHECK_FUNCS(isnan isinf) dnl C99 |
871 |
+ |
AC_CHECK_FUNCS(isnanl isinfl) dnl IEEE ? |
872 |
+ |
|
873 |
|
dnl UAE CPU sources for all non-m68k-native architectures. |
874 |
|
if [[ "x$WANT_NATIVE_M68K" = "xno" ]]; then |
875 |
|
CPUINCLUDES="-I../uae_cpu" |
876 |
|
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" |
877 |
|
fi |
878 |
|
|
879 |
|
dnl Remove the "-g" option if set for GCC. |
880 |
|
if [[ "x$HAVE_GCC27" = "xyes" ]]; then |
881 |
< |
dnl gb-- Probably not the cleanest way to take |
882 |
< |
CFLAGS=`echo $CFLAGS | sed -e 's/ -g / /;s/^-g / /;s/ -g$/ /;s/^-g$//'` |
883 |
< |
CXXFLAGS=`echo $CXXFLAGS | sed -e 's/ -g / /;s/^-g / /;s/ -g$/ /;s/^-g$//'` |
881 |
> |
CFLAGS=`echo $CFLAGS | sed -e 's/-g//g'` |
882 |
> |
CXXFLAGS=`echo $CXXFLAGS | sed -e 's/-g//g'` |
883 |
> |
fi |
884 |
> |
|
885 |
> |
dnl Or if we have -Ofast |
886 |
> |
if [[ "x$HAVE_OFAST" = "xyes" ]]; then |
887 |
> |
CFLAGS="`echo $CFLAGS | sed -e 's/-g//g'` -Ofast" |
888 |
> |
CXXFLAGS="`echo $CXXFLAGS | sed -e 's/-g//g'` -Ofast" |
889 |
> |
CXXFLAGS="-LANG:std $CXXFLAGS" |
890 |
> |
LDFLAGS="$LDFLAGS -ipa" |
891 |
|
fi |
892 |
|
|
893 |
|
dnl Generate Makefile. |
909 |
|
echo GTK user interface ............... : $WANT_GTK |
910 |
|
echo mon debugger support ............. : $WANT_MON |
911 |
|
echo Running m68k code natively ....... : $WANT_NATIVE_M68K |
912 |
+ |
echo Floating-Point emulation core .... : $FPE_CORE_STR |
913 |
|
echo Assembly optimizations ........... : $ASM_OPTIMIZATIONS |
914 |
|
echo Addressing mode .................. : $ADDRESSING_MODE |
915 |
|
echo |