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
8 # - Add a cache to the manual checks
10 # We use lowercase commands as advocated by the kde cmake coding style
12 include(CheckIncludeFile)
13 include(CheckCSourceCompiles)
15 # Implementation of AC_CHECK_HEADERS
16 # In addition, it also records the list of variables in the variable
17 # 'autoheader_vars', and for each variable, a documentation string in the
19 function(ac_check_headers headers)
20 foreach (header ${ARGV})
21 string(TOUPPER ${header} header_var)
22 string(REPLACE "." "_" header_var ${header_var})
23 string(REPLACE "/" "_" header_var ${header_var})
24 set(header_var "HAVE_${header_var}")
25 check_include_file (${header} ${header_var})
26 set("${header_var}_doc" "Define to 1 if you have the <${header}> header file." PARENT_SCOPE)
28 set("${header_var}_defined" "1" PARENT_SCOPE)
30 set("${header_var}_val" "1" PARENT_SCOPE)
31 set (autoheader_vars ${autoheader_vars} ${header_var})
33 set (autoheader_vars ${autoheader_vars} PARENT_SCOPE)
36 function(ac_check_funcs funcs)
37 foreach (func ${ARGV})
38 string(TOUPPER ${func} var)
39 set(var "HAVE_${var}")
41 check_function_exists (${func} ${var})
42 set("${var}_doc" "Define to 1 if you have the '${func}' function." PARENT_SCOPE)
44 set("${var}_defined" "1" PARENT_SCOPE)
45 set(${var} yes PARENT_SCOPE)
47 set("${var}_val" "1" PARENT_SCOPE)
48 set (autoheader_vars ${autoheader_vars} ${var})
50 set (autoheader_vars ${autoheader_vars} PARENT_SCOPE)
53 # Implementation of AC_DEFINE
54 function(ac_define varname value doc)
55 if (${varname} MATCHES ",")
56 message(FATAL_ERROR ",")
58 set("${varname}_doc" ${doc} PARENT_SCOPE)
59 set("${varname}_defined" 1 PARENT_SCOPE)
60 set("${varname}_val" ${value} PARENT_SCOPE)
61 set (autoheader_vars ${autoheader_vars} ${varname} PARENT_SCOPE)
64 # Implementation of AC_DEFINE_UNQUOTED
65 function(ac_define_unquoted varname value doc)
66 if (${varname} MATCHES ",")
67 message(FATAL_ERROR ",")
69 set("${varname}_doc" ${doc} PARENT_SCOPE)
70 set("${varname}_defined" 1 PARENT_SCOPE)
71 set("${varname}_val" \"${value}\" PARENT_SCOPE)
72 set (autoheader_vars ${autoheader_vars} ${varname} PARENT_SCOPE)
75 Include(CheckTypeSize)
77 # Implementation of AC_CHECK_SIZEOF
78 # FIXME: cross compiling
79 function(ac_check_sizeof type)
80 check_type_size(${type} size)
81 if (HAVE_size STREQUAL "TRUE")
83 message(FATAL_ERROR "Type ${type} not found.")
85 string(TOUPPER "SIZEOF_${type}" varname)
86 string(REPLACE " " "_" varname ${varname})
87 string(REPLACE "*" "P" varname ${varname})
89 set("${varname}_doc" "The size of '${type}' as computed by sizeof" PARENT_SCOPE)
90 set("${varname}_defined" 1 PARENT_SCOPE)
91 set("${varname}_val" ${size} PARENT_SCOPE)
92 set (autoheader_vars ${autoheader_vars} ${varname} PARENT_SCOPE)
95 # Implementation of autoheader
96 function(AUTOHEADER filename variables)
97 set(tmp_filename "${filename}.tmp")
98 file(WRITE ${tmp_filename} "")
99 foreach(var ${${variables}})
100 file(APPEND ${tmp_filename} "\n/* ${${var}_doc} */\n")
101 if(${${var}_defined})
102 file(APPEND ${tmp_filename} "#define ${var} ${${var}_val}\n")
104 file(APPEND ${tmp_filename} "/* #undef ${var} */\n")
107 # FIXME: This is unix specific
108 execute_process(COMMAND diff ${filename} ${filename}.tmp RESULT_VARIABLE diff_res OUTPUT_QUIET)
109 if (NOT diff_res STREQUAL 0)
110 message(STATUS "generating ${filename}.")
111 execute_process(COMMAND mv ${filename}.tmp ${filename})
113 message(STATUS "${filename} is unchanged.")
117 function(ac_msg_checking)
118 message(STATUS "checking ${ARGV}...")
119 set(last_msg_checking ${ARGV} PARENT_SCOPE)
122 function(ac_msg_result)
123 message(STATUS "checking ${last_msg_checking}... ${ARGV}")
126 function(ac_msg_error)
127 message(FATAL_ERROR "${ARGV}")
130 function(ac_msg_warn)
131 message(STATUS "WARNING: ${ARGV}")
134 # The lines commented out using ### are the stuff from configure.in which still
135 # need to be ported to cmake
136 # The svn revision of the configure.in used is r132691
139 ac_define_unquoted(VERSION ${VERSION} "Version number of package")
144 #### In case of cygwin, override LN_S, irrespective of what it determines.
145 #### The build uses cygwin, but the actual runtime doesn't.
147 ###*cygwin* ) set(LN_S 'cp -p';;)
153 # These variables are the CPPFLAGS/CFLAGS passed to libgc's configure
154 # libgc should inherit the original CFLAGS/CPPFLAGS passed to configure, i.e. -O0
156 set(CPPFLAGS_FOR_LIBGC ${CPPFLAGS})
157 set(CFLAGS_FOR_LIBGC ${CFLAGS})
160 # These are the flags that need to be stored in the mono.pc file for
161 # compiling code that will embed Mono
163 set(libmono_cflags "")
164 set(libmono_ldflags "")
166 ###AC_SUBST(libmono_cflags)
167 ###AC_SUBST(libmono_ldflags)
169 #### Variable to have relocatable .pc files (lib, or lib64)
170 ###set(reloc_libdir `basename ${libdir}`)
171 ###AC_SUBST(reloc_libdir)
173 # if linker handles the version script
174 set(no_version_script no)
176 # Set to yes if Unix sockets cannot be created in an anonymous namespace
177 set(need_link_unlink no)
183 # Obtain the GNU style target
184 # From GetTargetTriple.cmake in LLVM
185 function( get_target_triple var )
187 set( ${var} "i686-pc-win32" PARENT_SCOPE )
189 set(config_guess config.guess)
190 execute_process(COMMAND sh ${config_guess}
191 RESULT_VARIABLE TT_RV
192 OUTPUT_VARIABLE TT_OUT
193 OUTPUT_STRIP_TRAILING_WHITESPACE)
194 if( NOT TT_RV EQUAL 0 )
195 message(FATAL_ERROR "Failed to execute ${config_guess}")
196 endif( NOT TT_RV EQUAL 0 )
197 set( ${var} ${TT_OUT} PARENT_SCOPE )
199 endfunction( get_target_triple var )
201 get_target_triple(host)
203 message(STATUS "checking host platform characteristics...")
205 set(libgc_threads no)
207 set(parallel_mark yes)
209 if(host MATCHES .*-.*-linux.*)
210 set(platform_win32 no)
211 set(CPPFLAGS "${CPPFLAGS} -DHAVE_CONFIG_H -DGC_LINUX_THREADS -D_GNU_SOURCE -D_REENTRANT -DUSE_MMAP -DUSE_MUNMAP")
212 set(libmono_cflags "-D_REENTRANT")
213 set(libmono_ldflags "-lpthread")
215 set(libgc_threads pthreads)
216 set(AOT_SUPPORTED "yes")
217 set(use_sigposix yes)
219 message(FATAL_ERROR "The cmake build doesn't yet support host '${host}'.")
222 #### Thread configuration inspired by sleepycat's db
224 ### *-*-mingw*|*-*-cygwin*)
225 ### set(platform_win32 yes)
226 ### ac_define(PLATFORM_WIN32,1,[Platform is Win32])
227 ### ac_define(DISABLE_PORTABILITY,1,[Disable the io-portability layer])
228 ### ac_define(PLATFORM_NO_SYMLINKS,1,[This platform does not support symlinks])
229 ### if test "x$cross_compiling" = "xno"; then
230 ### set(CC "gcc -mno-cygwin -g")
231 ### # So libgc configure gets -mno-cygwin
234 ### set(HOST_CC "gcc")
235 ### # Windows 2000 is required that includes Internet Explorer 5.01
236 ### set(CPPFLAGS "$CPPFLAGS -DWINVER=0x0500 -D_WIN32_WINNT=0x0500 -D_WIN32_IE=0x0501 -D_UNICODE -DUNICODE -DWIN32_THREADS -DFD_SETSIZE=1024")
237 ### set(libmono_cflags "-mno-cygwin -mms-bitfields -mwindows")
238 ### set(libmono_ldflags "-mno-cygwin -mms-bitfields -mwindows")
240 ### set(libgc_threads win32)
241 ### set(gc_default included)
242 ### set(with_sigaltstack no)
244 ### # This forces libgc to use the DllMain based thread registration code on win32
245 ### set(libgc_configure_args "$libgc_configure_args --enable-win32-dllmain=yes")
248 ### set(platform_win32 no)
249 ### set(CPPFLAGS "$CPPFLAGS -D_REENTRANT -DGC_NETBSD_THREADS -D_GNU_SOURCE")
250 ### set(libmono_cflags "-D_REENTRANT")
251 ### set(LDFLAGS "$LDFLAGS -pthread")
252 ### set(CPPFLAGS "$CPPFLAGS -DPLATFORM_BSD")
253 ### set(libmono_ldflags "-pthread")
254 ### set(need_link_unlink yes)
255 ### set(libdl "-ldl")
256 ### set(libgc_threads pthreads)
257 ### set(with_sigaltstack no)
258 ### set(use_sigposix yes)
261 ### set(platform_win32 no)
262 ### if test "x$PTHREAD_CFLAGS" = "x"; then
263 ### set(CPPFLAGS "$CPPFLAGS -DGC_FREEBSD_THREADS")
264 ### set(libmono_cflags )
266 ### set(CPPFLAGS "$CPPFLAGS $PTHREAD_CFLAGS -DGC_FREEBSD_THREADS")
267 ### set(libmono_cflags "$PTHREAD_CFLAGS")
269 ### if test "x$PTHREAD_LIBS" = "x"; then
270 ### set(LDFLAGS "$LDFLAGS -pthread")
271 ### set(libmono_ldflags "-pthread")
273 ### set(LDFLAGS "$LDFLAGS $PTHREAD_LIBS")
274 ### set(libmono_ldflags "$PTHREAD_LIBS")
276 ### set(CPPFLAGS "$CPPFLAGS -DPLATFORM_BSD")
277 ### set(need_link_unlink yes)
278 ### ac_define(PTHREAD_POINTER_ID, 1, [pthread is a pointer])
280 ### set(libgc_threads pthreads)
281 ### # This doesn't seem to work as of 7.0 on amd64
282 ### set(with_sigaltstack no)
283 #### TLS is only partially implemented on -CURRENT (compiler support
284 #### but NOT library support)
286 ### set(with_tls pthread)
287 ### set(use_sigposix yes)
290 ### set(platform_win32 no)
291 ### set(CPPFLAGS "$CPPFLAGS -D_THREAD_SAFE -DGC_FREEBSD_THREADS -DPLATFORM_BSD")
292 ### set(libmono_cflags "-D_THREAD_SAFE")
293 ### set(LDFLAGS "$LDFLAGS -pthread")
294 ### set(libmono_ldflags "-pthread")
295 ### set(need_link_unlink yes)
296 ### ac_define(PTHREAD_POINTER_ID)
298 ### set(libgc_threads pthreads)
299 ### set(use_sigposix yes)
302 ### set(platform_win32 no)
303 ### set(CPPFLAGS "$CPPFLAGS -DGC_LINUX_THREADS -D_GNU_SOURCE -D_REENTRANT -DUSE_MMAP -DUSE_MUNMAP")
304 ### set(libmono_cflags "-D_REENTRANT")
305 ### set(libmono_ldflags "-lpthread")
306 ### set(libdl "-ldl")
307 ### set(libgc_threads pthreads)
308 ### set(AOT_SUPPORTED "yes")
309 ### set(use_sigposix yes)
312 ### set(platform_win32 no)
313 ### set(CPPFLAGS "$CPPFLAGS -DGC_HPUX_THREADS -D_HPUX_SOURCE -D_XOPEN_SOURCE_EXTENDED -D_REENTRANT")
314 ### # +ESdbgasm only valid on bundled cc on RISC
315 ### # silently ignored for ia64
316 ### if test $GCC != "yes"; then
317 ### set(CFLAGS "$CFLAGS +ESdbgasm")
318 ### # Arrange for run-time dereferencing of null
319 ### # pointers to produce a SIGSEGV signal.
320 ### set(LDFLAGS "$LDFLAGS -z")
322 ### set(CFLAGS "$CFLAGS +ESdbgasm")
323 ### set(LDFLAGS "$LDFLAGS -z")
324 ### set(libmono_cflags "-D_REENTRANT")
325 ### set(libmono_ldflags "-lpthread")
326 ### set(libgc_threads pthreads)
327 ### set(need_link_unlink yes)
328 ### set(use_sigposix yes)
331 ### set(platform_win32 no)
332 ### set(CPPFLAGS "$CPPFLAGS -DGC_SOLARIS_THREADS -DGC_SOLARIS_PTHREADS -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS -DUSE_MMAP -DUSE_MUNMAP -DPLATFORM_SOLARIS")
333 ### set(need_link_unlink yes)
334 ### set(libmono_cflags "-D_REENTRANT")
335 ### set(libgc_threads pthreads)
336 ### # This doesn't seem to work on solaris/x86, but the configure test runs
337 ### set(with_tls pthread)
338 ### set(has_dtrace yes)
339 ### set(use_sigposix yes)
342 ### set(parallel_mark "Disabled_Currently_Hangs_On_MacOSX")
343 ### set(platform_win32 no)
344 ### set(platform_darwin yes)
345 ### set(CPPFLAGS "$CPPFLAGS -no-cpp-precomp -D_THREAD_SAFE -DGC_MACOSX_THREADS -DPLATFORM_MACOSX -DUSE_MMAP -DUSE_MUNMAP")
346 ### set(CPPFLAGS "$CPPFLAGS -DGetCurrentProcess=MonoGetCurrentProcess -DGetCurrentThread=MonoGetCurrentThread -DCreateEvent=MonoCreateEvent")
347 ### set(libmono_cflags "-D_THREAD_SAFE")
348 ### set(LDFLAGS "$LDFLAGS -pthread")
349 ### set(libmono_ldflags "-pthread")
350 ### set(need_link_unlink yes)
351 ### ac_define(PTHREAD_POINTER_ID)
352 ### ac_define(USE_MACH_SEMA, 1, [...])
353 ### set(no_version_script yes)
355 ### set(libgc_threads pthreads)
356 ### set(has_dtrace yes)
357 ### if test "x$cross_compiling" = "xyes"; then
358 ### set(has_broken_apple_cpp yes)
362 ### AC_MSG_WARN([*** Please add $host to configure.in checks!])
363 ### set(platform_win32 no)
364 ### set(libdl "-ldl")
369 ###if test x$need_link_unlink = xyes; then
370 ### ac_define(NEED_LINK_UNLINK, 1, [Define if Unix sockets cannot be created in an anonymous namespace])
375 set(PLATFORM_SIGPOSIX 1)
378 set(PLATFORM_WIN32 yes)
380 if(${target_os} MATCHES "*linux*")
381 set(PLATFORM_LINUX yes)
384 set(PLATFORM_DARWIN yes)
387 include(CMakeDetermineASM-ATTCompiler)
389 find_program(BISON NAMES bison)
391 if(BISON STREQUAL "BISON-NOTFOUND")
392 message(FATAL_ERROR "You need to install bison")
394 message(STATUS "Found bison: ${BISON}")
399 #### We should use AM_PROG_AS, but it's not available on automake/aclocal 1.4
400 ###: ${set(CCAS '$(CC)'})
401 #### Set ASFLAGS if not already set.
402 ###: ${set(CCASFLAGS '$(CFLAGS)'})
404 ###AC_SUBST(CCASFLAGS)
406 #### may require a specific autoconf version
407 #### AC_PROG_CC_FOR_BUILD
408 #### CC_FOR_BUILD not automatically detected
409 ###set(CC_FOR_BUILD $CC)
410 ###set(CFLAGS_FOR_BUILD $CFLAGS)
411 ###set(BUILD_EXEEXT )
412 ###if test "x$cross_compiling" = "xyes"; then
413 ### set(CC_FOR_BUILD cc)
414 ### set(CFLAGS_FOR_BUILD )
415 ### set(BUILD_EXEEXT "")
417 ###AC_SUBST(CC_FOR_BUILD)
418 ###AC_SUBST(CFLAGS_FOR_BUILD)
420 ###AC_SUBST(BUILD_EXEEXT)
422 ###AM_CONDITIONAL(CROSS_COMPILING, [test x$cross_compiling = xyes])
423 ###AM_CONDITIONAL(USE_BATCH_FILES, [test x$platform_win32 = xyes -a x$cross_compiling = xyes])
425 #### Set STDC_HEADERS
427 ###AC_LIBTOOL_WIN32_DLL
428 #### This causes monodis to not link correctly
429 ####AC_DISABLE_FAST_INSTALL
430 ###set(export_ldflags `(./libtool --config; echo eval echo \\$export_dynamic_flag_spec) | sh`)
431 ###AC_SUBST(export_ldflags)
433 #### Test whenever ld supports -version-script
436 ###if test "x$lt_cv_prog_gnu_ld" = "xno"; then
437 ### set(no_version_script yes)
440 ###AM_CONDITIONAL(NO_VERSION_SCRIPT, test x$no_version_script = xyes)
443 ac_check_headers(unistd.h stdint.h sys/types.h)
444 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)
445 ac_check_headers(sys/user.h sys/socket.h sys/ipc.h sys/sem.h sys/utsname.h alloca.h ucontext.h pwd.h)
447 ac_check_headers(zlib.h)
448 set(have_zlib ${HAVE_ZLIB_H})
451 check_c_source_compiles("
454 #if defined(ZLIB_VERNUM) && (ZLIB_VERNUM >= 0x1230)
457 #error No good zlib found
461 ac_msg_result("Using system zlib")
462 set(zlib_msg "system zlib")
465 ac_msg_result("Using embedded zlib")
467 set(zlib_msg "bundled zlib")
474 ac_define(HAVE_ZLIB 1 "Have system zlib")
476 # for mono/metadata/debug-symfile.c
477 ac_check_headers(elf.h)
480 ac_check_headers(poll.h)
481 ac_check_headers(sys/poll.h)
482 ac_check_headers(sys/wait.h)
483 ac_check_headers(grp.h)
484 ac_check_headers(syslog.h)
487 ac_check_headers(wchar.h)
488 ac_check_headers(ieeefp.h)
490 # Check whenever using GCC
491 include(CheckCSourceCompiles)
492 include(CheckCCompilerFlag)
493 check_c_source_compiles("
502 ac_msg_checking("for isinf")
504 check_c_source_compiles("
512 ac_define(HAVE_ISINF 1 "isinf available")
513 set(HAVE_ISINF 1 CACHE BOOL "Have the isinf function")
519 # not 64 bit clean in cross-compile
520 ac_check_sizeof("void *" 4)
525 set(WARN "-Wall -Wunused -Wmissing-prototypes -Wmissing-declarations -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wno-cast-qual -Wwrite-strings")
526 # The runtime code does not respect ANSI C strict aliasing rules
527 set(CFLAGS "${CFLAGS} -fno-strict-aliasing")
528 CHECK_C_COMPILER_FLAG("-Wdeclaration-after-statement" HAS_WDECL_AFTER_STATEMENT)
529 if(HAS_WDECL_AFTER_STATEMENT)
530 set(WARN "${WARN} -Wdeclaration-after-statement")
533 # The Sun Forte compiler complains about inline functions that access static variables
534 # so disable all inlining.
537 ### set(CFLAGS "$CFLAGS -Dinline=")
543 set(CFLAGS "${CFLAGS} -g ${WARN}")
545 ###set(CFLAGS_FOR_LIBGC "$CFLAGS_FOR_LIBGC -g")
548 set(srcdir ${CMAKE_SOURCE_DIR})
549 set(top_srcdir ${CMAKE_SOURCE_DIR})
550 set(abs_top_srcdir ${top_srcdir})
553 set(top_builddir ${CMAKE_BINARY_DIR})
555 # Where's the 'mcs' source tree?
556 if(EXISTS ${srcdir}/mcs)
563 # A sanity check to catch cases where the package was unpacked
564 # with an ancient tar program (Solaris)
566 set(solaris-tar-check yes CACHE BOOL "Enable/disable solaris tar check")
568 if(solaris-tar-check)
569 ac_msg_checking("integrity of package")
570 if(EXISTS ${srcdir}/${mcsdir}/class/System.Runtime.Serialization.Formatters.Soap/System.Runtime.Serialization.Formatters.Soap/SoapTypeMapper.cs)
573 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")
574 ac_msg_error(${errorm})
578 set(mcs_topdir ${top_srcdir}/${mcsdir})
579 set(mcs_topdir_from_srcdir ${top_builddir}/${mcsdir})
581 ##### Maybe should also disable if mcsdir is invalid. Let's punt the issue for now.
582 ###AM_CONDITIONAL(BUILD_MCS, [test x$cross_compiling = xno && test x$enable_mcs_build != xno])
584 ###AC_SUBST([mcs_topdir])
585 ###AC_SUBST([mcs_topdir_from_srcdir])
587 #### Where's the 'olive' source tree?
588 ###if test -d $srcdir/olive; then
589 ### set(olivedir olive)
591 ### set(olivedir ../olive)
594 ###if test -d $srcdir/$olivedir; then
595 ###set(olive_topdir '$(top_srcdir)/'$olivedir)
598 #### gettext: prepare the translation directories.
599 #### we do not configure the full gettext, as we consume it dynamically from C#
602 ###if test "x$USE_NLS" = "xyes"; then
603 ### AC_CHECK_PROG(HAVE_MSGFMT, msgfmt,yes,no)
605 ### if test "x$HAVE_MSGFMT" = "xno"; then
606 ### ac_msg_error([msgfmt not found. You need to install the 'gettext' package, or pass --enable-set(nls no to configure.]))
610 set(libgdiplus installed CACHE STRING "=installed|sibling|<path> Override the libgdiplus used for System.Drawing tests (defaults to installed)")
611 set(with_libgdiplus ${libgdiplus})
613 ###case $with_libgdiplus in
614 ###no|installed) set(libgdiplus_loc ;;)
615 ###yes|sibling) set(libgdiplus_loc `cd ../libgdiplus && pwd`/src/libgdiplus.la ;;)
616 ###/*) set(libgdiplus_loc $with_libgdiplus ;;)
617 ###*) set(libgdiplus_loc `pwd`/$with_libgdiplus ;;)
619 ###AC_SUBST([libgdiplus_loc])
622 ###set(pkg_config_path )
623 ###set(crosspkgdir, [ --with-set(crosspkgdir /path/to/pkg-config/dir Change pkg-config dir to custom dir],)
624 ### if test x$with_crosspkgdir = "x"; then
625 ### if test -s $PKG_CONFIG_PATH; then
626 ### set(pkg_config_path $PKG_CONFIG_PATH)
629 ### set(pkg_config_path $with_crosspkgdir)
630 ### set(PKG_CONFIG_PATH $pkg_config_path)
631 ### export PKG_CONFIG_PATH
636 ### [ --with-set(glib embedded|system Choose glib API: system or embedded (default to system)],)
637 ### [], [set(with_glib system]))
642 include(FindPkgConfig)
645 set(with_glib "system")
646 if (${with_glib} STREQUAL "system")
647 ### if test "x$cross_compiling" = "xyes"; then
648 ### set(pkg_config_path "$PKG_CONFIG_PATH")
649 ### unset PKG_CONFIG_PATH
651 PKG_CHECK_MODULES(GLIB2 REQUIRED glib-2.0 gthread-2.0)
652 set(BUILD_GLIB_CFLAGS ${GLIB2_CFLAGS})
653 set(BUILD_GLIB_LIBS ${GLIB2_LIBRARIES})
655 ### if test "x$cross_compiling" = "xyes"; then
656 ### set(PKG_CONFIG_PATH $pkg_config_path)
657 ### export PKG_CONFIG_PATH
660 ## Versions of dependencies
661 set(GLIB_REQUIRED_VERSION 2.4.0)
663 PKG_CHECK_MODULES(GLIB2 REQUIRED glib-2.0 >= ${GLIB_REQUIRED_VERSION} gthread-2.0)
664 set(GLIB_CFLAGS ${GLIB2_CFLAGS})
665 set(GLIB_LIBS ${GLIB2_LIBRARIES})
666 PKG_CHECK_MODULES(GMODULE REQUIRED gmodule-2.0)
667 set(GMODULE_CFLAGS ${GMODULE_CFLAGS})
668 set(GMODULE_LIBS ${GMODULE_LIBRARIES})
671 ###case $with_glib in
673 ### set(GLIB_CFLAGS '-I$(top_srcdir)/eglib/src -I$(top_builddir)/eglib/src')
674 ### set(GLIB_LIBS '-L$(top_builddir)/eglib/src -leglib -lm')
675 ### set(BUILD_GLIB_CFLAGS "$GLIB_CFLAGS")
676 ### set(BUILD_GLIB_LIBS "$GLIB_LIBS")
677 ### set(GMODULE_CFLAGS "$GLIB_CFLAGS")
678 ### set(GMODULE_LIBS "$GLIB_LIBS")
679 ### set(eglib_dir eglib)
680 ### AC_CONFIG_SUBDIRS(eglib)
683 ### ac_msg_error([Invalid argument to --with-glib.])
685 if(with_glib STREQUAL "embedded")
689 ###AC_SUBST(GLIB_CFLAGS)
690 ###AC_SUBST(GLIB_LIBS)
691 ###AC_SUBST(GMODULE_CFLAGS)
692 ###AC_SUBST(GMODULE_LIBS)
693 ###AC_SUBST(BUILD_GLIB_CFLAGS)
694 ###AC_SUBST(BUILD_GLIB_LIBS)
695 ###AC_SUBST(eglib_dir)
697 ###if test x$cross_compiling$platform_win32 = xnoyes; then
698 ### ac_msg_checking(for cygwin glib2-dev package)
699 ### if [ cygcheck --f /usr/lib/libglib-2.0.dll.a | grep -q glib2-devel ]; then
700 ### ac_msg_result(found)
701 ### 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.])
703 ### ac_msg_result(not found, ok)
706 ### ac_msg_checking(for broken gwin32.h)
707 ### set(glib_include `$PKG_CONFIG --cflags-only-I glib-2.0 | sed -e 's/ -I.*//g' | sed -e 's/-I//g'`)
708 ### if test -f $glib_include/glib/gwin32.h; then
709 ### if [ grep ftruncate $glib_include/glib/gwin32.h | grep -q define ]; then
710 ### ac_msg_result(failed)
711 ### set(hashmark '#')
712 ### 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.])
715 ### ac_msg_result(ok)
718 # Enable support for fast thread-local storage
719 # Some systems have broken support, so we allow to disable it.
720 set(tls __thread CACHE STRING "Select Thread Local Storage implementation. Possible values are '__thread_' and 'pthread' (defaults to __thread)")
723 # Enable support for using sigaltstack for SIGSEGV and stack overflow handling
724 # This does not work on some platforms (bug #55253)
725 set(sigaltstack yes CACHE BOOL "Enable/disable support for sigaltstack (defaults to yes)")
726 set(with_sigaltstack ${sigaltstack})
728 set(static_mono yes CACHE BOOL "Link mono statically to libmono (faster) (defaults to yes)")
729 set(with_static_mono ${static_mono})
731 ###if test "x$enable_static" = "xno"; then
732 ### set(with_static_mono no)
735 ###if test "x$platform_win32" = "xyes"; then
736 ### # Boehm GC requires the runtime to be in its own dll
737 ### set(with_static_mono no)
743 set(enable_mcs_build yes)
744 ###AC_ARG_ENABLE(mcs-build, [ --disable-mcs-build disable the build of the mcs directory], set(try_mcs_build $enableval, enable_mcs_build=yes))
746 ###set(xen_opt, [ --with-set(xen_opt yes,no Enable Xen-specific behaviour (defaults to yes)],[],[with_xen_opt=yes]))
747 ###if test "x$with_xen_opt" = "xyes"; then
748 ### ac_define(MONO_XEN_OPT, 1, [Xen-specific behaviour])
749 ### set(ORIG_CFLAGS $CFLAGS)
750 ### set(CFLAGS "$CFLAGS -mno-tls-direct-seg-refs")
751 ### ac_msg_checking(for -mno-tls-direct-seg-refs option to gcc)
752 ### AC_TRY_COMPILE([], [
755 ### ac_msg_result(yes)
756 ### # Pass it to libgc as well
757 ### set(CFLAGS_FOR_LIBGC "$CFLAGS_FOR_LIBGC -mno-tls-direct-seg-refs")
759 ### ac_msg_result(no)
760 ### set(CFLAGS $ORIG_CFLAGS)
764 set (quiet-build yes CACHE BOOL "Enable quiet runtime build (on by default)")
766 set(DISABLED_FEATURES none)
768 ###AC_ARG_ENABLE(minimal, [ --enable-set(minimal LIST drop support for LIST subsystems.)
769 ### LIST is a comma-separated list from: aot, profiler, decimal, pinvoke, debug,
770 ### reflection_emit, reflection_emit_save, large_code, logging, com, ssa, generics, attach, jit, simd.],
772 ### for feature in `echo "$enable_minimal" | sed -e "s/,/ /g"`; do
773 ### eval "mono_feature_disable_$set(feature 'yes'")
774 ### AC_MSG_NOTICE([Disabled support for feature: $feature])
776 ### set(DISABLED_FEATURES $enable_minimal)
777 ### set(disabled "Disabled: $enable_minimal")
780 ac_define_unquoted(DISABLED_FEATURES "${DISABLED_FEATURES}" "String of disabled features")
782 ###if test "x$mono_feature_disable_aot" = "xyes"; then
783 ### ac_define(DISABLE_AOT, 1, [Disable AOT support])
786 ###if test "x$mono_feature_disable_profiler" = "xyes"; then
787 ### ac_define(DISABLE_PROFILER, 1, [Disable default profiler support])
789 ###AM_CONDITIONAL(DISABLE_PROFILER, test x$mono_feature_disable_profiler = xyes)
791 ###if test "x$mono_feature_disable_decimal" = "xyes"; then
792 ### ac_define(DISABLE_DECIMAL, 1, [Disable System.Decimal support])
795 ###if test "x$mono_feature_disable_pinvoke" = "xyes"; then
796 ### ac_define(DISABLE_PINVOKE, 1, [Disable P/Invoke support])
799 ###if test "x$mono_feature_disable_debug" = "xyes"; then
800 ### ac_define(DISABLE_DEBUG, 1, [Disable runtime debugging support])
803 ###if test "x$mono_feature_disable_reflection_emit" = "xyes"; then
804 ### ac_define(DISABLE_REFLECTION_EMIT, 1, [Disable reflection emit support])
805 ### set(mono_feature_disable_reflection_emit_save yes)
808 ###if test "x$mono_feature_disable_reflection_emit_save" = "xyes"; then
809 ### ac_define(DISABLE_REFLECTION_EMIT_SAVE, 1, [Disable assembly saving support in reflection emit])
812 ###if test "x$mono_feature_disable_large_code" = "xyes"; then
813 ### ac_define(DISABLE_LARGE_CODE, 1, [Disable support for huge assemblies])
816 ###if test "x$mono_feature_disable_logging" = "xyes"; then
817 ### ac_define(DISABLE_LOGGING, 1, [Disable support debug logging])
820 ###if test "x$mono_feature_disable_com" = "xyes"; then
821 ### ac_define(DISABLE_COM, 1, [Disable COM support])
824 ###if test "x$mono_feature_disable_ssa" = "xyes"; then
825 ### ac_define(DISABLE_SSA, 1, [Disable advanced SSA JIT optimizations])
828 ###if test "x$mono_feature_disable_generics" = "xyes"; then
829 ### ac_define(DISABLE_GENERICS, 1, [Disable generics support])
832 ###if test "x$mono_feature_disable_attach" = "xyes"; then
833 ### ac_define(DISABLE_ATTACH, 1, [Disable agent attach support])
836 ###if test "x$mono_feature_disable_jit" = "xyes"; then
837 ### ac_define(DISABLE_JIT, 1, [Disable the JIT, only full-aot mode will be supported by the runtime.])
840 ###AM_CONDITIONAL(DISABLE_JIT, test x$mono_feature_disable_jit = xyes)
842 ###if test "x$mono_feature_disable_simd" = "xyes"; then
843 ### ac_define(DISABLE_SIMD, 1, [Disable SIMD intrinsics related optimizations.])
846 ###ac_msg_checking(for visibility __attribute__)
847 ###AC_TRY_COMPILE([], [
848 ### void __attribute__ ((visibility ("hidden"))) doit (void) {}
849 ### void main () { doit (); }
851 ### set(have_visibility_hidden yes)
852 ### ac_msg_result(yes)
854 ### set(have_visibility_hidden no)
855 ### ac_msg_result(no)
865 set(use_included_gc no)
866 set(libgc_configure_args)
867 set(gc_default included)
869 set(gc ${gc_default} CACHE STRING "The GC library to use (defaults to included)")
873 set(enable_parallel_mark yes)
874 ###AC_ARG_ENABLE(parallel-mark, [ --enable-parallel-mark Enables GC Parallel Marking], set(enable_parallel_mark $enableval, enable_parallel_mark=$parallel_mark))
875 ###if test x$enable_parallel_mark = xyes; then
876 ### set(libgc_configure_args "$libgc_configure_args --enable-parallel-mark")
881 set(LIBGC_STATIC_LIBS )
884 if (gc STREQUAL included)
887 set(use_included_gc yes)
890 set(LIBGC_CFLAGS '-I${top_srcdir}/libgc/include')
891 set(LIBGC_LIBS '${top_builddir}/libgc/libmonogc.la')
892 set(LIBGC_STATIC_LIBS '${top_builddir}/libgc/libmonogc-static.la')
894 ac_define(HAVE_BOEHM_GC 1 "Have Boehm GC")
895 ### AC_SUBST(HAVE_BOEHM_GC)
897 ac_define(HAVE_GC_H 1 "Have gc.h")
898 ac_define(USE_INCLUDED_LIBGC 1 "Use included libgc")
900 # The included libgc contains GCJ support
901 ac_define(HAVE_GC_GCJ_MALLOC 1 "Have GC_gcj_malloc")
902 ac_define(HAVE_GC_ENABLE 1 "Have GC_enable")
903 if (enable_parallel_mark STREQUAL yes)
904 ac_define_unquoted(USED_GC_NAME "Included Boehm (with typed GC and Parallel Mark)" "GC description")
906 ac_define_unquoted(USED_GC_NAME "Included Boehm (with typed GC)" "GC description")
911 ### xboehm|xbohem|xyes)
912 ### ac_check_headers(gc.h gc/gc.h, set(gc_headers yes))
913 ### AC_CHECK_LIB(gc, GC_malloc, set(found_boehm "yes",,$libdl))
915 ### if test "x$found_boehm" != "xyes"; then
916 ### ac_msg_error("GC requested but libgc not found! Install libgc or run configure with --with-set(gc none."))
918 ### if test "x$gc_headers" != "xyes"; then
919 ### ac_msg_error("GC requested but header files not found! You may need to install them by hand.")
922 ### ac_define(HAVE_BOEHM_GC, 1, [Have Boehm GC])
923 ### AC_SUBST(HAVE_BOEHM_GC)
924 ### set(LIBGC_LIBS "-lgc $libdl")
925 ### set(LIBGC_STATIC_LIBS "$LIBGC_LIBS")
927 ### # ac_check_funcs does not work for some reason...
928 ### AC_CHECK_LIB(gc, GC_gcj_malloc, set(found_gcj_malloc "yes",,$libdl))
929 ### if test "x$found_gcj_malloc" = "xyes"; then
930 ### ac_define(HAVE_GC_GCJ_MALLOC, 1, [Have GC_gcj_malloc])
931 ### ac_define_unquoted(USED_GC_NAME, "System Boehm (with typed GC)", [GC description])
933 ### ac_define_unquoted(USED_GC_NAME, "System Boehm (no typed GC)", [GC description])
935 ### AC_CHECK_LIB(gc, GC_enable, set(found_gc_enable "yes",,$libdl))
936 ### if test "x$found_gc_enable" = "xyes"; then
937 ### ac_define(HAVE_GC_ENABLE, 1, [Have 'GC_enable'])
942 ### set(found_boehm yes)
943 ### set(gc_headers yes)
944 ### set(use_included_gc yes)
945 ### set(libgc_dir libgc)
947 ### set(LIBGC_CFLAGS '-I$(top_srcdir)/libgc/include')
948 ### set(LIBGC_LIBS '$(top_builddir)/libgc/libmonogc.la')
949 ### set(LIBGC_STATIC_LIBS '$(top_builddir)/libgc/libmonogc-static.la')
951 ### ac_define(HAVE_BOEHM_GC, 1, [Have Boehm GC])
952 ### AC_SUBST(HAVE_BOEHM_GC)
954 ### ac_define(HAVE_GC_H, 1, [Have gc.h])
955 ### ac_define(USE_INCLUDED_LIBGC, 1, [Use included libgc])
957 ### # The included libgc contains GCJ support
958 ### ac_define(HAVE_GC_GCJ_MALLOC, 1, [Have GC_gcj_malloc])
959 ### ac_define(HAVE_GC_ENABLE, 1, [Have GC_enable])
960 ### if test x$enable_parallel_mark = xyes; then
961 ### ac_define_unquoted(USED_GC_NAME, "Included Boehm (with typed GC and Parallel Mark)", [GC description])
963 ### ac_define_unquoted(USED_GC_NAME, "Included Boehm (with typed GC)", [GC description])
968 ### set(found_boehm no)
969 ### set(gc_headers no)
970 ### set(use_included_gc no)
971 ### ac_define(HAVE_SGEN_GC,1,[Using the simple generational GC.])
972 ### ac_define(HAVE_MOVING_COLLECTOR,1,[The GC can move objects.])
973 ### ac_define(HAVE_WRITE_BARRIERS,1,[The GC needs write barriers.])
974 ### ac_define_unquoted(USED_GC_NAME, "Simple generational", [GC description])
978 ### AC_MSG_WARN("Compiling mono without GC.")
979 ### ac_define_unquoted(USED_GC_NAME, "none", [GC description])
980 ### ac_define(HAVE_NULL_GC,1,[No GC support.])
983 ### ac_msg_error([Invalid argument to --with-gc.])
987 ###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]))
988 ###if test "x$large_heap" = "xyes"; then
990 ### set(CPPFLAGS "$CPPFLAGS -DLARGE_CONFIG")
993 ###AM_CONDITIONAL(INCLUDED_LIBGC, test x$use_included_gc = xyes)
994 ###AC_SUBST(LIBGC_CFLAGS)
995 ###AC_SUBST(LIBGC_LIBS)
996 ###AC_SUBST(LIBGC_STATIC_LIBS)
997 ###AC_SUBST(libgc_dir)
1000 # End of libgc checks
1003 include(CheckFunctionExists)
1004 include(CheckLibraryExists)
1006 if(platform_win32 STREQUAL no)
1009 # hires monotonic clock support
1010 ### AC_SEARCH_LIBS(clock_gettime, rt)
1012 check_function_exists (dlopen dlopen_found)
1016 check_library_exists (-ldl dlopen "" libdl_found)
1024 if (dl_support STREQUAL no)
1026 ### AC_MSG_WARN([No dynamic loading support available])
1028 set(LIBS ${LIBS} ${DL_LIB})
1029 ac_define(HAVE_DL_LOADER 1 "dlopen-based dynamic loader available")
1031 ### # from glib's configure.in
1032 ### AC_CACHE_CHECK([for preceeding underscore in symbols],
1033 ### mono_cv_uscore,[
1034 ### AC_TRY_RUN([#include <dlfcn.h>
1035 ### int mono_underscore_test (void) { return 42; }
1037 ### void *f1 = (void*)0, *f2 = (void*)0, *handle;
1038 ### handle = dlopen ((void*)0, 0);
1040 ### f1 = dlsym (handle, "mono_underscore_test");
1041 ### f2 = dlsym (handle, "_mono_underscore_test");
1042 ### } return (!f2 || f1);
1044 ### [set(mono_cv_uscore yes],)
1045 ### [set(mono_cv_uscore no],)
1048 ### if test "x$mono_cv_uscore" = "xyes"; then
1049 ### set(MONO_DL_NEED_USCORE 1)
1051 ### set(MONO_DL_NEED_USCORE 0)
1053 ### AC_SUBST(MONO_DL_NEED_USCORE)
1054 ### AC_CHECK_FUNC(dlerror)
1057 # ******************************************************************
1058 # *** Checks for the IKVM JNI interface library ***
1059 # ******************************************************************
1060 set(ikvm-native yes CACHE BOOL "Build the IKVM JNI interface library (defaults to yes)")
1061 set(with_ikvm_native ${ikvm-native})
1062 set(ikvm_native_dir )
1063 if(with_ikvm_native)
1064 set(ikvm_native_dir ikvm-native)
1065 set(jdk_headers_found "IKVM Native")
1068 ac_check_headers(execinfo.h)
1070 ac_check_funcs(getgrgid_r)
1071 ac_check_funcs(getgrnam_r)
1072 ac_check_funcs(getpwnam_r)
1073 ac_check_funcs(getpwuid_r)
1074 ac_check_funcs(getresuid)
1075 ac_check_funcs(setresuid)
1076 ac_check_funcs(kqueue)
1077 ac_check_funcs(backtrace_symbols)
1078 ac_check_funcs(mkstemp)
1079 ac_check_funcs(mmap)
1080 ac_check_funcs(madvise)
1081 ac_check_funcs(getrusage)
1082 ac_check_funcs(getpriority)
1083 ac_check_funcs(setpriority)
1085 ac_check_funcs(sched_setaffinity)
1087 # ******************************************************************
1088 # *** Check for large file support ***
1089 # *** (If we were using autoconf 2.50 we'd use AC_SYS_LARGEFILE) ***
1090 # ******************************************************************
1092 # Check that off_t can represent 2**63 - 1 correctly, working around
1093 # potential compiler bugs. Defines LARGE_FILE_SUPPORT, adds $1 to
1094 # CPPFLAGS and sets $large_offt to yes if the test succeeds
1095 ### set(large_offt no)
1096 ### AC_DEFUN([LARGE_FILES], [
1097 ### set(large_CPPFLAGS $CPPFLAGS)
1098 ### set(CPPFLAGS "$CPPFLAGS $1")
1100 ### #include <sys/types.h>
1102 ### #define BIG_OFF_T (((off_t)1<<62)-1+((off_t)1<<62))
1104 ### int main(void) {
1105 ### int set(big_off_t ((BIG_OFF_T%2147483629==721) &&)
1106 ### (BIG_OFF_T%set(2147483647 =1));)
1114 ### ac_msg_result(ok)
1115 ### ac_define(HAVE_LARGE_FILE_SUPPORT, 1, [Have large file support])
1116 ### set(large_CPPFLAGS "$large_CPPFLAGS $1")
1117 ### set(large_offt yes)
1119 ### ac_msg_result(no)
1121 ### set(CPPFLAGS $large_CPPFLAGS)
1124 ### ac_msg_checking(if off_t is 64 bits wide)
1126 ### if test $large_offt = no; then
1127 ### ac_msg_checking(if set(_FILE_OFFSET_BITS 64 gives 64 bit off_t))
1128 ### LARGE_FILES("-set(D_FILE_OFFSET_BITS 64"))
1130 ### if test $large_offt = no; then
1131 ### AC_MSG_WARN([No 64 bit file size support available])
1134 # *****************************
1135 # *** Checks for libsocket ***
1136 # *****************************
1137 ### AC_CHECK_LIB(socket, socket, set(LIBS "$LIBS -lsocket"))
1139 # *******************************
1140 # *** Checks for MSG_NOSIGNAL ***
1141 # *******************************
1142 ### ac_msg_checking(for MSG_NOSIGNAL)
1143 ### AC_TRY_COMPILE([#include <sys/socket.h>], [
1144 ### int f = MSG_NOSIGNAL;
1146 ### # Yes, we have it...
1147 ### ac_msg_result(yes)
1148 ### ac_define(HAVE_MSG_NOSIGNAL, 1, [Have MSG_NOSIGNAL])
1150 ### # We'll have to use signals
1151 ### ac_msg_result(no)
1154 # *****************************
1155 # *** Checks for SOL_IP ***
1156 # *****************************
1157 ### ac_msg_checking(for SOL_IP)
1158 ### AC_TRY_COMPILE([#include <netdb.h>], [
1159 ### int level = SOL_IP;
1161 ### # Yes, we have it...
1162 ### ac_msg_result(yes)
1163 ### ac_define(HAVE_SOL_IP, 1, [Have SOL_IP])
1165 ### # We'll have to use getprotobyname
1166 ### ac_msg_result(no)
1169 # *****************************
1170 # *** Checks for SOL_IPV6 ***
1171 # *****************************
1172 ### ac_msg_checking(for SOL_IPV6)
1173 ### AC_TRY_COMPILE([#include <netdb.h>], [
1174 ### int level = SOL_IPV6;
1176 ### # Yes, we have it...
1177 ### ac_msg_result(yes)
1178 ### ac_define(HAVE_SOL_IPV6, 1, [Have SOL_IPV6])
1180 ### # We'll have to use getprotobyname
1181 ### ac_msg_result(no)
1184 # *****************************
1185 # *** Checks for SOL_TCP ***
1186 # *****************************
1187 ### ac_msg_checking(for SOL_TCP)
1188 ### AC_TRY_COMPILE([#include <netdb.h>], [
1189 ### int level = SOL_TCP;
1191 ### # Yes, we have it...
1192 ### ac_msg_result(yes)
1193 ### ac_define(HAVE_SOL_TCP, 1, [Have SOL_TCP])
1195 ### # We'll have to use getprotobyname
1196 ### ac_msg_result(no)
1199 # *****************************
1200 # *** Checks for IP_PKTINFO ***
1201 # *****************************
1202 ### ac_msg_checking(for IP_PKTINFO)
1203 ### AC_TRY_COMPILE([#include <netdb.h>], [
1204 ### int level = IP_PKTINFO;
1206 ### # Yes, we have it...
1207 ### ac_msg_result(yes)
1208 ### ac_define(HAVE_IP_PKTINFO, 1, [Have IP_PKTINFO])
1210 ### ac_msg_result(no)
1213 # *****************************
1214 # *** Checks for IPV6_PKTINFO ***
1215 # *****************************
1216 ### ac_msg_checking(for IPV6_PKTINFO)
1217 ### AC_TRY_COMPILE([#include <netdb.h>], [
1218 ### int level = IPV6_PKTINFO;
1220 ### # Yes, we have it...
1221 ### ac_msg_result(yes)
1222 ### ac_define(HAVE_IPV6_PKTINFO, 1, [Have IPV6_PKTINFO])
1224 ### ac_msg_result(no)
1227 # **********************************
1228 # *** Checks for IP_DONTFRAGMENT ***
1229 # **********************************
1230 ### ac_msg_checking(for IP_DONTFRAGMENT)
1231 ### AC_TRY_COMPILE([#include <netdb.h>], [
1232 ### int level = IP_DONTFRAGMENT;
1234 ### # Yes, we have it...
1235 ### ac_msg_result(yes)
1236 ### ac_define(HAVE_IP_DONTFRAGMENT, 1, [Have IP_DONTFRAGMENT])
1238 ### ac_msg_result(no)
1241 # **********************************
1242 # *** Checks for IP_MTU_DISCOVER ***
1243 # **********************************
1244 ### ac_msg_checking(for IP_MTU_DISCOVER)
1245 ### AC_TRY_COMPILE([#include <netdb.h>], [
1246 ### int level = IP_MTU_DISCOVER;
1248 ### # Yes, we have it...
1249 ### ac_msg_result(yes)
1250 ### ac_define(HAVE_IP_MTU_DISCOVER, 1, [Have IP_MTU_DISCOVER])
1252 ### ac_msg_result(no)
1255 ### # *********************************
1256 # *** Check for struct ip_mreqn ***
1257 # *********************************
1258 ### ac_msg_checking(for struct ip_mreqn)
1259 ### AC_TRY_COMPILE([#include <netinet/in.h>], [
1260 ### struct ip_mreqn mreq;
1261 ### mreq.imr_address.s_addr = 0;
1263 ### # Yes, we have it...
1264 ### ac_msg_result(yes)
1265 ### ac_define(HAVE_STRUCT_IP_MREQN, 1, [Have struct ip_mreqn])
1267 ### # We'll just have to try and use struct ip_mreq
1268 ### ac_msg_result(no)
1269 ### ac_msg_checking(for struct ip_mreq)
1270 ### AC_TRY_COMPILE([#include <netinet/in.h>], [
1271 ### struct ip_mreq mreq;
1272 ### mreq.imr_interface.s_addr = 0;
1274 ### # Yes, we have it...
1275 ### ac_msg_result(yes)
1276 ### ac_define(HAVE_STRUCT_IP_MREQ, 1, [Have struct ip_mreq])
1278 ### # No multicast support
1279 ### ac_msg_result(no)
1283 # **********************************
1284 # *** Check for gethostbyname2_r ***
1285 # **********************************
1286 ### ac_msg_checking(for gethostbyname2_r)
1287 ### AC_TRY_LINK([#include <netdb.h>], [
1288 ### gethostbyname2_r(NULL,0,NULL,NULL,0,NULL,NULL);
1290 ### # Yes, we have it...
1291 ### ac_msg_result(yes)
1292 ### ac_define(HAVE_GETHOSTBYNAME2_R, 1, [Have gethostbyname2_r])
1294 ### ac_msg_result(no)
1297 # *****************************
1298 # *** Checks for libnsl ***
1299 # *****************************
1300 ### AC_CHECK_FUNC(gethostbyaddr, , AC_CHECK_LIB(nsl, gethostbyaddr, set(LIBS "$LIBS -lnsl")))
1302 ac_check_funcs(inet_pton inet_aton)
1304 # ***********************************************
1305 # *** Checks for size of sockaddr_un.sun_path ***
1306 # ***********************************************
1308 ac_msg_checking("size of sockaddr_un.sun_path")
1310 FILE(WRITE "${CMAKE_BINARY_DIR}/${CMAKE_FILES_DIRECTORY}/CMakeTmp/conftest.c"
1312 #include <sys/types.h>
1317 struct sockaddr_un sock_un;
1318 printf(\"%d\\n\", sizeof(sock_un.sun_path));
1323 TRY_RUN(run_res run_compiled
1325 ${CMAKE_BINARY_DIR}/${CMAKE_FILES_DIRECTORY}/CMakeTmp/conftest.c
1326 RUN_OUTPUT_VARIABLE output)
1328 set(mono_cv_sizeof_sunpath 0)
1330 if (run_res EQUAL 0)
1331 string(REGEX MATCH "[0-9]+" mono_cv_sizeof_sunpath ${output})
1335 ac_msg_result(${mono_cv_sizeof_sunpath})
1336 ac_define(MONO_SIZEOF_SUNPATH ${mono_cv_sizeof_sunpath} "Sizeof sock_un.sun_path")
1338 # *************************************
1339 # *** Checks for zero length arrays ***
1340 # *************************************
1341 ### ac_msg_checking(whether $CC supports zero length arrays)
1342 ### AC_TRY_COMPILE([
1348 ### ac_msg_result(yes)
1349 ### ac_define_unquoted(MONO_ZERO_ARRAY_LENGTH, 0, [Length of zero length arrays])
1351 ### ac_msg_result(no)
1352 ### ac_define_unquoted(MONO_ZERO_ARRAY_LENGTH, 1, [Length of zero length arrays])
1355 # *****************************
1356 # *** Checks for libxnet ***
1357 # *****************************
1358 ### case "${host}" in
1360 ### ac_msg_checking(for Solaris XPG4 support)
1361 ### if test -f /usr/lib/libxnet.so; then
1362 ### set(CPPFLAGS "$CPPFLAGS -D_XOPEN_SOURCE=500")
1363 ### set(CPPFLAGS "$CPPFLAGS -D__EXTENSIONS__")
1364 ### set(CPPFLAGS "$CPPFLAGS -D_XOPEN_SOURCE_EXTENDED=1")
1365 ### set(LIBS "$LIBS -lxnet")
1366 ### ac_msg_result(yes)
1368 ### ac_msg_result(no)
1371 ### if test "$GCC" = "yes"; then
1372 ### set(CFLAGS "$CFLAGS -Wno-char-subscripts")
1377 # *****************************
1378 # *** Checks for libpthread ***
1379 # *****************************
1380 # on FreeBSD -STABLE, the pthreads functions all reside in libc_r
1381 # and libpthread does not exist
1383 ### case "${host}" in
1385 ### AC_CHECK_LIB(pthread, main, set(LIBS "$LIBS -pthread"))
1388 ### AC_CHECK_LIB(pthread, main, set(LIBS "$LIBS -lpthread"))
1391 ac_check_headers(pthread.h)
1392 ### ac_check_funcs(pthread_mutex_timedlock)
1393 ### ac_check_funcs(pthread_getattr_np pthread_attr_get_np)
1394 ### ac_msg_checking(for PTHREAD_MUTEX_RECURSIVE)
1395 ### AC_TRY_COMPILE([ #include <pthread.h>], [
1396 ### pthread_mutexattr_t attr;
1397 ### pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
1399 ### ac_msg_result(ok)
1401 ### ac_msg_result(no)
1402 ### AC_MSG_WARN(Using mono_mutex_t for recursive mutexes)
1403 ### ac_define(USE_MONO_MUTEX, 1, [Use mono_mutex_t])
1405 ### ac_check_funcs(pthread_attr_setstacksize)
1406 ### ac_check_funcs(pthread_attr_getstack)
1407 ### ac_check_funcs(pthread_get_stacksize_np pthread_get_stackaddr_np)
1409 # ***********************************
1410 # *** Checks for working __thread ***
1411 # ***********************************
1412 ### ac_msg_checking(for working __thread)
1413 ### if test "x$with_tls" != "x__thread"; then
1414 ### ac_msg_result(disabled)
1417 ### #include <pthread.h>
1419 ### static int res1, res2;
1421 ### void thread_main (void *arg)
1426 ### res1 = (i == arg);
1428 ### res2 = (i == arg);
1432 ### pthread_t t1, t2;
1436 ### pthread_create (&t1, NULL, thread_main, 1);
1437 ### pthread_create (&t2, NULL, thread_main, 2);
1439 ### pthread_join (t1, NULL);
1440 ### pthread_join (t2, NULL);
1442 ### return !(res1 + res2 == 2);
1445 ### ac_msg_result(yes)
1447 ### ac_msg_result(no)
1448 ### set(with_tls pthread)
1452 # **************************************
1453 # *** Checks for working sigaltstack ***
1454 # **************************************
1455 ### ac_msg_checking(for working sigaltstack)
1456 ### if test "x$with_sigaltstack" != "xyes"; then
1457 ### ac_msg_result(disabled)
1460 ### #include <stdio.h>
1461 ### #include <stdlib.h>
1462 ### #include <unistd.h>
1463 ### #include <signal.h>
1464 ### #include <pthread.h>
1465 ### #include <sys/wait.h>
1466 ### #if defined(__FreeBSD__) || defined(__NetBSD__)
1467 ### #define SA_STACK SA_ONSTACK
1470 ### sigsegv_signal_handler (int _dummy, siginfo_t *info, void *context)
1476 ### loop (void *ignored)
1478 ### char *ptr = NULL;
1487 ### struct sigaction sa;
1488 ### struct sigaltstack sas;
1490 ### pthread_attr_t attr;
1492 ### sa.sa_sigaction = sigsegv_signal_handler;
1493 ### sigemptyset (&sa.sa_mask);
1494 ### sa.sa_flags = SA_SIGINFO | SA_ONSTACK;
1495 ### if (sigaction (SIGSEGV, &sa, NULL) == -1) {
1496 ### perror ("sigaction");
1500 ### sas.ss_sp = malloc (SIGSTKSZ);
1501 ### sas.ss_size = SIGSTKSZ;
1502 ### sas.ss_flags = 0;
1503 ### if (sigaltstack (&sas, NULL) == -1) {
1504 ### perror ("sigaltstack");
1508 ### pthread_attr_init (&attr);
1509 ### if (pthread_create(&id, &attr, loop, &attr) != 0) {
1510 ### printf ("pthread_create\n");
1525 ### if (son == -1) {
1534 ### for (i = 0; i < 3; ++i) {
1536 ### waitpid (son, &status, WNOHANG);
1537 ### if (WIFEXITED (status) && WEXITSTATUS (status) == 0)
1541 ### kill (son, SIGKILL);
1546 ### ac_msg_result(yes)
1547 ### ac_define(HAVE_WORKING_SIGALTSTACK, 1, [Have a working sigaltstack])
1549 ### set(with_sigaltstack no)
1550 ### ac_msg_result(no)
1554 # ********************************
1555 # *** Checks for semaphore lib ***
1556 # ********************************
1557 # 'Real Time' functions on Solaris
1558 # posix4 on Solaris 2.6
1559 # pthread (first!) on Linux
1560 ### AC_SEARCH_LIBS(sem_init, pthread rt posix4)
1561 check_library_exists(pthread shm_open "" HAVE_SHM_OPEN1)
1565 check_library_exists(rt shm_open "" HAVE_SHM_OPEN2)
1567 set(LIBS ${LIBS} -lrt)
1568 set(CMAKE_REQUIRED_LIBRARIES rt)
1569 ac_check_funcs(shm_open)
1570 set(CMAKE_REQUIRED_LIBRARIES)
1576 # ********************************
1577 # *** Checks for timezone stuff **
1578 # ********************************
1579 ### AC_CACHE_CHECK(for tm_gmtoff in struct tm, ac_cv_struct_tm_gmtoff,
1580 ### AC_TRY_COMPILE([
1581 ### #include <time.h>
1584 ### tm.tm_gmtoff = 1;
1585 ### ], set(ac_cv_struct_tm_gmtoff yes, ac_cv_struct_tm_gmtoff=no)))
1586 ### if test $ac_cv_struct_tm_gmtoff = yes; then
1587 ### ac_define(HAVE_TM_GMTOFF, 1, [Have tm_gmtoff])
1589 ### AC_CACHE_CHECK(for timezone variable, ac_cv_var_timezone,
1590 ### AC_TRY_COMPILE([
1591 ### #include <time.h>
1594 ### ], set(ac_cv_var_timezone yes, ac_cv_var_timezone=no)))
1595 ### if test $ac_cv_var_timezone = yes; then
1596 ### ac_define(HAVE_TIMEZONE, 1, [Have timezone variable])
1598 ### AC_ERROR(unable to find a way to determine timezone)
1602 # *********************************
1603 # *** Checks for math functions ***
1604 # *********************************
1605 set(LIBS ${LIBS} -lm)
1606 ### if test "x$has_broken_apple_cpp" != "xyes"; then
1607 ### ac_check_funcs(finite, , ac_msg_checking(for finite in math.h)
1608 ### AC_TRY_LINK([#include <math.h>],
1609 ### [ finite(0.0); ],
1610 ### ac_define(HAVE_FINITE, 1, [Have finite]) ac_msg_result(yes),
1611 ### ac_msg_result(no)))
1613 ### ac_check_funcs(isfinite, , ac_msg_checking(for isfinite in math.h)
1614 ### AC_TRY_LINK([#include <math.h>],
1615 ### [ isfinite(0.0); ],
1616 ### ac_define(HAVE_ISFINITE, 1, [Have isfinite]) ac_msg_result(yes),
1617 ### ac_msg_result(no)))
1619 # ****************************************************************
1620 # *** Checks for working poll() (macosx defines it but doesn't ***
1621 # *** have it in the library (duh)) ***
1622 # ****************************************************************
1623 ### ac_check_funcs(poll)
1625 # *************************
1626 # *** Check for signbit ***
1627 # *************************
1628 ### ac_msg_checking(for signbit)
1629 ### AC_TRY_LINK([#include <math.h>], [
1630 ### int s = signbit(1.0);
1632 ### ac_msg_result(yes)
1633 ### ac_define(HAVE_SIGNBIT, 1, [Have signbit])
1635 ### ac_msg_result(no)
1638 # **********************************
1640 # **********************************
1641 ac_check_headers(sys/epoll.h)
1643 ### ac_check_funcs(epoll_ctl, [set(haveepoll yes], ))
1644 ### if test "x$haveepoll" = "xyes" -a "x$ac_cv_header_sys_epoll_h" = "xyes" ; then
1645 ### ac_define(HAVE_EPOLL, 1, [epoll supported])
1648 # ******************************
1649 # *** Checks for SIOCGIFCONF ***
1650 # ******************************
1651 ac_check_headers(sys/ioctl.h)
1652 ac_check_headers(net/if.h)
1653 ### ac_msg_checking(for ifreq)
1654 ### AC_TRY_COMPILE([
1655 ### #include <stdio.h>
1656 ### #include <sys/ioctl.h>
1657 ### #include <net/if.h>
1659 ### struct ifconf ifc;
1660 ### struct ifreq *ifr;
1662 ### ifc.ifc_len = 0;
1663 ### ifc.ifc_buf = NULL;
1664 ### x = (void *) &ifr->ifr_addr;
1666 ### ac_msg_result(yes)
1667 ### ac_define(HAVE_SIOCGIFCONF, 1, [Can get interface list])
1669 ### ac_msg_result(no)
1671 # **********************************
1672 # *** Checks for sin_len ***
1673 # **********************************
1674 ### ac_msg_checking(for sockaddr_in.sin_len)
1675 ### AC_TRY_COMPILE([
1676 ### #include <netinet/in.h>
1678 ### struct sockaddr_in saddr;
1679 ### saddr.sin_len = sizeof (saddr);
1681 ### ac_msg_result(yes)
1682 ### ac_define(HAVE_SOCKADDR_IN_SIN_LEN, 1, [sockaddr_in has sin_len])
1684 ### ac_msg_result(no)
1686 # **********************************
1687 # *** Checks for sin6_len ***
1688 # **********************************
1689 ### ac_msg_checking(for sockaddr_in6.sin6_len)
1690 ### AC_TRY_COMPILE([
1691 ### #include <netinet/in.h>
1693 ### struct sockaddr_in6 saddr6;
1694 ### saddr6.sin6_len = sizeof (saddr6);
1696 ### ac_msg_result(yes)
1697 ### ac_define(HAVE_SOCKADDR_IN6_SIN_LEN, 1, [sockaddr_in6 has sin6_len])
1699 ### ac_msg_result(no)
1701 # **********************************
1702 # *** Checks for MonoPosixHelper ***
1703 # **********************************
1704 ac_check_headers(checklist.h)
1705 ac_check_headers(fstab.h)
1706 ac_check_headers(attr/xattr.h)
1707 ac_check_headers(sys/extattr.h)
1708 ac_check_headers(sys/sendfile.h)
1709 ac_check_headers(sys/statvfs.h)
1710 ac_check_headers(sys/statfs.h)
1711 ac_check_headers(sys/vfstab.h)
1712 ac_check_headers(sys/xattr.h)
1713 ac_check_headers(sys/mman.h)
1714 ac_check_headers(sys/param.h)
1715 ac_check_headers(sys/mount.h)
1716 ### ac_check_funcs(getdomainname)
1717 ### ac_check_funcs(setdomainname)
1718 ### ac_check_funcs(fgetgrent)
1719 ### ac_check_funcs(fgetpwent)
1720 ### ac_check_funcs(fgetpwent)
1721 ### ac_check_funcs(getfsstat)
1722 ### ac_check_funcs(lutimes)
1723 ### ac_check_funcs(mremap)
1724 ### ac_check_funcs(remap_file_pages)
1725 ### ac_check_funcs(posix_fadvise)
1726 ### ac_check_funcs(posix_fallocate)
1727 ### ac_check_funcs(posix_madvise)
1728 ### ac_check_funcs(vsnprintf)
1729 ### ac_check_funcs(sendfile)
1730 ### ac_check_funcs(sethostid)
1731 ### ac_check_funcs(statfs)
1732 ### ac_check_funcs(fstatfs)
1733 ### ac_check_funcs(statvfs)
1734 ### ac_check_funcs(fstatvfs)
1735 ### ac_check_funcs(stime)
1736 ### ac_check_funcs(strerror_r)
1737 ### ac_check_funcs(ttyname_r)
1738 ac_check_sizeof(size_t)
1739 ### AC_CHECK_TYPES([blksize_t], [ac_define(HAVE_BLKSIZE_T)], ,
1740 ### [#include <sys/types.h>
1741 ### #include <sys/stat.h>
1742 ### #include <unistd.h>])
1743 ### AC_CHECK_TYPES([blkcnt_t], [ac_define(HAVE_BLKCNT_T)], ,
1744 ### [#include <sys/types.h>
1745 ### #include <sys/stat.h>
1746 ### #include <unistd.h>])
1747 ### AC_CHECK_TYPES([suseconds_t], [ac_define(HAVE_SUSECONDS_T)], ,
1748 ### [#include <sys/time.h>])
1749 ### AC_CHECK_TYPES([struct flock], [ac_define(HAVE_STRUCT_FLOCK)], ,
1750 ### [#include <unistd.h>
1751 ### #include <fcntl.h>])
1752 ### AC_CHECK_TYPES([struct pollfd], [ac_define(HAVE_STRUCT_POLLFD)], ,
1753 ### [#include <sys/poll.h>])
1754 ### AC_CHECK_TYPES([struct stat], [ac_define(HAVE_STRUCT_STAT)], ,
1755 ### [#include <sys/types.h>
1756 ### #include <sys/stat.h>
1757 ### #include <unistd.h>])
1758 ### AC_CHECK_TYPES([struct timespec], [ac_define(HAVE_STRUCT_TIMESPEC)], ,
1759 ### [#include <time.h>])
1760 ### AC_CHECK_TYPES([struct timeval], [ac_define(HAVE_STRUCT_TIMEVAL)], ,
1761 ### [#include <sys/time.h>
1762 ### #include <sys/types.h>
1763 ### #include <utime.h>])
1764 ### AC_CHECK_TYPES([struct timezone], [ac_define(HAVE_STRUCT_TIMEZONE)], ,
1765 ### [#include <sys/time.h>])
1766 ### AC_CHECK_TYPES([struct utimbuf], [ac_define(HAVE_STRUCT_UTIMBUF)], ,
1767 ### [#include <sys/types.h>
1768 ### #include <utime.h>])
1769 ### AC_CHECK_MEMBERS(
1770 ### [struct dirent.d_off, struct dirent.d_reclen, struct dirent.d_type],,,
1771 ### [#include <sys/types.h>
1772 ### #include <dirent.h>])
1774 # Favour xattr through glibc, but use libattr if we have to
1775 ### AC_CHECK_FUNC(lsetxattr, ,
1776 ### AC_CHECK_LIB(attr, lsetxattr, set(XATTR_LIB "-lattr",))
1778 ### AC_SUBST(XATTR_LIB)
1780 # kinfo_proc.kp_proc works on darwin but fails on other simil-bsds
1781 ### AC_CHECK_MEMBERS(
1782 ### [struct kinfo_proc.kp_proc],,,
1783 ### [#include <sys/types.h>
1784 ### #include <sys/sysctl.h>
1785 ### #include <sys/proc.h>
1788 # *********************************
1789 # *** Checks for Windows compilation ***
1790 # *********************************
1791 ac_check_headers(sys/time.h)
1792 ac_check_headers(sys/param.h)
1793 ac_check_headers(dirent.h)
1795 # *********************************
1796 # *** Check for Console 2.0 I/O ***
1797 # *********************************
1798 ac_check_headers(curses.h)
1799 ac_check_headers(term.h)
1800 ### ac_check_headers([term.h], [], [],
1801 ### [#if HAVE_CURSES_H
1802 ### #include <curses.h>
1805 ac_check_headers(termios.h)
1807 # * This is provided in io-layer, but on windows it's only available
1809 ### ac_define(HAVE_GETPROCESSID, 1, [Define if GetProcessId is available])
1811 ### set(jdk_headers_found no)
1812 ### AC_CHECK_LIB(ws2_32, main, set(LIBS "$LIBS -lws2_32", AC_ERROR(bad mingw install?)))
1813 ### AC_CHECK_LIB(psapi, main, set(LIBS "$LIBS -lpsapi", AC_ERROR(bad mingw install?)))
1814 ### AC_CHECK_LIB(ole32, main, set(LIBS "$LIBS -lole32", AC_ERROR(bad mingw install?)))
1815 ### AC_CHECK_LIB(winmm, main, set(LIBS "$LIBS -lwinmm", AC_ERROR(bad mingw install?)))
1816 ### AC_CHECK_LIB(oleaut32, main, set(LIBS "$LIBS -loleaut32", AC_ERROR(bad mingw install?)))
1817 ### AC_CHECK_LIB(advapi32, main, set(LIBS "$LIBS -ladvapi32", AC_ERROR(bad mingw install?)))
1818 ### AC_CHECK_LIB(version, main, set(LIBS "$LIBS -lversion", AC_ERROR(bad mingw install?)))
1820 # *********************************
1821 # *** Check for struct ip_mreqn ***
1822 # *********************************
1823 ### ac_msg_checking(for struct ip_mreqn)
1824 ### AC_TRY_COMPILE([#include <ws2tcpip.h>], [
1825 ### struct ip_mreqn mreq;
1826 ### mreq.imr_address.s_addr = 0;
1828 ### # Yes, we have it...
1829 ### ac_msg_result(yes)
1830 ### ac_define(HAVE_STRUCT_IP_MREQN)
1832 ### # We'll just have to try and use struct ip_mreq
1833 ### ac_msg_result(no)
1834 ### ac_msg_checking(for struct ip_mreq)
1835 ### AC_TRY_COMPILE([#include <ws2tcpip.h>], [
1836 ### struct ip_mreq mreq;
1837 ### mreq.imr_interface.s_addr = 0;
1839 ### # Yes, we have it...
1840 ### ac_msg_result(yes)
1841 ### ac_define(HAVE_STRUCT_IP_MREQ)
1843 ### # No multicast support
1844 ### ac_msg_result(no)
1847 ### ac_check_funcs(GetProcessId)
1853 ac_msg_checking("for socklen_t")
1854 check_c_source_compiles("
1855 #include <sys/types.h>
1856 #include <sys/socket.h>
1861 ac_define(HAVE_SOCKLEN_T 1 "Have socklen_t")
1867 ###ac_msg_checking(for array element initalizer support)
1868 ###AC_TRY_COMPILE([#include <sys/socket.h>], [
1869 ### const int array[] = {[1] = 2,};
1871 # Yes, we have it...
1872 ### ac_msg_result(yes)
1873 ### ac_define(HAVE_ARRAY_ELEM_INIT,1,[Supports C99 array initialization])
1875 # We'll have to use signals
1876 ### ac_msg_result(no)
1879 ac_check_funcs(trunc)
1881 ac_msg_checking("for trunc in math.h")
1882 # Simply calling trunc (0.0) is no good since gcc will optimize the call away
1884 check_c_source_compiles("
1887 static void *p = &trunc;
1891 ac_define(HAVE_TRUNC 1 "")
1898 ###if test "x$ac_cv_truncl" != "xyes"; then
1899 ### AC_CHECK_LIB(sunmath, aintl, [ ac_define(HAVE_AINTL, 1, [Has the 'aintl' function]) set(LIBS "$LIBS -lsunmath"]))
1902 ac_check_funcs(round)
1903 ac_check_funcs(rint)
1905 # ****************************
1906 # *** Look for /dev/random ***
1907 # ****************************
1909 ###ac_msg_checking([if usage of random device is requested])
1910 ###AC_ARG_ENABLE(dev-random,
1911 ###[ --disable-dev-random disable the use of the random device (enabled by default)],
1912 ###set(try_dev_random $enableval, try_dev_random=yes))
1914 ###ac_msg_result($try_dev_random)
1916 ###case "{$target}" in
1918 ### set(NAME_DEV_RANDOM "/dev/srandom")
1921 # Win32 does not have /dev/random, they have their own method...
1923 ### *-*-mingw*|*-*-cygwin*)
1924 ### set(ac_cv_have_dev_random no)
1927 # Everywhere else, it's /dev/random
1930 ### set(NAME_DEV_RANDOM "/dev/random")
1934 ###ac_define_unquoted(NAME_DEV_RANDOM, "$NAME_DEV_RANDOM", [Name of /dev/random])
1936 # Now check if the device actually exists
1938 ###if test "x$try_dev_random" = "xyes"; then
1939 ### AC_CACHE_CHECK(for random device, ac_cv_have_dev_random,
1940 ### [if test -r "$NAME_DEV_RANDOM" ; then
1941 ### set(ac_cv_have_dev_random yes; else ac_cv_have_dev_random=no; fi]))
1942 ### if test "x$ac_cv_have_dev_random" = "xyes"; then
1943 ### ac_define(HAVE_CRYPT_RNG, 1, [Have /dev/random])
1946 ### ac_msg_checking(for random device)
1947 ### set(ac_cv_have_dev_random no)
1948 ### ac_msg_result(has been disabled)
1951 ###if test "x$platform_win32" = "xyes"; then
1952 ### ac_define(HAVE_CRYPT_RNG)
1955 ###if test "x$ac_cv_have_dev_random" = "xno" \
1956 ### && test "x$platform_win32" = "xno"; then
1959 ###*** A system-provided entropy source was not found on this system.
1960 ###*** Because of this, the System.Security.Cryptography random number generator
1961 ###*** will throw a NotImplemented exception.
1963 ###*** If you are seeing this message, and you know your system DOES have an
1964 ###*** entropy collection in place, please contact <crichton@gimp.org> and
1965 ###*** provide information about the system and how to access the random device.
1967 ###*** Otherwise you can install either egd or prngd and set the environment
1968 ###*** variable MONO_EGD_SOCKET to point to the daemon's socket to use that.
1972 ###ac_msg_checking([if inter-process shared handles are requested])
1973 ###AC_ARG_ENABLE(shared-handles, [ --disable-shared-handles disable inter-process shared handles], set(try_shared_handles $enableval, try_shared_handles=yes))
1974 ###ac_msg_result($try_shared_handles)
1975 ###if test "x$try_shared_handles" != "xyes"; then
1976 ### ac_define(DISABLE_SHARED_HANDLES, 1, [Disable inter-process shared handles])
1977 ### AC_SUBST(DISABLE_SHARED_HANDLES)
1980 ###if test x$gc = xsgen; then
1981 ### if test x$with_tls != x__thread; then
1982 ### 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.]))
1986 ###AC_ARG_ENABLE(nunit-tests, [ --enable-nunit-tests Run the nunit tests of the class library on 'make check'])
1987 ###AM_CONDITIONAL(ENABLE_NUNIT_TESTS, [test x$enable_nunit_tests = xyes])
1989 ac_msg_checking("if big-arrays are to be enabled")
1990 set(big-arrays no CACHE STRING "Enable the allocation and indexing of arrays greater than Int32.MaxValue]")
1991 set(enable_big_arrays ${big-arrays})
1992 ###if test "x$enable_big_arrays" = "xyes" ; then
1993 ### if test "x$ac_cv_sizeof_void_p" = "x8"; then
1994 ### ac_define(MONO_BIG_ARRAYS,1,[Enable the allocation and indexing of arrays greater than Int32.MaxValue])
1996 ### ac_msg_error([The allocation and indexing of arrays greater than Int32.MaxValue is not supported on this platform.])
1999 ###ac_msg_result($enable_big_arrays)
2005 set(dtrace ${has_dtrace} CACHE BOOL "Enable DTrace probes")
2006 set(enable_dtrace ${dtrace})
2008 ###if test "x$enable_dtrace" = "xyes"; then
2009 ### if test "x$has_dtrace" = "xno"; then
2010 ### ac_msg_error([DTrace probes are not supported on this platform.])
2012 ### AC_PATH_PROG(DTRACE, [dtrace], [no], [$PATH:/usr/sbin])
2013 ### if test "x$DTRACE" = "xno"; then
2014 ### ac_msg_result([dtrace utility not found, dtrace support disabled.])
2015 ### set(enable_dtrace no)
2020 ###if test "x$enable_dtrace" = "xyes"; then
2021 ### ac_define(ENABLE_DTRACE, 1, [Enable DTrace probes])
2022 ### set(DTRACEFLAGS )
2023 ### if test "x$ac_cv_sizeof_void_p" = "x8"; then
2025 ### powerpc-*-darwin*)
2026 ### set(DTRACEFLAGS "-arch ppc64")
2029 ### set(DTRACEFLAGS "-arch x86_64")
2032 ### set(DTRACEFLAGS -64)
2037 ### powerpc-*-darwin*)
2038 ### set(DTRACEFLAGS "-arch ppc")
2041 ### set(DTRACEFLAGS "-arch i386")
2044 ### set(DTRACEFLAGS -32)
2048 ### AC_SUBST(DTRACEFLAGS)
2051 ### set(dtrace_g yes)
2054 ### ac_check_headers([sys/sdt.h])
2056 ###AM_CONDITIONAL(ENABLE_DTRACE, [test x$enable_dtrace = xyes])
2057 ###AM_CONDITIONAL(DTRACE_G_REQUIRED, [test x$dtrace_g = xyes])
2063 set(llvm no CACHE BOOL "Enable the experimental LLVM back-end")
2064 set(enable_llvm ${llvm})
2066 ###if test "x$enable_llvm" = "xyes"; then
2067 ### AC_PATH_PROG(LLVM_CONFIG, llvm-config, no)
2068 ### if test "x$LLVM_CONFIG" = "xno"; then
2069 ### ac_msg_error([llvm-config not found.])
2072 ### set(LLVM_CXXFLAGS `$LLVM_CONFIG --cflags`)
2073 ### set(LLVM_LDFLAGS `$LLVM_CONFIG --ldflags`)
2074 ### set(LLVM_LIBS `$LLVM_CONFIG --libs core engine`)
2075 ### set(LLVM_LIBS "$LLVM_LDFLAGS $LLVM_LIBS -lstdc++")
2077 ### AC_SUBST(LLVM_CXXFLAGS)
2078 ### AC_SUBST(LLVM_LIBS)
2079 ### ac_define(ENABLE_LLVM, 1, [Enable the LLVM back end])
2083 set(ENABLE_LLVM yes)
2087 # Architecture-specific checks
2089 set(TARGET "unknown")
2090 set(ACCESS_UNALIGNED "yes")
2092 set(JIT_SUPPORTED no)
2093 set(INTERP_SUPPORTED no)
2094 set(LIBC "libc.so.6")
2095 set(INTL "libc.so.6")
2096 set(SQLITE "libsqlite.so.0")
2097 set(SQLITE3 "libsqlite3.so.0")
2098 set(X11 "libX11.so")
2100 set(sizeof_register "SIZEOF_VOID_P")
2102 set(jit_wanted false)
2103 set(interp_wanted false)
2105 if(host MATCHES "(x86_64-.*-.*)|(amd64-.*-.*)")
2107 set(arch_target amd64)
2108 set(JIT_SUPPORTED yes)
2109 set(jit_wanted true)
2110 elseif(host MATCHES "arm.*-linux.*")
2112 set(arch_target arm)
2113 set(ACCESS_UNALIGNED no)
2114 set(JIT_SUPPORTED yes)
2115 set(jit_wanted true)
2116 elseif(host MATCHES "mips.*")
2118 set(arch_target mips)
2119 set(ACCESS_UNALIGNED no)
2120 set(JIT_SUPPORTED yes)
2121 set(jit_wanted true)
2122 ### ac_msg_checking(for mips n32)
2123 ### AC_TRY_COMPILE([], [
2125 ### #if _MIPS_SIM != _ABIN32
2126 ### #error Not mips n32
2130 ### ac_msg_result(yes)
2131 ### set(sizeof_register 8)
2133 ### ac_msg_result(no)
2137 message(FATAL_ERROR "Host ${host} not yet supported by the cmake build.")
2140 # FIXME: Define the others as well
2141 if (${TARGET} STREQUAL "X86")
2142 ac_define(TARGET_X86 1 [...])
2143 elseif (${TARGET} STREQUAL "AMD64")
2144 ac_define(TARGET_AMD64 1 [...])
2145 elseif (${TARGET} STREQUAL "ARM")
2146 ac_define(TARGET_ARM 1 [...])
2150 # mips-sgi-irix5.* | mips-sgi-irix6.*)
2152 # set(ACCESS_UNALIGNED "no")
2155 ### set(TARGET X86;)
2156 ### set(arch_target x86;)
2157 ### set(JIT_SUPPORTED yes)
2158 ### set(jit_wanted true)
2159 ### case $host_os in
2161 ### set(LIBC "libc.so")
2162 ### set(INTL "libintl.so")
2163 ### if test "x$ac_cv_sizeof_void_p" = "x8"; then
2164 ### set(TARGET AMD64)
2165 ### set(arch_target amd64)
2168 ### # On solaris 10 x86, gcc prints a warning saying 'visibility attribute not supported on this configuration; ignored', but linking fails. A test case:
2169 ### # int astruct __attribute__ ((visibility ("hidden")));
2172 ### # void *p = &astruct;
2174 ### # gcc -fPIC --shared -o libfoo.so foo.c
2176 ### # foo.c:6: warning: visibility attribute not supported in this configuration; ignored
2177 ### # ld: fatal: relocation error: R_386_GOTOFF: file /var/tmp//ccxYR96k.o: symbol astruct: relocation must bind locally
2178 ### set(have_visibility_hidden no)
2183 ### set(TARGET IA64)
2184 ### set(arch_target ia64)
2185 ### set(ACCESS_UNALIGNED "no")
2186 ### set(JIT_SUPPORTED yes)
2187 ### set(jit_wanted true)
2188 ### set(LIBC "libc.so.6.1")
2189 ### set(INTL "libc.so.6.1")
2190 ### AC_CHECK_LIB(unwind, _U_dyn_register, [], [ac_msg_error(library libunwind not found)])
2191 ### set(libmono_ldflags "-lunwind")
2194 ### if test "x$ac_cv_sizeof_void_p" = "x8"; then
2195 ### set(TARGET SPARC64)
2197 ### set(TARGET SPARC)
2199 ### set(arch_target sparc;)
2200 ### set(JIT_SUPPORTED yes)
2201 ### set(ACCESS_UNALIGNED "no")
2202 ### case $host_os in
2205 ### set(LIBC "libc.so")
2206 ### set(INTL "libintl.so")
2208 ### set(jit_wanted true)
2209 ### if test x"$GCC" = xyes; then
2210 ### # We don't support v8 cpus
2211 ### set(CFLAGS "$CFLAGS -Wno-cast-align -mcpu=v9")
2213 ### if test x"$AR" = xfalse; then
2214 ### ac_msg_error([The required utility 'ar' is not found in your PATH. Usually it can be found in /usr/ccs/bin.])
2217 ### alpha*-*-linux* | alpha*-*-osf*)
2218 ### set(TARGET ALPHA;)
2219 ### set(ACCESS_UNALIGNED "no")
2220 ### set(JIT_SUPPORTED yes)
2221 ### set(jit_wanted true)
2222 ### set(arch_target alpha;)
2223 ### set(CFLAGS "$CFLAGS -mieee -O0")
2224 ### case $host_os in
2226 ### set(LIBC "libc.so.6.1")
2227 ### set(INTL "libc.so.6.1")
2230 ### *-*-mingw*|*-*-cygwin*)
2231 ### # When this is enabled, it leads to very strange crashes at runtime (gcc-3.4.4)
2232 ### set(have_visibility_hidden no)
2233 ### set(INTL "intl")
2235 ### hppa2.0w-hp-hpux11.00 | hppa64-hp-hpux11.00)
2236 ### set(TARGET HPPA;)
2237 ### set(arch_target hppa; )
2238 ### set(LIBC "libc.sl")
2239 ### set(ACCESS_UNALIGNED "no")
2240 ### set(INTERP_SUPPORTED yes)
2241 ### set(interp_wanted true)
2244 ### set(TARGET HPPA;)
2245 ### ac_define(MONO_ARCH_REGPARMS,1,[Architecture uses registers for Parameters])
2246 ### set(arch_target hppa; )
2247 ### set(ACCESS_UNALIGNED "no")
2248 ### set(JIT_SUPPORTED yes)
2249 ### set(jit_wanted true)
2251 ### macppc-*-openbsd* | powerpc*-*-linux* | powerpc-*-openbsd* | \
2252 ### powerpc-*-sysv* | powerpc-*-darwin* | powerpc-*-netbsd* )
2253 ### if test "x$ac_cv_sizeof_void_p" = "x8"; then
2254 ### set(TARGET POWERPC64;)
2255 ### set(CPPFLAGS "$CPPFLAGS -D__mono_ppc__ -D__mono_ppc64__")
2256 ### set(CFLAGS "$CFLAGS -mminimal-toc")
2258 ### set(TARGET POWERPC;)
2259 ### set(CPPFLAGS "$CPPFLAGS -D__mono_ppc__")
2261 ### ac_define(MONO_ARCH_REGPARMS,1,[Architecture uses registers for Parameters])
2262 ### set(arch_target ppc;)
2263 ### set(JIT_SUPPORTED yes)
2264 ### set(jit_wanted true)
2267 ### set(TARGET ARM;)
2268 ### set(arch_target arm;)
2269 ### set(ACCESS_UNALIGNED "no")
2270 ### set(JIT_SUPPORTED yes)
2271 ### set(CPPFLAGS "$CPPFLAGS -DARM_FPU_NONE=1")
2272 ### set(jit_wanted true)
2275 ### set(TARGET S390;)
2276 ### ac_define(MONO_ARCH_REGPARMS,1,[Architecture uses registers for Parameters])
2277 ### set(arch_target s390;)
2278 ### set(ACCESS_UNALIGNED "no")
2279 ### set(JIT_SUPPORTED yes)
2280 ### set(jit_wanted true)
2281 ### # Required CFLAGS for s390[x]. USE_STRING_INLINES is automatic with gcc 4.1
2282 ### set(CFLAGS "$CFLAGS -mbackchain -D__USE_STRING_INLINES")
2285 ### set(TARGET S390x;)
2286 ### ac_define(MONO_ARCH_REGPARMS,1,[Architecture uses registers for Parameters])
2287 ### set(arch_target s390x;)
2288 ### set(ACCESS_UNALIGNED "no")
2289 ### set(JIT_SUPPORTED yes)
2290 ### set(jit_wanted true)
2291 ### set(CFLAGS "$CFLAGS -mbackchain -D__USE_STRING_INLINES")
2295 if (${sizeof_register} STREQUAL "4")
2296 ac_define(SIZEOF_REGISTER 4 "size of machine integer registers")
2297 elseif (${sizeof_register} STREQUAL "8")
2298 ac_define(SIZEOF_REGISTER 8 "size of machine integer registers")
2300 ac_define(SIZEOF_REGISTER SIZEOF_VOID_P "size of machine integer registers")
2303 ###if (${have_visibility_hidden" = "xyes"; then
2304 ### ac_define(HAVE_VISIBILITY_HIDDEN, 1, [Support for the visibility ("hidden") attribute])
2307 ###set(jit, [ --with-set(jit yes,no If you want to build scripts that default to the JIT (defaults to no)],[)
2308 ### if test x$withval = xyes; then
2309 ### set(jit_wanted true)
2311 ### set(jit_wanted false)
2315 ###set(interp, [ --with-set(interp yes,no If you want to build scripts that default to the interpreter (defaults to no)],[)
2316 ### if test x$withval = xyes; then
2317 ### set(interp_wanted true)
2319 ### set(interp_wanted false)
2327 set(jit_status "Building and using the JIT")
2330 set(jit_status "Building the JIT, defaulting to the interpreter")
2332 message(FATAL_ERROR "No JIT or interpreter support available or selected.")
2337 set(jit_status "interpreter")
2339 message(FATAL_ERROR "No JIT or interpreter support available or selected.")
2342 set(USE_JIT ${USEJIT})
2344 set(libsuffix ".so")
2348 ### set(libsuffix ".dylib")
2349 ### set(LIBC "libc.dylib")
2350 ### set(INTL "libintl.dylib")
2351 ### set(SQLITE "libsqlite.0.dylib")
2352 ### set(SQLITE3 "libsqlite3.0.dylib")
2353 ### set(X11 "libX11.dylib")
2356 ### set(LIBC "libc.so.12")
2357 ### set(INTL "libintl.so.0")
2360 ### set(LIBC "libc.so")
2361 ### set(INTL "libintl.so")
2364 ### set(LIBC "libc.so")
2365 ### set(INTL "libintl.so")
2369 ### ac_msg_checking(for the soname of libX11.so)
2370 ### for i in $x_libraries /usr/lib /usr/lib64; do
2371 ### for r in 4 5 6; do
2372 ### if test -f $i/libX11.so.$r; then
2373 ### set(X11 libX11.so.$r)
2374 ### ac_msg_result($X11)
2379 ### if (${X11" = "xlibX11.so"; then
2380 ### AC_MSG_WARN([Could not find X development libs. Do you have the -devel package installed? WinForms may not work...]);
2386 ###AC_SUBST(libsuffix)
2388 ac_check_headers(valgrind/memcheck.h)
2389 if(${TARGET} STREQUAL "AMD64" OR ${TARGET} STREQUAL "X86")
2390 if(with_tls STREQUAL __thread)
2392 # On some linux distributions, TLS works in executables, but linking
2393 # against a shared library containing TLS fails with:
2394 # undefined reference to `__tls_get_addr'
2396 ### rm -f conftest.c conftest.so conftest
2397 ### echo "static __thread int foo; void main () { foo = 5; }" > conftest.c
2398 ### $CC -fPIC --shared -o conftest.so conftest.c > /dev/null 2>&1
2399 ### $CC -o conftest conftest.so > /dev/null 2>&1
2400 ### if test ! -f conftest; then
2401 ### AC_MSG_WARN([Disabling usage of __thread.]);
2402 ### set(with_tls pthread)
2404 ### rm -f conftest.c conftest.so conftest
2408 set(mono_debugger_supported no)
2409 if(${TARGET} STREQUAL "AMD64" OR ${TARGET} STREQUAL "X86")
2411 if (host MATCHES ".*-.*-.*linux.*")
2412 set(mono_debugger_supported yes)
2417 ac_msg_checking("if the Mono Debugger is supported on this platform")
2418 if(mono_debugger_supported)
2419 ac_define(MONO_DEBUGGER_SUPPORTED 1 "The Mono Debugger is supported on this platform")
2421 ac_msg_result(${mono_debugger_supported})
2422 if(mono_debugger_supported)
2423 set(MONO_DEBUGGER_SUPPORTED yes)
2426 if (with_tls STREQUAL "__thread")
2427 ac_define(HAVE_KW_THREAD 1 "Have __thread keyword")
2428 ac_define(USE_COMPILER_TLS 1 "Use __thread for TLS access")
2429 # Pass the information to libgc
2430 set(CPPFLAGS "${CPPFLAGS} -DUSE_COMPILER_TLS")
2431 ### ac_msg_checking(if the tls_model attribute is supported)
2432 ### AC_TRY_COMPILE([static __thread int foo __attribute__((tls_model("initial-exec")));], [
2434 ### ac_msg_result(yes)
2435 ### ac_define(HAVE_TLS_MODEL_ATTR, 1, [tld_model available])
2437 ### ac_msg_result(no)
2443 # ******************************************
2444 # *** Check to see what FPU is available ***
2445 # ******************************************
2446 # FIXME: Don't do this if cross-compiling
2447 if(${TARGET} STREQUAL "ARM")
2448 ac_msg_checking("which FPU to use")
2449 set(CMAKE_REQUIRED_FLAGS "-mfloat-abi=softfp -mfpu=vfp")
2450 set(compiles_fpu_vfp)
2451 check_c_source_compiles("
2453 __asm__ (\"faddd d7, d6, d7\");
2456 set(compiles_fpu_fpa)
2457 set(cmake_required_flags)
2458 check_c_source_compiles("
2460 __asm__ (\"ldfd f0, [r0]\");
2463 if(compiles_fpu_vfp)
2465 elseif(compiles_fpu_fpa)
2470 ac_msg_result(${fpu})
2471 set(CPPFLAGS "${CPPFLAGS} -DARM_FPU_${fpu}=1")
2475 if(${TARGET} STREQUAL "unknown")
2476 set(CPPFLAGS ${CPPFLAGS} -DNO_PORT)
2477 ac_msg_warn("mono has not been ported to ${host}: some things may not work.")
2480 if(NOT ACCESS_UNALIGNED)
2481 set(CPPFLAGS "${CPPFLAGS} -DNO_UNALIGNED_ACCESS")
2486 ### # Pass CPPFLAGS to libgc configure
2487 ### # We should use a separate variable for this to avoid passing useless and
2488 ### # potentially problematic defines to libgc (like -set(D_FILE_OFFSET_BITS 64))
2489 ### # This should be executed late so we pick up the final version of CPPFLAGS
2490 ### # The problem with this approach, is that during a reconfigure, the main
2491 ### # configure scripts gets invoked with these arguments, so we use separate
2492 ### # variables understood by libgc's configure to pass CPPFLAGS and CFLAGS.
2493 ### set(LIBGC_CPPFLAGS $CPPFLAGS)
2494 ### if test x$TARGET = xSPARC -o x$TARGET = xSPARC64; then
2495 ### set(LIBGC_CPPFLAGS `echo $LIBGC_CPPFLAGS | sed -e 's/-D_FILE_OFFSET_BITS=64//g'`)
2497 ### 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\"")
2498 ### AC_CONFIG_SUBDIRS(libgc)
2502 set(preview yes CACHE BOOL "If you want to install the 2.0 FX preview (defaults to yes)")
2503 set(PREVIEW ${preview})
2504 set(moonlight yes CACHE BOOL "If you want to build the Moonlight 2.1 assemblies (defaults to yes)")
2505 set(MOONLIGHT ${moonlight})
2507 set(oprofile no CACHE STRING "<oprofile install dir> or 'no' to disable oprofile support (defaults to no)")
2508 if (NOT oprofile STREQUAL no)
2509 ### if test x$with_oprofile != xno; then
2510 ### set(oprofile_include $with_oprofile/include)
2511 ### if test ! -f $oprofile_include/opagent.h; then
2512 ### ac_msg_error([oprofile include file not found at $oprofile_include/opagent.h])
2514 ### set(OPROFILE yes)
2515 ### set(OPROFILE_CFLAGS "-I$oprofile_include")
2516 ### set(OPROFILE_LIBS "-L$with_oprofile/lib/oprofile -lopagent")
2517 ### ac_define(HAVE_OPROFILE,1,[Have oprofile support])
2522 set(MALLOC_MEMPOOLS no)
2523 set(malloc_mempools no CACHE STRING "Use malloc for each single mempool allocation (only for runtime debugging, defaults to no)")
2524 ### if test x$with_malloc_mempools = xyes; then
2525 ### set(MALLOC_MEMPOOLS yes)
2526 ### ac_define(USE_MALLOC_FOR_MEMPOOLS,1,[Use malloc for each single mempool allocation])
2531 set(DISABLE_MCS_DOCS no)
2532 set(mcs_docs yes CACHE STRING "If you want to build the documentation under mcs (defaults to yes)")
2534 set(DISABLE_MCS_DOCS yes)
2537 set(HAVE_OPROFILE yes)
2539 ###AC_SUBST(OPROFILE_CFLAGS)
2540 ###AC_SUBST(OPROFILE_LIBS)
2543 foreach(lib ${LIBS})
2544 set(libs_list "${libs_list} ${lib}")
2546 set(libmono_ldflags "${libmono_ldflags} ${libs_list}")
2549 set(INSTALL_2_0 yes)
2552 set(INSTALL_2_1 yes)
2555 ###AM_CONDITIONAL(MIPS_GCC, test ${TARGET}${ac_cv_prog_gcc} = MIPSyes)
2556 ###AM_CONDITIONAL(MIPS_SGI, test ${TARGET}${ac_cv_prog_gcc} = MIPSno)
2557 # Define a variable for the target
2561 set(INTERP_SUPPORTED yes)
2563 if (gc STREQUAL "included")
2564 set(INCLUDED_LIBGC yes)
2570 ###AC_SUBST(SQLITE3)
2572 ac_define_unquoted(ARCHITECTURE "${arch_target}" "The architecture this is running on")
2573 ###AC_SUBST(arch_target)
2575 ###AC_SUBST(CPPFLAGS)
2576 ###AC_SUBST(LDFLAGS)
2578 set(mono_build_root ${CMAKE_BINARY_DIR})
2581 set(mono_runtime mono/mini/mono)
2583 set(mono_runtime mono/interpreter/mint)
2586 set(mono_cfg_root ${mono_build_root}/runtime)
2588 ###if test x$platform_win32 = xyes; then
2589 ### if (${cross_compiling" = "xno"; then
2590 ### set(mono_cfg_dir `cygpath -w -a $mono_cfg_root`\\etc)
2592 ### set(mono_cfg_dir `echo $mono_cfg_root | tr '/' '\\\'`\\etc)
2595 set(mono_cfg_dir ${mono_cfg_root}/etc)
2598 function(ac_config_files file)
2599 configure_file("${file}.in" ${file} @ONLY)
2601 ac_config_files("po/mcs/Makefile.in")
2603 ac_config_files("runtime/mono-wrapper")
2604 ac_config_files("runtime/monodis-wrapper")
2605 execute_process (COMMAND chmod a+x runtime/mono-wrapper runtime/monodis-wrapper)
2607 ###AC_CONFIG_COMMANDS([runtime/etc/mono/1.0/machine.config],
2608 ###[ set(depth ../../../..)
2610 ### [[\\/$]]* | ?:[[\\/]]* ) set(reldir $srcdir ;;)
2611 ### .) set(reldir $depth ;;)
2612 ### *) set(reldir $depth/$srcdir ;;)
2614 ### $ac_aux_dir/install-sh -d runtime/etc/mono/1.0
2615 ### cd runtime/etc/mono/1.0
2616 ### rm -f machine.config
2617 ### $LN_S $reldir/data/net_1_1/machine.config machine.config
2619 ###],[set(LN_S '$LN_S']))
2621 ###AC_CONFIG_COMMANDS([runtime/etc/mono/2.0/machine.config],
2622 ###[ set(depth ../../../..)
2624 ### [[\\/$]]* | ?:[[\\/]]* ) set(reldir $srcdir ;;)
2625 ### .) set(reldir $depth ;;)
2626 ### *) set(reldir $depth/$srcdir ;;)
2628 ### $ac_aux_dir/install-sh -d runtime/etc/mono/2.0
2629 ### cd runtime/etc/mono/2.0
2630 ### rm -f machine.config
2631 ### $LN_S $reldir/data/net_2_0/machine.config machine.config
2633 ###],[set(LN_S '$LN_S']))
2635 ###AC_CONFIG_COMMANDS([runtime/etc/mono/2.0/web.config],
2636 ###[ set(depth ../../../..)
2638 ### [[\\/$]]* | ?:[[\\/]]* ) set(reldir $srcdir ;;)
2639 ### .) set(reldir $depth ;;)
2640 ### *) set(reldir $depth/$srcdir ;;)
2642 ### $ac_aux_dir/install-sh -d runtime/etc/mono/2.0
2643 ### cd runtime/etc/mono/2.0
2644 ### rm -f web.config
2645 ### $LN_S $reldir/data/net_2_0/web.config web.config
2647 ###],[set(LN_S '$LN_S']))
2649 ###AC_CONFIG_COMMANDS([runtime/etc/mono/browscap.ini],
2650 ###[ set(depth ../../..)
2652 ### [[\\/$]]* | ?:[[\\/]]* ) set(reldir $srcdir ;;)
2653 ### .) set(reldir $depth ;;)
2654 ### *) set(reldir $depth/$srcdir ;;)
2656 ### $ac_aux_dir/install-sh -d runtime/etc/mono/
2657 ### cd runtime/etc/mono/
2658 ### rm -f browscap.ini
2659 ### $LN_S $reldir/data/browscap.ini browscap.ini
2661 ###],[set(LN_S '$LN_S']))
2663 ###AC_CONFIG_COMMANDS([runtime/etc/mono/2.0/Browsers/Compat.browser],
2664 ###[ set(depth ../../../../..)
2666 ### [[\\/$]]* | ?:[[\\/]]* ) set(reldir $srcdir ;;)
2667 ### .) set(reldir $depth ;;)
2668 ### *) set(reldir $depth/$srcdir ;;)
2670 ### $ac_aux_dir/install-sh -d runtime/etc/mono/2.0/Browsers/
2671 ### cd runtime/etc/mono/2.0/Browsers
2672 ### rm -f Compat.browser
2673 ### $LN_S $reldir/data/net_2_0/Browsers/Compat.browser Compat.browser
2675 ###],[set(LN_S '$LN_S']))
2677 ###if test x$enable_quiet_build = xyes; then
2678 ### 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]))
2679 ### 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])
2682 if("${prefix}" STREQUAL "")
2683 set(prefix /usr/local)
2685 if("${exec_prefix}" STREQUAL "")
2686 set(exec_prefix "\${prefix}")
2687 set(exec_prefix_full "${prefix}")
2689 set(exec_prefix_full "${exec_prefix}")
2692 # FIXME: Make these overridable
2693 set(bindir "\${exec_prefix}/bin")
2694 set(bindir_full "${exec_prefix_full}/bin")
2695 set(sbindir "\${exec_prefix}/sbin")
2696 set(libexecdir "\${exec_prefix}/libexec")
2697 set(datarootdir "\${prefix}/share")
2698 set(datadir "\${datarootdir}")
2699 set(sysconfdir "\${prefix}/etc")
2700 set(sharedstatedir "\${prefix}/com")
2701 set(localstatedir "\${prefix}/var")
2702 set(includedir "\${prefix}/include")
2703 set(oldincludedir "/usr/include")
2704 set(docdir "\${datarootdir}/doc/\${PACKAGE}")
2705 set(infodir "\${datarootdir}/info")
2706 set(htmldir "\${docdir}")
2707 set(dvidir "\${docdir}")
2708 set(pdfdir "\${docdir}")
2709 set(psdir "\${docdir}")
2710 set(libdir "\${exec_prefix}/lib")
2711 set(localedir "\${datarootdir}/locale")
2712 set(mandir "\${datarootdir}/man")
2714 autoheader("config.h" autoheader_vars)
2716 set(SUBDIRS po ${libgc_dir} ${eglib_dir} mono ${ikvm_native_dir} support data runtime scripts man samples web msvc docs)
2718 foreach(dir ${SUBDIRS})
2719 add_subdirectory(${dir})
2722 # Implementation of AC_OUTPUT for cmake
2723 function(ac_output outputs)
2724 foreach (output ${ARGV})
2725 configure_file ("${output}.in" "${output}" @ONLY)
2731 scripts/mono-find-provides
2732 scripts/mono-find-requires
2733 mono/tests/tests-config
2738 data/mono-options.pc
2739 data/mono-lineeditor.pc
2746 data/system.web.extensions_1.0.pc
2747 data/system.web.extensions.design_1.0.pc
2748 data/system.web.mvc.pc
2753 ###mono-uninstalled.pc
2754 ###scripts/mono-find-provides
2755 ###scripts/mono-find-requires
2756 ###mono/dis/Makefile
2757 ###mono/cil/Makefile
2758 ###mono/arch/Makefile
2759 ###mono/arch/x86/Makefile
2760 ###mono/arch/amd64/Makefile
2761 ###mono/arch/hppa/Makefile
2762 ###mono/arch/ppc/Makefile
2763 ###mono/arch/sparc/Makefile
2764 ###mono/arch/s390/Makefile
2765 ###mono/arch/s390x/Makefile
2766 ###mono/arch/arm/Makefile
2767 ###mono/arch/alpha/Makefile
2768 ###mono/arch/ia64/Makefile
2769 ###mono/arch/mips/Makefile
2770 ###mono/interpreter/Makefile
2771 ###mono/tests/Makefile
2772 ###mono/tests/tests-config
2773 ###mono/tests/assemblyresolve/Makefile
2774 ###mono/tests/cas/Makefile
2775 ###mono/tests/cas/assembly/Makefile
2776 ###mono/tests/cas/demand/Makefile
2777 ###mono/tests/cas/inheritance/Makefile
2778 ###mono/tests/cas/linkdemand/Makefile
2779 ###mono/tests/cas/threads/Makefile
2780 ###mono/benchmark/Makefile
2781 ###mono/monograph/Makefile
2782 ###mono/profiler/Makefile
2783 ###ikvm-native/Makefile
2789 ###data/net_1_1/Makefile
2790 ###data/net_2_0/Makefile
2791 ###data/net_2_0/Browsers/Makefile
2794 ###data/mono-cairo.pc
2795 ###data/mono-nunit.pc
2796 ###data/mono-options.pc
2797 ###data/mono-lineeditor.pc
2804 ###data/system.web.extensions_1.0.pc
2805 ###data/system.web.extensions.design_1.0.pc
2806 ###data/system.web.mvc.pc
2811 ###tools/locale-builder/Makefile
2817 ###if test x$platform_win32 = xyes; then
2818 ### # Get rid of 'cyg' prefixes in library names
2819 ### sed -e "s/\/cyg\//\/\//" libtool > libtool.new; mv libtool.new libtool; chmod 755 libtool
2820 ### # libtool seems to inherit -mno-cygwin from our CFLAGS, and uses it to compile its executable
2821 ### # wrapper scripts which use exec(). gcc has no problem compiling+linking this, but the resulting
2822 ### # executable doesn't work...
2823 ### sed -e "s,-mno-cygwin,,g" libtool > libtool.new; mv libtool.new libtool; chmod 755 libtool
2827 set(mcs_INSTALL ${mono_build_root}/install-sh)
2829 ### case $INSTALL in
2830 ### [[\\/$]]* | ?:[[\\/]]* ) set(mcs_INSTALL $INSTALL ;;)
2831 ### *) set(mcs_INSTALL $mono_build_root/$INSTALL ;;)
2834 # Compute a 4 part version number into myver from ${mono_version}
2835 string(REGEX REPLACE "([0-9]+)\\.([0-9]+)\\.([0-9]+)\\.([0-9]+).*" "\\1.\\2.\\3.\\4" myver "${mono_version}.0.0.0")
2837 set(config.make ${srcdir}/${mcsdir}/build/config.make)
2839 # If we are cross compiling, we don't build in the mcs/ tree. Let us not clobber
2840 # any existing config.make. This allows people to share the same source tree
2841 # with different build directories, one native and one cross
2843 if(NOT cross_compiling)
2844 set(not_cross_compiling yes)
2846 if(not_cross_compiling AND enable_mcs_build)
2847 file(WRITE ${config.make} "prefix=${prefix}
2848 exec_prefix=${exec_prefix}
2849 sysconfdir=${sysconfdir}
2850 mono_libdir=\${exec_prefix}/lib
2851 MCS_FLAGS=$(PLATFORM_DEBUG_FLAGS)
2853 RUNTIME=${mono_build_root}/runtime/mono-wrapper
2854 ILDISASM=${mono_build_root}/runtime/monodis-wrapper
2855 INSTALL=${mcs_INSTALL}
2856 MONO_VERSION=${myver}
2861 file(APPEND ${config.make} "PLATFORM=darwin\n")
2864 if (${TARGET} STREQUAL "AMD64" AND ${platform_win32} STREQUAL "no" AND AOT_SUPPORTED)
2865 file(APPEND ${config.make} "ENABLE_AOT=1\n")
2868 if (DISABLE_MCS_DOCS)
2869 file(APPEND ${config.make} "DISABLE_MCS_DOCS=yes\n")
2872 ### # if we have an olive folder, override the default settings
2873 ### if test -d $olivedir; then
2875 ### test -w $srcdir/$olivedir/build || chmod +w $srcdir/$olivedir/build
2877 ### if test x$cross_compiling = xno && test x$enable_olive_build != xno; then
2878 ### echo "set(prefix $prefix" > $srcdir/$olivedir/build/config.make)
2879 ### echo "set(exec_prefix $exec_prefix" >> $srcdir/$olivedir/build/config.make)
2880 ### echo 'set(mono_libdir ${exec_prefix}/lib' >> $srcdir/$olivedir/build/config.make)
2881 ### echo 'MCS_FLAGS = $(PLATFORM_DEBUG_FLAGS)' >> $srcdir/$olivedir/build/config.make
2882 ### echo "RUNTIME = $mono_build_root/runtime/mono-wrapper" >> $srcdir/$olivedir/build/config.make
2883 ### echo "MONO_VERSION = $myver" >> $srcdir/$olivedir/build/config.make
2884 ### if test x$with_moonlight = xyes; then
2885 ### echo "WITH_MOONLIGHT = yes" >> $srcdir/$olivedir/build/config.make
2890 if(NOT libgdiplus_loc)
2891 set(libgdiplus_msg "assumed to be installed")
2893 set(libgdiplus_msg ${libgdiplus_loc})
2898 mcs source: ${mcs_topdir}
2899 olive source: ${olive_topdir}
2903 SIGALTSTACK: ${with_sigaltstack}
2904 Engine: ${jit_status}
2905 2.0 Beta: ${PREVIEW}
2906 2.1 Alpha: ${MOONLIGHT}
2907 JNI support: ${jdk_headers_found}
2908 libgdiplus: ${libgdiplus_msg}
2910 oprofile: ${OPROFILE}
2911 BigArrays: ${enable_big_arrays}
2912 DTrace: ${enable_dtrace}
2913 Parallel Mark: ${enable_parallel_mark}
2914 LLVM Back End: ${enable_llvm}
2919 if(NOT with_static_mono)
2920 if(NOT platform_win32)
2921 ac_msg_warn("Turning off static Mono is a risk, you might run into unexpected bugs")
2925 if(gc STREQUAL sgen)
2928 IMPORTANT: You have selected an experimental, work-in-progress
2929 IMPORTANT: GC engine. This GC engine is currently not supported
2930 IMPORTANT: and is not yet ready for use.
2932 IMPORTANT: There are known problems with it, use at your own risk.
2940 IMPORTANT: The LLVM Back End is experimental and does not work yet.
2947 ### -rm -fr $(mcslib)/monolite-*
2948 ### -mkdir -p $(mcslib)
2949 ### test ! -d $(monolite) || test ! -d $(monolite).old || rm -fr $(monolite).old
2950 ### test ! -d $(monolite) || mv -f $(monolite) $(monolite).old
2951 ### cd $(mcslib) && { (wget -O- $(monolite_url) || curl $(monolite_url)) | gzip -d | tar xf - ; }
2952 ### cd $(mcslib) && mv -f monolite-* monolite
2955 #### Keep in sync with SUBDIRS
2956 ##### 'tools' is not normally built
2957 ###DIST_SUBDIRS = po libgc $(eglib_dir) mono ikvm-native support data runtime scripts man samples web tools msvc docs
2959 ###EXTRA_DIST= nls.m4 po.m4 progtest.m4 mono-uninstalled.pc.in build-mingw32.sh LICENSE mkinstalldirs
2961 ###DISTCHECK_CONFIGURE_FLAGS = EXTERNAL_MCS=false EXTERNAL_RUNTIME=false
2963 #### Distribute the 'mcs' tree too
2965 ### test -d $(distdir)/mcs || mkdir $(distdir)/mcs
2966 ### d=`cd $(distdir)/mcs && pwd`; cd $(mcs_topdir) && $(MAKE) PROFILE=net_1_1 distdir=$$d dist-recursive
2967 ### d=`cd $(distdir)/mcs && pwd`; cd $(mcs_topdir) && $(MAKE) PROFILE=net_2_0 distdir=$$d dist-recursive
2969 ###pkgconfigdir = $(libdir)/pkgconfig
2970 ###noinst_DATA = mono-uninstalled.pc
2971 ###DISTCLEANFILES= mono-uninstalled.pc
2973 ###.PHONY: get-monolite-latest mcs-do-compiler-tests compiler-tests bootstrap-world
2975 #### building with monolite
2976 set(mcslib ${mcs_topdir}/class/lib)
2977 set(monolite ${mcslib}/monolite)
2978 set(monolite_url http://mono.ximian.com/daily/monolite-latest.tar.gz)
2979 add_custom_target(get-monolite-latest
2980 COMMAND -rm -fr ${mcslib}/monolite-*
2981 COMMAND -mkdir -p ${mcslib}
2982 COMMAND test ! -d ${monolite} || test ! -d ${monolite}.old || rm -fr ${monolite}.old
2983 COMMAND test ! -d ${monolite} || mv -f ${monolite} ${monolite}.old
2984 COMMAND cd ${mcslib} && { (wget -O- ${monolite_url} || curl ${monolite_url}) | gzip -d | tar xf - \; }
2985 COMMAND cd ${mcslib} && mv -f monolite-* monolite
2988 ###compiler-tests: mcs-do-clean
2990 ### $(MAKE) mcs-do-compiler-tests
2992 ###compiler-tests-net_2_0:
2993 ### -rm -f $(mcs_topdir)/build/common/Consts.cs.save
2994 ### -mv -f $(mcs_topdir)/build/common/Consts.cs $(mcs_topdir)/build/common/Consts.cs.save
2995 ### cd $(mcs_topdir) && $(MAKE) PROFILE=net_2_0_bootstrap clean
2996 ### cd $(mcs_topdir) && $(MAKE) PROFILE=net_2_0 clean
2997 ### -mv -f $(mcs_topdir)/build/common/Consts.cs.save $(mcs_topdir)/build/common/Consts.cs
2999 ### $(MAKE) build_profiles=net_2_0 mcs-do-compiler-tests
3001 ###bootstrap-world: compiler-tests
3004 ###bootstrap-world-net_2_0: compiler-tests-net_2_0
3007 #### internal targets
3009 ### cd runtime && $(MAKE) clean-local
3010 ### cd mono/tests && $(MAKE) clean
3011 ###mcs-do-compiler-tests:
3012 ### cd runtime && $(MAKE) test_select='TEST_SUBDIRS="tests errors"' check-local
3013 ### cd mono/tests && $(MAKE) check
3016 ### wget http://www.go-mono.com/archive/pkgconfig-0.11-20020310.zip
3017 ### wget http://www.go-mono.com/archive/glib-2.0.4-20020703.zip
3018 ### wget http://www.go-mono.com/archive/glib-dev-2.0.4-20020703.zip
3019 ### wget http://www.go-mono.com/archive/libiconv-1.7.zip
3020 ### wget http://www.go-mono.com/archive/libiconv-dev-1.7.zip
3021 ### wget http://www.go-mono.com/archive/libintl-0.10.40-20020101.zip
3022 ### unzip -n -d / pkgconfig-0.11-20020310.zip
3023 ### unzip -n -d / glib-2.0.4-20020703.zip
3024 ### unzip -n -d / glib-dev-2.0.4-20020703.zip
3025 ### unzip -n -d / libiconv-1.7.zip
3026 ### unzip -n -d / libiconv-dev-1.7.zip
3027 ### unzip -n -d / libintl-0.10.40-20020101.zip
3030 ### makensis /DMILESTONE=$(VERSION) /DSOURCE_INSTALL_DIR=$(SOURCE_INSTALL_DIR) /DBUILDNUM=$(BUILDNUM) monowiz.win32.nsi
3033 ### @echo "*** 'make bootstrap' is obsolete. Just run 'make' to perform a combined mono+mcs build"
3037 ### find mono -name Makefile -exec scripts/patch-quiet.sh {} \;
3038 ### find libgc -name Makefile -exec scripts/patch-quiet.sh {} \;
3041 ### (cd $(mcs_topdir)/build/csproj && gmcs genproj.cs) && (cd runtime; make V=1 extra_targets=csproj-local)