ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/BasiliskII/src/Unix/configure.in
(Generate patch)

Comparing BasiliskII/src/Unix/configure.in (file contents):
Revision 1.10 by cebix, 1999-10-23T17:57:56Z vs.
Revision 1.44 by gbeauche, 2001-06-26T22:35:40Z

# Line 6 | Line 6 | AC_PREREQ(2.12)
6   AC_CONFIG_HEADER(config.h)
7  
8   dnl Options.
9 < WANT_XF86_DGA=yes
10 < WANT_FBDEV_DGA=yes
11 < WANT_ESD=yes
12 < WANT_UI=yes
13 < AC_ARG_ENABLE(xf86-dga, [  --enable-xf86-dga       use the XFree86 DGA extension [default=yes]], [WANT_XF86_DGA=$enableval], [])
14 < AC_ARG_ENABLE(fbdev-dga, [  --enable-fbdev-dga      use direct frame buffer access via /dev/fb [default=yes]], [WANT_FBDEV_DGA=$enableval], [])
15 < AC_ARG_ENABLE(esd, [  --enable-esd            Enlightened Sound Daemon support [default=yes]], [WANT_ESD=$enableval], [])
16 < AC_ARG_ENABLE(ui,  [  --enable-ui             use GTK user interface [default=yes]], [WANT_UI=$enableval], [])
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=which      specify which fpu emulator to use [default=opt]],
17 > [ case "$enableval" in
18 >    default)    FPE_CORE="default";; dnl fpu_x86.cpp if i386 architecture, fpu_uae.cpp otherwise
19 >        uae)            FPE_CORE="uae";;
20 >        *)                      AC_MSG_ERROR([--enable-fpe takes only one of the following values: default, uae]);;
21 >  esac
22 > ],
23 > [ FPE_CORE="default"
24 > ])
25 >
26 > dnl Addressing modes.
27 > AC_ARG_ENABLE(addressing,
28 > [  --enable-addressing=AM  specify the addressing mode to use [default=fastest]],
29 > [ case "$enableval" in
30 >    real)       ADDRESSING_TEST_ORDER="real";;
31 >    direct)     ADDRESSING_TEST_ORDER="direct";;
32 >    banks)      ADDRESSING_TEST_ORDER="banks";;
33 >    fastest)ADDRESSING_TEST_ORDER="direct banks";;
34 >    *)          AC_MSG_ERROR([--enable-addressing takes only one of the following values: fastest, real, direct, banks]);;
35 >  esac
36 > ],
37 > [ ADDRESSING_TEST_ORDER="direct banks"
38 > ])
39 >
40 > dnl External packages.
41 > AC_ARG_WITH(esd,             [  --with-esd              support ESD for sound under Linux/FreeBSD [default=yes]], [WANT_ESD=$withval], [WANT_ESD=yes])
42 > AC_ARG_WITH(gtk,             [  --with-gtk              use GTK user interface [default=yes]], [WANT_GTK=$withval], [WANT_GTK=yes])
43 > AC_ARG_WITH(mon,             [  --with-mon              use mon as debugger [default=yes]], [WANT_MON=$withval], [WANT_MON=yes])
44 >
45 > dnl Canonical system information.
46 > AC_CANONICAL_HOST
47 > AC_CANONICAL_TARGET
48 >
49 > dnl Target OS type (target is host if not cross-compiling).
50 > case "$target_os" in
51 >  linux*)       OS_TYPE=linux;;
52 >  netbsd*)      OS_TYPE=netbsd;;
53 >  freebsd*)     OS_TYPE=freebsd;;
54 >  solaris*)     OS_TYPE=solaris;;
55 >  darwin*)      OS_TYPE=darwin;;
56 >  *)            OS_TYPE=`echo $target_os | sed -e 's/-/_/g' | sed -e 's/\./_/g'`;;
57 > esac
58 > DEFINES="$DEFINES -DOS_$OS_TYPE"
59 >
60 > dnl Target CPU type.
61 > HAVE_I386=no
62 > HAVE_M68K=no
63 > HAVE_SPARC=no
64 > HAVE_POWERPC=no
65 > case "$target_cpu" in
66 >  i386* | i486* | i586* | i686* | i786* ) CPU_TYPE=i386 HAVE_I386=yes;;
67 >  m68k* ) CPU_TYPE=m68k HAVE_M68K=yes;;
68 >  sparc* ) CPU_TYPE=sparc HAVE_SPARC=yes;;
69 >  powerpc* ) CPU_TYPE=powerpc HAVE_POWERPC=yes;;
70 >  *) CPU_TYPE=`echo $target_cpu | sed -e 's/-/_/g'`;;
71 > esac
72 > DEFINES="$DEFINES -DCPU_$CPU_TYPE"
73  
74   dnl Checks for programs.
75   AC_PROG_CC
76 + AC_PROG_CC_C_O
77   AC_PROG_CPP
78   AC_PROG_CXX
79   AC_PROG_MAKE_SET
80   AC_PROG_INSTALL
81  
82 + dnl We use mon if possible.
83 + MONSRCS=
84 + if [[ "x$WANT_MON" = "xyes" ]]; then
85 +  AC_MSG_CHECKING(for mon)
86 +  mon_srcdir=../../../mon/src
87 +  if grep mon_init $mon_srcdir/mon.h >/dev/null 2>/dev/null; then
88 +    AC_MSG_RESULT(yes)
89 +    AC_DEFINE(ENABLE_MON)
90 +    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"
91 +    CXXFLAGS="$CXXFLAGS -I$mon_srcdir -I$mon_srcdir/disass"
92 +    AC_CHECK_LIB(readline, readline)
93 +    AC_CHECK_LIB(termcap, tputs)
94 +    AC_CHECK_HEADERS(readline.h history.h readline/readline.h readline/history.h)
95 +  else
96 +    AC_MSG_RESULT(no)
97 +    AC_MSG_WARN([Could not find mon, ignoring --with-mon.])
98 +    WANT_MON=no
99 +  fi
100 + fi
101 +
102   dnl Checks for libraries.
103   AC_CHECK_LIB(posix4, sem_init)
104  
# Line 34 | Line 111 | CFLAGS="$CFLAGS $X_CFLAGS"
111   CXXFLAGS="$CXXFLAGS $X_CFLAGS"
112   LIBS="$LIBS $X_PRE_LIBS $X_LIBS -lX11 -lXext $X_EXTRA_LIBS"
113  
114 < dnl We need pthreads. Try libpthread first, then libc_r (FreeBSD), then PTL.
114 > dnl We want pthreads. Try libpthread first, then libc_r (FreeBSD), then PTL.
115 > HAVE_PTHREADS=yes
116   AC_CHECK_LIB(pthread, pthread_create, , [
117    AC_CHECK_LIB(c_r, pthread_create, , [
118      AC_CHECK_LIB(PTL, pthread_create, , [
119 <      AC_MSG_ERROR([You need pthreads to run Basilisk II.])
119 >      HAVE_PTHREADS=no
120      ])
121    ])
122   ])
123 + if [[ "x$HAVE_PTHREADS" = "xyes" ]]; then
124 +  AC_DEFINE(HAVE_PTHREADS)
125 + fi
126 + AC_CHECK_FUNCS(pthread_cancel)
127  
128   dnl If POSIX.4 semaphores are not available, we emulate them with pthread mutexes.
129 < SEMSRCS=
129 > SEMSRC=
130   AC_CHECK_FUNCS(sem_init, , [
131 <  SEMSRCS=posix_sem.cpp
131 >  if test "x$HAVE_PTHREADS" = "xyes"; then
132 >    SEMSRC=posix_sem.cpp
133 >  fi
134   ])
135  
136   dnl We use DGA (XFree86 or fbdev) if possible.
137   if [[ "x$WANT_XF86_DGA" = "xyes" ]]; then
138    AC_CHECK_LIB(Xxf86dga, XF86DGAQueryExtension, [
139 <    DEFINES="$DEFINES -DENABLE_XF86_DGA=1"
139 >    AC_DEFINE(ENABLE_XF86_DGA)
140      LIBS="$LIBS -lXxf86dga"
141      if [[ "x$WANT_FBDEV_DGA" = "xyes" ]]; then
142        AC_MSG_WARN([Cannot have both --enable-xf86-dga and --enable-fbdev-dga, ignoring --enable-fbdev-dga.])
# Line 60 | Line 144 | if [[ "x$WANT_XF86_DGA" = "xyes" ]]; the
144      fi
145    ], [
146      AC_MSG_WARN([Could not find XFree86 DGA extension, ignoring --enable-xf86-dga.])
147 <    DEFINES="$DEFINES -DENABLE_XF86_DGA=0"
147 >    WANT_XF86_DGA=no
148    ])
65 else
66  DEFINES="$DEFINES -DENABLE_XF86_DGA=0"
149   fi
150   if [[ "x$WANT_FBDEV_DGA" = "xyes" ]]; then
151 <  DEFINES="$DEFINES -DENABLE_FBDEV_DGA=1"
152 < else
153 <  DEFINES="$DEFINES -DENABLE_FBDEV_DGA=0"
151 >  AC_DEFINE(ENABLE_FBDEV_DGA)
152 > fi
153 >
154 > dnl We use XFree86 VidMode if possible.
155 > if [[ "x$WANT_XF86_VIDMODE" = "xyes" ]]; then
156 >  AC_CHECK_LIB(Xxf86vm, XF86VidModeQueryExtension, [
157 >    AC_DEFINE(ENABLE_XF86_VIDMODE)
158 >    LIBS="$LIBS -lXxf86vm"
159 >  ], [
160 >    AC_MSG_WARN([Could not find XFree86 VidMode extension, ignoring --enable-xf86-vidmode.])
161 >    WANT_XF86_VIDMODE=no
162 >  ])
163   fi
164  
165   dnl We use GTK+ if possible.
166   UISRCS=../dummy/prefs_editor_dummy.cpp
167 < if [[ "x$WANT_UI" = "xyes" ]]; then
167 > if [[ "x$WANT_GTK" = "xyes" ]]; then
168    AM_PATH_GTK(1.2.0, [
169 <    DEFINES="$DEFINES -DENABLE_GTK=1"
169 >    AC_DEFINE(ENABLE_GTK)
170      CFLAGS="$CFLAGS $GTK_CFLAGS"
171      CXXFLAGS="$CXXFLAGS $GTK_CFLAGS"
172      LIBS="$LIBS $GTK_LIBS"
173      UISRCS=prefs_editor_gtk.cpp
174    ], [
175      AC_MSG_WARN([Could not find GTK+, disabling user interface.])
176 <    WANT_UI=no
176 >    WANT_GTK=no
177    ])
178   fi
179  
180   dnl We use ESD if possible.
181   if [[ "x$WANT_ESD" = "xyes" ]]; then
182    AM_PATH_ESD(0.2.8, [
183 <    DEFINES="$DEFINES -DENABLE_ESD=1"
183 >    AC_DEFINE(ENABLE_ESD)
184      CFLAGS="$CFLAGS $ESD_CFLAGS"
185      CXXFLAGS="$CXXFLAGS $ESD_CFLAGS"
186      LIBS="$LIBS $ESD_LIBS"
# Line 101 | Line 192 | fi
192  
193   dnl Checks for header files.
194   AC_HEADER_STDC
195 < AC_CHECK_HEADERS(unistd.h fcntl.h sys/time.h)
195 > AC_CHECK_HEADERS(unistd.h fcntl.h sys/time.h sys/mman.h)
196  
197   dnl Checks for typedefs, structures, and compiler characteristics.
198   AC_C_BIGENDIAN
# Line 111 | Line 202 | AC_CHECK_SIZEOF(short, 2)
202   AC_CHECK_SIZEOF(int, 4)
203   AC_CHECK_SIZEOF(long, 4)
204   AC_CHECK_SIZEOF(long long, 8)
205 + AC_CHECK_SIZEOF(void *, 4)
206   AC_TYPE_OFF_T
207   AC_CHECK_TYPE(loff_t, off_t)
208   AC_TYPE_SIZE_T
209 + AC_TYPE_SIGNAL
210   AC_HEADER_TIME
211   AC_STRUCT_TM
212  
213   dnl Checks for library functions.
214   AC_CHECK_FUNCS(strdup cfmakeraw)
215 < AC_CHECK_FUNCS(nanosleep clock_gettime timer_create)
216 < AC_CHECK_FUNCS(pthread_cancel)
215 > AC_CHECK_FUNCS(clock_gettime timer_create)
216 > AC_CHECK_FUNCS(sigaction signal)
217 > AC_CHECK_FUNCS(mmap mprotect munmap)
218 > AC_CHECK_FUNCS(vm_allocate vm_deallocate vm_protect)
219 >
220 > dnl Darwin seems to define mach_task_self() instead of task_self().
221 > AC_CHECK_FUNCS(mach_task_self task_self)
222  
223   dnl Select system-dependant source files.
224 < SYSSRCS="../dummy/ether_dummy.cpp ../dummy/scsi_dummy.cpp ../dummy/audio_dummy.cpp"
225 < if MACHINE=`uname -a 2>/dev/null`; then
226 <  case "$MACHINE" in
227 <  Linux*)
228 <    SYSSRCS="Linux/ether_linux.cpp Linux/scsi_linux.cpp audio_oss_esd.cpp"
229 <    ;;
230 <  FreeBSD*3.*)
231 <    dnl Check for the CAM library
232 <    AC_CHECK_LIB(cam, cam_open_btl, HAVE_LIBCAM=yes, HAVE_LIBCAM=no)
233 <    if [[ "x$HAVE_LIBCAM" = "xno" ]]; then
234 <      AC_MSG_ERROR([Cannot find libcam for SCSI management.])
224 > SERIALSRC=serial_unix.cpp
225 > ETHERSRC=../dummy/ether_dummy.cpp
226 > SCSISRC=../dummy/scsi_dummy.cpp
227 > AUDIOSRC=../dummy/audio_dummy.cpp
228 > EXTRASYSSRCS=
229 > CAN_NATIVE_M68K=no
230 > case "$target_os" in
231 > linux*)
232 >  ETHERSRC=ether_unix.cpp
233 >  AUDIOSRC=audio_oss_esd.cpp
234 >  SCSISRC=Linux/scsi_linux.cpp
235 >  ;;
236 > freebsd*)
237 >  ETHERSRC=ether_unix.cpp
238 >  AUDIOSRC=audio_oss_esd.cpp
239 >  DEFINES="$DEFINES -DBSD_COMP"
240 >  CXXFLAGS="$CXXFLAGS -fpermissive"
241 >  dnl Check for the CAM library
242 >  AC_CHECK_LIB(cam, cam_open_btl, HAVE_LIBCAM=yes, HAVE_LIBCAM=no)
243 >  if [[ "x$HAVE_LIBCAM" = "xno" ]]; then
244 >    AC_MSG_WARN([Cannot find libcam for SCSI management, disabling SCSI support.])
245 >  else
246 >    dnl Check for the sys kernel includes
247 >    AC_CHECK_HEADER(camlib.h)
248 >    if [[ "x$ac_cv_header_camlib_h" = "xno" ]]; then
249 >      dnl In this case I should fix this thing including a "patch"
250 >      dnl to access directly to the functions in the kernel :) --Orlando
251 >      AC_MSG_WARN([Cannot find includes for CAM library, disabling SCSI support.])
252      else
253 <      dnl Check for the sys kernel includes
139 <      AC_CHECK_HEADER(/sys/cam/cam.h)
140 <      if [[ "x$ac_cv_header__sys_cam_cam_h" = "xno" ]]; then
141 <        dnl In this case I should fix this thing including a "patch"
142 <        dnl to access directly to the functions in the kernel :) --Orlando
143 <        AC_MSG_ERROR([Cannot find kernel includes for CAM library.])
144 <      fi
145 <      SYSSRCS="../dummy/ether_dummy.cpp FreeBSD/scsi_freebsd.cpp audio_oss_esd.cpp"
146 <      CXXFLAGS="$CXXFLAGS -I/sys"
147 <      CFLAGS="$CFLAGS -I/sys"
253 >      SCSISRC=FreeBSD/scsi_freebsd.cpp
254        LIBS="$LIBS -lcam"
255 <      DEFINES="$DEFINES -DBSD_COMP -DCAM"
255 >      DEFINES="$DEFINES -DCAM"
256      fi
257 <    ;;
258 <  FreeBSD*)
259 <    dnl Check for the SCSI library
260 <    AC_CHECK_LIB(scsi, scsi_open, HAVE_LIBSCSI=yes, HAVE_LIBSCSI=no)
261 <    if [[ "x$HAVE_LIBSCSI" = "xno" ]]; then
262 <      AC_MSG_ERROR([Cannot find libscsi for SCSI management.])
263 <    else
264 <      dnl Check for the sys kernel includes
265 <      AC_CHECK_HEADER(scsi.h sys/scsiio.h)
266 <      if [[ "x$ac_cv_header_scsi_h" = "xno" ]]; then
267 <        AC_MSG_ERROR([Cannot find includes for the SCSI library.])
268 <      fi
269 <      SYSSRCS="../dummy/ether_dummy.cpp FreeBSD/scsi_freebsd.cpp ../dummy/audio_dummy.cpp"
270 <      LIBS="$LIBS -lscsi"
271 <      DEFINES="$DEFINES -DBSD_COMP"
257 >  fi
258 >  ;;
259 > netbsd*)
260 >  CAN_NATIVE_M68K=yes
261 >  ;;
262 > solaris*)
263 >  AUDIOSRC=Solaris/audio_solaris.cpp
264 >  DEFINES="$DEFINES -DBSD_COMP -D_POSIX_PTHREAD_SEMANTICS"
265 >  ;;
266 > irix*)
267 >  AUDIOSRC=Irix/audio_irix.cpp
268 >  EXTRASYSSRCS=Irix/unaligned.c
269 >  dnl IRIX headers work fine, but somehow don't define or use "STDC_HEADERS"
270 >  DEFINES="$DEFINES -DCRTSCTS=CNEW_RTSCTS -DB230400=B115200 -DSTDC_HEADERS"
271 >  LIBS="$LIBS -laudio"
272 >
273 >  dnl Check if our compiler supports -Ofast (MIPSPro)
274 >  HAVE_OFAST=no
275 >  ocflags="$CFLAGS"
276 >  CFLAGS=`echo $CFLAGS | sed -e 's/ -g / -Ofast /;s/^-g /-Ofast /;s/-g$/ -Ofast/;s/^-g$/-Ofast/'`
277 >  AC_MSG_CHECKING(if "-Ofast" works)
278 >  dnl Do a test compile of an empty function
279 >  AC_TRY_COMPILE(,, [AC_MSG_RESULT(yes); HAVE_OFAST=yes], AC_MSG_RESULT(no))
280 >  CFLAGS="$ocflags"
281 >
282 >  ;;
283 > esac
284 >
285 > dnl Use 68k CPU natively?
286 > WANT_NATIVE_M68K=no
287 > if [[ "x$HAVE_M68K" = "xyes" -a "x$CAN_NATIVE_M68K" = "xyes" ]]; then
288 >  AC_DEFINE(ENABLE_NATIVE_M68K)
289 >  WANT_NATIVE_M68K=yes
290 > fi
291 >
292 > if [[ "x$HAVE_PTHREADS" = "xno" ]]; then
293 >  dnl Serial, ethernet and audio support needs pthreads
294 >  AC_MSG_WARN([You don't have pthreads, disabling serial, ethernet and audio support.])
295 >  SERIALSRC=../dummy/serial_dummy.cpp
296 >  ETHERSRC=../dummy/ether_dummy.cpp
297 >  AUDIOSRC=../dummy/audio_dummy.cpp
298 > fi
299 > SYSSRCS="$SERIALSRC $ETHERSRC $SCSISRC $AUDIOSRC $SEMSRC $UISRCS $MONSRCS $EXTRASYSSRCS"
300 >
301 > dnl Define a macro that translates a yesno-variable into a C macro definition
302 > dnl to be put into the config.h file
303 > dnl $1 -- the macro to define
304 > dnl $2 -- the value to translate
305 > AC_DEFUN(AC_TRANSLATE_DEFINE, [
306 >    if [[ "x$2" = "xyes" -o "x$2" = "xguessing yes" ]]; then
307 >        AC_DEFINE($1)
308      fi
309 <    ;;
310 <  SunOS*)
311 <    SYSSRCS="../dummy/ether_dummy.cpp ../dummy/scsi_dummy.cpp Solaris/audio_solaris.cpp"
312 <    DEFINES="$DEFINES -DBSD_COMP -D_POSIX_PTHREAD_SEMANTICS"
313 <    ;;
314 <  IRIX*)
315 <    SYSSRCS="../dummy/ether_dummy.cpp ../dummy/scsi_dummy.cpp ../dummy/audio_dummy.cpp Irix/unaligned.c"
316 <    DEFINES="$DEFINES -DCRTSCTS=CNEW_RTSCTS -DB230400=B115200"
317 <    LIBS="$LIBS -lm"
318 <    ;;
309 > ])
310 >
311 > dnl Various checks if the system supports vm_allocate() and the like functions.
312 > have_mach_vm=no
313 > if [[ "x$ac_cv_func_vm_allocate" = "xyes" -a "x$ac_cv_func_vm_deallocate" = "xyes" -a \
314 >      "x$ac_cv_func_vm_protect" = "xyes" ]]; then
315 >  have_mach_vm=yes
316 > fi
317 > AC_TRANSLATE_DEFINE(HAVE_MACH_VM, "$have_mach_vm")
318 >
319 > dnl Check that vm_allocate(), vm_protect() work
320 > if [[ "x$have_mach_vm" = "xyes" ]]; then
321 >
322 > AC_CACHE_CHECK("whether vm_protect works",
323 >  ac_cv_vm_protect_works, [
324 >  AC_LANG_SAVE
325 >  AC_LANG_CPLUSPLUS
326 >  ac_cv_vm_protect_works=yes
327 >  dnl First the tests that should segfault
328 >  for test_def in NONE_READ NONE_WRITE READ_WRITE; do
329 >    AC_TRY_RUN([
330 >      #define CONFIGURE_TEST_VM_MAP
331 >      #define TEST_VM_PROT_$test_def
332 >      #include "vm_alloc.cpp"
333 >    ], ac_cv_vm_protect_works=no, rm -f core,
334 >    dnl When cross-compiling, do not assume anything
335 >    ac_cv_vm_protect_works="guessing no"
336 >    )
337 >  done
338 >  AC_TRY_RUN([
339 >    #define CONFIGURE_TEST_VM_MAP
340 >    #define TEST_VM_PROT_RDWR_WRITE
341 >    #include "vm_alloc.cpp"
342 >  ], , ac_cv_vm_protect_works=no,
343 >  dnl When cross-compiling, do not assume anything
344 >  ac_cv_vm_protect_works="guessing no"
345 >  )
346 >  AC_LANG_RESTORE
347 >  ]
348 > )
349 >
350 > dnl Remove support for vm_allocate() if vm_protect() does not work
351 > if [[ "x$have_mach_vm" = "xyes" ]]; then
352 >  case $ac_cv_vm_protect_works in
353 >    *yes) have_mach_vm=yes;;
354 >    *no) have_mach_vm=no;;
355    esac
356   fi
357 < SYSSRCS="$SYSSRCS $SEMSRCS $UISRCS"
357 > AC_TRANSLATE_DEFINE(HAVE_MACH_VM, "$have_mach_vm")
358  
359 < dnl Check for i386 CPU.
182 < HAVE_I386=no
183 < AC_MSG_CHECKING(for x86 target CPU)
184 < AC_EGREP_CPP(yes,
185 < [
186 < #ifdef __i386__
187 <  yes
188 < #endif
189 < ], [AC_MSG_RESULT(yes); HAVE_I386=yes], AC_MSG_RESULT(no))
359 > fi dnl HAVE_MACH_VM
360  
361 < dnl Check for SPARC CPU.
362 < HAVE_SPARC=no
363 < AC_MSG_CHECKING(for SPARC target CPU)
364 < AC_EGREP_CPP(yes,
365 < [
366 < #ifdef __sparc__
367 <  yes
368 < #endif
369 < ], [AC_MSG_RESULT(yes); HAVE_SPARC=yes], AC_MSG_RESULT(no))
361 > dnl Various checks if the system supports mmap() and the like functions.
362 > dnl ... and Mach memory allocators are not supported
363 > have_mmap_vm=no
364 > if [[ "x$ac_cv_func_mmap" = "xyes" -a "x$ac_cv_func_munmap" = "xyes" -a \
365 >      "x$ac_cv_func_mprotect" = "xyes" ]]; then
366 >  if [[ "x$have_mach_vm" = "xno" ]]; then
367 >    have_mmap_vm=yes
368 >  fi
369 > fi
370 > AC_TRANSLATE_DEFINE(HAVE_MMAP_VM, "$have_mmap_vm")
371 >
372 > dnl Check that mmap() and associated functions work.
373 > if [[ "x$have_mmap_vm" = "xyes" ]]; then
374 >
375 > dnl Check if we have a working anonymous mmap()
376 > AC_CACHE_CHECK("whether mmap supports MAP_ANON",
377 >  ac_cv_mmap_anon, [
378 >  AC_LANG_SAVE
379 >  AC_LANG_CPLUSPLUS
380 >  AC_TRY_RUN([
381 >    #define HAVE_MMAP_ANON
382 >    #define CONFIGURE_TEST_VM_MAP
383 >    #define TEST_VM_MMAP_ANON
384 >    #include "vm_alloc.cpp"
385 >  ], ac_cv_mmap_anon=yes, ac_cv_mmap_anon=no,
386 >  dnl When cross-compiling, do not assume anything.
387 >  ac_cv_mmap_anon="guessing no"
388 >  )
389 >  AC_LANG_RESTORE
390 >  ]
391 > )
392 > AC_TRANSLATE_DEFINE(HAVE_MMAP_ANON, "$ac_cv_mmap_anon")
393 >
394 > AC_CACHE_CHECK("whether mmap supports MAP_ANONYMOUS",
395 >  ac_cv_mmap_anonymous, [
396 >  AC_LANG_SAVE
397 >  AC_LANG_CPLUSPLUS
398 >  AC_TRY_RUN([
399 >    #define HAVE_MMAP_ANONYMOUS
400 >    #define CONFIGURE_TEST_VM_MAP
401 >    #define TEST_VM_MMAP_ANON
402 >    #include "vm_alloc.cpp"
403 >  ], ac_cv_mmap_anonymous=yes, ac_cv_mmap_anonymous=no,
404 >  dnl When cross-compiling, do not assume anything.
405 >  ac_cv_mmap_anonymous="guessing no"
406 >  )
407 >  AC_LANG_RESTORE
408 >  ]
409 > )
410 > AC_TRANSLATE_DEFINE(HAVE_MMAP_ANONYMOUS, "$ac_cv_mmap_anonymous")
411 >
412 > AC_CACHE_CHECK("whether mprotect works",
413 >  ac_cv_mprotect_works, [
414 >  AC_LANG_SAVE
415 >  AC_LANG_CPLUSPLUS
416 >  ac_cv_mprotect_works=yes
417 >  dnl First the tests that should segfault
418 >  for test_def in NONE_READ NONE_WRITE READ_WRITE; do
419 >    AC_TRY_RUN([
420 >      #define CONFIGURE_TEST_VM_MAP
421 >      #define TEST_VM_PROT_$test_def
422 >      #include "vm_alloc.cpp"
423 >    ], ac_cv_mprotect_works=no, rm -f core,
424 >    dnl When cross-compiling, do not assume anything
425 >    ac_cv_mprotect_works="guessing no"
426 >    )
427 >  done
428 >  AC_TRY_RUN([
429 >    #define CONFIGURE_TEST_VM_MAP
430 >    #define TEST_VM_PROT_RDWR_WRITE
431 >    #include "vm_alloc.cpp"
432 >  ], , ac_cv_mprotect_works=no,
433 >  dnl When cross-compiling, do not assume anything
434 >  ac_cv_mprotect_works="guessing no"
435 >  )
436 >  AC_LANG_RESTORE
437 >  ]
438 > )
439 >
440 > dnl Remove support for mmap() if mprotect() does not work
441 > if [[ "x$have_mmap_vm" = "xyes" ]]; then
442 >  case $ac_cv_mprotect_works in
443 >    *yes) have_mmap_vm=yes;;
444 >    *no) have_mmap_vm=no;;
445 >  esac
446 > fi
447 > AC_TRANSLATE_DEFINE(HAVE_MMAP_VM, $have_mmap_vm)
448 >
449 > fi dnl HAVE_MMAP_VM
450 >
451 > dnl Check if we can mmap 0x2000 bytes from 0x0000
452 > AC_CACHE_CHECK("whether we can map Low Memory area 0x0000-0x2000",
453 >  ac_cv_can_map_lm, [
454 >  AC_LANG_SAVE
455 >  AC_LANG_CPLUSPLUS
456 >  AC_TRY_RUN([
457 >    #include "vm_alloc.cpp"
458 >    int main(void) { /* returns 0 if we could map the lowmem globals */
459 >      volatile char * lm;
460 >      if (vm_init() < 0) exit(1);
461 >      if ((lm = (volatile char *)vm_acquire_fixed(0, 0x2000)) == VM_MAP_FAILED) exit(1);
462 >      lm[0] = 'z';
463 >      if (vm_release((char *)lm, 0x2000) < 0) exit(1);
464 >      vm_exit(); exit(0);
465 >    }
466 >  ], ac_cv_can_map_lm=yes, ac_cv_can_map_lm=no,
467 >  dnl When cross-compiling, do not assume anything.
468 >  ac_cv_can_map_lm="guessing no"
469 >  )
470 >  AC_LANG_RESTORE
471 >  ]
472 > )
473 >
474 > dnl Check signal handlers need to be reinstalled
475 > AC_CACHE_CHECK("whether signal handlers need to be reinstalled",
476 >  ac_cv_signal_need_reinstall, [
477 >  AC_LANG_SAVE
478 >  AC_LANG_CPLUSPLUS
479 >  AC_TRY_RUN([
480 >    #include <stdlib.h>
481 >    #ifdef HAVE_UNISTD_H
482 >    #include <unistd.h>
483 >    #endif
484 >    #include <signal.h>
485 >    static int handled_signal = 0;
486 >    RETSIGTYPE sigusr1_handler(int) { handled_signal++; }
487 >    int main(void) { /* returns 0 if signals need not to be reinstalled */
488 >      signal(SIGUSR1, sigusr1_handler); raise(SIGUSR1); raise(SIGUSR1);
489 >      exit(handled_signal == 2);
490 >    }
491 >  ], ac_cv_signal_need_reinstall=yes, ac_cv_signal_need_reinstall=no,
492 >  dnl When cross-compiling, do not assume anything.
493 >  ac_cv_signal_need_reinstall="guessing yes"
494 >  )
495 >  AC_LANG_RESTORE
496 >  ]
497 > )
498 > AC_TRANSLATE_DEFINE(SIGNAL_NEED_REINSTALL, "$ac_cv_signal_need_reinstall")
499 >
500 > dnl Check if sigaction handlers need to be reinstalled
501 > AC_CACHE_CHECK("whether sigaction handlers need to be reinstalled",
502 >  ac_cv_sigaction_need_reinstall, [
503 >  AC_LANG_SAVE
504 >  AC_LANG_CPLUSPLUS
505 >  AC_TRY_RUN([
506 >    #include <stdlib.h>
507 >    #ifdef HAVE_UNISTD_H
508 >    #include <unistd.h>
509 >    #endif
510 >    #include <signal.h>
511 >    static int handled_signal = 0;
512 >    RETSIGTYPE sigusr1_handler(int) { handled_signal++; }
513 >    typedef RETSIGTYPE (*signal_handler)(int);
514 >    static signal_handler mysignal(int sig, signal_handler handler) {
515 >      struct sigaction old_sa;
516 >      struct sigaction new_sa;
517 >      new_sa.sa_handler = handler;
518 >      return ((sigaction(sig,&new_sa,&old_sa) < 0) ? SIG_IGN : old_sa.sa_handler);
519 >    }
520 >    int main(void) { /* returns 0 if signals need not to be reinstalled */
521 >      mysignal(SIGUSR1, sigusr1_handler); raise(SIGUSR1); raise(SIGUSR1);
522 >      exit(handled_signal == 2);
523 >    }
524 >  ], ac_cv_sigaction_need_reinstall=yes, ac_cv_sigaction_need_reinstall=no,
525 >  dnl When cross-compiling, do not assume anything.
526 >  ac_cv_sigaction_need_reinstall="guessing yes"
527 >  )
528 >  AC_LANG_RESTORE
529 >  ]
530 > )
531 > AC_TRANSLATE_DEFINE(SIGACTION_NEED_REINSTALL, "$ac_cv_sigaction_need_reinstall")
532 >
533 > dnl Check if extended signals are supported.
534 > AC_CACHE_CHECK("whether your system supports extended signal handlers",
535 >  ac_cv_have_extended_signals, [
536 >  AC_LANG_SAVE
537 >  AC_LANG_CPLUSPLUS
538 >  AC_TRY_RUN([
539 >    #define HAVE_SIGINFO_T 1
540 >    #define CONFIGURE_TEST_SIGSEGV_RECOVERY
541 >    #include "vm_alloc.cpp"
542 >    #include "sigsegv.cpp"
543 >  ], ac_cv_have_extended_signals=yes, ac_cv_have_extended_signals=no,
544 >  dnl When cross-compiling, do not assume anything.
545 >  ac_cv_have_extended_signals=no
546 >  )
547 >  AC_LANG_RESTORE
548 >  ]
549 > )
550 > AC_TRANSLATE_DEFINE(HAVE_SIGINFO_T, "$ac_cv_have_extended_signals")
551 >
552 > dnl Otherwise, check for subterfuges.
553 > if [[ "x$ac_cv_have_extended_signals" = "xno" ]]; then
554 >  AC_CACHE_CHECK("whether we then have a subterfuge for your system",
555 >  ac_cv_have_sigcontext_hack, [
556 >    AC_LANG_SAVE
557 >    AC_LANG_CPLUSPLUS
558 >    AC_TRY_RUN([
559 >      #define HAVE_SIGCONTEXT_SUBTERFUGE 1
560 >      #define CONFIGURE_TEST_SIGSEGV_RECOVERY
561 >      #include "vm_alloc.cpp"
562 >      #include "sigsegv.cpp"
563 >    ], ac_cv_have_sigcontext_hack=yes, ac_cv_have_sigcontext_hack=no,
564 >    dnl When cross-compiling, do not assume anything.
565 >    ac_cv_have_sigcontext_hack=no
566 >    )
567 >    AC_LANG_RESTORE
568 >  ])
569 >  AC_TRANSLATE_DEFINE(HAVE_SIGCONTEXT_SUBTERFUGE, "$ac_cv_have_sigcontext_hack")
570 > fi
571 >
572 > dnl Can we do Video on SEGV Signals ?
573 > CAN_VOSF=no
574 > if [[ "$ac_cv_have_extended_signals" = "yes" -o "$ac_cv_have_sigcontext_hack" = "yes" ]]; then
575 >  CAN_VOSF=yes
576 > fi
577 >
578 > dnl Determine the addressing mode to use
579 > if [[ "x$WANT_NATIVE_M68K" = "xyes" ]]; then
580 >  ADDRESSING_MODE="real"
581 > else
582 >  ADDRESSING_MODE=""
583 >  AC_MSG_CHECKING([for the addressing mode to use])
584 >  for am in $ADDRESSING_TEST_ORDER; do
585 >    case $am in
586 >    real)
587 >      dnl Requires ability to mmap() Low Memory globals
588 >      if [[ "x$ac_cv_can_map_lm" = "xno" ]]; then
589 >        continue
590 >      fi
591 >          dnl Requires VOSF screen updates
592 >      if [[ "x$CAN_VOSF" = "xno" ]]; then
593 >        continue
594 >      fi
595 >      dnl Real addressing will probably work.
596 >      ADDRESSING_MODE="real"
597 >      WANT_VOSF=yes dnl we can use VOSF and we need it actually
598 >      DEFINES="$DEFINES -DREAL_ADDRESSING"
599 >      break
600 >      ;;
601 >    direct)
602 >      dnl Requires VOSF screen updates
603 >      if [[ "x$CAN_VOSF" = "xyes" ]]; then
604 >        ADDRESSING_MODE="direct"
605 >        WANT_VOSF=yes dnl we can use VOSF and we need it actually
606 >        DEFINES="$DEFINES -DDIRECT_ADDRESSING"
607 >        break
608 >      fi
609 >      ;;
610 >    banks)
611 >      dnl Default addressing mode
612 >      ADDRESSING_MODE="memory banks"
613 >      break
614 >      ;;
615 >    *)
616 >      AC_MSG_ERROR([Internal configure.in script error for $am addressing mode])
617 >    esac
618 >  done
619 >  AC_MSG_RESULT($ADDRESSING_MODE)
620 >  if [[ "x$ADDRESSING_MODE" = "x" ]]; then
621 >    AC_MSG_WARN([Sorry, no suitable addressing mode in $ADDRESSING_TEST_ORDER])
622 >    ADDRESSING_MODE="memory banks"
623 >  fi
624 > fi
625 >
626 > dnl Enable VOSF screen updates with this feature is requested and feasible
627 > if [[ "x$WANT_VOSF" = "xyes" -a "x$CAN_VOSF" = "xyes" ]]; then
628 >    AC_DEFINE(ENABLE_VOSF)
629 > else
630 >    WANT_VOSF=no
631 > fi
632  
633   dnl Check for GAS.
634   HAVE_GAS=no
# Line 217 | Line 649 | AC_EGREP_CPP(yes,
649   #endif
650   ], [AC_MSG_RESULT(yes); HAVE_GCC27=yes], AC_MSG_RESULT(no))
651  
652 < dnl Set "-fomit-frame-pointer" on GCC 2.7 or higher.
653 < if [[ "x$HAVE_GCC27" = "xyes" ]]; then
652 > dnl Set "-fomit-frame-pointer" on i386 GCC 2.7 or higher.
653 > if [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_I386" = "xyes" ]]; then
654    CFLAGS="$CFLAGS -fomit-frame-pointer"
655    CXXFLAGS="$CXXFLAGS -fomit-frame-pointer"
656   fi
657  
658   dnl Select appropriate CPU source and REGPARAM define.
659 + ASM_OPTIMIZATIONS=none
660   CPUSRCS="cpuemu1.cpp cpuemu2.cpp cpuemu3.cpp cpuemu4.cpp cpuemu5.cpp cpuemu6.cpp cpuemu7.cpp cpuemu8.cpp"
661 < if [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_I386" = "xyes" ]]; then
661 > FPUSRCS="../uae_cpu/fpu/fpu_uae.cpp"
662 > if [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_I386" = "xyes" -a "x$OS_TYPE" != "xfreebsd" ]]; then
663    dnl i386 CPU
664    DEFINES="$DEFINES -DREGPARAM=\"__attribute__((regparm(3)))\""
665    if [[ "x$HAVE_GAS" = "xyes" ]]; then
666 <    DEFINES="$DEFINES -DX86_ASSEMBLY"
666 >    ASM_OPTIMIZATIONS=i386
667 >    DEFINES="$DEFINES -DX86_ASSEMBLY -DUNALIGNED_PROFITABLE -DOPTIMIZED_FLAGS"
668      CPUSRCS="cpufast1.s cpufast2.s cpufast3.s cpufast4.s cpufast5.s cpufast6.s cpufast7.s cpufast8.s"
669 +    FPUSRCS="../uae_cpu/fpu_x86.cpp"
670    fi
671   elif [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_SPARC" = "xyes" -a "x$HAVE_GAS" = "xyes" ]]; then
672    dnl SPARC CPU
673 <  case "$MACHINE" in
674 <  SunOS*)
673 >  case "$target_os" in
674 >  solaris*)
675      AC_MSG_CHECKING(SPARC CPU architecture)
676      SPARC_TYPE=`Solaris/which_sparc`
677      AC_MSG_RESULT($SPARC_TYPE)
678      case "$SPARC_TYPE" in
679      SPARC_V8)
680 <      DEFINES="$DEFINES -DSPARC_V8_ASSEMBLY"
680 >      ASM_OPTIMIZATIONS="SPARC V8 architecture"
681 >      DEFINES="$DEFINES -DSPARC_V8_ASSEMBLY" dnl -DOPTIMIZED_FLAGS"
682        CFLAGS="$CFLAGS -Wa,-Av8"
683        CXXFLAGS="$CXXFLAGS -Wa,-Av8"
684        ;;
685      SPARC_V9)
686 <      DEFINES="$DEFINES -DSPARC_V9_ASSEMBLY"
686 >      ASM_OPTIMIZATIONS="SPARC V9 architecture"
687 >      DEFINES="$DEFINES -DSPARC_V9_ASSEMBLY" dnl -DOPTIMIZED_FLAGS"
688        CFLAGS="$CFLAGS -Wa,-Av9"
689        CXXFLAGS="$CXXFLAGS -Wa,-Av9"
690        ;;
691      esac
692      ;;
693    esac
694 + elif [[ "x$WANT_NATIVE_M68K" = "xyes" ]]; then
695 +  dnl Native m68k, no emulation
696 +  CPUINCLUDES="-I../native_cpu"
697 +  CPUSRCS="asm_support.s"
698   fi
699  
700 < dnl UAE CPU sources for all architectures.
701 < CPUINCLUDES="-I../uae_cpu"
702 < CPUSRCS="../uae_cpu/basilisk_glue.cpp ../uae_cpu/memory.cpp ../uae_cpu/newcpu.cpp ../uae_cpu/readcpu.cpp ../uae_cpu/fpp.cpp cpustbl.cpp cpudefs.cpp $CPUSRCS"
700 > dnl Select appropriate FPU source.
701 > dnl 1. Optimized X86 assembly core if target is i386 architecture
702 > SAVED_DEFINES=$DEFINES
703 > if [[ "x$FPE_CORE" = "xdefault" ]]; then
704 >  if [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_I386" = "xyes" -a "x$HAVE_GAS" = "xyes" ]]; then
705 >    DEFINES="$DEFINES -DFPU_X86"
706 >    FPE_CORE_STR="i386 optimized core"
707 >    FPUSRCS="../uae_cpu/fpu/fpu_x86.cpp"
708 >  else
709 >    FPE_CORE="uae"
710 >  fi
711 > fi
712 >
713 > dnl 2. JIT-FPU only supports IEEE-based implementation.
714 > if [[ "x$WANT_JIT_FPU" = "xyes" -a "x$FPE_CORE" != "xieee" ]]; then
715 >  AC_MSG_WARN([Sorry, JIT-FPU supports only the "ieee" FPE implementation])
716 >  FPE_CORE="ieee"
717 >  dnl Restore previous variables. FPE_CORE_STR and FPUSRCS are overwritten
718 >  DEFINES=$SAVED_DEFINES
719 > fi
720 >
721 > dnl 3. Choose either IEEE-based implementation or the old UAE core
722 > if [[ "x$FPE_CORE" = "xieee" ]]; then
723 >  AC_CHECK_HEADERS(fenv.h)
724 >  AC_CHECK_FUNCS(feclearexcept fegetexceptflag feraiseexcept fesetexceptflag fetestexcept)
725 >  AC_CHECK_FUNCS(fegetround fesetround)
726 >  DEFINES="$DEFINES -DFPU_IEEE"
727 >  FPE_CORE_STR="ieee-based fpu core"
728 >  FPUSRCS="../uae_cpu/fpu/fpu_ieee.cpp"
729 > elif [[ "x$FPE_CORE" = "xuae" ]]; then
730 >  DEFINES="$DEFINES -DFPU_UAE"
731 >  FPE_CORE_STR="original uae core"
732 >  FPUSRCS="../uae_cpu/fpu/fpu_uae.cpp"
733 > fi
734 >
735 > dnl Check for certain math functions
736 > AC_CHECK_FUNCS(atanh)
737 > AC_CHECK_FUNCS(isnan isinf)             dnl C99
738 > AC_CHECK_FUNCS(isnanl isinfl)   dnl IEEE ?
739 >
740 > dnl UAE CPU sources for all non-m68k-native architectures.
741 > if [[ "x$WANT_NATIVE_M68K" = "xno" ]]; then
742 >  CPUINCLUDES="-I../uae_cpu"
743 >  CPUSRCS="../uae_cpu/basilisk_glue.cpp ../uae_cpu/memory.cpp ../uae_cpu/newcpu.cpp ../uae_cpu/readcpu.cpp $FPUSRCS cpustbl.cpp cpudefs.cpp $CPUSRCS"
744 > fi
745 >
746 > dnl Remove the "-g" option if set for GCC.
747 > if [[ "x$HAVE_GCC27" = "xyes" ]]; then
748 >  CFLAGS=`echo $CFLAGS | sed -e 's/-g//g'`
749 >  CXXFLAGS=`echo $CXXFLAGS | sed -e 's/-g//g'`
750 > fi
751 >
752 > dnl Or if we have -Ofast
753 > if [[ "x$HAVE_OFAST" = "xyes" ]]; then
754 >  CFLAGS="`echo $CFLAGS | sed -e 's/-g//g'` -Ofast"
755 >  CXXFLAGS="`echo $CXXFLAGS | sed -e 's/-g//g'` -Ofast"
756 >  CXXFLAGS="-LANG:std $CXXFLAGS"
757 >  LDFLAGS="$LDFLAGS -Ofast"
758 > fi
759  
760   dnl Generate Makefile.
761   AC_SUBST(DEFINES)
# Line 265 | Line 763 | AC_SUBST(SYSSRCS)
763   AC_SUBST(CPUINCLUDES)
764   AC_SUBST(CPUSRCS)
765   AC_OUTPUT(Makefile)
766 < echo "Configuration done. Now type \"make\"."
766 >
767 > dnl Print summary.
768 > echo
769 > echo Basilisk II configuration summary:
770 > echo
771 > echo XFree86 DGA support .............. : $WANT_XF86_DGA
772 > echo XFree86 VidMode support .......... : $WANT_XF86_VIDMODE
773 > echo fbdev DGA support ................ : $WANT_FBDEV_DGA
774 > echo Enable video on SEGV signals ..... : $WANT_VOSF
775 > echo ESD sound support ................ : $WANT_ESD
776 > echo GTK user interface ............... : $WANT_GTK
777 > echo mon debugger support ............. : $WANT_MON
778 > echo Running m68k code natively ....... : $WANT_NATIVE_M68K
779 > echo Floating-Point emulation core .... : $FPE_CORE_STR
780 > echo Assembly optimizations ........... : $ASM_OPTIMIZATIONS
781 > echo Addressing mode .................. : $ADDRESSING_MODE
782 > echo
783 > echo "Configuration done. Now type \"make\" (or \"gmake\")."

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines