1 |
gbeauche |
1.1 |
dnl Process this file with autoconf to produce a configure script. |
2 |
|
|
dnl Written in 2002 by Christian Bauer et al. |
3 |
|
|
|
4 |
|
|
AC_INIT(main_unix.cpp) |
5 |
|
|
AC_PREREQ(2.52) |
6 |
|
|
AC_CONFIG_HEADER(config.h) |
7 |
|
|
|
8 |
|
|
dnl Options. |
9 |
|
|
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 |
|
|
AC_ARG_ENABLE(vosf, [ --enable-vosf enable video on SEGV signals [default=yes]], [WANT_VOSF=$enableval], [WANT_VOSF=yes]) |
13 |
|
|
|
14 |
|
|
dnl FPU emulation core. |
15 |
|
|
AC_ARG_ENABLE(fpe, |
16 |
|
|
[ --enable-fpe=FPE specify which fpu emulator to use [default=auto]], |
17 |
|
|
[ case "$enableval" in |
18 |
|
|
dnl default is always ieee, if architecture has this fp format |
19 |
|
|
auto) FPE_CORE_TEST_ORDER="ieee uae";; |
20 |
|
|
ieee) FPE_CORE_TEST_ORDER="ieee";; |
21 |
|
|
uae) FPE_CORE_TEST_ORDER="uae";; |
22 |
|
|
x86) FPE_CORE_TEST_ORDER="x86";; |
23 |
|
|
*) AC_MSG_ERROR([--enable-fpe takes only one of the following values: auto, x86, ieee, uae]);; |
24 |
|
|
esac |
25 |
|
|
], |
26 |
|
|
[ FPE_CORE_TEST_ORDER="ieee uae" |
27 |
|
|
]) |
28 |
|
|
|
29 |
|
|
dnl Addressing modes. |
30 |
|
|
AC_ARG_ENABLE(addressing, |
31 |
|
|
[ --enable-addressing=AM specify the addressing mode to use [default=fastest]], |
32 |
|
|
[ case "$enableval" in |
33 |
|
|
real) ADDRESSING_TEST_ORDER="real";; |
34 |
|
|
direct) ADDRESSING_TEST_ORDER="direct";; |
35 |
|
|
banks) ADDRESSING_TEST_ORDER="banks";; |
36 |
|
|
fastest)ADDRESSING_TEST_ORDER="direct banks";; |
37 |
|
|
*) AC_MSG_ERROR([--enable-addressing takes only one of the following values: fastest, real, direct, banks]);; |
38 |
|
|
esac |
39 |
|
|
], |
40 |
|
|
[ ADDRESSING_TEST_ORDER="direct banks" |
41 |
|
|
]) |
42 |
|
|
|
43 |
|
|
dnl External packages. |
44 |
|
|
AC_ARG_WITH(esd, [ --with-esd support ESD for sound under Linux/FreeBSD [default=yes]], [WANT_ESD=$withval], [WANT_ESD=yes]) |
45 |
|
|
AC_ARG_WITH(gtk, [ --with-gtk use GTK user interface [default=yes]], [WANT_GTK=$withval], [WANT_GTK=yes]) |
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 (target is host if not cross-compiling). |
53 |
|
|
case "$target_os" in |
54 |
|
|
linux*) OS_TYPE=linux;; |
55 |
|
|
netbsd*) OS_TYPE=netbsd;; |
56 |
|
|
freebsd*) OS_TYPE=freebsd;; |
57 |
|
|
solaris*) OS_TYPE=solaris;; |
58 |
|
|
darwin*) OS_TYPE=darwin;; |
59 |
|
|
*) OS_TYPE=`echo $target_os | sed -e 's/-/_/g' | sed -e 's/\./_/g'`;; |
60 |
|
|
esac |
61 |
|
|
DEFINES="$DEFINES -DOS_$OS_TYPE" |
62 |
|
|
|
63 |
|
|
dnl Target CPU type. |
64 |
|
|
HAVE_I386=no |
65 |
|
|
HAVE_M68K=no |
66 |
|
|
HAVE_SPARC=no |
67 |
|
|
HAVE_POWERPC=no |
68 |
|
|
case "$target_cpu" in |
69 |
|
|
i386* | i486* | i586* | i686* | i786* ) CPU_TYPE=i386 HAVE_I386=yes;; |
70 |
|
|
m68k* ) CPU_TYPE=m68k HAVE_M68K=yes;; |
71 |
|
|
sparc* ) CPU_TYPE=sparc HAVE_SPARC=yes;; |
72 |
|
|
powerpc* ) CPU_TYPE=powerpc HAVE_POWERPC=yes;; |
73 |
|
|
*) CPU_TYPE=`echo $target_cpu | sed -e 's/-/_/g'`;; |
74 |
|
|
esac |
75 |
|
|
DEFINES="$DEFINES -DCPU_$CPU_TYPE" |
76 |
|
|
|
77 |
|
|
dnl Checks for programs. |
78 |
|
|
AC_PROG_CC |
79 |
|
|
AC_PROG_CC_C_O |
80 |
|
|
AC_PROG_CPP |
81 |
|
|
AC_PROG_CXX |
82 |
|
|
AC_PROG_MAKE_SET |
83 |
|
|
AC_PROG_INSTALL |
84 |
|
|
|
85 |
|
|
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 |
|
|
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 |
|
|
CXXFLAGS="$CXXFLAGS -I$mon_srcdir -I$mon_srcdir/disass" |
95 |
|
|
AC_CHECK_LIB(ncurses, tgetent, , |
96 |
|
|
AC_CHECK_LIB(termcap, tgetent, , |
97 |
|
|
AC_CHECK_LIB(termlib, tgetent, , |
98 |
|
|
AC_CHECK_LIB(terminfo, tgetent, , |
99 |
|
|
AC_CHECK_LIB(Hcurses, tgetent, , |
100 |
|
|
AC_CHECK_LIB(curses, tgetent)))))) |
101 |
|
|
AC_CHECK_LIB(readline, readline) |
102 |
|
|
AC_CHECK_HEADERS(readline.h history.h readline/readline.h readline/history.h) |
103 |
|
|
else |
104 |
|
|
AC_MSG_RESULT(no) |
105 |
|
|
AC_MSG_WARN([Could not find mon, ignoring --with-mon.]) |
106 |
|
|
WANT_MON=no |
107 |
|
|
fi |
108 |
|
|
fi |
109 |
|
|
|
110 |
|
|
dnl Checks for libraries. |
111 |
|
|
AC_CHECK_LIB(posix4, sem_init) |
112 |
|
|
AC_CHECK_LIB(rt, timer_create) |
113 |
|
|
|
114 |
|
|
dnl We need X11. |
115 |
|
|
AC_PATH_XTRA |
116 |
|
|
if [[ "x$no_x" = "xyes" ]]; then |
117 |
|
|
AC_MSG_ERROR([You need X11 to run Basilisk II.]) |
118 |
|
|
fi |
119 |
|
|
CFLAGS="$CFLAGS $X_CFLAGS" |
120 |
|
|
CXXFLAGS="$CXXFLAGS $X_CFLAGS" |
121 |
|
|
LIBS="$LIBS $X_PRE_LIBS $X_LIBS -lX11 -lXext $X_EXTRA_LIBS" |
122 |
|
|
|
123 |
|
|
dnl We want pthreads. Try libpthread first, then libc_r (FreeBSD), then PTL. |
124 |
|
|
HAVE_PTHREADS=yes |
125 |
|
|
AC_CHECK_LIB(pthread, pthread_create, , [ |
126 |
|
|
AC_CHECK_LIB(c_r, pthread_create, , [ |
127 |
|
|
AC_CHECK_LIB(PTL, pthread_create, , [ |
128 |
|
|
HAVE_PTHREADS=no |
129 |
|
|
]) |
130 |
|
|
]) |
131 |
|
|
]) |
132 |
|
|
if [[ "x$HAVE_PTHREADS" = "xyes" ]]; then |
133 |
|
|
AC_DEFINE(HAVE_PTHREADS, 1, [Define if pthreads are available.]) |
134 |
|
|
fi |
135 |
|
|
AC_CHECK_FUNCS(pthread_cancel) |
136 |
|
|
AC_CHECK_FUNCS(pthread_mutexattr_setprotocol) |
137 |
|
|
AC_CHECK_FUNCS(pthread_mutexattr_settype) |
138 |
|
|
|
139 |
|
|
dnl If POSIX.4 semaphores are not available, we emulate them with pthread mutexes. |
140 |
|
|
SEMSRC= |
141 |
|
|
AC_CHECK_FUNCS(sem_init, , [ |
142 |
|
|
if test "x$HAVE_PTHREADS" = "xyes"; then |
143 |
|
|
SEMSRC=posix_sem.cpp |
144 |
|
|
fi |
145 |
|
|
]) |
146 |
|
|
|
147 |
|
|
dnl We use DGA (XFree86 or fbdev) if possible. |
148 |
|
|
if [[ "x$WANT_XF86_DGA" = "xyes" ]]; then |
149 |
|
|
AC_CHECK_LIB(Xxf86dga, XF86DGAQueryExtension, [ |
150 |
|
|
AC_DEFINE(ENABLE_XF86_DGA, 1, [Define if using XFree86 DGA extension.]) |
151 |
|
|
LIBS="$LIBS -lXxf86dga" |
152 |
|
|
if [[ "x$WANT_FBDEV_DGA" = "xyes" ]]; then |
153 |
|
|
AC_MSG_WARN([Cannot have both --enable-xf86-dga and --enable-fbdev-dga, ignoring --enable-fbdev-dga.]) |
154 |
|
|
WANT_FBDEV_DGA=no |
155 |
|
|
fi |
156 |
|
|
], [ |
157 |
|
|
AC_MSG_WARN([Could not find XFree86 DGA extension, ignoring --enable-xf86-dga.]) |
158 |
|
|
WANT_XF86_DGA=no |
159 |
|
|
]) |
160 |
|
|
fi |
161 |
|
|
if [[ "x$WANT_FBDEV_DGA" = "xyes" ]]; then |
162 |
|
|
AC_DEFINE(ENABLE_FBDEV_DGA, 1, [Define if using DGA with framebuffer device.]) |
163 |
|
|
fi |
164 |
|
|
|
165 |
|
|
dnl We use XFree86 VidMode if possible. |
166 |
|
|
if [[ "x$WANT_XF86_VIDMODE" = "xyes" ]]; then |
167 |
|
|
AC_CHECK_LIB(Xxf86vm, XF86VidModeQueryExtension, [ |
168 |
|
|
AC_DEFINE(ENABLE_XF86_VIDMODE, 1, [Define if using XFree86 DGA extension.]) |
169 |
|
|
LIBS="$LIBS -lXxf86vm" |
170 |
|
|
], [ |
171 |
|
|
AC_MSG_WARN([Could not find XFree86 VidMode extension, ignoring --enable-xf86-vidmode.]) |
172 |
|
|
WANT_XF86_VIDMODE=no |
173 |
|
|
]) |
174 |
|
|
fi |
175 |
|
|
|
176 |
|
|
dnl We use GTK+ if possible. |
177 |
|
|
UISRCS=../dummy/prefs_editor_dummy.cpp |
178 |
|
|
if [[ "x$WANT_GTK" = "xyes" ]]; then |
179 |
|
|
AM_PATH_GTK(1.2.0, [ |
180 |
|
|
AC_DEFINE(ENABLE_GTK, 1, [Define if using GTK.]) |
181 |
|
|
CXXFLAGS="$CXXFLAGS $GTK_CFLAGS" |
182 |
|
|
LIBS="$LIBS $GTK_LIBS" |
183 |
|
|
UISRCS=prefs_editor_gtk.cpp |
184 |
|
|
B2_PATH_GNOMEUI([ |
185 |
|
|
AC_DEFINE(HAVE_GNOMEUI, 1, [Define if libgnomeui is available.]) |
186 |
|
|
CXXFLAGS="$CXXFLAGS $GNOMEUI_CFLAGS" |
187 |
|
|
LIBS="$LIBS $GNOMEUI_LIBS" |
188 |
|
|
], []) |
189 |
|
|
], [ |
190 |
|
|
AC_MSG_WARN([Could not find GTK+, disabling user interface.]) |
191 |
|
|
WANT_GTK=no |
192 |
|
|
]) |
193 |
|
|
fi |
194 |
|
|
|
195 |
|
|
dnl We use ESD if possible. |
196 |
|
|
if [[ "x$WANT_ESD" = "xyes" ]]; then |
197 |
|
|
AM_PATH_ESD(0.2.8, [ |
198 |
|
|
AC_DEFINE(ENABLE_ESD, 1, [Define is using ESD.]) |
199 |
|
|
CFLAGS="$CFLAGS $ESD_CFLAGS" |
200 |
|
|
CXXFLAGS="$CXXFLAGS $ESD_CFLAGS" |
201 |
|
|
LIBS="$LIBS $ESD_LIBS" |
202 |
|
|
], [ |
203 |
|
|
AC_MSG_WARN([Could not find ESD, disabling ESD support.]) |
204 |
|
|
WANT_ESD=no |
205 |
|
|
]) |
206 |
|
|
fi |
207 |
|
|
|
208 |
|
|
dnl We use 64-bit file size support if possible. |
209 |
|
|
AC_SYS_LARGEFILE |
210 |
|
|
|
211 |
|
|
dnl Checks for header files. |
212 |
|
|
AC_HEADER_STDC |
213 |
|
|
AC_CHECK_HEADERS(unistd.h fcntl.h sys/time.h sys/mman.h) |
214 |
|
|
|
215 |
|
|
dnl Checks for typedefs, structures, and compiler characteristics. |
216 |
|
|
AC_C_BIGENDIAN |
217 |
|
|
AC_C_CONST |
218 |
|
|
AC_C_INLINE |
219 |
|
|
AC_CHECK_SIZEOF(short, 2) |
220 |
|
|
AC_CHECK_SIZEOF(int, 4) |
221 |
|
|
AC_CHECK_SIZEOF(long, 4) |
222 |
|
|
AC_CHECK_SIZEOF(long long, 8) |
223 |
|
|
AC_CHECK_SIZEOF(float, 4) |
224 |
|
|
AC_CHECK_SIZEOF(double, 8) |
225 |
|
|
AC_CHECK_SIZEOF(long double, 12) |
226 |
|
|
AC_CHECK_SIZEOF(void *, 4) |
227 |
|
|
AC_TYPE_OFF_T |
228 |
|
|
AC_CHECK_TYPE(loff_t, off_t) |
229 |
|
|
AC_CHECK_TYPE(caddr_t, [char *]) |
230 |
|
|
AC_TYPE_SIZE_T |
231 |
|
|
AC_TYPE_SIGNAL |
232 |
|
|
AC_HEADER_TIME |
233 |
|
|
AC_STRUCT_TM |
234 |
|
|
|
235 |
|
|
dnl Check whether sys/socket.h defines type socklen_t. |
236 |
|
|
dnl (extracted from ac-archive/Miscellaneous) |
237 |
|
|
AC_CACHE_CHECK([for socklen_t], |
238 |
|
|
ac_cv_type_socklen_t, [ |
239 |
|
|
AC_TRY_COMPILE([ |
240 |
|
|
#include <sys/types.h> |
241 |
|
|
#include <sys/socket.h> |
242 |
|
|
], [socklen_t len = 42; return 0;], |
243 |
|
|
ac_cv_type_socklen_t=yes, ac_cv_type_socklen_t=no, |
244 |
|
|
dnl When cross-compiling, do not assume anything. |
245 |
|
|
ac_cv_type_socklen_t="guessing no" |
246 |
|
|
) |
247 |
|
|
]) |
248 |
|
|
if [[ "x$ac_cv_type_socklen_t" != "xyes" ]]; then |
249 |
|
|
AC_DEFINE(socklen_t, int, [Define to 'int' if <sys/types.h> doesn't define.]) |
250 |
|
|
fi |
251 |
|
|
|
252 |
|
|
dnl Checks for library functions. |
253 |
|
|
AC_CHECK_FUNCS(strdup cfmakeraw) |
254 |
|
|
AC_CHECK_FUNCS(clock_gettime timer_create) |
255 |
|
|
AC_CHECK_FUNCS(sigaction signal) |
256 |
|
|
AC_CHECK_FUNCS(mmap mprotect munmap) |
257 |
|
|
AC_CHECK_FUNCS(vm_allocate vm_deallocate vm_protect) |
258 |
|
|
|
259 |
|
|
dnl Darwin seems to define mach_task_self() instead of task_self(). |
260 |
|
|
AC_CHECK_FUNCS(mach_task_self task_self) |
261 |
|
|
|
262 |
|
|
dnl Check for headers and functions related to pty support (sshpty.c) |
263 |
|
|
dnl From openssh-3.2.2p1 configure.ac |
264 |
|
|
|
265 |
|
|
AC_CHECK_HEADERS(strings.h login.h sys/bsdtty.h sys/stat.h util.h pty.h) |
266 |
|
|
AC_CHECK_FUNCS(_getpty vhangup strlcpy) |
267 |
|
|
|
268 |
|
|
case "$host" in |
269 |
|
|
*-*-hpux10.26) |
270 |
|
|
disable_ptmx_check=yes |
271 |
|
|
;; |
272 |
|
|
*-*-linux*) |
273 |
|
|
no_dev_ptmx=1 |
274 |
|
|
;; |
275 |
|
|
mips-sony-bsd|mips-sony-newsos4) |
276 |
|
|
AC_DEFINE(HAVE_NEWS4, 1, [Define if you are on NEWS-OS (additions from openssh-3.2.2p1, for sshpty.c).]) |
277 |
|
|
;; |
278 |
|
|
*-*-sco3.2v4*) |
279 |
|
|
no_dev_ptmx=1 |
280 |
|
|
;; |
281 |
|
|
*-*-sco3.2v5*) |
282 |
|
|
no_dev_ptmx=1 |
283 |
|
|
;; |
284 |
|
|
esac |
285 |
|
|
|
286 |
|
|
if test -z "$no_dev_ptmx" ; then |
287 |
|
|
if test "x$disable_ptmx_check" != "xyes" ; then |
288 |
|
|
AC_CHECK_FILE([/dev/ptmx], |
289 |
|
|
[ |
290 |
|
|
AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX, 1, [Define if you have /dev/ptmx.]) |
291 |
|
|
have_dev_ptmx=1 |
292 |
|
|
] |
293 |
|
|
) |
294 |
|
|
fi |
295 |
|
|
fi |
296 |
|
|
AC_CHECK_FILE([/dev/ptc], |
297 |
|
|
[ |
298 |
|
|
AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC, 1, [Define if you have /dev/ptc.]) |
299 |
|
|
have_dev_ptc=1 |
300 |
|
|
] |
301 |
|
|
) |
302 |
|
|
|
303 |
|
|
dnl (end of code from openssh-3.2.2p1 configure.ac) |
304 |
|
|
|
305 |
|
|
|
306 |
|
|
dnl Select system-dependant source files. |
307 |
|
|
SERIALSRC=serial_unix.cpp |
308 |
|
|
ETHERSRC=../dummy/ether_dummy.cpp |
309 |
|
|
SCSISRC=../dummy/scsi_dummy.cpp |
310 |
|
|
AUDIOSRC=../dummy/audio_dummy.cpp |
311 |
|
|
EXTRASYSSRCS= |
312 |
|
|
CAN_NATIVE_M68K=no |
313 |
|
|
case "$target_os" in |
314 |
|
|
linux*) |
315 |
|
|
ETHERSRC=ether_unix.cpp |
316 |
|
|
AUDIOSRC=audio_oss_esd.cpp |
317 |
|
|
SCSISRC=Linux/scsi_linux.cpp |
318 |
|
|
;; |
319 |
|
|
freebsd*) |
320 |
|
|
ETHERSRC=ether_unix.cpp |
321 |
|
|
AUDIOSRC=audio_oss_esd.cpp |
322 |
|
|
DEFINES="$DEFINES -DBSD_COMP" |
323 |
|
|
CXXFLAGS="$CXXFLAGS -fpermissive" |
324 |
|
|
dnl Check for the CAM library |
325 |
|
|
AC_CHECK_LIB(cam, cam_open_btl, HAVE_LIBCAM=yes, HAVE_LIBCAM=no) |
326 |
|
|
if [[ "x$HAVE_LIBCAM" = "xno" ]]; then |
327 |
|
|
AC_MSG_WARN([Cannot find libcam for SCSI management, disabling SCSI support.]) |
328 |
|
|
else |
329 |
|
|
dnl Check for the sys kernel includes |
330 |
|
|
AC_CHECK_HEADER(camlib.h) |
331 |
|
|
if [[ "x$ac_cv_header_camlib_h" = "xno" ]]; then |
332 |
|
|
dnl In this case I should fix this thing including a "patch" |
333 |
|
|
dnl to access directly to the functions in the kernel :) --Orlando |
334 |
|
|
AC_MSG_WARN([Cannot find includes for CAM library, disabling SCSI support.]) |
335 |
|
|
else |
336 |
|
|
SCSISRC=FreeBSD/scsi_freebsd.cpp |
337 |
|
|
LIBS="$LIBS -lcam" |
338 |
|
|
DEFINES="$DEFINES -DCAM" |
339 |
|
|
fi |
340 |
|
|
fi |
341 |
|
|
;; |
342 |
|
|
netbsd*) |
343 |
|
|
CAN_NATIVE_M68K=yes |
344 |
|
|
;; |
345 |
|
|
solaris*) |
346 |
|
|
AUDIOSRC=Solaris/audio_solaris.cpp |
347 |
|
|
DEFINES="$DEFINES -DBSD_COMP -D_POSIX_PTHREAD_SEMANTICS" |
348 |
|
|
;; |
349 |
|
|
irix*) |
350 |
|
|
ETHERSRC=ether_unix.cpp |
351 |
|
|
AUDIOSRC=Irix/audio_irix.cpp |
352 |
|
|
EXTRASYSSRCS=Irix/unaligned.c |
353 |
|
|
dnl IRIX headers work fine, but somehow don't define or use "STDC_HEADERS" |
354 |
|
|
DEFINES="$DEFINES -DCRTSCTS=CNEW_RTSCTS -DB230400=B115200 -DSTDC_HEADERS" |
355 |
|
|
LIBS="$LIBS -laudio" |
356 |
|
|
WANT_ESD=no |
357 |
|
|
|
358 |
|
|
dnl Check if our compiler supports -Ofast (MIPSPro) |
359 |
|
|
HAVE_OFAST=no |
360 |
|
|
ocflags="$CFLAGS" |
361 |
|
|
CFLAGS=`echo $CFLAGS | sed -e 's/ -g / -Ofast /;s/^-g /-Ofast /;s/-g$/ -Ofast/;s/^-g$/-Ofast/'` |
362 |
|
|
AC_MSG_CHECKING(if "-Ofast" works) |
363 |
|
|
dnl Do a test compile of an empty function |
364 |
|
|
AC_TRY_COMPILE(,, [AC_MSG_RESULT(yes); HAVE_OFAST=yes], AC_MSG_RESULT(no)) |
365 |
|
|
CFLAGS="$ocflags" |
366 |
|
|
|
367 |
|
|
;; |
368 |
|
|
esac |
369 |
|
|
|
370 |
|
|
dnl Use 68k CPU natively? |
371 |
|
|
WANT_NATIVE_M68K=no |
372 |
|
|
if [[ "x$HAVE_M68K" = "xyes" -a "x$CAN_NATIVE_M68K" = "xyes" ]]; then |
373 |
|
|
AC_DEFINE(ENABLE_NATIVE_M68K, 1, [Define if using native 68k mode.]) |
374 |
|
|
WANT_NATIVE_M68K=yes |
375 |
|
|
fi |
376 |
|
|
|
377 |
|
|
if [[ "x$HAVE_PTHREADS" = "xno" ]]; then |
378 |
|
|
dnl Serial, ethernet and audio support needs pthreads |
379 |
|
|
AC_MSG_WARN([You don't have pthreads, disabling serial, ethernet and audio support.]) |
380 |
|
|
SERIALSRC=../dummy/serial_dummy.cpp |
381 |
|
|
ETHERSRC=../dummy/ether_dummy.cpp |
382 |
|
|
AUDIOSRC=../dummy/audio_dummy.cpp |
383 |
|
|
fi |
384 |
|
|
SYSSRCS="$SERIALSRC $ETHERSRC $SCSISRC $AUDIOSRC $SEMSRC $UISRCS $MONSRCS $EXTRASYSSRCS" |
385 |
|
|
|
386 |
|
|
dnl Define a macro that translates a yesno-variable into a C macro definition |
387 |
|
|
dnl to be put into the config.h file |
388 |
|
|
dnl $1 -- the macro to define |
389 |
|
|
dnl $2 -- the value to translate |
390 |
|
|
dnl $3 -- template name |
391 |
|
|
AC_DEFUN(AC_TRANSLATE_DEFINE, [ |
392 |
|
|
if [[ "x$2" = "xyes" -o "x$2" = "xguessing yes" ]]; then |
393 |
|
|
AC_DEFINE($1, 1, $3) |
394 |
|
|
fi |
395 |
|
|
]) |
396 |
|
|
|
397 |
|
|
dnl Various checks if the system supports vm_allocate() and the like functions. |
398 |
|
|
have_mach_vm=no |
399 |
|
|
if [[ "x$ac_cv_func_vm_allocate" = "xyes" -a "x$ac_cv_func_vm_deallocate" = "xyes" -a \ |
400 |
|
|
"x$ac_cv_func_vm_protect" = "xyes" ]]; then |
401 |
|
|
have_mach_vm=yes |
402 |
|
|
fi |
403 |
|
|
AC_TRANSLATE_DEFINE(HAVE_MACH_VM, "$have_mach_vm", |
404 |
|
|
[Define if your system has a working vm_allocate()-based memory allocator.]) |
405 |
|
|
|
406 |
|
|
dnl Check that vm_allocate(), vm_protect() work |
407 |
|
|
if [[ "x$have_mach_vm" = "xyes" ]]; then |
408 |
|
|
|
409 |
|
|
AC_CACHE_CHECK([whether vm_protect works], |
410 |
|
|
ac_cv_vm_protect_works, [ |
411 |
|
|
AC_LANG_SAVE |
412 |
|
|
AC_LANG_CPLUSPLUS |
413 |
|
|
ac_cv_vm_protect_works=yes |
414 |
|
|
dnl First the tests that should segfault |
415 |
|
|
for test_def in NONE_READ NONE_WRITE READ_WRITE; do |
416 |
|
|
AC_TRY_RUN([ |
417 |
|
|
#define CONFIGURE_TEST_VM_MAP |
418 |
|
|
#define TEST_VM_PROT_$test_def |
419 |
|
|
#include "vm_alloc.cpp" |
420 |
|
|
], ac_cv_vm_protect_works=no, rm -f core, |
421 |
|
|
dnl When cross-compiling, do not assume anything |
422 |
|
|
ac_cv_vm_protect_works="guessing no" |
423 |
|
|
) |
424 |
|
|
done |
425 |
|
|
AC_TRY_RUN([ |
426 |
|
|
#define CONFIGURE_TEST_VM_MAP |
427 |
|
|
#define TEST_VM_PROT_RDWR_WRITE |
428 |
|
|
#include "vm_alloc.cpp" |
429 |
|
|
], , ac_cv_vm_protect_works=no, |
430 |
|
|
dnl When cross-compiling, do not assume anything |
431 |
|
|
ac_cv_vm_protect_works="guessing no" |
432 |
|
|
) |
433 |
|
|
AC_LANG_RESTORE |
434 |
|
|
] |
435 |
|
|
) |
436 |
|
|
|
437 |
|
|
dnl Remove support for vm_allocate() if vm_protect() does not work |
438 |
|
|
if [[ "x$have_mach_vm" = "xyes" ]]; then |
439 |
|
|
case $ac_cv_vm_protect_works in |
440 |
|
|
*yes) have_mach_vm=yes;; |
441 |
|
|
*no) have_mach_vm=no;; |
442 |
|
|
esac |
443 |
|
|
fi |
444 |
|
|
AC_TRANSLATE_DEFINE(HAVE_MACH_VM, "$have_mach_vm", |
445 |
|
|
[Define if your system has a working vm_allocate()-based memory allocator.]) |
446 |
|
|
|
447 |
|
|
fi dnl HAVE_MACH_VM |
448 |
|
|
|
449 |
|
|
dnl Various checks if the system supports mmap() and the like functions. |
450 |
|
|
dnl ... and Mach memory allocators are not supported |
451 |
|
|
have_mmap_vm=no |
452 |
|
|
if [[ "x$ac_cv_func_mmap" = "xyes" -a "x$ac_cv_func_munmap" = "xyes" -a \ |
453 |
|
|
"x$ac_cv_func_mprotect" = "xyes" ]]; then |
454 |
|
|
if [[ "x$have_mach_vm" = "xno" ]]; then |
455 |
|
|
have_mmap_vm=yes |
456 |
|
|
fi |
457 |
|
|
fi |
458 |
|
|
AC_TRANSLATE_DEFINE(HAVE_MMAP_VM, "$have_mmap_vm", |
459 |
|
|
[Define if your system has a working mmap()-based memory allocator.]) |
460 |
|
|
|
461 |
|
|
dnl Check that mmap() and associated functions work. |
462 |
|
|
if [[ "x$have_mmap_vm" = "xyes" ]]; then |
463 |
|
|
|
464 |
|
|
dnl Check if we have a working anonymous mmap() |
465 |
|
|
AC_CACHE_CHECK([whether mmap supports MAP_ANON], |
466 |
|
|
ac_cv_mmap_anon, [ |
467 |
|
|
AC_LANG_SAVE |
468 |
|
|
AC_LANG_CPLUSPLUS |
469 |
|
|
AC_TRY_RUN([ |
470 |
|
|
#define HAVE_MMAP_ANON |
471 |
|
|
#define CONFIGURE_TEST_VM_MAP |
472 |
|
|
#define TEST_VM_MMAP_ANON |
473 |
|
|
#include "vm_alloc.cpp" |
474 |
|
|
], ac_cv_mmap_anon=yes, ac_cv_mmap_anon=no, |
475 |
|
|
dnl When cross-compiling, do not assume anything. |
476 |
|
|
ac_cv_mmap_anon="guessing no" |
477 |
|
|
) |
478 |
|
|
AC_LANG_RESTORE |
479 |
|
|
] |
480 |
|
|
) |
481 |
|
|
AC_TRANSLATE_DEFINE(HAVE_MMAP_ANON, "$ac_cv_mmap_anon", |
482 |
|
|
[Define if <sys/mman.h> defines MAP_ANON and mmap()'ing with MAP_ANON works.]) |
483 |
|
|
|
484 |
|
|
AC_CACHE_CHECK([whether mmap supports MAP_ANONYMOUS], |
485 |
|
|
ac_cv_mmap_anonymous, [ |
486 |
|
|
AC_LANG_SAVE |
487 |
|
|
AC_LANG_CPLUSPLUS |
488 |
|
|
AC_TRY_RUN([ |
489 |
|
|
#define HAVE_MMAP_ANONYMOUS |
490 |
|
|
#define CONFIGURE_TEST_VM_MAP |
491 |
|
|
#define TEST_VM_MMAP_ANON |
492 |
|
|
#include "vm_alloc.cpp" |
493 |
|
|
], ac_cv_mmap_anonymous=yes, ac_cv_mmap_anonymous=no, |
494 |
|
|
dnl When cross-compiling, do not assume anything. |
495 |
|
|
ac_cv_mmap_anonymous="guessing no" |
496 |
|
|
) |
497 |
|
|
AC_LANG_RESTORE |
498 |
|
|
] |
499 |
|
|
) |
500 |
|
|
AC_TRANSLATE_DEFINE(HAVE_MMAP_ANONYMOUS, "$ac_cv_mmap_anonymous", |
501 |
|
|
[Define if <sys/mman.h> defines MAP_ANONYMOUS and mmap()'ing with MAP_ANONYMOUS works.]) |
502 |
|
|
|
503 |
|
|
AC_CACHE_CHECK([whether mprotect works], |
504 |
|
|
ac_cv_mprotect_works, [ |
505 |
|
|
AC_LANG_SAVE |
506 |
|
|
AC_LANG_CPLUSPLUS |
507 |
|
|
ac_cv_mprotect_works=yes |
508 |
|
|
dnl First the tests that should segfault |
509 |
|
|
for test_def in NONE_READ NONE_WRITE READ_WRITE; do |
510 |
|
|
AC_TRY_RUN([ |
511 |
|
|
#define CONFIGURE_TEST_VM_MAP |
512 |
|
|
#define TEST_VM_PROT_$test_def |
513 |
|
|
#include "vm_alloc.cpp" |
514 |
|
|
], ac_cv_mprotect_works=no, rm -f core, |
515 |
|
|
dnl When cross-compiling, do not assume anything |
516 |
|
|
ac_cv_mprotect_works="guessing no" |
517 |
|
|
) |
518 |
|
|
done |
519 |
|
|
AC_TRY_RUN([ |
520 |
|
|
#define CONFIGURE_TEST_VM_MAP |
521 |
|
|
#define TEST_VM_PROT_RDWR_WRITE |
522 |
|
|
#include "vm_alloc.cpp" |
523 |
|
|
], , ac_cv_mprotect_works=no, |
524 |
|
|
dnl When cross-compiling, do not assume anything |
525 |
|
|
ac_cv_mprotect_works="guessing no" |
526 |
|
|
) |
527 |
|
|
AC_LANG_RESTORE |
528 |
|
|
] |
529 |
|
|
) |
530 |
|
|
|
531 |
|
|
dnl Remove support for mmap() if mprotect() does not work |
532 |
|
|
if [[ "x$have_mmap_vm" = "xyes" ]]; then |
533 |
|
|
case $ac_cv_mprotect_works in |
534 |
|
|
*yes) have_mmap_vm=yes;; |
535 |
|
|
*no) have_mmap_vm=no;; |
536 |
|
|
esac |
537 |
|
|
fi |
538 |
|
|
AC_TRANSLATE_DEFINE(HAVE_MMAP_VM, $have_mmap_vm, |
539 |
|
|
[Define if your system has a working mmap()-based memory allocator.]) |
540 |
|
|
|
541 |
|
|
fi dnl HAVE_MMAP_VM |
542 |
|
|
|
543 |
|
|
dnl Check if we can mmap 0x2000 bytes from 0x0000 |
544 |
|
|
AC_CACHE_CHECK([whether we can map Low Memory area 0x0000-0x2000], |
545 |
|
|
ac_cv_can_map_lm, [ |
546 |
|
|
AC_LANG_SAVE |
547 |
|
|
AC_LANG_CPLUSPLUS |
548 |
|
|
AC_TRY_RUN([ |
549 |
|
|
#include "vm_alloc.cpp" |
550 |
|
|
int main(void) { /* returns 0 if we could map the lowmem globals */ |
551 |
|
|
volatile char * lm; |
552 |
|
|
if (vm_init() < 0) exit(1); |
553 |
|
|
if ((lm = (volatile char *)vm_acquire_fixed(0, 0x2000)) == VM_MAP_FAILED) exit(1); |
554 |
|
|
lm[0] = 'z'; |
555 |
|
|
if (vm_release((char *)lm, 0x2000) < 0) exit(1); |
556 |
|
|
vm_exit(); exit(0); |
557 |
|
|
} |
558 |
|
|
], ac_cv_can_map_lm=yes, ac_cv_can_map_lm=no, |
559 |
|
|
dnl When cross-compiling, do not assume anything. |
560 |
|
|
ac_cv_can_map_lm="guessing no" |
561 |
|
|
) |
562 |
|
|
AC_LANG_RESTORE |
563 |
|
|
] |
564 |
|
|
) |
565 |
|
|
|
566 |
|
|
dnl Check signal handlers need to be reinstalled |
567 |
|
|
AC_CACHE_CHECK([whether signal handlers need to be reinstalled], |
568 |
|
|
ac_cv_signal_need_reinstall, [ |
569 |
|
|
AC_LANG_SAVE |
570 |
|
|
AC_LANG_CPLUSPLUS |
571 |
|
|
AC_TRY_RUN([ |
572 |
|
|
#include <stdlib.h> |
573 |
|
|
#ifdef HAVE_UNISTD_H |
574 |
|
|
#include <unistd.h> |
575 |
|
|
#endif |
576 |
|
|
#include <signal.h> |
577 |
|
|
static int handled_signal = 0; |
578 |
|
|
RETSIGTYPE sigusr1_handler(int) { handled_signal++; } |
579 |
|
|
int main(void) { /* returns 0 if signals need not to be reinstalled */ |
580 |
|
|
signal(SIGUSR1, sigusr1_handler); raise(SIGUSR1); raise(SIGUSR1); |
581 |
|
|
exit(handled_signal == 2); |
582 |
|
|
} |
583 |
|
|
], ac_cv_signal_need_reinstall=yes, ac_cv_signal_need_reinstall=no, |
584 |
|
|
dnl When cross-compiling, do not assume anything. |
585 |
|
|
ac_cv_signal_need_reinstall="guessing yes" |
586 |
|
|
) |
587 |
|
|
AC_LANG_RESTORE |
588 |
|
|
] |
589 |
|
|
) |
590 |
|
|
AC_TRANSLATE_DEFINE(SIGNAL_NEED_REINSTALL, "$ac_cv_signal_need_reinstall", |
591 |
|
|
[Define if your system requires signals to be reinstalled.]) |
592 |
|
|
|
593 |
|
|
dnl Check if sigaction handlers need to be reinstalled |
594 |
|
|
AC_CACHE_CHECK([whether sigaction handlers need to be reinstalled], |
595 |
|
|
ac_cv_sigaction_need_reinstall, [ |
596 |
|
|
AC_LANG_SAVE |
597 |
|
|
AC_LANG_CPLUSPLUS |
598 |
|
|
AC_TRY_RUN([ |
599 |
|
|
#include <stdlib.h> |
600 |
|
|
#ifdef HAVE_UNISTD_H |
601 |
|
|
#include <unistd.h> |
602 |
|
|
#endif |
603 |
|
|
#include <signal.h> |
604 |
|
|
static int handled_signal = 0; |
605 |
|
|
RETSIGTYPE sigusr1_handler(int) { handled_signal++; } |
606 |
|
|
typedef RETSIGTYPE (*signal_handler)(int); |
607 |
|
|
static signal_handler mysignal(int sig, signal_handler handler) { |
608 |
|
|
struct sigaction old_sa; |
609 |
|
|
struct sigaction new_sa; |
610 |
|
|
new_sa.sa_handler = handler; |
611 |
|
|
return ((sigaction(sig,&new_sa,&old_sa) < 0) ? SIG_IGN : old_sa.sa_handler); |
612 |
|
|
} |
613 |
|
|
int main(void) { /* returns 0 if signals need not to be reinstalled */ |
614 |
|
|
mysignal(SIGUSR1, sigusr1_handler); raise(SIGUSR1); raise(SIGUSR1); |
615 |
|
|
exit(handled_signal == 2); |
616 |
|
|
} |
617 |
|
|
], ac_cv_sigaction_need_reinstall=yes, ac_cv_sigaction_need_reinstall=no, |
618 |
|
|
dnl When cross-compiling, do not assume anything. |
619 |
|
|
ac_cv_sigaction_need_reinstall="guessing yes" |
620 |
|
|
) |
621 |
|
|
AC_LANG_RESTORE |
622 |
|
|
] |
623 |
|
|
) |
624 |
|
|
AC_TRANSLATE_DEFINE(SIGACTION_NEED_REINSTALL, "$ac_cv_sigaction_need_reinstall", |
625 |
|
|
[Define if your system requires sigactions to be reinstalled.]) |
626 |
|
|
|
627 |
|
|
dnl Check if extended signals are supported. |
628 |
|
|
AC_CACHE_CHECK([whether your system supports extended signal handlers], |
629 |
|
|
ac_cv_have_extended_signals, [ |
630 |
|
|
AC_LANG_SAVE |
631 |
|
|
AC_LANG_CPLUSPLUS |
632 |
|
|
AC_TRY_RUN([ |
633 |
|
|
#define HAVE_SIGINFO_T 1 |
634 |
|
|
#define CONFIGURE_TEST_SIGSEGV_RECOVERY |
635 |
|
|
#include "vm_alloc.cpp" |
636 |
|
|
#include "sigsegv.cpp" |
637 |
|
|
], ac_cv_have_extended_signals=yes, ac_cv_have_extended_signals=no, |
638 |
|
|
dnl When cross-compiling, do not assume anything. |
639 |
|
|
ac_cv_have_extended_signals=no |
640 |
|
|
) |
641 |
|
|
AC_LANG_RESTORE |
642 |
|
|
] |
643 |
|
|
) |
644 |
|
|
AC_TRANSLATE_DEFINE(HAVE_SIGINFO_T, "$ac_cv_have_extended_signals", |
645 |
|
|
[Define if your system support extended signals.]) |
646 |
|
|
|
647 |
|
|
dnl Otherwise, check for subterfuges. |
648 |
|
|
if [[ "x$ac_cv_have_extended_signals" = "xno" ]]; then |
649 |
|
|
AC_CACHE_CHECK([whether we then have a subterfuge for your system], |
650 |
|
|
ac_cv_have_sigcontext_hack, [ |
651 |
|
|
AC_LANG_SAVE |
652 |
|
|
AC_LANG_CPLUSPLUS |
653 |
|
|
AC_TRY_RUN([ |
654 |
|
|
#define HAVE_SIGCONTEXT_SUBTERFUGE 1 |
655 |
|
|
#define CONFIGURE_TEST_SIGSEGV_RECOVERY |
656 |
|
|
#include "vm_alloc.cpp" |
657 |
|
|
#include "sigsegv.cpp" |
658 |
|
|
], ac_cv_have_sigcontext_hack=yes, ac_cv_have_sigcontext_hack=no, |
659 |
|
|
dnl When cross-compiling, do not assume anything. |
660 |
|
|
ac_cv_have_sigcontext_hack=no |
661 |
|
|
) |
662 |
|
|
AC_LANG_RESTORE |
663 |
|
|
]) |
664 |
|
|
AC_TRANSLATE_DEFINE(HAVE_SIGCONTEXT_SUBTERFUGE, "$ac_cv_have_sigcontext_hack", |
665 |
|
|
[Define if we know a hack to replace siginfo_t->si_addr member.]) |
666 |
|
|
fi |
667 |
|
|
|
668 |
|
|
dnl Check if we can ignore the fault (instruction skipping in SIGSEGV handler) |
669 |
|
|
AC_CACHE_CHECK([whether we can skip instruction in SIGSEGV handler], |
670 |
|
|
ac_cv_have_skip_instruction, [ |
671 |
|
|
AC_LANG_SAVE |
672 |
|
|
AC_LANG_CPLUSPLUS |
673 |
|
|
AC_TRY_RUN([ |
674 |
|
|
#define HAVE_SIGSEGV_SKIP_INSTRUCTION 1 |
675 |
|
|
#define CONFIGURE_TEST_SIGSEGV_RECOVERY |
676 |
|
|
#include "vm_alloc.cpp" |
677 |
|
|
#include "sigsegv.cpp" |
678 |
|
|
], ac_cv_have_skip_instruction=yes, ac_cv_have_skip_instruction=no, |
679 |
|
|
dnl When cross-compiling, do not assume anything. |
680 |
|
|
ac_cv_have_skip_instruction=no |
681 |
|
|
) |
682 |
|
|
AC_LANG_RESTORE |
683 |
|
|
] |
684 |
|
|
) |
685 |
|
|
AC_TRANSLATE_DEFINE(HAVE_SIGSEGV_SKIP_INSTRUCTION, "$ac_cv_have_skip_instruction", |
686 |
|
|
[Define if we can ignore the fault (instruction skipping in SIGSEGV handler).]) |
687 |
|
|
|
688 |
|
|
dnl Can we do Video on SEGV Signals ? |
689 |
|
|
CAN_VOSF=no |
690 |
|
|
if [[ "$ac_cv_have_extended_signals" = "yes" -o "$ac_cv_have_sigcontext_hack" = "yes" ]]; then |
691 |
|
|
CAN_VOSF=yes |
692 |
|
|
fi |
693 |
|
|
|
694 |
|
|
dnl Determine the addressing mode to use |
695 |
|
|
if [[ "x$WANT_NATIVE_M68K" = "xyes" ]]; then |
696 |
|
|
ADDRESSING_MODE="real" |
697 |
|
|
else |
698 |
|
|
ADDRESSING_MODE="" |
699 |
|
|
AC_MSG_CHECKING([for the addressing mode to use]) |
700 |
|
|
for am in $ADDRESSING_TEST_ORDER; do |
701 |
|
|
case $am in |
702 |
|
|
real) |
703 |
|
|
dnl Requires ability to mmap() Low Memory globals |
704 |
|
|
if [[ "x$ac_cv_can_map_lm" = "xno" ]]; then |
705 |
|
|
continue |
706 |
|
|
fi |
707 |
|
|
dnl Requires VOSF screen updates |
708 |
|
|
if [[ "x$CAN_VOSF" = "xno" ]]; then |
709 |
|
|
continue |
710 |
|
|
fi |
711 |
|
|
dnl Real addressing will probably work. |
712 |
|
|
ADDRESSING_MODE="real" |
713 |
|
|
WANT_VOSF=yes dnl we can use VOSF and we need it actually |
714 |
|
|
DEFINES="$DEFINES -DREAL_ADDRESSING" |
715 |
|
|
break |
716 |
|
|
;; |
717 |
|
|
direct) |
718 |
|
|
dnl Requires VOSF screen updates |
719 |
|
|
if [[ "x$CAN_VOSF" = "xyes" ]]; then |
720 |
|
|
ADDRESSING_MODE="direct" |
721 |
|
|
WANT_VOSF=yes dnl we can use VOSF and we need it actually |
722 |
|
|
DEFINES="$DEFINES -DDIRECT_ADDRESSING" |
723 |
|
|
break |
724 |
|
|
fi |
725 |
|
|
;; |
726 |
|
|
banks) |
727 |
|
|
dnl Default addressing mode |
728 |
|
|
ADDRESSING_MODE="memory banks" |
729 |
|
|
break |
730 |
|
|
;; |
731 |
|
|
*) |
732 |
|
|
AC_MSG_ERROR([Internal configure.in script error for $am addressing mode]) |
733 |
|
|
esac |
734 |
|
|
done |
735 |
|
|
AC_MSG_RESULT($ADDRESSING_MODE) |
736 |
|
|
if [[ "x$ADDRESSING_MODE" = "x" ]]; then |
737 |
|
|
AC_MSG_WARN([Sorry, no suitable addressing mode in $ADDRESSING_TEST_ORDER]) |
738 |
|
|
ADDRESSING_MODE="memory banks" |
739 |
|
|
fi |
740 |
|
|
fi |
741 |
|
|
|
742 |
|
|
dnl Enable VOSF screen updates with this feature is requested and feasible |
743 |
|
|
if [[ "x$WANT_VOSF" = "xyes" -a "x$CAN_VOSF" = "xyes" ]]; then |
744 |
|
|
AC_DEFINE(ENABLE_VOSF, 1, [Define if using video enabled on SEGV signals.]) |
745 |
|
|
else |
746 |
|
|
WANT_VOSF=no |
747 |
|
|
fi |
748 |
|
|
|
749 |
|
|
dnl Check for GAS. |
750 |
|
|
HAVE_GAS=no |
751 |
|
|
AC_MSG_CHECKING(for GAS .p2align feature) |
752 |
|
|
cat >conftest.S << EOF |
753 |
|
|
.text |
754 |
|
|
.p2align 5 |
755 |
|
|
EOF |
756 |
|
|
if $CC conftest.S -c -o conftest.o >/dev/null 2>&1 ; then HAVE_GAS=yes; fi |
757 |
|
|
AC_MSG_RESULT($HAVE_GAS) |
758 |
|
|
|
759 |
|
|
dnl Check for GCC 2.7 or higher. |
760 |
|
|
HAVE_GCC27=no |
761 |
|
|
AC_MSG_CHECKING(for GCC 2.7 or higher) |
762 |
|
|
AC_EGREP_CPP(yes, |
763 |
|
|
[#if __GNUC__ - 1 > 1 || __GNUC_MINOR__ - 1 > 5 |
764 |
|
|
yes |
765 |
|
|
#endif |
766 |
|
|
], [AC_MSG_RESULT(yes); HAVE_GCC27=yes], AC_MSG_RESULT(no)) |
767 |
|
|
|
768 |
|
|
dnl Check for GCC 3.0 or higher. |
769 |
|
|
HAVE_GCC30=no |
770 |
|
|
AC_MSG_CHECKING(for GCC 3.0 or higher) |
771 |
|
|
AC_EGREP_CPP(yes, |
772 |
|
|
[#if __GNUC__ >= 3 |
773 |
|
|
yes |
774 |
|
|
#endif |
775 |
|
|
], [AC_MSG_RESULT(yes); HAVE_GCC30=yes], AC_MSG_RESULT(no)) |
776 |
|
|
|
777 |
|
|
dnl Set "-fomit-frame-pointer" on i386 GCC 2.7 or higher. |
778 |
|
|
dnl Also set "-fno-exceptions" for C++ because exception handling requires |
779 |
|
|
dnl the frame pointer. |
780 |
|
|
if [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_I386" = "xyes" ]]; then |
781 |
|
|
CFLAGS="$CFLAGS -fomit-frame-pointer" |
782 |
|
|
CXXFLAGS="$CXXFLAGS -fomit-frame-pointer -fno-exceptions" |
783 |
|
|
fi |
784 |
|
|
|
785 |
|
|
dnl (gb) Do not merge constants since it breaks fpu/fpu_x86.cpp. |
786 |
|
|
dnl As of 2001/08/02, this affects the following compilers: |
787 |
|
|
dnl Official: probably gcc-3.1 (mainline CVS) |
788 |
|
|
dnl Mandrake: gcc-2.96 >= 0.59mdk, gcc-3.0.1 >= 0.1mdk |
789 |
|
|
dnl Red Hat : gcc-2.96 >= 89, gcc-3.0 >= 1 |
790 |
|
|
if [[ "x$HAVE_GCC27" = "xyes" ]]; then |
791 |
|
|
SAVED_CXXFLAGS="$CXXFLAGS" |
792 |
|
|
CXXFLAGS="$CXXFLAGS -fno-merge-constants" |
793 |
|
|
AC_CACHE_CHECK([whether GCC supports constants merging], ac_cv_gcc_constants_merging, [ |
794 |
|
|
AC_LANG_SAVE |
795 |
|
|
AC_LANG_CPLUSPLUS |
796 |
|
|
AC_TRY_COMPILE([],[],[ac_cv_gcc_constants_merging=yes],[ac_cv_gcc_constants_merging=no]) |
797 |
|
|
AC_LANG_RESTORE |
798 |
|
|
]) |
799 |
|
|
if [[ "x$ac_cv_gcc_constants_merging" != "xyes" ]]; then |
800 |
|
|
CXXFLAGS="$SAVED_CXXFLAGS" |
801 |
|
|
fi |
802 |
|
|
fi |
803 |
|
|
|
804 |
|
|
dnl Select appropriate CPU source and REGPARAM define. |
805 |
|
|
ASM_OPTIMIZATIONS=none |
806 |
|
|
CPUSRCS="cpuemu1.cpp cpuemu2.cpp cpuemu3.cpp cpuemu4.cpp cpuemu5.cpp cpuemu6.cpp cpuemu7.cpp cpuemu8.cpp" |
807 |
|
|
if [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_I386" = "xyes" -a "x$OS_TYPE" != "xfreebsd" ]]; then |
808 |
|
|
dnl i386 CPU |
809 |
|
|
DEFINES="$DEFINES -DREGPARAM=\"__attribute__((regparm(3)))\"" |
810 |
|
|
if [[ "x$HAVE_GAS" = "xyes" ]]; then |
811 |
|
|
ASM_OPTIMIZATIONS=i386 |
812 |
|
|
DEFINES="$DEFINES -DX86_ASSEMBLY -DUNALIGNED_PROFITABLE -DOPTIMIZED_FLAGS" |
813 |
|
|
CPUSRCS="cpufast1.s cpufast2.s cpufast3.s cpufast4.s cpufast5.s cpufast6.s cpufast7.s cpufast8.s" |
814 |
|
|
fi |
815 |
|
|
elif [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_SPARC" = "xyes" -a "x$HAVE_GAS" = "xyes" ]]; then |
816 |
|
|
dnl SPARC CPU |
817 |
|
|
case "$target_os" in |
818 |
|
|
solaris*) |
819 |
|
|
AC_MSG_CHECKING(SPARC CPU architecture) |
820 |
|
|
SPARC_TYPE=`Solaris/which_sparc` |
821 |
|
|
AC_MSG_RESULT($SPARC_TYPE) |
822 |
|
|
case "$SPARC_TYPE" in |
823 |
|
|
SPARC_V8) |
824 |
|
|
ASM_OPTIMIZATIONS="SPARC V8 architecture" |
825 |
|
|
DEFINES="$DEFINES -DSPARC_V8_ASSEMBLY" dnl -DOPTIMIZED_FLAGS" |
826 |
|
|
CFLAGS="$CFLAGS -Wa,-Av8" |
827 |
|
|
CXXFLAGS="$CXXFLAGS -Wa,-Av8" |
828 |
|
|
;; |
829 |
|
|
SPARC_V9) |
830 |
|
|
ASM_OPTIMIZATIONS="SPARC V9 architecture" |
831 |
|
|
DEFINES="$DEFINES -DSPARC_V9_ASSEMBLY" dnl -DOPTIMIZED_FLAGS" |
832 |
|
|
CFLAGS="$CFLAGS -Wa,-Av9" |
833 |
|
|
CXXFLAGS="$CXXFLAGS -Wa,-Av9" |
834 |
|
|
;; |
835 |
|
|
esac |
836 |
|
|
;; |
837 |
|
|
esac |
838 |
|
|
elif [[ "x$WANT_NATIVE_M68K" = "xyes" ]]; then |
839 |
|
|
dnl Native m68k, no emulation |
840 |
|
|
CPUINCLUDES="-I../native_cpu" |
841 |
|
|
CPUSRCS="asm_support.s" |
842 |
|
|
fi |
843 |
|
|
|
844 |
|
|
dnl Utility macro used by next two tests. |
845 |
|
|
dnl AC_EXAMINE_OBJECT(C source code, |
846 |
|
|
dnl commands examining object file, |
847 |
|
|
dnl [commands to run if compile failed]): |
848 |
|
|
dnl |
849 |
|
|
dnl Compile the source code to an object file; then convert it into a |
850 |
|
|
dnl printable representation. All unprintable characters and |
851 |
|
|
dnl asterisks (*) are replaced by dots (.). All white space is |
852 |
|
|
dnl deleted. Newlines (ASCII 0x10) in the input are preserved in the |
853 |
|
|
dnl output, but runs of newlines are compressed to a single newline. |
854 |
|
|
dnl Finally, line breaks are forcibly inserted so that no line is |
855 |
|
|
dnl longer than 80 columns and the file ends with a newline. The |
856 |
|
|
dnl result of all this processing is in the file conftest.dmp, which |
857 |
|
|
dnl may be examined by the commands in the second argument. |
858 |
|
|
dnl |
859 |
|
|
AC_DEFUN([gcc_AC_EXAMINE_OBJECT], |
860 |
|
|
[AC_LANG_SAVE |
861 |
|
|
AC_LANG_C |
862 |
|
|
dnl Next bit cribbed from AC_TRY_COMPILE. |
863 |
|
|
cat > conftest.$ac_ext <<EOF |
864 |
|
|
[#line __oline__ "configure" |
865 |
|
|
#include "confdefs.h" |
866 |
|
|
$1 |
867 |
|
|
]EOF |
868 |
|
|
if AC_TRY_EVAL(ac_compile); then |
869 |
|
|
od -c conftest.o | |
870 |
|
|
sed ['s/^[0-7]*[ ]*/ / |
871 |
|
|
s/\*/./g |
872 |
|
|
s/ \\n/*/g |
873 |
|
|
s/ [0-9][0-9][0-9]/./g |
874 |
|
|
s/ \\[^ ]/./g'] | |
875 |
|
|
tr -d ' |
876 |
|
|
' | tr -s '*' ' |
877 |
|
|
' | fold | sed '$a\ |
878 |
|
|
' > conftest.dmp |
879 |
|
|
$2 |
880 |
|
|
ifelse($3, , , else |
881 |
|
|
$3 |
882 |
|
|
)dnl |
883 |
|
|
fi |
884 |
|
|
rm -rf conftest* |
885 |
|
|
AC_LANG_RESTORE]) |
886 |
|
|
|
887 |
|
|
dnl Floating point format probe. |
888 |
|
|
dnl The basic concept is the same as the above: grep the object |
889 |
|
|
dnl file for an interesting string. We have to watch out for |
890 |
|
|
dnl rounding changing the values in the object, however; this is |
891 |
|
|
dnl handled by ignoring the least significant byte of the float. |
892 |
|
|
dnl |
893 |
|
|
dnl Does not know about VAX G-float or C4x idiosyncratic format. |
894 |
|
|
dnl It does know about PDP-10 idiosyncratic format, but this is |
895 |
|
|
dnl not presently supported by GCC. S/390 "binary floating point" |
896 |
|
|
dnl is in fact IEEE (but maybe we should have that in EBCDIC as well |
897 |
|
|
dnl as ASCII?) |
898 |
|
|
dnl |
899 |
|
|
AC_DEFUN([gcc_AC_C_FLOAT_FORMAT], |
900 |
|
|
[AC_CACHE_CHECK(floating point format, ac_cv_c_float_format, |
901 |
|
|
[gcc_AC_EXAMINE_OBJECT( |
902 |
|
|
[/* This will not work unless sizeof(double) == 8. */ |
903 |
|
|
extern char sizeof_double_must_be_8 [sizeof(double) == 8 ? 1 : -1]; |
904 |
|
|
|
905 |
|
|
/* This structure must have no internal padding. */ |
906 |
|
|
struct possibility { |
907 |
|
|
char prefix[8]; |
908 |
|
|
double candidate; |
909 |
|
|
char postfix[8]; |
910 |
|
|
}; |
911 |
|
|
|
912 |
|
|
#define C(cand) { "\nformat:", cand, ":tamrof\n" } |
913 |
|
|
struct possibility table [] = |
914 |
|
|
{ |
915 |
|
|
C( 3.25724264705901305206e+01), /* @@IEEEFP - IEEE 754 */ |
916 |
|
|
C( 3.53802595280598432000e+18), /* D__float - VAX */ |
917 |
|
|
C( 5.32201830133125317057e-19), /* D.PDP-10 - PDP-10 - the dot is 0x13a */ |
918 |
|
|
C( 1.77977764695171661377e+10), /* IBMHEXFP - s/390 format, ascii */ |
919 |
|
|
C(-5.22995989424860458374e+10) /* IBMHEXFP - s/390 format, EBCDIC */ |
920 |
|
|
};], |
921 |
|
|
[if grep 'format:.@IEEEF.:tamrof' conftest.dmp >/dev/null 2>&1; then |
922 |
|
|
ac_cv_c_float_format='IEEE (big-endian)' |
923 |
|
|
elif grep 'format:.I@@PFE.:tamrof' conftest.dmp >/dev/null 2>&1; then |
924 |
|
|
ac_cv_c_float_format='IEEE (big-endian)' |
925 |
|
|
elif grep 'format:.FEEEI@.:tamrof' conftest.dmp >/dev/null 2>&1; then |
926 |
|
|
ac_cv_c_float_format='IEEE (little-endian)' |
927 |
|
|
elif grep 'format:.EFP@@I.:tamrof' conftest.dmp >/dev/null 2>&1; then |
928 |
|
|
ac_cv_c_float_format='IEEE (little-endian)' |
929 |
|
|
elif grep 'format:.__floa.:tamrof' conftest.dmp >/dev/null 2>&1; then |
930 |
|
|
ac_cv_c_float_format='VAX D-float' |
931 |
|
|
elif grep 'format:..PDP-1.:tamrof' conftest.dmp >/dev/null 2>&1; then |
932 |
|
|
ac_cv_c_float_format='PDP-10' |
933 |
|
|
elif grep 'format:.BMHEXF.:tamrof' conftest.dmp >/dev/null 2>&1; then |
934 |
|
|
ac_cv_c_float_format='IBM 370 hex' |
935 |
|
|
else |
936 |
|
|
AC_MSG_ERROR(Unknown floating point format) |
937 |
|
|
fi], |
938 |
|
|
[AC_MSG_ERROR(compile failed)]) |
939 |
|
|
]) |
940 |
|
|
# IEEE is the default format. If the float endianness isn't the same |
941 |
|
|
# as the integer endianness, we have to set FLOAT_WORDS_BIG_ENDIAN |
942 |
|
|
# (which is a tristate: yes, no, default). This is only an issue with |
943 |
|
|
# IEEE; the other formats are only supported by a few machines each, |
944 |
|
|
# all with the same endianness. |
945 |
|
|
format=IEEE_FLOAT_FORMAT |
946 |
|
|
fbigend= |
947 |
|
|
case $ac_cv_c_float_format in |
948 |
|
|
'IEEE (big-endian)' ) |
949 |
|
|
if test $ac_cv_c_bigendian = no; then |
950 |
|
|
fbigend=1 |
951 |
|
|
fi |
952 |
|
|
;; |
953 |
|
|
'IEEE (little-endian)' ) |
954 |
|
|
if test $ac_cv_c_bigendian = yes; then |
955 |
|
|
fbigend=0 |
956 |
|
|
fi |
957 |
|
|
;; |
958 |
|
|
'VAX D-float' ) |
959 |
|
|
format=VAX_FLOAT_FORMAT |
960 |
|
|
;; |
961 |
|
|
'PDP-10' ) |
962 |
|
|
format=PDP10_FLOAT_FORMAT |
963 |
|
|
;; |
964 |
|
|
'IBM 370 hex' ) |
965 |
|
|
format=IBM_FLOAT_FORMAT |
966 |
|
|
;; |
967 |
|
|
esac |
968 |
|
|
AC_DEFINE_UNQUOTED(HOST_FLOAT_FORMAT, $format, |
969 |
|
|
[Define to the floating point format of the host machine.]) |
970 |
|
|
if test -n "$fbigend"; then |
971 |
|
|
AC_DEFINE_UNQUOTED(HOST_FLOAT_WORDS_BIG_ENDIAN, $fbigend, |
972 |
|
|
[Define to 1 if the host machine stores floating point numbers in |
973 |
|
|
memory with the word containing the sign bit at the lowest address, |
974 |
|
|
or to 0 if it does it the other way around. |
975 |
|
|
|
976 |
|
|
This macro should not be defined if the ordering is the same as for |
977 |
|
|
multi-word integers.]) |
978 |
|
|
fi |
979 |
|
|
]) |
980 |
|
|
|
981 |
|
|
dnl Select appropriate FPU source. |
982 |
|
|
gcc_AC_C_FLOAT_FORMAT |
983 |
|
|
AC_CHECK_HEADERS(ieee754.h ieeefp.h floatingpoint.h nan.h) |
984 |
|
|
|
985 |
|
|
for fpe in $FPE_CORE_TEST_ORDER; do |
986 |
|
|
case $fpe in |
987 |
|
|
ieee) |
988 |
gbeauche |
1.2 |
case $ac_cv_c_float_format in |
989 |
|
|
IEEE*) |
990 |
gbeauche |
1.1 |
FPE_CORE="IEEE fpu core" |
991 |
|
|
DEFINES="$DEFINES -DFPU_IEEE" |
992 |
|
|
FPUSRCS="../uae_cpu/fpu/fpu_ieee.cpp" |
993 |
|
|
break |
994 |
gbeauche |
1.2 |
;; |
995 |
|
|
esac |
996 |
gbeauche |
1.1 |
;; |
997 |
|
|
x86) |
998 |
|
|
if [[ ":$HAVE_GCC27:$HAVE_I386:$HAVE_GAS:" = ":yes:yes:yes:" ]]; then |
999 |
|
|
FPE_CORE="i387 fpu core" |
1000 |
|
|
DEFINES="$DEFINES -DFPU_X86" |
1001 |
|
|
FPUSRCS="../uae_cpu/fpu/fpu_x86.cpp" |
1002 |
|
|
break |
1003 |
|
|
fi |
1004 |
|
|
;; |
1005 |
|
|
uae) |
1006 |
|
|
FPE_CORE="uae fpu core" |
1007 |
|
|
DEFINES="$DEFINES -DFPU_UAE" |
1008 |
|
|
FPUSRCS="../uae_cpu/fpu/fpu_uae.cpp" |
1009 |
|
|
break |
1010 |
|
|
;; |
1011 |
|
|
*) |
1012 |
|
|
AC_MSG_ERROR([Internal configure.in script error for $fpe fpu core]) |
1013 |
|
|
;; |
1014 |
|
|
esac |
1015 |
|
|
done |
1016 |
|
|
if [[ "x$FPE_CORE" = "x" ]]; then |
1017 |
|
|
AC_MSG_ERROR([Sorry, no suitable FPU core found in $FPE_CORE_TEST_ORDER]) |
1018 |
|
|
fi |
1019 |
|
|
|
1020 |
|
|
dnl Check for certain math functions |
1021 |
|
|
AC_CHECK_FUNCS(atanh) |
1022 |
|
|
AC_CHECK_FUNCS(isnan isinf) dnl C99 |
1023 |
|
|
AC_CHECK_FUNCS(isnanl isinfl) dnl IEEE ? |
1024 |
|
|
|
1025 |
|
|
dnl UAE CPU sources for all non-m68k-native architectures. |
1026 |
|
|
if [[ "x$WANT_NATIVE_M68K" = "xno" ]]; then |
1027 |
|
|
CPUINCLUDES="-I../uae_cpu" |
1028 |
|
|
CPUSRCS="../uae_cpu/basilisk_glue.cpp ../uae_cpu/memory.cpp ../uae_cpu/newcpu.cpp ../uae_cpu/readcpu.cpp $FPUSRCS cpustbl.cpp cpudefs.cpp $CPUSRCS" |
1029 |
|
|
fi |
1030 |
|
|
|
1031 |
|
|
dnl Remove the "-g" option if set for GCC. |
1032 |
|
|
if [[ "x$HAVE_GCC27" = "xyes" ]]; then |
1033 |
|
|
CFLAGS=`echo $CFLAGS | sed -e 's/-g//g'` |
1034 |
|
|
CXXFLAGS=`echo $CXXFLAGS | sed -e 's/-g//g'` |
1035 |
|
|
fi |
1036 |
|
|
|
1037 |
|
|
dnl Or if we have -Ofast |
1038 |
|
|
if [[ "x$HAVE_OFAST" = "xyes" ]]; then |
1039 |
|
|
CFLAGS="`echo $CFLAGS | sed -e 's/-g//g'` -Ofast" |
1040 |
|
|
CXXFLAGS="`echo $CXXFLAGS | sed -e 's/-g//g'` -Ofast" |
1041 |
|
|
CXXFLAGS="-LANG:std $CXXFLAGS" |
1042 |
|
|
LDFLAGS="$LDFLAGS -ipa" |
1043 |
|
|
fi |
1044 |
|
|
|
1045 |
|
|
dnl Generate Makefile. |
1046 |
|
|
AC_SUBST(DEFINES) |
1047 |
|
|
AC_SUBST(SYSSRCS) |
1048 |
|
|
AC_SUBST(CPUINCLUDES) |
1049 |
|
|
AC_SUBST(CPUSRCS) |
1050 |
|
|
AC_OUTPUT(Makefile) |
1051 |
|
|
|
1052 |
|
|
dnl Print summary. |
1053 |
|
|
echo |
1054 |
|
|
echo Basilisk II configuration summary: |
1055 |
|
|
echo |
1056 |
|
|
echo XFree86 DGA support .................... : $WANT_XF86_DGA |
1057 |
|
|
echo XFree86 VidMode support ................ : $WANT_XF86_VIDMODE |
1058 |
|
|
echo fbdev DGA support ...................... : $WANT_FBDEV_DGA |
1059 |
|
|
echo Enable video on SEGV signals ........... : $WANT_VOSF |
1060 |
|
|
echo ESD sound support ...................... : $WANT_ESD |
1061 |
|
|
echo GTK user interface ..................... : $WANT_GTK |
1062 |
|
|
echo mon debugger support ................... : $WANT_MON |
1063 |
|
|
echo Running m68k code natively ............. : $WANT_NATIVE_M68K |
1064 |
|
|
echo Floating-Point emulation core .......... : $FPE_CORE |
1065 |
|
|
echo Assembly optimizations ................. : $ASM_OPTIMIZATIONS |
1066 |
|
|
echo Addressing mode ........................ : $ADDRESSING_MODE |
1067 |
|
|
echo |
1068 |
|
|
echo "Configuration done. Now type \"make\" (or \"gmake\")." |