ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/BasiliskII/src/MacOSX/configure.in
Revision: 1.3
Committed: 2002-03-16T09:16:18Z (22 years, 8 months ago) by nigel
Branch: MAIN
CVS Tags: nigel-build-10
Changes since 1.2: +5 -1 lines
Log Message:
Added latest changes in Unix version

File Contents

# User Rev Content
1 nigel 1.1 dnl Process this file with autoconf to produce a configure script.
2     dnl Based on Unix/configure.in
3     dnl Written in 1999 by Christian Bauer et al.
4    
5     AC_INIT(main_macosx.mm)
6     AC_PREREQ(2.12)
7     AC_CONFIG_HEADER(config.h)
8    
9     dnl These defines are necessary to get 64-bit file size support.
10     AC_DEFINE(_USE_LARGEFILE_SOURCE, 1, [Get more functions for correct standard I/O])
11     AC_DEFINE(_FILE_OFFSET_BITS, 64, [Get 64-bit file size support])
12    
13     dnl Options.
14     AC_ARG_ENABLE(full,
15     [ --enable-full use full screen mode [default=no]], [WANT_FULL=$enableval], [WANT_FULL=no])
16     AC_ARG_ENABLE(multiwin,
17     [ --enable-multiwin allow multiple emulator windows [default=no]], [WANT_MWIN=$enableval], [WANT_MWIN=no])
18    
19     dnl FPU emulation core.
20     AC_ARG_ENABLE(fpe,
21     [ --enable-fpe=which specify which fpu emulator to use [default=opt]],
22     [ case "$enableval" in
23     default) FPE_CORE="default";; dnl fpu_x86.cpp if i386 architecture, fpu_uae.cpp otherwise
24     uae) FPE_CORE="uae";;
25     *) AC_MSG_ERROR([--enable-fpe takes only one of the following values: default, uae]);;
26     esac
27     ],
28     [ FPE_CORE="default"
29     ])
30    
31     dnl Addressing modes.
32     AC_ARG_ENABLE(addressing,
33     [ --enable-addressing=AM specify the addressing mode to use [default=fastest]],
34     [ case "$enableval" in
35     real) ADDRESSING_TEST_ORDER="real";;
36     direct) ADDRESSING_TEST_ORDER="direct";;
37     banks) ADDRESSING_TEST_ORDER="banks";;
38     fastest)ADDRESSING_TEST_ORDER="direct banks";;
39     *) AC_MSG_ERROR([--enable-addressing takes only one of the following values: fastest, real, direct, banks]);;
40     esac
41     ],
42     [ ADDRESSING_TEST_ORDER="direct banks"
43     ])
44    
45     dnl External packages.
46     AC_ARG_WITH(mon, [ --with-mon use mon as debugger [default=yes]], [WANT_MON=$withval], [WANT_MON=yes])
47    
48     dnl Canonical system information.
49     AC_CANONICAL_HOST
50     AC_CANONICAL_TARGET
51    
52     dnl Target OS type
53     OS_TYPE=darwin
54     DEFINES="$DEFINES -DOS_$OS_TYPE"
55    
56     dnl Target CPU type.
57     HAVE_I386=no
58     HAVE_M68K=no
59     HAVE_SPARC=no
60     HAVE_POWERPC=no
61     case "$target_cpu" in
62     i386* | i486* | i586* | i686* | i786* ) CPU_TYPE=i386 HAVE_I386=yes;;
63     m68k* ) CPU_TYPE=m68k HAVE_M68K=yes;;
64     sparc* ) CPU_TYPE=sparc HAVE_SPARC=yes;;
65     powerpc* ) CPU_TYPE=powerpc HAVE_POWERPC=yes;;
66     *) CPU_TYPE=`echo $target_cpu | sed -e 's/-/_/g'`;;
67     esac
68     DEFINES="$DEFINES -DCPU_$CPU_TYPE"
69    
70     dnl Checks for programs.
71     AC_PROG_CC
72     AC_PROG_CC_C_O
73     AC_PROG_CPP
74     AC_PROG_CXX
75     AC_PROG_MAKE_SET
76     AC_PROG_INSTALL
77    
78     dnl We use mon if possible.
79     MONSRCS=
80     if [[ "x$WANT_MON" = "xyes" ]]; then
81     AC_MSG_CHECKING(for mon)
82     mon_srcdir=../../../mon/src
83     if grep mon_init $mon_srcdir/mon.h >/dev/null 2>/dev/null; then
84     AC_MSG_RESULT(yes)
85     AC_DEFINE(ENABLE_MON)
86     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/disass/floatformat.c $mon_srcdir/disass/i386-dis.c $mon_srcdir/disass/m68k-dis.c $mon_srcdir/disass/m68k-opc.c"
87     CXXFLAGS="$CXXFLAGS -I$mon_srcdir -I$mon_srcdir/disass"
88     AC_CHECK_LIB(readline, readline)
89     AC_CHECK_LIB(termcap, tputs)
90     AC_CHECK_HEADERS(readline.h history.h readline/readline.h readline/history.h)
91     else
92     AC_MSG_RESULT(no)
93     AC_MSG_WARN([Could not find mon, ignoring --with-mon.])
94     WANT_MON=no
95     fi
96     fi
97    
98     dnl We want pthreads.
99     HAVE_PTHREADS=yes
100     AC_CHECK_FUNCS(pthread_cancel)
101 nigel 1.3 AC_CHECK_FUNCS(pthread_mutexattr_setprotocol)
102     AC_CHECK_FUNCS(pthread_mutexattr_settype)
103 nigel 1.1
104     dnl If POSIX.4 semaphores are not available, we emulate them with pthread mutexes.
105     SEMSRC=
106     AC_CHECK_FUNCS(sem_init, , [
107     if test "x$HAVE_PTHREADS" = "xyes"; then
108     SEMSRC=posix_sem.cpp
109     fi
110     ])
111    
112     dnl We allow full screen mode if possible.
113     if [[ "x$WANT_FULL" = "xyes" ]]; then
114     WANT_FULL=yes
115     DEFINES="$DEFINES -DENABLE_FULL=1"
116     LIBS="$LIBS $FRMWKS/QuickTime.framework/QuickTime"
117     else
118     DEFINES="$DEFINES -DENABLE_FULL=0"
119     fi
120    
121    
122     dnl Ditto for multiple window support
123     if [[ "x$WANT_MWIN" = "xyes" ]]; then
124     WANT_MWIN=yes
125     DEFINES="$DEFINES -DENABLE_MULTIPLE"
126     fi
127    
128     dnl Checks for header files.
129     AC_HEADER_STDC
130     AC_CHECK_HEADERS(unistd.h fcntl.h sys/time.h sys/mman.h)
131    
132     dnl Checks for typedefs, structures, and compiler characteristics.
133     AC_C_BIGENDIAN
134     AC_C_CONST
135     AC_C_INLINE
136     AC_CHECK_SIZEOF(short, 2)
137     AC_CHECK_SIZEOF(int, 4)
138     AC_CHECK_SIZEOF(long, 4)
139     AC_CHECK_SIZEOF(long long, 8)
140     AC_CHECK_SIZEOF(void *, 4)
141     AC_TYPE_OFF_T
142     AC_CHECK_TYPE(loff_t, off_t)
143     dnl TYPE_SOCKLEN_T
144     AC_CHECK_TYPE(socklen_t)
145     AC_TYPE_SIZE_T
146     AC_TYPE_SIGNAL
147     AC_HEADER_TIME
148     AC_STRUCT_TM
149    
150     dnl Checks for library functions.
151     AC_CHECK_FUNCS(strdup cfmakeraw)
152     AC_CHECK_FUNCS(clock_gettime timer_create)
153     AC_CHECK_FUNCS(sigaction signal)
154     AC_CHECK_FUNCS(mmap mprotect munmap)
155     AC_CHECK_FUNCS(vm_allocate vm_deallocate vm_protect)
156    
157     dnl Darwin seems to define mach_task_self() instead of task_self().
158     AC_CHECK_FUNCS(mach_task_self task_self)
159    
160     dnl Select system-dependant source files.
161     DEFINES="$DEFINES -DBSD_COMP"
162     dnl Check for the CAM library
163     AC_CHECK_LIB(cam, cam_open_btl, HAVE_LIBCAM=yes, HAVE_LIBCAM=no)
164     if [[ "x$HAVE_LIBCAM" = "xno" ]]; then
165     AC_MSG_WARN([Cannot find libcam for SCSI management, disabling SCSI support.])
166     else
167     dnl Check for the sys kernel includes
168     AC_CHECK_HEADER(camlib.h)
169     if [[ "x$ac_cv_header_camlib_h" = "xno" ]]; then
170     dnl In this case I should fix this thing including a "patch"
171     dnl to access directly to the functions in the kernel :) --Orlando
172     AC_MSG_WARN([Cannot find includes for CAM library, disabling SCSI support.])
173     else
174     SCSISRC=FreeBSD/scsi_freebsd.cpp
175     LIBS="$LIBS -lcam"
176     DEFINES="$DEFINES -DCAM"
177     fi
178     fi
179    
180     dnl Use 68k CPU natively?
181     WANT_NATIVE_M68K=no
182    
183     SYSSRCS=$SCSISRC
184    
185     dnl Define a macro that translates a yesno-variable into a C macro definition
186     dnl to be put into the config.h file
187     dnl $1 -- the macro to define
188     dnl $2 -- the value to translate
189     AC_DEFUN(AC_TRANSLATE_DEFINE, [
190     if [[ "x$2" = "xyes" -o "x$2" = "xguessing yes" ]]; then
191     AC_DEFINE($1)
192     fi
193     ])
194    
195     dnl Various checks if the system supports vm_allocate() and the like functions.
196     have_mach_vm=no
197     if [[ "x$ac_cv_func_vm_allocate" = "xyes" -a "x$ac_cv_func_vm_deallocate" = "xyes" -a \
198     "x$ac_cv_func_vm_protect" = "xyes" ]]; then
199     have_mach_vm=yes
200     fi
201     AC_TRANSLATE_DEFINE(HAVE_MACH_VM, "$have_mach_vm")
202    
203     dnl Check that vm_allocate(), vm_protect() work
204     if [[ "x$have_mach_vm" = "xyes" ]]; then
205    
206     AC_CACHE_CHECK("whether vm_protect works",
207     ac_cv_vm_protect_works, [
208     AC_LANG_SAVE
209     AC_LANG_CPLUSPLUS
210     ac_cv_vm_protect_works=yes
211     dnl First the tests that should segfault
212     for test_def in NONE_READ NONE_WRITE READ_WRITE; do
213     AC_TRY_RUN([
214     #define CONFIGURE_TEST_VM_MAP
215     #define TEST_VM_PROT_$test_def
216     #include "vm_alloc.cpp"
217     ], ac_cv_vm_protect_works=no, rm -f core,
218     dnl When cross-compiling, do not assume anything
219     ac_cv_vm_protect_works="guessing no"
220     )
221     done
222     AC_TRY_RUN([
223     #define CONFIGURE_TEST_VM_MAP
224     #define TEST_VM_PROT_RDWR_WRITE
225     #include "vm_alloc.cpp"
226     ], , ac_cv_vm_protect_works=no,
227     dnl When cross-compiling, do not assume anything
228     ac_cv_vm_protect_works="guessing no"
229     )
230     AC_LANG_RESTORE
231     ]
232     )
233    
234     dnl Remove support for vm_allocate() if vm_protect() does not work
235     if [[ "x$have_mach_vm" = "xyes" ]]; then
236     case $ac_cv_vm_protect_works in
237     *yes) have_mach_vm=yes;;
238     *no) have_mach_vm=no;;
239     esac
240     fi
241     AC_TRANSLATE_DEFINE(HAVE_MACH_VM, "$have_mach_vm")
242    
243     fi dnl HAVE_MACH_VM
244    
245     dnl Various checks if the system supports mmap() and the like functions.
246     dnl ... and Mach memory allocators are not supported
247     have_mmap_vm=no
248     if [[ "x$ac_cv_func_mmap" = "xyes" -a "x$ac_cv_func_munmap" = "xyes" -a \
249     "x$ac_cv_func_mprotect" = "xyes" ]]; then
250     if [[ "x$have_mach_vm" = "xno" ]]; then
251     have_mmap_vm=yes
252     fi
253     fi
254     AC_TRANSLATE_DEFINE(HAVE_MMAP_VM, "$have_mmap_vm")
255    
256     dnl Check that mmap() and associated functions work.
257     if [[ "x$have_mmap_vm" = "xyes" ]]; then
258    
259     dnl Check if we have a working anonymous mmap()
260     AC_CACHE_CHECK("whether mmap supports MAP_ANON",
261     ac_cv_mmap_anon, [
262     AC_LANG_SAVE
263     AC_LANG_CPLUSPLUS
264     AC_TRY_RUN([
265     #define HAVE_MMAP_ANON
266     #define CONFIGURE_TEST_VM_MAP
267     #define TEST_VM_MMAP_ANON
268     #include "vm_alloc.cpp"
269     ], ac_cv_mmap_anon=yes, ac_cv_mmap_anon=no,
270     dnl When cross-compiling, do not assume anything.
271     ac_cv_mmap_anon="guessing no"
272     )
273     AC_LANG_RESTORE
274     ]
275     )
276     AC_TRANSLATE_DEFINE(HAVE_MMAP_ANON, "$ac_cv_mmap_anon")
277    
278     AC_CACHE_CHECK("whether mmap supports MAP_ANONYMOUS",
279     ac_cv_mmap_anonymous, [
280     AC_LANG_SAVE
281     AC_LANG_CPLUSPLUS
282     AC_TRY_RUN([
283     #define HAVE_MMAP_ANONYMOUS
284     #define CONFIGURE_TEST_VM_MAP
285     #define TEST_VM_MMAP_ANON
286     #include "vm_alloc.cpp"
287     ], ac_cv_mmap_anonymous=yes, ac_cv_mmap_anonymous=no,
288     dnl When cross-compiling, do not assume anything.
289     ac_cv_mmap_anonymous="guessing no"
290     )
291     AC_LANG_RESTORE
292     ]
293     )
294     AC_TRANSLATE_DEFINE(HAVE_MMAP_ANONYMOUS, "$ac_cv_mmap_anonymous")
295    
296     AC_CACHE_CHECK("whether mprotect works",
297     ac_cv_mprotect_works, [
298     AC_LANG_SAVE
299     AC_LANG_CPLUSPLUS
300     ac_cv_mprotect_works=yes
301     dnl First the tests that should segfault
302     for test_def in NONE_READ NONE_WRITE READ_WRITE; do
303     AC_TRY_RUN([
304     #define CONFIGURE_TEST_VM_MAP
305     #define TEST_VM_PROT_$test_def
306     #include "vm_alloc.cpp"
307     ], ac_cv_mprotect_works=no, rm -f core,
308     dnl When cross-compiling, do not assume anything
309     ac_cv_mprotect_works="guessing no"
310     )
311     done
312     AC_TRY_RUN([
313     #define CONFIGURE_TEST_VM_MAP
314     #define TEST_VM_PROT_RDWR_WRITE
315     #include "vm_alloc.cpp"
316     ], , ac_cv_mprotect_works=no,
317     dnl When cross-compiling, do not assume anything
318     ac_cv_mprotect_works="guessing no"
319     )
320     AC_LANG_RESTORE
321     ]
322     )
323    
324     dnl Remove support for mmap() if mprotect() does not work
325     if [[ "x$have_mmap_vm" = "xyes" ]]; then
326     case $ac_cv_mprotect_works in
327     *yes) have_mmap_vm=yes;;
328     *no) have_mmap_vm=no;;
329     esac
330     fi
331     AC_TRANSLATE_DEFINE(HAVE_MMAP_VM, $have_mmap_vm)
332    
333     fi dnl HAVE_MMAP_VM
334    
335     dnl Check if we can mmap 0x2000 bytes from 0x0000
336     AC_CACHE_CHECK("whether we can map Low Memory area 0x0000-0x2000",
337     ac_cv_can_map_lm, [
338     AC_LANG_SAVE
339     AC_LANG_CPLUSPLUS
340     AC_TRY_RUN([
341     #include "vm_alloc.cpp"
342     int main(void) { /* returns 0 if we could map the lowmem globals */
343     volatile char * lm;
344     if (vm_init() < 0) exit(1);
345     if ((lm = (volatile char *)vm_acquire_fixed(0, 0x2000)) == VM_MAP_FAILED) exit(1);
346     lm[0] = 'z';
347     if (vm_release((char *)lm, 0x2000) < 0) exit(1);
348     vm_exit(); exit(0);
349     }
350     ], ac_cv_can_map_lm=yes, ac_cv_can_map_lm=no,
351     dnl When cross-compiling, do not assume anything.
352     ac_cv_can_map_lm="guessing no"
353     )
354     AC_LANG_RESTORE
355     ]
356     )
357    
358     dnl Check signal handlers need to be reinstalled
359     AC_CACHE_CHECK("whether signal handlers need to be reinstalled",
360     ac_cv_signal_need_reinstall, [
361     AC_LANG_SAVE
362     AC_LANG_CPLUSPLUS
363     AC_TRY_RUN([
364     #include <stdlib.h>
365     #ifdef HAVE_UNISTD_H
366     #include <unistd.h>
367     #endif
368     #include <signal.h>
369     static int handled_signal = 0;
370     RETSIGTYPE sigusr1_handler(int) { handled_signal++; }
371     int main(void) { /* returns 0 if signals need not to be reinstalled */
372     signal(SIGUSR1, sigusr1_handler); raise(SIGUSR1); raise(SIGUSR1);
373     exit(handled_signal == 2);
374     }
375     ], ac_cv_signal_need_reinstall=yes, ac_cv_signal_need_reinstall=no,
376     dnl When cross-compiling, do not assume anything.
377     ac_cv_signal_need_reinstall="guessing yes"
378     )
379     AC_LANG_RESTORE
380     ]
381     )
382     AC_TRANSLATE_DEFINE(SIGNAL_NEED_REINSTALL, "$ac_cv_signal_need_reinstall")
383    
384     dnl Check if sigaction handlers need to be reinstalled
385     AC_CACHE_CHECK("whether sigaction handlers need to be reinstalled",
386     ac_cv_sigaction_need_reinstall, [
387     AC_LANG_SAVE
388     AC_LANG_CPLUSPLUS
389     AC_TRY_RUN([
390     #include <stdlib.h>
391     #ifdef HAVE_UNISTD_H
392     #include <unistd.h>
393     #endif
394     #include <signal.h>
395     static int handled_signal = 0;
396     RETSIGTYPE sigusr1_handler(int) { handled_signal++; }
397     typedef RETSIGTYPE (*signal_handler)(int);
398     static signal_handler mysignal(int sig, signal_handler handler) {
399     struct sigaction old_sa;
400     struct sigaction new_sa;
401     new_sa.sa_handler = handler;
402     return ((sigaction(sig,&new_sa,&old_sa) < 0) ? SIG_IGN : old_sa.sa_handler);
403     }
404     int main(void) { /* returns 0 if signals need not to be reinstalled */
405     mysignal(SIGUSR1, sigusr1_handler); raise(SIGUSR1); raise(SIGUSR1);
406     exit(handled_signal == 2);
407     }
408     ], ac_cv_sigaction_need_reinstall=yes, ac_cv_sigaction_need_reinstall=no,
409     dnl When cross-compiling, do not assume anything.
410     ac_cv_sigaction_need_reinstall="guessing yes"
411     )
412     AC_LANG_RESTORE
413     ]
414     )
415     AC_TRANSLATE_DEFINE(SIGACTION_NEED_REINSTALL, "$ac_cv_sigaction_need_reinstall")
416    
417     dnl Check if extended signals are supported.
418     AC_CACHE_CHECK("whether your system supports extended signal handlers",
419     ac_cv_have_extended_signals, [
420     AC_LANG_SAVE
421     AC_LANG_CPLUSPLUS
422     AC_TRY_RUN([
423     #define HAVE_SIGINFO_T 1
424     #define CONFIGURE_TEST_SIGSEGV_RECOVERY
425     #include "vm_alloc.cpp"
426     #include "sigsegv.cpp"
427     ], ac_cv_have_extended_signals=yes, ac_cv_have_extended_signals=no,
428     dnl When cross-compiling, do not assume anything.
429     ac_cv_have_extended_signals=no
430     )
431     AC_LANG_RESTORE
432     ]
433     )
434     AC_TRANSLATE_DEFINE(HAVE_SIGINFO_T, "$ac_cv_have_extended_signals")
435    
436     dnl Otherwise, check for subterfuges.
437     if [[ "x$ac_cv_have_extended_signals" = "xno" ]]; then
438     AC_CACHE_CHECK("whether we then have a subterfuge for your system",
439     ac_cv_have_sigcontext_hack, [
440     AC_LANG_SAVE
441     AC_LANG_CPLUSPLUS
442     AC_TRY_RUN([
443     #define HAVE_SIGCONTEXT_SUBTERFUGE 1
444     #define CONFIGURE_TEST_SIGSEGV_RECOVERY
445     #include "vm_alloc.cpp"
446     #include "sigsegv.cpp"
447     ], ac_cv_have_sigcontext_hack=yes, ac_cv_have_sigcontext_hack=no,
448     dnl When cross-compiling, do not assume anything.
449     ac_cv_have_sigcontext_hack=no
450     )
451     AC_LANG_RESTORE
452     ])
453     AC_TRANSLATE_DEFINE(HAVE_SIGCONTEXT_SUBTERFUGE, "$ac_cv_have_sigcontext_hack")
454     fi
455    
456     dnl Can we do Video on SEGV Signals ?
457     CAN_VOSF=no
458     if [[ "$ac_cv_have_extended_signals" = "yes" -o "$ac_cv_have_sigcontext_hack" = "yes" ]]; then
459     CAN_VOSF=yes
460     fi
461    
462     dnl Determine the addressing mode to use
463     if [[ "x$WANT_NATIVE_M68K" = "xyes" ]]; then
464     ADDRESSING_MODE="real"
465     else
466     ADDRESSING_MODE=""
467     AC_MSG_CHECKING([for the addressing mode to use])
468     for am in $ADDRESSING_TEST_ORDER; do
469     case $am in
470     real)
471     dnl Requires ability to mmap() Low Memory globals
472     if [[ "x$ac_cv_can_map_lm" = "xno" ]]; then
473     continue
474     fi
475     dnl Requires VOSF screen updates
476     if [[ "x$CAN_VOSF" = "xno" ]]; then
477     continue
478     fi
479     dnl Real addressing will probably work.
480     ADDRESSING_MODE="real"
481     WANT_VOSF=yes dnl we can use VOSF and we need it actually
482     DEFINES="$DEFINES -DREAL_ADDRESSING"
483     break
484     ;;
485     direct)
486     dnl Requires VOSF screen updates
487     if [[ "x$CAN_VOSF" = "xyes" ]]; then
488     ADDRESSING_MODE="direct"
489     WANT_VOSF=yes dnl we can use VOSF and we need it actually
490     DEFINES="$DEFINES -DDIRECT_ADDRESSING"
491     break
492     fi
493     ;;
494     banks)
495     dnl Default addressing mode
496     ADDRESSING_MODE="memory banks"
497     break
498     ;;
499     *)
500     AC_MSG_ERROR([Internal configure.in script error for $am addressing mode])
501     esac
502     done
503     AC_MSG_RESULT($ADDRESSING_MODE)
504     if [[ "x$ADDRESSING_MODE" = "x" ]]; then
505     AC_MSG_WARN([Sorry, no suitable addressing mode in $ADDRESSING_TEST_ORDER])
506     ADDRESSING_MODE="memory banks"
507     fi
508     fi
509    
510     dnl Enable VOSF screen updates with this feature is requested and feasible
511     if [[ "x$WANT_VOSF" = "xyes" -a "x$CAN_VOSF" = "xyes" ]]; then
512     AC_DEFINE(ENABLE_VOSF)
513     else
514     WANT_VOSF=no
515     fi
516    
517     dnl Check for GAS.
518     HAVE_GAS=no
519     AC_MSG_CHECKING(for GAS .p2align feature)
520     cat >conftest.S << EOF
521     .text
522     .p2align 5
523     EOF
524     if $CC conftest.S -c -o conftest.o >/dev/null 2>&1 ; then HAVE_GAS=yes; fi
525     AC_MSG_RESULT($HAVE_GAS)
526    
527     dnl Check for GCC 2.7 or higher.
528     HAVE_GCC27=no
529     AC_MSG_CHECKING(for GCC 2.7 or higher)
530     AC_EGREP_CPP(yes,
531     [#if __GNUC__ - 1 > 1 || __GNUC_MINOR__ - 1 > 5
532     yes
533     #endif
534     ], [AC_MSG_RESULT(yes); HAVE_GCC27=yes], AC_MSG_RESULT(no))
535    
536     dnl Check for GCC 3.0 or higher.
537     HAVE_GCC30=no
538     AC_MSG_CHECKING(for GCC 3.0 or higher)
539     AC_EGREP_CPP(yes,
540     [#if __GNUC__ >= 3
541     yes
542     #endif
543     ], [AC_MSG_RESULT(yes); HAVE_GCC30=yes], AC_MSG_RESULT(no))
544    
545     dnl Set "-fomit-frame-pointer" on i386 GCC 2.7 or higher.
546 nigel 1.3 dnl Also set "-fno-exceptions" for C++ because exception handling requires
547     dnl the frame pointer.
548 nigel 1.1 if [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_I386" = "xyes" ]]; then
549     CFLAGS="$CFLAGS -fomit-frame-pointer"
550 nigel 1.3 CXXFLAGS="$CXXFLAGS -fomit-frame-pointer -fno-exceptions"
551 nigel 1.1 fi
552    
553     dnl (gb) Do not merge constants since it breaks fpu/fpu_x86.cpp.
554     dnl As of 2001/08/02, this affects the following compilers:
555     dnl Official: probably gcc-3.1 (mainline CVS)
556     dnl Mandrake: gcc-2.96 >= 0.59mdk, gcc-3.0.1 >= 0.1mdk
557     dnl Red Hat : gcc-2.96 >= 89, gcc-3.0 >= 1
558     if [[ "x$HAVE_GCC27" = "xyes" ]]; then
559     SAVED_CXXFLAGS="$CXXFLAGS"
560     CXXFLAGS="$CXXFLAGS -fno-merge-constants"
561     AC_CACHE_CHECK([whether GCC supports constants merging], ac_cv_gcc_constants_merging, [
562     AC_LANG_SAVE
563     AC_LANG_CPLUSPLUS
564     AC_TRY_COMPILE([],[],[ac_cv_gcc_constants_merging=yes],[ac_cv_gcc_constants_merging=no])
565     AC_LANG_RESTORE
566     ])
567     if [[ "x$ac_cv_gcc_constants_merging" != "xyes" ]]; then
568     CXXFLAGS="$SAVED_CXXFLAGS"
569     fi
570     fi
571    
572     dnl Select appropriate CPU source and REGPARAM define.
573     ASM_OPTIMIZATIONS=none
574     CPUSRCS="cpuemu1.cpp cpuemu2.cpp cpuemu3.cpp cpuemu4.cpp cpuemu5.cpp cpuemu6.cpp cpuemu7.cpp cpuemu8.cpp"
575     FPUSRCS="../uae_cpu/fpu/fpu_uae.cpp"
576     if [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_I386" = "xyes" -a "x$OS_TYPE" != "xfreebsd" ]]; then
577     dnl i386 CPU
578     DEFINES="$DEFINES -DREGPARAM=\"__attribute__((regparm(3)))\""
579     if [[ "x$HAVE_GAS" = "xyes" ]]; then
580     ASM_OPTIMIZATIONS=i386
581     DEFINES="$DEFINES -DX86_ASSEMBLY -DUNALIGNED_PROFITABLE -DOPTIMIZED_FLAGS"
582     CPUSRCS="cpufast1.s cpufast2.s cpufast3.s cpufast4.s cpufast5.s cpufast6.s cpufast7.s cpufast8.s"
583     FPUSRCS="../uae_cpu/fpu_x86.cpp"
584     fi
585     elif [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_SPARC" = "xyes" -a "x$HAVE_GAS" = "xyes" ]]; then
586     dnl SPARC CPU
587     case "$target_os" in
588     solaris*)
589     AC_MSG_CHECKING(SPARC CPU architecture)
590     SPARC_TYPE=`Solaris/which_sparc`
591     AC_MSG_RESULT($SPARC_TYPE)
592     case "$SPARC_TYPE" in
593     SPARC_V8)
594     ASM_OPTIMIZATIONS="SPARC V8 architecture"
595     DEFINES="$DEFINES -DSPARC_V8_ASSEMBLY" dnl -DOPTIMIZED_FLAGS"
596     CFLAGS="$CFLAGS -Wa,-Av8"
597     CXXFLAGS="$CXXFLAGS -Wa,-Av8"
598     ;;
599     SPARC_V9)
600     ASM_OPTIMIZATIONS="SPARC V9 architecture"
601     DEFINES="$DEFINES -DSPARC_V9_ASSEMBLY" dnl -DOPTIMIZED_FLAGS"
602     CFLAGS="$CFLAGS -Wa,-Av9"
603     CXXFLAGS="$CXXFLAGS -Wa,-Av9"
604     ;;
605     esac
606     ;;
607     esac
608     elif [[ "x$WANT_NATIVE_M68K" = "xyes" ]]; then
609     dnl Native m68k, no emulation
610     CPUINCLUDES="-I../native_cpu"
611     CPUSRCS="asm_support.s"
612     fi
613    
614     dnl Select appropriate FPU source.
615     dnl 1. Optimized X86 assembly core if target is i386 architecture
616     SAVED_DEFINES=$DEFINES
617     if [[ "x$FPE_CORE" = "xdefault" ]]; then
618     if [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_I386" = "xyes" -a "x$HAVE_GAS" = "xyes" ]]; then
619     DEFINES="$DEFINES -DFPU_X86"
620     FPE_CORE_STR="i386 optimized core"
621     FPUSRCS="../uae_cpu/fpu/fpu_x86.cpp"
622     FPE_CORE="i386"
623     else
624     FPE_CORE="uae"
625     fi
626     fi
627    
628     dnl 2. JIT-FPU only supports IEEE-based implementation.
629     if [[ "x$WANT_JIT_FPU" = "xyes" -a "x$FPE_CORE" != "xieee" ]]; then
630     AC_MSG_WARN([Sorry, JIT-FPU supports only the "ieee" FPE implementation])
631     FPE_CORE="ieee"
632     dnl Restore previous variables. FPE_CORE_STR and FPUSRCS are overwritten
633     DEFINES=$SAVED_DEFINES
634     fi
635    
636     dnl 3. Choose either IEEE-based implementation or the old UAE core
637     if [[ "x$FPE_CORE" = "xieee" ]]; then
638     AC_CHECK_HEADERS(fenv.h)
639     AC_CHECK_FUNCS(feclearexcept fegetexceptflag feraiseexcept fesetexceptflag fetestexcept)
640     AC_CHECK_FUNCS(fegetround fesetround)
641     DEFINES="$DEFINES -DFPU_IEEE"
642     FPE_CORE_STR="ieee-based fpu core"
643     FPUSRCS="../uae_cpu/fpu/fpu_ieee.cpp"
644     elif [[ "x$FPE_CORE" = "xuae" ]]; then
645     DEFINES="$DEFINES -DFPU_UAE"
646     FPE_CORE_STR="original uae core"
647     FPUSRCS="../uae_cpu/fpu/fpu_uae.cpp"
648     fi
649    
650     dnl Check for certain math functions
651     AC_CHECK_FUNCS(atanh)
652     AC_CHECK_FUNCS(isnan isinf) dnl C99
653     AC_CHECK_FUNCS(isnanl isinfl) dnl IEEE ?
654    
655     dnl UAE CPU sources for all non-m68k-native architectures.
656     if [[ "x$WANT_NATIVE_M68K" = "xno" ]]; then
657     CPUINCLUDES="-I../uae_cpu"
658     CPUSRCS="../uae_cpu/basilisk_glue.cpp ../uae_cpu/memory.cpp ../uae_cpu/newcpu.cpp ../uae_cpu/readcpu.cpp $FPUSRCS cpustbl.cpp cpudefs.cpp $CPUSRCS"
659     fi
660    
661     dnl Remove the "-g" option if set for GCC.
662     if [[ "x$HAVE_GCC27" = "xyes" ]]; then
663     CFLAGS=`echo $CFLAGS | sed -e 's/-g//g'`
664     CXXFLAGS=`echo $CXXFLAGS | sed -e 's/-g//g'`
665     fi
666    
667     dnl Or if we have -Ofast
668     if [[ "x$HAVE_OFAST" = "xyes" ]]; then
669     CFLAGS="`echo $CFLAGS | sed -e 's/-g//g'` -Ofast"
670     CXXFLAGS="`echo $CXXFLAGS | sed -e 's/-g//g'` -Ofast"
671     CXXFLAGS="-LANG:std $CXXFLAGS"
672     LDFLAGS="$LDFLAGS -Ofast"
673     fi
674    
675     dnl Generate Makefile.
676     AC_SUBST(DEFINES)
677     AC_SUBST(SYSSRCS)
678     AC_SUBST(CPUINCLUDES)
679     AC_SUBST(CPUSRCS)
680     AC_OUTPUT(Makefile)
681    
682     dnl Print summary.
683     echo
684     echo Basilisk II configuration summary:
685     echo
686     echo Full screen support .............. : $WANT_FULL
687     echo Multiple emulator windows ........ : $WANT_MWIN
688     echo Enable video on SEGV signals ..... : $WANT_VOSF
689     echo mon debugger support ............. : $WANT_MON
690     echo Floating-Point emulation core .... : $FPE_CORE_STR
691     echo Assembly optimizations ........... : $ASM_OPTIMIZATIONS
692     echo Addressing mode .................. : $ADDRESSING_MODE
693     echo
694 nigel 1.2 echo "Configuration done. Now type \"make\" (or \"make ide\")."