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