25 |
|
AC_ARG_WITH(mon, [ --with-mon use mon as debugger [default=yes]], [WANT_MON=$withval], [WANT_MON=yes]) |
26 |
|
AC_ARG_WITH(dgcc, [ --with-dgcc=COMPILER use C++ COMPILER to compile synthetic opcodes], [DYNGEN_CC=$withval]) |
27 |
|
|
28 |
+ |
dnl Addressing mode |
29 |
+ |
AC_ARG_ENABLE(addressing, |
30 |
+ |
[ --enable-addressing=AM set the addressing mode to use [default=real]], |
31 |
+ |
[case "$enableval" in |
32 |
+ |
real) WANT_ADDRESSING_MODE="real";; |
33 |
+ |
direct) WANT_ADDRESSING_MODE="direct";; |
34 |
+ |
direct,0x*) WANT_ADDRESSING_MODE="direct"; NATMEM_OFFSET=`echo "$enableval" | sed -n '/direct,\(0[[xX]][[0-9A-Fa-f]]*\)/s//\1/p'`;; |
35 |
+ |
esac], |
36 |
+ |
[WANT_ADDRESSING_MODE="real"] |
37 |
+ |
) |
38 |
+ |
|
39 |
|
dnl SDL options. |
40 |
|
AC_ARG_ENABLE(sdl-static, [ --enable-sdl-static use SDL static libraries for linking [default=no]], [WANT_SDL_STATIC=$enableval], [WANT_SDL_STATIC=no]) |
41 |
|
AC_ARG_ENABLE(sdl-video, [ --enable-sdl-video use SDL for video graphics [default=no]], [WANT_SDL_VIDEO=$enableval], [WANT_SDL_VIDEO=no]) |
42 |
+ |
AC_ARG_ENABLE(sdl-audio, [ --enable-sdl-audio use SDL for audio [default=no]], [WANT_SDL_AUDIO=$enableval], [WANT_SDL_AUDIO=no]) |
43 |
|
|
44 |
|
dnl Checks for programs. |
45 |
|
AC_PROG_CC |
48 |
|
AC_PROG_MAKE_SET |
49 |
|
AC_PROG_INSTALL |
50 |
|
AC_PROG_EGREP |
51 |
+ |
AC_CHECK_PROGS(FILE, [file false]) |
52 |
|
|
53 |
|
dnl Check for PowerPC target CPU. |
54 |
|
HAVE_PPC=no |
111 |
|
|
112 |
|
dnl Do we need SDL? |
113 |
|
WANT_SDL=no |
101 |
– |
SDL_SUPPORT="none" |
114 |
|
if [[ "x$WANT_SDL_VIDEO" = "xyes" ]]; then |
115 |
|
WANT_SDL=yes |
116 |
|
WANT_XF86_DGA=no |
117 |
|
WANT_XF86_VIDMODE=no |
118 |
|
WANT_FBDEV_DGA=no |
119 |
< |
SDL_SUPPORT="video" |
119 |
> |
SDL_SUPPORT="$SDL_SUPPORT video" |
120 |
> |
fi |
121 |
> |
if [[ "x$WANT_SDL_AUDIO" = "xyes" ]]; then |
122 |
> |
WANT_SDL=yes |
123 |
> |
SDL_SUPPORT="$SDL_SUPPORT audio" |
124 |
|
fi |
125 |
|
if [[ "x$WANT_SDL" = "xyes" ]]; then |
126 |
|
AC_PATH_PROG(sdl_config, "sdl-config") |
127 |
|
if [[ -n "$sdl_config" ]]; then |
128 |
< |
sdl_cflags=`$sdl_config --cflags` |
129 |
< |
if [[ "x$WANT_SDL_STATIC" = "xyes" ]]; then |
130 |
< |
sdl_libs=`$sdl_config --static-libs` |
131 |
< |
else |
132 |
< |
sdl_libs=`$sdl_config --libs` |
133 |
< |
fi |
128 |
> |
case $target_os in |
129 |
> |
# Special treatment for Cygwin so that we can still use the POSIX layer |
130 |
> |
*cygwin*) |
131 |
> |
sdl_cflags="-I`$sdl_config --prefix`/include/SDL" |
132 |
> |
sdl_libs="-L`$sdl_config --exec-prefix`/lib -lSDL" |
133 |
> |
;; |
134 |
> |
*) |
135 |
> |
sdl_cflags=`$sdl_config --cflags` |
136 |
> |
if [[ "x$WANT_SDL_STATIC" = "xyes" ]]; then |
137 |
> |
sdl_libs=`$sdl_config --static-libs` |
138 |
> |
else |
139 |
> |
sdl_libs=`$sdl_config --libs` |
140 |
> |
fi |
141 |
> |
;; |
142 |
> |
esac |
143 |
|
CFLAGS="$CFLAGS $sdl_cflags" |
144 |
|
CXXFLAGS="$CXXFLAGS $sdl_cflags" |
145 |
|
LIBS="$LIBS $sdl_libs" |
146 |
|
else |
147 |
|
WANT_SDL=no |
148 |
|
fi |
149 |
+ |
SDL_SUPPORT=`echo "$SDL_SUPPORT" | sed -e "s/^ //"` |
150 |
+ |
else |
151 |
+ |
SDL_SUPPORT="none" |
152 |
|
fi |
153 |
|
|
154 |
|
dnl We need X11, if not using SDL. |
250 |
|
dnl Checks for header files. |
251 |
|
AC_HEADER_STDC |
252 |
|
AC_HEADER_SYS_WAIT |
253 |
+ |
AC_CHECK_HEADERS(malloc.h) |
254 |
|
AC_CHECK_HEADERS(mach/vm_map.h mach/mach_init.h sys/mman.h) |
255 |
|
AC_CHECK_HEADERS(sys/time.h sys/times.h sys/socket.h) |
256 |
< |
AC_CHECK_HEADERS(unistd.h fcntl.h byteswap.h) |
256 |
> |
AC_CHECK_HEADERS(unistd.h fcntl.h byteswap.h dirent.h) |
257 |
|
AC_CHECK_HEADERS(linux/if.h, [], [], [ |
258 |
|
#if HAVE_SYS_SOCKET_H |
259 |
|
# include <sys/socket.h> |
316 |
|
;; |
317 |
|
esac |
318 |
|
|
319 |
+ |
dnl Check for headers and functions related to pty support (sshpty.c) |
320 |
+ |
dnl From openssh-3.2.2p1 configure.ac |
321 |
+ |
AC_CHECK_HEADERS(strings.h login.h sys/bsdtty.h sys/stat.h util.h pty.h) |
322 |
+ |
AC_CHECK_FUNCS(_getpty vhangup strlcpy) |
323 |
+ |
|
324 |
+ |
case "$host" in |
325 |
+ |
*-*-hpux10.26) |
326 |
+ |
disable_ptmx_check=yes |
327 |
+ |
;; |
328 |
+ |
*-*-linux*) |
329 |
+ |
no_dev_ptmx=1 |
330 |
+ |
;; |
331 |
+ |
mips-sony-bsd|mips-sony-newsos4) |
332 |
+ |
AC_DEFINE(HAVE_NEWS4, 1, [Define if you are on NEWS-OS (additions from openssh-3.2.2p1, for sshpty.c).]) |
333 |
+ |
;; |
334 |
+ |
*-*-sco3.2v4*) |
335 |
+ |
no_dev_ptmx=1 |
336 |
+ |
;; |
337 |
+ |
*-*-sco3.2v5*) |
338 |
+ |
no_dev_ptmx=1 |
339 |
+ |
;; |
340 |
+ |
*-*-cygwin*) |
341 |
+ |
no_dev_ptmx=1 |
342 |
+ |
;; |
343 |
+ |
esac |
344 |
+ |
|
345 |
+ |
if test -z "$no_dev_ptmx" ; then |
346 |
+ |
if test "x$disable_ptmx_check" != "xyes" ; then |
347 |
+ |
AC_CHECK_FILE([/dev/ptmx], |
348 |
+ |
[ |
349 |
+ |
AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX, 1, [Define if you have /dev/ptmx.]) |
350 |
+ |
have_dev_ptmx=1 |
351 |
+ |
] |
352 |
+ |
) |
353 |
+ |
fi |
354 |
+ |
fi |
355 |
+ |
AC_CHECK_FILE([/dev/ptc], |
356 |
+ |
[ |
357 |
+ |
AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC, 1, [Define if you have /dev/ptc.]) |
358 |
+ |
have_dev_ptc=1 |
359 |
+ |
] |
360 |
+ |
) |
361 |
+ |
dnl (end of code from openssh-3.2.2p1 configure.ac) |
362 |
+ |
|
363 |
|
dnl AC_CHECK_FRAMEWORK($1=NAME, $2=INCLUDES) |
364 |
|
AC_DEFUN(AC_CHECK_FRAMEWORK, [ |
365 |
|
AS_VAR_PUSHDEF([ac_Framework], [ac_cv_framework_$1])dnl |
387 |
|
ETHERSRC=../dummy/ether_dummy.cpp |
388 |
|
SCSISRC=../dummy/scsi_dummy.cpp |
389 |
|
AUDIOSRC=../dummy/audio_dummy.cpp |
390 |
+ |
EXTFSSRC=extfs_unix.cpp |
391 |
|
EXTRASYSSRCS= |
392 |
|
case "$target_os" in |
393 |
|
linux*) |
405 |
|
if [[ "x$ac_cv_framework_IOKit" = "xyes" ]]; then |
406 |
|
EXTRASYSSRCS="$EXTRASYSSRCS ../MacOSX/sys_darwin.cpp" |
407 |
|
fi |
408 |
+ |
if [[ "x$ac_cv_framework_Carbon" = "xyes" ]]; then |
409 |
+ |
EXTFSSRC=../MacOSX/extfs_macosx.mm |
410 |
+ |
fi |
411 |
+ |
;; |
412 |
+ |
cygwin*) |
413 |
+ |
SERIALSRC="../dummy/serial_dummy.cpp" |
414 |
|
;; |
415 |
|
esac |
416 |
|
|
419 |
|
AC_DEFINE(USE_SDL, 1, [Define to enble SDL support.]) |
420 |
|
fi |
421 |
|
if [[ "x$WANT_SDL_VIDEO" = "xyes" ]]; then |
342 |
– |
VIDEOSRCS="../SDL/video_sdl.cpp" |
422 |
|
AC_DEFINE(USE_SDL_VIDEO, 1, [Define to enable SDL video graphics support.]) |
423 |
+ |
VIDEOSRCS="../SDL/video_sdl.cpp" |
424 |
|
KEYCODES="../SDL/keycodes" |
425 |
|
if [[ "x$ac_cv_framework_Carbon" = "xyes" ]]; then |
426 |
|
EXTRASYSSRCS="$EXTRASYSSRCS ../MacOSX/clip_macosx.cpp" |
427 |
|
else |
428 |
< |
EXTRASYSSRCS="$EXTRASYSSRCS ../dummy/clip_dummy.cpp" |
428 |
> |
case "$target_os" in |
429 |
> |
cygwin*) |
430 |
> |
EXTRASYSSRCS="$EXTRASYSSRCS ../Windows/clip_windows.cpp" |
431 |
> |
;; |
432 |
> |
*) |
433 |
> |
EXTRASYSSRCS="$EXTRASYSSRCS ../dummy/clip_dummy.cpp" |
434 |
> |
;; |
435 |
> |
esac |
436 |
|
fi |
437 |
|
else |
438 |
|
VIDEOSRCS="video_x.cpp" |
439 |
|
KEYCODES="keycodes" |
440 |
|
EXTRASYSSRCS="$EXTRASYSSRCS clip_unix.cpp" |
441 |
|
fi |
442 |
+ |
if [[ "x$WANT_SDL_AUDIO" = "xyes" ]]; then |
443 |
+ |
AC_DEFINE(USE_SDL_AUDIO, 1, [Define to enable SDL audio support]) |
444 |
+ |
AUDIOSRC="../SDL/audio_sdl.cpp" |
445 |
+ |
fi |
446 |
|
|
447 |
< |
SYSSRCS="$VIDEOSRCS $SERIALSRC $ETHERSRC $SCSISRC $AUDIOSRC $SEMSRC $UISRCS $MONSRCS $EXTRASYSSRCS" |
447 |
> |
SYSSRCS="$VIDEOSRCS $EXTFSSRC $SERIALSRC $ETHERSRC $SCSISRC $AUDIOSRC $SEMSRC $UISRCS $MONSRCS $EXTRASYSSRCS" |
448 |
|
|
449 |
|
dnl Define a macro that translates a yesno-variable into a C macro definition |
450 |
|
dnl to be put into the config.h file |
748 |
|
AC_TRANSLATE_DEFINE(HAVE_MACH_EXCEPTIONS, "$ac_cv_have_mach_exceptions", |
749 |
|
[Define if your system supports Mach exceptions.]) |
750 |
|
|
751 |
+ |
dnl Check if Windows exceptions are supported. |
752 |
+ |
AC_CACHE_CHECK([whether your system supports Windows exceptions], |
753 |
+ |
ac_cv_have_win32_exceptions, [ |
754 |
+ |
AC_LANG_SAVE |
755 |
+ |
AC_LANG_CPLUSPLUS |
756 |
+ |
AC_TRY_RUN([ |
757 |
+ |
#define HAVE_WIN32_EXCEPTIONS 1 |
758 |
+ |
#define CONFIGURE_TEST_SIGSEGV_RECOVERY |
759 |
+ |
#include "vm_alloc.cpp" |
760 |
+ |
#include "sigsegv.cpp" |
761 |
+ |
], [ |
762 |
+ |
sigsegv_recovery=win32 |
763 |
+ |
ac_cv_have_win32_exceptions=yes |
764 |
+ |
], |
765 |
+ |
ac_cv_have_win32_exceptions=no, |
766 |
+ |
dnl When cross-compiling, do not assume anything. |
767 |
+ |
ac_cv_have_win32_exceptions=no |
768 |
+ |
) |
769 |
+ |
AC_LANG_RESTORE |
770 |
+ |
] |
771 |
+ |
) |
772 |
+ |
AC_TRANSLATE_DEFINE(HAVE_WIN32_EXCEPTIONS, "$ac_cv_have_win32_exceptions", |
773 |
+ |
[Define if your system supports Windows exceptions.]) |
774 |
+ |
|
775 |
|
dnl Otherwise, check if extended signals are supported. |
776 |
|
if [[ -z "$sigsegv_recovery" ]]; then |
777 |
|
AC_CACHE_CHECK([whether your system supports extended signal handlers], |
858 |
|
WANT_VOSF=no |
859 |
|
fi |
860 |
|
|
861 |
+ |
dnl Check addressing mode to use |
862 |
+ |
AC_MSG_CHECKING([for addressing mode to use]) |
863 |
+ |
case "$os_target" in |
864 |
+ |
cygwin*) |
865 |
+ |
WANT_ADDRESSING_MODE="direct,cygwin-hack" |
866 |
+ |
NATMEM_OFFSET= |
867 |
+ |
;; |
868 |
+ |
esac |
869 |
+ |
if [[ "$EMULATED_PPC" != "yes" ]]; then |
870 |
+ |
if [[ "$WANT_ADDRESSING_MODE" != "real" ]]; then |
871 |
+ |
AC_MSG_WARN([Running in native PowerPC mode, force use of Real Addressing.]) |
872 |
+ |
WANT_ADDRESSING_MODE="real" |
873 |
+ |
fi |
874 |
+ |
fi |
875 |
+ |
if [[ "$WANT_ADDRESSING_MODE" = "direct" ]]; then |
876 |
+ |
if [[ -n "$NATMEM_OFFSET" ]]; then |
877 |
+ |
NATMEM_OFFSET_DEF="-DNATMEM_OFFSET=$NATMEM_OFFSET" |
878 |
+ |
fi |
879 |
+ |
AC_LANG_SAVE |
880 |
+ |
AC_LANG_CPLUSPLUS |
881 |
+ |
cat confdefs.h > conftest.$ac_ext |
882 |
+ |
cat >> conftest.$ac_ext << EOF |
883 |
+ |
#include <stdio.h> |
884 |
+ |
#include <string.h> |
885 |
+ |
#include "vm_alloc.cpp" |
886 |
+ |
|
887 |
+ |
int main(void) |
888 |
+ |
{ |
889 |
+ |
if (vm_init() < 0) |
890 |
+ |
return 1; |
891 |
+ |
|
892 |
+ |
static const struct { |
893 |
+ |
unsigned long base; |
894 |
+ |
unsigned int size; |
895 |
+ |
} ranges[[]] = { |
896 |
+ |
{ 0x00000000, 0x0003000 }, |
897 |
+ |
{ 0x10000000, 0x2000000 }, |
898 |
+ |
{ 0x40800000, 0x0400000 }, |
899 |
+ |
{ 0x68070000, 0x0010000 }, |
900 |
+ |
{ 0x69000000, 0x0080000 }, |
901 |
+ |
{ 0x68ffe000, 0x0002000 }, |
902 |
+ |
{ 0x5fffe000, 0x0002000 }, |
903 |
+ |
{ 0x60000000, 0x0040000 }, |
904 |
+ |
}; |
905 |
+ |
const int n_ranges = sizeof(ranges)/ sizeof(ranges[[0]]); |
906 |
+ |
|
907 |
+ |
#ifdef NATMEM_OFFSET |
908 |
+ |
unsigned long ofs = NATMEM_OFFSET; |
909 |
+ |
#else |
910 |
+ |
for (unsigned long ofs = 0x10000000; ofs <= 0x90000000; ofs += 0x10000000) |
911 |
+ |
#endif |
912 |
+ |
for (int i = 0; i < n_ranges; i++) { |
913 |
+ |
char *m = (char *)(ranges[[i]].base + ofs); |
914 |
+ |
if (vm_acquire_fixed(m, ranges[[i]].size) != 0) |
915 |
+ |
break; |
916 |
+ |
memset(m, 0, ranges[[i]].size); |
917 |
+ |
vm_release(m, ranges[[i]].size); |
918 |
+ |
if (i == n_ranges - 1) { |
919 |
+ |
printf("0x%08x\n", ofs); |
920 |
+ |
return 0; |
921 |
+ |
} |
922 |
+ |
} |
923 |
+ |
|
924 |
+ |
vm_exit(); |
925 |
+ |
return 1; |
926 |
+ |
} |
927 |
+ |
EOF |
928 |
+ |
doit='$CXX conftest.$ac_ext -o conftest.$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS $LIBS $NATMEM_OFFSET_DEF >& AS_MESSAGE_LOG_FD' |
929 |
+ |
if AC_TRY_EVAL(doit); then |
930 |
+ |
NATMEM_OFFSET=`./conftest.$ac_exeext` |
931 |
+ |
else |
932 |
+ |
NATMEM_OFFSET= |
933 |
+ |
fi |
934 |
+ |
rm -f conftest* |
935 |
+ |
AC_LANG_RESTORE |
936 |
+ |
|
937 |
+ |
if [[ -z "$NATMEM_OFFSET" ]]; then |
938 |
+ |
AC_MSG_ERROR([could not determine a sensible NATMEM_OFFSET value]) |
939 |
+ |
else |
940 |
+ |
WANT_ADDRESSING_MODE="direct,$NATMEM_OFFSET" |
941 |
+ |
AC_DEFINE_UNQUOTED(NATMEM_OFFSET, $NATMEM_OFFSET, |
942 |
+ |
[Define constant offset for Mac address translation]) |
943 |
+ |
fi |
944 |
+ |
fi |
945 |
+ |
AC_MSG_RESULT($WANT_ADDRESSING_MODE) |
946 |
+ |
|
947 |
|
dnl Platform specific binary postprocessor |
948 |
|
AC_PATH_PROG(BLESS, "true") |
949 |
|
if [[ "x$ac_cv_pagezero_hack" = "xyes" ]]; then |
977 |
|
fi |
978 |
|
AC_MSG_RESULT($HAVE_ICC) |
979 |
|
|
980 |
< |
# Test if the compiler can generate ELF objects |
980 |
> |
dnl Determine the generated object format |
981 |
|
AC_CACHE_CHECK([whether the compiler can generate ELF objects], |
982 |
< |
ac_cv_elf_objects, [ |
982 |
> |
ac_cv_object_format, [ |
983 |
|
echo 'int i;' > conftest.$ac_ext |
984 |
< |
ac_cv_elf_objects=no |
984 |
> |
ac_cv_object_format=no |
985 |
|
if AC_TRY_EVAL(ac_compile); then |
986 |
|
case `/usr/bin/file conftest.$ac_objext` in |
987 |
|
*"ELF"*) |
988 |
< |
ac_cv_elf_objects=yes |
988 |
> |
ac_cv_object_format=elf |
989 |
> |
;; |
990 |
> |
*) |
991 |
> |
ac_cv_object_format=unknown |
992 |
|
;; |
993 |
|
esac |
994 |
|
fi |
995 |
|
rm -rf conftest* |
996 |
|
]) |
793 |
– |
ELF_OBJECTS=$ac_cv_elf_objects |
997 |
|
|
998 |
|
dnl CPU emulator sources |
999 |
|
if [[ "x$EMULATED_PPC" = "xyes" ]]; then |
1000 |
|
CPUSRCS="\ |
1001 |
+ |
../kpx_cpu/src/mathlib/ieeefp.cpp \ |
1002 |
|
../kpx_cpu/src/cpu/ppc/ppc-cpu.cpp \ |
1003 |
|
../kpx_cpu/src/cpu/ppc/ppc-decode.cpp \ |
1004 |
|
../kpx_cpu/src/cpu/ppc/ppc-execute.cpp \ |
1009 |
|
if [[ "x$WANT_JIT" = "xyes" ]]; then |
1010 |
|
AC_CACHE_CHECK([whether dyngen can be used], |
1011 |
|
ac_cv_use_dyngen, [ |
1012 |
< |
case $host_cpu:$ELF_OBJECTS in |
1013 |
< |
powerpc:yes) |
1012 |
> |
case $host_cpu:$ac_cv_object_format in |
1013 |
> |
powerpc:elf) |
1014 |
|
ac_cv_use_dyngen=yes |
1015 |
|
;; |
1016 |
< |
x86_64:yes) |
1016 |
> |
x86_64:elf) |
1017 |
|
ac_cv_use_dyngen=yes |
1018 |
|
;; |
1019 |
< |
i?86:yes) |
1019 |
> |
i?86:elf) |
1020 |
|
ac_cv_use_dyngen=yes |
1021 |
|
;; |
1022 |
|
*:*) |
1120 |
|
AC_SUBST(CPUSRCS) |
1121 |
|
AC_SUBST(BLESS) |
1122 |
|
AC_SUBST(KEYCODES) |
1123 |
< |
AC_OUTPUT(Makefile) |
1123 |
> |
AC_OUTPUT([ |
1124 |
> |
Makefile |
1125 |
> |
../MacOSX/Info.plist |
1126 |
> |
]) |
1127 |
|
|
1128 |
|
dnl Print summary. |
1129 |
|
echo |
1138 |
|
echo ESD sound support ................ : $WANT_ESD |
1139 |
|
echo GTK user interface ............... : $WANT_GTK |
1140 |
|
echo mon debugger support ............. : $WANT_MON |
1141 |
+ |
echo Addressing mode .................. : $WANT_ADDRESSING_MODE |
1142 |
|
echo Bad memory access recovery type .. : $sigsegv_recovery |
1143 |
|
echo |
1144 |
|
echo "Configuration done. Now type \"make\"." |