21 |
|
AC_ARG_ENABLE(vosf, [ --enable-vosf enable video on SEGV signals [default=yes]], [WANT_VOSF=$enableval], [WANT_VOSF=yes]) |
22 |
|
|
23 |
|
dnl SDL options. |
24 |
+ |
AC_ARG_ENABLE(sdl-static, [ --enable-sdl-static use SDL static libraries for linking [default=no]], [WANT_SDL_STATIC=$enableval], [WANT_SDL_STATIC=no]) |
25 |
|
AC_ARG_ENABLE(sdl-video, [ --enable-sdl-video use SDL for video graphics [default=no]], [WANT_SDL_VIDEO=$enableval], [WANT_SDL_VIDEO=no]) |
26 |
|
AC_ARG_ENABLE(sdl-audio, [ --enable-sdl-audio use SDL for audio [default=no]], [WANT_SDL_AUDIO=$enableval], [WANT_SDL_AUDIO=no]) |
27 |
|
|
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 |
162 |
|
;; |
163 |
|
*) |
164 |
|
sdl_cflags=`$sdl_config --cflags` |
165 |
< |
sdl_libs=`$sdl_config --libs` |
165 |
> |
if [[ "x$WANT_SDL_STATIC" = "xyes" ]]; then |
166 |
> |
sdl_libs=`$sdl_config --static-libs` |
167 |
> |
else |
168 |
> |
sdl_libs=`$sdl_config --libs` |
169 |
> |
fi |
170 |
|
;; |
171 |
|
esac |
172 |
|
CFLAGS="$CFLAGS $sdl_cflags" |
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) |
316 |
> |
AC_CHECK_HEADERS(sys/socket.h sys/ioctl.h sys/filio.h sys/bitypes.h sys/wait.h) |
317 |
> |
AC_CHECK_HEADERS(sys/poll.h sys/select.h) |
318 |
> |
AC_CHECK_HEADERS(arpa/inet.h) |
319 |
|
AC_CHECK_HEADERS(linux/if.h linux/if_tun.h net/if.h net/if_tun.h, [], [], [ |
320 |
+ |
#ifdef HAVE_SYS_TYPES_H |
321 |
+ |
#include <sys/types.h> |
322 |
+ |
#endif |
323 |
|
#ifdef HAVE_SYS_SOCKET_H |
324 |
|
#include <sys/socket.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 |
365 |
|
fi |
366 |
|
|
367 |
|
dnl Checks for library functions. |
368 |
< |
AC_CHECK_FUNCS(strdup cfmakeraw) |
368 |
> |
AC_CHECK_FUNCS(strdup strerror cfmakeraw) |
369 |
|
AC_CHECK_FUNCS(clock_gettime timer_create) |
370 |
|
AC_CHECK_FUNCS(sigaction signal) |
371 |
|
AC_CHECK_FUNCS(mmap mprotect munmap) |
372 |
|
AC_CHECK_FUNCS(vm_allocate vm_deallocate vm_protect) |
373 |
+ |
AC_CHECK_FUNCS(poll inet_aton) |
374 |
|
|
375 |
|
dnl Darwin seems to define mach_task_self() instead of task_self(). |
376 |
|
AC_CHECK_FUNCS(mach_task_self task_self) |
423 |
|
|
424 |
|
|
425 |
|
dnl AC_CHECK_FRAMEWORK($1=NAME, $2=INCLUDES) |
426 |
< |
AC_DEFUN(AC_CHECK_FRAMEWORK, [ |
426 |
> |
AC_DEFUN([AC_CHECK_FRAMEWORK], [ |
427 |
|
AS_VAR_PUSHDEF([ac_Framework], [ac_cv_framework_$1])dnl |
428 |
|
AC_CACHE_CHECK([whether compiler supports framework $1], |
429 |
|
ac_Framework, [ |
430 |
|
saved_LIBS="$LIBS" |
431 |
|
LIBS="$LIBS -framework $1" |
432 |
|
AC_TRY_LINK( |
433 |
< |
[$2], [int main(void) { return 0; }], |
433 |
> |
[$2], [], |
434 |
|
[AS_VAR_SET(ac_Framework, yes)], [AS_VAR_SET(ac_Framework, no); LIBS="$saved_LIBS"] |
435 |
|
) |
436 |
|
]) |
443 |
|
dnl Check for some MacOS X frameworks |
444 |
|
AC_CHECK_FRAMEWORK(Carbon, [#include <Carbon/Carbon.h>]) |
445 |
|
AC_CHECK_FRAMEWORK(IOKit, [#include <IOKit/IOKitLib.h>]) |
446 |
+ |
AC_CHECK_FRAMEWORK(CoreFoundation, [#include <CoreFoundation/CoreFoundation.h>]) |
447 |
|
|
448 |
|
dnl Select system-dependant source files. |
449 |
|
SERIALSRC=serial_unix.cpp |
450 |
|
ETHERSRC=../dummy/ether_dummy.cpp |
451 |
|
SCSISRC=../dummy/scsi_dummy.cpp |
452 |
|
AUDIOSRC=../dummy/audio_dummy.cpp |
453 |
+ |
EXTFSSRC=extfs_unix.cpp |
454 |
|
EXTRASYSSRCS= |
455 |
|
CAN_NATIVE_M68K=no |
456 |
|
case "$target_os" in |
484 |
|
;; |
485 |
|
netbsd*) |
486 |
|
CAN_NATIVE_M68K=yes |
487 |
+ |
ETHERSRC=ether_unix.cpp |
488 |
|
;; |
489 |
|
solaris*) |
490 |
|
AUDIOSRC=Solaris/audio_solaris.cpp |
494 |
|
ETHERSRC=ether_unix.cpp |
495 |
|
AUDIOSRC=Irix/audio_irix.cpp |
496 |
|
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" |
497 |
|
LIBS="$LIBS -laudio" |
498 |
|
WANT_ESD=no |
499 |
|
|
503 |
|
CFLAGS=`echo "$CFLAGS -IPA" | sed -e "s/-g//g"` |
504 |
|
AC_MSG_CHECKING(if "-IPA" works) |
505 |
|
dnl Do a test compile of an empty function |
506 |
< |
AC_TRY_COMPILE(,, [AC_MSG_RESULT(yes); HAVE_IPA=yes], AC_MSG_RESULT(no)) |
506 |
> |
AC_TRY_COMPILE([#if defined __GNUC__ |
507 |
> |
# error GCC does not support IPA yet |
508 |
> |
#endif],, [AC_MSG_RESULT(yes); HAVE_IPA=yes], AC_MSG_RESULT(no)) |
509 |
|
CFLAGS="$ocflags" |
510 |
|
;; |
511 |
|
darwin*) |
512 |
< |
if [[ "x$ac_cv_framework_IOKit" = "xyes" ]]; then |
512 |
> |
ETHERSRC=ether_unix.cpp |
513 |
> |
if [[ "x$ac_cv_framework_IOKit" = "xyes" -a "x$ac_cv_framework_CoreFoundation" = "xyes" ]]; then |
514 |
|
EXTRASYSSRCS="../MacOSX/sys_darwin.cpp" |
515 |
|
fi |
516 |
+ |
if [[ "x$ac_cv_framework_Carbon" = "xyes" ]]; then |
517 |
+ |
EXTFSSRC=../MacOSX/extfs_macosx.mm |
518 |
+ |
fi |
519 |
|
;; |
520 |
|
cygwin*) |
521 |
|
SERIALSRC="../dummy/serial_dummy.cpp" |
522 |
|
EXTRASYSSRCS="../Windows/BasiliskII.rc" |
523 |
|
;; |
524 |
|
esac |
525 |
+ |
|
526 |
+ |
dnl Is the slirp library supported? |
527 |
+ |
if [[ "x$ETHERSRC" = "xether_unix.cpp" ]]; then |
528 |
+ |
AC_DEFINE(HAVE_SLIRP, 1, [Define if slirp library is supported]) |
529 |
+ |
SLIRP_SRCS="\ |
530 |
+ |
../slirp/bootp.c ../slirp/ip_output.c ../slirp/tcp_input.c \ |
531 |
+ |
../slirp/cksum.c ../slirp/mbuf.c ../slirp/tcp_output.c \ |
532 |
+ |
../slirp/debug.c ../slirp/misc.c ../slirp/tcp_subr.c \ |
533 |
+ |
../slirp/if.c ../slirp/sbuf.c ../slirp/tcp_timer.c \ |
534 |
+ |
../slirp/ip_icmp.c ../slirp/slirp.c ../slirp/tftp.c \ |
535 |
+ |
../slirp/ip_input.c ../slirp/socket.c ../slirp/udp.c" |
536 |
+ |
fi |
537 |
+ |
AC_SUBST(SLIRP_SRCS) |
538 |
+ |
|
539 |
|
dnl SDL overrides |
540 |
|
if [[ "x$WANT_SDL" = "xyes" ]]; then |
541 |
|
AC_DEFINE(USE_SDL, 1, [Define to enble SDL support]) |
547 |
|
if [[ "x$ac_cv_framework_Carbon" = "xyes" ]]; then |
548 |
|
EXTRASYSSRCS="$EXTRASYSSRCS ../MacOSX/clip_macosx.cpp" |
549 |
|
else |
550 |
< |
EXTRASYSSRCS="$EXTRASYSSRCS ../dummy/clip_dummy.cpp" |
550 |
> |
case "$target_os" in |
551 |
> |
cygwin*) |
552 |
> |
EXTRASYSSRCS="$EXTRASYSSRCS ../Windows/clip_windows.cpp" |
553 |
> |
;; |
554 |
> |
*) |
555 |
> |
EXTRASYSSRCS="$EXTRASYSSRCS ../dummy/clip_dummy.cpp" |
556 |
> |
;; |
557 |
> |
esac |
558 |
|
fi |
559 |
|
else |
560 |
|
VIDEOSRCS="video_x.cpp" |
580 |
|
ETHERSRC=../dummy/ether_dummy.cpp |
581 |
|
AUDIOSRC=../dummy/audio_dummy.cpp |
582 |
|
fi |
583 |
< |
SYSSRCS="$VIDEOSRCS $SERIALSRC $ETHERSRC $SCSISRC $AUDIOSRC $SEMSRC $UISRCS $MONSRCS $EXTRASYSSRCS" |
583 |
> |
SYSSRCS="$VIDEOSRCS $EXTFSSRC $SERIALSRC $ETHERSRC $SCSISRC $AUDIOSRC $SEMSRC $UISRCS $MONSRCS $EXTRASYSSRCS" |
584 |
|
|
585 |
|
dnl Define a macro that translates a yesno-variable into a C macro definition |
586 |
|
dnl to be put into the config.h file |
587 |
|
dnl $1 -- the macro to define |
588 |
|
dnl $2 -- the value to translate |
589 |
|
dnl $3 -- template name |
590 |
< |
AC_DEFUN(AC_TRANSLATE_DEFINE, [ |
590 |
> |
AC_DEFUN([AC_TRANSLATE_DEFINE], [ |
591 |
|
if [[ "x$2" = "xyes" -o "x$2" = "xguessing yes" ]]; then |
592 |
|
AC_DEFINE($1, 1, $3) |
593 |
|
fi |
1114 |
|
dnl Check for GCC 2.7 or higher. |
1115 |
|
HAVE_GCC27=no |
1116 |
|
AC_MSG_CHECKING(for GCC 2.7 or higher) |
1117 |
< |
AC_EGREP_CPP(xyes, |
1118 |
< |
[#if __GNUC__ - 1 > 1 || __GNUC_MINOR__ - 1 > 5 |
1119 |
< |
xyes |
1120 |
< |
#endif |
1121 |
< |
], [AC_MSG_RESULT(yes); HAVE_GCC27=yes], AC_MSG_RESULT(no)) |
1117 |
> |
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#if ! (__GNUC__ - 1 > 1 || __GNUC_MINOR__ - 1 > 5) |
1118 |
> |
# error gcc < 2.7 |
1119 |
> |
#endif |
1120 |
> |
]])], |
1121 |
> |
[AC_MSG_RESULT(yes); HAVE_GCC27=yes], |
1122 |
> |
[AC_MSG_RESULT(no)]) |
1123 |
|
|
1124 |
|
dnl Check for GCC 3.0 or higher. |
1125 |
|
HAVE_GCC30=no |
1126 |
|
AC_MSG_CHECKING(for GCC 3.0 or higher) |
1127 |
< |
AC_EGREP_CPP(xyes, |
1128 |
< |
[#if __GNUC__ >= 3 |
1129 |
< |
xyes |
1130 |
< |
#endif |
1131 |
< |
], [AC_MSG_RESULT(yes); HAVE_GCC30=yes], AC_MSG_RESULT(no)) |
1127 |
> |
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#if ! (__GNUC__ >= 3) |
1128 |
> |
# error gcc < 3 |
1129 |
> |
#endif |
1130 |
> |
]])], |
1131 |
> |
[AC_MSG_RESULT(yes); HAVE_GCC30=yes], |
1132 |
> |
[AC_MSG_RESULT(no)]) |
1133 |
> |
|
1134 |
> |
dnl Check for ICC. |
1135 |
> |
AC_MSG_CHECKING(for ICC) |
1136 |
> |
HAVE_ICC=no |
1137 |
> |
if $CXX -V -v 2>&1 | grep -q "Intel(R) C++ Compiler"; then |
1138 |
> |
HAVE_ICC=yes |
1139 |
> |
fi |
1140 |
> |
AC_MSG_RESULT($HAVE_ICC) |
1141 |
|
|
1142 |
|
dnl Set "-fomit-frame-pointer" on i386 GCC 2.7 or higher. |
1143 |
|
dnl Also set "-fno-exceptions" for C++ because exception handling requires |
1152 |
|
dnl Official: probably gcc-3.1 (mainline CVS) |
1153 |
|
dnl Mandrake: gcc-2.96 >= 0.59mdk, gcc-3.0.1 >= 0.1mdk |
1154 |
|
dnl Red Hat : gcc-2.96 >= 89, gcc-3.0 >= 1 |
1155 |
< |
if [[ "x$HAVE_GCC27" = "xyes" ]]; then |
1155 |
> |
if [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_ICC" = "xno" ]]; then |
1156 |
|
SAVED_CXXFLAGS="$CXXFLAGS" |
1157 |
|
CXXFLAGS="$CXXFLAGS -fno-merge-constants" |
1158 |
|
AC_CACHE_CHECK([whether GCC supports constants merging], ac_cv_gcc_constants_merging, [ |
1168 |
|
|
1169 |
|
dnl Store motion was introduced in 3.3-hammer branch and any gcc >= 3.4 |
1170 |
|
dnl However, there are some corner cases exposed on x86-64 |
1171 |
< |
if [[ "x$HAVE_GCC27" = "xyes" ]]; then |
1171 |
> |
if [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_ICC" = "xno" ]]; then |
1172 |
|
SAVED_CXXFLAGS="$CXXFLAGS" |
1173 |
|
CXXFLAGS="$CXXFLAGS -fno-gcse-sm" |
1174 |
|
AC_CACHE_CHECK([whether GCC supports store motion], ac_cv_gcc_store_motion, [ |
1182 |
|
fi |
1183 |
|
fi |
1184 |
|
|
1185 |
+ |
dnl Add -fno-strict-aliasing for slirp sources |
1186 |
+ |
if [[ "x$HAVE_GCC30" = "xyes" ]]; then |
1187 |
+ |
SAVED_CFLAGS="$CFLAGS" |
1188 |
+ |
CFLAGS="$CFLAGS -fno-strict-aliasing" |
1189 |
+ |
AC_CACHE_CHECK([whether the compiler supports -fno-strict-aliasing], |
1190 |
+ |
ac_cv_gcc_no_strict_aliasing, [ |
1191 |
+ |
AC_TRY_COMPILE([],[], |
1192 |
+ |
[ac_cv_gcc_no_strict_aliasing=yes; AC_SUBST(SLIRP_CFLAGS, "-fno-strict-aliasing")], |
1193 |
+ |
[ac_cv_gcc_no_strict_aliasing=no]) |
1194 |
+ |
]) |
1195 |
+ |
CFLAGS="$SAVED_CFLAGS" |
1196 |
+ |
fi |
1197 |
+ |
|
1198 |
+ |
dnl Add -mdynamic-no-pic for MacOS X (XXX icc10 will support MacOS X) |
1199 |
+ |
if [[ "x$HAVE_GCC30" = "xyes" -a "x$HAVE_ICC" = "xno" ]]; then |
1200 |
+ |
SAVED_CFLAGS="$CFLAGS" |
1201 |
+ |
CFLAGS="$CFLAGS -mdynamic-no-pic" |
1202 |
+ |
AC_CACHE_CHECK([whether the compiler supports -mdynamic-no-pic], |
1203 |
+ |
ac_cv_gcc_mdynamic_no_pic, [ |
1204 |
+ |
AC_TRY_COMPILE([],[],[ac_cv_gcc_mdynamic_no_pic=yes],[ac_cv_gcc_mdynamic_no_pic=no]) |
1205 |
+ |
]) |
1206 |
+ |
if [[ "x$ac_cv_gcc_mdynamic_no_pic" = "xyes" ]]; then |
1207 |
+ |
CXXFLAGS="$CXXFLAGS -mdynamic-no-pic" |
1208 |
+ |
else |
1209 |
+ |
CFLAGS="$SAVED_CFLAGS" |
1210 |
+ |
fi |
1211 |
+ |
fi |
1212 |
+ |
|
1213 |
|
dnl Select appropriate CPU source and REGPARAM define. |
1214 |
|
ASM_OPTIMIZATIONS=none |
1215 |
|
CPUSRCS="cpuemu1.cpp cpuemu2.cpp cpuemu3.cpp cpuemu4.cpp cpuemu5.cpp cpuemu6.cpp cpuemu7.cpp cpuemu8.cpp" |