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.3 by cebix, 1999-10-05T15:29:04Z vs.
Revision 1.34 by gbeauche, 2001-03-20T17:35:45Z

# 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 > 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
67   AC_PROG_INSTALL
68  
69 + dnl We use mon if possible.
70 + MONSRCS=
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.
90 + AC_CHECK_LIB(posix4, sem_init)
91 +
92 + dnl We need X11.
93   AC_PATH_XTRA
94   if [[ "x$no_x" = "xyes" ]]; then
95    AC_MSG_ERROR([You need X11 to run Basilisk II.])
96   fi
25
97   CFLAGS="$CFLAGS $X_CFLAGS"
98   CXXFLAGS="$CXXFLAGS $X_CFLAGS"
99   LIBS="$LIBS $X_PRE_LIBS $X_LIBS -lX11 -lXext $X_EXTRA_LIBS"
29 STATICLIBS=
100  
101 < dnl We need pthreads.
102 < AC_CHECK_LIB(pthread, pthread_create, HAVE_PTHREADS=yes, HAVE_PTHREADS=no)
103 < if [[ "x$HAVE_PTHREADS" = "xno" ]]; then
104 <  dnl Check even the libc_r (FreeBSD)
105 <  AC_CHECK_LIB(c_r, pthread_create, HAVE_PTHREADS=yes, HAVE_PTHREADS=no)
106 <  if [[ "x$HAVE_PTHREADS" = "xno" ]]; then
107 <     AC_MSG_ERROR([You need libpthreads to run Basilisk II.])
108 <  else
109 <     LIBS="$LIBS -lc_r"
110 <  fi
111 < else
42 <  LIBS="$LIBS -lpthread"
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 >      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 We use DGA if possible.
116 < if [[ "x$WANT_DGA" = "xyes" ]]; then
117 <  AC_CHECK_LIB(Xxf86dga, XF86DGAQueryExtension, HAVE_DGA=yes, HAVE_DGA=no)
118 <  if [[ "x$HAVE_DGA" = "xno" ]]; then
119 <    AC_MSG_WARN([Could not find DGA extension, ignoring --enable-dga.])
51 <  else
52 <    DEFINES="$DEFINES -DENABLE_DGA=1"
53 <    LIBS="$LIBS -lXxf86dga"
115 > dnl If POSIX.4 semaphores are not available, we emulate them with pthread mutexes.
116 > SEMSRC=
117 > AC_CHECK_FUNCS(sem_init, , [
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 +    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.])
130 +      WANT_FBDEV_DGA=no
131 +    fi
132 +  ], [
133 +    AC_MSG_WARN([Could not find XFree86 DGA extension, ignoring --enable-xf86-dga.])
134 +    WANT_XF86_DGA=no
135 +  ])
136 + fi
137 + if [[ "x$WANT_FBDEV_DGA" = "xyes" ]]; then
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 < if [[ "x$WANT_UI" = "xyes" ]]; then
154 <  AM_PATH_GTK(1.2.0)
155 <  if [[ "x$no_gtk" = "xyes" ]]; then
156 <    echo "Did not find gtk+, disabling user interface."
157 <    WANT_UI=no
158 <    GTK_CFLAGS=
159 <    GTK_LIBS=
160 <  else
161 <    DEFINES="$DEFINES -DENABLE_GTK=1"
162 <  fi
163 <  CFLAGS="$CFLAGS $GTK_CFLAGS"
164 <  CXXFLAGS="$CXXFLAGS $GTK_CFLAGS"
165 <  LIBS="$LIBS $GTK_LIBS"
166 < fi
167 <
168 < dnl We need POSIX.4 semaphores (and other POSIX.4 blessings).
169 < SEMSRCS=
170 < AC_CHECK_FUNCS(sem_init)
171 < if [[ "x$ac_cv_func_sem_init" = "xno" ]]; then
172 <  AC_CHECK_LIB(posix4, sem_init, HAVE_LIBPOSIX4=yes, HAVE_LIBPOSIX4=no)
173 <  if [[ "x$HAVE_LIBPOSIX4" = "xno" ]]; then
174 <    dnl Checks for the existance of semget
175 <    AC_CHECK_FUNCS(semget)
176 <    if [[ "x$ac_cv_func_semget" = "xno" ]]; then
177 <      AC_MSG_ERROR([You need POSIX.4 semaphores to run Basilisk II.])
83 <    else
84 <      SEMSRCS="posix_sem.cpp"
85 <    fi
86 <  else
87 <    LIBS="$LIBS -lposix4"
88 <  fi
153 > UISRCS=../dummy/prefs_editor_dummy.cpp
154 > if [[ "x$WANT_GTK" = "xyes" ]]; then
155 >  AM_PATH_GTK(1.2.0, [
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_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 >    AC_DEFINE(ENABLE_ESD)
171 >    CFLAGS="$CFLAGS $ESD_CFLAGS"
172 >    CXXFLAGS="$CXXFLAGS $ESD_CFLAGS"
173 >    LIBS="$LIBS $ESD_LIBS"
174 >  ], [
175 >    AC_MSG_WARN([Could not find ESD, disabling ESD support.])
176 >    WANT_ESD=no
177 >  ])
178   fi
179  
180   dnl Checks for header files.
# Line 100 | 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)
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 Linux/audio_linux.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
127 <      AC_CHECK_HEADER(/sys/cam/cam.h)
128 <      if [[ "x$ac_cv_header__sys_cam_cam_h" = "xno" ]]; then
129 <        dnl In this case I should fix this thing including a "patch"
130 <        dnl to access directly to the functions in the kernel :) --Orlando
131 <        AC_MSG_ERROR([Cannot find kernel includes for CAM library.])
132 <      fi
133 <      SYSSRCS="../dummy/ether_dummy.cpp FreeBSD/scsi_freebsd.cpp ../dummy/audio_dummy.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
147 <      AC_CHECK_HEADER(scsi.h sys/scsiio.h)
148 <      if [[ "x$ac_cv_header_scsi_h" = "xno" ]]; then
149 <        AC_MSG_ERROR([Cannot find includes for the SCSI library.])
150 <      fi
151 <      SYSSRCS="../dummy/ether_dummy.cpp FreeBSD/scsi_freebsd.cpp ../dummy/audio_dummy.cpp"
252 >      SCSISRC=FreeBSD/scsi_freebsd.cpp
253        LIBS="$LIBS -lscsi"
153      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
166  if [[ "x$WANT_UI" = "xyes" ]]; then
167    SYSSRCS="$SYSSRCS prefs_editor_gtk.cpp"
168  else
169    SYSSRCS="$SYSSRCS ../dummy/prefs_editor_dummy.cpp"
170  fi
474   fi
475 < if [[ "x$SEMSRCS" != "x" ]]; then
476 <  SYSSRCS="$SYSSRCS $SEMSRCS"
475 >
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 Defaults for UAE CPU.
483 < CPUINCLUDES="-I../uae_cpu"
484 < 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"
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 Check for i386.
531 < HAVE_I386=no
532 < AC_MSG_CHECKING(for x86 target CPU)
533 < AC_EGREP_CPP(yes,
534 < [
535 < #ifdef __i386__
186 <  yes
187 < #endif
188 < ], [AC_MSG_RESULT(yes); HAVE_I386=yes], AC_MSG_RESULT(no))
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 206 | 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.
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 + 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 <    DEFINES="$DEFINES -DX86_ASSEMBLY"
571 <    CPUSRCS="$CPUSRCS cpufast.s"
572 <  else
573 <    CPUSRCS="$CPUSRCS cpuemu.cpp"
570 >    ASM_OPTIMIZATIONS=i386
571 >    DEFINES="$DEFINES -DX86_ASSEMBLY -DUNALIGNED_PROFITABLE -DOPTIMIZED_FLAGS"
572 >    CPUSRCS="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 < else
576 <  CPUSRCS="$CPUSRCS cpuemu.cpp"
575 > elif [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_SPARC" = "xyes" -a "x$HAVE_GAS" = "xyes" ]]; then
576 >  dnl SPARC CPU
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 >      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 >      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 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)
230 AC_SUBST(STATICLIBS)
619   AC_SUBST(SYSSRCS)
620   AC_SUBST(CPUINCLUDES)
621   AC_SUBST(CPUSRCS)
622   AC_OUTPUT(Makefile)
623 < echo "Configuration done. Now type \"make\"."
623 >
624 > dnl Print summary.
625 > 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_GTK
634 > echo mon debugger support ............. : $WANT_MON
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\" (or \"gmake\")."

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines