14 |
|
dnl cores for the configure tests since some are intended to dump core. |
15 |
|
ulimit -c 0 |
16 |
|
|
17 |
+ |
AC_ARG_ENABLE(standalone-gui,[ --enable-standalone-gui enable a standalone GUI prefs editor [default=no]], [WANT_STANDALONE_GUI=$enableval], [WANT_STANDALONE_GUI=no]) |
18 |
+ |
|
19 |
|
dnl Video options. |
20 |
|
AC_ARG_ENABLE(xf86-dga, [ --enable-xf86-dga use the XFree86 DGA extension [default=yes]], [WANT_XF86_DGA=$enableval], [WANT_XF86_DGA=yes]) |
21 |
|
AC_ARG_ENABLE(xf86-vidmode, [ --enable-xf86-vidmode use the XFree86 VidMode extension [default=yes]], [WANT_XF86_VIDMODE=$enableval], [WANT_XF86_VIDMODE=yes]) |
23 |
|
AC_ARG_ENABLE(vosf, [ --enable-vosf enable video on SEGV signals [default=yes]], [WANT_VOSF=$enableval], [WANT_VOSF=yes]) |
24 |
|
|
25 |
|
dnl SDL options. |
26 |
+ |
AC_ARG_ENABLE(sdl-static, [ --enable-sdl-static use SDL static libraries for linking [default=no]], [WANT_SDL_STATIC=$enableval], [WANT_SDL_STATIC=no]) |
27 |
|
AC_ARG_ENABLE(sdl-video, [ --enable-sdl-video use SDL for video graphics [default=no]], [WANT_SDL_VIDEO=$enableval], [WANT_SDL_VIDEO=no]) |
28 |
|
AC_ARG_ENABLE(sdl-audio, [ --enable-sdl-audio use SDL for audio [default=no]], [WANT_SDL_AUDIO=$enableval], [WANT_SDL_AUDIO=no]) |
29 |
|
|
62 |
|
|
63 |
|
dnl External packages. |
64 |
|
AC_ARG_WITH(esd, [ --with-esd support ESD for sound under Linux/FreeBSD [default=yes]], [WANT_ESD=$withval], [WANT_ESD=yes]) |
65 |
< |
AC_ARG_WITH(gtk, [ --with-gtk use GTK user interface [default=yes]], [WANT_GTK=$withval], [WANT_GTK=yes]) |
65 |
> |
AC_ARG_WITH(gtk, [ --with-gtk use GTK user interface [default=yes]], |
66 |
> |
[case "$withval" in |
67 |
> |
gtk1) WANT_GTK="gtk";; |
68 |
> |
gtk|gtk2) WANT_GTK="$withval";; |
69 |
> |
yes) WANT_GTK="gtk2 gtk";; |
70 |
> |
*) WANT_GTK="no";; |
71 |
> |
esac], |
72 |
> |
[WANT_GTK="gtk2 gtk"]) |
73 |
|
AC_ARG_WITH(mon, [ --with-mon use mon as debugger [default=yes]], [WANT_MON=$withval], [WANT_MON=yes]) |
74 |
|
|
75 |
|
dnl Canonical system information. |
138 |
|
AC_CHECK_LIB(posix4, sem_init) |
139 |
|
AC_CHECK_LIB(rt, timer_create) |
140 |
|
AC_CHECK_LIB(rt, shm_open) |
141 |
+ |
AC_CHECK_LIB(m, cos) |
142 |
|
|
143 |
|
dnl Do we need SDL? |
144 |
|
WANT_SDL=no |
164 |
|
;; |
165 |
|
*) |
166 |
|
sdl_cflags=`$sdl_config --cflags` |
167 |
< |
sdl_libs=`$sdl_config --libs` |
167 |
> |
if [[ "x$WANT_SDL_STATIC" = "xyes" ]]; then |
168 |
> |
sdl_libs=`$sdl_config --static-libs` |
169 |
> |
else |
170 |
> |
sdl_libs=`$sdl_config --libs` |
171 |
> |
fi |
172 |
|
;; |
173 |
|
esac |
174 |
|
CFLAGS="$CFLAGS $sdl_cflags" |
205 |
|
if [[ "x$HAVE_PTHREADS" = "xyes" ]]; then |
206 |
|
AC_DEFINE(HAVE_PTHREADS, 1, [Define if pthreads are available.]) |
207 |
|
fi |
208 |
< |
AC_CHECK_FUNCS(pthread_cancel) |
208 |
> |
AC_CHECK_FUNCS(pthread_cond_init) |
209 |
> |
AC_CHECK_FUNCS(pthread_cancel pthread_testcancel) |
210 |
|
AC_CHECK_FUNCS(pthread_mutexattr_setprotocol) |
211 |
|
AC_CHECK_FUNCS(pthread_mutexattr_settype) |
212 |
|
AC_CHECK_FUNCS(pthread_mutexattr_setpshared) |
250 |
|
|
251 |
|
dnl We use GTK+ if possible. |
252 |
|
UISRCS=../dummy/prefs_editor_dummy.cpp |
253 |
< |
if [[ "x$WANT_GTK" = "xyes" ]]; then |
253 |
> |
case "x$WANT_GTK" in |
254 |
> |
xgtk2*) |
255 |
> |
AM_PATH_GTK_2_0(1.3.15, [ |
256 |
> |
GUI_CFLAGS="$GTK_CFLAGS" |
257 |
> |
GUI_LIBS="$GTK_LIBS" |
258 |
> |
WANT_GTK=gtk2 |
259 |
> |
], [ |
260 |
> |
case "x${WANT_GTK}x" in |
261 |
> |
*gtkx) |
262 |
> |
AC_MSG_WARN([Could not find GTK+ 2.0, trying with GTK+ 1.2.]) |
263 |
> |
WANT_GTK=gtk |
264 |
> |
;; |
265 |
> |
*) |
266 |
> |
AC_MSG_WARN([Could not find GTK+, disabling user interface.]) |
267 |
> |
WANT_GTK=no |
268 |
> |
;; |
269 |
> |
esac |
270 |
> |
]) |
271 |
> |
;; |
272 |
> |
esac |
273 |
> |
if [[ "x$WANT_GTK" = "xgtk" ]]; then |
274 |
|
AM_PATH_GTK(1.2.0, [ |
275 |
< |
AC_DEFINE(ENABLE_GTK, 1, [Define if using GTK.]) |
276 |
< |
CXXFLAGS="$CXXFLAGS $GTK_CFLAGS" |
241 |
< |
LIBS="$LIBS $GTK_LIBS" |
242 |
< |
UISRCS=prefs_editor_gtk.cpp |
275 |
> |
GUI_CFLAGS="$GTK_CFLAGS" |
276 |
> |
GUI_LIBS="$GTK_LIBS" |
277 |
|
dnl somehow, <gnome-i18n.h> would redefine gettext() to nothing if |
278 |
|
dnl ENABLE_NLS is not set, thusly conflicting with C++ <string> which |
279 |
|
dnl includes <libintl.h> |
280 |
|
AM_GNU_GETTEXT |
281 |
|
B2_PATH_GNOMEUI([ |
282 |
|
AC_DEFINE(HAVE_GNOMEUI, 1, [Define if libgnomeui is available.]) |
283 |
< |
CXXFLAGS="$CXXFLAGS $GNOMEUI_CFLAGS" |
284 |
< |
LIBS="$LIBS $GNOMEUI_LIBS" |
283 |
> |
GUI_CFLAGS="$GUI_CFLAGS $GNOMEUI_CFLAGS" |
284 |
> |
GUI_LIBS="$GUI_LIBS $GNOMEUI_LIBS" |
285 |
|
], []) |
286 |
|
], [ |
287 |
|
AC_MSG_WARN([Could not find GTK+, disabling user interface.]) |
288 |
|
WANT_GTK=no |
289 |
|
]) |
290 |
|
fi |
291 |
+ |
if [[ "x$WANT_GTK" != "xno" -a "x$WANT_STANDALONE_GUI" = "xno" ]]; then |
292 |
+ |
AC_DEFINE(ENABLE_GTK, 1, [Define if using GTK.]) |
293 |
+ |
UISRCS=prefs_editor_gtk.cpp |
294 |
+ |
fi |
295 |
+ |
AC_SUBST(GUI_CFLAGS) |
296 |
+ |
AC_SUBST(GUI_LIBS) |
297 |
+ |
|
298 |
+ |
dnl Build external GUI if requested. |
299 |
+ |
if [[ "$WANT_STANDALONE_GUI" != "yes" ]]; then |
300 |
+ |
WANT_STANDALONE_GUI=no |
301 |
+ |
fi |
302 |
+ |
if [[ "$WANT_GTK" = "no" ]]; then |
303 |
+ |
WANT_STANDALONE_GUI=no |
304 |
+ |
fi |
305 |
+ |
AC_SUBST(STANDALONE_GUI, [$WANT_STANDALONE_GUI]) |
306 |
|
|
307 |
|
dnl We use ESD if possible. |
308 |
|
if [[ "x$WANT_ESD" = "xyes" ]]; then |
322 |
|
|
323 |
|
dnl Checks for header files. |
324 |
|
AC_HEADER_STDC |
325 |
+ |
AC_CHECK_HEADERS(stdlib.h stdint.h) |
326 |
|
AC_CHECK_HEADERS(unistd.h fcntl.h sys/types.h sys/time.h sys/mman.h mach/mach.h) |
327 |
|
AC_CHECK_HEADERS(readline.h history.h readline/readline.h readline/history.h) |
328 |
< |
AC_CHECK_HEADERS(sys/socket.h) |
328 |
> |
AC_CHECK_HEADERS(sys/socket.h sys/ioctl.h sys/filio.h sys/bitypes.h sys/wait.h) |
329 |
> |
AC_CHECK_HEADERS(sys/poll.h sys/select.h) |
330 |
> |
AC_CHECK_HEADERS(arpa/inet.h) |
331 |
|
AC_CHECK_HEADERS(linux/if.h linux/if_tun.h net/if.h net/if_tun.h, [], [], [ |
332 |
+ |
#ifdef HAVE_SYS_TYPES_H |
333 |
+ |
#include <sys/types.h> |
334 |
+ |
#endif |
335 |
|
#ifdef HAVE_SYS_SOCKET_H |
336 |
|
#include <sys/socket.h> |
337 |
|
#endif |
338 |
|
]) |
339 |
|
AC_CHECK_HEADERS(AvailabilityMacros.h) |
340 |
+ |
AC_CHECK_HEADERS(IOKit/storage/IOBlockStorageDevice.h) |
341 |
|
|
342 |
|
dnl Checks for typedefs, structures, and compiler characteristics. |
343 |
|
AC_C_BIGENDIAN |
377 |
|
fi |
378 |
|
|
379 |
|
dnl Checks for library functions. |
380 |
< |
AC_CHECK_FUNCS(strdup cfmakeraw) |
380 |
> |
AC_CHECK_FUNCS(strdup strerror cfmakeraw) |
381 |
|
AC_CHECK_FUNCS(clock_gettime timer_create) |
382 |
|
AC_CHECK_FUNCS(sigaction signal) |
383 |
|
AC_CHECK_FUNCS(mmap mprotect munmap) |
384 |
|
AC_CHECK_FUNCS(vm_allocate vm_deallocate vm_protect) |
385 |
+ |
AC_CHECK_FUNCS(poll inet_aton) |
386 |
|
|
387 |
|
dnl Darwin seems to define mach_task_self() instead of task_self(). |
388 |
|
AC_CHECK_FUNCS(mach_task_self task_self) |
434 |
|
dnl (end of code from openssh-3.2.2p1 configure.ac) |
435 |
|
|
436 |
|
|
437 |
+ |
dnl Check for systems where POSIX-style non-blocking I/O (O_NONBLOCK) |
438 |
+ |
dnl doesn't work or is unimplemented. On these systems (mostly older |
439 |
+ |
dnl ones), use the old BSD-style FIONBIO approach instead. [tcl.m4] |
440 |
+ |
AC_CACHE_CHECK([FIONBIO vs. O_NONBLOCK for non-blocking I/O], |
441 |
+ |
ac_cv_nonblocking_io, [ |
442 |
+ |
case "$host" in |
443 |
+ |
*-*-osf*) |
444 |
+ |
ac_cv_nonblocking_io=FIONBIO |
445 |
+ |
;; |
446 |
+ |
*-*-sunos4*) |
447 |
+ |
ac_cv_nonblocking_io=FIONBIO |
448 |
+ |
;; |
449 |
+ |
*-*-ultrix*) |
450 |
+ |
ac_cv_nonblocking_io=FIONBIO |
451 |
+ |
;; |
452 |
+ |
*) |
453 |
+ |
ac_cv_nonblocking_io=O_NONBLOCK |
454 |
+ |
;; |
455 |
+ |
esac |
456 |
+ |
]) |
457 |
+ |
if [[ "$ac_cv_nonblocking_io" = "FIONBIO" ]]; then |
458 |
+ |
AC_DEFINE(USE_FIONBIO, 1, [Define if BSD-style non-blocking I/O is to be used]) |
459 |
+ |
fi |
460 |
+ |
|
461 |
+ |
dnl Check whether compiler supports byte bit-fields |
462 |
+ |
AC_CACHE_CHECK([whether compiler supports byte bit-fields], |
463 |
+ |
ac_cv_have_byte_bitfields, [ |
464 |
+ |
AC_LANG_SAVE |
465 |
+ |
AC_LANG_CPLUSPLUS |
466 |
+ |
AC_TRY_RUN([ |
467 |
+ |
struct A { |
468 |
+ |
unsigned char b1:4; |
469 |
+ |
unsigned char b2:4; |
470 |
+ |
unsigned char c; |
471 |
+ |
unsigned short s; |
472 |
+ |
unsigned char a[4]; |
473 |
+ |
}; |
474 |
+ |
|
475 |
+ |
int main(void) { |
476 |
+ |
A a; |
477 |
+ |
return ! (sizeof(A) == 8 && &a.c == ((unsigned char *)&a + 1)); |
478 |
+ |
}], |
479 |
+ |
[ac_cv_have_byte_bitfields=yes], |
480 |
+ |
[ac_cv_have_byte_bitfields=no], |
481 |
+ |
dnl When cross-compiling, assume only GCC supports this |
482 |
+ |
[if [[ "$GCC" = "yes" ]]; then |
483 |
+ |
ac_cv_have_byte_bitfields="guessing yes" |
484 |
+ |
else |
485 |
+ |
ac_cv_have_byte_bitfields="guessing no" |
486 |
+ |
fi] |
487 |
+ |
) |
488 |
+ |
AC_LANG_RESTORE |
489 |
+ |
]) |
490 |
+ |
|
491 |
|
dnl AC_CHECK_FRAMEWORK($1=NAME, $2=INCLUDES) |
492 |
< |
AC_DEFUN(AC_CHECK_FRAMEWORK, [ |
492 |
> |
AC_DEFUN([AC_CHECK_FRAMEWORK], [ |
493 |
|
AS_VAR_PUSHDEF([ac_Framework], [ac_cv_framework_$1])dnl |
494 |
|
AC_CACHE_CHECK([whether compiler supports framework $1], |
495 |
|
ac_Framework, [ |
496 |
|
saved_LIBS="$LIBS" |
497 |
|
LIBS="$LIBS -framework $1" |
498 |
|
AC_TRY_LINK( |
499 |
< |
[$2], [int main(void) { return 0; }], |
499 |
> |
[$2], [], |
500 |
|
[AS_VAR_SET(ac_Framework, yes)], [AS_VAR_SET(ac_Framework, no); LIBS="$saved_LIBS"] |
501 |
|
) |
502 |
|
]) |
507 |
|
]) |
508 |
|
|
509 |
|
dnl Check for some MacOS X frameworks |
510 |
+ |
AC_CHECK_FRAMEWORK(AppKit, []) |
511 |
|
AC_CHECK_FRAMEWORK(Carbon, [#include <Carbon/Carbon.h>]) |
512 |
|
AC_CHECK_FRAMEWORK(IOKit, [#include <IOKit/IOKitLib.h>]) |
513 |
+ |
AC_CHECK_FRAMEWORK(CoreFoundation, [#include <CoreFoundation/CoreFoundation.h>]) |
514 |
|
|
515 |
|
dnl Select system-dependant source files. |
516 |
|
SERIALSRC=serial_unix.cpp |
517 |
|
ETHERSRC=../dummy/ether_dummy.cpp |
518 |
|
SCSISRC=../dummy/scsi_dummy.cpp |
519 |
|
AUDIOSRC=../dummy/audio_dummy.cpp |
520 |
+ |
EXTFSSRC=extfs_unix.cpp |
521 |
|
EXTRASYSSRCS= |
522 |
|
CAN_NATIVE_M68K=no |
523 |
|
case "$target_os" in |
551 |
|
;; |
552 |
|
netbsd*) |
553 |
|
CAN_NATIVE_M68K=yes |
554 |
+ |
ETHERSRC=ether_unix.cpp |
555 |
|
;; |
556 |
|
solaris*) |
557 |
|
AUDIOSRC=Solaris/audio_solaris.cpp |
558 |
|
DEFINES="$DEFINES -DBSD_COMP -D_POSIX_PTHREAD_SEMANTICS" |
559 |
|
;; |
560 |
|
irix*) |
446 |
– |
ETHERSRC=ether_unix.cpp |
561 |
|
AUDIOSRC=Irix/audio_irix.cpp |
562 |
|
EXTRASYSSRCS=Irix/unaligned.c |
449 |
– |
dnl IRIX headers work fine, but somehow don't define or use "STDC_HEADERS" |
450 |
– |
DEFINES="$DEFINES -DCRTSCTS=CNEW_RTSCTS -DB230400=B115200 -DSTDC_HEADERS" |
563 |
|
LIBS="$LIBS -laudio" |
564 |
|
WANT_ESD=no |
565 |
|
|
569 |
|
CFLAGS=`echo "$CFLAGS -IPA" | sed -e "s/-g//g"` |
570 |
|
AC_MSG_CHECKING(if "-IPA" works) |
571 |
|
dnl Do a test compile of an empty function |
572 |
< |
AC_TRY_COMPILE(,, [AC_MSG_RESULT(yes); HAVE_IPA=yes], AC_MSG_RESULT(no)) |
572 |
> |
AC_TRY_COMPILE([#if defined __GNUC__ |
573 |
> |
# error GCC does not support IPA yet |
574 |
> |
#endif],, [AC_MSG_RESULT(yes); HAVE_IPA=yes], AC_MSG_RESULT(no)) |
575 |
|
CFLAGS="$ocflags" |
576 |
|
;; |
577 |
|
darwin*) |
578 |
< |
if [[ "x$ac_cv_framework_IOKit" = "xyes" ]]; then |
578 |
> |
ETHERSRC=ether_unix.cpp |
579 |
> |
if [[ "x$ac_cv_framework_IOKit" = "xyes" -a "x$ac_cv_framework_CoreFoundation" = "xyes" ]]; then |
580 |
|
EXTRASYSSRCS="../MacOSX/sys_darwin.cpp" |
581 |
|
fi |
582 |
+ |
if [[ "x$ac_cv_framework_Carbon" = "xyes" ]]; then |
583 |
+ |
EXTFSSRC=../MacOSX/extfs_macosx.mm |
584 |
+ |
fi |
585 |
|
;; |
586 |
|
cygwin*) |
587 |
|
SERIALSRC="../dummy/serial_dummy.cpp" |
588 |
|
EXTRASYSSRCS="../Windows/BasiliskII.rc" |
589 |
|
;; |
590 |
|
esac |
591 |
+ |
|
592 |
+ |
dnl Is the slirp library supported? |
593 |
+ |
case "$ac_cv_have_byte_bitfields" in |
594 |
+ |
yes|"guessing yes") |
595 |
+ |
CAN_SLIRP=yes |
596 |
+ |
ETHERSRC=ether_unix.cpp |
597 |
+ |
;; |
598 |
+ |
esac |
599 |
+ |
if [[ -n "$CAN_SLIRP" ]]; then |
600 |
+ |
AC_DEFINE(HAVE_SLIRP, 1, [Define if slirp library is supported]) |
601 |
+ |
SLIRP_SRCS="\ |
602 |
+ |
../slirp/bootp.c ../slirp/ip_output.c ../slirp/tcp_input.c \ |
603 |
+ |
../slirp/cksum.c ../slirp/mbuf.c ../slirp/tcp_output.c \ |
604 |
+ |
../slirp/debug.c ../slirp/misc.c ../slirp/tcp_subr.c \ |
605 |
+ |
../slirp/if.c ../slirp/sbuf.c ../slirp/tcp_timer.c \ |
606 |
+ |
../slirp/ip_icmp.c ../slirp/slirp.c ../slirp/tftp.c \ |
607 |
+ |
../slirp/ip_input.c ../slirp/socket.c ../slirp/udp.c" |
608 |
+ |
fi |
609 |
+ |
AC_SUBST(SLIRP_SRCS) |
610 |
+ |
|
611 |
|
dnl SDL overrides |
612 |
|
if [[ "x$WANT_SDL" = "xyes" ]]; then |
613 |
|
AC_DEFINE(USE_SDL, 1, [Define to enble SDL support]) |
652 |
|
ETHERSRC=../dummy/ether_dummy.cpp |
653 |
|
AUDIOSRC=../dummy/audio_dummy.cpp |
654 |
|
fi |
655 |
< |
SYSSRCS="$VIDEOSRCS $SERIALSRC $ETHERSRC $SCSISRC $AUDIOSRC $SEMSRC $UISRCS $MONSRCS $EXTRASYSSRCS" |
655 |
> |
SYSSRCS="$VIDEOSRCS $EXTFSSRC $SERIALSRC $ETHERSRC $SCSISRC $AUDIOSRC $SEMSRC $UISRCS $MONSRCS $EXTRASYSSRCS" |
656 |
|
|
657 |
|
dnl Define a macro that translates a yesno-variable into a C macro definition |
658 |
|
dnl to be put into the config.h file |
659 |
|
dnl $1 -- the macro to define |
660 |
|
dnl $2 -- the value to translate |
661 |
|
dnl $3 -- template name |
662 |
< |
AC_DEFUN(AC_TRANSLATE_DEFINE, [ |
662 |
> |
AC_DEFUN([AC_TRANSLATE_DEFINE], [ |
663 |
|
if [[ "x$2" = "xyes" -o "x$2" = "xguessing yes" ]]; then |
664 |
|
AC_DEFINE($1, 1, $3) |
665 |
|
fi |
870 |
|
] |
871 |
|
) |
872 |
|
|
735 |
– |
dnl Check if we have POSIX shared memory support |
736 |
– |
AC_CACHE_CHECK([whether POSIX shared memory is working], |
737 |
– |
ac_cv_have_posix_shm, [ |
738 |
– |
AC_LANG_SAVE |
739 |
– |
AC_LANG_CPLUSPLUS |
740 |
– |
AC_TRY_RUN([ |
741 |
– |
#define HAVE_POSIX_SHM |
742 |
– |
#include "vm_alloc.cpp" |
743 |
– |
int main(void) { /* returns 0 if we have working POSIX shm */ |
744 |
– |
if (vm_init() < 0) exit(2); |
745 |
– |
char *m1 = (char *)vm_acquire(32768, VM_MAP_DEFAULT | VM_MAP_33BIT); |
746 |
– |
if (m1 == VM_MAP_FAILED) exit(3); |
747 |
– |
vm_exit(); exit(0); |
748 |
– |
} |
749 |
– |
], ac_cv_have_posix_shm=yes, ac_cv_have_posix_shm=no, |
750 |
– |
dnl When cross-compiling, do not assume anything. |
751 |
– |
ac_cv_have_posix_shm="guessing no" |
752 |
– |
) |
753 |
– |
AC_LANG_RESTORE |
754 |
– |
] |
755 |
– |
) |
756 |
– |
AC_TRANSLATE_DEFINE(HAVE_POSIX_SHM, "$ac_cv_have_posix_shm", |
757 |
– |
[Define if your system supports POSIX shared memory.]) |
758 |
– |
|
759 |
– |
dnl Check if we have working 33-bit memory addressing |
760 |
– |
AC_CACHE_CHECK([whether 33-bit memory addressing is working], |
761 |
– |
ac_cv_have_33bit_addressing, [ |
762 |
– |
AC_LANG_SAVE |
763 |
– |
AC_LANG_CPLUSPLUS |
764 |
– |
AC_TRY_RUN([ |
765 |
– |
#define USE_33BIT_ADDRESSING 1 |
766 |
– |
#include "vm_alloc.cpp" |
767 |
– |
int main(void) { /* returns 0 if we have working 33-bit addressing */ |
768 |
– |
if (sizeof(void *) < 8) exit(1); |
769 |
– |
if (vm_init() < 0) exit(2); |
770 |
– |
char *m1 = (char *)vm_acquire(32768, VM_MAP_DEFAULT | VM_MAP_33BIT); |
771 |
– |
if (m1 == VM_MAP_FAILED) exit(3); |
772 |
– |
char *m2 = m1 + (1L << 32); |
773 |
– |
m1[0] = 0x12; if (m2[0] != 0x12) exit(4); |
774 |
– |
m2[0] = 0x34; if (m1[0] != 0x34) exit(5); |
775 |
– |
vm_exit(); exit(0); |
776 |
– |
} |
777 |
– |
], ac_cv_have_33bit_addressing=yes, ac_cv_have_33bit_addressing=no, |
778 |
– |
dnl When cross-compiling, do not assume anything. |
779 |
– |
ac_cv_have_33bit_addressing="guessing no" |
780 |
– |
) |
781 |
– |
AC_LANG_RESTORE |
782 |
– |
] |
783 |
– |
) |
784 |
– |
|
873 |
|
dnl Check signal handlers need to be reinstalled |
874 |
|
AC_CACHE_CHECK([whether signal handlers need to be reinstalled], |
875 |
|
ac_cv_signal_need_reinstall, [ |
1059 |
|
dnl A dummy program that returns always true |
1060 |
|
AC_PATH_PROG([BLESS], "true") |
1061 |
|
|
1062 |
+ |
dnl Check for linker script support |
1063 |
+ |
case $target_os:$target_cpu in |
1064 |
+ |
linux*:i?86) LINKER_SCRIPT_FLAGS="-Wl,-T,ldscripts/linux-i386.ld";; |
1065 |
+ |
linux*:x86_64) LINKER_SCRIPT_FLAGS="-Wl,-T,ldscripts/linux-x86_64.ld";; |
1066 |
+ |
linux*:powerpc) LINKER_SCRIPT_FLAGS="-Wl,-T,ldscripts/linux-ppc.ld";; |
1067 |
+ |
netbsd*:i?86) LINKER_SCRIPT_FLAGS="-Wl,-T,ldscripts/linux-i386.ld";; |
1068 |
+ |
freebsd*:i?86) LINKER_SCRIPT_FLAGS="-Wl,-T,ldscripts/freebsd-i386.ld";; |
1069 |
+ |
darwin*:*) LINKER_SCRIPT_FLAGS="-Wl,-seg1addr,0x78048000";; |
1070 |
+ |
esac |
1071 |
+ |
if [[ -n "$LINKER_SCRIPT_FLAGS" ]]; then |
1072 |
+ |
AC_CACHE_CHECK([whether linker script is usable], |
1073 |
+ |
ac_cv_linker_script_works, [ |
1074 |
+ |
AC_LANG_SAVE |
1075 |
+ |
AC_LANG_CPLUSPLUS |
1076 |
+ |
saved_LDFLAGS="$LDFLAGS" |
1077 |
+ |
LDFLAGS="$LDFLAGS $LINKER_SCRIPT_FLAGS" |
1078 |
+ |
AC_TRY_RUN( |
1079 |
+ |
[int main() {if ((char *)&main < (char *)0x70000000) return 1;}], |
1080 |
+ |
[ac_cv_linker_script_works=yes], |
1081 |
+ |
[ac_cv_linker_script_works=no], |
1082 |
+ |
dnl When cross-compiling, assume it works |
1083 |
+ |
[ac_cv_linker_script_works="guessing yes"] |
1084 |
+ |
) |
1085 |
+ |
AC_LANG_RESTORE |
1086 |
+ |
if [[ "$ac_cv_linker_script_works" = "no" ]]; then |
1087 |
+ |
LDFLAGS="$saved_LDFLAGS" |
1088 |
+ |
LINKER_SCRIPT_FLAGS="" |
1089 |
+ |
fi |
1090 |
+ |
]) |
1091 |
+ |
fi |
1092 |
+ |
AC_TRANSLATE_DEFINE(HAVE_LINKER_SCRIPT, "$ac_cv_linker_script_works", |
1093 |
+ |
[Define if there is a linker script to relocate the executable above 0x70000000.]) |
1094 |
+ |
|
1095 |
|
dnl Determine the addressing mode to use |
1096 |
|
if [[ "x$WANT_NATIVE_M68K" = "xyes" ]]; then |
1097 |
|
ADDRESSING_MODE="real" |
1169 |
|
dnl Check for GCC 2.7 or higher. |
1170 |
|
HAVE_GCC27=no |
1171 |
|
AC_MSG_CHECKING(for GCC 2.7 or higher) |
1172 |
< |
AC_EGREP_CPP(xyes, |
1173 |
< |
[#if __GNUC__ - 1 > 1 || __GNUC_MINOR__ - 1 > 5 |
1174 |
< |
xyes |
1175 |
< |
#endif |
1176 |
< |
], [AC_MSG_RESULT(yes); HAVE_GCC27=yes], AC_MSG_RESULT(no)) |
1172 |
> |
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#if ! (__GNUC__ - 1 > 1 || __GNUC_MINOR__ - 1 > 5) |
1173 |
> |
# error gcc < 2.7 |
1174 |
> |
#endif |
1175 |
> |
]])], |
1176 |
> |
[AC_MSG_RESULT(yes); HAVE_GCC27=yes], |
1177 |
> |
[AC_MSG_RESULT(no)]) |
1178 |
|
|
1179 |
|
dnl Check for GCC 3.0 or higher. |
1180 |
|
HAVE_GCC30=no |
1181 |
|
AC_MSG_CHECKING(for GCC 3.0 or higher) |
1182 |
< |
AC_EGREP_CPP(xyes, |
1183 |
< |
[#if __GNUC__ >= 3 |
1184 |
< |
xyes |
1185 |
< |
#endif |
1186 |
< |
], [AC_MSG_RESULT(yes); HAVE_GCC30=yes], AC_MSG_RESULT(no)) |
1182 |
> |
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#if ! (__GNUC__ >= 3) |
1183 |
> |
# error gcc < 3 |
1184 |
> |
#endif |
1185 |
> |
]])], |
1186 |
> |
[AC_MSG_RESULT(yes); HAVE_GCC30=yes], |
1187 |
> |
[AC_MSG_RESULT(no)]) |
1188 |
> |
|
1189 |
> |
dnl Check for ICC. |
1190 |
> |
AC_MSG_CHECKING(for ICC) |
1191 |
> |
HAVE_ICC=no |
1192 |
> |
if $CXX -V -v 2>&1 | grep -q "Intel(R) C++ Compiler"; then |
1193 |
> |
HAVE_ICC=yes |
1194 |
> |
fi |
1195 |
> |
AC_MSG_RESULT($HAVE_ICC) |
1196 |
|
|
1197 |
|
dnl Set "-fomit-frame-pointer" on i386 GCC 2.7 or higher. |
1198 |
|
dnl Also set "-fno-exceptions" for C++ because exception handling requires |
1207 |
|
dnl Official: probably gcc-3.1 (mainline CVS) |
1208 |
|
dnl Mandrake: gcc-2.96 >= 0.59mdk, gcc-3.0.1 >= 0.1mdk |
1209 |
|
dnl Red Hat : gcc-2.96 >= 89, gcc-3.0 >= 1 |
1210 |
< |
if [[ "x$HAVE_GCC27" = "xyes" ]]; then |
1210 |
> |
if [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_ICC" = "xno" ]]; then |
1211 |
|
SAVED_CXXFLAGS="$CXXFLAGS" |
1212 |
|
CXXFLAGS="$CXXFLAGS -fno-merge-constants" |
1213 |
|
AC_CACHE_CHECK([whether GCC supports constants merging], ac_cv_gcc_constants_merging, [ |
1223 |
|
|
1224 |
|
dnl Store motion was introduced in 3.3-hammer branch and any gcc >= 3.4 |
1225 |
|
dnl However, there are some corner cases exposed on x86-64 |
1226 |
< |
if [[ "x$HAVE_GCC27" = "xyes" ]]; then |
1226 |
> |
if [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_ICC" = "xno" ]]; then |
1227 |
|
SAVED_CXXFLAGS="$CXXFLAGS" |
1228 |
|
CXXFLAGS="$CXXFLAGS -fno-gcse-sm" |
1229 |
|
AC_CACHE_CHECK([whether GCC supports store motion], ac_cv_gcc_store_motion, [ |
1237 |
|
fi |
1238 |
|
fi |
1239 |
|
|
1240 |
+ |
dnl Add -fno-strict-aliasing for slirp sources |
1241 |
+ |
if [[ "x$HAVE_GCC30" = "xyes" ]]; then |
1242 |
+ |
SAVED_CFLAGS="$CFLAGS" |
1243 |
+ |
CFLAGS="$CFLAGS -fno-strict-aliasing" |
1244 |
+ |
AC_CACHE_CHECK([whether the compiler supports -fno-strict-aliasing], |
1245 |
+ |
ac_cv_gcc_no_strict_aliasing, [ |
1246 |
+ |
AC_TRY_COMPILE([],[], |
1247 |
+ |
[ac_cv_gcc_no_strict_aliasing=yes; AC_SUBST(SLIRP_CFLAGS, "-fno-strict-aliasing")], |
1248 |
+ |
[ac_cv_gcc_no_strict_aliasing=no]) |
1249 |
+ |
]) |
1250 |
+ |
CFLAGS="$SAVED_CFLAGS" |
1251 |
+ |
fi |
1252 |
+ |
|
1253 |
+ |
dnl Add -mdynamic-no-pic for MacOS X (XXX icc10 will support MacOS X) |
1254 |
+ |
if [[ "x$HAVE_GCC30" = "xyes" -a "x$HAVE_ICC" = "xno" ]]; then |
1255 |
+ |
SAVED_CFLAGS="$CFLAGS" |
1256 |
+ |
CFLAGS="$CFLAGS -mdynamic-no-pic" |
1257 |
+ |
AC_CACHE_CHECK([whether the compiler supports -mdynamic-no-pic], |
1258 |
+ |
ac_cv_gcc_mdynamic_no_pic, [ |
1259 |
+ |
AC_TRY_COMPILE([],[],[ac_cv_gcc_mdynamic_no_pic=yes],[ac_cv_gcc_mdynamic_no_pic=no]) |
1260 |
+ |
]) |
1261 |
+ |
if [[ "x$ac_cv_gcc_mdynamic_no_pic" = "xyes" ]]; then |
1262 |
+ |
CXXFLAGS="$CXXFLAGS -mdynamic-no-pic" |
1263 |
+ |
else |
1264 |
+ |
CFLAGS="$SAVED_CFLAGS" |
1265 |
+ |
fi |
1266 |
+ |
fi |
1267 |
+ |
|
1268 |
|
dnl Select appropriate CPU source and REGPARAM define. |
1269 |
|
ASM_OPTIMIZATIONS=none |
1270 |
|
CPUSRCS="cpuemu1.cpp cpuemu2.cpp cpuemu3.cpp cpuemu4.cpp cpuemu5.cpp cpuemu6.cpp cpuemu7.cpp cpuemu8.cpp" |
1291 |
|
DEFINES="$DEFINES -DX86_64_ASSEMBLY -DOPTIMIZED_FLAGS" |
1292 |
|
JITSRCS="cpuemu1_nf.cpp cpuemu2_nf.cpp cpuemu3_nf.cpp cpuemu4_nf.cpp cpuemu5_nf.cpp cpuemu6_nf.cpp cpuemu7_nf.cpp cpuemu8_nf.cpp $JITSRCS" |
1293 |
|
CAN_JIT=yes |
1135 |
– |
WANT_33BIT_ADDRESSING=yes |
1294 |
|
fi |
1295 |
|
elif [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_SPARC" = "xyes" -a "x$HAVE_GAS" = "xyes" ]]; then |
1296 |
|
dnl SPARC CPU |
1347 |
|
JITSRCS="" |
1348 |
|
fi |
1349 |
|
|
1192 |
– |
dnl Use 33-bit memory addressing? |
1193 |
– |
if [[ "$ac_cv_have_33bit_addressing:$WANT_33BIT_ADDRESSING" = "yes:yes" ]]; then |
1194 |
– |
use_33bit_addressing=yes |
1195 |
– |
fi |
1196 |
– |
AC_TRANSLATE_DEFINE(USE_33BIT_ADDRESSING, "$use_33bit_addressing", |
1197 |
– |
[Define to use 33-bit memory addressing on 64-bit JIT capable systems.]) |
1198 |
– |
|
1350 |
|
dnl Utility macro used by next two tests. |
1351 |
|
dnl AC_EXAMINE_OBJECT(C source code, |
1352 |
|
dnl commands examining object file, |