ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/BasiliskII/src/MacOSX/configure.in
Revision: 1.1
Committed: 2002-03-16T04:00:02Z (22 years, 8 months ago) by nigel
Branch: MAIN
Log Message:
Initial revision of Mac OS X port code. Uses Objective-C++. Needs Mac OS 10.1

File Contents

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