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