ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/SheepShaver/src/Unix/configure.in
(Generate patch)

Comparing SheepShaver/src/Unix/configure.in (file contents):
Revision 1.1 by cebix, 2002-02-04T16:58:13Z vs.
Revision 1.5 by gbeauche, 2003-05-22T22:12:04Z

# Line 8 | Line 8 | AC_CONFIG_HEADER(config.h)
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(xf86-vidmode, [  --enable-xf86-vidmode   use the XFree86 VidMode extension [default=yes]], [WANT_XF86_VIDMODE=$enableval], [WANT_XF86_VIDMODE=yes])
11 + AC_ARG_ENABLE(vosf,         [  --enable-vosf           enable video on SEGV signals [default=yes]], [WANT_VOSF=$enableval], [WANT_VOSF=yes])
12   AC_ARG_WITH(esd,            [  --with-esd              support ESD for sound under Linux/FreeBSD [default=yes]], [WANT_ESD=$withval], [WANT_ESD=yes])
13   AC_ARG_WITH(gtk,            [  --with-gtk              use GTK user interface [default=yes]], [WANT_GTK=$withval], [WANT_GTK=yes])
14   AC_ARG_WITH(mon,            [  --with-mon              use mon as debugger [default=yes]], [WANT_MON=$withval], [WANT_MON=yes])
# Line 39 | Line 40 | if [[ "x$WANT_MON" = "xyes" ]]; then
40      AC_DEFINE(ENABLE_MON)
41      MONSRCS="$mon_srcdir/mon.cpp $mon_srcdir/mon_6502.cpp $mon_srcdir/mon_z80.cpp $mon_srcdir/mon_cmd.cpp $mon_srcdir/mon_lowmem.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"
42      CXXFLAGS="$CXXFLAGS -I$mon_srcdir -I$mon_srcdir/disass"
43 +    AC_CHECK_LIB(ncurses, tgetent, ,
44 +      AC_CHECK_LIB(termcap, tgetent, ,
45 +        AC_CHECK_LIB(termlib, tgetent, ,
46 +          AC_CHECK_LIB(terminfo, tgetent, ,
47 +            AC_CHECK_LIB(Hcurses, tgetent, ,
48 +              AC_CHECK_LIB(curses, tgetent))))))
49      AC_CHECK_LIB(readline, readline)
43    AC_CHECK_LIB(termcap, tputs)
50      AC_CHECK_HEADERS(readline.h history.h readline/readline.h readline/history.h)
51    else
52      AC_MSG_RESULT(no)
# Line 77 | Line 83 | fi
83   dnl If POSIX.4 semaphores are not available, we emulate them with pthread mutexes.
84   SEMSRC=
85   AC_CHECK_FUNCS(sem_init, , [
86 <  if [[ "x$HAVE_PTHREADS" = "xyes" ]]; then
86 >  if test "x$HAVE_PTHREADS" = "xyes"; then
87      SEMSRC=posix_sem.cpp
88    fi
89   ])
# Line 135 | Line 141 | fi
141   dnl Checks for header files.
142   AC_HEADER_STDC
143   AC_HEADER_SYS_WAIT
144 < AC_CHECK_HEADERS(unistd.h fcntl.h sys/time.h)
144 > AC_CHECK_HEADERS(unistd.h fcntl.h sys/time.h sys/mman.h)
145  
146   dnl Checks for typedefs, structures, and compiler characteristics.
147   AC_C_BIGENDIAN
# Line 145 | Line 151 | AC_CHECK_SIZEOF(short, 2)
151   AC_CHECK_SIZEOF(int, 4)
152   AC_CHECK_SIZEOF(long, 4)
153   AC_CHECK_SIZEOF(long long, 8)
154 + AC_CHECK_SIZEOF(float, 4)
155 + AC_CHECK_SIZEOF(double, 8)
156 + AC_CHECK_SIZEOF(void *, 4)
157   AC_TYPE_OFF_T
158   AC_CHECK_TYPE(loff_t, off_t)
159   AC_TYPE_SIZE_T
160 + AC_TYPE_SIGNAL
161   AC_HEADER_TIME
162   AC_STRUCT_TM
163  
164   dnl Checks for library functions.
165   AC_CHECK_FUNCS(strdup cfmakeraw)
166   AC_CHECK_FUNCS(nanosleep clock_gettime timer_create)
167 + AC_CHECK_FUNCS(sigaction signal)
168 + AC_CHECK_FUNCS(mmap mprotect munmap)
169 + AC_CHECK_FUNCS(vm_allocate vm_deallocate vm_protect)
170  
171   dnl Select system-dependant sources.
172   if [[ "x$HAVE_PPC" = "xyes" ]]; then
# Line 163 | Line 176 | else
176   fi
177   SYSSRCS="$SYSSRCS $SEMSRCS $UISRCS $MONSRCS"
178  
179 + dnl Define a macro that translates a yesno-variable into a C macro definition
180 + dnl to be put into the config.h file
181 + dnl $1 -- the macro to define
182 + dnl $2 -- the value to translate
183 + dnl $3 -- template name
184 + AC_DEFUN(AC_TRANSLATE_DEFINE, [
185 +    if [[ "x$2" = "xyes" -o "x$2" = "xguessing yes" ]]; then
186 +        AC_DEFINE($1, 1, $3)
187 +    fi
188 + ])
189 +
190 + dnl Various checks if the system supports vm_allocate() and the like functions.
191 + have_mach_vm=no
192 + if [[ "x$ac_cv_func_vm_allocate" = "xyes" -a "x$ac_cv_func_vm_deallocate" = "xyes" -a \
193 +      "x$ac_cv_func_vm_protect" = "xyes" ]]; then
194 +  have_mach_vm=yes
195 + fi
196 + AC_TRANSLATE_DEFINE(HAVE_MACH_VM, "$have_mach_vm",
197 +  [Define if your system has a working vm_allocate()-based memory allocator.])
198 +
199 + dnl Check that vm_allocate(), vm_protect() work
200 + if [[ "x$have_mach_vm" = "xyes" ]]; then
201 +
202 + AC_CACHE_CHECK([whether vm_protect works],
203 +  ac_cv_vm_protect_works, [
204 +  AC_LANG_SAVE
205 +  AC_LANG_CPLUSPLUS
206 +  ac_cv_vm_protect_works=yes
207 +  dnl First the tests that should segfault
208 +  for test_def in NONE_READ NONE_WRITE READ_WRITE; do
209 +    AC_TRY_RUN([
210 +      #define CONFIGURE_TEST_VM_MAP
211 +      #define TEST_VM_PROT_$test_def
212 +      #include "vm_alloc.cpp"
213 +    ], ac_cv_vm_protect_works=no, rm -f core,
214 +    dnl When cross-compiling, do not assume anything
215 +    ac_cv_vm_protect_works="guessing no"
216 +    )
217 +  done
218 +  AC_TRY_RUN([
219 +    #define CONFIGURE_TEST_VM_MAP
220 +    #define TEST_VM_PROT_RDWR_WRITE
221 +    #include "vm_alloc.cpp"
222 +  ], , ac_cv_vm_protect_works=no,
223 +  dnl When cross-compiling, do not assume anything
224 +  ac_cv_vm_protect_works="guessing no"
225 +  )
226 +  AC_LANG_RESTORE
227 +  ]
228 + )
229 +
230 + dnl Remove support for vm_allocate() if vm_protect() does not work
231 + if [[ "x$have_mach_vm" = "xyes" ]]; then
232 +  case $ac_cv_vm_protect_works in
233 +    *yes) have_mach_vm=yes;;
234 +    *no) have_mach_vm=no;;
235 +  esac
236 + fi
237 + AC_TRANSLATE_DEFINE(HAVE_MACH_VM, "$have_mach_vm",
238 +  [Define if your system has a working vm_allocate()-based memory allocator.])
239 +
240 + fi dnl HAVE_MACH_VM
241 +
242 + dnl Various checks if the system supports mmap() and the like functions.
243 + dnl ... and Mach memory allocators are not supported
244 + have_mmap_vm=no
245 + if [[ "x$ac_cv_func_mmap" = "xyes" -a "x$ac_cv_func_munmap" = "xyes" -a \
246 +      "x$ac_cv_func_mprotect" = "xyes" ]]; then
247 +  if [[ "x$have_mach_vm" = "xno" ]]; then
248 +    have_mmap_vm=yes
249 +  fi
250 + fi
251 + AC_TRANSLATE_DEFINE(HAVE_MMAP_VM, "$have_mmap_vm",
252 +  [Define if your system has a working mmap()-based memory allocator.])
253 +
254 + dnl Check that mmap() and associated functions work.
255 + if [[ "x$have_mmap_vm" = "xyes" ]]; then
256 +
257 + dnl Check if we have a working anonymous mmap()
258 + AC_CACHE_CHECK([whether mmap supports MAP_ANON],
259 +  ac_cv_mmap_anon, [
260 +  AC_LANG_SAVE
261 +  AC_LANG_CPLUSPLUS
262 +  AC_TRY_RUN([
263 +    #define HAVE_MMAP_ANON
264 +    #define CONFIGURE_TEST_VM_MAP
265 +    #define TEST_VM_MMAP_ANON
266 +    #include "vm_alloc.cpp"
267 +  ], ac_cv_mmap_anon=yes, ac_cv_mmap_anon=no,
268 +  dnl When cross-compiling, do not assume anything.
269 +  ac_cv_mmap_anon="guessing no"
270 +  )
271 +  AC_LANG_RESTORE
272 +  ]
273 + )
274 + AC_TRANSLATE_DEFINE(HAVE_MMAP_ANON, "$ac_cv_mmap_anon",
275 +  [Define if <sys/mman.h> defines MAP_ANON and mmap()'ing with MAP_ANON works.])
276 +
277 + AC_CACHE_CHECK([whether mmap supports MAP_ANONYMOUS],
278 +  ac_cv_mmap_anonymous, [
279 +  AC_LANG_SAVE
280 +  AC_LANG_CPLUSPLUS
281 +  AC_TRY_RUN([
282 +    #define HAVE_MMAP_ANONYMOUS
283 +    #define CONFIGURE_TEST_VM_MAP
284 +    #define TEST_VM_MMAP_ANON
285 +    #include "vm_alloc.cpp"
286 +  ], ac_cv_mmap_anonymous=yes, ac_cv_mmap_anonymous=no,
287 +  dnl When cross-compiling, do not assume anything.
288 +  ac_cv_mmap_anonymous="guessing no"
289 +  )
290 +  AC_LANG_RESTORE
291 +  ]
292 + )
293 + AC_TRANSLATE_DEFINE(HAVE_MMAP_ANONYMOUS, "$ac_cv_mmap_anonymous",
294 +  [Define if <sys/mman.h> defines MAP_ANONYMOUS and mmap()'ing with MAP_ANONYMOUS works.])
295 +
296 + AC_CACHE_CHECK([whether mprotect works],
297 +  ac_cv_mprotect_works, [
298 +  AC_LANG_SAVE
299 +  AC_LANG_CPLUSPLUS
300 +  ac_cv_mprotect_works=yes
301 +  dnl First the tests that should segfault
302 +  for test_def in NONE_READ NONE_WRITE READ_WRITE; do
303 +    AC_TRY_RUN([
304 +      #define CONFIGURE_TEST_VM_MAP
305 +      #define TEST_VM_PROT_$test_def
306 +      #include "vm_alloc.cpp"
307 +    ], ac_cv_mprotect_works=no, rm -f core,
308 +    dnl When cross-compiling, do not assume anything
309 +    ac_cv_mprotect_works="guessing no"
310 +    )
311 +  done
312 +  AC_TRY_RUN([
313 +    #define CONFIGURE_TEST_VM_MAP
314 +    #define TEST_VM_PROT_RDWR_WRITE
315 +    #include "vm_alloc.cpp"
316 +  ], , ac_cv_mprotect_works=no,
317 +  dnl When cross-compiling, do not assume anything
318 +  ac_cv_mprotect_works="guessing no"
319 +  )
320 +  AC_LANG_RESTORE
321 +  ]
322 + )
323 +
324 + dnl Remove support for mmap() if mprotect() does not work
325 + if [[ "x$have_mmap_vm" = "xyes" ]]; then
326 +  case $ac_cv_mprotect_works in
327 +    *yes) have_mmap_vm=yes;;
328 +    *no) have_mmap_vm=no;;
329 +  esac
330 + fi
331 + AC_TRANSLATE_DEFINE(HAVE_MMAP_VM, $have_mmap_vm,
332 +  [Define if your system has a working mmap()-based memory allocator.])
333 +
334 + fi dnl HAVE_MMAP_VM
335 +
336 + dnl Check if we can mmap 0x2000 bytes from 0x0000
337 + AC_CACHE_CHECK([whether we can map Low Memory area 0x0000-0x2000],
338 +  ac_cv_can_map_lm, [
339 +  AC_LANG_SAVE
340 +  AC_LANG_CPLUSPLUS
341 +  AC_TRY_RUN([
342 +    #include "vm_alloc.cpp"
343 +    int main(void) { /* returns 0 if we could map the lowmem globals */
344 +      volatile char * lm = 0;
345 +      if (vm_init() < 0) exit(1);
346 +      if (vm_acquire_fixed(0, 0x2000) < 0) exit(1);
347 +      lm[0] = 'z';
348 +      if (vm_release((char *)lm, 0x2000) < 0) exit(1);
349 +      vm_exit(); exit(0);
350 +    }
351 +  ], ac_cv_can_map_lm=yes, ac_cv_can_map_lm=no,
352 +  dnl When cross-compiling, do not assume anything.
353 +  ac_cv_can_map_lm="guessing no"
354 +  )
355 +  AC_LANG_RESTORE
356 +  ]
357 + )
358 +
359 + dnl Check signal handlers need to be reinstalled
360 + AC_CACHE_CHECK([whether signal handlers need to be reinstalled],
361 +  ac_cv_signal_need_reinstall, [
362 +  AC_LANG_SAVE
363 +  AC_LANG_CPLUSPLUS
364 +  AC_TRY_RUN([
365 +    #include <stdlib.h>
366 +    #ifdef HAVE_UNISTD_H
367 +    #include <unistd.h>
368 +    #endif
369 +    #include <signal.h>
370 +    static int handled_signal = 0;
371 +    RETSIGTYPE sigusr1_handler(int) { handled_signal++; }
372 +    int main(void) { /* returns 0 if signals need not to be reinstalled */
373 +      signal(SIGUSR1, sigusr1_handler); raise(SIGUSR1); raise(SIGUSR1);
374 +      exit(handled_signal == 2);
375 +    }
376 +  ], ac_cv_signal_need_reinstall=yes, ac_cv_signal_need_reinstall=no,
377 +  dnl When cross-compiling, do not assume anything.
378 +  ac_cv_signal_need_reinstall="guessing yes"
379 +  )
380 +  AC_LANG_RESTORE
381 +  ]
382 + )
383 + AC_TRANSLATE_DEFINE(SIGNAL_NEED_REINSTALL, "$ac_cv_signal_need_reinstall",
384 +  [Define if your system requires signals to be reinstalled.])
385 +
386 + dnl Check if sigaction handlers need to be reinstalled
387 + AC_CACHE_CHECK([whether sigaction handlers need to be reinstalled],
388 +  ac_cv_sigaction_need_reinstall, [
389 +  AC_LANG_SAVE
390 +  AC_LANG_CPLUSPLUS
391 +  AC_TRY_RUN([
392 +    #include <stdlib.h>
393 +    #ifdef HAVE_UNISTD_H
394 +    #include <unistd.h>
395 +    #endif
396 +    #include <signal.h>
397 +    static int handled_signal = 0;
398 +    RETSIGTYPE sigusr1_handler(int) { handled_signal++; }
399 +    typedef RETSIGTYPE (*signal_handler)(int);
400 +    static signal_handler mysignal(int sig, signal_handler handler) {
401 +      struct sigaction old_sa;
402 +      struct sigaction new_sa;
403 +      new_sa.sa_handler = handler;
404 +      return ((sigaction(sig,&new_sa,&old_sa) < 0) ? SIG_IGN : old_sa.sa_handler);
405 +    }
406 +    int main(void) { /* returns 0 if signals need not to be reinstalled */
407 +      mysignal(SIGUSR1, sigusr1_handler); raise(SIGUSR1); raise(SIGUSR1);
408 +      exit(handled_signal == 2);
409 +    }
410 +  ], ac_cv_sigaction_need_reinstall=yes, ac_cv_sigaction_need_reinstall=no,
411 +  dnl When cross-compiling, do not assume anything.
412 +  ac_cv_sigaction_need_reinstall="guessing yes"
413 +  )
414 +  AC_LANG_RESTORE
415 +  ]
416 + )
417 + AC_TRANSLATE_DEFINE(SIGACTION_NEED_REINSTALL, "$ac_cv_sigaction_need_reinstall",
418 +  [Define if your system requires sigactions to be reinstalled.])
419 +
420 + dnl Check if extended signals are supported.
421 + AC_CACHE_CHECK([whether your system supports extended signal handlers],
422 +  ac_cv_have_extended_signals, [
423 +  AC_LANG_SAVE
424 +  AC_LANG_CPLUSPLUS
425 +  AC_TRY_RUN([
426 +    #define HAVE_SIGINFO_T 1
427 +    #define CONFIGURE_TEST_SIGSEGV_RECOVERY
428 +    #include "vm_alloc.cpp"
429 +    #include "sigsegv.cpp"
430 +  ], ac_cv_have_extended_signals=yes, ac_cv_have_extended_signals=no,
431 +  dnl When cross-compiling, do not assume anything.
432 +  ac_cv_have_extended_signals=no
433 +  )
434 +  AC_LANG_RESTORE
435 +  ]
436 + )
437 + AC_TRANSLATE_DEFINE(HAVE_SIGINFO_T, "$ac_cv_have_extended_signals",
438 +  [Define if your system support extended signals.])
439 +
440 + dnl Otherwise, check for subterfuges.
441 + if [[ "x$ac_cv_have_extended_signals" = "xno" ]]; then
442 +  AC_CACHE_CHECK([whether we then have a subterfuge for your system],
443 +  ac_cv_have_sigcontext_hack, [
444 +    AC_LANG_SAVE
445 +    AC_LANG_CPLUSPLUS
446 +    AC_TRY_RUN([
447 +      #define HAVE_SIGCONTEXT_SUBTERFUGE 1
448 +      #define CONFIGURE_TEST_SIGSEGV_RECOVERY
449 +      #include "vm_alloc.cpp"
450 +      #include "sigsegv.cpp"
451 +    ], ac_cv_have_sigcontext_hack=yes, ac_cv_have_sigcontext_hack=no,
452 +    dnl When cross-compiling, do not assume anything.
453 +    ac_cv_have_sigcontext_hack=no
454 +    )
455 +    AC_LANG_RESTORE
456 +  ])
457 +  AC_TRANSLATE_DEFINE(HAVE_SIGCONTEXT_SUBTERFUGE, "$ac_cv_have_sigcontext_hack",
458 +    [Define if we know a hack to replace siginfo_t->si_addr member.])
459 + fi
460 +
461 + dnl Check if we can ignore the fault (instruction skipping in SIGSEGV handler)
462 + AC_CACHE_CHECK([whether we can skip instruction in SIGSEGV handler],
463 +  ac_cv_have_skip_instruction, [
464 +  AC_LANG_SAVE
465 +  AC_LANG_CPLUSPLUS
466 +  AC_TRY_RUN([
467 +    #define HAVE_SIGSEGV_SKIP_INSTRUCTION 1
468 +    #define CONFIGURE_TEST_SIGSEGV_RECOVERY
469 +    #include "vm_alloc.cpp"
470 +    #include "sigsegv.cpp"
471 +  ], ac_cv_have_skip_instruction=yes, ac_cv_have_skip_instruction=no,
472 +  dnl When cross-compiling, do not assume anything.
473 +  ac_cv_have_skip_instruction=no
474 +  )
475 +  AC_LANG_RESTORE
476 +  ]
477 + )
478 + AC_TRANSLATE_DEFINE(HAVE_SIGSEGV_SKIP_INSTRUCTION, "$ac_cv_have_skip_instruction",
479 +  [Define if we can ignore the fault (instruction skipping in SIGSEGV handler).])
480 +
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 Enable VOSF screen updates with this feature is requested and feasible
488 + if [[ "x$WANT_VOSF" = "xyes" -a "x$CAN_VOSF" = "xyes" ]]; then
489 +    AC_DEFINE(ENABLE_VOSF, 1, [Define if using video enabled on SEGV signals.])
490 + else
491 +    WANT_VOSF=no
492 + fi
493 +
494   dnl Generate Makefile.
495   AC_SUBST(SYSSRCS)
496   AC_OUTPUT(Makefile)
# Line 173 | Line 501 | echo SheepShaver configuration summary:
501   echo
502   echo XFree86 DGA support .............. : $WANT_XF86_DGA
503   echo XFree86 VidMode support .......... : $WANT_XF86_VIDMODE
504 + echo Enable video on SEGV signals ..... : $WANT_VOSF
505   echo ESD sound support ................ : $WANT_ESD
506   echo GTK user interface ............... : $WANT_GTK
507   echo mon debugger support ............. : $WANT_MON

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines