ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/SheepShaver/src/Windows/configure.ac
Revision: 1.8
Committed: 2012-06-16T02:16:39Z (11 years, 10 months ago) by asvitkine
Branch: MAIN
CVS Tags: HEAD
Changes since 1.7: +1 -1 lines
Log Message:
Dump PPC disassembly on crash

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