ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/BasiliskII/src/Unix/configure.ac
Revision: 1.3
Committed: 2002-09-16T15:06:24Z (22 years, 2 months ago) by gbeauche
Branch: MAIN
Changes since 1.2: +1 -0 lines
Log Message:
Conditionalize use of pthread_mutexattr_setpshared() as this is an optional
POSIX feature from _POSIX_THREAD_PROCESS_SHARED group. Besides, Ulrich Drepper
mentions "the kernel support for this option wasn't available until 2.5.7.
Future versions of the thread library will support this option."
<http://people.redhat.com/drepper/posix-option-groups.html>

BTW, this nukes a warning when build on FreeBSD 4.6

File Contents

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