1 |
cebix |
1.1 |
dnl Process this file with autoconf to produce a configure script. |
2 |
|
|
dnl Written in 2002 by Christian Bauer |
3 |
|
|
|
4 |
|
|
AC_INIT(main_unix.cpp) |
5 |
|
|
AC_PREREQ(2.12) |
6 |
|
|
AC_CONFIG_HEADER(config.h) |
7 |
|
|
|
8 |
|
|
dnl Options. |
9 |
gbeauche |
1.6 |
AC_ARG_ENABLE(ppc-emulator, [ --enable-ppc-emulator use the selected PowerPC emulator [default=auto]], [WANT_EMULATED_PPC=$enableval], [WANT_EMULATED_PPC=auto]) |
10 |
cebix |
1.1 |
AC_ARG_ENABLE(xf86-dga, [ --enable-xf86-dga use the XFree86 DGA extension [default=yes]], [WANT_XF86_DGA=$enableval], [WANT_XF86_DGA=yes]) |
11 |
|
|
AC_ARG_ENABLE(xf86-vidmode, [ --enable-xf86-vidmode use the XFree86 VidMode extension [default=yes]], [WANT_XF86_VIDMODE=$enableval], [WANT_XF86_VIDMODE=yes]) |
12 |
gbeauche |
1.5 |
AC_ARG_ENABLE(vosf, [ --enable-vosf enable video on SEGV signals [default=yes]], [WANT_VOSF=$enableval], [WANT_VOSF=yes]) |
13 |
cebix |
1.1 |
AC_ARG_WITH(esd, [ --with-esd support ESD for sound under Linux/FreeBSD [default=yes]], [WANT_ESD=$withval], [WANT_ESD=yes]) |
14 |
|
|
AC_ARG_WITH(gtk, [ --with-gtk use GTK user interface [default=yes]], [WANT_GTK=$withval], [WANT_GTK=yes]) |
15 |
|
|
AC_ARG_WITH(mon, [ --with-mon use mon as debugger [default=yes]], [WANT_MON=$withval], [WANT_MON=yes]) |
16 |
|
|
|
17 |
|
|
dnl Checks for programs. |
18 |
|
|
AC_PROG_CC |
19 |
|
|
AC_PROG_CPP |
20 |
|
|
AC_PROG_CXX |
21 |
|
|
AC_PROG_MAKE_SET |
22 |
|
|
AC_PROG_INSTALL |
23 |
|
|
|
24 |
|
|
dnl Check for PowerPC target CPU. |
25 |
|
|
HAVE_PPC=no |
26 |
|
|
AC_MSG_CHECKING(for PowerPC target CPU) |
27 |
|
|
AC_EGREP_CPP(yes, |
28 |
|
|
[ |
29 |
|
|
#ifdef __powerpc__ |
30 |
|
|
yes |
31 |
|
|
#endif |
32 |
|
|
], [AC_MSG_RESULT(yes); HAVE_PPC=yes], AC_MSG_RESULT(no)) |
33 |
|
|
|
34 |
gbeauche |
1.6 |
dnl We use native CPU if possible. |
35 |
|
|
EMULATED_PPC=yes |
36 |
|
|
case $WANT_EMULATED_PPC in |
37 |
|
|
auto) [[ "x$HAVE_PPC" = "xyes" ]] && EMULATED_PPC=no;; |
38 |
|
|
no) EMULATED_PPC=no;; |
39 |
|
|
esac |
40 |
|
|
if [[ "x$EMULATED_PPC" = "xyes" ]]; then |
41 |
|
|
AC_DEFINE(EMULATED_PPC) |
42 |
|
|
fi |
43 |
|
|
|
44 |
cebix |
1.1 |
dnl We use mon if possible. |
45 |
|
|
MONSRCS= |
46 |
|
|
if [[ "x$WANT_MON" = "xyes" ]]; then |
47 |
|
|
AC_MSG_CHECKING(for mon) |
48 |
|
|
mon_srcdir=../../../mon/src |
49 |
|
|
if grep mon_init $mon_srcdir/mon.h >/dev/null 2>/dev/null; then |
50 |
|
|
AC_MSG_RESULT(yes) |
51 |
|
|
AC_DEFINE(ENABLE_MON) |
52 |
|
|
MONSRCS="$mon_srcdir/mon.cpp $mon_srcdir/mon_6502.cpp $mon_srcdir/mon_z80.cpp $mon_srcdir/mon_cmd.cpp $mon_srcdir/mon_lowmem.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" |
53 |
|
|
CXXFLAGS="$CXXFLAGS -I$mon_srcdir -I$mon_srcdir/disass" |
54 |
gbeauche |
1.2 |
AC_CHECK_LIB(ncurses, tgetent, , |
55 |
|
|
AC_CHECK_LIB(termcap, tgetent, , |
56 |
|
|
AC_CHECK_LIB(termlib, tgetent, , |
57 |
|
|
AC_CHECK_LIB(terminfo, tgetent, , |
58 |
|
|
AC_CHECK_LIB(Hcurses, tgetent, , |
59 |
|
|
AC_CHECK_LIB(curses, tgetent)))))) |
60 |
cebix |
1.1 |
AC_CHECK_LIB(readline, readline) |
61 |
|
|
AC_CHECK_HEADERS(readline.h history.h readline/readline.h readline/history.h) |
62 |
|
|
else |
63 |
|
|
AC_MSG_RESULT(no) |
64 |
|
|
AC_MSG_WARN([Could not find mon, ignoring --with-mon.]) |
65 |
|
|
WANT_MON=no |
66 |
|
|
fi |
67 |
|
|
fi |
68 |
|
|
|
69 |
|
|
dnl Checks for libraries. |
70 |
|
|
AC_CHECK_LIB(posix4, sem_init) |
71 |
|
|
|
72 |
|
|
dnl We need X11. |
73 |
|
|
AC_PATH_XTRA |
74 |
|
|
if [[ "x$no_x" = "xyes" ]]; then |
75 |
|
|
AC_MSG_ERROR([You need X11 to run SheepShaver.]) |
76 |
|
|
fi |
77 |
|
|
CFLAGS="$CFLAGS $X_CFLAGS" |
78 |
|
|
CXXFLAGS="$CXXFLAGS $X_CFLAGS" |
79 |
|
|
LIBS="$LIBS $X_PRE_LIBS $X_LIBS -lX11 -lXext $X_EXTRA_LIBS" |
80 |
|
|
|
81 |
|
|
dnl We need pthreads on non-PowerPC systems. Try libpthread first, then libc_r (FreeBSD), then PTL. |
82 |
|
|
HAVE_PTHREADS=yes |
83 |
gbeauche |
1.6 |
if [[ "x$EMULATED_PPC" = "xyes" ]]; then |
84 |
cebix |
1.1 |
AC_CHECK_LIB(pthread, pthread_create, , [ |
85 |
|
|
AC_CHECK_LIB(c_r, pthread_create, , [ |
86 |
|
|
AC_CHECK_LIB(PTL, pthread_create, , [ |
87 |
|
|
AC_MSG_ERROR([You need pthreads to run Basilisk II.]) |
88 |
|
|
]) |
89 |
|
|
]) |
90 |
|
|
]) |
91 |
|
|
AC_CHECK_FUNCS(pthread_cancel) |
92 |
|
|
fi |
93 |
|
|
|
94 |
|
|
dnl If POSIX.4 semaphores are not available, we emulate them with pthread mutexes. |
95 |
|
|
SEMSRC= |
96 |
|
|
AC_CHECK_FUNCS(sem_init, , [ |
97 |
gbeauche |
1.4 |
if test "x$HAVE_PTHREADS" = "xyes"; then |
98 |
cebix |
1.1 |
SEMSRC=posix_sem.cpp |
99 |
|
|
fi |
100 |
|
|
]) |
101 |
|
|
|
102 |
|
|
dnl We use XFree86 DGA if possible. |
103 |
|
|
if [[ "x$WANT_XF86_DGA" = "xyes" ]]; then |
104 |
|
|
AC_CHECK_LIB(Xxf86dga, XF86DGAQueryExtension, [ |
105 |
|
|
AC_DEFINE(ENABLE_XF86_DGA) |
106 |
|
|
LIBS="$LIBS -lXxf86dga" |
107 |
|
|
], [ |
108 |
|
|
AC_MSG_WARN([Could not find XFree86 DGA extension, ignoring --enable-xf86-dga.]) |
109 |
|
|
WANT_XF86_DGA=no |
110 |
|
|
]) |
111 |
|
|
fi |
112 |
|
|
|
113 |
|
|
dnl We use XFree86 VidMode if possible. |
114 |
|
|
if [[ "x$WANT_XF86_VIDMODE" = "xyes" ]]; then |
115 |
|
|
AC_CHECK_LIB(Xxf86vm, XF86VidModeQueryExtension, [ |
116 |
|
|
AC_DEFINE(ENABLE_XF86_VIDMODE) |
117 |
|
|
LIBS="$LIBS -lXxf86vm" |
118 |
|
|
], [ |
119 |
|
|
AC_MSG_WARN([Could not find XFree86 VidMode extension, ignoring --enable-xf86-vidmode.]) |
120 |
|
|
WANT_XF86_VIDMODE=no |
121 |
|
|
]) |
122 |
|
|
fi |
123 |
|
|
|
124 |
|
|
dnl We use GTK+ if possible. |
125 |
|
|
UISRCS= |
126 |
|
|
if [[ "x$WANT_GTK" = "xyes" ]]; then |
127 |
|
|
AM_PATH_GTK(1.2.0, [ |
128 |
|
|
AC_DEFINE(ENABLE_GTK) |
129 |
|
|
CFLAGS="$CFLAGS $GTK_CFLAGS" |
130 |
|
|
CXXFLAGS="$CXXFLAGS $GTK_CFLAGS" |
131 |
|
|
LIBS="$LIBS $GTK_LIBS" |
132 |
|
|
UISRCS=prefs_editor_gtk.cpp |
133 |
|
|
], [ |
134 |
|
|
AC_MSG_WARN([Could not find GTK+, disabling user interface.]) |
135 |
|
|
WANT_GTK=no |
136 |
|
|
]) |
137 |
|
|
fi |
138 |
|
|
|
139 |
|
|
dnl We use ESD if possible. |
140 |
|
|
if [[ "x$WANT_ESD" = "xyes" ]]; then |
141 |
|
|
AM_PATH_ESD(0.2.8, [ |
142 |
|
|
AC_DEFINE(ENABLE_ESD) |
143 |
|
|
CFLAGS="$CFLAGS $ESD_CFLAGS" |
144 |
|
|
CXXFLAGS="$CXXFLAGS $ESD_CFLAGS" |
145 |
|
|
LIBS="$LIBS $ESD_LIBS" |
146 |
|
|
], [ |
147 |
|
|
AC_MSG_WARN([Could not find ESD, disabling ESD support.]) |
148 |
|
|
WANT_ESD=no |
149 |
|
|
]) |
150 |
|
|
fi |
151 |
|
|
|
152 |
|
|
dnl Checks for header files. |
153 |
|
|
AC_HEADER_STDC |
154 |
|
|
AC_HEADER_SYS_WAIT |
155 |
gbeauche |
1.6 |
AC_CHECK_HEADERS(mach/vm_map.h mach/mach_init.h sys/mman.h) |
156 |
|
|
AC_CHECK_HEADERS(sys/time.h sys/times.h) |
157 |
|
|
AC_CHECK_HEADERS(unistd.h fcntl.h byteswap.h) |
158 |
cebix |
1.1 |
|
159 |
|
|
dnl Checks for typedefs, structures, and compiler characteristics. |
160 |
|
|
AC_C_BIGENDIAN |
161 |
|
|
AC_C_CONST |
162 |
|
|
AC_C_INLINE |
163 |
|
|
AC_CHECK_SIZEOF(short, 2) |
164 |
|
|
AC_CHECK_SIZEOF(int, 4) |
165 |
|
|
AC_CHECK_SIZEOF(long, 4) |
166 |
|
|
AC_CHECK_SIZEOF(long long, 8) |
167 |
gbeauche |
1.4 |
AC_CHECK_SIZEOF(float, 4) |
168 |
|
|
AC_CHECK_SIZEOF(double, 8) |
169 |
gbeauche |
1.3 |
AC_CHECK_SIZEOF(void *, 4) |
170 |
cebix |
1.1 |
AC_TYPE_OFF_T |
171 |
|
|
AC_CHECK_TYPE(loff_t, off_t) |
172 |
|
|
AC_TYPE_SIZE_T |
173 |
gbeauche |
1.4 |
AC_TYPE_SIGNAL |
174 |
cebix |
1.1 |
AC_HEADER_TIME |
175 |
|
|
AC_STRUCT_TM |
176 |
|
|
|
177 |
|
|
dnl Checks for library functions. |
178 |
|
|
AC_CHECK_FUNCS(strdup cfmakeraw) |
179 |
|
|
AC_CHECK_FUNCS(nanosleep clock_gettime timer_create) |
180 |
gbeauche |
1.4 |
AC_CHECK_FUNCS(sigaction signal) |
181 |
|
|
AC_CHECK_FUNCS(mmap mprotect munmap) |
182 |
|
|
AC_CHECK_FUNCS(vm_allocate vm_deallocate vm_protect) |
183 |
cebix |
1.1 |
|
184 |
|
|
dnl Select system-dependant sources. |
185 |
gbeauche |
1.6 |
if [[ "x$EMULATED_PPC" = "xno" ]]; then |
186 |
cebix |
1.1 |
SYSSRCS="Linux/paranoia.cpp Linux/sheepthreads.c Linux/asm_linux.S" |
187 |
|
|
else |
188 |
gbeauche |
1.6 |
SYSSRCS="../kpx_cpu/sheepshaver_glue.cpp \ |
189 |
|
|
../kpx_cpu/src/cpu/ppc/ppc-cpu.cpp \ |
190 |
|
|
../kpx_cpu/src/cpu/ppc/ppc-decode.cpp \ |
191 |
|
|
../kpx_cpu/src/cpu/ppc/ppc-execute.cpp" |
192 |
|
|
CPPFLAGS="$CPPFLAGS -I../kpx_cpu -I../kpx_cpu/include -I../kpx_cpu/src -I../kpx_cpu/src/cpu" |
193 |
cebix |
1.1 |
fi |
194 |
|
|
SYSSRCS="$SYSSRCS $SEMSRCS $UISRCS $MONSRCS" |
195 |
gbeauche |
1.4 |
|
196 |
|
|
dnl Define a macro that translates a yesno-variable into a C macro definition |
197 |
|
|
dnl to be put into the config.h file |
198 |
|
|
dnl $1 -- the macro to define |
199 |
|
|
dnl $2 -- the value to translate |
200 |
|
|
dnl $3 -- template name |
201 |
|
|
AC_DEFUN(AC_TRANSLATE_DEFINE, [ |
202 |
|
|
if [[ "x$2" = "xyes" -o "x$2" = "xguessing yes" ]]; then |
203 |
|
|
AC_DEFINE($1, 1, $3) |
204 |
|
|
fi |
205 |
|
|
]) |
206 |
|
|
|
207 |
|
|
dnl Various checks if the system supports vm_allocate() and the like functions. |
208 |
|
|
have_mach_vm=no |
209 |
|
|
if [[ "x$ac_cv_func_vm_allocate" = "xyes" -a "x$ac_cv_func_vm_deallocate" = "xyes" -a \ |
210 |
|
|
"x$ac_cv_func_vm_protect" = "xyes" ]]; then |
211 |
|
|
have_mach_vm=yes |
212 |
|
|
fi |
213 |
|
|
AC_TRANSLATE_DEFINE(HAVE_MACH_VM, "$have_mach_vm", |
214 |
|
|
[Define if your system has a working vm_allocate()-based memory allocator.]) |
215 |
|
|
|
216 |
|
|
dnl Check that vm_allocate(), vm_protect() work |
217 |
|
|
if [[ "x$have_mach_vm" = "xyes" ]]; then |
218 |
|
|
|
219 |
|
|
AC_CACHE_CHECK([whether vm_protect works], |
220 |
|
|
ac_cv_vm_protect_works, [ |
221 |
|
|
AC_LANG_SAVE |
222 |
|
|
AC_LANG_CPLUSPLUS |
223 |
|
|
ac_cv_vm_protect_works=yes |
224 |
|
|
dnl First the tests that should segfault |
225 |
|
|
for test_def in NONE_READ NONE_WRITE READ_WRITE; do |
226 |
|
|
AC_TRY_RUN([ |
227 |
|
|
#define CONFIGURE_TEST_VM_MAP |
228 |
|
|
#define TEST_VM_PROT_$test_def |
229 |
|
|
#include "vm_alloc.cpp" |
230 |
|
|
], ac_cv_vm_protect_works=no, rm -f core, |
231 |
|
|
dnl When cross-compiling, do not assume anything |
232 |
|
|
ac_cv_vm_protect_works="guessing no" |
233 |
|
|
) |
234 |
|
|
done |
235 |
|
|
AC_TRY_RUN([ |
236 |
|
|
#define CONFIGURE_TEST_VM_MAP |
237 |
|
|
#define TEST_VM_PROT_RDWR_WRITE |
238 |
|
|
#include "vm_alloc.cpp" |
239 |
|
|
], , ac_cv_vm_protect_works=no, |
240 |
|
|
dnl When cross-compiling, do not assume anything |
241 |
|
|
ac_cv_vm_protect_works="guessing no" |
242 |
|
|
) |
243 |
|
|
AC_LANG_RESTORE |
244 |
|
|
] |
245 |
|
|
) |
246 |
|
|
|
247 |
|
|
dnl Remove support for vm_allocate() if vm_protect() does not work |
248 |
|
|
if [[ "x$have_mach_vm" = "xyes" ]]; then |
249 |
|
|
case $ac_cv_vm_protect_works in |
250 |
|
|
*yes) have_mach_vm=yes;; |
251 |
|
|
*no) have_mach_vm=no;; |
252 |
|
|
esac |
253 |
|
|
fi |
254 |
|
|
AC_TRANSLATE_DEFINE(HAVE_MACH_VM, "$have_mach_vm", |
255 |
|
|
[Define if your system has a working vm_allocate()-based memory allocator.]) |
256 |
|
|
|
257 |
|
|
fi dnl HAVE_MACH_VM |
258 |
|
|
|
259 |
|
|
dnl Various checks if the system supports mmap() and the like functions. |
260 |
|
|
dnl ... and Mach memory allocators are not supported |
261 |
|
|
have_mmap_vm=no |
262 |
|
|
if [[ "x$ac_cv_func_mmap" = "xyes" -a "x$ac_cv_func_munmap" = "xyes" -a \ |
263 |
|
|
"x$ac_cv_func_mprotect" = "xyes" ]]; then |
264 |
|
|
if [[ "x$have_mach_vm" = "xno" ]]; then |
265 |
|
|
have_mmap_vm=yes |
266 |
|
|
fi |
267 |
|
|
fi |
268 |
|
|
AC_TRANSLATE_DEFINE(HAVE_MMAP_VM, "$have_mmap_vm", |
269 |
|
|
[Define if your system has a working mmap()-based memory allocator.]) |
270 |
|
|
|
271 |
|
|
dnl Check that mmap() and associated functions work. |
272 |
|
|
if [[ "x$have_mmap_vm" = "xyes" ]]; then |
273 |
|
|
|
274 |
|
|
dnl Check if we have a working anonymous mmap() |
275 |
|
|
AC_CACHE_CHECK([whether mmap supports MAP_ANON], |
276 |
|
|
ac_cv_mmap_anon, [ |
277 |
|
|
AC_LANG_SAVE |
278 |
|
|
AC_LANG_CPLUSPLUS |
279 |
|
|
AC_TRY_RUN([ |
280 |
|
|
#define HAVE_MMAP_ANON |
281 |
|
|
#define CONFIGURE_TEST_VM_MAP |
282 |
|
|
#define TEST_VM_MMAP_ANON |
283 |
|
|
#include "vm_alloc.cpp" |
284 |
|
|
], ac_cv_mmap_anon=yes, ac_cv_mmap_anon=no, |
285 |
|
|
dnl When cross-compiling, do not assume anything. |
286 |
|
|
ac_cv_mmap_anon="guessing no" |
287 |
|
|
) |
288 |
|
|
AC_LANG_RESTORE |
289 |
|
|
] |
290 |
|
|
) |
291 |
|
|
AC_TRANSLATE_DEFINE(HAVE_MMAP_ANON, "$ac_cv_mmap_anon", |
292 |
|
|
[Define if <sys/mman.h> defines MAP_ANON and mmap()'ing with MAP_ANON works.]) |
293 |
|
|
|
294 |
|
|
AC_CACHE_CHECK([whether mmap supports MAP_ANONYMOUS], |
295 |
|
|
ac_cv_mmap_anonymous, [ |
296 |
|
|
AC_LANG_SAVE |
297 |
|
|
AC_LANG_CPLUSPLUS |
298 |
|
|
AC_TRY_RUN([ |
299 |
|
|
#define HAVE_MMAP_ANONYMOUS |
300 |
|
|
#define CONFIGURE_TEST_VM_MAP |
301 |
|
|
#define TEST_VM_MMAP_ANON |
302 |
|
|
#include "vm_alloc.cpp" |
303 |
|
|
], ac_cv_mmap_anonymous=yes, ac_cv_mmap_anonymous=no, |
304 |
|
|
dnl When cross-compiling, do not assume anything. |
305 |
|
|
ac_cv_mmap_anonymous="guessing no" |
306 |
|
|
) |
307 |
|
|
AC_LANG_RESTORE |
308 |
|
|
] |
309 |
|
|
) |
310 |
|
|
AC_TRANSLATE_DEFINE(HAVE_MMAP_ANONYMOUS, "$ac_cv_mmap_anonymous", |
311 |
|
|
[Define if <sys/mman.h> defines MAP_ANONYMOUS and mmap()'ing with MAP_ANONYMOUS works.]) |
312 |
|
|
|
313 |
|
|
AC_CACHE_CHECK([whether mprotect works], |
314 |
|
|
ac_cv_mprotect_works, [ |
315 |
|
|
AC_LANG_SAVE |
316 |
|
|
AC_LANG_CPLUSPLUS |
317 |
|
|
ac_cv_mprotect_works=yes |
318 |
|
|
dnl First the tests that should segfault |
319 |
|
|
for test_def in NONE_READ NONE_WRITE READ_WRITE; do |
320 |
|
|
AC_TRY_RUN([ |
321 |
|
|
#define CONFIGURE_TEST_VM_MAP |
322 |
|
|
#define TEST_VM_PROT_$test_def |
323 |
|
|
#include "vm_alloc.cpp" |
324 |
|
|
], ac_cv_mprotect_works=no, rm -f core, |
325 |
|
|
dnl When cross-compiling, do not assume anything |
326 |
|
|
ac_cv_mprotect_works="guessing no" |
327 |
|
|
) |
328 |
|
|
done |
329 |
|
|
AC_TRY_RUN([ |
330 |
|
|
#define CONFIGURE_TEST_VM_MAP |
331 |
|
|
#define TEST_VM_PROT_RDWR_WRITE |
332 |
|
|
#include "vm_alloc.cpp" |
333 |
|
|
], , ac_cv_mprotect_works=no, |
334 |
|
|
dnl When cross-compiling, do not assume anything |
335 |
|
|
ac_cv_mprotect_works="guessing no" |
336 |
|
|
) |
337 |
|
|
AC_LANG_RESTORE |
338 |
|
|
] |
339 |
|
|
) |
340 |
|
|
|
341 |
|
|
dnl Remove support for mmap() if mprotect() does not work |
342 |
|
|
if [[ "x$have_mmap_vm" = "xyes" ]]; then |
343 |
|
|
case $ac_cv_mprotect_works in |
344 |
|
|
*yes) have_mmap_vm=yes;; |
345 |
|
|
*no) have_mmap_vm=no;; |
346 |
|
|
esac |
347 |
|
|
fi |
348 |
|
|
AC_TRANSLATE_DEFINE(HAVE_MMAP_VM, $have_mmap_vm, |
349 |
|
|
[Define if your system has a working mmap()-based memory allocator.]) |
350 |
|
|
|
351 |
|
|
fi dnl HAVE_MMAP_VM |
352 |
|
|
|
353 |
|
|
dnl Check if we can mmap 0x2000 bytes from 0x0000 |
354 |
|
|
AC_CACHE_CHECK([whether we can map Low Memory area 0x0000-0x2000], |
355 |
|
|
ac_cv_can_map_lm, [ |
356 |
|
|
AC_LANG_SAVE |
357 |
|
|
AC_LANG_CPLUSPLUS |
358 |
|
|
AC_TRY_RUN([ |
359 |
|
|
#include "vm_alloc.cpp" |
360 |
|
|
int main(void) { /* returns 0 if we could map the lowmem globals */ |
361 |
|
|
volatile char * lm = 0; |
362 |
|
|
if (vm_init() < 0) exit(1); |
363 |
|
|
if (vm_acquire_fixed(0, 0x2000) < 0) exit(1); |
364 |
|
|
lm[0] = 'z'; |
365 |
|
|
if (vm_release((char *)lm, 0x2000) < 0) exit(1); |
366 |
|
|
vm_exit(); exit(0); |
367 |
|
|
} |
368 |
|
|
], ac_cv_can_map_lm=yes, ac_cv_can_map_lm=no, |
369 |
|
|
dnl When cross-compiling, do not assume anything. |
370 |
|
|
ac_cv_can_map_lm="guessing no" |
371 |
|
|
) |
372 |
|
|
AC_LANG_RESTORE |
373 |
|
|
] |
374 |
|
|
) |
375 |
|
|
|
376 |
|
|
dnl Check signal handlers need to be reinstalled |
377 |
|
|
AC_CACHE_CHECK([whether signal handlers need to be reinstalled], |
378 |
|
|
ac_cv_signal_need_reinstall, [ |
379 |
|
|
AC_LANG_SAVE |
380 |
|
|
AC_LANG_CPLUSPLUS |
381 |
|
|
AC_TRY_RUN([ |
382 |
|
|
#include <stdlib.h> |
383 |
|
|
#ifdef HAVE_UNISTD_H |
384 |
|
|
#include <unistd.h> |
385 |
|
|
#endif |
386 |
|
|
#include <signal.h> |
387 |
|
|
static int handled_signal = 0; |
388 |
|
|
RETSIGTYPE sigusr1_handler(int) { handled_signal++; } |
389 |
|
|
int main(void) { /* returns 0 if signals need not to be reinstalled */ |
390 |
|
|
signal(SIGUSR1, sigusr1_handler); raise(SIGUSR1); raise(SIGUSR1); |
391 |
|
|
exit(handled_signal == 2); |
392 |
|
|
} |
393 |
|
|
], ac_cv_signal_need_reinstall=yes, ac_cv_signal_need_reinstall=no, |
394 |
|
|
dnl When cross-compiling, do not assume anything. |
395 |
|
|
ac_cv_signal_need_reinstall="guessing yes" |
396 |
|
|
) |
397 |
|
|
AC_LANG_RESTORE |
398 |
|
|
] |
399 |
|
|
) |
400 |
|
|
AC_TRANSLATE_DEFINE(SIGNAL_NEED_REINSTALL, "$ac_cv_signal_need_reinstall", |
401 |
|
|
[Define if your system requires signals to be reinstalled.]) |
402 |
|
|
|
403 |
|
|
dnl Check if sigaction handlers need to be reinstalled |
404 |
|
|
AC_CACHE_CHECK([whether sigaction handlers need to be reinstalled], |
405 |
|
|
ac_cv_sigaction_need_reinstall, [ |
406 |
|
|
AC_LANG_SAVE |
407 |
|
|
AC_LANG_CPLUSPLUS |
408 |
|
|
AC_TRY_RUN([ |
409 |
|
|
#include <stdlib.h> |
410 |
|
|
#ifdef HAVE_UNISTD_H |
411 |
|
|
#include <unistd.h> |
412 |
|
|
#endif |
413 |
|
|
#include <signal.h> |
414 |
|
|
static int handled_signal = 0; |
415 |
|
|
RETSIGTYPE sigusr1_handler(int) { handled_signal++; } |
416 |
|
|
typedef RETSIGTYPE (*signal_handler)(int); |
417 |
|
|
static signal_handler mysignal(int sig, signal_handler handler) { |
418 |
|
|
struct sigaction old_sa; |
419 |
|
|
struct sigaction new_sa; |
420 |
|
|
new_sa.sa_handler = handler; |
421 |
|
|
return ((sigaction(sig,&new_sa,&old_sa) < 0) ? SIG_IGN : old_sa.sa_handler); |
422 |
|
|
} |
423 |
|
|
int main(void) { /* returns 0 if signals need not to be reinstalled */ |
424 |
|
|
mysignal(SIGUSR1, sigusr1_handler); raise(SIGUSR1); raise(SIGUSR1); |
425 |
|
|
exit(handled_signal == 2); |
426 |
|
|
} |
427 |
|
|
], ac_cv_sigaction_need_reinstall=yes, ac_cv_sigaction_need_reinstall=no, |
428 |
|
|
dnl When cross-compiling, do not assume anything. |
429 |
|
|
ac_cv_sigaction_need_reinstall="guessing yes" |
430 |
|
|
) |
431 |
|
|
AC_LANG_RESTORE |
432 |
|
|
] |
433 |
|
|
) |
434 |
|
|
AC_TRANSLATE_DEFINE(SIGACTION_NEED_REINSTALL, "$ac_cv_sigaction_need_reinstall", |
435 |
|
|
[Define if your system requires sigactions to be reinstalled.]) |
436 |
|
|
|
437 |
|
|
dnl Check if extended signals are supported. |
438 |
|
|
AC_CACHE_CHECK([whether your system supports extended signal handlers], |
439 |
|
|
ac_cv_have_extended_signals, [ |
440 |
|
|
AC_LANG_SAVE |
441 |
|
|
AC_LANG_CPLUSPLUS |
442 |
|
|
AC_TRY_RUN([ |
443 |
|
|
#define HAVE_SIGINFO_T 1 |
444 |
|
|
#define CONFIGURE_TEST_SIGSEGV_RECOVERY |
445 |
|
|
#include "vm_alloc.cpp" |
446 |
|
|
#include "sigsegv.cpp" |
447 |
|
|
], ac_cv_have_extended_signals=yes, ac_cv_have_extended_signals=no, |
448 |
|
|
dnl When cross-compiling, do not assume anything. |
449 |
|
|
ac_cv_have_extended_signals=no |
450 |
|
|
) |
451 |
|
|
AC_LANG_RESTORE |
452 |
|
|
] |
453 |
|
|
) |
454 |
|
|
AC_TRANSLATE_DEFINE(HAVE_SIGINFO_T, "$ac_cv_have_extended_signals", |
455 |
|
|
[Define if your system support extended signals.]) |
456 |
|
|
|
457 |
|
|
dnl Otherwise, check for subterfuges. |
458 |
|
|
if [[ "x$ac_cv_have_extended_signals" = "xno" ]]; then |
459 |
|
|
AC_CACHE_CHECK([whether we then have a subterfuge for your system], |
460 |
|
|
ac_cv_have_sigcontext_hack, [ |
461 |
|
|
AC_LANG_SAVE |
462 |
|
|
AC_LANG_CPLUSPLUS |
463 |
|
|
AC_TRY_RUN([ |
464 |
|
|
#define HAVE_SIGCONTEXT_SUBTERFUGE 1 |
465 |
|
|
#define CONFIGURE_TEST_SIGSEGV_RECOVERY |
466 |
|
|
#include "vm_alloc.cpp" |
467 |
|
|
#include "sigsegv.cpp" |
468 |
|
|
], ac_cv_have_sigcontext_hack=yes, ac_cv_have_sigcontext_hack=no, |
469 |
|
|
dnl When cross-compiling, do not assume anything. |
470 |
|
|
ac_cv_have_sigcontext_hack=no |
471 |
|
|
) |
472 |
|
|
AC_LANG_RESTORE |
473 |
|
|
]) |
474 |
|
|
AC_TRANSLATE_DEFINE(HAVE_SIGCONTEXT_SUBTERFUGE, "$ac_cv_have_sigcontext_hack", |
475 |
|
|
[Define if we know a hack to replace siginfo_t->si_addr member.]) |
476 |
|
|
fi |
477 |
|
|
|
478 |
|
|
dnl Check if we can ignore the fault (instruction skipping in SIGSEGV handler) |
479 |
|
|
AC_CACHE_CHECK([whether we can skip instruction in SIGSEGV handler], |
480 |
|
|
ac_cv_have_skip_instruction, [ |
481 |
|
|
AC_LANG_SAVE |
482 |
|
|
AC_LANG_CPLUSPLUS |
483 |
|
|
AC_TRY_RUN([ |
484 |
|
|
#define HAVE_SIGSEGV_SKIP_INSTRUCTION 1 |
485 |
|
|
#define CONFIGURE_TEST_SIGSEGV_RECOVERY |
486 |
|
|
#include "vm_alloc.cpp" |
487 |
|
|
#include "sigsegv.cpp" |
488 |
|
|
], ac_cv_have_skip_instruction=yes, ac_cv_have_skip_instruction=no, |
489 |
|
|
dnl When cross-compiling, do not assume anything. |
490 |
|
|
ac_cv_have_skip_instruction=no |
491 |
|
|
) |
492 |
|
|
AC_LANG_RESTORE |
493 |
|
|
] |
494 |
|
|
) |
495 |
|
|
AC_TRANSLATE_DEFINE(HAVE_SIGSEGV_SKIP_INSTRUCTION, "$ac_cv_have_skip_instruction", |
496 |
|
|
[Define if we can ignore the fault (instruction skipping in SIGSEGV handler).]) |
497 |
cebix |
1.1 |
|
498 |
gbeauche |
1.5 |
dnl Can we do Video on SEGV Signals ? |
499 |
|
|
CAN_VOSF=no |
500 |
|
|
if [[ "$ac_cv_have_extended_signals" = "yes" -o "$ac_cv_have_sigcontext_hack" = "yes" ]]; then |
501 |
|
|
CAN_VOSF=yes |
502 |
|
|
fi |
503 |
|
|
|
504 |
|
|
dnl Enable VOSF screen updates with this feature is requested and feasible |
505 |
|
|
if [[ "x$WANT_VOSF" = "xyes" -a "x$CAN_VOSF" = "xyes" ]]; then |
506 |
|
|
AC_DEFINE(ENABLE_VOSF, 1, [Define if using video enabled on SEGV signals.]) |
507 |
|
|
else |
508 |
|
|
WANT_VOSF=no |
509 |
|
|
fi |
510 |
|
|
|
511 |
cebix |
1.1 |
dnl Generate Makefile. |
512 |
|
|
AC_SUBST(SYSSRCS) |
513 |
|
|
AC_OUTPUT(Makefile) |
514 |
|
|
|
515 |
|
|
dnl Print summary. |
516 |
|
|
echo |
517 |
|
|
echo SheepShaver configuration summary: |
518 |
|
|
echo |
519 |
|
|
echo XFree86 DGA support .............. : $WANT_XF86_DGA |
520 |
|
|
echo XFree86 VidMode support .......... : $WANT_XF86_VIDMODE |
521 |
gbeauche |
1.6 |
echo Using PowerPC emulator ........... : $EMULATED_PPC |
522 |
gbeauche |
1.5 |
echo Enable video on SEGV signals ..... : $WANT_VOSF |
523 |
cebix |
1.1 |
echo ESD sound support ................ : $WANT_ESD |
524 |
|
|
echo GTK user interface ............... : $WANT_GTK |
525 |
|
|
echo mon debugger support ............. : $WANT_MON |
526 |
|
|
echo |
527 |
|
|
echo "Configuration done. Now type \"make\"." |