1 |
dnl Process this file with autoconf to produce a configure script. |
2 |
dnl Written in 2002 by Christian Bauer et al. |
3 |
|
4 |
AC_INIT([Basilisk II], 1.0, [Christian.Bauer@uni-mainz.de], BasiliskII) |
5 |
AC_CONFIG_SRCDIR(main_unix.cpp) |
6 |
AC_PREREQ(2.52) |
7 |
AC_CONFIG_HEADER(config.h) |
8 |
|
9 |
dnl Aliases for PACKAGE and VERSION macros. |
10 |
AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE_NAME", [Define this program name.]) |
11 |
AC_DEFINE_UNQUOTED(VERSION, "$PACKAGE_VERSION", [Define this program version.]) |
12 |
|
13 |
dnl Some systems do not put corefiles in the currect directory, avoid saving |
14 |
dnl cores for the configure tests since some are intended to dump core. |
15 |
ulimit -c 0 |
16 |
|
17 |
dnl Video options. |
18 |
AC_ARG_ENABLE(xf86-dga, [ --enable-xf86-dga use the XFree86 DGA extension [default=yes]], [WANT_XF86_DGA=$enableval], [WANT_XF86_DGA=yes]) |
19 |
AC_ARG_ENABLE(xf86-vidmode, [ --enable-xf86-vidmode use the XFree86 VidMode extension [default=yes]], [WANT_XF86_VIDMODE=$enableval], [WANT_XF86_VIDMODE=yes]) |
20 |
AC_ARG_ENABLE(fbdev-dga, [ --enable-fbdev-dga use direct frame buffer access via /dev/fb [default=yes]], [WANT_FBDEV_DGA=$enableval], [WANT_FBDEV_DGA=yes]) |
21 |
AC_ARG_ENABLE(vosf, [ --enable-vosf enable video on SEGV signals [default=yes]], [WANT_VOSF=$enableval], [WANT_VOSF=yes]) |
22 |
|
23 |
dnl SDL options. |
24 |
AC_ARG_ENABLE(sdl-static, [ --enable-sdl-static use SDL static libraries for linking [default=no]], [WANT_SDL_STATIC=$enableval], [WANT_SDL_STATIC=no]) |
25 |
AC_ARG_ENABLE(sdl-video, [ --enable-sdl-video use SDL for video graphics [default=no]], [WANT_SDL_VIDEO=$enableval], [WANT_SDL_VIDEO=no]) |
26 |
AC_ARG_ENABLE(sdl-audio, [ --enable-sdl-audio use SDL for audio [default=no]], [WANT_SDL_AUDIO=$enableval], [WANT_SDL_AUDIO=no]) |
27 |
|
28 |
dnl JIT compiler options. |
29 |
AC_ARG_ENABLE(jit-compiler, [ --enable-jit-compiler enable JIT compiler [default=no]], [WANT_JIT=$enableval], [WANT_JIT=no]) |
30 |
AC_ARG_ENABLE(jit-debug, [ --enable-jit-debug activate native code disassemblers [default=no]], [WANT_JIT_DEBUG=$enableval], [WANT_JIT_DEBUG=no]) |
31 |
|
32 |
dnl FPU emulation core. |
33 |
AC_ARG_ENABLE(fpe, |
34 |
[ --enable-fpe=FPE specify which fpu emulator to use [default=auto]], |
35 |
[ case "$enableval" in |
36 |
dnl default is always ieee, if architecture has this fp format |
37 |
auto) FPE_CORE_TEST_ORDER="ieee uae";; |
38 |
ieee) FPE_CORE_TEST_ORDER="ieee";; |
39 |
uae) FPE_CORE_TEST_ORDER="uae";; |
40 |
x86) FPE_CORE_TEST_ORDER="x86";; |
41 |
*) AC_MSG_ERROR([--enable-fpe takes only one of the following values: auto, x86, ieee, uae]);; |
42 |
esac |
43 |
], |
44 |
[ FPE_CORE_TEST_ORDER="ieee uae" |
45 |
]) |
46 |
|
47 |
dnl Addressing modes. |
48 |
AC_ARG_ENABLE(addressing, |
49 |
[ --enable-addressing=AM specify the addressing mode to use [default=fastest]], |
50 |
[ case "$enableval" in |
51 |
real) ADDRESSING_TEST_ORDER="real";; |
52 |
direct) ADDRESSING_TEST_ORDER="direct";; |
53 |
banks) ADDRESSING_TEST_ORDER="banks";; |
54 |
fastest)ADDRESSING_TEST_ORDER="direct banks";; |
55 |
*) AC_MSG_ERROR([--enable-addressing takes only one of the following values: fastest, real, direct, banks]);; |
56 |
esac |
57 |
], |
58 |
[ ADDRESSING_TEST_ORDER="direct banks" |
59 |
]) |
60 |
|
61 |
dnl External packages. |
62 |
AC_ARG_WITH(esd, [ --with-esd support ESD for sound under Linux/FreeBSD [default=yes]], [WANT_ESD=$withval], [WANT_ESD=yes]) |
63 |
AC_ARG_WITH(gtk, [ --with-gtk use GTK user interface [default=yes]], [WANT_GTK=$withval], [WANT_GTK=yes]) |
64 |
AC_ARG_WITH(mon, [ --with-mon use mon as debugger [default=yes]], [WANT_MON=$withval], [WANT_MON=yes]) |
65 |
|
66 |
dnl Canonical system information. |
67 |
AC_CANONICAL_HOST |
68 |
AC_CANONICAL_TARGET |
69 |
|
70 |
dnl Target OS type (target is host if not cross-compiling). |
71 |
case "$target_os" in |
72 |
linux*) OS_TYPE=linux;; |
73 |
netbsd*) OS_TYPE=netbsd;; |
74 |
freebsd*) OS_TYPE=freebsd;; |
75 |
solaris*) OS_TYPE=solaris;; |
76 |
darwin*) OS_TYPE=darwin;; |
77 |
*) OS_TYPE=`echo $target_os | sed -e 's/-/_/g' | sed -e 's/\./_/g'`;; |
78 |
esac |
79 |
DEFINES="$DEFINES -DOS_$OS_TYPE" |
80 |
|
81 |
dnl Target CPU type. |
82 |
HAVE_I386=no |
83 |
HAVE_M68K=no |
84 |
HAVE_SPARC=no |
85 |
HAVE_POWERPC=no |
86 |
HAVE_X86_64=no |
87 |
case "$target_cpu" in |
88 |
i386* | i486* | i586* | i686* | i786* ) HAVE_I386=yes;; |
89 |
m68k* ) HAVE_M68K=yes;; |
90 |
sparc* ) HAVE_SPARC=yes;; |
91 |
powerpc* ) HAVE_POWERPC=yes;; |
92 |
x86_64* ) HAVE_X86_64=yes;; |
93 |
esac |
94 |
|
95 |
dnl Checks for programs. |
96 |
AC_PROG_CC |
97 |
AC_PROG_CC_C_O |
98 |
AC_PROG_CPP |
99 |
AC_PROG_CXX |
100 |
AC_PROG_MAKE_SET |
101 |
AC_PROG_INSTALL |
102 |
AC_PROG_EGREP |
103 |
|
104 |
dnl We use mon if possible. |
105 |
MONSRCS= |
106 |
if [[ "x$WANT_MON" = "xyes" ]]; then |
107 |
AC_MSG_CHECKING(for mon) |
108 |
mon_srcdir=../../../mon/src |
109 |
if grep mon_init $mon_srcdir/mon.h >/dev/null 2>/dev/null; then |
110 |
AC_MSG_RESULT(yes) |
111 |
AC_DEFINE(ENABLE_MON, 1, [Define if using "mon".]) |
112 |
MONSRCS="$mon_srcdir/mon.cpp $mon_srcdir/mon_6502.cpp $mon_srcdir/mon_z80.cpp $mon_srcdir/mon_cmd.cpp $mon_srcdir/mon_disass.cpp $mon_srcdir/mon_ppc.cpp $mon_srcdir/mon_lowmem.cpp $mon_srcdir/disass/floatformat.c $mon_srcdir/disass/i386-dis.c $mon_srcdir/disass/m68k-dis.c $mon_srcdir/disass/m68k-opc.c" |
113 |
CXXFLAGS="$CXXFLAGS -I$mon_srcdir -I$mon_srcdir/disass" |
114 |
AC_CHECK_LIB(ncurses, tgetent, , |
115 |
AC_CHECK_LIB(termcap, tgetent, , |
116 |
AC_CHECK_LIB(termlib, tgetent, , |
117 |
AC_CHECK_LIB(terminfo, tgetent, , |
118 |
AC_CHECK_LIB(Hcurses, tgetent, , |
119 |
AC_CHECK_LIB(curses, tgetent)))))) |
120 |
AC_CHECK_LIB(readline, readline) |
121 |
else |
122 |
AC_MSG_RESULT(no) |
123 |
AC_MSG_WARN([Could not find mon, ignoring --with-mon.]) |
124 |
WANT_MON=no |
125 |
fi |
126 |
fi |
127 |
|
128 |
dnl Checks for libraries. |
129 |
AC_CHECK_LIB(posix4, sem_init) |
130 |
AC_CHECK_LIB(rt, timer_create) |
131 |
AC_CHECK_LIB(rt, shm_open) |
132 |
|
133 |
dnl Do we need SDL? |
134 |
WANT_SDL=no |
135 |
if [[ "x$WANT_SDL_VIDEO" = "xyes" ]]; then |
136 |
WANT_SDL=yes |
137 |
WANT_XF86_DGA=no |
138 |
WANT_XF86_VIDMODE=no |
139 |
WANT_FBDEV_DGA=no |
140 |
SDL_SUPPORT="$SDL_SUPPORT video" |
141 |
fi |
142 |
if [[ "x$WANT_SDL_AUDIO" = "xyes" ]]; then |
143 |
WANT_SDL=yes |
144 |
SDL_SUPPORT="$SDL_SUPPORT audio" |
145 |
fi |
146 |
if [[ "x$WANT_SDL" = "xyes" ]]; then |
147 |
AC_PATH_PROG(sdl_config, "sdl-config") |
148 |
if [[ -n "$sdl_config" ]]; then |
149 |
case $target_os in |
150 |
# Special treatment for Cygwin so that we can still use the POSIX layer |
151 |
*cygwin*) |
152 |
sdl_cflags="-I`$sdl_config --prefix`/include/SDL" |
153 |
sdl_libs="-L`$sdl_config --exec-prefix`/lib -lSDL" |
154 |
;; |
155 |
*) |
156 |
sdl_cflags=`$sdl_config --cflags` |
157 |
if [[ "x$WANT_SDL_STATIC" = "xyes" ]]; then |
158 |
sdl_libs=`$sdl_config --static-libs` |
159 |
else |
160 |
sdl_libs=`$sdl_config --libs` |
161 |
fi |
162 |
;; |
163 |
esac |
164 |
CFLAGS="$CFLAGS $sdl_cflags" |
165 |
CXXFLAGS="$CXXFLAGS $sdl_cflags" |
166 |
LIBS="$LIBS $sdl_libs" |
167 |
else |
168 |
WANT_SDL=no |
169 |
fi |
170 |
SDL_SUPPORT=`echo "$SDL_SUPPORT" | sed -e "s/^ //"` |
171 |
else |
172 |
SDL_SUPPORT="none" |
173 |
fi |
174 |
|
175 |
dnl We need X11, if not using SDL. |
176 |
if [[ "x$WANT_SDL" = "xno" ]]; then |
177 |
AC_PATH_XTRA |
178 |
if [[ "x$no_x" = "xyes" ]]; then |
179 |
AC_MSG_ERROR([You need X11 to run Basilisk II.]) |
180 |
fi |
181 |
CFLAGS="$CFLAGS $X_CFLAGS" |
182 |
CXXFLAGS="$CXXFLAGS $X_CFLAGS" |
183 |
LIBS="$LIBS $X_PRE_LIBS $X_LIBS -lX11 -lXext $X_EXTRA_LIBS" |
184 |
fi |
185 |
|
186 |
dnl We want pthreads. Try libpthread first, then libc_r (FreeBSD), then PTL. |
187 |
HAVE_PTHREADS=yes |
188 |
AC_CHECK_LIB(pthread, pthread_create, , [ |
189 |
AC_CHECK_LIB(c_r, pthread_create, , [ |
190 |
AC_CHECK_LIB(PTL, pthread_create, , [ |
191 |
HAVE_PTHREADS=no |
192 |
]) |
193 |
]) |
194 |
]) |
195 |
if [[ "x$HAVE_PTHREADS" = "xyes" ]]; then |
196 |
AC_DEFINE(HAVE_PTHREADS, 1, [Define if pthreads are available.]) |
197 |
fi |
198 |
AC_CHECK_FUNCS(pthread_cancel) |
199 |
AC_CHECK_FUNCS(pthread_mutexattr_setprotocol) |
200 |
AC_CHECK_FUNCS(pthread_mutexattr_settype) |
201 |
AC_CHECK_FUNCS(pthread_mutexattr_setpshared) |
202 |
|
203 |
dnl If POSIX.4 semaphores are not available, we emulate them with pthread mutexes. |
204 |
SEMSRC= |
205 |
AC_CHECK_FUNCS(sem_init, , [ |
206 |
if test "x$HAVE_PTHREADS" = "xyes"; then |
207 |
SEMSRC=posix_sem.cpp |
208 |
fi |
209 |
]) |
210 |
|
211 |
dnl We use DGA (XFree86 or fbdev) if possible. |
212 |
if [[ "x$WANT_XF86_DGA" = "xyes" ]]; then |
213 |
AC_CHECK_LIB(Xxf86dga, XF86DGAQueryExtension, [ |
214 |
AC_DEFINE(ENABLE_XF86_DGA, 1, [Define if using XFree86 DGA extension.]) |
215 |
LIBS="$LIBS -lXxf86dga" |
216 |
if [[ "x$WANT_FBDEV_DGA" = "xyes" ]]; then |
217 |
AC_MSG_WARN([Cannot have both --enable-xf86-dga and --enable-fbdev-dga, ignoring --enable-fbdev-dga.]) |
218 |
WANT_FBDEV_DGA=no |
219 |
fi |
220 |
], [ |
221 |
AC_MSG_WARN([Could not find XFree86 DGA extension, ignoring --enable-xf86-dga.]) |
222 |
WANT_XF86_DGA=no |
223 |
]) |
224 |
fi |
225 |
if [[ "x$WANT_FBDEV_DGA" = "xyes" ]]; then |
226 |
AC_DEFINE(ENABLE_FBDEV_DGA, 1, [Define if using DGA with framebuffer device.]) |
227 |
fi |
228 |
|
229 |
dnl We use XFree86 VidMode if possible. |
230 |
if [[ "x$WANT_XF86_VIDMODE" = "xyes" ]]; then |
231 |
AC_CHECK_LIB(Xxf86vm, XF86VidModeQueryExtension, [ |
232 |
AC_DEFINE(ENABLE_XF86_VIDMODE, 1, [Define if using XFree86 DGA extension.]) |
233 |
LIBS="$LIBS -lXxf86vm" |
234 |
], [ |
235 |
AC_MSG_WARN([Could not find XFree86 VidMode extension, ignoring --enable-xf86-vidmode.]) |
236 |
WANT_XF86_VIDMODE=no |
237 |
]) |
238 |
fi |
239 |
|
240 |
dnl We use GTK+ if possible. |
241 |
UISRCS=../dummy/prefs_editor_dummy.cpp |
242 |
if [[ "x$WANT_GTK" = "xyes" ]]; then |
243 |
AM_PATH_GTK(1.2.0, [ |
244 |
AC_DEFINE(ENABLE_GTK, 1, [Define if using GTK.]) |
245 |
CXXFLAGS="$CXXFLAGS $GTK_CFLAGS" |
246 |
LIBS="$LIBS $GTK_LIBS" |
247 |
UISRCS=prefs_editor_gtk.cpp |
248 |
dnl somehow, <gnome-i18n.h> would redefine gettext() to nothing if |
249 |
dnl ENABLE_NLS is not set, thusly conflicting with C++ <string> which |
250 |
dnl includes <libintl.h> |
251 |
AM_GNU_GETTEXT |
252 |
B2_PATH_GNOMEUI([ |
253 |
AC_DEFINE(HAVE_GNOMEUI, 1, [Define if libgnomeui is available.]) |
254 |
CXXFLAGS="$CXXFLAGS $GNOMEUI_CFLAGS" |
255 |
LIBS="$LIBS $GNOMEUI_LIBS" |
256 |
], []) |
257 |
], [ |
258 |
AC_MSG_WARN([Could not find GTK+, disabling user interface.]) |
259 |
WANT_GTK=no |
260 |
]) |
261 |
fi |
262 |
|
263 |
dnl We use ESD if possible. |
264 |
if [[ "x$WANT_ESD" = "xyes" ]]; then |
265 |
AM_PATH_ESD(0.2.8, [ |
266 |
AC_DEFINE(ENABLE_ESD, 1, [Define is using ESD.]) |
267 |
CFLAGS="$CFLAGS $ESD_CFLAGS" |
268 |
CXXFLAGS="$CXXFLAGS $ESD_CFLAGS" |
269 |
LIBS="$LIBS $ESD_LIBS" |
270 |
], [ |
271 |
AC_MSG_WARN([Could not find ESD, disabling ESD support.]) |
272 |
WANT_ESD=no |
273 |
]) |
274 |
fi |
275 |
|
276 |
dnl We use 64-bit file size support if possible. |
277 |
AC_SYS_LARGEFILE |
278 |
|
279 |
dnl Checks for header files. |
280 |
AC_HEADER_STDC |
281 |
AC_CHECK_HEADERS(unistd.h fcntl.h sys/types.h sys/time.h sys/mman.h mach/mach.h) |
282 |
AC_CHECK_HEADERS(readline.h history.h readline/readline.h readline/history.h) |
283 |
AC_CHECK_HEADERS(sys/socket.h sys/ioctl.h sys/filio.h sys/bitypes.h sys/wait.h) |
284 |
AC_CHECK_HEADERS(sys/poll.h sys/select.h) |
285 |
AC_CHECK_HEADERS(arpa/inet.h) |
286 |
AC_CHECK_HEADERS(linux/if.h linux/if_tun.h net/if.h net/if_tun.h, [], [], [ |
287 |
#ifdef HAVE_SYS_TYPES_H |
288 |
#include <sys/types.h> |
289 |
#endif |
290 |
#ifdef HAVE_SYS_SOCKET_H |
291 |
#include <sys/socket.h> |
292 |
#endif |
293 |
]) |
294 |
AC_CHECK_HEADERS(AvailabilityMacros.h) |
295 |
|
296 |
dnl Checks for typedefs, structures, and compiler characteristics. |
297 |
AC_C_BIGENDIAN |
298 |
AC_C_CONST |
299 |
AC_C_INLINE |
300 |
AC_CHECK_SIZEOF(short, 2) |
301 |
AC_CHECK_SIZEOF(int, 4) |
302 |
AC_CHECK_SIZEOF(long, 4) |
303 |
AC_CHECK_SIZEOF(long long, 8) |
304 |
AC_CHECK_SIZEOF(float, 4) |
305 |
AC_CHECK_SIZEOF(double, 8) |
306 |
AC_CHECK_SIZEOF(long double, 12) |
307 |
AC_CHECK_SIZEOF(void *, 4) |
308 |
AC_TYPE_OFF_T |
309 |
AC_CHECK_TYPES(loff_t) |
310 |
AC_CHECK_TYPES(caddr_t) |
311 |
AC_TYPE_SIZE_T |
312 |
AC_TYPE_SIGNAL |
313 |
AC_HEADER_TIME |
314 |
AC_STRUCT_TM |
315 |
|
316 |
dnl Check whether sys/socket.h defines type socklen_t. |
317 |
dnl (extracted from ac-archive/Miscellaneous) |
318 |
AC_CACHE_CHECK([for socklen_t], |
319 |
ac_cv_type_socklen_t, [ |
320 |
AC_TRY_COMPILE([ |
321 |
#include <sys/types.h> |
322 |
#include <sys/socket.h> |
323 |
], [socklen_t len = 42; return 0;], |
324 |
ac_cv_type_socklen_t=yes, ac_cv_type_socklen_t=no, |
325 |
dnl When cross-compiling, do not assume anything. |
326 |
ac_cv_type_socklen_t="guessing no" |
327 |
) |
328 |
]) |
329 |
if [[ "x$ac_cv_type_socklen_t" != "xyes" ]]; then |
330 |
AC_DEFINE(socklen_t, int, [Define to 'int' if <sys/types.h> doesn't define.]) |
331 |
fi |
332 |
|
333 |
dnl Checks for library functions. |
334 |
AC_CHECK_FUNCS(strdup strerror cfmakeraw) |
335 |
AC_CHECK_FUNCS(clock_gettime timer_create) |
336 |
AC_CHECK_FUNCS(sigaction signal) |
337 |
AC_CHECK_FUNCS(mmap mprotect munmap) |
338 |
AC_CHECK_FUNCS(vm_allocate vm_deallocate vm_protect) |
339 |
AC_CHECK_FUNCS(poll inet_aton) |
340 |
|
341 |
dnl Darwin seems to define mach_task_self() instead of task_self(). |
342 |
AC_CHECK_FUNCS(mach_task_self task_self) |
343 |
|
344 |
dnl Check for headers and functions related to pty support (sshpty.c) |
345 |
dnl From openssh-3.2.2p1 configure.ac |
346 |
|
347 |
AC_CHECK_HEADERS(strings.h login.h sys/bsdtty.h sys/stat.h util.h pty.h) |
348 |
AC_CHECK_FUNCS(_getpty vhangup strlcpy) |
349 |
|
350 |
case "$host" in |
351 |
*-*-hpux10.26) |
352 |
disable_ptmx_check=yes |
353 |
;; |
354 |
*-*-linux*) |
355 |
no_dev_ptmx=1 |
356 |
;; |
357 |
mips-sony-bsd|mips-sony-newsos4) |
358 |
AC_DEFINE(HAVE_NEWS4, 1, [Define if you are on NEWS-OS (additions from openssh-3.2.2p1, for sshpty.c).]) |
359 |
;; |
360 |
*-*-sco3.2v4*) |
361 |
no_dev_ptmx=1 |
362 |
;; |
363 |
*-*-sco3.2v5*) |
364 |
no_dev_ptmx=1 |
365 |
;; |
366 |
*-*-cygwin*) |
367 |
no_dev_ptmx=1 |
368 |
;; |
369 |
esac |
370 |
|
371 |
if test -z "$no_dev_ptmx" ; then |
372 |
if test "x$disable_ptmx_check" != "xyes" ; then |
373 |
AC_CHECK_FILE([/dev/ptmx], |
374 |
[ |
375 |
AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX, 1, [Define if you have /dev/ptmx.]) |
376 |
have_dev_ptmx=1 |
377 |
] |
378 |
) |
379 |
fi |
380 |
fi |
381 |
AC_CHECK_FILE([/dev/ptc], |
382 |
[ |
383 |
AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC, 1, [Define if you have /dev/ptc.]) |
384 |
have_dev_ptc=1 |
385 |
] |
386 |
) |
387 |
|
388 |
dnl (end of code from openssh-3.2.2p1 configure.ac) |
389 |
|
390 |
|
391 |
dnl AC_CHECK_FRAMEWORK($1=NAME, $2=INCLUDES) |
392 |
AC_DEFUN(AC_CHECK_FRAMEWORK, [ |
393 |
AS_VAR_PUSHDEF([ac_Framework], [ac_cv_framework_$1])dnl |
394 |
AC_CACHE_CHECK([whether compiler supports framework $1], |
395 |
ac_Framework, [ |
396 |
saved_LIBS="$LIBS" |
397 |
LIBS="$LIBS -framework $1" |
398 |
AC_TRY_LINK( |
399 |
[$2], [int main(void) { return 0; }], |
400 |
[AS_VAR_SET(ac_Framework, yes)], [AS_VAR_SET(ac_Framework, no); LIBS="$saved_LIBS"] |
401 |
) |
402 |
]) |
403 |
AS_IF([test AS_VAR_GET(ac_Framework) = yes], |
404 |
[AC_DEFINE(AS_TR_CPP(HAVE_FRAMEWORK_$1), 1, [Define if framework $1 is available.])] |
405 |
) |
406 |
AS_VAR_POPDEF([ac_Framework])dnl |
407 |
]) |
408 |
|
409 |
dnl Check for some MacOS X frameworks |
410 |
AC_CHECK_FRAMEWORK(Carbon, [#include <Carbon/Carbon.h>]) |
411 |
AC_CHECK_FRAMEWORK(IOKit, [#include <IOKit/IOKitLib.h>]) |
412 |
|
413 |
dnl Select system-dependant source files. |
414 |
SERIALSRC=serial_unix.cpp |
415 |
ETHERSRC=../dummy/ether_dummy.cpp |
416 |
SCSISRC=../dummy/scsi_dummy.cpp |
417 |
AUDIOSRC=../dummy/audio_dummy.cpp |
418 |
EXTFSSRC=extfs_unix.cpp |
419 |
EXTRASYSSRCS= |
420 |
CAN_NATIVE_M68K=no |
421 |
case "$target_os" in |
422 |
linux*) |
423 |
ETHERSRC=ether_unix.cpp |
424 |
AUDIOSRC=audio_oss_esd.cpp |
425 |
SCSISRC=Linux/scsi_linux.cpp |
426 |
;; |
427 |
freebsd*) |
428 |
ETHERSRC=ether_unix.cpp |
429 |
AUDIOSRC=audio_oss_esd.cpp |
430 |
DEFINES="$DEFINES -DBSD_COMP" |
431 |
CXXFLAGS="$CXXFLAGS -fpermissive" |
432 |
dnl Check for the CAM library |
433 |
AC_CHECK_LIB(cam, cam_open_btl, HAVE_LIBCAM=yes, HAVE_LIBCAM=no) |
434 |
if [[ "x$HAVE_LIBCAM" = "xno" ]]; then |
435 |
AC_MSG_WARN([Cannot find libcam for SCSI management, disabling SCSI support.]) |
436 |
else |
437 |
dnl Check for the sys kernel includes |
438 |
AC_CHECK_HEADER(camlib.h) |
439 |
if [[ "x$ac_cv_header_camlib_h" = "xno" ]]; then |
440 |
dnl In this case I should fix this thing including a "patch" |
441 |
dnl to access directly to the functions in the kernel :) --Orlando |
442 |
AC_MSG_WARN([Cannot find includes for CAM library, disabling SCSI support.]) |
443 |
else |
444 |
SCSISRC=FreeBSD/scsi_freebsd.cpp |
445 |
LIBS="$LIBS -lcam" |
446 |
DEFINES="$DEFINES -DCAM" |
447 |
fi |
448 |
fi |
449 |
;; |
450 |
netbsd*) |
451 |
CAN_NATIVE_M68K=yes |
452 |
;; |
453 |
solaris*) |
454 |
AUDIOSRC=Solaris/audio_solaris.cpp |
455 |
DEFINES="$DEFINES -DBSD_COMP -D_POSIX_PTHREAD_SEMANTICS" |
456 |
;; |
457 |
irix*) |
458 |
ETHERSRC=ether_unix.cpp |
459 |
AUDIOSRC=Irix/audio_irix.cpp |
460 |
EXTRASYSSRCS=Irix/unaligned.c |
461 |
dnl IRIX headers work fine, but somehow don't define or use "STDC_HEADERS" |
462 |
DEFINES="$DEFINES -DCRTSCTS=CNEW_RTSCTS -DB230400=B115200 -DSTDC_HEADERS" |
463 |
LIBS="$LIBS -laudio" |
464 |
WANT_ESD=no |
465 |
|
466 |
dnl Check if our compiler supports -IPA (MIPSPro) |
467 |
HAVE_IPA=no |
468 |
ocflags="$CFLAGS" |
469 |
CFLAGS=`echo "$CFLAGS -IPA" | sed -e "s/-g//g"` |
470 |
AC_MSG_CHECKING(if "-IPA" works) |
471 |
dnl Do a test compile of an empty function |
472 |
AC_TRY_COMPILE(,, [AC_MSG_RESULT(yes); HAVE_IPA=yes], AC_MSG_RESULT(no)) |
473 |
CFLAGS="$ocflags" |
474 |
;; |
475 |
darwin*) |
476 |
if [[ "x$ac_cv_framework_IOKit" = "xyes" ]]; then |
477 |
EXTRASYSSRCS="../MacOSX/sys_darwin.cpp" |
478 |
fi |
479 |
if [[ "x$ac_cv_framework_Carbon" = "xyes" ]]; then |
480 |
EXTFSSRC=../MacOSX/extfs_macosx.mm |
481 |
fi |
482 |
;; |
483 |
cygwin*) |
484 |
SERIALSRC="../dummy/serial_dummy.cpp" |
485 |
EXTRASYSSRCS="../Windows/BasiliskII.rc" |
486 |
;; |
487 |
esac |
488 |
|
489 |
dnl Is the slirp library supported? |
490 |
if [[ "x$ETHERSRC" = "xether_unix.cpp" ]]; then |
491 |
AC_DEFINE(HAVE_SLIRP, 1, [Define if slirp library is supported]) |
492 |
SLIRP_SRCS="\ |
493 |
../slirp/bootp.c ../slirp/ip_output.c ../slirp/tcp_input.c \ |
494 |
../slirp/cksum.c ../slirp/mbuf.c ../slirp/tcp_output.c \ |
495 |
../slirp/debug.c ../slirp/misc.c ../slirp/tcp_subr.c \ |
496 |
../slirp/if.c ../slirp/sbuf.c ../slirp/tcp_timer.c \ |
497 |
../slirp/ip_icmp.c ../slirp/slirp.c ../slirp/tftp.c \ |
498 |
../slirp/ip_input.c ../slirp/socket.c ../slirp/udp.c" |
499 |
fi |
500 |
AC_SUBST(SLIRP_SRCS) |
501 |
|
502 |
dnl SDL overrides |
503 |
if [[ "x$WANT_SDL" = "xyes" ]]; then |
504 |
AC_DEFINE(USE_SDL, 1, [Define to enble SDL support]) |
505 |
fi |
506 |
if [[ "x$WANT_SDL_VIDEO" = "xyes" ]]; then |
507 |
AC_DEFINE(USE_SDL_VIDEO, 1, [Define to enable SDL video graphics support]) |
508 |
VIDEOSRCS="../SDL/video_sdl.cpp" |
509 |
KEYCODES="../SDL/keycodes" |
510 |
if [[ "x$ac_cv_framework_Carbon" = "xyes" ]]; then |
511 |
EXTRASYSSRCS="$EXTRASYSSRCS ../MacOSX/clip_macosx.cpp" |
512 |
else |
513 |
case "$target_os" in |
514 |
cygwin*) |
515 |
EXTRASYSSRCS="$EXTRASYSSRCS ../Windows/clip_windows.cpp" |
516 |
;; |
517 |
*) |
518 |
EXTRASYSSRCS="$EXTRASYSSRCS ../dummy/clip_dummy.cpp" |
519 |
;; |
520 |
esac |
521 |
fi |
522 |
else |
523 |
VIDEOSRCS="video_x.cpp" |
524 |
KEYCODES="keycodes" |
525 |
EXTRASYSSRCS="$EXTRASYSSRCS clip_unix.cpp" |
526 |
fi |
527 |
if [[ "x$WANT_SDL_AUDIO" = "xyes" ]]; then |
528 |
AC_DEFINE(USE_SDL_AUDIO, 1, [Define to enable SDL audio support]) |
529 |
AUDIOSRC="../SDL/audio_sdl.cpp" |
530 |
fi |
531 |
|
532 |
dnl Use 68k CPU natively? |
533 |
WANT_NATIVE_M68K=no |
534 |
if [[ "x$HAVE_M68K" = "xyes" -a "x$CAN_NATIVE_M68K" = "xyes" ]]; then |
535 |
AC_DEFINE(ENABLE_NATIVE_M68K, 1, [Define if using native 68k mode.]) |
536 |
WANT_NATIVE_M68K=yes |
537 |
fi |
538 |
|
539 |
if [[ "x$HAVE_PTHREADS" = "xno" ]]; then |
540 |
dnl Serial, ethernet and audio support needs pthreads |
541 |
AC_MSG_WARN([You don't have pthreads, disabling serial, ethernet and audio support.]) |
542 |
SERIALSRC=../dummy/serial_dummy.cpp |
543 |
ETHERSRC=../dummy/ether_dummy.cpp |
544 |
AUDIOSRC=../dummy/audio_dummy.cpp |
545 |
fi |
546 |
SYSSRCS="$VIDEOSRCS $EXTFSSRC $SERIALSRC $ETHERSRC $SCSISRC $AUDIOSRC $SEMSRC $UISRCS $MONSRCS $EXTRASYSSRCS" |
547 |
|
548 |
dnl Define a macro that translates a yesno-variable into a C macro definition |
549 |
dnl to be put into the config.h file |
550 |
dnl $1 -- the macro to define |
551 |
dnl $2 -- the value to translate |
552 |
dnl $3 -- template name |
553 |
AC_DEFUN(AC_TRANSLATE_DEFINE, [ |
554 |
if [[ "x$2" = "xyes" -o "x$2" = "xguessing yes" ]]; then |
555 |
AC_DEFINE($1, 1, $3) |
556 |
fi |
557 |
]) |
558 |
|
559 |
dnl Check that the host supports TUN/TAP devices |
560 |
AC_CACHE_CHECK([whether TUN/TAP is supported], |
561 |
ac_cv_tun_tap_support, [ |
562 |
AC_TRY_COMPILE([ |
563 |
#if defined(HAVE_LINUX_IF_H) && defined(HAVE_LINUX_IF_TUN_H) |
564 |
#include <linux/if.h> |
565 |
#include <linux/if_tun.h> |
566 |
#endif |
567 |
#if defined(HAVE_NET_IF_H) && defined(HAVE_NET_IF_TUN_H) |
568 |
#include <net/if.h> |
569 |
#include <net/if_tun.h> |
570 |
#endif |
571 |
], [ |
572 |
struct ifreq ifr; |
573 |
memset(&ifr, 0, sizeof(ifr)); |
574 |
ifr.ifr_flags = IFF_TAP | IFF_NO_PI; |
575 |
], |
576 |
ac_cv_tun_tap_support=yes, ac_cv_tun_tap_support=no |
577 |
) |
578 |
]) |
579 |
AC_TRANSLATE_DEFINE(ENABLE_TUNTAP, "$ac_cv_tun_tap_support", |
580 |
[Define if your system supports TUN/TAP devices.]) |
581 |
|
582 |
dnl Various checks if the system supports vm_allocate() and the like functions. |
583 |
have_mach_vm=no |
584 |
if [[ "x$ac_cv_func_vm_allocate" = "xyes" -a "x$ac_cv_func_vm_deallocate" = "xyes" -a \ |
585 |
"x$ac_cv_func_vm_protect" = "xyes" ]]; then |
586 |
have_mach_vm=yes |
587 |
fi |
588 |
AC_TRANSLATE_DEFINE(HAVE_MACH_VM, "$have_mach_vm", |
589 |
[Define if your system has a working vm_allocate()-based memory allocator.]) |
590 |
|
591 |
dnl Check that vm_allocate(), vm_protect() work |
592 |
if [[ "x$have_mach_vm" = "xyes" ]]; then |
593 |
|
594 |
AC_CACHE_CHECK([whether vm_protect works], |
595 |
ac_cv_vm_protect_works, [ |
596 |
AC_LANG_SAVE |
597 |
AC_LANG_CPLUSPLUS |
598 |
ac_cv_vm_protect_works=yes |
599 |
dnl First the tests that should segfault |
600 |
for test_def in NONE_READ NONE_WRITE READ_WRITE; do |
601 |
AC_TRY_RUN([ |
602 |
#define CONFIGURE_TEST_VM_MAP |
603 |
#define TEST_VM_PROT_$test_def |
604 |
#include "vm_alloc.cpp" |
605 |
], ac_cv_vm_protect_works=no, rm -f core, |
606 |
dnl When cross-compiling, do not assume anything |
607 |
ac_cv_vm_protect_works="guessing no" |
608 |
) |
609 |
done |
610 |
AC_TRY_RUN([ |
611 |
#define CONFIGURE_TEST_VM_MAP |
612 |
#define TEST_VM_PROT_RDWR_WRITE |
613 |
#include "vm_alloc.cpp" |
614 |
], , ac_cv_vm_protect_works=no, |
615 |
dnl When cross-compiling, do not assume anything |
616 |
ac_cv_vm_protect_works="guessing no" |
617 |
) |
618 |
AC_LANG_RESTORE |
619 |
] |
620 |
) |
621 |
|
622 |
dnl Remove support for vm_allocate() if vm_protect() does not work |
623 |
if [[ "x$have_mach_vm" = "xyes" ]]; then |
624 |
case $ac_cv_vm_protect_works in |
625 |
*yes) have_mach_vm=yes;; |
626 |
*no) have_mach_vm=no;; |
627 |
esac |
628 |
fi |
629 |
AC_TRANSLATE_DEFINE(HAVE_MACH_VM, "$have_mach_vm", |
630 |
[Define if your system has a working vm_allocate()-based memory allocator.]) |
631 |
|
632 |
fi dnl HAVE_MACH_VM |
633 |
|
634 |
dnl Various checks if the system supports mmap() and the like functions. |
635 |
dnl ... and Mach memory allocators are not supported |
636 |
have_mmap_vm=no |
637 |
if [[ "x$ac_cv_func_mmap" = "xyes" -a "x$ac_cv_func_munmap" = "xyes" -a \ |
638 |
"x$ac_cv_func_mprotect" = "xyes" ]]; then |
639 |
if [[ "x$have_mach_vm" = "xno" ]]; then |
640 |
have_mmap_vm=yes |
641 |
fi |
642 |
fi |
643 |
AC_TRANSLATE_DEFINE(HAVE_MMAP_VM, "$have_mmap_vm", |
644 |
[Define if your system has a working mmap()-based memory allocator.]) |
645 |
|
646 |
dnl Check that mmap() and associated functions work. |
647 |
if [[ "x$have_mmap_vm" = "xyes" ]]; then |
648 |
|
649 |
dnl Check if we have a working anonymous mmap() |
650 |
AC_CACHE_CHECK([whether mmap supports MAP_ANON], |
651 |
ac_cv_mmap_anon, [ |
652 |
AC_LANG_SAVE |
653 |
AC_LANG_CPLUSPLUS |
654 |
AC_TRY_RUN([ |
655 |
#define HAVE_MMAP_ANON |
656 |
#define CONFIGURE_TEST_VM_MAP |
657 |
#define TEST_VM_MMAP_ANON |
658 |
#include "vm_alloc.cpp" |
659 |
], ac_cv_mmap_anon=yes, ac_cv_mmap_anon=no, |
660 |
dnl When cross-compiling, do not assume anything. |
661 |
ac_cv_mmap_anon="guessing no" |
662 |
) |
663 |
AC_LANG_RESTORE |
664 |
] |
665 |
) |
666 |
AC_TRANSLATE_DEFINE(HAVE_MMAP_ANON, "$ac_cv_mmap_anon", |
667 |
[Define if <sys/mman.h> defines MAP_ANON and mmap()'ing with MAP_ANON works.]) |
668 |
|
669 |
AC_CACHE_CHECK([whether mmap supports MAP_ANONYMOUS], |
670 |
ac_cv_mmap_anonymous, [ |
671 |
AC_LANG_SAVE |
672 |
AC_LANG_CPLUSPLUS |
673 |
AC_TRY_RUN([ |
674 |
#define HAVE_MMAP_ANONYMOUS |
675 |
#define CONFIGURE_TEST_VM_MAP |
676 |
#define TEST_VM_MMAP_ANON |
677 |
#include "vm_alloc.cpp" |
678 |
], ac_cv_mmap_anonymous=yes, ac_cv_mmap_anonymous=no, |
679 |
dnl When cross-compiling, do not assume anything. |
680 |
ac_cv_mmap_anonymous="guessing no" |
681 |
) |
682 |
AC_LANG_RESTORE |
683 |
] |
684 |
) |
685 |
AC_TRANSLATE_DEFINE(HAVE_MMAP_ANONYMOUS, "$ac_cv_mmap_anonymous", |
686 |
[Define if <sys/mman.h> defines MAP_ANONYMOUS and mmap()'ing with MAP_ANONYMOUS works.]) |
687 |
|
688 |
AC_CACHE_CHECK([whether mprotect works], |
689 |
ac_cv_mprotect_works, [ |
690 |
AC_LANG_SAVE |
691 |
AC_LANG_CPLUSPLUS |
692 |
ac_cv_mprotect_works=yes |
693 |
dnl First the tests that should segfault |
694 |
for test_def in NONE_READ NONE_WRITE READ_WRITE; do |
695 |
AC_TRY_RUN([ |
696 |
#define CONFIGURE_TEST_VM_MAP |
697 |
#define TEST_VM_PROT_$test_def |
698 |
#include "vm_alloc.cpp" |
699 |
], ac_cv_mprotect_works=no, rm -f core, |
700 |
dnl When cross-compiling, do not assume anything |
701 |
ac_cv_mprotect_works="guessing no" |
702 |
) |
703 |
done |
704 |
AC_TRY_RUN([ |
705 |
#define CONFIGURE_TEST_VM_MAP |
706 |
#define TEST_VM_PROT_RDWR_WRITE |
707 |
#include "vm_alloc.cpp" |
708 |
], , ac_cv_mprotect_works=no, |
709 |
dnl When cross-compiling, do not assume anything |
710 |
ac_cv_mprotect_works="guessing no" |
711 |
) |
712 |
AC_LANG_RESTORE |
713 |
] |
714 |
) |
715 |
|
716 |
dnl Remove support for mmap() if mprotect() does not work |
717 |
if [[ "x$have_mmap_vm" = "xyes" ]]; then |
718 |
case $ac_cv_mprotect_works in |
719 |
*yes) have_mmap_vm=yes;; |
720 |
*no) have_mmap_vm=no;; |
721 |
esac |
722 |
fi |
723 |
AC_TRANSLATE_DEFINE(HAVE_MMAP_VM, $have_mmap_vm, |
724 |
[Define if your system has a working mmap()-based memory allocator.]) |
725 |
|
726 |
fi dnl HAVE_MMAP_VM |
727 |
|
728 |
dnl Check if we can modify the __PAGEZERO segment for use as Low Memory |
729 |
AC_CACHE_CHECK([whether __PAGEZERO can be Low Memory area 0x0000-0x2000], |
730 |
ac_cv_pagezero_hack, [ |
731 |
ac_cv_pagezero_hack=no |
732 |
if AC_TRY_COMMAND([Darwin/testlmem.sh 0x2000]); then |
733 |
ac_cv_pagezero_hack=yes |
734 |
dnl might as well skip the test for mmap-able low memory |
735 |
ac_cv_can_map_lm=no |
736 |
fi |
737 |
]) |
738 |
AC_TRANSLATE_DEFINE(PAGEZERO_HACK, "$ac_cv_pagezero_hack", |
739 |
[Define if the __PAGEZERO Mach-O Low Memory Globals hack works on this system.]) |
740 |
|
741 |
dnl Check if we can mmap 0x2000 bytes from 0x0000 |
742 |
AC_CACHE_CHECK([whether we can map Low Memory area 0x0000-0x2000], |
743 |
ac_cv_can_map_lm, [ |
744 |
AC_LANG_SAVE |
745 |
AC_LANG_CPLUSPLUS |
746 |
AC_TRY_RUN([ |
747 |
#include "vm_alloc.cpp" |
748 |
int main(void) { /* returns 0 if we could map the lowmem globals */ |
749 |
volatile char * lm = 0; |
750 |
if (vm_init() < 0) exit(1); |
751 |
if (vm_acquire_fixed(0, 0x2000) < 0) exit(1); |
752 |
lm[0] = 'z'; |
753 |
if (vm_release((char *)lm, 0x2000) < 0) exit(1); |
754 |
vm_exit(); exit(0); |
755 |
} |
756 |
], ac_cv_can_map_lm=yes, ac_cv_can_map_lm=no, |
757 |
dnl When cross-compiling, do not assume anything. |
758 |
ac_cv_can_map_lm="guessing no" |
759 |
) |
760 |
AC_LANG_RESTORE |
761 |
] |
762 |
) |
763 |
|
764 |
dnl Check if we have POSIX shared memory support |
765 |
AC_CACHE_CHECK([whether POSIX shared memory is working], |
766 |
ac_cv_have_posix_shm, [ |
767 |
AC_LANG_SAVE |
768 |
AC_LANG_CPLUSPLUS |
769 |
AC_TRY_RUN([ |
770 |
#define HAVE_POSIX_SHM |
771 |
#include "vm_alloc.cpp" |
772 |
int main(void) { /* returns 0 if we have working POSIX shm */ |
773 |
if (vm_init() < 0) exit(2); |
774 |
char *m1 = (char *)vm_acquire(32768, VM_MAP_DEFAULT | VM_MAP_33BIT); |
775 |
if (m1 == VM_MAP_FAILED) exit(3); |
776 |
vm_exit(); exit(0); |
777 |
} |
778 |
], ac_cv_have_posix_shm=yes, ac_cv_have_posix_shm=no, |
779 |
dnl When cross-compiling, do not assume anything. |
780 |
ac_cv_have_posix_shm="guessing no" |
781 |
) |
782 |
AC_LANG_RESTORE |
783 |
] |
784 |
) |
785 |
AC_TRANSLATE_DEFINE(HAVE_POSIX_SHM, "$ac_cv_have_posix_shm", |
786 |
[Define if your system supports POSIX shared memory.]) |
787 |
|
788 |
dnl Check if we have working 33-bit memory addressing |
789 |
AC_CACHE_CHECK([whether 33-bit memory addressing is working], |
790 |
ac_cv_have_33bit_addressing, [ |
791 |
AC_LANG_SAVE |
792 |
AC_LANG_CPLUSPLUS |
793 |
AC_TRY_RUN([ |
794 |
#define USE_33BIT_ADDRESSING 1 |
795 |
#include "vm_alloc.cpp" |
796 |
int main(void) { /* returns 0 if we have working 33-bit addressing */ |
797 |
if (sizeof(void *) < 8) exit(1); |
798 |
if (vm_init() < 0) exit(2); |
799 |
char *m1 = (char *)vm_acquire(32768, VM_MAP_DEFAULT | VM_MAP_33BIT); |
800 |
if (m1 == VM_MAP_FAILED) exit(3); |
801 |
char *m2 = m1 + (1L << 32); |
802 |
m1[0] = 0x12; if (m2[0] != 0x12) exit(4); |
803 |
m2[0] = 0x34; if (m1[0] != 0x34) exit(5); |
804 |
vm_exit(); exit(0); |
805 |
} |
806 |
], ac_cv_have_33bit_addressing=yes, ac_cv_have_33bit_addressing=no, |
807 |
dnl When cross-compiling, do not assume anything. |
808 |
ac_cv_have_33bit_addressing="guessing no" |
809 |
) |
810 |
AC_LANG_RESTORE |
811 |
] |
812 |
) |
813 |
|
814 |
dnl Check signal handlers need to be reinstalled |
815 |
AC_CACHE_CHECK([whether signal handlers need to be reinstalled], |
816 |
ac_cv_signal_need_reinstall, [ |
817 |
AC_LANG_SAVE |
818 |
AC_LANG_CPLUSPLUS |
819 |
AC_TRY_RUN([ |
820 |
#include <stdlib.h> |
821 |
#ifdef HAVE_UNISTD_H |
822 |
#include <unistd.h> |
823 |
#endif |
824 |
#include <signal.h> |
825 |
static int handled_signal = 0; |
826 |
RETSIGTYPE sigusr1_handler(int) { handled_signal++; } |
827 |
int main(void) { /* returns 0 if signals need not to be reinstalled */ |
828 |
signal(SIGUSR1, sigusr1_handler); raise(SIGUSR1); raise(SIGUSR1); |
829 |
exit(handled_signal == 2); |
830 |
} |
831 |
], ac_cv_signal_need_reinstall=yes, ac_cv_signal_need_reinstall=no, |
832 |
dnl When cross-compiling, do not assume anything. |
833 |
ac_cv_signal_need_reinstall="guessing yes" |
834 |
) |
835 |
AC_LANG_RESTORE |
836 |
] |
837 |
) |
838 |
AC_TRANSLATE_DEFINE(SIGNAL_NEED_REINSTALL, "$ac_cv_signal_need_reinstall", |
839 |
[Define if your system requires signals to be reinstalled.]) |
840 |
|
841 |
dnl Check if sigaction handlers need to be reinstalled |
842 |
AC_CACHE_CHECK([whether sigaction handlers need to be reinstalled], |
843 |
ac_cv_sigaction_need_reinstall, [ |
844 |
AC_LANG_SAVE |
845 |
AC_LANG_CPLUSPLUS |
846 |
AC_TRY_RUN([ |
847 |
#include <stdlib.h> |
848 |
#ifdef HAVE_UNISTD_H |
849 |
#include <unistd.h> |
850 |
#endif |
851 |
#include <signal.h> |
852 |
static int handled_signal = 0; |
853 |
RETSIGTYPE sigusr1_handler(int) { handled_signal++; } |
854 |
typedef RETSIGTYPE (*signal_handler)(int); |
855 |
static signal_handler mysignal(int sig, signal_handler handler) { |
856 |
struct sigaction old_sa; |
857 |
struct sigaction new_sa; |
858 |
new_sa.sa_handler = handler; |
859 |
return ((sigaction(sig,&new_sa,&old_sa) < 0) ? SIG_IGN : old_sa.sa_handler); |
860 |
} |
861 |
int main(void) { /* returns 0 if signals need not to be reinstalled */ |
862 |
mysignal(SIGUSR1, sigusr1_handler); raise(SIGUSR1); raise(SIGUSR1); |
863 |
exit(handled_signal == 2); |
864 |
} |
865 |
], ac_cv_sigaction_need_reinstall=yes, ac_cv_sigaction_need_reinstall=no, |
866 |
dnl When cross-compiling, do not assume anything. |
867 |
ac_cv_sigaction_need_reinstall="guessing yes" |
868 |
) |
869 |
AC_LANG_RESTORE |
870 |
] |
871 |
) |
872 |
AC_TRANSLATE_DEFINE(SIGACTION_NEED_REINSTALL, "$ac_cv_sigaction_need_reinstall", |
873 |
[Define if your system requires sigactions to be reinstalled.]) |
874 |
|
875 |
dnl Check if Mach exceptions supported. |
876 |
AC_CACHE_CHECK([whether your system supports Mach exceptions], |
877 |
ac_cv_have_mach_exceptions, [ |
878 |
AC_LANG_SAVE |
879 |
AC_LANG_CPLUSPLUS |
880 |
AC_TRY_RUN([ |
881 |
#define HAVE_MACH_EXCEPTIONS 1 |
882 |
#define CONFIGURE_TEST_SIGSEGV_RECOVERY |
883 |
#include "vm_alloc.cpp" |
884 |
#include "sigsegv.cpp" |
885 |
], [ |
886 |
sigsegv_recovery=mach |
887 |
ac_cv_have_mach_exceptions=yes |
888 |
], |
889 |
ac_cv_have_mach_exceptions=no, |
890 |
dnl When cross-compiling, do not assume anything. |
891 |
ac_cv_have_mach_exceptions=no |
892 |
) |
893 |
AC_LANG_RESTORE |
894 |
] |
895 |
) |
896 |
AC_TRANSLATE_DEFINE(HAVE_MACH_EXCEPTIONS, "$ac_cv_have_mach_exceptions", |
897 |
[Define if your system supports Mach exceptions.]) |
898 |
|
899 |
dnl Check if Windows exceptions are supported. |
900 |
AC_CACHE_CHECK([whether your system supports Windows exceptions], |
901 |
ac_cv_have_win32_exceptions, [ |
902 |
AC_LANG_SAVE |
903 |
AC_LANG_CPLUSPLUS |
904 |
AC_TRY_RUN([ |
905 |
#define HAVE_WIN32_EXCEPTIONS 1 |
906 |
#define CONFIGURE_TEST_SIGSEGV_RECOVERY |
907 |
#include "vm_alloc.cpp" |
908 |
#include "sigsegv.cpp" |
909 |
], [ |
910 |
sigsegv_recovery=win32 |
911 |
ac_cv_have_win32_exceptions=yes |
912 |
], |
913 |
ac_cv_have_win32_exceptions=no, |
914 |
dnl When cross-compiling, do not assume anything. |
915 |
ac_cv_have_win32_exceptions=no |
916 |
) |
917 |
AC_LANG_RESTORE |
918 |
] |
919 |
) |
920 |
AC_TRANSLATE_DEFINE(HAVE_WIN32_EXCEPTIONS, "$ac_cv_have_win32_exceptions", |
921 |
[Define if your system supports Windows exceptions.]) |
922 |
|
923 |
dnl Otherwise, check if extended signals are supported. |
924 |
if [[ -z "$sigsegv_recovery" ]]; then |
925 |
AC_CACHE_CHECK([whether your system supports extended signal handlers], |
926 |
ac_cv_have_extended_signals, [ |
927 |
AC_LANG_SAVE |
928 |
AC_LANG_CPLUSPLUS |
929 |
AC_TRY_RUN([ |
930 |
#define HAVE_SIGINFO_T 1 |
931 |
#define CONFIGURE_TEST_SIGSEGV_RECOVERY |
932 |
#include "vm_alloc.cpp" |
933 |
#include "sigsegv.cpp" |
934 |
], [ |
935 |
sigsegv_recovery=siginfo |
936 |
ac_cv_have_extended_signals=yes |
937 |
], |
938 |
ac_cv_have_extended_signals=no, |
939 |
dnl When cross-compiling, do not assume anything. |
940 |
ac_cv_have_extended_signals=no |
941 |
) |
942 |
AC_LANG_RESTORE |
943 |
] |
944 |
) |
945 |
AC_TRANSLATE_DEFINE(HAVE_SIGINFO_T, "$ac_cv_have_extended_signals", |
946 |
[Define if your system support extended signals.]) |
947 |
fi |
948 |
|
949 |
dnl Otherwise, check for subterfuges. |
950 |
if [[ -z "$sigsegv_recovery" ]]; then |
951 |
AC_CACHE_CHECK([whether we then have a subterfuge for your system], |
952 |
ac_cv_have_sigcontext_hack, [ |
953 |
AC_LANG_SAVE |
954 |
AC_LANG_CPLUSPLUS |
955 |
AC_TRY_RUN([ |
956 |
#define HAVE_SIGCONTEXT_SUBTERFUGE 1 |
957 |
#define CONFIGURE_TEST_SIGSEGV_RECOVERY |
958 |
#include "vm_alloc.cpp" |
959 |
#include "sigsegv.cpp" |
960 |
], [ |
961 |
sigsegv_recovery=sigcontext |
962 |
ac_cv_have_sigcontext_hack=yes |
963 |
], |
964 |
ac_cv_have_sigcontext_hack=no, |
965 |
dnl When cross-compiling, do not assume anything. |
966 |
ac_cv_have_sigcontext_hack=no |
967 |
) |
968 |
AC_LANG_RESTORE |
969 |
]) |
970 |
AC_TRANSLATE_DEFINE(HAVE_SIGCONTEXT_SUBTERFUGE, "$ac_cv_have_sigcontext_hack", |
971 |
[Define if we know a hack to replace siginfo_t->si_addr member.]) |
972 |
fi |
973 |
|
974 |
dnl Check if we can ignore the fault (instruction skipping in SIGSEGV handler) |
975 |
AC_CACHE_CHECK([whether we can skip instruction in SIGSEGV handler], |
976 |
ac_cv_have_skip_instruction, [ |
977 |
AC_LANG_SAVE |
978 |
AC_LANG_CPLUSPLUS |
979 |
AC_TRY_RUN([ |
980 |
#define HAVE_SIGSEGV_SKIP_INSTRUCTION 1 |
981 |
#define CONFIGURE_TEST_SIGSEGV_RECOVERY |
982 |
#include "vm_alloc.cpp" |
983 |
#include "sigsegv.cpp" |
984 |
], ac_cv_have_skip_instruction=yes, ac_cv_have_skip_instruction=no, |
985 |
dnl When cross-compiling, do not assume anything. |
986 |
ac_cv_have_skip_instruction=no |
987 |
) |
988 |
AC_LANG_RESTORE |
989 |
] |
990 |
) |
991 |
AC_TRANSLATE_DEFINE(HAVE_SIGSEGV_SKIP_INSTRUCTION, "$ac_cv_have_skip_instruction", |
992 |
[Define if we can ignore the fault (instruction skipping in SIGSEGV handler).]) |
993 |
|
994 |
dnl Can we do Video on SEGV Signals ? |
995 |
CAN_VOSF=no |
996 |
if [[ -n "$sigsegv_recovery" ]]; then |
997 |
CAN_VOSF=yes |
998 |
fi |
999 |
|
1000 |
dnl A dummy program that returns always true |
1001 |
AC_PATH_PROG([BLESS], "true") |
1002 |
|
1003 |
dnl Determine the addressing mode to use |
1004 |
if [[ "x$WANT_NATIVE_M68K" = "xyes" ]]; then |
1005 |
ADDRESSING_MODE="real" |
1006 |
else |
1007 |
ADDRESSING_MODE="" |
1008 |
AC_MSG_CHECKING([for the addressing mode to use]) |
1009 |
for am in $ADDRESSING_TEST_ORDER; do |
1010 |
case $am in |
1011 |
real) |
1012 |
dnl Requires ability to mmap() Low Memory globals |
1013 |
if [[ "x$ac_cv_can_map_lm$ac_cv_pagezero_hack" = "xnono" ]]; then |
1014 |
continue |
1015 |
fi |
1016 |
dnl Requires VOSF screen updates |
1017 |
if [[ "x$CAN_VOSF" = "xno" ]]; then |
1018 |
continue |
1019 |
fi |
1020 |
dnl Real addressing will probably work. |
1021 |
ADDRESSING_MODE="real" |
1022 |
WANT_VOSF=yes dnl we can use VOSF and we need it actually |
1023 |
DEFINES="$DEFINES -DREAL_ADDRESSING" |
1024 |
if [[ "x$ac_cv_pagezero_hack" = "xyes" ]]; then |
1025 |
BLESS=Darwin/lowmem |
1026 |
LDFLAGS="$LDFLAGS -pagezero_size 0x2000" |
1027 |
fi |
1028 |
break |
1029 |
;; |
1030 |
direct) |
1031 |
dnl Requires VOSF screen updates |
1032 |
if [[ "x$CAN_VOSF" = "xyes" ]]; then |
1033 |
ADDRESSING_MODE="direct" |
1034 |
WANT_VOSF=yes dnl we can use VOSF and we need it actually |
1035 |
DEFINES="$DEFINES -DDIRECT_ADDRESSING" |
1036 |
break |
1037 |
fi |
1038 |
;; |
1039 |
banks) |
1040 |
dnl Default addressing mode |
1041 |
ADDRESSING_MODE="memory banks" |
1042 |
break |
1043 |
;; |
1044 |
*) |
1045 |
AC_MSG_ERROR([Internal configure.in script error for $am addressing mode]) |
1046 |
esac |
1047 |
done |
1048 |
AC_MSG_RESULT($ADDRESSING_MODE) |
1049 |
if [[ "x$ADDRESSING_MODE" = "x" ]]; then |
1050 |
AC_MSG_WARN([Sorry, no suitable addressing mode in $ADDRESSING_TEST_ORDER]) |
1051 |
ADDRESSING_MODE="memory banks" |
1052 |
fi |
1053 |
fi |
1054 |
|
1055 |
dnl Banked Memory Addressing mode is not supported by the JIT compiler |
1056 |
if [[ "x$WANT_JIT" = "xyes" -a "x$ADDRESSING_MODE" = "xmemory banks" ]]; then |
1057 |
AC_MSG_ERROR([Sorry, the JIT Compiler requires Direct Addressing, at least]) |
1058 |
fi |
1059 |
|
1060 |
dnl Enable VOSF screen updates with this feature is requested and feasible |
1061 |
if [[ "x$WANT_VOSF" = "xyes" -a "x$CAN_VOSF" = "xyes" ]]; then |
1062 |
AC_DEFINE(ENABLE_VOSF, 1, [Define if using video enabled on SEGV signals.]) |
1063 |
else |
1064 |
WANT_VOSF=no |
1065 |
fi |
1066 |
|
1067 |
dnl Check for GAS. |
1068 |
HAVE_GAS=no |
1069 |
AC_MSG_CHECKING(for GAS .p2align feature) |
1070 |
cat >conftest.S << EOF |
1071 |
.text |
1072 |
.p2align 5 |
1073 |
EOF |
1074 |
if $CC conftest.S -c -o conftest.o >/dev/null 2>&1 ; then HAVE_GAS=yes; fi |
1075 |
AC_MSG_RESULT($HAVE_GAS) |
1076 |
|
1077 |
dnl Check for GCC 2.7 or higher. |
1078 |
HAVE_GCC27=no |
1079 |
AC_MSG_CHECKING(for GCC 2.7 or higher) |
1080 |
AC_EGREP_CPP(xyes, |
1081 |
[#if __GNUC__ - 1 > 1 || __GNUC_MINOR__ - 1 > 5 |
1082 |
xyes |
1083 |
#endif |
1084 |
], [AC_MSG_RESULT(yes); HAVE_GCC27=yes], AC_MSG_RESULT(no)) |
1085 |
|
1086 |
dnl Check for GCC 3.0 or higher. |
1087 |
HAVE_GCC30=no |
1088 |
AC_MSG_CHECKING(for GCC 3.0 or higher) |
1089 |
AC_EGREP_CPP(xyes, |
1090 |
[#if __GNUC__ >= 3 |
1091 |
xyes |
1092 |
#endif |
1093 |
], [AC_MSG_RESULT(yes); HAVE_GCC30=yes], AC_MSG_RESULT(no)) |
1094 |
|
1095 |
dnl Check for ICC. |
1096 |
AC_MSG_CHECKING(for ICC) |
1097 |
HAVE_ICC=no |
1098 |
if $CXX -V -v 2>&1 | grep -q "Intel(R) C++ Compiler"; then |
1099 |
HAVE_ICC=yes |
1100 |
fi |
1101 |
AC_MSG_RESULT($HAVE_ICC) |
1102 |
|
1103 |
dnl Set "-fomit-frame-pointer" on i386 GCC 2.7 or higher. |
1104 |
dnl Also set "-fno-exceptions" for C++ because exception handling requires |
1105 |
dnl the frame pointer. |
1106 |
if [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_I386" = "xyes" ]]; then |
1107 |
CFLAGS="$CFLAGS -fomit-frame-pointer" |
1108 |
CXXFLAGS="$CXXFLAGS -fomit-frame-pointer -fno-exceptions" |
1109 |
fi |
1110 |
|
1111 |
dnl (gb) Do not merge constants since it breaks fpu/fpu_x86.cpp. |
1112 |
dnl As of 2001/08/02, this affects the following compilers: |
1113 |
dnl Official: probably gcc-3.1 (mainline CVS) |
1114 |
dnl Mandrake: gcc-2.96 >= 0.59mdk, gcc-3.0.1 >= 0.1mdk |
1115 |
dnl Red Hat : gcc-2.96 >= 89, gcc-3.0 >= 1 |
1116 |
if [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_ICC" = "xno" ]]; then |
1117 |
SAVED_CXXFLAGS="$CXXFLAGS" |
1118 |
CXXFLAGS="$CXXFLAGS -fno-merge-constants" |
1119 |
AC_CACHE_CHECK([whether GCC supports constants merging], ac_cv_gcc_constants_merging, [ |
1120 |
AC_LANG_SAVE |
1121 |
AC_LANG_CPLUSPLUS |
1122 |
AC_TRY_COMPILE([],[],[ac_cv_gcc_constants_merging=yes],[ac_cv_gcc_constants_merging=no]) |
1123 |
AC_LANG_RESTORE |
1124 |
]) |
1125 |
if [[ "x$ac_cv_gcc_constants_merging" != "xyes" ]]; then |
1126 |
CXXFLAGS="$SAVED_CXXFLAGS" |
1127 |
fi |
1128 |
fi |
1129 |
|
1130 |
dnl Store motion was introduced in 3.3-hammer branch and any gcc >= 3.4 |
1131 |
dnl However, there are some corner cases exposed on x86-64 |
1132 |
if [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_ICC" = "xno" ]]; then |
1133 |
SAVED_CXXFLAGS="$CXXFLAGS" |
1134 |
CXXFLAGS="$CXXFLAGS -fno-gcse-sm" |
1135 |
AC_CACHE_CHECK([whether GCC supports store motion], ac_cv_gcc_store_motion, [ |
1136 |
AC_LANG_SAVE |
1137 |
AC_LANG_CPLUSPLUS |
1138 |
AC_TRY_COMPILE([],[],[ac_cv_gcc_store_motion=yes],[ac_cv_gcc_store_motion=no]) |
1139 |
AC_LANG_RESTORE |
1140 |
]) |
1141 |
if [[ "x$ac_cv_gcc_store_motion" != "xyes" ]]; then |
1142 |
CXXFLAGS="$SAVED_CXXFLAGS" |
1143 |
fi |
1144 |
fi |
1145 |
|
1146 |
dnl Add -fno-strict-aliasing for slirp sources |
1147 |
if [[ "x$HAVE_GCC30" = "xyes" ]]; then |
1148 |
SAVED_CFLAGS="$CFLAGS" |
1149 |
CFLAGS="$CFLAGS -fno-strict-aliasing" |
1150 |
AC_CACHE_CHECK([whether the compiler supports -fno-strict-aliasing], |
1151 |
ac_cv_gcc_no_strict_aliasing, [ |
1152 |
AC_TRY_COMPILE([],[], |
1153 |
[ac_cv_gcc_no_strict_aliasing=yes; AC_SUBST(SLIRP_CFLAGS, "$CFLAGS")], |
1154 |
[ac_cv_gcc_no_strict_aliasing=no]) |
1155 |
]) |
1156 |
CFLAGS="$SAVED_CFLAGS" |
1157 |
fi |
1158 |
|
1159 |
dnl Select appropriate CPU source and REGPARAM define. |
1160 |
ASM_OPTIMIZATIONS=none |
1161 |
CPUSRCS="cpuemu1.cpp cpuemu2.cpp cpuemu3.cpp cpuemu4.cpp cpuemu5.cpp cpuemu6.cpp cpuemu7.cpp cpuemu8.cpp" |
1162 |
|
1163 |
dnl (gb) JITSRCS will be emptied later if the JIT is not available |
1164 |
dnl Other platforms should define their own set of noflags file variants |
1165 |
CAN_JIT=no |
1166 |
JITSRCS="compemu1.cpp compemu2.cpp compemu3.cpp compemu4.cpp compemu5.cpp compemu6.cpp compemu7.cpp compemu8.cpp" |
1167 |
|
1168 |
if [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_I386" = "xyes" ]]; then |
1169 |
dnl i386 CPU |
1170 |
DEFINES="$DEFINES -DUNALIGNED_PROFITABLE -DREGPARAM=\"__attribute__((regparm(3)))\"" |
1171 |
if [[ "x$HAVE_GAS" = "xyes" ]]; then |
1172 |
ASM_OPTIMIZATIONS=i386 |
1173 |
DEFINES="$DEFINES -DX86_ASSEMBLY -DOPTIMIZED_FLAGS -DSAHF_SETO_PROFITABLE" |
1174 |
JITSRCS="cpuemu1_nf.cpp cpuemu2_nf.cpp cpuemu3_nf.cpp cpuemu4_nf.cpp cpuemu5_nf.cpp cpuemu6_nf.cpp cpuemu7_nf.cpp cpuemu8_nf.cpp $JITSRCS" |
1175 |
CAN_JIT=yes |
1176 |
fi |
1177 |
elif [[ "x$HAVE_GCC30" = "xyes" -a "x$HAVE_X86_64" = "xyes" ]]; then |
1178 |
dnl x86-64 CPU |
1179 |
DEFINES="$DEFINES -DUNALIGNED_PROFITABLE" |
1180 |
if [[ "x$HAVE_GAS" = "xyes" ]]; then |
1181 |
ASM_OPTIMIZATIONS="x86-64" |
1182 |
DEFINES="$DEFINES -DX86_64_ASSEMBLY -DOPTIMIZED_FLAGS" |
1183 |
JITSRCS="cpuemu1_nf.cpp cpuemu2_nf.cpp cpuemu3_nf.cpp cpuemu4_nf.cpp cpuemu5_nf.cpp cpuemu6_nf.cpp cpuemu7_nf.cpp cpuemu8_nf.cpp $JITSRCS" |
1184 |
CAN_JIT=yes |
1185 |
WANT_33BIT_ADDRESSING=yes |
1186 |
fi |
1187 |
elif [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_SPARC" = "xyes" -a "x$HAVE_GAS" = "xyes" ]]; then |
1188 |
dnl SPARC CPU |
1189 |
case "$target_os" in |
1190 |
solaris*) |
1191 |
AC_MSG_CHECKING(SPARC CPU architecture) |
1192 |
SPARC_TYPE=`Solaris/which_sparc` |
1193 |
AC_MSG_RESULT($SPARC_TYPE) |
1194 |
case "$SPARC_TYPE" in |
1195 |
SPARC_V8) |
1196 |
ASM_OPTIMIZATIONS="SPARC V8 architecture" |
1197 |
DEFINES="$DEFINES -DSPARC_V8_ASSEMBLY" dnl -DOPTIMIZED_FLAGS" |
1198 |
CFLAGS="$CFLAGS -Wa,-Av8" |
1199 |
CXXFLAGS="$CXXFLAGS -Wa,-Av8" |
1200 |
;; |
1201 |
SPARC_V9) |
1202 |
ASM_OPTIMIZATIONS="SPARC V9 architecture" |
1203 |
DEFINES="$DEFINES -DSPARC_V9_ASSEMBLY" dnl -DOPTIMIZED_FLAGS" |
1204 |
CFLAGS="$CFLAGS -Wa,-Av9" |
1205 |
CXXFLAGS="$CXXFLAGS -Wa,-Av9" |
1206 |
;; |
1207 |
esac |
1208 |
;; |
1209 |
esac |
1210 |
elif [[ "x$WANT_NATIVE_M68K" = "xyes" ]]; then |
1211 |
dnl Native m68k, no emulation |
1212 |
CPUINCLUDES="-I../native_cpu" |
1213 |
CPUSRCS="asm_support.s" |
1214 |
fi |
1215 |
|
1216 |
dnl Enable JIT compiler, if possible. |
1217 |
if [[ "x$WANT_JIT" = "xyes" -a "x$CAN_JIT" ]]; then |
1218 |
JITSRCS="$JITSRCS ../uae_cpu/compiler/compemu_support.cpp ../uae_cpu/compiler/compemu_fpp.cpp compstbl.o cpustbl_nf.o" |
1219 |
DEFINES="$DEFINES -DUSE_JIT -DUSE_JIT_FPU" |
1220 |
|
1221 |
if [[ "x$WANT_JIT_DEBUG" = "xyes" ]]; then |
1222 |
if [[ "x$WANT_MON" = "xyes" ]]; then |
1223 |
DEFINES="$DEFINES -DJIT_DEBUG=1" |
1224 |
else |
1225 |
AC_MSG_WARN([cxmon not found, ignoring --enable-jit-debug]) |
1226 |
WANT_JIT_DEBUG=no |
1227 |
fi |
1228 |
fi |
1229 |
|
1230 |
dnl IEEE core is the only FPU emulator to use with the JIT compiler |
1231 |
case $FPE_CORE_TEST_ORDER in |
1232 |
ieee*) ;; |
1233 |
*) AC_MSG_WARN([Forcing use of the IEEE FPU core, as the JIT compiler supports only this one.]) ;; |
1234 |
esac |
1235 |
FPE_CORE_TEST_ORDER="ieee" |
1236 |
else |
1237 |
WANT_JIT=no |
1238 |
WANT_JIT_DEBUG=no |
1239 |
JITSRCS="" |
1240 |
fi |
1241 |
|
1242 |
dnl Use 33-bit memory addressing? |
1243 |
if [[ "$ac_cv_have_33bit_addressing:$WANT_33BIT_ADDRESSING" = "yes:yes" ]]; then |
1244 |
use_33bit_addressing=yes |
1245 |
fi |
1246 |
AC_TRANSLATE_DEFINE(USE_33BIT_ADDRESSING, "$use_33bit_addressing", |
1247 |
[Define to use 33-bit memory addressing on 64-bit JIT capable systems.]) |
1248 |
|
1249 |
dnl Utility macro used by next two tests. |
1250 |
dnl AC_EXAMINE_OBJECT(C source code, |
1251 |
dnl commands examining object file, |
1252 |
dnl [commands to run if compile failed]): |
1253 |
dnl |
1254 |
dnl Compile the source code to an object file; then convert it into a |
1255 |
dnl printable representation. All unprintable characters and |
1256 |
dnl asterisks (*) are replaced by dots (.). All white space is |
1257 |
dnl deleted. Newlines (ASCII 0x10) in the input are preserved in the |
1258 |
dnl output, but runs of newlines are compressed to a single newline. |
1259 |
dnl Finally, line breaks are forcibly inserted so that no line is |
1260 |
dnl longer than 80 columns and the file ends with a newline. The |
1261 |
dnl result of all this processing is in the file conftest.dmp, which |
1262 |
dnl may be examined by the commands in the second argument. |
1263 |
dnl |
1264 |
AC_DEFUN([gcc_AC_EXAMINE_OBJECT], |
1265 |
[AC_LANG_SAVE |
1266 |
AC_LANG_C |
1267 |
dnl Next bit cribbed from AC_TRY_COMPILE. |
1268 |
cat > conftest.$ac_ext <<EOF |
1269 |
[#line __oline__ "configure" |
1270 |
#include "confdefs.h" |
1271 |
$1 |
1272 |
]EOF |
1273 |
if AC_TRY_EVAL(ac_compile); then |
1274 |
od -c conftest.o | |
1275 |
sed ['s/^[0-7]*[ ]*/ / |
1276 |
s/\*/./g |
1277 |
s/ \\n/*/g |
1278 |
s/ [0-9][0-9][0-9]/./g |
1279 |
s/ \\[^ ]/./g'] | |
1280 |
tr -d ' |
1281 |
' | tr -s '*' ' |
1282 |
' | fold | sed '$a\ |
1283 |
' > conftest.dmp |
1284 |
$2 |
1285 |
ifelse($3, , , else |
1286 |
$3 |
1287 |
)dnl |
1288 |
fi |
1289 |
rm -rf conftest* |
1290 |
AC_LANG_RESTORE]) |
1291 |
|
1292 |
dnl Floating point format probe. |
1293 |
dnl The basic concept is the same as the above: grep the object |
1294 |
dnl file for an interesting string. We have to watch out for |
1295 |
dnl rounding changing the values in the object, however; this is |
1296 |
dnl handled by ignoring the least significant byte of the float. |
1297 |
dnl |
1298 |
dnl Does not know about VAX G-float or C4x idiosyncratic format. |
1299 |
dnl It does know about PDP-10 idiosyncratic format, but this is |
1300 |
dnl not presently supported by GCC. S/390 "binary floating point" |
1301 |
dnl is in fact IEEE (but maybe we should have that in EBCDIC as well |
1302 |
dnl as ASCII?) |
1303 |
dnl |
1304 |
AC_DEFUN([gcc_AC_C_FLOAT_FORMAT], |
1305 |
[AC_CACHE_CHECK(floating point format, ac_cv_c_float_format, |
1306 |
[gcc_AC_EXAMINE_OBJECT( |
1307 |
[/* This will not work unless sizeof(double) == 8. */ |
1308 |
extern char sizeof_double_must_be_8 [sizeof(double) == 8 ? 1 : -1]; |
1309 |
|
1310 |
/* This structure must have no internal padding. */ |
1311 |
struct possibility { |
1312 |
char prefix[8]; |
1313 |
double candidate; |
1314 |
char postfix[8]; |
1315 |
}; |
1316 |
|
1317 |
#define C(cand) { "\nformat:", cand, ":tamrof\n" } |
1318 |
struct possibility table [] = |
1319 |
{ |
1320 |
C( 3.25724264705901305206e+01), /* @@IEEEFP - IEEE 754 */ |
1321 |
C( 3.53802595280598432000e+18), /* D__float - VAX */ |
1322 |
C( 5.32201830133125317057e-19), /* D.PDP-10 - PDP-10 - the dot is 0x13a */ |
1323 |
C( 1.77977764695171661377e+10), /* IBMHEXFP - s/390 format, ascii */ |
1324 |
C(-5.22995989424860458374e+10) /* IBMHEXFP - s/390 format, EBCDIC */ |
1325 |
};], |
1326 |
[if grep 'format:.@IEEEF.:tamrof' conftest.dmp >/dev/null 2>&1; then |
1327 |
ac_cv_c_float_format='IEEE (big-endian)' |
1328 |
elif grep 'format:.I@@PFE.:tamrof' conftest.dmp >/dev/null 2>&1; then |
1329 |
ac_cv_c_float_format='IEEE (big-endian)' |
1330 |
elif grep 'format:.FEEEI@.:tamrof' conftest.dmp >/dev/null 2>&1; then |
1331 |
ac_cv_c_float_format='IEEE (little-endian)' |
1332 |
elif grep 'format:.EFP@@I.:tamrof' conftest.dmp >/dev/null 2>&1; then |
1333 |
ac_cv_c_float_format='IEEE (little-endian)' |
1334 |
elif grep 'format:.__floa.:tamrof' conftest.dmp >/dev/null 2>&1; then |
1335 |
ac_cv_c_float_format='VAX D-float' |
1336 |
elif grep 'format:..PDP-1.:tamrof' conftest.dmp >/dev/null 2>&1; then |
1337 |
ac_cv_c_float_format='PDP-10' |
1338 |
elif grep 'format:.BMHEXF.:tamrof' conftest.dmp >/dev/null 2>&1; then |
1339 |
ac_cv_c_float_format='IBM 370 hex' |
1340 |
else |
1341 |
AC_MSG_ERROR(Unknown floating point format) |
1342 |
fi], |
1343 |
[AC_MSG_ERROR(compile failed)]) |
1344 |
]) |
1345 |
# IEEE is the default format. If the float endianness isn't the same |
1346 |
# as the integer endianness, we have to set FLOAT_WORDS_BIG_ENDIAN |
1347 |
# (which is a tristate: yes, no, default). This is only an issue with |
1348 |
# IEEE; the other formats are only supported by a few machines each, |
1349 |
# all with the same endianness. |
1350 |
format=IEEE_FLOAT_FORMAT |
1351 |
fbigend= |
1352 |
case $ac_cv_c_float_format in |
1353 |
'IEEE (big-endian)' ) |
1354 |
if test $ac_cv_c_bigendian = no; then |
1355 |
fbigend=1 |
1356 |
fi |
1357 |
;; |
1358 |
'IEEE (little-endian)' ) |
1359 |
if test $ac_cv_c_bigendian = yes; then |
1360 |
fbigend=0 |
1361 |
fi |
1362 |
;; |
1363 |
'VAX D-float' ) |
1364 |
format=VAX_FLOAT_FORMAT |
1365 |
;; |
1366 |
'PDP-10' ) |
1367 |
format=PDP10_FLOAT_FORMAT |
1368 |
;; |
1369 |
'IBM 370 hex' ) |
1370 |
format=IBM_FLOAT_FORMAT |
1371 |
;; |
1372 |
esac |
1373 |
AC_DEFINE_UNQUOTED(HOST_FLOAT_FORMAT, $format, |
1374 |
[Define to the floating point format of the host machine.]) |
1375 |
if test -n "$fbigend"; then |
1376 |
AC_DEFINE_UNQUOTED(HOST_FLOAT_WORDS_BIG_ENDIAN, $fbigend, |
1377 |
[Define to 1 if the host machine stores floating point numbers in |
1378 |
memory with the word containing the sign bit at the lowest address, |
1379 |
or to 0 if it does it the other way around. |
1380 |
|
1381 |
This macro should not be defined if the ordering is the same as for |
1382 |
multi-word integers.]) |
1383 |
fi |
1384 |
]) |
1385 |
|
1386 |
dnl Select appropriate FPU source. |
1387 |
gcc_AC_C_FLOAT_FORMAT |
1388 |
AC_CHECK_HEADERS(ieee754.h ieeefp.h floatingpoint.h nan.h) |
1389 |
|
1390 |
for fpe in $FPE_CORE_TEST_ORDER; do |
1391 |
case $fpe in |
1392 |
ieee) |
1393 |
case $ac_cv_c_float_format in |
1394 |
IEEE*) |
1395 |
FPE_CORE="IEEE fpu core" |
1396 |
DEFINES="$DEFINES -DFPU_IEEE" |
1397 |
FPUSRCS="../uae_cpu/fpu/fpu_ieee.cpp" |
1398 |
dnl Math functions not mandated by C99 standard |
1399 |
AC_CHECK_FUNCS(isnanl isinfl) |
1400 |
dnl Math functions required by C99 standard, but probably not |
1401 |
dnl implemented everywhere. In that case, we fall back to the |
1402 |
dnl regular variant for doubles. |
1403 |
AC_CHECK_FUNCS(logl log10l expl powl fabsl sqrtl) |
1404 |
AC_CHECK_FUNCS(sinl cosl tanl sinhl coshl tanhl) |
1405 |
AC_CHECK_FUNCS(asinl acosl atanl asinhl acoshl atanhl) |
1406 |
AC_CHECK_FUNCS(floorl ceill) |
1407 |
break |
1408 |
;; |
1409 |
esac |
1410 |
;; |
1411 |
x86) |
1412 |
if [[ ":$HAVE_GCC27:$HAVE_I386:$HAVE_GAS:" = ":yes:yes:yes:" ]]; then |
1413 |
FPE_CORE="i387 fpu core" |
1414 |
DEFINES="$DEFINES -DFPU_X86" |
1415 |
FPUSRCS="../uae_cpu/fpu/fpu_x86.cpp" |
1416 |
break |
1417 |
fi |
1418 |
;; |
1419 |
uae) |
1420 |
FPE_CORE="uae fpu core" |
1421 |
DEFINES="$DEFINES -DFPU_UAE" |
1422 |
FPUSRCS="../uae_cpu/fpu/fpu_uae.cpp" |
1423 |
break |
1424 |
;; |
1425 |
*) |
1426 |
AC_MSG_ERROR([Internal configure.in script error for $fpe fpu core]) |
1427 |
;; |
1428 |
esac |
1429 |
done |
1430 |
if [[ "x$FPE_CORE" = "x" ]]; then |
1431 |
AC_MSG_ERROR([Sorry, no suitable FPU core found in $FPE_CORE_TEST_ORDER]) |
1432 |
fi |
1433 |
|
1434 |
dnl Check for certain math functions |
1435 |
AC_CHECK_FUNCS(atanh) |
1436 |
AC_CHECK_FUNCS(isnan isinf finite isnormal signbit) |
1437 |
|
1438 |
dnl UAE CPU sources for all non-m68k-native architectures. |
1439 |
if [[ "x$WANT_NATIVE_M68K" = "xno" ]]; then |
1440 |
CPUINCLUDES="-I../uae_cpu" |
1441 |
CPUSRCS="../uae_cpu/basilisk_glue.cpp ../uae_cpu/memory.cpp ../uae_cpu/newcpu.cpp ../uae_cpu/readcpu.cpp $FPUSRCS cpustbl.cpp cpudefs.cpp $CPUSRCS $JITSRCS" |
1442 |
fi |
1443 |
|
1444 |
dnl Remove the "-g" option if set for GCC. |
1445 |
if [[ "x$HAVE_GCC27" = "xyes" ]]; then |
1446 |
CFLAGS=`echo $CFLAGS | sed -e 's/-g\b//g'` |
1447 |
CXXFLAGS=`echo $CXXFLAGS | sed -e 's/-g\b//g'` |
1448 |
fi |
1449 |
|
1450 |
dnl Or if we have -IPA (MIPSPro compilers) |
1451 |
if [[ "x$HAVE_IPA" = "xyes" ]]; then |
1452 |
CFLAGS="`echo $CFLAGS | sed -e 's/-g//g'` -O3 -OPT:Olimit=0 -IPA" |
1453 |
CXXFLAGS="`echo $CXXFLAGS | sed -e 's/-g//g'` -O3 -OPT:Olimit=0 -IPA" |
1454 |
CXXFLAGS="-LANG:std $CXXFLAGS" |
1455 |
LDFLAGS="$LDFLAGS -O3 -OPT:Olimit=0 -IPA" |
1456 |
fi |
1457 |
|
1458 |
dnl Generate Makefile. |
1459 |
AC_SUBST(DEFINES) |
1460 |
AC_SUBST(SYSSRCS) |
1461 |
AC_SUBST(CPUINCLUDES) |
1462 |
AC_SUBST(CPUSRCS) |
1463 |
AC_SUBST(BLESS) |
1464 |
AC_SUBST(KEYCODES) |
1465 |
AC_CONFIG_FILES([Makefile]) |
1466 |
AC_OUTPUT |
1467 |
|
1468 |
dnl Print summary. |
1469 |
echo |
1470 |
echo Basilisk II configuration summary: |
1471 |
echo |
1472 |
echo SDL support ............................ : $SDL_SUPPORT |
1473 |
echo XFree86 DGA support .................... : $WANT_XF86_DGA |
1474 |
echo XFree86 VidMode support ................ : $WANT_XF86_VIDMODE |
1475 |
echo fbdev DGA support ...................... : $WANT_FBDEV_DGA |
1476 |
echo Enable video on SEGV signals ........... : $WANT_VOSF |
1477 |
echo ESD sound support ...................... : $WANT_ESD |
1478 |
echo GTK user interface ..................... : $WANT_GTK |
1479 |
echo mon debugger support ................... : $WANT_MON |
1480 |
echo Running m68k code natively ............. : $WANT_NATIVE_M68K |
1481 |
echo Use JIT compiler ....................... : $WANT_JIT |
1482 |
echo JIT debug mode ......................... : $WANT_JIT_DEBUG |
1483 |
echo Floating-Point emulation core .......... : $FPE_CORE |
1484 |
echo Assembly optimizations ................. : $ASM_OPTIMIZATIONS |
1485 |
echo Addressing mode ........................ : $ADDRESSING_MODE |
1486 |
echo Bad memory access recovery type ........ : $sigsegv_recovery |
1487 |
echo |
1488 |
echo "Configuration done. Now type \"make\" (or \"gmake\")." |