forked from mono/mono
-
Notifications
You must be signed in to change notification settings - Fork 516
/
configure.ac
7283 lines (6481 loc) · 230 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
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# Process this file with autoconf to produce a configure script.
#AC_PREREQ([2.62])
# This line is parsed by tools besides autoconf, such as msvc/mono.winconfig.targets.
# It should remain in the format they expect.
#
AC_INIT(mono, [6.13.0],
[https://github.com/mono/mono/issues/new])
AC_CONFIG_SRCDIR([Makefile.am])
AC_CONFIG_MACRO_DIR([m4])
AC_CANONICAL_SYSTEM
AC_CANONICAL_HOST
# Gross hack to enable 'make dist' on automake 1.9+tar 1.14.
# The extra brackets are to foil regex-based scans.
m4_ifdef([_A][M_PROG_TAR],[_A][M_SET_OPTION([tar-ustar])])
AM_INIT_AUTOMAKE([1.9 dist-xz tar-ustar no-dist-gzip foreign subdir-objects]
m4_esyscmd([case `automake --version | head -n 1` in # parallel-tests is default in automake 1.13+, we need to explicitly enable it
*1.11*|*1.12*) echo parallel-tests;; # for 1.11 and 1.12 but not below as those versions don't recognize the flag
esac])) # TODO: remove this hack once we require automake 1.11+
AC_CONFIG_HEADERS([config.h])
AM_MAINTAINER_MODE
m4_ifdef([AM_EXTRA_RECURSIVE_TARGETS], AM_EXTRA_RECURSIVE_TARGETS([test]))
m4_ifdef([AM_EXTRA_RECURSIVE_TARGETS], AM_EXTRA_RECURSIVE_TARGETS([test-bundle]))
API_VER=2.0
AC_SUBST(API_VER)
AC_PROG_LN_S
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
MONO_VERSION_MAJOR=`echo $VERSION | cut -d . -f 1`
MONO_VERSION_MINOR=`echo $VERSION | cut -d . -f 2`
MONO_VERSION_BUILD=`echo $VERSION | cut -d . -f 3`
#
# This is the version of the corlib-runtime interface. When
# making changes to this interface (by changing the layout
# of classes the runtime knows about, changing icall signature or
# semantics etc), change this variable.
#
# This must be unique relative to corlib interface and semantics.
#
# If you change corlib such that a runtime change is required, or
# vice versa, change this string. Examples include removing icalls,
# adding icalls, changing icall signatures, and changing type layouts
# that both sides know.
#
# It is an arbitrary string and should be parsed as such.
# A guid works and is encouraged.
#
# Generate it with uuidgen. For example:
# perl -pi.bak -e "s/^MONO_CORLIB_VERSION=\S+/MONO_CORLIB_VERSION=`uuidgen`/" configure.ac
#
# There is no ordering of corlib versions, no old or new,
# an exact match is required between corlib and runtime.
#
# This line is parsed by tools besides autoconf, such as msvc/mono.winconfig.targets.
# It should remain in the format they expect.
#
MONO_CORLIB_VERSION=1A5E0066-58DC-428A-B21C-0AD6CDAE2789
#
# Put a quoted #define in config.h.
# Substitute @MONO_CORLIB_VERSION@ unquoted.
#
AC_DEFINE_UNQUOTED(MONO_CORLIB_VERSION,"$MONO_CORLIB_VERSION",[Version of the corlib-runtime interface])
AC_SUBST(MONO_CORLIB_VERSION)
case $host_os in
*cygwin* )
echo "Run configure using ./configure --host=i686-w64-mingw32 or --host=x86_64-w64-mingw32"
exit 1
esac
# In case of cygwin, override LN_S, irrespective of what it determines.
# The build uses cygwin, but the actual runtime doesn't.
case $host_os in
*cygwin* ) LN_S='cp -p';;
esac
#
# libgc defaults
#
libgc_configure_args=
# These variables are the CPPFLAGS/CFLAGS passed to libgc's configure
# libgc should inherit the original CFLAGS/CPPFLAGS passed to configure, i.e. -O0
CPPFLAGS_FOR_LIBGC=$CPPFLAGS
CFLAGS_FOR_LIBGC=$CFLAGS
CPPFLAGS_FOR_BTLS=$CPPFLAGS
CFLAGS_FOR_BTLS=$CFLAGS
# libgc uses some deprecated APIs
CFLAGS_FOR_LIBGC="$CFLAGS -Wno-deprecated-declarations"
#
# These are the flags that need to be stored in the mono.pc file for
# compiling code that will embed Mono
#
libmono_cflags=""
libmono_ldflags=""
AC_SUBST(libmono_cflags)
AC_SUBST(libmono_ldflags)
# Variable to have relocatable .pc files (lib, or lib64)
# realpath isn't always available, and requires that all but the tip of the provided
# path exists. Fall back to the old behaviour, but realpath allows depth >1
# e.g. Debian puts Mono in /usr/bin and libs in /usr/lib/x86_64-linux-gnu/ which is
# too deep for the old method to work
reloc_libdir=`realpath --relative-to=${prefix} ${libdir} 2> /dev/null || basename ${libdir}`
AC_SUBST(reloc_libdir)
# Set to yes if Unix sockets cannot be created in an anonymous namespace
need_link_unlink=no
#Set to extra linker flags to be passed to the runtime binaries (mono /mono-sgen)
extra_runtime_ldflags=""
# Thread configuration inspired by sleepycat's db
AC_MSG_CHECKING([host platform characteristics])
libgc_threads=no
has_dtrace=no
parallel_mark=yes
ikvm_native=yes
host_win32=no
target_win32=no
target_wasm=no
platform_android=no
platform_tizen=no
platform_ios=no
host_darwin=no
host_linux=no
build_darwin=no
host_sunos=no
case "$host" in
wasm32*)
CFLAGS="$CFLAGS -D_REENTRANT -D_GNU_SOURCE -s WASM=1"
CPPFLAGS="$CPPFLAGS -D_REENTRANT -DUSE_MMAP -s WASM=1"
libgc_threads=pthreads
host_wasm=yes
# FIXME:
RID="osx-x64"
COREARCH="wasm32"
CORETARGETS="-p:TargetsUnix=true -p:TargetsOSX=true"
build_darwin=yes
;;
*-mingw*|*-*-cygwin*)
AC_DEFINE(DISABLE_PORTABILITY,1,[Disable the io-portability layer])
AC_DEFINE(HOST_NO_SYMLINKS,1,[This platform does not support symlinks])
host_win32=yes
mono_cv_clang=no
if test "x$cross_compiling" = "xno"; then
if test "x$host" = "x$build" -a "x$host" = "x$target"; then
target_win32=yes
fi
else
if test "x$host" = "x$target"; then
target_win32=yes
fi
fi
HOST_CC="gcc"
RID="win-x86"
CORETARGETS="-p:TargetsWindows=true"
COREARCH="x86"
# Boehm not supported on 64-bit Windows.
case "$host" in
x86_64-*-* | amd64-*-*)
with_gc=sgen
RID="win-x64"
COREARCH="x64"
;;
esac
# Windows 7 or later is required
WIN32_CPPFLAGS="-DWINVER=0x0601 -D_WIN32_WINNT=0x0601 -D_WIN32_IE=0x0501 -D_UNICODE -DUNICODE -DWIN32_THREADS -DFD_SETSIZE=1024"
CPPFLAGS="$CPPFLAGS $WIN32_CPPFLAGS"
WIN32_LDFLAGS="-lbcrypt -lmswsock -lws2_32 -lole32 -loleaut32 -lpsapi -lversion -ladvapi32 -lwinmm -lkernel32 -liphlpapi -static-libgcc"
LDFLAGS="$LDFLAGS $WIN32_LDFLAGS"
libmono_cflags="-mms-bitfields -mwindows"
libmono_ldflags="-mms-bitfields -mwindows"
libgc_threads=win32
with_sigaltstack=no
with_tls=pthread
with_sgen_default_concurrent=yes
LN_S=cp
;;
*-*-*netbsd*)
CPPFLAGS="$CPPFLAGS -D_REENTRANT -DGC_NETBSD_THREADS -D_GNU_SOURCE"
libmono_cflags="-D_REENTRANT"
LDFLAGS="$LDFLAGS -pthread"
CPPFLAGS="$CPPFLAGS -DHOST_BSD"
libmono_ldflags="-pthread"
need_link_unlink=yes
libgc_threads=pthreads
with_sigaltstack=no
use_sigposix=yes
with_sgen_default_concurrent=yes
;;
*-*-kfreebsd*-gnu)
CPPFLAGS="$CPPFLAGS -DGC_FREEBSD_THREADS -D_GNU_SOURCE -D_REENTRANT -DUSE_MMAP -DUSE_MUNMAP -DTHREAD_LOCAL_ALLOC -pthread"
libmono_cflags="-D_REENTRANT -DTHREAD_LOCAL_ALLOC -pthread"
libmono_ldflags="-lpthread -pthread"
libgc_threads=pthreads
need_link_unlink=yes
with_sigaltstack=no
use_sigposix=yes
with_sgen_default_concurrent=yes
;;
*-*-*freebsd*)
dnl For close_my_fds
LDFLAGS="$LDFLAGS -lutil"
if test "x$PTHREAD_CFLAGS" = "x"; then
CPPFLAGS="$CPPFLAGS -DGC_FREEBSD_THREADS"
libmono_cflags=
else
CPPFLAGS="$CPPFLAGS $PTHREAD_CFLAGS -DGC_FREEBSD_THREADS"
libmono_cflags="$PTHREAD_CFLAGS"
fi
if test "x$PTHREAD_LIBS" = "x"; then
LDFLAGS="$LDFLAGS -pthread -L/usr/local/lib"
libmono_ldflags="-pthread"
else
LDFLAGS="$LDFLAGS $PTHREAD_LIBS -L/usr/local/lib"
libmono_ldflags="$PTHREAD_LIBS"
fi
CPPFLAGS="$CPPFLAGS -DHOST_BSD -D_WITH_GETLINE"
need_link_unlink=yes
AC_DEFINE(PTHREAD_POINTER_ID, 1, [pthread is a pointer])
libgc_threads=pthreads
use_sigposix=yes
has_dtrace=yes
case "$host" in
aarch64-*)
support_boehm=no
with_gc=sgen
;;
riscv*)
support_boehm=no
with_gc=sgen
;;
esac
with_sgen_default_concurrent=yes
;;
*-*-*openbsd*)
CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE -DGC_OPENBSD_THREADS -DHOST_BSD -D_REENTRANT -DUSE_MMAP"
LDFLAGS="${LDFLAGS} -Wl,-zwxneeded"
if test "x$disable_munmap" != "xyes"; then
CPPFLAGS="$CPPFLAGS -DUSE_MUNMAP"
fi
libmono_cflags="-D_THREAD_SAFE -D_REENTRANT"
LDFLAGS="$LDFLAGS -pthread"
need_link_unlink=yes
AC_DEFINE(PTHREAD_POINTER_ID)
libgc_threads=pthreads
with_tls=pthread
with_sigaltstack=no
use_sigposix=yes
with_sgen_default_concurrent=yes
;;
*-*-linux-android*)
platform_android=yes
AC_DEFINE(HOST_ANDROID,1,[Targeting the Android platform])
AC_DEFINE(TARGET_ANDROID,1,[Targeting the Android platform])
CPPFLAGS="$CPPFLAGS -DGC_LINUX_THREADS -D_GNU_SOURCE -D_REENTRANT -DUSE_MMAP"
if test "x$disable_munmap" != "xyes"; then
CPPFLAGS="$CPPFLAGS -DUSE_MUNMAP"
fi
libmono_cflags="-D_REENTRANT"
libgc_threads=pthreads
use_sigposix=yes
with_tls=pthread
with_sigaltstack=no
with_static_mono=no
# isinf(3) requires -lm
LDFLAGS="$LDFLAGS -lm"
# Bionic's <pthread.h> sets PTHREAD_STACK_MIN=2*PAGE_SIZE; doesn't define
# PAGE_SIZE; breaks mono/io-layer/collection.c
# Bionic doesn't provide S_IWRITE; breaks io-layer/io.c
CFLAGS="$CFLAGS -DPAGE_SIZE=4096 -DS_IWRITE=S_IWUSR"
CXXFLAGS="$CXXFLAGS -DPAGE_SIZE=4096 -DS_IWRITE=S_IWUSR"
# FIXME? Only if __ANDROID_API__ < 24?
# FILE32API means "long", which is stuck at 32bits for 32bit ABI (64bits for 64bit ABI).
# ABI 24 introduces the "o" for "file offset" variations, which can be widened to 64bits for 32bit ABI (and still 64bits for 64bit).
# Android itself uses FILE32API, and mono should use system zlib on Android anyway.
ZLIB_CFLAGS="$ZLIB_CFLAGS -DUSE_FILE32API"
# to bypass the underscore linker check, can't work when cross-compiling
mono_cv_uscore=yes
mono_cv_clang=no
;;
*-*-linux*)
host_linux=yes
CPPFLAGS="$CPPFLAGS -DGC_LINUX_THREADS -D_GNU_SOURCE -D_REENTRANT -DUSE_MMAP"
if test "x$disable_munmap" != "xyes"; then
CPPFLAGS="$CPPFLAGS -DUSE_MUNMAP"
fi
libmono_cflags="-D_REENTRANT"
libgc_threads=pthreads
CORETARGETS="-p:TargetsUnix=true"
use_sigposix=yes
if test "x$cross_compiling" != "xno"; then
# to bypass the underscore linker check, not
# available during cross-compilation
mono_cv_uscore=no
fi
case "$host" in
*-musl)
AC_DEFINE(MUSL, 1, [musl libc])
;;
esac
case "$host" in
*-tizen-linux-*)
platform_tizen=yes
;;
esac
case "$host" in
ppc64-*)
RID="linux-ppc64"
;;
ppc64le-*)
RID="linux-ppc64el"
;;
mipsel-*)
RID="linux-mipsel"
;;
x86-*)
RID="linux-x86"
COREARCH="x86"
;;
x86_64-*)
RID="linux-x64"
COREARCH="x64"
;;
arm-*)
# deal with this in the FPU detection section, since
# we cannot determine FPU from triplet and don't want
# to duplicate the logic
;;
aarch64-*)
support_boehm=no
with_gc=sgen
RID="linux-arm64"
COREARCH="arm64"
;;
powerpc*-*-linux*)
# https://bugzilla.novell.com/show_bug.cgi?id=504411
disable_munmap=yes
;;
powerpc*-*-freebsd*)
# https://bugzilla.novell.com/show_bug.cgi?id=504411
disable_munmap=yes
;;
riscv*)
support_boehm=no
with_gc=sgen
;;
esac
with_sgen_default_concurrent=yes
;;
*-*-nacl*)
echo "nacl no longer supported."
exit 1
;;
*-*-hpux*)
CPPFLAGS="$CPPFLAGS -DGC_HPUX_THREADS -D_HPUX_SOURCE -D_XOPEN_SOURCE_EXTENDED -D_REENTRANT"
# +ESdbgasm only valid on bundled cc on RISC
# silently ignored for ia64
if test $GCC != "yes"; then
CFLAGS="$CFLAGS +ESdbgasm"
# Arrange for run-time dereferencing of null
# pointers to produce a SIGSEGV signal.
LDFLAGS="$LDFLAGS -z"
fi
CFLAGS="$CFLAGS +ESdbgasm"
LDFLAGS="$LDFLAGS -z"
libmono_cflags="-D_REENTRANT"
libmono_ldflags="-lpthread"
libgc_threads=pthreads
need_link_unlink=yes
use_sigposix=yes
;;
*-*-solaris*)
CPPFLAGS="$CPPFLAGS -DGC_SOLARIS_THREADS -DGC_SOLARIS_PTHREADS -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS -DUSE_MMAP -DUSE_MUNMAP -DHOST_SOLARIS -D__EXTENSIONS__ -D_XPG4_2"
need_link_unlink=yes
libmono_cflags="-D_REENTRANT"
libgc_threads=pthreads
has_dtrace=yes
use_sigposix=yes
enable_solaris_tar_check=yes
host_sunos=yes
;;
*-*-darwin*)
parallel_mark="Disabled_Currently_Hangs_On_MacOSX"
host_darwin=yes
target_mach=yes
CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE -DGC_MACOSX_THREADS -DUSE_MMAP -DUSE_MUNMAP"
libmono_cflags="-D_THREAD_SAFE"
need_link_unlink=yes
AC_DEFINE(PTHREAD_POINTER_ID)
AC_DEFINE(USE_MACH_SEMA, 1, [...])
CORETARGETS="-p:TargetsUnix=true -p:TargetsOSX=true"
libgc_threads=pthreads
has_dtrace=yes
if test "x$cross_compiling" = "xyes"; then
has_broken_apple_cpp=yes
fi
dnl Snow Leopard is horribly broken -- it reports itself as i386-apple-darwin*, but
dnl its gcc defaults to 64-bit mode. They have also deprecated the usage of ucontext
dnl we need to set some flags to build our 32-bit binaries on 10.6 properly
case "$host" in
dnl Snow Leopard and newer config.guess reports as this
i*86-*-darwin*)
BROKEN_DARWIN_FLAGS="-arch i386"
BROKEN_DARWIN_CPPFLAGS=""
CPPFLAGS="$CPPFLAGS $BROKEN_DARWIN_CPPFLAGS"
CFLAGS="$CFLAGS $BROKEN_DARWIN_FLAGS"
CXXFLAGS="$CXXFLAGS $BROKEN_DARWIN_FLAGS"
CCASFLAGS="$CCASFLAGS $BROKEN_DARWIN_FLAGS"
CPPFLAGS_FOR_LIBGC="$CPPFLAGS_FOR_LIBGC $BROKEN_DARWIN_CPPFLAGS"
CFLAGS_FOR_LIBGC="$CFLAGS_FOR_LIBGC $BROKEN_DARWIN_FLAGS"
with_sgen_default_concurrent=yes
RID="osx-x86"
COREARCH="x86"
;;
x*64-*-darwin*)
with_sgen_default_concurrent=yes
RID="osx-x64"
COREARCH="x64"
;;
arm*-darwin*)
platform_ios=yes
has_dtrace=no
;;
aarch64*-darwin20*)
# OSX/arm64
support_boehm=no
;;
aarch64*-darwin*)
platform_ios=yes
;;
esac
;;
*-*-haiku*)
dnl BSD_SOURCE is for getifaddrs
CPPFLAGS="$CPPFLAGS -D_BSD_SOURCE -D_REENTRANT -D_THREAD_SAFE"
libmono_cflags="-D_REENTRANT -D_THREAD_SAFE"
LIBS="$LIBS -lnetwork -ltextencoding"
need_link_unlink=yes
AC_DEFINE(PTHREAD_POINTER_ID)
dnl Haiku does not support static TLS with __thread
with_tls=pthread
libgc_threads=pthreads
use_sigposix=yes
with_sigaltstack=no
;;
*-*-fuchsia*)
AC_DEFINE(DISABLE_PORTABILITY,1,[Disable the io-portability layer])
AC_DEFINE(HOST_FUCHSIA,1,[Targeting the Fuchsia platform])
fuchsia=true
with_tls=pthread
with_sigaltstack=yes
with_static_mono=no
support_boehm=no
with_gc=sgen
mono_cv_uscore=yes
mono_cv_clang=no
;;
*-*-aix*|*-*-os400*)
AC_DEFINE(HOST_AIX,1,[Targeting the AIX and PASE platforms])
host_aix=yes
dnl IMPORTANT: For svr4 sonames on AIX, you should set
dnl `OBJECT_MODE=64` when configuring.
dnl libtool cannot generate functioning svr4 sonames on
dnl 64-bit without it.
dnl Unfortunately, everything is complicated by the fact that
dnl gcc doesn't respect this variable. (otherwise we could set
dnl it for build time for configure and make)
dnl On IBM i PASE using IBM's packages, GCC *does* respect this
dnl variable, and builds are 64-bit by default. svr4 sonames
dnl must still be specified when configuring on i, however.
dnl As such, because Mono doesn't support 32-bit AIX or PASE,
dnl set up a 64-bit build (assming GCC; XLC not supported)
dnl regardless of what variable is used.
case $host_os in
aix*)
if test "x$OBJECT_MODE" = "x64" && test "x$CC" = "x" && test "x$CXX" = "x"; then
dnl HACK: Set -maix64 at the GCC invocation
dnl level explicitly to work around the fact
dnl GCC in default maix32 mode explodes when
dnl binutils respects OBJECT_MODE.
dnl When that check occurs, flags are not
dnl passed to to the compiler, so GCC has no
dnl chance to change its mode.
dnl Otherwise, it may enter a state where it
dnl runs, but uses the libtool "compile"
dnl wrapper, which subtly breaks other things.
dnl This should propagate to all uses of CC.
dnl This is only set if not manually set.
CC="gcc -maix64"
CXX="g++ -maix64"
echo
fi
;;
dnl Not needed on i because it defaults to 64-bit and
dnl has a GCC smart enough to respect OBJECT_MODE.
esac
dnl We still set this for *FLAGS, however, because we may not
dnl be setting OBJECT_MODE.
LDFLAGS="$LDFLAGS -maix64"
CPPFLAGS="$CPPFLAGS -maix64 -DGC_AIX_THREADS -D_ALL_SOURCE -pthread -D_THREAD_SAFE -D_LARGE_FILES -D_REENTRANT"
libmono_cflags="-pthread -D_THREAD_SAFE -D_REENTRANT"
dnl Would you believe GNU nm doesn't know how to process AIX libraries?
dnl Hardcode IBM binutils in case GNU ones end up on our path. Also
dnl specifiy 64-bit mode for tools. (OBJECT_MODE is finicky with cmake.)
dnl XXX: We should stop the hardcoding madness
AR="/usr/bin/ar -X64"
NM="/usr/bin/nm -X64"
STRIP="/usr/bin/strip -X64"
RANLIB="/usr/bin/ranlib -X64"
dnl SGen is the future (changes to Boehm support code would be
dnl required if you wish to re-enable Boehm)
support_boehm=no
with_gc=sgen
need_link_unlink=yes
use_sigposix=yes
dnl Similar limitation to macOS about the first thread and the
dnl guard page, except sometimes the runtime hangs. Disable for
dnl now until cause can be determined or it seems OK enough.
with_sigaltstack=no
dnl use pthread TLS, __thread has issues with the compiler flags we use
with_tls=pthread
dnl ppc Linux is the same? test further
disable_munmap=yes
RID="aix-ppc64"
CORETARGETS="-p:TargetsUnix=true"
;;
*)
AC_MSG_WARN([*** Please add $host to configure.ac checks!])
;;
esac
AC_MSG_RESULT(ok)
if test x$need_link_unlink = xyes; then
AC_DEFINE(NEED_LINK_UNLINK, 1, [Define if Unix sockets cannot be created in an anonymous namespace])
fi
if test x$host_win32 = xyes; then
AC_DEFINE(HOST_WIN32, 1, [Host Platform is Win32])
fi
if test x$target_win32 = xyes; then
AC_DEFINE(TARGET_WIN32, 1, [Target Platform is Win32])
fi
if test x$host_darwin = xyes; then
AC_DEFINE(HOST_DARWIN, 1, [Host Platform is Darwin])
fi
if test echo x$target_os | grep -q linux; then
AC_DEFINE(HOST_LINUX, 1, [Host Platform is Linux])
fi
# Defined for all targets/platforms using classic Windows API support.
AC_DEFINE(HAVE_CLASSIC_WINAPI_SUPPORT, 1, [Use classic Windows API support])
AC_DEFINE(HAVE_UWP_WINAPI_SUPPORT, 0, [Don't use UWP Windows API support])
AC_SUBST(extra_runtime_ldflags)
AM_CONDITIONAL(HOST_WIN32, test x$host_win32 = xyes)
AM_CONDITIONAL(TARGET_WIN32, test x$target_win32 = xyes)
AM_CONDITIONAL(HOST_LINUX, echo x$target_os | grep -q linux)
AM_CONDITIONAL(HOST_DARWIN, test x$host_darwin = xyes)
AM_CONDITIONAL(HOST_SIGPOSIX, test x$use_sigposix = xyes)
AM_CONDITIONAL(HOST_ANDROID, test x$platform_android = xyes)
AM_CONDITIONAL(HOST_TIZEN, test x$platform_tizen = xyes)
AM_CONDITIONAL(HOST_IOS, test x$platform_ios = xyes)
AM_CONDITIONAL(HOST_WASM, test x$host_wasm = xyes)
AM_CONDITIONAL(HOST_AIX, test x$host_aix = xyes)
if test -z "$HOST_DARWIN_TRUE"; then :
PLATFORM_AOT_SUFFIX=.dylib
PLATFORM_AOT_PREFIX=lib
fi
if test -z "$HOST_LINUX_TRUE"; then :
PLATFORM_AOT_SUFFIX=.so
PLATFORM_AOT_PREFIX=lib
fi
if test -z "$HOST_WIN32_TRUE"; then :
PLATFORM_AOT_SUFFIX=.dll
PLATFORM_AOT_PREFIX=
fi
AC_SUBST(PLATFORM_AOT_SUFFIX)
AC_SUBST(PLATFORM_AOT_PREFIX)
if test -z "$HOST_WASM_TRUE"; then :
AC_DEFINE(HAVE_UTIME)
AC_DEFINE(HAVE_UTIMES)
fi
## PLATFORM_AOT_SUFFIX not so simple for windows :-)
AC_CHECK_TOOL(CC, gcc, gcc)
AC_PROG_CC
AC_CHECK_TOOL(CXX, g++, g++)
AC_PROG_CXX
AM_PATH_PYTHON([3.2])
AM_PROG_AS
AC_PROG_INSTALL
AC_PROG_AWK
AM_PROG_CC_C_O
dnl We should use AM_PROG_AS, but it's not available on automake/aclocal 1.4
: ${CCAS='$(CC)'}
# Set ASFLAGS if not already set.
: ${CCASFLAGS='$(CFLAGS)'}
AC_SUBST(CCAS)
AC_SUBST(CCASFLAGS)
if test "x$CXX" = "xno"; then
AC_MSG_ERROR([No c++ compiler found. You need to install a c++ compiler])
fi
# AC_PROG_CXX helpfully sets CXX to g++ even if no c++ compiler is found so check
# GXX instead. See http://lists.gnu.org/archive/html/bug-autoconf/2002-04/msg00056.html
if test "x$CXX" = "xg++"; then
if test "x$GXX" != "xyes"; then
# automake/libtool is so broken, it requires g++ even if the c++ sources
# are inside automake conditionals
AC_MSG_ERROR([You need to install g++])
fi
fi
dnl may require a specific autoconf version
dnl AC_PROG_CC_FOR_BUILD
dnl CC_FOR_BUILD not automatically detected
CC_FOR_BUILD=$CC
CFLAGS_FOR_BUILD=$CFLAGS
BUILD_EXEEXT=
if test "x$cross_compiling" = "xyes"; then
CC_FOR_BUILD=cc
CFLAGS_FOR_BUILD=
BUILD_EXEEXT=""
fi
AC_SUBST(CC_FOR_BUILD)
AC_SUBST(CFLAGS_FOR_BUILD)
AC_SUBST(HOST_CC)
AC_SUBST(BUILD_EXEEXT)
AM_CONDITIONAL(CROSS_COMPILING, [test x$cross_compiling = xyes])
AM_CONDITIONAL(USE_BATCH_FILES, [test x$host_win32 = xyes -a x$cross_compiling = xyes])
# Set STDC_HEADERS
AC_HEADER_STDC
AC_LIBTOOL_WIN32_DLL
# This causes monodis to not link correctly
#AC_DISABLE_FAST_INSTALL
#lookup makedev() header
AC_HEADER_MAJOR
AM_PROG_LIBTOOL
# Use dolt (http://dolt.freedesktop.org/) instead of libtool for building.
DOLT
export_ldflags=`(./libtool --config; echo eval echo \\$export_dynamic_flag_spec) | sh`
AC_SUBST(export_ldflags)
# Test whenever ld supports -version-script
AC_PROG_LD
AC_PROG_LD_GNU
AC_CHECK_HEADERS(sys/filio.h sys/sockio.h netdb.h utime.h sys/utime.h semaphore.h sys/un.h linux/rtc.h sys/syscall.h sys/mkdev.h sys/uio.h sys/param.h sys/sysctl.h libproc.h sys/prctl.h copyfile.h gnu/lib-names.h)
AC_CHECK_HEADERS(sys/param.h sys/socket.h sys/ipc.h sys/utsname.h alloca.h ucontext.h pwd.h sys/select.h netinet/tcp.h netinet/in.h unistd.h sys/types.h link.h asm/sigcontext.h sys/inotify.h arpa/inet.h complex.h unwind.h)
# zlib/configure checks for unistd.h existence and defines HAVE_UNISTD_H on the compiler
# command line (not config.h) if it is present.
AC_CHECK_HEADER(unistd.h,
[HAVE_UNISTD_H=1
ZLIB_CFLAGS="$ZLIB_CFLAGS -DHAVE_UNISTD_H"],
[HAVE_UNISTD_H=0])
AC_SUBST(HAVE_UNISTD_H)
AC_CHECK_HEADERS([linux/netlink.h linux/rtnetlink.h],
[], [], [#include <stddef.h>
#include <sys/socket.h>
#include <linux/socket.h>])
AC_CHECK_HEADERS(sys/user.h, [], [],
[
#ifdef HAVE_SYS_PARAM_H
# include <sys/param.h>
#endif
])
AC_CHECK_HEADERS(linux/serial.h)
case "$host" in
# Use bundled zlib on Windows to be sure it is static.
*-mingw*|*-cygwin*)
have_sys_zlib=no
zlib_msg="bundled zlib"
;;
# Use bundled zlib on RISC-V for now to make cross-compiling easier.
riscv*)
have_sys_zlib=no
zlib_msg="bundled zlib"
;;
*)
AC_CHECK_HEADER(zlib.h, [have_sys_zlib=yes], [have_sys_zlib=no])
if test x$have_sys_zlib = xyes; then
AC_TRY_COMPILE([#include <zlib.h>], [
#if defined(ZLIB_VERNUM) && (ZLIB_VERNUM >= 0x1230)
#else
#error No good zlib found
#endif
],[
AC_MSG_RESULT(Using system zlib)
zlib_msg="system zlib"
have_sys_zlib=yes
],[
AC_MSG_RESULT(zlib too old, using embedded zlib)
have_sys_zlib=no
zlib_msg="bundled zlib"
])
else
AC_MSG_RESULT(zlib not found, using embedded zlib)
have_sys_zlib=no
zlib_msg="bundled zlib"
fi
;;
esac
AC_ARG_WITH(static-zlib, [ --with-static-zlib=PATH use the specified static zlib instead of -lz],[STATIC_ZLIB_PATH=$with_static_zlib],[STATIC_ZLIB_PATH=])
if test "x$STATIC_ZLIB_PATH" != "x"; then
have_static_zlib=yes
have_sys_zlib=no
zlib_msg="static zlib from $STATIC_ZLIB_PATH"
AC_SUBST(STATIC_ZLIB_PATH)
fi
AM_CONDITIONAL(HAVE_STATIC_ZLIB, test x$have_static_zlib = xyes)
AM_CONDITIONAL(HAVE_SYS_ZLIB, test x$have_sys_zlib = xyes)
if test x$have_static_zlib = xyes; then
AC_DEFINE(HAVE_STATIC_ZLIB, 1, [Use static zlib])
fi
if test x$have_sys_zlib = xyes; then
AC_DEFINE(HAVE_SYS_ZLIB, 1, [Use OS-provided zlib])
fi
# for mono/metadata/debug-symfile.c
AC_CHECK_HEADERS(elf.h)
# for perf jit dump support
AC_CHECK_HEADERS(sys/mman.h)
if test "x$host_linux" = "xyes" -a x$ac_cv_header_sys_mman_h = xyes -a x$ac_cv_header_elf_h = xyes -a x$ac_cv_header_sys_syscall_h = xyes; then
AC_DEFINE(ENABLE_JIT_DUMP, 1, [Enable jit dump support on Linux])
fi
# for support
AC_CHECK_HEADERS(poll.h)
AC_CHECK_HEADERS(sys/poll.h)
AC_CHECK_HEADERS(sys/wait.h)
AC_CHECK_HEADERS(grp.h)
AC_CHECK_HEADERS(syslog.h)
AC_CHECK_FUNCS(vsyslog)
# for mono/dis
AC_CHECK_HEADERS(wchar.h)
# for Linux statfs support
AC_CHECK_HEADERS(linux/magic.h)
# For Android NDK unified headers
if test x$platform_android = xyes; then
AC_CHECK_HEADERS(machine/endian.h sys/endian.h)
AC_CHECK_HEADERS(android/legacy_signal_inlines.h, [have_android_signal_inlines=yes], [have_android_signal_inlines=no])
AC_CHECK_HEADERS(android/ndk-version.h)
# Make sure SIGRT{MIN,MAX} work - they will fail to work with unified headers if building for
# API level < 21 *and* android/legacy_signal_inlines.h doesn't declare (and define) the required
# libc APIs to obtain values for SIGRT{MIN,MAX}. We perform the check only if android/legacy_signal_inlines.h
# is found because in other cases the macros will either work (for NDK < 14) or fail if the legacy header
# doesn't contain the required definitions (NDK 14)
if test x$have_android_signal_inlines = xyes; then
AC_MSG_CHECKING([Whether Android SIGRTMIN/SGRTMAX macros are valid])
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM([#include <signal.h>
#include <android/legacy_signal_inlines.h>],[
int i;
for (i = SIGRTMIN + 1; i < SIGRTMAX; ++i) {
}
])],[
AC_MSG_RESULT(yes)
android_sigrtminmax_work=yes
],[
AC_MSG_RESULT(no)
android_sigrtminmax_work=no
]
)
if test x$android_sigrtminmax_work = xno; then
AC_MSG_ERROR([Android SIGRTMIN/SIGRTMAX macros don't work in this NDK])
fi
fi
# Attempt to detect whether we're using Android NDK unified headers
AC_CHECK_HEADERS(android/api-level.h, [have_android_api_level=yes], [have_android_api_level=no])
AC_CHECK_HEADERS(android/versioning.h, [have_android_versioning=yes], [have_android_versioning=no])
android_unified_headers=no
if test x$have_android_api_level = xyes; then
if test x$have_android_versioning = xyes; then
AC_MSG_CHECKING([whether using Android NDK unified headers])
# Both macros are defined only in the NDK unified headers
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM([
#include <android/api-level.h>
#include <android/versioning.h>
],[
#if __ANDROID_API_O__ == 26 && defined(__INTRODUCED_IN)
#else
#error __ANDROID_API_O__ != 26 or the __INTRODUCED_IN macro not defined
#endif
])],[
AC_MSG_RESULT(yes)
android_unified_headers=yes
],[
AC_MSG_RESULT(no)
android_unified_headers=no
]
)
fi
fi
if test x$android_unified_headers = xyes; then
AC_DEFINE(ANDROID_UNIFIED_HEADERS, 1, [Whether Android NDK unified headers are used])
fi
fi # Android
# not 64 bit clean in cross-compile
AC_CHECK_SIZEOF(void *)
AC_CHECK_SIZEOF(long)
AC_CHECK_SIZEOF(int)
AC_CHECK_SIZEOF(long long)
AC_CACHE_CHECK([for clang],
mono_cv_clang,[
AC_TRY_COMPILE([], [
#ifdef __clang__
#else
#error "FAILED"
#endif
],
[mono_cv_clang=yes],
[mono_cv_clang=no],
[])
])
AC_ARG_ENABLE(visibility-hidden,
[ --disable-visibility-hidden disable usage of -fvisiblity=hidden],
disable_visibility_hidden=yes, disable_visibility_hidden=no)
WARN=''
if test x"$GCC" = xyes; then
WARN='-Wall -Wunused -Wmissing-declarations -Wpointer-arith -Wno-cast-qual -Wwrite-strings -Wno-switch -Wno-switch-enum -Wno-unused-value -Wno-attributes'
CFLAGS="$CFLAGS -Wmissing-prototypes -Wstrict-prototypes -Wnested-externs -Wno-format-zero-length -Wc++-compat"
# We require C99 with some GNU extensions, e.g. `linux` macro
CFLAGS="$CFLAGS -std=gnu99"
# The runtime code does not respect ANSI C strict aliasing rules
CFLAGS="$CFLAGS -fno-strict-aliasing"
# We rely on signed overflow to behave
CFLAGS="$CFLAGS -fwrapv"
CFLAGS="$CFLAGS -DMONO_DLL_EXPORT"
if test x"$disable_visibility_hidden" = xno; then
# Don't export any symbols by default
SHARED_CFLAGS="-fvisibility=hidden"
CXXFLAGS="$CXXFLAGS -fvisibility=hidden"
fi
ORIG_CFLAGS=$CFLAGS
# Check for the normal version, since gcc ignores unknown -Wno options
CFLAGS="$CFLAGS -Wunused-but-set-variable -Werror"
AC_MSG_CHECKING(for -Wno-unused-but-set-variable option to gcc)
AC_TRY_COMPILE([],[
], [
AC_MSG_RESULT(yes)
CFLAGS="$ORIG_CFLAGS -Wno-unused-but-set-variable"
], [
AC_MSG_RESULT(no)
CFLAGS=$ORIG_CFLAGS
])
if test "x$mono_cv_clang" = "xyes"; then
# https://bugzilla.samba.org/show_bug.cgi?id=8118
WARN="$WARN -Qunused-arguments"
WARN="$WARN -Wno-unused-function -Wno-tautological-compare -Wno-parentheses-equality -Wno-self-assign -Wno-return-stack-address -Wno-constant-logical-operand"
# We rely on zero length arrays in structs
WARN="$WARN -Wno-zero-length-array"
fi
else
# The Sun Forte compiler complains about inline functions that access static variables
# so disable all inlining.
case "$host" in
*-*-solaris*)
CFLAGS="$CFLAGS -Dinline="
;;
esac
fi
CFLAGS="$WARN $CFLAGS -g"
CFLAGS_FOR_LIBGC="$CFLAGS_FOR_LIBGC -g"
CPPFLAGS="$WARN $CPPFLAGS -g"
# Where's the 'mcs' source tree?
if test -d $srcdir/mcs; then
mcsdir=mcs
else
mcsdir=../mcs
fi
AC_ARG_WITH(mcs-path, [ --with-mcs-path=/path/to/mcs Specify an alternate mcs source tree],
if test x$with_mcs_path != "x" -a -d $with_mcs_path ; then
mcsdir=$with_mcs_path
fi
)
AC_ARG_WITH(jumptables, [ --with-jumptables=yes,no enable/disable support for jumptables (ARM-only for now) (defaults to no)],[],[with_jumptables=no])
AC_ARG_WITH(core, [ --with-core=only controls whether to build Mono as a .NET Core runtime (defaults to no)],[],[with_core=no])
if test x$with_core = xonly; then
AC_DEFINE(ENABLE_NETCORE,1,[Enables the support for .NET Core Features in the MonoVM])
with_runtime_preset=netcore
fi
AM_CONDITIONAL(ENABLE_NETCORE, test x$with_core = xonly)
#
# A sanity check to catch cases where the package was unpacked
# with an ancient tar program (Solaris)
#
AC_ARG_ENABLE(solaris-tar-check,
[ --disable-solaris-tar-check disable solaris tar check],
do_solaris_tar_check=no, do_solaris_tar_check=yes)
if test x"$do_solaris_tar_check" = xyes -a x"$enable_solaris_tar_check" = xyes; then
AC_MSG_CHECKING(integrity of package)
if test -f $mcsdir/class/System.Runtime.Serialization.Formatters.Soap/System.Runtime.Serialization.Formatters.Soap/SoapTypeMapper.cs
then
AC_MSG_RESULT(ok)
else
errorm="Your mono distribution is incomplete; if unpacking from a tar file, make sure you use GNU tar; see http://www.mono-project.com/IncompletePackage for more details"
AC_MSG_ERROR([$errorm])
fi
fi
if test "x$with_mcs_path" != "x"; then
mcs_topdir=$(cd "$mcsdir" && pwd)
mcs_topdir_from_srcdir=$mcs_topdir
else
mcs_topdir=$(cd "$srcdir/$mcsdir" && pwd)
mcs_topdir_from_srcdir='$(top_builddir)'/$mcsdir
fi
# Convert mcs_topdir* paths to Windows syntax.
if test x$cross_compiling$host_win32 = xnoyes; then
mcs_topdir=$(cygpath -m $mcs_topdir)
case $mcs_topdir_from_srcdir in
/cygdrive/*)
mcs_topdir_from_srcdir=$(cygpath -m $mcs_topdir_from_srcdir)
;;
esac
fi
AC_SUBST([mcs_topdir])
AC_SUBST([mcs_topdir_from_srcdir])
# gettext: prepare the translation directories.
# we do not configure the full gettext, as we consume it dynamically from C#
AM_PO_SUBDIRS