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=no]], [WANT_VOSF=$enableval], [WANT_VOSF=no]) |
13 |
+ |
|
14 |
+ |
dnl Addressing modes. |
15 |
+ |
AC_ARG_ENABLE(addressing, |
16 |
+ |
[ --enable-addressing=AM specify the addressing mode to use [default=fastest]], |
17 |
+ |
[ case "$enableval" in |
18 |
+ |
real) ADDRESSING_TEST_ORDER="real";; |
19 |
+ |
direct) ADDRESSING_TEST_ORDER="direct";; |
20 |
+ |
banks) ADDRESSING_TEST_ORDER="banks";; |
21 |
+ |
fastest)ADDRESSING_TEST_ORDER="direct banks";; |
22 |
+ |
*) AC_MSG_ERROR([--enable-addressing takes only one of the following values: fastest, real, direct, banks]);; |
23 |
+ |
esac |
24 |
+ |
], |
25 |
+ |
[ ADDRESSING_TEST_ORDER="direct banks" |
26 |
+ |
]) |
27 |
+ |
|
28 |
+ |
dnl External packages. |
29 |
|
AC_ARG_WITH(esd, [ --with-esd support ESD for sound under Linux/FreeBSD [default=yes]], [WANT_ESD=$withval], [WANT_ESD=yes]) |
30 |
|
AC_ARG_WITH(gtk, [ --with-gtk use GTK user interface [default=yes]], [WANT_GTK=$withval], [WANT_GTK=yes]) |
31 |
|
AC_ARG_WITH(mon, [ --with-mon use mon as debugger [default=yes]], [WANT_MON=$withval], [WANT_MON=yes]) |
32 |
|
|
33 |
+ |
dnl Canonical system information. |
34 |
+ |
AC_CANONICAL_HOST |
35 |
+ |
AC_CANONICAL_TARGET |
36 |
+ |
|
37 |
+ |
dnl Target OS type (target is host if not cross-compiling). |
38 |
+ |
case "$target_os" in |
39 |
+ |
linux*) OS_TYPE=linux;; |
40 |
+ |
netbsd*) OS_TYPE=netbsd;; |
41 |
+ |
freebsd*) OS_TYPE=freebsd;; |
42 |
+ |
solaris*) OS_TYPE=solaris;; |
43 |
+ |
*) OS_TYPE=`echo $target_os | sed -e 's/-/_/' | sed -e 's/\./_/'`;; |
44 |
+ |
esac |
45 |
+ |
DEFINES="$DEFINES -DOS_$OS_TYPE" |
46 |
+ |
|
47 |
+ |
dnl Target CPU type. |
48 |
+ |
HAVE_I386=no |
49 |
+ |
HAVE_M68K=no |
50 |
+ |
HAVE_SPARC=no |
51 |
+ |
HAVE_POWERPC=no |
52 |
+ |
case "$target_cpu" in |
53 |
+ |
i386* | i486* | i586* | i686* | i786* ) CPU_TYPE=i386 HAVE_I386=yes;; |
54 |
+ |
m68k* ) CPU_TYPE=m68k HAVE_M68K=yes;; |
55 |
+ |
sparc* ) CPU_TYPE=sparc HAVE_SPARC=yes;; |
56 |
+ |
powerpc* ) CPU_TYPE=powerpc HAVE_POWERPC=yes;; |
57 |
+ |
*) CPU_TYPE=`echo $target_cpu | sed -e 's/-/_/'`;; |
58 |
+ |
esac |
59 |
+ |
DEFINES="$DEFINES -DCPU_$CPU_TYPE" |
60 |
+ |
|
61 |
|
dnl Checks for programs. |
62 |
|
AC_PROG_CC |
63 |
+ |
AC_PROG_CC_C_O |
64 |
|
AC_PROG_CPP |
65 |
|
AC_PROG_CXX |
66 |
|
AC_PROG_MAKE_SET |
67 |
|
AC_PROG_INSTALL |
68 |
|
|
23 |
– |
dnl Check for i386 target CPU. |
24 |
– |
HAVE_I386=no |
25 |
– |
AC_MSG_CHECKING(for x86 target CPU) |
26 |
– |
AC_EGREP_CPP(yes, |
27 |
– |
[ |
28 |
– |
#ifdef __i386__ |
29 |
– |
yes |
30 |
– |
#endif |
31 |
– |
], [AC_MSG_RESULT(yes); HAVE_I386=yes], AC_MSG_RESULT(no)) |
32 |
– |
|
33 |
– |
dnl Check for SPARC target CPU. |
34 |
– |
HAVE_SPARC=no |
35 |
– |
AC_MSG_CHECKING(for SPARC target CPU) |
36 |
– |
AC_EGREP_CPP(yes, |
37 |
– |
[ |
38 |
– |
#ifdef __sparc__ |
39 |
– |
yes |
40 |
– |
#endif |
41 |
– |
], [AC_MSG_RESULT(yes); HAVE_SPARC=yes], AC_MSG_RESULT(no)) |
42 |
– |
|
43 |
– |
dnl Check for m68k target CPU. |
44 |
– |
HAVE_M68K=no |
45 |
– |
AC_MSG_CHECKING(for m68k target CPU) |
46 |
– |
AC_EGREP_CPP(yes, |
47 |
– |
[ |
48 |
– |
#ifdef __m68k__ |
49 |
– |
yes |
50 |
– |
#endif |
51 |
– |
], [AC_MSG_RESULT(yes); HAVE_M68K=yes], AC_MSG_RESULT(no)) |
52 |
– |
|
69 |
|
dnl We use mon if possible. |
70 |
|
MONSRCS= |
71 |
|
if [[ "x$WANT_MON" = "xyes" ]]; then |
72 |
|
AC_MSG_CHECKING(for mon) |
73 |
< |
if grep mon_init ../../../mon/src/mon.h >/dev/null 2>/dev/null; then |
73 |
> |
mon_srcdir=../../../mon/src |
74 |
> |
if grep mon_init $mon_srcdir/mon.h >/dev/null 2>/dev/null; then |
75 |
|
AC_MSG_RESULT(yes) |
76 |
|
AC_DEFINE(ENABLE_MON) |
77 |
< |
MONSRCS="../../../mon/src/mon.cpp ../../../mon/src/mon_6502.cpp ../../../mon/src/mon_68k.cpp ../../../mon/src/mon_8080.cpp ../../../mon/src/mon_cmd.cpp ../../../mon/src/mon_ppc.cpp ../../../mon/src/mon_x86.cpp" |
78 |
< |
CXXFLAGS="$CXXFLAGS -I../../../mon/src" |
77 |
> |
MONSRCS="$mon_srcdir/mon.cpp $mon_srcdir/mon_6502.cpp $mon_srcdir/mon_z80.cpp $mon_srcdir/mon_cmd.cpp $mon_srcdir/mon_disass.cpp $mon_srcdir/mon_ppc.cpp $mon_srcdir/disass/floatformat.c $mon_srcdir/disass/i386-dis.c $mon_srcdir/disass/m68k-dis.c $mon_srcdir/disass/m68k-opc.c" |
78 |
> |
CXXFLAGS="$CXXFLAGS -I$mon_srcdir -I$mon_srcdir/disass" |
79 |
|
AC_CHECK_LIB(readline, readline) |
80 |
|
AC_CHECK_LIB(termcap, tputs) |
81 |
|
AC_CHECK_HEADERS(readline.h history.h readline/readline.h readline/history.h) |
115 |
|
dnl If POSIX.4 semaphores are not available, we emulate them with pthread mutexes. |
116 |
|
SEMSRC= |
117 |
|
AC_CHECK_FUNCS(sem_init, , [ |
118 |
< |
if [ "x$HAVE_PTHREADS" = "xyes" ]; then |
118 |
> |
if test "x$HAVE_PTHREADS" = "xyes"; then |
119 |
|
SEMSRC=posix_sem.cpp |
120 |
|
fi |
121 |
|
]) |
189 |
|
AC_CHECK_SIZEOF(int, 4) |
190 |
|
AC_CHECK_SIZEOF(long, 4) |
191 |
|
AC_CHECK_SIZEOF(long long, 8) |
192 |
+ |
AC_CHECK_SIZEOF(void *, 4) |
193 |
|
AC_TYPE_OFF_T |
194 |
|
AC_CHECK_TYPE(loff_t, off_t) |
195 |
|
AC_TYPE_SIZE_T |
196 |
+ |
AC_TYPE_SIGNAL |
197 |
|
AC_HEADER_TIME |
198 |
|
AC_STRUCT_TM |
199 |
|
|
200 |
|
dnl Checks for library functions. |
201 |
|
AC_CHECK_FUNCS(strdup cfmakeraw) |
202 |
< |
AC_CHECK_FUNCS(nanosleep clock_gettime timer_create) |
202 |
> |
AC_CHECK_FUNCS(clock_gettime timer_create) |
203 |
|
|
204 |
|
dnl Select system-dependant source files. |
205 |
|
SERIALSRC=serial_unix.cpp |
207 |
|
SCSISRC=../dummy/scsi_dummy.cpp |
208 |
|
AUDIOSRC=../dummy/audio_dummy.cpp |
209 |
|
EXTRASYSSRCS= |
210 |
< |
SUPPORTS_NATIVE_M68K=no |
211 |
< |
if MACHINE=`uname -s 2>/dev/null`; then |
212 |
< |
case "$MACHINE" in |
213 |
< |
Linux*) |
214 |
< |
ETHERSRC=Linux/ether_linux.cpp |
215 |
< |
SCSISRC=Linux/scsi_linux.cpp |
216 |
< |
AUDIOSRC=audio_oss_esd.cpp |
217 |
< |
;; |
218 |
< |
FreeBSD*3.*) |
219 |
< |
AUDIOSRC=audio_oss_esd.cpp |
220 |
< |
DEFINES="$DEFINES -DBSD_COMP" |
221 |
< |
dnl Check for the CAM library |
222 |
< |
AC_CHECK_LIB(cam, cam_open_btl, HAVE_LIBCAM=yes, HAVE_LIBCAM=no) |
223 |
< |
if [[ "x$HAVE_LIBCAM" = "xno" ]]; then |
224 |
< |
AC_MSG_WARN([Cannot find libcam for SCSI management, disabling SCSI support.]) |
210 |
> |
CAN_NATIVE_M68K=no |
211 |
> |
case "$target_os" in |
212 |
> |
linux*) |
213 |
> |
ETHERSRC=Linux/ether_linux.cpp |
214 |
> |
SCSISRC=Linux/scsi_linux.cpp |
215 |
> |
AUDIOSRC=audio_oss_esd.cpp |
216 |
> |
;; |
217 |
> |
freebsd*3.*) |
218 |
> |
AUDIOSRC=audio_oss_esd.cpp |
219 |
> |
DEFINES="$DEFINES -DBSD_COMP" |
220 |
> |
dnl Check for the CAM library |
221 |
> |
AC_CHECK_LIB(cam, cam_open_btl, HAVE_LIBCAM=yes, HAVE_LIBCAM=no) |
222 |
> |
if [[ "x$HAVE_LIBCAM" = "xno" ]]; then |
223 |
> |
AC_MSG_WARN([Cannot find libcam for SCSI management, disabling SCSI support.]) |
224 |
> |
else |
225 |
> |
dnl Check for the sys kernel includes |
226 |
> |
AC_CHECK_HEADER(/sys/cam/cam.h) |
227 |
> |
if [[ "x$ac_cv_header__sys_cam_cam_h" = "xno" ]]; then |
228 |
> |
dnl In this case I should fix this thing including a "patch" |
229 |
> |
dnl to access directly to the functions in the kernel :) --Orlando |
230 |
> |
AC_MSG_WARN([Cannot find kernel includes for CAM library, disabling SCSI support.]) |
231 |
|
else |
232 |
< |
dnl Check for the sys kernel includes |
233 |
< |
AC_CHECK_HEADER(/sys/cam/cam.h) |
234 |
< |
if [[ "x$ac_cv_header__sys_cam_cam_h" = "xno" ]]; then |
235 |
< |
dnl In this case I should fix this thing including a "patch" |
236 |
< |
dnl to access directly to the functions in the kernel :) --Orlando |
212 |
< |
AC_MSG_WARN([Cannot find kernel includes for CAM library, disabling SCSI support.]) |
213 |
< |
else |
214 |
< |
SCSISRC=FreeBSD/scsi_freebsd.cpp |
215 |
< |
CXXFLAGS="$CXXFLAGS -I/sys" |
216 |
< |
CFLAGS="$CFLAGS -I/sys" |
217 |
< |
LIBS="$LIBS -lcam" |
218 |
< |
DEFINES="$DEFINES -DCAM" |
219 |
< |
fi |
232 |
> |
SCSISRC=FreeBSD/scsi_freebsd.cpp |
233 |
> |
CXXFLAGS="$CXXFLAGS -I/sys" |
234 |
> |
CFLAGS="$CFLAGS -I/sys" |
235 |
> |
LIBS="$LIBS -lcam" |
236 |
> |
DEFINES="$DEFINES -DCAM" |
237 |
|
fi |
238 |
< |
;; |
239 |
< |
FreeBSD*) |
240 |
< |
DEFINES="$DEFINES -DBSD_COMP" |
241 |
< |
dnl Check for the SCSI library |
242 |
< |
AC_CHECK_LIB(scsi, scsi_open, HAVE_LIBSCSI=yes, HAVE_LIBSCSI=no) |
243 |
< |
if [[ "x$HAVE_LIBSCSI" = "xno" ]]; then |
244 |
< |
AC_MSG_WARN([Cannot find libscsi for SCSI management, disabling SCSI support.]) |
238 |
> |
fi |
239 |
> |
;; |
240 |
> |
freebsd*) |
241 |
> |
DEFINES="$DEFINES -DBSD_COMP" |
242 |
> |
dnl Check for the SCSI library |
243 |
> |
AC_CHECK_LIB(scsi, scsi_open, HAVE_LIBSCSI=yes, HAVE_LIBSCSI=no) |
244 |
> |
if [[ "x$HAVE_LIBSCSI" = "xno" ]]; then |
245 |
> |
AC_MSG_WARN([Cannot find libscsi for SCSI management, disabling SCSI support.]) |
246 |
> |
else |
247 |
> |
dnl Check for the sys kernel includes |
248 |
> |
AC_CHECK_HEADER(scsi.h sys/scsiio.h) |
249 |
> |
if [[ "x$ac_cv_header_scsi_h" = "xno" ]]; then |
250 |
> |
AC_MSG_WARN([Cannot find includes for the SCSI library, disabling SCSI support.]) |
251 |
|
else |
252 |
< |
dnl Check for the sys kernel includes |
253 |
< |
AC_CHECK_HEADER(scsi.h sys/scsiio.h) |
231 |
< |
if [[ "x$ac_cv_header_scsi_h" = "xno" ]]; then |
232 |
< |
AC_MSG_WARN([Cannot find includes for the SCSI library, disabling SCSI support.]) |
233 |
< |
else |
234 |
< |
SCSISRC=FreeBSD/scsi_freebsd.cpp |
235 |
< |
LIBS="$LIBS -lscsi" |
236 |
< |
fi |
252 |
> |
SCSISRC=FreeBSD/scsi_freebsd.cpp |
253 |
> |
LIBS="$LIBS -lscsi" |
254 |
|
fi |
255 |
< |
;; |
256 |
< |
NetBSD*) |
257 |
< |
SUPPORTS_NATIVE_M68K=yes |
258 |
< |
;; |
259 |
< |
SunOS*) |
260 |
< |
AUDIOSRC=Solaris/audio_solaris.cpp |
261 |
< |
DEFINES="$DEFINES -DBSD_COMP -D_POSIX_PTHREAD_SEMANTICS" |
262 |
< |
;; |
263 |
< |
IRIX*) |
264 |
< |
EXTRASYSSRCS=Irix/unaligned.c |
265 |
< |
DEFINES="$DEFINES -DCRTSCTS=CNEW_RTSCTS -DB230400=B115200" |
266 |
< |
LIBS="$LIBS -lm" |
267 |
< |
;; |
268 |
< |
esac |
255 |
> |
fi |
256 |
> |
;; |
257 |
> |
netbsd*) |
258 |
> |
CAN_NATIVE_M68K=yes |
259 |
> |
;; |
260 |
> |
solaris*) |
261 |
> |
AUDIOSRC=Solaris/audio_solaris.cpp |
262 |
> |
DEFINES="$DEFINES -DBSD_COMP -D_POSIX_PTHREAD_SEMANTICS" |
263 |
> |
;; |
264 |
> |
irix*) |
265 |
> |
AUDIOSRC=Irix/audio_irix.cpp |
266 |
> |
EXTRASYSSRCS=Irix/unaligned.c |
267 |
> |
dnl IRIX headers work fine, but somehow don't define or use "STDC_HEADERS" |
268 |
> |
DEFINES="$DEFINES -DCRTSCTS=CNEW_RTSCTS -DB230400=B115200 -DSTDC_HEADERS" |
269 |
> |
LIBS="$LIBS -laudio" |
270 |
> |
;; |
271 |
> |
esac |
272 |
> |
|
273 |
> |
dnl Use 68k CPU natively? |
274 |
> |
WANT_NATIVE_M68K=no |
275 |
> |
if [[ "x$HAVE_M68K" = "xyes" -a "x$CAN_NATIVE_M68K" = "xyes" ]]; then |
276 |
> |
AC_DEFINE(ENABLE_NATIVE_M68K) |
277 |
> |
WANT_NATIVE_M68K=yes |
278 |
|
fi |
279 |
+ |
|
280 |
|
if [[ "x$HAVE_PTHREADS" = "xno" ]]; then |
281 |
|
dnl Serial, ethernet and audio support needs pthreads |
282 |
|
AC_MSG_WARN([You don't have pthreads, disabling serial, ethernet and audio support.]) |
286 |
|
fi |
287 |
|
SYSSRCS="$SERIALSRC $ETHERSRC $SCSISRC $AUDIOSRC $SEMSRC $UISRCS $MONSRCS $EXTRASYSSRCS" |
288 |
|
|
289 |
+ |
dnl Define a macro that translates a yesno-variable into a C macro definition |
290 |
+ |
dnl to be put into the config.h file |
291 |
+ |
dnl $1 -- the macro to define |
292 |
+ |
dnl $2 -- the value to translate |
293 |
+ |
AC_DEFUN(AC_TRANSLATE_DEFINE, [ |
294 |
+ |
if [[ "x$2" = "xyes" ]]; then |
295 |
+ |
AC_DEFINE($1) |
296 |
+ |
fi |
297 |
+ |
]) |
298 |
+ |
|
299 |
+ |
dnl Check if we can mmap 0x2000 bytes from 0x0000 |
300 |
+ |
AC_CACHE_CHECK("whether we can map Low Memory area 0x0000-0x2000", |
301 |
+ |
ac_cv_can_map_lm, [ |
302 |
+ |
AC_LANG_SAVE |
303 |
+ |
AC_LANG_CPLUSPLUS |
304 |
+ |
AC_TRY_RUN([ |
305 |
+ |
#include <unistd.h> |
306 |
+ |
#include <fcntl.h> |
307 |
+ |
#include <sys/mman.h> |
308 |
+ |
|
309 |
+ |
int main() |
310 |
+ |
{ int zero_fd; char * lm; |
311 |
+ |
if ((zero_fd = open("/dev/zero", O_RDWR)) < 0) exit(1); |
312 |
+ |
if ((lm = (char *)mmap((caddr_t)0x0000, 0x2000, PROT_READ | PROT_WRITE, MAP_FIXED | MAP_PRIVATE, zero_fd, 0)) == MAP_FAILED) exit(1); |
313 |
+ |
lm[0] = 0x12; |
314 |
+ |
munmap(lm, 0x2000); |
315 |
+ |
close(zero_fd); |
316 |
+ |
exit(0); |
317 |
+ |
} |
318 |
+ |
], |
319 |
+ |
[ac_cv_can_map_lm=yes], |
320 |
+ |
[ac_cv_can_map_lm=no] |
321 |
+ |
) |
322 |
+ |
AC_LANG_RESTORE |
323 |
+ |
] |
324 |
+ |
) |
325 |
+ |
|
326 |
+ |
dnl Check if extended signals are supported. |
327 |
+ |
AC_CACHE_CHECK("whether your system supports extended signal handlers", |
328 |
+ |
ac_cv_have_extended_signals, [ |
329 |
+ |
AC_LANG_SAVE |
330 |
+ |
AC_LANG_CPLUSPLUS |
331 |
+ |
AC_TRY_RUN([ |
332 |
+ |
#include <unistd.h> |
333 |
+ |
#include <stdlib.h> |
334 |
+ |
#include <signal.h> |
335 |
+ |
#include <fcntl.h> |
336 |
+ |
#include <sys/mman.h> |
337 |
+ |
|
338 |
+ |
static volatile caddr_t mem = 0; |
339 |
+ |
static int zero_fd = -1; |
340 |
+ |
|
341 |
+ |
static RETSIGTYPE segfault_handler(int, siginfo_t * sip, void *) |
342 |
+ |
{ if ((caddr_t)(sip->si_addr) != mem) exit(1); |
343 |
+ |
munmap(mem, getpagesize()); close(zero_fd); exit(0); } |
344 |
+ |
|
345 |
+ |
int main() |
346 |
+ |
{ if ((zero_fd = open("/dev/zero", O_RDWR)) < 0) exit(1); |
347 |
+ |
if ((mem = (caddr_t)mmap(0, getpagesize(), PROT_READ, MAP_PRIVATE, zero_fd, 0)) == (caddr_t)MAP_FAILED) exit(1); |
348 |
+ |
struct sigaction sa; sa.sa_sigaction = segfault_handler; sa.sa_flags = SA_SIGINFO; |
349 |
+ |
sigaction(SIGSEGV, &sa, 0); |
350 |
+ |
mem[0] = 0; |
351 |
+ |
exit(1); // should not be reached |
352 |
+ |
} |
353 |
+ |
], |
354 |
+ |
[ac_cv_have_extended_signals=yes], |
355 |
+ |
[ac_cv_have_extended_signals=no] |
356 |
+ |
) |
357 |
+ |
AC_LANG_RESTORE |
358 |
+ |
] |
359 |
+ |
) |
360 |
+ |
AC_TRANSLATE_DEFINE(HAVE_SIGINFO_T, "$ac_cv_have_extended_signals") |
361 |
+ |
|
362 |
+ |
dnl Otherwise, check for subterfuges. |
363 |
+ |
if [[ "x$ac_cv_have_extended_signals" = "xno" ]]; then |
364 |
+ |
case "$target_os" in |
365 |
+ |
linux*) |
366 |
+ |
if [[ "x$HAVE_I386" = "xyes" ]]; then |
367 |
+ |
AC_CACHE_CHECK("whether we then have a subterfuge for your system", |
368 |
+ |
ac_cv_have_sigcontext_hack, [ |
369 |
+ |
AC_LANG_SAVE |
370 |
+ |
AC_LANG_CPLUSPLUS |
371 |
+ |
AC_TRY_RUN([ |
372 |
+ |
#include <unistd.h> |
373 |
+ |
#include <signal.h> |
374 |
+ |
#include <fcntl.h> |
375 |
+ |
#include <sys/mman.h> |
376 |
+ |
|
377 |
+ |
static volatile caddr_t mem = 0; |
378 |
+ |
static int zero_fd = -1; |
379 |
+ |
|
380 |
+ |
static RETSIGTYPE segfault_handler(int, struct sigcontext scs) |
381 |
+ |
{ if ((caddr_t)(scs.cr2) != mem) exit(1); |
382 |
+ |
munmap(mem, getpagesize()); close(zero_fd); exit(0); } |
383 |
+ |
|
384 |
+ |
int main() |
385 |
+ |
{ if ((zero_fd = open("/dev/zero", O_RDWR)) < 0) exit(1); |
386 |
+ |
if ((mem = (caddr_t)mmap(0, getpagesize(), PROT_READ, MAP_PRIVATE, zero_fd, 0)) == (caddr_t)MAP_FAILED) exit(1); |
387 |
+ |
struct sigaction sa; sa.sa_flags = 0; |
388 |
+ |
sa.sa_handler = (RETSIGTYPE (*)(int))segfault_handler; |
389 |
+ |
sigaction(SIGSEGV, &sa, 0); |
390 |
+ |
mem[0] = 0; |
391 |
+ |
exit(1); // should not be reached |
392 |
+ |
} |
393 |
+ |
], |
394 |
+ |
[ac_cv_have_sigcontext_hack=yes], |
395 |
+ |
[ac_cv_have_sigcontext_hack=no] |
396 |
+ |
) |
397 |
+ |
AC_LANG_RESTORE |
398 |
+ |
]) |
399 |
+ |
AC_TRANSLATE_DEFINE(HAVE_SIGCONTEXT_SUBTERFUGE, $ac_cv_have_sigcontext_hack) |
400 |
+ |
elif [[ "x$HAVE_POWERPC" = "xyes" ]]; then |
401 |
+ |
AC_CACHE_CHECK("whether we then have a subterfuge for your system", |
402 |
+ |
ac_cv_have_sigcontext_hack, [ |
403 |
+ |
AC_LANG_SAVE |
404 |
+ |
AC_LANG_CPLUSPLUS |
405 |
+ |
AC_TRY_RUN([ |
406 |
+ |
#include <unistd.h> |
407 |
+ |
#include <signal.h> |
408 |
+ |
#include <fcntl.h> |
409 |
+ |
#include <sys/mman.h> |
410 |
+ |
|
411 |
+ |
static volatile caddr_t mem = 0; |
412 |
+ |
static int zero_fd = -1; |
413 |
+ |
|
414 |
+ |
static RETSIGTYPE segfault_handler(int, struct sigcontext_struct *scs) |
415 |
+ |
{ if ((caddr_t)(scs->regs->dar) != mem) exit(1); |
416 |
+ |
munmap(mem, getpagesize()); close(zero_fd); exit(0); } |
417 |
+ |
|
418 |
+ |
int main() |
419 |
+ |
{ if ((zero_fd = open("/dev/zero", O_RDWR)) < 0) exit(1); |
420 |
+ |
if ((mem = (caddr_t)mmap(0, getpagesize(), PROT_READ, MAP_PRIVATE, zero_fd, 0)) == (caddr_t)MAP_FAILED) exit(1); |
421 |
+ |
struct sigaction sa; sa.sa_flags = 0; |
422 |
+ |
sa.sa_handler = (RETSIGTYPE (*)(int))segfault_handler; |
423 |
+ |
sigaction(SIGSEGV, &sa, 0); |
424 |
+ |
mem[0] = 0; |
425 |
+ |
exit(1); // should not be reached |
426 |
+ |
} |
427 |
+ |
], |
428 |
+ |
[ac_cv_have_sigcontext_hack=yes], |
429 |
+ |
[ac_cv_have_sigcontext_hack=no] |
430 |
+ |
) |
431 |
+ |
AC_LANG_RESTORE |
432 |
+ |
]) |
433 |
+ |
AC_TRANSLATE_DEFINE(HAVE_SIGCONTEXT_SUBTERFUGE, $ac_cv_have_sigcontext_hack) |
434 |
+ |
fi |
435 |
+ |
;; |
436 |
+ |
netbsd*) |
437 |
+ |
if [[ "x$HAVE_M68K" = "xyes" ]]; then |
438 |
+ |
AC_CACHE_CHECK("whether we then have a subterfuge for your system", |
439 |
+ |
ac_cv_have_sigcontext_hack, [ |
440 |
+ |
AC_LANG_SAVE |
441 |
+ |
AC_LANG_CPLUSPLUS |
442 |
+ |
AC_TRY_RUN([ |
443 |
+ |
#include <unistd.h> |
444 |
+ |
#include <signal.h> |
445 |
+ |
#include <fcntl.h> |
446 |
+ |
#include <sys/mman.h> |
447 |
+ |
|
448 |
+ |
static volatile caddr_t mem = 0; |
449 |
+ |
static int zero_fd = -1; |
450 |
+ |
|
451 |
+ |
static RETSIGTYPE segfault_handler(int, int code) |
452 |
+ |
{ if ((caddr_t)code != mem) exit(1); |
453 |
+ |
munmap(mem, getpagesize()); close(zero_fd); exit(0); } |
454 |
+ |
|
455 |
+ |
int main() |
456 |
+ |
{ if ((zero_fd = open("/dev/zero", O_RDWR)) < 0) exit(1); |
457 |
+ |
if ((mem = (caddr_t)mmap(0, getpagesize(), PROT_READ, MAP_PRIVATE, zero_fd, 0)) == (caddr_t)MAP_FAILED) exit(1); |
458 |
+ |
struct sigaction sa; sa.sa_flags = 0; |
459 |
+ |
sa.sa_handler = (RETSIGTYPE (*)(int))segfault_handler; |
460 |
+ |
sigaction(SIGSEGV, &sa, 0); |
461 |
+ |
mem[0] = 0; |
462 |
+ |
exit(1); // should not be reached |
463 |
+ |
} |
464 |
+ |
], |
465 |
+ |
[ac_cv_have_sigcontext_hack=yes], |
466 |
+ |
[ac_cv_have_sigcontext_hack=no] |
467 |
+ |
) |
468 |
+ |
AC_LANG_RESTORE |
469 |
+ |
]) |
470 |
+ |
AC_TRANSLATE_DEFINE(HAVE_SIGCONTEXT_SUBTERFUGE, $ac_cv_have_sigcontext_hack) |
471 |
+ |
fi |
472 |
+ |
;; |
473 |
+ |
esac |
474 |
+ |
fi |
475 |
+ |
|
476 |
+ |
dnl Can we do Video on SEGV Signals ? |
477 |
+ |
CAN_VOSF=no |
478 |
+ |
if [[ "$ac_cv_have_extended_signals" = "yes" -o "$ac_cv_have_sigcontext_hack" = "yes" ]]; then |
479 |
+ |
CAN_VOSF=yes |
480 |
+ |
fi |
481 |
+ |
|
482 |
+ |
dnl Determine the addressing mode to use |
483 |
+ |
if [[ "x$WANT_NATIVE_M68K" = "xyes" ]]; then |
484 |
+ |
ADDRESSING_MODE="real" |
485 |
+ |
else |
486 |
+ |
ADDRESSING_MODE="" |
487 |
+ |
AC_MSG_CHECKING([for the addressing mode to use]) |
488 |
+ |
for am in $ADDRESSING_TEST_ORDER; do |
489 |
+ |
case $am in |
490 |
+ |
real) |
491 |
+ |
dnl Requires ability to mmap() Low Memory globals |
492 |
+ |
if [[ "x$ac_cv_can_map_lm" = "xno" ]]; then |
493 |
+ |
continue |
494 |
+ |
fi |
495 |
+ |
dnl Requires VOSF screen updates |
496 |
+ |
if [[ "x$CAN_VOSF" = "xno" ]]; then |
497 |
+ |
continue |
498 |
+ |
fi |
499 |
+ |
dnl Real addressing will probably work. |
500 |
+ |
ADDRESSING_MODE="real" |
501 |
+ |
WANT_VOSF=yes dnl we can use VOSF and we need it actually |
502 |
+ |
DEFINES="$DEFINES -DREAL_ADDRESSING" |
503 |
+ |
break |
504 |
+ |
;; |
505 |
+ |
direct) |
506 |
+ |
dnl Requires VOSF screen updates |
507 |
+ |
if [[ "x$CAN_VOSF" = "xyes" ]]; then |
508 |
+ |
ADDRESSING_MODE="direct" |
509 |
+ |
WANT_VOSF=yes dnl we can use VOSF and we need it actually |
510 |
+ |
DEFINES="$DEFINES -DDIRECT_ADDRESSING" |
511 |
+ |
break |
512 |
+ |
fi |
513 |
+ |
;; |
514 |
+ |
banks) |
515 |
+ |
dnl Default addressing mode |
516 |
+ |
ADDRESSING_MODE="memory banks" |
517 |
+ |
break |
518 |
+ |
;; |
519 |
+ |
*) |
520 |
+ |
AC_MSG_ERROR([Internal configure.in script error for $am addressing mode]) |
521 |
+ |
esac |
522 |
+ |
done |
523 |
+ |
AC_MSG_RESULT($ADDRESSING_MODE) |
524 |
+ |
if [[ "x$ADDRESSING_MODE" = "x" ]]; then |
525 |
+ |
AC_MSG_WARN([Sorry, no suitable addressing mode in $ADDRESSING_TEST_ORDER]) |
526 |
+ |
ADDRESSING_MODE="memory banks" |
527 |
+ |
fi |
528 |
+ |
fi |
529 |
+ |
|
530 |
+ |
dnl Enable VOSF screen updates with this feature is requested and feasible |
531 |
+ |
if [[ "x$WANT_VOSF" = "xyes" -a "x$CAN_VOSF" = "xyes" ]]; then |
532 |
+ |
AC_DEFINE(ENABLE_VOSF) |
533 |
+ |
else |
534 |
+ |
WANT_VOSF=no |
535 |
+ |
fi |
536 |
+ |
|
537 |
|
dnl Check for GAS. |
538 |
|
HAVE_GAS=no |
539 |
|
AC_MSG_CHECKING(for GAS .p2align feature) |
560 |
|
fi |
561 |
|
|
562 |
|
dnl Select appropriate CPU source and REGPARAM define. |
563 |
< |
WANT_X86_ASSEMBLY=no |
289 |
< |
WANT_SPARC_V8_ASSEMBLY=no |
290 |
< |
WANT_SPARC_V9_ASSEMBLY=no |
291 |
< |
WANT_NATIVE_M68K=no |
563 |
> |
ASM_OPTIMIZATIONS=none |
564 |
|
CPUSRCS="cpuemu1.cpp cpuemu2.cpp cpuemu3.cpp cpuemu4.cpp cpuemu5.cpp cpuemu6.cpp cpuemu7.cpp cpuemu8.cpp" |
565 |
+ |
FPUSRCS="../uae_cpu/fpp.cpp" |
566 |
|
if [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_I386" = "xyes" ]]; then |
567 |
|
dnl i386 CPU |
568 |
|
DEFINES="$DEFINES -DREGPARAM=\"__attribute__((regparm(3)))\"" |
569 |
|
if [[ "x$HAVE_GAS" = "xyes" ]]; then |
570 |
< |
WANT_X86_ASSEMBLY=yes |
571 |
< |
DEFINES="$DEFINES -DX86_ASSEMBLY" |
570 |
> |
ASM_OPTIMIZATIONS=i386 |
571 |
> |
DEFINES="$DEFINES -DX86_ASSEMBLY -DUNALIGNED_PROFITABLE -DOPTIMIZED_FLAGS" |
572 |
|
CPUSRCS="../uae_cpu/compiler.cpp cpufast1.s cpufast2.s cpufast3.s cpufast4.s cpufast5.s cpufast6.s cpufast7.s cpufast8.s" |
573 |
+ |
FPUSRCS="../uae_cpu/fpu_x86.cpp" |
574 |
|
fi |
575 |
|
elif [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_SPARC" = "xyes" -a "x$HAVE_GAS" = "xyes" ]]; then |
576 |
|
dnl SPARC CPU |
577 |
< |
case "$MACHINE" in |
578 |
< |
SunOS*) |
577 |
> |
case "$target_os" in |
578 |
> |
solaris*) |
579 |
|
AC_MSG_CHECKING(SPARC CPU architecture) |
580 |
|
SPARC_TYPE=`Solaris/which_sparc` |
581 |
|
AC_MSG_RESULT($SPARC_TYPE) |
582 |
|
case "$SPARC_TYPE" in |
583 |
|
SPARC_V8) |
584 |
< |
WANT_SPARC_V8_ASSEMBLY=yes |
585 |
< |
DEFINES="$DEFINES -DSPARC_V8_ASSEMBLY" |
584 |
> |
ASM_OPTIMIZATIONS="SPARC V8 architecture" |
585 |
> |
DEFINES="$DEFINES -DSPARC_V8_ASSEMBLY" dnl -DOPTIMIZED_FLAGS" |
586 |
|
CFLAGS="$CFLAGS -Wa,-Av8" |
587 |
|
CXXFLAGS="$CXXFLAGS -Wa,-Av8" |
588 |
|
;; |
589 |
|
SPARC_V9) |
590 |
< |
WANT_SPARC_V9_ASSEMBLY=yes |
591 |
< |
DEFINES="$DEFINES -DSPARC_V9_ASSEMBLY" |
590 |
> |
ASM_OPTIMIZATIONS="SPARC V9 architecture" |
591 |
> |
DEFINES="$DEFINES -DSPARC_V9_ASSEMBLY" dnl -DOPTIMIZED_FLAGS" |
592 |
|
CFLAGS="$CFLAGS -Wa,-Av9" |
593 |
|
CXXFLAGS="$CXXFLAGS -Wa,-Av9" |
594 |
|
;; |
595 |
|
esac |
596 |
|
;; |
597 |
|
esac |
598 |
< |
elif [[ "x$HAVE_M68K" = "xyes" -a "x$SUPPORTS_NATIVE_M68K" = "xyes" ]]; then |
598 |
> |
elif [[ "x$WANT_NATIVE_M68K" = "xyes" ]]; then |
599 |
|
dnl Native m68k, no emulation |
600 |
< |
CPUSRCS="" |
601 |
< |
AC_DEFINE(ENABLE_NATIVE_M68K) |
328 |
< |
WANT_NATIVE_M68K=yes |
600 |
> |
CPUINCLUDES="-I../native_cpu" |
601 |
> |
CPUSRCS="asm_support.s" |
602 |
|
fi |
603 |
|
|
604 |
|
dnl UAE CPU sources for all non-m68k-native architectures. |
605 |
|
if [[ "x$WANT_NATIVE_M68K" = "xno" ]]; then |
606 |
|
CPUINCLUDES="-I../uae_cpu" |
607 |
< |
CPUSRCS="../uae_cpu/basilisk_glue.cpp ../uae_cpu/memory.cpp ../uae_cpu/newcpu.cpp ../uae_cpu/readcpu.cpp ../uae_cpu/fpp.cpp cpustbl.cpp cpudefs.cpp $CPUSRCS" |
608 |
< |
else |
609 |
< |
CPUINCLUDES="-I../native_cpu" |
610 |
< |
CPUSRCS="asm_support.s" |
607 |
> |
CPUSRCS="../uae_cpu/basilisk_glue.cpp ../uae_cpu/memory.cpp ../uae_cpu/newcpu.cpp ../uae_cpu/readcpu.cpp $FPUSRCS cpustbl.cpp cpudefs.cpp $CPUSRCS" |
608 |
> |
fi |
609 |
> |
|
610 |
> |
dnl Remove the "-g" option if set for GCC. |
611 |
> |
if [[ "x$HAVE_GCC27" = "xyes" ]]; then |
612 |
> |
dnl gb-- Probably not the cleanest way to take |
613 |
> |
CFLAGS=`echo $CFLAGS | sed -e 's/ -g / /;s/^-g / /;s/ -g$/ /;s/^-g$//'` |
614 |
> |
CXXFLAGS=`echo $CXXFLAGS | sed -e 's/ -g / /;s/^-g / /;s/ -g$/ /;s/^-g$//'` |
615 |
|
fi |
616 |
|
|
617 |
|
dnl Generate Makefile. |
628 |
|
echo XFree86 DGA support .............. : $WANT_XF86_DGA |
629 |
|
echo XFree86 VidMode support .......... : $WANT_XF86_VIDMODE |
630 |
|
echo fbdev DGA support ................ : $WANT_FBDEV_DGA |
631 |
+ |
echo Enable video on SEGV signals ..... : $WANT_VOSF |
632 |
|
echo ESD sound support ................ : $WANT_ESD |
633 |
|
echo GTK user interface ............... : $WANT_GTK |
634 |
|
echo mon debugger support ............. : $WANT_MON |
357 |
– |
echo i386 assembly optimizations ...... : $WANT_X86_ASSEMBLY |
358 |
– |
echo SPARC V8 assembly optimizations .. : $WANT_SPARC_V8_ASSEMBLY |
359 |
– |
echo SPARC V9 assembly optimizations .. : $WANT_SPARC_V9_ASSEMBLY |
635 |
|
echo Running m68k code natively ....... : $WANT_NATIVE_M68K |
636 |
+ |
echo Assembly optimizations ........... : $ASM_OPTIMIZATIONS |
637 |
+ |
echo Addressing mode .................. : $ADDRESSING_MODE |
638 |
|
echo |
639 |
|
echo "Configuration done. Now type \"make\" (or \"gmake\")." |