~ubuntu-branches/ubuntu/vivid/basilisk2/vivid

« back to all changes in this revision

Viewing changes to src/Windows/configure.ac

  • Committer: Bazaar Package Importer
  • Author(s): Jonas Smedegaard
  • Date: 2008-03-06 19:33:01 UTC
  • mfrom: (2.1.4 gutsy)
  • Revision ID: james.westby@ubuntu.com-20080306193301-cc2ofn705nfsq3y0
Tags: 0.9.20070407-4
* Update copyright-check cdbs snippet to parse licensecheck using perl:
  + No longer randomly drops newlines
  + More compact hint file (and ordered more like wiki-proposed new copyright
    syntax).
  + No longer ignore files without copyright.
* Update copyright_hints.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
dnl Process this file with autoconf to produce a configure script.
 
2
dnl Written in 2002 by Christian Bauer et al.
 
3
 
 
4
AC_INIT([Basilisk II], 1.0, [Christian.Bauer@uni-mainz.de], BasiliskII)
 
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 Aliases for PACKAGE and VERSION macros.
 
11
AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE_NAME", [Define this program name.])
 
12
AC_DEFINE_UNQUOTED(VERSION, "$PACKAGE_VERSION", [Define this program version.])
 
13
 
 
14
dnl SDL options.
 
15
AC_ARG_ENABLE(sdl-static,    [  --enable-sdl-static     use SDL static libraries for linking [default=no]], [WANT_SDL_STATIC=$enableval], [WANT_SDL_STATIC=no])
 
16
 
 
17
dnl JIT compiler options.
 
18
AC_ARG_ENABLE(jit-compiler,  [  --enable-jit-compiler   enable JIT compiler [default=yes]], [WANT_JIT=$enableval], [WANT_JIT=yes])
 
19
AC_ARG_ENABLE(jit-debug,     [  --enable-jit-debug      activate native code disassemblers [default=no]], [WANT_JIT_DEBUG=$enableval], [WANT_JIT_DEBUG=no])
 
20
 
 
21
dnl FPU emulation core.
 
22
AC_ARG_ENABLE(fpe,
 
23
[  --enable-fpe=FPE        specify which fpu emulator to use [default=auto]],
 
24
[ case "$enableval" in
 
25
    dnl default is always ieee, if architecture has this fp format
 
26
    auto)       FPE_CORE_TEST_ORDER="ieee uae";;
 
27
    ieee)       FPE_CORE_TEST_ORDER="ieee";;
 
28
    uae)        FPE_CORE_TEST_ORDER="uae";;
 
29
    x86)        FPE_CORE_TEST_ORDER="x86";;
 
30
        *)              AC_MSG_ERROR([--enable-fpe takes only one of the following values: auto, x86, ieee, uae]);;
 
31
  esac
 
32
],
 
33
[ FPE_CORE_TEST_ORDER="ieee uae"
 
34
])
 
35
 
 
36
dnl External packages.
 
37
AC_ARG_WITH(gtk,             [  --with-gtk              use GTK user interface [default=yes]], [WANT_GTK=$withval], [WANT_GTK=yes])
 
38
 
 
39
dnl Addressing modes.
 
40
AC_ARG_ENABLE(addressing,
 
41
[  --enable-addressing=AM  specify the addressing mode to use [default=fastest]],
 
42
[ case "$enableval" in
 
43
    direct)     ADDRESSING_TEST_ORDER="direct";;
 
44
    banks)      ADDRESSING_TEST_ORDER="banks";;
 
45
    fastest)ADDRESSING_TEST_ORDER="direct banks";;
 
46
    *)          AC_MSG_ERROR([--enable-addressing takes only one of the following values: fastest, direct, banks]);;
 
47
  esac
 
48
],
 
49
[ ADDRESSING_TEST_ORDER="direct banks"
 
50
])
 
51
 
 
52
dnl Canonical system information.
 
53
AC_CANONICAL_HOST
 
54
AC_CANONICAL_TARGET
 
55
 
 
56
dnl Target CPU type.
 
57
HAVE_I386=no
 
58
HAVE_POWERPC=no
 
59
HAVE_X86_64=no
 
60
case "$target_cpu" in
 
61
  i386* | i486* | i586* | i686* | i786* ) HAVE_I386=yes;;
 
62
  powerpc* ) HAVE_POWERPC=yes;;
 
63
  x86_64* ) HAVE_X86_64=yes;;
 
64
esac
 
65
 
 
66
dnl Checks for programs.
 
67
AC_PROG_CC
 
68
AC_PROG_CC_C_O
 
69
AC_PROG_CPP
 
70
AC_PROG_CXX
 
71
AC_PROG_MAKE_SET
 
72
AC_PROG_EGREP
 
73
AC_PROG_LN_S
 
74
AC_CHECK_TOOL(WINDRES, windres)
 
75
 
 
76
dnl We use GTK+ if possible.
 
77
if [[ "x$WANT_GTK" = "xyes" ]]; then
 
78
  AM_PATH_GTK_2_0(1.3.15, [], [
 
79
    AC_MSG_WARN([Could not find GTK+ 2.0, disabling user interface.])
 
80
    WANT_GTK=no
 
81
  ])
 
82
fi
 
83
AC_SUBST(WANT_GTK)
 
84
 
 
85
dnl We use 64-bit file size support if possible.
 
86
AC_SYS_LARGEFILE
 
87
 
 
88
dnl Checks for header files.
 
89
AC_HEADER_STDC
 
90
 
 
91
dnl Checks for typedefs, structures, and compiler characteristics.
 
92
AC_C_BIGENDIAN
 
93
AC_C_CONST
 
94
AC_C_INLINE
 
95
AC_CHECK_SIZEOF(short, 2)
 
96
AC_CHECK_SIZEOF(int, 4)
 
97
AC_CHECK_SIZEOF(long, 4)
 
98
AC_CHECK_SIZEOF(long long, 8)
 
99
AC_CHECK_SIZEOF(float, 4)
 
100
AC_CHECK_SIZEOF(double, 8)
 
101
AC_CHECK_SIZEOF(long double, 12)
 
102
AC_CHECK_SIZEOF(void *, 4)
 
103
AC_TYPE_OFF_T
 
104
AC_CHECK_TYPES(loff_t)
 
105
AC_CHECK_TYPES(caddr_t)
 
106
AC_TYPE_SIZE_T
 
107
 
 
108
dnl Checks for library functions.
 
109
AC_CHECK_FUNCS(strdup strerror)
 
110
 
 
111
dnl Define a macro that translates a yesno-variable into a C macro definition
 
112
dnl to be put into the config.h file
 
113
dnl $1 -- the macro to define
 
114
dnl $2 -- the value to translate
 
115
dnl $3 -- template name
 
116
AC_DEFUN([AC_TRANSLATE_DEFINE], [
 
117
    if [[ "x$2" = "xyes" -o "x$2" = "xguessing yes" ]]; then
 
118
        AC_DEFINE($1, 1, $3)
 
119
    fi
 
120
])
 
121
 
 
122
dnl Check that VirtualAlloc(), VirtualProtect() work
 
123
AC_CACHE_CHECK([whether VirtualProtect works],
 
124
  ac_cv_VirtualProtect_works, [
 
125
  AC_LANG_SAVE
 
126
  AC_LANG_CPLUSPLUS
 
127
  ac_cv_VirtualProtect_works=yes
 
128
  dnl First the tests that should segfault
 
129
  for test_def in NONE_READ NONE_WRITE READ_WRITE; do
 
130
    AC_TRY_RUN([
 
131
      #define HAVE_WIN32_VM 1
 
132
      #define CONFIGURE_TEST_VM_MAP
 
133
      #define TEST_VM_PROT_$test_def
 
134
      #include "../Unix/vm_alloc.cpp"
 
135
    ], ac_cv_VirtualProtect_works=no, rm -f core,
 
136
    dnl When cross-compiling, assume it works
 
137
    ac_cv_VirtualProtect_works="yes"
 
138
    )
 
139
  done
 
140
  AC_TRY_RUN([
 
141
    #define HAVE_WIN32_VM 1
 
142
    #define CONFIGURE_TEST_VM_MAP
 
143
    #define TEST_VM_PROT_RDWR_WRITE
 
144
    #include "../Unix/vm_alloc.cpp"
 
145
  ], , ac_cv_VirtualProtect_works=no,
 
146
  dnl When cross-compiling, assume it works
 
147
  ac_cv_VirtualProtect_works="yes"
 
148
  )
 
149
  AC_LANG_RESTORE
 
150
  ]
 
151
)
 
152
if [[ "x$ac_cv_VirtualProtect_works" = "xyes" ]]; then
 
153
  AC_DEFINE(HAVE_WIN32_VM, 1, [Define if your system has a working Win32-based memory allocator.])
 
154
else
 
155
  AC_MSG_ERROR([Sorry, Windows VM functions don't work as expected on your system.])
 
156
fi
 
157
 
 
158
dnl Check if Windows exceptions are supported.
 
159
AC_CACHE_CHECK([whether your system supports Windows exceptions],
 
160
  ac_cv_have_win32_exceptions, [
 
161
  AC_LANG_SAVE
 
162
  AC_LANG_CPLUSPLUS
 
163
  AC_TRY_RUN([
 
164
    #define HAVE_WIN32_EXCEPTIONS 1
 
165
    #define CONFIGURE_TEST_SIGSEGV_RECOVERY
 
166
    #include "../Unix/vm_alloc.cpp"
 
167
    #include "../Unix/sigsegv.cpp"
 
168
  ],
 
169
  ac_cv_have_win32_exceptions=yes,
 
170
  ac_cv_have_win32_exceptions=no,
 
171
  dnl When cross-compiling, assume it works
 
172
  ac_cv_have_win32_exceptions="yes"
 
173
  )
 
174
  AC_LANG_RESTORE
 
175
  ]
 
176
)
 
177
if [[ "x$ac_cv_have_win32_exceptions" = "xyes" ]]; then
 
178
  AC_DEFINE(HAVE_WIN32_EXCEPTIONS, 1, [Define if your system supports Windows exceptions.])
 
179
else
 
180
  AC_MSG_ERROR([Sorry, Windows exceptions don't work as expected on your system.])
 
181
fi
 
182
 
 
183
dnl Check if we can ignore the fault (instruction skipping in SIGSEGV handler)
 
184
AC_CACHE_CHECK([whether we can skip instruction in SIGSEGV handler],
 
185
  ac_cv_have_skip_instruction, [
 
186
  AC_LANG_SAVE
 
187
  AC_LANG_CPLUSPLUS
 
188
  AC_TRY_RUN([
 
189
    #define HAVE_SIGSEGV_SKIP_INSTRUCTION 1
 
190
    #define CONFIGURE_TEST_SIGSEGV_RECOVERY
 
191
    #include "../Unix/vm_alloc.cpp"
 
192
    #include "../Unix/sigsegv.cpp"
 
193
  ], ac_cv_have_skip_instruction=yes, ac_cv_have_skip_instruction=no,
 
194
  dnl When cross-compiling, do not assume anything.
 
195
  ac_cv_have_skip_instruction=no
 
196
  )
 
197
  AC_LANG_RESTORE
 
198
  ]
 
199
)
 
200
AC_TRANSLATE_DEFINE(HAVE_SIGSEGV_SKIP_INSTRUCTION, "$ac_cv_have_skip_instruction",
 
201
  [Define if we can ignore the fault (instruction skipping in SIGSEGV handler).])
 
202
 
 
203
dnl We really want VOSF (Video on SEGV Signals) screen updates acceleration
 
204
AC_DEFINE(ENABLE_VOSF, 1, [Define if using video enabled on SEGV signals.])
 
205
 
 
206
dnl Determine the addressing mode to use
 
207
ADDRESSING_MODE=""
 
208
AC_MSG_CHECKING([for the addressing mode to use])
 
209
for am in $ADDRESSING_TEST_ORDER; do
 
210
  case $am in
 
211
  direct)
 
212
    dnl Direct addressing mode (constant offset)
 
213
    ADDRESSING_MODE="direct"
 
214
    DEFINES="$DEFINES -DDIRECT_ADDRESSING"
 
215
    break
 
216
    ;;
 
217
  banks)
 
218
    dnl Default addressing mode
 
219
    ADDRESSING_MODE="memory banks"
 
220
    break
 
221
    ;;
 
222
  *)
 
223
    AC_MSG_ERROR([Internal configure.ac script error for $am addressing mode])
 
224
  esac
 
225
done
 
226
AC_MSG_RESULT($ADDRESSING_MODE)
 
227
if [[ "x$ADDRESSING_MODE" = "x" ]]; then
 
228
  AC_MSG_WARN([Sorry, no suitable addressing mode in $ADDRESSING_TEST_ORDER])
 
229
  ADDRESSING_MODE="memory banks"
 
230
fi
 
231
 
 
232
dnl Banked Memory Addressing mode is not supported by the JIT compiler
 
233
if [[ "x$WANT_JIT" = "xyes" -a "x$ADDRESSING_MODE" = "xmemory banks" ]]; then
 
234
  AC_MSG_ERROR([Sorry, the JIT Compiler requires Direct Addressing, at least])
 
235
fi
 
236
 
 
237
dnl Check for GAS.
 
238
HAVE_GAS=no
 
239
AC_MSG_CHECKING(for GAS .p2align feature)
 
240
cat >conftest.S << EOF
 
241
        .text
 
242
        .p2align 5
 
243
EOF
 
244
if $CC conftest.S -c -o conftest.o >/dev/null 2>&1 ; then HAVE_GAS=yes; fi
 
245
AC_MSG_RESULT($HAVE_GAS)
 
246
 
 
247
dnl Check for GCC 2.7 or higher.
 
248
HAVE_GCC27=no
 
249
AC_MSG_CHECKING(for GCC 2.7 or higher)
 
250
AC_EGREP_CPP(xyes,
 
251
[#if __GNUC__ - 1 > 1 || __GNUC_MINOR__ - 1 > 5
 
252
  xyes
 
253
#endif
 
254
], [AC_MSG_RESULT(yes); HAVE_GCC27=yes], AC_MSG_RESULT(no))
 
255
 
 
256
dnl Check for GCC 3.0 or higher.
 
257
HAVE_GCC30=no
 
258
AC_MSG_CHECKING(for GCC 3.0 or higher)
 
259
AC_EGREP_CPP(xyes,
 
260
[#if __GNUC__ >= 3
 
261
  xyes
 
262
#endif
 
263
], [AC_MSG_RESULT(yes); HAVE_GCC30=yes], AC_MSG_RESULT(no))
 
264
 
 
265
dnl Add -fno-strict-aliasing for slirp sources
 
266
if [[ "x$HAVE_GCC30" = "xyes" ]]; then
 
267
  SAVED_CFLAGS="$CFLAGS"
 
268
  CFLAGS="$CFLAGS -fno-strict-aliasing"
 
269
  AC_CACHE_CHECK([whether the compiler supports -fno-strict-aliasing],
 
270
    ac_cv_gcc_no_strict_aliasing, [
 
271
    AC_TRY_COMPILE([],[],
 
272
      [ac_cv_gcc_no_strict_aliasing=yes; AC_SUBST(SLIRP_CFLAGS, "-fno-strict-aliasing")],
 
273
      [ac_cv_gcc_no_strict_aliasing=no])
 
274
  ])
 
275
  CFLAGS="$SAVED_CFLAGS"
 
276
fi
 
277
 
 
278
dnl Select appropriate CPU source and REGPARAM define.
 
279
ASM_OPTIMIZATIONS=none
 
280
CPUSRCS="cpuemu1.cpp cpuemu2.cpp cpuemu3.cpp cpuemu4.cpp cpuemu5.cpp cpuemu6.cpp cpuemu7.cpp cpuemu8.cpp"
 
281
 
 
282
dnl JITSRCS will be emptied later if the JIT is not available
 
283
dnl Other platforms should define their own set of noflags file variants
 
284
CAN_JIT=no
 
285
JITSRCS="compemu1.cpp compemu2.cpp compemu3.cpp compemu4.cpp compemu5.cpp compemu6.cpp compemu7.cpp compemu8.cpp"
 
286
 
 
287
if [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_I386" = "xyes" ]]; then
 
288
  dnl i386 CPU
 
289
  DEFINES="$DEFINES -DUNALIGNED_PROFITABLE -DREGPARAM=\"__attribute__((regparm(3)))\""
 
290
  if [[ "x$HAVE_GAS" = "xyes" ]]; then
 
291
    ASM_OPTIMIZATIONS=i386
 
292
    DEFINES="$DEFINES -DX86_ASSEMBLY -DOPTIMIZED_FLAGS -DSAHF_SETO_PROFITABLE"
 
293
    JITSRCS="cpuemu1_nf.cpp cpuemu2_nf.cpp cpuemu3_nf.cpp cpuemu4_nf.cpp cpuemu5_nf.cpp cpuemu6_nf.cpp cpuemu7_nf.cpp cpuemu8_nf.cpp $JITSRCS"
 
294
    CAN_JIT=yes
 
295
  fi
 
296
elif [[ "x$HAVE_GCC30" = "xyes" -a "x$HAVE_X86_64" = "xyes" ]]; then
 
297
  dnl x86-64 CPU
 
298
  DEFINES="$DEFINES -DUNALIGNED_PROFITABLE"
 
299
  if [[ "x$HAVE_GAS" = "xyes" ]]; then
 
300
    ASM_OPTIMIZATIONS="x86-64"
 
301
    DEFINES="$DEFINES -DX86_64_ASSEMBLY -DOPTIMIZED_FLAGS"
 
302
    JITSRCS="cpuemu1_nf.cpp cpuemu2_nf.cpp cpuemu3_nf.cpp cpuemu4_nf.cpp cpuemu5_nf.cpp cpuemu6_nf.cpp cpuemu7_nf.cpp cpuemu8_nf.cpp $JITSRCS"
 
303
    CAN_JIT=yes
 
304
  fi
 
305
fi
 
306
 
 
307
dnl Enable JIT compiler, if possible.
 
308
if [[ "x$WANT_JIT" = "xyes" -a "x$CAN_JIT" ]]; then
 
309
  JITSRCS="$JITSRCS ../uae_cpu/compiler/compemu_support.cpp ../uae_cpu/compiler/compemu_fpp.cpp compstbl.o cpustbl_nf.o"
 
310
  DEFINES="$DEFINES -DUSE_JIT -DUSE_JIT_FPU"
 
311
  
 
312
  if [[ "x$WANT_JIT_DEBUG" = "xyes" ]]; then
 
313
    if [[ "x$WANT_MON" = "xyes" ]]; then
 
314
      DEFINES="$DEFINES -DJIT_DEBUG=1"
 
315
    else
 
316
      AC_MSG_WARN([cxmon not found, ignoring --enable-jit-debug])
 
317
      WANT_JIT_DEBUG=no
 
318
    fi
 
319
  fi
 
320
 
 
321
  dnl IEEE core is the only FPU emulator to use with the JIT compiler
 
322
  case $FPE_CORE_TEST_ORDER in
 
323
  ieee*) ;;
 
324
  *) AC_MSG_WARN([Forcing use of the IEEE FPU core, as the JIT compiler supports only this one.]) ;;
 
325
  esac
 
326
  FPE_CORE_TEST_ORDER="ieee"
 
327
else
 
328
  WANT_JIT=no
 
329
  WANT_JIT_DEBUG=no
 
330
  JITSRCS=""
 
331
fi
 
332
 
 
333
dnl Utility macro used by next two tests.
 
334
dnl AC_EXAMINE_OBJECT(C source code,
 
335
dnl     commands examining object file,
 
336
dnl     [commands to run if compile failed]):
 
337
dnl
 
338
dnl Compile the source code to an object file; then convert it into a
 
339
dnl printable representation.  All unprintable characters and
 
340
dnl asterisks (*) are replaced by dots (.).  All white space is
 
341
dnl deleted.  Newlines (ASCII 0x10) in the input are preserved in the
 
342
dnl output, but runs of newlines are compressed to a single newline.
 
343
dnl Finally, line breaks are forcibly inserted so that no line is
 
344
dnl longer than 80 columns and the file ends with a newline.  The
 
345
dnl result of all this processing is in the file conftest.dmp, which
 
346
dnl may be examined by the commands in the second argument.
 
347
dnl
 
348
AC_DEFUN([gcc_AC_EXAMINE_OBJECT],
 
349
[AC_LANG_SAVE
 
350
AC_LANG_C
 
351
dnl Next bit cribbed from AC_TRY_COMPILE.
 
352
cat > conftest.$ac_ext <<EOF
 
353
[#line __oline__ "configure"
 
354
#include "confdefs.h"
 
355
$1
 
356
]EOF
 
357
if AC_TRY_EVAL(ac_compile); then
 
358
  od -c conftest.o |
 
359
    sed ['s/^[0-7]*[    ]*/ /
 
360
          s/\*/./g
 
361
          s/ \\n/*/g
 
362
          s/ [0-9][0-9][0-9]/./g
 
363
          s/  \\[^ ]/./g'] |
 
364
    tr -d '
 
365
 ' | tr -s '*' '
 
366
' | fold | sed '$a\
 
367
' > conftest.dmp
 
368
  $2
 
369
ifelse($3, , , else
 
370
  $3
 
371
)dnl
 
372
fi
 
373
rm -rf conftest*
 
374
AC_LANG_RESTORE])
 
375
 
 
376
dnl Floating point format probe.
 
377
dnl The basic concept is the same as the above: grep the object
 
378
dnl file for an interesting string.  We have to watch out for
 
379
dnl rounding changing the values in the object, however; this is
 
380
dnl handled by ignoring the least significant byte of the float.
 
381
dnl
 
382
dnl Does not know about VAX G-float or C4x idiosyncratic format.
 
383
dnl It does know about PDP-10 idiosyncratic format, but this is
 
384
dnl not presently supported by GCC.  S/390 "binary floating point"
 
385
dnl is in fact IEEE (but maybe we should have that in EBCDIC as well
 
386
dnl as ASCII?)
 
387
dnl
 
388
AC_DEFUN([gcc_AC_C_FLOAT_FORMAT],
 
389
[AC_CACHE_CHECK(floating point format, ac_cv_c_float_format,
 
390
[gcc_AC_EXAMINE_OBJECT(
 
391
[/* This will not work unless sizeof(double) == 8.  */
 
392
extern char sizeof_double_must_be_8 [sizeof(double) == 8 ? 1 : -1];
 
393
 
 
394
/* This structure must have no internal padding.  */
 
395
struct possibility {
 
396
  char prefix[8];
 
397
  double candidate;
 
398
  char postfix[8];
 
399
};
 
400
 
 
401
#define C(cand) { "\nformat:", cand, ":tamrof\n" }
 
402
struct possibility table [] =
 
403
{
 
404
  C( 3.25724264705901305206e+01), /* @@IEEEFP - IEEE 754 */
 
405
  C( 3.53802595280598432000e+18), /* D__float - VAX */
 
406
  C( 5.32201830133125317057e-19), /* D.PDP-10 - PDP-10 - the dot is 0x13a */
 
407
  C( 1.77977764695171661377e+10), /* IBMHEXFP - s/390 format, ascii */
 
408
  C(-5.22995989424860458374e+10)  /* IBMHEXFP - s/390 format, EBCDIC */
 
409
};],
 
410
 [if   grep 'format:.@IEEEF.:tamrof' conftest.dmp >/dev/null 2>&1; then
 
411
    ac_cv_c_float_format='IEEE (big-endian)'
 
412
  elif grep 'format:.I@@PFE.:tamrof' conftest.dmp >/dev/null 2>&1; then
 
413
    ac_cv_c_float_format='IEEE (big-endian)'
 
414
  elif grep 'format:.FEEEI@.:tamrof' conftest.dmp >/dev/null 2>&1; then
 
415
    ac_cv_c_float_format='IEEE (little-endian)'
 
416
  elif grep 'format:.EFP@@I.:tamrof' conftest.dmp >/dev/null 2>&1; then
 
417
    ac_cv_c_float_format='IEEE (little-endian)'
 
418
  elif grep 'format:.__floa.:tamrof' conftest.dmp >/dev/null 2>&1; then
 
419
    ac_cv_c_float_format='VAX D-float'
 
420
  elif grep 'format:..PDP-1.:tamrof' conftest.dmp >/dev/null 2>&1; then
 
421
    ac_cv_c_float_format='PDP-10'
 
422
  elif grep 'format:.BMHEXF.:tamrof' conftest.dmp >/dev/null 2>&1; then
 
423
    ac_cv_c_float_format='IBM 370 hex'
 
424
  else
 
425
    AC_MSG_ERROR(Unknown floating point format)
 
426
  fi],
 
427
  [AC_MSG_ERROR(compile failed)])
 
428
])
 
429
# IEEE is the default format.  If the float endianness isn't the same
 
430
# as the integer endianness, we have to set FLOAT_WORDS_BIG_ENDIAN
 
431
# (which is a tristate: yes, no, default).  This is only an issue with
 
432
# IEEE; the other formats are only supported by a few machines each,
 
433
# all with the same endianness.
 
434
format=IEEE_FLOAT_FORMAT
 
435
fbigend=
 
436
case $ac_cv_c_float_format in
 
437
    'IEEE (big-endian)' )
 
438
        if test $ac_cv_c_bigendian = no; then
 
439
            fbigend=1
 
440
        fi
 
441
        ;;
 
442
    'IEEE (little-endian)' )
 
443
        if test $ac_cv_c_bigendian = yes; then
 
444
            fbigend=0
 
445
        fi
 
446
        ;;
 
447
    'VAX D-float' )
 
448
        format=VAX_FLOAT_FORMAT
 
449
        ;;
 
450
    'PDP-10' )
 
451
        format=PDP10_FLOAT_FORMAT
 
452
        ;;
 
453
    'IBM 370 hex' )
 
454
        format=IBM_FLOAT_FORMAT
 
455
        ;;
 
456
esac
 
457
AC_DEFINE_UNQUOTED(HOST_FLOAT_FORMAT, $format,
 
458
  [Define to the floating point format of the host machine.])
 
459
if test -n "$fbigend"; then
 
460
        AC_DEFINE_UNQUOTED(HOST_FLOAT_WORDS_BIG_ENDIAN, $fbigend,
 
461
  [Define to 1 if the host machine stores floating point numbers in
 
462
   memory with the word containing the sign bit at the lowest address,
 
463
   or to 0 if it does it the other way around.
 
464
 
 
465
   This macro should not be defined if the ordering is the same as for
 
466
   multi-word integers.])
 
467
fi
 
468
])
 
469
 
 
470
dnl Select appropriate FPU source.
 
471
gcc_AC_C_FLOAT_FORMAT
 
472
AC_CHECK_HEADERS(ieee754.h ieeefp.h floatingpoint.h nan.h)
 
473
 
 
474
for fpe in $FPE_CORE_TEST_ORDER; do
 
475
  case $fpe in
 
476
  ieee)
 
477
    case $ac_cv_c_float_format in
 
478
    IEEE*)
 
479
      FPE_CORE="IEEE fpu core"
 
480
      DEFINES="$DEFINES -DFPU_IEEE"
 
481
      FPUSRCS="../uae_cpu/fpu/fpu_ieee.cpp"
 
482
      dnl Math functions not mandated by C99 standard
 
483
      AC_CHECK_FUNCS(isnanl isinfl)
 
484
      dnl Math functions required by C99 standard, but probably not
 
485
      dnl implemented everywhere. In that case, we fall back to the
 
486
      dnl regular variant for doubles.
 
487
      AC_CHECK_FUNCS(logl log10l expl powl fabsl sqrtl)
 
488
      AC_CHECK_FUNCS(sinl cosl tanl sinhl coshl tanhl)
 
489
      AC_CHECK_FUNCS(asinl acosl atanl asinhl acoshl atanhl)
 
490
      AC_CHECK_FUNCS(floorl ceill)
 
491
      break
 
492
      ;;
 
493
    esac
 
494
    ;;
 
495
  x86)
 
496
    if [[ ":$HAVE_GCC27:$HAVE_I386:$HAVE_GAS:" = ":yes:yes:yes:" ]]; then
 
497
      FPE_CORE="i387 fpu core"
 
498
      DEFINES="$DEFINES -DFPU_X86"
 
499
      FPUSRCS="../uae_cpu/fpu/fpu_x86.cpp"
 
500
      break
 
501
    fi
 
502
    ;;
 
503
  uae)
 
504
    FPE_CORE="uae fpu core"
 
505
    DEFINES="$DEFINES -DFPU_UAE"
 
506
    FPUSRCS="../uae_cpu/fpu/fpu_uae.cpp"
 
507
    break
 
508
    ;;
 
509
  *)
 
510
    AC_MSG_ERROR([Internal configure.in script error for $fpe fpu core])
 
511
    ;;
 
512
  esac
 
513
done
 
514
if [[ "x$FPE_CORE" = "x" ]]; then
 
515
  AC_MSG_ERROR([Sorry, no suitable FPU core found in $FPE_CORE_TEST_ORDER])
 
516
fi
 
517
 
 
518
dnl Check for certain math functions
 
519
AC_CHECK_FUNCS(atanh)
 
520
AC_CHECK_FUNCS(isnan isinf finite isnormal signbit)
 
521
 
 
522
dnl UAE CPU sources for all non-m68k-native architectures.
 
523
CPUINCLUDES="-I../uae_cpu"
 
524
CPUSRCS="../uae_cpu/basilisk_glue.cpp ../uae_cpu/memory.cpp ../uae_cpu/newcpu.cpp ../uae_cpu/readcpu.cpp $FPUSRCS cpustbl.cpp cpudefs.cpp $CPUSRCS $JITSRCS"
 
525
 
 
526
dnl We really want SDL for now
 
527
AC_CHECK_TOOL(sdl_config, sdl-config, [AC_MSG_ERROR([Sorry, you currently need SDL for this port])])
 
528
SDL_CFLAGS=`$sdl_config --cflags`
 
529
AC_SUBST(SDL_CFLAGS)
 
530
if [[ "x$WANT_SDL_STATIC" = "xyes" ]]; then
 
531
  SDL_LIBS=`$sdl_config --static-libs`
 
532
  sdl_prefix=`$sdl_config --exec-prefix`
 
533
  if [[ -n "$sdl_prefix" ]]; then
 
534
    SDL_LIBS=`echo "$SDL_LIBS" | sed -e "s,-l\(SDLmain\|SDL\),$sdl_prefix/lib/lib\1.a,g"`
 
535
  fi
 
536
  SDL_LIBS="$SDL_LIBS -lwinmm"
 
537
else
 
538
  SDL_LIBS=`$sdl_config --libs`
 
539
fi
 
540
AC_SUBST(SDL_LIBS)
 
541
AC_DEFINE(USE_SDL, 1, [Define to enble SDL support])
 
542
AC_DEFINE(USE_SDL_VIDEO, 1, [Define to enable SDL video graphics support])
 
543
AC_DEFINE(USE_SDL_AUDIO, 1, [Define to enable SDL audio support])
 
544
 
 
545
dnl Remove the "-g" option if set for GCC.
 
546
if [[ "x$HAVE_GCC27" = "xyes" ]]; then
 
547
  CFLAGS=`echo $CFLAGS | sed -e 's/-g\b//g'`
 
548
  CXXFLAGS=`echo $CXXFLAGS | sed -e 's/-g\b//g'`
 
549
fi
 
550
 
 
551
dnl Generate Makefile.
 
552
AC_SUBST(DEFINES)
 
553
AC_SUBST(CPUINCLUDES)
 
554
AC_SUBST(CPUSRCS)
 
555
AC_CONFIG_FILES([Makefile])
 
556
AC_OUTPUT
 
557
 
 
558
dnl Print summary.
 
559
echo
 
560
echo Basilisk II configuration summary:
 
561
echo
 
562
echo Use JIT compiler ....................... : $WANT_JIT
 
563
echo JIT debug mode ......................... : $WANT_JIT_DEBUG
 
564
echo Floating-Point emulation core .......... : $FPE_CORE
 
565
echo Assembly optimizations ................. : $ASM_OPTIMIZATIONS
 
566
echo Addressing mode ........................ : $ADDRESSING_MODE
 
567
echo GTK user interface ..................... : $WANT_GTK
 
568
echo
 
569
echo "Configuration done. Now type \"make\" (or \"gmake\")."