ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/BasiliskII/src/MacOSX/configure.in
Revision: 1.7
Committed: 2002-10-31T08:52:59Z (22 years ago) by nigel
Branch: MAIN
Changes since 1.6: +6 -0 lines
Log Message:
SOme 10.2 compile fixes

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