ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/SheepShaver/src/Windows/configure.ac
Revision: 1.3
Committed: 2005-11-27T23:54:26Z (18 years, 11 months ago) by gbeauche
Branch: MAIN
Changes since 1.2: +15 -5 lines
Log Message:
Build Windows GUI with GTK

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