ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/BasiliskII/src/MacOSX/configure.in
Revision: 1.28
Committed: 2011-03-11T16:44:46Z (13 years, 2 months ago) by asvitkine
Branch: MAIN
CVS Tags: HEAD
Changes since 1.27: +6 -6 lines
Log Message:
[Joseph Oswald]
The src/MacOSX/configure script generated by autoconf is broken (it has bad syntax after the egrep test). Applying a fix from the src/Unix fixes this.

File Contents

# Content
1 dnl Mac OS X configuration driver
2 dnl $Id: configure.in,v 1.27 2008/12/09 18:03:35 asvitkine Exp $
3 dnl Process this file with autoconf to produce a configure script.
4 dnl Based on Unix/configure.in
5 dnl Written in 1999 by Christian Bauer et al.
6 dnl Occasionally re-synchronised (merged?) with latest version
7 dnl Written in 2002 by Christian Bauer et al.
8
9 dnl autoconf on 10.1 doesn't understand these
10 dnl AC_INIT([Basilisk II], 1.0, [Christian.Bauer@uni-mainz.de], BasiliskII)
11 dnl AC_CONFIG_SRCDIR(main_macosx.mm)
12 AC_INIT(main_macosx.mm)
13 AC_CONFIG_AUX_DIR(../Unix)
14 AC_PREREQ(2.12)
15 AC_CONFIG_HEADER(config.h)
16 AH_TOP([
17 /* Include MacOS X macros determined at compile-time */
18 #include "config_macosx.h"
19 ])
20
21 dnl Aliases for PACKAGE and VERSION macros.
22 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE_NAME", [Define this program name.])
23 AC_DEFINE_UNQUOTED(VERSION, "$PACKAGE_VERSION", [Define this program version.])
24
25 dnl Some systems do not put corefiles in the currect directory, avoid saving
26 dnl cores for the configure tests since some are intended to dump core.
27 ulimit -c 0
28
29 dnl Universal binaries.
30 AC_ARG_ENABLE(universal,
31 [ --enable-universal enable universal binaries for selected arches [default=no]],
32 [ WANT_UNIVERSAL=""
33 for arch in $enableval; do
34 case $arch in
35 yes) WANT_UNIVERSAL="i386 ppc";;
36 ppc|ppc64|i386|x86_64) WANT_UNIVERSAL="$WANT_UNIVERSAL $arch";;
37 esac
38 done
39 ])
40 AC_ARG_WITH(ppc-sdk, [ --with-ppc-sdk=VERSION use specific SDK VERSION for ppc builds [default=earliest]], [PPC_SDK_VERSION=$withval])
41
42 dnl Video options.
43 AC_ARG_ENABLE(multiwin,
44 [ --enable-multiwin allow multiple emulator windows [default=no]], [ENABLE_MULTIPLE=$enableval], [ENABLE_MULTIPLE=no])
45
46 dnl JIT compiler options.
47 AC_ARG_ENABLE(jit-compiler, [ --enable-jit-compiler enable JIT compiler [default=no]], [WANT_JIT=$enableval], [WANT_JIT=no])
48 AC_ARG_ENABLE(jit-debug, [ --enable-jit-debug activate native code disassemblers [default=no]], [WANT_JIT_DEBUG=$enableval], [WANT_JIT_DEBUG=no])
49
50 dnl Addressing modes.
51 AC_ARG_ENABLE(addressing,
52 [ --enable-addressing=AM specify the addressing mode to use [default=fastest]],
53 [ case "$enableval" in
54 real) ADDRESSING_TEST_ORDER="real";;
55 direct) ADDRESSING_TEST_ORDER="direct";;
56 banks) ADDRESSING_TEST_ORDER="banks";;
57 fastest)ADDRESSING_TEST_ORDER="direct banks";;
58 *) AC_MSG_ERROR([--enable-addressing takes only one of the following values: fastest, real, direct, banks]);;
59 esac
60 ],
61 [ ADDRESSING_TEST_ORDER="direct banks"
62 ])
63
64 dnl External packages.
65 AC_ARG_WITH(mon, [ --with-mon use mon as debugger [default=yes]], [WANT_MON=$withval], [WANT_MON=no])
66
67 dnl Canonical system information.
68 AC_CANONICAL_HOST
69 AC_CANONICAL_TARGET
70
71 dnl Target OS type (target is host if not cross-compiling).
72 case "$target_os" in
73 linux*) OS_TYPE=linux;;
74 netbsd*) OS_TYPE=netbsd;;
75 freebsd*) OS_TYPE=freebsd;;
76 solaris*) OS_TYPE=solaris;;
77 darwin*) OS_TYPE=darwin;;
78 *) OS_TYPE=`echo $target_os | sed -e 's/-/_/g' | sed -e 's/\./_/g'`;;
79 esac
80 DEFINES="$DEFINES -DOS_$OS_TYPE"
81
82 dnl Target CPU type.
83 HAVE_I386=no
84 HAVE_M68K=no
85 HAVE_SPARC=no
86 HAVE_POWERPC=no
87 HAVE_X86_64=no
88 case "$target_cpu" in
89 i386* | i486* | i586* | i686* | i786* ) HAVE_I386=yes;;
90 m68k* ) HAVE_M68K=yes;;
91 sparc* ) HAVE_SPARC=yes;;
92 powerpc* ) HAVE_POWERPC=yes;;
93 x86_64* ) HAVE_X86_64=yes;;
94 esac
95
96 dnl Checks for programs.
97 AC_PROG_CC
98 AC_PROG_CC_C_O
99 AC_PROG_CPP
100 AC_PROG_CXX
101 AC_PROG_MAKE_SET
102 AC_PROG_INSTALL
103 AC_PROG_EGREP
104
105 dnl We use mon if possible.
106 MONSRCS=
107 if [[ "x$WANT_MON" = "xyes" ]]; then
108 AC_MSG_CHECKING(for mon)
109 mon_srcdir=../../../mon/src
110 if grep mon_init $mon_srcdir/mon.h >/dev/null 2>/dev/null; then
111 AC_MSG_RESULT(yes)
112 AC_DEFINE(ENABLE_MON, 1, [Define if using "mon".])
113 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"
114 AC_SUBST(MONSRCS)
115 CXXFLAGS="$CXXFLAGS -I$mon_srcdir -I$mon_srcdir/disass"
116 AC_CHECK_LIB(ncurses, tgetent, ,
117 [AC_CHECK_LIB(termcap, tgetent, ,
118 [AC_CHECK_LIB(termlib, tgetent, ,
119 [AC_CHECK_LIB(terminfo, tgetent, ,
120 [AC_CHECK_LIB(Hcurses, tgetent, ,
121 [AC_CHECK_LIB(curses, tgetent)])])])])])
122 AC_CHECK_LIB(readline, readline)
123 else
124 AC_MSG_RESULT(no)
125 AC_MSG_WARN([Could not find mon, ignoring --with-mon.])
126 WANT_MON=no
127 fi
128 fi
129
130 dnl We want pthreads. Try libpthread first, then libc_r (FreeBSD), then PTL.
131 HAVE_PTHREADS=yes
132 AC_CHECK_LIB(pthread, pthread_create, , [
133 AC_CHECK_LIB(c_r, pthread_create, , [
134 AC_CHECK_LIB(PTL, pthread_create, , [
135 HAVE_PTHREADS=no
136 ])
137 ])
138 ])
139 dnl OS X does have pthreads, but not in any of the above locations:
140 HAVE_PTHREADS=yes
141 if [[ "x$HAVE_PTHREADS" = "xyes" ]]; then
142 AC_DEFINE(HAVE_PTHREADS, 1, [Define if pthreads are available.])
143 fi
144 AC_CHECK_FUNCS(pthread_cond_init)
145 AC_CHECK_FUNCS(pthread_cancel pthread_testcancel)
146 AC_CHECK_FUNCS(pthread_mutexattr_setprotocol)
147 AC_CHECK_FUNCS(pthread_mutexattr_settype)
148 AC_CHECK_FUNCS(pthread_mutexattr_setpshared)
149
150 dnl If POSIX.4 semaphores are not available, we emulate them with pthread mutexes.
151 SEMSRC=
152 AC_CHECK_FUNCS(sem_init, , [
153 if test "x$HAVE_PTHREADS" = "xyes"; then
154 SEMSRC=posix_sem.cpp
155 fi
156 ])
157
158 dnl We want to enable multiple window support if possible
159 if [[ "x$WANT_MWIN" = "xyes" ]]; then
160 WANT_MWIN=yes
161 DEFINES="$DEFINES -DENABLE_MULTIPLE"
162 fi
163
164 dnl We use 64-bit file size support if possible.
165 AC_SYS_LARGEFILE
166
167 dnl Checks for header files.
168 AC_HEADER_STDC
169 AC_CHECK_HEADERS(stdlib.h stdint.h)
170 AC_CHECK_HEADERS(unistd.h fcntl.h sys/types.h sys/time.h sys/mman.h mach/mach.h)
171 AC_CHECK_HEADERS(readline.h history.h readline/readline.h readline/history.h)
172 AC_CHECK_HEADERS(sys/socket.h sys/ioctl.h sys/filio.h sys/bitypes.h sys/wait.h)
173 AC_CHECK_HEADERS(sys/poll.h sys/select.h)
174 AC_CHECK_HEADERS(arpa/inet.h)
175 AC_CHECK_HEADERS(linux/if.h linux/if_tun.h net/if.h net/if_tun.h, [], [], [
176 #ifdef HAVE_SYS_TYPES_H
177 #include <sys/types.h>
178 #endif
179 #ifdef HAVE_SYS_SOCKET_H
180 #include <sys/socket.h>
181 #endif
182 ])
183 AC_CHECK_HEADERS(AvailabilityMacros.h)
184 AC_CHECK_HEADERS(IOKit/storage/IOBlockStorageDevice.h)
185
186 dnl Checks for typedefs, structures, and compiler characteristics.
187 AC_C_CONST
188 AC_C_INLINE
189 AC_TYPE_OFF_T
190 dnl These two symbols are not defined in 10.1's autoconf:
191 dnl AC_CHECK_TYPE(loff_t, off_t)
192 dnl AC_CHECK_TYPE(caddr_t, [char *])
193 dnl We define loff_t as a typedef of off_t in sysdeps.h if we don't have LOFF_T
194 dnl OS X does have caddr_t, but the above check doesn't work, so we have to do:
195 AC_DEFINE(HAVE_CADDR_T, 1, [The type "caddr_t" does exist on MacOS X.])
196 AC_TYPE_SIZE_T
197 AC_TYPE_SIGNAL
198 AC_HEADER_TIME
199 AC_STRUCT_TM
200
201 dnl Check whether sys/socket.h defines type socklen_t.
202 dnl (extracted from ac-archive/Miscellaneous)
203 AC_CACHE_CHECK([for socklen_t],
204 ac_cv_type_socklen_t, [
205 AC_TRY_COMPILE([
206 #include <sys/types.h>
207 #include <sys/socket.h>
208 ], [socklen_t len = 42; return 0;],
209 ac_cv_type_socklen_t=yes, ac_cv_type_socklen_t=no,
210 dnl When cross-compiling, do not assume anything.
211 ac_cv_type_socklen_t="guessing no"
212 )
213 ])
214 if [[ "x$ac_cv_type_socklen_t" != "xyes" ]]; then
215 AC_DEFINE(socklen_t, int, [Define to 'int' if <sys/types.h> doesn't define.])
216 fi
217
218 dnl Checks for library functions.
219 AC_CHECK_FUNCS(strdup strerror cfmakeraw)
220 AC_CHECK_FUNCS(clock_gettime timer_create)
221 AC_CHECK_FUNCS(sigaction signal)
222 AC_CHECK_FUNCS(poll inet_aton)
223
224 dnl Darwin seems to define mach_task_self() instead of task_self().
225 AC_CHECK_FUNCS(mach_task_self task_self)
226
227 dnl Check for headers and functions related to pty support (sshpty.c)
228 dnl From openssh-3.2.2p1 configure.ac
229
230 AC_CHECK_HEADERS(strings.h login.h sys/bsdtty.h sys/stat.h util.h pty.h)
231 AC_CHECK_FUNCS(_getpty vhangup strlcpy)
232 if test -z "$no_dev_ptmx" ; then
233 if test "x$disable_ptmx_check" != "xyes" ; then
234 AC_CHECK_FILE([/dev/ptmx],
235 [
236 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX, 1, [Define if you have /dev/ptmx.])
237 have_dev_ptmx=1
238 ]
239 )
240 fi
241 fi
242 AC_CHECK_FILE([/dev/ptc],
243 [
244 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC, 1, [Define if you have /dev/ptc.])
245 have_dev_ptc=1
246 ]
247 )
248
249 dnl (end of code from openssh-3.2.2p1 configure.ac)
250
251
252 dnl Check for systems where POSIX-style non-blocking I/O (O_NONBLOCK)
253 dnl doesn't work or is unimplemented. On these systems (mostly older
254 dnl ones), use the old BSD-style FIONBIO approach instead. [tcl.m4]
255 AC_CACHE_CHECK([FIONBIO vs. O_NONBLOCK for non-blocking I/O],
256 ac_cv_nonblocking_io, [
257 case "$host" in
258 *-*-osf*)
259 ac_cv_nonblocking_io=FIONBIO
260 ;;
261 *-*-sunos4*)
262 ac_cv_nonblocking_io=FIONBIO
263 ;;
264 *-*-ultrix*)
265 ac_cv_nonblocking_io=FIONBIO
266 ;;
267 *)
268 ac_cv_nonblocking_io=O_NONBLOCK
269 ;;
270 esac
271 ])
272 if [[ "$ac_cv_nonblocking_io" = "FIONBIO" ]]; then
273 AC_DEFINE(USE_FIONBIO, 1, [Define if BSD-style non-blocking I/O is to be used])
274 fi
275
276 dnl Check whether compiler supports byte bit-fields
277 AC_CACHE_CHECK([whether compiler supports byte bit-fields],
278 ac_cv_have_byte_bitfields, [
279 AC_LANG_SAVE
280 AC_LANG_CPLUSPLUS
281 AC_TRY_RUN([
282 struct A {
283 unsigned char b1:4;
284 unsigned char b2:4;
285 unsigned char c;
286 unsigned short s;
287 unsigned char a[4];
288 };
289
290 int main(void) {
291 A a;
292 return ! (sizeof(A) == 8 && &a.c == ((unsigned char *)&a + 1));
293 }],
294 [ac_cv_have_byte_bitfields=yes],
295 [ac_cv_have_byte_bitfields=no],
296 dnl When cross-compiling, assume only GCC supports this
297 [if [[ "$GCC" = "yes" ]]; then
298 ac_cv_have_byte_bitfields="guessing yes"
299 else
300 ac_cv_have_byte_bitfields="guessing no"
301 fi]
302 )
303 AC_LANG_RESTORE
304 ])
305
306 dnl AC_CHECK_FRAMEWORK($1=NAME, $2=INCLUDES)
307 AC_DEFUN([AC_CHECK_FRAMEWORK], [
308 AS_VAR_PUSHDEF([ac_Framework], [ac_cv_framework_$1])dnl
309 AC_CACHE_CHECK([whether compiler supports framework $1],
310 ac_Framework, [
311 saved_LIBS="$LIBS"
312 LIBS="$LIBS -framework $1"
313 AC_TRY_LINK(
314 [$2], [],
315 [AS_VAR_SET(ac_Framework, yes)], [AS_VAR_SET(ac_Framework, no); LIBS="$saved_LIBS"]
316 )
317 ])
318 AS_IF([test AS_VAR_GET(ac_Framework) = yes],
319 [AC_DEFINE(AS_TR_CPP(HAVE_FRAMEWORK_$1), 1, [Define if framework $1 is available.])]
320 )
321 AS_VAR_POPDEF([ac_Framework])dnl
322 ])
323
324 dnl Check for some MacOS X frameworks
325 AC_CHECK_FRAMEWORK(AppKit, [])
326 AC_CHECK_FRAMEWORK(Carbon, [#include <Carbon/Carbon.h>])
327 AC_CHECK_FRAMEWORK(IOKit, [#include <IOKit/IOKitLib.h>])
328 AC_CHECK_FRAMEWORK(CoreFoundation, [#include <CoreFoundation/CoreFoundation.h>])
329 AC_CHECK_FRAMEWORK(CoreAudio, [#include <CoreAudio/CoreAudio.h>])
330 AC_CHECK_FRAMEWORK(AudioUnit, [#include <AudioUnit/AudioUnit.h>])
331 AC_CHECK_FRAMEWORK(AudioToolbox, [#include <AudioToolbox/AudioToolbox.h>])
332
333 dnl Select system-dependant source files.
334 ETHERSRC=ether_unix.cpp
335 DEFINES="$DEFINES -DBSD_COMP"
336 CXXFLAGS="$CXXFLAGS -fpermissive"
337 dnl Check for the CAM library
338 AC_CHECK_LIB(cam, cam_open_btl, HAVE_LIBCAM=yes, HAVE_LIBCAM=no)
339 if [[ "x$HAVE_LIBCAM" = "xno" ]]; then
340 AC_MSG_WARN([Cannot find libcam for SCSI management, disabling SCSI support.])
341 else
342 dnl Check for the sys kernel includes
343 AC_CHECK_HEADER(camlib.h)
344 if [[ "x$ac_cv_header_camlib_h" = "xno" ]]; then
345 dnl In this case I should fix this thing including a "patch"
346 dnl to access directly to the functions in the kernel :) --Orlando
347 AC_MSG_WARN([Cannot find includes for CAM library, disabling SCSI support.])
348 else
349 SCSISRC=FreeBSD/scsi_freebsd.cpp
350 LIBS="$LIBS -lcam"
351 DEFINES="$DEFINES -DCAM"
352 fi
353 fi
354
355 dnl Is the slirp library supported?
356 WANT_SLIRP=no
357 case "$ac_cv_have_byte_bitfields" in
358 yes|"guessing yes")
359 WANT_SLIRP=yes
360 ETHERSRC=ether_unix.cpp
361 ;;
362 esac
363 if [[ "x$WANT_SLIRP" = "xyes" ]]; then
364 AC_DEFINE(HAVE_SLIRP, 1, [Define if slirp library is supported])
365 SLIRP_SRCS="\
366 ../slirp/bootp.c ../slirp/ip_output.c ../slirp/tcp_input.c \
367 ../slirp/cksum.c ../slirp/mbuf.c ../slirp/tcp_output.c \
368 ../slirp/debug.c ../slirp/misc.c ../slirp/tcp_subr.c \
369 ../slirp/if.c ../slirp/sbuf.c ../slirp/tcp_timer.c \
370 ../slirp/ip_icmp.c ../slirp/slirp.c ../slirp/tftp.c \
371 ../slirp/ip_input.c ../slirp/socket.c ../slirp/udp.c"
372 fi
373 AC_SUBST(WANT_SLIRP)
374 AC_SUBST(SLIRP_SRCS)
375
376
377 dnl Define a macro that translates a yesno-variable into a C macro definition
378 dnl to be put into the config.h file
379 dnl $1 -- the macro to define
380 dnl $2 -- the value to translate
381 dnl $3 -- template name
382 AC_DEFUN([AC_TRANSLATE_DEFINE], [
383 if [[ "x$2" = "xyes" -o "x$2" = "xguessing yes" ]]; then
384 AC_DEFINE($1, 1, $3)
385 fi
386 ])
387
388 dnl Check that the host supports TUN/TAP devices
389 AC_CACHE_CHECK([whether TUN/TAP is supported],
390 ac_cv_tun_tap_support, [
391 AC_TRY_COMPILE([
392 #if defined(HAVE_LINUX_IF_H) && defined(HAVE_LINUX_IF_TUN_H)
393 #include <linux/if.h>
394 #include <linux/if_tun.h>
395 #endif
396 #if defined(HAVE_NET_IF_H) && defined(HAVE_NET_IF_TUN_H)
397 #include <net/if.h>
398 #include <net/if_tun.h>
399 #endif
400 ], [
401 struct ifreq ifr;
402 memset(&ifr, 0, sizeof(ifr));
403 ifr.ifr_flags = IFF_TAP | IFF_NO_PI;
404 ],
405 ac_cv_tun_tap_support=yes, ac_cv_tun_tap_support=no
406 )
407 ])
408 AC_TRANSLATE_DEFINE(ENABLE_TUNTAP, "$ac_cv_tun_tap_support",
409 [Define if your system supports TUN/TAP devices.])
410
411 dnl Check signal handlers need to be reinstalled
412 AC_CACHE_CHECK([whether signal handlers need to be reinstalled],
413 ac_cv_signal_need_reinstall, [
414 AC_LANG_SAVE
415 AC_LANG_CPLUSPLUS
416 AC_TRY_RUN([
417 #include <stdlib.h>
418 #ifdef HAVE_UNISTD_H
419 #include <unistd.h>
420 #endif
421 #include <signal.h>
422 static int handled_signal = 0;
423 RETSIGTYPE sigusr1_handler(int) { handled_signal++; }
424 int main(void) { /* returns 0 if signals need not to be reinstalled */
425 signal(SIGUSR1, sigusr1_handler); raise(SIGUSR1); raise(SIGUSR1);
426 exit(handled_signal == 2);
427 }
428 ], ac_cv_signal_need_reinstall=yes, ac_cv_signal_need_reinstall=no,
429 dnl When cross-compiling, do not assume anything.
430 ac_cv_signal_need_reinstall="guessing yes"
431 )
432 AC_LANG_RESTORE
433 ]
434 )
435 AC_TRANSLATE_DEFINE(SIGNAL_NEED_REINSTALL, "$ac_cv_signal_need_reinstall",
436 [Define if your system requires signals to be reinstalled.])
437
438 dnl Check if sigaction handlers need to be reinstalled
439 AC_CACHE_CHECK([whether sigaction handlers need to be reinstalled],
440 ac_cv_sigaction_need_reinstall, [
441 AC_LANG_SAVE
442 AC_LANG_CPLUSPLUS
443 AC_TRY_RUN([
444 #include <stdlib.h>
445 #ifdef HAVE_UNISTD_H
446 #include <unistd.h>
447 #endif
448 #include <signal.h>
449 static int handled_signal = 0;
450 RETSIGTYPE sigusr1_handler(int) { handled_signal++; }
451 typedef RETSIGTYPE (*signal_handler)(int);
452 static signal_handler mysignal(int sig, signal_handler handler) {
453 struct sigaction old_sa;
454 struct sigaction new_sa;
455 new_sa.sa_handler = handler;
456 return ((sigaction(sig,&new_sa,&old_sa) < 0) ? SIG_IGN : old_sa.sa_handler);
457 }
458 int main(void) { /* returns 0 if signals need not to be reinstalled */
459 mysignal(SIGUSR1, sigusr1_handler); raise(SIGUSR1); raise(SIGUSR1);
460 exit(handled_signal == 2);
461 }
462 ], ac_cv_sigaction_need_reinstall=yes, ac_cv_sigaction_need_reinstall=no,
463 dnl When cross-compiling, do not assume anything.
464 ac_cv_sigaction_need_reinstall="guessing yes"
465 )
466 AC_LANG_RESTORE
467 ]
468 )
469 AC_TRANSLATE_DEFINE(SIGACTION_NEED_REINSTALL, "$ac_cv_sigaction_need_reinstall",
470 [Define if your system requires sigactions to be reinstalled.])
471
472 dnl Check if we can ignore the fault (instruction skipping in SIGSEGV handler)
473 AC_CACHE_CHECK([whether we can skip instruction in SIGSEGV handler],
474 ac_cv_have_skip_instruction, [
475 AC_LANG_SAVE
476 AC_LANG_CPLUSPLUS
477 AC_TRY_RUN([
478 #include "config_macosx.h"
479 #define HAVE_SIGSEGV_SKIP_INSTRUCTION 1
480 #define CONFIGURE_TEST_SIGSEGV_RECOVERY
481 #include "../Unix/vm_alloc.cpp"
482 #include "../Unix/sigsegv.cpp"
483 ], ac_cv_have_skip_instruction=yes, ac_cv_have_skip_instruction=no,
484 dnl When cross-compiling, do not assume anything.
485 ac_cv_have_skip_instruction=no
486 )
487 AC_LANG_RESTORE
488 ]
489 )
490 AC_TRANSLATE_DEFINE(HAVE_SIGSEGV_SKIP_INSTRUCTION, "$ac_cv_have_skip_instruction",
491 [Define if we can ignore the fault (instruction skipping in SIGSEGV handler).])
492
493 dnl We can do Video on SEGV Signals
494 CAN_VOSF=yes
495
496 dnl A dummy program that returns always true
497 AC_PATH_PROG([BLESS], "true")
498
499 dnl Check for linker script support
500 case $target_os:$target_cpu in
501 linux*:i?86) LINKER_SCRIPT_FLAGS="-Wl,-T,ldscripts/linux-i386.ld";;
502 linux*:x86_64) LINKER_SCRIPT_FLAGS="-Wl,-T,ldscripts/linux-x86_64.ld";;
503 linux*:powerpc) LINKER_SCRIPT_FLAGS="-Wl,-T,ldscripts/linux-ppc.ld";;
504 netbsd*:i?86) LINKER_SCRIPT_FLAGS="-Wl,-T,ldscripts/linux-i386.ld";;
505 freebsd*:i?86) LINKER_SCRIPT_FLAGS="-Wl,-T,ldscripts/freebsd-i386.ld";;
506 darwin*:*) LINKER_SCRIPT_FLAGS="-Wl,-seg1addr,0x78048000";;
507 esac
508 if [[ -n "$LINKER_SCRIPT_FLAGS" ]]; then
509 AC_CACHE_CHECK([whether linker script is usable],
510 ac_cv_linker_script_works, [
511 AC_LANG_SAVE
512 AC_LANG_CPLUSPLUS
513 saved_LDFLAGS="$LDFLAGS"
514 LDFLAGS="$LDFLAGS $LINKER_SCRIPT_FLAGS"
515 AC_TRY_RUN(
516 [int main() {if ((char *)&main < (char *)0x70000000) return 1;}],
517 [ac_cv_linker_script_works=yes],
518 [ac_cv_linker_script_works=no],
519 dnl When cross-compiling, assume it works
520 [ac_cv_linker_script_works="guessing yes"]
521 )
522 AC_LANG_RESTORE
523 if [[ "$ac_cv_linker_script_works" = "no" ]]; then
524 LDFLAGS="$saved_LDFLAGS"
525 LINKER_SCRIPT_FLAGS=""
526 fi
527 ])
528 fi
529 AC_TRANSLATE_DEFINE(HAVE_LINKER_SCRIPT, "$ac_cv_linker_script_works",
530 [Define if there is a linker script to relocate the executable above 0x70000000.])
531
532 dnl Determine the addressing mode to use
533 ADDRESSING_MODE=""
534 AC_MSG_CHECKING([for the addressing mode to use])
535 for am in $ADDRESSING_TEST_ORDER; do
536 case $am in
537 real)
538 dnl Requires VOSF screen updates
539 if [[ "x$CAN_VOSF" = "xno" ]]; then
540 continue
541 fi
542 dnl Real addressing will probably work.
543 ADDRESSING_MODE="real"
544 WANT_VOSF=yes dnl we can use VOSF and we need it actually
545 DEFINES="$DEFINES -DREAL_ADDRESSING"
546 AC_DEFINE(REAL_ADDRESSING, 1, [Emulated memory is memory mapped to actual address.])
547 LDFLAGS="$LDFLAGS -pagezero_size 0x2000"
548 break
549 ;;
550 direct)
551 dnl Requires VOSF screen updates
552 if [[ "x$CAN_VOSF" = "xyes" ]]; then
553 ADDRESSING_MODE="direct"
554 WANT_VOSF=yes dnl we can use VOSF and we need it actually
555 DEFINES="$DEFINES -DDIRECT_ADDRESSING"
556 AC_DEFINE(DIRECT_ADDRESSING, 1, [Emulated memory is an offset from actual address.])
557 break
558 fi
559 ;;
560 banks)
561 dnl Default addressing mode
562 ADDRESSING_MODE="memory banks"
563 break
564 ;;
565 *)
566 AC_MSG_ERROR([Internal configure.in script error for $am addressing mode])
567 esac
568 done
569 AC_MSG_RESULT($ADDRESSING_MODE)
570 if [[ "x$ADDRESSING_MODE" = "x" ]]; then
571 AC_MSG_WARN([Sorry, no suitable addressing mode in $ADDRESSING_TEST_ORDER])
572 ADDRESSING_MODE="memory banks"
573 fi
574
575 dnl Banked Memory Addressing mode is not supported by the JIT compiler
576 if [[ "x$WANT_JIT" = "xyes" -a "x$ADDRESSING_MODE" = "xmemory banks" ]]; then
577 AC_MSG_ERROR([Sorry, the JIT Compiler requires Direct Addressing, at least])
578 fi
579
580 dnl Enable VOSF screen updates with this feature is requested and feasible
581 if [[ "x$WANT_VOSF" = "xyes" -a "x$CAN_VOSF" = "xyes" ]]; then
582 AC_DEFINE(ENABLE_VOSF, 1, [Define if using video enabled on SEGV signals.])
583 else
584 WANT_VOSF=no
585 fi
586
587 dnl Check for GAS.
588 HAVE_GAS=no
589 AC_MSG_CHECKING(for GAS .p2align feature)
590 cat >conftest.S << EOF
591 .text
592 .p2align 5
593 EOF
594 if $CC conftest.S -c -o conftest.o >/dev/null 2>&1 ; then HAVE_GAS=yes; fi
595 AC_MSG_RESULT($HAVE_GAS)
596
597 dnl Check for GCC 2.7 or higher.
598 HAVE_GCC27=no
599 AC_MSG_CHECKING(for GCC 2.7 or higher)
600 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#if ! (__GNUC__ - 1 > 1 || __GNUC_MINOR__ - 1 > 5)
601 # error gcc < 2.7
602 #endif
603 ]])],
604 [AC_MSG_RESULT(yes); HAVE_GCC27=yes],
605 [AC_MSG_RESULT(no)])
606
607 dnl Check for GCC 3.0 or higher.
608 HAVE_GCC30=no
609 AC_MSG_CHECKING(for GCC 3.0 or higher)
610 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#if ! (__GNUC__ >= 3)
611 # error gcc < 3
612 #endif
613 ]])],
614 [AC_MSG_RESULT(yes); HAVE_GCC30=yes],
615 [AC_MSG_RESULT(no)])
616
617 dnl Check for ICC.
618 AC_MSG_CHECKING(for ICC)
619 HAVE_ICC=no
620 if $CXX -V -v 2>&1 | grep -q "Intel(R) C++ Compiler"; then
621 HAVE_ICC=yes
622 fi
623 AC_MSG_RESULT($HAVE_ICC)
624
625 dnl Set "-fomit-frame-pointer" on i386 GCC 2.7 or higher.
626 dnl Also set "-fno-exceptions" for C++ because exception handling requires
627 dnl the frame pointer.
628 if [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_I386" = "xyes" ]]; then
629 CFLAGS="$CFLAGS -fomit-frame-pointer"
630 CXXFLAGS="$CXXFLAGS -fomit-frame-pointer -fno-exceptions"
631 fi
632
633 dnl (gb) Do not merge constants since it breaks fpu/fpu_x86.cpp.
634 dnl As of 2001/08/02, this affects the following compilers:
635 dnl Official: probably gcc-3.1 (mainline CVS)
636 dnl Mandrake: gcc-2.96 >= 0.59mdk, gcc-3.0.1 >= 0.1mdk
637 dnl Red Hat : gcc-2.96 >= 89, gcc-3.0 >= 1
638 if [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_ICC" = "xno" ]]; then
639 SAVED_CXXFLAGS="$CXXFLAGS"
640 CXXFLAGS="$CXXFLAGS -fno-merge-constants"
641 AC_CACHE_CHECK([whether GCC supports constants merging], ac_cv_gcc_constants_merging, [
642 AC_LANG_SAVE
643 AC_LANG_CPLUSPLUS
644 AC_TRY_COMPILE([],[],[ac_cv_gcc_constants_merging=yes],[ac_cv_gcc_constants_merging=no])
645 AC_LANG_RESTORE
646 ])
647 if [[ "x$ac_cv_gcc_constants_merging" != "xyes" ]]; then
648 CXXFLAGS="$SAVED_CXXFLAGS"
649 fi
650 fi
651
652 dnl Store motion was introduced in 3.3-hammer branch and any gcc >= 3.4
653 dnl However, there are some corner cases exposed on x86-64
654 if [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_ICC" = "xno" ]]; then
655 SAVED_CXXFLAGS="$CXXFLAGS"
656 CXXFLAGS="$CXXFLAGS -fno-gcse-sm"
657 AC_CACHE_CHECK([whether GCC supports store motion], ac_cv_gcc_store_motion, [
658 AC_LANG_SAVE
659 AC_LANG_CPLUSPLUS
660 AC_TRY_COMPILE([],[],[ac_cv_gcc_store_motion=yes],[ac_cv_gcc_store_motion=no])
661 AC_LANG_RESTORE
662 ])
663 if [[ "x$ac_cv_gcc_store_motion" != "xyes" ]]; then
664 CXXFLAGS="$SAVED_CXXFLAGS"
665 fi
666 fi
667
668 dnl Add -fno-strict-aliasing for slirp sources
669 if [[ "x$HAVE_GCC30" = "xyes" ]]; then
670 SAVED_CFLAGS="$CFLAGS"
671 CFLAGS="$CFLAGS -fno-strict-aliasing"
672 AC_CACHE_CHECK([whether the compiler supports -fno-strict-aliasing],
673 ac_cv_gcc_no_strict_aliasing, [
674 AC_TRY_COMPILE([],[],[ac_cv_gcc_no_strict_aliasing=yes],[ac_cv_gcc_no_strict_aliasing=no])
675 ])
676 if [[ "x$ac_cv_gcc_no_strict_aliasing" = "xyes" ]]; then
677 AC_SUBST(SLIRP_CFLAGS, "-fno-strict-aliasing")
678 fi
679 CFLAGS="$SAVED_CFLAGS"
680 fi
681
682 dnl Add -mdynamic-no-pic for MacOS X (XXX icc10 will support MacOS X)
683 if [[ "x$HAVE_GCC30" = "xyes" -a "x$HAVE_ICC" = "xno" ]]; then
684 SAVED_CFLAGS="$CFLAGS"
685 CFLAGS="$CFLAGS -mdynamic-no-pic"
686 AC_CACHE_CHECK([whether the compiler supports -mdynamic-no-pic],
687 ac_cv_gcc_mdynamic_no_pic, [
688 AC_TRY_COMPILE([],[],[ac_cv_gcc_mdynamic_no_pic=yes],[ac_cv_gcc_mdynamic_no_pic=no])
689 ])
690 if [[ "x$ac_cv_gcc_mdynamic_no_pic" = "xyes" ]]; then
691 CXXFLAGS="$CXXFLAGS -mdynamic-no-pic"
692 else
693 CFLAGS="$SAVED_CFLAGS"
694 fi
695 fi
696
697 dnl Make sure we can enable JIT debug mode.
698 if [[ "x$WANT_JIT_DEBUG" = "xyes" ]]; then
699 if [[ ":$WANT_JIT:$WANT_MON:" != ":yes:yes:" ]]; then
700 AC_MSG_WARN([cxmon not found, ignoring --enable-jit-debug])
701 WANT_JIT_DEBUG=no
702 fi
703 fi
704
705 dnl Additionnal checks for the IEEE FPU emulation code.
706 AC_CHECK_HEADERS(ieee754.h ieeefp.h floatingpoint.h nan.h)
707 AC_CHECK_FUNCS(atanh)
708 AC_CHECK_FUNCS(isnan isinf finite isnormal signbit)
709 dnl Math functions not mandated by C99 standard
710 AC_CHECK_FUNCS(isnanl isinfl)
711 dnl Math functions required by C99 standard, but probably not
712 dnl implemented everywhere. In that case, we fall back to the
713 dnl regular variant for doubles.
714 AC_CHECK_FUNCS(logl log10l expl powl fabsl sqrtl)
715 AC_CHECK_FUNCS(sinl cosl tanl sinhl coshl tanhl)
716 AC_CHECK_FUNCS(asinl acosl atanl asinhl acoshl atanhl)
717 AC_CHECK_FUNCS(floorl ceill)
718
719 dnl Remove the "-g" option if set for GCC.
720 if [[ "x$HAVE_GCC27" = "xyes" ]]; then
721 CFLAGS=`echo $CFLAGS | sed -e 's/-g\b//g'`
722 CXXFLAGS=`echo $CXXFLAGS | sed -e 's/-g\b//g'`
723 fi
724
725 dnl
726 dnl Some Mac OS X specific stuff:
727 dnl
728
729 dnl MacOS 10.2 (and later?) have a particular header for defining the OS version
730 if [[ "x$ac_cv_header_AvailabilityMacros_h" = "xyes" ]]; then
731 AC_DEFINE(AVAILABILITYMACROS, 1, [Header specific to 10.2 and later.])
732 fi
733
734 dnl Which IDE do we use?
735 if test -d "/Developer/Applications/Xcode.app"; then
736 IDE=xcodebuild
737 PROJECT=BasiliskII.xcode
738 IDEARGS="-project BasiliskII.xcode"
739 else
740 IDE=pbxbuild
741 PROJECT=BasiliskII.pbproj
742 IDEARGS=""
743 fi
744
745 dnl Universal binaries
746 if [[ -z "$WANT_UNIVERSAL" ]]; then
747 WANT_UNIVERSAL=`echo $target_cpu | sed -e 's/i.86/i386/'`
748 fi
749 AC_SUBST(TARGET_ARCHES, [$WANT_UNIVERSAL])
750
751 AC_MSG_CHECKING(for PowerPC SDK)
752 for version in $PPC_SDK_VERSION 10.2.8 10.3.9 10.4; do
753 sdk=`echo /Developer/SDKs/MacOSX$version*.sdk`
754 if [[ -d "$sdk" ]]; then
755 PPC_SDK_VERSION="$version"
756 break
757 fi
758 done
759 AC_MSG_RESULT($PPC_SDK_VERSION)
760 AC_SUBST(PPC_SDK_VERSION)
761
762 AC_DEFINE(DATADIR, "~", [unix_ether needs this!])
763
764 dnl Generate Makefile.
765 AC_SUBST(DEFINES)
766 AC_SUBST(MONSRCS)
767 AC_SUBST(CPUINCLUDES)
768 AC_SUBST(BLESS)
769 AC_SUBST(IDE)
770 AC_SUBST(PROJECT)
771 AC_SUBST(IDEARGS)
772 AC_SUBST(SLIRP_SRCS)
773 AC_SUBST(KEYCODES)
774 AC_SUBST(WANT_JIT)
775 AC_SUBST(WANT_JIT_DEBUG)
776 dnl autoconf on 10.1 doesn't understand these
777 dnl AC_CONFIG_FILES([Makefile])
778 dnl AC_OUTPUT
779 AC_OUTPUT(Makefile)
780
781 dnl Print summary.
782 echo
783 echo Basilisk II configuration summary:
784 echo
785 echo Build binaries for ..................... : $WANT_UNIVERSAL
786 echo Multiple emulator windows .............. : $ENABLE_MULTIPLE
787 echo Enable video on SEGV signals ........... : $WANT_VOSF
788 echo mon debugger support ................... : $WANT_MON
789 echo Build JIT compiler ..................... : $WANT_JIT
790 echo Build JIT with debug code .............. : $WANT_JIT_DEBUG
791 echo Addressing mode ........................ : $ADDRESSING_MODE
792 echo Mac OS X development environment ....... : $IDE
793 echo
794 echo "Configuration done. Now type \"make\" (or \"make ide\")."