ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/BasiliskII/src/Unix/configure.in
Revision: 1.32
Committed: 2001-01-28T14:04:32Z (23 years, 9 months ago) by gbeauche
Branch: MAIN
Changes since 1.31: +17 -31 lines
Log Message:
- removed --enable-16bit-vidmode (unused and useless)

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