ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/BasiliskII/src/Unix/configure.in
Revision: 1.36
Committed: 2001-03-24T08:56:15Z (23 years, 8 months ago) by gbeauche
Branch: MAIN
Changes since 1.35: +2 -0 lines
Log Message:
- fixed FPU core auto-detection for non-x86 architectures

File Contents

# User Rev Content
1 cebix 1.1 dnl Process this file with autoconf to produce a configure script.
2     dnl Written in 1999 by Christian Bauer et al.
3    
4     AC_INIT(main_unix.cpp)
5     AC_PREREQ(2.12)
6     AC_CONFIG_HEADER(config.h)
7    
8     dnl Options.
9 cebix 1.17 AC_ARG_ENABLE(xf86-dga, [ --enable-xf86-dga use the XFree86 DGA extension [default=yes]], [WANT_XF86_DGA=$enableval], [WANT_XF86_DGA=yes])
10     AC_ARG_ENABLE(xf86-vidmode, [ --enable-xf86-vidmode use the XFree86 VidMode extension [default=yes]], [WANT_XF86_VIDMODE=$enableval], [WANT_XF86_VIDMODE=yes])
11     AC_ARG_ENABLE(fbdev-dga, [ --enable-fbdev-dga use direct frame buffer access via /dev/fb [default=yes]], [WANT_FBDEV_DGA=$enableval], [WANT_FBDEV_DGA=yes])
12 cebix 1.27 AC_ARG_ENABLE(vosf, [ --enable-vosf enable video on SEGV signals [default=no]], [WANT_VOSF=$enableval], [WANT_VOSF=no])
13 gbeauche 1.32
14 gbeauche 1.35 dnl FPU emulation core.
15     AC_ARG_ENABLE(fpe,
16     [ --enable-fpe=which specify which fpu emulator to use [default=opt]],
17     [ case "$enableval" in
18     default) FPE_CORE="default";; dnl fpu_x86.cpp if i386 architecture, fpu_uae.cpp otherwise
19     uae) FPE_CORE="uae";;
20     *) AC_MSG_ERROR([--enable-fpe takes only one of the following values: default, uae]);;
21     esac
22     ],
23     [ FPE_CORE="default"
24     ])
25    
26 gbeauche 1.32 dnl Addressing modes.
27 gbeauche 1.23 AC_ARG_ENABLE(addressing,
28 gbeauche 1.32 [ --enable-addressing=AM specify the addressing mode to use [default=fastest]],
29 gbeauche 1.23 [ case "$enableval" in
30 cebix 1.24 real) ADDRESSING_TEST_ORDER="real";;
31     direct) ADDRESSING_TEST_ORDER="direct";;
32     banks) ADDRESSING_TEST_ORDER="banks";;
33 gbeauche 1.32 fastest)ADDRESSING_TEST_ORDER="direct banks";;
34     *) AC_MSG_ERROR([--enable-addressing takes only one of the following values: fastest, real, direct, banks]);;
35 gbeauche 1.23 esac
36     ],
37     [ ADDRESSING_TEST_ORDER="direct banks"
38     ])
39 gbeauche 1.32
40     dnl External packages.
41 cebix 1.17 AC_ARG_WITH(esd, [ --with-esd support ESD for sound under Linux/FreeBSD [default=yes]], [WANT_ESD=$withval], [WANT_ESD=yes])
42     AC_ARG_WITH(gtk, [ --with-gtk use GTK user interface [default=yes]], [WANT_GTK=$withval], [WANT_GTK=yes])
43     AC_ARG_WITH(mon, [ --with-mon use mon as debugger [default=yes]], [WANT_MON=$withval], [WANT_MON=yes])
44 cebix 1.1
45 gbeauche 1.23 dnl Canonical system information.
46     AC_CANONICAL_HOST
47     AC_CANONICAL_TARGET
48    
49     dnl Target OS type (target is host if not cross-compiling).
50     case "$target_os" in
51     linux*) OS_TYPE=linux;;
52     netbsd*) OS_TYPE=netbsd;;
53     freebsd*) OS_TYPE=freebsd;;
54     solaris*) OS_TYPE=solaris;;
55 cebix 1.28 *) OS_TYPE=`echo $target_os | sed -e 's/-/_/' | sed -e 's/\./_/'`;;
56 gbeauche 1.23 esac
57     DEFINES="$DEFINES -DOS_$OS_TYPE"
58    
59     dnl Target CPU type.
60     HAVE_I386=no
61     HAVE_M68K=no
62     HAVE_SPARC=no
63 cebix 1.33 HAVE_POWERPC=no
64 gbeauche 1.23 case "$target_cpu" in
65     i386* | i486* | i586* | i686* | i786* ) CPU_TYPE=i386 HAVE_I386=yes;;
66     m68k* ) CPU_TYPE=m68k HAVE_M68K=yes;;
67     sparc* ) CPU_TYPE=sparc HAVE_SPARC=yes;;
68 cebix 1.33 powerpc* ) CPU_TYPE=powerpc HAVE_POWERPC=yes;;
69 gbeauche 1.23 *) CPU_TYPE=`echo $target_cpu | sed -e 's/-/_/'`;;
70     esac
71     DEFINES="$DEFINES -DCPU_$CPU_TYPE"
72    
73 cebix 1.1 dnl Checks for programs.
74     AC_PROG_CC
75 gbeauche 1.23 AC_PROG_CC_C_O
76 cebix 1.4 AC_PROG_CPP
77 cebix 1.1 AC_PROG_CXX
78     AC_PROG_MAKE_SET
79     AC_PROG_INSTALL
80    
81 cebix 1.11 dnl We use mon if possible.
82     MONSRCS=
83 cebix 1.18 if [[ "x$WANT_MON" = "xyes" ]]; then
84     AC_MSG_CHECKING(for mon)
85 cebix 1.24 mon_srcdir=../../../mon/src
86     if grep mon_init $mon_srcdir/mon.h >/dev/null 2>/dev/null; then
87 cebix 1.18 AC_MSG_RESULT(yes)
88 cebix 1.19 AC_DEFINE(ENABLE_MON)
89 cebix 1.29 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"
90 cebix 1.24 CXXFLAGS="$CXXFLAGS -I$mon_srcdir -I$mon_srcdir/disass"
91 cebix 1.18 AC_CHECK_LIB(readline, readline)
92 cebix 1.19 AC_CHECK_LIB(termcap, tputs)
93     AC_CHECK_HEADERS(readline.h history.h readline/readline.h readline/history.h)
94 cebix 1.18 else
95     AC_MSG_RESULT(no)
96     AC_MSG_WARN([Could not find mon, ignoring --with-mon.])
97     WANT_MON=no
98     fi
99 cebix 1.11 fi
100    
101 cebix 1.1 dnl Checks for libraries.
102 cebix 1.10 AC_CHECK_LIB(posix4, sem_init)
103    
104     dnl We need X11.
105 cebix 1.1 AC_PATH_XTRA
106     if [[ "x$no_x" = "xyes" ]]; then
107     AC_MSG_ERROR([You need X11 to run Basilisk II.])
108     fi
109     CFLAGS="$CFLAGS $X_CFLAGS"
110     CXXFLAGS="$CXXFLAGS $X_CFLAGS"
111     LIBS="$LIBS $X_PRE_LIBS $X_LIBS -lX11 -lXext $X_EXTRA_LIBS"
112    
113 cebix 1.19 dnl We want pthreads. Try libpthread first, then libc_r (FreeBSD), then PTL.
114     HAVE_PTHREADS=yes
115 cebix 1.10 AC_CHECK_LIB(pthread, pthread_create, , [
116     AC_CHECK_LIB(c_r, pthread_create, , [
117     AC_CHECK_LIB(PTL, pthread_create, , [
118 cebix 1.19 HAVE_PTHREADS=no
119 cebix 1.10 ])
120     ])
121     ])
122 cebix 1.19 if [[ "x$HAVE_PTHREADS" = "xyes" ]]; then
123     AC_DEFINE(HAVE_PTHREADS)
124     fi
125     AC_CHECK_FUNCS(pthread_cancel)
126 cebix 1.10
127     dnl If POSIX.4 semaphores are not available, we emulate them with pthread mutexes.
128 cebix 1.19 SEMSRC=
129 cebix 1.10 AC_CHECK_FUNCS(sem_init, , [
130 cebix 1.26 if test "x$HAVE_PTHREADS" = "xyes"; then
131 cebix 1.19 SEMSRC=posix_sem.cpp
132     fi
133 cebix 1.10 ])
134 cebix 1.1
135 cebix 1.10 dnl We use DGA (XFree86 or fbdev) if possible.
136 cebix 1.8 if [[ "x$WANT_XF86_DGA" = "xyes" ]]; then
137 cebix 1.10 AC_CHECK_LIB(Xxf86dga, XF86DGAQueryExtension, [
138 cebix 1.19 AC_DEFINE(ENABLE_XF86_DGA)
139 cebix 1.1 LIBS="$LIBS -lXxf86dga"
140 cebix 1.8 if [[ "x$WANT_FBDEV_DGA" = "xyes" ]]; then
141     AC_MSG_WARN([Cannot have both --enable-xf86-dga and --enable-fbdev-dga, ignoring --enable-fbdev-dga.])
142     WANT_FBDEV_DGA=no
143     fi
144 cebix 1.10 ], [
145     AC_MSG_WARN([Could not find XFree86 DGA extension, ignoring --enable-xf86-dga.])
146 cebix 1.13 WANT_XF86_DGA=no
147 cebix 1.10 ])
148 cebix 1.8 fi
149     if [[ "x$WANT_FBDEV_DGA" = "xyes" ]]; then
150 cebix 1.19 AC_DEFINE(ENABLE_FBDEV_DGA)
151 cebix 1.1 fi
152    
153 cebix 1.17 dnl We use XFree86 VidMode if possible.
154     if [[ "x$WANT_XF86_VIDMODE" = "xyes" ]]; then
155     AC_CHECK_LIB(Xxf86vm, XF86VidModeQueryExtension, [
156 cebix 1.19 AC_DEFINE(ENABLE_XF86_VIDMODE)
157 cebix 1.17 LIBS="$LIBS -lXxf86vm"
158     ], [
159     AC_MSG_WARN([Could not find XFree86 VidMode extension, ignoring --enable-xf86-vidmode.])
160     WANT_XF86_VIDMODE=no
161     ])
162     fi
163    
164 cebix 1.1 dnl We use GTK+ if possible.
165 cebix 1.10 UISRCS=../dummy/prefs_editor_dummy.cpp
166 cebix 1.14 if [[ "x$WANT_GTK" = "xyes" ]]; then
167 cebix 1.10 AM_PATH_GTK(1.2.0, [
168 cebix 1.19 AC_DEFINE(ENABLE_GTK)
169 cebix 1.10 CFLAGS="$CFLAGS $GTK_CFLAGS"
170     CXXFLAGS="$CXXFLAGS $GTK_CFLAGS"
171     LIBS="$LIBS $GTK_LIBS"
172     UISRCS=prefs_editor_gtk.cpp
173     ], [
174     AC_MSG_WARN([Could not find GTK+, disabling user interface.])
175 cebix 1.14 WANT_GTK=no
176 cebix 1.10 ])
177 cebix 1.1 fi
178    
179 cebix 1.10 dnl We use ESD if possible.
180     if [[ "x$WANT_ESD" = "xyes" ]]; then
181     AM_PATH_ESD(0.2.8, [
182 cebix 1.19 AC_DEFINE(ENABLE_ESD)
183 cebix 1.10 CFLAGS="$CFLAGS $ESD_CFLAGS"
184     CXXFLAGS="$CXXFLAGS $ESD_CFLAGS"
185     LIBS="$LIBS $ESD_LIBS"
186     ], [
187     AC_MSG_WARN([Could not find ESD, disabling ESD support.])
188     WANT_ESD=no
189     ])
190 cebix 1.1 fi
191    
192     dnl Checks for header files.
193     AC_HEADER_STDC
194     AC_CHECK_HEADERS(unistd.h fcntl.h sys/time.h)
195    
196     dnl Checks for typedefs, structures, and compiler characteristics.
197     AC_C_BIGENDIAN
198     AC_C_CONST
199     AC_C_INLINE
200     AC_CHECK_SIZEOF(short, 2)
201     AC_CHECK_SIZEOF(int, 4)
202     AC_CHECK_SIZEOF(long, 4)
203     AC_CHECK_SIZEOF(long long, 8)
204 gbeauche 1.23 AC_CHECK_SIZEOF(void *, 4)
205 cebix 1.1 AC_TYPE_OFF_T
206     AC_CHECK_TYPE(loff_t, off_t)
207     AC_TYPE_SIZE_T
208 gbeauche 1.23 AC_TYPE_SIGNAL
209 cebix 1.1 AC_HEADER_TIME
210     AC_STRUCT_TM
211    
212     dnl Checks for library functions.
213     AC_CHECK_FUNCS(strdup cfmakeraw)
214 cebix 1.21 AC_CHECK_FUNCS(clock_gettime timer_create)
215 cebix 1.1
216     dnl Select system-dependant source files.
217 cebix 1.19 SERIALSRC=serial_unix.cpp
218     ETHERSRC=../dummy/ether_dummy.cpp
219     SCSISRC=../dummy/scsi_dummy.cpp
220     AUDIOSRC=../dummy/audio_dummy.cpp
221     EXTRASYSSRCS=
222 cebix 1.27 CAN_NATIVE_M68K=no
223 gbeauche 1.23 case "$target_os" in
224     linux*)
225     ETHERSRC=Linux/ether_linux.cpp
226     SCSISRC=Linux/scsi_linux.cpp
227     AUDIOSRC=audio_oss_esd.cpp
228     ;;
229     freebsd*3.*)
230     AUDIOSRC=audio_oss_esd.cpp
231     DEFINES="$DEFINES -DBSD_COMP"
232     dnl Check for the CAM library
233     AC_CHECK_LIB(cam, cam_open_btl, HAVE_LIBCAM=yes, HAVE_LIBCAM=no)
234     if [[ "x$HAVE_LIBCAM" = "xno" ]]; then
235     AC_MSG_WARN([Cannot find libcam for SCSI management, disabling SCSI support.])
236     else
237     dnl Check for the sys kernel includes
238     AC_CHECK_HEADER(/sys/cam/cam.h)
239     if [[ "x$ac_cv_header__sys_cam_cam_h" = "xno" ]]; then
240     dnl In this case I should fix this thing including a "patch"
241     dnl to access directly to the functions in the kernel :) --Orlando
242     AC_MSG_WARN([Cannot find kernel includes for CAM library, disabling SCSI support.])
243     else
244     SCSISRC=FreeBSD/scsi_freebsd.cpp
245     CXXFLAGS="$CXXFLAGS -I/sys"
246     CFLAGS="$CFLAGS -I/sys"
247     LIBS="$LIBS -lcam"
248     DEFINES="$DEFINES -DCAM"
249     fi
250     fi
251     ;;
252     freebsd*)
253     DEFINES="$DEFINES -DBSD_COMP"
254     dnl Check for the SCSI library
255     AC_CHECK_LIB(scsi, scsi_open, HAVE_LIBSCSI=yes, HAVE_LIBSCSI=no)
256     if [[ "x$HAVE_LIBSCSI" = "xno" ]]; then
257     AC_MSG_WARN([Cannot find libscsi for SCSI management, disabling SCSI support.])
258     else
259     dnl Check for the sys kernel includes
260     AC_CHECK_HEADER(scsi.h sys/scsiio.h)
261     if [[ "x$ac_cv_header_scsi_h" = "xno" ]]; then
262     AC_MSG_WARN([Cannot find includes for the SCSI library, disabling SCSI support.])
263     else
264     SCSISRC=FreeBSD/scsi_freebsd.cpp
265     LIBS="$LIBS -lscsi"
266     fi
267     fi
268     ;;
269     netbsd*)
270 cebix 1.27 CAN_NATIVE_M68K=yes
271 gbeauche 1.23 ;;
272     solaris*)
273     AUDIOSRC=Solaris/audio_solaris.cpp
274     DEFINES="$DEFINES -DBSD_COMP -D_POSIX_PTHREAD_SEMANTICS"
275     ;;
276     irix*)
277 cebix 1.30 AUDIOSRC=Irix/audio_irix.cpp
278 gbeauche 1.23 EXTRASYSSRCS=Irix/unaligned.c
279 cebix 1.28 dnl IRIX headers work fine, but somehow don't define or use "STDC_HEADERS"
280     DEFINES="$DEFINES -DCRTSCTS=CNEW_RTSCTS -DB230400=B115200 -DSTDC_HEADERS"
281 cebix 1.30 LIBS="$LIBS -laudio"
282 gbeauche 1.23 ;;
283     esac
284    
285 cebix 1.27 dnl Use 68k CPU natively?
286     WANT_NATIVE_M68K=no
287     if [[ "x$HAVE_M68K" = "xyes" -a "x$CAN_NATIVE_M68K" = "xyes" ]]; then
288     AC_DEFINE(ENABLE_NATIVE_M68K)
289     WANT_NATIVE_M68K=yes
290     fi
291    
292 gbeauche 1.23 if [[ "x$HAVE_PTHREADS" = "xno" ]]; then
293     dnl Serial, ethernet and audio support needs pthreads
294     AC_MSG_WARN([You don't have pthreads, disabling serial, ethernet and audio support.])
295     SERIALSRC=../dummy/serial_dummy.cpp
296     ETHERSRC=../dummy/ether_dummy.cpp
297     AUDIOSRC=../dummy/audio_dummy.cpp
298     fi
299     SYSSRCS="$SERIALSRC $ETHERSRC $SCSISRC $AUDIOSRC $SEMSRC $UISRCS $MONSRCS $EXTRASYSSRCS"
300    
301     dnl Define a macro that translates a yesno-variable into a C macro definition
302     dnl to be put into the config.h file
303     dnl $1 -- the macro to define
304     dnl $2 -- the value to translate
305     AC_DEFUN(AC_TRANSLATE_DEFINE, [
306     if [[ "x$2" = "xyes" ]]; then
307     AC_DEFINE($1)
308     fi
309     ])
310    
311     dnl Check if we can mmap 0x2000 bytes from 0x0000
312     AC_CACHE_CHECK("whether we can map Low Memory area 0x0000-0x2000",
313     ac_cv_can_map_lm, [
314     AC_LANG_SAVE
315     AC_LANG_CPLUSPLUS
316     AC_TRY_RUN([
317     #include <unistd.h>
318     #include <fcntl.h>
319     #include <sys/mman.h>
320    
321     int main()
322     { int zero_fd; char * lm;
323     if ((zero_fd = open("/dev/zero", O_RDWR)) < 0) exit(1);
324     if ((lm = (char *)mmap((caddr_t)0x0000, 0x2000, PROT_READ | PROT_WRITE, MAP_FIXED | MAP_PRIVATE, zero_fd, 0)) == MAP_FAILED) exit(1);
325     lm[0] = 0x12;
326     munmap(lm, 0x2000);
327     close(zero_fd);
328     exit(0);
329     }
330     ],
331     [ac_cv_can_map_lm=yes],
332     [ac_cv_can_map_lm=no]
333     )
334     AC_LANG_RESTORE
335     ]
336     )
337    
338     dnl Check if extended signals are supported.
339     AC_CACHE_CHECK("whether your system supports extended signal handlers",
340     ac_cv_have_extended_signals, [
341     AC_LANG_SAVE
342     AC_LANG_CPLUSPLUS
343     AC_TRY_RUN([
344     #include <unistd.h>
345 cebix 1.25 #include <stdlib.h>
346 gbeauche 1.23 #include <signal.h>
347     #include <fcntl.h>
348     #include <sys/mman.h>
349    
350     static volatile caddr_t mem = 0;
351     static int zero_fd = -1;
352    
353     static RETSIGTYPE segfault_handler(int, siginfo_t * sip, void *)
354     { if ((caddr_t)(sip->si_addr) != mem) exit(1);
355     munmap(mem, getpagesize()); close(zero_fd); exit(0); }
356    
357     int main()
358     { if ((zero_fd = open("/dev/zero", O_RDWR)) < 0) exit(1);
359     if ((mem = (caddr_t)mmap(0, getpagesize(), PROT_READ, MAP_PRIVATE, zero_fd, 0)) == (caddr_t)MAP_FAILED) exit(1);
360 cebix 1.25 struct sigaction sa; sa.sa_sigaction = segfault_handler; sa.sa_flags = SA_SIGINFO;
361 gbeauche 1.23 sigaction(SIGSEGV, &sa, 0);
362     mem[0] = 0;
363     exit(1); // should not be reached
364     }
365     ],
366     [ac_cv_have_extended_signals=yes],
367     [ac_cv_have_extended_signals=no]
368     )
369     AC_LANG_RESTORE
370     ]
371     )
372     AC_TRANSLATE_DEFINE(HAVE_SIGINFO_T, "$ac_cv_have_extended_signals")
373    
374     dnl Otherwise, check for subterfuges.
375     if [[ "x$ac_cv_have_extended_signals" = "xno" ]]; then
376     case "$target_os" in
377     linux*)
378     if [[ "x$HAVE_I386" = "xyes" ]]; then
379     AC_CACHE_CHECK("whether we then have a subterfuge for your system",
380     ac_cv_have_sigcontext_hack, [
381     AC_LANG_SAVE
382     AC_LANG_CPLUSPLUS
383     AC_TRY_RUN([
384     #include <unistd.h>
385     #include <signal.h>
386     #include <fcntl.h>
387     #include <sys/mman.h>
388    
389     static volatile caddr_t mem = 0;
390     static int zero_fd = -1;
391    
392     static RETSIGTYPE segfault_handler(int, struct sigcontext scs)
393     { if ((caddr_t)(scs.cr2) != mem) exit(1);
394 cebix 1.33 munmap(mem, getpagesize()); close(zero_fd); exit(0); }
395    
396     int main()
397     { if ((zero_fd = open("/dev/zero", O_RDWR)) < 0) exit(1);
398     if ((mem = (caddr_t)mmap(0, getpagesize(), PROT_READ, MAP_PRIVATE, zero_fd, 0)) == (caddr_t)MAP_FAILED) exit(1);
399     struct sigaction sa; sa.sa_flags = 0;
400     sa.sa_handler = (RETSIGTYPE (*)(int))segfault_handler;
401     sigaction(SIGSEGV, &sa, 0);
402     mem[0] = 0;
403     exit(1); // should not be reached
404     }
405     ],
406     [ac_cv_have_sigcontext_hack=yes],
407     [ac_cv_have_sigcontext_hack=no]
408     )
409     AC_LANG_RESTORE
410     ])
411     AC_TRANSLATE_DEFINE(HAVE_SIGCONTEXT_SUBTERFUGE, $ac_cv_have_sigcontext_hack)
412     elif [[ "x$HAVE_POWERPC" = "xyes" ]]; then
413     AC_CACHE_CHECK("whether we then have a subterfuge for your system",
414     ac_cv_have_sigcontext_hack, [
415     AC_LANG_SAVE
416     AC_LANG_CPLUSPLUS
417     AC_TRY_RUN([
418     #include <unistd.h>
419     #include <signal.h>
420     #include <fcntl.h>
421     #include <sys/mman.h>
422    
423     static volatile caddr_t mem = 0;
424     static int zero_fd = -1;
425    
426     static RETSIGTYPE segfault_handler(int, struct sigcontext_struct *scs)
427     { if ((caddr_t)(scs->regs->dar) != mem) exit(1);
428 gbeauche 1.23 munmap(mem, getpagesize()); close(zero_fd); exit(0); }
429    
430     int main()
431     { if ((zero_fd = open("/dev/zero", O_RDWR)) < 0) exit(1);
432     if ((mem = (caddr_t)mmap(0, getpagesize(), PROT_READ, MAP_PRIVATE, zero_fd, 0)) == (caddr_t)MAP_FAILED) exit(1);
433     struct sigaction sa; sa.sa_flags = 0;
434 cebix 1.25 sa.sa_handler = (RETSIGTYPE (*)(int))segfault_handler;
435 gbeauche 1.23 sigaction(SIGSEGV, &sa, 0);
436     mem[0] = 0;
437     exit(1); // should not be reached
438     }
439     ],
440     [ac_cv_have_sigcontext_hack=yes],
441     [ac_cv_have_sigcontext_hack=no]
442     )
443     AC_LANG_RESTORE
444     ])
445 cebix 1.25 AC_TRANSLATE_DEFINE(HAVE_SIGCONTEXT_SUBTERFUGE, $ac_cv_have_sigcontext_hack)
446 gbeauche 1.23 fi
447 cebix 1.27 ;;
448     netbsd*)
449     if [[ "x$HAVE_M68K" = "xyes" ]]; then
450     AC_CACHE_CHECK("whether we then have a subterfuge for your system",
451     ac_cv_have_sigcontext_hack, [
452     AC_LANG_SAVE
453     AC_LANG_CPLUSPLUS
454     AC_TRY_RUN([
455     #include <unistd.h>
456     #include <signal.h>
457     #include <fcntl.h>
458     #include <sys/mman.h>
459    
460     static volatile caddr_t mem = 0;
461     static int zero_fd = -1;
462    
463     static RETSIGTYPE segfault_handler(int, int code)
464     { if ((caddr_t)code != mem) exit(1);
465     munmap(mem, getpagesize()); close(zero_fd); exit(0); }
466    
467     int main()
468     { if ((zero_fd = open("/dev/zero", O_RDWR)) < 0) exit(1);
469     if ((mem = (caddr_t)mmap(0, getpagesize(), PROT_READ, MAP_PRIVATE, zero_fd, 0)) == (caddr_t)MAP_FAILED) exit(1);
470     struct sigaction sa; sa.sa_flags = 0;
471     sa.sa_handler = (RETSIGTYPE (*)(int))segfault_handler;
472     sigaction(SIGSEGV, &sa, 0);
473     mem[0] = 0;
474     exit(1); // should not be reached
475     }
476     ],
477     [ac_cv_have_sigcontext_hack=yes],
478     [ac_cv_have_sigcontext_hack=no]
479     )
480     AC_LANG_RESTORE
481     ])
482     AC_TRANSLATE_DEFINE(HAVE_SIGCONTEXT_SUBTERFUGE, $ac_cv_have_sigcontext_hack)
483     fi
484 cebix 1.1 ;;
485 gbeauche 1.23 esac
486     fi
487    
488     dnl Can we do Video on SEGV Signals ?
489     CAN_VOSF=no
490     if [[ "$ac_cv_have_extended_signals" = "yes" -o "$ac_cv_have_sigcontext_hack" = "yes" ]]; then
491     CAN_VOSF=yes
492     fi
493    
494     dnl Determine the addressing mode to use
495 cebix 1.27 if [[ "x$WANT_NATIVE_M68K" = "xyes" ]]; then
496     ADDRESSING_MODE="real"
497     else
498     ADDRESSING_MODE=""
499     AC_MSG_CHECKING([for the addressing mode to use])
500     for am in $ADDRESSING_TEST_ORDER; do
501     case $am in
502     real)
503 gbeauche 1.32 dnl Requires ability to mmap() Low Memory globals
504 cebix 1.27 if [[ "x$ac_cv_can_map_lm" = "xno" ]]; then
505     continue
506     fi
507 gbeauche 1.32 dnl Requires VOSF screen updates
508     if [[ "x$CAN_VOSF" = "xno" ]]; then
509     continue
510 cebix 1.1 fi
511 gbeauche 1.32 dnl Real addressing will probably work.
512 cebix 1.27 ADDRESSING_MODE="real"
513     WANT_VOSF=yes dnl we can use VOSF and we need it actually
514     DEFINES="$DEFINES -DREAL_ADDRESSING"
515     break
516     ;;
517     direct)
518 gbeauche 1.32 dnl Requires VOSF screen updates
519 cebix 1.27 if [[ "x$CAN_VOSF" = "xyes" ]]; then
520     ADDRESSING_MODE="direct"
521     WANT_VOSF=yes dnl we can use VOSF and we need it actually
522     DEFINES="$DEFINES -DDIRECT_ADDRESSING"
523     break
524 cebix 1.1 fi
525 cebix 1.27 ;;
526     banks)
527     dnl Default addressing mode
528     ADDRESSING_MODE="memory banks"
529 gbeauche 1.23 break
530 cebix 1.27 ;;
531     *)
532     AC_MSG_ERROR([Internal configure.in script error for $am addressing mode])
533     esac
534     done
535     AC_MSG_RESULT($ADDRESSING_MODE)
536     if [[ "x$ADDRESSING_MODE" = "x" ]]; then
537     AC_MSG_WARN([Sorry, no suitable addressing mode in $ADDRESSING_TEST_ORDER])
538 gbeauche 1.23 ADDRESSING_MODE="memory banks"
539 cebix 1.27 fi
540 cebix 1.8 fi
541 gbeauche 1.23
542 gbeauche 1.32 dnl Enable VOSF screen updates with this feature is requested and feasible
543     if [[ "x$WANT_VOSF" = "xyes" -a "x$CAN_VOSF" = "xyes" ]]; then
544     AC_DEFINE(ENABLE_VOSF)
545     else
546 gbeauche 1.23 WANT_VOSF=no
547 cebix 1.19 fi
548 cebix 1.9
549 cebix 1.3 dnl Check for GAS.
550 cebix 1.1 HAVE_GAS=no
551     AC_MSG_CHECKING(for GAS .p2align feature)
552     cat >conftest.S << EOF
553     .text
554     .p2align 5
555     EOF
556     if $CC conftest.S -c -o conftest.o >/dev/null 2>&1 ; then HAVE_GAS=yes; fi
557     AC_MSG_RESULT($HAVE_GAS)
558    
559 cebix 1.3 dnl Check for GCC 2.7 or higher.
560 cebix 1.1 HAVE_GCC27=no
561     AC_MSG_CHECKING(for GCC 2.7 or higher)
562     AC_EGREP_CPP(yes,
563     [#if __GNUC__ - 1 > 1 || __GNUC_MINOR__ - 1 > 5
564     yes
565     #endif
566     ], [AC_MSG_RESULT(yes); HAVE_GCC27=yes], AC_MSG_RESULT(no))
567    
568 cebix 1.19 dnl Set "-fomit-frame-pointer" on i386 GCC 2.7 or higher.
569     if [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_I386" = "xyes" ]]; then
570 cebix 1.1 CFLAGS="$CFLAGS -fomit-frame-pointer"
571     CXXFLAGS="$CXXFLAGS -fomit-frame-pointer"
572     fi
573    
574 cebix 1.3 dnl Select appropriate CPU source and REGPARAM define.
575 gbeauche 1.23 ASM_OPTIMIZATIONS=none
576 cebix 1.9 CPUSRCS="cpuemu1.cpp cpuemu2.cpp cpuemu3.cpp cpuemu4.cpp cpuemu5.cpp cpuemu6.cpp cpuemu7.cpp cpuemu8.cpp"
577 gbeauche 1.22 FPUSRCS="../uae_cpu/fpp.cpp"
578 cebix 1.1 if [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_I386" = "xyes" ]]; then
579 cebix 1.9 dnl i386 CPU
580 cebix 1.1 DEFINES="$DEFINES -DREGPARAM=\"__attribute__((regparm(3)))\""
581     if [[ "x$HAVE_GAS" = "xyes" ]]; then
582 gbeauche 1.23 ASM_OPTIMIZATIONS=i386
583 gbeauche 1.31 DEFINES="$DEFINES -DX86_ASSEMBLY -DUNALIGNED_PROFITABLE -DOPTIMIZED_FLAGS"
584 gbeauche 1.34 CPUSRCS="cpufast1.s cpufast2.s cpufast3.s cpufast4.s cpufast5.s cpufast6.s cpufast7.s cpufast8.s"
585 gbeauche 1.22 FPUSRCS="../uae_cpu/fpu_x86.cpp"
586 cebix 1.1 fi
587 cebix 1.9 elif [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_SPARC" = "xyes" -a "x$HAVE_GAS" = "xyes" ]]; then
588     dnl SPARC CPU
589 gbeauche 1.23 case "$target_os" in
590     solaris*)
591 cebix 1.9 AC_MSG_CHECKING(SPARC CPU architecture)
592     SPARC_TYPE=`Solaris/which_sparc`
593     AC_MSG_RESULT($SPARC_TYPE)
594     case "$SPARC_TYPE" in
595     SPARC_V8)
596 cebix 1.26 ASM_OPTIMIZATIONS="SPARC V8 architecture"
597 gbeauche 1.31 DEFINES="$DEFINES -DSPARC_V8_ASSEMBLY" dnl -DOPTIMIZED_FLAGS"
598 cebix 1.9 CFLAGS="$CFLAGS -Wa,-Av8"
599     CXXFLAGS="$CXXFLAGS -Wa,-Av8"
600     ;;
601     SPARC_V9)
602 cebix 1.26 ASM_OPTIMIZATIONS="SPARC V9 architecture"
603 gbeauche 1.31 DEFINES="$DEFINES -DSPARC_V9_ASSEMBLY" dnl -DOPTIMIZED_FLAGS"
604 cebix 1.9 CFLAGS="$CFLAGS -Wa,-Av9"
605     CXXFLAGS="$CXXFLAGS -Wa,-Av9"
606     ;;
607     esac
608     ;;
609     esac
610 cebix 1.27 elif [[ "x$WANT_NATIVE_M68K" = "xyes" ]]; then
611 cebix 1.19 dnl Native m68k, no emulation
612 cebix 1.27 CPUINCLUDES="-I../native_cpu"
613     CPUSRCS="asm_support.s"
614 cebix 1.1 fi
615 cebix 1.9
616 gbeauche 1.35 dnl Select appropriate FPU source.
617     dnl 1. Optimized X86 assembly core if target is i386 architecture
618     SAVED_DEFINES=$DEFINES
619     if [[ "x$FPE_CORE" = "xdefault" ]]; then
620     if [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_I386" = "xyes" -a "x$HAVE_GAS" = "xyes" ]]; then
621     DEFINES="$DEFINES -DFPU_X86"
622     FPE_CORE_STR="i386 optimized core"
623     FPUSRCS="../uae_cpu/fpu/fpu_x86.cpp"
624 gbeauche 1.36 else
625     FPE_CORE="uae"
626 gbeauche 1.35 fi
627     fi
628    
629     dnl 2. JIT-FPU only supports IEEE-based implementation.
630     if [[ "x$WANT_JIT_FPU" = "xyes" -a "x$FPE_CORE" != "xieee" ]]; then
631     AC_MSG_WARN([Sorry, JIT-FPU supports only the "ieee" FPE implementation])
632     FPE_CORE="ieee"
633     dnl Restore previous variables. FPE_CORE_STR and FPUSRCS are overwritten
634     DEFINES=$SAVED_DEFINES
635     fi
636    
637     dnl 3. Choose either IEEE-based implementation or the old UAE core
638     if [[ "x$FPE_CORE" = "xieee" ]]; then
639     AC_CHECK_HEADERS(fenv.h)
640     AC_CHECK_FUNCS(feclearexcept fegetexceptflag feraiseexcept fesetexceptflag fetestexcept)
641     AC_CHECK_FUNCS(fegetround fesetround)
642     DEFINES="$DEFINES -DFPU_IEEE"
643     FPE_CORE_STR="ieee-based fpu core"
644     FPUSRCS="../uae_cpu/fpu/fpu_ieee.cpp"
645     elif [[ "x$FPE_CORE" = "xuae" ]]; then
646     DEFINES="$DEFINES -DFPU_UAE"
647     FPE_CORE_STR="original uae core"
648     FPUSRCS="../uae_cpu/fpu/fpu_uae.cpp"
649     fi
650    
651     dnl Check for certain math functions
652     AC_CHECK_FUNCS(atanh)
653     AC_CHECK_FUNCS(isnan isinf) dnl C99
654     AC_CHECK_FUNCS(isnanl isinfl) dnl IEEE ?
655    
656 cebix 1.19 dnl UAE CPU sources for all non-m68k-native architectures.
657     if [[ "x$WANT_NATIVE_M68K" = "xno" ]]; then
658 cebix 1.20 CPUINCLUDES="-I../uae_cpu"
659 gbeauche 1.22 CPUSRCS="../uae_cpu/basilisk_glue.cpp ../uae_cpu/memory.cpp ../uae_cpu/newcpu.cpp ../uae_cpu/readcpu.cpp $FPUSRCS cpustbl.cpp cpudefs.cpp $CPUSRCS"
660 cebix 1.19 fi
661 cebix 1.1
662 gbeauche 1.23 dnl Remove the "-g" option if set for GCC.
663     if [[ "x$HAVE_GCC27" = "xyes" ]]; then
664 cebix 1.26 dnl gb-- Probably not the cleanest way to take
665     CFLAGS=`echo $CFLAGS | sed -e 's/ -g / /;s/^-g / /;s/ -g$/ /;s/^-g$//'`
666     CXXFLAGS=`echo $CXXFLAGS | sed -e 's/ -g / /;s/^-g / /;s/ -g$/ /;s/^-g$//'`
667 gbeauche 1.23 fi
668    
669 cebix 1.3 dnl Generate Makefile.
670 cebix 1.1 AC_SUBST(DEFINES)
671     AC_SUBST(SYSSRCS)
672     AC_SUBST(CPUINCLUDES)
673     AC_SUBST(CPUSRCS)
674     AC_OUTPUT(Makefile)
675 cebix 1.12
676     dnl Print summary.
677     echo
678     echo Basilisk II configuration summary:
679     echo
680     echo XFree86 DGA support .............. : $WANT_XF86_DGA
681 cebix 1.17 echo XFree86 VidMode support .......... : $WANT_XF86_VIDMODE
682 cebix 1.12 echo fbdev DGA support ................ : $WANT_FBDEV_DGA
683 gbeauche 1.23 echo Enable video on SEGV signals ..... : $WANT_VOSF
684 cebix 1.12 echo ESD sound support ................ : $WANT_ESD
685 cebix 1.14 echo GTK user interface ............... : $WANT_GTK
686 cebix 1.12 echo mon debugger support ............. : $WANT_MON
687 cebix 1.19 echo Running m68k code natively ....... : $WANT_NATIVE_M68K
688 gbeauche 1.35 echo Floating-Point emulation core .... : $FPE_CORE_STR
689 gbeauche 1.23 echo Assembly optimizations ........... : $ASM_OPTIMIZATIONS
690     echo Addressing mode .................. : $ADDRESSING_MODE
691 cebix 1.12 echo
692 cebix 1.19 echo "Configuration done. Now type \"make\" (or \"gmake\")."