1 |
cebix |
1.1 |
dnl Process this file with autoconf to produce a configure script. |
2 |
|
|
dnl Written in 1999 by Christian Bauer et al. |
3 |
|
|
|
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.27 |
AC_ARG_ENABLE(vosf, [ --enable-vosf enable video on SEGV signals [default=no]], [WANT_VOSF=$enableval], [WANT_VOSF=no]) |
13 |
gbeauche |
1.23 |
AC_ARG_ENABLE(16bit-vidmode, [ --enable-16bit-vidmode enable 16-bit video if possible [default=yes]], [WANT_16BIT_VIDMODE=$enableval], [WANT_16BIT_VIDMODE=yes]) |
14 |
|
|
AC_ARG_ENABLE(addressing, |
15 |
|
|
[ --enable-addressing=mode specify the addressing mode to use [default=fastest]], |
16 |
|
|
[ case "$enableval" in |
17 |
cebix |
1.24 |
real) ADDRESSING_TEST_ORDER="real";; |
18 |
|
|
direct) ADDRESSING_TEST_ORDER="direct";; |
19 |
|
|
banks) ADDRESSING_TEST_ORDER="banks";; |
20 |
|
|
dnl fastest) ADDRESSING_TEST_ORDER="real direct banks";; gb-- will enable later... |
21 |
|
|
fastest) ADDRESSING_TEST_ORDER="direct banks";; |
22 |
|
|
*) AC_MSG_ERROR([--enable-mem-addressing takes only one of the following values: fastest, real, direct, banks]);; |
23 |
gbeauche |
1.23 |
esac |
24 |
|
|
], |
25 |
|
|
dnl [ ADDRESSING_TEST_ORDER="real direct banks" gb-- will probably reactivate later |
26 |
|
|
[ ADDRESSING_TEST_ORDER="direct banks" |
27 |
|
|
]) |
28 |
cebix |
1.17 |
AC_ARG_WITH(esd, [ --with-esd support ESD for sound under Linux/FreeBSD [default=yes]], [WANT_ESD=$withval], [WANT_ESD=yes]) |
29 |
|
|
AC_ARG_WITH(gtk, [ --with-gtk use GTK user interface [default=yes]], [WANT_GTK=$withval], [WANT_GTK=yes]) |
30 |
|
|
AC_ARG_WITH(mon, [ --with-mon use mon as debugger [default=yes]], [WANT_MON=$withval], [WANT_MON=yes]) |
31 |
cebix |
1.1 |
|
32 |
gbeauche |
1.23 |
dnl Canonical system information. |
33 |
|
|
AC_CANONICAL_HOST |
34 |
|
|
AC_CANONICAL_TARGET |
35 |
|
|
|
36 |
|
|
dnl Target OS type (target is host if not cross-compiling). |
37 |
|
|
case "$target_os" in |
38 |
|
|
linux*) OS_TYPE=linux;; |
39 |
|
|
netbsd*) OS_TYPE=netbsd;; |
40 |
|
|
freebsd*) OS_TYPE=freebsd;; |
41 |
|
|
solaris*) OS_TYPE=solaris;; |
42 |
|
|
*) OS_TYPE=`echo $target_os | sed -e 's/-/_/'`;; |
43 |
|
|
esac |
44 |
|
|
DEFINES="$DEFINES -DOS_$OS_TYPE" |
45 |
|
|
|
46 |
|
|
dnl Target CPU type. |
47 |
|
|
HAVE_I386=no |
48 |
|
|
HAVE_M68K=no |
49 |
|
|
HAVE_SPARC=no |
50 |
|
|
case "$target_cpu" in |
51 |
|
|
i386* | i486* | i586* | i686* | i786* ) CPU_TYPE=i386 HAVE_I386=yes;; |
52 |
|
|
m68k* ) CPU_TYPE=m68k HAVE_M68K=yes;; |
53 |
|
|
sparc* ) CPU_TYPE=sparc HAVE_SPARC=yes;; |
54 |
|
|
*) CPU_TYPE=`echo $target_cpu | sed -e 's/-/_/'`;; |
55 |
|
|
esac |
56 |
|
|
DEFINES="$DEFINES -DCPU_$CPU_TYPE" |
57 |
|
|
|
58 |
cebix |
1.1 |
dnl Checks for programs. |
59 |
|
|
AC_PROG_CC |
60 |
gbeauche |
1.23 |
AC_PROG_CC_C_O |
61 |
cebix |
1.4 |
AC_PROG_CPP |
62 |
cebix |
1.1 |
AC_PROG_CXX |
63 |
|
|
AC_PROG_MAKE_SET |
64 |
|
|
AC_PROG_INSTALL |
65 |
|
|
|
66 |
cebix |
1.11 |
dnl We use mon if possible. |
67 |
|
|
MONSRCS= |
68 |
cebix |
1.18 |
if [[ "x$WANT_MON" = "xyes" ]]; then |
69 |
|
|
AC_MSG_CHECKING(for mon) |
70 |
cebix |
1.24 |
mon_srcdir=../../../mon/src |
71 |
|
|
if grep mon_init $mon_srcdir/mon.h >/dev/null 2>/dev/null; then |
72 |
cebix |
1.18 |
AC_MSG_RESULT(yes) |
73 |
cebix |
1.19 |
AC_DEFINE(ENABLE_MON) |
74 |
cebix |
1.24 |
MONSRCS="$mon_srcdir/mon.cpp $mon_srcdir/mon_6502.cpp $mon_srcdir/mon_8080.cpp $mon_srcdir/mon_cmd.cpp $mon_srcdir/mon_disass.cpp $mon_srcdir/mon_ppc.cpp $mon_srcdir/disass/floatformat.c $mon_srcdir/disass/i386-dis.c $mon_srcdir/disass/m68k-dis.c $mon_srcdir/disass/m68k-opc.c" |
75 |
|
|
CXXFLAGS="$CXXFLAGS -I$mon_srcdir -I$mon_srcdir/disass" |
76 |
cebix |
1.18 |
AC_CHECK_LIB(readline, readline) |
77 |
cebix |
1.19 |
AC_CHECK_LIB(termcap, tputs) |
78 |
|
|
AC_CHECK_HEADERS(readline.h history.h readline/readline.h readline/history.h) |
79 |
cebix |
1.18 |
else |
80 |
|
|
AC_MSG_RESULT(no) |
81 |
|
|
AC_MSG_WARN([Could not find mon, ignoring --with-mon.]) |
82 |
|
|
WANT_MON=no |
83 |
|
|
fi |
84 |
cebix |
1.11 |
fi |
85 |
|
|
|
86 |
cebix |
1.1 |
dnl Checks for libraries. |
87 |
cebix |
1.10 |
AC_CHECK_LIB(posix4, sem_init) |
88 |
|
|
|
89 |
|
|
dnl We need X11. |
90 |
cebix |
1.1 |
AC_PATH_XTRA |
91 |
|
|
if [[ "x$no_x" = "xyes" ]]; then |
92 |
|
|
AC_MSG_ERROR([You need X11 to run Basilisk II.]) |
93 |
|
|
fi |
94 |
|
|
CFLAGS="$CFLAGS $X_CFLAGS" |
95 |
|
|
CXXFLAGS="$CXXFLAGS $X_CFLAGS" |
96 |
|
|
LIBS="$LIBS $X_PRE_LIBS $X_LIBS -lX11 -lXext $X_EXTRA_LIBS" |
97 |
|
|
|
98 |
cebix |
1.19 |
dnl We want pthreads. Try libpthread first, then libc_r (FreeBSD), then PTL. |
99 |
|
|
HAVE_PTHREADS=yes |
100 |
cebix |
1.10 |
AC_CHECK_LIB(pthread, pthread_create, , [ |
101 |
|
|
AC_CHECK_LIB(c_r, pthread_create, , [ |
102 |
|
|
AC_CHECK_LIB(PTL, pthread_create, , [ |
103 |
cebix |
1.19 |
HAVE_PTHREADS=no |
104 |
cebix |
1.10 |
]) |
105 |
|
|
]) |
106 |
|
|
]) |
107 |
cebix |
1.19 |
if [[ "x$HAVE_PTHREADS" = "xyes" ]]; then |
108 |
|
|
AC_DEFINE(HAVE_PTHREADS) |
109 |
|
|
fi |
110 |
|
|
AC_CHECK_FUNCS(pthread_cancel) |
111 |
cebix |
1.10 |
|
112 |
|
|
dnl If POSIX.4 semaphores are not available, we emulate them with pthread mutexes. |
113 |
cebix |
1.19 |
SEMSRC= |
114 |
cebix |
1.10 |
AC_CHECK_FUNCS(sem_init, , [ |
115 |
cebix |
1.26 |
if test "x$HAVE_PTHREADS" = "xyes"; then |
116 |
cebix |
1.19 |
SEMSRC=posix_sem.cpp |
117 |
|
|
fi |
118 |
cebix |
1.10 |
]) |
119 |
cebix |
1.1 |
|
120 |
cebix |
1.10 |
dnl We use DGA (XFree86 or fbdev) if possible. |
121 |
cebix |
1.8 |
if [[ "x$WANT_XF86_DGA" = "xyes" ]]; then |
122 |
cebix |
1.10 |
AC_CHECK_LIB(Xxf86dga, XF86DGAQueryExtension, [ |
123 |
cebix |
1.19 |
AC_DEFINE(ENABLE_XF86_DGA) |
124 |
cebix |
1.1 |
LIBS="$LIBS -lXxf86dga" |
125 |
cebix |
1.8 |
if [[ "x$WANT_FBDEV_DGA" = "xyes" ]]; then |
126 |
|
|
AC_MSG_WARN([Cannot have both --enable-xf86-dga and --enable-fbdev-dga, ignoring --enable-fbdev-dga.]) |
127 |
|
|
WANT_FBDEV_DGA=no |
128 |
|
|
fi |
129 |
cebix |
1.10 |
], [ |
130 |
|
|
AC_MSG_WARN([Could not find XFree86 DGA extension, ignoring --enable-xf86-dga.]) |
131 |
cebix |
1.13 |
WANT_XF86_DGA=no |
132 |
cebix |
1.10 |
]) |
133 |
cebix |
1.8 |
fi |
134 |
|
|
if [[ "x$WANT_FBDEV_DGA" = "xyes" ]]; then |
135 |
cebix |
1.19 |
AC_DEFINE(ENABLE_FBDEV_DGA) |
136 |
cebix |
1.1 |
fi |
137 |
|
|
|
138 |
cebix |
1.17 |
dnl We use XFree86 VidMode if possible. |
139 |
|
|
if [[ "x$WANT_XF86_VIDMODE" = "xyes" ]]; then |
140 |
|
|
AC_CHECK_LIB(Xxf86vm, XF86VidModeQueryExtension, [ |
141 |
cebix |
1.19 |
AC_DEFINE(ENABLE_XF86_VIDMODE) |
142 |
cebix |
1.17 |
LIBS="$LIBS -lXxf86vm" |
143 |
|
|
], [ |
144 |
|
|
AC_MSG_WARN([Could not find XFree86 VidMode extension, ignoring --enable-xf86-vidmode.]) |
145 |
|
|
WANT_XF86_VIDMODE=no |
146 |
|
|
]) |
147 |
|
|
fi |
148 |
|
|
|
149 |
cebix |
1.1 |
dnl We use GTK+ if possible. |
150 |
cebix |
1.10 |
UISRCS=../dummy/prefs_editor_dummy.cpp |
151 |
cebix |
1.14 |
if [[ "x$WANT_GTK" = "xyes" ]]; then |
152 |
cebix |
1.10 |
AM_PATH_GTK(1.2.0, [ |
153 |
cebix |
1.19 |
AC_DEFINE(ENABLE_GTK) |
154 |
cebix |
1.10 |
CFLAGS="$CFLAGS $GTK_CFLAGS" |
155 |
|
|
CXXFLAGS="$CXXFLAGS $GTK_CFLAGS" |
156 |
|
|
LIBS="$LIBS $GTK_LIBS" |
157 |
|
|
UISRCS=prefs_editor_gtk.cpp |
158 |
|
|
], [ |
159 |
|
|
AC_MSG_WARN([Could not find GTK+, disabling user interface.]) |
160 |
cebix |
1.14 |
WANT_GTK=no |
161 |
cebix |
1.10 |
]) |
162 |
cebix |
1.1 |
fi |
163 |
|
|
|
164 |
cebix |
1.10 |
dnl We use ESD if possible. |
165 |
|
|
if [[ "x$WANT_ESD" = "xyes" ]]; then |
166 |
|
|
AM_PATH_ESD(0.2.8, [ |
167 |
cebix |
1.19 |
AC_DEFINE(ENABLE_ESD) |
168 |
cebix |
1.10 |
CFLAGS="$CFLAGS $ESD_CFLAGS" |
169 |
|
|
CXXFLAGS="$CXXFLAGS $ESD_CFLAGS" |
170 |
|
|
LIBS="$LIBS $ESD_LIBS" |
171 |
|
|
], [ |
172 |
|
|
AC_MSG_WARN([Could not find ESD, disabling ESD support.]) |
173 |
|
|
WANT_ESD=no |
174 |
|
|
]) |
175 |
cebix |
1.1 |
fi |
176 |
|
|
|
177 |
|
|
dnl Checks for header files. |
178 |
|
|
AC_HEADER_STDC |
179 |
|
|
AC_CHECK_HEADERS(unistd.h fcntl.h sys/time.h) |
180 |
|
|
|
181 |
|
|
dnl Checks for typedefs, structures, and compiler characteristics. |
182 |
|
|
AC_C_BIGENDIAN |
183 |
|
|
AC_C_CONST |
184 |
|
|
AC_C_INLINE |
185 |
|
|
AC_CHECK_SIZEOF(short, 2) |
186 |
|
|
AC_CHECK_SIZEOF(int, 4) |
187 |
|
|
AC_CHECK_SIZEOF(long, 4) |
188 |
|
|
AC_CHECK_SIZEOF(long long, 8) |
189 |
gbeauche |
1.23 |
AC_CHECK_SIZEOF(void *, 4) |
190 |
cebix |
1.1 |
AC_TYPE_OFF_T |
191 |
|
|
AC_CHECK_TYPE(loff_t, off_t) |
192 |
|
|
AC_TYPE_SIZE_T |
193 |
gbeauche |
1.23 |
AC_TYPE_SIGNAL |
194 |
cebix |
1.1 |
AC_HEADER_TIME |
195 |
|
|
AC_STRUCT_TM |
196 |
|
|
|
197 |
|
|
dnl Checks for library functions. |
198 |
|
|
AC_CHECK_FUNCS(strdup cfmakeraw) |
199 |
cebix |
1.21 |
AC_CHECK_FUNCS(clock_gettime timer_create) |
200 |
cebix |
1.1 |
|
201 |
|
|
dnl Select system-dependant source files. |
202 |
cebix |
1.19 |
SERIALSRC=serial_unix.cpp |
203 |
|
|
ETHERSRC=../dummy/ether_dummy.cpp |
204 |
|
|
SCSISRC=../dummy/scsi_dummy.cpp |
205 |
|
|
AUDIOSRC=../dummy/audio_dummy.cpp |
206 |
|
|
EXTRASYSSRCS= |
207 |
cebix |
1.27 |
CAN_NATIVE_M68K=no |
208 |
gbeauche |
1.23 |
case "$target_os" in |
209 |
|
|
linux*) |
210 |
|
|
ETHERSRC=Linux/ether_linux.cpp |
211 |
|
|
SCSISRC=Linux/scsi_linux.cpp |
212 |
|
|
AUDIOSRC=audio_oss_esd.cpp |
213 |
|
|
;; |
214 |
|
|
freebsd*3.*) |
215 |
|
|
AUDIOSRC=audio_oss_esd.cpp |
216 |
|
|
DEFINES="$DEFINES -DBSD_COMP" |
217 |
|
|
dnl Check for the CAM library |
218 |
|
|
AC_CHECK_LIB(cam, cam_open_btl, HAVE_LIBCAM=yes, HAVE_LIBCAM=no) |
219 |
|
|
if [[ "x$HAVE_LIBCAM" = "xno" ]]; then |
220 |
|
|
AC_MSG_WARN([Cannot find libcam for SCSI management, disabling SCSI support.]) |
221 |
|
|
else |
222 |
|
|
dnl Check for the sys kernel includes |
223 |
|
|
AC_CHECK_HEADER(/sys/cam/cam.h) |
224 |
|
|
if [[ "x$ac_cv_header__sys_cam_cam_h" = "xno" ]]; then |
225 |
|
|
dnl In this case I should fix this thing including a "patch" |
226 |
|
|
dnl to access directly to the functions in the kernel :) --Orlando |
227 |
|
|
AC_MSG_WARN([Cannot find kernel includes for CAM library, disabling SCSI support.]) |
228 |
|
|
else |
229 |
|
|
SCSISRC=FreeBSD/scsi_freebsd.cpp |
230 |
|
|
CXXFLAGS="$CXXFLAGS -I/sys" |
231 |
|
|
CFLAGS="$CFLAGS -I/sys" |
232 |
|
|
LIBS="$LIBS -lcam" |
233 |
|
|
DEFINES="$DEFINES -DCAM" |
234 |
|
|
fi |
235 |
|
|
fi |
236 |
|
|
;; |
237 |
|
|
freebsd*) |
238 |
|
|
DEFINES="$DEFINES -DBSD_COMP" |
239 |
|
|
dnl Check for the SCSI library |
240 |
|
|
AC_CHECK_LIB(scsi, scsi_open, HAVE_LIBSCSI=yes, HAVE_LIBSCSI=no) |
241 |
|
|
if [[ "x$HAVE_LIBSCSI" = "xno" ]]; then |
242 |
|
|
AC_MSG_WARN([Cannot find libscsi for SCSI management, disabling SCSI support.]) |
243 |
|
|
else |
244 |
|
|
dnl Check for the sys kernel includes |
245 |
|
|
AC_CHECK_HEADER(scsi.h sys/scsiio.h) |
246 |
|
|
if [[ "x$ac_cv_header_scsi_h" = "xno" ]]; then |
247 |
|
|
AC_MSG_WARN([Cannot find includes for the SCSI library, disabling SCSI support.]) |
248 |
|
|
else |
249 |
|
|
SCSISRC=FreeBSD/scsi_freebsd.cpp |
250 |
|
|
LIBS="$LIBS -lscsi" |
251 |
|
|
fi |
252 |
|
|
fi |
253 |
|
|
;; |
254 |
|
|
netbsd*) |
255 |
cebix |
1.27 |
CAN_NATIVE_M68K=yes |
256 |
gbeauche |
1.23 |
;; |
257 |
|
|
solaris*) |
258 |
|
|
AUDIOSRC=Solaris/audio_solaris.cpp |
259 |
|
|
DEFINES="$DEFINES -DBSD_COMP -D_POSIX_PTHREAD_SEMANTICS" |
260 |
|
|
;; |
261 |
|
|
irix*) |
262 |
|
|
EXTRASYSSRCS=Irix/unaligned.c |
263 |
|
|
DEFINES="$DEFINES -DCRTSCTS=CNEW_RTSCTS -DB230400=B115200" |
264 |
|
|
LIBS="$LIBS -lm" |
265 |
|
|
;; |
266 |
|
|
esac |
267 |
|
|
|
268 |
cebix |
1.27 |
dnl Use 68k CPU natively? |
269 |
|
|
WANT_NATIVE_M68K=no |
270 |
|
|
if [[ "x$HAVE_M68K" = "xyes" -a "x$CAN_NATIVE_M68K" = "xyes" ]]; then |
271 |
|
|
AC_DEFINE(ENABLE_NATIVE_M68K) |
272 |
|
|
WANT_NATIVE_M68K=yes |
273 |
|
|
fi |
274 |
|
|
|
275 |
gbeauche |
1.23 |
if [[ "x$HAVE_PTHREADS" = "xno" ]]; then |
276 |
|
|
dnl Serial, ethernet and audio support needs pthreads |
277 |
|
|
AC_MSG_WARN([You don't have pthreads, disabling serial, ethernet and audio support.]) |
278 |
|
|
SERIALSRC=../dummy/serial_dummy.cpp |
279 |
|
|
ETHERSRC=../dummy/ether_dummy.cpp |
280 |
|
|
AUDIOSRC=../dummy/audio_dummy.cpp |
281 |
|
|
fi |
282 |
|
|
SYSSRCS="$SERIALSRC $ETHERSRC $SCSISRC $AUDIOSRC $SEMSRC $UISRCS $MONSRCS $EXTRASYSSRCS" |
283 |
|
|
|
284 |
|
|
dnl Define a macro that translates a yesno-variable into a C macro definition |
285 |
|
|
dnl to be put into the config.h file |
286 |
|
|
dnl $1 -- the macro to define |
287 |
|
|
dnl $2 -- the value to translate |
288 |
|
|
AC_DEFUN(AC_TRANSLATE_DEFINE, [ |
289 |
|
|
if [[ "x$2" = "xyes" ]]; then |
290 |
|
|
AC_DEFINE($1) |
291 |
|
|
fi |
292 |
|
|
]) |
293 |
|
|
|
294 |
|
|
dnl Check if we can mmap 0x2000 bytes from 0x0000 |
295 |
|
|
AC_CACHE_CHECK("whether we can map Low Memory area 0x0000-0x2000", |
296 |
|
|
ac_cv_can_map_lm, [ |
297 |
|
|
AC_LANG_SAVE |
298 |
|
|
AC_LANG_CPLUSPLUS |
299 |
|
|
AC_TRY_RUN([ |
300 |
|
|
#include <unistd.h> |
301 |
|
|
#include <fcntl.h> |
302 |
|
|
#include <sys/mman.h> |
303 |
|
|
|
304 |
|
|
int main() |
305 |
|
|
{ int zero_fd; char * lm; |
306 |
|
|
if ((zero_fd = open("/dev/zero", O_RDWR)) < 0) exit(1); |
307 |
|
|
if ((lm = (char *)mmap((caddr_t)0x0000, 0x2000, PROT_READ | PROT_WRITE, MAP_FIXED | MAP_PRIVATE, zero_fd, 0)) == MAP_FAILED) exit(1); |
308 |
|
|
lm[0] = 0x12; |
309 |
|
|
munmap(lm, 0x2000); |
310 |
|
|
close(zero_fd); |
311 |
|
|
exit(0); |
312 |
|
|
} |
313 |
|
|
], |
314 |
|
|
[ac_cv_can_map_lm=yes], |
315 |
|
|
[ac_cv_can_map_lm=no] |
316 |
|
|
) |
317 |
|
|
AC_LANG_RESTORE |
318 |
|
|
] |
319 |
|
|
) |
320 |
|
|
|
321 |
|
|
dnl Check if extended signals are supported. |
322 |
|
|
AC_CACHE_CHECK("whether your system supports extended signal handlers", |
323 |
|
|
ac_cv_have_extended_signals, [ |
324 |
|
|
AC_LANG_SAVE |
325 |
|
|
AC_LANG_CPLUSPLUS |
326 |
|
|
AC_TRY_RUN([ |
327 |
|
|
#include <unistd.h> |
328 |
cebix |
1.25 |
#include <stdlib.h> |
329 |
gbeauche |
1.23 |
#include <signal.h> |
330 |
|
|
#include <fcntl.h> |
331 |
|
|
#include <sys/mman.h> |
332 |
|
|
|
333 |
|
|
static volatile caddr_t mem = 0; |
334 |
|
|
static int zero_fd = -1; |
335 |
|
|
|
336 |
|
|
static RETSIGTYPE segfault_handler(int, siginfo_t * sip, void *) |
337 |
|
|
{ if ((caddr_t)(sip->si_addr) != mem) exit(1); |
338 |
|
|
munmap(mem, getpagesize()); close(zero_fd); exit(0); } |
339 |
|
|
|
340 |
|
|
int main() |
341 |
|
|
{ if ((zero_fd = open("/dev/zero", O_RDWR)) < 0) exit(1); |
342 |
|
|
if ((mem = (caddr_t)mmap(0, getpagesize(), PROT_READ, MAP_PRIVATE, zero_fd, 0)) == (caddr_t)MAP_FAILED) exit(1); |
343 |
cebix |
1.25 |
struct sigaction sa; sa.sa_sigaction = segfault_handler; sa.sa_flags = SA_SIGINFO; |
344 |
gbeauche |
1.23 |
sigaction(SIGSEGV, &sa, 0); |
345 |
|
|
mem[0] = 0; |
346 |
|
|
exit(1); // should not be reached |
347 |
|
|
} |
348 |
|
|
], |
349 |
|
|
[ac_cv_have_extended_signals=yes], |
350 |
|
|
[ac_cv_have_extended_signals=no] |
351 |
|
|
) |
352 |
|
|
AC_LANG_RESTORE |
353 |
|
|
] |
354 |
|
|
) |
355 |
|
|
AC_TRANSLATE_DEFINE(HAVE_SIGINFO_T, "$ac_cv_have_extended_signals") |
356 |
|
|
|
357 |
|
|
dnl Otherwise, check for subterfuges. |
358 |
|
|
if [[ "x$ac_cv_have_extended_signals" = "xno" ]]; then |
359 |
|
|
case "$target_os" in |
360 |
|
|
linux*) |
361 |
|
|
if [[ "x$HAVE_I386" = "xyes" ]]; then |
362 |
|
|
AC_CACHE_CHECK("whether we then have a subterfuge for your system", |
363 |
|
|
ac_cv_have_sigcontext_hack, [ |
364 |
|
|
AC_LANG_SAVE |
365 |
|
|
AC_LANG_CPLUSPLUS |
366 |
|
|
AC_TRY_RUN([ |
367 |
|
|
#include <unistd.h> |
368 |
|
|
#include <signal.h> |
369 |
|
|
#include <fcntl.h> |
370 |
|
|
#include <sys/mman.h> |
371 |
|
|
|
372 |
|
|
static volatile caddr_t mem = 0; |
373 |
|
|
static int zero_fd = -1; |
374 |
|
|
|
375 |
|
|
static RETSIGTYPE segfault_handler(int, struct sigcontext scs) |
376 |
|
|
{ if ((caddr_t)(scs.cr2) != mem) exit(1); |
377 |
|
|
munmap(mem, getpagesize()); close(zero_fd); exit(0); } |
378 |
|
|
|
379 |
|
|
int main() |
380 |
|
|
{ if ((zero_fd = open("/dev/zero", O_RDWR)) < 0) exit(1); |
381 |
|
|
if ((mem = (caddr_t)mmap(0, getpagesize(), PROT_READ, MAP_PRIVATE, zero_fd, 0)) == (caddr_t)MAP_FAILED) exit(1); |
382 |
|
|
struct sigaction sa; sa.sa_flags = 0; |
383 |
cebix |
1.25 |
sa.sa_handler = (RETSIGTYPE (*)(int))segfault_handler; |
384 |
gbeauche |
1.23 |
sigaction(SIGSEGV, &sa, 0); |
385 |
|
|
mem[0] = 0; |
386 |
|
|
exit(1); // should not be reached |
387 |
|
|
} |
388 |
|
|
], |
389 |
|
|
[ac_cv_have_sigcontext_hack=yes], |
390 |
|
|
[ac_cv_have_sigcontext_hack=no] |
391 |
|
|
) |
392 |
|
|
AC_LANG_RESTORE |
393 |
|
|
]) |
394 |
cebix |
1.25 |
AC_TRANSLATE_DEFINE(HAVE_SIGCONTEXT_SUBTERFUGE, $ac_cv_have_sigcontext_hack) |
395 |
gbeauche |
1.23 |
fi |
396 |
cebix |
1.27 |
;; |
397 |
|
|
netbsd*) |
398 |
|
|
if [[ "x$HAVE_M68K" = "xyes" ]]; then |
399 |
|
|
AC_CACHE_CHECK("whether we then have a subterfuge for your system", |
400 |
|
|
ac_cv_have_sigcontext_hack, [ |
401 |
|
|
AC_LANG_SAVE |
402 |
|
|
AC_LANG_CPLUSPLUS |
403 |
|
|
AC_TRY_RUN([ |
404 |
|
|
#include <unistd.h> |
405 |
|
|
#include <signal.h> |
406 |
|
|
#include <fcntl.h> |
407 |
|
|
#include <sys/mman.h> |
408 |
|
|
|
409 |
|
|
static volatile caddr_t mem = 0; |
410 |
|
|
static int zero_fd = -1; |
411 |
|
|
|
412 |
|
|
static RETSIGTYPE segfault_handler(int, int code) |
413 |
|
|
{ if ((caddr_t)code != mem) exit(1); |
414 |
|
|
munmap(mem, getpagesize()); close(zero_fd); exit(0); } |
415 |
|
|
|
416 |
|
|
int main() |
417 |
|
|
{ if ((zero_fd = open("/dev/zero", O_RDWR)) < 0) exit(1); |
418 |
|
|
if ((mem = (caddr_t)mmap(0, getpagesize(), PROT_READ, MAP_PRIVATE, zero_fd, 0)) == (caddr_t)MAP_FAILED) exit(1); |
419 |
|
|
struct sigaction sa; sa.sa_flags = 0; |
420 |
|
|
sa.sa_handler = (RETSIGTYPE (*)(int))segfault_handler; |
421 |
|
|
sigaction(SIGSEGV, &sa, 0); |
422 |
|
|
mem[0] = 0; |
423 |
|
|
exit(1); // should not be reached |
424 |
|
|
} |
425 |
|
|
], |
426 |
|
|
[ac_cv_have_sigcontext_hack=yes], |
427 |
|
|
[ac_cv_have_sigcontext_hack=no] |
428 |
|
|
) |
429 |
|
|
AC_LANG_RESTORE |
430 |
|
|
]) |
431 |
|
|
AC_TRANSLATE_DEFINE(HAVE_SIGCONTEXT_SUBTERFUGE, $ac_cv_have_sigcontext_hack) |
432 |
|
|
fi |
433 |
cebix |
1.1 |
;; |
434 |
gbeauche |
1.23 |
esac |
435 |
|
|
fi |
436 |
|
|
|
437 |
|
|
dnl Can we do Video on SEGV Signals ? |
438 |
|
|
CAN_VOSF=no |
439 |
|
|
if [[ "$ac_cv_have_extended_signals" = "yes" -o "$ac_cv_have_sigcontext_hack" = "yes" ]]; then |
440 |
|
|
CAN_VOSF=yes |
441 |
|
|
fi |
442 |
|
|
|
443 |
|
|
dnl Determine the addressing mode to use |
444 |
cebix |
1.27 |
if [[ "x$WANT_NATIVE_M68K" = "xyes" ]]; then |
445 |
|
|
ADDRESSING_MODE="real" |
446 |
|
|
else |
447 |
|
|
ADDRESSING_MODE="" |
448 |
|
|
AC_MSG_CHECKING([for the addressing mode to use]) |
449 |
|
|
for am in $ADDRESSING_TEST_ORDER; do |
450 |
|
|
case $am in |
451 |
|
|
real) |
452 |
|
|
dnl Requires ability to mmap Low Memory globals. |
453 |
|
|
if [[ "x$ac_cv_can_map_lm" = "xno" ]]; then |
454 |
|
|
continue |
455 |
|
|
fi |
456 |
|
|
if [[ "x$ac_cv_c_bigendian" = "xyes" ]]; then |
457 |
|
|
dnl Requires only VOSF if 16-bit vidmode enable |
458 |
|
|
if [[ "x$WANT_16BIT_VIDMODE" = "xyes" ]]; then |
459 |
|
|
if [[ "x$CAN_VOSF" = "xno" ]]; then |
460 |
|
|
continue |
461 |
|
|
fi |
462 |
|
|
else |
463 |
|
|
DEFINES="$DEFINES -DDISABLE_16BIT_VIDMODE" |
464 |
|
|
fi |
465 |
|
|
else |
466 |
|
|
dnl Requires VOSF |
467 |
gbeauche |
1.23 |
if [[ "x$CAN_VOSF" = "xno" ]]; then |
468 |
|
|
continue |
469 |
|
|
fi |
470 |
cebix |
1.1 |
fi |
471 |
cebix |
1.27 |
dnl Real addressing will probably work |
472 |
|
|
ADDRESSING_MODE="real" |
473 |
|
|
WANT_VOSF=yes dnl we can use VOSF and we need it actually |
474 |
|
|
DEFINES="$DEFINES -DREAL_ADDRESSING" |
475 |
|
|
break |
476 |
|
|
;; |
477 |
|
|
direct) |
478 |
gbeauche |
1.23 |
dnl Requires VOSF |
479 |
cebix |
1.27 |
if [[ "x$CAN_VOSF" = "xyes" ]]; then |
480 |
|
|
ADDRESSING_MODE="direct" |
481 |
|
|
WANT_VOSF=yes dnl we can use VOSF and we need it actually |
482 |
|
|
DEFINES="$DEFINES -DDIRECT_ADDRESSING" |
483 |
|
|
break |
484 |
cebix |
1.1 |
fi |
485 |
cebix |
1.27 |
;; |
486 |
|
|
banks) |
487 |
|
|
dnl Default addressing mode |
488 |
|
|
ADDRESSING_MODE="memory banks" |
489 |
gbeauche |
1.23 |
break |
490 |
cebix |
1.27 |
;; |
491 |
|
|
*) |
492 |
|
|
AC_MSG_ERROR([Internal configure.in script error for $am addressing mode]) |
493 |
|
|
esac |
494 |
|
|
done |
495 |
|
|
AC_MSG_RESULT($ADDRESSING_MODE) |
496 |
|
|
if [[ "x$ADDRESSING_MODE" = "x" ]]; then |
497 |
|
|
AC_MSG_WARN([Sorry, no suitable addressing mode in $ADDRESSING_TEST_ORDER]) |
498 |
gbeauche |
1.23 |
ADDRESSING_MODE="memory banks" |
499 |
cebix |
1.27 |
fi |
500 |
cebix |
1.8 |
fi |
501 |
gbeauche |
1.23 |
|
502 |
|
|
dnl Since real and direct addressing modes automatically activate VOSF, |
503 |
|
|
dnl I put this test here. |
504 |
|
|
if [[ "x$WANT_VOSF" = "xyes" ]]; then |
505 |
|
|
if [[ "x$CAN_VOSF" = "xno" ]]; then |
506 |
|
|
AC_MSG_WARN([Sorry, your system does not support Video on SEGV signals]) |
507 |
|
|
WANT_VOSF=no |
508 |
|
|
else |
509 |
|
|
AC_DEFINE(ENABLE_VOSF) |
510 |
|
|
fi |
511 |
cebix |
1.19 |
fi |
512 |
cebix |
1.9 |
|
513 |
cebix |
1.3 |
dnl Check for GAS. |
514 |
cebix |
1.1 |
HAVE_GAS=no |
515 |
|
|
AC_MSG_CHECKING(for GAS .p2align feature) |
516 |
|
|
cat >conftest.S << EOF |
517 |
|
|
.text |
518 |
|
|
.p2align 5 |
519 |
|
|
EOF |
520 |
|
|
if $CC conftest.S -c -o conftest.o >/dev/null 2>&1 ; then HAVE_GAS=yes; fi |
521 |
|
|
AC_MSG_RESULT($HAVE_GAS) |
522 |
|
|
|
523 |
cebix |
1.3 |
dnl Check for GCC 2.7 or higher. |
524 |
cebix |
1.1 |
HAVE_GCC27=no |
525 |
|
|
AC_MSG_CHECKING(for GCC 2.7 or higher) |
526 |
|
|
AC_EGREP_CPP(yes, |
527 |
|
|
[#if __GNUC__ - 1 > 1 || __GNUC_MINOR__ - 1 > 5 |
528 |
|
|
yes |
529 |
|
|
#endif |
530 |
|
|
], [AC_MSG_RESULT(yes); HAVE_GCC27=yes], AC_MSG_RESULT(no)) |
531 |
|
|
|
532 |
cebix |
1.19 |
dnl Set "-fomit-frame-pointer" on i386 GCC 2.7 or higher. |
533 |
|
|
if [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_I386" = "xyes" ]]; then |
534 |
cebix |
1.1 |
CFLAGS="$CFLAGS -fomit-frame-pointer" |
535 |
|
|
CXXFLAGS="$CXXFLAGS -fomit-frame-pointer" |
536 |
|
|
fi |
537 |
|
|
|
538 |
cebix |
1.3 |
dnl Select appropriate CPU source and REGPARAM define. |
539 |
gbeauche |
1.23 |
ASM_OPTIMIZATIONS=none |
540 |
cebix |
1.9 |
CPUSRCS="cpuemu1.cpp cpuemu2.cpp cpuemu3.cpp cpuemu4.cpp cpuemu5.cpp cpuemu6.cpp cpuemu7.cpp cpuemu8.cpp" |
541 |
gbeauche |
1.22 |
FPUSRCS="../uae_cpu/fpp.cpp" |
542 |
cebix |
1.1 |
if [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_I386" = "xyes" ]]; then |
543 |
cebix |
1.9 |
dnl i386 CPU |
544 |
cebix |
1.1 |
DEFINES="$DEFINES -DREGPARAM=\"__attribute__((regparm(3)))\"" |
545 |
|
|
if [[ "x$HAVE_GAS" = "xyes" ]]; then |
546 |
gbeauche |
1.23 |
ASM_OPTIMIZATIONS=i386 |
547 |
|
|
DEFINES="$DEFINES -DX86_ASSEMBLY -DOPTFLAGS" |
548 |
cebix |
1.16 |
CPUSRCS="../uae_cpu/compiler.cpp cpufast1.s cpufast2.s cpufast3.s cpufast4.s cpufast5.s cpufast6.s cpufast7.s cpufast8.s" |
549 |
gbeauche |
1.22 |
FPUSRCS="../uae_cpu/fpu_x86.cpp" |
550 |
cebix |
1.1 |
fi |
551 |
cebix |
1.9 |
elif [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_SPARC" = "xyes" -a "x$HAVE_GAS" = "xyes" ]]; then |
552 |
|
|
dnl SPARC CPU |
553 |
gbeauche |
1.23 |
case "$target_os" in |
554 |
|
|
solaris*) |
555 |
cebix |
1.9 |
AC_MSG_CHECKING(SPARC CPU architecture) |
556 |
|
|
SPARC_TYPE=`Solaris/which_sparc` |
557 |
|
|
AC_MSG_RESULT($SPARC_TYPE) |
558 |
|
|
case "$SPARC_TYPE" in |
559 |
|
|
SPARC_V8) |
560 |
cebix |
1.26 |
ASM_OPTIMIZATIONS="SPARC V8 architecture" |
561 |
gbeauche |
1.23 |
DEFINES="$DEFINES -DSPARC_V8_ASSEMBLY" dnl -DOPTFLAGS" |
562 |
cebix |
1.9 |
CFLAGS="$CFLAGS -Wa,-Av8" |
563 |
|
|
CXXFLAGS="$CXXFLAGS -Wa,-Av8" |
564 |
|
|
;; |
565 |
|
|
SPARC_V9) |
566 |
cebix |
1.26 |
ASM_OPTIMIZATIONS="SPARC V9 architecture" |
567 |
gbeauche |
1.23 |
DEFINES="$DEFINES -DSPARC_V9_ASSEMBLY" dnl -DOPTFLAGS" |
568 |
cebix |
1.9 |
CFLAGS="$CFLAGS -Wa,-Av9" |
569 |
|
|
CXXFLAGS="$CXXFLAGS -Wa,-Av9" |
570 |
|
|
;; |
571 |
|
|
esac |
572 |
|
|
;; |
573 |
|
|
esac |
574 |
cebix |
1.27 |
elif [[ "x$WANT_NATIVE_M68K" = "xyes" ]]; then |
575 |
cebix |
1.19 |
dnl Native m68k, no emulation |
576 |
cebix |
1.27 |
CPUINCLUDES="-I../native_cpu" |
577 |
|
|
CPUSRCS="asm_support.s" |
578 |
cebix |
1.1 |
fi |
579 |
cebix |
1.9 |
|
580 |
cebix |
1.19 |
dnl UAE CPU sources for all non-m68k-native architectures. |
581 |
|
|
if [[ "x$WANT_NATIVE_M68K" = "xno" ]]; then |
582 |
cebix |
1.20 |
CPUINCLUDES="-I../uae_cpu" |
583 |
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" |
584 |
cebix |
1.19 |
fi |
585 |
cebix |
1.1 |
|
586 |
gbeauche |
1.23 |
dnl Remove the "-g" option if set for GCC. |
587 |
|
|
if [[ "x$HAVE_GCC27" = "xyes" ]]; then |
588 |
cebix |
1.26 |
dnl gb-- Probably not the cleanest way to take |
589 |
|
|
CFLAGS=`echo $CFLAGS | sed -e 's/ -g / /;s/^-g / /;s/ -g$/ /;s/^-g$//'` |
590 |
|
|
CXXFLAGS=`echo $CXXFLAGS | sed -e 's/ -g / /;s/^-g / /;s/ -g$/ /;s/^-g$//'` |
591 |
gbeauche |
1.23 |
fi |
592 |
|
|
|
593 |
cebix |
1.3 |
dnl Generate Makefile. |
594 |
cebix |
1.1 |
AC_SUBST(DEFINES) |
595 |
|
|
AC_SUBST(SYSSRCS) |
596 |
|
|
AC_SUBST(CPUINCLUDES) |
597 |
|
|
AC_SUBST(CPUSRCS) |
598 |
|
|
AC_OUTPUT(Makefile) |
599 |
cebix |
1.12 |
|
600 |
|
|
dnl Print summary. |
601 |
|
|
echo |
602 |
|
|
echo Basilisk II configuration summary: |
603 |
|
|
echo |
604 |
|
|
echo XFree86 DGA support .............. : $WANT_XF86_DGA |
605 |
cebix |
1.17 |
echo XFree86 VidMode support .......... : $WANT_XF86_VIDMODE |
606 |
cebix |
1.12 |
echo fbdev DGA support ................ : $WANT_FBDEV_DGA |
607 |
gbeauche |
1.23 |
echo Enable video on SEGV signals ..... : $WANT_VOSF |
608 |
cebix |
1.12 |
echo ESD sound support ................ : $WANT_ESD |
609 |
cebix |
1.14 |
echo GTK user interface ............... : $WANT_GTK |
610 |
cebix |
1.12 |
echo mon debugger support ............. : $WANT_MON |
611 |
cebix |
1.19 |
echo Running m68k code natively ....... : $WANT_NATIVE_M68K |
612 |
gbeauche |
1.23 |
echo Assembly optimizations ........... : $ASM_OPTIMIZATIONS |
613 |
|
|
echo Addressing mode .................. : $ADDRESSING_MODE |
614 |
cebix |
1.12 |
echo |
615 |
cebix |
1.19 |
echo "Configuration done. Now type \"make\" (or \"gmake\")." |