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