configure.in 71 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491
  1. AC_INIT(README)
  2. AC_CANONICAL_SYSTEM
  3. # Gross hack to enable 'make dist' on automake 1.9+tar 1.14.
  4. # The extra brackets are to foil regex-based scans.
  5. m4_ifdef([_A][M_PROG_TAR],[_A][M_SET_OPTION([tar-ustar])])
  6. AM_CONFIG_HEADER(config.h)
  7. AM_INIT_AUTOMAKE(mono,2.3)
  8. AM_MAINTAINER_MODE
  9. API_VER=1.0
  10. AC_SUBST(API_VER)
  11. AC_PROG_LN_S
  12. # In case of cygwin, override LN_S, irrespective of what it determines.
  13. # The build uses cygwin, but the actual runtime doesn't.
  14. case $host_os in
  15. *cygwin* ) LN_S='cp -p';;
  16. esac
  17. dnl
  18. dnl libgc checks
  19. dnl
  20. gc_headers=no
  21. gc=included
  22. use_included_gc=no
  23. libgc_configure_args=
  24. if test -d $srcdir/libgc ; then
  25. gc_default=included
  26. else
  27. gc_default=boehm
  28. fi
  29. # These variables are the CPPFLAGS/CFLAGS passed to libgc's configure
  30. # libgc should inherit the original CFLAGS/CPPFLAGS passed to configure, i.e. -O0
  31. CPPFLAGS_FOR_LIBGC=$CPPFLAGS
  32. CFLAGS_FOR_LIBGC=$CFLAGS
  33. #
  34. # These are the flags that need to be stored in the mono.pc file for
  35. # compiling code that will embed Mono
  36. #
  37. libmono_cflags=""
  38. libmono_ldflags=""
  39. AC_SUBST(libmono_cflags)
  40. AC_SUBST(libmono_ldflags)
  41. # Variable to have relocatable .pc files (lib, or lib64)
  42. reloc_libdir=`basename ${libdir}`
  43. AC_SUBST(reloc_libdir)
  44. dnl if linker handles the version script
  45. no_version_script=no
  46. # Set to yes if Unix sockets cannot be created in an anonymous namespace
  47. need_link_unlink=no
  48. # Thread configuration inspired by sleepycat's db
  49. AC_MSG_CHECKING([host platform characteristics])
  50. libgc_threads=no
  51. has_dtrace=no
  52. case "$host" in
  53. *-*-mingw*|*-*-cygwin*)
  54. platform_win32=yes
  55. AC_DEFINE(PLATFORM_WIN32,1,[Platform is Win32])
  56. if test "x$cross_compiling" = "xno"; then
  57. CC="gcc -mno-cygwin -g"
  58. # So libgc configure gets -mno-cygwin
  59. export CC
  60. fi
  61. HOST_CC="gcc"
  62. # Windows 2000 is required that includes Internet Explorer 5.01
  63. CPPFLAGS="$CPPFLAGS -DWINVER=0x0500 -D_WIN32_WINNT=0x0500 -D_WIN32_IE=0x0501 -D_UNICODE -DUNICODE -DWIN32_THREADS -DFD_SETSIZE=1024"
  64. libmono_cflags="-mno-cygwin -mms-bitfields -mwindows"
  65. libmono_ldflags="-mno-cygwin -mms-bitfields -mwindows"
  66. libdl=
  67. libgc_threads=win32
  68. gc_default=included
  69. with_sigaltstack=no
  70. LN_S=cp
  71. # This forces libgc to use the DllMain based thread registration code on win32
  72. libgc_configure_args="$libgc_configure_args --enable-win32-dllmain=yes"
  73. ;;
  74. *-*-*netbsd*)
  75. platform_win32=no
  76. CPPFLAGS="$CPPFLAGS -D_REENTRANT -DGC_NETBSD_THREADS -D_GNU_SOURCE"
  77. libmono_cflags="-D_REENTRANT"
  78. LDFLAGS="$LDFLAGS -pthread"
  79. CPPFLAGS="$CPPFLAGS -DPLATFORM_BSD"
  80. libmono_ldflags="-pthread"
  81. need_link_unlink=yes
  82. libdl="-ldl"
  83. libgc_threads=pthreads
  84. with_sigaltstack=no
  85. ;;
  86. *-*-*freebsd*)
  87. platform_win32=no
  88. if test "x$PTHREAD_CFLAGS" = "x"; then
  89. CPPFLAGS="$CPPFLAGS -DGC_FREEBSD_THREADS"
  90. libmono_cflags=
  91. else
  92. CPPFLAGS="$CPPFLAGS $PTHREAD_CFLAGS -DGC_FREEBSD_THREADS"
  93. libmono_cflags="$PTHREAD_CFLAGS"
  94. fi
  95. if test "x$PTHREAD_LIBS" = "x"; then
  96. LDFLAGS="$LDFLAGS -pthread"
  97. libmono_ldflags="-pthread"
  98. else
  99. LDFLAGS="$LDFLAGS $PTHREAD_LIBS"
  100. libmono_ldflags="$PTHREAD_LIBS"
  101. fi
  102. CPPFLAGS="$CPPFLAGS -DPLATFORM_BSD"
  103. need_link_unlink=yes
  104. AC_DEFINE(PTHREAD_POINTER_ID, 1, [pthread is a pointer])
  105. libdl=
  106. libgc_threads=pthreads
  107. # This doesn't seem to work as of 7.0 on amd64
  108. with_sigaltstack=no
  109. # TLS is only partially implemented on -CURRENT (compiler support
  110. # but NOT library support)
  111. #
  112. with_tls=pthread
  113. ;;
  114. *-*-*openbsd*)
  115. platform_win32=no
  116. CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE -DGC_FREEBSD_THREADS"
  117. libmono_cflags="-D_THREAD_SAFE"
  118. LDFLAGS="$LDFLAGS -pthread"
  119. libmono_ldflags="-pthread"
  120. need_link_unlink=yes
  121. AC_DEFINE(PTHREAD_POINTER_ID)
  122. libdl=
  123. libgc_threads=pthreads
  124. ;;
  125. *-*-linux*)
  126. platform_win32=no
  127. CPPFLAGS="$CPPFLAGS -DGC_LINUX_THREADS -D_GNU_SOURCE -D_REENTRANT -DUSE_MMAP -DUSE_MUNMAP"
  128. libmono_cflags="-D_REENTRANT"
  129. libmono_ldflags="-lpthread"
  130. libdl="-ldl"
  131. libgc_threads=pthreads
  132. AOT_SUPPORTED="yes"
  133. ;;
  134. *-*-hpux*)
  135. platform_win32=no
  136. CPPFLAGS="$CPPFLAGS -DGC_HPUX_THREADS -D_HPUX_SOURCE -D_XOPEN_SOURCE_EXTENDED -D_REENTRANT"
  137. # +ESdbgasm only valid on bundled cc on RISC
  138. # silently ignored for ia64
  139. if test $GCC != "yes"; then
  140. CFLAGS="$CFLAGS +ESdbgasm"
  141. # Arrange for run-time dereferencing of null
  142. # pointers to produce a SIGSEGV signal.
  143. LDFLAGS="$LDFLAGS -z"
  144. fi
  145. CFLAGS="$CFLAGS +ESdbgasm"
  146. LDFLAGS="$LDFLAGS -z"
  147. libmono_cflags="-D_REENTRANT"
  148. libmono_ldflags="-lpthread"
  149. libgc_threads=pthreads
  150. need_link_unlink=yes
  151. ;;
  152. *-*-solaris*)
  153. platform_win32=no
  154. CPPFLAGS="$CPPFLAGS -DGC_SOLARIS_THREADS -DGC_SOLARIS_PTHREADS -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS -DUSE_MMAP -DUSE_MUNMAP -DPLATFORM_SOLARIS"
  155. need_link_unlink=yes
  156. libmono_cflags="-D_REENTRANT"
  157. libgc_threads=pthreads
  158. # This doesn't seem to work on solaris/x86, but the configure test runs
  159. with_tls=pthread
  160. has_dtrace=yes
  161. ;;
  162. *-*-darwin*)
  163. platform_win32=no
  164. platform_darwin=yes
  165. CPPFLAGS="$CPPFLAGS -no-cpp-precomp -D_THREAD_SAFE -DGC_MACOSX_THREADS -DPLATFORM_MACOSX -DUSE_MMAP -DUSE_MUNMAP"
  166. CPPFLAGS="$CPPFLAGS -DGetCurrentProcess=MonoGetCurrentProcess -DGetCurrentThread=MonoGetCurrentThread -DCreateEvent=MonoCreateEvent"
  167. libmono_cflags="-D_THREAD_SAFE"
  168. LDFLAGS="$LDFLAGS -pthread"
  169. libmono_ldflags="-pthread"
  170. need_link_unlink=yes
  171. AC_DEFINE(PTHREAD_POINTER_ID)
  172. AC_DEFINE(USE_MACH_SEMA, 1, [...])
  173. no_version_script=yes
  174. libdl=
  175. libgc_threads=pthreads
  176. has_dtrace=yes
  177. if test "x$cross_compiling" = "xyes"; then
  178. has_broken_apple_cpp=yes
  179. fi
  180. ;;
  181. *)
  182. AC_MSG_WARN([*** Please add $host to configure.in checks!])
  183. platform_win32=no
  184. libdl="-ldl"
  185. ;;
  186. esac
  187. AC_MSG_RESULT(ok)
  188. if test x$need_link_unlink = xyes; then
  189. AC_DEFINE(NEED_LINK_UNLINK, 1, [Define if Unix sockets cannot be created in an anonymous namespace])
  190. fi
  191. AM_CONDITIONAL(PLATFORM_WIN32, test x$platform_win32 = xyes)
  192. AM_CONDITIONAL(PLATFORM_LINUX, echo x$target_os | grep -q linux)
  193. AC_CHECK_TOOL(CC, gcc, gcc)
  194. AC_PROG_CC
  195. AM_PROG_AS
  196. AM_PROG_CC_STDC
  197. AC_PROG_INSTALL
  198. AC_PROG_AWK
  199. dnl We should use AM_PROG_AS, but it's not available on automake/aclocal 1.4
  200. : ${CCAS='$(CC)'}
  201. # Set ASFLAGS if not already set.
  202. : ${CCASFLAGS='$(CFLAGS)'}
  203. AC_SUBST(CCAS)
  204. AC_SUBST(CCASFLAGS)
  205. AC_CHECK_PROG(BISON, bison,yes,no)
  206. if test "x$BISON" = "xno";
  207. then
  208. AC_MSG_ERROR([You need to install bison])
  209. fi
  210. dnl may require a specific autoconf version
  211. dnl AC_PROG_CC_FOR_BUILD
  212. dnl CC_FOR_BUILD not automatically detected
  213. CC_FOR_BUILD=$CC
  214. CFLAGS_FOR_BUILD=$CFLAGS
  215. BUILD_EXEEXT=
  216. if test "x$cross_compiling" = "xyes"; then
  217. CC_FOR_BUILD=cc
  218. CFLAGS_FOR_BUILD=
  219. BUILD_EXEEXT=""
  220. fi
  221. AC_SUBST(CC_FOR_BUILD)
  222. AC_SUBST(CFLAGS_FOR_BUILD)
  223. AC_SUBST(HOST_CC)
  224. AC_SUBST(BUILD_EXEEXT)
  225. AM_CONDITIONAL(CROSS_COMPILING, [test x$cross_compiling = xyes])
  226. AM_CONDITIONAL(USE_BATCH_FILES, [test x$platform_win32 = xyes -a x$cross_compiling = xyes])
  227. # Set STDC_HEADERS
  228. AC_HEADER_STDC
  229. AC_LIBTOOL_WIN32_DLL
  230. # This causes monodis to not link correctly
  231. #AC_DISABLE_FAST_INSTALL
  232. AM_PROG_LIBTOOL
  233. # Use dolt (http://dolt.freedesktop.org/) instead of libtool for building.
  234. DOLT
  235. export_ldflags=`(./libtool --config; echo eval echo \\$export_dynamic_flag_spec) | sh`
  236. AC_SUBST(export_ldflags)
  237. # Test whenever ld supports -version-script
  238. AC_PROG_LD
  239. AC_PROG_LD_GNU
  240. if test "x$lt_cv_prog_gnu_ld" = "xno"; then
  241. no_version_script=yes
  242. fi
  243. AM_CONDITIONAL(NO_VERSION_SCRIPT, test x$no_version_script = xyes)
  244. 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)
  245. AC_CHECK_HEADERS(sys/user.h sys/socket.h sys/ipc.h sys/sem.h sys/utsname.h alloca.h ucontext.h pwd.h)
  246. AC_CHECK_HEADER(zlib.h, [have_zlib=yes], [have_zlib=no])
  247. if test x$have_zlib = xyes; then
  248. AC_TRY_COMPILE([#include <zlib.h>], [
  249. void main () {
  250. #if defined(ZLIB_VERNUM) && (ZLIB_VERNUM >= 0x1230)
  251. }
  252. #else
  253. #error No good zlib found
  254. #endif
  255. ],[
  256. AC_MSG_RESULT(Using system zlib)
  257. zlib_msg="system zlib"
  258. ],[
  259. AC_MSG_RESULT(Using embedded zlib)
  260. have_zlib=no
  261. zlib_msg="bundled zlib"
  262. ])
  263. fi
  264. AM_CONDITIONAL(HAVE_ZLIB, test x$have_zlib = xyes)
  265. AC_DEFINE(HAVE_ZLIB,1,[Have system zlib])
  266. # for mono/metadata/debug-symfile.c
  267. AC_CHECK_HEADERS(elf.h)
  268. # for support
  269. AC_CHECK_HEADERS(poll.h)
  270. AC_CHECK_HEADERS(sys/poll.h)
  271. AC_CHECK_HEADERS(sys/wait.h)
  272. AC_CHECK_HEADERS(grp.h)
  273. AC_CHECK_HEADERS(syslog.h)
  274. # for mono/dis
  275. AC_CHECK_HEADERS(wchar.h)
  276. AC_CHECK_HEADERS(ieeefp.h)
  277. AC_MSG_CHECKING(for isinf)
  278. AC_TRY_LINK([#include <math.h>], [
  279. int f = isinf (1);
  280. ], [
  281. AC_MSG_RESULT(yes)
  282. AC_DEFINE(HAVE_ISINF, 1, [isinf available])
  283. ], [
  284. # We'll have to use signals
  285. AC_MSG_RESULT(no)
  286. ])
  287. # not 64 bit clean in cross-compile
  288. AC_CHECK_SIZEOF(void *, 4)
  289. WARN=''
  290. if test x"$GCC" = xyes; then
  291. WARN='-Wall -Wunused -Wmissing-prototypes -Wmissing-declarations -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wno-cast-qual -Wcast-align -Wwrite-strings'
  292. # The runtime code does not respect ANSI C strict aliasing rules
  293. CFLAGS="$CFLAGS -fno-strict-aliasing"
  294. ORIG_CFLAGS=$CFLAGS
  295. CFLAGS="$CFLAGS -Wdeclaration-after-statement"
  296. AC_MSG_CHECKING(for -Wdeclaration-after-statement option to gcc)
  297. AC_TRY_COMPILE([], [
  298. void main () { }
  299. ], [
  300. AC_MSG_RESULT(yes)
  301. ], [
  302. AC_MSG_RESULT(no)
  303. CFLAGS=$ORIG_CFLAGS
  304. ])
  305. else
  306. # The Sun Forte compiler complains about inline functions that access static variables
  307. # so disable all inlining.
  308. case "$host" in
  309. *-*-solaris*)
  310. CFLAGS="$CFLAGS -Dinline="
  311. ;;
  312. esac
  313. fi
  314. CFLAGS="$CFLAGS -g $WARN"
  315. CFLAGS_FOR_LIBGC="$CFLAGS_FOR_LIBGC -g"
  316. # Where's the 'mcs' source tree?
  317. if test -d $srcdir/mcs; then
  318. mcsdir=mcs
  319. else
  320. mcsdir=../mcs
  321. fi
  322. #
  323. # A sanity check to catch cases where the package was unpacked
  324. # with an ancient tar program (Solaris)
  325. #
  326. AC_MSG_CHECKING(integrity of package)
  327. if test -f $srcdir/$mcsdir/class/System.Runtime.Serialization.Formatters.Soap/System.Runtime.Serialization.Formatters.Soap/SoapTypeMapper.cs
  328. then
  329. AC_MSG_RESULT(ok)
  330. else
  331. 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"
  332. AC_MSG_ERROR([$errorm])
  333. fi
  334. mcs_topdir='$(top_srcdir)/'$mcsdir
  335. mcs_topdir_from_srcdir='$(top_builddir)/'$mcsdir
  336. ## Maybe should also disable if mcsdir is invalid. Let's punt the issue for now.
  337. AM_CONDITIONAL(BUILD_MCS, [test x$cross_compiling = xno && test x$enable_mcs_build != xno])
  338. AC_SUBST([mcs_topdir])
  339. AC_SUBST([mcs_topdir_from_srcdir])
  340. # Where's the 'olive' source tree?
  341. if test -d $srcdir/olive; then
  342. olivedir=olive
  343. else
  344. olivedir=../olive
  345. fi
  346. if test -d $srcdir/$olivedir; then
  347. olive_topdir='$(top_srcdir)/'$olivedir
  348. fi
  349. # gettext: prepare the translation directories.
  350. # we do not configure the full gettext, as we consume it dynamically from C#
  351. AM_PO_SUBDIRS
  352. if test "x$USE_NLS" = "xyes"; then
  353. AC_CHECK_PROG(HAVE_MSGFMT, msgfmt,yes,no)
  354. if test "x$HAVE_MSGFMT" = "xno"; then
  355. AC_MSG_ERROR([msgfmt not found. You need to install the 'gettext' package, or pass --enable-nls=no to configure.])
  356. fi
  357. fi
  358. AC_ARG_WITH([libgdiplus],
  359. [ --with-libgdiplus=installed|sibling|<path> Override the libgdiplus used for System.Drawing tests (defaults to NO)],
  360. [], [with_libgdiplus=installed])
  361. case $with_libgdiplus in
  362. no|installed) libgdiplus_loc= ;;
  363. yes|sibling) libgdiplus_loc=`cd ../libgdiplus && pwd`/src/libgdiplus.la ;;
  364. /*) libgdiplus_loc=$with_libgdiplus ;;
  365. *) libgdiplus_loc=`pwd`/$with_libgdiplus ;;
  366. esac
  367. AC_SUBST([libgdiplus_loc])
  368. AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
  369. if test "x$PKG_CONFIG" = "xno"; then
  370. AC_MSG_ERROR([You need to install pkg-config])
  371. fi
  372. pkg_config_path=
  373. AC_ARG_WITH(crosspkgdir, [ --with-crosspkgdir=/path/to/pkg-config/dir],
  374. if test x$with_crosspkgdir = "x"; then
  375. if test -s $PKG_CONFIG_PATH; then
  376. pkg_config_path=$PKG_CONFIG_PATH
  377. fi
  378. else
  379. pkg_config_path=$with_crosspkgdir
  380. PKG_CONFIG_PATH=$pkg_config_path
  381. export PKG_CONFIG_PATH
  382. fi
  383. )
  384. AC_ARG_WITH([glib],
  385. [ --with-glib=embedded|system Choose glib API: system or embedded (default to system)],
  386. [], [with_glib=system])
  387. eglib_dir=
  388. case $with_glib in
  389. embedded)
  390. GLIB_CFLAGS='-I$(top_srcdir)/eglib/src -I$(top_builddir)/eglib/src'
  391. GLIB_LIBS='-L$(top_builddir)/eglib/src -leglib -lm'
  392. BUILD_GLIB_CFLAGS="$GLIB_CFLAGS"
  393. BUILD_GLIB_LIBS="$GLIB_LIBS"
  394. GMODULE_CFLAGS="$GLIB_CFLAGS"
  395. GMODULE_LIBS="$GLIB_LIBS"
  396. eglib_dir=eglib
  397. AC_CONFIG_SUBDIRS(eglib)
  398. ;;
  399. system)
  400. if test "x$cross_compiling" = "xyes"; then
  401. pkg_config_path="$PKG_CONFIG_PATH"
  402. unset PKG_CONFIG_PATH
  403. fi
  404. BUILD_GLIB_CFLAGS=`$PKG_CONFIG --cflags glib-2.0 gthread-2.0`
  405. BUILD_GLIB_LIBS=`$PKG_CONFIG --libs glib-2.0 gthread-2.0`
  406. if test "x$cross_compiling" = "xyes"; then
  407. PKG_CONFIG_PATH=$pkg_config_path
  408. export PKG_CONFIG_PATH
  409. fi
  410. ## Versions of dependencies
  411. GLIB_REQUIRED_VERSION=1.3.11
  412. PKG_CHECK_MODULES(BASE_DEPENDENCIES, glib-2.0 >= $GLIB_REQUIRED_VERSION)
  413. GLIB_CFLAGS=`$PKG_CONFIG --cflags glib-2.0 gthread-2.0`
  414. GLIB_LIBS=`$PKG_CONFIG --libs glib-2.0 gthread-2.0`
  415. GMODULE_CFLAGS=`$PKG_CONFIG --cflags gmodule-2.0`
  416. GMODULE_LIBS=`$PKG_CONFIG --libs gmodule-2.0`
  417. ;;
  418. *)
  419. AC_MSG_ERROR([Invalid argument to --with-glib.])
  420. esac
  421. AM_CONDITIONAL(EGLIB_BUILD, test x$with_glib = xembedded)
  422. AC_SUBST(GLIB_CFLAGS)
  423. AC_SUBST(GLIB_LIBS)
  424. AC_SUBST(GMODULE_CFLAGS)
  425. AC_SUBST(GMODULE_LIBS)
  426. AC_SUBST(BUILD_GLIB_CFLAGS)
  427. AC_SUBST(BUILD_GLIB_LIBS)
  428. AC_SUBST(eglib_dir)
  429. if test x$cross_compiling$platform_win32 = xnoyes; then
  430. AC_MSG_CHECKING(for cygwin glib2-dev package)
  431. if [ cygcheck --f /usr/lib/libglib-2.0.dll.a | grep -q glib2-devel ]; then
  432. AC_MSG_RESULT(found)
  433. 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.])
  434. else
  435. AC_MSG_RESULT(not found, ok)
  436. fi
  437. AC_MSG_CHECKING(for broken gwin32.h)
  438. glib_include=`$PKG_CONFIG --cflags-only-I glib-2.0 | sed -e 's/ -I.*//g' | sed -e 's/-I//g'`
  439. if test -f $glib_include/glib/gwin32.h; then
  440. if [ grep ftruncate $glib_include/glib/gwin32.h | grep -q define ]; then
  441. AC_MSG_RESULT(failed)
  442. hashmark='#'
  443. 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.])
  444. fi
  445. fi
  446. AC_MSG_RESULT(ok)
  447. fi
  448. AC_ARG_WITH(gc, [ --with-gc=boehm,included,none],[gc=$with_gc],[gc=$gc_default])
  449. # Enable support for fast thread-local storage
  450. # Some systems have broken support, so we allow to disable it.
  451. AC_ARG_WITH(tls, [ --with-tls=__thread,pthread select Thread Local Storage implementation],[],[with_tls=__thread])
  452. # Enable support for using sigaltstack for SIGSEGV and stack overflow handling
  453. # This does not work on some platforms (bug #55253)
  454. AC_ARG_WITH(sigaltstack, [ --with-sigaltstack=yes,no enable/disable support for sigaltstack],[],[with_sigaltstack=yes])
  455. AC_ARG_WITH(static_mono, [ --with-static_mono=yes,no link mono statically to libmono (faster)],[],[with_static_mono=yes])
  456. if test "x$enable_static" = "xno"; then
  457. with_static_mono=no
  458. fi
  459. if test "x$platform_win32" = "xyes"; then
  460. # Boehm GC requires the runtime to be in its own dll
  461. with_static_mono=no
  462. fi
  463. AM_CONDITIONAL(STATIC_MONO, test x$with_static_mono != xno)
  464. AC_ARG_ENABLE(mcs-build, [ --disable-mcs-build disable the build of the mcs directory], try_mcs_build=$enableval, enable_mcs_build=yes)
  465. AC_ARG_WITH(xen_opt, [ --with-xen_opt=yes,no Enable Xen-specific behaviour],[],[with_xen_opt=yes])
  466. if test "x$with_xen_opt" = "xyes"; then
  467. AC_DEFINE(MONO_XEN_OPT, 1, [Xen-specific behaviour])
  468. ORIG_CFLAGS=$CFLAGS
  469. CFLAGS="$CFLAGS -mno-tls-direct-seg-refs"
  470. AC_MSG_CHECKING(for -mno-tls-direct-seg-refs option to gcc)
  471. AC_TRY_COMPILE([], [
  472. void main () { }
  473. ], [
  474. AC_MSG_RESULT(yes)
  475. # Pass it to libgc as well
  476. CFLAGS_FOR_LIBGC="$CFLAGS_FOR_LIBGC -mno-tls-direct-seg-refs"
  477. ], [
  478. AC_MSG_RESULT(no)
  479. CFLAGS=$ORIG_CFLAGS
  480. ])
  481. fi
  482. AC_ARG_ENABLE(quiet-build, [ --enable-quiet-build Enable quiet runtime build], enable_quiet_build=$enableval, enable_quiet_build=yes)
  483. DISABLED_FEATURES=none
  484. AC_ARG_ENABLE(minimal, [ --enable-minimal=LIST drop support for LIST subsystems.
  485. LIST is a comma-separated list from: aot, profiler, decimal, pinvoke, debug,
  486. reflection_emit, reflection_emit_save, large_code, logging, com, ssa, generics, attach, jit, simd.],
  487. [
  488. for feature in `echo "$enable_minimal" | sed -e "s/,/ /g"`; do
  489. eval "mono_feature_disable_$feature='yes'"
  490. AC_MSG_NOTICE([Disabled support for feature: $feature])
  491. done
  492. DISABLED_FEATURES=$enable_minimal
  493. disabled="Disabled: $enable_minimal"
  494. ],[])
  495. AC_DEFINE_UNQUOTED(DISABLED_FEATURES, "$DISABLED_FEATURES", [String of disabled features])
  496. if test "x$mono_feature_disable_aot" = "xyes"; then
  497. AC_DEFINE(DISABLE_AOT, 1, [Disable AOT support])
  498. fi
  499. if test "x$mono_feature_disable_profiler" = "xyes"; then
  500. AC_DEFINE(DISABLE_PROFILER, 1, [Disable default profiler support])
  501. fi
  502. AM_CONDITIONAL(DISABLE_PROFILER, test x$mono_feature_disable_profiler = xyes)
  503. if test "x$mono_feature_disable_decimal" = "xyes"; then
  504. AC_DEFINE(DISABLE_DECIMAL, 1, [Disable System.Decimal support])
  505. fi
  506. if test "x$mono_feature_disable_pinvoke" = "xyes"; then
  507. AC_DEFINE(DISABLE_PINVOKE, 1, [Disable P/Invoke support])
  508. fi
  509. if test "x$mono_feature_disable_debug" = "xyes"; then
  510. AC_DEFINE(DISABLE_DEBUG, 1, [Disable runtime debugging support])
  511. fi
  512. if test "x$mono_feature_disable_reflection_emit" = "xyes"; then
  513. AC_DEFINE(DISABLE_REFLECTION_EMIT, 1, [Disable reflection emit support])
  514. mono_feature_disable_reflection_emit_save=yes
  515. fi
  516. if test "x$mono_feature_disable_reflection_emit_save" = "xyes"; then
  517. AC_DEFINE(DISABLE_REFLECTION_EMIT_SAVE, 1, [Disable assembly saving support in reflection emit])
  518. fi
  519. if test "x$mono_feature_disable_large_code" = "xyes"; then
  520. AC_DEFINE(DISABLE_LARGE_CODE, 1, [Disable support for huge assemblies])
  521. fi
  522. if test "x$mono_feature_disable_logging" = "xyes"; then
  523. AC_DEFINE(DISABLE_LOGGING, 1, [Disable support debug logging])
  524. fi
  525. if test "x$mono_feature_disable_com" = "xyes"; then
  526. AC_DEFINE(DISABLE_COM, 1, [Disable COM support])
  527. fi
  528. if test "x$mono_feature_disable_ssa" = "xyes"; then
  529. AC_DEFINE(DISABLE_SSA, 1, [Disable advanced SSA JIT optimizations])
  530. fi
  531. if test "x$mono_feature_disable_generics" = "xyes"; then
  532. AC_DEFINE(DISABLE_GENERICS, 1, [Disable generics support])
  533. fi
  534. if test "x$mono_feature_disable_attach" = "xyes"; then
  535. AC_DEFINE(DISABLE_ATTACH, 1, [Disable agent attach support])
  536. fi
  537. if test "x$mono_feature_disable_jit" = "xyes"; then
  538. AC_DEFINE(DISABLE_JIT, 1, [Disable the JIT, only full-aot mode will be supported by the runtime.])
  539. fi
  540. AM_CONDITIONAL(DISABLE_JIT, test x$mono_feature_disable_jit = xyes)
  541. if test "x$mono_feature_disable_simd" = "xyes"; then
  542. AC_DEFINE(DISABLE_SIMD, 1, [Disable SIMD intrinsics related optimizations.])
  543. fi
  544. AC_MSG_CHECKING(for visibility __attribute__)
  545. AC_TRY_COMPILE([], [
  546. void __attribute__ ((visibility ("hidden"))) doit (void) {}
  547. void main () { doit (); }
  548. ], [
  549. have_visibility_hidden=yes
  550. AC_MSG_RESULT(yes)
  551. ], [
  552. have_visibility_hidden=no
  553. AC_MSG_RESULT(no)
  554. ])
  555. AC_ARG_ENABLE(parallel-mark, [ --enable-parallel-mark Enables GC Parallel Marking])
  556. if test x$enable_parallel_mark = xyes; then
  557. libgc_configure_args="$libgc_configure_args --enable-parallel-mark"
  558. fi
  559. LIBGC_CFLAGS=
  560. LIBGC_LIBS=
  561. LIBGC_STATIC_LIBS=
  562. libgc_dir=
  563. case "x$gc" in
  564. xboehm|xbohem|xyes)
  565. AC_CHECK_HEADERS(gc.h gc/gc.h, gc_headers=yes)
  566. AC_CHECK_LIB(gc, GC_malloc, found_boehm="yes",,$libdl)
  567. if test "x$found_boehm" != "xyes"; then
  568. AC_MSG_ERROR("GC requested but libgc not found! Install libgc or run configure with --with-gc=none.")
  569. fi
  570. if test "x$gc_headers" != "xyes"; then
  571. AC_MSG_ERROR("GC requested but header files not found! You may need to install them by hand.")
  572. fi
  573. AC_DEFINE(HAVE_BOEHM_GC, 1, [Have Boehm GC])
  574. AC_SUBST(HAVE_BOEHM_GC)
  575. LIBGC_LIBS="-lgc $libdl"
  576. LIBGC_STATIC_LIBS="$LIBGC_LIBS"
  577. # AC_CHECK_FUNCS does not work for some reason...
  578. AC_CHECK_LIB(gc, GC_gcj_malloc, found_gcj_malloc="yes",,$libdl)
  579. if test "x$found_gcj_malloc" = "xyes"; then
  580. AC_DEFINE(HAVE_GC_GCJ_MALLOC, 1, [Have GC_gcj_malloc])
  581. AC_DEFINE_UNQUOTED(USED_GC_NAME, "System Boehm (with typed GC)", [GC description])
  582. else
  583. AC_DEFINE_UNQUOTED(USED_GC_NAME, "System Boehm (no typed GC)", [GC description])
  584. fi
  585. AC_CHECK_LIB(gc, GC_enable, found_gc_enable="yes",,$libdl)
  586. if test "x$found_gc_enable" = "xyes"; then
  587. AC_DEFINE(HAVE_GC_ENABLE, 1, [Have 'GC_enable'])
  588. fi
  589. ;;
  590. xincluded)
  591. found_boehm=yes
  592. gc_headers=yes
  593. use_included_gc=yes
  594. libgc_dir=libgc
  595. LIBGC_CFLAGS='-I$(top_srcdir)/libgc/include'
  596. LIBGC_LIBS='$(top_builddir)/libgc/libmonogc.la'
  597. LIBGC_STATIC_LIBS='$(top_builddir)/libgc/libmonogc-static.la'
  598. AC_DEFINE(HAVE_BOEHM_GC, 1, [Have Boehm GC])
  599. AC_SUBST(HAVE_BOEHM_GC)
  600. AC_DEFINE(HAVE_GC_H, 1, [Have gc.h])
  601. AC_DEFINE(USE_INCLUDED_LIBGC, 1, [Use included libgc])
  602. # The included libgc contains GCJ support
  603. AC_DEFINE(HAVE_GC_GCJ_MALLOC, 1, [Have GC_gcj_malloc])
  604. AC_DEFINE(HAVE_GC_ENABLE, 1, [Have GC_enable])
  605. if test x$enable_parallel_mark = xyes; then
  606. AC_DEFINE_UNQUOTED(USED_GC_NAME, "Included Boehm (with typed GC and Parallel Mark)", [GC description])
  607. else
  608. AC_DEFINE_UNQUOTED(USED_GC_NAME, "Included Boehm (with typed GC)", [GC description])
  609. fi
  610. ;;
  611. xsgen)
  612. found_boehm=no
  613. gc_headers=no
  614. use_included_gc=no
  615. AC_DEFINE(HAVE_SGEN_GC,1,[Using the simple generational GC.])
  616. AC_DEFINE(HAVE_MOVING_COLLECTOR,1,[The GC can move objects.])
  617. AC_DEFINE(HAVE_WRITE_BARRIERS,1,[The GC needs write barriers.])
  618. AC_DEFINE_UNQUOTED(USED_GC_NAME, "Simple generational", [GC description])
  619. ;;
  620. xnone)
  621. AC_MSG_WARN("Compiling mono without GC.")
  622. AC_DEFINE_UNQUOTED(USED_GC_NAME, "none", [GC description])
  623. AC_DEFINE(HAVE_NULL_GC,1,[No GC support.])
  624. ;;
  625. *)
  626. AC_MSG_ERROR([Invalid argument to --with-gc.])
  627. ;;
  628. esac
  629. AC_ARG_WITH(large-heap, [ --with-large-heap=yes,no Enable support for GC heaps larger than 3GB], [large_heap=$withval], [large_heap=no])
  630. if test "x$large_heap" = "xyes"; then
  631. echo "FOO"
  632. CPPFLAGS="$CPPFLAGS -DLARGE_CONFIG"
  633. fi
  634. AM_CONDITIONAL(INCLUDED_LIBGC, test x$use_included_gc = xyes)
  635. AC_SUBST(LIBGC_CFLAGS)
  636. AC_SUBST(LIBGC_LIBS)
  637. AC_SUBST(LIBGC_STATIC_LIBS)
  638. AC_SUBST(libgc_dir)
  639. dnl
  640. dnl End of libgc checks
  641. dnl
  642. if test x$platform_win32 = xno; then
  643. dnl hires monotonic clock support
  644. AC_SEARCH_LIBS(clock_gettime, rt)
  645. dnl dynamic loader support
  646. AC_CHECK_FUNC(dlopen, DL_LIB="",
  647. AC_CHECK_LIB(dl, dlopen, DL_LIB="-ldl", dl_support=no)
  648. )
  649. if test x$dl_support = xno; then
  650. AC_MSG_WARN([No dynamic loading support available])
  651. else
  652. LIBS="$LIBS $DL_LIB"
  653. AC_DEFINE(HAVE_DL_LOADER,1,[dlopen-based dynamic loader available])
  654. dnl from glib's configure.in
  655. AC_CACHE_CHECK([for preceeding underscore in symbols],
  656. mono_cv_uscore,[
  657. AC_TRY_RUN([#include <dlfcn.h>
  658. int mono_underscore_test (void) { return 42; }
  659. int main() {
  660. void *f1 = (void*)0, *f2 = (void*)0, *handle;
  661. handle = dlopen ((void*)0, 0);
  662. if (handle) {
  663. f1 = dlsym (handle, "mono_underscore_test");
  664. f2 = dlsym (handle, "_mono_underscore_test");
  665. } return (!f2 || f1);
  666. }],
  667. [mono_cv_uscore=yes],
  668. [mono_cv_uscore=no],
  669. [])
  670. ])
  671. if test "x$mono_cv_uscore" = "xyes"; then
  672. MONO_DL_NEED_USCORE=1
  673. else
  674. MONO_DL_NEED_USCORE=0
  675. fi
  676. AC_SUBST(MONO_DL_NEED_USCORE)
  677. AC_CHECK_FUNC(dlerror)
  678. fi
  679. dnl ******************************************************************
  680. dnl *** Checks for the IKVM JNI interface library ***
  681. dnl ******************************************************************
  682. AC_ARG_WITH(ikvm-native, [ --with-ikvm-native=yes,no build the IKVM JNI interface library],[with_ikvm_native=$withval],[with_ikvm_native=yes])
  683. ikvm_native_dir=
  684. if test x$with_ikvm_native = xyes; then
  685. ikvm_native_dir=ikvm-native
  686. jdk_headers_found="IKVM Native"
  687. fi
  688. AC_SUBST(ikvm_native_dir)
  689. AC_CHECK_HEADERS(execinfo.h)
  690. AC_CHECK_FUNCS(getgrgid_r)
  691. AC_CHECK_FUNCS(getgrnam_r)
  692. AC_CHECK_FUNCS(getpwnam_r)
  693. AC_CHECK_FUNCS(getpwuid_r)
  694. AC_CHECK_FUNCS(getresuid)
  695. AC_CHECK_FUNCS(setresuid)
  696. AC_CHECK_FUNCS(kqueue)
  697. AC_CHECK_FUNCS(backtrace_symbols)
  698. AC_CHECK_FUNCS(mkstemp)
  699. AC_CHECK_FUNCS(mmap)
  700. AC_CHECK_FUNCS(madvise)
  701. AC_CHECK_FUNCS(getrusage)
  702. AC_CHECK_FUNCS(getpriority)
  703. AC_CHECK_FUNCS(setpriority)
  704. AC_CHECK_FUNCS(sched_setaffinity)
  705. dnl ******************************************************************
  706. dnl *** Check for large file support ***
  707. dnl *** (If we were using autoconf 2.50 we'd use AC_SYS_LARGEFILE) ***
  708. dnl ******************************************************************
  709. # Check that off_t can represent 2**63 - 1 correctly, working around
  710. # potential compiler bugs. Defines LARGE_FILE_SUPPORT, adds $1 to
  711. # CPPFLAGS and sets $large_offt to yes if the test succeeds
  712. large_offt=no
  713. AC_DEFUN([LARGE_FILES], [
  714. large_CPPFLAGS=$CPPFLAGS
  715. CPPFLAGS="$CPPFLAGS $1"
  716. AC_TRY_RUN([
  717. #include <sys/types.h>
  718. #define BIG_OFF_T (((off_t)1<<62)-1+((off_t)1<<62))
  719. int main(void) {
  720. int big_off_t=((BIG_OFF_T%2147483629==721) &&
  721. (BIG_OFF_T%2147483647==1));
  722. if(big_off_t) {
  723. exit(0);
  724. } else {
  725. exit(1);
  726. }
  727. }
  728. ], [
  729. AC_MSG_RESULT(ok)
  730. AC_DEFINE(HAVE_LARGE_FILE_SUPPORT, 1, [Have large file support])
  731. large_CPPFLAGS="$large_CPPFLAGS $1"
  732. large_offt=yes
  733. ], [
  734. AC_MSG_RESULT(no)
  735. ], "")
  736. CPPFLAGS=$large_CPPFLAGS
  737. ])
  738. AC_MSG_CHECKING(if off_t is 64 bits wide)
  739. LARGE_FILES("")
  740. if test $large_offt = no; then
  741. AC_MSG_CHECKING(if _FILE_OFFSET_BITS=64 gives 64 bit off_t)
  742. LARGE_FILES("-D_FILE_OFFSET_BITS=64")
  743. fi
  744. if test $large_offt = no; then
  745. AC_MSG_WARN([No 64 bit file size support available])
  746. fi
  747. dnl *****************************
  748. dnl *** Checks for libsocket ***
  749. dnl *****************************
  750. AC_CHECK_LIB(socket, socket, LIBS="$LIBS -lsocket")
  751. dnl *******************************
  752. dnl *** Checks for MSG_NOSIGNAL ***
  753. dnl *******************************
  754. AC_MSG_CHECKING(for MSG_NOSIGNAL)
  755. AC_TRY_COMPILE([#include <sys/socket.h>], [
  756. int f = MSG_NOSIGNAL;
  757. ], [
  758. # Yes, we have it...
  759. AC_MSG_RESULT(yes)
  760. AC_DEFINE(HAVE_MSG_NOSIGNAL, 1, [Have MSG_NOSIGNAL])
  761. ], [
  762. # We'll have to use signals
  763. AC_MSG_RESULT(no)
  764. ])
  765. dnl *****************************
  766. dnl *** Checks for SOL_IP ***
  767. dnl *****************************
  768. AC_MSG_CHECKING(for SOL_IP)
  769. AC_TRY_COMPILE([#include <netdb.h>], [
  770. int level = SOL_IP;
  771. ], [
  772. # Yes, we have it...
  773. AC_MSG_RESULT(yes)
  774. AC_DEFINE(HAVE_SOL_IP, 1, [Have SOL_IP])
  775. ], [
  776. # We'll have to use getprotobyname
  777. AC_MSG_RESULT(no)
  778. ])
  779. dnl *****************************
  780. dnl *** Checks for SOL_IPV6 ***
  781. dnl *****************************
  782. AC_MSG_CHECKING(for SOL_IPV6)
  783. AC_TRY_COMPILE([#include <netdb.h>], [
  784. int level = SOL_IPV6;
  785. ], [
  786. # Yes, we have it...
  787. AC_MSG_RESULT(yes)
  788. AC_DEFINE(HAVE_SOL_IPV6, 1, [Have SOL_IPV6])
  789. ], [
  790. # We'll have to use getprotobyname
  791. AC_MSG_RESULT(no)
  792. ])
  793. dnl *****************************
  794. dnl *** Checks for SOL_TCP ***
  795. dnl *****************************
  796. AC_MSG_CHECKING(for SOL_TCP)
  797. AC_TRY_COMPILE([#include <netdb.h>], [
  798. int level = SOL_TCP;
  799. ], [
  800. # Yes, we have it...
  801. AC_MSG_RESULT(yes)
  802. AC_DEFINE(HAVE_SOL_TCP, 1, [Have SOL_TCP])
  803. ], [
  804. # We'll have to use getprotobyname
  805. AC_MSG_RESULT(no)
  806. ])
  807. dnl *****************************
  808. dnl *** Checks for IP_PKTINFO ***
  809. dnl *****************************
  810. AC_MSG_CHECKING(for IP_PKTINFO)
  811. AC_TRY_COMPILE([#include <netdb.h>], [
  812. int level = IP_PKTINFO;
  813. ], [
  814. # Yes, we have it...
  815. AC_MSG_RESULT(yes)
  816. AC_DEFINE(HAVE_IP_PKTINFO, 1, [Have IP_PKTINFO])
  817. ], [
  818. AC_MSG_RESULT(no)
  819. ])
  820. dnl *****************************
  821. dnl *** Checks for IPV6_PKTINFO ***
  822. dnl *****************************
  823. AC_MSG_CHECKING(for IPV6_PKTINFO)
  824. AC_TRY_COMPILE([#include <netdb.h>], [
  825. int level = IPV6_PKTINFO;
  826. ], [
  827. # Yes, we have it...
  828. AC_MSG_RESULT(yes)
  829. AC_DEFINE(HAVE_IPV6_PKTINFO, 1, [Have IPV6_PKTINFO])
  830. ], [
  831. AC_MSG_RESULT(no)
  832. ])
  833. dnl **********************************
  834. dnl *** Checks for IP_DONTFRAGMENT ***
  835. dnl **********************************
  836. AC_MSG_CHECKING(for IP_DONTFRAGMENT)
  837. AC_TRY_COMPILE([#include <netdb.h>], [
  838. int level = IP_DONTFRAGMENT;
  839. ], [
  840. # Yes, we have it...
  841. AC_MSG_RESULT(yes)
  842. AC_DEFINE(HAVE_IP_DONTFRAGMENT, 1, [Have IP_DONTFRAGMENT])
  843. ], [
  844. AC_MSG_RESULT(no)
  845. ])
  846. dnl **********************************
  847. dnl *** Checks for IP_MTU_DISCOVER ***
  848. dnl **********************************
  849. AC_MSG_CHECKING(for IP_MTU_DISCOVER)
  850. AC_TRY_COMPILE([#include <netdb.h>], [
  851. int level = IP_MTU_DISCOVER;
  852. ], [
  853. # Yes, we have it...
  854. AC_MSG_RESULT(yes)
  855. AC_DEFINE(HAVE_IP_MTU_DISCOVER, 1, [Have IP_MTU_DISCOVER])
  856. ], [
  857. AC_MSG_RESULT(no)
  858. ])
  859. dnl *********************************
  860. dnl *** Check for struct ip_mreqn ***
  861. dnl *********************************
  862. AC_MSG_CHECKING(for struct ip_mreqn)
  863. AC_TRY_COMPILE([#include <netinet/in.h>], [
  864. struct ip_mreqn mreq;
  865. mreq.imr_address.s_addr = 0;
  866. ], [
  867. # Yes, we have it...
  868. AC_MSG_RESULT(yes)
  869. AC_DEFINE(HAVE_STRUCT_IP_MREQN, 1, [Have struct ip_mreqn])
  870. ], [
  871. # We'll just have to try and use struct ip_mreq
  872. AC_MSG_RESULT(no)
  873. AC_MSG_CHECKING(for struct ip_mreq)
  874. AC_TRY_COMPILE([#include <netinet/in.h>], [
  875. struct ip_mreq mreq;
  876. mreq.imr_interface.s_addr = 0;
  877. ], [
  878. # Yes, we have it...
  879. AC_MSG_RESULT(yes)
  880. AC_DEFINE(HAVE_STRUCT_IP_MREQ, 1, [Have struct ip_mreq])
  881. ], [
  882. # No multicast support
  883. AC_MSG_RESULT(no)
  884. ])
  885. ])
  886. dnl **********************************
  887. dnl *** Check for gethostbyname2_r ***
  888. dnl **********************************
  889. AC_MSG_CHECKING(for gethostbyname2_r)
  890. AC_TRY_LINK([#include <netdb.h>], [
  891. gethostbyname2_r(NULL,0,NULL,NULL,0,NULL,NULL);
  892. ], [
  893. # Yes, we have it...
  894. AC_MSG_RESULT(yes)
  895. AC_DEFINE(HAVE_GETHOSTBYNAME2_R, 1, [Have gethostbyname2_r])
  896. ], [
  897. AC_MSG_RESULT(no)
  898. ])
  899. dnl *****************************
  900. dnl *** Checks for libnsl ***
  901. dnl *****************************
  902. AC_CHECK_FUNC(gethostbyaddr, , AC_CHECK_LIB(nsl, gethostbyaddr, LIBS="$LIBS -lnsl"))
  903. AC_CHECK_FUNCS(inet_pton inet_aton)
  904. dnl ***********************************************
  905. dnl *** Checks for size of sockaddr_un.sun_path ***
  906. dnl ***********************************************
  907. # AC_CHECK_SIZEOF can't cope with struct members :-(
  908. AC_MSG_CHECKING(size of sockaddr_un.sun_path)
  909. AC_CACHE_VAL(mono_cv_sizeof_sunpath,
  910. [AC_TRY_RUN([
  911. #include <sys/types.h>
  912. #include <stdio.h>
  913. #include <sys/un.h>
  914. int main(void) {
  915. struct sockaddr_un sock_un;
  916. FILE *f=fopen("conftestval", "w");
  917. if(!f) exit(1);
  918. fprintf(f, "%d\n", sizeof(sock_un.sun_path));
  919. exit(0);
  920. }
  921. ], mono_cv_sizeof_sunpath=`cat conftestval`,
  922. mono_cv_sizeof_sunpath=0,
  923. mono_cv_sizeof_sunpath=0)])dnl
  924. AC_MSG_RESULT($mono_cv_sizeof_sunpath)
  925. AC_DEFINE_UNQUOTED(MONO_SIZEOF_SUNPATH, $mono_cv_sizeof_sunpath, [Sizeof sock_un.sun_path])
  926. dnl *************************************
  927. dnl *** Checks for zero length arrays ***
  928. dnl *************************************
  929. AC_MSG_CHECKING(whether $CC supports zero length arrays)
  930. AC_TRY_COMPILE([
  931. struct s {
  932. int length;
  933. char data [0];
  934. };
  935. ], [], [
  936. AC_MSG_RESULT(yes)
  937. AC_DEFINE_UNQUOTED(MONO_ZERO_ARRAY_LENGTH, 0, [Length of zero length arrays])
  938. ], [
  939. AC_MSG_RESULT(no)
  940. AC_DEFINE_UNQUOTED(MONO_ZERO_ARRAY_LENGTH, 1, [Length of zero length arrays])
  941. ])
  942. dnl *****************************
  943. dnl *** Checks for libxnet ***
  944. dnl *****************************
  945. case "${host}" in
  946. *solaris* )
  947. AC_MSG_CHECKING(for Solaris XPG4 support)
  948. if test -f /usr/lib/libxnet.so; then
  949. CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=500"
  950. CPPFLAGS="$CPPFLAGS -D__EXTENSIONS__"
  951. CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE_EXTENDED=1"
  952. LIBS="$LIBS -lxnet"
  953. AC_MSG_RESULT(yes)
  954. else
  955. AC_MSG_RESULT(no)
  956. fi
  957. if test "$GCC" = "yes"; then
  958. CFLAGS="$CFLAGS -Wno-char-subscripts"
  959. fi
  960. ;;
  961. esac
  962. dnl *****************************
  963. dnl *** Checks for libpthread ***
  964. dnl *****************************
  965. # on FreeBSD -STABLE, the pthreads functions all reside in libc_r
  966. # and libpthread does not exist
  967. #
  968. case "${host}" in
  969. *-*-*freebsd*)
  970. AC_CHECK_LIB(pthread, main, LIBS="$LIBS -pthread")
  971. ;;
  972. *)
  973. AC_CHECK_LIB(pthread, main, LIBS="$LIBS -lpthread")
  974. ;;
  975. esac
  976. AC_CHECK_HEADERS(pthread.h)
  977. AC_CHECK_FUNCS(pthread_mutex_timedlock)
  978. AC_CHECK_FUNCS(pthread_getattr_np pthread_attr_get_np)
  979. AC_MSG_CHECKING(for PTHREAD_MUTEX_RECURSIVE)
  980. AC_TRY_COMPILE([ #include <pthread.h>], [
  981. pthread_mutexattr_t attr;
  982. pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
  983. ], [
  984. AC_MSG_RESULT(ok)
  985. ], [
  986. AC_MSG_RESULT(no)
  987. AC_MSG_WARN(Using mono_mutex_t for recursive mutexes)
  988. AC_DEFINE(USE_MONO_MUTEX, 1, [Use mono_mutex_t])
  989. ])
  990. AC_CHECK_FUNCS(pthread_attr_setstacksize)
  991. AC_CHECK_FUNCS(pthread_attr_getstack)
  992. AC_CHECK_FUNCS(pthread_get_stacksize_np pthread_get_stackaddr_np)
  993. dnl ***********************************
  994. dnl *** Checks for working __thread ***
  995. dnl ***********************************
  996. AC_MSG_CHECKING(for working __thread)
  997. if test "x$with_tls" != "x__thread"; then
  998. AC_MSG_RESULT(disabled)
  999. else
  1000. AC_TRY_RUN([
  1001. #include <pthread.h>
  1002. __thread int i;
  1003. static int res1, res2;
  1004. void thread_main (void *arg)
  1005. {
  1006. i = arg;
  1007. sleep (1);
  1008. if (arg == 1)
  1009. res1 = (i == arg);
  1010. else
  1011. res2 = (i == arg);
  1012. }
  1013. int main () {
  1014. pthread_t t1, t2;
  1015. i = 5;
  1016. pthread_create (&t1, NULL, thread_main, 1);
  1017. pthread_create (&t2, NULL, thread_main, 2);
  1018. pthread_join (t1, NULL);
  1019. pthread_join (t2, NULL);
  1020. return !(res1 + res2 == 2);
  1021. }
  1022. ], [
  1023. AC_MSG_RESULT(yes)
  1024. ], [
  1025. AC_MSG_RESULT(no)
  1026. with_tls=pthread
  1027. ])
  1028. fi
  1029. dnl **************************************
  1030. dnl *** Checks for working sigaltstack ***
  1031. dnl **************************************
  1032. AC_MSG_CHECKING(for working sigaltstack)
  1033. if test "x$with_sigaltstack" != "xyes"; then
  1034. AC_MSG_RESULT(disabled)
  1035. else
  1036. AC_TRY_RUN([
  1037. #include <stdio.h>
  1038. #include <stdlib.h>
  1039. #include <unistd.h>
  1040. #include <signal.h>
  1041. #include <pthread.h>
  1042. #include <sys/wait.h>
  1043. #if defined(__FreeBSD__) || defined(__NetBSD__)
  1044. #define SA_STACK SA_ONSTACK
  1045. #endif
  1046. static void
  1047. sigsegv_signal_handler (int _dummy, siginfo_t *info, void *context)
  1048. {
  1049. exit (0);
  1050. }
  1051. static void *
  1052. loop (void *ignored)
  1053. {
  1054. char *ptr = NULL;
  1055. *ptr = 0;
  1056. return NULL;
  1057. }
  1058. static void
  1059. child ()
  1060. {
  1061. struct sigaction sa;
  1062. struct sigaltstack sas;
  1063. pthread_t id;
  1064. pthread_attr_t attr;
  1065. sa.sa_sigaction = sigsegv_signal_handler;
  1066. sigemptyset (&sa.sa_mask);
  1067. sa.sa_flags = SA_SIGINFO | SA_ONSTACK;
  1068. if (sigaction (SIGSEGV, &sa, NULL) == -1) {
  1069. perror ("sigaction");
  1070. return;
  1071. }
  1072. sas.ss_sp = malloc (SIGSTKSZ);
  1073. sas.ss_size = SIGSTKSZ;
  1074. sas.ss_flags = 0;
  1075. if (sigaltstack (&sas, NULL) == -1) {
  1076. perror ("sigaltstack");
  1077. return;
  1078. }
  1079. pthread_attr_init (&attr);
  1080. if (pthread_create(&id, &attr, loop, &attr) != 0) {
  1081. printf ("pthread_create\n");
  1082. return;
  1083. }
  1084. sleep (100);
  1085. }
  1086. int
  1087. main ()
  1088. {
  1089. pid_t son;
  1090. int status;
  1091. int i;
  1092. son = fork ();
  1093. if (son == -1) {
  1094. return 1;
  1095. }
  1096. if (son == 0) {
  1097. child ();
  1098. return 0;
  1099. }
  1100. for (i = 0; i < 3; ++i) {
  1101. sleep (1);
  1102. waitpid (son, &status, WNOHANG);
  1103. if (WIFEXITED (status) && WEXITSTATUS (status) == 0)
  1104. return 0;
  1105. }
  1106. kill (son, SIGKILL);
  1107. return 1;
  1108. }
  1109. ], [
  1110. AC_MSG_RESULT(yes)
  1111. AC_DEFINE(HAVE_WORKING_SIGALTSTACK, 1, [Have a working sigaltstack])
  1112. ], [
  1113. with_sigaltstack=no
  1114. AC_MSG_RESULT(no)
  1115. ])
  1116. fi
  1117. dnl ********************************
  1118. dnl *** Checks for semaphore lib ***
  1119. dnl ********************************
  1120. # 'Real Time' functions on Solaris
  1121. # posix4 on Solaris 2.6
  1122. # pthread (first!) on Linux
  1123. AC_SEARCH_LIBS(sem_init, pthread rt posix4)
  1124. AC_SEARCH_LIBS(shm_open, pthread rt posix4)
  1125. AC_CHECK_FUNCS(shm_open)
  1126. dnl ********************************
  1127. dnl *** Checks for timezone stuff **
  1128. dnl ********************************
  1129. AC_CACHE_CHECK(for tm_gmtoff in struct tm, ac_cv_struct_tm_gmtoff,
  1130. AC_TRY_COMPILE([
  1131. #include <time.h>
  1132. ], [
  1133. struct tm tm;
  1134. tm.tm_gmtoff = 1;
  1135. ], ac_cv_struct_tm_gmtoff=yes, ac_cv_struct_tm_gmtoff=no))
  1136. if test $ac_cv_struct_tm_gmtoff = yes; then
  1137. AC_DEFINE(HAVE_TM_GMTOFF, 1, [Have tm_gmtoff])
  1138. else
  1139. AC_CACHE_CHECK(for timezone variable, ac_cv_var_timezone,
  1140. AC_TRY_COMPILE([
  1141. #include <time.h>
  1142. ], [
  1143. timezone = 1;
  1144. ], ac_cv_var_timezone=yes, ac_cv_var_timezone=no))
  1145. if test $ac_cv_var_timezone = yes; then
  1146. AC_DEFINE(HAVE_TIMEZONE, 1, [Have timezone variable])
  1147. else
  1148. AC_ERROR(unable to find a way to determine timezone)
  1149. fi
  1150. fi
  1151. dnl *********************************
  1152. dnl *** Checks for math functions ***
  1153. dnl *********************************
  1154. LIBS="$LIBS -lm";
  1155. if test "x$has_broken_apple_cpp" != "xyes"; then
  1156. AC_CHECK_FUNCS(finite, , AC_MSG_CHECKING(for finite in math.h)
  1157. AC_TRY_LINK([#include <math.h>],
  1158. [ finite(0.0); ],
  1159. AC_DEFINE(HAVE_FINITE, 1, [Have finite]) AC_MSG_RESULT(yes),
  1160. AC_MSG_RESULT(no)))
  1161. fi
  1162. AC_CHECK_FUNCS(isfinite, , AC_MSG_CHECKING(for isfinite in math.h)
  1163. AC_TRY_LINK([#include <math.h>],
  1164. [ isfinite(0.0); ],
  1165. AC_DEFINE(HAVE_ISFINITE, 1, [Have isfinite]) AC_MSG_RESULT(yes),
  1166. AC_MSG_RESULT(no)))
  1167. dnl ****************************************************************
  1168. dnl *** Checks for working poll() (macosx defines it but doesn't ***
  1169. dnl *** have it in the library (duh)) ***
  1170. dnl ****************************************************************
  1171. AC_CHECK_FUNCS(poll)
  1172. dnl *************************
  1173. dnl *** Check for signbit ***
  1174. dnl *************************
  1175. AC_MSG_CHECKING(for signbit)
  1176. AC_TRY_LINK([#include <math.h>], [
  1177. int s = signbit(1.0);
  1178. ], [
  1179. AC_MSG_RESULT(yes)
  1180. AC_DEFINE(HAVE_SIGNBIT, 1, [Have signbit])
  1181. ], [
  1182. AC_MSG_RESULT(no)
  1183. ])
  1184. dnl **********************************
  1185. dnl *** epoll ***
  1186. dnl **********************************
  1187. AC_CHECK_HEADERS(sys/epoll.h)
  1188. haveepoll=no
  1189. AC_CHECK_FUNCS(epoll_ctl, [haveepoll=yes], )
  1190. if test "x$haveepoll" = "xyes" -a "x$ac_cv_header_sys_epoll_h" = "xyes" ; then
  1191. AC_DEFINE(HAVE_EPOLL, 1, [epoll supported])
  1192. fi
  1193. dnl ******************************
  1194. dnl *** Checks for SIOCGIFCONF ***
  1195. dnl ******************************
  1196. AC_CHECK_HEADERS(sys/ioctl.h)
  1197. AC_CHECK_HEADERS(net/if.h)
  1198. AC_MSG_CHECKING(for ifreq)
  1199. AC_TRY_COMPILE([
  1200. #include <sys/ioctl.h>
  1201. #include <net/if.h>
  1202. ], [
  1203. struct ifconf ifc;
  1204. struct ifreq *ifr;
  1205. void *x;
  1206. ifc.ifc_len = 0;
  1207. ifc.ifc_buf = NULL;
  1208. x = (void *) &ifr->ifr_addr;
  1209. ],[
  1210. AC_MSG_RESULT(yes)
  1211. AC_DEFINE(HAVE_SIOCGIFCONF, 1, [Can get interface list])
  1212. ], [
  1213. AC_MSG_RESULT(no)
  1214. ])
  1215. dnl **********************************
  1216. dnl *** Checks for sin_len ***
  1217. dnl **********************************
  1218. AC_MSG_CHECKING(for sockaddr_in.sin_len)
  1219. AC_TRY_COMPILE([
  1220. #include <netinet/in.h>
  1221. ], [
  1222. struct sockaddr_in saddr;
  1223. saddr.sin_len = sizeof (saddr);
  1224. ],[
  1225. AC_MSG_RESULT(yes)
  1226. AC_DEFINE(HAVE_SOCKADDR_IN_SIN_LEN, 1, [sockaddr_in has sin_len])
  1227. ], [
  1228. AC_MSG_RESULT(no)
  1229. ])
  1230. dnl **********************************
  1231. dnl *** Checks for sin6_len ***
  1232. dnl **********************************
  1233. AC_MSG_CHECKING(for sockaddr_in6.sin6_len)
  1234. AC_TRY_COMPILE([
  1235. #include <netinet/in.h>
  1236. ], [
  1237. struct sockaddr_in6 saddr6;
  1238. saddr6.sin6_len = sizeof (saddr6);
  1239. ],[
  1240. AC_MSG_RESULT(yes)
  1241. AC_DEFINE(HAVE_SOCKADDR_IN6_SIN_LEN, 1, [sockaddr_in6 has sin6_len])
  1242. ], [
  1243. AC_MSG_RESULT(no)
  1244. ])
  1245. dnl **********************************
  1246. dnl *** Checks for MonoPosixHelper ***
  1247. dnl **********************************
  1248. AC_CHECK_HEADERS(checklist.h)
  1249. AC_CHECK_HEADERS(fstab.h)
  1250. AC_CHECK_HEADERS(attr/xattr.h)
  1251. AC_CHECK_HEADERS(sys/extattr.h)
  1252. AC_CHECK_HEADERS(sys/sendfile.h)
  1253. AC_CHECK_HEADERS(sys/statvfs.h)
  1254. AC_CHECK_HEADERS(sys/vfstab.h)
  1255. AC_CHECK_HEADERS(sys/xattr.h)
  1256. AC_CHECK_HEADERS(sys/mman.h)
  1257. AC_CHECK_FUNCS(getdomainname)
  1258. AC_CHECK_FUNCS(setdomainname)
  1259. AC_CHECK_FUNCS(fgetgrent)
  1260. AC_CHECK_FUNCS(fgetpwent)
  1261. AC_CHECK_FUNCS(fgetpwent)
  1262. AC_CHECK_FUNCS(getfsstat)
  1263. AC_CHECK_FUNCS(lutimes)
  1264. AC_CHECK_FUNCS(mremap)
  1265. AC_CHECK_FUNCS(remap_file_pages)
  1266. AC_CHECK_FUNCS(posix_fadvise)
  1267. AC_CHECK_FUNCS(posix_fallocate)
  1268. AC_CHECK_FUNCS(posix_madvise)
  1269. AC_CHECK_FUNCS(vsnprintf)
  1270. AC_CHECK_FUNCS(sendfile)
  1271. AC_CHECK_FUNCS(sethostid)
  1272. AC_CHECK_FUNCS(statfs)
  1273. AC_CHECK_FUNCS(fstatfs)
  1274. AC_CHECK_FUNCS(statvfs)
  1275. AC_CHECK_FUNCS(fstatvfs)
  1276. AC_CHECK_FUNCS(stime)
  1277. AC_CHECK_FUNCS(strerror_r)
  1278. AC_CHECK_FUNCS(ttyname_r)
  1279. AC_CHECK_SIZEOF(size_t)
  1280. AC_CHECK_TYPES([blksize_t], [AC_DEFINE(HAVE_BLKSIZE_T)], ,
  1281. [#include <sys/types.h>
  1282. #include <sys/stat.h>
  1283. #include <unistd.h>])
  1284. AC_CHECK_TYPES([blkcnt_t], [AC_DEFINE(HAVE_BLKCNT_T)], ,
  1285. [#include <sys/types.h>
  1286. #include <sys/stat.h>
  1287. #include <unistd.h>])
  1288. AC_CHECK_TYPES([suseconds_t], [AC_DEFINE(HAVE_SUSECONDS_T)], ,
  1289. [#include <sys/time.h>])
  1290. AC_CHECK_TYPES([struct flock], [AC_DEFINE(HAVE_STRUCT_FLOCK)], ,
  1291. [#include <unistd.h>
  1292. #include <fcntl.h>])
  1293. AC_CHECK_TYPES([struct pollfd], [AC_DEFINE(HAVE_STRUCT_POLLFD)], ,
  1294. [#include <sys/poll.h>])
  1295. AC_CHECK_TYPES([struct stat], [AC_DEFINE(HAVE_STRUCT_STAT)], ,
  1296. [#include <sys/types.h>
  1297. #include <sys/stat.h>
  1298. #include <unistd.h>])
  1299. AC_CHECK_TYPES([struct timespec], [AC_DEFINE(HAVE_STRUCT_TIMESPEC)], ,
  1300. [#include <time.h>])
  1301. AC_CHECK_TYPES([struct timeval], [AC_DEFINE(HAVE_STRUCT_TIMEVAL)], ,
  1302. [#include <sys/time.h>
  1303. #include <sys/types.h>
  1304. #include <utime.h>])
  1305. AC_CHECK_TYPES([struct timezone], [AC_DEFINE(HAVE_STRUCT_TIMEZONE)], ,
  1306. [#include <sys/time.h>])
  1307. AC_CHECK_TYPES([struct utimbuf], [AC_DEFINE(HAVE_STRUCT_UTIMBUF)], ,
  1308. [#include <sys/types.h>
  1309. #include <utime.h>])
  1310. AC_CHECK_MEMBERS(
  1311. [struct dirent.d_off, struct dirent.d_reclen, struct dirent.d_type],,,
  1312. [#include <sys/types.h>
  1313. #include <dirent.h>])
  1314. dnl Favour xattr through glibc, but use libattr if we have to
  1315. AC_CHECK_FUNC(lsetxattr, ,
  1316. AC_CHECK_LIB(attr, lsetxattr, XATTR_LIB="-lattr",)
  1317. )
  1318. AC_SUBST(XATTR_LIB)
  1319. dnl kinfo_proc.kp_proc works on darwin but fails on other simil-bsds
  1320. AC_CHECK_MEMBERS(
  1321. [struct kinfo_proc.kp_proc],,,
  1322. [#include <sys/types.h>
  1323. #include <sys/sysctl.h>
  1324. #include <sys/proc.h>
  1325. ])
  1326. dnl *********************************
  1327. dnl *** Checks for Windows compilation ***
  1328. dnl *********************************
  1329. AC_CHECK_HEADERS(sys/time.h)
  1330. AC_CHECK_HEADERS(sys/param.h)
  1331. AC_CHECK_HEADERS(dirent.h)
  1332. dnl *********************************
  1333. dnl *** Check for Console 2.0 I/O ***
  1334. dnl *********************************
  1335. AC_CHECK_HEADERS([curses.h])
  1336. AC_CHECK_HEADERS([term.h], [], [],
  1337. [#if HAVE_CURSES_H
  1338. #include <curses.h>
  1339. #endif
  1340. ])
  1341. AC_CHECK_HEADERS([termios.h])
  1342. dnl * This is provided in io-layer, but on windows it's only available
  1343. dnl * on xp+
  1344. AC_DEFINE(HAVE_GETPROCESSID, 1, [Define if GetProcessId is available])
  1345. else
  1346. jdk_headers_found=no
  1347. AC_CHECK_LIB(ws2_32, main, LIBS="$LIBS -lws2_32", AC_ERROR(bad mingw install?))
  1348. AC_CHECK_LIB(psapi, main, LIBS="$LIBS -lpsapi", AC_ERROR(bad mingw install?))
  1349. AC_CHECK_LIB(ole32, main, LIBS="$LIBS -lole32", AC_ERROR(bad mingw install?))
  1350. AC_CHECK_LIB(winmm, main, LIBS="$LIBS -lwinmm", AC_ERROR(bad mingw install?))
  1351. AC_CHECK_LIB(oleaut32, main, LIBS="$LIBS -loleaut32", AC_ERROR(bad mingw install?))
  1352. AC_CHECK_LIB(advapi32, main, LIBS="$LIBS -ladvapi32", AC_ERROR(bad mingw install?))
  1353. AC_CHECK_LIB(version, main, LIBS="$LIBS -lversion", AC_ERROR(bad mingw install?))
  1354. dnl *********************************
  1355. dnl *** Check for struct ip_mreqn ***
  1356. dnl *********************************
  1357. AC_MSG_CHECKING(for struct ip_mreqn)
  1358. AC_TRY_COMPILE([#include <ws2tcpip.h>], [
  1359. struct ip_mreqn mreq;
  1360. mreq.imr_address.s_addr = 0;
  1361. ], [
  1362. # Yes, we have it...
  1363. AC_MSG_RESULT(yes)
  1364. AC_DEFINE(HAVE_STRUCT_IP_MREQN)
  1365. ], [
  1366. # We'll just have to try and use struct ip_mreq
  1367. AC_MSG_RESULT(no)
  1368. AC_MSG_CHECKING(for struct ip_mreq)
  1369. AC_TRY_COMPILE([#include <ws2tcpip.h>], [
  1370. struct ip_mreq mreq;
  1371. mreq.imr_interface.s_addr = 0;
  1372. ], [
  1373. # Yes, we have it...
  1374. AC_MSG_RESULT(yes)
  1375. AC_DEFINE(HAVE_STRUCT_IP_MREQ)
  1376. ], [
  1377. # No multicast support
  1378. AC_MSG_RESULT(no)
  1379. ])
  1380. ])
  1381. AC_CHECK_FUNCS(GetProcessId)
  1382. fi
  1383. dnl socklen_t check
  1384. AC_MSG_CHECKING(for socklen_t)
  1385. AC_TRY_COMPILE([
  1386. #include <sys/types.h>
  1387. #include <sys/socket.h>
  1388. ],[
  1389. socklen_t foo;
  1390. ],[
  1391. ac_cv_c_socklen_t=yes
  1392. AC_DEFINE(HAVE_SOCKLEN_T, 1, [Have socklen_t])
  1393. AC_MSG_RESULT(yes)
  1394. ],[
  1395. AC_MSG_RESULT(no)
  1396. ])
  1397. AC_MSG_CHECKING(for array element initalizer support)
  1398. AC_TRY_COMPILE([#include <sys/socket.h>], [
  1399. const int array[] = {[1] = 2,};
  1400. ], [
  1401. # Yes, we have it...
  1402. AC_MSG_RESULT(yes)
  1403. AC_DEFINE(HAVE_ARRAY_ELEM_INIT,1,[Supports C99 array initialization])
  1404. ], [
  1405. # We'll have to use signals
  1406. AC_MSG_RESULT(no)
  1407. ])
  1408. AC_CHECK_FUNCS(trunc, , AC_MSG_CHECKING(for trunc in math.h)
  1409. # Simply calling trunc (0.0) is no good since gcc will optimize the call away
  1410. AC_TRY_LINK([#include <math.h>],
  1411. [ static void *p = &trunc; ],
  1412. [
  1413. AC_DEFINE(HAVE_TRUNC)
  1414. AC_MSG_RESULT(yes)
  1415. ac_cv_trunc=yes
  1416. ],
  1417. AC_MSG_RESULT(no)))
  1418. if test "x$ac_cv_truncl" != "xyes"; then
  1419. AC_CHECK_LIB(sunmath, aintl, [ AC_DEFINE(HAVE_AINTL, 1, [Has the 'aintl' function]) LIBS="$LIBS -lsunmath"])
  1420. fi
  1421. AC_CHECK_FUNCS(round)
  1422. AC_CHECK_FUNCS(rint)
  1423. dnl ****************************
  1424. dnl *** Look for /dev/random ***
  1425. dnl ****************************
  1426. AC_MSG_CHECKING([if usage of random device is requested])
  1427. AC_ARG_ENABLE(dev-random,
  1428. [ --disable-dev-random disable the use of the random device],
  1429. try_dev_random=$enableval, try_dev_random=yes)
  1430. AC_MSG_RESULT($try_dev_random)
  1431. case "{$target}" in
  1432. *-openbsd*)
  1433. NAME_DEV_RANDOM="/dev/srandom"
  1434. ;;
  1435. dnl Win32 does not have /dev/random, they have their own method...
  1436. *-*-mingw*|*-*-cygwin*)
  1437. ac_cv_have_dev_random=no
  1438. ;;
  1439. dnl Everywhere else, it's /dev/random
  1440. *)
  1441. NAME_DEV_RANDOM="/dev/random"
  1442. ;;
  1443. esac
  1444. AC_DEFINE_UNQUOTED(NAME_DEV_RANDOM, "$NAME_DEV_RANDOM", [Name of /dev/random])
  1445. dnl Now check if the device actually exists
  1446. if test "x$try_dev_random" = "xyes"; then
  1447. AC_CACHE_CHECK(for random device, ac_cv_have_dev_random,
  1448. [if test -r "$NAME_DEV_RANDOM" ; then
  1449. ac_cv_have_dev_random=yes; else ac_cv_have_dev_random=no; fi])
  1450. if test "x$ac_cv_have_dev_random" = "xyes"; then
  1451. AC_DEFINE(HAVE_CRYPT_RNG, 1, [Have /dev/random])
  1452. fi
  1453. else
  1454. AC_MSG_CHECKING(for random device)
  1455. ac_cv_have_dev_random=no
  1456. AC_MSG_RESULT(has been disabled)
  1457. fi
  1458. if test "x$platform_win32" = "xyes"; then
  1459. AC_DEFINE(HAVE_CRYPT_RNG)
  1460. fi
  1461. if test "x$ac_cv_have_dev_random" = "xno" \
  1462. && test "x$platform_win32" = "xno"; then
  1463. AC_MSG_WARN([[
  1464. ***
  1465. *** A system-provided entropy source was not found on this system.
  1466. *** Because of this, the System.Security.Cryptography random number generator
  1467. *** will throw a NotImplemented exception.
  1468. ***
  1469. *** If you are seeing this message, and you know your system DOES have an
  1470. *** entropy collection in place, please contact <[email protected]> and
  1471. *** provide information about the system and how to access the random device.
  1472. ***
  1473. *** Otherwise you can install either egd or prngd and set the environment
  1474. *** variable MONO_EGD_SOCKET to point to the daemon's socket to use that.
  1475. ***]])
  1476. fi
  1477. AC_MSG_CHECKING([if inter-process shared handles are requested])
  1478. AC_ARG_ENABLE(shared-handles, [ --disable-shared-handles disable inter-process shared handles], try_shared_handles=$enableval, try_shared_handles=yes)
  1479. AC_MSG_RESULT($try_shared_handles)
  1480. if test "x$try_shared_handles" != "xyes"; then
  1481. AC_DEFINE(DISABLE_SHARED_HANDLES, 1, [Disable inter-process shared handles])
  1482. AC_SUBST(DISABLE_SHARED_HANDLES)
  1483. fi
  1484. if test x$gc = xsgen; then
  1485. if test x$with_tls != x__thread; then
  1486. AC_MSG_ERROR([The SGEN garbage collector depends on a working __thread implementation, and either --with-thread=pthread was passed to configure, or the configure test for __thread failed.])
  1487. fi
  1488. fi
  1489. AC_ARG_ENABLE(nunit-tests, [ --enable-nunit-tests Run the nunit tests of the class library on 'make check'])
  1490. AM_CONDITIONAL(ENABLE_NUNIT_TESTS, [test x$enable_nunit_tests = xyes])
  1491. AC_MSG_CHECKING([if big-arrays are to be enabled])
  1492. AC_ARG_ENABLE(big-arrays, [ --enable-big-arrays Enable the allocation and indexing of arrays greater than Int32.MaxValue], enable_big_arrays=$enableval, enable_big_arrays=no)
  1493. if test "x$enable_big_arrays" = "xyes" ; then
  1494. if test "x$ac_cv_sizeof_void_p" = "x8"; then
  1495. AC_DEFINE(MONO_BIG_ARRAYS,1,[Enable the allocation and indexing of arrays greater than Int32.MaxValue])
  1496. else
  1497. AC_MSG_ERROR([The allocation and indexing of arrays greater than Int32.MaxValue is not supported on this platform.])
  1498. fi
  1499. fi
  1500. AC_MSG_RESULT($enable_big_arrays)
  1501. dnl **************
  1502. dnl *** DTRACE ***
  1503. dnl **************
  1504. AC_ARG_ENABLE(dtrace,[ --enable-dtrace Enable DTrace probes], enable_dtrace=$enableval, enable_dtrace=$has_dtrace)
  1505. if test "x$enable_dtrace" = "xyes"; then
  1506. if test "x$has_dtrace" = "xno"; then
  1507. AC_MSG_ERROR([DTrace probes are not supported on this platform.])
  1508. fi
  1509. AC_PATH_PROG(DTRACE, [dtrace], [no], [$PATH:/usr/sbin])
  1510. if test "x$DTRACE" = "xno"; then
  1511. AC_MSG_RESULT([dtrace utility not found, dtrace support disabled.])
  1512. enable_dtrace=no
  1513. fi
  1514. fi
  1515. dtrace_g=no
  1516. if test "x$enable_dtrace" = "xyes"; then
  1517. AC_DEFINE(ENABLE_DTRACE, 1, [Enable DTrace probes])
  1518. DTRACEFLAGS=
  1519. if test "x$ac_cv_sizeof_void_p" = "x8"; then
  1520. case "$host" in
  1521. powerpc-*-darwin*)
  1522. DTRACEFLAGS="-arch ppc64"
  1523. ;;
  1524. i*86-*-darwin*)
  1525. DTRACEFLAGS="-arch x86_64"
  1526. ;;
  1527. *)
  1528. DTRACEFLAGS=-64
  1529. ;;
  1530. esac
  1531. else
  1532. case "$host" in
  1533. powerpc-*-darwin*)
  1534. DTRACEFLAGS="-arch ppc"
  1535. ;;
  1536. i*86-*-darwin*)
  1537. DTRACEFLAGS="-arch i386"
  1538. ;;
  1539. *)
  1540. DTRACEFLAGS=-32
  1541. ;;
  1542. esac
  1543. fi
  1544. AC_SUBST(DTRACEFLAGS)
  1545. case "$host" in
  1546. *-*-solaris*)
  1547. dtrace_g=yes
  1548. ;;
  1549. esac
  1550. AC_CHECK_HEADERS([sys/sdt.h])
  1551. fi
  1552. AM_CONDITIONAL(ENABLE_DTRACE, [test x$enable_dtrace = xyes])
  1553. AM_CONDITIONAL(DTRACE_G_REQUIRED, [test x$dtrace_g = xyes])
  1554. TARGET="unknown"
  1555. ACCESS_UNALIGNED="yes"
  1556. JIT_SUPPORTED=no
  1557. INTERP_SUPPORTED=no
  1558. LIBC="libc.so.6"
  1559. INTL="libc.so.6"
  1560. SQLITE="libsqlite.so.0"
  1561. SQLITE3="libsqlite3.so.0"
  1562. X11="libX11.so"
  1563. sizeof_register="SIZEOF_VOID_P"
  1564. jit_wanted=false
  1565. interp_wanted=false
  1566. case "$host" in
  1567. # mips-sgi-irix5.* | mips-sgi-irix6.*)
  1568. # TARGET=MIPS;
  1569. # ACCESS_UNALIGNED="no"
  1570. # ;;
  1571. mips*)
  1572. TARGET=MIPS;
  1573. arch_target=mips;
  1574. ACCESS_UNALIGNED="no"
  1575. JIT_SUPPORTED=yes
  1576. jit_wanted=true
  1577. AC_MSG_CHECKING(for mips n32)
  1578. AC_TRY_COMPILE([], [
  1579. void main () {
  1580. #if _MIPS_SIM != _ABIN32
  1581. #error Not mips n32
  1582. #endif
  1583. }
  1584. ],[
  1585. AC_MSG_RESULT(yes)
  1586. sizeof_register=8
  1587. ],[
  1588. AC_MSG_RESULT(no)
  1589. ])
  1590. ;;
  1591. i*86-*-*)
  1592. TARGET=X86;
  1593. arch_target=x86;
  1594. JIT_SUPPORTED=yes
  1595. jit_wanted=true
  1596. case $host_os in
  1597. solaris*)
  1598. LIBC="libc.so"
  1599. INTL="libintl.so"
  1600. if test "x$ac_cv_sizeof_void_p" = "x8"; then
  1601. TARGET=AMD64
  1602. arch_target=amd64
  1603. fi
  1604. # On solaris 10 x86, gcc prints a warning saying 'visibility attribute not supported on this configuration; ignored', but linking fails. A test case:
  1605. # int astruct __attribute__ ((visibility ("hidden")));
  1606. # void foo ()
  1607. # {
  1608. # void *p = &astruct;
  1609. # }
  1610. # gcc -fPIC --shared -o libfoo.so foo.c
  1611. # yields:
  1612. # foo.c:6: warning: visibility attribute not supported in this configuration; ignored
  1613. # ld: fatal: relocation error: R_386_GOTOFF: file /var/tmp//ccxYR96k.o: symbol astruct: relocation must bind locally
  1614. have_visibility_hidden=no
  1615. esac
  1616. ;;
  1617. x86_64-*-* | amd64-*-*)
  1618. TARGET=AMD64;
  1619. arch_target=amd64;
  1620. JIT_SUPPORTED=yes
  1621. jit_wanted=true
  1622. ;;
  1623. ia64-*-*)
  1624. TARGET=IA64
  1625. arch_target=ia64
  1626. ACCESS_UNALIGNED="no"
  1627. JIT_SUPPORTED=yes
  1628. jit_wanted=true
  1629. LIBC="libc.so.6.1"
  1630. INTL="libc.so.6.1"
  1631. AC_CHECK_LIB(unwind, _U_dyn_register, [], [AC_MSG_ERROR(library libunwind not found)])
  1632. libmono_ldflags="-lunwind"
  1633. ;;
  1634. sparc*-*-*)
  1635. if test "x$ac_cv_sizeof_void_p" = "x8"; then
  1636. TARGET=SPARC64
  1637. else
  1638. TARGET=SPARC
  1639. fi
  1640. arch_target=sparc;
  1641. JIT_SUPPORTED=yes
  1642. ACCESS_UNALIGNED="no"
  1643. case $host_os in
  1644. linux*) ;;
  1645. *)
  1646. LIBC="libc.so"
  1647. INTL="libintl.so"
  1648. esac
  1649. jit_wanted=true
  1650. if test x"$GCC" = xyes; then
  1651. # We don't support v8 cpus
  1652. CFLAGS="$CFLAGS -Wno-cast-align -mcpu=v9"
  1653. fi
  1654. if test x"$AR" = xfalse; then
  1655. AC_MSG_ERROR([The required utility 'ar' is not found in your PATH. Usually it can be found in /usr/ccs/bin.])
  1656. fi
  1657. ;;
  1658. alpha*-*-linux* | alpha*-*-osf*)
  1659. TARGET=ALPHA;
  1660. ACCESS_UNALIGNED="no"
  1661. JIT_SUPPORTED=yes
  1662. jit_wanted=true
  1663. arch_target=alpha;
  1664. CFLAGS="$CFLAGS -mieee -O0"
  1665. case $host_os in
  1666. linux*)
  1667. LIBC="libc.so.6.1"
  1668. INTL="libc.so.6.1"
  1669. esac
  1670. ;;
  1671. *-*-mingw*|*-*-cygwin*)
  1672. # When this is enabled, it leads to very strange crashes at runtime (gcc-3.4.4)
  1673. have_visibility_hidden=no
  1674. INTL="intl"
  1675. ;;
  1676. hppa2.0w-hp-hpux11.00 | hppa64-hp-hpux11.00)
  1677. TARGET=HPPA;
  1678. arch_target=hppa;
  1679. LIBC="libc.sl"
  1680. ACCESS_UNALIGNED="no"
  1681. INTERP_SUPPORTED=yes
  1682. interp_wanted=true
  1683. ;;
  1684. hppa*linux*)
  1685. TARGET=HPPA;
  1686. AC_DEFINE(MONO_ARCH_REGPARMS,1,[Architecture uses registers for Parameters])
  1687. arch_target=hppa;
  1688. ACCESS_UNALIGNED="no"
  1689. JIT_SUPPORTED=yes
  1690. jit_wanted=true
  1691. ;;
  1692. macppc-*-openbsd* | powerpc*-*-linux* | powerpc-*-openbsd* | \
  1693. powerpc-*-sysv* | powerpc-*-darwin* | powerpc-*-netbsd* )
  1694. if test "x$ac_cv_sizeof_void_p" = "x8"; then
  1695. TARGET=POWERPC64;
  1696. CPPFLAGS="$CPPFLAGS -D__mono_ppc__ -D__mono_ppc64__"
  1697. CFLAGS="$CFLAGS -mminimal-toc"
  1698. else
  1699. TARGET=POWERPC;
  1700. CPPFLAGS="$CPPFLAGS -D__mono_ppc__"
  1701. fi
  1702. AC_DEFINE(MONO_ARCH_REGPARMS,1,[Architecture uses registers for Parameters])
  1703. arch_target=ppc;
  1704. JIT_SUPPORTED=yes
  1705. jit_wanted=true
  1706. ;;
  1707. arm*-darwin*)
  1708. TARGET=ARM;
  1709. arch_target=arm;
  1710. ACCESS_UNALIGNED="no"
  1711. JIT_SUPPORTED=yes
  1712. CPPFLAGS="$CPPFLAGS -DARM_FPU_NONE=1"
  1713. jit_wanted=true
  1714. ;;
  1715. arm*-linux*)
  1716. TARGET=ARM;
  1717. arch_target=arm;
  1718. ACCESS_UNALIGNED="no"
  1719. JIT_SUPPORTED=yes
  1720. jit_wanted=true
  1721. ;;
  1722. s390-*-linux*)
  1723. TARGET=S390;
  1724. AC_DEFINE(MONO_ARCH_REGPARMS,1,[Architecture uses registers for Parameters])
  1725. arch_target=s390;
  1726. ACCESS_UNALIGNED="no"
  1727. JIT_SUPPORTED=yes
  1728. jit_wanted=true
  1729. # Required CFLAGS for s390[x]. USE_STRING_INLINES is automatic with gcc 4.1
  1730. CFLAGS="$CFLAGS -mbackchain -D__USE_STRING_INLINES"
  1731. ;;
  1732. s390x-*-linux*)
  1733. TARGET=S390x;
  1734. AC_DEFINE(MONO_ARCH_REGPARMS,1,[Architecture uses registers for Parameters])
  1735. arch_target=s390x;
  1736. ACCESS_UNALIGNED="no"
  1737. JIT_SUPPORTED=yes
  1738. jit_wanted=true
  1739. CFLAGS="$CFLAGS -mbackchain -D__USE_STRING_INLINES"
  1740. ;;
  1741. esac
  1742. if test "x$sizeof_register" = "x4"; then
  1743. AC_DEFINE(SIZEOF_REGISTER,4,[size of machine integer registers])
  1744. elif test "x$sizeof_register" = "x8"; then
  1745. AC_DEFINE(SIZEOF_REGISTER,8,[size of machine integer registers])
  1746. else
  1747. AC_DEFINE(SIZEOF_REGISTER,SIZEOF_VOID_P,[size of machine integer registers])
  1748. fi
  1749. if test "x$have_visibility_hidden" = "xyes"; then
  1750. AC_DEFINE(HAVE_VISIBILITY_HIDDEN, 1, [Support for the visibility ("hidden") attribute])
  1751. fi
  1752. AC_ARG_WITH(jit, [ --with-jit=yes,no If you want to build scripts that default to the JIT],[
  1753. if test x$withval = xyes; then
  1754. jit_wanted=true
  1755. else
  1756. jit_wanted=false
  1757. fi
  1758. ])
  1759. AC_ARG_WITH(interp, [ --with-interp=yes,no If you want to build scripts that default to the interpreter],[
  1760. if test x$withval = xyes; then
  1761. interp_wanted=true
  1762. else
  1763. interp_wanted=false
  1764. fi
  1765. ])
  1766. USEJIT=false
  1767. if test x$JIT_SUPPORTED = xyes; then
  1768. if $jit_wanted; then
  1769. USEJIT=true
  1770. jit_status="Building and using the JIT"
  1771. else
  1772. if $interp_wanted; then
  1773. jit_status="Building the JIT, defaulting to the interpreter"
  1774. else
  1775. AC_ERROR(No JIT or interpreter support available or selected.)
  1776. fi
  1777. fi
  1778. else
  1779. if test x$interp_wanted = xtrue; then
  1780. jit_status="interpreter"
  1781. else
  1782. AC_ERROR(No JIT or interpreter support available or selected.)
  1783. fi
  1784. fi
  1785. AM_CONDITIONAL(USE_JIT, test x$USEJIT = xtrue)
  1786. libsuffix=".so"
  1787. case "$host" in
  1788. *-*-darwin*)
  1789. libsuffix=".dylib"
  1790. LIBC="libc.dylib"
  1791. INTL="libintl.dylib"
  1792. SQLITE="libsqlite.0.dylib"
  1793. SQLITE3="libsqlite3.0.dylib"
  1794. X11="libX11.dylib"
  1795. ;;
  1796. *-*-*netbsd*)
  1797. LIBC="libc.so.12"
  1798. INTL="libintl.so.0"
  1799. ;;
  1800. *-*-*freebsd*)
  1801. LIBC="libc.so"
  1802. INTL="libintl.so"
  1803. ;;
  1804. *-*-*openbsd*)
  1805. LIBC="libc.so"
  1806. INTL="libintl.so"
  1807. ;;
  1808. *-*-*linux*)
  1809. AC_PATH_X
  1810. AC_MSG_CHECKING(for the soname of libX11.so)
  1811. for i in $x_libraries /usr/lib /usr/lib64; do
  1812. for r in 4 5 6; do
  1813. if test -f $i/libX11.so.$r; then
  1814. X11=libX11.so.$r
  1815. AC_MSG_RESULT($X11)
  1816. fi
  1817. done
  1818. done
  1819. if test "x$X11" = "xlibX11.so"; then
  1820. AC_MSG_WARN([Could not find X development libs. Do you have the -devel package installed? WinForms may not work...]);
  1821. fi
  1822. ;;
  1823. esac
  1824. AC_SUBST(libsuffix)
  1825. AC_CHECK_HEADERS(valgrind/memcheck.h)
  1826. if test "x$TARGET" = "xAMD64" -o "x$TARGET" = "xX86"; then
  1827. if test "x$with_tls" = "x__thread"; then
  1828. #
  1829. # On some linux distributions, TLS works in executables, but linking
  1830. # against a shared library containing TLS fails with:
  1831. # undefined reference to `__tls_get_addr'
  1832. #
  1833. rm -f conftest.c conftest.so conftest
  1834. echo "static __thread int foo; void main () { foo = 5; }" > conftest.c
  1835. $CC -fPIC --shared -o conftest.so conftest.c > /dev/null 2>&1
  1836. $CC -o conftest conftest.so > /dev/null 2>&1
  1837. if test ! -f conftest; then
  1838. AC_MSG_WARN([Disabling usage of __thread.]);
  1839. with_tls=pthread
  1840. fi
  1841. rm -f conftest.c conftest.so conftest
  1842. fi
  1843. fi
  1844. mono_debugger_supported=no
  1845. if test "x$TARGET" = "xAMD64" -o "x$TARGET" = "xX86" -o "x$TARGET" = "xALPHA"; then
  1846. if test x$use_included_gc = xyes; then
  1847. case "$host" in
  1848. *-*-*linux*)
  1849. mono_debugger_supported=yes
  1850. ;;
  1851. esac
  1852. fi
  1853. fi
  1854. AC_MSG_CHECKING(if the Mono Debugger is supported on this platform)
  1855. if test "x$mono_debugger_supported" = "xyes"; then
  1856. AC_DEFINE(MONO_DEBUGGER_SUPPORTED,1,[The Mono Debugger is supported on this platform])
  1857. fi
  1858. AC_MSG_RESULT($mono_debugger_supported)
  1859. AM_CONDITIONAL(MONO_DEBUGGER_SUPPORTED, test x$mono_debugger_supported = xyes)
  1860. if test "x$with_tls" = "x__thread"; then
  1861. AC_DEFINE(HAVE_KW_THREAD, 1, [Have __thread keyword])
  1862. # Pass the information to libgc
  1863. CPPFLAGS="$CPPFLAGS -DUSE_COMPILER_TLS"
  1864. AC_MSG_CHECKING(if the tls_model attribute is supported)
  1865. AC_TRY_COMPILE([static __thread int foo __attribute__((tls_model("initial-exec")));], [
  1866. ], [
  1867. AC_MSG_RESULT(yes)
  1868. AC_DEFINE(HAVE_TLS_MODEL_ATTR, 1, [tld_model available])
  1869. ], [
  1870. AC_MSG_RESULT(no)
  1871. ])
  1872. fi
  1873. if test ${TARGET} = ARM && test x$cross_compiling = xno && test x$enable_mcs_build != xno; then
  1874. dnl ******************************************
  1875. dnl *** Check to see what FPU is available ***
  1876. dnl ******************************************
  1877. AC_MSG_CHECKING(which FPU to use)
  1878. AC_TRY_COMPILE([], [
  1879. __asm__ ("ldfd f0, [r0]");
  1880. ], fpu=FPA, fpu=NONE)
  1881. AC_MSG_RESULT($fpu)
  1882. CPPFLAGS="$CPPFLAGS -DARM_FPU_$fpu=1"
  1883. unset fpu
  1884. fi
  1885. if test ${TARGET} = unknown; then
  1886. CPPFLAGS="$CPPFLAGS -DNO_PORT"
  1887. AC_MSG_WARN("mono has not been ported to $host: some things may not work.")
  1888. fi
  1889. if test ${ACCESS_UNALIGNED} = no; then
  1890. CPPFLAGS="$CPPFLAGS -DNO_UNALIGNED_ACCESS"
  1891. fi
  1892. case "x$gc" in
  1893. xincluded)
  1894. # Pass CPPFLAGS to libgc configure
  1895. # We should use a separate variable for this to avoid passing useless and
  1896. # potentially problematic defines to libgc (like -D_FILE_OFFSET_BITS=64)
  1897. # This should be executed late so we pick up the final version of CPPFLAGS
  1898. # The problem with this approach, is that during a reconfigure, the main
  1899. # configure scripts gets invoked with these arguments, so we use separate
  1900. # variables understood by libgc's configure to pass CPPFLAGS and CFLAGS.
  1901. LIBGC_CPPFLAGS=$CPPFLAGS
  1902. if test x$TARGET = xSPARC -o x$TARGET = xSPARC64; then
  1903. LIBGC_CPPFLAGS=`echo $LIBGC_CPPFLAGS | sed -e 's/-D_FILE_OFFSET_BITS=64//g'`
  1904. fi
  1905. 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\""
  1906. AC_CONFIG_SUBDIRS(libgc)
  1907. ;;
  1908. esac
  1909. PREVIEW=yes
  1910. AC_ARG_WITH(preview, [ --with-preview=yes,no If you want to install the 2.0 FX preview],[
  1911. if test x$with_preview = xno; then
  1912. PREVIEW=no
  1913. fi
  1914. ])
  1915. MOONLIGHT=yes
  1916. AC_ARG_WITH(moonlight,[ --with-moonlight=yes,no If you want to build the Moonlight 2.1 assemblies],[
  1917. if test x$with_moonlight = xno; then
  1918. MOONLIGHT=no
  1919. fi
  1920. ])
  1921. OPROFILE=no
  1922. AC_ARG_WITH(oprofile,[ --with-oprofile=no,<path> Enable oprofile support (defaults to NO)],[
  1923. if test x$with_oprofile != xno; then
  1924. OPROFILE=yes
  1925. OPROFILE_CFLAGS="-I$with_oprofile/include"
  1926. OPROFILE_LIBS=
  1927. AC_DEFINE(HAVE_OPROFILE,1,[Have oprofile support])
  1928. fi
  1929. ])
  1930. MALLOC_MEMPOOLS=no
  1931. AC_ARG_WITH(malloc_mempools,[ --with-malloc-mempools=yes,no Use malloc for each single mempool allocation (only for runtime debugging, defaults to NO)],[
  1932. if test x$with_malloc_mempools = xyes; then
  1933. MALLOC_MEMPOOLS=yes
  1934. AC_DEFINE(USE_MALLOC_FOR_MEMPOOLS,1,[Use malloc for each single mempool allocation])
  1935. fi
  1936. ])
  1937. AM_CONDITIONAL(HAVE_OPROFILE, test x$OPROFILE = xyes)
  1938. AC_SUBST(OPROFILE_CFLAGS)
  1939. AC_SUBST(OPROFILE_LIBS)
  1940. libmono_ldflags="$libmono_ldflags $LIBS"
  1941. AM_CONDITIONAL(INSTALL_2_0, test x$PREVIEW = xyes)
  1942. AM_CONDITIONAL(INSTALL_2_1, test x$MOONLIGHT = xyes)
  1943. AM_CONDITIONAL(MIPS_GCC, test ${TARGET}${ac_cv_prog_gcc} = MIPSyes)
  1944. AM_CONDITIONAL(MIPS_SGI, test ${TARGET}${ac_cv_prog_gcc} = MIPSno)
  1945. AM_CONDITIONAL(SPARC, test x$TARGET = xSPARC)
  1946. AM_CONDITIONAL(SPARC64, test x$TARGET = xSPARC64)
  1947. AM_CONDITIONAL(X86, test x$TARGET = xX86)
  1948. AM_CONDITIONAL(AMD64, test x$TARGET = xAMD64)
  1949. AM_CONDITIONAL(ALPHA, test x$TARGET = xALPHA)
  1950. AM_CONDITIONAL(IA64, test x$TARGET = xIA64)
  1951. AM_CONDITIONAL(M68K, test x$TARGET = xM68K)
  1952. AM_CONDITIONAL(MIPS, test x$TARGET = xMIPS)
  1953. AM_CONDITIONAL(POWERPC, test x$TARGET = xPOWERPC)
  1954. AM_CONDITIONAL(POWERPC64, test x$TARGET = xPOWERPC64)
  1955. AM_CONDITIONAL(ARM, test x$TARGET = xARM)
  1956. AM_CONDITIONAL(S390, test x$TARGET = xS390)
  1957. AM_CONDITIONAL(S390x, test x$TARGET = xS390x)
  1958. AM_CONDITIONAL(HPPA, test x$TARGET = xHPPA)
  1959. AM_CONDITIONAL(JIT_SUPPORTED, test x$JIT_SUPPORTED = xyes)
  1960. AM_CONDITIONAL(INTERP_SUPPORTED, test x$interp_wanted = xtrue)
  1961. AM_CONDITIONAL(INCLUDED_LIBGC, test x$gc = xincluded)
  1962. AC_SUBST(LIBC)
  1963. AC_SUBST(INTL)
  1964. AC_SUBST(SQLITE)
  1965. AC_SUBST(SQLITE3)
  1966. AC_SUBST(X11)
  1967. AC_DEFINE_UNQUOTED(ARCHITECTURE,"$arch_target",[The architecture this is running on])
  1968. AC_SUBST(arch_target)
  1969. AC_SUBST(CFLAGS)
  1970. AC_SUBST(CPPFLAGS)
  1971. AC_SUBST(LDFLAGS)
  1972. mono_build_root=`pwd`
  1973. AC_SUBST(mono_build_root)
  1974. if test x$USEJIT = xtrue; then
  1975. mono_runtime=mono/mini/mono
  1976. else
  1977. mono_runtime=mono/interpreter/mint
  1978. fi
  1979. AC_SUBST(mono_runtime)
  1980. mono_cfg_root=$mono_build_root/runtime
  1981. if test x$platform_win32 = xyes; then
  1982. if test "x$cross_compiling" = "xno"; then
  1983. mono_cfg_dir=`cygpath -w -a $mono_cfg_root`\\etc
  1984. else
  1985. mono_cfg_dir=`echo $mono_cfg_root | tr '/' '\\\'`\\etc
  1986. fi
  1987. else
  1988. mono_cfg_dir=$mono_cfg_root/etc
  1989. fi
  1990. AC_SUBST(mono_cfg_dir)
  1991. AC_CONFIG_FILES([po/mcs/Makefile.in])
  1992. AC_CONFIG_FILES([runtime/mono-wrapper],[chmod +x runtime/mono-wrapper])
  1993. AC_CONFIG_FILES([runtime/monodis-wrapper],[chmod +x runtime/monodis-wrapper])
  1994. AC_CONFIG_COMMANDS([runtime/etc/mono/1.0/machine.config],
  1995. [ depth=../../../..
  1996. case $srcdir in
  1997. [[\\/$]]* | ?:[[\\/]]* ) reldir=$srcdir ;;
  1998. .) reldir=$depth ;;
  1999. *) reldir=$depth/$srcdir ;;
  2000. esac
  2001. $ac_aux_dir/install-sh -d runtime/etc/mono/1.0
  2002. cd runtime/etc/mono/1.0
  2003. rm -f machine.config
  2004. $LN_S $reldir/data/net_1_1/machine.config machine.config
  2005. cd $depth
  2006. ],[LN_S='$LN_S'])
  2007. AC_CONFIG_COMMANDS([runtime/etc/mono/2.0/machine.config],
  2008. [ depth=../../../..
  2009. case $srcdir in
  2010. [[\\/$]]* | ?:[[\\/]]* ) reldir=$srcdir ;;
  2011. .) reldir=$depth ;;
  2012. *) reldir=$depth/$srcdir ;;
  2013. esac
  2014. $ac_aux_dir/install-sh -d runtime/etc/mono/2.0
  2015. cd runtime/etc/mono/2.0
  2016. rm -f machine.config
  2017. $LN_S $reldir/data/net_2_0/machine.config machine.config
  2018. cd $depth
  2019. ],[LN_S='$LN_S'])
  2020. AC_CONFIG_COMMANDS([runtime/etc/mono/2.0/web.config],
  2021. [ depth=../../../..
  2022. case $srcdir in
  2023. [[\\/$]]* | ?:[[\\/]]* ) reldir=$srcdir ;;
  2024. .) reldir=$depth ;;
  2025. *) reldir=$depth/$srcdir ;;
  2026. esac
  2027. $ac_aux_dir/install-sh -d runtime/etc/mono/2.0
  2028. cd runtime/etc/mono/2.0
  2029. rm -f web.config
  2030. $LN_S $reldir/data/net_2_0/web.config web.config
  2031. cd $depth
  2032. ],[LN_S='$LN_S'])
  2033. AC_CONFIG_COMMANDS([runtime/etc/mono/browscap.ini],
  2034. [ depth=../../..
  2035. case $srcdir in
  2036. [[\\/$]]* | ?:[[\\/]]* ) reldir=$srcdir ;;
  2037. .) reldir=$depth ;;
  2038. *) reldir=$depth/$srcdir ;;
  2039. esac
  2040. $ac_aux_dir/install-sh -d runtime/etc/mono/
  2041. cd runtime/etc/mono/
  2042. rm -f browscap.ini
  2043. $LN_S $reldir/data/browscap.ini browscap.ini
  2044. cd $depth
  2045. ],[LN_S='$LN_S'])
  2046. AC_CONFIG_COMMANDS([runtime/etc/mono/2.0/Browsers/Compat.browser],
  2047. [ depth=../../../../..
  2048. case $srcdir in
  2049. [[\\/$]]* | ?:[[\\/]]* ) reldir=$srcdir ;;
  2050. .) reldir=$depth ;;
  2051. *) reldir=$depth/$srcdir ;;
  2052. esac
  2053. $ac_aux_dir/install-sh -d runtime/etc/mono/2.0/Browsers/
  2054. cd runtime/etc/mono/2.0/Browsers
  2055. rm -f Compat.browser
  2056. $LN_S $reldir/data/net_2_0/Browsers/Compat.browser Compat.browser
  2057. cd $depth
  2058. ],[LN_S='$LN_S'])
  2059. if test x$enable_quiet_build = xyes; then
  2060. AC_CONFIG_COMMANDS([quiet], [for i in `find mono libgc support -name Makefile.in | sed -e 's/Makefile.in/Makefile/g'`; do $srcdir/scripts/patch-quiet.sh $i; done], [shell=$SHELL])
  2061. 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])
  2062. fi
  2063. AC_OUTPUT([
  2064. Makefile
  2065. mono-uninstalled.pc
  2066. scripts/mono-find-provides
  2067. scripts/mono-find-requires
  2068. mono/Makefile
  2069. mono/utils/Makefile
  2070. mono/metadata/Makefile
  2071. mono/dis/Makefile
  2072. mono/cil/Makefile
  2073. mono/arch/Makefile
  2074. mono/os/Makefile
  2075. mono/arch/x86/Makefile
  2076. mono/arch/amd64/Makefile
  2077. mono/arch/hppa/Makefile
  2078. mono/arch/ppc/Makefile
  2079. mono/arch/sparc/Makefile
  2080. mono/arch/s390/Makefile
  2081. mono/arch/s390x/Makefile
  2082. mono/arch/arm/Makefile
  2083. mono/arch/alpha/Makefile
  2084. mono/arch/ia64/Makefile
  2085. mono/arch/mips/Makefile
  2086. mono/interpreter/Makefile
  2087. mono/tests/Makefile
  2088. mono/tests/tests-config
  2089. mono/tests/assemblyresolve/Makefile
  2090. mono/tests/cas/Makefile
  2091. mono/tests/cas/assembly/Makefile
  2092. mono/tests/cas/demand/Makefile
  2093. mono/tests/cas/inheritance/Makefile
  2094. mono/tests/cas/linkdemand/Makefile
  2095. mono/tests/cas/threads/Makefile
  2096. mono/benchmark/Makefile
  2097. mono/monograph/Makefile
  2098. mono/io-layer/Makefile
  2099. mono/mini/Makefile
  2100. mono/profiler/Makefile
  2101. ikvm-native/Makefile
  2102. scripts/Makefile
  2103. man/Makefile
  2104. web/Makefile
  2105. docs/Makefile
  2106. data/Makefile
  2107. data/net_1_1/Makefile
  2108. data/net_2_0/Makefile
  2109. data/net_2_0/Browsers/Makefile
  2110. data/mint.pc
  2111. data/mono.pc
  2112. data/mono-cairo.pc
  2113. data/mono-nunit.pc
  2114. data/mono-options.pc
  2115. data/mono-lineeditor.pc
  2116. data/monodoc.pc
  2117. data/dotnet.pc
  2118. data/dotnet35.pc
  2119. data/wcf.pc
  2120. data/cecil.pc
  2121. data/smcs.pc
  2122. data/system.web.extensions_1.0.pc
  2123. data/system.web.extensions.design_1.0.pc
  2124. samples/Makefile
  2125. support/Makefile
  2126. data/config
  2127. tools/Makefile
  2128. tools/locale-builder/Makefile
  2129. runtime/Makefile
  2130. msvc/Makefile
  2131. po/Makefile
  2132. ])
  2133. if test x$platform_win32 = xyes; then
  2134. # Get rid of 'cyg' prefixes in library names
  2135. sed -e "s/\/cyg\//\/\//" libtool > libtool.new; mv libtool.new libtool; chmod 755 libtool
  2136. # libtool seems to inherit -mno-cygwin from our CFLAGS, and uses it to compile its executable
  2137. # wrapper scripts which use exec(). gcc has no problem compiling+linking this, but the resulting
  2138. # executable doesn't work...
  2139. sed -e "s,-mno-cygwin,,g" libtool > libtool.new; mv libtool.new libtool; chmod 755 libtool
  2140. fi
  2141. (
  2142. case $prefix in
  2143. NONE) prefix=$ac_default_prefix ;;
  2144. esac
  2145. case $exec_prefix in
  2146. NONE) exec_prefix='${prefix}' ;;
  2147. esac
  2148. test -w $srcdir/$mcsdir/build || chmod +w $srcdir/$mcsdir/build
  2149. #
  2150. # If we are cross compiling, we don't build in the mcs/ tree. Let us not clobber
  2151. # any existing config.make. This allows people to share the same source tree
  2152. # with different build directories, one native and one cross
  2153. #
  2154. if test x$cross_compiling = xno && test x$enable_mcs_build != xno; then
  2155. echo "prefix=$prefix" > $srcdir/$mcsdir/build/config.make
  2156. echo "exec_prefix=$exec_prefix" >> $srcdir/$mcsdir/build/config.make
  2157. echo "sysconfdir=$sysconfdir" >> $srcdir/$mcsdir/build/config.make
  2158. echo 'mono_libdir=${exec_prefix}/lib' >> $srcdir/$mcsdir/build/config.make
  2159. echo 'MCS_FLAGS = $(PLATFORM_DEBUG_FLAGS)' >> $srcdir/$mcsdir/build/config.make
  2160. echo 'IL_FLAGS = /debug' >> $srcdir/$mcsdir/build/config.make
  2161. echo "RUNTIME = $mono_build_root/runtime/mono-wrapper" >> $srcdir/$mcsdir/build/config.make
  2162. echo "ILDISASM = $mono_build_root/runtime/monodis-wrapper" >> $srcdir/$mcsdir/build/config.make
  2163. case $INSTALL in
  2164. [[\\/$]]* | ?:[[\\/]]* ) mcs_INSTALL=$INSTALL ;;
  2165. *) mcs_INSTALL=$mono_build_root/$INSTALL ;;
  2166. esac
  2167. echo "INSTALL = $mcs_INSTALL" >> $srcdir/$mcsdir/build/config.make
  2168. export VERSION
  2169. [myver=$($AWK 'BEGIN {
  2170. split (ENVIRON["VERSION"] ".0.0.0", vsplit, ".")
  2171. if(length(vsplit [1]) > 4) {
  2172. split (substr(ENVIRON["VERSION"], 0, 4) "." substr(ENVIRON["VERSION"], 5) ".0.0", vsplit, ".")
  2173. }
  2174. print vsplit [1] "." vsplit [2] "." vsplit [3] "." vsplit [4]
  2175. }')]
  2176. echo "MONO_VERSION = $myver" >> $srcdir/$mcsdir/build/config.make
  2177. fi
  2178. if test x$platform_darwin = xyes; then
  2179. echo "PLATFORM = darwin" >> $srcdir/$mcsdir/build/config.make
  2180. fi
  2181. if test x$TARGET = xAMD64 -a x$platform_win32 = xno -a "x$AOT_SUPPORTED" = "xyes"; then
  2182. echo "ENABLE_AOT = 1" >> $srcdir/$mcsdir/build/config.make
  2183. fi
  2184. # if we have an olive folder, override the default settings
  2185. if test -d $olivedir; then
  2186. test -w $srcdir/$olivedir/build || chmod +w $srcdir/$olivedir/build
  2187. if test x$cross_compiling = xno && test x$enable_olive_build != xno; then
  2188. echo "prefix=$prefix" > $srcdir/$olivedir/build/config.make
  2189. echo "exec_prefix=$exec_prefix" >> $srcdir/$olivedir/build/config.make
  2190. echo 'mono_libdir=${exec_prefix}/lib' >> $srcdir/$olivedir/build/config.make
  2191. echo 'MCS_FLAGS = $(PLATFORM_DEBUG_FLAGS)' >> $srcdir/$olivedir/build/config.make
  2192. echo "RUNTIME = $mono_build_root/runtime/mono-wrapper" >> $srcdir/$olivedir/build/config.make
  2193. echo "MONO_VERSION = $myver" >> $srcdir/$olivedir/build/config.make
  2194. if test x$with_moonlight = xyes; then
  2195. echo "WITH_MOONLIGHT = yes" >> $srcdir/$olivedir/build/config.make
  2196. fi
  2197. fi
  2198. fi
  2199. )
  2200. libgdiplus_msg=${libgdiplus_loc:-assumed to be installed}
  2201. echo "
  2202. mcs source: $mcs_topdir
  2203. olive source: $olive_topdir
  2204. GC: $gc
  2205. TLS: $with_tls
  2206. SIGALTSTACK: $with_sigaltstack
  2207. Engine: $jit_status
  2208. 2.0 Beta: $PREVIEW
  2209. 2.1 Alpha: $MOONLIGHT
  2210. JNI support: $jdk_headers_found
  2211. libgdiplus: $libgdiplus_msg
  2212. zlib: $zlib_msg
  2213. oprofile: $OPROFILE
  2214. BigArrays: $enable_big_arrays
  2215. DTrace: $enable_dtrace
  2216. $disabled
  2217. "
  2218. if test x$with_static_mono = xno -a "x$platform_win32" != "xyes"; then
  2219. AC_MSG_WARN(Turning off static Mono is a risk, you might run into unexpected bugs)
  2220. fi
  2221. if test x$gc = xsgen; then
  2222. echo IMPORTANT:
  2223. echo IMPORTANT: You have selected an experimental, work-in-progress
  2224. echo IMPORTANT: GC engine. This GC engine is currently not supported
  2225. echo IMPORTANT: and is not yet ready for use.
  2226. echo IMPORTANT:
  2227. echo IMPORTANT: There are known problems with it, use at your own risk.
  2228. fi