ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/SheepShaver/src/Windows/configure.ac
Revision: 1.1
Committed: 2005-03-20T23:45:17Z (19 years, 3 months ago) by gbeauche
Branch: MAIN
Log Message:
Windows specific configure script and Makefile

File Contents

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