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.12 by cebix, 1999-10-25T19:01:43Z vs.
Revision 1.33 by cebix, 2001-02-10T15:29:01Z

# 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_ENABLE(esd,       [  --enable-esd            Enlightened Sound Daemon support [default=yes]], [WANT_ESD=$enableval], [WANT_ESD=yes])
12 < AC_ARG_ENABLE(ui,        [  --enable-ui             use GTK user interface [default=yes]], [WANT_UI=$enableval], [WANT_UI=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 Addressing modes.
15 > AC_ARG_ENABLE(addressing,
16 > [  --enable-addressing=AM  specify the addressing mode to use [default=fastest]],
17 > [ case "$enableval" in
18 >    real)       ADDRESSING_TEST_ORDER="real";;
19 >    direct)     ADDRESSING_TEST_ORDER="direct";;
20 >    banks)      ADDRESSING_TEST_ORDER="banks";;
21 >    fastest)ADDRESSING_TEST_ORDER="direct banks";;
22 >    *)          AC_MSG_ERROR([--enable-addressing takes only one of the following values: fastest, real, direct, banks]);;
23 >  esac
24 > ],
25 > [ ADDRESSING_TEST_ORDER="direct banks"
26 > ])
27 >
28 > dnl External packages.
29 > AC_ARG_WITH(esd,             [  --with-esd              support ESD for sound under Linux/FreeBSD [default=yes]], [WANT_ESD=$withval], [WANT_ESD=yes])
30 > AC_ARG_WITH(gtk,             [  --with-gtk              use GTK user interface [default=yes]], [WANT_GTK=$withval], [WANT_GTK=yes])
31 > AC_ARG_WITH(mon,             [  --with-mon              use mon as debugger [default=yes]], [WANT_MON=$withval], [WANT_MON=yes])
32 >
33 > dnl Canonical system information.
34 > AC_CANONICAL_HOST
35 > AC_CANONICAL_TARGET
36 >
37 > dnl Target OS type (target is host if not cross-compiling).
38 > case "$target_os" in
39 >  linux*)       OS_TYPE=linux;;
40 >  netbsd*)      OS_TYPE=netbsd;;
41 >  freebsd*)     OS_TYPE=freebsd;;
42 >  solaris*)     OS_TYPE=solaris;;
43 >  *)            OS_TYPE=`echo $target_os | sed -e 's/-/_/' | sed -e 's/\./_/'`;;
44 > esac
45 > DEFINES="$DEFINES -DOS_$OS_TYPE"
46 >
47 > dnl Target CPU type.
48 > HAVE_I386=no
49 > HAVE_M68K=no
50 > HAVE_SPARC=no
51 > HAVE_POWERPC=no
52 > case "$target_cpu" in
53 >  i386* | i486* | i586* | i686* | i786* ) CPU_TYPE=i386 HAVE_I386=yes;;
54 >  m68k* ) CPU_TYPE=m68k HAVE_M68K=yes;;
55 >  sparc* ) CPU_TYPE=sparc HAVE_SPARC=yes;;
56 >  powerpc* ) CPU_TYPE=powerpc HAVE_POWERPC=yes;;
57 >  *) CPU_TYPE=`echo $target_cpu | sed -e 's/-/_/'`;;
58 > esac
59 > DEFINES="$DEFINES -DCPU_$CPU_TYPE"
60  
61   dnl Checks for programs.
62   AC_PROG_CC
63 + AC_PROG_CC_C_O
64   AC_PROG_CPP
65   AC_PROG_CXX
66   AC_PROG_MAKE_SET
# Line 20 | Line 68 | AC_PROG_INSTALL
68  
69   dnl We use mon if possible.
70   MONSRCS=
71 < AC_MSG_CHECKING(for mon)
72 < if grep mon_init ../../../mon/src/mon.h >/dev/null 2>/dev/null; then
73 <  AC_MSG_RESULT(yes)
74 <  WANT_MON=yes
75 <  DEFINES="$DEFINES -DENABLE_MON=1"
76 <  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"
77 <  CXXFLAGS="$CXXFLAGS -I../../../mon/src"
78 < else
79 <  AC_MSG_RESULT(no)
80 <  WANT_MON=no
81 <  DEFINES="$DEFINES -DENABLE_MON=0"
71 > if [[ "x$WANT_MON" = "xyes" ]]; then
72 >  AC_MSG_CHECKING(for mon)
73 >  mon_srcdir=../../../mon/src
74 >  if grep mon_init $mon_srcdir/mon.h >/dev/null 2>/dev/null; then
75 >    AC_MSG_RESULT(yes)
76 >    AC_DEFINE(ENABLE_MON)
77 >    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"
78 >    CXXFLAGS="$CXXFLAGS -I$mon_srcdir -I$mon_srcdir/disass"
79 >    AC_CHECK_LIB(readline, readline)
80 >    AC_CHECK_LIB(termcap, tputs)
81 >    AC_CHECK_HEADERS(readline.h history.h readline/readline.h readline/history.h)
82 >  else
83 >    AC_MSG_RESULT(no)
84 >    AC_MSG_WARN([Could not find mon, ignoring --with-mon.])
85 >    WANT_MON=no
86 >  fi
87   fi
88  
89   dnl Checks for libraries.
# Line 45 | Line 98 | CFLAGS="$CFLAGS $X_CFLAGS"
98   CXXFLAGS="$CXXFLAGS $X_CFLAGS"
99   LIBS="$LIBS $X_PRE_LIBS $X_LIBS -lX11 -lXext $X_EXTRA_LIBS"
100  
101 < dnl We need pthreads. Try libpthread first, then libc_r (FreeBSD), then PTL.
101 > dnl We want pthreads. Try libpthread first, then libc_r (FreeBSD), then PTL.
102 > HAVE_PTHREADS=yes
103   AC_CHECK_LIB(pthread, pthread_create, , [
104    AC_CHECK_LIB(c_r, pthread_create, , [
105      AC_CHECK_LIB(PTL, pthread_create, , [
106 <      AC_MSG_ERROR([You need pthreads to run Basilisk II.])
106 >      HAVE_PTHREADS=no
107      ])
108    ])
109   ])
110 + if [[ "x$HAVE_PTHREADS" = "xyes" ]]; then
111 +  AC_DEFINE(HAVE_PTHREADS)
112 + fi
113 + AC_CHECK_FUNCS(pthread_cancel)
114  
115   dnl If POSIX.4 semaphores are not available, we emulate them with pthread mutexes.
116 < SEMSRCS=
116 > SEMSRC=
117   AC_CHECK_FUNCS(sem_init, , [
118 <  SEMSRCS=posix_sem.cpp
118 >  if test "x$HAVE_PTHREADS" = "xyes"; then
119 >    SEMSRC=posix_sem.cpp
120 >  fi
121   ])
122  
123   dnl We use DGA (XFree86 or fbdev) if possible.
124   if [[ "x$WANT_XF86_DGA" = "xyes" ]]; then
125    AC_CHECK_LIB(Xxf86dga, XF86DGAQueryExtension, [
126 <    DEFINES="$DEFINES -DENABLE_XF86_DGA=1"
126 >    AC_DEFINE(ENABLE_XF86_DGA)
127      LIBS="$LIBS -lXxf86dga"
128      if [[ "x$WANT_FBDEV_DGA" = "xyes" ]]; then
129        AC_MSG_WARN([Cannot have both --enable-xf86-dga and --enable-fbdev-dga, ignoring --enable-fbdev-dga.])
# Line 71 | Line 131 | if [[ "x$WANT_XF86_DGA" = "xyes" ]]; the
131      fi
132    ], [
133      AC_MSG_WARN([Could not find XFree86 DGA extension, ignoring --enable-xf86-dga.])
134 <    DEFINES="$DEFINES -DENABLE_XF86_DGA=0"
134 >    WANT_XF86_DGA=no
135    ])
76 else
77  DEFINES="$DEFINES -DENABLE_XF86_DGA=0"
136   fi
137   if [[ "x$WANT_FBDEV_DGA" = "xyes" ]]; then
138 <  DEFINES="$DEFINES -DENABLE_FBDEV_DGA=1"
139 < else
140 <  DEFINES="$DEFINES -DENABLE_FBDEV_DGA=0"
138 >  AC_DEFINE(ENABLE_FBDEV_DGA)
139 > fi
140 >
141 > dnl We use XFree86 VidMode if possible.
142 > if [[ "x$WANT_XF86_VIDMODE" = "xyes" ]]; then
143 >  AC_CHECK_LIB(Xxf86vm, XF86VidModeQueryExtension, [
144 >    AC_DEFINE(ENABLE_XF86_VIDMODE)
145 >    LIBS="$LIBS -lXxf86vm"
146 >  ], [
147 >    AC_MSG_WARN([Could not find XFree86 VidMode extension, ignoring --enable-xf86-vidmode.])
148 >    WANT_XF86_VIDMODE=no
149 >  ])
150   fi
151  
152   dnl We use GTK+ if possible.
153   UISRCS=../dummy/prefs_editor_dummy.cpp
154 < if [[ "x$WANT_UI" = "xyes" ]]; then
154 > if [[ "x$WANT_GTK" = "xyes" ]]; then
155    AM_PATH_GTK(1.2.0, [
156 <    DEFINES="$DEFINES -DENABLE_GTK=1"
156 >    AC_DEFINE(ENABLE_GTK)
157      CFLAGS="$CFLAGS $GTK_CFLAGS"
158      CXXFLAGS="$CXXFLAGS $GTK_CFLAGS"
159      LIBS="$LIBS $GTK_LIBS"
160      UISRCS=prefs_editor_gtk.cpp
161    ], [
162      AC_MSG_WARN([Could not find GTK+, disabling user interface.])
163 <    WANT_UI=no
163 >    WANT_GTK=no
164    ])
165   fi
166  
167   dnl We use ESD if possible.
168   if [[ "x$WANT_ESD" = "xyes" ]]; then
169    AM_PATH_ESD(0.2.8, [
170 <    DEFINES="$DEFINES -DENABLE_ESD=1"
170 >    AC_DEFINE(ENABLE_ESD)
171      CFLAGS="$CFLAGS $ESD_CFLAGS"
172      CXXFLAGS="$CXXFLAGS $ESD_CFLAGS"
173      LIBS="$LIBS $ESD_LIBS"
# Line 122 | Line 189 | AC_CHECK_SIZEOF(short, 2)
189   AC_CHECK_SIZEOF(int, 4)
190   AC_CHECK_SIZEOF(long, 4)
191   AC_CHECK_SIZEOF(long long, 8)
192 + AC_CHECK_SIZEOF(void *, 4)
193   AC_TYPE_OFF_T
194   AC_CHECK_TYPE(loff_t, off_t)
195   AC_TYPE_SIZE_T
196 + AC_TYPE_SIGNAL
197   AC_HEADER_TIME
198   AC_STRUCT_TM
199  
200   dnl Checks for library functions.
201   AC_CHECK_FUNCS(strdup cfmakeraw)
202 < AC_CHECK_FUNCS(nanosleep clock_gettime timer_create)
134 < AC_CHECK_FUNCS(pthread_cancel)
202 > AC_CHECK_FUNCS(clock_gettime timer_create)
203  
204   dnl Select system-dependant source files.
205 < SYSSRCS="../dummy/ether_dummy.cpp ../dummy/scsi_dummy.cpp ../dummy/audio_dummy.cpp"
206 < if MACHINE=`uname -a 2>/dev/null`; then
207 <  case "$MACHINE" in
208 <  Linux*)
209 <    SYSSRCS="Linux/ether_linux.cpp Linux/scsi_linux.cpp audio_oss_esd.cpp"
210 <    ;;
211 <  FreeBSD*3.*)
212 <    dnl Check for the CAM library
213 <    AC_CHECK_LIB(cam, cam_open_btl, HAVE_LIBCAM=yes, HAVE_LIBCAM=no)
214 <    if [[ "x$HAVE_LIBCAM" = "xno" ]]; then
215 <      AC_MSG_ERROR([Cannot find libcam for SCSI management.])
205 > SERIALSRC=serial_unix.cpp
206 > ETHERSRC=../dummy/ether_dummy.cpp
207 > SCSISRC=../dummy/scsi_dummy.cpp
208 > AUDIOSRC=../dummy/audio_dummy.cpp
209 > EXTRASYSSRCS=
210 > CAN_NATIVE_M68K=no
211 > case "$target_os" in
212 > linux*)
213 >  ETHERSRC=Linux/ether_linux.cpp
214 >  SCSISRC=Linux/scsi_linux.cpp
215 >  AUDIOSRC=audio_oss_esd.cpp
216 >  ;;
217 > freebsd*3.*)
218 >  AUDIOSRC=audio_oss_esd.cpp
219 >  DEFINES="$DEFINES -DBSD_COMP"
220 >  dnl Check for the CAM library
221 >  AC_CHECK_LIB(cam, cam_open_btl, HAVE_LIBCAM=yes, HAVE_LIBCAM=no)
222 >  if [[ "x$HAVE_LIBCAM" = "xno" ]]; then
223 >    AC_MSG_WARN([Cannot find libcam for SCSI management, disabling SCSI support.])
224 >  else
225 >    dnl Check for the sys kernel includes
226 >    AC_CHECK_HEADER(/sys/cam/cam.h)
227 >    if [[ "x$ac_cv_header__sys_cam_cam_h" = "xno" ]]; then
228 >      dnl In this case I should fix this thing including a "patch"
229 >      dnl to access directly to the functions in the kernel :) --Orlando
230 >      AC_MSG_WARN([Cannot find kernel includes for CAM library, disabling SCSI support.])
231      else
232 <      dnl Check for the sys kernel includes
150 <      AC_CHECK_HEADER(/sys/cam/cam.h)
151 <      if [[ "x$ac_cv_header__sys_cam_cam_h" = "xno" ]]; then
152 <        dnl In this case I should fix this thing including a "patch"
153 <        dnl to access directly to the functions in the kernel :) --Orlando
154 <        AC_MSG_ERROR([Cannot find kernel includes for CAM library.])
155 <      fi
156 <      SYSSRCS="../dummy/ether_dummy.cpp FreeBSD/scsi_freebsd.cpp audio_oss_esd.cpp"
232 >      SCSISRC=FreeBSD/scsi_freebsd.cpp
233        CXXFLAGS="$CXXFLAGS -I/sys"
234        CFLAGS="$CFLAGS -I/sys"
235        LIBS="$LIBS -lcam"
236 <      DEFINES="$DEFINES -DBSD_COMP -DCAM"
236 >      DEFINES="$DEFINES -DCAM"
237      fi
238 <    ;;
239 <  FreeBSD*)
240 <    dnl Check for the SCSI library
241 <    AC_CHECK_LIB(scsi, scsi_open, HAVE_LIBSCSI=yes, HAVE_LIBSCSI=no)
242 <    if [[ "x$HAVE_LIBSCSI" = "xno" ]]; then
243 <      AC_MSG_ERROR([Cannot find libscsi for SCSI management.])
238 >  fi
239 >  ;;
240 > freebsd*)
241 >  DEFINES="$DEFINES -DBSD_COMP"
242 >  dnl Check for the SCSI library
243 >  AC_CHECK_LIB(scsi, scsi_open, HAVE_LIBSCSI=yes, HAVE_LIBSCSI=no)
244 >  if [[ "x$HAVE_LIBSCSI" = "xno" ]]; then
245 >    AC_MSG_WARN([Cannot find libscsi for SCSI management, disabling SCSI support.])
246 >  else
247 >    dnl Check for the sys kernel includes
248 >    AC_CHECK_HEADER(scsi.h sys/scsiio.h)
249 >    if [[ "x$ac_cv_header_scsi_h" = "xno" ]]; then
250 >      AC_MSG_WARN([Cannot find includes for the SCSI library, disabling SCSI support.])
251      else
252 <      dnl Check for the sys kernel includes
170 <      AC_CHECK_HEADER(scsi.h sys/scsiio.h)
171 <      if [[ "x$ac_cv_header_scsi_h" = "xno" ]]; then
172 <        AC_MSG_ERROR([Cannot find includes for the SCSI library.])
173 <      fi
174 <      SYSSRCS="../dummy/ether_dummy.cpp FreeBSD/scsi_freebsd.cpp ../dummy/audio_dummy.cpp"
252 >      SCSISRC=FreeBSD/scsi_freebsd.cpp
253        LIBS="$LIBS -lscsi"
176      DEFINES="$DEFINES -DBSD_COMP"
254      fi
255 <    ;;
256 <  SunOS*)
257 <    SYSSRCS="../dummy/ether_dummy.cpp ../dummy/scsi_dummy.cpp Solaris/audio_solaris.cpp"
258 <    DEFINES="$DEFINES -DBSD_COMP -D_POSIX_PTHREAD_SEMANTICS"
259 <    ;;
260 <  IRIX*)
261 <    SYSSRCS="../dummy/ether_dummy.cpp ../dummy/scsi_dummy.cpp ../dummy/audio_dummy.cpp Irix/unaligned.c"
262 <    DEFINES="$DEFINES -DCRTSCTS=CNEW_RTSCTS -DB230400=B115200"
263 <    LIBS="$LIBS -lm"
255 >  fi
256 >  ;;
257 > netbsd*)
258 >  CAN_NATIVE_M68K=yes
259 >  ;;
260 > solaris*)
261 >  AUDIOSRC=Solaris/audio_solaris.cpp
262 >  DEFINES="$DEFINES -DBSD_COMP -D_POSIX_PTHREAD_SEMANTICS"
263 >  ;;
264 > irix*)
265 >  AUDIOSRC=Irix/audio_irix.cpp
266 >  EXTRASYSSRCS=Irix/unaligned.c
267 >  dnl IRIX headers work fine, but somehow don't define or use "STDC_HEADERS"
268 >  DEFINES="$DEFINES -DCRTSCTS=CNEW_RTSCTS -DB230400=B115200 -DSTDC_HEADERS"
269 >  LIBS="$LIBS -laudio"
270 >  ;;
271 > esac
272 >
273 > dnl Use 68k CPU natively?
274 > WANT_NATIVE_M68K=no
275 > if [[ "x$HAVE_M68K" = "xyes" -a "x$CAN_NATIVE_M68K" = "xyes" ]]; then
276 >  AC_DEFINE(ENABLE_NATIVE_M68K)
277 >  WANT_NATIVE_M68K=yes
278 > fi
279 >
280 > if [[ "x$HAVE_PTHREADS" = "xno" ]]; then
281 >  dnl Serial, ethernet and audio support needs pthreads
282 >  AC_MSG_WARN([You don't have pthreads, disabling serial, ethernet and audio support.])
283 >  SERIALSRC=../dummy/serial_dummy.cpp
284 >  ETHERSRC=../dummy/ether_dummy.cpp
285 >  AUDIOSRC=../dummy/audio_dummy.cpp
286 > fi
287 > SYSSRCS="$SERIALSRC $ETHERSRC $SCSISRC $AUDIOSRC $SEMSRC $UISRCS $MONSRCS $EXTRASYSSRCS"
288 >
289 > dnl Define a macro that translates a yesno-variable into a C macro definition
290 > dnl to be put into the config.h file
291 > dnl $1 -- the macro to define
292 > dnl $2 -- the value to translate
293 > AC_DEFUN(AC_TRANSLATE_DEFINE, [
294 >    if [[ "x$2" = "xyes" ]]; then
295 >        AC_DEFINE($1)
296 >    fi
297 > ])
298 >
299 > dnl Check if we can mmap 0x2000 bytes from 0x0000
300 > AC_CACHE_CHECK("whether we can map Low Memory area 0x0000-0x2000",
301 >  ac_cv_can_map_lm, [
302 >  AC_LANG_SAVE
303 >  AC_LANG_CPLUSPLUS
304 >  AC_TRY_RUN([
305 >    #include <unistd.h>
306 >    #include <fcntl.h>
307 >    #include <sys/mman.h>
308 >    
309 >    int main()
310 >    { int zero_fd; char * lm;
311 >      if ((zero_fd = open("/dev/zero", O_RDWR)) < 0) exit(1);
312 >      if ((lm = (char *)mmap((caddr_t)0x0000, 0x2000, PROT_READ | PROT_WRITE, MAP_FIXED | MAP_PRIVATE, zero_fd, 0)) == MAP_FAILED) exit(1);
313 >      lm[0] = 0x12;
314 >          munmap(lm, 0x2000);
315 >      close(zero_fd);
316 >      exit(0);
317 >    }
318 >  ],
319 >  [ac_cv_can_map_lm=yes],
320 >  [ac_cv_can_map_lm=no]
321 >  )
322 >  AC_LANG_RESTORE
323 >  ]
324 > )
325 >
326 > dnl Check if extended signals are supported.
327 > AC_CACHE_CHECK("whether your system supports extended signal handlers",
328 >  ac_cv_have_extended_signals, [
329 >  AC_LANG_SAVE
330 >  AC_LANG_CPLUSPLUS
331 >  AC_TRY_RUN([
332 >    #include <unistd.h>
333 >    #include <stdlib.h>
334 >    #include <signal.h>
335 >    #include <fcntl.h>
336 >    #include <sys/mman.h>
337 >
338 >    static volatile caddr_t mem = 0;
339 >    static int zero_fd = -1;
340 >
341 >    static RETSIGTYPE segfault_handler(int, siginfo_t * sip, void *)
342 >    { if ((caddr_t)(sip->si_addr) != mem) exit(1);
343 >      munmap(mem, getpagesize()); close(zero_fd); exit(0); }
344 >
345 >    int main()
346 >    { if ((zero_fd = open("/dev/zero", O_RDWR)) < 0) exit(1);
347 >      if ((mem = (caddr_t)mmap(0, getpagesize(), PROT_READ, MAP_PRIVATE, zero_fd, 0)) == (caddr_t)MAP_FAILED) exit(1);
348 >      struct sigaction sa; sa.sa_sigaction = segfault_handler; sa.sa_flags = SA_SIGINFO;
349 >      sigaction(SIGSEGV, &sa, 0);
350 >      mem[0] = 0;
351 >      exit(1); // should not be reached
352 >    }
353 >  ],
354 >  [ac_cv_have_extended_signals=yes],
355 >  [ac_cv_have_extended_signals=no]
356 >  )
357 >  AC_LANG_RESTORE
358 >  ]
359 > )
360 > AC_TRANSLATE_DEFINE(HAVE_SIGINFO_T, "$ac_cv_have_extended_signals")
361 >
362 > dnl Otherwise, check for subterfuges.
363 > if [[ "x$ac_cv_have_extended_signals" = "xno" ]]; then
364 >  case "$target_os" in
365 >    linux*)
366 >      if [[ "x$HAVE_I386" = "xyes" ]]; then
367 >        AC_CACHE_CHECK("whether we then have a subterfuge for your system",
368 >                  ac_cv_have_sigcontext_hack, [
369 >          AC_LANG_SAVE
370 >          AC_LANG_CPLUSPLUS
371 >          AC_TRY_RUN([
372 >            #include <unistd.h>
373 >            #include <signal.h>
374 >            #include <fcntl.h>
375 >            #include <sys/mman.h>
376 >
377 >            static volatile caddr_t mem = 0;
378 >            static int zero_fd = -1;
379 >
380 >            static RETSIGTYPE segfault_handler(int, struct sigcontext scs)
381 >            { if ((caddr_t)(scs.cr2) != mem) exit(1);
382 >              munmap(mem, getpagesize()); close(zero_fd); exit(0); }
383 >
384 >            int main()
385 >            { if ((zero_fd = open("/dev/zero", O_RDWR)) < 0) exit(1);
386 >              if ((mem = (caddr_t)mmap(0, getpagesize(), PROT_READ, MAP_PRIVATE, zero_fd, 0)) == (caddr_t)MAP_FAILED) exit(1);
387 >              struct sigaction sa; sa.sa_flags = 0;
388 >              sa.sa_handler = (RETSIGTYPE (*)(int))segfault_handler;
389 >              sigaction(SIGSEGV, &sa, 0);
390 >              mem[0] = 0;
391 >              exit(1); // should not be reached
392 >            }
393 >          ],
394 >          [ac_cv_have_sigcontext_hack=yes],
395 >          [ac_cv_have_sigcontext_hack=no]
396 >          )
397 >          AC_LANG_RESTORE
398 >        ])
399 >        AC_TRANSLATE_DEFINE(HAVE_SIGCONTEXT_SUBTERFUGE, $ac_cv_have_sigcontext_hack)
400 >      elif [[ "x$HAVE_POWERPC" = "xyes" ]]; then
401 >        AC_CACHE_CHECK("whether we then have a subterfuge for your system",
402 >                  ac_cv_have_sigcontext_hack, [
403 >          AC_LANG_SAVE
404 >          AC_LANG_CPLUSPLUS
405 >          AC_TRY_RUN([
406 >            #include <unistd.h>
407 >            #include <signal.h>
408 >            #include <fcntl.h>
409 >            #include <sys/mman.h>
410 >
411 >            static volatile caddr_t mem = 0;
412 >            static int zero_fd = -1;
413 >
414 >            static RETSIGTYPE segfault_handler(int, struct sigcontext_struct *scs)
415 >            { if ((caddr_t)(scs->regs->dar) != mem) exit(1);
416 >              munmap(mem, getpagesize()); close(zero_fd); exit(0); }
417 >
418 >            int main()
419 >            { if ((zero_fd = open("/dev/zero", O_RDWR)) < 0) exit(1);
420 >              if ((mem = (caddr_t)mmap(0, getpagesize(), PROT_READ, MAP_PRIVATE, zero_fd, 0)) == (caddr_t)MAP_FAILED) exit(1);
421 >              struct sigaction sa; sa.sa_flags = 0;
422 >              sa.sa_handler = (RETSIGTYPE (*)(int))segfault_handler;
423 >              sigaction(SIGSEGV, &sa, 0);
424 >              mem[0] = 0;
425 >              exit(1); // should not be reached
426 >            }
427 >          ],
428 >          [ac_cv_have_sigcontext_hack=yes],
429 >          [ac_cv_have_sigcontext_hack=no]
430 >          )
431 >          AC_LANG_RESTORE
432 >        ])
433 >        AC_TRANSLATE_DEFINE(HAVE_SIGCONTEXT_SUBTERFUGE, $ac_cv_have_sigcontext_hack)
434 >      fi
435 >      ;;
436 >    netbsd*)
437 >      if [[ "x$HAVE_M68K" = "xyes" ]]; then
438 >        AC_CACHE_CHECK("whether we then have a subterfuge for your system",
439 >                  ac_cv_have_sigcontext_hack, [
440 >          AC_LANG_SAVE
441 >          AC_LANG_CPLUSPLUS
442 >          AC_TRY_RUN([
443 >            #include <unistd.h>
444 >            #include <signal.h>
445 >            #include <fcntl.h>
446 >            #include <sys/mman.h>
447 >
448 >            static volatile caddr_t mem = 0;
449 >            static int zero_fd = -1;
450 >
451 >            static RETSIGTYPE segfault_handler(int, int code)
452 >            { if ((caddr_t)code != mem) exit(1);
453 >              munmap(mem, getpagesize()); close(zero_fd); exit(0); }
454 >
455 >            int main()
456 >            { if ((zero_fd = open("/dev/zero", O_RDWR)) < 0) exit(1);
457 >              if ((mem = (caddr_t)mmap(0, getpagesize(), PROT_READ, MAP_PRIVATE, zero_fd, 0)) == (caddr_t)MAP_FAILED) exit(1);
458 >              struct sigaction sa; sa.sa_flags = 0;
459 >              sa.sa_handler = (RETSIGTYPE (*)(int))segfault_handler;
460 >              sigaction(SIGSEGV, &sa, 0);
461 >              mem[0] = 0;
462 >              exit(1); // should not be reached
463 >            }
464 >          ],
465 >          [ac_cv_have_sigcontext_hack=yes],
466 >          [ac_cv_have_sigcontext_hack=no]
467 >          )
468 >          AC_LANG_RESTORE
469 >        ])
470 >        AC_TRANSLATE_DEFINE(HAVE_SIGCONTEXT_SUBTERFUGE, $ac_cv_have_sigcontext_hack)
471 >      fi
472      ;;
473    esac
474   fi
190 SYSSRCS="$SYSSRCS $SEMSRCS $UISRCS $MONSRCS"
475  
476 < dnl Check for i386 CPU.
477 < HAVE_I386=no
478 < AC_MSG_CHECKING(for x86 target CPU)
479 < AC_EGREP_CPP(yes,
480 < [
197 < #ifdef __i386__
198 <  yes
199 < #endif
200 < ], [AC_MSG_RESULT(yes); HAVE_I386=yes], AC_MSG_RESULT(no))
476 > dnl Can we do Video on SEGV Signals ?
477 > CAN_VOSF=no
478 > if [[ "$ac_cv_have_extended_signals" = "yes" -o "$ac_cv_have_sigcontext_hack" = "yes" ]]; then
479 >  CAN_VOSF=yes
480 > fi
481  
482 < dnl Check for SPARC CPU.
483 < HAVE_SPARC=no
484 < AC_MSG_CHECKING(for SPARC target CPU)
485 < AC_EGREP_CPP(yes,
486 < [
487 < #ifdef __sparc__
488 <  yes
489 < #endif
490 < ], [AC_MSG_RESULT(yes); HAVE_SPARC=yes], AC_MSG_RESULT(no))
482 > dnl Determine the addressing mode to use
483 > if [[ "x$WANT_NATIVE_M68K" = "xyes" ]]; then
484 >  ADDRESSING_MODE="real"
485 > else
486 >  ADDRESSING_MODE=""
487 >  AC_MSG_CHECKING([for the addressing mode to use])
488 >  for am in $ADDRESSING_TEST_ORDER; do
489 >    case $am in
490 >    real)
491 >      dnl Requires ability to mmap() Low Memory globals
492 >      if [[ "x$ac_cv_can_map_lm" = "xno" ]]; then
493 >        continue
494 >      fi
495 >          dnl Requires VOSF screen updates
496 >      if [[ "x$CAN_VOSF" = "xno" ]]; then
497 >        continue
498 >      fi
499 >      dnl Real addressing will probably work.
500 >      ADDRESSING_MODE="real"
501 >      WANT_VOSF=yes dnl we can use VOSF and we need it actually
502 >      DEFINES="$DEFINES -DREAL_ADDRESSING"
503 >      break
504 >      ;;
505 >    direct)
506 >      dnl Requires VOSF screen updates
507 >      if [[ "x$CAN_VOSF" = "xyes" ]]; then
508 >        ADDRESSING_MODE="direct"
509 >        WANT_VOSF=yes dnl we can use VOSF and we need it actually
510 >        DEFINES="$DEFINES -DDIRECT_ADDRESSING"
511 >        break
512 >      fi
513 >      ;;
514 >    banks)
515 >      dnl Default addressing mode
516 >      ADDRESSING_MODE="memory banks"
517 >      break
518 >      ;;
519 >    *)
520 >      AC_MSG_ERROR([Internal configure.in script error for $am addressing mode])
521 >    esac
522 >  done
523 >  AC_MSG_RESULT($ADDRESSING_MODE)
524 >  if [[ "x$ADDRESSING_MODE" = "x" ]]; then
525 >    AC_MSG_WARN([Sorry, no suitable addressing mode in $ADDRESSING_TEST_ORDER])
526 >    ADDRESSING_MODE="memory banks"
527 >  fi
528 > fi
529 >
530 > dnl Enable VOSF screen updates with this feature is requested and feasible
531 > if [[ "x$WANT_VOSF" = "xyes" -a "x$CAN_VOSF" = "xyes" ]]; then
532 >    AC_DEFINE(ENABLE_VOSF)
533 > else
534 >    WANT_VOSF=no
535 > fi
536  
537   dnl Check for GAS.
538   HAVE_GAS=no
# Line 228 | Line 553 | AC_EGREP_CPP(yes,
553   #endif
554   ], [AC_MSG_RESULT(yes); HAVE_GCC27=yes], AC_MSG_RESULT(no))
555  
556 < dnl Set "-fomit-frame-pointer" on GCC 2.7 or higher.
557 < if [[ "x$HAVE_GCC27" = "xyes" ]]; then
556 > dnl Set "-fomit-frame-pointer" on i386 GCC 2.7 or higher.
557 > if [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_I386" = "xyes" ]]; then
558    CFLAGS="$CFLAGS -fomit-frame-pointer"
559    CXXFLAGS="$CXXFLAGS -fomit-frame-pointer"
560   fi
561  
562   dnl Select appropriate CPU source and REGPARAM define.
563 < WANT_X86_ASSEMBLY=no
239 < WANT_SPARC_V8_ASSEMBLY=no
240 < WANT_SPARC_V9_ASSEMBLY=no
563 > ASM_OPTIMIZATIONS=none
564   CPUSRCS="cpuemu1.cpp cpuemu2.cpp cpuemu3.cpp cpuemu4.cpp cpuemu5.cpp cpuemu6.cpp cpuemu7.cpp cpuemu8.cpp"
565 + FPUSRCS="../uae_cpu/fpp.cpp"
566   if [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_I386" = "xyes" ]]; then
567    dnl i386 CPU
568    DEFINES="$DEFINES -DREGPARAM=\"__attribute__((regparm(3)))\""
569    if [[ "x$HAVE_GAS" = "xyes" ]]; then
570 <    WANT_X86_ASSEMBLY=yes
571 <    DEFINES="$DEFINES -DX86_ASSEMBLY"
572 <    CPUSRCS="cpufast1.s cpufast2.s cpufast3.s cpufast4.s cpufast5.s cpufast6.s cpufast7.s cpufast8.s"
570 >    ASM_OPTIMIZATIONS=i386
571 >    DEFINES="$DEFINES -DX86_ASSEMBLY -DUNALIGNED_PROFITABLE -DOPTIMIZED_FLAGS"
572 >    CPUSRCS="../uae_cpu/compiler.cpp cpufast1.s cpufast2.s cpufast3.s cpufast4.s cpufast5.s cpufast6.s cpufast7.s cpufast8.s"
573 >    FPUSRCS="../uae_cpu/fpu_x86.cpp"
574    fi
575   elif [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_SPARC" = "xyes" -a "x$HAVE_GAS" = "xyes" ]]; then
576    dnl SPARC CPU
577 <  case "$MACHINE" in
578 <  SunOS*)
577 >  case "$target_os" in
578 >  solaris*)
579      AC_MSG_CHECKING(SPARC CPU architecture)
580      SPARC_TYPE=`Solaris/which_sparc`
581      AC_MSG_RESULT($SPARC_TYPE)
582      case "$SPARC_TYPE" in
583      SPARC_V8)
584 <      WANT_SPARC_V8_ASSEMBLY=yes
585 <      DEFINES="$DEFINES -DSPARC_V8_ASSEMBLY"
584 >      ASM_OPTIMIZATIONS="SPARC V8 architecture"
585 >      DEFINES="$DEFINES -DSPARC_V8_ASSEMBLY" dnl -DOPTIMIZED_FLAGS"
586        CFLAGS="$CFLAGS -Wa,-Av8"
587        CXXFLAGS="$CXXFLAGS -Wa,-Av8"
588        ;;
589      SPARC_V9)
590 <      WANT_SPARC_V9_ASSEMBLY=yes
591 <      DEFINES="$DEFINES -DSPARC_V9_ASSEMBLY"
590 >      ASM_OPTIMIZATIONS="SPARC V9 architecture"
591 >      DEFINES="$DEFINES -DSPARC_V9_ASSEMBLY" dnl -DOPTIMIZED_FLAGS"
592        CFLAGS="$CFLAGS -Wa,-Av9"
593        CXXFLAGS="$CXXFLAGS -Wa,-Av9"
594        ;;
595      esac
596      ;;
597    esac
598 + elif [[ "x$WANT_NATIVE_M68K" = "xyes" ]]; then
599 +  dnl Native m68k, no emulation
600 +  CPUINCLUDES="-I../native_cpu"
601 +  CPUSRCS="asm_support.s"
602   fi
603  
604 < dnl UAE CPU sources for all architectures.
605 < CPUINCLUDES="-I../uae_cpu"
606 < 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"
604 > dnl UAE CPU sources for all non-m68k-native architectures.
605 > if [[ "x$WANT_NATIVE_M68K" = "xno" ]]; then
606 >  CPUINCLUDES="-I../uae_cpu"
607 >  CPUSRCS="../uae_cpu/basilisk_glue.cpp ../uae_cpu/memory.cpp ../uae_cpu/newcpu.cpp ../uae_cpu/readcpu.cpp $FPUSRCS cpustbl.cpp cpudefs.cpp $CPUSRCS"
608 > fi
609 >
610 > dnl Remove the "-g" option if set for GCC.
611 > if [[ "x$HAVE_GCC27" = "xyes" ]]; then
612 >  dnl gb-- Probably not the cleanest way to take
613 >  CFLAGS=`echo $CFLAGS | sed -e 's/ -g / /;s/^-g / /;s/ -g$/ /;s/^-g$//'`
614 >  CXXFLAGS=`echo $CXXFLAGS | sed -e 's/ -g / /;s/^-g / /;s/ -g$/ /;s/^-g$//'`
615 > fi
616  
617   dnl Generate Makefile.
618   AC_SUBST(DEFINES)
# Line 288 | Line 626 | echo
626   echo Basilisk II configuration summary:
627   echo
628   echo XFree86 DGA support .............. : $WANT_XF86_DGA
629 + echo XFree86 VidMode support .......... : $WANT_XF86_VIDMODE
630   echo fbdev DGA support ................ : $WANT_FBDEV_DGA
631 + echo Enable video on SEGV signals ..... : $WANT_VOSF
632   echo ESD sound support ................ : $WANT_ESD
633 < echo GTK user interface ............... : $WANT_UI
633 > echo GTK user interface ............... : $WANT_GTK
634   echo mon debugger support ............. : $WANT_MON
635 < echo i386 assembly optimizations ...... : $WANT_X86_ASSEMBLY
636 < echo SPARC V8 assembly optimizations .. : $WANT_SPARC_V8_ASSEMBLY
637 < echo SPARC V9 assembly optimizations .. : $WANT_SPARC_V9_ASSEMBLY
635 > echo Running m68k code natively ....... : $WANT_NATIVE_M68K
636 > echo Assembly optimizations ........... : $ASM_OPTIMIZATIONS
637 > echo Addressing mode .................. : $ADDRESSING_MODE
638   echo
639 < echo "Configuration done. Now type \"make\"."
639 > echo "Configuration done. Now type \"make\" (or \"gmake\")."

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines