ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/BasiliskII/src/MacOSX/configure.in
Revision: 1.14
Committed: 2004-01-28T07:26:00Z (20 years, 9 months ago) by nigel
Branch: MAIN
Changes since 1.13: +50 -13 lines
Log Message:
/bin/true isn't on OS X, auto-detect Xcode (vs Project Builder),
some textual changes to make it even more like Unix/autoconfigure.ac

File Contents

# User Rev Content
1 nigel 1.10 dnl Mac OS X configuration driver
2 nigel 1.14 dnl $Id: configure.in,v 1.13 2004/01/27 04:35:30 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    
7 nigel 1.11 dnl autoconf on 10.1 doesn't understand these
8     dnl AC_INIT([Basilisk II], 1.0, [Christian.Bauer@uni-mainz.de], BasiliskII)
9     dnl AC_CONFIG_SRCDIR(main_macosx.mm)
10 nigel 1.1 AC_INIT(main_macosx.mm)
11     AC_PREREQ(2.12)
12     AC_CONFIG_HEADER(config.h)
13    
14 nigel 1.13 dnl Aliases for PACKAGE and VERSION macros.
15     AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE_NAME", [Define this program name.])
16     AC_DEFINE_UNQUOTED(VERSION, "$PACKAGE_VERSION", [Define this program version.])
17    
18     dnl Some systems do not put corefiles in the currect directory, avoid saving
19     dnl cores for the configure tests since some are intended to dump core.
20     ulimit -c 0
21    
22 nigel 1.5 dnl Video options.
23 nigel 1.1 AC_ARG_ENABLE(multiwin,
24 nigel 1.8 [ --enable-multiwin allow multiple emulator windows [default=no]], [ENABLE_MULTIPLE=$enableval], [ENABLE_MULTIPLE=no])
25 nigel 1.1
26 nigel 1.5 dnl JIT compiler options.
27     AC_ARG_ENABLE(jit-compiler, [ --enable-jit-compiler enable JIT compiler [default=no]], [WANT_JIT=$enableval], [WANT_JIT=no])
28     AC_ARG_ENABLE(jit-debug, [ --enable-jit-debug activate native code disassemblers [default=no]], [WANT_JIT_DEBUG=$enableval], [WANT_JIT_DEBUG=no])
29    
30 nigel 1.1 dnl FPU emulation core.
31     AC_ARG_ENABLE(fpe,
32 nigel 1.5 [ --enable-fpe=FPE specify which fpu emulator to use [default=auto]],
33 nigel 1.1 [ case "$enableval" in
34 nigel 1.5 dnl default is always ieee, if architecture has this fp format
35     auto) FPE_CORE_TEST_ORDER="ieee uae";;
36     ieee) FPE_CORE_TEST_ORDER="ieee";;
37     uae) FPE_CORE_TEST_ORDER="uae";;
38     x86) FPE_CORE_TEST_ORDER="x86";;
39 nigel 1.10 *) AC_MSG_ERROR([--enable-fpe takes only one of the following values: auto, x86, ieee, uae]);;
40 nigel 1.1 esac
41     ],
42 nigel 1.5 [ FPE_CORE_TEST_ORDER="ieee uae"
43 nigel 1.1 ])
44    
45     dnl Addressing modes.
46     AC_ARG_ENABLE(addressing,
47     [ --enable-addressing=AM specify the addressing mode to use [default=fastest]],
48     [ case "$enableval" in
49     real) ADDRESSING_TEST_ORDER="real";;
50     direct) ADDRESSING_TEST_ORDER="direct";;
51     banks) ADDRESSING_TEST_ORDER="banks";;
52     fastest)ADDRESSING_TEST_ORDER="direct banks";;
53     *) AC_MSG_ERROR([--enable-addressing takes only one of the following values: fastest, real, direct, banks]);;
54     esac
55     ],
56     [ ADDRESSING_TEST_ORDER="direct banks"
57     ])
58    
59     dnl External packages.
60     AC_ARG_WITH(mon, [ --with-mon use mon as debugger [default=yes]], [WANT_MON=$withval], [WANT_MON=yes])
61    
62     dnl Canonical system information.
63     AC_CANONICAL_HOST
64     AC_CANONICAL_TARGET
65    
66 nigel 1.14 dnl Target OS type (target is host if not cross-compiling).
67     case "$target_os" in
68     linux*) OS_TYPE=linux;;
69     netbsd*) OS_TYPE=netbsd;;
70     freebsd*) OS_TYPE=freebsd;;
71     solaris*) OS_TYPE=solaris;;
72     darwin*) OS_TYPE=darwin;;
73     *) OS_TYPE=`echo $target_os | sed -e 's/-/_/g' | sed -e 's/\./_/g'`;;
74     esac
75 nigel 1.1 DEFINES="$DEFINES -DOS_$OS_TYPE"
76    
77     dnl Target CPU type.
78     HAVE_I386=no
79     HAVE_M68K=no
80     HAVE_SPARC=no
81     HAVE_POWERPC=no
82 nigel 1.10 HAVE_X86_64=no
83 nigel 1.1 case "$target_cpu" in
84 nigel 1.10 i386* | i486* | i586* | i686* | i786* ) HAVE_I386=yes;;
85     m68k* ) HAVE_M68K=yes;;
86     sparc* ) HAVE_SPARC=yes;;
87     powerpc* ) HAVE_POWERPC=yes;;
88     x86_64* ) HAVE_X86_64=yes;;
89 nigel 1.1 esac
90    
91     dnl Checks for programs.
92     AC_PROG_CC
93     AC_PROG_CC_C_O
94     AC_PROG_CPP
95     AC_PROG_CXX
96     AC_PROG_MAKE_SET
97     AC_PROG_INSTALL
98    
99     dnl We use mon if possible.
100     MONSRCS=
101     if [[ "x$WANT_MON" = "xyes" ]]; then
102     AC_MSG_CHECKING(for mon)
103     mon_srcdir=../../../mon/src
104     if grep mon_init $mon_srcdir/mon.h >/dev/null 2>/dev/null; then
105     AC_MSG_RESULT(yes)
106 nigel 1.5 AC_DEFINE(ENABLE_MON, 1, [Define if using "mon".])
107     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"
108 nigel 1.1 CXXFLAGS="$CXXFLAGS -I$mon_srcdir -I$mon_srcdir/disass"
109 nigel 1.10 AC_CHECK_LIB(ncurses, tgetent, ,
110     AC_CHECK_LIB(termcap, tgetent, ,
111     AC_CHECK_LIB(termlib, tgetent, ,
112     AC_CHECK_LIB(terminfo, tgetent, ,
113     AC_CHECK_LIB(Hcurses, tgetent, ,
114     AC_CHECK_LIB(curses, tgetent))))))
115 nigel 1.1 AC_CHECK_LIB(readline, readline)
116     else
117     AC_MSG_RESULT(no)
118     AC_MSG_WARN([Could not find mon, ignoring --with-mon.])
119     WANT_MON=no
120     fi
121     fi
122    
123 nigel 1.14 dnl We want pthreads. Try libpthread first, then libc_r (FreeBSD), then PTL.
124 nigel 1.1 HAVE_PTHREADS=yes
125 nigel 1.14 AC_CHECK_LIB(pthread, pthread_create, , [
126     AC_CHECK_LIB(c_r, pthread_create, , [
127     AC_CHECK_LIB(PTL, pthread_create, , [
128     HAVE_PTHREADS=no
129     ])
130     ])
131     ])
132     dnl OS X does have pthreads, but not in any of the above locations:
133     HAVE_PTHREADS=yes
134     if [[ "x$HAVE_PTHREADS" = "xyes" ]]; then
135     AC_DEFINE(HAVE_PTHREADS, 1, [Define if pthreads are available.])
136     fi
137 nigel 1.1 AC_CHECK_FUNCS(pthread_cancel)
138 nigel 1.3 AC_CHECK_FUNCS(pthread_mutexattr_setprotocol)
139     AC_CHECK_FUNCS(pthread_mutexattr_settype)
140 nigel 1.5 AC_CHECK_FUNCS(pthread_mutexattr_setpshared)
141 nigel 1.1
142     dnl If POSIX.4 semaphores are not available, we emulate them with pthread mutexes.
143     SEMSRC=
144     AC_CHECK_FUNCS(sem_init, , [
145     if test "x$HAVE_PTHREADS" = "xyes"; then
146     SEMSRC=posix_sem.cpp
147     fi
148     ])
149    
150 nigel 1.5 dnl We want to enable multiple window support if possible
151 nigel 1.1 if [[ "x$WANT_MWIN" = "xyes" ]]; then
152     WANT_MWIN=yes
153     DEFINES="$DEFINES -DENABLE_MULTIPLE"
154     fi
155    
156 nigel 1.5 dnl We use 64-bit file size support if possible.
157     AC_SYS_LARGEFILE
158    
159 nigel 1.1 dnl Checks for header files.
160     AC_HEADER_STDC
161 nigel 1.13 AC_CHECK_HEADERS(unistd.h fcntl.h sys/types.h sys/time.h sys/mman.h mach/mach.h)
162 nigel 1.12 AC_CHECK_HEADERS(readline.h history.h readline/readline.h readline/history.h)
163 nigel 1.1
164     dnl Checks for typedefs, structures, and compiler characteristics.
165     AC_C_BIGENDIAN
166     AC_C_CONST
167     AC_C_INLINE
168     AC_CHECK_SIZEOF(short, 2)
169     AC_CHECK_SIZEOF(int, 4)
170     AC_CHECK_SIZEOF(long, 4)
171     AC_CHECK_SIZEOF(long long, 8)
172 nigel 1.5 AC_CHECK_SIZEOF(float, 4)
173     AC_CHECK_SIZEOF(double, 8)
174     AC_CHECK_SIZEOF(long double, 12)
175 nigel 1.1 AC_CHECK_SIZEOF(void *, 4)
176 nigel 1.10 AC_TYPE_OFF_T
177 nigel 1.13 dnl These two symbols are not defined in 10.1's autoconf:
178 nigel 1.8 dnl AC_CHECK_TYPE(loff_t, off_t)
179     dnl AC_CHECK_TYPE(caddr_t, [char *])
180     dnl We define loff_t as a typedef of off_t in sysdeps.h if we don't have LOFF_T
181 nigel 1.13 dnl OS X does have caddr_t, but the above check doesn't work, so we have to do:
182     AC_DEFINE(HAVE_CADDR_T, 1, [The type "caddr_t" does exist on MacOS X.])
183 nigel 1.1 AC_TYPE_SIZE_T
184     AC_TYPE_SIGNAL
185     AC_HEADER_TIME
186     AC_STRUCT_TM
187    
188 nigel 1.5 dnl Check whether sys/socket.h defines type socklen_t.
189     dnl (extracted from ac-archive/Miscellaneous)
190     AC_CACHE_CHECK([for socklen_t],
191     ac_cv_type_socklen_t, [
192     AC_TRY_COMPILE([
193     #include <sys/types.h>
194     #include <sys/socket.h>
195     ], [socklen_t len = 42; return 0;],
196     ac_cv_type_socklen_t=yes, ac_cv_type_socklen_t=no,
197     dnl When cross-compiling, do not assume anything.
198     ac_cv_type_socklen_t="guessing no"
199     )
200     ])
201     if [[ "x$ac_cv_type_socklen_t" != "xyes" ]]; then
202     AC_DEFINE(socklen_t, int, [Define to 'int' if <sys/types.h> doesn't define.])
203     fi
204    
205 nigel 1.1 dnl Checks for library functions.
206     AC_CHECK_FUNCS(strdup cfmakeraw)
207     AC_CHECK_FUNCS(clock_gettime timer_create)
208     AC_CHECK_FUNCS(sigaction signal)
209     AC_CHECK_FUNCS(mmap mprotect munmap)
210     AC_CHECK_FUNCS(vm_allocate vm_deallocate vm_protect)
211    
212     dnl Darwin seems to define mach_task_self() instead of task_self().
213     AC_CHECK_FUNCS(mach_task_self task_self)
214    
215     dnl Select system-dependant source files.
216 nigel 1.13 DEFINES="$DEFINES -DBSD_COMP"
217     CXXFLAGS="$CXXFLAGS -fpermissive"
218 nigel 1.1 dnl Check for the CAM library
219 nigel 1.5 AC_CHECK_LIB(cam, cam_open_btl, HAVE_LIBCAM=yes, HAVE_LIBCAM=no)
220 nigel 1.1 if [[ "x$HAVE_LIBCAM" = "xno" ]]; then
221     AC_MSG_WARN([Cannot find libcam for SCSI management, disabling SCSI support.])
222 nigel 1.5 else
223     dnl Check for the sys kernel includes
224 nigel 1.1 AC_CHECK_HEADER(camlib.h)
225     if [[ "x$ac_cv_header_camlib_h" = "xno" ]]; then
226     dnl In this case I should fix this thing including a "patch"
227     dnl to access directly to the functions in the kernel :) --Orlando
228     AC_MSG_WARN([Cannot find includes for CAM library, disabling SCSI support.])
229     else
230     SCSISRC=FreeBSD/scsi_freebsd.cpp
231     LIBS="$LIBS -lcam"
232     DEFINES="$DEFINES -DCAM"
233     fi
234     fi
235    
236     dnl Use 68k CPU natively?
237     WANT_NATIVE_M68K=no
238    
239    
240     dnl Define a macro that translates a yesno-variable into a C macro definition
241     dnl to be put into the config.h file
242     dnl $1 -- the macro to define
243     dnl $2 -- the value to translate
244 nigel 1.5 dnl $3 -- template name
245 nigel 1.1 AC_DEFUN(AC_TRANSLATE_DEFINE, [
246     if [[ "x$2" = "xyes" -o "x$2" = "xguessing yes" ]]; then
247 nigel 1.5 AC_DEFINE($1, 1, $3)
248 nigel 1.1 fi
249     ])
250    
251     dnl Various checks if the system supports vm_allocate() and the like functions.
252     have_mach_vm=no
253     if [[ "x$ac_cv_func_vm_allocate" = "xyes" -a "x$ac_cv_func_vm_deallocate" = "xyes" -a \
254     "x$ac_cv_func_vm_protect" = "xyes" ]]; then
255     have_mach_vm=yes
256     fi
257 nigel 1.5 AC_TRANSLATE_DEFINE(HAVE_MACH_VM, "$have_mach_vm",
258     [Define if your system has a working vm_allocate()-based memory allocator.])
259 nigel 1.1
260     dnl Check that vm_allocate(), vm_protect() work
261     if [[ "x$have_mach_vm" = "xyes" ]]; then
262    
263 nigel 1.5 AC_CACHE_CHECK([whether vm_protect works],
264 nigel 1.1 ac_cv_vm_protect_works, [
265     AC_LANG_SAVE
266     AC_LANG_CPLUSPLUS
267     ac_cv_vm_protect_works=yes
268     dnl First the tests that should segfault
269     for test_def in NONE_READ NONE_WRITE READ_WRITE; do
270     AC_TRY_RUN([
271     #define CONFIGURE_TEST_VM_MAP
272     #define TEST_VM_PROT_$test_def
273 nigel 1.6 #include "../Unix/vm_alloc.cpp"
274 nigel 1.1 ], ac_cv_vm_protect_works=no, rm -f core,
275     dnl When cross-compiling, do not assume anything
276     ac_cv_vm_protect_works="guessing no"
277     )
278     done
279     AC_TRY_RUN([
280     #define CONFIGURE_TEST_VM_MAP
281     #define TEST_VM_PROT_RDWR_WRITE
282 nigel 1.6 #include "../Unix/vm_alloc.cpp"
283 nigel 1.1 ], , ac_cv_vm_protect_works=no,
284     dnl When cross-compiling, do not assume anything
285     ac_cv_vm_protect_works="guessing no"
286     )
287     AC_LANG_RESTORE
288     ]
289     )
290    
291     dnl Remove support for vm_allocate() if vm_protect() does not work
292     if [[ "x$have_mach_vm" = "xyes" ]]; then
293     case $ac_cv_vm_protect_works in
294     *yes) have_mach_vm=yes;;
295     *no) have_mach_vm=no;;
296     esac
297     fi
298 nigel 1.5 AC_TRANSLATE_DEFINE(HAVE_MACH_VM, "$have_mach_vm",
299     [Define if your system has a working vm_allocate()-based memory allocator.])
300 nigel 1.1
301     fi dnl HAVE_MACH_VM
302    
303     dnl Various checks if the system supports mmap() and the like functions.
304     dnl ... and Mach memory allocators are not supported
305     have_mmap_vm=no
306     if [[ "x$ac_cv_func_mmap" = "xyes" -a "x$ac_cv_func_munmap" = "xyes" -a \
307     "x$ac_cv_func_mprotect" = "xyes" ]]; then
308     if [[ "x$have_mach_vm" = "xno" ]]; then
309     have_mmap_vm=yes
310     fi
311     fi
312 nigel 1.5 AC_TRANSLATE_DEFINE(HAVE_MMAP_VM, "$have_mmap_vm",
313     [Define if your system has a working mmap()-based memory allocator.])
314 nigel 1.1
315     dnl Check that mmap() and associated functions work.
316     if [[ "x$have_mmap_vm" = "xyes" ]]; then
317    
318     dnl Check if we have a working anonymous mmap()
319 nigel 1.5 AC_CACHE_CHECK([whether mmap supports MAP_ANON],
320 nigel 1.1 ac_cv_mmap_anon, [
321     AC_LANG_SAVE
322     AC_LANG_CPLUSPLUS
323     AC_TRY_RUN([
324     #define HAVE_MMAP_ANON
325     #define CONFIGURE_TEST_VM_MAP
326     #define TEST_VM_MMAP_ANON
327 nigel 1.6 #include "../Unix/vm_alloc.cpp"
328 nigel 1.1 ], ac_cv_mmap_anon=yes, ac_cv_mmap_anon=no,
329     dnl When cross-compiling, do not assume anything.
330     ac_cv_mmap_anon="guessing no"
331     )
332     AC_LANG_RESTORE
333     ]
334     )
335 nigel 1.5 AC_TRANSLATE_DEFINE(HAVE_MMAP_ANON, "$ac_cv_mmap_anon",
336     [Define if <sys/mman.h> defines MAP_ANON and mmap()'ing with MAP_ANON works.])
337 nigel 1.1
338 nigel 1.5 AC_CACHE_CHECK([whether mmap supports MAP_ANONYMOUS],
339 nigel 1.1 ac_cv_mmap_anonymous, [
340     AC_LANG_SAVE
341     AC_LANG_CPLUSPLUS
342     AC_TRY_RUN([
343     #define HAVE_MMAP_ANONYMOUS
344     #define CONFIGURE_TEST_VM_MAP
345     #define TEST_VM_MMAP_ANON
346 nigel 1.6 #include "../Unix/vm_alloc.cpp"
347 nigel 1.1 ], ac_cv_mmap_anonymous=yes, ac_cv_mmap_anonymous=no,
348     dnl When cross-compiling, do not assume anything.
349     ac_cv_mmap_anonymous="guessing no"
350     )
351     AC_LANG_RESTORE
352     ]
353     )
354 nigel 1.5 AC_TRANSLATE_DEFINE(HAVE_MMAP_ANONYMOUS, "$ac_cv_mmap_anonymous",
355     [Define if <sys/mman.h> defines MAP_ANONYMOUS and mmap()'ing with MAP_ANONYMOUS works.])
356 nigel 1.1
357 nigel 1.5 AC_CACHE_CHECK([whether mprotect works],
358 nigel 1.1 ac_cv_mprotect_works, [
359     AC_LANG_SAVE
360     AC_LANG_CPLUSPLUS
361     ac_cv_mprotect_works=yes
362     dnl First the tests that should segfault
363     for test_def in NONE_READ NONE_WRITE READ_WRITE; do
364     AC_TRY_RUN([
365     #define CONFIGURE_TEST_VM_MAP
366     #define TEST_VM_PROT_$test_def
367 nigel 1.6 #include "../Unix/vm_alloc.cpp"
368 nigel 1.1 ], ac_cv_mprotect_works=no, rm -f core,
369     dnl When cross-compiling, do not assume anything
370     ac_cv_mprotect_works="guessing no"
371     )
372     done
373     AC_TRY_RUN([
374     #define CONFIGURE_TEST_VM_MAP
375     #define TEST_VM_PROT_RDWR_WRITE
376 nigel 1.6 #include "../Unix/vm_alloc.cpp"
377 nigel 1.1 ], , ac_cv_mprotect_works=no,
378     dnl When cross-compiling, do not assume anything
379     ac_cv_mprotect_works="guessing no"
380     )
381     AC_LANG_RESTORE
382     ]
383     )
384    
385     dnl Remove support for mmap() if mprotect() does not work
386     if [[ "x$have_mmap_vm" = "xyes" ]]; then
387     case $ac_cv_mprotect_works in
388     *yes) have_mmap_vm=yes;;
389     *no) have_mmap_vm=no;;
390     esac
391     fi
392 nigel 1.5 AC_TRANSLATE_DEFINE(HAVE_MMAP_VM, $have_mmap_vm,
393     [Define if your system has a working mmap()-based memory allocator.])
394 nigel 1.1
395     fi dnl HAVE_MMAP_VM
396    
397 nigel 1.12 dnl Check if we can modify the __PAGEZERO segment for use as Low Memory
398     AC_CACHE_CHECK([whether __PAGEZERO can be Low Memory area 0x0000-0x2000],
399     ac_cv_pagezero_hack, [
400     ac_cv_pagezero_hack=no
401     if AC_TRY_COMMAND([Darwin/testlmem.sh 0x2000]); then
402     ac_cv_pagezero_hack=yes
403     dnl might as well skip the test for mmap-able low memory
404     ac_cv_can_map_lm=no
405     fi
406     ])
407     AC_TRANSLATE_DEFINE(PAGEZERO_HACK, "$ac_cv_pagezero_hack",
408     [Define if the __PAGEZERO Mach-O Low Memory Globals hack works on this system.])
409    
410 nigel 1.1 dnl Check if we can mmap 0x2000 bytes from 0x0000
411 nigel 1.5 AC_CACHE_CHECK([whether we can map Low Memory area 0x0000-0x2000],
412 nigel 1.1 ac_cv_can_map_lm, [
413     AC_LANG_SAVE
414     AC_LANG_CPLUSPLUS
415     AC_TRY_RUN([
416 nigel 1.6 #include "../Unix/vm_alloc.cpp"
417 nigel 1.1 int main(void) { /* returns 0 if we could map the lowmem globals */
418 nigel 1.11 volatile char * lm = 0;
419 nigel 1.1 if (vm_init() < 0) exit(1);
420 nigel 1.12 if (vm_acquire_fixed(0, 0x2000) < 0) exit(1);
421 nigel 1.1 lm[0] = 'z';
422     if (vm_release((char *)lm, 0x2000) < 0) exit(1);
423     vm_exit(); exit(0);
424     }
425     ], ac_cv_can_map_lm=yes, ac_cv_can_map_lm=no,
426     dnl When cross-compiling, do not assume anything.
427     ac_cv_can_map_lm="guessing no"
428     )
429     AC_LANG_RESTORE
430     ]
431     )
432    
433     dnl Check signal handlers need to be reinstalled
434 nigel 1.5 AC_CACHE_CHECK([whether signal handlers need to be reinstalled],
435 nigel 1.1 ac_cv_signal_need_reinstall, [
436     AC_LANG_SAVE
437     AC_LANG_CPLUSPLUS
438     AC_TRY_RUN([
439     #include <stdlib.h>
440     #ifdef HAVE_UNISTD_H
441     #include <unistd.h>
442     #endif
443     #include <signal.h>
444     static int handled_signal = 0;
445     RETSIGTYPE sigusr1_handler(int) { handled_signal++; }
446     int main(void) { /* returns 0 if signals need not to be reinstalled */
447     signal(SIGUSR1, sigusr1_handler); raise(SIGUSR1); raise(SIGUSR1);
448     exit(handled_signal == 2);
449     }
450     ], ac_cv_signal_need_reinstall=yes, ac_cv_signal_need_reinstall=no,
451     dnl When cross-compiling, do not assume anything.
452     ac_cv_signal_need_reinstall="guessing yes"
453     )
454     AC_LANG_RESTORE
455     ]
456     )
457 nigel 1.5 AC_TRANSLATE_DEFINE(SIGNAL_NEED_REINSTALL, "$ac_cv_signal_need_reinstall",
458     [Define if your system requires signals to be reinstalled.])
459 nigel 1.1
460     dnl Check if sigaction handlers need to be reinstalled
461 nigel 1.5 AC_CACHE_CHECK([whether sigaction handlers need to be reinstalled],
462 nigel 1.1 ac_cv_sigaction_need_reinstall, [
463     AC_LANG_SAVE
464     AC_LANG_CPLUSPLUS
465     AC_TRY_RUN([
466     #include <stdlib.h>
467     #ifdef HAVE_UNISTD_H
468     #include <unistd.h>
469     #endif
470     #include <signal.h>
471     static int handled_signal = 0;
472     RETSIGTYPE sigusr1_handler(int) { handled_signal++; }
473     typedef RETSIGTYPE (*signal_handler)(int);
474     static signal_handler mysignal(int sig, signal_handler handler) {
475     struct sigaction old_sa;
476     struct sigaction new_sa;
477     new_sa.sa_handler = handler;
478     return ((sigaction(sig,&new_sa,&old_sa) < 0) ? SIG_IGN : old_sa.sa_handler);
479     }
480     int main(void) { /* returns 0 if signals need not to be reinstalled */
481     mysignal(SIGUSR1, sigusr1_handler); raise(SIGUSR1); raise(SIGUSR1);
482     exit(handled_signal == 2);
483     }
484     ], ac_cv_sigaction_need_reinstall=yes, ac_cv_sigaction_need_reinstall=no,
485     dnl When cross-compiling, do not assume anything.
486     ac_cv_sigaction_need_reinstall="guessing yes"
487     )
488     AC_LANG_RESTORE
489     ]
490     )
491 nigel 1.5 AC_TRANSLATE_DEFINE(SIGACTION_NEED_REINSTALL, "$ac_cv_sigaction_need_reinstall",
492     [Define if your system requires sigactions to be reinstalled.])
493 nigel 1.1
494 nigel 1.12 dnl Check if Mach exceptions supported.
495     AC_CACHE_CHECK([whether your system supports Mach exceptions],
496     ac_cv_have_mach_exceptions, [
497 nigel 1.1 AC_LANG_SAVE
498     AC_LANG_CPLUSPLUS
499     AC_TRY_RUN([
500 nigel 1.12 #define HAVE_MACH_EXCEPTIONS 1
501 nigel 1.1 #define CONFIGURE_TEST_SIGSEGV_RECOVERY
502 nigel 1.13 #include "../Unix/vm_alloc.cpp"
503     #include "../Unix/sigsegv.cpp"
504 nigel 1.12 ], [
505     sigsegv_recovery=mach
506     ac_cv_have_mach_exceptions=yes
507     ],
508     ac_cv_have_mach_exceptions=no,
509 nigel 1.1 dnl When cross-compiling, do not assume anything.
510 nigel 1.12 ac_cv_have_mach_exceptions=no
511 nigel 1.1 )
512     AC_LANG_RESTORE
513     ]
514     )
515 nigel 1.12 AC_TRANSLATE_DEFINE(HAVE_MACH_EXCEPTIONS, "$ac_cv_have_mach_exceptions",
516     [Define if your system supports Mach exceptions.])
517    
518     dnl Otherwise, check if extended signals are supported.
519     if [[ -z "$sigsegv_recovery" ]]; then
520     AC_CACHE_CHECK([whether your system supports extended signal handlers],
521     ac_cv_have_extended_signals, [
522     AC_LANG_SAVE
523     AC_LANG_CPLUSPLUS
524     AC_TRY_RUN([
525     #define HAVE_SIGINFO_T 1
526     #define CONFIGURE_TEST_SIGSEGV_RECOVERY
527     #include "../Unix/vm_alloc.cpp"
528     #include "../Unix/sigsegv.cpp"
529     ], [
530     sigsegv_recovery=siginfo
531     ac_cv_have_extended_signals=yes
532     ],
533     ac_cv_have_extended_signals=no,
534     dnl When cross-compiling, do not assume anything.
535     ac_cv_have_extended_signals=no
536     )
537     AC_LANG_RESTORE
538     ]
539     )
540     AC_TRANSLATE_DEFINE(HAVE_SIGINFO_T, "$ac_cv_have_extended_signals",
541     [Define if your system support extended signals.])
542     fi
543 nigel 1.5
544 nigel 1.1 dnl Otherwise, check for subterfuges.
545 nigel 1.14 if [[ -z "$sigsegv_recovery" ]]; then
546 nigel 1.13 AC_CACHE_CHECK([whether we then have a subterfuge for your system],
547     ac_cv_have_sigcontext_hack, [
548     AC_LANG_SAVE
549     AC_LANG_CPLUSPLUS
550 nigel 1.14 AC_TRY_RUN([
551 nigel 1.13 #define HAVE_SIGCONTEXT_SUBTERFUGE 1
552     #define CONFIGURE_TEST_SIGSEGV_RECOVERY
553     #include "../Unix/vm_alloc.cpp"
554     #include "../Unix/sigsegv.cpp"
555     ], [
556     sigsegv_recovery=sigcontext
557     ac_cv_have_sigcontext_hack=yes
558     ],
559     ac_cv_have_sigcontext_hack=no,
560     dnl When cross-compiling, do not assume anything.
561     ac_cv_have_sigcontext_hack=no
562     )
563     AC_LANG_RESTORE
564     ])
565     AC_TRANSLATE_DEFINE(HAVE_SIGCONTEXT_SUBTERFUGE, "$ac_cv_have_sigcontext_hack",
566     [Define if we know a hack to replace siginfo_t->si_addr member.])
567     fi
568 nigel 1.1
569 nigel 1.5 dnl Check if we can ignore the fault (instruction skipping in SIGSEGV handler)
570     AC_CACHE_CHECK([whether we can skip instruction in SIGSEGV handler],
571     ac_cv_have_skip_instruction, [
572     AC_LANG_SAVE
573     AC_LANG_CPLUSPLUS
574     AC_TRY_RUN([
575     #define HAVE_SIGSEGV_SKIP_INSTRUCTION 1
576     #define CONFIGURE_TEST_SIGSEGV_RECOVERY
577 nigel 1.6 #include "../Unix/vm_alloc.cpp"
578     #include "../Unix/sigsegv.cpp"
579 nigel 1.5 ], ac_cv_have_skip_instruction=yes, ac_cv_have_skip_instruction=no,
580     dnl When cross-compiling, do not assume anything.
581     ac_cv_have_skip_instruction=no
582     )
583     AC_LANG_RESTORE
584     ]
585     )
586     AC_TRANSLATE_DEFINE(HAVE_SIGSEGV_SKIP_INSTRUCTION, "$ac_cv_have_skip_instruction",
587     [Define if we can ignore the fault (instruction skipping in SIGSEGV handler).])
588    
589 nigel 1.1 dnl Can we do Video on SEGV Signals ?
590     CAN_VOSF=no
591 nigel 1.12 if [[ -n "$sigsegv_recovery" ]]; then
592 nigel 1.1 CAN_VOSF=yes
593     fi
594    
595 nigel 1.12 dnl A dummy program that returns always true
596 nigel 1.14 BLESS=/usr/bin/touch
597 nigel 1.12
598 nigel 1.1 dnl Determine the addressing mode to use
599     if [[ "x$WANT_NATIVE_M68K" = "xyes" ]]; then
600     ADDRESSING_MODE="real"
601     else
602     ADDRESSING_MODE=""
603     AC_MSG_CHECKING([for the addressing mode to use])
604     for am in $ADDRESSING_TEST_ORDER; do
605     case $am in
606     real)
607     dnl Requires ability to mmap() Low Memory globals
608 nigel 1.12 if [[ "x$ac_cv_can_map_lm$ac_cv_pagezero_hack" = "xnono" ]]; then
609 nigel 1.1 continue
610     fi
611 nigel 1.12 dnl Requires VOSF screen updates
612 nigel 1.1 if [[ "x$CAN_VOSF" = "xno" ]]; then
613     continue
614     fi
615     dnl Real addressing will probably work.
616     ADDRESSING_MODE="real"
617     WANT_VOSF=yes dnl we can use VOSF and we need it actually
618     DEFINES="$DEFINES -DREAL_ADDRESSING"
619 nigel 1.13 AC_DEFINE(REAL_ADDRESSING, 1, [Emulated memory is memory mapped to actual address.])
620 nigel 1.12 if [[ "x$ac_cv_pagezero_hack" = "xyes" ]]; then
621     BLESS=Darwin/lowmem
622     LDFLAGS="$LDFLAGS -pagezero_size 0x2000"
623     fi
624 nigel 1.1 break
625     ;;
626     direct)
627     dnl Requires VOSF screen updates
628     if [[ "x$CAN_VOSF" = "xyes" ]]; then
629     ADDRESSING_MODE="direct"
630     WANT_VOSF=yes dnl we can use VOSF and we need it actually
631     DEFINES="$DEFINES -DDIRECT_ADDRESSING"
632 nigel 1.13 AC_DEFINE(DIRECT_ADDRESSING, 1, [Emulated memory is an offset from actual address.])
633 nigel 1.1 break
634     fi
635     ;;
636     banks)
637     dnl Default addressing mode
638     ADDRESSING_MODE="memory banks"
639     break
640     ;;
641     *)
642     AC_MSG_ERROR([Internal configure.in script error for $am addressing mode])
643     esac
644     done
645     AC_MSG_RESULT($ADDRESSING_MODE)
646     if [[ "x$ADDRESSING_MODE" = "x" ]]; then
647     AC_MSG_WARN([Sorry, no suitable addressing mode in $ADDRESSING_TEST_ORDER])
648     ADDRESSING_MODE="memory banks"
649     fi
650     fi
651    
652 nigel 1.5 dnl Banked Memory Addressing mode is not supported by the JIT compiler
653     if [[ "x$WANT_JIT" = "xyes" -a "x$ADDRESSING_MODE" = "xmemory banks" ]]; then
654     AC_MSG_ERROR([Sorry, the JIT Compiler requires Direct Addressing, at least])
655     fi
656    
657 nigel 1.1 dnl Enable VOSF screen updates with this feature is requested and feasible
658     if [[ "x$WANT_VOSF" = "xyes" -a "x$CAN_VOSF" = "xyes" ]]; then
659 nigel 1.5 AC_DEFINE(ENABLE_VOSF, 1, [Define if using video enabled on SEGV signals.])
660 nigel 1.1 else
661     WANT_VOSF=no
662     fi
663    
664     dnl Check for GAS.
665     HAVE_GAS=no
666     AC_MSG_CHECKING(for GAS .p2align feature)
667     cat >conftest.S << EOF
668     .text
669     .p2align 5
670     EOF
671     if $CC conftest.S -c -o conftest.o >/dev/null 2>&1 ; then HAVE_GAS=yes; fi
672     AC_MSG_RESULT($HAVE_GAS)
673    
674     dnl Check for GCC 2.7 or higher.
675     HAVE_GCC27=no
676     AC_MSG_CHECKING(for GCC 2.7 or higher)
677 nigel 1.11 AC_EGREP_CPP(xyes,
678 nigel 1.1 [#if __GNUC__ - 1 > 1 || __GNUC_MINOR__ - 1 > 5
679 nigel 1.11 xyes
680 nigel 1.1 #endif
681     ], [AC_MSG_RESULT(yes); HAVE_GCC27=yes], AC_MSG_RESULT(no))
682    
683     dnl Check for GCC 3.0 or higher.
684     HAVE_GCC30=no
685     AC_MSG_CHECKING(for GCC 3.0 or higher)
686 nigel 1.11 AC_EGREP_CPP(xyes,
687 nigel 1.1 [#if __GNUC__ >= 3
688 nigel 1.11 xyes
689 nigel 1.1 #endif
690     ], [AC_MSG_RESULT(yes); HAVE_GCC30=yes], AC_MSG_RESULT(no))
691    
692     dnl Set "-fomit-frame-pointer" on i386 GCC 2.7 or higher.
693 nigel 1.3 dnl Also set "-fno-exceptions" for C++ because exception handling requires
694     dnl the frame pointer.
695 nigel 1.1 if [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_I386" = "xyes" ]]; then
696     CFLAGS="$CFLAGS -fomit-frame-pointer"
697 nigel 1.3 CXXFLAGS="$CXXFLAGS -fomit-frame-pointer -fno-exceptions"
698 nigel 1.1 fi
699    
700     dnl (gb) Do not merge constants since it breaks fpu/fpu_x86.cpp.
701     dnl As of 2001/08/02, this affects the following compilers:
702     dnl Official: probably gcc-3.1 (mainline CVS)
703     dnl Mandrake: gcc-2.96 >= 0.59mdk, gcc-3.0.1 >= 0.1mdk
704     dnl Red Hat : gcc-2.96 >= 89, gcc-3.0 >= 1
705     if [[ "x$HAVE_GCC27" = "xyes" ]]; then
706     SAVED_CXXFLAGS="$CXXFLAGS"
707     CXXFLAGS="$CXXFLAGS -fno-merge-constants"
708     AC_CACHE_CHECK([whether GCC supports constants merging], ac_cv_gcc_constants_merging, [
709     AC_LANG_SAVE
710     AC_LANG_CPLUSPLUS
711     AC_TRY_COMPILE([],[],[ac_cv_gcc_constants_merging=yes],[ac_cv_gcc_constants_merging=no])
712     AC_LANG_RESTORE
713     ])
714     if [[ "x$ac_cv_gcc_constants_merging" != "xyes" ]]; then
715     CXXFLAGS="$SAVED_CXXFLAGS"
716     fi
717     fi
718    
719     dnl Select appropriate CPU source and REGPARAM define.
720     ASM_OPTIMIZATIONS=none
721     CPUSRCS="cpuemu1.cpp cpuemu2.cpp cpuemu3.cpp cpuemu4.cpp cpuemu5.cpp cpuemu6.cpp cpuemu7.cpp cpuemu8.cpp"
722 nigel 1.5
723     dnl (gb) JITSRCS will be emptied later if the JIT is not available
724     dnl Other platforms should define their own set of noflags file variants
725     CAN_JIT=no
726     JITSRCS="compemu1.cpp compemu2.cpp compemu3.cpp compemu4.cpp compemu5.cpp compemu6.cpp compemu7.cpp compemu8.cpp"
727    
728 nigel 1.10 if [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_I386" = "xyes" ]]; then
729 nigel 1.1 dnl i386 CPU
730 nigel 1.5 DEFINES="$DEFINES -DUNALIGNED_PROFITABLE -DREGPARAM=\"__attribute__((regparm(3)))\""
731 nigel 1.1 if [[ "x$HAVE_GAS" = "xyes" ]]; then
732     ASM_OPTIMIZATIONS=i386
733 nigel 1.5 DEFINES="$DEFINES -DX86_ASSEMBLY -DOPTIMIZED_FLAGS -DSAHF_SETO_PROFITABLE"
734 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"
735     CAN_JIT=yes
736     fi
737     elif [[ "x$HAVE_GCC30" = "xyes" -a "x$HAVE_X86_64" = "xyes" ]]; then
738     dnl x86-64 CPU
739     DEFINES="$DEFINES -DUNALIGNED_PROFITABLE"
740     if [[ "x$HAVE_GAS" = "xyes" ]]; then
741     ASM_OPTIMIZATIONS="x86-64"
742     DEFINES="$DEFINES -DX86_64_ASSEMBLY -DOPTIMIZED_FLAGS"
743 nigel 1.1 fi
744     elif [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_SPARC" = "xyes" -a "x$HAVE_GAS" = "xyes" ]]; then
745     dnl SPARC CPU
746     case "$target_os" in
747     solaris*)
748     AC_MSG_CHECKING(SPARC CPU architecture)
749     SPARC_TYPE=`Solaris/which_sparc`
750     AC_MSG_RESULT($SPARC_TYPE)
751     case "$SPARC_TYPE" in
752     SPARC_V8)
753     ASM_OPTIMIZATIONS="SPARC V8 architecture"
754     DEFINES="$DEFINES -DSPARC_V8_ASSEMBLY" dnl -DOPTIMIZED_FLAGS"
755     CFLAGS="$CFLAGS -Wa,-Av8"
756     CXXFLAGS="$CXXFLAGS -Wa,-Av8"
757     ;;
758     SPARC_V9)
759     ASM_OPTIMIZATIONS="SPARC V9 architecture"
760     DEFINES="$DEFINES -DSPARC_V9_ASSEMBLY" dnl -DOPTIMIZED_FLAGS"
761     CFLAGS="$CFLAGS -Wa,-Av9"
762     CXXFLAGS="$CXXFLAGS -Wa,-Av9"
763     ;;
764     esac
765     ;;
766     esac
767     elif [[ "x$WANT_NATIVE_M68K" = "xyes" ]]; then
768     dnl Native m68k, no emulation
769     CPUINCLUDES="-I../native_cpu"
770     CPUSRCS="asm_support.s"
771     fi
772    
773 nigel 1.5 dnl Enable JIT compiler, if possible.
774     if [[ "x$WANT_JIT" = "xyes" -a "x$CAN_JIT" ]]; then
775     JITSRCS="$JITSRCS ../uae_cpu/compiler/compemu_support.cpp ../uae_cpu/compiler/compemu_fpp.cpp compstbl.o cpustbl_nf.o"
776     DEFINES="$DEFINES -DUSE_JIT -DUSE_JIT_FPU"
777    
778     if [[ "x$WANT_JIT_DEBUG" = "xyes" ]]; then
779     if [[ "x$WANT_MON" = "xyes" ]]; then
780     DEFINES="$DEFINES -DJIT_DEBUG=1"
781     else
782     AC_MSG_WARN([cxmon not found, ignoring --enable-jit-debug])
783     WANT_JIT_DEBUG=no
784     fi
785     fi
786    
787     dnl IEEE core is the only FPU emulator to use with the JIT compiler
788     case $FPE_CORE_TEST_ORDER in
789     ieee*) ;;
790     *) AC_MSG_WARN([Forcing use of the IEEE FPU core, as the JIT compiler supports only this one.]) ;;
791     esac
792     FPE_CORE_TEST_ORDER="ieee"
793     else
794     WANT_JIT=no
795     WANT_JIT_DEBUG=no
796     JITSRCS=""
797     fi
798    
799     dnl Utility macro used by next two tests.
800     dnl AC_EXAMINE_OBJECT(C source code,
801     dnl commands examining object file,
802     dnl [commands to run if compile failed]):
803     dnl
804     dnl Compile the source code to an object file; then convert it into a
805     dnl printable representation. All unprintable characters and
806     dnl asterisks (*) are replaced by dots (.). All white space is
807     dnl deleted. Newlines (ASCII 0x10) in the input are preserved in the
808     dnl output, but runs of newlines are compressed to a single newline.
809     dnl Finally, line breaks are forcibly inserted so that no line is
810     dnl longer than 80 columns and the file ends with a newline. The
811     dnl result of all this processing is in the file conftest.dmp, which
812     dnl may be examined by the commands in the second argument.
813     dnl
814     AC_DEFUN([gcc_AC_EXAMINE_OBJECT],
815     [AC_LANG_SAVE
816     AC_LANG_C
817     dnl Next bit cribbed from AC_TRY_COMPILE.
818     cat > conftest.$ac_ext <<EOF
819     [#line __oline__ "configure"
820     #include "confdefs.h"
821     $1
822     ]EOF
823     if AC_TRY_EVAL(ac_compile); then
824     od -c conftest.o |
825     sed ['s/^[0-7]*[ ]*/ /
826     s/\*/./g
827     s/ \\n/*/g
828     s/ [0-9][0-9][0-9]/./g
829     s/ \\[^ ]/./g'] |
830     tr -d '
831     ' | tr -s '*' '
832     ' | fold | sed '$a\
833     ' > conftest.dmp
834     $2
835     ifelse($3, , , else
836     $3
837     )dnl
838     fi
839     rm -rf conftest*
840     AC_LANG_RESTORE])
841    
842     dnl Floating point format probe.
843     dnl The basic concept is the same as the above: grep the object
844     dnl file for an interesting string. We have to watch out for
845     dnl rounding changing the values in the object, however; this is
846     dnl handled by ignoring the least significant byte of the float.
847     dnl
848     dnl Does not know about VAX G-float or C4x idiosyncratic format.
849     dnl It does know about PDP-10 idiosyncratic format, but this is
850     dnl not presently supported by GCC. S/390 "binary floating point"
851     dnl is in fact IEEE (but maybe we should have that in EBCDIC as well
852     dnl as ASCII?)
853     dnl
854     AC_DEFUN([gcc_AC_C_FLOAT_FORMAT],
855     [AC_CACHE_CHECK(floating point format, ac_cv_c_float_format,
856     [gcc_AC_EXAMINE_OBJECT(
857     [/* This will not work unless sizeof(double) == 8. */
858     extern char sizeof_double_must_be_8 [sizeof(double) == 8 ? 1 : -1];
859    
860     /* This structure must have no internal padding. */
861     struct possibility {
862     char prefix[8];
863     double candidate;
864     char postfix[8];
865     };
866    
867     #define C(cand) { "\nformat:", cand, ":tamrof\n" }
868     struct possibility table [] =
869     {
870     C( 3.25724264705901305206e+01), /* @@IEEEFP - IEEE 754 */
871     C( 3.53802595280598432000e+18), /* D__float - VAX */
872     C( 5.32201830133125317057e-19), /* D.PDP-10 - PDP-10 - the dot is 0x13a */
873     C( 1.77977764695171661377e+10), /* IBMHEXFP - s/390 format, ascii */
874     C(-5.22995989424860458374e+10) /* IBMHEXFP - s/390 format, EBCDIC */
875     };],
876     [if grep 'format:.@IEEEF.:tamrof' conftest.dmp >/dev/null 2>&1; then
877     ac_cv_c_float_format='IEEE (big-endian)'
878     elif grep 'format:.I@@PFE.:tamrof' conftest.dmp >/dev/null 2>&1; then
879     ac_cv_c_float_format='IEEE (big-endian)'
880     elif grep 'format:.FEEEI@.:tamrof' conftest.dmp >/dev/null 2>&1; then
881     ac_cv_c_float_format='IEEE (little-endian)'
882     elif grep 'format:.EFP@@I.:tamrof' conftest.dmp >/dev/null 2>&1; then
883     ac_cv_c_float_format='IEEE (little-endian)'
884     elif grep 'format:.__floa.:tamrof' conftest.dmp >/dev/null 2>&1; then
885     ac_cv_c_float_format='VAX D-float'
886     elif grep 'format:..PDP-1.:tamrof' conftest.dmp >/dev/null 2>&1; then
887     ac_cv_c_float_format='PDP-10'
888     elif grep 'format:.BMHEXF.:tamrof' conftest.dmp >/dev/null 2>&1; then
889     ac_cv_c_float_format='IBM 370 hex'
890 nigel 1.1 else
891 nigel 1.5 AC_MSG_ERROR(Unknown floating point format)
892     fi],
893     [AC_MSG_ERROR(compile failed)])
894     ])
895     # IEEE is the default format. If the float endianness isn't the same
896     # as the integer endianness, we have to set FLOAT_WORDS_BIG_ENDIAN
897     # (which is a tristate: yes, no, default). This is only an issue with
898     # IEEE; the other formats are only supported by a few machines each,
899     # all with the same endianness.
900     format=IEEE_FLOAT_FORMAT
901     fbigend=
902     case $ac_cv_c_float_format in
903     'IEEE (big-endian)' )
904     if test $ac_cv_c_bigendian = no; then
905     fbigend=1
906     fi
907     ;;
908     'IEEE (little-endian)' )
909     if test $ac_cv_c_bigendian = yes; then
910     fbigend=0
911     fi
912     ;;
913     'VAX D-float' )
914     format=VAX_FLOAT_FORMAT
915     ;;
916     'PDP-10' )
917     format=PDP10_FLOAT_FORMAT
918     ;;
919     'IBM 370 hex' )
920     format=IBM_FLOAT_FORMAT
921     ;;
922     esac
923     AC_DEFINE_UNQUOTED(HOST_FLOAT_FORMAT, $format,
924     [Define to the floating point format of the host machine.])
925     if test -n "$fbigend"; then
926     AC_DEFINE_UNQUOTED(HOST_FLOAT_WORDS_BIG_ENDIAN, $fbigend,
927     [Define to 1 if the host machine stores floating point numbers in
928     memory with the word containing the sign bit at the lowest address,
929     or to 0 if it does it the other way around.
930    
931     This macro should not be defined if the ordering is the same as for
932     multi-word integers.])
933 nigel 1.1 fi
934 nigel 1.5 ])
935 nigel 1.1
936 nigel 1.5 dnl Select appropriate FPU source.
937     gcc_AC_C_FLOAT_FORMAT
938     AC_CHECK_HEADERS(ieee754.h ieeefp.h floatingpoint.h nan.h)
939    
940     for fpe in $FPE_CORE_TEST_ORDER; do
941     case $fpe in
942     ieee)
943     case $ac_cv_c_float_format in
944     IEEE*)
945     FPE_CORE="IEEE fpu core"
946     DEFINES="$DEFINES -DFPU_IEEE"
947 nigel 1.13 AC_DEFINE(FPU_IEEE, 1, [Floating Point Core emulation method is IEEE.])
948 nigel 1.5 FPUSRCS="../uae_cpu/fpu/fpu_ieee.cpp"
949     dnl Math functions not mandated by C99 standard
950     AC_CHECK_FUNCS(isnanl isinfl)
951     dnl Math functions required by C99 standard, but probably not
952     dnl implemented everywhere. In that case, we fall back to the
953     dnl regular variant for doubles.
954     AC_CHECK_FUNCS(logl log10l expl powl fabsl sqrtl)
955     AC_CHECK_FUNCS(sinl cosl tanl sinhl coshl tanhl)
956     AC_CHECK_FUNCS(asinl acosl atanl asinhl acoshl atanhl)
957     AC_CHECK_FUNCS(floorl ceill)
958     break
959     ;;
960     esac
961     ;;
962     x86)
963     if [[ ":$HAVE_GCC27:$HAVE_I386:$HAVE_GAS:" = ":yes:yes:yes:" ]]; then
964     FPE_CORE="i387 fpu core"
965     DEFINES="$DEFINES -DFPU_X86"
966     FPUSRCS="../uae_cpu/fpu/fpu_x86.cpp"
967     break
968     fi
969     ;;
970     uae)
971     FPE_CORE="uae fpu core"
972     DEFINES="$DEFINES -DFPU_UAE"
973 nigel 1.13 AC_DEFINE(FPU_UAE, 1, [Floating Point Core emulation is standard UAE.])
974 nigel 1.5 FPUSRCS="../uae_cpu/fpu/fpu_uae.cpp"
975     break
976     ;;
977     *)
978     AC_MSG_ERROR([Internal configure.in script error for $fpe fpu core])
979     ;;
980     esac
981     done
982     if [[ "x$FPE_CORE" = "x" ]]; then
983     AC_MSG_ERROR([Sorry, no suitable FPU core found in $FPE_CORE_TEST_ORDER])
984 nigel 1.1 fi
985    
986     dnl Check for certain math functions
987     AC_CHECK_FUNCS(atanh)
988 nigel 1.5 AC_CHECK_FUNCS(isnan isinf finite isnormal signbit)
989 nigel 1.1
990     dnl UAE CPU sources for all non-m68k-native architectures.
991     if [[ "x$WANT_NATIVE_M68K" = "xno" ]]; then
992     CPUINCLUDES="-I../uae_cpu"
993 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"
994 nigel 1.1 fi
995    
996     dnl Remove the "-g" option if set for GCC.
997     if [[ "x$HAVE_GCC27" = "xyes" ]]; then
998     CFLAGS=`echo $CFLAGS | sed -e 's/-g//g'`
999     CXXFLAGS=`echo $CXXFLAGS | sed -e 's/-g//g'`
1000     fi
1001    
1002 nigel 1.10 dnl Or if we have -IPA (MIPSPro compilers)
1003     if [[ "x$HAVE_IPA" = "xyes" ]]; then
1004     CFLAGS="`echo $CFLAGS | sed -e 's/-g//g'` -O3 -OPT:Olimit=0 -IPA"
1005     CXXFLAGS="`echo $CXXFLAGS | sed -e 's/-g//g'` -O3 -OPT:Olimit=0 -IPA"
1006 nigel 1.1 CXXFLAGS="-LANG:std $CXXFLAGS"
1007 nigel 1.10 LDFLAGS="$LDFLAGS -O3 -OPT:Olimit=0 -IPA"
1008 nigel 1.1 fi
1009    
1010 nigel 1.14 dnl
1011     dnl Some Mac OS X specific stuff:
1012     dnl
1013    
1014     dnl MacOS 10.2 (and later?) have a particular header for defining the OS version
1015     AC_CHECK_HEADER(AvailabilityMacros.h)
1016     if [[ "x$ac_cv_header_AvailabilityMacros_h" = "xyes" ]]; then
1017     AC_DEFINE(AVAILABILITYMACROS, 1, [Header specific to 10.2 and later.])
1018     fi
1019    
1020     dnl Which IDE do we use?
1021     if test -d "Developer/Applications/Xcode.app"; then
1022     IDE=xcodebuild
1023     PROJECT=BasiliskII.xcode
1024     IDEARGS="-project BasiliskII.xcode"
1025     else
1026     IDE=pbxbuild
1027     PROJECT=BasiliskII.pbproj
1028     IDEARGS=""
1029     fi
1030    
1031 nigel 1.1 dnl Generate Makefile.
1032     AC_SUBST(DEFINES)
1033     AC_SUBST(SYSSRCS)
1034     AC_SUBST(CPUINCLUDES)
1035     AC_SUBST(CPUSRCS)
1036 nigel 1.12 AC_SUBST(BLESS)
1037 nigel 1.14 AC_SUBST(IDE)
1038     AC_SUBST(PROJECT)
1039     AC_SUBST(IDEARGS)
1040 nigel 1.11 dnl autoconf on 10.1 doesn't understand these
1041     dnl AC_CONFIG_FILES([Makefile])
1042     dnl AC_OUTPUT
1043 nigel 1.1 AC_OUTPUT(Makefile)
1044    
1045     dnl Print summary.
1046     echo
1047     echo Basilisk II configuration summary:
1048     echo
1049 nigel 1.8 echo Multiple emulator windows .............. : $ENABLE_MULTIPLE
1050 nigel 1.5 echo Enable video on SEGV signals ........... : $WANT_VOSF
1051     echo mon debugger support ................... : $WANT_MON
1052     echo Use JIT compiler ....................... : $WANT_JIT
1053     echo JIT debug mode ......................... : $WANT_JIT_DEBUG
1054     echo Floating-Point emulation core .......... : $FPE_CORE
1055     echo Assembly optimizations ................. : $ASM_OPTIMIZATIONS
1056     echo Addressing mode ........................ : $ADDRESSING_MODE
1057 nigel 1.12 echo Bad memory access recovery type ........ : $sigsegv_recovery
1058 nigel 1.1 echo
1059 nigel 1.2 echo "Configuration done. Now type \"make\" (or \"make ide\")."