1 cmake_minimum_required(VERSION 2.6.4)
3 # FIXME: Sanitize the variables, no need for the duplicate am conditionals
4 # - It would be nice to rename 'CMakeFiles' to something like '.cmake'
5 # - It would be nice to have a per-target VERBOSE setting
6 # - or a way to change the setting name to 'V' and the output to CC <src>
7 # to be similar to the current build output
9 # We use lowercase commands as advocated by the kde cmake coding style
11 include(CheckIncludeFile)
12 include(CheckCSourceCompiles)
14 # Implementation of AC_CHECK_HEADERS
15 # In addition, it also records the list of variables in the variable
16 # 'autoheader_vars', and for each variable, a documentation string in the
18 function(ac_check_headers headers)
19 foreach (header ${ARGV})
20 string(TOUPPER ${header} header_var)
21 string(REPLACE "." "_" header_var ${header_var})
22 string(REPLACE "/" "_" header_var ${header_var})
23 set(header_var "HAVE_${header_var}")
24 check_include_file (${header} ${header_var})
25 set("${header_var}_doc" "Define to 1 if you have the <${header}> header file." PARENT_SCOPE)
27 set("${header_var}_defined" "1" PARENT_SCOPE)
29 set("${header_var}_val" "1" PARENT_SCOPE)
30 set (autoheader_vars ${autoheader_vars} ${header_var})
32 set (autoheader_vars ${autoheader_vars} PARENT_SCOPE)
35 function(ac_check_funcs funcs)
36 foreach (func ${ARGV})
37 string(TOUPPER ${func} var)
38 set(var "HAVE_${var}")
40 check_function_exists (${func} ${var})
41 set("${var}_doc" "Define to 1 if you have the '${func}' function." PARENT_SCOPE)
43 set("${var}_defined" "1" PARENT_SCOPE)
44 set(${var} yes PARENT_SCOPE)
46 set("${var}_val" "1" PARENT_SCOPE)
47 set (autoheader_vars ${autoheader_vars} ${var})
49 set (autoheader_vars ${autoheader_vars} PARENT_SCOPE)
52 # Implementation of AC_DEFINE
53 function(ac_define varname value doc)
54 if (${varname} MATCHES ",")
55 message(FATAL_ERROR ",")
57 set("${varname}_doc" ${doc} PARENT_SCOPE)
58 set("${varname}_defined" 1 PARENT_SCOPE)
59 set("${varname}_val" ${value} PARENT_SCOPE)
60 set (autoheader_vars ${autoheader_vars} ${varname} PARENT_SCOPE)
63 # Implementation of AC_DEFINE_UNQUOTED
64 function(ac_define_unquoted varname value doc)
65 if (${varname} MATCHES ",")
66 message(FATAL_ERROR ",")
68 set("${varname}_doc" ${doc} PARENT_SCOPE)
69 set("${varname}_defined" 1 PARENT_SCOPE)
70 set("${varname}_val" \"${value}\" PARENT_SCOPE)
71 set (autoheader_vars ${autoheader_vars} ${varname} PARENT_SCOPE)
74 Include(CheckTypeSize)
76 # Implementation of AC_CHECK_SIZEOF
77 # FIXME: cross compiling
78 function(ac_check_sizeof type)
79 check_type_size(${type} size)
80 if (HAVE_size STREQUAL "TRUE")
82 message(FATAL_ERROR "Type ${type} not found.")
84 string(TOUPPER "SIZEOF_${type}" varname)
85 string(REPLACE " " "_" varname ${varname})
86 string(REPLACE "*" "P" varname ${varname})
88 set("${varname}_doc" "The size of '${type}' as computed by sizeof" PARENT_SCOPE)
89 set("${varname}_defined" 1 PARENT_SCOPE)
90 set("${varname}_val" ${size} PARENT_SCOPE)
91 set (autoheader_vars ${autoheader_vars} ${varname} PARENT_SCOPE)
94 # Implementation of autoheader
95 function(AUTOHEADER filename variables)
96 set(tmp_filename "${filename}.tmp")
97 file(WRITE ${tmp_filename} "")
98 foreach(var ${${variables}})
99 file(APPEND ${tmp_filename} "\n/* ${${var}_doc} */\n")
100 if(${${var}_defined})
101 file(APPEND ${tmp_filename} "#define ${var} ${${var}_val}\n")
103 file(APPEND ${tmp_filename} "/* #undef ${var} */\n")
106 # FIXME: This is unix specific
107 execute_process(COMMAND diff ${filename} ${filename}.tmp RESULT_VARIABLE diff_res OUTPUT_QUIET)
108 if (NOT diff_res STREQUAL 0)
109 message(STATUS "generating ${filename}.")
110 execute_process(COMMAND mv ${filename}.tmp ${filename})
112 message(STATUS "${filename} is unchanged.")
116 function(ac_msg_checking)
117 message(STATUS "checking ${ARGV}...")
118 set(last_msg_checking ${ARGV} PARENT_SCOPE)
121 function(ac_msg_result)
122 message(STATUS "checking ${last_msg_checking}... ${ARGV}")
125 function(ac_msg_error)
126 message(FATAL_ERROR "${ARGV}")
129 function(ac_msg_warn)
130 message(STATUS "WARNING: ${ARGV}")
133 # The lines commented out using ### are the stuff from configure.in which still
134 # need to be ported to cmake
135 # The svn revision of the configure.in used is r132691
138 ac_define_unquoted(VERSION ${VERSION} "Version number of package")
143 #### In case of cygwin, override LN_S, irrespective of what it determines.
144 #### The build uses cygwin, but the actual runtime doesn't.
146 ###*cygwin* ) set(LN_S 'cp -p';;)
152 # These variables are the CPPFLAGS/CFLAGS passed to libgc's configure
153 # libgc should inherit the original CFLAGS/CPPFLAGS passed to configure, i.e. -O0
155 set(CPPFLAGS_FOR_LIBGC ${CPPFLAGS})
156 set(CFLAGS_FOR_LIBGC ${CFLAGS})
159 # These are the flags that need to be stored in the mono.pc file for
160 # compiling code that will embed Mono
162 set(libmono_cflags "")
163 set(libmono_ldflags "")
165 ###AC_SUBST(libmono_cflags)
166 ###AC_SUBST(libmono_ldflags)
168 #### Variable to have relocatable .pc files (lib, or lib64)
169 ###set(reloc_libdir `basename ${libdir}`)
170 ###AC_SUBST(reloc_libdir)
172 # if linker handles the version script
173 set(no_version_script no)
175 # Set to yes if Unix sockets cannot be created in an anonymous namespace
176 set(need_link_unlink no)
182 # Obtain the GNU style target
183 # From GetTargetTriple.cmake in LLVM
184 function( get_target_triple var )
186 set( ${var} "i686-pc-win32" PARENT_SCOPE )
188 set(config_guess config.guess)
189 execute_process(COMMAND sh ${config_guess}
190 RESULT_VARIABLE TT_RV
191 OUTPUT_VARIABLE TT_OUT
192 OUTPUT_STRIP_TRAILING_WHITESPACE)
193 if( NOT TT_RV EQUAL 0 )
194 message(FATAL_ERROR "Failed to execute ${config_guess}")
195 endif( NOT TT_RV EQUAL 0 )
196 set( ${var} ${TT_OUT} PARENT_SCOPE )
198 endfunction( get_target_triple var )
200 get_target_triple(host)
202 message(STATUS "checking host platform characteristics...")
204 set(libgc_threads no)
206 set(parallel_mark yes)
208 if(host MATCHES .*-.*-linux.*)
209 set(platform_win32 no)
210 set(CPPFLAGS "${CPPFLAGS} -DHAVE_CONFIG_H -DGC_LINUX_THREADS -D_GNU_SOURCE -D_REENTRANT -DUSE_MMAP -DUSE_MUNMAP")
211 set(libmono_cflags "-D_REENTRANT")
212 set(libmono_ldflags "-lpthread")
214 set(libgc_threads pthreads)
215 set(AOT_SUPPORTED "yes")
216 set(use_sigposix yes)
218 message(FATAL_ERROR "The cmake build doesn't yet support host '${host}'.")
221 #### Thread configuration inspired by sleepycat's db
223 ### *-*-mingw*|*-*-cygwin*)
224 ### set(platform_win32 yes)
225 ### ac_define(PLATFORM_WIN32,1,[Platform is Win32])
226 ### ac_define(DISABLE_PORTABILITY,1,[Disable the io-portability layer])
227 ### ac_define(PLATFORM_NO_SYMLINKS,1,[This platform does not support symlinks])
228 ### if test "x$cross_compiling" = "xno"; then
229 ### set(CC "gcc -mno-cygwin -g")
230 ### # So libgc configure gets -mno-cygwin
233 ### set(HOST_CC "gcc")
234 ### # Windows 2000 is required that includes Internet Explorer 5.01
235 ### set(CPPFLAGS "$CPPFLAGS -DWINVER=0x0500 -D_WIN32_WINNT=0x0500 -D_WIN32_IE=0x0501 -D_UNICODE -DUNICODE -DWIN32_THREADS -DFD_SETSIZE=1024")
236 ### set(libmono_cflags "-mno-cygwin -mms-bitfields -mwindows")
237 ### set(libmono_ldflags "-mno-cygwin -mms-bitfields -mwindows")
239 ### set(libgc_threads win32)
240 ### set(gc_default included)
241 ### set(with_sigaltstack no)
243 ### # This forces libgc to use the DllMain based thread registration code on win32
244 ### set(libgc_configure_args "$libgc_configure_args --enable-win32-dllmain=yes")
247 ### set(platform_win32 no)
248 ### set(CPPFLAGS "$CPPFLAGS -D_REENTRANT -DGC_NETBSD_THREADS -D_GNU_SOURCE")
249 ### set(libmono_cflags "-D_REENTRANT")
250 ### set(LDFLAGS "$LDFLAGS -pthread")
251 ### set(CPPFLAGS "$CPPFLAGS -DPLATFORM_BSD")
252 ### set(libmono_ldflags "-pthread")
253 ### set(need_link_unlink yes)
254 ### set(libdl "-ldl")
255 ### set(libgc_threads pthreads)
256 ### set(with_sigaltstack no)
257 ### set(use_sigposix yes)
260 ### set(platform_win32 no)
261 ### if test "x$PTHREAD_CFLAGS" = "x"; then
262 ### set(CPPFLAGS "$CPPFLAGS -DGC_FREEBSD_THREADS")
263 ### set(libmono_cflags )
265 ### set(CPPFLAGS "$CPPFLAGS $PTHREAD_CFLAGS -DGC_FREEBSD_THREADS")
266 ### set(libmono_cflags "$PTHREAD_CFLAGS")
268 ### if test "x$PTHREAD_LIBS" = "x"; then
269 ### set(LDFLAGS "$LDFLAGS -pthread")
270 ### set(libmono_ldflags "-pthread")
272 ### set(LDFLAGS "$LDFLAGS $PTHREAD_LIBS")
273 ### set(libmono_ldflags "$PTHREAD_LIBS")
275 ### set(CPPFLAGS "$CPPFLAGS -DPLATFORM_BSD")
276 ### set(need_link_unlink yes)
277 ### ac_define(PTHREAD_POINTER_ID, 1, [pthread is a pointer])
279 ### set(libgc_threads pthreads)
280 ### # This doesn't seem to work as of 7.0 on amd64
281 ### set(with_sigaltstack no)
282 #### TLS is only partially implemented on -CURRENT (compiler support
283 #### but NOT library support)
285 ### set(with_tls pthread)
286 ### set(use_sigposix yes)
289 ### set(platform_win32 no)
290 ### set(CPPFLAGS "$CPPFLAGS -D_THREAD_SAFE -DGC_FREEBSD_THREADS -DPLATFORM_BSD")
291 ### set(libmono_cflags "-D_THREAD_SAFE")
292 ### set(LDFLAGS "$LDFLAGS -pthread")
293 ### set(libmono_ldflags "-pthread")
294 ### set(need_link_unlink yes)
295 ### ac_define(PTHREAD_POINTER_ID)
297 ### set(libgc_threads pthreads)
298 ### set(use_sigposix yes)
301 ### set(platform_win32 no)
302 ### set(CPPFLAGS "$CPPFLAGS -DGC_LINUX_THREADS -D_GNU_SOURCE -D_REENTRANT -DUSE_MMAP -DUSE_MUNMAP")
303 ### set(libmono_cflags "-D_REENTRANT")
304 ### set(libmono_ldflags "-lpthread")
305 ### set(libdl "-ldl")
306 ### set(libgc_threads pthreads)
307 ### set(AOT_SUPPORTED "yes")
308 ### set(use_sigposix yes)
311 ### set(platform_win32 no)
312 ### set(CPPFLAGS "$CPPFLAGS -DGC_HPUX_THREADS -D_HPUX_SOURCE -D_XOPEN_SOURCE_EXTENDED -D_REENTRANT")
313 ### # +ESdbgasm only valid on bundled cc on RISC
314 ### # silently ignored for ia64
315 ### if test $GCC != "yes"; then
316 ### set(CFLAGS "$CFLAGS +ESdbgasm")
317 ### # Arrange for run-time dereferencing of null
318 ### # pointers to produce a SIGSEGV signal.
319 ### set(LDFLAGS "$LDFLAGS -z")
321 ### set(CFLAGS "$CFLAGS +ESdbgasm")
322 ### set(LDFLAGS "$LDFLAGS -z")
323 ### set(libmono_cflags "-D_REENTRANT")
324 ### set(libmono_ldflags "-lpthread")
325 ### set(libgc_threads pthreads)
326 ### set(need_link_unlink yes)
327 ### set(use_sigposix yes)
330 ### set(platform_win32 no)
331 ### set(CPPFLAGS "$CPPFLAGS -DGC_SOLARIS_THREADS -DGC_SOLARIS_PTHREADS -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS -DUSE_MMAP -DUSE_MUNMAP -DPLATFORM_SOLARIS")
332 ### set(need_link_unlink yes)
333 ### set(libmono_cflags "-D_REENTRANT")
334 ### set(libgc_threads pthreads)
335 ### # This doesn't seem to work on solaris/x86, but the configure test runs
336 ### set(with_tls pthread)
337 ### set(has_dtrace yes)
338 ### set(use_sigposix yes)
341 ### set(parallel_mark "Disabled_Currently_Hangs_On_MacOSX")
342 ### set(platform_win32 no)
343 ### set(platform_darwin yes)
344 ### set(CPPFLAGS "$CPPFLAGS -no-cpp-precomp -D_THREAD_SAFE -DGC_MACOSX_THREADS -DPLATFORM_MACOSX -DUSE_MMAP -DUSE_MUNMAP")
345 ### set(CPPFLAGS "$CPPFLAGS -DGetCurrentProcess=MonoGetCurrentProcess -DGetCurrentThread=MonoGetCurrentThread -DCreateEvent=MonoCreateEvent")
346 ### set(libmono_cflags "-D_THREAD_SAFE")
347 ### set(LDFLAGS "$LDFLAGS -pthread")
348 ### set(libmono_ldflags "-pthread")
349 ### set(need_link_unlink yes)
350 ### ac_define(PTHREAD_POINTER_ID)
351 ### ac_define(USE_MACH_SEMA, 1, [...])
352 ### set(no_version_script yes)
354 ### set(libgc_threads pthreads)
355 ### set(has_dtrace yes)
356 ### if test "x$cross_compiling" = "xyes"; then
357 ### set(has_broken_apple_cpp yes)
361 ### AC_MSG_WARN([*** Please add $host to configure.in checks!])
362 ### set(platform_win32 no)
363 ### set(libdl "-ldl")
368 ###if test x$need_link_unlink = xyes; then
369 ### ac_define(NEED_LINK_UNLINK, 1, [Define if Unix sockets cannot be created in an anonymous namespace])
374 set(PLATFORM_SIGPOSIX 1)
377 set(PLATFORM_WIN32 yes)
379 if(${target_os} MATCHES "*linux*")
380 set(PLATFORM_LINUX yes)
383 set(PLATFORM_DARWIN yes)
386 include(CMakeDetermineASM-ATTCompiler)
388 find_program(BISON NAMES bison)
390 if(BISON STREQUAL "BISON-NOTFOUND")
391 message(FATAL_ERROR "You need to install bison")
393 message(STATUS "Found bison: ${BISON}")
398 #### We should use AM_PROG_AS, but it's not available on automake/aclocal 1.4
399 ###: ${set(CCAS '$(CC)'})
400 #### Set ASFLAGS if not already set.
401 ###: ${set(CCASFLAGS '$(CFLAGS)'})
403 ###AC_SUBST(CCASFLAGS)
405 #### may require a specific autoconf version
406 #### AC_PROG_CC_FOR_BUILD
407 #### CC_FOR_BUILD not automatically detected
408 ###set(CC_FOR_BUILD $CC)
409 ###set(CFLAGS_FOR_BUILD $CFLAGS)
410 ###set(BUILD_EXEEXT )
411 ###if test "x$cross_compiling" = "xyes"; then
412 ### set(CC_FOR_BUILD cc)
413 ### set(CFLAGS_FOR_BUILD )
414 ### set(BUILD_EXEEXT "")
416 ###AC_SUBST(CC_FOR_BUILD)
417 ###AC_SUBST(CFLAGS_FOR_BUILD)
419 ###AC_SUBST(BUILD_EXEEXT)
421 ###AM_CONDITIONAL(CROSS_COMPILING, [test x$cross_compiling = xyes])
422 ###AM_CONDITIONAL(USE_BATCH_FILES, [test x$platform_win32 = xyes -a x$cross_compiling = xyes])
424 #### Set STDC_HEADERS
426 ###AC_LIBTOOL_WIN32_DLL
427 #### This causes monodis to not link correctly
428 ####AC_DISABLE_FAST_INSTALL
429 ###set(export_ldflags `(./libtool --config; echo eval echo \\$export_dynamic_flag_spec) | sh`)
430 ###AC_SUBST(export_ldflags)
432 #### Test whenever ld supports -version-script
435 ###if test "x$lt_cv_prog_gnu_ld" = "xno"; then
436 ### set(no_version_script yes)
439 ###AM_CONDITIONAL(NO_VERSION_SCRIPT, test x$no_version_script = xyes)
442 ac_check_headers(unistd.h stdint.h sys/types.h)
443 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)
444 ac_check_headers(sys/user.h sys/socket.h sys/ipc.h sys/sem.h sys/utsname.h alloca.h ucontext.h pwd.h)
446 ac_check_headers(zlib.h)
447 set(have_zlib ${HAVE_ZLIB_H})
450 check_c_source_compiles("
453 #if defined(ZLIB_VERNUM) && (ZLIB_VERNUM >= 0x1230)
456 #error No good zlib found
460 ac_msg_result("Using system zlib")
461 set(zlib_msg "system zlib")
464 ac_msg_result("Using embedded zlib")
466 set(zlib_msg "bundled zlib")
473 ac_define(HAVE_ZLIB 1 "Have system zlib")
475 # for mono/metadata/debug-symfile.c
476 ac_check_headers(elf.h)
479 ac_check_headers(poll.h)
480 ac_check_headers(sys/poll.h)
481 ac_check_headers(sys/wait.h)
482 ac_check_headers(grp.h)
483 ac_check_headers(syslog.h)
486 ac_check_headers(wchar.h)
487 ac_check_headers(ieeefp.h)
489 # Check whenever using GCC
490 include(CheckCSourceCompiles)
491 include(CheckCCompilerFlag)
492 check_c_source_compiles("
500 ac_msg_checking("for isinf")
502 check_c_source_compiles("
510 ac_define(HAVE_ISINF 1 "isinf available")
515 # not 64 bit clean in cross-compile
516 ac_check_sizeof("void *" 4)
521 set(WARN "-Wall -Wunused -Wmissing-prototypes -Wmissing-declarations -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wno-cast-qual -Wwrite-strings")
522 # The runtime code does not respect ANSI C strict aliasing rules
523 set(CFLAGS "${CFLAGS} -fno-strict-aliasing")
524 CHECK_C_COMPILER_FLAG("-Wdeclaration-after-statement" HAS_WDECL_AFTER_STATEMENT)
525 if(HAS_WDECL_AFTER_STATEMENT)
526 set(WARN "${WARN} -Wdeclaration-after-statement")
529 # The Sun Forte compiler complains about inline functions that access static variables
530 # so disable all inlining.
533 ### set(CFLAGS "$CFLAGS -Dinline=")
539 set(CFLAGS "${CFLAGS} -g ${WARN}")
541 ###set(CFLAGS_FOR_LIBGC "$CFLAGS_FOR_LIBGC -g")
544 set(srcdir ${CMAKE_SOURCE_DIR})
545 set(top_srcdir ${CMAKE_SOURCE_DIR})
546 set(abs_top_srcdir ${top_srcdir})
549 set(top_builddir ${CMAKE_BINARY_DIR})
551 # Where's the 'mcs' source tree?
552 if(EXISTS ${srcdir}/mcs)
559 # A sanity check to catch cases where the package was unpacked
560 # with an ancient tar program (Solaris)
562 ac_msg_checking("integrity of package")
563 if(EXISTS ${srcdir}/${mcsdir}/class/System.Runtime.Serialization.Formatters.Soap/System.Runtime.Serialization.Formatters.Soap/SoapTypeMapper.cs)
566 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")
567 ac_msg_error(${errorm})
570 set(mcs_topdir ${top_srcdir}/${mcsdir})
571 set(mcs_topdir_from_srcdir ${top_builddir}/${mcsdir})
573 ##### Maybe should also disable if mcsdir is invalid. Let's punt the issue for now.
574 ###AM_CONDITIONAL(BUILD_MCS, [test x$cross_compiling = xno && test x$enable_mcs_build != xno])
576 ###AC_SUBST([mcs_topdir])
577 ###AC_SUBST([mcs_topdir_from_srcdir])
579 #### Where's the 'olive' source tree?
580 ###if test -d $srcdir/olive; then
581 ### set(olivedir olive)
583 ### set(olivedir ../olive)
586 ###if test -d $srcdir/$olivedir; then
587 ###set(olive_topdir '$(top_srcdir)/'$olivedir)
590 #### gettext: prepare the translation directories.
591 #### we do not configure the full gettext, as we consume it dynamically from C#
594 ###if test "x$USE_NLS" = "xyes"; then
595 ### AC_CHECK_PROG(HAVE_MSGFMT, msgfmt,yes,no)
597 ### if test "x$HAVE_MSGFMT" = "xno"; then
598 ### ac_msg_error([msgfmt not found. You need to install the 'gettext' package, or pass --enable-set(nls no to configure.]))
602 set(libgdiplus installed CACHE STRING "=installed|sibling|<path> Override the libgdiplus used for System.Drawing tests (defaults to installed)")
603 set(with_libgdiplus ${libgdiplus})
605 ###case $with_libgdiplus in
606 ###no|installed) set(libgdiplus_loc ;;)
607 ###yes|sibling) set(libgdiplus_loc `cd ../libgdiplus && pwd`/src/libgdiplus.la ;;)
608 ###/*) set(libgdiplus_loc $with_libgdiplus ;;)
609 ###*) set(libgdiplus_loc `pwd`/$with_libgdiplus ;;)
611 ###AC_SUBST([libgdiplus_loc])
614 ###set(pkg_config_path )
615 ###set(crosspkgdir, [ --with-set(crosspkgdir /path/to/pkg-config/dir Change pkg-config dir to custom dir],)
616 ### if test x$with_crosspkgdir = "x"; then
617 ### if test -s $PKG_CONFIG_PATH; then
618 ### set(pkg_config_path $PKG_CONFIG_PATH)
621 ### set(pkg_config_path $with_crosspkgdir)
622 ### set(PKG_CONFIG_PATH $pkg_config_path)
623 ### export PKG_CONFIG_PATH
628 ### [ --with-set(glib embedded|system Choose glib API: system or embedded (default to system)],)
629 ### [], [set(with_glib system]))
634 include(FindPkgConfig)
637 set(with_glib "system")
638 if (${with_glib} STREQUAL "system")
639 ### if test "x$cross_compiling" = "xyes"; then
640 ### set(pkg_config_path "$PKG_CONFIG_PATH")
641 ### unset PKG_CONFIG_PATH
643 PKG_CHECK_MODULES(GLIB2 REQUIRED glib-2.0 gthread-2.0)
644 set(BUILD_GLIB_CFLAGS ${GLIB2_CFLAGS})
645 set(BUILD_GLIB_LIBS ${GLIB2_LIBRARIES})
647 ### if test "x$cross_compiling" = "xyes"; then
648 ### set(PKG_CONFIG_PATH $pkg_config_path)
649 ### export PKG_CONFIG_PATH
652 ## Versions of dependencies
653 set(GLIB_REQUIRED_VERSION 2.4.0)
655 PKG_CHECK_MODULES(GLIB2 REQUIRED glib-2.0 >= ${GLIB_REQUIRED_VERSION} gthread-2.0)
656 set(GLIB_CFLAGS ${GLIB2_CFLAGS})
657 set(GLIB_LIBS ${GLIB2_LIBRARIES})
658 PKG_CHECK_MODULES(GMODULE REQUIRED gmodule-2.0)
659 set(GMODULE_CFLAGS ${GMODULE_CFLAGS})
660 set(GMODULE_LIBS ${GMODULE_LIBRARIES})
663 ###case $with_glib in
665 ### set(GLIB_CFLAGS '-I$(top_srcdir)/eglib/src -I$(top_builddir)/eglib/src')
666 ### set(GLIB_LIBS '-L$(top_builddir)/eglib/src -leglib -lm')
667 ### set(BUILD_GLIB_CFLAGS "$GLIB_CFLAGS")
668 ### set(BUILD_GLIB_LIBS "$GLIB_LIBS")
669 ### set(GMODULE_CFLAGS "$GLIB_CFLAGS")
670 ### set(GMODULE_LIBS "$GLIB_LIBS")
671 ### set(eglib_dir eglib)
672 ### AC_CONFIG_SUBDIRS(eglib)
675 ### ac_msg_error([Invalid argument to --with-glib.])
677 if(with_glib STREQUAL "embedded")
681 ###AC_SUBST(GLIB_CFLAGS)
682 ###AC_SUBST(GLIB_LIBS)
683 ###AC_SUBST(GMODULE_CFLAGS)
684 ###AC_SUBST(GMODULE_LIBS)
685 ###AC_SUBST(BUILD_GLIB_CFLAGS)
686 ###AC_SUBST(BUILD_GLIB_LIBS)
687 ###AC_SUBST(eglib_dir)
689 ###if test x$cross_compiling$platform_win32 = xnoyes; then
690 ### ac_msg_checking(for cygwin glib2-dev package)
691 ### if [ cygcheck --f /usr/lib/libglib-2.0.dll.a | grep -q glib2-devel ]; then
692 ### ac_msg_result(found)
693 ### 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.])
695 ### ac_msg_result(not found, ok)
698 ### ac_msg_checking(for broken gwin32.h)
699 ### set(glib_include `$PKG_CONFIG --cflags-only-I glib-2.0 | sed -e 's/ -I.*//g' | sed -e 's/-I//g'`)
700 ### if test -f $glib_include/glib/gwin32.h; then
701 ### if [ grep ftruncate $glib_include/glib/gwin32.h | grep -q define ]; then
702 ### ac_msg_result(failed)
703 ### set(hashmark '#')
704 ### 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.])
707 ### ac_msg_result(ok)
710 # Enable support for fast thread-local storage
711 # Some systems have broken support, so we allow to disable it.
712 set(tls __thread CACHE STRING "Select Thread Local Storage implementation. Possible values are '__thread_' and 'pthread' (defaults to __thread)")
715 # Enable support for using sigaltstack for SIGSEGV and stack overflow handling
716 # This does not work on some platforms (bug #55253)
717 set(sigaltstack yes CACHE BOOL "Enable/disable support for sigaltstack (defaults to yes)")
718 set(with_sigaltstack ${sigaltstack})
720 set(static_mono yes CACHE BOOL "Link mono statically to libmono (faster) (defaults to yes)")
721 set(with_static_mono ${static_mono})
723 ###if test "x$enable_static" = "xno"; then
724 ### set(with_static_mono no)
727 ###if test "x$platform_win32" = "xyes"; then
728 ### # Boehm GC requires the runtime to be in its own dll
729 ### set(with_static_mono no)
735 set(enable_mcs_build yes)
736 ###AC_ARG_ENABLE(mcs-build, [ --disable-mcs-build disable the build of the mcs directory], set(try_mcs_build $enableval, enable_mcs_build=yes))
738 ###set(xen_opt, [ --with-set(xen_opt yes,no Enable Xen-specific behaviour (defaults to yes)],[],[with_xen_opt=yes]))
739 ###if test "x$with_xen_opt" = "xyes"; then
740 ### ac_define(MONO_XEN_OPT, 1, [Xen-specific behaviour])
741 ### set(ORIG_CFLAGS $CFLAGS)
742 ### set(CFLAGS "$CFLAGS -mno-tls-direct-seg-refs")
743 ### ac_msg_checking(for -mno-tls-direct-seg-refs option to gcc)
744 ### AC_TRY_COMPILE([], [
747 ### ac_msg_result(yes)
748 ### # Pass it to libgc as well
749 ### set(CFLAGS_FOR_LIBGC "$CFLAGS_FOR_LIBGC -mno-tls-direct-seg-refs")
751 ### ac_msg_result(no)
752 ### set(CFLAGS $ORIG_CFLAGS)
756 set (quiet-build yes CACHE BOOL "Enable quiet runtime build (on by default)")
758 set(DISABLED_FEATURES none)
760 ###AC_ARG_ENABLE(minimal, [ --enable-set(minimal LIST drop support for LIST subsystems.)
761 ### LIST is a comma-separated list from: aot, profiler, decimal, pinvoke, debug,
762 ### reflection_emit, reflection_emit_save, large_code, logging, com, ssa, generics, attach, jit, simd.],
764 ### for feature in `echo "$enable_minimal" | sed -e "s/,/ /g"`; do
765 ### eval "mono_feature_disable_$set(feature 'yes'")
766 ### AC_MSG_NOTICE([Disabled support for feature: $feature])
768 ### set(DISABLED_FEATURES $enable_minimal)
769 ### set(disabled "Disabled: $enable_minimal")
772 ac_define_unquoted(DISABLED_FEATURES "${DISABLED_FEATURES}" "String of disabled features")
774 ###if test "x$mono_feature_disable_aot" = "xyes"; then
775 ### ac_define(DISABLE_AOT, 1, [Disable AOT support])
778 ###if test "x$mono_feature_disable_profiler" = "xyes"; then
779 ### ac_define(DISABLE_PROFILER, 1, [Disable default profiler support])
781 ###AM_CONDITIONAL(DISABLE_PROFILER, test x$mono_feature_disable_profiler = xyes)
783 ###if test "x$mono_feature_disable_decimal" = "xyes"; then
784 ### ac_define(DISABLE_DECIMAL, 1, [Disable System.Decimal support])
787 ###if test "x$mono_feature_disable_pinvoke" = "xyes"; then
788 ### ac_define(DISABLE_PINVOKE, 1, [Disable P/Invoke support])
791 ###if test "x$mono_feature_disable_debug" = "xyes"; then
792 ### ac_define(DISABLE_DEBUG, 1, [Disable runtime debugging support])
795 ###if test "x$mono_feature_disable_reflection_emit" = "xyes"; then
796 ### ac_define(DISABLE_REFLECTION_EMIT, 1, [Disable reflection emit support])
797 ### set(mono_feature_disable_reflection_emit_save yes)
800 ###if test "x$mono_feature_disable_reflection_emit_save" = "xyes"; then
801 ### ac_define(DISABLE_REFLECTION_EMIT_SAVE, 1, [Disable assembly saving support in reflection emit])
804 ###if test "x$mono_feature_disable_large_code" = "xyes"; then
805 ### ac_define(DISABLE_LARGE_CODE, 1, [Disable support for huge assemblies])
808 ###if test "x$mono_feature_disable_logging" = "xyes"; then
809 ### ac_define(DISABLE_LOGGING, 1, [Disable support debug logging])
812 ###if test "x$mono_feature_disable_com" = "xyes"; then
813 ### ac_define(DISABLE_COM, 1, [Disable COM support])
816 ###if test "x$mono_feature_disable_ssa" = "xyes"; then
817 ### ac_define(DISABLE_SSA, 1, [Disable advanced SSA JIT optimizations])
820 ###if test "x$mono_feature_disable_generics" = "xyes"; then
821 ### ac_define(DISABLE_GENERICS, 1, [Disable generics support])
824 ###if test "x$mono_feature_disable_attach" = "xyes"; then
825 ### ac_define(DISABLE_ATTACH, 1, [Disable agent attach support])
828 ###if test "x$mono_feature_disable_jit" = "xyes"; then
829 ### ac_define(DISABLE_JIT, 1, [Disable the JIT, only full-aot mode will be supported by the runtime.])
832 ###AM_CONDITIONAL(DISABLE_JIT, test x$mono_feature_disable_jit = xyes)
834 ###if test "x$mono_feature_disable_simd" = "xyes"; then
835 ### ac_define(DISABLE_SIMD, 1, [Disable SIMD intrinsics related optimizations.])
838 ###ac_msg_checking(for visibility __attribute__)
839 ###AC_TRY_COMPILE([], [
840 ### void __attribute__ ((visibility ("hidden"))) doit (void) {}
841 ### void main () { doit (); }
843 ### set(have_visibility_hidden yes)
844 ### ac_msg_result(yes)
846 ### set(have_visibility_hidden no)
847 ### ac_msg_result(no)
857 set(use_included_gc no)
858 set(libgc_configure_args)
859 set(gc_default included)
861 set(gc ${gc_default} CACHE STRING "The GC library to use (defaults to included)")
865 set(enable_parallel_mark yes)
866 ###AC_ARG_ENABLE(parallel-mark, [ --enable-parallel-mark Enables GC Parallel Marking], set(enable_parallel_mark $enableval, enable_parallel_mark=$parallel_mark))
867 ###if test x$enable_parallel_mark = xyes; then
868 ### set(libgc_configure_args "$libgc_configure_args --enable-parallel-mark")
873 set(LIBGC_STATIC_LIBS )
876 if (gc STREQUAL included)
879 set(use_included_gc yes)
882 set(LIBGC_CFLAGS '-I${top_srcdir}/libgc/include')
883 set(LIBGC_LIBS '${top_builddir}/libgc/libmonogc.la')
884 set(LIBGC_STATIC_LIBS '${top_builddir}/libgc/libmonogc-static.la')
886 ac_define(HAVE_BOEHM_GC 1 "Have Boehm GC")
887 ### AC_SUBST(HAVE_BOEHM_GC)
889 ac_define(HAVE_GC_H 1 "Have gc.h")
890 ac_define(USE_INCLUDED_LIBGC 1 "Use included libgc")
892 # The included libgc contains GCJ support
893 ac_define(HAVE_GC_GCJ_MALLOC 1 "Have GC_gcj_malloc")
894 ac_define(HAVE_GC_ENABLE 1 "Have GC_enable")
895 if (enable_parallel_mark STREQUAL yes)
896 ac_define_unquoted(USED_GC_NAME "Included Boehm (with typed GC and Parallel Mark)" "GC description")
898 ac_define_unquoted(USED_GC_NAME "Included Boehm (with typed GC)" "GC description")
903 ### xboehm|xbohem|xyes)
904 ### ac_check_headers(gc.h gc/gc.h, set(gc_headers yes))
905 ### AC_CHECK_LIB(gc, GC_malloc, set(found_boehm "yes",,$libdl))
907 ### if test "x$found_boehm" != "xyes"; then
908 ### ac_msg_error("GC requested but libgc not found! Install libgc or run configure with --with-set(gc none."))
910 ### if test "x$gc_headers" != "xyes"; then
911 ### ac_msg_error("GC requested but header files not found! You may need to install them by hand.")
914 ### ac_define(HAVE_BOEHM_GC, 1, [Have Boehm GC])
915 ### AC_SUBST(HAVE_BOEHM_GC)
916 ### set(LIBGC_LIBS "-lgc $libdl")
917 ### set(LIBGC_STATIC_LIBS "$LIBGC_LIBS")
919 ### # ac_check_funcs does not work for some reason...
920 ### AC_CHECK_LIB(gc, GC_gcj_malloc, set(found_gcj_malloc "yes",,$libdl))
921 ### if test "x$found_gcj_malloc" = "xyes"; then
922 ### ac_define(HAVE_GC_GCJ_MALLOC, 1, [Have GC_gcj_malloc])
923 ### ac_define_unquoted(USED_GC_NAME, "System Boehm (with typed GC)", [GC description])
925 ### ac_define_unquoted(USED_GC_NAME, "System Boehm (no typed GC)", [GC description])
927 ### AC_CHECK_LIB(gc, GC_enable, set(found_gc_enable "yes",,$libdl))
928 ### if test "x$found_gc_enable" = "xyes"; then
929 ### ac_define(HAVE_GC_ENABLE, 1, [Have 'GC_enable'])
934 ### set(found_boehm yes)
935 ### set(gc_headers yes)
936 ### set(use_included_gc yes)
937 ### set(libgc_dir libgc)
939 ### set(LIBGC_CFLAGS '-I$(top_srcdir)/libgc/include')
940 ### set(LIBGC_LIBS '$(top_builddir)/libgc/libmonogc.la')
941 ### set(LIBGC_STATIC_LIBS '$(top_builddir)/libgc/libmonogc-static.la')
943 ### ac_define(HAVE_BOEHM_GC, 1, [Have Boehm GC])
944 ### AC_SUBST(HAVE_BOEHM_GC)
946 ### ac_define(HAVE_GC_H, 1, [Have gc.h])
947 ### ac_define(USE_INCLUDED_LIBGC, 1, [Use included libgc])
949 ### # The included libgc contains GCJ support
950 ### ac_define(HAVE_GC_GCJ_MALLOC, 1, [Have GC_gcj_malloc])
951 ### ac_define(HAVE_GC_ENABLE, 1, [Have GC_enable])
952 ### if test x$enable_parallel_mark = xyes; then
953 ### ac_define_unquoted(USED_GC_NAME, "Included Boehm (with typed GC and Parallel Mark)", [GC description])
955 ### ac_define_unquoted(USED_GC_NAME, "Included Boehm (with typed GC)", [GC description])
960 ### set(found_boehm no)
961 ### set(gc_headers no)
962 ### set(use_included_gc no)
963 ### ac_define(HAVE_SGEN_GC,1,[Using the simple generational GC.])
964 ### ac_define(HAVE_MOVING_COLLECTOR,1,[The GC can move objects.])
965 ### ac_define(HAVE_WRITE_BARRIERS,1,[The GC needs write barriers.])
966 ### ac_define_unquoted(USED_GC_NAME, "Simple generational", [GC description])
970 ### AC_MSG_WARN("Compiling mono without GC.")
971 ### ac_define_unquoted(USED_GC_NAME, "none", [GC description])
972 ### ac_define(HAVE_NULL_GC,1,[No GC support.])
975 ### ac_msg_error([Invalid argument to --with-gc.])
979 ###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]))
980 ###if test "x$large_heap" = "xyes"; then
982 ### set(CPPFLAGS "$CPPFLAGS -DLARGE_CONFIG")
985 ###AM_CONDITIONAL(INCLUDED_LIBGC, test x$use_included_gc = xyes)
986 ###AC_SUBST(LIBGC_CFLAGS)
987 ###AC_SUBST(LIBGC_LIBS)
988 ###AC_SUBST(LIBGC_STATIC_LIBS)
989 ###AC_SUBST(libgc_dir)
992 # End of libgc checks
995 include(CheckFunctionExists)
996 include(CheckLibraryExists)
998 if(platform_win32 STREQUAL no)
1001 # hires monotonic clock support
1002 ### AC_SEARCH_LIBS(clock_gettime, rt)
1004 check_function_exists (dlopen dlopen_found)
1008 check_library_exists (-ldl dlopen "" libdl_found)
1016 if (dl_support STREQUAL no)
1018 ### AC_MSG_WARN([No dynamic loading support available])
1020 set(LIBS ${LIBS} ${DL_LIB})
1021 ac_define(HAVE_DL_LOADER 1 "dlopen-based dynamic loader available")
1023 ### # from glib's configure.in
1024 ### AC_CACHE_CHECK([for preceeding underscore in symbols],
1025 ### mono_cv_uscore,[
1026 ### AC_TRY_RUN([#include <dlfcn.h>
1027 ### int mono_underscore_test (void) { return 42; }
1029 ### void *f1 = (void*)0, *f2 = (void*)0, *handle;
1030 ### handle = dlopen ((void*)0, 0);
1032 ### f1 = dlsym (handle, "mono_underscore_test");
1033 ### f2 = dlsym (handle, "_mono_underscore_test");
1034 ### } return (!f2 || f1);
1036 ### [set(mono_cv_uscore yes],)
1037 ### [set(mono_cv_uscore no],)
1040 ### if test "x$mono_cv_uscore" = "xyes"; then
1041 ### set(MONO_DL_NEED_USCORE 1)
1043 ### set(MONO_DL_NEED_USCORE 0)
1045 ### AC_SUBST(MONO_DL_NEED_USCORE)
1046 ### AC_CHECK_FUNC(dlerror)
1049 # ******************************************************************
1050 # *** Checks for the IKVM JNI interface library ***
1051 # ******************************************************************
1052 set(ikvm-native yes CACHE BOOL "Build the IKVM JNI interface library (defaults to yes)")
1053 set(with_ikvm_native ${ikvm-native})
1054 set(ikvm_native_dir )
1055 if(with_ikvm_native)
1056 set(ikvm_native_dir ikvm-native)
1057 set(jdk_headers_found "IKVM Native")
1060 ac_check_headers(execinfo.h)
1062 ac_check_funcs(getgrgid_r)
1063 ac_check_funcs(getgrnam_r)
1064 ac_check_funcs(getpwnam_r)
1065 ac_check_funcs(getpwuid_r)
1066 ac_check_funcs(getresuid)
1067 ac_check_funcs(setresuid)
1068 ac_check_funcs(kqueue)
1069 ac_check_funcs(backtrace_symbols)
1070 ac_check_funcs(mkstemp)
1071 ac_check_funcs(mmap)
1072 ac_check_funcs(madvise)
1073 ac_check_funcs(getrusage)
1074 ac_check_funcs(getpriority)
1075 ac_check_funcs(setpriority)
1077 ac_check_funcs(sched_setaffinity)
1079 # ******************************************************************
1080 # *** Check for large file support ***
1081 # *** (If we were using autoconf 2.50 we'd use AC_SYS_LARGEFILE) ***
1082 # ******************************************************************
1084 # Check that off_t can represent 2**63 - 1 correctly, working around
1085 # potential compiler bugs. Defines LARGE_FILE_SUPPORT, adds $1 to
1086 # CPPFLAGS and sets $large_offt to yes if the test succeeds
1087 ### set(large_offt no)
1088 ### AC_DEFUN([LARGE_FILES], [
1089 ### set(large_CPPFLAGS $CPPFLAGS)
1090 ### set(CPPFLAGS "$CPPFLAGS $1")
1092 ### #include <sys/types.h>
1094 ### #define BIG_OFF_T (((off_t)1<<62)-1+((off_t)1<<62))
1096 ### int main(void) {
1097 ### int set(big_off_t ((BIG_OFF_T%2147483629==721) &&)
1098 ### (BIG_OFF_T%set(2147483647 =1));)
1106 ### ac_msg_result(ok)
1107 ### ac_define(HAVE_LARGE_FILE_SUPPORT, 1, [Have large file support])
1108 ### set(large_CPPFLAGS "$large_CPPFLAGS $1")
1109 ### set(large_offt yes)
1111 ### ac_msg_result(no)
1113 ### set(CPPFLAGS $large_CPPFLAGS)
1116 ### ac_msg_checking(if off_t is 64 bits wide)
1118 ### if test $large_offt = no; then
1119 ### ac_msg_checking(if set(_FILE_OFFSET_BITS 64 gives 64 bit off_t))
1120 ### LARGE_FILES("-set(D_FILE_OFFSET_BITS 64"))
1122 ### if test $large_offt = no; then
1123 ### AC_MSG_WARN([No 64 bit file size support available])
1126 # *****************************
1127 # *** Checks for libsocket ***
1128 # *****************************
1129 ### AC_CHECK_LIB(socket, socket, set(LIBS "$LIBS -lsocket"))
1131 # *******************************
1132 # *** Checks for MSG_NOSIGNAL ***
1133 # *******************************
1134 ### ac_msg_checking(for MSG_NOSIGNAL)
1135 ### AC_TRY_COMPILE([#include <sys/socket.h>], [
1136 ### int f = MSG_NOSIGNAL;
1138 ### # Yes, we have it...
1139 ### ac_msg_result(yes)
1140 ### ac_define(HAVE_MSG_NOSIGNAL, 1, [Have MSG_NOSIGNAL])
1142 ### # We'll have to use signals
1143 ### ac_msg_result(no)
1146 # *****************************
1147 # *** Checks for SOL_IP ***
1148 # *****************************
1149 ### ac_msg_checking(for SOL_IP)
1150 ### AC_TRY_COMPILE([#include <netdb.h>], [
1151 ### int level = SOL_IP;
1153 ### # Yes, we have it...
1154 ### ac_msg_result(yes)
1155 ### ac_define(HAVE_SOL_IP, 1, [Have SOL_IP])
1157 ### # We'll have to use getprotobyname
1158 ### ac_msg_result(no)
1161 # *****************************
1162 # *** Checks for SOL_IPV6 ***
1163 # *****************************
1164 ### ac_msg_checking(for SOL_IPV6)
1165 ### AC_TRY_COMPILE([#include <netdb.h>], [
1166 ### int level = SOL_IPV6;
1168 ### # Yes, we have it...
1169 ### ac_msg_result(yes)
1170 ### ac_define(HAVE_SOL_IPV6, 1, [Have SOL_IPV6])
1172 ### # We'll have to use getprotobyname
1173 ### ac_msg_result(no)
1176 # *****************************
1177 # *** Checks for SOL_TCP ***
1178 # *****************************
1179 ### ac_msg_checking(for SOL_TCP)
1180 ### AC_TRY_COMPILE([#include <netdb.h>], [
1181 ### int level = SOL_TCP;
1183 ### # Yes, we have it...
1184 ### ac_msg_result(yes)
1185 ### ac_define(HAVE_SOL_TCP, 1, [Have SOL_TCP])
1187 ### # We'll have to use getprotobyname
1188 ### ac_msg_result(no)
1191 # *****************************
1192 # *** Checks for IP_PKTINFO ***
1193 # *****************************
1194 ### ac_msg_checking(for IP_PKTINFO)
1195 ### AC_TRY_COMPILE([#include <netdb.h>], [
1196 ### int level = IP_PKTINFO;
1198 ### # Yes, we have it...
1199 ### ac_msg_result(yes)
1200 ### ac_define(HAVE_IP_PKTINFO, 1, [Have IP_PKTINFO])
1202 ### ac_msg_result(no)
1205 # *****************************
1206 # *** Checks for IPV6_PKTINFO ***
1207 # *****************************
1208 ### ac_msg_checking(for IPV6_PKTINFO)
1209 ### AC_TRY_COMPILE([#include <netdb.h>], [
1210 ### int level = IPV6_PKTINFO;
1212 ### # Yes, we have it...
1213 ### ac_msg_result(yes)
1214 ### ac_define(HAVE_IPV6_PKTINFO, 1, [Have IPV6_PKTINFO])
1216 ### ac_msg_result(no)
1219 # **********************************
1220 # *** Checks for IP_DONTFRAGMENT ***
1221 # **********************************
1222 ### ac_msg_checking(for IP_DONTFRAGMENT)
1223 ### AC_TRY_COMPILE([#include <netdb.h>], [
1224 ### int level = IP_DONTFRAGMENT;
1226 ### # Yes, we have it...
1227 ### ac_msg_result(yes)
1228 ### ac_define(HAVE_IP_DONTFRAGMENT, 1, [Have IP_DONTFRAGMENT])
1230 ### ac_msg_result(no)
1233 # **********************************
1234 # *** Checks for IP_MTU_DISCOVER ***
1235 # **********************************
1236 ### ac_msg_checking(for IP_MTU_DISCOVER)
1237 ### AC_TRY_COMPILE([#include <netdb.h>], [
1238 ### int level = IP_MTU_DISCOVER;
1240 ### # Yes, we have it...
1241 ### ac_msg_result(yes)
1242 ### ac_define(HAVE_IP_MTU_DISCOVER, 1, [Have IP_MTU_DISCOVER])
1244 ### ac_msg_result(no)
1247 ### # *********************************
1248 # *** Check for struct ip_mreqn ***
1249 # *********************************
1250 ### ac_msg_checking(for struct ip_mreqn)
1251 ### AC_TRY_COMPILE([#include <netinet/in.h>], [
1252 ### struct ip_mreqn mreq;
1253 ### mreq.imr_address.s_addr = 0;
1255 ### # Yes, we have it...
1256 ### ac_msg_result(yes)
1257 ### ac_define(HAVE_STRUCT_IP_MREQN, 1, [Have struct ip_mreqn])
1259 ### # We'll just have to try and use struct ip_mreq
1260 ### ac_msg_result(no)
1261 ### ac_msg_checking(for struct ip_mreq)
1262 ### AC_TRY_COMPILE([#include <netinet/in.h>], [
1263 ### struct ip_mreq mreq;
1264 ### mreq.imr_interface.s_addr = 0;
1266 ### # Yes, we have it...
1267 ### ac_msg_result(yes)
1268 ### ac_define(HAVE_STRUCT_IP_MREQ, 1, [Have struct ip_mreq])
1270 ### # No multicast support
1271 ### ac_msg_result(no)
1275 # **********************************
1276 # *** Check for gethostbyname2_r ***
1277 # **********************************
1278 ### ac_msg_checking(for gethostbyname2_r)
1279 ### AC_TRY_LINK([#include <netdb.h>], [
1280 ### gethostbyname2_r(NULL,0,NULL,NULL,0,NULL,NULL);
1282 ### # Yes, we have it...
1283 ### ac_msg_result(yes)
1284 ### ac_define(HAVE_GETHOSTBYNAME2_R, 1, [Have gethostbyname2_r])
1286 ### ac_msg_result(no)
1289 # *****************************
1290 # *** Checks for libnsl ***
1291 # *****************************
1292 ### AC_CHECK_FUNC(gethostbyaddr, , AC_CHECK_LIB(nsl, gethostbyaddr, set(LIBS "$LIBS -lnsl")))
1294 ac_check_funcs(inet_pton inet_aton)
1296 # ***********************************************
1297 # *** Checks for size of sockaddr_un.sun_path ***
1298 # ***********************************************
1300 ac_msg_checking("size of sockaddr_un.sun_path")
1302 FILE(WRITE "${CMAKE_BINARY_DIR}/${CMAKE_FILES_DIRECTORY}/CMakeTmp/conftest.c"
1304 #include <sys/types.h>
1309 struct sockaddr_un sock_un;
1310 printf(\"%d\\n\", sizeof(sock_un.sun_path));
1315 TRY_RUN(run_res run_compiled
1317 ${CMAKE_BINARY_DIR}/${CMAKE_FILES_DIRECTORY}/CMakeTmp/conftest.c
1318 RUN_OUTPUT_VARIABLE output)
1320 set(mono_cv_sizeof_sunpath 0)
1322 if (run_res EQUAL 0)
1323 string(REGEX MATCH "[0-9]+" mono_cv_sizeof_sunpath ${output})
1327 ac_msg_result(${mono_cv_sizeof_sunpath})
1328 ac_define(MONO_SIZEOF_SUNPATH ${mono_cv_sizeof_sunpath} "Sizeof sock_un.sun_path")
1330 # *************************************
1331 # *** Checks for zero length arrays ***
1332 # *************************************
1333 ### ac_msg_checking(whether $CC supports zero length arrays)
1334 ### AC_TRY_COMPILE([
1340 ### ac_msg_result(yes)
1341 ### ac_define_unquoted(MONO_ZERO_ARRAY_LENGTH, 0, [Length of zero length arrays])
1343 ### ac_msg_result(no)
1344 ### ac_define_unquoted(MONO_ZERO_ARRAY_LENGTH, 1, [Length of zero length arrays])
1347 # *****************************
1348 # *** Checks for libxnet ***
1349 # *****************************
1350 ### case "${host}" in
1352 ### ac_msg_checking(for Solaris XPG4 support)
1353 ### if test -f /usr/lib/libxnet.so; then
1354 ### set(CPPFLAGS "$CPPFLAGS -D_XOPEN_SOURCE=500")
1355 ### set(CPPFLAGS "$CPPFLAGS -D__EXTENSIONS__")
1356 ### set(CPPFLAGS "$CPPFLAGS -D_XOPEN_SOURCE_EXTENDED=1")
1357 ### set(LIBS "$LIBS -lxnet")
1358 ### ac_msg_result(yes)
1360 ### ac_msg_result(no)
1363 ### if test "$GCC" = "yes"; then
1364 ### set(CFLAGS "$CFLAGS -Wno-char-subscripts")
1369 # *****************************
1370 # *** Checks for libpthread ***
1371 # *****************************
1372 # on FreeBSD -STABLE, the pthreads functions all reside in libc_r
1373 # and libpthread does not exist
1375 ### case "${host}" in
1377 ### AC_CHECK_LIB(pthread, main, set(LIBS "$LIBS -pthread"))
1380 ### AC_CHECK_LIB(pthread, main, set(LIBS "$LIBS -lpthread"))
1383 ac_check_headers(pthread.h)
1384 ### ac_check_funcs(pthread_mutex_timedlock)
1385 ### ac_check_funcs(pthread_getattr_np pthread_attr_get_np)
1386 ### ac_msg_checking(for PTHREAD_MUTEX_RECURSIVE)
1387 ### AC_TRY_COMPILE([ #include <pthread.h>], [
1388 ### pthread_mutexattr_t attr;
1389 ### pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
1391 ### ac_msg_result(ok)
1393 ### ac_msg_result(no)
1394 ### AC_MSG_WARN(Using mono_mutex_t for recursive mutexes)
1395 ### ac_define(USE_MONO_MUTEX, 1, [Use mono_mutex_t])
1397 ### ac_check_funcs(pthread_attr_setstacksize)
1398 ### ac_check_funcs(pthread_attr_getstack)
1399 ### ac_check_funcs(pthread_get_stacksize_np pthread_get_stackaddr_np)
1401 # ***********************************
1402 # *** Checks for working __thread ***
1403 # ***********************************
1404 ### ac_msg_checking(for working __thread)
1405 ### if test "x$with_tls" != "x__thread"; then
1406 ### ac_msg_result(disabled)
1409 ### #include <pthread.h>
1411 ### static int res1, res2;
1413 ### void thread_main (void *arg)
1418 ### res1 = (i == arg);
1420 ### res2 = (i == arg);
1424 ### pthread_t t1, t2;
1428 ### pthread_create (&t1, NULL, thread_main, 1);
1429 ### pthread_create (&t2, NULL, thread_main, 2);
1431 ### pthread_join (t1, NULL);
1432 ### pthread_join (t2, NULL);
1434 ### return !(res1 + res2 == 2);
1437 ### ac_msg_result(yes)
1439 ### ac_msg_result(no)
1440 ### set(with_tls pthread)
1444 # **************************************
1445 # *** Checks for working sigaltstack ***
1446 # **************************************
1447 ### ac_msg_checking(for working sigaltstack)
1448 ### if test "x$with_sigaltstack" != "xyes"; then
1449 ### ac_msg_result(disabled)
1452 ### #include <stdio.h>
1453 ### #include <stdlib.h>
1454 ### #include <unistd.h>
1455 ### #include <signal.h>
1456 ### #include <pthread.h>
1457 ### #include <sys/wait.h>
1458 ### #if defined(__FreeBSD__) || defined(__NetBSD__)
1459 ### #define SA_STACK SA_ONSTACK
1462 ### sigsegv_signal_handler (int _dummy, siginfo_t *info, void *context)
1468 ### loop (void *ignored)
1470 ### char *ptr = NULL;
1479 ### struct sigaction sa;
1480 ### struct sigaltstack sas;
1482 ### pthread_attr_t attr;
1484 ### sa.sa_sigaction = sigsegv_signal_handler;
1485 ### sigemptyset (&sa.sa_mask);
1486 ### sa.sa_flags = SA_SIGINFO | SA_ONSTACK;
1487 ### if (sigaction (SIGSEGV, &sa, NULL) == -1) {
1488 ### perror ("sigaction");
1492 ### sas.ss_sp = malloc (SIGSTKSZ);
1493 ### sas.ss_size = SIGSTKSZ;
1494 ### sas.ss_flags = 0;
1495 ### if (sigaltstack (&sas, NULL) == -1) {
1496 ### perror ("sigaltstack");
1500 ### pthread_attr_init (&attr);
1501 ### if (pthread_create(&id, &attr, loop, &attr) != 0) {
1502 ### printf ("pthread_create\n");
1517 ### if (son == -1) {
1526 ### for (i = 0; i < 3; ++i) {
1528 ### waitpid (son, &status, WNOHANG);
1529 ### if (WIFEXITED (status) && WEXITSTATUS (status) == 0)
1533 ### kill (son, SIGKILL);
1538 ### ac_msg_result(yes)
1539 ### ac_define(HAVE_WORKING_SIGALTSTACK, 1, [Have a working sigaltstack])
1541 ### set(with_sigaltstack no)
1542 ### ac_msg_result(no)
1546 # ********************************
1547 # *** Checks for semaphore lib ***
1548 # ********************************
1549 # 'Real Time' functions on Solaris
1550 # posix4 on Solaris 2.6
1551 # pthread (first!) on Linux
1552 ### AC_SEARCH_LIBS(sem_init, pthread rt posix4)
1553 check_library_exists(pthread shm_open "" HAVE_SHM_OPEN1)
1557 check_library_exists(rt shm_open "" HAVE_SHM_OPEN2)
1559 set(LIBS ${LIBS} -lrt)
1560 set(CMAKE_REQUIRED_LIBRARIES rt)
1561 ac_check_funcs(shm_open)
1562 set(CMAKE_REQUIRED_LIBRARIES)
1568 # ********************************
1569 # *** Checks for timezone stuff **
1570 # ********************************
1571 ### AC_CACHE_CHECK(for tm_gmtoff in struct tm, ac_cv_struct_tm_gmtoff,
1572 ### AC_TRY_COMPILE([
1573 ### #include <time.h>
1576 ### tm.tm_gmtoff = 1;
1577 ### ], set(ac_cv_struct_tm_gmtoff yes, ac_cv_struct_tm_gmtoff=no)))
1578 ### if test $ac_cv_struct_tm_gmtoff = yes; then
1579 ### ac_define(HAVE_TM_GMTOFF, 1, [Have tm_gmtoff])
1581 ### AC_CACHE_CHECK(for timezone variable, ac_cv_var_timezone,
1582 ### AC_TRY_COMPILE([
1583 ### #include <time.h>
1586 ### ], set(ac_cv_var_timezone yes, ac_cv_var_timezone=no)))
1587 ### if test $ac_cv_var_timezone = yes; then
1588 ### ac_define(HAVE_TIMEZONE, 1, [Have timezone variable])
1590 ### AC_ERROR(unable to find a way to determine timezone)
1594 # *********************************
1595 # *** Checks for math functions ***
1596 # *********************************
1597 set(LIBS ${LIBS} -lm)
1598 ### if test "x$has_broken_apple_cpp" != "xyes"; then
1599 ### ac_check_funcs(finite, , ac_msg_checking(for finite in math.h)
1600 ### AC_TRY_LINK([#include <math.h>],
1601 ### [ finite(0.0); ],
1602 ### ac_define(HAVE_FINITE, 1, [Have finite]) ac_msg_result(yes),
1603 ### ac_msg_result(no)))
1605 ### ac_check_funcs(isfinite, , ac_msg_checking(for isfinite in math.h)
1606 ### AC_TRY_LINK([#include <math.h>],
1607 ### [ isfinite(0.0); ],
1608 ### ac_define(HAVE_ISFINITE, 1, [Have isfinite]) ac_msg_result(yes),
1609 ### ac_msg_result(no)))
1611 # ****************************************************************
1612 # *** Checks for working poll() (macosx defines it but doesn't ***
1613 # *** have it in the library (duh)) ***
1614 # ****************************************************************
1615 ### ac_check_funcs(poll)
1617 # *************************
1618 # *** Check for signbit ***
1619 # *************************
1620 ### ac_msg_checking(for signbit)
1621 ### AC_TRY_LINK([#include <math.h>], [
1622 ### int s = signbit(1.0);
1624 ### ac_msg_result(yes)
1625 ### ac_define(HAVE_SIGNBIT, 1, [Have signbit])
1627 ### ac_msg_result(no)
1630 # **********************************
1632 # **********************************
1633 ac_check_headers(sys/epoll.h)
1635 ### ac_check_funcs(epoll_ctl, [set(haveepoll yes], ))
1636 ### if test "x$haveepoll" = "xyes" -a "x$ac_cv_header_sys_epoll_h" = "xyes" ; then
1637 ### ac_define(HAVE_EPOLL, 1, [epoll supported])
1640 # ******************************
1641 # *** Checks for SIOCGIFCONF ***
1642 # ******************************
1643 ac_check_headers(sys/ioctl.h)
1644 ac_check_headers(net/if.h)
1645 ### ac_msg_checking(for ifreq)
1646 ### AC_TRY_COMPILE([
1647 ### #include <stdio.h>
1648 ### #include <sys/ioctl.h>
1649 ### #include <net/if.h>
1651 ### struct ifconf ifc;
1652 ### struct ifreq *ifr;
1654 ### ifc.ifc_len = 0;
1655 ### ifc.ifc_buf = NULL;
1656 ### x = (void *) &ifr->ifr_addr;
1658 ### ac_msg_result(yes)
1659 ### ac_define(HAVE_SIOCGIFCONF, 1, [Can get interface list])
1661 ### ac_msg_result(no)
1663 # **********************************
1664 # *** Checks for sin_len ***
1665 # **********************************
1666 ### ac_msg_checking(for sockaddr_in.sin_len)
1667 ### AC_TRY_COMPILE([
1668 ### #include <netinet/in.h>
1670 ### struct sockaddr_in saddr;
1671 ### saddr.sin_len = sizeof (saddr);
1673 ### ac_msg_result(yes)
1674 ### ac_define(HAVE_SOCKADDR_IN_SIN_LEN, 1, [sockaddr_in has sin_len])
1676 ### ac_msg_result(no)
1678 # **********************************
1679 # *** Checks for sin6_len ***
1680 # **********************************
1681 ### ac_msg_checking(for sockaddr_in6.sin6_len)
1682 ### AC_TRY_COMPILE([
1683 ### #include <netinet/in.h>
1685 ### struct sockaddr_in6 saddr6;
1686 ### saddr6.sin6_len = sizeof (saddr6);
1688 ### ac_msg_result(yes)
1689 ### ac_define(HAVE_SOCKADDR_IN6_SIN_LEN, 1, [sockaddr_in6 has sin6_len])
1691 ### ac_msg_result(no)
1693 # **********************************
1694 # *** Checks for MonoPosixHelper ***
1695 # **********************************
1696 ac_check_headers(checklist.h)
1697 ac_check_headers(fstab.h)
1698 ac_check_headers(attr/xattr.h)
1699 ac_check_headers(sys/extattr.h)
1700 ac_check_headers(sys/sendfile.h)
1701 ac_check_headers(sys/statvfs.h)
1702 ac_check_headers(sys/statfs.h)
1703 ac_check_headers(sys/vfstab.h)
1704 ac_check_headers(sys/xattr.h)
1705 ac_check_headers(sys/mman.h)
1706 ac_check_headers(sys/param.h)
1707 ac_check_headers(sys/mount.h)
1708 ### ac_check_funcs(getdomainname)
1709 ### ac_check_funcs(setdomainname)
1710 ### ac_check_funcs(fgetgrent)
1711 ### ac_check_funcs(fgetpwent)
1712 ### ac_check_funcs(fgetpwent)
1713 ### ac_check_funcs(getfsstat)
1714 ### ac_check_funcs(lutimes)
1715 ### ac_check_funcs(mremap)
1716 ### ac_check_funcs(remap_file_pages)
1717 ### ac_check_funcs(posix_fadvise)
1718 ### ac_check_funcs(posix_fallocate)
1719 ### ac_check_funcs(posix_madvise)
1720 ### ac_check_funcs(vsnprintf)
1721 ### ac_check_funcs(sendfile)
1722 ### ac_check_funcs(sethostid)
1723 ### ac_check_funcs(statfs)
1724 ### ac_check_funcs(fstatfs)
1725 ### ac_check_funcs(statvfs)
1726 ### ac_check_funcs(fstatvfs)
1727 ### ac_check_funcs(stime)
1728 ### ac_check_funcs(strerror_r)
1729 ### ac_check_funcs(ttyname_r)
1730 ac_check_sizeof(size_t)
1731 ### AC_CHECK_TYPES([blksize_t], [ac_define(HAVE_BLKSIZE_T)], ,
1732 ### [#include <sys/types.h>
1733 ### #include <sys/stat.h>
1734 ### #include <unistd.h>])
1735 ### AC_CHECK_TYPES([blkcnt_t], [ac_define(HAVE_BLKCNT_T)], ,
1736 ### [#include <sys/types.h>
1737 ### #include <sys/stat.h>
1738 ### #include <unistd.h>])
1739 ### AC_CHECK_TYPES([suseconds_t], [ac_define(HAVE_SUSECONDS_T)], ,
1740 ### [#include <sys/time.h>])
1741 ### AC_CHECK_TYPES([struct flock], [ac_define(HAVE_STRUCT_FLOCK)], ,
1742 ### [#include <unistd.h>
1743 ### #include <fcntl.h>])
1744 ### AC_CHECK_TYPES([struct pollfd], [ac_define(HAVE_STRUCT_POLLFD)], ,
1745 ### [#include <sys/poll.h>])
1746 ### AC_CHECK_TYPES([struct stat], [ac_define(HAVE_STRUCT_STAT)], ,
1747 ### [#include <sys/types.h>
1748 ### #include <sys/stat.h>
1749 ### #include <unistd.h>])
1750 ### AC_CHECK_TYPES([struct timespec], [ac_define(HAVE_STRUCT_TIMESPEC)], ,
1751 ### [#include <time.h>])
1752 ### AC_CHECK_TYPES([struct timeval], [ac_define(HAVE_STRUCT_TIMEVAL)], ,
1753 ### [#include <sys/time.h>
1754 ### #include <sys/types.h>
1755 ### #include <utime.h>])
1756 ### AC_CHECK_TYPES([struct timezone], [ac_define(HAVE_STRUCT_TIMEZONE)], ,
1757 ### [#include <sys/time.h>])
1758 ### AC_CHECK_TYPES([struct utimbuf], [ac_define(HAVE_STRUCT_UTIMBUF)], ,
1759 ### [#include <sys/types.h>
1760 ### #include <utime.h>])
1761 ### AC_CHECK_MEMBERS(
1762 ### [struct dirent.d_off, struct dirent.d_reclen, struct dirent.d_type],,,
1763 ### [#include <sys/types.h>
1764 ### #include <dirent.h>])
1766 # Favour xattr through glibc, but use libattr if we have to
1767 ### AC_CHECK_FUNC(lsetxattr, ,
1768 ### AC_CHECK_LIB(attr, lsetxattr, set(XATTR_LIB "-lattr",))
1770 ### AC_SUBST(XATTR_LIB)
1772 # kinfo_proc.kp_proc works on darwin but fails on other simil-bsds
1773 ### AC_CHECK_MEMBERS(
1774 ### [struct kinfo_proc.kp_proc],,,
1775 ### [#include <sys/types.h>
1776 ### #include <sys/sysctl.h>
1777 ### #include <sys/proc.h>
1780 # *********************************
1781 # *** Checks for Windows compilation ***
1782 # *********************************
1783 ac_check_headers(sys/time.h)
1784 ac_check_headers(sys/param.h)
1785 ac_check_headers(dirent.h)
1787 # *********************************
1788 # *** Check for Console 2.0 I/O ***
1789 # *********************************
1790 ac_check_headers(curses.h)
1791 ac_check_headers(term.h)
1792 ### ac_check_headers([term.h], [], [],
1793 ### [#if HAVE_CURSES_H
1794 ### #include <curses.h>
1797 ac_check_headers(termios.h)
1799 # * This is provided in io-layer, but on windows it's only available
1801 ### ac_define(HAVE_GETPROCESSID, 1, [Define if GetProcessId is available])
1803 ### set(jdk_headers_found no)
1804 ### AC_CHECK_LIB(ws2_32, main, set(LIBS "$LIBS -lws2_32", AC_ERROR(bad mingw install?)))
1805 ### AC_CHECK_LIB(psapi, main, set(LIBS "$LIBS -lpsapi", AC_ERROR(bad mingw install?)))
1806 ### AC_CHECK_LIB(ole32, main, set(LIBS "$LIBS -lole32", AC_ERROR(bad mingw install?)))
1807 ### AC_CHECK_LIB(winmm, main, set(LIBS "$LIBS -lwinmm", AC_ERROR(bad mingw install?)))
1808 ### AC_CHECK_LIB(oleaut32, main, set(LIBS "$LIBS -loleaut32", AC_ERROR(bad mingw install?)))
1809 ### AC_CHECK_LIB(advapi32, main, set(LIBS "$LIBS -ladvapi32", AC_ERROR(bad mingw install?)))
1810 ### AC_CHECK_LIB(version, main, set(LIBS "$LIBS -lversion", AC_ERROR(bad mingw install?)))
1812 # *********************************
1813 # *** Check for struct ip_mreqn ***
1814 # *********************************
1815 ### ac_msg_checking(for struct ip_mreqn)
1816 ### AC_TRY_COMPILE([#include <ws2tcpip.h>], [
1817 ### struct ip_mreqn mreq;
1818 ### mreq.imr_address.s_addr = 0;
1820 ### # Yes, we have it...
1821 ### ac_msg_result(yes)
1822 ### ac_define(HAVE_STRUCT_IP_MREQN)
1824 ### # We'll just have to try and use struct ip_mreq
1825 ### ac_msg_result(no)
1826 ### ac_msg_checking(for struct ip_mreq)
1827 ### AC_TRY_COMPILE([#include <ws2tcpip.h>], [
1828 ### struct ip_mreq mreq;
1829 ### mreq.imr_interface.s_addr = 0;
1831 ### # Yes, we have it...
1832 ### ac_msg_result(yes)
1833 ### ac_define(HAVE_STRUCT_IP_MREQ)
1835 ### # No multicast support
1836 ### ac_msg_result(no)
1839 ### ac_check_funcs(GetProcessId)
1845 ac_msg_checking("for socklen_t")
1846 check_c_source_compiles("
1847 #include <sys/types.h>
1848 #include <sys/socket.h>
1853 ac_define(HAVE_SOCKLEN_T 1 "Have socklen_t")
1859 ###ac_msg_checking(for array element initalizer support)
1860 ###AC_TRY_COMPILE([#include <sys/socket.h>], [
1861 ### const int array[] = {[1] = 2,};
1863 # Yes, we have it...
1864 ### ac_msg_result(yes)
1865 ### ac_define(HAVE_ARRAY_ELEM_INIT,1,[Supports C99 array initialization])
1867 # We'll have to use signals
1868 ### ac_msg_result(no)
1871 ac_check_funcs(trunc)
1873 ac_msg_checking("for trunc in math.h")
1874 # Simply calling trunc (0.0) is no good since gcc will optimize the call away
1876 check_c_source_compiles("
1879 static void *p = &trunc;
1883 ac_define(HAVE_TRUNC 1 "")
1890 ###if test "x$ac_cv_truncl" != "xyes"; then
1891 ### AC_CHECK_LIB(sunmath, aintl, [ ac_define(HAVE_AINTL, 1, [Has the 'aintl' function]) set(LIBS "$LIBS -lsunmath"]))
1894 ac_check_funcs(round)
1895 ac_check_funcs(rint)
1897 # ****************************
1898 # *** Look for /dev/random ***
1899 # ****************************
1901 ###ac_msg_checking([if usage of random device is requested])
1902 ###AC_ARG_ENABLE(dev-random,
1903 ###[ --disable-dev-random disable the use of the random device (enabled by default)],
1904 ###set(try_dev_random $enableval, try_dev_random=yes))
1906 ###ac_msg_result($try_dev_random)
1908 ###case "{$target}" in
1910 ### set(NAME_DEV_RANDOM "/dev/srandom")
1913 # Win32 does not have /dev/random, they have their own method...
1915 ### *-*-mingw*|*-*-cygwin*)
1916 ### set(ac_cv_have_dev_random no)
1919 # Everywhere else, it's /dev/random
1922 ### set(NAME_DEV_RANDOM "/dev/random")
1926 ###ac_define_unquoted(NAME_DEV_RANDOM, "$NAME_DEV_RANDOM", [Name of /dev/random])
1928 # Now check if the device actually exists
1930 ###if test "x$try_dev_random" = "xyes"; then
1931 ### AC_CACHE_CHECK(for random device, ac_cv_have_dev_random,
1932 ### [if test -r "$NAME_DEV_RANDOM" ; then
1933 ### set(ac_cv_have_dev_random yes; else ac_cv_have_dev_random=no; fi]))
1934 ### if test "x$ac_cv_have_dev_random" = "xyes"; then
1935 ### ac_define(HAVE_CRYPT_RNG, 1, [Have /dev/random])
1938 ### ac_msg_checking(for random device)
1939 ### set(ac_cv_have_dev_random no)
1940 ### ac_msg_result(has been disabled)
1943 ###if test "x$platform_win32" = "xyes"; then
1944 ### ac_define(HAVE_CRYPT_RNG)
1947 ###if test "x$ac_cv_have_dev_random" = "xno" \
1948 ### && test "x$platform_win32" = "xno"; then
1951 ###*** A system-provided entropy source was not found on this system.
1952 ###*** Because of this, the System.Security.Cryptography random number generator
1953 ###*** will throw a NotImplemented exception.
1955 ###*** If you are seeing this message, and you know your system DOES have an
1956 ###*** entropy collection in place, please contact <crichton@gimp.org> and
1957 ###*** provide information about the system and how to access the random device.
1959 ###*** Otherwise you can install either egd or prngd and set the environment
1960 ###*** variable MONO_EGD_SOCKET to point to the daemon's socket to use that.
1964 ###ac_msg_checking([if inter-process shared handles are requested])
1965 ###AC_ARG_ENABLE(shared-handles, [ --disable-shared-handles disable inter-process shared handles], set(try_shared_handles $enableval, try_shared_handles=yes))
1966 ###ac_msg_result($try_shared_handles)
1967 ###if test "x$try_shared_handles" != "xyes"; then
1968 ### ac_define(DISABLE_SHARED_HANDLES, 1, [Disable inter-process shared handles])
1969 ### AC_SUBST(DISABLE_SHARED_HANDLES)
1972 ###if test x$gc = xsgen; then
1973 ### if test x$with_tls != x__thread; then
1974 ### ac_msg_error([The SGEN garbage collector depends on a working __thread implementation, and either --with-set(thread pthread was passed to configure, or the configure test for __thread failed.]))
1978 ###AC_ARG_ENABLE(nunit-tests, [ --enable-nunit-tests Run the nunit tests of the class library on 'make check'])
1979 ###AM_CONDITIONAL(ENABLE_NUNIT_TESTS, [test x$enable_nunit_tests = xyes])
1981 ac_msg_checking("if big-arrays are to be enabled")
1982 set(big-arrays no CACHE STRING "Enable the allocation and indexing of arrays greater than Int32.MaxValue]")
1983 set(enable_big_arrays ${big-arrays})
1984 ###if test "x$enable_big_arrays" = "xyes" ; then
1985 ### if test "x$ac_cv_sizeof_void_p" = "x8"; then
1986 ### ac_define(MONO_BIG_ARRAYS,1,[Enable the allocation and indexing of arrays greater than Int32.MaxValue])
1988 ### ac_msg_error([The allocation and indexing of arrays greater than Int32.MaxValue is not supported on this platform.])
1991 ###ac_msg_result($enable_big_arrays)
1997 set(dtrace ${has_dtrace} CACHE BOOL "Enable DTrace probes")
1998 set(enable_dtrace ${dtrace})
2000 ###if test "x$enable_dtrace" = "xyes"; then
2001 ### if test "x$has_dtrace" = "xno"; then
2002 ### ac_msg_error([DTrace probes are not supported on this platform.])
2004 ### AC_PATH_PROG(DTRACE, [dtrace], [no], [$PATH:/usr/sbin])
2005 ### if test "x$DTRACE" = "xno"; then
2006 ### ac_msg_result([dtrace utility not found, dtrace support disabled.])
2007 ### set(enable_dtrace no)
2012 ###if test "x$enable_dtrace" = "xyes"; then
2013 ### ac_define(ENABLE_DTRACE, 1, [Enable DTrace probes])
2014 ### set(DTRACEFLAGS )
2015 ### if test "x$ac_cv_sizeof_void_p" = "x8"; then
2017 ### powerpc-*-darwin*)
2018 ### set(DTRACEFLAGS "-arch ppc64")
2021 ### set(DTRACEFLAGS "-arch x86_64")
2024 ### set(DTRACEFLAGS -64)
2029 ### powerpc-*-darwin*)
2030 ### set(DTRACEFLAGS "-arch ppc")
2033 ### set(DTRACEFLAGS "-arch i386")
2036 ### set(DTRACEFLAGS -32)
2040 ### AC_SUBST(DTRACEFLAGS)
2043 ### set(dtrace_g yes)
2046 ### ac_check_headers([sys/sdt.h])
2048 ###AM_CONDITIONAL(ENABLE_DTRACE, [test x$enable_dtrace = xyes])
2049 ###AM_CONDITIONAL(DTRACE_G_REQUIRED, [test x$dtrace_g = xyes])
2055 set(llvm no CACHE BOOL "Enable the experimental LLVM back-end")
2056 set(enable_llvm ${llvm})
2058 ###if test "x$enable_llvm" = "xyes"; then
2059 ### AC_PATH_PROG(LLVM_CONFIG, llvm-config, no)
2060 ### if test "x$LLVM_CONFIG" = "xno"; then
2061 ### ac_msg_error([llvm-config not found.])
2064 ### set(LLVM_CXXFLAGS `$LLVM_CONFIG --cflags`)
2065 ### set(LLVM_LDFLAGS `$LLVM_CONFIG --ldflags`)
2066 ### set(LLVM_LIBS `$LLVM_CONFIG --libs core engine`)
2067 ### set(LLVM_LIBS "$LLVM_LDFLAGS $LLVM_LIBS -lstdc++")
2069 ### AC_SUBST(LLVM_CXXFLAGS)
2070 ### AC_SUBST(LLVM_LIBS)
2071 ### ac_define(ENABLE_LLVM, 1, [Enable the LLVM back end])
2075 set(ENABLE_LLVM yes)
2079 # Architecture-specific checks
2081 set(TARGET "unknown")
2082 set(ACCESS_UNALIGNED "yes")
2084 set(JIT_SUPPORTED no)
2085 set(INTERP_SUPPORTED no)
2086 set(LIBC "libc.so.6")
2087 set(INTL "libc.so.6")
2088 set(SQLITE "libsqlite.so.0")
2089 set(SQLITE3 "libsqlite3.so.0")
2090 set(X11 "libX11.so")
2092 set(sizeof_register "SIZEOF_VOID_P")
2094 set(jit_wanted false)
2095 set(interp_wanted false)
2097 if(host MATCHES "(x86_64-.*-.*)|(amd64-.*-.*)")
2099 set(arch_target amd64)
2100 set(JIT_SUPPORTED yes)
2101 set(jit_wanted true)
2102 elseif(host MATCHES "arm.*-linux.*")
2104 set(arch_target arm)
2105 set(ACCESS_UNALIGNED no)
2106 set(JIT_SUPPORTED yes)
2107 set(jit_wanted true)
2109 message(FATAL_ERROR "Host ${host} not yet supported by the cmake build.")
2112 # FIXME: Define the others as well
2113 if (${TARGET} STREQUAL "X86")
2114 ac_define(TARGET_X86 1 [...])
2115 elseif (${TARGET} STREQUAL "AMD64")
2116 ac_define(TARGET_AMD64 1 [...])
2117 elseif (${TARGET} STREQUAL "ARM")
2118 ac_define(TARGET_ARM 1 [...])
2122 # mips-sgi-irix5.* | mips-sgi-irix6.*)
2124 # set(ACCESS_UNALIGNED "no")
2127 ### set(TARGET MIPS;)
2128 ### set(arch_target mips;)
2129 ### set(ACCESS_UNALIGNED "no")
2130 ### set(JIT_SUPPORTED yes)
2131 ### set(jit_wanted true)
2133 ### ac_msg_checking(for mips n32)
2134 ### AC_TRY_COMPILE([], [
2136 ### #if _MIPS_SIM != _ABIN32
2137 ### #error Not mips n32
2141 ### ac_msg_result(yes)
2142 ### set(sizeof_register 8)
2144 ### ac_msg_result(no)
2148 ### set(TARGET X86;)
2149 ### set(arch_target x86;)
2150 ### set(JIT_SUPPORTED yes)
2151 ### set(jit_wanted true)
2152 ### case $host_os in
2154 ### set(LIBC "libc.so")
2155 ### set(INTL "libintl.so")
2156 ### if test "x$ac_cv_sizeof_void_p" = "x8"; then
2157 ### set(TARGET AMD64)
2158 ### set(arch_target amd64)
2161 ### # On solaris 10 x86, gcc prints a warning saying 'visibility attribute not supported on this configuration; ignored', but linking fails. A test case:
2162 ### # int astruct __attribute__ ((visibility ("hidden")));
2165 ### # void *p = &astruct;
2167 ### # gcc -fPIC --shared -o libfoo.so foo.c
2169 ### # foo.c:6: warning: visibility attribute not supported in this configuration; ignored
2170 ### # ld: fatal: relocation error: R_386_GOTOFF: file /var/tmp//ccxYR96k.o: symbol astruct: relocation must bind locally
2171 ### set(have_visibility_hidden no)
2176 ### set(TARGET IA64)
2177 ### set(arch_target ia64)
2178 ### set(ACCESS_UNALIGNED "no")
2179 ### set(JIT_SUPPORTED yes)
2180 ### set(jit_wanted true)
2181 ### set(LIBC "libc.so.6.1")
2182 ### set(INTL "libc.so.6.1")
2183 ### AC_CHECK_LIB(unwind, _U_dyn_register, [], [ac_msg_error(library libunwind not found)])
2184 ### set(libmono_ldflags "-lunwind")
2187 ### if test "x$ac_cv_sizeof_void_p" = "x8"; then
2188 ### set(TARGET SPARC64)
2190 ### set(TARGET SPARC)
2192 ### set(arch_target sparc;)
2193 ### set(JIT_SUPPORTED yes)
2194 ### set(ACCESS_UNALIGNED "no")
2195 ### case $host_os in
2198 ### set(LIBC "libc.so")
2199 ### set(INTL "libintl.so")
2201 ### set(jit_wanted true)
2202 ### if test x"$GCC" = xyes; then
2203 ### # We don't support v8 cpus
2204 ### set(CFLAGS "$CFLAGS -Wno-cast-align -mcpu=v9")
2206 ### if test x"$AR" = xfalse; then
2207 ### ac_msg_error([The required utility 'ar' is not found in your PATH. Usually it can be found in /usr/ccs/bin.])
2210 ### alpha*-*-linux* | alpha*-*-osf*)
2211 ### set(TARGET ALPHA;)
2212 ### set(ACCESS_UNALIGNED "no")
2213 ### set(JIT_SUPPORTED yes)
2214 ### set(jit_wanted true)
2215 ### set(arch_target alpha;)
2216 ### set(CFLAGS "$CFLAGS -mieee -O0")
2217 ### case $host_os in
2219 ### set(LIBC "libc.so.6.1")
2220 ### set(INTL "libc.so.6.1")
2223 ### *-*-mingw*|*-*-cygwin*)
2224 ### # When this is enabled, it leads to very strange crashes at runtime (gcc-3.4.4)
2225 ### set(have_visibility_hidden no)
2226 ### set(INTL "intl")
2228 ### hppa2.0w-hp-hpux11.00 | hppa64-hp-hpux11.00)
2229 ### set(TARGET HPPA;)
2230 ### set(arch_target hppa; )
2231 ### set(LIBC "libc.sl")
2232 ### set(ACCESS_UNALIGNED "no")
2233 ### set(INTERP_SUPPORTED yes)
2234 ### set(interp_wanted true)
2237 ### set(TARGET HPPA;)
2238 ### ac_define(MONO_ARCH_REGPARMS,1,[Architecture uses registers for Parameters])
2239 ### set(arch_target hppa; )
2240 ### set(ACCESS_UNALIGNED "no")
2241 ### set(JIT_SUPPORTED yes)
2242 ### set(jit_wanted true)
2244 ### macppc-*-openbsd* | powerpc*-*-linux* | powerpc-*-openbsd* | \
2245 ### powerpc-*-sysv* | powerpc-*-darwin* | powerpc-*-netbsd* )
2246 ### if test "x$ac_cv_sizeof_void_p" = "x8"; then
2247 ### set(TARGET POWERPC64;)
2248 ### set(CPPFLAGS "$CPPFLAGS -D__mono_ppc__ -D__mono_ppc64__")
2249 ### set(CFLAGS "$CFLAGS -mminimal-toc")
2251 ### set(TARGET POWERPC;)
2252 ### set(CPPFLAGS "$CPPFLAGS -D__mono_ppc__")
2254 ### ac_define(MONO_ARCH_REGPARMS,1,[Architecture uses registers for Parameters])
2255 ### set(arch_target ppc;)
2256 ### set(JIT_SUPPORTED yes)
2257 ### set(jit_wanted true)
2260 ### set(TARGET ARM;)
2261 ### set(arch_target arm;)
2262 ### set(ACCESS_UNALIGNED "no")
2263 ### set(JIT_SUPPORTED yes)
2264 ### set(CPPFLAGS "$CPPFLAGS -DARM_FPU_NONE=1")
2265 ### set(jit_wanted true)
2268 ### set(TARGET S390;)
2269 ### ac_define(MONO_ARCH_REGPARMS,1,[Architecture uses registers for Parameters])
2270 ### set(arch_target s390;)
2271 ### set(ACCESS_UNALIGNED "no")
2272 ### set(JIT_SUPPORTED yes)
2273 ### set(jit_wanted true)
2274 ### # Required CFLAGS for s390[x]. USE_STRING_INLINES is automatic with gcc 4.1
2275 ### set(CFLAGS "$CFLAGS -mbackchain -D__USE_STRING_INLINES")
2278 ### set(TARGET S390x;)
2279 ### ac_define(MONO_ARCH_REGPARMS,1,[Architecture uses registers for Parameters])
2280 ### set(arch_target s390x;)
2281 ### set(ACCESS_UNALIGNED "no")
2282 ### set(JIT_SUPPORTED yes)
2283 ### set(jit_wanted true)
2284 ### set(CFLAGS "$CFLAGS -mbackchain -D__USE_STRING_INLINES")
2288 if (${sizeof_register} STREQUAL "4")
2289 ac_define(SIZEOF_REGISTER 4 "size of machine integer registers")
2290 elseif (${sizeof_register} STREQUAL "8")
2291 ac_define(SIZEOF_REGISTER 8 "size of machine integer registers")
2293 ac_define(SIZEOF_REGISTER SIZEOF_VOID_P "size of machine integer registers")
2296 ###if (${have_visibility_hidden" = "xyes"; then
2297 ### ac_define(HAVE_VISIBILITY_HIDDEN, 1, [Support for the visibility ("hidden") attribute])
2300 ###set(jit, [ --with-set(jit yes,no If you want to build scripts that default to the JIT (defaults to no)],[)
2301 ### if test x$withval = xyes; then
2302 ### set(jit_wanted true)
2304 ### set(jit_wanted false)
2308 ###set(interp, [ --with-set(interp yes,no If you want to build scripts that default to the interpreter (defaults to no)],[)
2309 ### if test x$withval = xyes; then
2310 ### set(interp_wanted true)
2312 ### set(interp_wanted false)
2320 set(jit_status "Building and using the JIT")
2323 set(jit_status "Building the JIT, defaulting to the interpreter")
2325 message(FATAL_ERROR "No JIT or interpreter support available or selected.")
2330 set(jit_status "interpreter")
2332 message(FATAL_ERROR "No JIT or interpreter support available or selected.")
2335 set(USE_JIT ${USEJIT})
2337 set(libsuffix ".so")
2341 ### set(libsuffix ".dylib")
2342 ### set(LIBC "libc.dylib")
2343 ### set(INTL "libintl.dylib")
2344 ### set(SQLITE "libsqlite.0.dylib")
2345 ### set(SQLITE3 "libsqlite3.0.dylib")
2346 ### set(X11 "libX11.dylib")
2349 ### set(LIBC "libc.so.12")
2350 ### set(INTL "libintl.so.0")
2353 ### set(LIBC "libc.so")
2354 ### set(INTL "libintl.so")
2357 ### set(LIBC "libc.so")
2358 ### set(INTL "libintl.so")
2362 ### ac_msg_checking(for the soname of libX11.so)
2363 ### for i in $x_libraries /usr/lib /usr/lib64; do
2364 ### for r in 4 5 6; do
2365 ### if test -f $i/libX11.so.$r; then
2366 ### set(X11 libX11.so.$r)
2367 ### ac_msg_result($X11)
2372 ### if (${X11" = "xlibX11.so"; then
2373 ### AC_MSG_WARN([Could not find X development libs. Do you have the -devel package installed? WinForms may not work...]);
2379 ###AC_SUBST(libsuffix)
2381 ac_check_headers(valgrind/memcheck.h)
2382 if(${TARGET} STREQUAL "AMD64" OR ${TARGET} STREQUAL "X86")
2383 if(with_tls STREQUAL __thread)
2385 # On some linux distributions, TLS works in executables, but linking
2386 # against a shared library containing TLS fails with:
2387 # undefined reference to `__tls_get_addr'
2389 ### rm -f conftest.c conftest.so conftest
2390 ### echo "static __thread int foo; void main () { foo = 5; }" > conftest.c
2391 ### $CC -fPIC --shared -o conftest.so conftest.c > /dev/null 2>&1
2392 ### $CC -o conftest conftest.so > /dev/null 2>&1
2393 ### if test ! -f conftest; then
2394 ### AC_MSG_WARN([Disabling usage of __thread.]);
2395 ### set(with_tls pthread)
2397 ### rm -f conftest.c conftest.so conftest
2401 set(mono_debugger_supported no)
2402 if(${TARGET} STREQUAL "AMD64" OR ${TARGET} STREQUAL "X86")
2404 if (host MATCHES ".*-.*-.*linux.*")
2405 set(mono_debugger_supported yes)
2410 ac_msg_checking("if the Mono Debugger is supported on this platform")
2411 if(mono_debugger_supported)
2412 ac_define(MONO_DEBUGGER_SUPPORTED 1 "The Mono Debugger is supported on this platform")
2414 ac_msg_result(${mono_debugger_supported})
2415 if(mono_debugger_supported)
2416 set(MONO_DEBUGGER_SUPPORTED yes)
2419 if (with_tls STREQUAL "__thread")
2420 ac_define(HAVE_KW_THREAD 1 "Have __thread keyword")
2421 ac_define(USE_COMPILER_TLS 1 "Use __thread for TLS access")
2422 # Pass the information to libgc
2423 ### set(CPPFLAGS "$CPPFLAGS -DUSE_COMPILER_TLS")
2424 ### ac_msg_checking(if the tls_model attribute is supported)
2425 ### AC_TRY_COMPILE([static __thread int foo __attribute__((tls_model("initial-exec")));], [
2427 ### ac_msg_result(yes)
2428 ### ac_define(HAVE_TLS_MODEL_ATTR, 1, [tld_model available])
2430 ### ac_msg_result(no)
2436 # ******************************************
2437 # *** Check to see what FPU is available ***
2438 # ******************************************
2439 # FIXME: Don't do this if cross-compiling
2440 if(${TARGET} STREQUAL "ARM")
2441 ac_msg_checking("which FPU to use")
2442 set(CMAKE_REQUIRED_FLAGS "-mfloat-abi=softfp -mfpu=vfp")
2443 set(compiles_fpu_vfp)
2444 check_c_source_compiles("
2446 __asm__ (\"faddd d7, d6, d7\");
2449 set(compiles_fpu_fpa)
2450 set(cmake_required_flags)
2451 check_c_source_compiles("
2453 __asm__ (\"ldfd f0, [r0]\");
2456 if(compiles_fpu_vfp)
2458 elseif(compiles_fpu_fpa)
2463 ac_msg_result(${fpu})
2464 set(CPPFLAGS "${CPPFLAGS} -DARM_FPU_${fpu}=1")
2468 if(${TARGET} STREQUAL "unknown")
2469 set(CPPFLAGS ${CPPFLAGS} -DNO_PORT)
2470 ac_msg_warn("mono has not been ported to ${host}: some things may not work.")
2473 if(NOT ACCESS_UNALIGNED)
2474 set(CPPFLAGS "${CPPFLAGS} -DNO_UNALIGNED_ACCESS")
2479 ### # Pass CPPFLAGS to libgc configure
2480 ### # We should use a separate variable for this to avoid passing useless and
2481 ### # potentially problematic defines to libgc (like -set(D_FILE_OFFSET_BITS 64))
2482 ### # This should be executed late so we pick up the final version of CPPFLAGS
2483 ### # The problem with this approach, is that during a reconfigure, the main
2484 ### # configure scripts gets invoked with these arguments, so we use separate
2485 ### # variables understood by libgc's configure to pass CPPFLAGS and CFLAGS.
2486 ### set(LIBGC_CPPFLAGS $CPPFLAGS)
2487 ### if test x$TARGET = xSPARC -o x$TARGET = xSPARC64; then
2488 ### set(LIBGC_CPPFLAGS `echo $LIBGC_CPPFLAGS | sed -e 's/-D_FILE_OFFSET_BITS=64//g'`)
2490 ### set(ac_configure_args "$ac_configure_args --disable-embed-check --with-libgc-threads=$libgc_threads $libgc_configure_args \"CPPFLAGS_FOR_LIBGC=$LIBGC_CPPFLAGS\" \"CFLAGS_FOR_LIBGC=$CFLAGS_FOR_LIBGC\"")
2491 ### AC_CONFIG_SUBDIRS(libgc)
2495 set(preview yes CACHE BOOL "If you want to install the 2.0 FX preview (defaults to yes)")
2496 set(PREVIEW ${preview})
2497 set(moonlight yes CACHE BOOL "If you want to build the Moonlight 2.1 assemblies (defaults to yes)")
2498 set(MOONLIGHT ${moonlight})
2500 set(oprofile no CACHE STRING "<oprofile install dir> or 'no' to disable oprofile support (defaults to no)")
2501 if (NOT oprofile STREQUAL no)
2502 ### if test x$with_oprofile != xno; then
2503 ### set(oprofile_include $with_oprofile/include)
2504 ### if test ! -f $oprofile_include/opagent.h; then
2505 ### ac_msg_error([oprofile include file not found at $oprofile_include/opagent.h])
2507 ### set(OPROFILE yes)
2508 ### set(OPROFILE_CFLAGS "-I$oprofile_include")
2509 ### set(OPROFILE_LIBS "-L$with_oprofile/lib/oprofile -lopagent")
2510 ### ac_define(HAVE_OPROFILE,1,[Have oprofile support])
2515 set(MALLOC_MEMPOOLS no)
2516 set(malloc_mempools no CACHE STRING "Use malloc for each single mempool allocation (only for runtime debugging, defaults to no)")
2517 ### if test x$with_malloc_mempools = xyes; then
2518 ### set(MALLOC_MEMPOOLS yes)
2519 ### ac_define(USE_MALLOC_FOR_MEMPOOLS,1,[Use malloc for each single mempool allocation])
2524 set(DISABLE_MCS_DOCS no)
2525 set(mcs_docs yes CACHE STRING "If you want to build the documentation under mcs (defaults to yes)")
2527 set(DISABLE_MCS_DOCS yes)
2530 set(HAVE_OPROFILE yes)
2532 ###AC_SUBST(OPROFILE_CFLAGS)
2533 ###AC_SUBST(OPROFILE_LIBS)
2536 foreach(lib ${LIBS})
2537 set(libs_list "${libs_list} ${lib}")
2539 set(libmono_ldflags "${libmono_ldflags} ${libs_list}")
2542 set(INSTALL_2_0 yes)
2545 set(INSTALL_2_1 yes)
2548 ###AM_CONDITIONAL(MIPS_GCC, test ${TARGET}${ac_cv_prog_gcc} = MIPSyes)
2549 ###AM_CONDITIONAL(MIPS_SGI, test ${TARGET}${ac_cv_prog_gcc} = MIPSno)
2550 # Define a variable for the target
2554 set(INTERP_SUPPORTED yes)
2556 if (gc STREQUAL "included")
2557 set(INCLUDED_LIBGC yes)
2563 ###AC_SUBST(SQLITE3)
2565 ac_define_unquoted(ARCHITECTURE "${arch_target}" "The architecture this is running on")
2566 ###AC_SUBST(arch_target)
2568 ###AC_SUBST(CPPFLAGS)
2569 ###AC_SUBST(LDFLAGS)
2571 set(mono_build_root ${CMAKE_BINARY_DIR})
2574 set(mono_runtime mono/mini/mono)
2576 set(mono_runtime mono/interpreter/mint)
2579 set(mono_cfg_root ${mono_build_root}/runtime)
2581 ###if test x$platform_win32 = xyes; then
2582 ### if (${cross_compiling" = "xno"; then
2583 ### set(mono_cfg_dir `cygpath -w -a $mono_cfg_root`\\etc)
2585 ### set(mono_cfg_dir `echo $mono_cfg_root | tr '/' '\\\'`\\etc)
2588 set(mono_cfg_dir ${mono_cfg_root}/etc)
2591 function(ac_config_files file)
2592 configure_file("${file}.in" ${file} @ONLY)
2594 ac_config_files("po/mcs/Makefile.in")
2596 ac_config_files("runtime/mono-wrapper")
2597 ac_config_files("runtime/monodis-wrapper")
2598 execute_process (COMMAND chmod a+x runtime/mono-wrapper runtime/monodis-wrapper)
2600 ###AC_CONFIG_COMMANDS([runtime/etc/mono/1.0/machine.config],
2601 ###[ set(depth ../../../..)
2603 ### [[\\/$]]* | ?:[[\\/]]* ) set(reldir $srcdir ;;)
2604 ### .) set(reldir $depth ;;)
2605 ### *) set(reldir $depth/$srcdir ;;)
2607 ### $ac_aux_dir/install-sh -d runtime/etc/mono/1.0
2608 ### cd runtime/etc/mono/1.0
2609 ### rm -f machine.config
2610 ### $LN_S $reldir/data/net_1_1/machine.config machine.config
2612 ###],[set(LN_S '$LN_S']))
2614 ###AC_CONFIG_COMMANDS([runtime/etc/mono/2.0/machine.config],
2615 ###[ set(depth ../../../..)
2617 ### [[\\/$]]* | ?:[[\\/]]* ) set(reldir $srcdir ;;)
2618 ### .) set(reldir $depth ;;)
2619 ### *) set(reldir $depth/$srcdir ;;)
2621 ### $ac_aux_dir/install-sh -d runtime/etc/mono/2.0
2622 ### cd runtime/etc/mono/2.0
2623 ### rm -f machine.config
2624 ### $LN_S $reldir/data/net_2_0/machine.config machine.config
2626 ###],[set(LN_S '$LN_S']))
2628 ###AC_CONFIG_COMMANDS([runtime/etc/mono/2.0/web.config],
2629 ###[ set(depth ../../../..)
2631 ### [[\\/$]]* | ?:[[\\/]]* ) set(reldir $srcdir ;;)
2632 ### .) set(reldir $depth ;;)
2633 ### *) set(reldir $depth/$srcdir ;;)
2635 ### $ac_aux_dir/install-sh -d runtime/etc/mono/2.0
2636 ### cd runtime/etc/mono/2.0
2637 ### rm -f web.config
2638 ### $LN_S $reldir/data/net_2_0/web.config web.config
2640 ###],[set(LN_S '$LN_S']))
2642 ###AC_CONFIG_COMMANDS([runtime/etc/mono/browscap.ini],
2643 ###[ set(depth ../../..)
2645 ### [[\\/$]]* | ?:[[\\/]]* ) set(reldir $srcdir ;;)
2646 ### .) set(reldir $depth ;;)
2647 ### *) set(reldir $depth/$srcdir ;;)
2649 ### $ac_aux_dir/install-sh -d runtime/etc/mono/
2650 ### cd runtime/etc/mono/
2651 ### rm -f browscap.ini
2652 ### $LN_S $reldir/data/browscap.ini browscap.ini
2654 ###],[set(LN_S '$LN_S']))
2656 ###AC_CONFIG_COMMANDS([runtime/etc/mono/2.0/Browsers/Compat.browser],
2657 ###[ set(depth ../../../../..)
2659 ### [[\\/$]]* | ?:[[\\/]]* ) set(reldir $srcdir ;;)
2660 ### .) set(reldir $depth ;;)
2661 ### *) set(reldir $depth/$srcdir ;;)
2663 ### $ac_aux_dir/install-sh -d runtime/etc/mono/2.0/Browsers/
2664 ### cd runtime/etc/mono/2.0/Browsers
2665 ### rm -f Compat.browser
2666 ### $LN_S $reldir/data/net_2_0/Browsers/Compat.browser Compat.browser
2668 ###],[set(LN_S '$LN_S']))
2670 ###if test x$enable_quiet_build = xyes; then
2671 ### AC_CONFIG_COMMANDS([quiet], [for i in `find mono libgc support -name Makefile.in | sed -e 's/Makefile.in/Makefile/g'`; do if test -f $i; then $srcdir/scripts/patch-quiet.sh $i; fi; done], [set(shell $SHELL]))
2672 ### AC_CONFIG_COMMANDS([quiet-libtool], [sed -e 's/$echo "copying selected/$show "copying selected/g' < libtool > libtool.tmp && mv libtool.tmp libtool && chmod a+x libtool; sed -e 's/$ECHO "copying selected/# "copying selected/g' < libtool > libtool.tmp && mv libtool.tmp libtool && chmod a+x libtool])
2675 if("${prefix}" STREQUAL "")
2676 set(prefix /usr/local)
2678 if("${exec_prefix}" STREQUAL "")
2679 set(exec_prefix "\${prefix}")
2682 # FIXME: Make these overridable
2683 set(bindir "\${exec_prefix}/bin")
2684 set(sbindir "\${exec_prefix}/sbin")
2685 set(libexecdir "\${exec_prefix}/libexec")
2686 set(datarootdir "\${prefix}/share")
2687 set(datadir "\${datarootdir}")
2688 set(sysconfdir "\${prefix}/etc")
2689 set(sharedstatedir "\${prefix}/com")
2690 set(localstatedir "\${prefix}/var")
2691 set(includedir "\${prefix}/include")
2692 set(oldincludedir "/usr/include")
2693 set(docdir "\${datarootdir}/doc/\${PACKAGE}")
2694 set(infodir "\${datarootdir}/info")
2695 set(htmldir "\${docdir}")
2696 set(dvidir "\${docdir}")
2697 set(pdfdir "\${docdir}")
2698 set(psdir "\${docdir}")
2699 set(libdir "\${exec_prefix}/lib")
2700 set(localedir "\${datarootdir}/locale")
2701 set(mandir "\${datarootdir}/man")
2703 autoheader("config.h" autoheader_vars)
2705 set(SUBDIRS po ${libgc_dir} ${eglib_dir} mono ${ikvm_native_dir} support data runtime scripts man samples web msvc docs)
2707 foreach(dir ${SUBDIRS})
2708 add_subdirectory(${dir})
2711 # Implementation of AC_OUTPUT for cmake
2712 function(ac_output outputs)
2713 foreach (output ${ARGV})
2714 configure_file ("${output}.in" "${output}" @ONLY)
2720 scripts/mono-find-provides
2721 scripts/mono-find-requires
2722 mono/tests/tests-config
2727 data/mono-options.pc
2728 data/mono-lineeditor.pc
2735 data/system.web.extensions_1.0.pc
2736 data/system.web.extensions.design_1.0.pc
2737 data/system.web.mvc.pc
2742 ###mono-uninstalled.pc
2743 ###scripts/mono-find-provides
2744 ###scripts/mono-find-requires
2745 ###mono/dis/Makefile
2746 ###mono/cil/Makefile
2747 ###mono/arch/Makefile
2748 ###mono/arch/x86/Makefile
2749 ###mono/arch/amd64/Makefile
2750 ###mono/arch/hppa/Makefile
2751 ###mono/arch/ppc/Makefile
2752 ###mono/arch/sparc/Makefile
2753 ###mono/arch/s390/Makefile
2754 ###mono/arch/s390x/Makefile
2755 ###mono/arch/arm/Makefile
2756 ###mono/arch/alpha/Makefile
2757 ###mono/arch/ia64/Makefile
2758 ###mono/arch/mips/Makefile
2759 ###mono/interpreter/Makefile
2760 ###mono/tests/Makefile
2761 ###mono/tests/tests-config
2762 ###mono/tests/assemblyresolve/Makefile
2763 ###mono/tests/cas/Makefile
2764 ###mono/tests/cas/assembly/Makefile
2765 ###mono/tests/cas/demand/Makefile
2766 ###mono/tests/cas/inheritance/Makefile
2767 ###mono/tests/cas/linkdemand/Makefile
2768 ###mono/tests/cas/threads/Makefile
2769 ###mono/benchmark/Makefile
2770 ###mono/monograph/Makefile
2771 ###mono/profiler/Makefile
2772 ###ikvm-native/Makefile
2778 ###data/net_1_1/Makefile
2779 ###data/net_2_0/Makefile
2780 ###data/net_2_0/Browsers/Makefile
2783 ###data/mono-cairo.pc
2784 ###data/mono-nunit.pc
2785 ###data/mono-options.pc
2786 ###data/mono-lineeditor.pc
2793 ###data/system.web.extensions_1.0.pc
2794 ###data/system.web.extensions.design_1.0.pc
2795 ###data/system.web.mvc.pc
2800 ###tools/locale-builder/Makefile
2806 ###if test x$platform_win32 = xyes; then
2807 ### # Get rid of 'cyg' prefixes in library names
2808 ### sed -e "s/\/cyg\//\/\//" libtool > libtool.new; mv libtool.new libtool; chmod 755 libtool
2809 ### # libtool seems to inherit -mno-cygwin from our CFLAGS, and uses it to compile its executable
2810 ### # wrapper scripts which use exec(). gcc has no problem compiling+linking this, but the resulting
2811 ### # executable doesn't work...
2812 ### sed -e "s,-mno-cygwin,,g" libtool > libtool.new; mv libtool.new libtool; chmod 755 libtool
2816 set(mcs_INSTALL ${mono_build_root}/install-sh)
2818 ### case $INSTALL in
2819 ### [[\\/$]]* | ?:[[\\/]]* ) set(mcs_INSTALL $INSTALL ;;)
2820 ### *) set(mcs_INSTALL $mono_build_root/$INSTALL ;;)
2823 # Compute a 4 part version number into myver from ${mono_version}
2824 string(REGEX REPLACE "([0-9]+)\\.([0-9]+)\\.([0-9]+)\\.([0-9]+).*" "\\1.\\2.\\3.\\4" myver "${mono_version}.0.0.0")
2826 set(config.make ${srcdir}/${mcsdir}/build/config.make)
2828 # If we are cross compiling, we don't build in the mcs/ tree. Let us not clobber
2829 # any existing config.make. This allows people to share the same source tree
2830 # with different build directories, one native and one cross
2832 if(NOT cross_compiling)
2833 set(not_cross_compiling yes)
2835 if(not_cross_compiling AND enable_mcs_build)
2836 file(WRITE ${config.make} "prefix=${prefix}
2837 exec_prefix=${exec_prefix}
2838 sysconfdir=${sysconfdir}
2839 mono_libdir=\${exec_prefix}/lib
2840 MCS_FLAGS=$(PLATFORM_DEBUG_FLAGS)
2842 RUNTIME=${mono_build_root}/runtime/mono-wrapper
2843 ILDISASM=${mono_build_root}/runtime/monodis-wrapper
2844 INSTALL=${mcs_INSTALL}
2845 MONO_VERSION=${myver}
2850 file(APPEND ${config.make} "PLATFORM=darwin\n")
2853 if (${TARGET} STREQUAL "AMD64" AND ${platform_win32} STREQUAL "no" AND AOT_SUPPORTED)
2854 file(APPEND ${config.make} "ENABLE_AOT=1\n")
2857 if (DISABLE_MCS_DOCS)
2858 file(APPEND ${config.make} "DISABLE_MCS_DOCS=yes\n")
2861 ### # if we have an olive folder, override the default settings
2862 ### if test -d $olivedir; then
2864 ### test -w $srcdir/$olivedir/build || chmod +w $srcdir/$olivedir/build
2866 ### if test x$cross_compiling = xno && test x$enable_olive_build != xno; then
2867 ### echo "set(prefix $prefix" > $srcdir/$olivedir/build/config.make)
2868 ### echo "set(exec_prefix $exec_prefix" >> $srcdir/$olivedir/build/config.make)
2869 ### echo 'set(mono_libdir ${exec_prefix}/lib' >> $srcdir/$olivedir/build/config.make)
2870 ### echo 'MCS_FLAGS = $(PLATFORM_DEBUG_FLAGS)' >> $srcdir/$olivedir/build/config.make
2871 ### echo "RUNTIME = $mono_build_root/runtime/mono-wrapper" >> $srcdir/$olivedir/build/config.make
2872 ### echo "MONO_VERSION = $myver" >> $srcdir/$olivedir/build/config.make
2873 ### if test x$with_moonlight = xyes; then
2874 ### echo "WITH_MOONLIGHT = yes" >> $srcdir/$olivedir/build/config.make
2879 if(NOT libgdiplus_loc)
2880 set(libgdiplus_msg "assumed to be installed")
2882 set(libgdiplus_msg ${libgdiplus_loc})
2887 mcs source: ${mcs_topdir}
2888 olive source: ${olive_topdir}
2892 SIGALTSTACK: ${with_sigaltstack}
2893 Engine: ${jit_status}
2894 2.0 Beta: ${PREVIEW}
2895 2.1 Alpha: ${MOONLIGHT}
2896 JNI support: ${jdk_headers_found}
2897 libgdiplus: ${libgdiplus_msg}
2899 oprofile: ${OPROFILE}
2900 BigArrays: ${enable_big_arrays}
2901 DTrace: ${enable_dtrace}
2902 Parallel Mark: ${enable_parallel_mark}
2903 LLVM Back End: ${enable_llvm}
2908 if(NOT with_static_mono)
2909 if(NOT platform_win32)
2910 ac_msg_warn("Turning off static Mono is a risk, you might run into unexpected bugs")
2914 if(gc STREQUAL sgen)
2917 IMPORTANT: You have selected an experimental, work-in-progress
2918 IMPORTANT: GC engine. This GC engine is currently not supported
2919 IMPORTANT: and is not yet ready for use.
2921 IMPORTANT: There are known problems with it, use at your own risk.
2929 IMPORTANT: The LLVM Back End is experimental and does not work yet.
2936 ### -rm -fr $(mcslib)/monolite-*
2937 ### -mkdir -p $(mcslib)
2938 ### test ! -d $(monolite) || test ! -d $(monolite).old || rm -fr $(monolite).old
2939 ### test ! -d $(monolite) || mv -f $(monolite) $(monolite).old
2940 ### cd $(mcslib) && { (wget -O- $(monolite_url) || curl $(monolite_url)) | gzip -d | tar xf - ; }
2941 ### cd $(mcslib) && mv -f monolite-* monolite
2944 #### Keep in sync with SUBDIRS
2945 ##### 'tools' is not normally built
2946 ###DIST_SUBDIRS = po libgc $(eglib_dir) mono ikvm-native support data runtime scripts man samples web tools msvc docs
2948 ###EXTRA_DIST= nls.m4 po.m4 progtest.m4 mono-uninstalled.pc.in build-mingw32.sh LICENSE mkinstalldirs
2950 ###DISTCHECK_CONFIGURE_FLAGS = EXTERNAL_MCS=false EXTERNAL_RUNTIME=false
2952 #### Distribute the 'mcs' tree too
2954 ### test -d $(distdir)/mcs || mkdir $(distdir)/mcs
2955 ### d=`cd $(distdir)/mcs && pwd`; cd $(mcs_topdir) && $(MAKE) PROFILE=net_1_1 distdir=$$d dist-recursive
2956 ### d=`cd $(distdir)/mcs && pwd`; cd $(mcs_topdir) && $(MAKE) PROFILE=net_2_0 distdir=$$d dist-recursive
2958 ###pkgconfigdir = $(libdir)/pkgconfig
2959 ###noinst_DATA = mono-uninstalled.pc
2960 ###DISTCLEANFILES= mono-uninstalled.pc
2962 ###.PHONY: get-monolite-latest mcs-do-compiler-tests compiler-tests bootstrap-world
2964 #### building with monolite
2965 set(mcslib ${mcs_topdir}/class/lib)
2966 set(monolite ${mcslib}/monolite)
2967 set(monolite_url http://mono.ximian.com/daily/monolite-latest.tar.gz)
2968 add_custom_target(get-monolite-latest
2969 COMMAND -rm -fr ${mcslib}/monolite-*
2970 COMMAND -mkdir -p ${mcslib}
2971 COMMAND test ! -d ${monolite} || test ! -d ${monolite}.old || rm -fr ${monolite}.old
2972 COMMAND test ! -d ${monolite} || mv -f ${monolite} ${monolite}.old
2973 COMMAND cd ${mcslib} && { (wget -O- ${monolite_url} || curl ${monolite_url}) | gzip -d | tar xf - \; }
2974 COMMAND cd ${mcslib} && mv -f monolite-* monolite
2977 ###compiler-tests: mcs-do-clean
2979 ### $(MAKE) mcs-do-compiler-tests
2981 ###compiler-tests-net_2_0:
2982 ### -rm -f $(mcs_topdir)/build/common/Consts.cs.save
2983 ### -mv -f $(mcs_topdir)/build/common/Consts.cs $(mcs_topdir)/build/common/Consts.cs.save
2984 ### cd $(mcs_topdir) && $(MAKE) PROFILE=net_2_0_bootstrap clean
2985 ### cd $(mcs_topdir) && $(MAKE) PROFILE=net_2_0 clean
2986 ### -mv -f $(mcs_topdir)/build/common/Consts.cs.save $(mcs_topdir)/build/common/Consts.cs
2988 ### $(MAKE) build_profiles=net_2_0 mcs-do-compiler-tests
2990 ###bootstrap-world: compiler-tests
2993 ###bootstrap-world-net_2_0: compiler-tests-net_2_0
2996 #### internal targets
2998 ### cd runtime && $(MAKE) clean-local
2999 ### cd mono/tests && $(MAKE) clean
3000 ###mcs-do-compiler-tests:
3001 ### cd runtime && $(MAKE) test_select='TEST_SUBDIRS="tests errors"' check-local
3002 ### cd mono/tests && $(MAKE) check
3005 ### wget http://www.go-mono.com/archive/pkgconfig-0.11-20020310.zip
3006 ### wget http://www.go-mono.com/archive/glib-2.0.4-20020703.zip
3007 ### wget http://www.go-mono.com/archive/glib-dev-2.0.4-20020703.zip
3008 ### wget http://www.go-mono.com/archive/libiconv-1.7.zip
3009 ### wget http://www.go-mono.com/archive/libiconv-dev-1.7.zip
3010 ### wget http://www.go-mono.com/archive/libintl-0.10.40-20020101.zip
3011 ### unzip -n -d / pkgconfig-0.11-20020310.zip
3012 ### unzip -n -d / glib-2.0.4-20020703.zip
3013 ### unzip -n -d / glib-dev-2.0.4-20020703.zip
3014 ### unzip -n -d / libiconv-1.7.zip
3015 ### unzip -n -d / libiconv-dev-1.7.zip
3016 ### unzip -n -d / libintl-0.10.40-20020101.zip
3019 ### makensis /DMILESTONE=$(VERSION) /DSOURCE_INSTALL_DIR=$(SOURCE_INSTALL_DIR) /DBUILDNUM=$(BUILDNUM) monowiz.win32.nsi
3022 ### @echo "*** 'make bootstrap' is obsolete. Just run 'make' to perform a combined mono+mcs build"
3026 ### find mono -name Makefile -exec scripts/patch-quiet.sh {} \;
3027 ### find libgc -name Makefile -exec scripts/patch-quiet.sh {} \;
3030 ### (cd $(mcs_topdir)/build/csproj && gmcs genproj.cs) && (cd runtime; make V=1 extra_targets=csproj-local)