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.7 by cebix, 1999-10-18T16:15:44Z vs.
Revision 1.32 by gbeauche, 2001-01-28T14:04:32Z

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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines