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=yes]) |
13 |
+ |
|
14 |
+ |
dnl FPU emulation core. |
15 |
+ |
AC_ARG_ENABLE(fpe, |
16 |
+ |
[ --enable-fpe=FPE specify which fpu emulator to use [default=auto]], |
17 |
+ |
[ case "$enableval" in |
18 |
+ |
dnl default is always ieee, if architecture has this fp format |
19 |
+ |
auto) FPE_CORE_TEST_ORDER="ieee uae";; |
20 |
+ |
ieee) FPE_CORE_TEST_ORDER="ieee";; |
21 |
+ |
uae) FPE_CORE_TEST_ORDER="uae";; |
22 |
+ |
x86) FPE_CORE_TEST_ORDER="x86";; |
23 |
+ |
*) AC_MSG_ERROR([--enable-fpe takes only one of the following values: auto, x86, ieee, uae]);; |
24 |
+ |
esac |
25 |
+ |
], |
26 |
+ |
[ FPE_CORE_TEST_ORDER="ieee uae" |
27 |
+ |
]) |
28 |
+ |
|
29 |
+ |
dnl Addressing modes. |
30 |
+ |
AC_ARG_ENABLE(addressing, |
31 |
+ |
[ --enable-addressing=AM specify the addressing mode to use [default=fastest]], |
32 |
+ |
[ case "$enableval" in |
33 |
+ |
real) ADDRESSING_TEST_ORDER="real";; |
34 |
+ |
direct) ADDRESSING_TEST_ORDER="direct";; |
35 |
+ |
banks) ADDRESSING_TEST_ORDER="banks";; |
36 |
+ |
fastest)ADDRESSING_TEST_ORDER="direct banks";; |
37 |
+ |
*) AC_MSG_ERROR([--enable-addressing takes only one of the following values: fastest, real, direct, banks]);; |
38 |
+ |
esac |
39 |
+ |
], |
40 |
+ |
[ ADDRESSING_TEST_ORDER="direct banks" |
41 |
+ |
]) |
42 |
+ |
|
43 |
+ |
dnl External packages. |
44 |
|
AC_ARG_WITH(esd, [ --with-esd support ESD for sound under Linux/FreeBSD [default=yes]], [WANT_ESD=$withval], [WANT_ESD=yes]) |
45 |
|
AC_ARG_WITH(gtk, [ --with-gtk use GTK user interface [default=yes]], [WANT_GTK=$withval], [WANT_GTK=yes]) |
46 |
|
AC_ARG_WITH(mon, [ --with-mon use mon as debugger [default=yes]], [WANT_MON=$withval], [WANT_MON=yes]) |
47 |
|
|
48 |
+ |
dnl Canonical system information. |
49 |
+ |
AC_CANONICAL_HOST |
50 |
+ |
AC_CANONICAL_TARGET |
51 |
+ |
|
52 |
+ |
dnl Target OS type (target is host if not cross-compiling). |
53 |
+ |
case "$target_os" in |
54 |
+ |
linux*) OS_TYPE=linux;; |
55 |
+ |
netbsd*) OS_TYPE=netbsd;; |
56 |
+ |
freebsd*) OS_TYPE=freebsd;; |
57 |
+ |
solaris*) OS_TYPE=solaris;; |
58 |
+ |
darwin*) OS_TYPE=darwin;; |
59 |
+ |
*) OS_TYPE=`echo $target_os | sed -e 's/-/_/g' | sed -e 's/\./_/g'`;; |
60 |
+ |
esac |
61 |
+ |
DEFINES="$DEFINES -DOS_$OS_TYPE" |
62 |
+ |
|
63 |
+ |
dnl Target CPU type. |
64 |
+ |
HAVE_I386=no |
65 |
+ |
HAVE_M68K=no |
66 |
+ |
HAVE_SPARC=no |
67 |
+ |
HAVE_POWERPC=no |
68 |
+ |
case "$target_cpu" in |
69 |
+ |
i386* | i486* | i586* | i686* | i786* ) CPU_TYPE=i386 HAVE_I386=yes;; |
70 |
+ |
m68k* ) CPU_TYPE=m68k HAVE_M68K=yes;; |
71 |
+ |
sparc* ) CPU_TYPE=sparc HAVE_SPARC=yes;; |
72 |
+ |
powerpc* ) CPU_TYPE=powerpc HAVE_POWERPC=yes;; |
73 |
+ |
*) CPU_TYPE=`echo $target_cpu | sed -e 's/-/_/g'`;; |
74 |
+ |
esac |
75 |
+ |
DEFINES="$DEFINES -DCPU_$CPU_TYPE" |
76 |
+ |
|
77 |
|
dnl Checks for programs. |
78 |
|
AC_PROG_CC |
79 |
+ |
AC_PROG_CC_C_O |
80 |
|
AC_PROG_CPP |
81 |
|
AC_PROG_CXX |
82 |
|
AC_PROG_MAKE_SET |
83 |
|
AC_PROG_INSTALL |
84 |
|
|
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 |
– |
|
85 |
|
dnl We use mon if possible. |
86 |
|
MONSRCS= |
87 |
|
if [[ "x$WANT_MON" = "xyes" ]]; then |
88 |
|
AC_MSG_CHECKING(for mon) |
89 |
< |
if grep mon_init ../../../mon/src/mon.h >/dev/null 2>/dev/null; then |
89 |
> |
mon_srcdir=../../../mon/src |
90 |
> |
if grep mon_init $mon_srcdir/mon.h >/dev/null 2>/dev/null; then |
91 |
|
AC_MSG_RESULT(yes) |
92 |
|
AC_DEFINE(ENABLE_MON) |
93 |
< |
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" |
94 |
< |
CXXFLAGS="$CXXFLAGS -I../../../mon/src" |
93 |
> |
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" |
94 |
> |
CXXFLAGS="$CXXFLAGS -I$mon_srcdir -I$mon_srcdir/disass" |
95 |
> |
AC_CHECK_LIB(ncurses, tgetent, , |
96 |
> |
AC_CHECK_LIB(termcap, tgetent, , |
97 |
> |
AC_CHECK_LIB(termlib, tgetent, , |
98 |
> |
AC_CHECK_LIB(terminfo, tgetent, , |
99 |
> |
AC_CHECK_LIB(Hcurses, tgetent, , |
100 |
> |
AC_CHECK_LIB(curses, tgetent)))))) |
101 |
|
AC_CHECK_LIB(readline, readline) |
63 |
– |
AC_CHECK_LIB(termcap, tputs) |
102 |
|
AC_CHECK_HEADERS(readline.h history.h readline/readline.h readline/history.h) |
103 |
|
else |
104 |
|
AC_MSG_RESULT(no) |
109 |
|
|
110 |
|
dnl Checks for libraries. |
111 |
|
AC_CHECK_LIB(posix4, sem_init) |
112 |
+ |
AC_CHECK_LIB(rt, timer_create) |
113 |
|
|
114 |
|
dnl We need X11. |
115 |
|
AC_PATH_XTRA |
133 |
|
AC_DEFINE(HAVE_PTHREADS) |
134 |
|
fi |
135 |
|
AC_CHECK_FUNCS(pthread_cancel) |
136 |
+ |
AC_CHECK_FUNCS(pthread_mutexattr_setprotocol) |
137 |
+ |
AC_CHECK_FUNCS(pthread_mutexattr_settype) |
138 |
|
|
139 |
|
dnl If POSIX.4 semaphores are not available, we emulate them with pthread mutexes. |
140 |
|
SEMSRC= |
141 |
|
AC_CHECK_FUNCS(sem_init, , [ |
142 |
< |
if [ "x$HAVE_PTHREADS" = "xyes" ]; then |
142 |
> |
if test "x$HAVE_PTHREADS" = "xyes"; then |
143 |
|
SEMSRC=posix_sem.cpp |
144 |
|
fi |
145 |
|
]) |
178 |
|
if [[ "x$WANT_GTK" = "xyes" ]]; then |
179 |
|
AM_PATH_GTK(1.2.0, [ |
180 |
|
AC_DEFINE(ENABLE_GTK) |
140 |
– |
CFLAGS="$CFLAGS $GTK_CFLAGS" |
181 |
|
CXXFLAGS="$CXXFLAGS $GTK_CFLAGS" |
182 |
|
LIBS="$LIBS $GTK_LIBS" |
183 |
|
UISRCS=prefs_editor_gtk.cpp |
184 |
+ |
B2_PATH_GNOMEUI([ |
185 |
+ |
AC_DEFINE(HAVE_GNOMEUI) |
186 |
+ |
CXXFLAGS="$CXXFLAGS $GNOMEUI_CFLAGS" |
187 |
+ |
LIBS="$LIBS $GNOMEUI_LIBS" |
188 |
+ |
], []) |
189 |
|
], [ |
190 |
|
AC_MSG_WARN([Could not find GTK+, disabling user interface.]) |
191 |
|
WANT_GTK=no |
205 |
|
]) |
206 |
|
fi |
207 |
|
|
208 |
+ |
dnl We use 64-bit file size support if possible. |
209 |
+ |
dnl FIXME: Use AC_SYS_LARGEFILE from autoconf 2.5+ |
210 |
+ |
if [[ "x$OS_TYPE" = "xlinux" ]]; then |
211 |
+ |
AC_DEFINE(_USE_LARGEFILE_SOURCE, 1, [Get more functions for correct standard I/O]) |
212 |
+ |
AC_DEFINE(_FILE_OFFSET_BITS, 64, [Get 64-bit file size support]) |
213 |
+ |
fi |
214 |
+ |
|
215 |
|
dnl Checks for header files. |
216 |
|
AC_HEADER_STDC |
217 |
< |
AC_CHECK_HEADERS(unistd.h fcntl.h sys/time.h) |
217 |
> |
AC_CHECK_HEADERS(unistd.h fcntl.h sys/time.h sys/mman.h) |
218 |
|
|
219 |
|
dnl Checks for typedefs, structures, and compiler characteristics. |
220 |
|
AC_C_BIGENDIAN |
224 |
|
AC_CHECK_SIZEOF(int, 4) |
225 |
|
AC_CHECK_SIZEOF(long, 4) |
226 |
|
AC_CHECK_SIZEOF(long long, 8) |
227 |
+ |
AC_CHECK_SIZEOF(float, 4) |
228 |
+ |
AC_CHECK_SIZEOF(double, 8) |
229 |
+ |
AC_CHECK_SIZEOF(long double, 12) |
230 |
+ |
AC_CHECK_SIZEOF(void *, 4) |
231 |
|
AC_TYPE_OFF_T |
232 |
|
AC_CHECK_TYPE(loff_t, off_t) |
233 |
+ |
AC_CHECK_TYPE(caddr_t, [char *]) |
234 |
|
AC_TYPE_SIZE_T |
235 |
+ |
AC_TYPE_SIGNAL |
236 |
|
AC_HEADER_TIME |
237 |
|
AC_STRUCT_TM |
238 |
|
|
239 |
+ |
dnl Check whether sys/socket.h defines type socklen_t. |
240 |
+ |
dnl (extracted from ac-archive/Miscellaneous) |
241 |
+ |
AC_CACHE_CHECK("for socklen_t", |
242 |
+ |
ac_cv_type_socklen_t, [ |
243 |
+ |
AC_TRY_COMPILE([ |
244 |
+ |
#include <sys/types.h> |
245 |
+ |
#include <sys/socket.h> |
246 |
+ |
], [socklen_t len = 42; return 0;], |
247 |
+ |
ac_cv_type_socklen_t=yes, ac_cv_type_socklen_t=no, |
248 |
+ |
dnl When cross-compiling, do not assume anything. |
249 |
+ |
ac_cv_type_socklen_t="guessing no" |
250 |
+ |
) |
251 |
+ |
]) |
252 |
+ |
if [[ "x$ac_cv_type_socklen_t" != "xyes" ]]; then |
253 |
+ |
AC_DEFINE(socklen_t, int) |
254 |
+ |
fi |
255 |
+ |
|
256 |
|
dnl Checks for library functions. |
257 |
|
AC_CHECK_FUNCS(strdup cfmakeraw) |
258 |
< |
AC_CHECK_FUNCS(nanosleep clock_gettime timer_create) |
258 |
> |
AC_CHECK_FUNCS(clock_gettime timer_create) |
259 |
> |
AC_CHECK_FUNCS(sigaction signal) |
260 |
> |
AC_CHECK_FUNCS(mmap mprotect munmap) |
261 |
> |
AC_CHECK_FUNCS(vm_allocate vm_deallocate vm_protect) |
262 |
> |
|
263 |
> |
dnl Darwin seems to define mach_task_self() instead of task_self(). |
264 |
> |
AC_CHECK_FUNCS(mach_task_self task_self) |
265 |
> |
|
266 |
> |
dnl Check for headers and functions related to pty support (sshpty.c) |
267 |
> |
dnl From openssh-3.2.2p1 configure.ac |
268 |
> |
|
269 |
> |
AC_CHECK_HEADERS(strings.h login.h sys/bsdtty.h sys/stat.h util.h pty.h) |
270 |
> |
AC_CHECK_FUNCS(_getpty vhangup strlcpy) |
271 |
> |
|
272 |
> |
case "$host" in |
273 |
> |
*-*-hpux10.26) |
274 |
> |
disable_ptmx_check=yes |
275 |
> |
;; |
276 |
> |
*-*-linux*) |
277 |
> |
no_dev_ptmx=1 |
278 |
> |
;; |
279 |
> |
mips-sony-bsd|mips-sony-newsos4) |
280 |
> |
AC_DEFINE(HAVE_NEWS4) |
281 |
> |
;; |
282 |
> |
*-*-sco3.2v4*) |
283 |
> |
no_dev_ptmx=1 |
284 |
> |
;; |
285 |
> |
*-*-sco3.2v5*) |
286 |
> |
no_dev_ptmx=1 |
287 |
> |
;; |
288 |
> |
esac |
289 |
> |
|
290 |
> |
if test -z "$no_dev_ptmx" ; then |
291 |
> |
if test "x$disable_ptmx_check" != "xyes" ; then |
292 |
> |
AC_CHECK_FILE("/dev/ptmx", |
293 |
> |
[ |
294 |
> |
AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX) |
295 |
> |
have_dev_ptmx=1 |
296 |
> |
] |
297 |
> |
) |
298 |
> |
fi |
299 |
> |
fi |
300 |
> |
AC_CHECK_FILE("/dev/ptc", |
301 |
> |
[ |
302 |
> |
AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC) |
303 |
> |
have_dev_ptc=1 |
304 |
> |
] |
305 |
> |
) |
306 |
> |
|
307 |
> |
dnl (end of code from openssh-3.2.2p1 configure.ac) |
308 |
> |
|
309 |
|
|
310 |
|
dnl Select system-dependant source files. |
311 |
|
SERIALSRC=serial_unix.cpp |
313 |
|
SCSISRC=../dummy/scsi_dummy.cpp |
314 |
|
AUDIOSRC=../dummy/audio_dummy.cpp |
315 |
|
EXTRASYSSRCS= |
316 |
< |
SUPPORTS_NATIVE_M68K=no |
317 |
< |
if MACHINE=`uname -s 2>/dev/null`; then |
318 |
< |
case "$MACHINE" in |
319 |
< |
Linux*) |
320 |
< |
ETHERSRC=Linux/ether_linux.cpp |
321 |
< |
SCSISRC=Linux/scsi_linux.cpp |
322 |
< |
AUDIOSRC=audio_oss_esd.cpp |
323 |
< |
;; |
324 |
< |
FreeBSD*3.*) |
325 |
< |
AUDIOSRC=audio_oss_esd.cpp |
326 |
< |
DEFINES="$DEFINES -DBSD_COMP" |
327 |
< |
dnl Check for the CAM library |
328 |
< |
AC_CHECK_LIB(cam, cam_open_btl, HAVE_LIBCAM=yes, HAVE_LIBCAM=no) |
329 |
< |
if [[ "x$HAVE_LIBCAM" = "xno" ]]; then |
330 |
< |
AC_MSG_WARN([Cannot find libcam for SCSI management, disabling SCSI support.]) |
331 |
< |
else |
332 |
< |
dnl Check for the sys kernel includes |
333 |
< |
AC_CHECK_HEADER(/sys/cam/cam.h) |
334 |
< |
if [[ "x$ac_cv_header__sys_cam_cam_h" = "xno" ]]; then |
335 |
< |
dnl In this case I should fix this thing including a "patch" |
336 |
< |
dnl to access directly to the functions in the kernel :) --Orlando |
337 |
< |
AC_MSG_WARN([Cannot find kernel includes for CAM library, disabling SCSI support.]) |
338 |
< |
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 |
220 |
< |
fi |
221 |
< |
;; |
222 |
< |
FreeBSD*) |
223 |
< |
DEFINES="$DEFINES -DBSD_COMP" |
224 |
< |
dnl Check for the SCSI library |
225 |
< |
AC_CHECK_LIB(scsi, scsi_open, HAVE_LIBSCSI=yes, HAVE_LIBSCSI=no) |
226 |
< |
if [[ "x$HAVE_LIBSCSI" = "xno" ]]; then |
227 |
< |
AC_MSG_WARN([Cannot find libscsi for SCSI management, disabling SCSI support.]) |
316 |
> |
CAN_NATIVE_M68K=no |
317 |
> |
case "$target_os" in |
318 |
> |
linux*) |
319 |
> |
ETHERSRC=ether_unix.cpp |
320 |
> |
AUDIOSRC=audio_oss_esd.cpp |
321 |
> |
SCSISRC=Linux/scsi_linux.cpp |
322 |
> |
;; |
323 |
> |
freebsd*) |
324 |
> |
ETHERSRC=ether_unix.cpp |
325 |
> |
AUDIOSRC=audio_oss_esd.cpp |
326 |
> |
DEFINES="$DEFINES -DBSD_COMP" |
327 |
> |
CXXFLAGS="$CXXFLAGS -fpermissive" |
328 |
> |
dnl Check for the CAM library |
329 |
> |
AC_CHECK_LIB(cam, cam_open_btl, HAVE_LIBCAM=yes, HAVE_LIBCAM=no) |
330 |
> |
if [[ "x$HAVE_LIBCAM" = "xno" ]]; then |
331 |
> |
AC_MSG_WARN([Cannot find libcam for SCSI management, disabling SCSI support.]) |
332 |
> |
else |
333 |
> |
dnl Check for the sys kernel includes |
334 |
> |
AC_CHECK_HEADER(camlib.h) |
335 |
> |
if [[ "x$ac_cv_header_camlib_h" = "xno" ]]; then |
336 |
> |
dnl In this case I should fix this thing including a "patch" |
337 |
> |
dnl to access directly to the functions in the kernel :) --Orlando |
338 |
> |
AC_MSG_WARN([Cannot find includes for CAM library, disabling SCSI support.]) |
339 |
|
else |
340 |
< |
dnl Check for the sys kernel includes |
341 |
< |
AC_CHECK_HEADER(scsi.h sys/scsiio.h) |
342 |
< |
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 |
340 |
> |
SCSISRC=FreeBSD/scsi_freebsd.cpp |
341 |
> |
LIBS="$LIBS -lcam" |
342 |
> |
DEFINES="$DEFINES -DCAM" |
343 |
|
fi |
344 |
< |
;; |
345 |
< |
NetBSD*) |
346 |
< |
SUPPORTS_NATIVE_M68K=yes |
347 |
< |
;; |
348 |
< |
SunOS*) |
349 |
< |
AUDIOSRC=Solaris/audio_solaris.cpp |
350 |
< |
DEFINES="$DEFINES -DBSD_COMP -D_POSIX_PTHREAD_SEMANTICS" |
351 |
< |
;; |
352 |
< |
IRIX*) |
353 |
< |
EXTRASYSSRCS=Irix/unaligned.c |
354 |
< |
DEFINES="$DEFINES -DCRTSCTS=CNEW_RTSCTS -DB230400=B115200" |
355 |
< |
LIBS="$LIBS -lm" |
356 |
< |
;; |
357 |
< |
esac |
344 |
> |
fi |
345 |
> |
;; |
346 |
> |
netbsd*) |
347 |
> |
CAN_NATIVE_M68K=yes |
348 |
> |
;; |
349 |
> |
solaris*) |
350 |
> |
AUDIOSRC=Solaris/audio_solaris.cpp |
351 |
> |
DEFINES="$DEFINES -DBSD_COMP -D_POSIX_PTHREAD_SEMANTICS" |
352 |
> |
;; |
353 |
> |
irix*) |
354 |
> |
ETHERSRC=ether_unix.cpp |
355 |
> |
AUDIOSRC=Irix/audio_irix.cpp |
356 |
> |
EXTRASYSSRCS=Irix/unaligned.c |
357 |
> |
dnl IRIX headers work fine, but somehow don't define or use "STDC_HEADERS" |
358 |
> |
DEFINES="$DEFINES -DCRTSCTS=CNEW_RTSCTS -DB230400=B115200 -DSTDC_HEADERS" |
359 |
> |
LIBS="$LIBS -laudio" |
360 |
> |
WANT_ESD=no |
361 |
> |
|
362 |
> |
dnl Check if our compiler supports -Ofast (MIPSPro) |
363 |
> |
HAVE_OFAST=no |
364 |
> |
ocflags="$CFLAGS" |
365 |
> |
CFLAGS=`echo $CFLAGS | sed -e 's/ -g / -Ofast /;s/^-g /-Ofast /;s/-g$/ -Ofast/;s/^-g$/-Ofast/'` |
366 |
> |
AC_MSG_CHECKING(if "-Ofast" works) |
367 |
> |
dnl Do a test compile of an empty function |
368 |
> |
AC_TRY_COMPILE(,, [AC_MSG_RESULT(yes); HAVE_OFAST=yes], AC_MSG_RESULT(no)) |
369 |
> |
CFLAGS="$ocflags" |
370 |
> |
|
371 |
> |
;; |
372 |
> |
esac |
373 |
> |
|
374 |
> |
dnl Use 68k CPU natively? |
375 |
> |
WANT_NATIVE_M68K=no |
376 |
> |
if [[ "x$HAVE_M68K" = "xyes" -a "x$CAN_NATIVE_M68K" = "xyes" ]]; then |
377 |
> |
AC_DEFINE(ENABLE_NATIVE_M68K) |
378 |
> |
WANT_NATIVE_M68K=yes |
379 |
|
fi |
380 |
+ |
|
381 |
|
if [[ "x$HAVE_PTHREADS" = "xno" ]]; then |
382 |
|
dnl Serial, ethernet and audio support needs pthreads |
383 |
|
AC_MSG_WARN([You don't have pthreads, disabling serial, ethernet and audio support.]) |
387 |
|
fi |
388 |
|
SYSSRCS="$SERIALSRC $ETHERSRC $SCSISRC $AUDIOSRC $SEMSRC $UISRCS $MONSRCS $EXTRASYSSRCS" |
389 |
|
|
390 |
+ |
dnl Define a macro that translates a yesno-variable into a C macro definition |
391 |
+ |
dnl to be put into the config.h file |
392 |
+ |
dnl $1 -- the macro to define |
393 |
+ |
dnl $2 -- the value to translate |
394 |
+ |
AC_DEFUN(AC_TRANSLATE_DEFINE, [ |
395 |
+ |
if [[ "x$2" = "xyes" -o "x$2" = "xguessing yes" ]]; then |
396 |
+ |
AC_DEFINE($1) |
397 |
+ |
fi |
398 |
+ |
]) |
399 |
+ |
|
400 |
+ |
dnl Various checks if the system supports vm_allocate() and the like functions. |
401 |
+ |
have_mach_vm=no |
402 |
+ |
if [[ "x$ac_cv_func_vm_allocate" = "xyes" -a "x$ac_cv_func_vm_deallocate" = "xyes" -a \ |
403 |
+ |
"x$ac_cv_func_vm_protect" = "xyes" ]]; then |
404 |
+ |
have_mach_vm=yes |
405 |
+ |
fi |
406 |
+ |
AC_TRANSLATE_DEFINE(HAVE_MACH_VM, "$have_mach_vm") |
407 |
+ |
|
408 |
+ |
dnl Check that vm_allocate(), vm_protect() work |
409 |
+ |
if [[ "x$have_mach_vm" = "xyes" ]]; then |
410 |
+ |
|
411 |
+ |
AC_CACHE_CHECK("whether vm_protect works", |
412 |
+ |
ac_cv_vm_protect_works, [ |
413 |
+ |
AC_LANG_SAVE |
414 |
+ |
AC_LANG_CPLUSPLUS |
415 |
+ |
ac_cv_vm_protect_works=yes |
416 |
+ |
dnl First the tests that should segfault |
417 |
+ |
for test_def in NONE_READ NONE_WRITE READ_WRITE; do |
418 |
+ |
AC_TRY_RUN([ |
419 |
+ |
#define CONFIGURE_TEST_VM_MAP |
420 |
+ |
#define TEST_VM_PROT_$test_def |
421 |
+ |
#include "vm_alloc.cpp" |
422 |
+ |
], ac_cv_vm_protect_works=no, rm -f core, |
423 |
+ |
dnl When cross-compiling, do not assume anything |
424 |
+ |
ac_cv_vm_protect_works="guessing no" |
425 |
+ |
) |
426 |
+ |
done |
427 |
+ |
AC_TRY_RUN([ |
428 |
+ |
#define CONFIGURE_TEST_VM_MAP |
429 |
+ |
#define TEST_VM_PROT_RDWR_WRITE |
430 |
+ |
#include "vm_alloc.cpp" |
431 |
+ |
], , ac_cv_vm_protect_works=no, |
432 |
+ |
dnl When cross-compiling, do not assume anything |
433 |
+ |
ac_cv_vm_protect_works="guessing no" |
434 |
+ |
) |
435 |
+ |
AC_LANG_RESTORE |
436 |
+ |
] |
437 |
+ |
) |
438 |
+ |
|
439 |
+ |
dnl Remove support for vm_allocate() if vm_protect() does not work |
440 |
+ |
if [[ "x$have_mach_vm" = "xyes" ]]; then |
441 |
+ |
case $ac_cv_vm_protect_works in |
442 |
+ |
*yes) have_mach_vm=yes;; |
443 |
+ |
*no) have_mach_vm=no;; |
444 |
+ |
esac |
445 |
+ |
fi |
446 |
+ |
AC_TRANSLATE_DEFINE(HAVE_MACH_VM, "$have_mach_vm") |
447 |
+ |
|
448 |
+ |
fi dnl HAVE_MACH_VM |
449 |
+ |
|
450 |
+ |
dnl Various checks if the system supports mmap() and the like functions. |
451 |
+ |
dnl ... and Mach memory allocators are not supported |
452 |
+ |
have_mmap_vm=no |
453 |
+ |
if [[ "x$ac_cv_func_mmap" = "xyes" -a "x$ac_cv_func_munmap" = "xyes" -a \ |
454 |
+ |
"x$ac_cv_func_mprotect" = "xyes" ]]; then |
455 |
+ |
if [[ "x$have_mach_vm" = "xno" ]]; then |
456 |
+ |
have_mmap_vm=yes |
457 |
+ |
fi |
458 |
+ |
fi |
459 |
+ |
AC_TRANSLATE_DEFINE(HAVE_MMAP_VM, "$have_mmap_vm") |
460 |
+ |
|
461 |
+ |
dnl Check that mmap() and associated functions work. |
462 |
+ |
if [[ "x$have_mmap_vm" = "xyes" ]]; then |
463 |
+ |
|
464 |
+ |
dnl Check if we have a working anonymous mmap() |
465 |
+ |
AC_CACHE_CHECK("whether mmap supports MAP_ANON", |
466 |
+ |
ac_cv_mmap_anon, [ |
467 |
+ |
AC_LANG_SAVE |
468 |
+ |
AC_LANG_CPLUSPLUS |
469 |
+ |
AC_TRY_RUN([ |
470 |
+ |
#define HAVE_MMAP_ANON |
471 |
+ |
#define CONFIGURE_TEST_VM_MAP |
472 |
+ |
#define TEST_VM_MMAP_ANON |
473 |
+ |
#include "vm_alloc.cpp" |
474 |
+ |
], ac_cv_mmap_anon=yes, ac_cv_mmap_anon=no, |
475 |
+ |
dnl When cross-compiling, do not assume anything. |
476 |
+ |
ac_cv_mmap_anon="guessing no" |
477 |
+ |
) |
478 |
+ |
AC_LANG_RESTORE |
479 |
+ |
] |
480 |
+ |
) |
481 |
+ |
AC_TRANSLATE_DEFINE(HAVE_MMAP_ANON, "$ac_cv_mmap_anon") |
482 |
+ |
|
483 |
+ |
AC_CACHE_CHECK("whether mmap supports MAP_ANONYMOUS", |
484 |
+ |
ac_cv_mmap_anonymous, [ |
485 |
+ |
AC_LANG_SAVE |
486 |
+ |
AC_LANG_CPLUSPLUS |
487 |
+ |
AC_TRY_RUN([ |
488 |
+ |
#define HAVE_MMAP_ANONYMOUS |
489 |
+ |
#define CONFIGURE_TEST_VM_MAP |
490 |
+ |
#define TEST_VM_MMAP_ANON |
491 |
+ |
#include "vm_alloc.cpp" |
492 |
+ |
], ac_cv_mmap_anonymous=yes, ac_cv_mmap_anonymous=no, |
493 |
+ |
dnl When cross-compiling, do not assume anything. |
494 |
+ |
ac_cv_mmap_anonymous="guessing no" |
495 |
+ |
) |
496 |
+ |
AC_LANG_RESTORE |
497 |
+ |
] |
498 |
+ |
) |
499 |
+ |
AC_TRANSLATE_DEFINE(HAVE_MMAP_ANONYMOUS, "$ac_cv_mmap_anonymous") |
500 |
+ |
|
501 |
+ |
AC_CACHE_CHECK("whether mprotect works", |
502 |
+ |
ac_cv_mprotect_works, [ |
503 |
+ |
AC_LANG_SAVE |
504 |
+ |
AC_LANG_CPLUSPLUS |
505 |
+ |
ac_cv_mprotect_works=yes |
506 |
+ |
dnl First the tests that should segfault |
507 |
+ |
for test_def in NONE_READ NONE_WRITE READ_WRITE; do |
508 |
+ |
AC_TRY_RUN([ |
509 |
+ |
#define CONFIGURE_TEST_VM_MAP |
510 |
+ |
#define TEST_VM_PROT_$test_def |
511 |
+ |
#include "vm_alloc.cpp" |
512 |
+ |
], ac_cv_mprotect_works=no, rm -f core, |
513 |
+ |
dnl When cross-compiling, do not assume anything |
514 |
+ |
ac_cv_mprotect_works="guessing no" |
515 |
+ |
) |
516 |
+ |
done |
517 |
+ |
AC_TRY_RUN([ |
518 |
+ |
#define CONFIGURE_TEST_VM_MAP |
519 |
+ |
#define TEST_VM_PROT_RDWR_WRITE |
520 |
+ |
#include "vm_alloc.cpp" |
521 |
+ |
], , ac_cv_mprotect_works=no, |
522 |
+ |
dnl When cross-compiling, do not assume anything |
523 |
+ |
ac_cv_mprotect_works="guessing no" |
524 |
+ |
) |
525 |
+ |
AC_LANG_RESTORE |
526 |
+ |
] |
527 |
+ |
) |
528 |
+ |
|
529 |
+ |
dnl Remove support for mmap() if mprotect() does not work |
530 |
+ |
if [[ "x$have_mmap_vm" = "xyes" ]]; then |
531 |
+ |
case $ac_cv_mprotect_works in |
532 |
+ |
*yes) have_mmap_vm=yes;; |
533 |
+ |
*no) have_mmap_vm=no;; |
534 |
+ |
esac |
535 |
+ |
fi |
536 |
+ |
AC_TRANSLATE_DEFINE(HAVE_MMAP_VM, $have_mmap_vm) |
537 |
+ |
|
538 |
+ |
fi dnl HAVE_MMAP_VM |
539 |
+ |
|
540 |
+ |
dnl Check if we can mmap 0x2000 bytes from 0x0000 |
541 |
+ |
AC_CACHE_CHECK("whether we can map Low Memory area 0x0000-0x2000", |
542 |
+ |
ac_cv_can_map_lm, [ |
543 |
+ |
AC_LANG_SAVE |
544 |
+ |
AC_LANG_CPLUSPLUS |
545 |
+ |
AC_TRY_RUN([ |
546 |
+ |
#include "vm_alloc.cpp" |
547 |
+ |
int main(void) { /* returns 0 if we could map the lowmem globals */ |
548 |
+ |
volatile char * lm; |
549 |
+ |
if (vm_init() < 0) exit(1); |
550 |
+ |
if ((lm = (volatile char *)vm_acquire_fixed(0, 0x2000)) == VM_MAP_FAILED) exit(1); |
551 |
+ |
lm[0] = 'z'; |
552 |
+ |
if (vm_release((char *)lm, 0x2000) < 0) exit(1); |
553 |
+ |
vm_exit(); exit(0); |
554 |
+ |
} |
555 |
+ |
], ac_cv_can_map_lm=yes, ac_cv_can_map_lm=no, |
556 |
+ |
dnl When cross-compiling, do not assume anything. |
557 |
+ |
ac_cv_can_map_lm="guessing no" |
558 |
+ |
) |
559 |
+ |
AC_LANG_RESTORE |
560 |
+ |
] |
561 |
+ |
) |
562 |
+ |
|
563 |
+ |
dnl Check signal handlers need to be reinstalled |
564 |
+ |
AC_CACHE_CHECK("whether signal handlers need to be reinstalled", |
565 |
+ |
ac_cv_signal_need_reinstall, [ |
566 |
+ |
AC_LANG_SAVE |
567 |
+ |
AC_LANG_CPLUSPLUS |
568 |
+ |
AC_TRY_RUN([ |
569 |
+ |
#include <stdlib.h> |
570 |
+ |
#ifdef HAVE_UNISTD_H |
571 |
+ |
#include <unistd.h> |
572 |
+ |
#endif |
573 |
+ |
#include <signal.h> |
574 |
+ |
static int handled_signal = 0; |
575 |
+ |
RETSIGTYPE sigusr1_handler(int) { handled_signal++; } |
576 |
+ |
int main(void) { /* returns 0 if signals need not to be reinstalled */ |
577 |
+ |
signal(SIGUSR1, sigusr1_handler); raise(SIGUSR1); raise(SIGUSR1); |
578 |
+ |
exit(handled_signal == 2); |
579 |
+ |
} |
580 |
+ |
], ac_cv_signal_need_reinstall=yes, ac_cv_signal_need_reinstall=no, |
581 |
+ |
dnl When cross-compiling, do not assume anything. |
582 |
+ |
ac_cv_signal_need_reinstall="guessing yes" |
583 |
+ |
) |
584 |
+ |
AC_LANG_RESTORE |
585 |
+ |
] |
586 |
+ |
) |
587 |
+ |
AC_TRANSLATE_DEFINE(SIGNAL_NEED_REINSTALL, "$ac_cv_signal_need_reinstall") |
588 |
+ |
|
589 |
+ |
dnl Check if sigaction handlers need to be reinstalled |
590 |
+ |
AC_CACHE_CHECK("whether sigaction handlers need to be reinstalled", |
591 |
+ |
ac_cv_sigaction_need_reinstall, [ |
592 |
+ |
AC_LANG_SAVE |
593 |
+ |
AC_LANG_CPLUSPLUS |
594 |
+ |
AC_TRY_RUN([ |
595 |
+ |
#include <stdlib.h> |
596 |
+ |
#ifdef HAVE_UNISTD_H |
597 |
+ |
#include <unistd.h> |
598 |
+ |
#endif |
599 |
+ |
#include <signal.h> |
600 |
+ |
static int handled_signal = 0; |
601 |
+ |
RETSIGTYPE sigusr1_handler(int) { handled_signal++; } |
602 |
+ |
typedef RETSIGTYPE (*signal_handler)(int); |
603 |
+ |
static signal_handler mysignal(int sig, signal_handler handler) { |
604 |
+ |
struct sigaction old_sa; |
605 |
+ |
struct sigaction new_sa; |
606 |
+ |
new_sa.sa_handler = handler; |
607 |
+ |
return ((sigaction(sig,&new_sa,&old_sa) < 0) ? SIG_IGN : old_sa.sa_handler); |
608 |
+ |
} |
609 |
+ |
int main(void) { /* returns 0 if signals need not to be reinstalled */ |
610 |
+ |
mysignal(SIGUSR1, sigusr1_handler); raise(SIGUSR1); raise(SIGUSR1); |
611 |
+ |
exit(handled_signal == 2); |
612 |
+ |
} |
613 |
+ |
], ac_cv_sigaction_need_reinstall=yes, ac_cv_sigaction_need_reinstall=no, |
614 |
+ |
dnl When cross-compiling, do not assume anything. |
615 |
+ |
ac_cv_sigaction_need_reinstall="guessing yes" |
616 |
+ |
) |
617 |
+ |
AC_LANG_RESTORE |
618 |
+ |
] |
619 |
+ |
) |
620 |
+ |
AC_TRANSLATE_DEFINE(SIGACTION_NEED_REINSTALL, "$ac_cv_sigaction_need_reinstall") |
621 |
+ |
|
622 |
+ |
dnl Check if extended signals are supported. |
623 |
+ |
AC_CACHE_CHECK("whether your system supports extended signal handlers", |
624 |
+ |
ac_cv_have_extended_signals, [ |
625 |
+ |
AC_LANG_SAVE |
626 |
+ |
AC_LANG_CPLUSPLUS |
627 |
+ |
AC_TRY_RUN([ |
628 |
+ |
#define HAVE_SIGINFO_T 1 |
629 |
+ |
#define CONFIGURE_TEST_SIGSEGV_RECOVERY |
630 |
+ |
#include "vm_alloc.cpp" |
631 |
+ |
#include "sigsegv.cpp" |
632 |
+ |
], ac_cv_have_extended_signals=yes, ac_cv_have_extended_signals=no, |
633 |
+ |
dnl When cross-compiling, do not assume anything. |
634 |
+ |
ac_cv_have_extended_signals=no |
635 |
+ |
) |
636 |
+ |
AC_LANG_RESTORE |
637 |
+ |
] |
638 |
+ |
) |
639 |
+ |
AC_TRANSLATE_DEFINE(HAVE_SIGINFO_T, "$ac_cv_have_extended_signals") |
640 |
+ |
|
641 |
+ |
dnl Otherwise, check for subterfuges. |
642 |
+ |
if [[ "x$ac_cv_have_extended_signals" = "xno" ]]; then |
643 |
+ |
AC_CACHE_CHECK("whether we then have a subterfuge for your system", |
644 |
+ |
ac_cv_have_sigcontext_hack, [ |
645 |
+ |
AC_LANG_SAVE |
646 |
+ |
AC_LANG_CPLUSPLUS |
647 |
+ |
AC_TRY_RUN([ |
648 |
+ |
#define HAVE_SIGCONTEXT_SUBTERFUGE 1 |
649 |
+ |
#define CONFIGURE_TEST_SIGSEGV_RECOVERY |
650 |
+ |
#include "vm_alloc.cpp" |
651 |
+ |
#include "sigsegv.cpp" |
652 |
+ |
], ac_cv_have_sigcontext_hack=yes, ac_cv_have_sigcontext_hack=no, |
653 |
+ |
dnl When cross-compiling, do not assume anything. |
654 |
+ |
ac_cv_have_sigcontext_hack=no |
655 |
+ |
) |
656 |
+ |
AC_LANG_RESTORE |
657 |
+ |
]) |
658 |
+ |
AC_TRANSLATE_DEFINE(HAVE_SIGCONTEXT_SUBTERFUGE, "$ac_cv_have_sigcontext_hack") |
659 |
+ |
fi |
660 |
+ |
|
661 |
+ |
dnl Check if we can ignore the fault (instruction skipping in SIGSEGV handler) |
662 |
+ |
AC_CACHE_CHECK("whether we can skip instruction in SIGSEGV handler", |
663 |
+ |
ac_cv_have_skip_instruction, [ |
664 |
+ |
AC_LANG_SAVE |
665 |
+ |
AC_LANG_CPLUSPLUS |
666 |
+ |
AC_TRY_RUN([ |
667 |
+ |
#define HAVE_SIGSEGV_SKIP_INSTRUCTION 1 |
668 |
+ |
#define CONFIGURE_TEST_SIGSEGV_RECOVERY |
669 |
+ |
#include "vm_alloc.cpp" |
670 |
+ |
#include "sigsegv.cpp" |
671 |
+ |
], ac_cv_have_skip_instruction=yes, ac_cv_have_skip_instruction=no, |
672 |
+ |
dnl When cross-compiling, do not assume anything. |
673 |
+ |
ac_cv_have_skip_instruction=no |
674 |
+ |
) |
675 |
+ |
AC_LANG_RESTORE |
676 |
+ |
] |
677 |
+ |
) |
678 |
+ |
AC_TRANSLATE_DEFINE(HAVE_SIGSEGV_SKIP_INSTRUCTION, "$ac_cv_have_skip_instruction") |
679 |
+ |
|
680 |
+ |
dnl Can we do Video on SEGV Signals ? |
681 |
+ |
CAN_VOSF=no |
682 |
+ |
if [[ "$ac_cv_have_extended_signals" = "yes" -o "$ac_cv_have_sigcontext_hack" = "yes" ]]; then |
683 |
+ |
CAN_VOSF=yes |
684 |
+ |
fi |
685 |
+ |
|
686 |
+ |
dnl Determine the addressing mode to use |
687 |
+ |
if [[ "x$WANT_NATIVE_M68K" = "xyes" ]]; then |
688 |
+ |
ADDRESSING_MODE="real" |
689 |
+ |
else |
690 |
+ |
ADDRESSING_MODE="" |
691 |
+ |
AC_MSG_CHECKING([for the addressing mode to use]) |
692 |
+ |
for am in $ADDRESSING_TEST_ORDER; do |
693 |
+ |
case $am in |
694 |
+ |
real) |
695 |
+ |
dnl Requires ability to mmap() Low Memory globals |
696 |
+ |
if [[ "x$ac_cv_can_map_lm" = "xno" ]]; then |
697 |
+ |
continue |
698 |
+ |
fi |
699 |
+ |
dnl Requires VOSF screen updates |
700 |
+ |
if [[ "x$CAN_VOSF" = "xno" ]]; then |
701 |
+ |
continue |
702 |
+ |
fi |
703 |
+ |
dnl Real addressing will probably work. |
704 |
+ |
ADDRESSING_MODE="real" |
705 |
+ |
WANT_VOSF=yes dnl we can use VOSF and we need it actually |
706 |
+ |
DEFINES="$DEFINES -DREAL_ADDRESSING" |
707 |
+ |
break |
708 |
+ |
;; |
709 |
+ |
direct) |
710 |
+ |
dnl Requires VOSF screen updates |
711 |
+ |
if [[ "x$CAN_VOSF" = "xyes" ]]; then |
712 |
+ |
ADDRESSING_MODE="direct" |
713 |
+ |
WANT_VOSF=yes dnl we can use VOSF and we need it actually |
714 |
+ |
DEFINES="$DEFINES -DDIRECT_ADDRESSING" |
715 |
+ |
break |
716 |
+ |
fi |
717 |
+ |
;; |
718 |
+ |
banks) |
719 |
+ |
dnl Default addressing mode |
720 |
+ |
ADDRESSING_MODE="memory banks" |
721 |
+ |
break |
722 |
+ |
;; |
723 |
+ |
*) |
724 |
+ |
AC_MSG_ERROR([Internal configure.in script error for $am addressing mode]) |
725 |
+ |
esac |
726 |
+ |
done |
727 |
+ |
AC_MSG_RESULT($ADDRESSING_MODE) |
728 |
+ |
if [[ "x$ADDRESSING_MODE" = "x" ]]; then |
729 |
+ |
AC_MSG_WARN([Sorry, no suitable addressing mode in $ADDRESSING_TEST_ORDER]) |
730 |
+ |
ADDRESSING_MODE="memory banks" |
731 |
+ |
fi |
732 |
+ |
fi |
733 |
+ |
|
734 |
+ |
dnl Enable VOSF screen updates with this feature is requested and feasible |
735 |
+ |
if [[ "x$WANT_VOSF" = "xyes" -a "x$CAN_VOSF" = "xyes" ]]; then |
736 |
+ |
AC_DEFINE(ENABLE_VOSF) |
737 |
+ |
else |
738 |
+ |
WANT_VOSF=no |
739 |
+ |
fi |
740 |
+ |
|
741 |
|
dnl Check for GAS. |
742 |
|
HAVE_GAS=no |
743 |
|
AC_MSG_CHECKING(for GAS .p2align feature) |
757 |
|
#endif |
758 |
|
], [AC_MSG_RESULT(yes); HAVE_GCC27=yes], AC_MSG_RESULT(no)) |
759 |
|
|
760 |
+ |
dnl Check for GCC 3.0 or higher. |
761 |
+ |
HAVE_GCC30=no |
762 |
+ |
AC_MSG_CHECKING(for GCC 3.0 or higher) |
763 |
+ |
AC_EGREP_CPP(yes, |
764 |
+ |
[#if __GNUC__ >= 3 |
765 |
+ |
yes |
766 |
+ |
#endif |
767 |
+ |
], [AC_MSG_RESULT(yes); HAVE_GCC30=yes], AC_MSG_RESULT(no)) |
768 |
+ |
|
769 |
|
dnl Set "-fomit-frame-pointer" on i386 GCC 2.7 or higher. |
770 |
+ |
dnl Also set "-fno-exceptions" for C++ because exception handling requires |
771 |
+ |
dnl the frame pointer. |
772 |
|
if [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_I386" = "xyes" ]]; then |
773 |
|
CFLAGS="$CFLAGS -fomit-frame-pointer" |
774 |
< |
CXXFLAGS="$CXXFLAGS -fomit-frame-pointer" |
774 |
> |
CXXFLAGS="$CXXFLAGS -fomit-frame-pointer -fno-exceptions" |
775 |
> |
fi |
776 |
> |
|
777 |
> |
dnl (gb) Do not merge constants since it breaks fpu/fpu_x86.cpp. |
778 |
> |
dnl As of 2001/08/02, this affects the following compilers: |
779 |
> |
dnl Official: probably gcc-3.1 (mainline CVS) |
780 |
> |
dnl Mandrake: gcc-2.96 >= 0.59mdk, gcc-3.0.1 >= 0.1mdk |
781 |
> |
dnl Red Hat : gcc-2.96 >= 89, gcc-3.0 >= 1 |
782 |
> |
if [[ "x$HAVE_GCC27" = "xyes" ]]; then |
783 |
> |
SAVED_CXXFLAGS="$CXXFLAGS" |
784 |
> |
CXXFLAGS="$CXXFLAGS -fno-merge-constants" |
785 |
> |
AC_CACHE_CHECK([whether GCC supports constants merging], ac_cv_gcc_constants_merging, [ |
786 |
> |
AC_LANG_SAVE |
787 |
> |
AC_LANG_CPLUSPLUS |
788 |
> |
AC_TRY_COMPILE([],[],[ac_cv_gcc_constants_merging=yes],[ac_cv_gcc_constants_merging=no]) |
789 |
> |
AC_LANG_RESTORE |
790 |
> |
]) |
791 |
> |
if [[ "x$ac_cv_gcc_constants_merging" != "xyes" ]]; then |
792 |
> |
CXXFLAGS="$SAVED_CXXFLAGS" |
793 |
> |
fi |
794 |
|
fi |
795 |
|
|
796 |
|
dnl Select appropriate CPU source and REGPARAM define. |
797 |
< |
WANT_X86_ASSEMBLY=no |
289 |
< |
WANT_SPARC_V8_ASSEMBLY=no |
290 |
< |
WANT_SPARC_V9_ASSEMBLY=no |
291 |
< |
WANT_NATIVE_M68K=no |
797 |
> |
ASM_OPTIMIZATIONS=none |
798 |
|
CPUSRCS="cpuemu1.cpp cpuemu2.cpp cpuemu3.cpp cpuemu4.cpp cpuemu5.cpp cpuemu6.cpp cpuemu7.cpp cpuemu8.cpp" |
799 |
< |
if [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_I386" = "xyes" ]]; then |
799 |
> |
if [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_I386" = "xyes" -a "x$OS_TYPE" != "xfreebsd" ]]; then |
800 |
|
dnl i386 CPU |
801 |
|
DEFINES="$DEFINES -DREGPARAM=\"__attribute__((regparm(3)))\"" |
802 |
|
if [[ "x$HAVE_GAS" = "xyes" ]]; then |
803 |
< |
WANT_X86_ASSEMBLY=yes |
804 |
< |
DEFINES="$DEFINES -DX86_ASSEMBLY" |
805 |
< |
CPUSRCS="../uae_cpu/compiler.cpp cpufast1.s cpufast2.s cpufast3.s cpufast4.s cpufast5.s cpufast6.s cpufast7.s cpufast8.s" |
803 |
> |
ASM_OPTIMIZATIONS=i386 |
804 |
> |
DEFINES="$DEFINES -DX86_ASSEMBLY -DUNALIGNED_PROFITABLE -DOPTIMIZED_FLAGS" |
805 |
> |
CPUSRCS="cpufast1.s cpufast2.s cpufast3.s cpufast4.s cpufast5.s cpufast6.s cpufast7.s cpufast8.s" |
806 |
|
fi |
807 |
|
elif [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_SPARC" = "xyes" -a "x$HAVE_GAS" = "xyes" ]]; then |
808 |
|
dnl SPARC CPU |
809 |
< |
case "$MACHINE" in |
810 |
< |
SunOS*) |
809 |
> |
case "$target_os" in |
810 |
> |
solaris*) |
811 |
|
AC_MSG_CHECKING(SPARC CPU architecture) |
812 |
|
SPARC_TYPE=`Solaris/which_sparc` |
813 |
|
AC_MSG_RESULT($SPARC_TYPE) |
814 |
|
case "$SPARC_TYPE" in |
815 |
|
SPARC_V8) |
816 |
< |
WANT_SPARC_V8_ASSEMBLY=yes |
817 |
< |
DEFINES="$DEFINES -DSPARC_V8_ASSEMBLY" |
816 |
> |
ASM_OPTIMIZATIONS="SPARC V8 architecture" |
817 |
> |
DEFINES="$DEFINES -DSPARC_V8_ASSEMBLY" dnl -DOPTIMIZED_FLAGS" |
818 |
|
CFLAGS="$CFLAGS -Wa,-Av8" |
819 |
|
CXXFLAGS="$CXXFLAGS -Wa,-Av8" |
820 |
|
;; |
821 |
|
SPARC_V9) |
822 |
< |
WANT_SPARC_V9_ASSEMBLY=yes |
823 |
< |
DEFINES="$DEFINES -DSPARC_V9_ASSEMBLY" |
822 |
> |
ASM_OPTIMIZATIONS="SPARC V9 architecture" |
823 |
> |
DEFINES="$DEFINES -DSPARC_V9_ASSEMBLY" dnl -DOPTIMIZED_FLAGS" |
824 |
|
CFLAGS="$CFLAGS -Wa,-Av9" |
825 |
|
CXXFLAGS="$CXXFLAGS -Wa,-Av9" |
826 |
|
;; |
827 |
|
esac |
828 |
|
;; |
829 |
|
esac |
830 |
< |
elif [[ "x$HAVE_M68K" = "xyes" -a "x$SUPPORTS_NATIVE_M68K" = "xyes" ]]; then |
830 |
> |
elif [[ "x$WANT_NATIVE_M68K" = "xyes" ]]; then |
831 |
|
dnl Native m68k, no emulation |
832 |
< |
CPUSRCS="" |
833 |
< |
AC_DEFINE(ENABLE_NATIVE_M68K) |
834 |
< |
WANT_NATIVE_M68K=yes |
832 |
> |
CPUINCLUDES="-I../native_cpu" |
833 |
> |
CPUSRCS="asm_support.s" |
834 |
> |
fi |
835 |
> |
|
836 |
> |
dnl Utility macro used by next two tests. |
837 |
> |
dnl AC_EXAMINE_OBJECT(C source code, |
838 |
> |
dnl commands examining object file, |
839 |
> |
dnl [commands to run if compile failed]): |
840 |
> |
dnl |
841 |
> |
dnl Compile the source code to an object file; then convert it into a |
842 |
> |
dnl printable representation. All unprintable characters and |
843 |
> |
dnl asterisks (*) are replaced by dots (.). All white space is |
844 |
> |
dnl deleted. Newlines (ASCII 0x10) in the input are preserved in the |
845 |
> |
dnl output, but runs of newlines are compressed to a single newline. |
846 |
> |
dnl Finally, line breaks are forcibly inserted so that no line is |
847 |
> |
dnl longer than 80 columns and the file ends with a newline. The |
848 |
> |
dnl result of all this processing is in the file conftest.dmp, which |
849 |
> |
dnl may be examined by the commands in the second argument. |
850 |
> |
dnl |
851 |
> |
AC_DEFUN([gcc_AC_EXAMINE_OBJECT], |
852 |
> |
[AC_LANG_SAVE |
853 |
> |
AC_LANG_C |
854 |
> |
dnl Next bit cribbed from AC_TRY_COMPILE. |
855 |
> |
cat > conftest.$ac_ext <<EOF |
856 |
> |
[#line __oline__ "configure" |
857 |
> |
#include "confdefs.h" |
858 |
> |
$1 |
859 |
> |
]EOF |
860 |
> |
if AC_TRY_EVAL(ac_compile); then |
861 |
> |
od -c conftest.o | |
862 |
> |
sed ['s/^[0-7]*[ ]*/ / |
863 |
> |
s/\*/./g |
864 |
> |
s/ \\n/*/g |
865 |
> |
s/ [0-9][0-9][0-9]/./g |
866 |
> |
s/ \\[^ ]/./g'] | |
867 |
> |
tr -d ' |
868 |
> |
' | tr -s '*' ' |
869 |
> |
' | fold | sed '$a\ |
870 |
> |
' > conftest.dmp |
871 |
> |
$2 |
872 |
> |
ifelse($3, , , else |
873 |
> |
$3 |
874 |
> |
)dnl |
875 |
> |
fi |
876 |
> |
rm -rf conftest* |
877 |
> |
AC_LANG_RESTORE]) |
878 |
> |
|
879 |
> |
dnl Floating point format probe. |
880 |
> |
dnl The basic concept is the same as the above: grep the object |
881 |
> |
dnl file for an interesting string. We have to watch out for |
882 |
> |
dnl rounding changing the values in the object, however; this is |
883 |
> |
dnl handled by ignoring the least significant byte of the float. |
884 |
> |
dnl |
885 |
> |
dnl Does not know about VAX G-float or C4x idiosyncratic format. |
886 |
> |
dnl It does know about PDP-10 idiosyncratic format, but this is |
887 |
> |
dnl not presently supported by GCC. S/390 "binary floating point" |
888 |
> |
dnl is in fact IEEE (but maybe we should have that in EBCDIC as well |
889 |
> |
dnl as ASCII?) |
890 |
> |
dnl |
891 |
> |
AC_DEFUN([gcc_AC_C_FLOAT_FORMAT], |
892 |
> |
[AC_CACHE_CHECK(floating point format, ac_cv_c_float_format, |
893 |
> |
[gcc_AC_EXAMINE_OBJECT( |
894 |
> |
[/* This will not work unless sizeof(double) == 8. */ |
895 |
> |
extern char sizeof_double_must_be_8 [sizeof(double) == 8 ? 1 : -1]; |
896 |
> |
|
897 |
> |
/* This structure must have no internal padding. */ |
898 |
> |
struct possibility { |
899 |
> |
char prefix[8]; |
900 |
> |
double candidate; |
901 |
> |
char postfix[8]; |
902 |
> |
}; |
903 |
> |
|
904 |
> |
#define C(cand) { "\nformat:", cand, ":tamrof\n" } |
905 |
> |
struct possibility table [] = |
906 |
> |
{ |
907 |
> |
C( 3.25724264705901305206e+01), /* @@IEEEFP - IEEE 754 */ |
908 |
> |
C( 3.53802595280598432000e+18), /* D__float - VAX */ |
909 |
> |
C( 5.32201830133125317057e-19), /* D.PDP-10 - PDP-10 - the dot is 0x13a */ |
910 |
> |
C( 1.77977764695171661377e+10), /* IBMHEXFP - s/390 format, ascii */ |
911 |
> |
C(-5.22995989424860458374e+10) /* IBMHEXFP - s/390 format, EBCDIC */ |
912 |
> |
};], |
913 |
> |
[if grep 'format:.@IEEEF.:tamrof' conftest.dmp >/dev/null 2>&1; then |
914 |
> |
ac_cv_c_float_format='IEEE (big-endian)' |
915 |
> |
elif grep 'format:.I@@PFE.:tamrof' conftest.dmp >/dev/null 2>&1; then |
916 |
> |
ac_cv_c_float_format='IEEE (big-endian)' |
917 |
> |
elif grep 'format:.FEEEI@.:tamrof' conftest.dmp >/dev/null 2>&1; then |
918 |
> |
ac_cv_c_float_format='IEEE (little-endian)' |
919 |
> |
elif grep 'format:.EFP@@I.:tamrof' conftest.dmp >/dev/null 2>&1; then |
920 |
> |
ac_cv_c_float_format='IEEE (little-endian)' |
921 |
> |
elif grep 'format:.__floa.:tamrof' conftest.dmp >/dev/null 2>&1; then |
922 |
> |
ac_cv_c_float_format='VAX D-float' |
923 |
> |
elif grep 'format:..PDP-1.:tamrof' conftest.dmp >/dev/null 2>&1; then |
924 |
> |
ac_cv_c_float_format='PDP-10' |
925 |
> |
elif grep 'format:.BMHEXF.:tamrof' conftest.dmp >/dev/null 2>&1; then |
926 |
> |
ac_cv_c_float_format='IBM 370 hex' |
927 |
> |
else |
928 |
> |
AC_MSG_ERROR(Unknown floating point format) |
929 |
> |
fi], |
930 |
> |
[AC_MSG_ERROR(compile failed)]) |
931 |
> |
]) |
932 |
> |
# IEEE is the default format. If the float endianness isn't the same |
933 |
> |
# as the integer endianness, we have to set FLOAT_WORDS_BIG_ENDIAN |
934 |
> |
# (which is a tristate: yes, no, default). This is only an issue with |
935 |
> |
# IEEE; the other formats are only supported by a few machines each, |
936 |
> |
# all with the same endianness. |
937 |
> |
format=IEEE_FLOAT_FORMAT |
938 |
> |
fbigend= |
939 |
> |
case $ac_cv_c_float_format in |
940 |
> |
'IEEE (big-endian)' ) |
941 |
> |
if test $ac_cv_c_bigendian = no; then |
942 |
> |
fbigend=1 |
943 |
> |
fi |
944 |
> |
;; |
945 |
> |
'IEEE (little-endian)' ) |
946 |
> |
if test $ac_cv_c_bigendian = yes; then |
947 |
> |
fbigend=0 |
948 |
> |
fi |
949 |
> |
;; |
950 |
> |
'VAX D-float' ) |
951 |
> |
format=VAX_FLOAT_FORMAT |
952 |
> |
;; |
953 |
> |
'PDP-10' ) |
954 |
> |
format=PDP10_FLOAT_FORMAT |
955 |
> |
;; |
956 |
> |
'IBM 370 hex' ) |
957 |
> |
format=IBM_FLOAT_FORMAT |
958 |
> |
;; |
959 |
> |
esac |
960 |
> |
AC_DEFINE_UNQUOTED(HOST_FLOAT_FORMAT, $format, |
961 |
> |
[Define to the floating point format of the host machine.]) |
962 |
> |
if test -n "$fbigend"; then |
963 |
> |
AC_DEFINE_UNQUOTED(HOST_FLOAT_WORDS_BIG_ENDIAN, $fbigend, |
964 |
> |
[Define to 1 if the host machine stores floating point numbers in |
965 |
> |
memory with the word containing the sign bit at the lowest address, |
966 |
> |
or to 0 if it does it the other way around. |
967 |
> |
|
968 |
> |
This macro should not be defined if the ordering is the same as for |
969 |
> |
multi-word integers.]) |
970 |
> |
fi |
971 |
> |
]) |
972 |
> |
|
973 |
> |
dnl Select appropriate FPU source. |
974 |
> |
gcc_AC_C_FLOAT_FORMAT |
975 |
> |
AC_CHECK_HEADERS(ieee754.h ieeefp.h floatingpoint.h nan.h) |
976 |
> |
|
977 |
> |
for fpe in $FPE_CORE_TEST_ORDER; do |
978 |
> |
case $fpe in |
979 |
> |
ieee) |
980 |
> |
if echo "$ac_cv_c_float_format" | grep -q IEEE; then |
981 |
> |
FPE_CORE="IEEE fpu core" |
982 |
> |
DEFINES="$DEFINES -DFPU_IEEE" |
983 |
> |
FPUSRCS="../uae_cpu/fpu/fpu_ieee.cpp" |
984 |
> |
break |
985 |
> |
fi |
986 |
> |
;; |
987 |
> |
x86) |
988 |
> |
if [[ ":$HAVE_GCC27:$HAVE_I386:$HAVE_GAS:" = ":yes:yes:yes:" ]]; then |
989 |
> |
FPE_CORE="i387 fpu core" |
990 |
> |
DEFINES="$DEFINES -DFPU_X86" |
991 |
> |
FPUSRCS="../uae_cpu/fpu/fpu_x86.cpp" |
992 |
> |
break |
993 |
> |
fi |
994 |
> |
;; |
995 |
> |
uae) |
996 |
> |
FPE_CORE="uae fpu core" |
997 |
> |
DEFINES="$DEFINES -DFPU_UAE" |
998 |
> |
FPUSRCS="../uae_cpu/fpu/fpu_uae.cpp" |
999 |
> |
break |
1000 |
> |
;; |
1001 |
> |
*) |
1002 |
> |
AC_MSG_ERROR([Internal configure.in script error for $fpe fpu core]) |
1003 |
> |
;; |
1004 |
> |
esac |
1005 |
> |
done |
1006 |
> |
if [[ "x$FPE_CORE" = "x" ]]; then |
1007 |
> |
AC_MSG_ERROR([Sorry, no suitable FPU core found in $FPE_CORE_TEST_ORDER]) |
1008 |
|
fi |
1009 |
|
|
1010 |
+ |
dnl Check for certain math functions |
1011 |
+ |
AC_CHECK_FUNCS(atanh) |
1012 |
+ |
AC_CHECK_FUNCS(isnan isinf) dnl C99 |
1013 |
+ |
AC_CHECK_FUNCS(isnanl isinfl) dnl IEEE ? |
1014 |
+ |
|
1015 |
|
dnl UAE CPU sources for all non-m68k-native architectures. |
1016 |
|
if [[ "x$WANT_NATIVE_M68K" = "xno" ]]; then |
1017 |
< |
CPUINCLUDES="-I../cpu_cpu" |
1018 |
< |
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" |
1019 |
< |
else |
1020 |
< |
CPUINCLUDES="-I../native_cpu" |
1021 |
< |
CPUSRCS="asm_support.s" |
1017 |
> |
CPUINCLUDES="-I../uae_cpu" |
1018 |
> |
CPUSRCS="../uae_cpu/basilisk_glue.cpp ../uae_cpu/memory.cpp ../uae_cpu/newcpu.cpp ../uae_cpu/readcpu.cpp $FPUSRCS cpustbl.cpp cpudefs.cpp $CPUSRCS" |
1019 |
> |
fi |
1020 |
> |
|
1021 |
> |
dnl Remove the "-g" option if set for GCC. |
1022 |
> |
if [[ "x$HAVE_GCC27" = "xyes" ]]; then |
1023 |
> |
CFLAGS=`echo $CFLAGS | sed -e 's/-g//g'` |
1024 |
> |
CXXFLAGS=`echo $CXXFLAGS | sed -e 's/-g//g'` |
1025 |
> |
fi |
1026 |
> |
|
1027 |
> |
dnl Or if we have -Ofast |
1028 |
> |
if [[ "x$HAVE_OFAST" = "xyes" ]]; then |
1029 |
> |
CFLAGS="`echo $CFLAGS | sed -e 's/-g//g'` -Ofast" |
1030 |
> |
CXXFLAGS="`echo $CXXFLAGS | sed -e 's/-g//g'` -Ofast" |
1031 |
> |
CXXFLAGS="-LANG:std $CXXFLAGS" |
1032 |
> |
LDFLAGS="$LDFLAGS -ipa" |
1033 |
|
fi |
1034 |
|
|
1035 |
|
dnl Generate Makefile. |
1043 |
|
echo |
1044 |
|
echo Basilisk II configuration summary: |
1045 |
|
echo |
1046 |
< |
echo XFree86 DGA support .............. : $WANT_XF86_DGA |
1047 |
< |
echo XFree86 VidMode support .......... : $WANT_XF86_VIDMODE |
1048 |
< |
echo fbdev DGA support ................ : $WANT_FBDEV_DGA |
1049 |
< |
echo ESD sound support ................ : $WANT_ESD |
1050 |
< |
echo GTK user interface ............... : $WANT_GTK |
1051 |
< |
echo mon debugger support ............. : $WANT_MON |
1052 |
< |
echo i386 assembly optimizations ...... : $WANT_X86_ASSEMBLY |
1053 |
< |
echo SPARC V8 assembly optimizations .. : $WANT_SPARC_V8_ASSEMBLY |
1054 |
< |
echo SPARC V9 assembly optimizations .. : $WANT_SPARC_V9_ASSEMBLY |
1055 |
< |
echo Running m68k code natively ....... : $WANT_NATIVE_M68K |
1046 |
> |
echo XFree86 DGA support .................... : $WANT_XF86_DGA |
1047 |
> |
echo XFree86 VidMode support ................ : $WANT_XF86_VIDMODE |
1048 |
> |
echo fbdev DGA support ...................... : $WANT_FBDEV_DGA |
1049 |
> |
echo Enable video on SEGV signals ........... : $WANT_VOSF |
1050 |
> |
echo ESD sound support ...................... : $WANT_ESD |
1051 |
> |
echo GTK user interface ..................... : $WANT_GTK |
1052 |
> |
echo mon debugger support ................... : $WANT_MON |
1053 |
> |
echo Running m68k code natively ............. : $WANT_NATIVE_M68K |
1054 |
> |
echo Floating-Point emulation core .......... : $FPE_CORE |
1055 |
> |
echo Assembly optimizations ................. : $ASM_OPTIMIZATIONS |
1056 |
> |
echo Addressing mode ........................ : $ADDRESSING_MODE |
1057 |
|
echo |
1058 |
|
echo "Configuration done. Now type \"make\" (or \"gmake\")." |