forked from polyml/polyml
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
623 lines (547 loc) · 22.8 KB
/
configure.ac
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
AC_INIT([Poly/ML],[5.9],[polyml AT polyml DOT org],[polyml])
AM_INIT_AUTOMAKE
AC_PREREQ([2.71])
# libtoolize recommends this line.
AC_CONFIG_MACRO_DIR([m4])
ac_debug_mode="no"
AC_ARG_ENABLE([debug],
[ --enable-debug Compiles without optimisation for debugging ],
[ac_debug_mode="yes"])
if test "$ac_debug_mode" != "yes"; then
# Default to maximum optimisation. -O2 is not good enough.
# Set CCASFLAGS to empty so that it doesn't get set to CFLAGS.
# The -g option on assembler causes problems on Sparc/Solaris 10.
# test X || Y is equivalent to if !X then Y
test "${CFLAGS+set}" = set || CFLAGS="-O3"
test "${CXXFLAGS+set}" = set || CXXFLAGS="-O3"
test "${CCASFLAGS+set}" = set || CCASFLAGS=""
else
test "${CFLAGS+set}" = set || CFLAGS="-g"
test "${CXXFLAGS+set}" = set || CXXFLAGS="-g"
test "${CCASFLAGS+set}" = set || CCASFLAGS=""
fi
AC_CANONICAL_HOST
# If the compiler defines _WIN32 we're building for native Windows otherwise we're
# building for something else.
AC_CHECK_DECL([_WIN32], [poly_native_windows=yes], [poly_native_windows=no])
# If we are building on cygwin or mingw we need to give the -no-defined flag to
# build a DLL. We also have to use Windows calling conventions rather than
# SysV on 64-bit.
poly_use_windowscc=no
poly_need_macosopt=no
case "${host_os}" in
darwin*)
AC_SUBST([OSFLAG], [-DMACOSX])
;;
sunos* | solaris*)
AC_SUBST([OSFLAG], [-DSOLARIS])
;;
*mingw* | *cygwin*)
poly_no_undefined=yes
poly_use_windowscc=yes
;;
esac
# libpolyml can be a DLL but libpolymain can't.
# Enable shared libraries by default. It complicates installation a bit if the
# the library is installed to a non-standard location but simplifies polyc.
LT_INIT([win32-dll])
AM_MAINTAINER_MODE
# Check we're in the right directory
AC_CONFIG_SRCDIR([polyexports.h])
AC_CONFIG_HEADERS([config.h])
# Checks for programs.
AC_PROG_CXX
# The following check was supposed to check that there was actually a
# C++ compiler but doesn't work properly if CXX is set by the user.
#AC_CHECK_PROG(check_cpp, $CXX, "yes", "no")
#if test "$check_cpp" != "yes"; then
# AC_MSG_ERROR([No C++ compiler found. Unable to build Poly/ML.])
#fi
AC_PROG_CC
AC_PROG_MAKE_SET
AC_PROG_CPP
AM_PROG_AS
# Activate large file mode if needed
AC_SYS_LARGEFILE
# Checks for libraries.
AC_CHECK_LIB(stdc++, main)
# These can sometimes be in the standard libraries
AC_SEARCH_LIBS([dlopen], [dl dld])
AC_SEARCH_LIBS([floor], [m])
## External names on Win64. They have no leading underscores as per
## the X64 ABI published by MS. Earlier versions of GCC (anything
## prior to 4.5.0) were faulty.
LT_SYS_SYMBOL_USCORE
if test x$sys_symbol_underscore = xyes; then
AC_DEFINE(SYMBOLS_REQUIRE_UNDERSCORE, [1], [Defined if external symbols are prefixed by underscores])
fi
# Check for headers
AC_FUNC_ALLOCA
AC_HEADER_DIRENT
m4_warn([obsolete],
[The preprocessor macro `STDC_HEADERS' is obsolete.
Except in unusual embedded environments, you can safely include all
ISO C90 headers unconditionally.])dnl
# Autoupdate added the next two lines to ensure that your configure
# script's behavior did not change. They are probably safe to remove.
AC_CHECK_INCLUDES_DEFAULT
AC_PROG_EGREP
AC_HEADER_SYS_WAIT
AC_CHECK_HEADERS([stdio.h time.h fcntl.h float.h limits.h locale.h malloc.h netdb.h netinet/in.h stddef.h])
AC_CHECK_HEADERS([stdlib.h string.h sys/file.h sys/ioctl.h sys/param.h sys/socket.h sys/systeminfo.h])
AC_CHECK_HEADERS([sys/time.h unistd.h values.h dlfcn.h signal.h ucontext.h])
AC_CHECK_HEADERS([assert.h ctype.h direct.h errno.h excpt.h fenv.h fpu_control.h grp.h])
AC_CHECK_HEADERS([ieeefp.h io.h math.h memory.h netinet/tcp.h arpa/inet.h poll.h pwd.h siginfo.h])
AC_CHECK_HEADERS([stdarg.h sys/errno.h sys/filio.h sys/mman.h sys/resource.h])
AC_CHECK_HEADERS([sys/sockio.h sys/stat.h termios.h sys/times.h])
AC_CHECK_HEADERS([sys/types.h sys/uio.h sys/un.h sys/utsname.h sys/select.h sys/sysctl.h])
AC_CHECK_HEADERS([sys/elf_SPARC.h sys/elf_386.h sys/elf_amd64.h asm/elf.h machine/reloc.h i386/elf_machdep.h])
AC_CHECK_HEADERS([mach-o/x86_64/reloc.h mach-o/arm64/reloc.h])
AC_CHECK_HEADERS([windows.h tchar.h semaphore.h])
AC_CHECK_HEADERS([stdint.h inttypes.h])
# Only check for the X headers if the user said --with-x.
if test "${with_x+set}" = set; then
AC_CHECK_HEADERS([X11/Xlib.h Xm/Xm.h])
fi
PKG_PROG_PKG_CONFIG
# Check for GMP
AC_ARG_WITH([gmp],
[AS_HELP_STRING([--with-gmp],
[use the GMP library for arbitrary precision arithmetic @<:@default=check@:>@])],
[],
[with_gmp=check])
# If we want GMP check that the library and headers are installed.
if test "x$with_gmp" != "xno"; then
AC_CHECK_LIB([gmp], [__gmpn_tdiv_qr],
[AC_DEFINE([HAVE_LIBGMP], [1],
[Define to 1 if you have libgmp])
[LIBS="-lgmp $LIBS"]
AC_CHECK_HEADER([gmp.h],
[AC_DEFINE([HAVE_GMP_H], [1],
[Define to 1 if you have the gmp.h header file])],
[if test "x$with_gmp" != "xcheck"; then
AC_MSG_FAILURE(
[--with-gmp was given, but gmp.h header file is not installed])
fi
])
],
[if test "x$with_gmp" != "xcheck"; then
AC_MSG_FAILURE(
[--with-gmp was given, but gmp library (version 4 or later) is not installed])
fi
])
fi
# Special configuration for Windows or Unix.
poly_windows_enablegui=false
if test "x$poly_native_windows" = xyes; then
# The next two are only used with mingw. We mustn't include ws2_32 in Cygwin64 because
# the "select" function gets used instead of Cygwin's own.
AC_CHECK_LIB(ws2_32, main)
AC_CHECK_LIB(gdi32, main)
CFLAGS="$CFLAGS -mthreads"
CXXFLAGS="$CXXFLAGS -mthreads"
AC_SUBST([OSFLAG], ["-DUNICODE -D_UNICODE -D_WIN32_WINNT=0x600"])
AC_CHECK_TOOL(WINDRES, windres)
# Enable/Disable the GUI in Windows.
AC_ARG_ENABLE([windows-gui],
[AS_HELP_STRING([--enable-windows-gui],
[create a GUI in Windows. If this is disabled use a Windows console. @<:@default=yes@:>@])],
[case "${enableval}" in
yes) poly_windows_enablegui=true ;;
no) poly_windows_enablegui=false ;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-windows-gui]) ;;
esac],
[poly_windows_enablegui=true])
else
# Unix or similar e.g. Cygwin. We need pthreads.
# On Android pthread_create is in the standard library
AC_SEARCH_LIBS([pthread_create], [pthread],
[AC_DEFINE([HAVE_LIBPTHREAD], [1],
[Define to 1 if you have the `pthread' library (-lpthread).])
AC_CHECK_HEADER([pthread.h],
[AC_DEFINE([HAVE_PTHREAD_H], [1],
[Define to 1 if you have the <pthread.h> header file.])],
[
AC_MSG_FAILURE([pthread.h header file is not installed])
])
],
[
AC_MSG_FAILURE([pthread library is not installed])
])
# Solaris needs -lsocket, -lnsl and -lrt
AC_SEARCH_LIBS([gethostbyname], [nsl])
AC_SEARCH_LIBS([getsockopt], [socket])
AC_SEARCH_LIBS([sem_wait], [rt])
# Check for X and Motif headers and libraries
AC_PATH_X
if test "x${with_x}" = "xyes"; then
AC_DEFINE([WITH_XWINDOWS], [1], [Define if the X-Windows interface should be built])
if test "$x_includes" != "" ; then
if test "$x_includes" != "NONE" ; then
CFLAGS="$CFLAGS -I$x_includes"
CXXFLAGS="$CXXFLAGS -I$x_includes"
CPPFLAGS="$CPPFLAGS -I$x_includes"
fi
fi
if test "$x_libraries" != "" ; then
if test "$x_libraries" != "NONE" ; then
LIBS="-L$x_libraries $LIBS"
fi
fi
AC_CHECK_LIB(X11, XCreateGC)
AC_CHECK_LIB(Xt, XtMalloc)
AC_CHECK_LIB(Xext, XextAddDisplay)
if test "$xm_includes" != "" ; then
if test "$xm_includes" != "NONE" ; then
CFLAGS="$CFLAGS -I$xm_includes"
CXXFLAGS="$CXXFLAGS -I$xm_includes"
CPPFLAGS="$CPPFLAGS -I$xm_includes"
fi
fi
if test "$xm_libraries" != "" ; then
if test "$xm_libraries" != "NONE" ; then
LIBS="-L$xm_libraries $LIBS"
fi
fi
AC_CHECK_LIB(Xm, XmGetDestination)
fi
# TODO: May need AC_PATH_XTRA for Solaris
fi
# End of Windows/Unix configuration.
# Find out which type of object code exporter to use.
# If we have winnt use PECOFF. This really only applies to cygwin here.
# If we have elf.h use ELF.
# If we have mach-o/reloc.h use Mach-O
# Otherwise use the C source code exporter.
AC_CHECK_TYPES([IMAGE_FILE_HEADER],
[AC_DEFINE([HAVE_PECOFF], [], [Define to 1 if you have the PE/COFF types.])]
[polyexport=pecoff],
[AC_CHECK_HEADER([elf.h],
[AC_DEFINE([HAVE_ELF_H], [], [Define to 1 if you have the <elf.h> header file.])]
[polyexport=elf],
[AC_CHECK_HEADER([mach-o/reloc.h],
[AC_DEFINE([HAVE_MACH_O_RELOC_H], [], [Define to 1 if you have the <mach-o/reloc.h> header file.])]
[polyexport=macho],
[AC_CHECK_HEADERS([elf_abi.h machine/reloc.h],
[AC_DEFINE([HAVE_ELF_ABI_H], [], [Define to 1 if you have <elf_abi.h> and <machine/reloc.h> header files.])]
[polyexport=elf] )]
)]
)],
[#include <windows.h>]
)
AM_CONDITIONAL([EXPPECOFF], [test "$polyexport" = pecoff])
AM_CONDITIONAL([EXPELF], [test "$polyexport" = elf])
AM_CONDITIONAL([EXPMACHO], [test "$polyexport" = macho])
# Checks for typedefs, structures, and compiler characteristics.
AC_HEADER_STDBOOL
AC_C_CONST
AC_TYPE_INT16_T
AC_TYPE_UINT16_T
AC_TYPE_INT32_T
AC_TYPE_UINT32_T
AC_TYPE_INT64_T
AC_TYPE_UINT64_T
AC_TYPE_INTPTR_T
AC_TYPE_UINTPTR_T
AC_TYPE_UID_T
AC_TYPE_MODE_T
AC_TYPE_OFF_T
AC_TYPE_PID_T
AC_TYPE_SIZE_T
AC_TYPE_SSIZE_T
m4_warn([obsolete],
[Update your code to rely only on HAVE_SYS_TIME_H,
then remove this warning and the obsolete code below it.
All current systems provide time.h; it need not be checked for.
Not all systems provide sys/time.h, but those that do, all allow
you to include it and time.h simultaneously.])dnl
AC_CHECK_HEADERS_ONCE([sys/time.h])
# Obsolete code to be removed.
if test $ac_cv_header_sys_time_h = yes; then
AC_DEFINE([TIME_WITH_SYS_TIME],[1],[Define to 1 if you can safely include both <sys/time.h>
and <time.h>. This macro is obsolete.])
fi
# End of obsolete code.
AC_STRUCT_TM
# Check for the various sub-second fields of the stat structure.
AC_CHECK_MEMBERS([struct stat.st_atim, struct stat.st_atimespec,
struct stat.st_atimensec, struct stat.st_atime_n, struct stat.st_uatime])
# Mac OS X, at any rate, needs signal.h to be included first.
AC_CHECK_TYPES([ucontext_t], , , [#include "signal.h"
#include "ucontext.h"])
AC_CHECK_TYPES([struct sigcontext, stack_t, sighandler_t, sig_t], , ,[#include "signal.h"])
AC_CHECK_TYPES([socklen_t],,,[#include "sys/types.h"
#include "sys/socket.h"])
AC_CHECK_TYPES([SYSTEM_LOGICAL_PROCESSOR_INFORMATION],,,[#include "windows.h"])
AC_CHECK_TYPES(long long)
AC_CHECK_TYPES(ssize_t)
AC_CHECK_TYPES([ptrdiff_t], [],
[AC_DEFINE_UNQUOTED([ptrdiff_t], [int],
[Define to `int' if <sys/types.h> does not define.])])
AC_CHECK_SIZEOF(void*)
AC_CHECK_SIZEOF(long)
AC_CHECK_SIZEOF(int)
AC_CHECK_SIZEOF(long long)
AC_CHECK_SIZEOF(double)
AC_CHECK_SIZEOF(float)
AC_C_BIGENDIAN
# Checks for library functions.
AC_FUNC_ERROR_AT_LINE
AC_FUNC_GETGROUPS
AC_FUNC_GETPGRP
AC_PROG_GCC_TRADITIONAL
AC_FUNC_SELECT_ARGTYPES
AC_FUNC_STAT
AC_FUNC_STRTOD
AC_CHECK_FUNCS([dlopen strtod dtoa getpagesize sigaltstack mmap mkstemp])
## There does not seem to be a declaration for fpsetmask in mingw64.
AC_CHECK_DECLS([fpsetmask], [], [], [[#include <ieeefp.h>]])
AC_CHECK_FUNCS([sysctl sysctlbyname])
AC_CHECK_FUNCS([localtime_r gmtime_r])
AC_CHECK_FUNCS([ctermid tcdrain])
AC_CHECK_FUNCS([_ftelli64])
AC_CHECK_FUNCS([pthread_jit_write_protect_np])
# Where are the registers when we get a signal? Used in time profiling.
#Linux:
AC_CHECK_MEMBERS([mcontext_t.gregs, mcontext_t.regs, mcontext_t.mc_esp],,,[#include "ucontext.h"])
#Mac OS X:
AC_CHECK_MEMBERS([struct mcontext.ss, struct __darwin_mcontext.ss, struct __darwin_mcontext.__ss,
struct __darwin_mcontext32.ss, struct __darwin_mcontext32.__ss,
struct __darwin_mcontext64.ss, struct __darwin_mcontext64.__ss],,,
[#include "signal.h"
#include "ucontext.h"])
# FreeBSD includes a sun_len member in struct sockaddr_un
AC_CHECK_MEMBERS([struct sockaddr_un.sun_len],,,
[#include <sys/un.h>])
# This option enables the native code generator. More precisely it allows
# the byte code interpreter to be built on X86.
AC_ARG_ENABLE([native-codegeneration],
[AS_HELP_STRING([--disable-native-codegeneration],
[disable the native code generator and use the slow byte code interpreter instead.])],
[case "${enableval}" in
no) with_portable=yes ;;
yes) with_portable=no ;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-native-codegeneration]) ;;
esac],
[with_portable=check])
# Check which CPU we're building for. Can we use a native pre-built compiler
# or do we need to fall back to the interpreter? Most of these settings are to tweak
# the ELF exporter.
case "${host_cpu}" in
i[[3456]]86*)
AC_DEFINE([HOSTARCHITECTURE_X86], [1], [Define if the host is an X86 (32-bit)])
polyarch=i386
;;
x86_64* | amd64*)
if test X"$ac_cv_sizeof_voidp" = X8; then
AC_DEFINE([HOSTARCHITECTURE_X86_64], [1], [Define if the host is an X86 (64-bit)])
polyarch=x86_64
else
AC_DEFINE([HOSTARCHITECTURE_X32], [1], [Define if the host is an X86 (32-bit ABI, 64-bit processor)])
polyarch=interpret
fi
;;
aarch64* | arm*)
# MacOS seems to return "arm" on 64-bit ARM.
if test X"$ac_cv_sizeof_voidp" = X8; then
AC_DEFINE([HOSTARCHITECTURE_AARCH64], [1], [Define if the host is an ARM (64-bit)])
polyarch=aarch64
else
AC_DEFINE([HOSTARCHITECTURE_ARM], [1], [Define if the host is an ARM (32-bit)])
polyarch=interpret
fi
;;
sparc64*)
AC_DEFINE([HOSTARCHITECTURE_SPARC64], [1], [Define if the host is a Sparc (64-bit)])
polyarch=interpret
;;
sparc*)
AC_DEFINE([HOSTARCHITECTURE_SPARC], [1], [Define if the host is a Sparc (32-bit)])
polyarch=interpret
;;
powerpc64* | ppc64*)
AC_DEFINE([HOSTARCHITECTURE_PPC64], [1], [Define if the host is a PowerPC (64-bit)])
polyarch=interpret
;;
power* | ppc*)
AC_DEFINE([HOSTARCHITECTURE_PPC], [1], [Define if the host is a PowerPC (32-bit)])
polyarch=interpret
;;
hppa*)
AC_DEFINE([HOSTARCHITECTURE_HPPA], [1], [Define if the host is an HP PA-RISC (32-bit)])
polyarch=interpret
;;
ia64*)
AC_DEFINE([HOSTARCHITECTURE_IA64], [1], [Define if the host is an Itanium])
polyarch=interpret
;;
m68k*)
AC_DEFINE([HOSTARCHITECTURE_M68K], [1], [Define if the host is a Motorola 68000])
polyarch=interpret
;;
mips64*)
AC_DEFINE([HOSTARCHITECTURE_MIPS64], [1], [Define if the host is a MIPS (64-bit)])
polyarch=interpret
;;
mips*)
AC_DEFINE([HOSTARCHITECTURE_MIPS], [1], [Define if the host is a MIPS (32-bit)])
polyarch=interpret
;;
s390x*)
AC_DEFINE([HOSTARCHITECTURE_S390X], [1], [Define if the host is an S/390 (64-bit)])
polyarch=interpret
;;
s390*)
AC_DEFINE([HOSTARCHITECTURE_S390], [1], [Define if the host is an S/390 (32-bit)])
polyarch=interpret
;;
sh*)
AC_DEFINE([HOSTARCHITECTURE_SH], [1], [Define if the host is a SuperH (32-bit)])
polyarch=interpret
;;
alpha*)
AC_DEFINE([HOSTARCHITECTURE_ALPHA], [1], [Define if the host is an Alpha (64-bit)])
polyarch=interpret
# GCC defaults to non-conforming floating-point, and does not respect the rounding mode
# in the floating-point control register, so we force it to conform to IEEE and use the
# dynamic suffix on the floating-point instructions it produces.
CFLAGS="$CFLAGS -mieee -mfp-rounding-mode=d"
CXXFLAGS="$CXXFLAGS -mieee -mfp-rounding-mode=d"
;;
riscv32)
AC_DEFINE([HOSTARCHITECTURE_RISCV32], [1], [Define if the host is a RISC-V (32-bit)])
polyarch=interpret
;;
riscv64)
AC_DEFINE([HOSTARCHITECTURE_RISCV64], [1], [Define if the host is a RISC-V (64-bit)])
polyarch=interpret
;;
loongarch32)
AC_DEFINE([HOSTARCHITECTURE_LOONGARCH32], [1], [Define if the host is a LoongArch (32-bit)])
polyarch=interpret
;;
loongarch64)
AC_DEFINE([HOSTARCHITECTURE_LOONGARCH64], [1], [Define if the host is a LoongArch (64-bit)])
polyarch=interpret
;;
*) AC_MSG_ERROR([Poly/ML is not supported for this architecture]) ;;
esac
# If we explicitly asked to use the interpreter set the architecture to interpreted.
if test "x$with_portable" = "xyes" ; then
if test "x$polyarch" != "xinterpret" ; then
AC_MSG_WARN(
[*******You have disabled native code generation. Are you really sure you want to do that?*******])
fi
polyarch=interpret
fi
# If we asked not to use the interpreter check we have native code support.
if test "x$with_portable" = "xno" ; then
if test "x$polyarch" = "xinterpret" ; then
AC_MSG_ERROR(
[--enable-native-codegeneration was given but native code is not supported on this platform])
fi
fi
# Check for libffi only if we're building the interpreted version
if test "x$polyarch" = "xinterpret" ; then
AC_CHECK_LIB([ffi], [ffi_prep_closure_loc])
AC_CHECK_HEADERS([ffi.h])
fi
if test X"$ac_cv_sizeof_voidp" = X8 ; then
bootstrap64="yes"
else
bootstrap64="no"
fi
# Build 32-bit in 64-bits. This is only allowed when building on native 64-bit X86.
AC_ARG_ENABLE([compact32bit],
[AS_HELP_STRING([--enable-compact32bit],
[use 32-bit values rather than native 64-bits.])])
if test "x$enable_compact32bit" = "xyes"; then
if test X"$ac_cv_sizeof_voidp" = X8 ; then
AC_DEFINE([POLYML32IN64], [1], [Define if this should use 32-bit values in 64-bit architectures])
bootstrap64="no"
else
AC_MSG_ERROR([--enable-compact32bit is only available on a 64-bit architecture])
fi
fi
# Put this test at the end where it's less likely to be missed.
# If we're compiling on Cygwin (and mingw?) and /usr/bin/file is not present
# the link step will produce some strange warning messages of the form:
# "Warning: linker path does not have real file for library -lXXX". I think
# that's really a bug in autoconf but to explain what's happening to the user
# add a test here.
if test "$lt_cv_file_magic_cmd" = "func_win32_libid";
then
if test \! -x /usr/bin/file;
then
echo ""
echo "*** Warning: You are building Poly/ML on Cygwin/Mingw but '/usr/bin/file' cannot be found."
echo "*** You can still go ahead and build Poly/ML but libpolyml will not be built as a"
echo "*** shared library and you may get strange warning messages from the linker step."
echo "*** Install the 'file' package to correct this problem."
echo ""
fi
fi
AM_CONDITIONAL([ARCHI386], [test "$polyarch" = i386])
AM_CONDITIONAL([ARCHX86_64], [test "$polyarch" = x86_64])
AM_CONDITIONAL([ARCHARM_64], [test "$polyarch" = aarch64])
AM_CONDITIONAL([ARCHINTERPRET], [test "$polyarch" = interpret])
# Are we bootstrapping from the 32-bit or 64-bit pre-built compiler?
AM_CONDITIONAL([BOOT64], [test "$bootstrap64" = yes])
# If we are targeting Windows rather than *nix we need the pre=built compiler with Windows conventions.
AM_CONDITIONAL([WINDOWSCALLCONV], [test "$poly_use_windowscc" = yes])
# This is true if we are building for native Windows rather than Cygwin
AM_CONDITIONAL([NATIVE_WINDOWS], [test "$poly_native_windows" = yes])
AM_CONDITIONAL([NO_UNDEFINED], [test "$poly_no_undefined" = yes])
AM_CONDITIONAL([WINDOWSGUI], [test x$poly_windows_enablegui = xtrue])
# If we're building only the static version of libpolyml
# then polyc and polyml.pc have to include the dependent libraries.
dependentlibs=""
if test "${enable_shared}" != yes; then
dependentlibs=${LIBS}
fi
AC_SUBST([dependentlibs], ["$dependentlibs"])
# Test whether this is a git directory and set the version if possible
AC_CHECK_PROG([gitinstalled], [git], [yes], [no])
if test X"$gitinstalled" = "Xyes" -a -d ".git"; then
GIT_VERSION='-DGIT_VERSION=\"$(shell git describe --tags --always)\"'
AC_SUBST(GIT_VERSION)
fi
# Strip -fdebug-prefix-map= from CFLAGS; it's meaningless for users of polyc,
# and hurts reproducibility.
polyc_CFLAGS=
for cflag in $CFLAGS; do
cflag="${cflag##-fdebug-prefix-map=*}"
if test -n "$cflag"; then
if test -n "$polyc_CFLAGS"; then
polyc_CFLAGS="$polyc_CFLAGS $cflag"
else
polyc_CFLAGS="$cflag"
fi
fi
done
AC_SUBST([polyc_CFLAGS], ["$polyc_CFLAGS"])
# Modules directory
AC_ARG_WITH([moduledir],
[AS_HELP_STRING([--with-moduledir=DIR], [directory for Poly/ML modules])],
[moduledir=$withval],
[moduledir="\${libdir}/polyml/modules"])
AC_SUBST([moduledir], [$moduledir])
# Control whether to build the basis library with arbitrary precision as the default int
AC_ARG_ENABLE([intinf-as-int],
[AS_HELP_STRING([--enable-intinf-as-int], [set arbitrary precision as the default int type])],
[case "${enableval}" in
no) intisintinf=no ;;
yes) intisintinf=yes ;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-intinf-as-int]) ;;
esac],
[intisintinf=no])
AM_CONDITIONAL([INTINFISINT], [test "$intisintinf" = "yes"])
# These are needed for building in a separate build directory, as they are
# referenced from exportPoly.sml.
AC_CONFIG_COMMANDS([basis], [test -e basis || ln -sf ${ac_top_srcdir}/basis .])
AC_CONFIG_COMMANDS([mlsource], [test -e mlsource || ln -sf ${ac_top_srcdir}/mlsource .])
AC_CONFIG_FILES([Makefile libpolyml/Makefile libpolyml/polyml.pc libpolymain/Makefile modules/Makefile modules/IntInfAsInt/Makefile])
AC_CONFIG_FILES([polyc], [chmod +x polyc])
AC_OUTPUT