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