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 |
|
|
99 |
|
AC_PROG_CXX |
100 |
|
AC_PROG_MAKE_SET |
101 |
|
AC_PROG_INSTALL |
102 |
+ |
AC_PROG_EGREP |
103 |
|
|
104 |
|
dnl We use mon if possible. |
105 |
|
MONSRCS= |
128 |
|
dnl Checks for libraries. |
129 |
|
AC_CHECK_LIB(posix4, sem_init) |
130 |
|
AC_CHECK_LIB(rt, timer_create) |
131 |
+ |
AC_CHECK_LIB(rt, shm_open) |
132 |
|
|
133 |
|
dnl Do we need SDL? |
134 |
|
WANT_SDL=no |
146 |
|
if [[ "x$WANT_SDL" = "xyes" ]]; then |
147 |
|
AC_PATH_PROG(sdl_config, "sdl-config") |
148 |
|
if [[ -n "$sdl_config" ]]; then |
149 |
< |
sdl_cflags=`$sdl_config --cflags` |
150 |
< |
sdl_libs=`$sdl_config --libs` |
149 |
> |
case $target_os in |
150 |
> |
# Special treatment for Cygwin so that we can still use the POSIX layer |
151 |
> |
*cygwin*) |
152 |
> |
sdl_cflags="-I`$sdl_config --prefix`/include/SDL" |
153 |
> |
sdl_libs="-L`$sdl_config --exec-prefix`/lib -lSDL" |
154 |
> |
;; |
155 |
> |
*) |
156 |
> |
sdl_cflags=`$sdl_config --cflags` |
157 |
> |
if [[ "x$WANT_SDL_STATIC" = "xyes" ]]; then |
158 |
> |
sdl_libs=`$sdl_config --static-libs` |
159 |
> |
else |
160 |
> |
sdl_libs=`$sdl_config --libs` |
161 |
> |
fi |
162 |
> |
;; |
163 |
> |
esac |
164 |
|
CFLAGS="$CFLAGS $sdl_cflags" |
165 |
|
CXXFLAGS="$CXXFLAGS $sdl_cflags" |
166 |
|
LIBS="$LIBS $sdl_libs" |
280 |
|
AC_HEADER_STDC |
281 |
|
AC_CHECK_HEADERS(unistd.h fcntl.h sys/types.h sys/time.h sys/mman.h mach/mach.h) |
282 |
|
AC_CHECK_HEADERS(readline.h history.h readline/readline.h readline/history.h) |
283 |
< |
AC_CHECK_HEADERS(linux/if.h linux/if_tun.h net/if.h net/if_tun.h) |
283 |
> |
AC_CHECK_HEADERS(sys/socket.h sys/ioctl.h sys/filio.h sys/bitypes.h sys/wait.h) |
284 |
> |
AC_CHECK_HEADERS(sys/poll.h sys/select.h) |
285 |
> |
AC_CHECK_HEADERS(arpa/inet.h) |
286 |
> |
AC_CHECK_HEADERS(linux/if.h linux/if_tun.h net/if.h net/if_tun.h, [], [], [ |
287 |
> |
#ifdef HAVE_SYS_TYPES_H |
288 |
> |
#include <sys/types.h> |
289 |
> |
#endif |
290 |
> |
#ifdef HAVE_SYS_SOCKET_H |
291 |
> |
#include <sys/socket.h> |
292 |
> |
#endif |
293 |
> |
]) |
294 |
|
AC_CHECK_HEADERS(AvailabilityMacros.h) |
295 |
|
|
296 |
|
dnl Checks for typedefs, structures, and compiler characteristics. |
331 |
|
fi |
332 |
|
|
333 |
|
dnl Checks for library functions. |
334 |
< |
AC_CHECK_FUNCS(strdup cfmakeraw) |
334 |
> |
AC_CHECK_FUNCS(strdup strerror cfmakeraw) |
335 |
|
AC_CHECK_FUNCS(clock_gettime timer_create) |
336 |
|
AC_CHECK_FUNCS(sigaction signal) |
337 |
|
AC_CHECK_FUNCS(mmap mprotect munmap) |
338 |
|
AC_CHECK_FUNCS(vm_allocate vm_deallocate vm_protect) |
339 |
+ |
AC_CHECK_FUNCS(poll inet_aton) |
340 |
|
|
341 |
|
dnl Darwin seems to define mach_task_self() instead of task_self(). |
342 |
|
AC_CHECK_FUNCS(mach_task_self task_self) |
363 |
|
*-*-sco3.2v5*) |
364 |
|
no_dev_ptmx=1 |
365 |
|
;; |
366 |
+ |
*-*-cygwin*) |
367 |
+ |
no_dev_ptmx=1 |
368 |
+ |
;; |
369 |
|
esac |
370 |
|
|
371 |
|
if test -z "$no_dev_ptmx" ; then |
415 |
|
ETHERSRC=../dummy/ether_dummy.cpp |
416 |
|
SCSISRC=../dummy/scsi_dummy.cpp |
417 |
|
AUDIOSRC=../dummy/audio_dummy.cpp |
418 |
+ |
EXTFSSRC=extfs_unix.cpp |
419 |
|
EXTRASYSSRCS= |
420 |
|
CAN_NATIVE_M68K=no |
421 |
|
case "$target_os" in |
449 |
|
;; |
450 |
|
netbsd*) |
451 |
|
CAN_NATIVE_M68K=yes |
452 |
+ |
ETHERSRC=ether_unix.cpp |
453 |
|
;; |
454 |
|
solaris*) |
455 |
|
AUDIOSRC=Solaris/audio_solaris.cpp |
474 |
|
CFLAGS="$ocflags" |
475 |
|
;; |
476 |
|
darwin*) |
477 |
+ |
ETHERSRC=ether_unix.cpp |
478 |
|
if [[ "x$ac_cv_framework_IOKit" = "xyes" ]]; then |
479 |
|
EXTRASYSSRCS="../MacOSX/sys_darwin.cpp" |
480 |
|
fi |
481 |
+ |
if [[ "x$ac_cv_framework_Carbon" = "xyes" ]]; then |
482 |
+ |
EXTFSSRC=../MacOSX/extfs_macosx.mm |
483 |
+ |
fi |
484 |
+ |
;; |
485 |
+ |
cygwin*) |
486 |
+ |
SERIALSRC="../dummy/serial_dummy.cpp" |
487 |
+ |
EXTRASYSSRCS="../Windows/BasiliskII.rc" |
488 |
|
;; |
489 |
|
esac |
490 |
+ |
|
491 |
+ |
dnl Is the slirp library supported? |
492 |
+ |
if [[ "x$ETHERSRC" = "xether_unix.cpp" ]]; then |
493 |
+ |
AC_DEFINE(HAVE_SLIRP, 1, [Define if slirp library is supported]) |
494 |
+ |
SLIRP_SRCS="\ |
495 |
+ |
../slirp/bootp.c ../slirp/ip_output.c ../slirp/tcp_input.c \ |
496 |
+ |
../slirp/cksum.c ../slirp/mbuf.c ../slirp/tcp_output.c \ |
497 |
+ |
../slirp/debug.c ../slirp/misc.c ../slirp/tcp_subr.c \ |
498 |
+ |
../slirp/if.c ../slirp/sbuf.c ../slirp/tcp_timer.c \ |
499 |
+ |
../slirp/ip_icmp.c ../slirp/slirp.c ../slirp/tftp.c \ |
500 |
+ |
../slirp/ip_input.c ../slirp/socket.c ../slirp/udp.c" |
501 |
+ |
fi |
502 |
+ |
AC_SUBST(SLIRP_SRCS) |
503 |
+ |
|
504 |
|
dnl SDL overrides |
505 |
|
if [[ "x$WANT_SDL" = "xyes" ]]; then |
506 |
|
AC_DEFINE(USE_SDL, 1, [Define to enble SDL support]) |
512 |
|
if [[ "x$ac_cv_framework_Carbon" = "xyes" ]]; then |
513 |
|
EXTRASYSSRCS="$EXTRASYSSRCS ../MacOSX/clip_macosx.cpp" |
514 |
|
else |
515 |
< |
EXTRASYSSRCS="$EXTRASYSSRCS ../dummy/clip_dummy.cpp" |
515 |
> |
case "$target_os" in |
516 |
> |
cygwin*) |
517 |
> |
EXTRASYSSRCS="$EXTRASYSSRCS ../Windows/clip_windows.cpp" |
518 |
> |
;; |
519 |
> |
*) |
520 |
> |
EXTRASYSSRCS="$EXTRASYSSRCS ../dummy/clip_dummy.cpp" |
521 |
> |
;; |
522 |
> |
esac |
523 |
|
fi |
524 |
|
else |
525 |
|
VIDEOSRCS="video_x.cpp" |
545 |
|
ETHERSRC=../dummy/ether_dummy.cpp |
546 |
|
AUDIOSRC=../dummy/audio_dummy.cpp |
547 |
|
fi |
548 |
< |
SYSSRCS="$VIDEOSRCS $SERIALSRC $ETHERSRC $SCSISRC $AUDIOSRC $SEMSRC $UISRCS $MONSRCS $EXTRASYSSRCS" |
548 |
> |
SYSSRCS="$VIDEOSRCS $EXTFSSRC $SERIALSRC $ETHERSRC $SCSISRC $AUDIOSRC $SEMSRC $UISRCS $MONSRCS $EXTRASYSSRCS" |
549 |
|
|
550 |
|
dnl Define a macro that translates a yesno-variable into a C macro definition |
551 |
|
dnl to be put into the config.h file |
763 |
|
] |
764 |
|
) |
765 |
|
|
766 |
+ |
dnl Check if we have POSIX shared memory support |
767 |
+ |
AC_CACHE_CHECK([whether POSIX shared memory is working], |
768 |
+ |
ac_cv_have_posix_shm, [ |
769 |
+ |
AC_LANG_SAVE |
770 |
+ |
AC_LANG_CPLUSPLUS |
771 |
+ |
AC_TRY_RUN([ |
772 |
+ |
#define HAVE_POSIX_SHM |
773 |
+ |
#include "vm_alloc.cpp" |
774 |
+ |
int main(void) { /* returns 0 if we have working POSIX shm */ |
775 |
+ |
if (vm_init() < 0) exit(2); |
776 |
+ |
char *m1 = (char *)vm_acquire(32768, VM_MAP_DEFAULT | VM_MAP_33BIT); |
777 |
+ |
if (m1 == VM_MAP_FAILED) exit(3); |
778 |
+ |
vm_exit(); exit(0); |
779 |
+ |
} |
780 |
+ |
], ac_cv_have_posix_shm=yes, ac_cv_have_posix_shm=no, |
781 |
+ |
dnl When cross-compiling, do not assume anything. |
782 |
+ |
ac_cv_have_posix_shm="guessing no" |
783 |
+ |
) |
784 |
+ |
AC_LANG_RESTORE |
785 |
+ |
] |
786 |
+ |
) |
787 |
+ |
AC_TRANSLATE_DEFINE(HAVE_POSIX_SHM, "$ac_cv_have_posix_shm", |
788 |
+ |
[Define if your system supports POSIX shared memory.]) |
789 |
+ |
|
790 |
+ |
dnl Check if we have working 33-bit memory addressing |
791 |
+ |
AC_CACHE_CHECK([whether 33-bit memory addressing is working], |
792 |
+ |
ac_cv_have_33bit_addressing, [ |
793 |
+ |
AC_LANG_SAVE |
794 |
+ |
AC_LANG_CPLUSPLUS |
795 |
+ |
AC_TRY_RUN([ |
796 |
+ |
#define USE_33BIT_ADDRESSING 1 |
797 |
+ |
#include "vm_alloc.cpp" |
798 |
+ |
int main(void) { /* returns 0 if we have working 33-bit addressing */ |
799 |
+ |
if (sizeof(void *) < 8) exit(1); |
800 |
+ |
if (vm_init() < 0) exit(2); |
801 |
+ |
char *m1 = (char *)vm_acquire(32768, VM_MAP_DEFAULT | VM_MAP_33BIT); |
802 |
+ |
if (m1 == VM_MAP_FAILED) exit(3); |
803 |
+ |
char *m2 = m1 + (1L << 32); |
804 |
+ |
m1[0] = 0x12; if (m2[0] != 0x12) exit(4); |
805 |
+ |
m2[0] = 0x34; if (m1[0] != 0x34) exit(5); |
806 |
+ |
vm_exit(); exit(0); |
807 |
+ |
} |
808 |
+ |
], ac_cv_have_33bit_addressing=yes, ac_cv_have_33bit_addressing=no, |
809 |
+ |
dnl When cross-compiling, do not assume anything. |
810 |
+ |
ac_cv_have_33bit_addressing="guessing no" |
811 |
+ |
) |
812 |
+ |
AC_LANG_RESTORE |
813 |
+ |
] |
814 |
+ |
) |
815 |
+ |
|
816 |
|
dnl Check signal handlers need to be reinstalled |
817 |
|
AC_CACHE_CHECK([whether signal handlers need to be reinstalled], |
818 |
|
ac_cv_signal_need_reinstall, [ |
898 |
|
AC_TRANSLATE_DEFINE(HAVE_MACH_EXCEPTIONS, "$ac_cv_have_mach_exceptions", |
899 |
|
[Define if your system supports Mach exceptions.]) |
900 |
|
|
901 |
+ |
dnl Check if Windows exceptions are supported. |
902 |
+ |
AC_CACHE_CHECK([whether your system supports Windows exceptions], |
903 |
+ |
ac_cv_have_win32_exceptions, [ |
904 |
+ |
AC_LANG_SAVE |
905 |
+ |
AC_LANG_CPLUSPLUS |
906 |
+ |
AC_TRY_RUN([ |
907 |
+ |
#define HAVE_WIN32_EXCEPTIONS 1 |
908 |
+ |
#define CONFIGURE_TEST_SIGSEGV_RECOVERY |
909 |
+ |
#include "vm_alloc.cpp" |
910 |
+ |
#include "sigsegv.cpp" |
911 |
+ |
], [ |
912 |
+ |
sigsegv_recovery=win32 |
913 |
+ |
ac_cv_have_win32_exceptions=yes |
914 |
+ |
], |
915 |
+ |
ac_cv_have_win32_exceptions=no, |
916 |
+ |
dnl When cross-compiling, do not assume anything. |
917 |
+ |
ac_cv_have_win32_exceptions=no |
918 |
+ |
) |
919 |
+ |
AC_LANG_RESTORE |
920 |
+ |
] |
921 |
+ |
) |
922 |
+ |
AC_TRANSLATE_DEFINE(HAVE_WIN32_EXCEPTIONS, "$ac_cv_have_win32_exceptions", |
923 |
+ |
[Define if your system supports Windows exceptions.]) |
924 |
+ |
|
925 |
|
dnl Otherwise, check if extended signals are supported. |
926 |
|
if [[ -z "$sigsegv_recovery" ]]; then |
927 |
|
AC_CACHE_CHECK([whether your system supports extended signal handlers], |
1094 |
|
#endif |
1095 |
|
], [AC_MSG_RESULT(yes); HAVE_GCC30=yes], AC_MSG_RESULT(no)) |
1096 |
|
|
1097 |
+ |
dnl Check for ICC. |
1098 |
+ |
AC_MSG_CHECKING(for ICC) |
1099 |
+ |
HAVE_ICC=no |
1100 |
+ |
if $CXX -V -v 2>&1 | grep -q "Intel(R) C++ Compiler"; then |
1101 |
+ |
HAVE_ICC=yes |
1102 |
+ |
fi |
1103 |
+ |
AC_MSG_RESULT($HAVE_ICC) |
1104 |
+ |
|
1105 |
|
dnl Set "-fomit-frame-pointer" on i386 GCC 2.7 or higher. |
1106 |
|
dnl Also set "-fno-exceptions" for C++ because exception handling requires |
1107 |
|
dnl the frame pointer. |
1115 |
|
dnl Official: probably gcc-3.1 (mainline CVS) |
1116 |
|
dnl Mandrake: gcc-2.96 >= 0.59mdk, gcc-3.0.1 >= 0.1mdk |
1117 |
|
dnl Red Hat : gcc-2.96 >= 89, gcc-3.0 >= 1 |
1118 |
< |
if [[ "x$HAVE_GCC27" = "xyes" ]]; then |
1118 |
> |
if [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_ICC" = "xno" ]]; then |
1119 |
|
SAVED_CXXFLAGS="$CXXFLAGS" |
1120 |
|
CXXFLAGS="$CXXFLAGS -fno-merge-constants" |
1121 |
|
AC_CACHE_CHECK([whether GCC supports constants merging], ac_cv_gcc_constants_merging, [ |
1131 |
|
|
1132 |
|
dnl Store motion was introduced in 3.3-hammer branch and any gcc >= 3.4 |
1133 |
|
dnl However, there are some corner cases exposed on x86-64 |
1134 |
< |
if [[ "x$HAVE_GCC27" = "xyes" ]]; then |
1134 |
> |
if [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_ICC" = "xno" ]]; then |
1135 |
|
SAVED_CXXFLAGS="$CXXFLAGS" |
1136 |
|
CXXFLAGS="$CXXFLAGS -fno-gcse-sm" |
1137 |
|
AC_CACHE_CHECK([whether GCC supports store motion], ac_cv_gcc_store_motion, [ |
1145 |
|
fi |
1146 |
|
fi |
1147 |
|
|
1148 |
+ |
dnl Add -fno-strict-aliasing for slirp sources |
1149 |
+ |
if [[ "x$HAVE_GCC30" = "xyes" ]]; then |
1150 |
+ |
SAVED_CFLAGS="$CFLAGS" |
1151 |
+ |
CFLAGS="$CFLAGS -fno-strict-aliasing" |
1152 |
+ |
AC_CACHE_CHECK([whether the compiler supports -fno-strict-aliasing], |
1153 |
+ |
ac_cv_gcc_no_strict_aliasing, [ |
1154 |
+ |
AC_TRY_COMPILE([],[], |
1155 |
+ |
[ac_cv_gcc_no_strict_aliasing=yes; AC_SUBST(SLIRP_CFLAGS, "$CFLAGS")], |
1156 |
+ |
[ac_cv_gcc_no_strict_aliasing=no]) |
1157 |
+ |
]) |
1158 |
+ |
CFLAGS="$SAVED_CFLAGS" |
1159 |
+ |
fi |
1160 |
+ |
|
1161 |
|
dnl Select appropriate CPU source and REGPARAM define. |
1162 |
|
ASM_OPTIMIZATIONS=none |
1163 |
|
CPUSRCS="cpuemu1.cpp cpuemu2.cpp cpuemu3.cpp cpuemu4.cpp cpuemu5.cpp cpuemu6.cpp cpuemu7.cpp cpuemu8.cpp" |
1184 |
|
DEFINES="$DEFINES -DX86_64_ASSEMBLY -DOPTIMIZED_FLAGS" |
1185 |
|
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" |
1186 |
|
CAN_JIT=yes |
1187 |
+ |
WANT_33BIT_ADDRESSING=yes |
1188 |
|
fi |
1189 |
|
elif [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_SPARC" = "xyes" -a "x$HAVE_GAS" = "xyes" ]]; then |
1190 |
|
dnl SPARC CPU |
1241 |
|
JITSRCS="" |
1242 |
|
fi |
1243 |
|
|
1244 |
+ |
dnl Use 33-bit memory addressing? |
1245 |
+ |
if [[ "$ac_cv_have_33bit_addressing:$WANT_33BIT_ADDRESSING" = "yes:yes" ]]; then |
1246 |
+ |
use_33bit_addressing=yes |
1247 |
+ |
fi |
1248 |
+ |
AC_TRANSLATE_DEFINE(USE_33BIT_ADDRESSING, "$use_33bit_addressing", |
1249 |
+ |
[Define to use 33-bit memory addressing on 64-bit JIT capable systems.]) |
1250 |
+ |
|
1251 |
|
dnl Utility macro used by next two tests. |
1252 |
|
dnl AC_EXAMINE_OBJECT(C source code, |
1253 |
|
dnl commands examining object file, |