ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/BasiliskII/src/Unix/configure.ac
Revision: 1.79
Committed: 2010-07-28T01:10:24Z (14 years, 4 months ago) by asvitkine
Branch: MAIN
Changes since 1.78: +3 -18 lines
Log Message:
Some messy changes got into last commit that weren't supposed to be there.

File Contents

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