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