ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/SheepShaver/src/Windows/configure.ac
Revision: 1.2
Committed: 2005-03-24T23:39:19Z (19 years, 2 months ago) by gbeauche
Branch: MAIN
Changes since 1.1: +5 -3 lines
Log Message:
cross-compilation fixes

File Contents

# Content
1 dnl Process this file with autoconf to produce a configure script.
2 dnl Written in 2002 by Christian Bauer
3
4 AC_INIT([SheepShaver], 2.2, [Christian.Bauer@uni-mainz.de], SheepShaver)
5 AC_CONFIG_SRCDIR(main_windows.cpp)
6 AC_CONFIG_AUX_DIR(../Unix)
7 AC_PREREQ(2.52)
8 AC_CONFIG_HEADER(config.h)
9
10 dnl Canonical system information.
11 AC_CANONICAL_HOST
12 AC_CANONICAL_TARGET
13
14 dnl Options.
15 AC_ARG_ENABLE(jit, [ --enable-jit enable JIT compiler [default=yes]], [WANT_JIT=$enableval], [WANT_JIT=yes])
16
17 dnl Checks for programs.
18 AC_PROG_CC
19 AC_PROG_CPP
20 AC_PROG_CXX
21 AC_PROG_MAKE_SET
22 AC_PROG_EGREP
23 AC_PROG_LN_S
24 AC_PATH_PROG(PERL, [perl])
25 AC_CHECK_TOOL(WINDRES, windres)
26
27 dnl We use 64-bit file size support if possible.
28 AC_SYS_LARGEFILE
29
30 dnl Checks for header files.
31 AC_HEADER_STDC
32
33 dnl Checks for typedefs, structures, and compiler characteristics.
34 AC_C_BIGENDIAN
35 AC_C_CONST
36 AC_C_INLINE
37 AC_CHECK_SIZEOF(short, 2)
38 AC_CHECK_SIZEOF(int, 4)
39 AC_CHECK_SIZEOF(long, 4)
40 AC_CHECK_SIZEOF(long long, 8)
41 AC_CHECK_SIZEOF(float, 4)
42 AC_CHECK_SIZEOF(double, 8)
43 AC_CHECK_SIZEOF(void *, 4)
44 AC_TYPE_OFF_T
45 AC_CHECK_TYPES(loff_t)
46 AC_TYPE_SIZE_T
47
48 dnl Checks for library functions.
49 AC_CHECK_FUNCS(exp2f log2f exp2 log2 trunc)
50
51 dnl Define a macro that translates a yesno-variable into a C macro definition
52 dnl to be put into the config.h file
53 dnl $1 -- the macro to define
54 dnl $2 -- the value to translate
55 dnl $3 -- template name
56 AC_DEFUN([AC_TRANSLATE_DEFINE], [
57 if [[ "x$2" = "xyes" -o "x$2" = "xguessing yes" ]]; then
58 AC_DEFINE($1, 1, $3)
59 fi
60 ])
61
62 dnl Check that VirtualAlloc(), VirtualProtect() work
63 AC_CACHE_CHECK([whether VirtualProtect works],
64 ac_cv_VirtualProtect_works, [
65 AC_LANG_SAVE
66 AC_LANG_CPLUSPLUS
67 ac_cv_VirtualProtect_works=yes
68 dnl First the tests that should segfault
69 for test_def in NONE_READ NONE_WRITE READ_WRITE; do
70 AC_TRY_RUN([
71 #define HAVE_WIN32_VM 1
72 #define CONFIGURE_TEST_VM_MAP
73 #define TEST_VM_PROT_$test_def
74 #include "../Unix/vm_alloc.cpp"
75 ], ac_cv_VirtualProtect_works=no, rm -f core,
76 dnl When cross-compiling, assume it works
77 ac_cv_VirtualProtect_works="yes"
78 )
79 done
80 AC_TRY_RUN([
81 #define HAVE_WIN32_VM 1
82 #define CONFIGURE_TEST_VM_MAP
83 #define TEST_VM_PROT_RDWR_WRITE
84 #include "../Unix/vm_alloc.cpp"
85 ], , ac_cv_VirtualProtect_works=no,
86 dnl When cross-compiling, assume it works
87 ac_cv_VirtualProtect_works="yes"
88 )
89 AC_LANG_RESTORE
90 ]
91 )
92 if [[ "x$ac_cv_VirtualProtect_works" = "xyes" ]]; then
93 AC_DEFINE(HAVE_WIN32_VM, 1, [Define if your system has a working Win32-based memory allocator.])
94 else
95 AC_MSG_ERROR([Sorry, Windows VM functions don't work as expected on your system.])
96 fi
97
98 dnl Check if Windows exceptions are supported.
99 AC_CACHE_CHECK([whether your system supports Windows exceptions],
100 ac_cv_have_win32_exceptions, [
101 AC_LANG_SAVE
102 AC_LANG_CPLUSPLUS
103 AC_TRY_RUN([
104 #define HAVE_WIN32_EXCEPTIONS 1
105 #define CONFIGURE_TEST_SIGSEGV_RECOVERY
106 #include "../Unix/vm_alloc.cpp"
107 #include "../Unix/sigsegv.cpp"
108 ],
109 ac_cv_have_win32_exceptions=yes,
110 ac_cv_have_win32_exceptions=no,
111 dnl When cross-compiling, assume it works
112 ac_cv_have_win32_exceptions="yes"
113 )
114 AC_LANG_RESTORE
115 ]
116 )
117 if [[ "x$ac_cv_have_win32_exceptions" = "xyes" ]]; then
118 AC_DEFINE(HAVE_WIN32_EXCEPTIONS, 1, [Define if your system supports Windows exceptions.])
119 else
120 AC_MSG_ERROR([Sorry, Windows exceptions don't work as expected on your system.])
121 fi
122
123 dnl Check if we can ignore the fault (instruction skipping in SIGSEGV handler)
124 AC_CACHE_CHECK([whether we can skip instruction in SIGSEGV handler],
125 ac_cv_have_skip_instruction, [
126 AC_LANG_SAVE
127 AC_LANG_CPLUSPLUS
128 AC_TRY_RUN([
129 #define HAVE_SIGSEGV_SKIP_INSTRUCTION 1
130 #define CONFIGURE_TEST_SIGSEGV_RECOVERY
131 #include "../Unix/vm_alloc.cpp"
132 #include "../Unix/sigsegv.cpp"
133 ], ac_cv_have_skip_instruction=yes, ac_cv_have_skip_instruction=no,
134 dnl When cross-compiling, assume it works
135 ac_cv_have_skip_instruction="yes"
136 )
137 AC_LANG_RESTORE
138 ]
139 )
140 AC_TRANSLATE_DEFINE(HAVE_SIGSEGV_SKIP_INSTRUCTION, "$ac_cv_have_skip_instruction",
141 [Define if we can ignore the fault (instruction skipping in SIGSEGV handler).])
142
143 dnl We really want VOSF (Video on SEGV Signals) screen updates acceleration
144 AC_DEFINE(ENABLE_VOSF, 1, [Define if using video enabled on SEGV signals.])
145
146 dnl Check for GCC 2.7 or higher.
147 HAVE_GCC27=no
148 AC_MSG_CHECKING(for GCC 2.7 or higher)
149 AC_EGREP_CPP(xyes,
150 [#if __GNUC__ - 1 > 1 || __GNUC_MINOR__ - 1 > 5
151 xyes
152 #endif
153 ], [AC_MSG_RESULT(yes); HAVE_GCC27=yes], AC_MSG_RESULT(no))
154
155 dnl Check for GCC 3.0 or higher.
156 HAVE_GCC30=no
157 AC_MSG_CHECKING(for GCC 3.0 or higher)
158 AC_EGREP_CPP(xyes,
159 [#if __GNUC__ >= 3
160 xyes
161 #endif
162 ], [AC_MSG_RESULT(yes); HAVE_GCC30=yes], AC_MSG_RESULT(no))
163
164 dnl CPU emulator sources
165 CPUSRCS="\
166 ../kpx_cpu/src/mathlib/ieeefp.cpp \
167 ../kpx_cpu/src/cpu/ppc/ppc-cpu.cpp \
168 ../kpx_cpu/src/cpu/ppc/ppc-decode.cpp \
169 ../kpx_cpu/src/cpu/ppc/ppc-execute.cpp \
170 ../kpx_cpu/src/cpu/ppc/ppc-translate.cpp"
171 CPPFLAGS="$CPPFLAGS -I../kpx_cpu/include -I../kpx_cpu/src"
172
173 dnl Enable JIT compiler, if possible
174 USE_DYNGEN="no"
175 if [[ "x$WANT_JIT" = "xyes" ]]; then
176 case $host_cpu in
177 i?86)
178 DYNGEN_OP_FLAGS="-fomit-frame-pointer -mpreferred-stack-boundary=2"
179 if [[ "x$HAVE_GCC30" = "xyes" ]]; then
180 DYNGEN_OP_FLAGS="$DYNGEN_OP_FLAGS -falign-functions=0"
181 else
182 DYNGEN_OP_FLAGS="$DYNGEN_OP_FLAGS -malign-functions=0"
183 fi
184 ;;
185 esac
186 USE_DYNGEN="yes"
187 DYNGEN_OP_FLAGS="$DYNGEN_OP_FLAGS -finline-limit=10000 -g0"
188 if [[ "x$HAVE_GCC30" = "xyes" ]]; then
189 DYNGEN_OP_FLAGS="$DYNGEN_OP_FLAGS -fno-reorder-blocks -fno-optimize-sibling-calls"
190 fi
191 AC_DEFINE(ENABLE_DYNGEN, 1, [Define to enable dyngen engine])
192 DYNGENSRCS="\
193 ../kpx_cpu/src/cpu/jit/dyngen.c \
194 ../kpx_cpu/src/cpu/jit/cxxdemangle.cpp"
195 CPUSRCS="\
196 ../kpx_cpu/src/cpu/jit/jit-cache.cpp \
197 ../kpx_cpu/src/cpu/jit/basic-dyngen.cpp \
198 ../kpx_cpu/src/cpu/ppc/ppc-dyngen.cpp $CPUSRCS"
199 CPPFLAGS="$CPPFLAGS -DUSE_JIT"
200 fi
201 CPUSRCS="$CPUSRCS ../kpx_cpu/sheepshaver_glue.cpp"
202
203 dnl We really want SDL for now
204 AC_CHECK_TOOL(sdl_config, sdl-config, [AC_MSG_ERROR([Sorry, you currently need SDL for this port])])
205 sdl_cflags=`$sdl_config --cflags`
206 sdl_libs=`$sdl_config --libs`
207 CFLAGS="$CFLAGS $sdl_cflags"
208 CXXFLAGS="$CXXFLAGS $sdl_cflags"
209 LIBS="$LIBS $sdl_libs"
210 AC_DEFINE(USE_SDL, 1, [Define to enble SDL support])
211 AC_DEFINE(USE_SDL_VIDEO, 1, [Define to enable SDL video graphics support])
212 AC_DEFINE(USE_SDL_AUDIO, 1, [Define to enable SDL audio support])
213
214 dnl Remove the "-g" option if set for GCC.
215 if [[ "x$HAVE_GCC27" = "xyes" ]]; then
216 CFLAGS=`echo $CFLAGS | sed -e 's/-g\b//g'`
217 CXXFLAGS=`echo $CXXFLAGS | sed -e 's/-g\b//g'`
218 fi
219
220 dnl Generate Makefile.
221 AC_SUBST(PERL)
222 AC_SUBST(USE_DYNGEN)
223 AC_SUBST(DYNGENSRCS)
224 AC_SUBST(DYNGEN_OP_FLAGS)
225 AC_SUBST(CPUSRCS)
226 AC_OUTPUT([Makefile])
227
228 dnl Print summary.
229 echo
230 echo SheepShaver configuration summary:
231 echo
232 echo Enable JIT compiler .............. : $WANT_JIT
233 echo
234 echo "Configuration done. Now type \"make\"."