ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/BasiliskII/src/MacOSX/configure.in
Revision: 1.16
Committed: 2005-06-12T23:36:33Z (19 years, 5 months ago) by gbeauche
Branch: MAIN
Changes since 1.15: +2 -1 lines
Log Message:
Check for CoreFoundation framework (Darwin 8.0.1). Likewise for
IOKit/storage/IOBlockStorageDevice.h which is not available there on x86

File Contents

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