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