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