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.11 by cebix, 1999-10-25T08:07:58Z vs.
Revision 1.37 by cebix, 2001-03-28T16:53:38Z

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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines