forked from mono/mono
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
3092 lines (2869 loc) · 93.6 KB
/
CMakeLists.txt
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
cmake_minimum_required(VERSION 2.6.4)
# To keep this in sync with the autoconf based system:
# git log -n --format=oneline CMakeLists.txt
# git diff <commit displayed by previous line>..HEAD configure.in Makefile.am
# FIXME: Sanitize the variables, no need for the duplicate am conditionals
# - It would be nice to rename 'CMakeFiles' to something like '.cmake'
# - It would be nice to have a per-target VERBOSE setting
# - or a way to change the setting name to 'V' and the output to CC <src>
# to be similar to the current build output
# - Add a cache to the manual checks
# We use lowercase commands as advocated by the kde cmake coding style
include(CheckIncludeFile)
include(CheckCSourceCompiles)
# Implementation of AC_CHECK_HEADERS
# In addition, it also records the list of variables in the variable
# 'autoheader_vars', and for each variable, a documentation string in the
# variable ${var}_doc
function(ac_check_headers headers)
foreach (header ${ARGV})
string(TOUPPER ${header} header_var)
string(REPLACE "." "_" header_var ${header_var})
string(REPLACE "/" "_" header_var ${header_var})
set(header_var "HAVE_${header_var}")
check_include_file (${header} ${header_var})
set("${header_var}_doc" "Define to 1 if you have the <${header}> header file." PARENT_SCOPE)
if (${header_var})
set("${header_var}_defined" "1" PARENT_SCOPE)
endif()
set("${header_var}_val" "1" PARENT_SCOPE)
set (autoheader_vars ${autoheader_vars} ${header_var})
endforeach()
set (autoheader_vars ${autoheader_vars} PARENT_SCOPE)
endfunction()
function(ac_check_funcs funcs)
foreach (func ${ARGV})
string(TOUPPER ${func} var)
set(var "HAVE_${var}")
set(${var})
check_function_exists (${func} ${var})
set("${var}_doc" "Define to 1 if you have the '${func}' function." PARENT_SCOPE)
if (${var})
set("${var}_defined" "1" PARENT_SCOPE)
set(${var} yes PARENT_SCOPE)
endif()
set("${var}_val" "1" PARENT_SCOPE)
set (autoheader_vars ${autoheader_vars} ${var})
endforeach()
set (autoheader_vars ${autoheader_vars} PARENT_SCOPE)
endfunction()
# Implementation of AC_DEFINE
function(ac_define varname value doc)
if (${varname} MATCHES ",")
message(FATAL_ERROR ",")
endif()
set("${varname}_doc" ${doc} PARENT_SCOPE)
set("${varname}_defined" 1 PARENT_SCOPE)
set("${varname}_val" ${value} PARENT_SCOPE)
set (autoheader_vars ${autoheader_vars} ${varname} PARENT_SCOPE)
endfunction()
# Implementation of AC_DEFINE_UNQUOTED
function(ac_define_unquoted varname value doc)
if (${varname} MATCHES ",")
message(FATAL_ERROR ",")
endif()
set("${varname}_doc" ${doc} PARENT_SCOPE)
set("${varname}_defined" 1 PARENT_SCOPE)
set("${varname}_val" \"${value}\" PARENT_SCOPE)
set (autoheader_vars ${autoheader_vars} ${varname} PARENT_SCOPE)
endfunction()
Include(CheckTypeSize)
# Implementation of AC_CHECK_SIZEOF
# FIXME: cross compiling
function(ac_check_sizeof type)
check_type_size(${type} size)
if (HAVE_size STREQUAL "TRUE")
else()
message(FATAL_ERROR "Type ${type} not found.")
endif()
string(TOUPPER "SIZEOF_${type}" varname)
string(REPLACE " " "_" varname ${varname})
string(REPLACE "*" "P" varname ${varname})
set("${varname}_doc" "The size of '${type}' as computed by sizeof" PARENT_SCOPE)
set("${varname}_defined" 1 PARENT_SCOPE)
set("${varname}_val" ${size} PARENT_SCOPE)
set (autoheader_vars ${autoheader_vars} ${varname} PARENT_SCOPE)
endfunction()
# Implementation of autoheader
function(AUTOHEADER filename variables)
set(tmp_filename "${filename}.tmp")
file(WRITE ${tmp_filename} "")
foreach(var ${${variables}})
file(APPEND ${tmp_filename} "\n/* ${${var}_doc} */\n")
if(${${var}_defined})
file(APPEND ${tmp_filename} "#define ${var} ${${var}_val}\n")
else()
file(APPEND ${tmp_filename} "/* #undef ${var} */\n")
endif()
endforeach()
# FIXME: This is unix specific
execute_process(COMMAND diff ${filename} ${filename}.tmp RESULT_VARIABLE diff_res OUTPUT_QUIET)
if (NOT diff_res STREQUAL 0)
message(STATUS "generating ${filename}.")
execute_process(COMMAND mv ${filename}.tmp ${filename})
else()
message(STATUS "${filename} is unchanged.")
endif()
endfunction()
function(ac_msg_checking)
message(STATUS "checking ${ARGV}...")
set(last_msg_checking ${ARGV} PARENT_SCOPE)
endfunction()
function(ac_msg_result)
message(STATUS "checking ${last_msg_checking}... ${ARGV}")
endfunction()
function(ac_msg_error)
message(FATAL_ERROR "${ARGV}")
endfunction()
function(ac_msg_warn)
message(STATUS "WARNING: ${ARGV}")
endfunction()
# The lines commented out using ### are the stuff from configure.in which still
# need to be ported to cmake
set(VERSION 2.7)
ac_define_unquoted(VERSION ${VERSION} "Version number of package")
set(API_VER 1.0)
###
###AC_PROG_LN_S
###
#### 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* ) set(LN_S 'cp -p';;)
###esac
###
###
#
# These variables are the CPPFLAGS/CFLAGS passed to libgc's configure
# libgc should inherit the original CFLAGS/CPPFLAGS passed to configure, i.e. -O0
#
set(CPPFLAGS_FOR_LIBGC ${CPPFLAGS})
set(CFLAGS_FOR_LIBGC ${CFLAGS})
#
# These are the flags that need to be stored in the mono.pc file for
# compiling code that will embed Mono
#
set(libmono_cflags "")
set(libmono_ldflags "")
###AC_SUBST(libmono_cflags)
###AC_SUBST(libmono_ldflags)
###
#### Variable to have relocatable .pc files (lib, or lib64)
###set(reloc_libdir `basename ${libdir}`)
###AC_SUBST(reloc_libdir)
# if linker handles the version script
set(no_version_script no)
# Set to yes if Unix sockets cannot be created in an anonymous namespace
set(need_link_unlink no)
#
# Platform support
#
# Obtain the GNU style target
# From GetTargetTriple.cmake in LLVM
function( get_target_triple var )
if( MSVC )
set( ${var} "i686-pc-win32" PARENT_SCOPE )
else( MSVC )
set(config_guess config.guess)
execute_process(COMMAND sh ${config_guess}
RESULT_VARIABLE TT_RV
OUTPUT_VARIABLE TT_OUT
OUTPUT_STRIP_TRAILING_WHITESPACE)
if( NOT TT_RV EQUAL 0 )
message(FATAL_ERROR "Failed to execute ${config_guess}")
endif( NOT TT_RV EQUAL 0 )
set( ${var} ${TT_OUT} PARENT_SCOPE )
endif( MSVC )
endfunction( get_target_triple var )
get_target_triple(host)
message(STATUS "checking host platform characteristics...")
set(libgc_threads no)
set(has_dtrace no)
set(parallel_mark yes)
if(host MATCHES .*-.*-linux.*)
set(platform_win32 no)
set(CPPFLAGS "${CPPFLAGS} -DHAVE_CONFIG_H -DGC_LINUX_THREADS -D_GNU_SOURCE -D_REENTRANT -DUSE_MMAP -DUSE_MUNMAP")
set(libmono_cflags "-D_REENTRANT")
set(libmono_ldflags "-lpthread")
set(libdl "-ldl")
set(libgc_threads pthreads)
set(AOT_SUPPORTED "yes")
set(use_sigposix yes)
else()
message(FATAL_ERROR "The cmake build doesn't yet support host '${host}'.")
endif()
#### Thread configuration inspired by sleepycat's db
###case "$host" in
### *-*-mingw*|*-*-cygwin*)
### set(platform_win32 yes)
### AC_DEFINE(PLATFORM_WIN32,1,[Host Platform is Win32])
### AC_DEFINE(TARGET_WIN32,1,[Target OS is Win32])
### ac_define(DISABLE_PORTABILITY,1,[Disable the io-portability layer])
### ac_define(PLATFORM_NO_SYMLINKS,1,[This platform does not support symlinks])
### if test "x$cross_compiling" = "xno"; then
### set(CC "gcc -mno-cygwin -g")
### # So libgc configure gets -mno-cygwin
### export CC
### fi
### set(HOST_CC "gcc")
### # Windows 2000 is required that includes Internet Explorer 5.01
### set(CPPFLAGS "$CPPFLAGS -DWINVER=0x0500 -D_WIN32_WINNT=0x0500 -D_WIN32_IE=0x0501 -D_UNICODE -DUNICODE -DWIN32_THREADS -DFD_SETSIZE=1024")
### set(libmono_cflags "-mno-cygwin -mms-bitfields -mwindows")
### set(libmono_ldflags "-mno-cygwin -mms-bitfields -mwindows")
### set(libdl )
### set(libgc_threads win32)
### set(gc_default included)
### set(with_sigaltstack no)
### set(LN_S cp)
### # This forces libgc to use the DllMain based thread registration code on win32
### set(libgc_configure_args "$libgc_configure_args --enable-win32-dllmain=yes")
### ;;
### *-*-*netbsd*)
### set(platform_win32 no)
### set(CPPFLAGS "$CPPFLAGS -D_REENTRANT -DGC_NETBSD_THREADS -D_GNU_SOURCE")
### set(libmono_cflags "-D_REENTRANT")
### set(LDFLAGS "$LDFLAGS -pthread")
### set(CPPFLAGS "$CPPFLAGS -DPLATFORM_BSD")
### set(libmono_ldflags "-pthread")
### set(need_link_unlink yes)
### set(libdl "-ldl")
### set(libgc_threads pthreads)
### set(with_sigaltstack no)
### set(use_sigposix yes)
### ;;
### *-*-*freebsd*)
### set(platform_win32 no)
### if test "x$PTHREAD_CFLAGS" = "x"; then
### set(CPPFLAGS "$CPPFLAGS -DGC_FREEBSD_THREADS")
### set(libmono_cflags )
### else
### set(CPPFLAGS "$CPPFLAGS $PTHREAD_CFLAGS -DGC_FREEBSD_THREADS")
### set(libmono_cflags "$PTHREAD_CFLAGS")
### fi
### if test "x$PTHREAD_LIBS" = "x"; then
### set(LDFLAGS "$LDFLAGS -pthread")
### set(libmono_ldflags "-pthread")
### else
### set(LDFLAGS "$LDFLAGS $PTHREAD_LIBS")
### set(libmono_ldflags "$PTHREAD_LIBS")
### fi
### set(CPPFLAGS "$CPPFLAGS -DPLATFORM_BSD")
### set(need_link_unlink yes)
### ac_define(PTHREAD_POINTER_ID, 1, [pthread is a pointer])
### set(libdl )
### set(libgc_threads pthreads)
### # This doesn't seem to work as of 7.0 on amd64
### set(with_sigaltstack no)
#### TLS is only partially implemented on -CURRENT (compiler support
#### but NOT library support)
####
### set(with_tls pthread)
### set(use_sigposix yes)
### ;;
### *-*-*openbsd*)
### set(platform_win32 no)
### set(CPPFLAGS "$CPPFLAGS -D_THREAD_SAFE -DGC_FREEBSD_THREADS -DPLATFORM_BSD")
### set(libmono_cflags "-D_THREAD_SAFE")
### set(LDFLAGS "$LDFLAGS -pthread")
### set(libmono_ldflags "-pthread")
### set(need_link_unlink yes)
### ac_define(PTHREAD_POINTER_ID)
### set(libdl )
### set(libgc_threads pthreads)
### set(use_sigposix yes)
### ;;
### *-*-linux*)
### set(platform_win32 no)
### set(CPPFLAGS "$CPPFLAGS -DGC_LINUX_THREADS -D_GNU_SOURCE -D_REENTRANT -DUSE_MMAP -DUSE_MUNMAP")
### set(libmono_cflags "-D_REENTRANT")
### set(libmono_ldflags "-lpthread")
### set(libdl "-ldl")
### set(libgc_threads pthreads)
### set(AOT_SUPPORTED "yes")
### set(use_sigposix yes)
### ;;
### *-*-hpux*)
### set(platform_win32 no)
### set(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
### set(CFLAGS "$CFLAGS +ESdbgasm")
### # Arrange for run-time dereferencing of null
### # pointers to produce a SIGSEGV signal.
### set(LDFLAGS "$LDFLAGS -z")
### fi
### set(CFLAGS "$CFLAGS +ESdbgasm")
### set(LDFLAGS "$LDFLAGS -z")
### set(libmono_cflags "-D_REENTRANT")
### set(libmono_ldflags "-lpthread")
### set(libgc_threads pthreads)
### set(need_link_unlink yes)
### set(use_sigposix yes)
### ;;
### *-*-solaris*)
### set(platform_win32 no)
### set(CPPFLAGS "$CPPFLAGS -DGC_SOLARIS_THREADS -DGC_SOLARIS_PTHREADS -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS -DUSE_MMAP -DUSE_MUNMAP -DPLATFORM_SOLARIS")
### set(need_link_unlink yes)
### set(libmono_cflags "-D_REENTRANT")
### set(libgc_threads pthreads)
### # This doesn't seem to work on solaris/x86, but the configure test runs
### set(with_tls pthread)
### set(has_dtrace yes)
### set(use_sigposix yes)
### ;;
### *-*-darwin*)
### set(parallel_mark "Disabled_Currently_Hangs_On_MacOSX")
### set(platform_win32 no)
### set(platform_darwin yes)
### set(CPPFLAGS "$CPPFLAGS -no-cpp-precomp -D_THREAD_SAFE -DGC_MACOSX_THREADS -DPLATFORM_MACOSX -DUSE_MMAP -DUSE_MUNMAP")
### set(CPPFLAGS "$CPPFLAGS -DGetCurrentProcess=MonoGetCurrentProcess -DGetCurrentThread=MonoGetCurrentThread -DCreateEvent=MonoCreateEvent")
### set(libmono_cflags "-D_THREAD_SAFE")
### set(LDFLAGS "$LDFLAGS -pthread")
### set(libmono_ldflags "-pthread")
### set(need_link_unlink yes)
### ac_define(PTHREAD_POINTER_ID)
### ac_define(USE_MACH_SEMA, 1, [...])
### set(no_version_script yes)
### set(libdl )
### set(libgc_threads pthreads)
### set(has_dtrace yes)
### if test "x$cross_compiling" = "xyes"; then
### set(has_broken_apple_cpp yes)
### fi
### ;;
### *)
### AC_MSG_WARN([*** Please add $host to configure.in checks!])
### set(platform_win32 no)
### set(libdl "-ldl")
### ;;
###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(use_sigposix)
set(PLATFORM_SIGPOSIX 1)
endif()
if(platform_win32)
set(PLATFORM_WIN32 yes)
endif()
if(${target_os} MATCHES "*linux*")
set(PLATFORM_LINUX yes)
endif()
if(platform_darwin)
set(PLATFORM_DARWIN yes)
endif()
include(CMakeDetermineASM-ATTCompiler)
find_program(BISON NAMES bison)
if(BISON STREQUAL "BISON-NOTFOUND")
message(FATAL_ERROR "You need to install bison")
else()
message(STATUS "Found bison: ${BISON}")
endif()
###AC_PROG_INSTALL
###AC_PROG_AWK
#### We should use AM_PROG_AS, but it's not available on automake/aclocal 1.4
###: ${set(CCAS '$(CC)'})
#### Set ASFLAGS if not already set.
###: ${set(CCASFLAGS '$(CFLAGS)'})
###AC_SUBST(CCAS)
###AC_SUBST(CCASFLAGS)
###
#### may require a specific autoconf version
#### AC_PROG_CC_FOR_BUILD
#### CC_FOR_BUILD not automatically detected
###set(CC_FOR_BUILD $CC)
###set(CFLAGS_FOR_BUILD $CFLAGS)
###set(BUILD_EXEEXT )
###if test "x$cross_compiling" = "xyes"; then
### set(CC_FOR_BUILD cc)
### set(CFLAGS_FOR_BUILD )
### set(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$platform_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
###set(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
###if test "x$lt_cv_prog_gnu_ld" = "xno"; then
### set(no_version_script yes)
###fi
###
###AM_CONDITIONAL(NO_VERSION_SCRIPT, test x$no_version_script = xyes)
###
ac_check_headers(unistd.h stdint.h sys/types.h)
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)
ac_check_headers(sys/user.h sys/socket.h sys/ipc.h sys/sem.h sys/utsname.h alloca.h ucontext.h pwd.h)
ac_check_headers(zlib.h)
set(have_zlib ${HAVE_ZLIB_H})
if(have_zlib)
set(compiles)
check_c_source_compiles("
#include <zlib.h>
void main () {
#if defined(ZLIB_VERNUM) && (ZLIB_VERNUM >= 0x1230)
}
#else
#error No good zlib found
#endif
" compiles)
if(compiles)
ac_msg_result("Using system zlib")
set(zlib_msg "system zlib")
set(HAVE_ZLIB yes)
else()
ac_msg_result("Using embedded zlib")
set(have_zlib no)
set(zlib_msg "bundled zlib")
endif()
endif()
if(have_zlib)
set(HAVE_ZLIB yes)
endif()
ac_define(HAVE_ZLIB 1 "Have system zlib")
# for mono/metadata/debug-symfile.c
ac_check_headers(elf.h)
# 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)
# for mono/dis
ac_check_headers(wchar.h)
ac_check_headers(ieeefp.h)
# Check whenever using GCC
include(CheckCSourceCompiles)
include(CheckCCompilerFlag)
check_c_source_compiles("
#ifdef __GNUC__
#else
#error 1
#endif
void main () {}
" GCC)
if(NOT HAVE_ISINF)
ac_msg_checking("for isinf")
set(compiles)
check_c_source_compiles("
#include <math.h>
void main () {
int f = isinf (1);
}
" compiles)
if(compiles)
ac_msg_result(yes)
ac_define(HAVE_ISINF 1 "isinf available")
set(HAVE_ISINF 1 CACHE BOOL "Have the isinf function")
else()
ac_msg_result(no)
endif()
endif()
# not 64 bit clean in cross-compile
ac_check_sizeof("void *" 4)
set(WARN '')
if(GCC)
set(WARN "-Wall -Wunused -Wmissing-prototypes -Wmissing-declarations -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wno-cast-qual -Wwrite-strings")
# The runtime code does not respect ANSI C strict aliasing rules
set(CFLAGS "${CFLAGS} -fno-strict-aliasing")
CHECK_C_COMPILER_FLAG("-Wdeclaration-after-statement" HAS_WDECL_AFTER_STATEMENT)
if(HAS_WDECL_AFTER_STATEMENT)
set(WARN "${WARN} -Wdeclaration-after-statement")
endif()
else()
# The Sun Forte compiler complains about inline functions that access static variables
# so disable all inlining.
### case "$host" in
### *-*-solaris*)
### set(CFLAGS "$CFLAGS -Dinline=")
### ;;
### esac
###fi
endif()
set(CFLAGS "${CFLAGS} -g ${WARN}")
###set(CFLAGS_FOR_LIBGC "$CFLAGS_FOR_LIBGC -g")
###
set(srcdir ${CMAKE_SOURCE_DIR})
set(top_srcdir ${CMAKE_SOURCE_DIR})
set(abs_top_srcdir ${top_srcdir})
# FIXME:
set(top_builddir ${CMAKE_BINARY_DIR})
# Where's the 'mcs' source tree?
if(EXISTS ${srcdir}/mcs)
set(mcsdir mcs)
else()
set(mcsdir ../mcs)
endif()
#
# A sanity check to catch cases where the package was unpacked
# with an ancient tar program (Solaris)
#
set(solaris-tar-check yes CACHE BOOL "Enable/disable solaris tar check")
if(solaris-tar-check)
ac_msg_checking("integrity of package")
if(EXISTS ${srcdir}/${mcsdir}/class/System.Runtime.Serialization.Formatters.Soap/System.Runtime.Serialization.Formatters.Soap/SoapTypeMapper.cs)
ac_msg_result(ok)
else()
set(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})
endif()
endif()
set(mcs_topdir ${top_srcdir}/${mcsdir})
set(mcs_topdir_from_srcdir ${top_builddir}/${mcsdir})
###
##### Maybe should also disable if mcsdir is invalid. Let's punt the issue for now.
###AM_CONDITIONAL(BUILD_MCS, [test x$cross_compiling = xno && test x$enable_mcs_build != xno])
###
###AC_SUBST([mcs_topdir])
###AC_SUBST([mcs_topdir_from_srcdir])
###
#### Where's the 'olive' source tree?
###if test -d $srcdir/olive; then
### set(olivedir olive)
###else
### set(olivedir ../olive)
###fi
###
###if test -d $srcdir/$olivedir; then
###set(olive_topdir '$(top_srcdir)/'$olivedir)
###fi
###
#### gettext: prepare the translation directories.
#### we do not configure the full gettext, as we consume it dynamically from C#
###AM_PO_SUBDIRS
###
###if test "x$USE_NLS" = "xyes"; then
### AC_CHECK_PROG(HAVE_MSGFMT, msgfmt,yes,no)
###
### if test "x$HAVE_MSGFMT" = "xno"; then
### ac_msg_error([msgfmt not found. You need to install the 'gettext' package, or pass --enable-set(nls no to configure.]))
### fi
###fi
###
set(libgdiplus installed CACHE STRING "=installed|sibling|<path> Override the libgdiplus used for System.Drawing tests (defaults to installed)")
set(with_libgdiplus ${libgdiplus})
###case $with_libgdiplus in
###no|installed) set(libgdiplus_loc ;;)
###yes|sibling) set(libgdiplus_loc `cd ../libgdiplus && pwd`/src/libgdiplus.la ;;)
###/*) set(libgdiplus_loc $with_libgdiplus ;;)
###*) set(libgdiplus_loc `pwd`/$with_libgdiplus ;;)
###esac
###AC_SUBST([libgdiplus_loc])
###
###
###set(pkg_config_path )
###set(crosspkgdir, [ --with-set(crosspkgdir /path/to/pkg-config/dir Change pkg-config dir to custom dir],)
### if test x$with_crosspkgdir = "x"; then
### if test -s $PKG_CONFIG_PATH; then
### set(pkg_config_path $PKG_CONFIG_PATH)
### fi
### else
### set(pkg_config_path $with_crosspkgdir)
### set(PKG_CONFIG_PATH $pkg_config_path)
### export PKG_CONFIG_PATH
### fi
###)
###
###set([glib],
### [ --with-set(glib embedded|system Choose glib API: system or embedded (default to system)],)
### [], [set(with_glib system]))
###
###set(eglib_dir )
###
include(FindPkgConfig)
# FIXME:
set(with_glib "system")
if (${with_glib} STREQUAL "system")
### if test "x$cross_compiling" = "xyes"; then
### set(pkg_config_path "$PKG_CONFIG_PATH")
### unset PKG_CONFIG_PATH
### fi
PKG_CHECK_MODULES(GLIB2 REQUIRED glib-2.0 gthread-2.0)
set(BUILD_GLIB_CFLAGS ${GLIB2_CFLAGS})
set(BUILD_GLIB_LIBS ${GLIB2_LIBRARIES})
### if test "x$cross_compiling" = "xyes"; then
### set(PKG_CONFIG_PATH $pkg_config_path)
### export PKG_CONFIG_PATH
### fi
###
## Versions of dependencies
set(GLIB_REQUIRED_VERSION 2.4.0)
PKG_CHECK_MODULES(GLIB2 REQUIRED glib-2.0 >= ${GLIB_REQUIRED_VERSION} gthread-2.0)
set(GLIB_CFLAGS ${GLIB2_CFLAGS})
set(GLIB_LIBS ${GLIB2_LIBRARIES})
PKG_CHECK_MODULES(GMODULE REQUIRED gmodule-2.0)
set(GMODULE_CFLAGS ${GMODULE_CFLAGS})
set(GMODULE_LIBS ${GMODULE_LIBRARIES})
endif()
###case $with_glib in
###embedded)
### set(GLIB_CFLAGS '-I$(top_srcdir)/eglib/src -I$(top_builddir)/eglib/src')
### set(GLIB_LIBS '-L$(top_builddir)/eglib/src -leglib -lm')
### set(BUILD_GLIB_CFLAGS "$GLIB_CFLAGS")
### set(BUILD_GLIB_LIBS "$GLIB_LIBS")
### set(GMODULE_CFLAGS "$GLIB_CFLAGS")
### set(GMODULE_LIBS "$GLIB_LIBS")
### set(eglib_dir eglib)
### AC_CONFIG_SUBDIRS(eglib)
### ;;
###*)
### ac_msg_error([Invalid argument to --with-glib.])
###esac
if(with_glib STREQUAL "embedded")
set(EGLIB_BUILD yes)
endif()
###
###AC_SUBST(GLIB_CFLAGS)
###AC_SUBST(GLIB_LIBS)
###AC_SUBST(GMODULE_CFLAGS)
###AC_SUBST(GMODULE_LIBS)
###AC_SUBST(BUILD_GLIB_CFLAGS)
###AC_SUBST(BUILD_GLIB_LIBS)
###AC_SUBST(eglib_dir)
###
###if test x$cross_compiling$platform_win32 = xnoyes; then
### ac_msg_checking(for cygwin glib2-dev package)
### if [ cygcheck --f /usr/lib/libglib-2.0.dll.a | grep -q glib2-devel ]; then
### ac_msg_result(found)
### ac_msg_error([Mono cannot be built with the cygwin glib2-devel package installed, because that package doesn't work with -mno-cygwin. Please uninstall it then re-run configure.])
### else
### ac_msg_result(not found, ok)
### fi
###
### ac_msg_checking(for broken gwin32.h)
### set(glib_include `$PKG_CONFIG --cflags-only-I glib-2.0 | sed -e 's/ -I.*//g' | sed -e 's/-I//g'`)
### if test -f $glib_include/glib/gwin32.h; then
### if [ grep ftruncate $glib_include/glib/gwin32.h | grep -q define ]; then
### ac_msg_result(failed)
### set(hashmark '#')
### ac_msg_error([Your version of gwin32.h is broken and will cause compilation errors when building mono. Please fix it by deleting the line: '$hashmark define ftruncate...' from '$glib_include/glib/gwin32.h' then re-run configure.])
### fi
### fi
### ac_msg_result(ok)
###fi
# Enable support for fast thread-local storage
# Some systems have broken support, so we allow to disable it.
set(tls __thread CACHE STRING "Select Thread Local Storage implementation. Possible values are '__thread_' and 'pthread' (defaults to __thread)")
set(with_tls ${tls})
# Enable support for using sigaltstack for SIGSEGV and stack overflow handling
# This does not work on some platforms (bug #55253)
set(sigaltstack yes CACHE BOOL "Enable/disable support for sigaltstack (defaults to yes)")
set(with_sigaltstack ${sigaltstack})
set(static_mono yes CACHE BOOL "Link mono statically to libmono (faster) (defaults to yes)")
set(with_static_mono ${static_mono})
###
###if test "x$enable_static" = "xno"; then
### set(with_static_mono no)
###fi
###
###if test "x$platform_win32" = "xyes"; then
### # Boehm GC requires the runtime to be in its own dll
### set(with_static_mono no)
###fi
###
if(with_static_mono)
set(STATIC_MONO yes)
endif()
set(enable_mcs_build yes)
###AC_ARG_ENABLE(mcs-build, [ --disable-mcs-build disable the build of the mcs directory], set(try_mcs_build $enableval, enable_mcs_build=yes))
###
###set(xen_opt, [ --with-set(xen_opt yes,no Enable Xen-specific behaviour (defaults to yes)],[],[with_xen_opt=yes]))
###if test "x$with_xen_opt" = "xyes"; then
### ac_define(MONO_XEN_OPT, 1, [Xen-specific behaviour])
### set(ORIG_CFLAGS $CFLAGS)
### set(CFLAGS "$CFLAGS -mno-tls-direct-seg-refs")
### ac_msg_checking(for -mno-tls-direct-seg-refs option to gcc)
### AC_TRY_COMPILE([], [
### void main () { }
### ], [
### ac_msg_result(yes)
### # Pass it to libgc as well
### set(CFLAGS_FOR_LIBGC "$CFLAGS_FOR_LIBGC -mno-tls-direct-seg-refs")
### ], [
### ac_msg_result(no)
### set(CFLAGS $ORIG_CFLAGS)
### ])
###fi
set (quiet-build yes CACHE BOOL "Enable quiet runtime build (on by default)")
set(DISABLED_FEATURES none)
###AC_ARG_ENABLE(minimal, [ --enable-set(minimal LIST drop support for LIST subsystems.)
### LIST is a comma-separated list from: aot, profiler, decimal, pinvoke, debug,
### reflection_emit, reflection_emit_save, large_code, logging, com, ssa, generics, attach, jit, simd.],
###[
### for feature in `echo "$enable_minimal" | sed -e "s/,/ /g"`; do
### eval "mono_feature_disable_$set(feature 'yes'")
### AC_MSG_NOTICE([Disabled support for feature: $feature])
### done
### set(DISABLED_FEATURES $enable_minimal)
### set(disabled "Disabled: $enable_minimal")
###],[])
###
ac_define_unquoted(DISABLED_FEATURES "${DISABLED_FEATURES}" "String of disabled features")
###
###if test "x$mono_feature_disable_aot" = "xyes"; then
### AC_DEFINE(DISABLE_AOT_COMPILER, 1, [Disable AOT Compiler])
### AC_MSG_NOTICE([Disabled AOT compiler])
###fi
###
###if test "x$mono_feature_disable_profiler" = "xyes"; then
### ac_define(DISABLE_PROFILER, 1, [Disable default profiler support])
###fi
###AM_CONDITIONAL(DISABLE_PROFILER, test x$mono_feature_disable_profiler = xyes)
###
###if test "x$mono_feature_disable_decimal" = "xyes"; then
### ac_define(DISABLE_DECIMAL, 1, [Disable System.Decimal support])
###fi
###
###if test "x$mono_feature_disable_pinvoke" = "xyes"; then
### ac_define(DISABLE_PINVOKE, 1, [Disable P/Invoke support])
###fi
###
###if test "x$mono_feature_disable_debug" = "xyes"; then
### ac_define(DISABLE_DEBUG, 1, [Disable runtime debugging support])
###fi
###
###if test "x$mono_feature_disable_reflection_emit" = "xyes"; then
### ac_define(DISABLE_REFLECTION_EMIT, 1, [Disable reflection emit support])
### set(mono_feature_disable_reflection_emit_save yes)
###fi
###
###if test "x$mono_feature_disable_reflection_emit_save" = "xyes"; then
### ac_define(DISABLE_REFLECTION_EMIT_SAVE, 1, [Disable assembly saving support in reflection emit])
###fi
###
###if test "x$mono_feature_disable_large_code" = "xyes"; then
### ac_define(DISABLE_LARGE_CODE, 1, [Disable support for huge assemblies])
###fi
###
###if test "x$mono_feature_disable_logging" = "xyes"; then
### ac_define(DISABLE_LOGGING, 1, [Disable support debug logging])
###fi
###
###if test "x$mono_feature_disable_com" = "xyes"; then
### ac_define(DISABLE_COM, 1, [Disable COM support])
###fi
###
###if test "x$mono_feature_disable_ssa" = "xyes"; then
### ac_define(DISABLE_SSA, 1, [Disable advanced SSA JIT optimizations])
###fi
###
###if test "x$mono_feature_disable_generics" = "xyes"; then
### ac_define(DISABLE_GENERICS, 1, [Disable generics support])
###fi
###
###if test "x$mono_feature_disable_attach" = "xyes"; then
### ac_define(DISABLE_ATTACH, 1, [Disable agent attach support])
###fi
###
###if test "x$mono_feature_disable_jit" = "xyes"; then
### ac_define(DISABLE_JIT, 1, [Disable the JIT, only full-aot mode will be supported by the runtime.])
###fi
###
###AM_CONDITIONAL(DISABLE_JIT, test x$mono_feature_disable_jit = xyes)
###
###if test "x$mono_feature_disable_simd" = "xyes"; then
### ac_define(DISABLE_SIMD, 1, [Disable SIMD intrinsics related optimizations.])
###fi
###
###ac_msg_checking(for visibility __attribute__)
###AC_TRY_COMPILE([], [
### void __attribute__ ((visibility ("hidden"))) doit (void) {}
### void main () { doit (); }
###], [
### set(have_visibility_hidden yes)
### ac_msg_result(yes)
###], [
### set(have_visibility_hidden no)
### ac_msg_result(no)
###])
###
#
# libgc checks
#
set(gc_headers no)
set(gc included)
set(use_included_gc no)
set(libgc_configure_args)
set(gc_default included)
set(gc ${gc_default} CACHE STRING "The GC library to use (defaults to included)")
set(with_gc ${gc})
# FIXME:
set(enable_parallel_mark yes)
###AC_ARG_ENABLE(parallel-mark, [ --enable-parallel-mark Enables GC Parallel Marking], set(enable_parallel_mark $enableval, enable_parallel_mark=$parallel_mark))
###if test x$enable_parallel_mark = xyes; then
### set(libgc_configure_args "$libgc_configure_args --enable-parallel-mark")
###fi
###
set(LIBGC_CFLAGS )
set(LIBGC_LIBS )
set(LIBGC_STATIC_LIBS )
set(libgc_dir )
if (gc STREQUAL included)
set(found_boehm yes)
set(gc_headers yes)
set(use_included_gc yes)
set(libgc_dir libgc)
set(LIBGC_CFLAGS '-I${top_srcdir}/libgc/include')
set(LIBGC_LIBS '${top_builddir}/libgc/libmonogc.la')
set(LIBGC_STATIC_LIBS '${top_builddir}/libgc/libmonogc-static.la')
ac_define(HAVE_BOEHM_GC 1 "Have Boehm GC")
### AC_SUBST(HAVE_BOEHM_GC)
ac_define(HAVE_GC_H 1 "Have gc.h")
ac_define(USE_INCLUDED_LIBGC 1 "Use included libgc")
# The included libgc contains GCJ support
ac_define(HAVE_GC_GCJ_MALLOC 1 "Have GC_gcj_malloc")
ac_define(HAVE_GC_ENABLE 1 "Have GC_enable")
if (enable_parallel_mark STREQUAL yes)
ac_define_unquoted(USED_GC_NAME "Included Boehm (with typed GC and Parallel Mark)" "GC description")
else()
ac_define_unquoted(USED_GC_NAME "Included Boehm (with typed GC)" "GC description")
endif()
endif()
###case "x$gc" in
### xboehm|xbohem|xyes)
### ac_check_headers(gc.h gc/gc.h, set(gc_headers yes))
### AC_CHECK_LIB(gc, GC_malloc, set(found_boehm "yes",,$libdl))
###
### if test "x$found_boehm" != "xyes"; then
### ac_msg_error("GC requested but libgc not found! Install libgc or run configure with --with-set(gc none."))
### fi
### if test "x$gc_headers" != "xyes"; then
### ac_msg_error("GC requested but header files not found! You may need to install them by hand.")
### fi
###
### ac_define(HAVE_BOEHM_GC, 1, [Have Boehm GC])
### AC_SUBST(HAVE_BOEHM_GC)
### set(LIBGC_LIBS "-lgc $libdl")
### set(LIBGC_STATIC_LIBS "$LIBGC_LIBS")
###
### # ac_check_funcs does not work for some reason...
### AC_CHECK_LIB(gc, GC_gcj_malloc, set(found_gcj_malloc "yes",,$libdl))
### if test "x$found_gcj_malloc" = "xyes"; then
### ac_define(HAVE_GC_GCJ_MALLOC, 1, [Have GC_gcj_malloc])
### ac_define_unquoted(USED_GC_NAME, "System Boehm (with typed GC)", [GC description])
### else
### ac_define_unquoted(USED_GC_NAME, "System Boehm (no typed GC)", [GC description])
### fi
### AC_CHECK_LIB(gc, GC_enable, set(found_gc_enable "yes",,$libdl))
### if test "x$found_gc_enable" = "xyes"; then
### ac_define(HAVE_GC_ENABLE, 1, [Have 'GC_enable'])
### fi
### ;;
###
### xincluded)
### set(found_boehm yes)
### set(gc_headers yes)
### set(use_included_gc yes)
### set(libgc_dir libgc)
###
### set(LIBGC_CFLAGS '-I$(top_srcdir)/libgc/include')
### set(LIBGC_LIBS '$(top_builddir)/libgc/libmonogc.la')
### set(LIBGC_STATIC_LIBS '$(top_builddir)/libgc/libmonogc-static.la')
###
### ac_define(HAVE_BOEHM_GC, 1, [Have Boehm GC])
### AC_SUBST(HAVE_BOEHM_GC)
###
### ac_define(HAVE_GC_H, 1, [Have gc.h])
### ac_define(USE_INCLUDED_LIBGC, 1, [Use included libgc])
###
### # The included libgc contains GCJ support
### ac_define(HAVE_GC_GCJ_MALLOC, 1, [Have GC_gcj_malloc])
### ac_define(HAVE_GC_ENABLE, 1, [Have GC_enable])
### if test x$enable_parallel_mark = xyes; then
### ac_define_unquoted(USED_GC_NAME, "Included Boehm (with typed GC and Parallel Mark)", [GC description])
### else
### ac_define_unquoted(USED_GC_NAME, "Included Boehm (with typed GC)", [GC description])
### fi
### ;;
###
### xsgen)
### set(found_boehm no)
### set(gc_headers no)
### set(use_included_gc no)
### ac_define(HAVE_SGEN_GC,1,[Using the simple generational GC.])
### ac_define(HAVE_MOVING_COLLECTOR,1,[The GC can move objects.])
### ac_define(HAVE_WRITE_BARRIERS,1,[The GC needs write barriers.])
### ac_define_unquoted(USED_GC_NAME, "Simple generational", [GC description])
### ;;
###
### xnone)
### AC_MSG_WARN("Compiling mono without GC.")
### ac_define_unquoted(USED_GC_NAME, "none", [GC description])
### ac_define(HAVE_NULL_GC,1,[No GC support.])
### ;;
### *)
### ac_msg_error([Invalid argument to --with-gc.])
### ;;
###esac
###
###set(large-heap, [ --with-large-set(heap yes,no Enable support for GC heaps larger than 3GB (defaults to no)], [large_heap=$withval], [large_heap=no]))
###if test "x$large_heap" = "xyes"; then
### echo "FOO"
### set(CPPFLAGS "$CPPFLAGS -DLARGE_CONFIG")
###fi
###
###AM_CONDITIONAL(INCLUDED_LIBGC, test x$use_included_gc = xyes)
###AC_SUBST(LIBGC_CFLAGS)
###AC_SUBST(LIBGC_LIBS)