1 |
cebix |
1.1 |
dnl Process this file with autoconf to produce a configure script. |
2 |
cebix |
1.50 |
dnl Written in 2002 by Christian Bauer et al. |
3 |
cebix |
1.1 |
|
4 |
|
|
AC_INIT(main_unix.cpp) |
5 |
|
|
AC_PREREQ(2.12) |
6 |
|
|
AC_CONFIG_HEADER(config.h) |
7 |
|
|
|
8 |
|
|
dnl Options. |
9 |
cebix |
1.17 |
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 |
cebix |
1.42 |
AC_ARG_ENABLE(vosf, [ --enable-vosf enable video on SEGV signals [default=yes]], [WANT_VOSF=$enableval], [WANT_VOSF=yes]) |
13 |
gbeauche |
1.32 |
|
14 |
gbeauche |
1.35 |
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 |
gbeauche |
1.32 |
dnl Addressing modes. |
27 |
gbeauche |
1.23 |
AC_ARG_ENABLE(addressing, |
28 |
gbeauche |
1.32 |
[ --enable-addressing=AM specify the addressing mode to use [default=fastest]], |
29 |
gbeauche |
1.23 |
[ case "$enableval" in |
30 |
cebix |
1.24 |
real) ADDRESSING_TEST_ORDER="real";; |
31 |
|
|
direct) ADDRESSING_TEST_ORDER="direct";; |
32 |
|
|
banks) ADDRESSING_TEST_ORDER="banks";; |
33 |
gbeauche |
1.32 |
fastest)ADDRESSING_TEST_ORDER="direct banks";; |
34 |
|
|
*) AC_MSG_ERROR([--enable-addressing takes only one of the following values: fastest, real, direct, banks]);; |
35 |
gbeauche |
1.23 |
esac |
36 |
|
|
], |
37 |
|
|
[ ADDRESSING_TEST_ORDER="direct banks" |
38 |
|
|
]) |
39 |
gbeauche |
1.32 |
|
40 |
|
|
dnl External packages. |
41 |
cebix |
1.17 |
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]) |
44 |
cebix |
1.1 |
|
45 |
gbeauche |
1.23 |
dnl Canonical system information. |
46 |
|
|
AC_CANONICAL_HOST |
47 |
|
|
AC_CANONICAL_TARGET |
48 |
|
|
|
49 |
|
|
dnl Target OS type (target is host if not cross-compiling). |
50 |
|
|
case "$target_os" in |
51 |
|
|
linux*) OS_TYPE=linux;; |
52 |
|
|
netbsd*) OS_TYPE=netbsd;; |
53 |
|
|
freebsd*) OS_TYPE=freebsd;; |
54 |
|
|
solaris*) OS_TYPE=solaris;; |
55 |
gbeauche |
1.44 |
darwin*) OS_TYPE=darwin;; |
56 |
|
|
*) OS_TYPE=`echo $target_os | sed -e 's/-/_/g' | sed -e 's/\./_/g'`;; |
57 |
gbeauche |
1.23 |
esac |
58 |
|
|
DEFINES="$DEFINES -DOS_$OS_TYPE" |
59 |
|
|
|
60 |
|
|
dnl Target CPU type. |
61 |
|
|
HAVE_I386=no |
62 |
|
|
HAVE_M68K=no |
63 |
|
|
HAVE_SPARC=no |
64 |
cebix |
1.33 |
HAVE_POWERPC=no |
65 |
gbeauche |
1.23 |
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 |
cebix |
1.33 |
powerpc* ) CPU_TYPE=powerpc HAVE_POWERPC=yes;; |
70 |
gbeauche |
1.44 |
*) CPU_TYPE=`echo $target_cpu | sed -e 's/-/_/g'`;; |
71 |
gbeauche |
1.23 |
esac |
72 |
|
|
DEFINES="$DEFINES -DCPU_$CPU_TYPE" |
73 |
|
|
|
74 |
cebix |
1.1 |
dnl Checks for programs. |
75 |
|
|
AC_PROG_CC |
76 |
gbeauche |
1.23 |
AC_PROG_CC_C_O |
77 |
cebix |
1.4 |
AC_PROG_CPP |
78 |
cebix |
1.1 |
AC_PROG_CXX |
79 |
|
|
AC_PROG_MAKE_SET |
80 |
|
|
AC_PROG_INSTALL |
81 |
|
|
|
82 |
cebix |
1.11 |
dnl We use mon if possible. |
83 |
|
|
MONSRCS= |
84 |
cebix |
1.18 |
if [[ "x$WANT_MON" = "xyes" ]]; then |
85 |
|
|
AC_MSG_CHECKING(for mon) |
86 |
cebix |
1.24 |
mon_srcdir=../../../mon/src |
87 |
|
|
if grep mon_init $mon_srcdir/mon.h >/dev/null 2>/dev/null; then |
88 |
cebix |
1.18 |
AC_MSG_RESULT(yes) |
89 |
cebix |
1.19 |
AC_DEFINE(ENABLE_MON) |
90 |
cebix |
1.51 |
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 |
cebix |
1.24 |
CXXFLAGS="$CXXFLAGS -I$mon_srcdir -I$mon_srcdir/disass" |
92 |
gbeauche |
1.58 |
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 |
cebix |
1.18 |
AC_CHECK_LIB(readline, readline) |
99 |
cebix |
1.19 |
AC_CHECK_HEADERS(readline.h history.h readline/readline.h readline/history.h) |
100 |
cebix |
1.18 |
else |
101 |
|
|
AC_MSG_RESULT(no) |
102 |
|
|
AC_MSG_WARN([Could not find mon, ignoring --with-mon.]) |
103 |
|
|
WANT_MON=no |
104 |
|
|
fi |
105 |
cebix |
1.11 |
fi |
106 |
|
|
|
107 |
cebix |
1.1 |
dnl Checks for libraries. |
108 |
cebix |
1.10 |
AC_CHECK_LIB(posix4, sem_init) |
109 |
cebix |
1.45 |
AC_CHECK_LIB(rt, timer_create) |
110 |
cebix |
1.10 |
|
111 |
|
|
dnl We need X11. |
112 |
cebix |
1.1 |
AC_PATH_XTRA |
113 |
|
|
if [[ "x$no_x" = "xyes" ]]; then |
114 |
|
|
AC_MSG_ERROR([You need X11 to run Basilisk II.]) |
115 |
|
|
fi |
116 |
|
|
CFLAGS="$CFLAGS $X_CFLAGS" |
117 |
|
|
CXXFLAGS="$CXXFLAGS $X_CFLAGS" |
118 |
|
|
LIBS="$LIBS $X_PRE_LIBS $X_LIBS -lX11 -lXext $X_EXTRA_LIBS" |
119 |
|
|
|
120 |
cebix |
1.19 |
dnl We want pthreads. Try libpthread first, then libc_r (FreeBSD), then PTL. |
121 |
|
|
HAVE_PTHREADS=yes |
122 |
cebix |
1.10 |
AC_CHECK_LIB(pthread, pthread_create, , [ |
123 |
|
|
AC_CHECK_LIB(c_r, pthread_create, , [ |
124 |
|
|
AC_CHECK_LIB(PTL, pthread_create, , [ |
125 |
cebix |
1.19 |
HAVE_PTHREADS=no |
126 |
cebix |
1.10 |
]) |
127 |
|
|
]) |
128 |
|
|
]) |
129 |
cebix |
1.19 |
if [[ "x$HAVE_PTHREADS" = "xyes" ]]; then |
130 |
|
|
AC_DEFINE(HAVE_PTHREADS) |
131 |
|
|
fi |
132 |
|
|
AC_CHECK_FUNCS(pthread_cancel) |
133 |
cebix |
1.53 |
AC_CHECK_FUNCS(pthread_mutexattr_setprotocol) |
134 |
|
|
AC_CHECK_FUNCS(pthread_mutexattr_settype) |
135 |
cebix |
1.10 |
|
136 |
|
|
dnl If POSIX.4 semaphores are not available, we emulate them with pthread mutexes. |
137 |
cebix |
1.19 |
SEMSRC= |
138 |
cebix |
1.10 |
AC_CHECK_FUNCS(sem_init, , [ |
139 |
cebix |
1.26 |
if test "x$HAVE_PTHREADS" = "xyes"; then |
140 |
cebix |
1.19 |
SEMSRC=posix_sem.cpp |
141 |
|
|
fi |
142 |
cebix |
1.10 |
]) |
143 |
cebix |
1.1 |
|
144 |
cebix |
1.10 |
dnl We use DGA (XFree86 or fbdev) if possible. |
145 |
cebix |
1.8 |
if [[ "x$WANT_XF86_DGA" = "xyes" ]]; then |
146 |
cebix |
1.10 |
AC_CHECK_LIB(Xxf86dga, XF86DGAQueryExtension, [ |
147 |
cebix |
1.19 |
AC_DEFINE(ENABLE_XF86_DGA) |
148 |
cebix |
1.1 |
LIBS="$LIBS -lXxf86dga" |
149 |
cebix |
1.8 |
if [[ "x$WANT_FBDEV_DGA" = "xyes" ]]; then |
150 |
|
|
AC_MSG_WARN([Cannot have both --enable-xf86-dga and --enable-fbdev-dga, ignoring --enable-fbdev-dga.]) |
151 |
|
|
WANT_FBDEV_DGA=no |
152 |
|
|
fi |
153 |
cebix |
1.10 |
], [ |
154 |
|
|
AC_MSG_WARN([Could not find XFree86 DGA extension, ignoring --enable-xf86-dga.]) |
155 |
cebix |
1.13 |
WANT_XF86_DGA=no |
156 |
cebix |
1.10 |
]) |
157 |
cebix |
1.8 |
fi |
158 |
|
|
if [[ "x$WANT_FBDEV_DGA" = "xyes" ]]; then |
159 |
cebix |
1.19 |
AC_DEFINE(ENABLE_FBDEV_DGA) |
160 |
cebix |
1.1 |
fi |
161 |
|
|
|
162 |
cebix |
1.17 |
dnl We use XFree86 VidMode if possible. |
163 |
|
|
if [[ "x$WANT_XF86_VIDMODE" = "xyes" ]]; then |
164 |
|
|
AC_CHECK_LIB(Xxf86vm, XF86VidModeQueryExtension, [ |
165 |
cebix |
1.19 |
AC_DEFINE(ENABLE_XF86_VIDMODE) |
166 |
cebix |
1.17 |
LIBS="$LIBS -lXxf86vm" |
167 |
|
|
], [ |
168 |
|
|
AC_MSG_WARN([Could not find XFree86 VidMode extension, ignoring --enable-xf86-vidmode.]) |
169 |
|
|
WANT_XF86_VIDMODE=no |
170 |
|
|
]) |
171 |
|
|
fi |
172 |
|
|
|
173 |
cebix |
1.1 |
dnl We use GTK+ if possible. |
174 |
cebix |
1.10 |
UISRCS=../dummy/prefs_editor_dummy.cpp |
175 |
cebix |
1.14 |
if [[ "x$WANT_GTK" = "xyes" ]]; then |
176 |
cebix |
1.10 |
AM_PATH_GTK(1.2.0, [ |
177 |
cebix |
1.19 |
AC_DEFINE(ENABLE_GTK) |
178 |
cebix |
1.10 |
CXXFLAGS="$CXXFLAGS $GTK_CFLAGS" |
179 |
|
|
LIBS="$LIBS $GTK_LIBS" |
180 |
|
|
UISRCS=prefs_editor_gtk.cpp |
181 |
cebix |
1.52 |
B2_PATH_GNOMEUI([ |
182 |
|
|
AC_DEFINE(HAVE_GNOMEUI) |
183 |
|
|
CXXFLAGS="$CXXFLAGS $GNOMEUI_CFLAGS" |
184 |
|
|
LIBS="$LIBS $GNOMEUI_LIBS" |
185 |
|
|
], []) |
186 |
cebix |
1.10 |
], [ |
187 |
|
|
AC_MSG_WARN([Could not find GTK+, disabling user interface.]) |
188 |
cebix |
1.14 |
WANT_GTK=no |
189 |
cebix |
1.10 |
]) |
190 |
cebix |
1.1 |
fi |
191 |
|
|
|
192 |
cebix |
1.10 |
dnl We use ESD if possible. |
193 |
|
|
if [[ "x$WANT_ESD" = "xyes" ]]; then |
194 |
|
|
AM_PATH_ESD(0.2.8, [ |
195 |
cebix |
1.19 |
AC_DEFINE(ENABLE_ESD) |
196 |
cebix |
1.10 |
CFLAGS="$CFLAGS $ESD_CFLAGS" |
197 |
|
|
CXXFLAGS="$CXXFLAGS $ESD_CFLAGS" |
198 |
|
|
LIBS="$LIBS $ESD_LIBS" |
199 |
|
|
], [ |
200 |
|
|
AC_MSG_WARN([Could not find ESD, disabling ESD support.]) |
201 |
|
|
WANT_ESD=no |
202 |
|
|
]) |
203 |
gbeauche |
1.56 |
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 |
cebix |
1.1 |
fi |
211 |
|
|
|
212 |
|
|
dnl Checks for header files. |
213 |
|
|
AC_HEADER_STDC |
214 |
gbeauche |
1.44 |
AC_CHECK_HEADERS(unistd.h fcntl.h sys/time.h sys/mman.h) |
215 |
cebix |
1.1 |
|
216 |
|
|
dnl Checks for typedefs, structures, and compiler characteristics. |
217 |
|
|
AC_C_BIGENDIAN |
218 |
|
|
AC_C_CONST |
219 |
|
|
AC_C_INLINE |
220 |
|
|
AC_CHECK_SIZEOF(short, 2) |
221 |
|
|
AC_CHECK_SIZEOF(int, 4) |
222 |
|
|
AC_CHECK_SIZEOF(long, 4) |
223 |
|
|
AC_CHECK_SIZEOF(long long, 8) |
224 |
gbeauche |
1.23 |
AC_CHECK_SIZEOF(void *, 4) |
225 |
cebix |
1.1 |
AC_TYPE_OFF_T |
226 |
|
|
AC_CHECK_TYPE(loff_t, off_t) |
227 |
gbeauche |
1.55 |
AC_CHECK_TYPE(caddr_t, [char *]) |
228 |
cebix |
1.1 |
AC_TYPE_SIZE_T |
229 |
gbeauche |
1.23 |
AC_TYPE_SIGNAL |
230 |
cebix |
1.1 |
AC_HEADER_TIME |
231 |
|
|
AC_STRUCT_TM |
232 |
gbeauche |
1.54 |
|
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 |
cebix |
1.1 |
|
250 |
|
|
dnl Checks for library functions. |
251 |
|
|
AC_CHECK_FUNCS(strdup cfmakeraw) |
252 |
cebix |
1.21 |
AC_CHECK_FUNCS(clock_gettime timer_create) |
253 |
gbeauche |
1.40 |
AC_CHECK_FUNCS(sigaction signal) |
254 |
gbeauche |
1.44 |
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 |
cebix |
1.1 |
|
260 |
|
|
dnl Select system-dependant source files. |
261 |
cebix |
1.19 |
SERIALSRC=serial_unix.cpp |
262 |
|
|
ETHERSRC=../dummy/ether_dummy.cpp |
263 |
|
|
SCSISRC=../dummy/scsi_dummy.cpp |
264 |
|
|
AUDIOSRC=../dummy/audio_dummy.cpp |
265 |
|
|
EXTRASYSSRCS= |
266 |
cebix |
1.27 |
CAN_NATIVE_M68K=no |
267 |
gbeauche |
1.23 |
case "$target_os" in |
268 |
|
|
linux*) |
269 |
cebix |
1.38 |
ETHERSRC=ether_unix.cpp |
270 |
|
|
AUDIOSRC=audio_oss_esd.cpp |
271 |
gbeauche |
1.23 |
SCSISRC=Linux/scsi_linux.cpp |
272 |
|
|
;; |
273 |
cebix |
1.38 |
freebsd*) |
274 |
|
|
ETHERSRC=ether_unix.cpp |
275 |
gbeauche |
1.23 |
AUDIOSRC=audio_oss_esd.cpp |
276 |
|
|
DEFINES="$DEFINES -DBSD_COMP" |
277 |
cebix |
1.38 |
CXXFLAGS="$CXXFLAGS -fpermissive" |
278 |
gbeauche |
1.23 |
dnl Check for the CAM library |
279 |
|
|
AC_CHECK_LIB(cam, cam_open_btl, HAVE_LIBCAM=yes, HAVE_LIBCAM=no) |
280 |
|
|
if [[ "x$HAVE_LIBCAM" = "xno" ]]; then |
281 |
|
|
AC_MSG_WARN([Cannot find libcam for SCSI management, disabling SCSI support.]) |
282 |
|
|
else |
283 |
|
|
dnl Check for the sys kernel includes |
284 |
cebix |
1.38 |
AC_CHECK_HEADER(camlib.h) |
285 |
|
|
if [[ "x$ac_cv_header_camlib_h" = "xno" ]]; then |
286 |
gbeauche |
1.23 |
dnl In this case I should fix this thing including a "patch" |
287 |
|
|
dnl to access directly to the functions in the kernel :) --Orlando |
288 |
cebix |
1.38 |
AC_MSG_WARN([Cannot find includes for CAM library, disabling SCSI support.]) |
289 |
gbeauche |
1.23 |
else |
290 |
|
|
SCSISRC=FreeBSD/scsi_freebsd.cpp |
291 |
|
|
LIBS="$LIBS -lcam" |
292 |
|
|
DEFINES="$DEFINES -DCAM" |
293 |
|
|
fi |
294 |
|
|
fi |
295 |
|
|
;; |
296 |
|
|
netbsd*) |
297 |
cebix |
1.27 |
CAN_NATIVE_M68K=yes |
298 |
gbeauche |
1.23 |
;; |
299 |
|
|
solaris*) |
300 |
|
|
AUDIOSRC=Solaris/audio_solaris.cpp |
301 |
|
|
DEFINES="$DEFINES -DBSD_COMP -D_POSIX_PTHREAD_SEMANTICS" |
302 |
|
|
;; |
303 |
|
|
irix*) |
304 |
cebix |
1.48 |
ETHERSRC=ether_unix.cpp |
305 |
cebix |
1.30 |
AUDIOSRC=Irix/audio_irix.cpp |
306 |
gbeauche |
1.23 |
EXTRASYSSRCS=Irix/unaligned.c |
307 |
cebix |
1.28 |
dnl IRIX headers work fine, but somehow don't define or use "STDC_HEADERS" |
308 |
|
|
DEFINES="$DEFINES -DCRTSCTS=CNEW_RTSCTS -DB230400=B115200 -DSTDC_HEADERS" |
309 |
cebix |
1.30 |
LIBS="$LIBS -laudio" |
310 |
cebix |
1.48 |
WANT_ESD=no |
311 |
cebix |
1.37 |
|
312 |
|
|
dnl Check if our compiler supports -Ofast (MIPSPro) |
313 |
|
|
HAVE_OFAST=no |
314 |
|
|
ocflags="$CFLAGS" |
315 |
|
|
CFLAGS=`echo $CFLAGS | sed -e 's/ -g / -Ofast /;s/^-g /-Ofast /;s/-g$/ -Ofast/;s/^-g$/-Ofast/'` |
316 |
|
|
AC_MSG_CHECKING(if "-Ofast" works) |
317 |
|
|
dnl Do a test compile of an empty function |
318 |
|
|
AC_TRY_COMPILE(,, [AC_MSG_RESULT(yes); HAVE_OFAST=yes], AC_MSG_RESULT(no)) |
319 |
|
|
CFLAGS="$ocflags" |
320 |
|
|
|
321 |
gbeauche |
1.23 |
;; |
322 |
|
|
esac |
323 |
|
|
|
324 |
cebix |
1.27 |
dnl Use 68k CPU natively? |
325 |
|
|
WANT_NATIVE_M68K=no |
326 |
|
|
if [[ "x$HAVE_M68K" = "xyes" -a "x$CAN_NATIVE_M68K" = "xyes" ]]; then |
327 |
|
|
AC_DEFINE(ENABLE_NATIVE_M68K) |
328 |
|
|
WANT_NATIVE_M68K=yes |
329 |
|
|
fi |
330 |
|
|
|
331 |
gbeauche |
1.23 |
if [[ "x$HAVE_PTHREADS" = "xno" ]]; then |
332 |
|
|
dnl Serial, ethernet and audio support needs pthreads |
333 |
|
|
AC_MSG_WARN([You don't have pthreads, disabling serial, ethernet and audio support.]) |
334 |
|
|
SERIALSRC=../dummy/serial_dummy.cpp |
335 |
|
|
ETHERSRC=../dummy/ether_dummy.cpp |
336 |
|
|
AUDIOSRC=../dummy/audio_dummy.cpp |
337 |
|
|
fi |
338 |
|
|
SYSSRCS="$SERIALSRC $ETHERSRC $SCSISRC $AUDIOSRC $SEMSRC $UISRCS $MONSRCS $EXTRASYSSRCS" |
339 |
|
|
|
340 |
|
|
dnl Define a macro that translates a yesno-variable into a C macro definition |
341 |
|
|
dnl to be put into the config.h file |
342 |
|
|
dnl $1 -- the macro to define |
343 |
|
|
dnl $2 -- the value to translate |
344 |
|
|
AC_DEFUN(AC_TRANSLATE_DEFINE, [ |
345 |
gbeauche |
1.44 |
if [[ "x$2" = "xyes" -o "x$2" = "xguessing yes" ]]; then |
346 |
gbeauche |
1.23 |
AC_DEFINE($1) |
347 |
|
|
fi |
348 |
|
|
]) |
349 |
|
|
|
350 |
gbeauche |
1.44 |
dnl Various checks if the system supports vm_allocate() and the like functions. |
351 |
|
|
have_mach_vm=no |
352 |
|
|
if [[ "x$ac_cv_func_vm_allocate" = "xyes" -a "x$ac_cv_func_vm_deallocate" = "xyes" -a \ |
353 |
|
|
"x$ac_cv_func_vm_protect" = "xyes" ]]; then |
354 |
|
|
have_mach_vm=yes |
355 |
|
|
fi |
356 |
|
|
AC_TRANSLATE_DEFINE(HAVE_MACH_VM, "$have_mach_vm") |
357 |
|
|
|
358 |
|
|
dnl Check that vm_allocate(), vm_protect() work |
359 |
|
|
if [[ "x$have_mach_vm" = "xyes" ]]; then |
360 |
|
|
|
361 |
|
|
AC_CACHE_CHECK("whether vm_protect works", |
362 |
|
|
ac_cv_vm_protect_works, [ |
363 |
|
|
AC_LANG_SAVE |
364 |
|
|
AC_LANG_CPLUSPLUS |
365 |
|
|
ac_cv_vm_protect_works=yes |
366 |
|
|
dnl First the tests that should segfault |
367 |
|
|
for test_def in NONE_READ NONE_WRITE READ_WRITE; do |
368 |
|
|
AC_TRY_RUN([ |
369 |
|
|
#define CONFIGURE_TEST_VM_MAP |
370 |
|
|
#define TEST_VM_PROT_$test_def |
371 |
|
|
#include "vm_alloc.cpp" |
372 |
|
|
], ac_cv_vm_protect_works=no, rm -f core, |
373 |
|
|
dnl When cross-compiling, do not assume anything |
374 |
|
|
ac_cv_vm_protect_works="guessing no" |
375 |
|
|
) |
376 |
|
|
done |
377 |
|
|
AC_TRY_RUN([ |
378 |
|
|
#define CONFIGURE_TEST_VM_MAP |
379 |
|
|
#define TEST_VM_PROT_RDWR_WRITE |
380 |
|
|
#include "vm_alloc.cpp" |
381 |
|
|
], , ac_cv_vm_protect_works=no, |
382 |
|
|
dnl When cross-compiling, do not assume anything |
383 |
|
|
ac_cv_vm_protect_works="guessing no" |
384 |
|
|
) |
385 |
|
|
AC_LANG_RESTORE |
386 |
|
|
] |
387 |
|
|
) |
388 |
|
|
|
389 |
|
|
dnl Remove support for vm_allocate() if vm_protect() does not work |
390 |
|
|
if [[ "x$have_mach_vm" = "xyes" ]]; then |
391 |
|
|
case $ac_cv_vm_protect_works in |
392 |
|
|
*yes) have_mach_vm=yes;; |
393 |
|
|
*no) have_mach_vm=no;; |
394 |
|
|
esac |
395 |
|
|
fi |
396 |
|
|
AC_TRANSLATE_DEFINE(HAVE_MACH_VM, "$have_mach_vm") |
397 |
|
|
|
398 |
|
|
fi dnl HAVE_MACH_VM |
399 |
|
|
|
400 |
|
|
dnl Various checks if the system supports mmap() and the like functions. |
401 |
|
|
dnl ... and Mach memory allocators are not supported |
402 |
|
|
have_mmap_vm=no |
403 |
|
|
if [[ "x$ac_cv_func_mmap" = "xyes" -a "x$ac_cv_func_munmap" = "xyes" -a \ |
404 |
|
|
"x$ac_cv_func_mprotect" = "xyes" ]]; then |
405 |
|
|
if [[ "x$have_mach_vm" = "xno" ]]; then |
406 |
|
|
have_mmap_vm=yes |
407 |
|
|
fi |
408 |
|
|
fi |
409 |
|
|
AC_TRANSLATE_DEFINE(HAVE_MMAP_VM, "$have_mmap_vm") |
410 |
|
|
|
411 |
|
|
dnl Check that mmap() and associated functions work. |
412 |
|
|
if [[ "x$have_mmap_vm" = "xyes" ]]; then |
413 |
|
|
|
414 |
|
|
dnl Check if we have a working anonymous mmap() |
415 |
|
|
AC_CACHE_CHECK("whether mmap supports MAP_ANON", |
416 |
|
|
ac_cv_mmap_anon, [ |
417 |
|
|
AC_LANG_SAVE |
418 |
|
|
AC_LANG_CPLUSPLUS |
419 |
|
|
AC_TRY_RUN([ |
420 |
|
|
#define HAVE_MMAP_ANON |
421 |
|
|
#define CONFIGURE_TEST_VM_MAP |
422 |
|
|
#define TEST_VM_MMAP_ANON |
423 |
|
|
#include "vm_alloc.cpp" |
424 |
|
|
], ac_cv_mmap_anon=yes, ac_cv_mmap_anon=no, |
425 |
|
|
dnl When cross-compiling, do not assume anything. |
426 |
|
|
ac_cv_mmap_anon="guessing no" |
427 |
|
|
) |
428 |
|
|
AC_LANG_RESTORE |
429 |
|
|
] |
430 |
|
|
) |
431 |
|
|
AC_TRANSLATE_DEFINE(HAVE_MMAP_ANON, "$ac_cv_mmap_anon") |
432 |
|
|
|
433 |
|
|
AC_CACHE_CHECK("whether mmap supports MAP_ANONYMOUS", |
434 |
|
|
ac_cv_mmap_anonymous, [ |
435 |
|
|
AC_LANG_SAVE |
436 |
|
|
AC_LANG_CPLUSPLUS |
437 |
|
|
AC_TRY_RUN([ |
438 |
|
|
#define HAVE_MMAP_ANONYMOUS |
439 |
|
|
#define CONFIGURE_TEST_VM_MAP |
440 |
|
|
#define TEST_VM_MMAP_ANON |
441 |
|
|
#include "vm_alloc.cpp" |
442 |
|
|
], ac_cv_mmap_anonymous=yes, ac_cv_mmap_anonymous=no, |
443 |
|
|
dnl When cross-compiling, do not assume anything. |
444 |
|
|
ac_cv_mmap_anonymous="guessing no" |
445 |
|
|
) |
446 |
|
|
AC_LANG_RESTORE |
447 |
|
|
] |
448 |
|
|
) |
449 |
|
|
AC_TRANSLATE_DEFINE(HAVE_MMAP_ANONYMOUS, "$ac_cv_mmap_anonymous") |
450 |
|
|
|
451 |
|
|
AC_CACHE_CHECK("whether mprotect works", |
452 |
|
|
ac_cv_mprotect_works, [ |
453 |
|
|
AC_LANG_SAVE |
454 |
|
|
AC_LANG_CPLUSPLUS |
455 |
|
|
ac_cv_mprotect_works=yes |
456 |
|
|
dnl First the tests that should segfault |
457 |
|
|
for test_def in NONE_READ NONE_WRITE READ_WRITE; do |
458 |
|
|
AC_TRY_RUN([ |
459 |
|
|
#define CONFIGURE_TEST_VM_MAP |
460 |
|
|
#define TEST_VM_PROT_$test_def |
461 |
|
|
#include "vm_alloc.cpp" |
462 |
|
|
], ac_cv_mprotect_works=no, rm -f core, |
463 |
|
|
dnl When cross-compiling, do not assume anything |
464 |
|
|
ac_cv_mprotect_works="guessing no" |
465 |
|
|
) |
466 |
|
|
done |
467 |
|
|
AC_TRY_RUN([ |
468 |
|
|
#define CONFIGURE_TEST_VM_MAP |
469 |
|
|
#define TEST_VM_PROT_RDWR_WRITE |
470 |
|
|
#include "vm_alloc.cpp" |
471 |
|
|
], , ac_cv_mprotect_works=no, |
472 |
|
|
dnl When cross-compiling, do not assume anything |
473 |
|
|
ac_cv_mprotect_works="guessing no" |
474 |
|
|
) |
475 |
|
|
AC_LANG_RESTORE |
476 |
|
|
] |
477 |
|
|
) |
478 |
|
|
|
479 |
|
|
dnl Remove support for mmap() if mprotect() does not work |
480 |
|
|
if [[ "x$have_mmap_vm" = "xyes" ]]; then |
481 |
|
|
case $ac_cv_mprotect_works in |
482 |
|
|
*yes) have_mmap_vm=yes;; |
483 |
|
|
*no) have_mmap_vm=no;; |
484 |
|
|
esac |
485 |
|
|
fi |
486 |
|
|
AC_TRANSLATE_DEFINE(HAVE_MMAP_VM, $have_mmap_vm) |
487 |
|
|
|
488 |
|
|
fi dnl HAVE_MMAP_VM |
489 |
|
|
|
490 |
gbeauche |
1.23 |
dnl Check if we can mmap 0x2000 bytes from 0x0000 |
491 |
|
|
AC_CACHE_CHECK("whether we can map Low Memory area 0x0000-0x2000", |
492 |
|
|
ac_cv_can_map_lm, [ |
493 |
|
|
AC_LANG_SAVE |
494 |
|
|
AC_LANG_CPLUSPLUS |
495 |
|
|
AC_TRY_RUN([ |
496 |
gbeauche |
1.44 |
#include "vm_alloc.cpp" |
497 |
|
|
int main(void) { /* returns 0 if we could map the lowmem globals */ |
498 |
|
|
volatile char * lm; |
499 |
|
|
if (vm_init() < 0) exit(1); |
500 |
|
|
if ((lm = (volatile char *)vm_acquire_fixed(0, 0x2000)) == VM_MAP_FAILED) exit(1); |
501 |
|
|
lm[0] = 'z'; |
502 |
|
|
if (vm_release((char *)lm, 0x2000) < 0) exit(1); |
503 |
|
|
vm_exit(); exit(0); |
504 |
gbeauche |
1.23 |
} |
505 |
gbeauche |
1.44 |
], ac_cv_can_map_lm=yes, ac_cv_can_map_lm=no, |
506 |
|
|
dnl When cross-compiling, do not assume anything. |
507 |
|
|
ac_cv_can_map_lm="guessing no" |
508 |
gbeauche |
1.23 |
) |
509 |
|
|
AC_LANG_RESTORE |
510 |
|
|
] |
511 |
|
|
) |
512 |
|
|
|
513 |
gbeauche |
1.40 |
dnl Check signal handlers need to be reinstalled |
514 |
|
|
AC_CACHE_CHECK("whether signal handlers need to be reinstalled", |
515 |
gbeauche |
1.44 |
ac_cv_signal_need_reinstall, [ |
516 |
|
|
AC_LANG_SAVE |
517 |
|
|
AC_LANG_CPLUSPLUS |
518 |
|
|
AC_TRY_RUN([ |
519 |
|
|
#include <stdlib.h> |
520 |
|
|
#ifdef HAVE_UNISTD_H |
521 |
|
|
#include <unistd.h> |
522 |
|
|
#endif |
523 |
|
|
#include <signal.h> |
524 |
|
|
static int handled_signal = 0; |
525 |
|
|
RETSIGTYPE sigusr1_handler(int) { handled_signal++; } |
526 |
|
|
int main(void) { /* returns 0 if signals need not to be reinstalled */ |
527 |
|
|
signal(SIGUSR1, sigusr1_handler); raise(SIGUSR1); raise(SIGUSR1); |
528 |
|
|
exit(handled_signal == 2); |
529 |
|
|
} |
530 |
|
|
], ac_cv_signal_need_reinstall=yes, ac_cv_signal_need_reinstall=no, |
531 |
|
|
dnl When cross-compiling, do not assume anything. |
532 |
|
|
ac_cv_signal_need_reinstall="guessing yes" |
533 |
|
|
) |
534 |
|
|
AC_LANG_RESTORE |
535 |
|
|
] |
536 |
gbeauche |
1.40 |
) |
537 |
|
|
AC_TRANSLATE_DEFINE(SIGNAL_NEED_REINSTALL, "$ac_cv_signal_need_reinstall") |
538 |
|
|
|
539 |
|
|
dnl Check if sigaction handlers need to be reinstalled |
540 |
|
|
AC_CACHE_CHECK("whether sigaction handlers need to be reinstalled", |
541 |
|
|
ac_cv_sigaction_need_reinstall, [ |
542 |
|
|
AC_LANG_SAVE |
543 |
|
|
AC_LANG_CPLUSPLUS |
544 |
|
|
AC_TRY_RUN([ |
545 |
|
|
#include <stdlib.h> |
546 |
|
|
#ifdef HAVE_UNISTD_H |
547 |
|
|
#include <unistd.h> |
548 |
|
|
#endif |
549 |
|
|
#include <signal.h> |
550 |
|
|
static int handled_signal = 0; |
551 |
|
|
RETSIGTYPE sigusr1_handler(int) { handled_signal++; } |
552 |
|
|
typedef RETSIGTYPE (*signal_handler)(int); |
553 |
|
|
static signal_handler mysignal(int sig, signal_handler handler) { |
554 |
|
|
struct sigaction old_sa; |
555 |
|
|
struct sigaction new_sa; |
556 |
|
|
new_sa.sa_handler = handler; |
557 |
|
|
return ((sigaction(sig,&new_sa,&old_sa) < 0) ? SIG_IGN : old_sa.sa_handler); |
558 |
|
|
} |
559 |
|
|
int main(void) { /* returns 0 if signals need not to be reinstalled */ |
560 |
|
|
mysignal(SIGUSR1, sigusr1_handler); raise(SIGUSR1); raise(SIGUSR1); |
561 |
|
|
exit(handled_signal == 2); |
562 |
|
|
} |
563 |
gbeauche |
1.44 |
], ac_cv_sigaction_need_reinstall=yes, ac_cv_sigaction_need_reinstall=no, |
564 |
|
|
dnl When cross-compiling, do not assume anything. |
565 |
|
|
ac_cv_sigaction_need_reinstall="guessing yes" |
566 |
gbeauche |
1.40 |
) |
567 |
|
|
AC_LANG_RESTORE |
568 |
|
|
] |
569 |
|
|
) |
570 |
|
|
AC_TRANSLATE_DEFINE(SIGACTION_NEED_REINSTALL, "$ac_cv_sigaction_need_reinstall") |
571 |
|
|
|
572 |
gbeauche |
1.23 |
dnl Check if extended signals are supported. |
573 |
|
|
AC_CACHE_CHECK("whether your system supports extended signal handlers", |
574 |
|
|
ac_cv_have_extended_signals, [ |
575 |
|
|
AC_LANG_SAVE |
576 |
|
|
AC_LANG_CPLUSPLUS |
577 |
|
|
AC_TRY_RUN([ |
578 |
gbeauche |
1.40 |
#define HAVE_SIGINFO_T 1 |
579 |
gbeauche |
1.44 |
#define CONFIGURE_TEST_SIGSEGV_RECOVERY |
580 |
|
|
#include "vm_alloc.cpp" |
581 |
gbeauche |
1.40 |
#include "sigsegv.cpp" |
582 |
gbeauche |
1.44 |
], ac_cv_have_extended_signals=yes, ac_cv_have_extended_signals=no, |
583 |
|
|
dnl When cross-compiling, do not assume anything. |
584 |
|
|
ac_cv_have_extended_signals=no |
585 |
gbeauche |
1.23 |
) |
586 |
|
|
AC_LANG_RESTORE |
587 |
|
|
] |
588 |
|
|
) |
589 |
|
|
AC_TRANSLATE_DEFINE(HAVE_SIGINFO_T, "$ac_cv_have_extended_signals") |
590 |
gbeauche |
1.60 |
|
591 |
gbeauche |
1.23 |
dnl Otherwise, check for subterfuges. |
592 |
|
|
if [[ "x$ac_cv_have_extended_signals" = "xno" ]]; then |
593 |
gbeauche |
1.40 |
AC_CACHE_CHECK("whether we then have a subterfuge for your system", |
594 |
|
|
ac_cv_have_sigcontext_hack, [ |
595 |
|
|
AC_LANG_SAVE |
596 |
|
|
AC_LANG_CPLUSPLUS |
597 |
|
|
AC_TRY_RUN([ |
598 |
|
|
#define HAVE_SIGCONTEXT_SUBTERFUGE 1 |
599 |
gbeauche |
1.44 |
#define CONFIGURE_TEST_SIGSEGV_RECOVERY |
600 |
|
|
#include "vm_alloc.cpp" |
601 |
gbeauche |
1.40 |
#include "sigsegv.cpp" |
602 |
gbeauche |
1.44 |
], ac_cv_have_sigcontext_hack=yes, ac_cv_have_sigcontext_hack=no, |
603 |
|
|
dnl When cross-compiling, do not assume anything. |
604 |
|
|
ac_cv_have_sigcontext_hack=no |
605 |
gbeauche |
1.40 |
) |
606 |
|
|
AC_LANG_RESTORE |
607 |
|
|
]) |
608 |
|
|
AC_TRANSLATE_DEFINE(HAVE_SIGCONTEXT_SUBTERFUGE, "$ac_cv_have_sigcontext_hack") |
609 |
gbeauche |
1.23 |
fi |
610 |
gbeauche |
1.60 |
|
611 |
|
|
dnl Check if we can ignore the fault (instruction skipping in SIGSEGV handler) |
612 |
|
|
AC_CACHE_CHECK("whether we can skip instruction in SIGSEGV handler", |
613 |
|
|
ac_cv_have_skip_instruction, [ |
614 |
|
|
AC_LANG_SAVE |
615 |
|
|
AC_LANG_CPLUSPLUS |
616 |
|
|
AC_TRY_RUN([ |
617 |
|
|
#define HAVE_SIGSEGV_SKIP_INSTRUCTION 1 |
618 |
|
|
#define CONFIGURE_TEST_SIGSEGV_RECOVERY |
619 |
|
|
#include "vm_alloc.cpp" |
620 |
|
|
#include "sigsegv.cpp" |
621 |
|
|
], ac_cv_have_skip_instruction=yes, ac_cv_have_skip_instruction=no, |
622 |
|
|
dnl When cross-compiling, do not assume anything. |
623 |
|
|
ac_cv_have_skip_instruction=no |
624 |
|
|
) |
625 |
|
|
AC_LANG_RESTORE |
626 |
|
|
] |
627 |
|
|
) |
628 |
|
|
AC_TRANSLATE_DEFINE(HAVE_SIGSEGV_SKIP_INSTRUCTION, "$ac_cv_have_skip_instruction") |
629 |
gbeauche |
1.23 |
|
630 |
|
|
dnl Can we do Video on SEGV Signals ? |
631 |
|
|
CAN_VOSF=no |
632 |
|
|
if [[ "$ac_cv_have_extended_signals" = "yes" -o "$ac_cv_have_sigcontext_hack" = "yes" ]]; then |
633 |
|
|
CAN_VOSF=yes |
634 |
|
|
fi |
635 |
|
|
|
636 |
|
|
dnl Determine the addressing mode to use |
637 |
cebix |
1.27 |
if [[ "x$WANT_NATIVE_M68K" = "xyes" ]]; then |
638 |
|
|
ADDRESSING_MODE="real" |
639 |
|
|
else |
640 |
|
|
ADDRESSING_MODE="" |
641 |
|
|
AC_MSG_CHECKING([for the addressing mode to use]) |
642 |
|
|
for am in $ADDRESSING_TEST_ORDER; do |
643 |
|
|
case $am in |
644 |
|
|
real) |
645 |
gbeauche |
1.32 |
dnl Requires ability to mmap() Low Memory globals |
646 |
cebix |
1.27 |
if [[ "x$ac_cv_can_map_lm" = "xno" ]]; then |
647 |
|
|
continue |
648 |
|
|
fi |
649 |
gbeauche |
1.32 |
dnl Requires VOSF screen updates |
650 |
|
|
if [[ "x$CAN_VOSF" = "xno" ]]; then |
651 |
|
|
continue |
652 |
cebix |
1.1 |
fi |
653 |
gbeauche |
1.32 |
dnl Real addressing will probably work. |
654 |
cebix |
1.27 |
ADDRESSING_MODE="real" |
655 |
|
|
WANT_VOSF=yes dnl we can use VOSF and we need it actually |
656 |
|
|
DEFINES="$DEFINES -DREAL_ADDRESSING" |
657 |
|
|
break |
658 |
|
|
;; |
659 |
|
|
direct) |
660 |
gbeauche |
1.32 |
dnl Requires VOSF screen updates |
661 |
cebix |
1.27 |
if [[ "x$CAN_VOSF" = "xyes" ]]; then |
662 |
|
|
ADDRESSING_MODE="direct" |
663 |
|
|
WANT_VOSF=yes dnl we can use VOSF and we need it actually |
664 |
|
|
DEFINES="$DEFINES -DDIRECT_ADDRESSING" |
665 |
|
|
break |
666 |
cebix |
1.1 |
fi |
667 |
cebix |
1.27 |
;; |
668 |
|
|
banks) |
669 |
|
|
dnl Default addressing mode |
670 |
|
|
ADDRESSING_MODE="memory banks" |
671 |
gbeauche |
1.23 |
break |
672 |
cebix |
1.27 |
;; |
673 |
|
|
*) |
674 |
|
|
AC_MSG_ERROR([Internal configure.in script error for $am addressing mode]) |
675 |
|
|
esac |
676 |
|
|
done |
677 |
|
|
AC_MSG_RESULT($ADDRESSING_MODE) |
678 |
|
|
if [[ "x$ADDRESSING_MODE" = "x" ]]; then |
679 |
|
|
AC_MSG_WARN([Sorry, no suitable addressing mode in $ADDRESSING_TEST_ORDER]) |
680 |
gbeauche |
1.23 |
ADDRESSING_MODE="memory banks" |
681 |
cebix |
1.27 |
fi |
682 |
cebix |
1.8 |
fi |
683 |
gbeauche |
1.23 |
|
684 |
gbeauche |
1.32 |
dnl Enable VOSF screen updates with this feature is requested and feasible |
685 |
|
|
if [[ "x$WANT_VOSF" = "xyes" -a "x$CAN_VOSF" = "xyes" ]]; then |
686 |
|
|
AC_DEFINE(ENABLE_VOSF) |
687 |
|
|
else |
688 |
gbeauche |
1.23 |
WANT_VOSF=no |
689 |
cebix |
1.19 |
fi |
690 |
cebix |
1.9 |
|
691 |
cebix |
1.3 |
dnl Check for GAS. |
692 |
cebix |
1.1 |
HAVE_GAS=no |
693 |
|
|
AC_MSG_CHECKING(for GAS .p2align feature) |
694 |
|
|
cat >conftest.S << EOF |
695 |
|
|
.text |
696 |
|
|
.p2align 5 |
697 |
|
|
EOF |
698 |
|
|
if $CC conftest.S -c -o conftest.o >/dev/null 2>&1 ; then HAVE_GAS=yes; fi |
699 |
|
|
AC_MSG_RESULT($HAVE_GAS) |
700 |
|
|
|
701 |
cebix |
1.3 |
dnl Check for GCC 2.7 or higher. |
702 |
cebix |
1.1 |
HAVE_GCC27=no |
703 |
|
|
AC_MSG_CHECKING(for GCC 2.7 or higher) |
704 |
|
|
AC_EGREP_CPP(yes, |
705 |
|
|
[#if __GNUC__ - 1 > 1 || __GNUC_MINOR__ - 1 > 5 |
706 |
|
|
yes |
707 |
|
|
#endif |
708 |
|
|
], [AC_MSG_RESULT(yes); HAVE_GCC27=yes], AC_MSG_RESULT(no)) |
709 |
|
|
|
710 |
gbeauche |
1.46 |
dnl Check for GCC 3.0 or higher. |
711 |
|
|
HAVE_GCC30=no |
712 |
|
|
AC_MSG_CHECKING(for GCC 3.0 or higher) |
713 |
|
|
AC_EGREP_CPP(yes, |
714 |
|
|
[#if __GNUC__ >= 3 |
715 |
|
|
yes |
716 |
|
|
#endif |
717 |
|
|
], [AC_MSG_RESULT(yes); HAVE_GCC30=yes], AC_MSG_RESULT(no)) |
718 |
|
|
|
719 |
cebix |
1.19 |
dnl Set "-fomit-frame-pointer" on i386 GCC 2.7 or higher. |
720 |
cebix |
1.53 |
dnl Also set "-fno-exceptions" for C++ because exception handling requires |
721 |
|
|
dnl the frame pointer. |
722 |
cebix |
1.19 |
if [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_I386" = "xyes" ]]; then |
723 |
cebix |
1.1 |
CFLAGS="$CFLAGS -fomit-frame-pointer" |
724 |
cebix |
1.53 |
CXXFLAGS="$CXXFLAGS -fomit-frame-pointer -fno-exceptions" |
725 |
cebix |
1.1 |
fi |
726 |
|
|
|
727 |
gbeauche |
1.46 |
dnl (gb) Do not merge constants since it breaks fpu/fpu_x86.cpp. |
728 |
|
|
dnl As of 2001/08/02, this affects the following compilers: |
729 |
|
|
dnl Official: probably gcc-3.1 (mainline CVS) |
730 |
|
|
dnl Mandrake: gcc-2.96 >= 0.59mdk, gcc-3.0.1 >= 0.1mdk |
731 |
|
|
dnl Red Hat : gcc-2.96 >= 89, gcc-3.0 >= 1 |
732 |
|
|
if [[ "x$HAVE_GCC27" = "xyes" ]]; then |
733 |
|
|
SAVED_CXXFLAGS="$CXXFLAGS" |
734 |
gbeauche |
1.47 |
CXXFLAGS="$CXXFLAGS -fno-merge-constants" |
735 |
gbeauche |
1.46 |
AC_CACHE_CHECK([whether GCC supports constants merging], ac_cv_gcc_constants_merging, [ |
736 |
|
|
AC_LANG_SAVE |
737 |
|
|
AC_LANG_CPLUSPLUS |
738 |
|
|
AC_TRY_COMPILE([],[],[ac_cv_gcc_constants_merging=yes],[ac_cv_gcc_constants_merging=no]) |
739 |
|
|
AC_LANG_RESTORE |
740 |
|
|
]) |
741 |
|
|
if [[ "x$ac_cv_gcc_constants_merging" != "xyes" ]]; then |
742 |
|
|
CXXFLAGS="$SAVED_CXXFLAGS" |
743 |
|
|
fi |
744 |
|
|
fi |
745 |
|
|
|
746 |
cebix |
1.3 |
dnl Select appropriate CPU source and REGPARAM define. |
747 |
gbeauche |
1.23 |
ASM_OPTIMIZATIONS=none |
748 |
cebix |
1.9 |
CPUSRCS="cpuemu1.cpp cpuemu2.cpp cpuemu3.cpp cpuemu4.cpp cpuemu5.cpp cpuemu6.cpp cpuemu7.cpp cpuemu8.cpp" |
749 |
cebix |
1.41 |
FPUSRCS="../uae_cpu/fpu/fpu_uae.cpp" |
750 |
cebix |
1.38 |
if [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_I386" = "xyes" -a "x$OS_TYPE" != "xfreebsd" ]]; then |
751 |
cebix |
1.9 |
dnl i386 CPU |
752 |
cebix |
1.1 |
DEFINES="$DEFINES -DREGPARAM=\"__attribute__((regparm(3)))\"" |
753 |
|
|
if [[ "x$HAVE_GAS" = "xyes" ]]; then |
754 |
gbeauche |
1.23 |
ASM_OPTIMIZATIONS=i386 |
755 |
gbeauche |
1.31 |
DEFINES="$DEFINES -DX86_ASSEMBLY -DUNALIGNED_PROFITABLE -DOPTIMIZED_FLAGS" |
756 |
gbeauche |
1.34 |
CPUSRCS="cpufast1.s cpufast2.s cpufast3.s cpufast4.s cpufast5.s cpufast6.s cpufast7.s cpufast8.s" |
757 |
gbeauche |
1.22 |
FPUSRCS="../uae_cpu/fpu_x86.cpp" |
758 |
cebix |
1.1 |
fi |
759 |
cebix |
1.9 |
elif [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_SPARC" = "xyes" -a "x$HAVE_GAS" = "xyes" ]]; then |
760 |
|
|
dnl SPARC CPU |
761 |
gbeauche |
1.23 |
case "$target_os" in |
762 |
|
|
solaris*) |
763 |
cebix |
1.9 |
AC_MSG_CHECKING(SPARC CPU architecture) |
764 |
|
|
SPARC_TYPE=`Solaris/which_sparc` |
765 |
|
|
AC_MSG_RESULT($SPARC_TYPE) |
766 |
|
|
case "$SPARC_TYPE" in |
767 |
|
|
SPARC_V8) |
768 |
cebix |
1.26 |
ASM_OPTIMIZATIONS="SPARC V8 architecture" |
769 |
gbeauche |
1.31 |
DEFINES="$DEFINES -DSPARC_V8_ASSEMBLY" dnl -DOPTIMIZED_FLAGS" |
770 |
cebix |
1.9 |
CFLAGS="$CFLAGS -Wa,-Av8" |
771 |
|
|
CXXFLAGS="$CXXFLAGS -Wa,-Av8" |
772 |
|
|
;; |
773 |
|
|
SPARC_V9) |
774 |
cebix |
1.26 |
ASM_OPTIMIZATIONS="SPARC V9 architecture" |
775 |
gbeauche |
1.31 |
DEFINES="$DEFINES -DSPARC_V9_ASSEMBLY" dnl -DOPTIMIZED_FLAGS" |
776 |
cebix |
1.9 |
CFLAGS="$CFLAGS -Wa,-Av9" |
777 |
|
|
CXXFLAGS="$CXXFLAGS -Wa,-Av9" |
778 |
|
|
;; |
779 |
|
|
esac |
780 |
|
|
;; |
781 |
|
|
esac |
782 |
cebix |
1.27 |
elif [[ "x$WANT_NATIVE_M68K" = "xyes" ]]; then |
783 |
cebix |
1.19 |
dnl Native m68k, no emulation |
784 |
cebix |
1.27 |
CPUINCLUDES="-I../native_cpu" |
785 |
|
|
CPUSRCS="asm_support.s" |
786 |
cebix |
1.1 |
fi |
787 |
cebix |
1.9 |
|
788 |
gbeauche |
1.35 |
dnl Select appropriate FPU source. |
789 |
|
|
dnl 1. Optimized X86 assembly core if target is i386 architecture |
790 |
|
|
SAVED_DEFINES=$DEFINES |
791 |
|
|
if [[ "x$FPE_CORE" = "xdefault" ]]; then |
792 |
|
|
if [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_I386" = "xyes" -a "x$HAVE_GAS" = "xyes" ]]; then |
793 |
|
|
DEFINES="$DEFINES -DFPU_X86" |
794 |
|
|
FPE_CORE_STR="i386 optimized core" |
795 |
|
|
FPUSRCS="../uae_cpu/fpu/fpu_x86.cpp" |
796 |
gbeauche |
1.46 |
FPE_CORE="i386" |
797 |
gbeauche |
1.36 |
else |
798 |
|
|
FPE_CORE="uae" |
799 |
gbeauche |
1.35 |
fi |
800 |
|
|
fi |
801 |
|
|
|
802 |
|
|
dnl 2. JIT-FPU only supports IEEE-based implementation. |
803 |
|
|
if [[ "x$WANT_JIT_FPU" = "xyes" -a "x$FPE_CORE" != "xieee" ]]; then |
804 |
|
|
AC_MSG_WARN([Sorry, JIT-FPU supports only the "ieee" FPE implementation]) |
805 |
|
|
FPE_CORE="ieee" |
806 |
|
|
dnl Restore previous variables. FPE_CORE_STR and FPUSRCS are overwritten |
807 |
|
|
DEFINES=$SAVED_DEFINES |
808 |
|
|
fi |
809 |
|
|
|
810 |
|
|
dnl 3. Choose either IEEE-based implementation or the old UAE core |
811 |
|
|
if [[ "x$FPE_CORE" = "xieee" ]]; then |
812 |
|
|
AC_CHECK_HEADERS(fenv.h) |
813 |
|
|
AC_CHECK_FUNCS(feclearexcept fegetexceptflag feraiseexcept fesetexceptflag fetestexcept) |
814 |
|
|
AC_CHECK_FUNCS(fegetround fesetround) |
815 |
|
|
DEFINES="$DEFINES -DFPU_IEEE" |
816 |
|
|
FPE_CORE_STR="ieee-based fpu core" |
817 |
|
|
FPUSRCS="../uae_cpu/fpu/fpu_ieee.cpp" |
818 |
|
|
elif [[ "x$FPE_CORE" = "xuae" ]]; then |
819 |
|
|
DEFINES="$DEFINES -DFPU_UAE" |
820 |
|
|
FPE_CORE_STR="original uae core" |
821 |
|
|
FPUSRCS="../uae_cpu/fpu/fpu_uae.cpp" |
822 |
|
|
fi |
823 |
|
|
|
824 |
|
|
dnl Check for certain math functions |
825 |
|
|
AC_CHECK_FUNCS(atanh) |
826 |
|
|
AC_CHECK_FUNCS(isnan isinf) dnl C99 |
827 |
|
|
AC_CHECK_FUNCS(isnanl isinfl) dnl IEEE ? |
828 |
|
|
|
829 |
cebix |
1.19 |
dnl UAE CPU sources for all non-m68k-native architectures. |
830 |
|
|
if [[ "x$WANT_NATIVE_M68K" = "xno" ]]; then |
831 |
cebix |
1.20 |
CPUINCLUDES="-I../uae_cpu" |
832 |
gbeauche |
1.22 |
CPUSRCS="../uae_cpu/basilisk_glue.cpp ../uae_cpu/memory.cpp ../uae_cpu/newcpu.cpp ../uae_cpu/readcpu.cpp $FPUSRCS cpustbl.cpp cpudefs.cpp $CPUSRCS" |
833 |
cebix |
1.19 |
fi |
834 |
cebix |
1.1 |
|
835 |
gbeauche |
1.23 |
dnl Remove the "-g" option if set for GCC. |
836 |
|
|
if [[ "x$HAVE_GCC27" = "xyes" ]]; then |
837 |
gbeauche |
1.43 |
CFLAGS=`echo $CFLAGS | sed -e 's/-g//g'` |
838 |
|
|
CXXFLAGS=`echo $CXXFLAGS | sed -e 's/-g//g'` |
839 |
cebix |
1.37 |
fi |
840 |
|
|
|
841 |
|
|
dnl Or if we have -Ofast |
842 |
|
|
if [[ "x$HAVE_OFAST" = "xyes" ]]; then |
843 |
gbeauche |
1.43 |
CFLAGS="`echo $CFLAGS | sed -e 's/-g//g'` -Ofast" |
844 |
|
|
CXXFLAGS="`echo $CXXFLAGS | sed -e 's/-g//g'` -Ofast" |
845 |
cebix |
1.37 |
CXXFLAGS="-LANG:std $CXXFLAGS" |
846 |
cebix |
1.59 |
LDFLAGS="$LDFLAGS -ipa" |
847 |
gbeauche |
1.23 |
fi |
848 |
|
|
|
849 |
cebix |
1.3 |
dnl Generate Makefile. |
850 |
cebix |
1.1 |
AC_SUBST(DEFINES) |
851 |
|
|
AC_SUBST(SYSSRCS) |
852 |
|
|
AC_SUBST(CPUINCLUDES) |
853 |
|
|
AC_SUBST(CPUSRCS) |
854 |
|
|
AC_OUTPUT(Makefile) |
855 |
cebix |
1.12 |
|
856 |
|
|
dnl Print summary. |
857 |
|
|
echo |
858 |
|
|
echo Basilisk II configuration summary: |
859 |
|
|
echo |
860 |
|
|
echo XFree86 DGA support .............. : $WANT_XF86_DGA |
861 |
cebix |
1.17 |
echo XFree86 VidMode support .......... : $WANT_XF86_VIDMODE |
862 |
cebix |
1.12 |
echo fbdev DGA support ................ : $WANT_FBDEV_DGA |
863 |
gbeauche |
1.23 |
echo Enable video on SEGV signals ..... : $WANT_VOSF |
864 |
cebix |
1.12 |
echo ESD sound support ................ : $WANT_ESD |
865 |
cebix |
1.14 |
echo GTK user interface ............... : $WANT_GTK |
866 |
cebix |
1.12 |
echo mon debugger support ............. : $WANT_MON |
867 |
cebix |
1.19 |
echo Running m68k code natively ....... : $WANT_NATIVE_M68K |
868 |
gbeauche |
1.35 |
echo Floating-Point emulation core .... : $FPE_CORE_STR |
869 |
gbeauche |
1.23 |
echo Assembly optimizations ........... : $ASM_OPTIMIZATIONS |
870 |
|
|
echo Addressing mode .................. : $ADDRESSING_MODE |
871 |
cebix |
1.12 |
echo |
872 |
cebix |
1.19 |
echo "Configuration done. Now type \"make\" (or \"gmake\")." |