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.16 by cebix, 1999-11-03T10:56:28Z vs.
Revision 1.39 by cebix, 2001-04-10T18:33:57Z

# Line 6 | Line 6 | AC_PREREQ(2.12)
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(fbdev-dga, [  --enable-fbdev-dga      use direct frame buffer access via /dev/fb [default=yes]], [WANT_FBDEV_DGA=$enableval], [WANT_FBDEV_DGA=yes])
11 < AC_ARG_WITH(esd,       [  --with-esd              support ESD for sound under Linux/FreeBSD [default=yes]], [WANT_ESD=$withval], [WANT_ESD=yes])
12 < AC_ARG_WITH(gtk,       [  --with-gtk              use GTK user interface [default=yes]], [WANT_GTK=$withval], [WANT_GTK=yes])
13 < AC_ARG_WITH(mon,       [  --with-mon              use mon as debugger [default=yes]], [WANT_MON=$withval], [WANT_MON=yes])
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 21 | 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 <  WANT_MON=yes
87 <  DEFINES="$DEFINES -DENABLE_MON=1"
88 <  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"
89 <  CXXFLAGS="$CXXFLAGS -I../../../mon/src"
90 <  AC_CHECK_LIB(readline, readline)
91 <  AC_CHECK_HEADERS(readline/readline.h readline/history.h)
92 < else
93 <  AC_MSG_RESULT(no)
94 <  WANT_MON=no
95 <  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 48 | 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 75 | Line 144 | if [[ "x$WANT_XF86_DGA" = "xyes" ]]; the
144    ], [
145      AC_MSG_WARN([Could not find XFree86 DGA extension, ignoring --enable-xf86-dga.])
146      WANT_XF86_DGA=no
78    DEFINES="$DEFINES -DENABLE_XF86_DGA=0"
147    ])
80 else
81  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_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"
# Line 98 | Line 173 | if [[ "x$WANT_GTK" = "xyes" ]]; then
173    ], [
174      AC_MSG_WARN([Could not find GTK+, disabling user interface.])
175      WANT_GTK=no
101    DEFINES="$DEFINES -DENABLE_GTK=0"
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"
186    ], [
187      AC_MSG_WARN([Could not find ESD, disabling ESD support.])
188      WANT_ESD=no
115    DEFINES="$DEFINES -DENABLE_ESD=0"
189    ])
190   fi
191  
# Line 128 | 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)
140 < 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=ether_unix.cpp
226 >  AUDIOSRC=audio_oss_esd.cpp
227 >  SCSISRC=Linux/scsi_linux.cpp
228 >  ;;
229 > freebsd*)
230 >  ETHERSRC=ether_unix.cpp
231 >  AUDIOSRC=audio_oss_esd.cpp
232 >  DEFINES="$DEFINES -DBSD_COMP"
233 >  CXXFLAGS="$CXXFLAGS -fpermissive"
234 >  dnl Check for the CAM library
235 >  AC_CHECK_LIB(cam, cam_open_btl, HAVE_LIBCAM=yes, HAVE_LIBCAM=no)
236 >  if [[ "x$HAVE_LIBCAM" = "xno" ]]; then
237 >    AC_MSG_WARN([Cannot find libcam for SCSI management, disabling SCSI support.])
238 >  else
239 >    dnl Check for the sys kernel includes
240 >    AC_CHECK_HEADER(camlib.h)
241 >    if [[ "x$ac_cv_header_camlib_h" = "xno" ]]; then
242 >      dnl In this case I should fix this thing including a "patch"
243 >      dnl to access directly to the functions in the kernel :) --Orlando
244 >      AC_MSG_WARN([Cannot find includes for CAM library, disabling SCSI support.])
245      else
246 <      dnl Check for the sys kernel includes
156 <      AC_CHECK_HEADER(/sys/cam/cam.h)
157 <      if [[ "x$ac_cv_header__sys_cam_cam_h" = "xno" ]]; then
158 <        dnl In this case I should fix this thing including a "patch"
159 <        dnl to access directly to the functions in the kernel :) --Orlando
160 <        AC_MSG_ERROR([Cannot find kernel includes for CAM library.])
161 <      fi
162 <      SYSSRCS="../dummy/ether_dummy.cpp FreeBSD/scsi_freebsd.cpp audio_oss_esd.cpp"
163 <      CXXFLAGS="$CXXFLAGS -I/sys"
164 <      CFLAGS="$CFLAGS -I/sys"
246 >      SCSISRC=FreeBSD/scsi_freebsd.cpp
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.])
256 <    else
257 <      dnl Check for the sys kernel includes
258 <      AC_CHECK_HEADER(scsi.h sys/scsiio.h)
259 <      if [[ "x$ac_cv_header_scsi_h" = "xno" ]]; then
260 <        AC_MSG_ERROR([Cannot find includes for the SCSI library.])
261 <      fi
262 <      SYSSRCS="../dummy/ether_dummy.cpp FreeBSD/scsi_freebsd.cpp ../dummy/audio_dummy.cpp"
263 <      LIBS="$LIBS -lscsi"
264 <      DEFINES="$DEFINES -DBSD_COMP"
250 >  fi
251 >  ;;
252 > netbsd*)
253 >  CAN_NATIVE_M68K=yes
254 >  ;;
255 > solaris*)
256 >  AUDIOSRC=Solaris/audio_solaris.cpp
257 >  DEFINES="$DEFINES -DBSD_COMP -D_POSIX_PTHREAD_SEMANTICS"
258 >  ;;
259 > irix*)
260 >  AUDIOSRC=Irix/audio_irix.cpp
261 >  EXTRASYSSRCS=Irix/unaligned.c
262 >  dnl IRIX headers work fine, but somehow don't define or use "STDC_HEADERS"
263 >  DEFINES="$DEFINES -DCRTSCTS=CNEW_RTSCTS -DB230400=B115200 -DSTDC_HEADERS"
264 >  LIBS="$LIBS -laudio"
265 >
266 >  dnl Check if our compiler supports -Ofast (MIPSPro)
267 >  HAVE_OFAST=no
268 >  ocflags="$CFLAGS"
269 >  CFLAGS=`echo $CFLAGS | sed -e 's/ -g / -Ofast /;s/^-g /-Ofast /;s/-g$/ -Ofast/;s/^-g$/-Ofast/'`
270 >  AC_MSG_CHECKING(if "-Ofast" works)
271 >  dnl Do a test compile of an empty function
272 >  AC_TRY_COMPILE(,, [AC_MSG_RESULT(yes); HAVE_OFAST=yes], AC_MSG_RESULT(no))
273 >  CFLAGS="$ocflags"
274 >
275 >  ;;
276 > esac
277 >
278 > dnl Use 68k CPU natively?
279 > WANT_NATIVE_M68K=no
280 > if [[ "x$HAVE_M68K" = "xyes" -a "x$CAN_NATIVE_M68K" = "xyes" ]]; then
281 >  AC_DEFINE(ENABLE_NATIVE_M68K)
282 >  WANT_NATIVE_M68K=yes
283 > fi
284 >
285 > if [[ "x$HAVE_PTHREADS" = "xno" ]]; then
286 >  dnl Serial, ethernet and audio support needs pthreads
287 >  AC_MSG_WARN([You don't have pthreads, disabling serial, ethernet and audio support.])
288 >  SERIALSRC=../dummy/serial_dummy.cpp
289 >  ETHERSRC=../dummy/ether_dummy.cpp
290 >  AUDIOSRC=../dummy/audio_dummy.cpp
291 > fi
292 > SYSSRCS="$SERIALSRC $ETHERSRC $SCSISRC $AUDIOSRC $SEMSRC $UISRCS $MONSRCS $EXTRASYSSRCS"
293 >
294 > dnl Define a macro that translates a yesno-variable into a C macro definition
295 > dnl to be put into the config.h file
296 > dnl $1 -- the macro to define
297 > dnl $2 -- the value to translate
298 > AC_DEFUN(AC_TRANSLATE_DEFINE, [
299 >    if [[ "x$2" = "xyes" ]]; then
300 >        AC_DEFINE($1)
301      fi
302 <    ;;
303 <  SunOS*)
304 <    SYSSRCS="../dummy/ether_dummy.cpp ../dummy/scsi_dummy.cpp Solaris/audio_solaris.cpp"
305 <    DEFINES="$DEFINES -DBSD_COMP -D_POSIX_PTHREAD_SEMANTICS"
306 <    ;;
307 <  IRIX*)
308 <    SYSSRCS="../dummy/ether_dummy.cpp ../dummy/scsi_dummy.cpp ../dummy/audio_dummy.cpp Irix/unaligned.c"
309 <    DEFINES="$DEFINES -DCRTSCTS=CNEW_RTSCTS -DB230400=B115200"
310 <    LIBS="$LIBS -lm"
302 > ])
303 >
304 > dnl Check if we can mmap 0x2000 bytes from 0x0000
305 > AC_CACHE_CHECK("whether we can map Low Memory area 0x0000-0x2000",
306 >  ac_cv_can_map_lm, [
307 >  AC_LANG_SAVE
308 >  AC_LANG_CPLUSPLUS
309 >  AC_TRY_RUN([
310 >    #include <unistd.h>
311 >    #include <fcntl.h>
312 >    #include <sys/mman.h>
313 >    
314 >    int main()
315 >    { int zero_fd; char * lm;
316 >      if ((zero_fd = open("/dev/zero", O_RDWR)) < 0) exit(1);
317 >      if ((lm = (char *)mmap((caddr_t)0x0000, 0x2000, PROT_READ | PROT_WRITE, MAP_FIXED | MAP_PRIVATE, zero_fd, 0)) == MAP_FAILED) exit(1);
318 >      lm[0] = 0x12;
319 >          munmap(lm, 0x2000);
320 >      close(zero_fd);
321 >      exit(0);
322 >    }
323 >  ],
324 >  [ac_cv_can_map_lm=yes],
325 >  [ac_cv_can_map_lm=no]
326 >  )
327 >  AC_LANG_RESTORE
328 >  ]
329 > )
330 >
331 > dnl Check if extended signals are supported.
332 > AC_CACHE_CHECK("whether your system supports extended signal handlers",
333 >  ac_cv_have_extended_signals, [
334 >  AC_LANG_SAVE
335 >  AC_LANG_CPLUSPLUS
336 >  AC_TRY_RUN([
337 >    #include <unistd.h>
338 >    #include <stdlib.h>
339 >    #include <signal.h>
340 >    #include <fcntl.h>
341 >    #include <sys/mman.h>
342 >
343 >    static volatile caddr_t mem = 0;
344 >    static int zero_fd = -1;
345 >
346 >    static RETSIGTYPE segfault_handler(int, siginfo_t * sip, void *)
347 >    { if ((caddr_t)(sip->si_addr) != mem) exit(1);
348 >      munmap(mem, getpagesize()); close(zero_fd); exit(0); }
349 >
350 >    int main()
351 >    { if ((zero_fd = open("/dev/zero", O_RDWR)) < 0) exit(1);
352 >      if ((mem = (caddr_t)mmap(0, getpagesize(), PROT_READ, MAP_PRIVATE, zero_fd, 0)) == (caddr_t)MAP_FAILED) exit(1);
353 >      struct sigaction sa; sa.sa_sigaction = segfault_handler; sa.sa_flags = SA_SIGINFO;
354 >      sigaction(SIGSEGV, &sa, 0);
355 >      mem[0] = 0;
356 >      exit(1); // should not be reached
357 >    }
358 >  ],
359 >  [ac_cv_have_extended_signals=yes],
360 >  [ac_cv_have_extended_signals=no]
361 >  )
362 >  AC_LANG_RESTORE
363 >  ]
364 > )
365 > AC_TRANSLATE_DEFINE(HAVE_SIGINFO_T, "$ac_cv_have_extended_signals")
366 >
367 > dnl Otherwise, check for subterfuges.
368 > if [[ "x$ac_cv_have_extended_signals" = "xno" ]]; then
369 >  case "$target_os" in
370 >    linux*)
371 >      if [[ "x$HAVE_I386" = "xyes" ]]; then
372 >        AC_CACHE_CHECK("whether we then have a subterfuge for your system",
373 >                  ac_cv_have_sigcontext_hack, [
374 >          AC_LANG_SAVE
375 >          AC_LANG_CPLUSPLUS
376 >          AC_TRY_RUN([
377 >            #include <unistd.h>
378 >            #include <signal.h>
379 >            #include <fcntl.h>
380 >            #include <sys/mman.h>
381 >
382 >            static volatile caddr_t mem = 0;
383 >            static int zero_fd = -1;
384 >
385 >            static RETSIGTYPE segfault_handler(int, struct sigcontext scs)
386 >            { if ((caddr_t)(scs.cr2) != mem) exit(1);
387 >              munmap(mem, getpagesize()); close(zero_fd); exit(0); }
388 >
389 >            int main()
390 >            { if ((zero_fd = open("/dev/zero", O_RDWR)) < 0) exit(1);
391 >              if ((mem = (caddr_t)mmap(0, getpagesize(), PROT_READ, MAP_PRIVATE, zero_fd, 0)) == (caddr_t)MAP_FAILED) exit(1);
392 >              struct sigaction sa; sa.sa_flags = 0;
393 >              sa.sa_handler = (RETSIGTYPE (*)(int))segfault_handler;
394 >              sigaction(SIGSEGV, &sa, 0);
395 >              mem[0] = 0;
396 >              exit(1); // should not be reached
397 >            }
398 >          ],
399 >          [ac_cv_have_sigcontext_hack=yes],
400 >          [ac_cv_have_sigcontext_hack=no]
401 >          )
402 >          AC_LANG_RESTORE
403 >        ])
404 >        AC_TRANSLATE_DEFINE(HAVE_SIGCONTEXT_SUBTERFUGE, $ac_cv_have_sigcontext_hack)
405 >      elif [[ "x$HAVE_POWERPC" = "xyes" ]]; then
406 >        AC_CACHE_CHECK("whether we then have a subterfuge for your system",
407 >                  ac_cv_have_sigcontext_hack, [
408 >          AC_LANG_SAVE
409 >          AC_LANG_CPLUSPLUS
410 >          AC_TRY_RUN([
411 >            #include <unistd.h>
412 >            #include <signal.h>
413 >            #include <fcntl.h>
414 >            #include <sys/mman.h>
415 >
416 >            static volatile caddr_t mem = 0;
417 >            static int zero_fd = -1;
418 >
419 >            static RETSIGTYPE segfault_handler(int, struct sigcontext_struct *scs)
420 >            { if ((caddr_t)(scs->regs->dar) != mem) exit(1);
421 >              munmap(mem, getpagesize()); close(zero_fd); exit(0); }
422 >
423 >            int main()
424 >            { if ((zero_fd = open("/dev/zero", O_RDWR)) < 0) exit(1);
425 >              if ((mem = (caddr_t)mmap(0, getpagesize(), PROT_READ, MAP_PRIVATE, zero_fd, 0)) == (caddr_t)MAP_FAILED) exit(1);
426 >              struct sigaction sa; sa.sa_flags = 0;
427 >              sa.sa_handler = (RETSIGTYPE (*)(int))segfault_handler;
428 >              sigaction(SIGSEGV, &sa, 0);
429 >              mem[0] = 0;
430 >              exit(1); // should not be reached
431 >            }
432 >          ],
433 >          [ac_cv_have_sigcontext_hack=yes],
434 >          [ac_cv_have_sigcontext_hack=no]
435 >          )
436 >          AC_LANG_RESTORE
437 >        ])
438 >        AC_TRANSLATE_DEFINE(HAVE_SIGCONTEXT_SUBTERFUGE, $ac_cv_have_sigcontext_hack)
439 >      fi
440 >      ;;
441 >    netbsd*)
442 >      if [[ "x$HAVE_M68K" = "xyes" ]]; then
443 >        AC_CACHE_CHECK("whether we then have a subterfuge for your system",
444 >                  ac_cv_have_sigcontext_hack, [
445 >          AC_LANG_SAVE
446 >          AC_LANG_CPLUSPLUS
447 >          AC_TRY_RUN([
448 >            #include <unistd.h>
449 >            #include <signal.h>
450 >            #include <fcntl.h>
451 >            #include <sys/mman.h>
452 >
453 >            static volatile caddr_t mem = 0;
454 >            static int zero_fd = -1;
455 >
456 >            static RETSIGTYPE segfault_handler(int, int code)
457 >            { if ((caddr_t)code != mem) exit(1);
458 >              munmap(mem, getpagesize()); close(zero_fd); exit(0); }
459 >
460 >            int main()
461 >            { if ((zero_fd = open("/dev/zero", O_RDWR)) < 0) exit(1);
462 >              if ((mem = (caddr_t)mmap(0, getpagesize(), PROT_READ, MAP_PRIVATE, zero_fd, 0)) == (caddr_t)MAP_FAILED) exit(1);
463 >              struct sigaction sa; sa.sa_flags = 0;
464 >              sa.sa_handler = (RETSIGTYPE (*)(int))segfault_handler;
465 >              sigaction(SIGSEGV, &sa, 0);
466 >              mem[0] = 0;
467 >              exit(1); // should not be reached
468 >            }
469 >          ],
470 >          [ac_cv_have_sigcontext_hack=yes],
471 >          [ac_cv_have_sigcontext_hack=no]
472 >          )
473 >          AC_LANG_RESTORE
474 >        ])
475 >        AC_TRANSLATE_DEFINE(HAVE_SIGCONTEXT_SUBTERFUGE, $ac_cv_have_sigcontext_hack)
476 >      fi
477      ;;
478    esac
479   fi
196 SYSSRCS="$SYSSRCS $SEMSRCS $UISRCS $MONSRCS"
480  
481 < dnl Check for i386 CPU.
482 < HAVE_I386=no
483 < AC_MSG_CHECKING(for x86 target CPU)
484 < AC_EGREP_CPP(yes,
485 < [
203 < #ifdef __i386__
204 <  yes
205 < #endif
206 < ], [AC_MSG_RESULT(yes); HAVE_I386=yes], AC_MSG_RESULT(no))
481 > dnl Can we do Video on SEGV Signals ?
482 > CAN_VOSF=no
483 > if [[ "$ac_cv_have_extended_signals" = "yes" -o "$ac_cv_have_sigcontext_hack" = "yes" ]]; then
484 >  CAN_VOSF=yes
485 > fi
486  
487 < dnl Check for SPARC CPU.
488 < HAVE_SPARC=no
489 < AC_MSG_CHECKING(for SPARC target CPU)
490 < AC_EGREP_CPP(yes,
491 < [
492 < #ifdef __sparc__
493 <  yes
494 < #endif
495 < ], [AC_MSG_RESULT(yes); HAVE_SPARC=yes], AC_MSG_RESULT(no))
487 > dnl Determine the addressing mode to use
488 > if [[ "x$WANT_NATIVE_M68K" = "xyes" ]]; then
489 >  ADDRESSING_MODE="real"
490 > else
491 >  ADDRESSING_MODE=""
492 >  AC_MSG_CHECKING([for the addressing mode to use])
493 >  for am in $ADDRESSING_TEST_ORDER; do
494 >    case $am in
495 >    real)
496 >      dnl Requires ability to mmap() Low Memory globals
497 >      if [[ "x$ac_cv_can_map_lm" = "xno" ]]; then
498 >        continue
499 >      fi
500 >          dnl Requires VOSF screen updates
501 >      if [[ "x$CAN_VOSF" = "xno" ]]; then
502 >        continue
503 >      fi
504 >      dnl Real addressing will probably work.
505 >      ADDRESSING_MODE="real"
506 >      WANT_VOSF=yes dnl we can use VOSF and we need it actually
507 >      DEFINES="$DEFINES -DREAL_ADDRESSING"
508 >      break
509 >      ;;
510 >    direct)
511 >      dnl Requires VOSF screen updates
512 >      if [[ "x$CAN_VOSF" = "xyes" ]]; then
513 >        ADDRESSING_MODE="direct"
514 >        WANT_VOSF=yes dnl we can use VOSF and we need it actually
515 >        DEFINES="$DEFINES -DDIRECT_ADDRESSING"
516 >        break
517 >      fi
518 >      ;;
519 >    banks)
520 >      dnl Default addressing mode
521 >      ADDRESSING_MODE="memory banks"
522 >      break
523 >      ;;
524 >    *)
525 >      AC_MSG_ERROR([Internal configure.in script error for $am addressing mode])
526 >    esac
527 >  done
528 >  AC_MSG_RESULT($ADDRESSING_MODE)
529 >  if [[ "x$ADDRESSING_MODE" = "x" ]]; then
530 >    AC_MSG_WARN([Sorry, no suitable addressing mode in $ADDRESSING_TEST_ORDER])
531 >    ADDRESSING_MODE="memory banks"
532 >  fi
533 > fi
534 >
535 > dnl Enable VOSF screen updates with this feature is requested and feasible
536 > if [[ "x$WANT_VOSF" = "xyes" -a "x$CAN_VOSF" = "xyes" ]]; then
537 >    AC_DEFINE(ENABLE_VOSF)
538 > else
539 >    WANT_VOSF=no
540 > fi
541  
542   dnl Check for GAS.
543   HAVE_GAS=no
# Line 234 | Line 558 | AC_EGREP_CPP(yes,
558   #endif
559   ], [AC_MSG_RESULT(yes); HAVE_GCC27=yes], AC_MSG_RESULT(no))
560  
561 < dnl Set "-fomit-frame-pointer" on GCC 2.7 or higher.
562 < if [[ "x$HAVE_GCC27" = "xyes" ]]; then
561 > dnl Set "-fomit-frame-pointer" on i386 GCC 2.7 or higher.
562 > if [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_I386" = "xyes" ]]; then
563    CFLAGS="$CFLAGS -fomit-frame-pointer"
564    CXXFLAGS="$CXXFLAGS -fomit-frame-pointer"
565   fi
566  
567   dnl Select appropriate CPU source and REGPARAM define.
568 < WANT_X86_ASSEMBLY=no
245 < WANT_SPARC_V8_ASSEMBLY=no
246 < WANT_SPARC_V9_ASSEMBLY=no
568 > ASM_OPTIMIZATIONS=none
569   CPUSRCS="cpuemu1.cpp cpuemu2.cpp cpuemu3.cpp cpuemu4.cpp cpuemu5.cpp cpuemu6.cpp cpuemu7.cpp cpuemu8.cpp"
570 < if [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_I386" = "xyes" ]]; then
570 > FPUSRCS="../uae_cpu/fpp.cpp"
571 > if [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_I386" = "xyes" -a "x$OS_TYPE" != "xfreebsd" ]]; then
572    dnl i386 CPU
573    DEFINES="$DEFINES -DREGPARAM=\"__attribute__((regparm(3)))\""
574    if [[ "x$HAVE_GAS" = "xyes" ]]; then
575 <    WANT_X86_ASSEMBLY=yes
576 <    DEFINES="$DEFINES -DX86_ASSEMBLY"
577 <    CPUSRCS="../uae_cpu/compiler.cpp cpufast1.s cpufast2.s cpufast3.s cpufast4.s cpufast5.s cpufast6.s cpufast7.s cpufast8.s"
575 >    ASM_OPTIMIZATIONS=i386
576 >    DEFINES="$DEFINES -DX86_ASSEMBLY -DUNALIGNED_PROFITABLE -DOPTIMIZED_FLAGS"
577 >    CPUSRCS="cpufast1.s cpufast2.s cpufast3.s cpufast4.s cpufast5.s cpufast6.s cpufast7.s cpufast8.s"
578 >    FPUSRCS="../uae_cpu/fpu_x86.cpp"
579    fi
580   elif [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_SPARC" = "xyes" -a "x$HAVE_GAS" = "xyes" ]]; then
581    dnl SPARC CPU
582 <  case "$MACHINE" in
583 <  SunOS*)
582 >  case "$target_os" in
583 >  solaris*)
584      AC_MSG_CHECKING(SPARC CPU architecture)
585      SPARC_TYPE=`Solaris/which_sparc`
586      AC_MSG_RESULT($SPARC_TYPE)
587      case "$SPARC_TYPE" in
588      SPARC_V8)
589 <      WANT_SPARC_V8_ASSEMBLY=yes
590 <      DEFINES="$DEFINES -DSPARC_V8_ASSEMBLY"
589 >      ASM_OPTIMIZATIONS="SPARC V8 architecture"
590 >      DEFINES="$DEFINES -DSPARC_V8_ASSEMBLY" dnl -DOPTIMIZED_FLAGS"
591        CFLAGS="$CFLAGS -Wa,-Av8"
592        CXXFLAGS="$CXXFLAGS -Wa,-Av8"
593        ;;
594      SPARC_V9)
595 <      WANT_SPARC_V9_ASSEMBLY=yes
596 <      DEFINES="$DEFINES -DSPARC_V9_ASSEMBLY"
595 >      ASM_OPTIMIZATIONS="SPARC V9 architecture"
596 >      DEFINES="$DEFINES -DSPARC_V9_ASSEMBLY" dnl -DOPTIMIZED_FLAGS"
597        CFLAGS="$CFLAGS -Wa,-Av9"
598        CXXFLAGS="$CXXFLAGS -Wa,-Av9"
599        ;;
600      esac
601      ;;
602    esac
603 + elif [[ "x$WANT_NATIVE_M68K" = "xyes" ]]; then
604 +  dnl Native m68k, no emulation
605 +  CPUINCLUDES="-I../native_cpu"
606 +  CPUSRCS="asm_support.s"
607   fi
608  
609 < dnl UAE CPU sources for all architectures.
610 < CPUINCLUDES="-I../uae_cpu"
611 < 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"
609 > dnl Select appropriate FPU source.
610 > dnl 1. Optimized X86 assembly core if target is i386 architecture
611 > SAVED_DEFINES=$DEFINES
612 > if [[ "x$FPE_CORE" = "xdefault" ]]; then
613 >  if [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_I386" = "xyes" -a "x$HAVE_GAS" = "xyes" ]]; then
614 >    DEFINES="$DEFINES -DFPU_X86"
615 >    FPE_CORE_STR="i386 optimized core"
616 >    FPUSRCS="../uae_cpu/fpu/fpu_x86.cpp"
617 >  else
618 >    FPE_CORE="uae"
619 >  fi
620 > fi
621 >
622 > dnl 2. JIT-FPU only supports IEEE-based implementation.
623 > if [[ "x$WANT_JIT_FPU" = "xyes" -a "x$FPE_CORE" != "xieee" ]]; then
624 >  AC_MSG_WARN([Sorry, JIT-FPU supports only the "ieee" FPE implementation])
625 >  FPE_CORE="ieee"
626 >  dnl Restore previous variables. FPE_CORE_STR and FPUSRCS are overwritten
627 >  DEFINES=$SAVED_DEFINES
628 > fi
629 >
630 > dnl 3. Choose either IEEE-based implementation or the old UAE core
631 > if [[ "x$FPE_CORE" = "xieee" ]]; then
632 >  AC_CHECK_HEADERS(fenv.h)
633 >  AC_CHECK_FUNCS(feclearexcept fegetexceptflag feraiseexcept fesetexceptflag fetestexcept)
634 >  AC_CHECK_FUNCS(fegetround fesetround)
635 >  DEFINES="$DEFINES -DFPU_IEEE"
636 >  FPE_CORE_STR="ieee-based fpu core"
637 >  FPUSRCS="../uae_cpu/fpu/fpu_ieee.cpp"
638 > elif [[ "x$FPE_CORE" = "xuae" ]]; then
639 >  DEFINES="$DEFINES -DFPU_UAE"
640 >  FPE_CORE_STR="original uae core"
641 >  FPUSRCS="../uae_cpu/fpu/fpu_uae.cpp"
642 > fi
643 >
644 > dnl Check for certain math functions
645 > AC_CHECK_FUNCS(atanh)
646 > AC_CHECK_FUNCS(isnan isinf)             dnl C99
647 > AC_CHECK_FUNCS(isnanl isinfl)   dnl IEEE ?
648 >
649 > dnl UAE CPU sources for all non-m68k-native architectures.
650 > if [[ "x$WANT_NATIVE_M68K" = "xno" ]]; then
651 >  CPUINCLUDES="-I../uae_cpu"
652 >  CPUSRCS="../uae_cpu/basilisk_glue.cpp ../uae_cpu/memory.cpp ../uae_cpu/newcpu.cpp ../uae_cpu/readcpu.cpp $FPUSRCS cpustbl.cpp cpudefs.cpp $CPUSRCS"
653 > fi
654 >
655 > dnl Remove the "-g" option if set for GCC.
656 > if [[ "x$HAVE_GCC27" = "xyes" ]]; then
657 >  dnl gb-- Probably not the cleanest way to take
658 >  CFLAGS=`echo $CFLAGS | sed -e 's/ -g / /;s/^-g / /;s/ -g$/ /;s/^-g$//'`
659 >  CXXFLAGS=`echo $CXXFLAGS | sed -e 's/ -g / /;s/^-g / /;s/ -g$/ /;s/^-g$//'`
660 > fi
661 >
662 > dnl Or if we have -Ofast
663 > if [[ "x$HAVE_OFAST" = "xyes" ]]; then
664 >  CFLAGS=`echo $CFLAGS | sed -e 's/ -g / -Ofast /;s/^-g /-Ofast /;s/-g$/ -Ofast/;s/^-g$/-Ofast/'`
665 >  CXXFLAGS=`echo $CXXFLAGS | sed -e 's/ -g / -Ofast /;s/^-g /-Ofast /;s/ -g$/ -Ofast/;s/^-g$/-Ofast/'`
666 >  CXXFLAGS="-LANG:std $CXXFLAGS"
667 >  LDFLAGS="$LDFLAGS -Ofast"
668 > fi
669  
670   dnl Generate Makefile.
671   AC_SUBST(DEFINES)
# Line 294 | Line 679 | echo
679   echo Basilisk II configuration summary:
680   echo
681   echo XFree86 DGA support .............. : $WANT_XF86_DGA
682 + echo XFree86 VidMode support .......... : $WANT_XF86_VIDMODE
683   echo fbdev DGA support ................ : $WANT_FBDEV_DGA
684 + echo Enable video on SEGV signals ..... : $WANT_VOSF
685   echo ESD sound support ................ : $WANT_ESD
686   echo GTK user interface ............... : $WANT_GTK
687   echo mon debugger support ............. : $WANT_MON
688 < echo i386 assembly optimizations ...... : $WANT_X86_ASSEMBLY
689 < echo SPARC V8 assembly optimizations .. : $WANT_SPARC_V8_ASSEMBLY
690 < echo SPARC V9 assembly optimizations .. : $WANT_SPARC_V9_ASSEMBLY
688 > echo Running m68k code natively ....... : $WANT_NATIVE_M68K
689 > echo Floating-Point emulation core .... : $FPE_CORE_STR
690 > echo Assembly optimizations ........... : $ASM_OPTIMIZATIONS
691 > echo Addressing mode .................. : $ADDRESSING_MODE
692   echo
693 < echo "Configuration done. Now type \"make\"."
693 > echo "Configuration done. Now type \"make\" (or \"gmake\")."

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines