60 |
|
|
61 |
|
dnl External packages. |
62 |
|
AC_ARG_WITH(esd, [ --with-esd support ESD for sound under Linux/FreeBSD [default=yes]], [WANT_ESD=$withval], [WANT_ESD=yes]) |
63 |
< |
AC_ARG_WITH(gtk, [ --with-gtk use GTK user interface [default=yes]], [WANT_GTK=$withval], [WANT_GTK=yes]) |
63 |
> |
AC_ARG_WITH(gtk, [ --with-gtk use GTK user interface [default=yes]], |
64 |
> |
[case "$withval" in |
65 |
> |
gtk1) WANT_GTK="gtk";; |
66 |
> |
gtk|gtk2) WANT_GTK="$withval";; |
67 |
> |
yes) WANT_GTK="gtk2 gtk";; |
68 |
> |
*) WANT_GTK="no";; |
69 |
> |
esac], |
70 |
> |
[WANT_GTK="gtk2 gtk"]) |
71 |
|
AC_ARG_WITH(mon, [ --with-mon use mon as debugger [default=yes]], [WANT_MON=$withval], [WANT_MON=yes]) |
72 |
|
|
73 |
|
dnl Canonical system information. |
136 |
|
AC_CHECK_LIB(posix4, sem_init) |
137 |
|
AC_CHECK_LIB(rt, timer_create) |
138 |
|
AC_CHECK_LIB(rt, shm_open) |
139 |
+ |
AC_CHECK_LIB(m, cos) |
140 |
|
|
141 |
|
dnl Do we need SDL? |
142 |
|
WANT_SDL=no |
203 |
|
if [[ "x$HAVE_PTHREADS" = "xyes" ]]; then |
204 |
|
AC_DEFINE(HAVE_PTHREADS, 1, [Define if pthreads are available.]) |
205 |
|
fi |
206 |
< |
AC_CHECK_FUNCS(pthread_cancel) |
206 |
> |
AC_CHECK_FUNCS(pthread_cond_init) |
207 |
> |
AC_CHECK_FUNCS(pthread_cancel pthread_testcancel) |
208 |
|
AC_CHECK_FUNCS(pthread_mutexattr_setprotocol) |
209 |
|
AC_CHECK_FUNCS(pthread_mutexattr_settype) |
210 |
|
AC_CHECK_FUNCS(pthread_mutexattr_setpshared) |
248 |
|
|
249 |
|
dnl We use GTK+ if possible. |
250 |
|
UISRCS=../dummy/prefs_editor_dummy.cpp |
251 |
< |
if [[ "x$WANT_GTK" = "xyes" ]]; then |
251 |
> |
case "x$WANT_GTK" in |
252 |
> |
xgtk2*) |
253 |
> |
AM_PATH_GTK_2_0(1.3.15, [ |
254 |
> |
AC_DEFINE(ENABLE_GTK, 1, [Define if using GTK.]) |
255 |
> |
CFLAGS="$CFLAGS $GTK_CFLAGS" |
256 |
> |
CXXFLAGS="$CXXFLAGS $GTK_CFLAGS" |
257 |
> |
LIBS="$LIBS $GTK_LIBS" |
258 |
> |
UISRCS=prefs_editor_gtk.cpp |
259 |
> |
WANT_GTK=gtk2 |
260 |
> |
], [ |
261 |
> |
case "x${WANT_GTK}x" in |
262 |
> |
*gtkx) |
263 |
> |
AC_MSG_WARN([Could not find GTK+ 2.0, trying with GTK+ 1.2.]) |
264 |
> |
WANT_GTK=gtk |
265 |
> |
;; |
266 |
> |
*) |
267 |
> |
AC_MSG_WARN([Could not find GTK+, disabling user interface.]) |
268 |
> |
WANT_GTK=no |
269 |
> |
;; |
270 |
> |
esac |
271 |
> |
]) |
272 |
> |
;; |
273 |
> |
esac |
274 |
> |
if [[ "x$WANT_GTK" = "xgtk" ]]; then |
275 |
|
AM_PATH_GTK(1.2.0, [ |
276 |
|
AC_DEFINE(ENABLE_GTK, 1, [Define if using GTK.]) |
277 |
|
CXXFLAGS="$CXXFLAGS $GTK_CFLAGS" |
310 |
|
|
311 |
|
dnl Checks for header files. |
312 |
|
AC_HEADER_STDC |
313 |
+ |
AC_CHECK_HEADERS(stdlib.h stdint.h) |
314 |
|
AC_CHECK_HEADERS(unistd.h fcntl.h sys/types.h sys/time.h sys/mman.h mach/mach.h) |
315 |
|
AC_CHECK_HEADERS(readline.h history.h readline/readline.h readline/history.h) |
316 |
|
AC_CHECK_HEADERS(sys/socket.h sys/ioctl.h sys/filio.h sys/bitypes.h sys/wait.h) |
325 |
|
#endif |
326 |
|
]) |
327 |
|
AC_CHECK_HEADERS(AvailabilityMacros.h) |
328 |
+ |
AC_CHECK_HEADERS(IOKit/storage/IOBlockStorageDevice.h) |
329 |
|
|
330 |
|
dnl Checks for typedefs, structures, and compiler characteristics. |
331 |
|
AC_C_BIGENDIAN |
422 |
|
dnl (end of code from openssh-3.2.2p1 configure.ac) |
423 |
|
|
424 |
|
|
425 |
+ |
dnl Check for systems where POSIX-style non-blocking I/O (O_NONBLOCK) |
426 |
+ |
dnl doesn't work or is unimplemented. On these systems (mostly older |
427 |
+ |
dnl ones), use the old BSD-style FIONBIO approach instead. [tcl.m4] |
428 |
+ |
AC_CACHE_CHECK([FIONBIO vs. O_NONBLOCK for non-blocking I/O], |
429 |
+ |
ac_cv_nonblocking_io, [ |
430 |
+ |
case "$host" in |
431 |
+ |
*-*-osf*) |
432 |
+ |
ac_cv_nonblocking_io=FIONBIO |
433 |
+ |
;; |
434 |
+ |
*-*-sunos4*) |
435 |
+ |
ac_cv_nonblocking_io=FIONBIO |
436 |
+ |
;; |
437 |
+ |
*-*-ultrix*) |
438 |
+ |
ac_cv_nonblocking_io=FIONBIO |
439 |
+ |
;; |
440 |
+ |
*) |
441 |
+ |
ac_cv_nonblocking_io=O_NONBLOCK |
442 |
+ |
;; |
443 |
+ |
esac |
444 |
+ |
]) |
445 |
+ |
if [[ "$ac_cv_nonblocking_io" = "FIONBIO" ]]; then |
446 |
+ |
AC_DEFINE(USE_FIONBIO, 1, [Define if BSD-style non-blocking I/O is to be used]) |
447 |
+ |
fi |
448 |
+ |
|
449 |
+ |
dnl Check whether compiler supports byte bit-fields |
450 |
+ |
AC_CACHE_CHECK([whether compiler supports byte bit-fields], |
451 |
+ |
ac_cv_have_byte_bitfields, [ |
452 |
+ |
AC_LANG_SAVE |
453 |
+ |
AC_LANG_CPLUSPLUS |
454 |
+ |
AC_TRY_RUN([ |
455 |
+ |
struct A { |
456 |
+ |
unsigned char b1:4; |
457 |
+ |
unsigned char b2:4; |
458 |
+ |
unsigned char c; |
459 |
+ |
unsigned short s; |
460 |
+ |
unsigned char a[4]; |
461 |
+ |
}; |
462 |
+ |
|
463 |
+ |
int main(void) { |
464 |
+ |
A a; |
465 |
+ |
return ! (sizeof(A) == 8 && &a.c == ((unsigned char *)&a + 1)); |
466 |
+ |
}], |
467 |
+ |
[ac_cv_have_byte_bitfields=yes], |
468 |
+ |
[ac_cv_have_byte_bitfields=no], |
469 |
+ |
dnl When cross-compiling, assume only GCC supports this |
470 |
+ |
[if [[ "$GCC" = "yes" ]]; then |
471 |
+ |
ac_cv_have_byte_bitfields="guessing yes" |
472 |
+ |
else |
473 |
+ |
ac_cv_have_byte_bitfields="guessing no" |
474 |
+ |
fi] |
475 |
+ |
) |
476 |
+ |
AC_LANG_RESTORE |
477 |
+ |
]) |
478 |
+ |
|
479 |
|
dnl AC_CHECK_FRAMEWORK($1=NAME, $2=INCLUDES) |
480 |
< |
AC_DEFUN(AC_CHECK_FRAMEWORK, [ |
480 |
> |
AC_DEFUN([AC_CHECK_FRAMEWORK], [ |
481 |
|
AS_VAR_PUSHDEF([ac_Framework], [ac_cv_framework_$1])dnl |
482 |
|
AC_CACHE_CHECK([whether compiler supports framework $1], |
483 |
|
ac_Framework, [ |
484 |
|
saved_LIBS="$LIBS" |
485 |
|
LIBS="$LIBS -framework $1" |
486 |
|
AC_TRY_LINK( |
487 |
< |
[$2], [int main(void) { return 0; }], |
487 |
> |
[$2], [], |
488 |
|
[AS_VAR_SET(ac_Framework, yes)], [AS_VAR_SET(ac_Framework, no); LIBS="$saved_LIBS"] |
489 |
|
) |
490 |
|
]) |
497 |
|
dnl Check for some MacOS X frameworks |
498 |
|
AC_CHECK_FRAMEWORK(Carbon, [#include <Carbon/Carbon.h>]) |
499 |
|
AC_CHECK_FRAMEWORK(IOKit, [#include <IOKit/IOKitLib.h>]) |
500 |
+ |
AC_CHECK_FRAMEWORK(CoreFoundation, [#include <CoreFoundation/CoreFoundation.h>]) |
501 |
|
|
502 |
|
dnl Select system-dependant source files. |
503 |
|
SERIALSRC=serial_unix.cpp |
545 |
|
DEFINES="$DEFINES -DBSD_COMP -D_POSIX_PTHREAD_SEMANTICS" |
546 |
|
;; |
547 |
|
irix*) |
459 |
– |
ETHERSRC=ether_unix.cpp |
548 |
|
AUDIOSRC=Irix/audio_irix.cpp |
549 |
|
EXTRASYSSRCS=Irix/unaligned.c |
462 |
– |
dnl IRIX headers work fine, but somehow don't define or use "STDC_HEADERS" |
463 |
– |
DEFINES="$DEFINES -DCRTSCTS=CNEW_RTSCTS -DB230400=B115200 -DSTDC_HEADERS" |
550 |
|
LIBS="$LIBS -laudio" |
551 |
|
WANT_ESD=no |
552 |
|
|
556 |
|
CFLAGS=`echo "$CFLAGS -IPA" | sed -e "s/-g//g"` |
557 |
|
AC_MSG_CHECKING(if "-IPA" works) |
558 |
|
dnl Do a test compile of an empty function |
559 |
< |
AC_TRY_COMPILE(,, [AC_MSG_RESULT(yes); HAVE_IPA=yes], AC_MSG_RESULT(no)) |
559 |
> |
AC_TRY_COMPILE([#if defined __GNUC__ |
560 |
> |
# error GCC does not support IPA yet |
561 |
> |
#endif],, [AC_MSG_RESULT(yes); HAVE_IPA=yes], AC_MSG_RESULT(no)) |
562 |
|
CFLAGS="$ocflags" |
563 |
|
;; |
564 |
|
darwin*) |
565 |
|
ETHERSRC=ether_unix.cpp |
566 |
< |
if [[ "x$ac_cv_framework_IOKit" = "xyes" ]]; then |
566 |
> |
if [[ "x$ac_cv_framework_IOKit" = "xyes" -a "x$ac_cv_framework_CoreFoundation" = "xyes" ]]; then |
567 |
|
EXTRASYSSRCS="../MacOSX/sys_darwin.cpp" |
568 |
|
fi |
569 |
|
if [[ "x$ac_cv_framework_Carbon" = "xyes" ]]; then |
577 |
|
esac |
578 |
|
|
579 |
|
dnl Is the slirp library supported? |
580 |
< |
if [[ "x$ETHERSRC" = "xether_unix.cpp" ]]; then |
580 |
> |
case "$ac_cv_have_byte_bitfields" in |
581 |
> |
yes|"guessing yes") |
582 |
> |
CAN_SLIRP=yes |
583 |
> |
ETHERSRC=ether_unix.cpp |
584 |
> |
;; |
585 |
> |
esac |
586 |
> |
if [[ -n "$CAN_SLIRP" ]]; then |
587 |
|
AC_DEFINE(HAVE_SLIRP, 1, [Define if slirp library is supported]) |
588 |
|
SLIRP_SRCS="\ |
589 |
|
../slirp/bootp.c ../slirp/ip_output.c ../slirp/tcp_input.c \ |
646 |
|
dnl $1 -- the macro to define |
647 |
|
dnl $2 -- the value to translate |
648 |
|
dnl $3 -- template name |
649 |
< |
AC_DEFUN(AC_TRANSLATE_DEFINE, [ |
649 |
> |
AC_DEFUN([AC_TRANSLATE_DEFINE], [ |
650 |
|
if [[ "x$2" = "xyes" -o "x$2" = "xguessing yes" ]]; then |
651 |
|
AC_DEFINE($1, 1, $3) |
652 |
|
fi |
1096 |
|
dnl A dummy program that returns always true |
1097 |
|
AC_PATH_PROG([BLESS], "true") |
1098 |
|
|
1099 |
+ |
dnl Check for linker script support |
1100 |
+ |
case $target_os:$target_cpu in |
1101 |
+ |
linux*:i?86) LINKER_SCRIPT_FLAGS="-Wl,-T,ldscripts/linux-i386.ld";; |
1102 |
+ |
linux*:x86_64) LINKER_SCRIPT_FLAGS="-Wl,-T,ldscripts/linux-x86_64.ld";; |
1103 |
+ |
esac |
1104 |
+ |
if [[ -n "$LINKER_SCRIPT_FLAGS" ]]; then |
1105 |
+ |
AC_CACHE_CHECK([whether linker script is usable], |
1106 |
+ |
ac_cv_linker_script_works, [ |
1107 |
+ |
AC_LANG_SAVE |
1108 |
+ |
AC_LANG_CPLUSPLUS |
1109 |
+ |
saved_LDFLAGS="$LDFLAGS" |
1110 |
+ |
LDFLAGS="$LDFLAGS $LINKER_SCRIPT_FLAGS" |
1111 |
+ |
AC_TRY_RUN( |
1112 |
+ |
[int main() {if ((char *)&main < (char *)0x70000000) return 1;}], |
1113 |
+ |
[ac_cv_linker_script_works=yes], |
1114 |
+ |
[ac_cv_linker_script_works=no], |
1115 |
+ |
dnl When cross-compiling, assume it works |
1116 |
+ |
[ac_cv_linker_script_works="guessing yes"] |
1117 |
+ |
) |
1118 |
+ |
AC_LANG_RESTORE |
1119 |
+ |
if [[ "$ac_cv_linker_script_works" = "no" ]]; then |
1120 |
+ |
LDFLAGS="$saved_LDFLAGS" |
1121 |
+ |
LINKER_SCRIPT_FLAGS="" |
1122 |
+ |
fi |
1123 |
+ |
]) |
1124 |
+ |
fi |
1125 |
+ |
AC_TRANSLATE_DEFINE(HAVE_LINKER_SCRIPT, "$ac_cv_linker_script_works", |
1126 |
+ |
[Define if there is a linker script to relocate the executable above 0x70000000.]) |
1127 |
+ |
|
1128 |
|
dnl Determine the addressing mode to use |
1129 |
|
if [[ "x$WANT_NATIVE_M68K" = "xyes" ]]; then |
1130 |
|
ADDRESSING_MODE="real" |
1202 |
|
dnl Check for GCC 2.7 or higher. |
1203 |
|
HAVE_GCC27=no |
1204 |
|
AC_MSG_CHECKING(for GCC 2.7 or higher) |
1205 |
< |
AC_EGREP_CPP(xyes, |
1206 |
< |
[#if __GNUC__ - 1 > 1 || __GNUC_MINOR__ - 1 > 5 |
1207 |
< |
xyes |
1208 |
< |
#endif |
1209 |
< |
], [AC_MSG_RESULT(yes); HAVE_GCC27=yes], AC_MSG_RESULT(no)) |
1205 |
> |
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#if ! (__GNUC__ - 1 > 1 || __GNUC_MINOR__ - 1 > 5) |
1206 |
> |
# error gcc < 2.7 |
1207 |
> |
#endif |
1208 |
> |
]])], |
1209 |
> |
[AC_MSG_RESULT(yes); HAVE_GCC27=yes], |
1210 |
> |
[AC_MSG_RESULT(no)]) |
1211 |
|
|
1212 |
|
dnl Check for GCC 3.0 or higher. |
1213 |
|
HAVE_GCC30=no |
1214 |
|
AC_MSG_CHECKING(for GCC 3.0 or higher) |
1215 |
< |
AC_EGREP_CPP(xyes, |
1216 |
< |
[#if __GNUC__ >= 3 |
1217 |
< |
xyes |
1218 |
< |
#endif |
1219 |
< |
], [AC_MSG_RESULT(yes); HAVE_GCC30=yes], AC_MSG_RESULT(no)) |
1215 |
> |
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#if ! (__GNUC__ >= 3) |
1216 |
> |
# error gcc < 3 |
1217 |
> |
#endif |
1218 |
> |
]])], |
1219 |
> |
[AC_MSG_RESULT(yes); HAVE_GCC30=yes], |
1220 |
> |
[AC_MSG_RESULT(no)]) |
1221 |
|
|
1222 |
|
dnl Check for ICC. |
1223 |
|
AC_MSG_CHECKING(for ICC) |
1277 |
|
AC_CACHE_CHECK([whether the compiler supports -fno-strict-aliasing], |
1278 |
|
ac_cv_gcc_no_strict_aliasing, [ |
1279 |
|
AC_TRY_COMPILE([],[], |
1280 |
< |
[ac_cv_gcc_no_strict_aliasing=yes; AC_SUBST(SLIRP_CFLAGS, "$CFLAGS")], |
1280 |
> |
[ac_cv_gcc_no_strict_aliasing=yes; AC_SUBST(SLIRP_CFLAGS, "-fno-strict-aliasing")], |
1281 |
|
[ac_cv_gcc_no_strict_aliasing=no]) |
1282 |
|
]) |
1283 |
|
CFLAGS="$SAVED_CFLAGS" |
1284 |
|
fi |
1285 |
|
|
1286 |
+ |
dnl Add -mdynamic-no-pic for MacOS X (XXX icc10 will support MacOS X) |
1287 |
+ |
if [[ "x$HAVE_GCC30" = "xyes" -a "x$HAVE_ICC" = "xno" ]]; then |
1288 |
+ |
SAVED_CFLAGS="$CFLAGS" |
1289 |
+ |
CFLAGS="$CFLAGS -mdynamic-no-pic" |
1290 |
+ |
AC_CACHE_CHECK([whether the compiler supports -mdynamic-no-pic], |
1291 |
+ |
ac_cv_gcc_mdynamic_no_pic, [ |
1292 |
+ |
AC_TRY_COMPILE([],[],[ac_cv_gcc_mdynamic_no_pic=yes],[ac_cv_gcc_mdynamic_no_pic=no]) |
1293 |
+ |
]) |
1294 |
+ |
if [[ "x$ac_cv_gcc_mdynamic_no_pic" = "xyes" ]]; then |
1295 |
+ |
CXXFLAGS="$CXXFLAGS -mdynamic-no-pic" |
1296 |
+ |
else |
1297 |
+ |
CFLAGS="$SAVED_CFLAGS" |
1298 |
+ |
fi |
1299 |
+ |
fi |
1300 |
+ |
|
1301 |
|
dnl Select appropriate CPU source and REGPARAM define. |
1302 |
|
ASM_OPTIMIZATIONS=none |
1303 |
|
CPUSRCS="cpuemu1.cpp cpuemu2.cpp cpuemu3.cpp cpuemu4.cpp cpuemu5.cpp cpuemu6.cpp cpuemu7.cpp cpuemu8.cpp" |