configure.ac 126 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312
  1. # Process this file with autoconf to produce a configure script.
  2. #AC_PREREQ([2.62])
  3. # when bumping version number below, keep it in sync with man/mono.1 too
  4. AC_INIT(mono, [4.7.0],
  5. [http://bugzilla.xamarin.com/enter_bug.cgi?classification=Mono])
  6. AC_CONFIG_SRCDIR([README.md])
  7. AC_CONFIG_MACRO_DIR([m4])
  8. AC_CANONICAL_SYSTEM
  9. AC_CANONICAL_HOST
  10. # Gross hack to enable 'make dist' on automake 1.9+tar 1.14.
  11. # The extra brackets are to foil regex-based scans.
  12. m4_ifdef([_A][M_PROG_TAR],[_A][M_SET_OPTION([tar-ustar])])
  13. AM_INIT_AUTOMAKE([1.9 dist-bzip2 tar-ustar no-dist-gzip foreign subdir-objects]
  14. m4_esyscmd([case `automake --version | head -n 1` in # parallel-tests is default in automake 1.13+, we need to explicitly enable it
  15. *1.11*|*1.12*) echo parallel-tests;; # for 1.11 and 1.12 but not below as those versions don't recognize the flag
  16. esac])) # TODO: remove this hack once we require automake 1.11+
  17. AC_CONFIG_HEADERS([config.h])
  18. AM_MAINTAINER_MODE
  19. API_VER=2.0
  20. AC_SUBST(API_VER)
  21. AC_PROG_LN_S
  22. m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
  23. case $host_os in
  24. *cygwin* )
  25. echo "Run configure using ./configure --host=i686-pc-mingw32"
  26. exit 1
  27. esac
  28. # In case of cygwin, override LN_S, irrespective of what it determines.
  29. # The build uses cygwin, but the actual runtime doesn't.
  30. case $host_os in
  31. *cygwin* ) LN_S='cp -p';;
  32. esac
  33. #
  34. # libgc defaults
  35. #
  36. libgc_configure_args=
  37. # These variables are the CPPFLAGS/CFLAGS passed to libgc's configure
  38. # libgc should inherit the original CFLAGS/CPPFLAGS passed to configure, i.e. -O0
  39. CPPFLAGS_FOR_LIBGC=$CPPFLAGS
  40. CFLAGS_FOR_LIBGC=$CFLAGS
  41. CPPFLAGS_FOR_EGLIB=$CPPFLAGS
  42. CFLAGS_FOR_EGLIB=$CFLAGS
  43. # libgc uses some deprecated APIs
  44. CFLAGS_FOR_LIBGC="$CFLAGS -Wno-deprecated-declarations"
  45. #
  46. # These are the flags that need to be stored in the mono.pc file for
  47. # compiling code that will embed Mono
  48. #
  49. libmono_cflags=""
  50. libmono_ldflags=""
  51. AC_SUBST(libmono_cflags)
  52. AC_SUBST(libmono_ldflags)
  53. # Variable to have relocatable .pc files (lib, or lib64)
  54. reloc_libdir=`basename ${libdir}`
  55. AC_SUBST(reloc_libdir)
  56. # Set to yes if Unix sockets cannot be created in an anonymous namespace
  57. need_link_unlink=no
  58. #Set to extra linker flags to be passed to the runtime binaries (mono /mono-sgen)
  59. extra_runtime_ldflags=""
  60. # Thread configuration inspired by sleepycat's db
  61. AC_MSG_CHECKING([host platform characteristics])
  62. libgc_threads=no
  63. has_dtrace=no
  64. parallel_mark=yes
  65. ikvm_native=yes
  66. host_win32=no
  67. target_win32=no
  68. platform_android=no
  69. host_darwin=no
  70. case "$host" in
  71. *-mingw*|*-*-cygwin*)
  72. AC_DEFINE(DISABLE_PORTABILITY,1,[Disable the io-portability layer])
  73. AC_DEFINE(PLATFORM_NO_SYMLINKS,1,[This platform does not support symlinks])
  74. host_win32=yes
  75. mono_cv_clang=no
  76. if test "x$cross_compiling" = "xno"; then
  77. if test "x$host" = "x$build" -a "x$host" = "x$target"; then
  78. target_win32=yes
  79. fi
  80. else
  81. if test "x$host" = "x$target"; then
  82. target_win32=yes
  83. fi
  84. fi
  85. HOST_CC="gcc"
  86. # Windows Vista or later is required
  87. CPPFLAGS="$CPPFLAGS -DWINVER=0x0600 -D_WIN32_WINNT=0x0600 -D_WIN32_IE=0x0501 -D_UNICODE -DUNICODE -DWIN32_THREADS -DFD_SETSIZE=1024"
  88. LDFLAGS="$LDFLAGS -lmswsock -lws2_32 -lole32 -loleaut32 -lpsapi -lversion -ladvapi32 -lwinmm -lkernel32 -liphlpapi"
  89. libmono_cflags="-mms-bitfields -mwindows"
  90. libmono_ldflags="-mms-bitfields -mwindows"
  91. libdl=
  92. libgc_threads=win32
  93. with_sigaltstack=no
  94. with_tls=pthread
  95. LN_S=cp
  96. # This forces libgc to use the DllMain based thread registration code on win32
  97. libgc_configure_args="$libgc_configure_args --enable-win32-dllmain=yes"
  98. ;;
  99. *-*-*netbsd*)
  100. CPPFLAGS="$CPPFLAGS -D_REENTRANT -DGC_NETBSD_THREADS -D_GNU_SOURCE"
  101. libmono_cflags="-D_REENTRANT"
  102. LDFLAGS="$LDFLAGS -pthread"
  103. CPPFLAGS="$CPPFLAGS -DPLATFORM_BSD"
  104. libmono_ldflags="-pthread"
  105. need_link_unlink=yes
  106. libdl="-ldl"
  107. libgc_threads=pthreads
  108. with_sigaltstack=no
  109. use_sigposix=yes
  110. ;;
  111. *-*-kfreebsd*-gnu)
  112. CPPFLAGS="$CPPFLAGS -DGC_FREEBSD_THREADS -D_GNU_SOURCE -D_REENTRANT -DUSE_MMAP -DUSE_MUNMAP -DTHREAD_LOCAL_ALLOC -pthread"
  113. libmono_cflags="-D_REENTRANT -DTHREAD_LOCAL_ALLOC -pthread"
  114. libmono_ldflags="-lpthread -pthread"
  115. libdl="-ldl"
  116. libgc_threads=pthreads
  117. need_link_unlink=yes
  118. with_sigaltstack=no
  119. use_sigposix=yes
  120. ;;
  121. *-*-*freebsd*)
  122. if test "x$PTHREAD_CFLAGS" = "x"; then
  123. CPPFLAGS="$CPPFLAGS -DGC_FREEBSD_THREADS"
  124. libmono_cflags=
  125. else
  126. CPPFLAGS="$CPPFLAGS $PTHREAD_CFLAGS -DGC_FREEBSD_THREADS"
  127. libmono_cflags="$PTHREAD_CFLAGS"
  128. fi
  129. if test "x$PTHREAD_LIBS" = "x"; then
  130. LDFLAGS="$LDFLAGS -pthread -L/usr/local/lib"
  131. libmono_ldflags="-pthread"
  132. else
  133. LDFLAGS="$LDFLAGS $PTHREAD_LIBS -L/usr/local/lib"
  134. libmono_ldflags="$PTHREAD_LIBS"
  135. fi
  136. CPPFLAGS="$CPPFLAGS -DPLATFORM_BSD"
  137. need_link_unlink=yes
  138. AC_DEFINE(PTHREAD_POINTER_ID, 1, [pthread is a pointer])
  139. libdl=
  140. libgc_threads=pthreads
  141. use_sigposix=yes
  142. has_dtrace=yes
  143. ;;
  144. *-*-*openbsd*)
  145. CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE -DGC_OPENBSD_THREADS -DPLATFORM_BSD -D_REENTRANT -DUSE_MMAP"
  146. if test "x$disable_munmap" != "xyes"; then
  147. CPPFLAGS="$CPPFLAGS -DUSE_MUNMAP"
  148. fi
  149. libmono_cflags="-D_THREAD_SAFE -D_REENTRANT"
  150. LDFLAGS="$LDFLAGS -pthread"
  151. need_link_unlink=yes
  152. AC_DEFINE(PTHREAD_POINTER_ID)
  153. libdl=
  154. libgc_threads=pthreads
  155. with_sigaltstack=no
  156. use_sigposix=yes
  157. ;;
  158. *-*-linux-android*)
  159. platform_android=yes
  160. AC_DEFINE(PLATFORM_ANDROID,1,[Targeting the Android platform])
  161. AC_DEFINE(TARGET_ANDROID,1,[Targeting the Android platform])
  162. CPPFLAGS="$CPPFLAGS -DGC_LINUX_THREADS -D_GNU_SOURCE -D_REENTRANT -DUSE_MMAP"
  163. if test "x$disable_munmap" != "xyes"; then
  164. CPPFLAGS="$CPPFLAGS -DUSE_MUNMAP"
  165. fi
  166. libmono_cflags="-D_REENTRANT"
  167. libdl="-ldl"
  168. libgc_threads=pthreads
  169. use_sigposix=yes
  170. with_tls=pthread
  171. with_sigaltstack=no
  172. with_static_mono=no
  173. # Android doesn't support boehm, as it's missing <link.h>
  174. support_boehm=no
  175. with_gc=sgen
  176. # isinf(3) requires -lm; see isinf check below
  177. LDFLAGS="$LDFLAGS -lm"
  178. # Bionic's <pthread.h> sets PTHREAD_STACK_MIN=2*PAGE_SIZE; doesn't define
  179. # PAGE_SIZE; breaks mono/io-layer/collection.c
  180. # Bionic doesn't provide S_IWRITE; breaks io-layer/io.c
  181. CFLAGS="$CFLAGS -DPAGE_SIZE=4096 -DS_IWRITE=S_IWUSR"
  182. CXXFLAGS="$CXXFLAGS -DPAGE_SIZE=4096 -DS_IWRITE=S_IWUSR"
  183. # The configure check can't detect this
  184. AC_DEFINE(HAVE_LARGE_FILE_SUPPORT, 1, [Have large file support])
  185. # to bypass the underscore linker check, can't work when cross-compiling
  186. mono_cv_uscore=yes
  187. mono_cv_clang=no
  188. ;;
  189. *-*-linux*)
  190. CPPFLAGS="$CPPFLAGS -DGC_LINUX_THREADS -D_GNU_SOURCE -D_REENTRANT -DUSE_MMAP"
  191. if test "x$disable_munmap" != "xyes"; then
  192. CPPFLAGS="$CPPFLAGS -DUSE_MUNMAP"
  193. fi
  194. libmono_cflags="-D_REENTRANT"
  195. libdl="-ldl"
  196. libgc_threads=pthreads
  197. use_sigposix=yes
  198. if test "x$cross_compiling" != "xno"; then
  199. # to bypass the underscore linker check, not
  200. # available during cross-compilation
  201. mono_cv_uscore=no
  202. fi
  203. case "$host" in
  204. aarch64-*)
  205. support_boehm=no
  206. with_gc=sgen
  207. ;;
  208. powerpc*-*-linux*)
  209. # https://bugzilla.novell.com/show_bug.cgi?id=504411
  210. disable_munmap=yes
  211. ;;
  212. esac
  213. ;;
  214. *-*-nacl*)
  215. CPPFLAGS="$CPPFLAGS -DGC_LINUX_THREADS -D_GNU_SOURCE -D_REENTRANT -DUSE_MMAP"
  216. if test "x$disable_munmap" != "xyes"; then
  217. CPPFLAGS="$CPPFLAGS -DUSE_MUNMAP"
  218. fi
  219. libmono_cflags="-D_REENTRANT"
  220. libdl=
  221. libgc_threads=pthreads
  222. use_sigposix=yes
  223. ikvm_native=no
  224. AC_DEFINE(DISABLE_SOCKETS,1,[Disable sockets support])
  225. AC_DEFINE(DISABLE_ATTACH, 1, [Disable agent attach support])
  226. ;;
  227. *-*-hpux*)
  228. CPPFLAGS="$CPPFLAGS -DGC_HPUX_THREADS -D_HPUX_SOURCE -D_XOPEN_SOURCE_EXTENDED -D_REENTRANT"
  229. # +ESdbgasm only valid on bundled cc on RISC
  230. # silently ignored for ia64
  231. if test $GCC != "yes"; then
  232. CFLAGS="$CFLAGS +ESdbgasm"
  233. # Arrange for run-time dereferencing of null
  234. # pointers to produce a SIGSEGV signal.
  235. LDFLAGS="$LDFLAGS -z"
  236. fi
  237. CFLAGS="$CFLAGS +ESdbgasm"
  238. LDFLAGS="$LDFLAGS -z"
  239. libmono_cflags="-D_REENTRANT"
  240. libmono_ldflags="-lpthread"
  241. libgc_threads=pthreads
  242. need_link_unlink=yes
  243. use_sigposix=yes
  244. ;;
  245. *-*-solaris*)
  246. CPPFLAGS="$CPPFLAGS -DGC_SOLARIS_THREADS -DGC_SOLARIS_PTHREADS -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS -DUSE_MMAP -DUSE_MUNMAP -DPLATFORM_SOLARIS"
  247. need_link_unlink=yes
  248. libmono_cflags="-D_REENTRANT"
  249. libgc_threads=pthreads
  250. has_dtrace=yes
  251. use_sigposix=yes
  252. enable_solaris_tar_check=yes
  253. ;;
  254. *-*-darwin*)
  255. parallel_mark="Disabled_Currently_Hangs_On_MacOSX"
  256. host_darwin=yes
  257. target_mach=yes
  258. CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE -DGC_MACOSX_THREADS -DPLATFORM_MACOSX -DUSE_MMAP -DUSE_MUNMAP"
  259. libmono_cflags="-D_THREAD_SAFE"
  260. need_link_unlink=yes
  261. AC_DEFINE(PTHREAD_POINTER_ID)
  262. AC_DEFINE(USE_MACH_SEMA, 1, [...])
  263. libdl=
  264. libgc_threads=pthreads
  265. has_dtrace=yes
  266. if test "x$cross_compiling" = "xyes"; then
  267. has_broken_apple_cpp=yes
  268. fi
  269. dnl Snow Leopard is horribly broken -- it reports itself as i386-apple-darwin*, but
  270. dnl its gcc defaults to 64-bit mode. They have also deprecated the usage of ucontext
  271. dnl we need to set some flags to build our 32-bit binaries on 10.6 properly
  272. case "$host" in
  273. dnl Snow Leopard and newer config.guess reports as this
  274. i*86-*-darwin*)
  275. BROKEN_DARWIN_FLAGS="-arch i386 -D_XOPEN_SOURCE"
  276. BROKEN_DARWIN_CPPFLAGS="-D_XOPEN_SOURCE"
  277. CPPFLAGS="$CPPFLAGS $BROKEN_DARWIN_CPPFLAGS"
  278. CFLAGS="$CFLAGS $BROKEN_DARWIN_FLAGS"
  279. CXXFLAGS="$CXXFLAGS $BROKEN_DARWIN_FLAGS"
  280. CCASFLAGS="$CCASFLAGS $BROKEN_DARWIN_FLAGS"
  281. CPPFLAGS_FOR_LIBGC="$CPPFLAGS_FOR_LIBGC $BROKEN_DARWIN_CPPFLAGS"
  282. CFLAGS_FOR_LIBGC="$CFLAGS_FOR_LIBGC $BROKEN_DARWIN_FLAGS"
  283. CPPFLAGS_FOR_EGLIB="$CPPFLAGS_FOR_EGLIB $BROKEN_DARWIN_CPPFLAGS"
  284. CFLAGS_FOR_EGLIB="$CFLAGS_FOR_EGLIB $BROKEN_DARWIN_FLAGS"
  285. ;;
  286. x*64-*-darwin*)
  287. ;;
  288. arm*-darwin*)
  289. has_dtrace=no
  290. ;;
  291. esac
  292. ;;
  293. *-*-haiku*)
  294. CPPFLAGS="$CPPFLAGS -D_REENTRANT -D_THREAD_SAFE"
  295. libmono_cflags="-D_REENTRANT -D_THREAD_SAFE"
  296. libdl=
  297. LIBS="$LIBS -lnetwork"
  298. need_link_unlink=yes
  299. AC_DEFINE(PTHREAD_POINTER_ID)
  300. libgc_threads=pthreads
  301. use_sigposix=yes
  302. ;;
  303. *)
  304. AC_MSG_WARN([*** Please add $host to configure.ac checks!])
  305. libdl="-ldl"
  306. ;;
  307. esac
  308. AC_MSG_RESULT(ok)
  309. if test x$need_link_unlink = xyes; then
  310. AC_DEFINE(NEED_LINK_UNLINK, 1, [Define if Unix sockets cannot be created in an anonymous namespace])
  311. fi
  312. if test x$host_win32 = xyes; then
  313. AC_DEFINE(HOST_WIN32, 1, [Host Platform is Win32])
  314. fi
  315. if test x$target_win32 = xyes; then
  316. AC_DEFINE(TARGET_WIN32, 1, [Target Platform is Win32])
  317. fi
  318. AC_SUBST(extra_runtime_ldflags)
  319. AM_CONDITIONAL(HOST_WIN32, test x$host_win32 = xyes)
  320. AM_CONDITIONAL(TARGET_WIN32, test x$target_win32 = xyes)
  321. AM_CONDITIONAL(PLATFORM_LINUX, echo x$target_os | grep -q linux)
  322. AM_CONDITIONAL(PLATFORM_DARWIN, test x$host_darwin = xyes)
  323. AM_CONDITIONAL(PLATFORM_SIGPOSIX, test x$use_sigposix = xyes)
  324. AM_CONDITIONAL(PLATFORM_ANDROID, test x$platform_android = xyes)
  325. if test -z "$PLATFORM_DARWIN_TRUE"; then :
  326. PLATFORM_AOT_SUFFIX=.dylib
  327. fi
  328. if test -z "$PLATFORM_LINUX_TRUE"; then :
  329. PLATFORM_AOT_SUFFIX=.so
  330. fi
  331. AC_SUBST(PLATFORM_AOT_SUFFIX)
  332. ## PLATFORM_AOT_SUFFIX not so simple for windows :-)
  333. AC_CHECK_TOOL(CC, gcc, gcc)
  334. AC_PROG_CC
  335. AC_CHECK_TOOL(CXX, g++, g++)
  336. AC_PROG_CXX
  337. AM_PROG_AS
  338. AC_PROG_INSTALL
  339. AC_PROG_AWK
  340. AM_PROG_CC_C_O
  341. dnl We should use AM_PROG_AS, but it's not available on automake/aclocal 1.4
  342. : ${CCAS='$(CC)'}
  343. # Set ASFLAGS if not already set.
  344. : ${CCASFLAGS='$(CFLAGS)'}
  345. AC_SUBST(CCAS)
  346. AC_SUBST(CCASFLAGS)
  347. # AC_PROG_CXX helpfully sets CXX to g++ even if no c++ compiler is found so check
  348. # GXX instead. See http://lists.gnu.org/archive/html/bug-autoconf/2002-04/msg00056.html
  349. if test "x$CXX" = "xg++"; then
  350. if test "x$GXX" != "xyes"; then
  351. # automake/libtool is so broken, it requires g++ even if the c++ sources
  352. # are inside automake conditionals
  353. AC_MSG_ERROR([You need to install g++])
  354. fi
  355. fi
  356. dnl may require a specific autoconf version
  357. dnl AC_PROG_CC_FOR_BUILD
  358. dnl CC_FOR_BUILD not automatically detected
  359. CC_FOR_BUILD=$CC
  360. CFLAGS_FOR_BUILD=$CFLAGS
  361. BUILD_EXEEXT=
  362. if test "x$cross_compiling" = "xyes"; then
  363. CC_FOR_BUILD=cc
  364. CFLAGS_FOR_BUILD=
  365. BUILD_EXEEXT=""
  366. fi
  367. AC_SUBST(CC_FOR_BUILD)
  368. AC_SUBST(CFLAGS_FOR_BUILD)
  369. AC_SUBST(HOST_CC)
  370. AC_SUBST(BUILD_EXEEXT)
  371. AM_CONDITIONAL(CROSS_COMPILING, [test x$cross_compiling = xyes])
  372. AM_CONDITIONAL(USE_BATCH_FILES, [test x$host_win32 = xyes -a x$cross_compiling = xyes])
  373. # Set STDC_HEADERS
  374. AC_HEADER_STDC
  375. AC_LIBTOOL_WIN32_DLL
  376. # This causes monodis to not link correctly
  377. #AC_DISABLE_FAST_INSTALL
  378. AM_PROG_LIBTOOL
  379. # Use dolt (http://dolt.freedesktop.org/) instead of libtool for building.
  380. DOLT
  381. export_ldflags=`(./libtool --config; echo eval echo \\$export_dynamic_flag_spec) | sh`
  382. AC_SUBST(export_ldflags)
  383. # Test whenever ld supports -version-script
  384. AC_PROG_LD
  385. AC_PROG_LD_GNU
  386. AM_ICONV()
  387. AC_CHECK_HEADERS(sys/filio.h sys/sockio.h netdb.h utime.h sys/utime.h semaphore.h sys/un.h linux/rtc.h sys/syscall.h sys/mkdev.h sys/uio.h sys/param.h sys/sysctl.h libproc.h sys/prctl.h)
  388. AC_CHECK_HEADERS(sys/param.h sys/socket.h sys/ipc.h sys/utsname.h alloca.h ucontext.h pwd.h sys/select.h netinet/tcp.h netinet/in.h unistd.h sys/types.h link.h asm/sigcontext.h sys/inotify.h arpa/inet.h complex.h unwind.h)
  389. AC_CHECK_HEADERS([linux/netlink.h linux/rtnetlink.h],
  390. [], [], [#include <stddef.h>
  391. #include <sys/socket.h>
  392. #include <linux/socket.h>])
  393. AC_CHECK_HEADERS(sys/user.h, [], [],
  394. [
  395. #ifdef HAVE_SYS_PARAM_H
  396. # include <sys/param.h>
  397. #endif
  398. ])
  399. AC_CHECK_HEADERS(linux/serial.h)
  400. AC_CHECK_HEADER(zlib.h, [have_zlib=yes], [have_zlib=no])
  401. if test x$have_zlib = xyes; then
  402. AC_TRY_COMPILE([#include <zlib.h>], [
  403. #if defined(ZLIB_VERNUM) && (ZLIB_VERNUM >= 0x1230)
  404. return 0;
  405. #else
  406. #error No good zlib found
  407. #endif
  408. ],[
  409. AC_MSG_RESULT(Using system zlib)
  410. zlib_msg="system zlib"
  411. AC_DEFINE(HAVE_SYS_ZLIB,1,[Have system zlib])
  412. ],[
  413. AC_MSG_RESULT(Using embedded zlib)
  414. have_zlib=no
  415. zlib_msg="bundled zlib"
  416. ])
  417. fi
  418. AM_CONDITIONAL(HAVE_ZLIB, test x$have_zlib = xyes)
  419. AC_DEFINE(HAVE_ZLIB,1,[Have system zlib])
  420. # for mono/metadata/debug-symfile.c
  421. AC_CHECK_HEADERS(elf.h)
  422. # for support
  423. AC_CHECK_HEADERS(poll.h)
  424. AC_CHECK_HEADERS(sys/poll.h)
  425. AC_CHECK_HEADERS(sys/wait.h)
  426. AC_CHECK_HEADERS(grp.h)
  427. AC_CHECK_HEADERS(syslog.h)
  428. # for mono/dis
  429. AC_CHECK_HEADERS(wchar.h)
  430. AC_CHECK_HEADERS(ieeefp.h)
  431. AC_MSG_CHECKING(for isinf)
  432. AC_TRY_LINK([#include <math.h>], [
  433. int f = isinf (1.0);
  434. ], [
  435. AC_MSG_RESULT(yes)
  436. AC_DEFINE(HAVE_ISINF, 1, [isinf available])
  437. ], [
  438. # We'll have to use signals
  439. AC_MSG_RESULT(no)
  440. ])
  441. # mingw
  442. AC_CHECK_FUNCS(_finite, , AC_MSG_CHECKING(for _finite in math.h)
  443. AC_TRY_LINK([#include <math.h>],
  444. [ _finite(0.0); ],
  445. AC_DEFINE(HAVE__FINITE, 1, [Have _finite in -lm]) AC_MSG_RESULT(yes),
  446. AC_MSG_RESULT(no)))
  447. # for Linux statfs support
  448. AC_CHECK_HEADERS(linux/magic.h)
  449. # not 64 bit clean in cross-compile
  450. AC_CHECK_SIZEOF(void *, 4)
  451. AC_CACHE_CHECK([for clang],
  452. mono_cv_clang,[
  453. AC_TRY_COMPILE([], [
  454. #ifdef __clang__
  455. #else
  456. #error "FAILED"
  457. #endif
  458. return 0;
  459. ],
  460. [mono_cv_clang=yes],
  461. [mono_cv_clang=no],
  462. [])
  463. ])
  464. AC_ARG_ENABLE(visibility-hidden,
  465. [ --disable-visibility-hidden disable usage of -fvisiblity=hidden],
  466. disable_visibility_hidden=yes, disable_visibility_hidden=no)
  467. WARN=''
  468. if test x"$GCC" = xyes; then
  469. WARN='-Wall -Wunused -Wmissing-prototypes -Wmissing-declarations -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wno-cast-qual -Wwrite-strings -Wno-switch -Wno-switch-enum -Wno-unused-value -Wno-attributes'
  470. # We require C99 with some GNU extensions, e.g. `linux` macro
  471. CFLAGS="$CFLAGS -std=gnu99"
  472. # The runtime code does not respect ANSI C strict aliasing rules
  473. CFLAGS="$CFLAGS -fno-strict-aliasing"
  474. # We rely on signed overflow to behave
  475. CFLAGS="$CFLAGS -fwrapv"
  476. # We rely on zero length arrays in structs
  477. CFLAGS="$CFLAGS -Wno-zero-length-array"
  478. CFLAGS="$CFLAGS -DMONO_DLL_EXPORT"
  479. if test x"$disable_visibility_hidden" = xno; then
  480. # Don't export any symbols by default
  481. SHARED_CFLAGS="-fvisibility=hidden"
  482. CFLAGS_FOR_EGLIB="$CFLAGS_FOR_EGLIB -fvisibility=hidden"
  483. CXXFLAGS="$CXXFLAGS -fvisibility=hidden"
  484. fi
  485. ORIG_CFLAGS=$CFLAGS
  486. # Check for the normal version, since gcc ignores unknown -Wno options
  487. CFLAGS="$CFLAGS -Wunused-but-set-variable -Werror"
  488. AC_MSG_CHECKING(for -Wno-unused-but-set-variable option to gcc)
  489. AC_TRY_COMPILE([],[
  490. return 0;
  491. ], [
  492. AC_MSG_RESULT(yes)
  493. CFLAGS="$ORIG_CFLAGS -Wno-unused-but-set-variable"
  494. ], [
  495. AC_MSG_RESULT(no)
  496. CFLAGS=$ORIG_CFLAGS
  497. ])
  498. if test "x$mono_cv_clang" = "xyes"; then
  499. # https://bugzilla.samba.org/show_bug.cgi?id=8118
  500. WARN="$WARN -Qunused-arguments"
  501. WARN="$WARN -Wno-unused-function -Wno-tautological-compare -Wno-parentheses-equality -Wno-self-assign -Wno-return-stack-address -Wno-constant-logical-operand"
  502. fi
  503. else
  504. # The Sun Forte compiler complains about inline functions that access static variables
  505. # so disable all inlining.
  506. case "$host" in
  507. *-*-solaris*)
  508. CFLAGS="$CFLAGS -Dinline="
  509. ;;
  510. esac
  511. fi
  512. CFLAGS="$CFLAGS -g $WARN"
  513. CFLAGS_FOR_LIBGC="$CFLAGS_FOR_LIBGC -g"
  514. CPPFLAGS="$CPPFLAGS -g $WARN"
  515. # Where's the 'mcs' source tree?
  516. if test -d $srcdir/mcs; then
  517. mcsdir=mcs
  518. else
  519. mcsdir=../mcs
  520. fi
  521. AC_ARG_WITH(mcs-path, [ --with-mcs-path=/path/to/mcs Specify an alternate mcs source tree],
  522. if test x$with_mcs_path != "x" -a -d $with_mcs_path ; then
  523. mcsdir=$with_mcs_path
  524. fi
  525. )
  526. AC_ARG_WITH(jumptables, [ --with-jumptables=yes,no enable/disable support for jumptables (ARM-only for now) (defaults to no)],[],[with_jumptables=no])
  527. #
  528. # A sanity check to catch cases where the package was unpacked
  529. # with an ancient tar program (Solaris)
  530. #
  531. AC_ARG_ENABLE(solaris-tar-check,
  532. [ --disable-solaris-tar-check disable solaris tar check],
  533. do_solaris_tar_check=no, do_solaris_tar_check=yes)
  534. if test x"$do_solaris_tar_check" = xyes -a x"$enable_solaris_tar_check" = xyes; then
  535. AC_MSG_CHECKING(integrity of package)
  536. if test -f $mcsdir/class/System.Runtime.Serialization.Formatters.Soap/System.Runtime.Serialization.Formatters.Soap/SoapTypeMapper.cs
  537. then
  538. AC_MSG_RESULT(ok)
  539. else
  540. 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"
  541. AC_MSG_ERROR([$errorm])
  542. fi
  543. fi
  544. if test "x$with_mcs_path" != "x"; then
  545. mcs_topdir=$(cd "$mcsdir" && pwd)
  546. mcs_topdir_from_srcdir=$mcs_topdir
  547. else
  548. mcs_topdir=$(cd "$srcdir/$mcsdir" && pwd)
  549. mcs_topdir_from_srcdir='$(top_builddir)'/$mcsdir
  550. fi
  551. # Convert mcs_topdir* paths to Windows syntax.
  552. if test x$cross_compiling$host_win32 = xnoyes; then
  553. mcs_topdir=$(cygpath -m $mcs_topdir)
  554. case $mcs_topdir_from_srcdir in
  555. /cygdrive/*)
  556. mcs_topdir_from_srcdir=$(cygpath -m $mcs_topdir_from_srcdir)
  557. ;;
  558. esac
  559. fi
  560. AC_SUBST([mcs_topdir])
  561. AC_SUBST([mcs_topdir_from_srcdir])
  562. # gettext: prepare the translation directories.
  563. # we do not configure the full gettext, as we consume it dynamically from C#
  564. AM_PO_SUBDIRS
  565. if test "x$USE_NLS" = "xyes"; then
  566. AC_CHECK_PROG(HAVE_MSGFMT, msgfmt,yes,no)
  567. if test "x$HAVE_MSGFMT" = "xno"; then
  568. AC_MSG_ERROR([msgfmt not found. You need to install the 'gettext' package, or pass --enable-nls=no to configure.])
  569. fi
  570. fi
  571. AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
  572. pkg_config_path=
  573. AC_ARG_WITH(crosspkgdir, [ --with-crosspkgdir=/path/to/pkg-config/dir Change pkg-config dir to custom dir],
  574. if test x$with_crosspkgdir = "x"; then
  575. if test -s $PKG_CONFIG_PATH; then
  576. pkg_config_path=$PKG_CONFIG_PATH
  577. fi
  578. else
  579. pkg_config_path=$with_crosspkgdir
  580. PKG_CONFIG_PATH=$pkg_config_path
  581. export PKG_CONFIG_PATH
  582. fi
  583. )
  584. AC_ARG_ENABLE(werror, [ --enable-werror Pass -Werror to the C compiler], werror_flag=$enableval, werror_flag=no)
  585. if test x$werror_flag = xyes; then
  586. WERROR_CFLAGS="-Werror"
  587. fi
  588. AC_SUBST([WERROR_CFLAGS])
  589. AC_SUBST([SHARED_CFLAGS])
  590. ac_configure_args="$ac_configure_args \"CPPFLAGS_FOR_EGLIB=$EGLIB_CPPFLAGS\" \"CFLAGS_FOR_EGLIB=$CFLAGS_FOR_EGLIB\""
  591. AC_CONFIG_SUBDIRS(eglib)
  592. GLIB_CFLAGS='-I$(top_srcdir)/eglib/src -I$(top_builddir)/eglib/src'
  593. GLIB_LIBS='-L$(top_builddir)/eglib/src -leglib -lm'
  594. AC_SUBST(GLIB_CFLAGS)
  595. AC_SUBST(GLIB_LIBS)
  596. # Enable support for fast thread-local storage
  597. # Some systems have broken support, so we allow to disable it.
  598. AC_ARG_WITH(tls, [ --with-tls=__thread,pthread select Thread Local Storage implementation (defaults to __thread)],[],[with_tls=__thread])
  599. # Enable support for using sigaltstack for SIGSEGV and stack overflow handling
  600. # This does not work on some platforms (bug #55253)
  601. AC_ARG_WITH(sigaltstack, [ --with-sigaltstack=yes,no enable/disable support for sigaltstack (defaults to yes)],[],[with_sigaltstack=yes])
  602. AC_ARG_WITH(static_mono, [ --with-static_mono=yes,no link mono statically to libmono (faster) (defaults to yes)],[],[with_static_mono=yes])
  603. AC_ARG_WITH(shared_mono, [ --with-shared_mono=yes,no build a shared libmono library (defaults to yes)],[],[with_shared_mono=yes])
  604. # Same as --with-shared_mono=no
  605. AC_ARG_ENABLE(libraries, [ --disable-libraries disable the build of libmono], enable_libraries=$enableval, enable_libraries=yes)
  606. if test "x$enable_static" = "xno"; then
  607. with_static_mono=no
  608. fi
  609. if test "x$enable_shared" = "xno"; then
  610. with_shared_mono=no
  611. fi
  612. if test "x$enable_libraries" = "xno"; then
  613. with_shared_mono=no
  614. fi
  615. AM_CONDITIONAL(DISABLE_LIBRARIES, test x$enable_libraries = xno)
  616. case $host in
  617. *nacl* ) with_shared_mono=yes;;
  618. esac
  619. if test "x$host_win32" = "xyes"; then
  620. # Boehm GC requires the runtime to be in its own dll
  621. with_static_mono=no
  622. fi
  623. AM_CONDITIONAL(STATIC_MONO, test x$with_static_mono != xno)
  624. AM_CONDITIONAL(SHARED_MONO, test x$with_shared_mono != xno)
  625. AC_ARG_ENABLE(mcs-build, [ --disable-mcs-build disable the build of the mcs directory], try_mcs_build=$enableval, enable_mcs_build=yes)
  626. AC_ARG_WITH(xen_opt, [ --with-xen_opt=yes,no Enable Xen-specific behaviour (defaults to yes)],[],[with_xen_opt=yes])
  627. if test "x$with_xen_opt" = "xyes" -a "x$mono_cv_clang" = "xno"; then
  628. AC_DEFINE(MONO_XEN_OPT, 1, [Xen-specific behaviour])
  629. ORIG_CFLAGS=$CFLAGS
  630. CFLAGS="$CFLAGS -mno-tls-direct-seg-refs"
  631. AC_MSG_CHECKING(for -mno-tls-direct-seg-refs option to gcc)
  632. AC_TRY_COMPILE([], [
  633. return 0;
  634. ], [
  635. AC_MSG_RESULT(yes)
  636. # Pass it to libgc as well
  637. CFLAGS_FOR_LIBGC="$CFLAGS_FOR_LIBGC -mno-tls-direct-seg-refs"
  638. ], [
  639. AC_MSG_RESULT(no)
  640. CFLAGS=$ORIG_CFLAGS
  641. ])
  642. fi
  643. AC_ARG_ENABLE(small-config, [ --enable-small-config Enable tweaks to reduce requirements (and capabilities)], enable_small_config=$enableval, enable_small_config=no)
  644. if test x$enable_small_config = xyes; then
  645. AC_DEFINE(MONO_SMALL_CONFIG,1,[Reduce runtime requirements (and capabilities)])
  646. CFLAGS_FOR_LIBGC="$CFLAGS_FOR_LIBGC -DSMALL_CONFIG"
  647. fi
  648. AC_ARG_ENABLE(system-aot, [ --enable-system-aot Enable the Ahead-Of-Time compilation of system assemblies during the build (on by default on some platforms)], enable_system_aot=$enableval, enable_system_aot=default)
  649. DISABLED_FEATURES=none
  650. #
  651. # Set the build profiles and options before things which use them
  652. #
  653. AC_ARG_WITH(profile4_x, [ --with-profile4=yes,no If you want to install the 4.x FX (defaults to yes)], [], [with_profile4_x=default])
  654. AC_ARG_WITH(monodroid, [ --with-monodroid=yes,no If you want to build the MonoDroid assemblies (defaults to no)], [], [with_monodroid=default])
  655. AC_ARG_WITH(monotouch, [ --with-monotouch=yes,no If you want to build the Xamarin.iOS assemblies (defaults to no)], [], [with_monotouch=default])
  656. AC_ARG_WITH(monotouch_watch, [ --with-monotouch_watch=yes,no If you want to build the Xamarin.WatchOS assemblies (defaults to no)],[], [with_monotouch_watch=default])
  657. AC_ARG_WITH(monotouch_tv, [ --with-monotouch_tv=yes,no If you want to build the Xamarin.TVOS assemblies (defaults to no)], [], [with_monotouch_tv=default])
  658. AC_ARG_WITH(bitcode, [ --with-bitcode=yes,no If bitcode is enabled (defaults to no)], [], [with_bitcode=default])
  659. AC_ARG_WITH(xammac, [ --with-xammac=yes,no If you want to build the Xamarin.Mac assemblies (defaults to no)], [], [with_xammac=default])
  660. AC_ARG_WITH(mobile_static, [ --with-mobile_static=yes,no If you want to build the mobile_static assemblies (defaults to no)], [], [with_mobile_static=default])
  661. AC_ARG_WITH(runtime_preset, [ --with-runtime_preset=net_4_x,all,mobile_static,bitcode_mobile_static Which default profile to build (defaults to net_4_x)], [], [with_runtime_preset=net_4_x])
  662. dnl
  663. dnl Profile defaults
  664. dnl
  665. TEST_PROFILE=default
  666. enable_llvm_default=no
  667. INVARIANT_AOT_OPTIONS=nimt-trampolines=900,ntrampolines=8000,nrgctx-fetch-trampolines=256,ngsharedvt-trampolines=2800
  668. if test x$cross_compiling = xyes -o x$enable_mcs_build = xno; then
  669. DISABLE_MCS_DOCS_default=yes
  670. with_profile4_x_default=no
  671. with_monodroid_default=no
  672. with_monotouch_default=no
  673. with_monotouch_watch_default=no
  674. with_monotouch_tv_default=no
  675. with_xammac_default=no
  676. with_mobile_static_default=no
  677. with_bitcode_default=no
  678. with_cooperative_gc_default=no
  679. elif test x$with_runtime_preset = xnet_4_x; then
  680. with_cooperative_gc_default=no
  681. with_profile4_x_default=yes
  682. with_monodroid_default=no
  683. with_monotouch_default=no
  684. with_monotouch_watch_default=no
  685. with_monotouch_tv_default=no
  686. with_xammac_default=no
  687. with_mobile_static_default=no
  688. with_bitcode_default=no
  689. elif test x$with_runtime_preset = xall; then
  690. with_cooperative_gc_default=no
  691. with_profile4_x_default=yes
  692. with_monodroid_default=yes
  693. with_monotouch_default=yes
  694. with_monotouch_watch_default=yes
  695. with_monotouch_tv_default=yes
  696. with_xammac_default=yes
  697. with_mobile_static_default=no
  698. with_bitcode_default=no
  699. elif test x$with_runtime_preset = xmobile_static; then
  700. DISABLE_MCS_DOCS_default=yes
  701. with_cooperative_gc_default=no
  702. with_profile4_x_default=no
  703. with_monodroid_default=no
  704. with_monotouch_default=no
  705. with_monotouch_watch_default=no
  706. with_monotouch_tv_default=no
  707. with_xammac_default=no
  708. with_mobile_static_default=yes
  709. with_bitcode_default=no
  710. with_cooperative_gc_default=no
  711. TEST_PROFILE=mobile_static
  712. mono_feature_disable_com='yes'
  713. mono_feature_disable_remoting='yes'
  714. mono_feature_disable_reflection_emit_save='yes'
  715. mono_feature_disable_reflection_emit='yes'
  716. mono_feature_disable_appdomains='yes'
  717. AOT_BUILD_FLAGS="-O=gsharedvt --aot=full,$INVARIANT_AOT_OPTIONS"
  718. AOT_RUN_FLAGS="--full-aot"
  719. elif test x$with_runtime_preset = xbitcode_mobile_static; then
  720. DISABLE_MCS_DOCS_default=yes
  721. with_profile4_x_default=no
  722. with_monodroid_default=no
  723. with_monotouch_default=no
  724. with_monotouch_watch_default=no
  725. with_monotouch_tv_default=no
  726. with_xammac_default=no
  727. with_mobile_static_default=yes
  728. with_bitcode_default=yes
  729. with_cooperative_gc_default=yes
  730. TEST_PROFILE=mobile_static
  731. enable_llvm_default=yes
  732. mono_feature_disable_com='yes'
  733. mono_feature_disable_remoting='yes'
  734. mono_feature_disable_reflection_emit_save='yes'
  735. mono_feature_disable_reflection_emit='yes'
  736. mono_feature_disable_appdomains='yes'
  737. AOT_BUILD_FLAGS="--aot=llvmonly,$INVARIANT_AOT_OPTIONS"
  738. AOT_RUN_FLAGS="--llvmonly"
  739. else
  740. with_profile4_x_default=yes
  741. with_monodroid_default=no
  742. with_monotouch_default=no
  743. with_monotouch_watch_default=no
  744. with_monotouch_tv_default=no
  745. with_bitcode_default=no
  746. with_xammac_default=no
  747. with_mobile_static_default=no
  748. with_cooperative_gc_default=no
  749. fi
  750. if test "x$AOT_BUILD_FLAGS" != "x"; then :
  751. AC_SUBST(AOT_BUILD_FLAGS)
  752. AC_SUBST(AOT_RUN_FLAGS)
  753. # For llvmonlycheck + fullaotcheck
  754. AC_SUBST(INVARIANT_AOT_OPTIONS)
  755. fi
  756. AC_SUBST(TEST_PROFILE)
  757. if test "x$with_profile4_x" = "xdefault"; then
  758. with_profile4_x=$with_profile4_x_default
  759. fi
  760. if test "x$with_monodroid" = "xdefault"; then
  761. with_monodroid=$with_monodroid_default
  762. fi
  763. if test "x$with_monotouch" = "xdefault"; then
  764. with_monotouch=$with_monotouch_default
  765. fi
  766. if test "x$with_monotouch_watch" = "xdefault"; then
  767. with_monotouch_watch=$with_monotouch_watch_default
  768. fi
  769. if test "x$with_monotouch_tv" = "xdefault"; then
  770. with_monotouch_tv=$with_monotouch_tv_default
  771. fi
  772. if test "x$with_bitcode" = "xdefault"; then
  773. with_bitcode=$with_bitcode_default
  774. fi
  775. if test "x$with_xammac" = "xdefault"; then
  776. with_xammac=$with_xammac_default
  777. fi
  778. if test "x$with_mobile_static" = "xdefault"; then
  779. with_mobile_static=$with_mobile_static_default
  780. fi
  781. AM_CONDITIONAL(INSTALL_4_x, [test "x$with_profile4_x" = "xyes"])
  782. AM_CONDITIONAL(INSTALL_MONODROID, [test "x$with_monodroid" != "xno"])
  783. AM_CONDITIONAL(INSTALL_MONOTOUCH, [test "x$with_monotouch" != "xno"])
  784. AM_CONDITIONAL(INSTALL_MONOTOUCH_WATCH, [test "x$with_monotouch_watch" != "xno"])
  785. AM_CONDITIONAL(INSTALL_MONOTOUCH_TV, [test "x$with_monotouch_tv" != "xno"])
  786. AM_CONDITIONAL(BITCODE, test "x$with_bitcode" = "xyes")
  787. AM_CONDITIONAL(INSTALL_XAMMAC, [test "x$with_xammac" != "xno"])
  788. AM_CONDITIONAL(INSTALL_MOBILE_STATIC, [test "x$with_mobile_static" != "xno"])
  789. AC_SUBST(INSTALL_MOBILE_STATIC)
  790. default_profile=net_4_x
  791. if test -z "$INSTALL_MONODROID_TRUE"; then :
  792. default_profile=monodroid
  793. fi
  794. if test -z "$INSTALL_MONOTOUCH_TRUE"; then :
  795. default_profile=monotouch
  796. fi
  797. if test -z "$INSTALL_XAMMAC_TRUE"; then :
  798. default_profile=xammac
  799. fi
  800. if test -z "$INSTALL_MOBILE_STATIC_TRUE"; then :
  801. default_profile=mobile_static
  802. fi
  803. if test -z "$INSTALL_4_x_TRUE"; then :
  804. default_profile=net_4_x
  805. fi
  806. DEFAULT_PROFILE=$default_profile
  807. AC_SUBST(DEFAULT_PROFILE)
  808. #
  809. # End build profile configuration
  810. #
  811. if test x$USE_NLS = xprofile_default; then
  812. if test x$host_darwin = xyes; then
  813. # We make the default value for USE_NLS
  814. # "no" on OSX because it isn't available on most
  815. # default OSX installs. The most common configurations will
  816. # all disable it, so this saves us typing.
  817. USE_NLS=no
  818. AC_SUBST([USE_NLS])
  819. AC_MSG_RESULT([$USE_NLS])
  820. else
  821. USE_NLS=yes
  822. AC_SUBST([USE_NLS])
  823. AC_MSG_RESULT([$USE_NLS])
  824. fi
  825. fi
  826. AC_ARG_ENABLE(minimal, [ --enable-minimal=LIST drop support for LIST subsystems.
  827. LIST is a comma-separated list from: aot, profiler, decimal, pinvoke, debug, appdomains, verifier,
  828. reflection_emit, reflection_emit_save, large_code, logging, com, ssa, generics, attach, jit, simd, soft_debug, perfcounters, normalization, assembly_remapping, shared_perfcounters, remoting,
  829. security, sgen_remset, sgen_marksweep_par, sgen_marksweep_fixed, sgen_marksweep_fixed_par, sgen_copying.],
  830. [
  831. for feature in `echo "$enable_minimal" | sed -e "s/,/ /g"`; do
  832. eval "mono_feature_disable_$feature='yes'"
  833. done
  834. DISABLED_FEATURES=$enable_minimal
  835. disabled="Disabled: $enable_minimal"
  836. ],[])
  837. AC_DEFINE_UNQUOTED(DISABLED_FEATURES, "$DISABLED_FEATURES", [String of disabled features])
  838. if test "x$mono_feature_disable_aot" = "xyes"; then
  839. AC_DEFINE(DISABLE_AOT, 1, [Disable AOT Compiler])
  840. enable_system_aot=no
  841. AC_MSG_NOTICE([Disabled AOT compiler])
  842. fi
  843. if test "x$mono_feature_disable_profiler" = "xyes"; then
  844. AC_DEFINE(DISABLE_PROFILER, 1, [Disable default profiler support])
  845. AC_MSG_NOTICE([Disabled support for the profiler])
  846. fi
  847. AM_CONDITIONAL(DISABLE_PROFILER, test x$mono_feature_disable_profiler = xyes)
  848. if test "x$mono_feature_disable_decimal" = "xyes"; then
  849. AC_DEFINE(DISABLE_DECIMAL, 1, [Disable System.Decimal support])
  850. AC_MSG_NOTICE([Disabled support for decimal])
  851. fi
  852. if test "x$mono_feature_disable_pinvoke" = "xyes"; then
  853. AC_DEFINE(DISABLE_PINVOKE, 1, [Disable P/Invoke support])
  854. AC_MSG_NOTICE([Disabled support for P/Invoke])
  855. fi
  856. if test "x$mono_feature_disable_debug" = "xyes"; then
  857. AC_DEFINE(DISABLE_DEBUG, 1, [Disable runtime debugging support])
  858. AC_MSG_NOTICE([Disabled support for runtime debugging])
  859. fi
  860. if test "x$mono_feature_disable_reflection_emit" = "xyes"; then
  861. AC_DEFINE(DISABLE_REFLECTION_EMIT, 1, [Disable reflection emit support])
  862. mono_feature_disable_reflection_emit_save=yes
  863. AC_MSG_NOTICE([Disabled support for Reflection.Emit])
  864. fi
  865. if test "x$mono_feature_disable_reflection_emit_save" = "xyes"; then
  866. AC_DEFINE(DISABLE_REFLECTION_EMIT_SAVE, 1, [Disable assembly saving support in reflection emit])
  867. AC_MSG_NOTICE([Disabled support for Reflection.Emit.Save])
  868. fi
  869. if test "x$mono_feature_disable_large_code" = "xyes"; then
  870. AC_DEFINE(DISABLE_LARGE_CODE, 1, [Disable support for huge assemblies])
  871. AC_MSG_NOTICE([Disabled support for large assemblies])
  872. fi
  873. if test "x$mono_feature_disable_logging" = "xyes"; then
  874. AC_DEFINE(DISABLE_LOGGING, 1, [Disable support debug logging])
  875. AC_MSG_NOTICE([Disabled support for logging])
  876. fi
  877. if test "x$mono_feature_disable_com" = "xyes"; then
  878. AC_DEFINE(DISABLE_COM, 1, [Disable COM support])
  879. AC_MSG_NOTICE([Disabled COM support])
  880. fi
  881. if test "x$mono_feature_disable_ssa" = "xyes"; then
  882. AC_DEFINE(DISABLE_SSA, 1, [Disable advanced SSA JIT optimizations])
  883. AC_MSG_NOTICE([Disabled SSA JIT optimizations])
  884. fi
  885. if test "x$mono_feature_disable_generics" = "xyes"; then
  886. AC_DEFINE(DISABLE_GENERICS, 1, [Disable generics support])
  887. AC_MSG_NOTICE([Disabled Generics Support])
  888. fi
  889. if test "x$mono_feature_disable_shadowcopy" = "xyes"; then
  890. AC_DEFINE(DISABLE_SHADOW_COPY, 1, [Disable Shadow Copy for AppDomains])
  891. AC_MSG_NOTICE([Disabled Shadow copy for AppDomains])
  892. fi
  893. if test "x$mono_feature_disable_portability" = "xyes"; then
  894. AC_DEFINE(DISABLE_PORTABILITY, 1, [Disables the IO portability layer])
  895. AC_MSG_NOTICE([Disabled IO Portability layer])
  896. fi
  897. if test "x$mono_feature_disable_attach" = "xyes"; then
  898. AC_DEFINE(DISABLE_ATTACH, 1, [Disable agent attach support])
  899. AC_MSG_NOTICE([Disabled agent attach])
  900. fi
  901. if test "x$mono_feature_disable_full_messages" = "xyes"; then
  902. AC_DEFINE(DISABLE_FULL_MESSAGES, 1, [Disables building in the full table of WAPI messages])
  903. AC_MSG_NOTICE([Disabled full messages for Win32 errors, only core message strings shipped])
  904. fi
  905. if test "x$mono_feature_disable_verifier" = "xyes"; then
  906. AC_DEFINE(DISABLE_VERIFIER, 1, [Disables the verifier])
  907. AC_MSG_NOTICE([Disabled the metadata and IL verifiers])
  908. fi
  909. if test "x$mono_feature_disable_jit" = "xyes"; then
  910. AC_DEFINE(DISABLE_JIT, 1, [Disable the JIT, only full-aot mode will be supported by the runtime.])
  911. AC_MSG_NOTICE([Disabled the JIT engine, only full AOT will be supported])
  912. fi
  913. AM_CONDITIONAL(DISABLE_JIT, test x$mono_feature_disable_jit = xyes)
  914. if test "x$mono_feature_disable_simd" = "xyes"; then
  915. AC_DEFINE(DISABLE_SIMD, 1, [Disable SIMD intrinsics related optimizations.])
  916. AC_MSG_NOTICE([Disabled SIMD support])
  917. fi
  918. if test "x$mono_feature_disable_soft_debug" = "xyes"; then
  919. AC_DEFINE(DISABLE_SOFT_DEBUG, 1, [Disable Soft Debugger Agent.])
  920. AC_MSG_NOTICE([Disabled Soft Debugger.])
  921. fi
  922. if test "x$mono_feature_disable_perfcounters" = "xyes"; then
  923. AC_DEFINE(DISABLE_PERFCOUNTERS, 1, [Disable Performance Counters.])
  924. AC_MSG_NOTICE([Disabled Performance Counters.])
  925. fi
  926. if test "x$mono_feature_disable_normalization" = "xyes"; then
  927. AC_DEFINE(DISABLE_NORMALIZATION, 1, [Disable String normalization support.])
  928. AC_MSG_NOTICE([Disabled String normalization support.])
  929. fi
  930. if test "x$mono_feature_disable_assembly_remapping" = "xyes"; then
  931. AC_DEFINE(DISABLE_ASSEMBLY_REMAPPING, 1, [Disable assembly remapping.])
  932. AC_MSG_NOTICE([Disabled Assembly remapping.])
  933. fi
  934. if test "x$mono_feature_disable_shared_perfcounters" = "xyes"; then
  935. AC_DEFINE(DISABLE_SHARED_PERFCOUNTERS, 1, [Disable shared perfcounters.])
  936. AC_MSG_NOTICE([Disabled Shared perfcounters.])
  937. fi
  938. if test "x$mono_feature_disable_appdomains" = "xyes"; then
  939. AC_DEFINE(DISABLE_APPDOMAINS, 1, [Disable support for multiple appdomains.])
  940. AC_MSG_NOTICE([Disabled support for multiple appdomains.])
  941. fi
  942. if test "x$mono_feature_disable_remoting" = "xyes"; then
  943. AC_DEFINE(DISABLE_REMOTING, 1, [Disable remoting support (This disables type proxies and make com non-functional)])
  944. AC_MSG_NOTICE([Disabled remoting])
  945. fi
  946. if test "x$mono_feature_disable_security" = "xyes"; then
  947. AC_DEFINE(DISABLE_SECURITY, 1, [Disable CAS/CoreCLR security])
  948. AC_MSG_NOTICE([Disabled CAS/CoreCLR security manager (used e.g. for Moonlight)])
  949. fi
  950. if test "x$mono_feature_disable_sgen_remset" = "xyes"; then
  951. AC_DEFINE(DISABLE_SGEN_REMSET, 1, [Disable wbarrier=remset support in SGEN.])
  952. AC_MSG_NOTICE([Disabled wbarrier=remset support in SGEN.])
  953. fi
  954. if test "x$mono_feature_disable_sgen_marksweep_par" = "xyes"; then
  955. AC_DEFINE(DISABLE_SGEN_MAJOR_MARKSWEEP_PAR, 1, [Disable major=marksweep-par support in SGEN.])
  956. AC_MSG_NOTICE([Disabled major=marksweep-par support in SGEN.])
  957. fi
  958. if test "x$mono_feature_disable_sgen_marksweep_fixed" = "xyes"; then
  959. AC_DEFINE(DISABLE_SGEN_MAJOR_MARKSWEEP_FIXED, 1, [Disable major=marksweep-fixed support in SGEN.])
  960. AC_MSG_NOTICE([Disabled major=marksweep-fixed support in SGEN.])
  961. fi
  962. if test "x$mono_feature_disable_sgen_marksweep_fixed_par" = "xyes"; then
  963. AC_DEFINE(DISABLE_SGEN_MAJOR_MARKSWEEP_FIXED_PAR, 1, [Disable major=marksweep-fixed-par support in SGEN.])
  964. AC_MSG_NOTICE([Disabled major=marksweep-fixed-par support in SGEN.])
  965. fi
  966. if test "x$mono_feature_disable_sgen_copying" = "xyes"; then
  967. AC_DEFINE(DISABLE_SGEN_MAJOR_COPYING, 1, [Disable major=copying support in SGEN.])
  968. AC_MSG_NOTICE([Disabled major=copying support in SGEN.])
  969. fi
  970. AC_ARG_ENABLE(executables, [ --disable-executables disable the build of the runtime executables], enable_executables=$enableval, enable_executables=yes)
  971. AM_CONDITIONAL(DISABLE_EXECUTABLES, test x$enable_executables = xno)
  972. has_extension_module=no
  973. AC_ARG_ENABLE(extension-module, [ --enable-extension-module=LIST enable the core-extensions from LIST],
  974. [
  975. for extension in `echo "$enable_extension_module" | sed -e "s/,/ /g"`; do
  976. if test x$extension = xdefault ; then
  977. has_extension_module=yes;
  978. fi
  979. done
  980. if test x$enable_extension_module = xyes; then
  981. has_extension_module=yes;
  982. fi
  983. ], [])
  984. AM_CONDITIONAL([HAS_EXTENSION_MODULE], [test x$has_extension_module != xno])
  985. if test x$has_extension_module != xno ; then
  986. AC_DEFINE([ENABLE_EXTENSION_MODULE], 1, [Extension module enabled])
  987. AC_MSG_NOTICE([Enabling mono extension module.])
  988. fi
  989. # Deprecated
  990. AC_ARG_ENABLE(gsharedvt, [ --enable-gsharedvt Enable generic valuetype sharing (Deprecated)], enable_gsharedvt=$enableval, enable_gsharedvt=no)
  991. AC_MSG_CHECKING(for visibility __attribute__)
  992. AC_COMPILE_IFELSE([
  993. AC_LANG_SOURCE([[
  994. void __attribute__ ((visibility ("hidden"))) doit (void) {}
  995. int main () { doit (); return 0; }
  996. ]])
  997. ], [
  998. have_visibility_hidden=yes
  999. AC_MSG_RESULT(yes)
  1000. ], [
  1001. have_visibility_hidden=no
  1002. AC_MSG_RESULT(no)
  1003. ])
  1004. AC_MSG_CHECKING(for deprecated __attribute__)
  1005. AC_TRY_COMPILE([
  1006. int doit (void) __attribute__ ((deprecated));
  1007. int doit (void) { return 0; }
  1008. ], [
  1009. return 0;
  1010. ], [
  1011. have_deprecated=yes
  1012. AC_MSG_RESULT(yes)
  1013. ], [
  1014. have_deprecated=no
  1015. AC_MSG_RESULT(no)
  1016. ])
  1017. dnl
  1018. dnl Boehm GC configuration
  1019. dnl
  1020. AC_ARG_WITH(libgc, [ --with-gc=included,none Controls the Boehm GC config, default=included],[libgc=$with_gc],[libgc=included])
  1021. AC_ARG_ENABLE(boehm, [ --disable-boehm Disable the Boehm GC.], support_boehm=$enableval,support_boehm=${support_boehm:-yes})
  1022. AM_CONDITIONAL(SUPPORT_BOEHM, test x$support_boehm = xyes)
  1023. if test "x$support_boehm" = "xyes"; then
  1024. AC_ARG_ENABLE(parallel-mark, [ --enable-parallel-mark Enables Boehm GC Parallel Marking], enable_parallel_mark=$enableval, enable_parallel_mark=$parallel_mark)
  1025. if test x$enable_parallel_mark = xyes; then
  1026. libgc_configure_args="$libgc_configure_args --enable-parallel-mark"
  1027. fi
  1028. gc_msg=""
  1029. LIBGC_CPPFLAGS=
  1030. LIBGC_LIBS=
  1031. LIBGC_STATIC_LIBS=
  1032. libgc_dir=
  1033. case "x$libgc" in
  1034. xincluded)
  1035. if test "x$support_boehm" = "xyes"; then
  1036. libgc_dir=libgc
  1037. fi
  1038. LIBGC_CPPFLAGS='-I$(top_srcdir)/libgc/include'
  1039. LIBGC_LIBS='$(top_builddir)/libgc/libmonogc.la'
  1040. LIBGC_STATIC_LIBS='$(top_builddir)/libgc/libmonogc-static.la'
  1041. BOEHM_DEFINES="-DHAVE_BOEHM_GC"
  1042. if test x$target_win32 = xyes; then
  1043. BOEHM_DEFINES="$BOEHM_DEFINES -DGC_NOT_DLL"
  1044. CFLAGS_FOR_LIBGC="$CFLAGS_FOR_LIBGC -DGC_BUILD -DGC_NOT_DLL"
  1045. fi
  1046. gc_msg="Included Boehm GC with typed GC"
  1047. if test x$enable_parallel_mark = xyes; then
  1048. AC_DEFINE_UNQUOTED(DEFAULT_GC_NAME, "Included Boehm (with typed GC and Parallel Mark)", [GC description])
  1049. gc_msg="$gc_msg and parallel mark"
  1050. else
  1051. AC_DEFINE_UNQUOTED(DEFAULT_GC_NAME, "Included Boehm (with typed GC)", [GC description])
  1052. fi
  1053. ;;
  1054. xboehm|xbohem|xyes)
  1055. AC_MSG_WARN("External Boehm is no longer supported")
  1056. ;;
  1057. xsgen)
  1058. AC_MSG_WARN("Use --with-sgen instead, --with-gc= controls Boehm configuration")
  1059. ;;
  1060. xnone)
  1061. AC_MSG_WARN("Compiling mono without GC.")
  1062. AC_DEFINE_UNQUOTED(DEFAULT_GC_NAME, "none", [GC description])
  1063. AC_DEFINE(HAVE_NULL_GC,1,[No GC support.])
  1064. gc_msg="none"
  1065. ;;
  1066. *)
  1067. AC_MSG_ERROR([Invalid argument to --with-gc.])
  1068. ;;
  1069. esac
  1070. AC_ARG_WITH(large-heap, [ --with-large-heap=yes,no Enable support for GC heaps larger than 3GB (defaults to no)], [large_heap=$withval], [large_heap=no])
  1071. if test "x$large_heap" = "xyes"; then
  1072. CPPFLAGS="$CPPFLAGS -DLARGE_CONFIG"
  1073. fi
  1074. AC_SUBST(LIBGC_CPPFLAGS)
  1075. AC_SUBST(LIBGC_LIBS)
  1076. AC_SUBST(LIBGC_STATIC_LIBS)
  1077. AC_SUBST(libgc_dir)
  1078. AC_SUBST(BOEHM_DEFINES)
  1079. fi
  1080. dnl
  1081. dnl End of Boehm GC Configuration
  1082. dnl
  1083. dnl *************************************
  1084. dnl *** Checks for zero length arrays ***
  1085. dnl *************************************
  1086. AC_MSG_CHECKING(whether $CC supports zero length arrays)
  1087. AC_TRY_COMPILE([
  1088. struct s {
  1089. int length;
  1090. char data [0];
  1091. };
  1092. ], [], [
  1093. AC_MSG_RESULT(yes)
  1094. AC_DEFINE_UNQUOTED(MONO_ZERO_LEN_ARRAY, 0, [Length of zero length arrays])
  1095. ], [
  1096. AC_MSG_RESULT(no)
  1097. AC_DEFINE_UNQUOTED(MONO_ZERO_LEN_ARRAY, 1, [Length of zero length arrays])
  1098. ])
  1099. AC_CHECK_HEADERS(nacl/nacl_dyncode.h)
  1100. dnl ***********************************
  1101. dnl *** Checks for signals
  1102. dnl ***********************************
  1103. AC_CHECK_HEADERS(signal.h)
  1104. AC_CHECK_FUNCS(sigaction)
  1105. AC_CHECK_FUNCS(kill)
  1106. AC_CHECK_FUNCS(signal)
  1107. # signal() is declared inline in Android headers
  1108. # so we need to workaround it by overriding the check.
  1109. if test x$platform_android = xyes; then
  1110. AC_DEFINE(HAVE_SIGNAL,1)
  1111. fi
  1112. if test x$host_win32 = xno; then
  1113. dnl hires monotonic clock support
  1114. AC_SEARCH_LIBS(clock_gettime, rt)
  1115. AC_CHECK_FUNCS(clock_nanosleep)
  1116. dnl dynamic loader support
  1117. AC_CHECK_FUNC(dlopen, DL_LIB="",
  1118. AC_CHECK_LIB(dl, dlopen, DL_LIB="-ldl", dl_support=no)
  1119. )
  1120. if test x$dl_support = xno; then
  1121. AC_MSG_WARN([No dynamic loading support available])
  1122. else
  1123. LIBS="$LIBS $DL_LIB"
  1124. AC_DEFINE(HAVE_DL_LOADER,1,[dlopen-based dynamic loader available])
  1125. dnl from glib's configure.ac
  1126. AC_CACHE_CHECK([for preceeding underscore in symbols],
  1127. mono_cv_uscore,[
  1128. AC_TRY_RUN([#include <dlfcn.h>
  1129. int mono_underscore_test (void) { return 42; }
  1130. int main() {
  1131. void *f1 = (void*)0, *f2 = (void*)0, *handle;
  1132. handle = dlopen ((void*)0, 0);
  1133. if (handle) {
  1134. f1 = dlsym (handle, "mono_underscore_test");
  1135. f2 = dlsym (handle, "_mono_underscore_test");
  1136. } return (!f2 || f1);
  1137. }],
  1138. [mono_cv_uscore=yes],
  1139. [mono_cv_uscore=no],
  1140. [])
  1141. ])
  1142. if test "x$mono_cv_uscore" = "xyes"; then
  1143. MONO_DL_NEED_USCORE=1
  1144. else
  1145. MONO_DL_NEED_USCORE=0
  1146. fi
  1147. AC_SUBST(MONO_DL_NEED_USCORE)
  1148. AC_CHECK_FUNC(dlerror)
  1149. fi
  1150. dnl ******************************************************************
  1151. dnl *** Checks for the IKVM JNI interface library ***
  1152. dnl ******************************************************************
  1153. AC_ARG_WITH(ikvm-native, [ --with-ikvm-native=yes,no build the IKVM JNI interface library (defaults to yes)],[with_ikvm_native=$withval],[with_ikvm_native=$ikvm_native])
  1154. ikvm_native_dir=
  1155. if test x$with_ikvm_native = xyes; then
  1156. ikvm_native_dir=ikvm-native
  1157. jdk_headers_found="IKVM Native"
  1158. fi
  1159. AC_SUBST(ikvm_native_dir)
  1160. AC_CHECK_HEADERS(execinfo.h)
  1161. AC_CHECK_HEADERS(sys/auxv.h sys/resource.h)
  1162. AC_CHECK_FUNCS(getgrgid_r)
  1163. AC_CHECK_FUNCS(getgrnam_r)
  1164. AC_CHECK_FUNCS(getpwnam_r)
  1165. AC_CHECK_FUNCS(getpwuid_r)
  1166. AC_CHECK_FUNCS(getresuid)
  1167. AC_CHECK_FUNCS(setresuid)
  1168. AC_CHECK_FUNCS(kqueue)
  1169. AC_CHECK_FUNCS(backtrace_symbols)
  1170. AC_CHECK_FUNCS(mkstemp)
  1171. AC_CHECK_FUNCS(mmap)
  1172. AC_CHECK_FUNCS(madvise)
  1173. AC_CHECK_FUNCS(getrusage)
  1174. AC_CHECK_FUNCS(getpriority)
  1175. AC_CHECK_FUNCS(setpriority)
  1176. AC_CHECK_FUNCS(dl_iterate_phdr)
  1177. AC_CHECK_FUNCS(dladdr)
  1178. AC_CHECK_FUNCS(sysconf)
  1179. AC_CHECK_FUNCS(getrlimit)
  1180. AC_CHECK_FUNCS(prctl)
  1181. AC_CHECK_FUNCS(sched_getaffinity)
  1182. AC_CHECK_FUNCS(sched_setaffinity)
  1183. AC_CHECK_FUNCS(sched_getcpu)
  1184. dnl ****************************************************************
  1185. dnl *** Check for sched_setaffinity from glibc versions before ***
  1186. dnl *** 2.3.4. The older versions of the function only take 2 ***
  1187. dnl *** parameters, not 3. ***
  1188. dnl *** ***
  1189. dnl *** Because the interface change was not made in a minor ***
  1190. dnl *** version rev, the __GLIBC__ and __GLIBC_MINOR__ macros ***
  1191. dnl *** won't always indicate the interface sched_affinity has. ***
  1192. dnl ****************************************************************
  1193. AC_MSG_CHECKING(for sched_setaffinity from glibc < 2.3.4)
  1194. AC_TRY_COMPILE([#include <sched.h>], [
  1195. int mask = 1;
  1196. sched_setaffinity(0, &mask);
  1197. return 0;
  1198. ], [
  1199. # Yes, we have it...
  1200. AC_MSG_RESULT(yes)
  1201. AC_DEFINE(GLIBC_BEFORE_2_3_4_SCHED_SETAFFINITY, 1, [Have GLIBC_BEFORE_2_3_4_SCHED_SETAFFINITY])
  1202. ], [
  1203. # We have the new, three-parameter version
  1204. AC_MSG_RESULT(no)
  1205. ])
  1206. dnl ******************************************************************
  1207. dnl *** Check for large file support ***
  1208. dnl *** (If we were using autoconf 2.50 we'd use AC_SYS_LARGEFILE) ***
  1209. dnl ******************************************************************
  1210. # Check that off_t can represent 2**63 - 1 correctly, working around
  1211. # potential compiler bugs. Defines LARGE_FILE_SUPPORT, adds $1 to
  1212. # CPPFLAGS and sets $large_offt to yes if the test succeeds
  1213. large_offt=no
  1214. AC_DEFUN([LARGE_FILES], [
  1215. large_CPPFLAGS=$CPPFLAGS
  1216. CPPFLAGS="$CPPFLAGS $1"
  1217. AC_TRY_COMPILE([
  1218. #include <sys/types.h>
  1219. #include <limits.h>
  1220. ], [
  1221. /* Lifted this compile time assert method from: http://www.jaggersoft.com/pubs/CVu11_3.html */
  1222. #define COMPILE_TIME_ASSERT(pred) \
  1223. switch(0){case 0:case pred:;}
  1224. COMPILE_TIME_ASSERT(sizeof(off_t) * CHAR_BIT == 64);
  1225. ], [
  1226. AC_MSG_RESULT(ok)
  1227. AC_DEFINE(HAVE_LARGE_FILE_SUPPORT, 1, [Have large file support])
  1228. large_CPPFLAGS="$large_CPPFLAGS $1"
  1229. large_offt=yes
  1230. ], [
  1231. AC_MSG_RESULT(no)
  1232. ])
  1233. CPPFLAGS=$large_CPPFLAGS
  1234. ])
  1235. AC_MSG_CHECKING(if off_t is 64 bits wide)
  1236. LARGE_FILES("")
  1237. if test $large_offt = no; then
  1238. AC_MSG_CHECKING(if _FILE_OFFSET_BITS=64 gives 64 bit off_t)
  1239. LARGE_FILES("-D_FILE_OFFSET_BITS=64")
  1240. fi
  1241. if test $large_offt = no; then
  1242. AC_MSG_WARN([No 64 bit file size support available])
  1243. fi
  1244. dnl *****************************
  1245. dnl *** Checks for libsocket ***
  1246. dnl *****************************
  1247. AC_CHECK_LIB(socket, socket, LIBS="$LIBS -lsocket")
  1248. case "$host" in
  1249. *-*-*freebsd*)
  1250. dnl *****************************
  1251. dnl *** Checks for libinotify ***
  1252. dnl *****************************
  1253. AC_CHECK_LIB(inotify, inotify_init, LIBS="$LIBS -linotify")
  1254. esac
  1255. dnl *******************************
  1256. dnl *** Checks for MSG_NOSIGNAL ***
  1257. dnl *******************************
  1258. AC_MSG_CHECKING(for MSG_NOSIGNAL)
  1259. AC_TRY_COMPILE([#include <sys/socket.h>], [
  1260. int f = MSG_NOSIGNAL;
  1261. ], [
  1262. # Yes, we have it...
  1263. AC_MSG_RESULT(yes)
  1264. AC_DEFINE(HAVE_MSG_NOSIGNAL, 1, [Have MSG_NOSIGNAL])
  1265. ], [
  1266. # We'll have to use signals
  1267. AC_MSG_RESULT(no)
  1268. ])
  1269. dnl *****************************
  1270. dnl *** Checks for IPPROTO_IP ***
  1271. dnl *****************************
  1272. AC_MSG_CHECKING(for IPPROTO_IP)
  1273. AC_TRY_COMPILE([#include <netinet/in.h>], [
  1274. int level = IPPROTO_IP;
  1275. ], [
  1276. # Yes, we have it...
  1277. AC_MSG_RESULT(yes)
  1278. AC_DEFINE(HAVE_IPPROTO_IP, 1, [Have IPPROTO_IP])
  1279. ], [
  1280. # We'll have to use getprotobyname
  1281. AC_MSG_RESULT(no)
  1282. ])
  1283. dnl *******************************
  1284. dnl *** Checks for IPPROTO_IPV6 ***
  1285. dnl *******************************
  1286. AC_MSG_CHECKING(for IPPROTO_IPV6)
  1287. AC_TRY_COMPILE([#include <netinet/in.h>], [
  1288. int level = IPPROTO_IPV6;
  1289. ], [
  1290. # Yes, we have it...
  1291. AC_MSG_RESULT(yes)
  1292. AC_DEFINE(HAVE_IPPROTO_IPV6, 1, [Have IPPROTO_IPV6])
  1293. ], [
  1294. # We'll have to use getprotobyname
  1295. AC_MSG_RESULT(no)
  1296. ])
  1297. dnl ******************************
  1298. dnl *** Checks for IPPROTO_TCP ***
  1299. dnl ******************************
  1300. AC_MSG_CHECKING(for IPPROTO_TCP)
  1301. AC_TRY_COMPILE([#include <netinet/in.h>], [
  1302. int level = IPPROTO_TCP;
  1303. ], [
  1304. # Yes, we have it...
  1305. AC_MSG_RESULT(yes)
  1306. AC_DEFINE(HAVE_IPPROTO_TCP, 1, [Have IPPROTO_TCP])
  1307. ], [
  1308. # We'll have to use getprotobyname
  1309. AC_MSG_RESULT(no)
  1310. ])
  1311. dnl *****************************
  1312. dnl *** Checks for SOL_IP ***
  1313. dnl *****************************
  1314. AC_MSG_CHECKING(for SOL_IP)
  1315. AC_TRY_COMPILE([#include <netdb.h>], [
  1316. int level = SOL_IP;
  1317. ], [
  1318. # Yes, we have it...
  1319. AC_MSG_RESULT(yes)
  1320. AC_DEFINE(HAVE_SOL_IP, 1, [Have SOL_IP])
  1321. ], [
  1322. # We'll have to use getprotobyname
  1323. AC_MSG_RESULT(no)
  1324. ])
  1325. dnl *****************************
  1326. dnl *** Checks for SOL_IPV6 ***
  1327. dnl *****************************
  1328. AC_MSG_CHECKING(for SOL_IPV6)
  1329. AC_TRY_COMPILE([#include <netdb.h>], [
  1330. int level = SOL_IPV6;
  1331. ], [
  1332. # Yes, we have it...
  1333. AC_MSG_RESULT(yes)
  1334. AC_DEFINE(HAVE_SOL_IPV6, 1, [Have SOL_IPV6])
  1335. ], [
  1336. # We'll have to use getprotobyname
  1337. AC_MSG_RESULT(no)
  1338. ])
  1339. dnl *****************************
  1340. dnl *** Checks for SOL_TCP ***
  1341. dnl *****************************
  1342. AC_MSG_CHECKING(for SOL_TCP)
  1343. AC_TRY_COMPILE([#include <netdb.h>], [
  1344. int level = SOL_TCP;
  1345. ], [
  1346. # Yes, we have it...
  1347. AC_MSG_RESULT(yes)
  1348. AC_DEFINE(HAVE_SOL_TCP, 1, [Have SOL_TCP])
  1349. ], [
  1350. # We'll have to use getprotobyname
  1351. AC_MSG_RESULT(no)
  1352. ])
  1353. dnl *****************************
  1354. dnl *** Checks for IP_PKTINFO ***
  1355. dnl *****************************
  1356. AC_MSG_CHECKING(for IP_PKTINFO)
  1357. AC_TRY_COMPILE([#include <linux/in.h>], [
  1358. int level = IP_PKTINFO;
  1359. ], [
  1360. # Yes, we have it...
  1361. AC_MSG_RESULT(yes)
  1362. AC_DEFINE(HAVE_IP_PKTINFO, 1, [Have IP_PKTINFO])
  1363. ], [
  1364. AC_MSG_RESULT(no)
  1365. ])
  1366. dnl *****************************
  1367. dnl *** Checks for IPV6_PKTINFO ***
  1368. dnl *****************************
  1369. AC_MSG_CHECKING(for IPV6_PKTINFO)
  1370. AC_TRY_COMPILE([#include <netdb.h>], [
  1371. int level = IPV6_PKTINFO;
  1372. ], [
  1373. # Yes, we have it...
  1374. AC_MSG_RESULT(yes)
  1375. AC_DEFINE(HAVE_IPV6_PKTINFO, 1, [Have IPV6_PKTINFO])
  1376. ], [
  1377. AC_MSG_RESULT(no)
  1378. ])
  1379. dnl **********************************
  1380. dnl *** Checks for IP_DONTFRAG ***
  1381. dnl **********************************
  1382. AC_MSG_CHECKING(for IP_DONTFRAG)
  1383. AC_TRY_COMPILE([#include <netinet/in.h>], [
  1384. int level = IP_DONTFRAG;
  1385. ], [
  1386. # Yes, we have it...
  1387. AC_MSG_RESULT(yes)
  1388. AC_DEFINE(HAVE_IP_DONTFRAG, 1, [Have IP_DONTFRAG])
  1389. ], [
  1390. AC_MSG_RESULT(no)
  1391. ])
  1392. dnl **********************************
  1393. dnl *** Checks for IP_DONTFRAGMENT ***
  1394. dnl **********************************
  1395. AC_MSG_CHECKING(for IP_DONTFRAGMENT)
  1396. AC_TRY_COMPILE([#include <Ws2ipdef.h>], [
  1397. int level = IP_DONTFRAGMENT;
  1398. ], [
  1399. # Yes, we have it...
  1400. AC_MSG_RESULT(yes)
  1401. AC_DEFINE(HAVE_IP_DONTFRAGMENT, 1, [Have IP_DONTFRAGMENT])
  1402. ], [
  1403. AC_MSG_RESULT(no)
  1404. ])
  1405. dnl **********************************
  1406. dnl *** Checks for IP_MTU_DISCOVER ***
  1407. dnl **********************************
  1408. AC_MSG_CHECKING(for IP_MTU_DISCOVER)
  1409. AC_TRY_COMPILE([#include <linux/in.h>], [
  1410. int level = IP_MTU_DISCOVER;
  1411. ], [
  1412. # Yes, we have it...
  1413. AC_MSG_RESULT(yes)
  1414. AC_DEFINE(HAVE_IP_MTU_DISCOVER, 1, [Have IP_MTU_DISCOVER])
  1415. ], [
  1416. AC_MSG_RESULT(no)
  1417. ])
  1418. dnl **********************************
  1419. dnl *** Checks for IP_PMTUDISC_DO ***
  1420. dnl **********************************
  1421. AC_MSG_CHECKING(for IP_PMTUDISC_DO)
  1422. AC_TRY_COMPILE([#include <linux/in.h>], [
  1423. int level = IP_PMTUDISC_DO;
  1424. ], [
  1425. # Yes, we have it...
  1426. AC_MSG_RESULT(yes)
  1427. AC_DEFINE(HAVE_IP_PMTUDISC_DO, 1, [Have IP_PMTUDISC_DO])
  1428. ], [
  1429. AC_MSG_RESULT(no)
  1430. ])
  1431. dnl *********************************
  1432. dnl *** Check for struct ip_mreqn ***
  1433. dnl *********************************
  1434. AC_MSG_CHECKING(for struct ip_mreqn)
  1435. AC_TRY_COMPILE([#include <netinet/in.h>], [
  1436. struct ip_mreqn mreq;
  1437. mreq.imr_address.s_addr = 0;
  1438. ], [
  1439. # Yes, we have it...
  1440. AC_MSG_RESULT(yes)
  1441. AC_DEFINE(HAVE_STRUCT_IP_MREQN, 1, [Have struct ip_mreqn])
  1442. ], [
  1443. # We'll just have to try and use struct ip_mreq
  1444. AC_MSG_RESULT(no)
  1445. AC_MSG_CHECKING(for struct ip_mreq)
  1446. AC_TRY_COMPILE([#include <netinet/in.h>], [
  1447. struct ip_mreq mreq;
  1448. mreq.imr_interface.s_addr = 0;
  1449. ], [
  1450. # Yes, we have it...
  1451. AC_MSG_RESULT(yes)
  1452. AC_DEFINE(HAVE_STRUCT_IP_MREQ, 1, [Have struct ip_mreq])
  1453. ], [
  1454. # No multicast support
  1455. AC_MSG_RESULT(no)
  1456. ])
  1457. ])
  1458. dnl **********************************
  1459. dnl *** Check for getaddrinfo ***
  1460. dnl **********************************
  1461. AC_MSG_CHECKING(for getaddrinfo)
  1462. AC_TRY_LINK([
  1463. #include <stdio.h>
  1464. #include <netdb.h>
  1465. ], [
  1466. getaddrinfo(NULL,NULL,NULL,NULL);
  1467. ], [
  1468. # Yes, we have it...
  1469. AC_MSG_RESULT(yes)
  1470. AC_DEFINE(HAVE_GETADDRINFO, 1, [Have getaddrinfo])
  1471. ], [
  1472. AC_MSG_RESULT(no)
  1473. ])
  1474. dnl **********************************
  1475. dnl *** Check for gethostbyname2_r ***
  1476. dnl **********************************
  1477. AC_MSG_CHECKING(for gethostbyname2_r)
  1478. AC_TRY_LINK([
  1479. #include <stdio.h>
  1480. #include <netdb.h>
  1481. ], [
  1482. gethostbyname2_r(NULL,0,NULL,NULL,0,NULL,NULL);
  1483. ], [
  1484. # Yes, we have it...
  1485. AC_MSG_RESULT(yes)
  1486. AC_DEFINE(HAVE_GETHOSTBYNAME2_R, 1, [Have gethostbyname2_r])
  1487. ], [
  1488. AC_MSG_RESULT(no)
  1489. ])
  1490. dnl **********************************
  1491. dnl *** Check for gethostbyname2 ***
  1492. dnl **********************************
  1493. AC_MSG_CHECKING(for gethostbyname2)
  1494. AC_TRY_LINK([
  1495. #include <stdio.h>
  1496. #include <netdb.h>
  1497. ], [
  1498. gethostbyname2(NULL,0);
  1499. ], [
  1500. # Yes, we have it...
  1501. AC_MSG_RESULT(yes)
  1502. AC_DEFINE(HAVE_GETHOSTBYNAME2, 1, [Have gethostbyname2])
  1503. ], [
  1504. AC_MSG_RESULT(no)
  1505. ])
  1506. dnl **********************************
  1507. dnl *** Check for gethostbyname ***
  1508. dnl **********************************
  1509. AC_MSG_CHECKING(for gethostbyname)
  1510. AC_TRY_LINK([
  1511. #include <stdio.h>
  1512. #include <netdb.h>
  1513. ], [
  1514. gethostbyname(NULL);
  1515. ], [
  1516. # Yes, we have it...
  1517. AC_MSG_RESULT(yes)
  1518. AC_DEFINE(HAVE_GETHOSTBYNAME, 1, [Have gethostbyname])
  1519. ], [
  1520. AC_MSG_RESULT(no)
  1521. ])
  1522. dnl **********************************
  1523. dnl *** Check for getprotobyname ***
  1524. dnl **********************************
  1525. AC_MSG_CHECKING(for getprotobyname)
  1526. AC_TRY_LINK([
  1527. #include <stdio.h>
  1528. #include <netdb.h>
  1529. ], [
  1530. getprotobyname(NULL);
  1531. ], [
  1532. # Yes, we have it...
  1533. AC_MSG_RESULT(yes)
  1534. AC_DEFINE(HAVE_GETPROTOBYNAME, 1, [Have getprotobyname])
  1535. ], [
  1536. AC_MSG_RESULT(no)
  1537. ])
  1538. dnl **********************************
  1539. dnl *** Check for getnameinfo ***
  1540. dnl **********************************
  1541. AC_MSG_CHECKING(for getnameinfo)
  1542. AC_TRY_LINK([
  1543. #include <stdio.h>
  1544. #include <netdb.h>
  1545. ], [
  1546. getnameinfo (NULL, 0, NULL, 0, NULL, 0, 0);
  1547. ], [
  1548. # Yes, we have it...
  1549. AC_MSG_RESULT(yes)
  1550. AC_DEFINE(HAVE_GETNAMEINFO, 1, [Have getnameinfo])
  1551. ], [
  1552. AC_MSG_RESULT(no)
  1553. ])
  1554. dnl **********************************
  1555. dnl *** Check for inet_ntop ***
  1556. dnl **********************************
  1557. AC_MSG_CHECKING(for inet_ntop)
  1558. AC_TRY_LINK([
  1559. #include <stdio.h>
  1560. #include <arpa/inet.h>
  1561. ], [
  1562. inet_ntop (0, NULL, NULL, 0);
  1563. ], [
  1564. # Yes, we have it...
  1565. AC_MSG_RESULT(yes)
  1566. AC_DEFINE(HAVE_INET_NTOP, 1, [Have inet_ntop])
  1567. ], [
  1568. AC_MSG_RESULT(no)
  1569. ])
  1570. dnl *****************************
  1571. dnl *** Checks for libnsl ***
  1572. dnl *****************************
  1573. AC_CHECK_FUNC(gethostbyaddr, , AC_CHECK_LIB(nsl, gethostbyaddr, LIBS="$LIBS -lnsl"))
  1574. AC_CHECK_FUNCS(inet_pton inet_aton)
  1575. dnl *****************************
  1576. dnl *** Checks for libxnet ***
  1577. dnl *****************************
  1578. case "${host}" in
  1579. *solaris* )
  1580. AC_MSG_CHECKING(for Solaris XPG4 support)
  1581. if test -f /usr/lib/libxnet.so; then
  1582. CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=500"
  1583. CPPFLAGS="$CPPFLAGS -D__EXTENSIONS__"
  1584. CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE_EXTENDED=1"
  1585. LIBS="$LIBS -lxnet"
  1586. AC_MSG_RESULT(yes)
  1587. else
  1588. AC_MSG_RESULT(no)
  1589. fi
  1590. if test "$GCC" = "yes"; then
  1591. CFLAGS="$CFLAGS -Wno-char-subscripts"
  1592. fi
  1593. ;;
  1594. esac
  1595. dnl *****************************
  1596. dnl *** Checks for libpthread ***
  1597. dnl *****************************
  1598. # on FreeBSD -STABLE, the pthreads functions all reside in libc_r
  1599. # and libpthread does not exist
  1600. #
  1601. case "${host}" in
  1602. *-*-*freebsd*)
  1603. AC_CHECK_LIB(pthread, main, LIBS="$LIBS -pthread")
  1604. ;;
  1605. *-*-*openbsd*)
  1606. AC_CHECK_LIB(pthread, main, LIBS="$LIBS -pthread")
  1607. ;;
  1608. *)
  1609. AC_CHECK_LIB(pthread, main, LIBS="$LIBS -lpthread")
  1610. ;;
  1611. esac
  1612. AC_CHECK_HEADERS(pthread.h)
  1613. AC_CHECK_HEADERS(pthread_np.h)
  1614. AC_CHECK_FUNCS(pthread_mutex_timedlock)
  1615. AC_CHECK_FUNCS(pthread_getattr_np pthread_attr_get_np pthread_setname_np)
  1616. AC_CHECK_FUNCS(pthread_kill)
  1617. AC_MSG_CHECKING(for PTHREAD_MUTEX_RECURSIVE)
  1618. AC_TRY_COMPILE([ #include <pthread.h>], [
  1619. pthread_mutexattr_t attr;
  1620. pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
  1621. ], [
  1622. AC_MSG_RESULT(ok)
  1623. ], [
  1624. AC_MSG_RESULT(no)
  1625. AC_ERROR(Posix system lacks support for recursive mutexes)
  1626. ])
  1627. AC_CHECK_FUNCS(pthread_attr_setstacksize)
  1628. AC_CHECK_FUNCS(pthread_attr_getstack pthread_attr_getstacksize)
  1629. AC_CHECK_FUNCS(pthread_get_stacksize_np pthread_get_stackaddr_np)
  1630. dnl **********************************
  1631. dnl *** Check for mincore ***
  1632. dnl **********************************
  1633. AC_MSG_CHECKING(for mincore)
  1634. AC_TRY_LINK([
  1635. #include <stdio.h>
  1636. #include <sys/types.h>
  1637. #include <sys/mman.h>
  1638. ], [
  1639. mincore(NULL, 0, NULL);
  1640. ], [
  1641. # Yes, we have it...
  1642. AC_MSG_RESULT(yes)
  1643. AC_DEFINE(HAVE_MINCORE, 1, [Have mincore])
  1644. ], [
  1645. AC_MSG_RESULT(no)
  1646. ])
  1647. dnl ***********************************
  1648. dnl *** Checks for working __thread ***
  1649. dnl ***********************************
  1650. AC_MSG_CHECKING(for working __thread)
  1651. if test "x$with_tls" != "x__thread"; then
  1652. AC_MSG_RESULT(disabled)
  1653. elif test "x$cross_compiling" = "xyes"; then
  1654. AC_MSG_RESULT(cross compiling, assuming yes)
  1655. else
  1656. AC_TRY_RUN([
  1657. #if defined(__APPLE__) && defined(__clang__)
  1658. #error "__thread does not currently work with clang on Mac OS X"
  1659. #endif
  1660. #include <pthread.h>
  1661. __thread int i;
  1662. static int res1, res2;
  1663. void thread_main (void *arg)
  1664. {
  1665. i = arg;
  1666. sleep (1);
  1667. if (arg == 1)
  1668. res1 = (i == arg);
  1669. else
  1670. res2 = (i == arg);
  1671. }
  1672. int main () {
  1673. pthread_t t1, t2;
  1674. i = 5;
  1675. pthread_create (&t1, NULL, thread_main, 1);
  1676. pthread_create (&t2, NULL, thread_main, 2);
  1677. pthread_join (t1, NULL);
  1678. pthread_join (t2, NULL);
  1679. return !(res1 + res2 == 2);
  1680. }
  1681. ], [
  1682. AC_MSG_RESULT(yes)
  1683. ], [
  1684. AC_MSG_RESULT(no)
  1685. with_tls=pthread
  1686. ])
  1687. fi
  1688. dnl **************************************
  1689. dnl *** Checks for working sigaltstack ***
  1690. dnl **************************************
  1691. AC_MSG_CHECKING(for working sigaltstack)
  1692. if test "x$with_sigaltstack" != "xyes"; then
  1693. AC_MSG_RESULT(disabled)
  1694. elif test "x$cross_compiling" = "xyes"; then
  1695. AC_MSG_RESULT(cross compiling, assuming yes)
  1696. else
  1697. AC_TRY_RUN([
  1698. #include <stdio.h>
  1699. #include <stdlib.h>
  1700. #include <unistd.h>
  1701. #include <signal.h>
  1702. #include <pthread.h>
  1703. #include <sys/wait.h>
  1704. #if defined(__FreeBSD__) || defined(__NetBSD__)
  1705. #define SA_STACK SA_ONSTACK
  1706. #endif
  1707. static void
  1708. sigsegv_signal_handler (int _dummy, siginfo_t *info, void *context)
  1709. {
  1710. exit (0);
  1711. }
  1712. volatile char*__ptr = NULL;
  1713. static void *
  1714. loop (void *ignored)
  1715. {
  1716. *__ptr = 0;
  1717. return NULL;
  1718. }
  1719. static void
  1720. child ()
  1721. {
  1722. struct sigaction sa;
  1723. #ifdef __APPLE__
  1724. stack_t sas;
  1725. #else
  1726. struct sigaltstack sas;
  1727. #endif
  1728. pthread_t id;
  1729. pthread_attr_t attr;
  1730. sa.sa_sigaction = sigsegv_signal_handler;
  1731. sigemptyset (&sa.sa_mask);
  1732. sa.sa_flags = SA_SIGINFO | SA_ONSTACK;
  1733. if (sigaction (SIGSEGV, &sa, NULL) == -1) {
  1734. perror ("sigaction");
  1735. return;
  1736. }
  1737. /* x86 darwin deliver segfaults using SIGBUS */
  1738. if (sigaction (SIGBUS, &sa, NULL) == -1) {
  1739. perror ("sigaction");
  1740. return;
  1741. }
  1742. sas.ss_sp = malloc (SIGSTKSZ);
  1743. sas.ss_size = SIGSTKSZ;
  1744. sas.ss_flags = 0;
  1745. if (sigaltstack (&sas, NULL) == -1) {
  1746. perror ("sigaltstack");
  1747. return;
  1748. }
  1749. pthread_attr_init (&attr);
  1750. if (pthread_create(&id, &attr, loop, &attr) != 0) {
  1751. printf ("pthread_create\n");
  1752. return;
  1753. }
  1754. sleep (100);
  1755. }
  1756. int
  1757. main ()
  1758. {
  1759. pid_t son;
  1760. int status;
  1761. int i;
  1762. son = fork ();
  1763. if (son == -1) {
  1764. return 1;
  1765. }
  1766. if (son == 0) {
  1767. child ();
  1768. return 0;
  1769. }
  1770. for (i = 0; i < 300; ++i) {
  1771. waitpid (son, &status, WNOHANG);
  1772. if (WIFEXITED (status) && WEXITSTATUS (status) == 0)
  1773. return 0;
  1774. usleep (10000);
  1775. }
  1776. kill (son, SIGKILL);
  1777. return 1;
  1778. }
  1779. ], [
  1780. AC_MSG_RESULT(yes)
  1781. AC_DEFINE(HAVE_WORKING_SIGALTSTACK, 1, [Have a working sigaltstack])
  1782. ], [
  1783. with_sigaltstack=no
  1784. AC_MSG_RESULT(no)
  1785. ])
  1786. fi
  1787. dnl ********************************
  1788. dnl *** Checks for semaphore lib ***
  1789. dnl ********************************
  1790. # 'Real Time' functions on Solaris
  1791. # posix4 on Solaris 2.6
  1792. # pthread (first!) on Linux
  1793. AC_SEARCH_LIBS(sem_init, pthread rt posix4)
  1794. AC_SEARCH_LIBS(shm_open, pthread rt posix4)
  1795. AC_CHECK_FUNCS(shm_open)
  1796. dnl ********************************
  1797. dnl *** Checks for timezone stuff **
  1798. dnl ********************************
  1799. AC_CACHE_CHECK(for tm_gmtoff in struct tm, ac_cv_struct_tm_gmtoff,
  1800. AC_TRY_COMPILE([
  1801. #include <time.h>
  1802. ], [
  1803. struct tm tm;
  1804. tm.tm_gmtoff = 1;
  1805. ], ac_cv_struct_tm_gmtoff=yes, ac_cv_struct_tm_gmtoff=no))
  1806. if test $ac_cv_struct_tm_gmtoff = yes; then
  1807. AC_DEFINE(HAVE_TM_GMTOFF, 1, [Have tm_gmtoff])
  1808. else
  1809. AC_CACHE_CHECK(for timezone variable, ac_cv_var_timezone,
  1810. AC_TRY_COMPILE([
  1811. #include <time.h>
  1812. ], [
  1813. timezone = 1;
  1814. ], ac_cv_var_timezone=yes, ac_cv_var_timezone=no))
  1815. if test $ac_cv_var_timezone = yes; then
  1816. AC_DEFINE(HAVE_TIMEZONE, 1, [Have timezone variable])
  1817. else
  1818. AC_ERROR(unable to find a way to determine timezone)
  1819. fi
  1820. fi
  1821. dnl *********************************
  1822. dnl *** Checks for math functions ***
  1823. dnl *********************************
  1824. AC_SEARCH_LIBS(sqrtf, m)
  1825. if test "x$has_broken_apple_cpp" != "xyes"; then
  1826. AC_CHECK_FUNCS(finite, , AC_MSG_CHECKING(for finite in math.h)
  1827. AC_TRY_LINK([#include <math.h>],
  1828. [ finite(0.0); ],
  1829. AC_DEFINE(HAVE_FINITE, 1, [Have finite in -lm]) AC_MSG_RESULT(yes),
  1830. AC_MSG_RESULT(no)))
  1831. fi
  1832. AC_CHECK_FUNCS(isfinite, , AC_MSG_CHECKING(for isfinite in math.h)
  1833. AC_TRY_LINK([#include <math.h>],
  1834. [ isfinite(0.0); ],
  1835. AC_DEFINE(HAVE_ISFINITE, 1, [Have isfinite]) AC_MSG_RESULT(yes),
  1836. AC_MSG_RESULT(no)))
  1837. dnl ****************************************************************
  1838. dnl *** Checks for working poll() (macosx defines it but doesn't ***
  1839. dnl *** have it in the library (duh)) ***
  1840. dnl ****************************************************************
  1841. AC_CHECK_FUNCS(poll)
  1842. dnl *************************
  1843. dnl *** Check for signbit ***
  1844. dnl *************************
  1845. AC_MSG_CHECKING(for signbit)
  1846. AC_TRY_LINK([#include <math.h>], [
  1847. int s = signbit(1.0);
  1848. ], [
  1849. AC_MSG_RESULT(yes)
  1850. AC_DEFINE(HAVE_SIGNBIT, 1, [Have signbit])
  1851. ], [
  1852. AC_MSG_RESULT(no)
  1853. ])
  1854. dnl **********************************
  1855. dnl *** epoll ***
  1856. dnl **********************************
  1857. if test "x$ac_cv_header_nacl_nacl_dyncode_h" = "xno"; then
  1858. AC_CHECK_HEADERS(sys/epoll.h)
  1859. haveepoll=no
  1860. AC_CHECK_FUNCS(epoll_ctl, [haveepoll=yes], )
  1861. if test "x$haveepoll" = "xyes" -a "x$ac_cv_header_sys_epoll_h" = "xyes"; then
  1862. AC_DEFINE(HAVE_EPOLL, 1, [epoll supported])
  1863. fi
  1864. fi
  1865. havekqueue=no
  1866. AC_CHECK_HEADERS(sys/event.h)
  1867. AC_CHECK_FUNCS(kqueue, [havekqueue=yes], )
  1868. dnl **************************************
  1869. dnl * Darwin has a race that prevents us from using reliably:
  1870. dnl * http://lists.apple.com/archives/darwin-dev/2011/Jun/msg00016.html
  1871. dnl * Since kqueue is mostly used for scaling large web servers,
  1872. dnl * and very few folks run Mono on large web servers on OSX, falling
  1873. dnl * back
  1874. dnl **************************************
  1875. if test "x$havekqueue" = "xyes" -a "x$ac_cv_header_sys_event_h" = "xyes"; then
  1876. if test "x$host_darwin" = "xno"; then
  1877. AC_DEFINE(USE_KQUEUE_FOR_THREADPOOL, 1, [Use kqueue for the threadpool])
  1878. fi
  1879. fi
  1880. dnl ******************************
  1881. dnl *** Checks for SIOCGIFCONF ***
  1882. dnl ******************************
  1883. AC_CHECK_HEADERS(sys/ioctl.h)
  1884. AC_CHECK_HEADERS(net/if.h, [], [],
  1885. [
  1886. #ifdef HAVE_SYS_TYPES_H
  1887. # include <sys/types.h>
  1888. #endif
  1889. #ifdef HAVE_SYS_SOCKET_H
  1890. # include <sys/socket.h>
  1891. #endif
  1892. ])
  1893. AC_MSG_CHECKING(for ifreq)
  1894. AC_TRY_COMPILE([
  1895. #include <stdio.h>
  1896. #include <sys/ioctl.h>
  1897. #include <net/if.h>
  1898. ], [
  1899. struct ifconf ifc;
  1900. struct ifreq *ifr;
  1901. void *x;
  1902. ifc.ifc_len = 0;
  1903. ifc.ifc_buf = NULL;
  1904. x = (void *) &ifr->ifr_addr;
  1905. ],[
  1906. AC_MSG_RESULT(yes)
  1907. AC_DEFINE(HAVE_SIOCGIFCONF, 1, [Can get interface list])
  1908. ], [
  1909. AC_MSG_RESULT(no)
  1910. ])
  1911. dnl **********************************
  1912. dnl *** Checks for sin_len ***
  1913. dnl **********************************
  1914. AC_MSG_CHECKING(for sockaddr_in.sin_len)
  1915. AC_TRY_COMPILE([
  1916. #include <netinet/in.h>
  1917. ], [
  1918. struct sockaddr_in saddr;
  1919. saddr.sin_len = sizeof (saddr);
  1920. ],[
  1921. AC_MSG_RESULT(yes)
  1922. AC_DEFINE(HAVE_SOCKADDR_IN_SIN_LEN, 1, [sockaddr_in has sin_len])
  1923. ], [
  1924. AC_MSG_RESULT(no)
  1925. ])
  1926. dnl **********************************
  1927. dnl *** Checks for sin6_len ***
  1928. dnl **********************************
  1929. AC_MSG_CHECKING(for sockaddr_in6.sin6_len)
  1930. AC_TRY_COMPILE([
  1931. #include <netinet/in.h>
  1932. ], [
  1933. struct sockaddr_in6 saddr6;
  1934. saddr6.sin6_len = sizeof (saddr6);
  1935. ],[
  1936. AC_MSG_RESULT(yes)
  1937. AC_DEFINE(HAVE_SOCKADDR_IN6_SIN_LEN, 1, [sockaddr_in6 has sin6_len])
  1938. ], [
  1939. AC_MSG_RESULT(no)
  1940. ])
  1941. dnl **********************************
  1942. dnl *** Check for getifaddrs ***
  1943. dnl **********************************
  1944. AC_MSG_CHECKING(for getifaddrs)
  1945. AC_TRY_LINK([
  1946. #include <stdio.h>
  1947. #include <sys/types.h>
  1948. #include <sys/socket.h>
  1949. #include <ifaddrs.h>
  1950. ], [
  1951. getifaddrs(NULL);
  1952. ], [
  1953. # Yes, we have it...
  1954. AC_MSG_RESULT(yes)
  1955. AC_DEFINE(HAVE_GETIFADDRS, 1, [Have getifaddrs])
  1956. ], [
  1957. AC_MSG_RESULT(no)
  1958. ])
  1959. dnl **********************************
  1960. dnl *** Check for if_nametoindex ***
  1961. dnl **********************************
  1962. AC_MSG_CHECKING(for if_nametoindex)
  1963. AC_TRY_LINK([
  1964. #include <stdio.h>
  1965. #include <sys/types.h>
  1966. #include <sys/socket.h>
  1967. #include <net/if.h>
  1968. ], [
  1969. if_nametoindex(NULL);
  1970. ], [
  1971. # Yes, we have it...
  1972. AC_MSG_RESULT(yes)
  1973. AC_DEFINE(HAVE_IF_NAMETOINDEX, 1, [Have if_nametoindex])
  1974. ], [
  1975. AC_MSG_RESULT(no)
  1976. ])
  1977. dnl **********************************
  1978. dnl *** Checks for MonoPosixHelper ***
  1979. dnl **********************************
  1980. AC_CHECK_HEADERS(checklist.h)
  1981. AC_CHECK_HEADERS(pathconf.h)
  1982. AC_CHECK_HEADERS(fstab.h)
  1983. AC_CHECK_HEADERS(attr/xattr.h)
  1984. AC_CHECK_HEADERS(sys/extattr.h)
  1985. AC_CHECK_HEADERS(sys/sendfile.h)
  1986. AC_CHECK_HEADERS(sys/statvfs.h)
  1987. AC_CHECK_HEADERS(sys/statfs.h)
  1988. AC_CHECK_HEADERS(sys/vfstab.h)
  1989. AC_CHECK_HEADERS(sys/xattr.h)
  1990. AC_CHECK_HEADERS(sys/mman.h)
  1991. AC_CHECK_HEADERS(sys/param.h)
  1992. AC_CHECK_HEADERS(sys/mount.h, [], [],
  1993. [
  1994. #ifdef HAVE_SYS_PARAM_H
  1995. # include <sys/param.h>
  1996. #endif
  1997. ])
  1998. AC_CHECK_HEADERS(sys/mount.h)
  1999. AC_CHECK_FUNCS(confstr)
  2000. AC_CHECK_FUNCS(seekdir telldir)
  2001. AC_CHECK_FUNCS(getdomainname)
  2002. AC_CHECK_FUNCS(setdomainname)
  2003. AC_CHECK_FUNCS(endgrent getgrent fgetgrent setgrent)
  2004. AC_CHECK_FUNCS(setgroups)
  2005. AC_CHECK_FUNCS(endpwent getpwent fgetpwent setpwent)
  2006. AC_CHECK_FUNCS(getfsstat)
  2007. AC_CHECK_FUNCS(lutimes futimes)
  2008. AC_CHECK_FUNCS(mremap)
  2009. AC_CHECK_FUNCS(remap_file_pages)
  2010. AC_CHECK_FUNCS(posix_fadvise)
  2011. AC_CHECK_FUNCS(posix_fallocate)
  2012. AC_CHECK_FUNCS(posix_madvise)
  2013. AC_CHECK_FUNCS(vsnprintf)
  2014. AC_CHECK_FUNCS(sendfile)
  2015. AC_CHECK_FUNCS(gethostid sethostid)
  2016. AC_CHECK_FUNCS(sethostname)
  2017. AC_CHECK_FUNCS(statfs)
  2018. AC_CHECK_FUNCS(fstatfs)
  2019. AC_CHECK_FUNCS(statvfs)
  2020. AC_CHECK_FUNCS(fstatvfs)
  2021. AC_CHECK_FUNCS(stime)
  2022. AC_CHECK_FUNCS(strerror_r)
  2023. AC_CHECK_FUNCS(ttyname_r)
  2024. AC_CHECK_FUNCS(psignal)
  2025. AC_CHECK_FUNCS(getlogin_r)
  2026. AC_CHECK_FUNCS(lockf)
  2027. AC_CHECK_FUNCS(swab)
  2028. AC_CHECK_FUNCS(setusershell endusershell)
  2029. AC_CHECK_FUNCS(futimens utimensat)
  2030. AC_CHECK_FUNCS(fstatat mknodat readlinkat)
  2031. AC_CHECK_FUNCS(readv writev preadv pwritev)
  2032. AC_CHECK_FUNCS(setpgid)
  2033. AC_CHECK_FUNCS(system)
  2034. AC_CHECK_FUNCS(fork execv execve)
  2035. AC_CHECK_FUNCS(accept4)
  2036. AC_CHECK_SIZEOF(size_t)
  2037. AC_CHECK_TYPES([blksize_t], [AC_DEFINE(HAVE_BLKSIZE_T)], ,
  2038. [#include <sys/types.h>
  2039. #include <sys/stat.h>
  2040. #include <unistd.h>])
  2041. AC_CHECK_TYPES([blkcnt_t], [AC_DEFINE(HAVE_BLKCNT_T)], ,
  2042. [#include <sys/types.h>
  2043. #include <sys/stat.h>
  2044. #include <unistd.h>])
  2045. AC_CHECK_TYPES([suseconds_t], [AC_DEFINE(HAVE_SUSECONDS_T)], ,
  2046. [#include <sys/time.h>])
  2047. AC_CHECK_TYPES([struct cmsghdr], [AC_DEFINE(HAVE_STRUCT_CMSGHDR)], ,
  2048. [#include <sys/socket.h>])
  2049. AC_CHECK_TYPES([struct flock], [AC_DEFINE(HAVE_STRUCT_FLOCK)], ,
  2050. [#include <unistd.h>
  2051. #include <fcntl.h>])
  2052. AC_CHECK_TYPES([struct iovec], [AC_DEFINE(HAVE_STRUCT_IOVEC)], ,
  2053. [#include <sys/uio.h>])
  2054. AC_CHECK_TYPES([struct linger], [AC_DEFINE(HAVE_STRUCT_LINGER)], ,
  2055. [#include <sys/socket.h>])
  2056. AC_CHECK_TYPES([struct pollfd], [AC_DEFINE(HAVE_STRUCT_POLLFD)], ,
  2057. [#include <sys/poll.h>])
  2058. AC_CHECK_TYPES([struct sockaddr], [AC_DEFINE(HAVE_STRUCT_SOCKADDR)], ,
  2059. [#include <sys/socket.h>])
  2060. AC_CHECK_TYPES([struct sockaddr_storage], [AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE)], ,
  2061. [#include <sys/socket.h>])
  2062. AC_CHECK_TYPES([struct sockaddr_in], [AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN)], ,
  2063. [#include <netinet/in.h>])
  2064. AC_CHECK_TYPES([struct sockaddr_in6], [AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6)], ,
  2065. [#include <netinet/in.h>])
  2066. AC_CHECK_TYPES([struct sockaddr_un], [AC_DEFINE(HAVE_STRUCT_SOCKADDR_UN)], ,
  2067. [#include <sys/un.h>])
  2068. AC_CHECK_TYPES([struct stat], [AC_DEFINE(HAVE_STRUCT_STAT)], ,
  2069. [#include <sys/types.h>
  2070. #include <sys/stat.h>
  2071. #include <unistd.h>])
  2072. AC_CHECK_TYPES([struct timespec], [AC_DEFINE(HAVE_STRUCT_TIMESPEC)], ,
  2073. [#include <time.h>])
  2074. AC_CHECK_TYPES([struct timeval], [AC_DEFINE(HAVE_STRUCT_TIMEVAL)], ,
  2075. [#include <sys/time.h>
  2076. #include <sys/types.h>
  2077. #include <utime.h>])
  2078. AC_CHECK_TYPES([struct timezone], [AC_DEFINE(HAVE_STRUCT_TIMEZONE)], ,
  2079. [#include <sys/time.h>])
  2080. AC_CHECK_TYPES([struct utimbuf], [AC_DEFINE(HAVE_STRUCT_UTIMBUF)], ,
  2081. [#include <sys/types.h>
  2082. #include <utime.h>])
  2083. AC_CHECK_MEMBERS(
  2084. [struct dirent.d_off, struct dirent.d_reclen, struct dirent.d_type],,,
  2085. [#include <sys/types.h>
  2086. #include <dirent.h>])
  2087. AC_CHECK_MEMBERS(
  2088. [struct passwd.pw_gecos],,,
  2089. [#include <sys/types.h>
  2090. #include <pwd.h>])
  2091. AC_CHECK_MEMBERS(
  2092. [struct statfs.f_flags],,,
  2093. [#include <sys/types.h>
  2094. #include <sys/vfs.h>])
  2095. AC_CHECK_MEMBERS(
  2096. [struct stat.st_atim, struct stat.st_mtim, struct stat.st_ctim],,,
  2097. [#include <sys/types.h>
  2098. #include <sys/stat.h>
  2099. #include <unistd.h>])
  2100. dnl Favour xattr through glibc, but use libattr if we have to
  2101. AC_CHECK_FUNC(lsetxattr, ,
  2102. AC_CHECK_LIB(attr, lsetxattr, XATTR_LIB="-lattr",)
  2103. )
  2104. AC_SUBST(XATTR_LIB)
  2105. dnl kinfo_proc.kp_proc works on darwin but fails on other simil-bsds
  2106. AC_CHECK_MEMBERS(
  2107. [struct kinfo_proc.kp_proc],,,
  2108. [#include <sys/types.h>
  2109. #include <sys/param.h>
  2110. #include <sys/sysctl.h>
  2111. #include <sys/proc.h>
  2112. ])
  2113. dnl *********************************
  2114. dnl *** Checks for Windows compilation ***
  2115. dnl *********************************
  2116. AC_CHECK_HEADERS(sys/time.h)
  2117. AC_CHECK_HEADERS(sys/param.h)
  2118. AC_CHECK_HEADERS(dirent.h)
  2119. dnl ******************************************
  2120. dnl *** Checks for OSX and iOS compilation ***
  2121. dnl ******************************************
  2122. AC_CHECK_HEADERS(CommonCrypto/CommonDigest.h)
  2123. dnl *********************************
  2124. dnl *** Check for Console 2.0 I/O ***
  2125. dnl *********************************
  2126. AC_CHECK_HEADERS([curses.h])
  2127. AC_CHECK_HEADERS([term.h], [], [],
  2128. [#if HAVE_CURSES_H
  2129. #include <curses.h>
  2130. #endif
  2131. ])
  2132. AC_CHECK_HEADERS([termios.h])
  2133. else
  2134. dnl *********************************
  2135. dnl *** Checks for Windows compilation ***
  2136. dnl *********************************
  2137. AC_CHECK_HEADERS(winternl.h)
  2138. jdk_headers_found=no
  2139. AC_CHECK_LIB(ws2_32, main, LIBS="$LIBS -lws2_32", AC_ERROR(bad mingw install?))
  2140. AC_CHECK_LIB(psapi, main, LIBS="$LIBS -lpsapi", AC_ERROR(bad mingw install?))
  2141. AC_CHECK_LIB(ole32, main, LIBS="$LIBS -lole32", AC_ERROR(bad mingw install?))
  2142. AC_CHECK_LIB(winmm, main, LIBS="$LIBS -lwinmm", AC_ERROR(bad mingw install?))
  2143. AC_CHECK_LIB(oleaut32, main, LIBS="$LIBS -loleaut32", AC_ERROR(bad mingw install?))
  2144. AC_CHECK_LIB(advapi32, main, LIBS="$LIBS -ladvapi32", AC_ERROR(bad mingw install?))
  2145. AC_CHECK_LIB(version, main, LIBS="$LIBS -lversion", AC_ERROR(bad mingw install?))
  2146. dnl *********************************
  2147. dnl *** Check for struct ip_mreqn ***
  2148. dnl *********************************
  2149. AC_MSG_CHECKING(for struct ip_mreqn)
  2150. AC_TRY_COMPILE([#include <ws2tcpip.h>], [
  2151. struct ip_mreqn mreq;
  2152. mreq.imr_address.s_addr = 0;
  2153. ], [
  2154. # Yes, we have it...
  2155. AC_MSG_RESULT(yes)
  2156. AC_DEFINE(HAVE_STRUCT_IP_MREQN)
  2157. ], [
  2158. # We'll just have to try and use struct ip_mreq
  2159. AC_MSG_RESULT(no)
  2160. AC_MSG_CHECKING(for struct ip_mreq)
  2161. AC_TRY_COMPILE([#include <ws2tcpip.h>], [
  2162. struct ip_mreq mreq;
  2163. mreq.imr_interface.s_addr = 0;
  2164. ], [
  2165. # Yes, we have it...
  2166. AC_MSG_RESULT(yes)
  2167. AC_DEFINE(HAVE_STRUCT_IP_MREQ)
  2168. ], [
  2169. # No multicast support
  2170. AC_MSG_RESULT(no)
  2171. ])
  2172. ])
  2173. dnl **********************************
  2174. dnl *** Check for getaddrinfo ***
  2175. dnl **********************************
  2176. AC_MSG_CHECKING(for getaddrinfo)
  2177. AC_TRY_LINK([
  2178. #include <stdio.h>
  2179. #include <winsock2.h>
  2180. #include <ws2tcpip.h>
  2181. ], [
  2182. getaddrinfo(NULL,NULL,NULL,NULL);
  2183. ], [
  2184. # Yes, we have it...
  2185. AC_MSG_RESULT(yes)
  2186. AC_DEFINE(HAVE_GETADDRINFO, 1, [Have getaddrinfo])
  2187. ], [
  2188. AC_MSG_RESULT(no)
  2189. ])
  2190. dnl **********************************
  2191. dnl *** Check for gethostbyname ***
  2192. dnl **********************************
  2193. AC_MSG_CHECKING(for gethostbyname)
  2194. AC_TRY_LINK([
  2195. #include <stdio.h>
  2196. #include <winsock2.h>
  2197. #include <ws2tcpip.h>
  2198. ], [
  2199. gethostbyname(NULL);
  2200. ], [
  2201. # Yes, we have it...
  2202. AC_MSG_RESULT(yes)
  2203. AC_DEFINE(HAVE_GETHOSTBYNAME, 1, [Have gethostbyname])
  2204. ], [
  2205. AC_MSG_RESULT(no)
  2206. ])
  2207. dnl **********************************
  2208. dnl *** Check for getprotobyname ***
  2209. dnl **********************************
  2210. AC_MSG_CHECKING(for getprotobyname)
  2211. AC_TRY_LINK([
  2212. #include <stdio.h>
  2213. #include <winsock2.h>
  2214. #include <ws2tcpip.h>
  2215. ], [
  2216. getprotobyname(NULL);
  2217. ], [
  2218. # Yes, we have it...
  2219. AC_MSG_RESULT(yes)
  2220. AC_DEFINE(HAVE_GETPROTOBYNAME, 1, [Have getprotobyname])
  2221. ], [
  2222. AC_MSG_RESULT(no)
  2223. ])
  2224. dnl **********************************
  2225. dnl *** Check for getnameinfo ***
  2226. dnl **********************************
  2227. AC_MSG_CHECKING(for getnameinfo)
  2228. AC_TRY_LINK([
  2229. #include <stdio.h>
  2230. #include <winsock2.h>
  2231. #include <ws2tcpip.h>
  2232. ], [
  2233. getnameinfo (NULL, 0, NULL, 0, NULL, 0, 0);
  2234. ], [
  2235. # Yes, we have it...
  2236. AC_MSG_RESULT(yes)
  2237. AC_DEFINE(HAVE_GETNAMEINFO, 1, [Have getnameinfo])
  2238. ], [
  2239. AC_MSG_RESULT(no)
  2240. ])
  2241. dnl **********************************
  2242. dnl *** Check for inet_ntop ***
  2243. dnl **********************************
  2244. AC_MSG_CHECKING(for inet_ntop)
  2245. AC_TRY_LINK([
  2246. #include <stdio.h>
  2247. #include <winsock2.h>
  2248. #include <ws2tcpip.h>
  2249. ], [
  2250. inet_ntop (0, NULL, NULL, 0);
  2251. ], [
  2252. # Yes, we have it...
  2253. AC_MSG_RESULT(yes)
  2254. AC_DEFINE(HAVE_INET_NTOP, 1, [Have inet_ntop])
  2255. ], [
  2256. AC_MSG_RESULT(no)
  2257. ])
  2258. dnl **********************************
  2259. dnl *** Check for inet_pton ***
  2260. dnl **********************************
  2261. AC_MSG_CHECKING(for inet_pton)
  2262. AC_TRY_LINK([
  2263. #include <stdio.h>
  2264. #include <winsock2.h>
  2265. #include <ws2tcpip.h>
  2266. ], [
  2267. #ifndef inet_pton
  2268. (void) inet_pton;
  2269. #endif
  2270. inet_pton (0, NULL, NULL);
  2271. ], [
  2272. # Yes, we have it...
  2273. AC_MSG_RESULT(yes)
  2274. AC_DEFINE(HAVE_INET_PTON, 1, [Have inet_pton])
  2275. ], [
  2276. AC_MSG_RESULT(no)
  2277. ])
  2278. AC_CHECK_DECLS(InterlockedExchange64, [], [], [[#include <windows.h>]])
  2279. AC_CHECK_DECLS(InterlockedCompareExchange64, [], [], [[#include <windows.h>]])
  2280. AC_CHECK_DECLS(InterlockedDecrement64, [], [], [[#include <windows.h>]])
  2281. AC_CHECK_DECLS(InterlockedIncrement64, [], [], [[#include <windows.h>]])
  2282. AC_CHECK_DECLS(InterlockedAdd, [], [], [[#include <windows.h>]])
  2283. AC_CHECK_DECLS(InterlockedAdd64, [], [], [[#include <windows.h>]])
  2284. AC_CHECK_DECLS(__readfsdword, [], [], [[#include <windows.h>]])
  2285. fi
  2286. dnl socklen_t check
  2287. AC_MSG_CHECKING(for socklen_t)
  2288. AC_TRY_COMPILE([
  2289. #include <sys/types.h>
  2290. #include <sys/socket.h>
  2291. ],[
  2292. socklen_t foo;
  2293. ],[
  2294. ac_cv_c_socklen_t=yes
  2295. AC_DEFINE(HAVE_SOCKLEN_T, 1, [Have socklen_t])
  2296. AC_MSG_RESULT(yes)
  2297. ],[
  2298. AC_MSG_RESULT(no)
  2299. ])
  2300. AC_MSG_CHECKING(for array element initializer support)
  2301. AC_TRY_COMPILE([#include <sys/socket.h>], [
  2302. const int array[] = {[1] = 2,};
  2303. ], [
  2304. # Yes, we have it...
  2305. AC_MSG_RESULT(yes)
  2306. AC_DEFINE(HAVE_ARRAY_ELEM_INIT,1,[Supports C99 array initialization])
  2307. ], [
  2308. # We'll have to use signals
  2309. AC_MSG_RESULT(no)
  2310. ])
  2311. AC_CHECK_FUNCS(trunc, , AC_MSG_CHECKING(for trunc in math.h)
  2312. # Simply calling trunc (0.0) is no good since gcc will optimize the call away
  2313. AC_TRY_LINK([#include <math.h>],
  2314. [ static void *p = &trunc; ],
  2315. [
  2316. AC_DEFINE(HAVE_TRUNC)
  2317. AC_MSG_RESULT(yes)
  2318. ac_cv_trunc=yes
  2319. ],
  2320. AC_MSG_RESULT(no)))
  2321. if test "x$ac_cv_truncl" != "xyes"; then
  2322. AC_CHECK_LIB(sunmath, aintl, [ AC_DEFINE(HAVE_AINTL, 1, [Has the 'aintl' function]) LIBS="$LIBS -lsunmath"])
  2323. fi
  2324. AC_CHECK_FUNCS(execvp)
  2325. dnl ****************************
  2326. dnl *** Look for /dev/random ***
  2327. dnl ****************************
  2328. AC_MSG_CHECKING([if usage of random device is requested])
  2329. AC_ARG_ENABLE(dev-random,
  2330. [ --disable-dev-random disable the use of the random device (enabled by default)],
  2331. try_dev_random=$enableval, try_dev_random=yes)
  2332. AC_MSG_RESULT($try_dev_random)
  2333. case "{$build}" in
  2334. *-openbsd*)
  2335. NAME_DEV_RANDOM="/dev/srandom"
  2336. ;;
  2337. dnl Win32 does not have /dev/random, they have their own method...
  2338. *-mingw*|*-*-cygwin*)
  2339. ac_cv_have_dev_random=no
  2340. ;;
  2341. dnl Everywhere else, it's /dev/random
  2342. *)
  2343. NAME_DEV_RANDOM="/dev/random"
  2344. ;;
  2345. esac
  2346. AC_DEFINE_UNQUOTED(NAME_DEV_RANDOM, "$NAME_DEV_RANDOM", [Name of /dev/random])
  2347. dnl Now check if the device actually exists
  2348. if test "x$try_dev_random" = "xyes"; then
  2349. AC_CACHE_CHECK(for random device, ac_cv_have_dev_random,
  2350. [if test -r "$NAME_DEV_RANDOM" ; then
  2351. ac_cv_have_dev_random=yes; else ac_cv_have_dev_random=no; fi])
  2352. if test "x$ac_cv_have_dev_random" = "xyes"; then
  2353. AC_DEFINE(HAVE_CRYPT_RNG, 1, [Have /dev/random])
  2354. fi
  2355. else
  2356. AC_MSG_CHECKING(for random device)
  2357. ac_cv_have_dev_random=no
  2358. AC_MSG_RESULT(has been disabled)
  2359. fi
  2360. if test "x$host_win32" = "xyes"; then
  2361. AC_DEFINE(HAVE_CRYPT_RNG)
  2362. fi
  2363. if test "x$ac_cv_have_dev_random" = "xno" \
  2364. && test "x$host_win32" = "xno"; then
  2365. AC_MSG_WARN([[
  2366. ***
  2367. *** A system-provided entropy source was not found on this system.
  2368. *** Because of this, the System.Security.Cryptography random number generator
  2369. *** will throw a NotImplemented exception.
  2370. ***
  2371. *** If you are seeing this message, and you know your system DOES have an
  2372. *** entropy collection in place, please contact <[email protected]> and
  2373. *** provide information about the system and how to access the random device.
  2374. ***
  2375. *** Otherwise you can install either egd or prngd and set the environment
  2376. *** variable MONO_EGD_SOCKET to point to the daemon's socket to use that.
  2377. ***]])
  2378. fi
  2379. AC_ARG_ENABLE(bcl-opt, [ --disable-bcl-opt BCL is compiled with no optimizations (allows accurate BCL debugging)], test_bcl_opt=$enableval, test_bcl_opt=yes)
  2380. AC_ARG_ENABLE(perf-events, [ --enable-perf-events Enable using `perf` for profiling on Linux], test_perf_events=$enableval, test_perf_events=no)
  2381. if test "x$test_perf_events" = "xyes"; then
  2382. AC_DEFINE(ENABLE_PERF_EVENTS, 1, [Enable using `perf` for profiling on Linux])
  2383. AC_SUBST(ENABLE_PERF_EVENTS)
  2384. fi
  2385. AC_MSG_CHECKING([if big-arrays are to be enabled])
  2386. 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)
  2387. if test "x$enable_big_arrays" = "xyes" ; then
  2388. if test "x$ac_cv_sizeof_void_p" = "x8"; then
  2389. AC_DEFINE(MONO_BIG_ARRAYS,1,[Enable the allocation and indexing of arrays greater than Int32.MaxValue])
  2390. else
  2391. AC_MSG_ERROR([The allocation and indexing of arrays greater than Int32.MaxValue is not supported on this platform.])
  2392. fi
  2393. fi
  2394. AC_MSG_RESULT($enable_big_arrays)
  2395. dnl **************
  2396. dnl *** DTRACE ***
  2397. dnl **************
  2398. AC_ARG_ENABLE(dtrace,[ --enable-dtrace Enable DTrace probes], enable_dtrace=$enableval, enable_dtrace=$has_dtrace)
  2399. if test "x$enable_dtrace" = "xyes"; then
  2400. if test "x$has_dtrace" = "xno"; then
  2401. AC_MSG_ERROR([DTrace probes are not supported on this platform.])
  2402. fi
  2403. AC_PATH_PROG(DTRACE, [dtrace], [no], [$PATH:/usr/sbin])
  2404. if test "x$DTRACE" = "xno"; then
  2405. AC_MSG_RESULT([dtrace utility not found, dtrace support disabled.])
  2406. enable_dtrace=no
  2407. elif ! $DTRACE -h -s $srcdir/data/mono.d > /dev/null 2>&1; then
  2408. AC_MSG_RESULT([dtrace doesn't support -h option, dtrace support disabled.])
  2409. enable_dtrace=no
  2410. fi
  2411. fi
  2412. dtrace_g=no
  2413. if test "x$enable_dtrace" = "xyes"; then
  2414. AC_DEFINE(ENABLE_DTRACE, 1, [Enable DTrace probes])
  2415. DTRACEFLAGS=
  2416. if test "x$ac_cv_sizeof_void_p" = "x8"; then
  2417. case "$host" in
  2418. powerpc-*-darwin*)
  2419. DTRACEFLAGS="-arch ppc64"
  2420. ;;
  2421. i*86-*-darwin*)
  2422. DTRACEFLAGS="-arch x86_64"
  2423. ;;
  2424. *)
  2425. DTRACEFLAGS=-64
  2426. ;;
  2427. esac
  2428. else
  2429. case "$host" in
  2430. powerpc-*-darwin*)
  2431. DTRACEFLAGS="-arch ppc"
  2432. ;;
  2433. i*86-*-darwin*)
  2434. DTRACEFLAGS="-arch i386"
  2435. ;;
  2436. *)
  2437. DTRACEFLAGS=-32
  2438. ;;
  2439. esac
  2440. fi
  2441. AC_SUBST(DTRACEFLAGS)
  2442. case "$host" in
  2443. *-*-solaris*)
  2444. dtrace_g=yes
  2445. ;;
  2446. esac
  2447. AC_CHECK_HEADERS([sys/sdt.h])
  2448. fi
  2449. AM_CONDITIONAL(ENABLE_DTRACE, [test x$enable_dtrace = xyes])
  2450. AM_CONDITIONAL(DTRACE_G_REQUIRED, [test x$dtrace_g = xyes])
  2451. dnl **************
  2452. dnl *** NaCl ***
  2453. dnl **************
  2454. AC_ARG_ENABLE(nacl_codegen, [ --enable-nacl-codegen Enable Native Client code generation], enable_nacl_codegen=$enableval, enable_nacl_codegen=no)
  2455. AC_ARG_ENABLE(nacl_gc, [ --enable-nacl-gc Enable Native Client garbage collection], enable_nacl_gc=$enableval, enable_nacl_gc=no)
  2456. AM_CONDITIONAL(NACL_CODEGEN, test x$enable_nacl_codegen != xno)
  2457. dnl
  2458. dnl Hack to use system mono for operations in build/install not allowed in NaCl.
  2459. dnl
  2460. nacl_self_host=""
  2461. if test "x$ac_cv_header_nacl_nacl_dyncode_h" = "xyes"; then
  2462. nacl_self_host="nacl_self_host"
  2463. fi
  2464. AC_SUBST(nacl_self_host)
  2465. if test "x$enable_nacl_codegen" = "xyes"; then
  2466. MONO_NACL_ALIGN_MASK_OFF=1
  2467. AC_DEFINE(TARGET_NACL, 1, [...])
  2468. AC_DEFINE(__native_client_codegen__, 1, [...])
  2469. fi
  2470. if test "x$enable_nacl_gc" = "xyes"; then
  2471. if test "x$TARGET" = "xAMD64" -o "x$TARGET" = "xX86"; then
  2472. INSTRUMENT_CFLAG="-finstrument-for-thread-suspension"
  2473. else
  2474. # Not yet implemented
  2475. INSTRUMENT_CFLAG=""
  2476. fi
  2477. CPPFLAGS="$CPPFLAGS $INSTRUMENT_CFLAG -D__native_client_gc__"
  2478. fi
  2479. AC_SUBST(MONO_NACL_ALIGN_MASK_OFF)
  2480. dnl **************************
  2481. dnl *** AOT cross offsets ***
  2482. dnl **************************
  2483. AC_ARG_WITH(cross-offsets, [ --with-cross-offsets=<offsets file path> Explicit AOT cross offsets file],
  2484. AC_DEFINE_UNQUOTED(MONO_OFFSETS_FILE, "$withval", [AOT cross offsets file]))
  2485. dnl **************
  2486. dnl *** LLVM ***
  2487. dnl **************
  2488. AC_ARG_ENABLE(llvm,[ --enable-llvm Enable the LLVM back-end], enable_llvm=$enableval, enable_llvm=default)
  2489. AC_ARG_ENABLE(loadedllvm,[ --enable-loadedllvm Load the LLVM back-end dynamically], enable_llvm=$enableval && enable_loadedllvm=$enableval, enable_loadedllvm=no)
  2490. AC_ARG_ENABLE(llvm-version-check,[ --enable-llvm-version-check Check that the LLVM matches the version expected by mono], enable_llvm_version_check=$enableval, enable_llvm_version_check=no)
  2491. AC_ARG_ENABLE(llvm-runtime,[ --enable-llvm-runtime Enable runtime support for llvmonly code], enable_llvm_runtime=$enableval, enable_llvm_runtime=no)
  2492. AC_ARG_WITH(llvm, [ --with-llvm=<llvm prefix> Enable the LLVM back-end], enable_llvm=yes,)
  2493. if test "x$enable_llvm" = "xdefault"; then
  2494. enable_llvm=$enable_llvm_default
  2495. fi
  2496. if test "x$enable_llvm" = "xyes"; then
  2497. if test "x$with_llvm" != "x"; then
  2498. LLVM_CONFIG=$with_llvm/bin/llvm-config
  2499. if test x$host_win32 = xyes; then
  2500. LLVM_CONFIG=$LLVM_CONFIG.exe
  2501. fi
  2502. if test ! -x $LLVM_CONFIG; then
  2503. AC_MSG_ERROR([LLVM executable $LLVM_CONFIG not found.])
  2504. fi
  2505. else
  2506. AC_PATH_PROG(LLVM_CONFIG, llvm-config, no)
  2507. if test "x$LLVM_CONFIG" = "xno"; then
  2508. AC_MSG_ERROR([llvm-config not found.])
  2509. fi
  2510. fi
  2511. llvm_codegen="x86codegen"
  2512. case "$target" in
  2513. arm*)
  2514. llvm_codegen="armcodegen"
  2515. ;;
  2516. esac
  2517. if test "x$host_win32" = "xno"; then
  2518. # Should be something like '2.6' or '2.7svn'
  2519. llvm_version=`$LLVM_CONFIG --version`
  2520. llvm_api_version=`$LLVM_CONFIG --mono-api-version 2>/dev/null`
  2521. AC_MSG_CHECKING(LLVM version)
  2522. AC_MSG_RESULT($llvm_version $llvm_api_version)
  2523. if echo $llvm_version | grep -q 'mono'; then
  2524. if test "x$enable_llvm_version_check" = "xyes"; then
  2525. if test "$llvm_version" != "$expected_llvm_version"; then
  2526. AC_MSG_ERROR([Expected llvm version $expected_llvm_version, but llvm-config --version returned $llvm_version"])
  2527. fi
  2528. fi
  2529. else
  2530. AC_MSG_ERROR([Compiling with stock LLVM is not supported, please use the Mono LLVM repo at https://github.com/mono/llvm, with the GIT branch which matches this version of mono, i.e. 'mono-2-10' for Mono 2.10.])
  2531. fi
  2532. # The output of --cflags seems to include optimizations flags too
  2533. if test $llvm_api_version -gt 100; then
  2534. # The --cflags argument includes all kinds of warnings -pendantic etc.
  2535. LLVM_CFLAGS="-I$with_llvm/include -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS"
  2536. LLVM_CXXFLAGS="-I$with_llvm/include -std=c++11 -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS"
  2537. else
  2538. LLVM_CFLAGS=`$LLVM_CONFIG --cflags | sed -e 's/-O2//g' | sed -e 's/-O0//g' | sed -e 's/-fomit-frame-pointer//g' | sed -e 's/-fPIC//g'`
  2539. LLVM_CXXFLAGS=`$LLVM_CONFIG --cxxflags | sed -e 's/-O2//g' | sed -e 's/-O0//g' | sed -e 's/-fomit-frame-pointer//g' | sed -e 's/-fPIC//g'`
  2540. fi
  2541. # LLVM is compiled with -fno-rtti, so we need this too, since our classes inherit
  2542. # from LLVM classes.
  2543. LLVM_CXXFLAGS="$LLVM_CXXFLAGS -fno-rtti -fexceptions"
  2544. LLVM_LDFLAGS=`$LLVM_CONFIG --ldflags`
  2545. # This might include empty lines
  2546. LLVM_SYSTEM_LIBS=`$LLVM_CONFIG --system-libs 2>/dev/null | grep -- -`
  2547. llvm_jit_supported=yes
  2548. llvm_jit_libs="jit mcjit $llvm_codegen"
  2549. if test $llvm_api_version -gt 100; then
  2550. # Based on llvm 3.9, only aot is currently supported
  2551. llvm_jit_libs="orcjit $llvm_codegen"
  2552. elif test "x$host" != "x$target"; then
  2553. # No need for jit libs
  2554. llvm_jit_supported=no
  2555. llvm_jit_libs=""
  2556. fi
  2557. LLVM_LIBS=`$LLVM_CONFIG --libs analysis core bitwriter $llvm_jit_libs`
  2558. if test "x$LLVM_LIBS" = "x"; then
  2559. echo "$LLVM_CONFIG --libs failed."
  2560. exit 1
  2561. fi
  2562. LLVM_LIBS="$LLVM_LIBS $LLVM_LDFLAGS $LLVM_SYSTEM_LIBS"
  2563. # The c++ standard library used by llvm doesn't show up in $LLVM_SYSTEM_LIBS so add it manually
  2564. if echo $LLVM_CXXFLAGS | grep -q -- '-stdlib=libc++'; then
  2565. LLVM_LIBS="$LLVM_LIBS -lc++"
  2566. else
  2567. LLVM_LIBS="$LLVM_LIBS -lstdc++"
  2568. fi
  2569. expected_llvm_version="3.4svn-mono-mono/e656cac"
  2570. else
  2571. LLVM_CFLAGS="-I$with_llvm/include -DNDEBUG -D__NO_CTYPE_INLINE -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS"
  2572. LLVM_CXXFLAGS="$LLVM_CFLAGS -std=gnu++11 -fvisibility-inlines-hidden -fno-rtti -Woverloaded-virtual -Wcast-qual"
  2573. LLVM_LDFLAGS="-L$with_llvm/lib"
  2574. LLVM_SYSTEM_LIBS="-lshell32 -lpsapi -limagehlp -ldbghelp -lm"
  2575. LLVM_LIBS="-lLLVMLTO -lLLVMObjCARCOpts -lLLVMLinker -lLLVMipo -lLLVMVectorize -lLLVMBitWriter \
  2576. -lLLVMARMDisassembler -lLLVMARMCodeGen -lLLVMARMAsmParser -lLLVMARMDesc -lLLVMARMInfo \
  2577. -lLLVMARMAsmPrinter -lLLVMTableGen -lLLVMDebugInfo -lLLVMOption -lLLVMX86Disassembler \
  2578. -lLLVMX86AsmParser -lLLVMX86CodeGen -lLLVMSelectionDAG -lLLVMAsmPrinter -lLLVMX86Desc \
  2579. -lLLVMMCDisassembler -lLLVMX86Info -lLLVMX86AsmPrinter -lLLVMX86Utils -lLLVMJIT \
  2580. -lLLVMAnalysis -lLLVMTarget \
  2581. -lLLVMIRReader -lLLVMAsmParser -lLLVMLineEditor -lLLVMMCAnalysis -lLLVMInstrumentation \
  2582. -lLLVMInterpreter -lLLVMCodeGen -lLLVMScalarOpts -lLLVMInstCombine -lLLVMTransformUtils \
  2583. -lLLVMipa -lLLVMAnalysis -lLLVMProfileData -lLLVMMCJIT -lLLVMTarget -lLLVMRuntimeDyld \
  2584. -lLLVMObject -lLLVMMCParser -lLLVMBitReader -lLLVMExecutionEngine -lLLVMMC -lLLVMCore \
  2585. -lLLVMSupport -lstdc++"
  2586. LLVM_LIBS="$LLVM_LIBS $LLVM_SYSTEM_LIBS"
  2587. llvm_config_path=$with_llvm/include/llvm/Config/llvm-config.h
  2588. llvm_api_version=`awk '/MONO_API_VERSION/ { print $3 }' $llvm_config_path`
  2589. fi
  2590. if test "x$llvm_api_version" = "x"; then
  2591. LLVM_CFLAGS="$LLVM_CFLAGS -DLLVM_API_VERSION=0"
  2592. LLVM_CXXFLAGS="$LLVM_CXXFLAGS -DLLVM_API_VERSION=0"
  2593. else
  2594. LLVM_CFLAGS="$LLVM_CFLAGS -DLLVM_API_VERSION=$llvm_api_version"
  2595. LLVM_CXXFLAGS="$LLVM_CXXFLAGS -DLLVM_API_VERSION=$llvm_api_version"
  2596. fi
  2597. AC_DEFINE_UNQUOTED(LLVM_VERSION, "$llvm_version", [Full version of LLVM libraties])
  2598. AC_SUBST(LLVM_CFLAGS)
  2599. AC_SUBST(LLVM_CXXFLAGS)
  2600. AC_SUBST(LLVM_LIBS)
  2601. AC_SUBST(LLVM_LDFLAGS)
  2602. AC_DEFINE(ENABLE_LLVM, 1, [Enable the LLVM back end])
  2603. fi
  2604. AM_CONDITIONAL(ENABLE_LLVM, [test x$enable_llvm = xyes])
  2605. if test "x$enable_loadedllvm" = "xyes"; then
  2606. AC_DEFINE(MONO_LLVM_LOADED, 1, [The LLVM back end is dynamically loaded])
  2607. fi
  2608. AM_CONDITIONAL(LOADED_LLVM, [test x$enable_loadedllvm = xyes])
  2609. if test "x$enable_llvm" = "xyes"; then
  2610. enable_llvm_runtime=yes
  2611. fi
  2612. if test "x$enable_llvm_runtime" = "xyes"; then
  2613. AC_DEFINE(ENABLE_LLVM_RUNTIME, 1, [Runtime support code for llvm enabled])
  2614. fi
  2615. AM_CONDITIONAL(ENABLE_LLVM_RUNTIME, [test x$enable_llvm_runtime = xyes])
  2616. TARGET="unknown"
  2617. ACCESS_UNALIGNED="yes"
  2618. LIBC="libc.so.6"
  2619. INTL="libc.so.6"
  2620. SQLITE="libsqlite.so.0"
  2621. SQLITE3="libsqlite3.so.0"
  2622. X11="libX11.so"
  2623. GDKX11="libgdk-x11-2.0.so.0"
  2624. GTKX11="libgtk-x11-2.0.so.0"
  2625. XINERAMA="libXinerama.so.1"
  2626. sizeof_register="SIZEOF_VOID_P"
  2627. jit_wanted=true
  2628. boehm_supported=true
  2629. case "$host" in
  2630. mips*)
  2631. TARGET=MIPS;
  2632. arch_target=mips;
  2633. with_tls=pthread;
  2634. ACCESS_UNALIGNED="no"
  2635. AC_MSG_CHECKING(for mips n32)
  2636. AC_TRY_COMPILE([],[
  2637. #if _MIPS_SIM != _ABIN32
  2638. #error Not mips n32
  2639. #endif
  2640. return 0;
  2641. ],[
  2642. AC_MSG_RESULT(yes)
  2643. sizeof_register=8
  2644. ],[
  2645. AC_MSG_RESULT(no)
  2646. ])
  2647. ;;
  2648. i*86-*-*)
  2649. TARGET=X86;
  2650. arch_target=x86;
  2651. case $host_os in
  2652. solaris*)
  2653. LIBC="libc.so"
  2654. INTL="libintl.so"
  2655. if test "x$ac_cv_sizeof_void_p" = "x8"; then
  2656. TARGET=AMD64
  2657. arch_target=amd64
  2658. fi
  2659. # On solaris 10 x86, gcc prints a warning saying 'visibility attribute not supported on this configuration; ignored', but linking fails. A test case:
  2660. # int astruct __attribute__ ((visibility ("hidden")));
  2661. # void foo ()
  2662. # {
  2663. # void *p = &astruct;
  2664. # }
  2665. # gcc -fPIC --shared -o libfoo.so foo.c
  2666. # yields:
  2667. # foo.c:6: warning: visibility attribute not supported in this configuration; ignored
  2668. # ld: fatal: relocation error: R_386_GOTOFF: file /var/tmp//ccxYR96k.o: symbol astruct: relocation must bind locally
  2669. have_visibility_hidden=no
  2670. ;;
  2671. mingw*|cygwin*)
  2672. have_visibility_hidden=no
  2673. ;;
  2674. haiku*)
  2675. LIBC=libroot.so
  2676. ;;
  2677. linux*)
  2678. AOT_SUPPORTED="yes"
  2679. ;;
  2680. darwin*)
  2681. AOT_SUPPORTED="yes"
  2682. ;;
  2683. openbsd*|freebsd*|kfreebsd-gnu*)
  2684. ;;
  2685. esac
  2686. ;;
  2687. x86_64-*-* | amd64-*-*)
  2688. TARGET=AMD64;
  2689. arch_target=amd64;
  2690. if test "x$ac_cv_sizeof_void_p" = "x4"; then
  2691. AC_DEFINE(__mono_ilp32__, 1, [64 bit mode with 4 byte longs and pointers])
  2692. sizeof_register=8
  2693. fi
  2694. case $host_os in
  2695. linux*)
  2696. AOT_SUPPORTED="yes"
  2697. ;;
  2698. darwin*)
  2699. AOT_SUPPORTED="yes"
  2700. ;;
  2701. openbsd*|freebsd*|kfreebsd-gnu*)
  2702. ;;
  2703. mingw*)
  2704. ;;
  2705. esac
  2706. case "$host" in
  2707. x86_64-*-nacl*)
  2708. AC_DEFINE(__mono_ilp32__, 1, [64 bit mode with 4 byte longs and pointers])
  2709. sizeof_register=8
  2710. ;;
  2711. esac
  2712. ;;
  2713. ia64-*-*)
  2714. TARGET=IA64
  2715. arch_target=ia64
  2716. ACCESS_UNALIGNED="no"
  2717. LIBC="libc.so.6.1"
  2718. INTL="libc.so.6.1"
  2719. AC_CHECK_LIB(unwind, _U_dyn_register, [], [AC_MSG_ERROR(library libunwind not found)])
  2720. libmono_ldflags="-lunwind"
  2721. ;;
  2722. sparc*-*-*)
  2723. if test "x$ac_cv_sizeof_void_p" = "x8"; then
  2724. TARGET=SPARC64
  2725. else
  2726. TARGET=SPARC
  2727. fi
  2728. arch_target=sparc;
  2729. ACCESS_UNALIGNED="no"
  2730. case $host_os in
  2731. linux*) ;;
  2732. *)
  2733. LIBC="libc.so"
  2734. INTL="libintl.so"
  2735. esac
  2736. if test x"$GCC" = xyes; then
  2737. # We don't support v8 cpus
  2738. CFLAGS="$CFLAGS -Wno-cast-align -mcpu=v9"
  2739. fi
  2740. if test x"$AR" = xfalse; then
  2741. AC_MSG_ERROR([The required utility 'ar' is not found in your PATH. Usually it can be found in /usr/ccs/bin.])
  2742. fi
  2743. ;;
  2744. *-mingw*|*-*-cygwin*)
  2745. # When this is enabled, it leads to very strange crashes at runtime (gcc-3.4.4)
  2746. have_visibility_hidden=no
  2747. INTL="intl"
  2748. ;;
  2749. macppc-*-openbsd* | powerpc*-*-linux* | powerpc-*-openbsd* | \
  2750. powerpc-*-sysv* | powerpc-*-darwin* | powerpc-*-netbsd* | powerpc-*-freebsd* )
  2751. if test "x$ac_cv_sizeof_void_p" = "x8"; then
  2752. TARGET=POWERPC64;
  2753. CPPFLAGS="$CPPFLAGS -D__mono_ppc__ -D__mono_ppc64__"
  2754. CFLAGS="$CFLAGS -mminimal-toc"
  2755. else
  2756. TARGET=POWERPC;
  2757. CPPFLAGS="$CPPFLAGS -D__mono_ppc__"
  2758. fi
  2759. arch_target=ppc;
  2760. case $host_os in
  2761. linux*|darwin*)
  2762. ;;
  2763. esac
  2764. ;;
  2765. armv7k-*-darwin*)
  2766. TARGET=ARM;
  2767. TARGET_SYS=WATCHOS
  2768. arch_target=arm;
  2769. arm_fpu=VFP_HARD
  2770. ACCESS_UNALIGNED="no"
  2771. CPPFLAGS="$CPPFLAGS -D__ARM_EABI__"
  2772. ;;
  2773. arm*-darwin*)
  2774. TARGET=ARM;
  2775. arch_target=arm;
  2776. ACCESS_UNALIGNED="no"
  2777. CPPFLAGS="$CPPFLAGS -D__ARM_EABI__"
  2778. ;;
  2779. arm*-linux*)
  2780. TARGET=ARM;
  2781. arch_target=arm;
  2782. ACCESS_UNALIGNED="no"
  2783. AOT_SUPPORTED="yes"
  2784. CPPFLAGS="$CPPFLAGS -D__ARM_EABI__"
  2785. ;;
  2786. arm*-netbsd*-eabi*)
  2787. TARGET=ARM;
  2788. arch_target=arm;
  2789. ACCESS_UNALIGNED="no"
  2790. CPPFLAGS="$CPPFLAGS -D__ARM_EABI__"
  2791. ;;
  2792. # TODO: make proper support for NaCl host.
  2793. # arm*-*nacl)
  2794. # TARGET=ARM;
  2795. # arch_target=arm;
  2796. # ACCESS_UNALIGNED="no"
  2797. # AOT_SUPPORTED="no"
  2798. # ;;
  2799. aarch64-*)
  2800. # https://lkml.org/lkml/2012/7/15/133
  2801. TARGET=ARM64
  2802. arch_target=arm64
  2803. boehm_supported=false
  2804. AOT_SUPPORTED="yes"
  2805. ;;
  2806. s390x-*-linux*)
  2807. TARGET=S390X;
  2808. arch_target=s390x;
  2809. ACCESS_UNALIGNED="yes"
  2810. CFLAGS="$CFLAGS -mbackchain -D__USE_STRING_INLINES"
  2811. ;;
  2812. esac
  2813. HOST=$TARGET
  2814. if test "x$host" != "x$target"; then
  2815. AC_DEFINE(MONO_CROSS_COMPILE,1,[The runtime is compiled for cross-compiling mode])
  2816. enable_mcs_build=no
  2817. case "$target" in
  2818. arm*-darwin*)
  2819. TARGET=ARM;
  2820. arch_target=arm;
  2821. ACCESS_UNALIGNED="no"
  2822. CPPFLAGS="$CPPFLAGS -D__ARM_EABI__"
  2823. # Can't use tls, since it depends on the runtime detection of tls offsets
  2824. # in mono-compiler.h
  2825. with_tls=pthread
  2826. case "$target" in
  2827. armv7k-*)
  2828. arm_fpu=VFP_HARD
  2829. AC_DEFINE(TARGET_WATCHOS, 1, [...])
  2830. ;;
  2831. esac
  2832. ;;
  2833. powerpc64-ps3-linux-gnu)
  2834. TARGET=POWERPC64
  2835. arch_target=powerpc64
  2836. AC_DEFINE(TARGET_PS3, 1, [...])
  2837. # It would be better to just use TARGET_POWERPC64, but lots of code already
  2838. # uses this define
  2839. AC_DEFINE(__mono_ppc64__, 1, [...])
  2840. AC_DEFINE(__mono_ilp32__, 1, [64 bit mode with 4 byte longs and pointers])
  2841. sizeof_register=8
  2842. target_byte_order=G_BIG_ENDIAN
  2843. ;;
  2844. powerpc64-xbox360-linux-gnu)
  2845. TARGET=POWERPC64
  2846. arch_target=powerpc64
  2847. AC_DEFINE(TARGET_XBOX360, 1, [...])
  2848. # It would be better to just use TARGET_POWERPC64, but lots of code already
  2849. # uses this define
  2850. sizeof_register=8
  2851. target_byte_order=G_BIG_ENDIAN
  2852. ;;
  2853. x86_64-*-nacl)
  2854. TARGET=AMD64
  2855. arch_target=amd64
  2856. AC_DEFINE(TARGET_AMD64, 1, [...])
  2857. AC_DEFINE(__mono_ilp32__, 1, [64 bit mode with 4 byte longs and pointers])
  2858. sizeof_register=8
  2859. ;;
  2860. # TODO: make proper support for NaCl target.
  2861. # arm*-*nacl)
  2862. # TARGET=ARM
  2863. # arch_target=arm
  2864. # AC_DEFINE(TARGET_ARM, 1, [...])
  2865. # ACCESS_UNALIGNED="no"
  2866. # sizeof_register=4
  2867. # CPPFLAGS="$CPPFLAGS \
  2868. # -D__ARM_EABI__ \
  2869. # -D__arm__ \
  2870. # -D__portable_native_client__ \
  2871. # -Dtimezone=_timezone \
  2872. # -DDISABLE_SOCKETS \
  2873. # -DDISABLE_ATTACH \
  2874. # -DUSE_NEWLIB"
  2875. # Can't use tls, since it depends on the runtime detection of tls offsets
  2876. # in mono-compiler.h
  2877. # with_tls=pthread
  2878. # ;;
  2879. i686-*-nacl)
  2880. TARGET=X86
  2881. arch_target=x86
  2882. AC_DEFINE(TARGET_X86, 1, [...])
  2883. sizeof_register=4
  2884. ;;
  2885. arm*-linux-*)
  2886. TARGET=ARM;
  2887. arch_target=arm;
  2888. AC_DEFINE(TARGET_ARM, 1, [...])
  2889. AC_DEFINE(TARGET_ANDROID, 1, [...])
  2890. ACCESS_UNALIGNED="no"
  2891. CPPFLAGS="$CPPFLAGS -D__ARM_EABI__"
  2892. # Can't use tls, since it depends on the runtime detection of tls offsets
  2893. # in mono-compiler.h
  2894. with_tls=pthread
  2895. target_mach=no
  2896. case "$target" in
  2897. armv7l-unknown-linux-gnueabi*)
  2898. # TEGRA
  2899. CPPFLAGS="$CPPFLAGS"
  2900. ;;
  2901. armv5-*-linux-androideabi*)
  2902. CPPFLAGS="$CPPFLAGS"
  2903. ;;
  2904. esac
  2905. ;;
  2906. arm*-netbsd*-eabi*)
  2907. TARGET=ARM;
  2908. arch_target=arm;
  2909. AC_DEFINE(TARGET_ARM, 1, [...])
  2910. ACCESS_UNALIGNED="no"
  2911. CPPFLAGS="$CPPFLAGS -D__ARM_EABI__"
  2912. # Can't use tls, since it depends on the runtime detection of tls offsets
  2913. # in mono-compiler.h
  2914. with_tls=pthread
  2915. target_mach=no
  2916. ;;
  2917. i686*-linux-*)
  2918. TARGET=X86;
  2919. arch_target=x86;
  2920. AC_DEFINE(TARGET_X86, 1, [...])
  2921. AC_DEFINE(TARGET_ANDROID, 1, [...])
  2922. CPPFLAGS="$CPPFLAGS"
  2923. # Can't use tls, since it depends on the runtime detection of tls offsets
  2924. # in mono-compiler.h
  2925. with_tls=pthread
  2926. target_mach=no
  2927. ;;
  2928. x86_64*-linux-*)
  2929. TARGET=AMD64;
  2930. arch_target=amd64;
  2931. AC_DEFINE(TARGET_AMD64, 1, [...])
  2932. AC_DEFINE(TARGET_ANDROID, 1, [...])
  2933. CPPFLAGS="$CPPFLAGS"
  2934. # Can't use tls, since it depends on the runtime detection of tls offsets
  2935. # in mono-compiler.h
  2936. with_tls=pthread
  2937. target_mach=no
  2938. ;;
  2939. x86_64-ps4-freebsd)
  2940. TARGET=AMD64;
  2941. arch_target=amd64;
  2942. AC_DEFINE(TARGET_AMD64, 1, [...])
  2943. AC_DEFINE(TARGET_PS4, 1, [...])
  2944. AC_DEFINE(DISABLE_HW_TRAPS, 1, [...])
  2945. CPPFLAGS="$CPPFLAGS"
  2946. # Can't use tls, since it depends on the runtime detection of tls offsets
  2947. # in mono-compiler.h
  2948. with_tls=pthread
  2949. target_mach=no
  2950. target_win32=no
  2951. ;;
  2952. aarch64*-linux-*)
  2953. TARGET=ARM64;
  2954. arch_target=arm64;
  2955. AC_DEFINE(TARGET_ARM64, 1, [...])
  2956. AC_DEFINE(TARGET_ANDROID, 1, [...])
  2957. CPPFLAGS="$CPPFLAGS"
  2958. # Can't use tls, since it depends on the runtime detection of tls offsets
  2959. # in mono-compiler.h
  2960. with_tls=pthread
  2961. target_mach=no
  2962. ;;
  2963. aarch64-*)
  2964. TARGET=ARM64
  2965. ;;
  2966. *)
  2967. AC_MSG_ERROR([Cross compiling is not supported for target $target])
  2968. esac
  2969. fi
  2970. case "$TARGET" in
  2971. X86)
  2972. AC_DEFINE(TARGET_X86, 1, [...])
  2973. ;;
  2974. AMD64)
  2975. AC_DEFINE(TARGET_AMD64, 1, [...])
  2976. ;;
  2977. ARM)
  2978. AC_DEFINE(TARGET_ARM, 1, [...])
  2979. ;;
  2980. ARM64)
  2981. AC_DEFINE(TARGET_ARM64, 1, [...])
  2982. ;;
  2983. POWERPC)
  2984. AC_DEFINE(TARGET_POWERPC, 1, [...])
  2985. ;;
  2986. POWERPC64)
  2987. AC_DEFINE(TARGET_POWERPC, 1, [...])
  2988. AC_DEFINE(TARGET_POWERPC64, 1, [...])
  2989. ;;
  2990. S390X)
  2991. AC_DEFINE(TARGET_S390X, 1, [...])
  2992. ;;
  2993. MIPS)
  2994. AC_DEFINE(TARGET_MIPS, 1, [...])
  2995. ;;
  2996. IA64)
  2997. AC_DEFINE(TARGET_IA64, 1, [...])
  2998. ;;
  2999. SPARC)
  3000. AC_DEFINE(TARGET_SPARC, 1, [...])
  3001. ;;
  3002. SPARC64)
  3003. AC_DEFINE(TARGET_SPARC64, 1, [...])
  3004. ;;
  3005. esac
  3006. case "$HOST" in
  3007. X86)
  3008. AC_DEFINE(HOST_X86, 1, [...])
  3009. ;;
  3010. AMD64)
  3011. AC_DEFINE(HOST_AMD64, 1, [...])
  3012. ;;
  3013. ARM)
  3014. AC_DEFINE(HOST_ARM, 1, [...])
  3015. ;;
  3016. ARM64)
  3017. AC_DEFINE(HOST_ARM64, 1, [...])
  3018. ;;
  3019. POWERPC)
  3020. AC_DEFINE(HOST_POWERPC, 1, [...])
  3021. ;;
  3022. POWERPC64)
  3023. AC_DEFINE(HOST_POWERPC, 1, [...])
  3024. AC_DEFINE(HOST_POWERPC64, 1, [...])
  3025. ;;
  3026. S390X)
  3027. AC_DEFINE(HOST_S390X, 1, [...])
  3028. ;;
  3029. MIPS)
  3030. AC_DEFINE(HOST_MIPS, 1, [...])
  3031. ;;
  3032. IA64)
  3033. AC_DEFINE(HOST_IA64, 1, [...])
  3034. ;;
  3035. SPARC)
  3036. AC_DEFINE(HOST_SPARC, 1, [...])
  3037. ;;
  3038. SPARC64)
  3039. AC_DEFINE(HOST_SPARC64, 1, [...])
  3040. ;;
  3041. esac
  3042. dnl *************
  3043. dnl *** VTUNE ***
  3044. dnl *************
  3045. AC_ARG_ENABLE(vtune,[ --enable-vtune Enable the VTUNE back-end], enable_vtune=$enableval, enable_vtune=no)
  3046. AC_ARG_WITH(vtune, [ --with-vtune=<vtune prefix> Enable jit vtune profiling], enable_vtune=yes,)
  3047. AM_CONDITIONAL(HAVE_VTUNE, test x$enable_vtune = xyes)
  3048. if test "x$enable_vtune" = "xyes"; then
  3049. if test "x$with_vtune" = "x"; then
  3050. VTUNE_PATH=/opt/intel/vtune_amplifier_xe
  3051. else
  3052. VTUNE_PATH=$with_vtune
  3053. fi
  3054. VTUNE_INCLUDE=$VTUNE_PATH/include
  3055. case "$TARGET" in
  3056. X86)
  3057. VTUNE_LIB=$VTUNE_PATH/lib32
  3058. ;;
  3059. AMD64)
  3060. VTUNE_LIB=$VTUNE_PATH/lib64
  3061. ;;
  3062. *)
  3063. AC_MSG_ERROR([Unsupported target $TARGET for VTUNE.])
  3064. ;;
  3065. esac
  3066. if test ! -f $VTUNE_INCLUDE/jitprofiling.h; then
  3067. AC_MSG_ERROR([VTUNE $VTUNE_INCLUDE/jitprofiling.h not found.])
  3068. fi
  3069. if test ! -f $VTUNE_LIB/libjitprofiling.a; then
  3070. AC_MSG_ERROR([VTUNE $VTUNE_LIB/libjitprofiling.a not found.])
  3071. fi
  3072. VTUNE_CFLAGS=-I$VTUNE_INCLUDE
  3073. VTUNE_LIBS="-L/$VTUNE_LIB/ -ljitprofiling"
  3074. AC_SUBST(VTUNE_LIBS)
  3075. AC_SUBST(VTUNE_CFLAGS)
  3076. fi
  3077. dnl Use GCC atomic ops if they work on the target.
  3078. if test x$GCC = "xyes"; then
  3079. case $TARGET in
  3080. X86 | AMD64 | ARM | ARM64 | POWERPC | POWERPC64 | MIPS | S390X | SPARC | SPARC64)
  3081. AC_DEFINE(USE_GCC_ATOMIC_OPS, 1, [...])
  3082. ;;
  3083. esac
  3084. fi
  3085. if test "x$target_mach" = "xyes"; then
  3086. if test "x$TARGET_SYS" = "xWATCHOS"; then
  3087. AC_DEFINE(TARGET_WATCHOS,1,[The JIT/AOT targets WatchOS])
  3088. CPPFLAGS_FOR_LIBGC="$CPPFLAGS_FOR_LIBGC -DTARGET_WATCHOS"
  3089. CFLAGS_FOR_LIBGC="$CFLAGS_FOR_LIBGC -DTARGET_WATCHOS"
  3090. elif test "x$TARGET" = "xARM" -o "x$TARGET" = "xARM64"; then
  3091. AC_DEFINE(TARGET_IOS,1,[The JIT/AOT targets iOS])
  3092. CPPFLAGS_FOR_LIBGC="$CPPFLAGS_FOR_LIBGC -DTARGET_IOS"
  3093. CFLAGS_FOR_LIBGC="$CFLAGS_FOR_LIBGC -DTARGET_IOS"
  3094. else
  3095. AC_TRY_COMPILE([#include "TargetConditionals.h"],[
  3096. #if TARGET_IPHONE_SIMULATOR == 1 || TARGET_OS_IPHONE == 1
  3097. #error fail this for ios
  3098. #endif
  3099. return 0;
  3100. ], [
  3101. AC_DEFINE(TARGET_OSX,1,[The JIT/AOT targets OSX])
  3102. CPPFLAGS_FOR_LIBGC="$CPPFLAGS_FOR_LIBGC -DTARGET_OSX"
  3103. CFLAGS_FOR_LIBGC="$CFLAGS_FOR_LIBGC -DTARGET_OSX"
  3104. ], [
  3105. AC_DEFINE(TARGET_IOS,1,[The JIT/AOT targets iOS])
  3106. CPPFLAGS_FOR_LIBGC="$CPPFLAGS_FOR_LIBGC -DTARGET_IOS"
  3107. CFLAGS_FOR_LIBGC="$CFLAGS_FOR_LIBGC -DTARGET_IOS"
  3108. ])
  3109. fi
  3110. AC_DEFINE(TARGET_MACH,1,[The JIT/AOT targets Apple platforms])
  3111. fi
  3112. if test "x$sizeof_register" = "x4"; then
  3113. AC_DEFINE(SIZEOF_REGISTER,4,[size of machine integer registers])
  3114. elif test "x$sizeof_register" = "x8"; then
  3115. AC_DEFINE(SIZEOF_REGISTER,8,[size of machine integer registers])
  3116. else
  3117. AC_DEFINE(SIZEOF_REGISTER,SIZEOF_VOID_P,[size of machine integer registers])
  3118. fi
  3119. if test "x$target_byte_order" = "xG_BIG_ENDIAN"; then
  3120. AC_DEFINE(TARGET_BYTE_ORDER,G_BIG_ENDIAN,[byte order of target])
  3121. elif test "x$target_byte_order" = "xG_LITTLE_ENDIAN"; then
  3122. AC_DEFINE(TARGET_BYTE_ORDER,G_LITTLE_ENDIAN,[byte order of target])
  3123. else
  3124. AC_DEFINE(TARGET_BYTE_ORDER,G_BYTE_ORDER,[byte order of target])
  3125. fi
  3126. if test "x$have_visibility_hidden" = "xyes"; then
  3127. AC_DEFINE(HAVE_VISIBILITY_HIDDEN, 1, [Support for the visibility ("hidden") attribute])
  3128. fi
  3129. if test "x$have_deprecated" = "xyes"; then
  3130. AC_DEFINE(HAVE_DEPRECATED, 1, [Support for the deprecated attribute])
  3131. fi
  3132. dnl
  3133. dnl Simple Generational checks (sgen)
  3134. dnl
  3135. SGEN_DEFINES=
  3136. AC_ARG_WITH(sgen, [ --with-sgen=yes,no Extra Generational GC, default=yes],[buildsgen=$with_sgen],[buildsgen=yes])
  3137. AC_ARG_WITH(sgen-default-concurrent, [ --with-sgen-default-concurrent=yes,no Use Concurrent GC, default=no],[],[with_sgen_default_concurrent=no])
  3138. if test x$buildsgen = xyes; then
  3139. AC_DEFINE(HAVE_MOVING_COLLECTOR, 1, [Moving collector])
  3140. SGEN_DEFINES="-DHAVE_SGEN_GC"
  3141. conc_gc_msg=""
  3142. if test x$with_sgen_default_concurrent != xno; then
  3143. AC_DEFINE(HAVE_CONC_GC_AS_DEFAULT, 1, [Defaults to concurrent GC])
  3144. conc_gc_msg=" (concurrent by default)"
  3145. fi
  3146. if test "x$gc_msg" = "x"; then
  3147. gc_msg="sgen$conc_gc_msg"
  3148. else
  3149. gc_msg="sgen$conc_gc_msg and $gc_msg"
  3150. fi
  3151. fi
  3152. AC_SUBST(SGEN_DEFINES)
  3153. AM_CONDITIONAL(SUPPORT_SGEN, test x$buildsgen = xyes)
  3154. jit_status="Building and using the JIT"
  3155. libsuffix=".so"
  3156. case "$host" in
  3157. *-*-darwin*)
  3158. libsuffix=".dylib"
  3159. LIBC="libc.dylib"
  3160. INTL="libintl.dylib"
  3161. SQLITE="libsqlite.0.dylib"
  3162. SQLITE3="libsqlite3.0.dylib"
  3163. X11="libX11.dylib"
  3164. GDKX11="libgdk-x11-2.0.dylib"
  3165. GTKX11="libgtk-x11-2.0.dylib"
  3166. ;;
  3167. *-*-*netbsd*)
  3168. LIBC="libc.so"
  3169. INTL="libintl.so"
  3170. SQLITE="libsqlite.so"
  3171. SQLITE3="libsqlite3.so"
  3172. ;;
  3173. *-*-kfreebsd*-gnu)
  3174. LIBC="libc.so.0.1"
  3175. INTL="libc.so.0.1"
  3176. X11="libX11.so.6"
  3177. ;;
  3178. *-*-*freebsd*)
  3179. LIBC="libc.so.7"
  3180. INTL="libintl.so"
  3181. SQLITE="libsqlite.so"
  3182. SQLITE3="libsqlite3.so"
  3183. ;;
  3184. *-*-*openbsd*)
  3185. LIBC="libc.so"
  3186. INTL="libintl.so"
  3187. SQLITE="libsqlite.so"
  3188. SQLITE3="libsqlite3.so"
  3189. ;;
  3190. *-*-*linux*)
  3191. AC_PATH_X
  3192. dlsearch_path=`(libtool --config ; echo eval echo \\$sys_lib_dlsearch_path_spec) | sh`
  3193. AC_MSG_CHECKING(for the soname of libX11.so)
  3194. for i in $x_libraries $dlsearch_path; do
  3195. for r in 4 5 6; do
  3196. if test -f $i/libX11.so.$r; then
  3197. X11=libX11.so.$r
  3198. AC_MSG_RESULT($X11)
  3199. fi
  3200. done
  3201. done
  3202. if test "x$X11" = "xlibX11.so"; then
  3203. AC_MSG_WARN([Could not find libX11.so. Do you have X.org or XFree86 installed? Assuming libX11.so.6...]);
  3204. X11=libX11.so.6
  3205. fi
  3206. ;;
  3207. esac
  3208. AC_SUBST(libsuffix)
  3209. AC_ARG_WITH([libgdiplus],
  3210. [ --with-libgdiplus=installed|sibling|<path> Override the libgdiplus used for System.Drawing tests (defaults to installed)],
  3211. [], [with_libgdiplus=installed])
  3212. # default install location
  3213. libgdiplus_install_loc=libgdiplus${libsuffix}
  3214. case "$host" in
  3215. *-*-*linux*)
  3216. libgdiplus_install_loc=libgdiplus${libsuffix}.0
  3217. ;;
  3218. esac
  3219. case $with_libgdiplus in
  3220. no|installed)
  3221. libgdiplus_loc=
  3222. ;;
  3223. yes|sibling)
  3224. libgdiplus_loc=`cd ../libgdiplus && pwd`/src/libgdiplus.la
  3225. ;;
  3226. /*) # absolute path, assume it is an install location
  3227. libgdiplus_loc=$with_libgdiplus
  3228. libgdiplus_install_loc=$with_libgdiplus
  3229. ;;
  3230. *)
  3231. libgdiplus_loc=`pwd`/$with_libgdiplus
  3232. ;;
  3233. esac
  3234. AC_SUBST([libgdiplus_loc])
  3235. AC_SUBST([libgdiplus_install_loc])
  3236. AC_ARG_ENABLE(icall-symbol-map,[ --enable-icall-symbol-map Generate tables which map icall functions to their C symbols], icall_symbol_map=$enableval, icall_symbol_map=no)
  3237. if test "x$icall_symbol_map" = "xyes"; then
  3238. AC_DEFINE(ENABLE_ICALL_SYMBOL_MAP, 1, [Icall symbol map enabled])
  3239. fi
  3240. AC_ARG_ENABLE(icall-export,[ --enable-icall-export Export icall functions], icall_export=$enableval, icall_export=no)
  3241. if test "x$icall_export" = "xyes"; then
  3242. AC_DEFINE(ENABLE_ICALL_EXPORT, 1, [Icall export enabled])
  3243. fi
  3244. AC_ARG_ENABLE(icall-tables,[ --disable-icall-tables Disable the runtime lookup of icalls], icall_tables=$enableval, icall_tables=yes)
  3245. if test "x$icall_tables" = "xno"; then
  3246. AC_DEFINE(DISABLE_ICALL_TABLES, 1, [Icall tables disabled])
  3247. fi
  3248. if test "x$with_tls" = "x__thread"; then
  3249. AC_DEFINE(HAVE_KW_THREAD, 1, [Have __thread keyword])
  3250. # Pass the information to libgc
  3251. CPPFLAGS="$CPPFLAGS -DUSE_COMPILER_TLS"
  3252. AC_MSG_CHECKING(if the tls_model attribute is supported)
  3253. AC_TRY_COMPILE([static __thread int foo __attribute__((tls_model("initial-exec")));], [
  3254. ], [
  3255. AC_MSG_RESULT(yes)
  3256. AC_DEFINE(HAVE_TLS_MODEL_ATTR, 1, [tls_model available])
  3257. ], [
  3258. AC_MSG_RESULT(no)
  3259. ])
  3260. fi
  3261. if test ${TARGET} = ARM; then
  3262. dnl ******************************************
  3263. dnl *** Check to see what FPU is available ***
  3264. dnl ******************************************
  3265. AC_MSG_CHECKING(which FPU to use)
  3266. #
  3267. # This is a bit tricky:
  3268. #
  3269. # if (__ARM_PCS_VFP) {
  3270. # /* mfloat-abi=hard == VFP with hard ABI */
  3271. # } elif (!__SOFTFP__) {
  3272. # /* mfloat-abi=softfp == VFP with soft ABI */
  3273. # } else {
  3274. # /* mfloat-abi=soft == no VFP */
  3275. # }
  3276. #
  3277. # The exception is iOS (w/ GCC) where none of the above
  3278. # are defined (but iOS always uses the 'softfp' ABI).
  3279. #
  3280. # No support for FPA.
  3281. #
  3282. fpu=NONE
  3283. # iOS GCC always uses the 'softfp' ABI.
  3284. if test x"$GCC" = xyes && test x$host_darwin = xyes; then
  3285. fpu=VFP
  3286. fi
  3287. # Are we using the 'hard' ABI?
  3288. if test x$fpu = xNONE; then
  3289. AC_TRY_COMPILE([], [
  3290. #ifndef __ARM_PCS_VFP
  3291. #error "Float ABI is not 'hard'"
  3292. #endif
  3293. return 0;
  3294. ], [
  3295. fpu=VFP_HARD
  3296. ], [
  3297. fpu=NONE
  3298. ])
  3299. fi
  3300. # No 'hard' ABI. 'soft' or 'softfp'?
  3301. if test x$fpu = xNONE; then
  3302. AC_TRY_COMPILE([], [
  3303. #ifdef __SOFTFP__
  3304. #error "Float ABI is not 'softfp'"
  3305. #endif
  3306. return 0;
  3307. ], [
  3308. fpu=VFP
  3309. ], [
  3310. fpu=NONE
  3311. ])
  3312. fi
  3313. if test x$arm_fpu != x; then
  3314. fpu=$arm_fpu
  3315. fi
  3316. AC_MSG_RESULT($fpu)
  3317. CPPFLAGS="$CPPFLAGS -DARM_FPU_$fpu=1"
  3318. unset fpu
  3319. dnl *********************************************
  3320. dnl *** Check which ARM version(s) we can use ***
  3321. dnl *********************************************
  3322. AC_MSG_CHECKING(which ARM version to use)
  3323. AC_TRY_COMPILE([], [
  3324. #if !defined(__ARM_ARCH_5T__) && !defined(__ARM_ARCH_5TE__) && !defined(__ARM_ARCH_5TEJ__)
  3325. #error Not on ARM v5.
  3326. #endif
  3327. return 0;
  3328. ], [
  3329. arm_v5=yes
  3330. arm_ver=ARMv5
  3331. ], [])
  3332. AC_TRY_COMPILE([], [
  3333. #if !defined(__ARM_ARCH_6J__) && !defined(__ARM_ARCH_6ZK__) && !defined(__ARM_ARCH_6K__) && !defined(__ARM_ARCH_6T2__) && !defined(__ARM_ARCH_6M__)
  3334. #error Not on ARM v6.
  3335. #endif
  3336. return 0;
  3337. ], [
  3338. arm_v5=yes
  3339. arm_v6=yes
  3340. arm_ver=ARMv6
  3341. ], [])
  3342. AC_TRY_COMPILE([], [
  3343. #if !defined(__ARM_ARCH_7A__) && !defined(__ARM_ARCH_7R__) && !defined(__ARM_ARCH_7EM__) && !defined(__ARM_ARCH_7M__) && !defined(__ARM_ARCH_7S__)
  3344. #error Not on ARM v7.
  3345. #endif
  3346. return 0;
  3347. ], [
  3348. arm_v5=yes
  3349. arm_v6=yes
  3350. arm_v7=yes
  3351. arm_ver=ARMv7
  3352. ], [])
  3353. AC_MSG_RESULT($arm_ver)
  3354. if test x$arm_v5 = xyes; then
  3355. AC_DEFINE(HAVE_ARMV5, 1, [ARM v5])
  3356. CPPFLAGS_FOR_LIBGC="$CPPFLAGS_FOR_LIBGC -DHAVE_ARMV5=1"
  3357. fi
  3358. if test x$arm_v6 = xyes; then
  3359. AC_DEFINE(HAVE_ARMV6, 1, [ARM v6])
  3360. CPPFLAGS_FOR_LIBGC="$CPPFLAGS_FOR_LIBGC -DHAVE_ARMV6=1"
  3361. fi
  3362. if test x$arm_v7 = xyes; then
  3363. AC_DEFINE(HAVE_ARMV7, 1, [ARM v7])
  3364. CPPFLAGS_FOR_LIBGC="$CPPFLAGS_FOR_LIBGC -DHAVE_ARMV7=1"
  3365. fi
  3366. fi
  3367. if test ${TARGET} = unknown; then
  3368. CPPFLAGS="$CPPFLAGS -DNO_PORT"
  3369. AC_MSG_WARN("mono has not been ported to $host: some things may not work.")
  3370. fi
  3371. if test ${ACCESS_UNALIGNED} = no; then
  3372. CPPFLAGS="$CPPFLAGS -DNO_UNALIGNED_ACCESS"
  3373. fi
  3374. case "x$libgc" in
  3375. xincluded)
  3376. # Pass CPPFLAGS to libgc configure
  3377. # We should use a separate variable for this to avoid passing useless and
  3378. # potentially problematic defines to libgc (like -D_FILE_OFFSET_BITS=64)
  3379. # This should be executed late so we pick up the final version of CPPFLAGS
  3380. # The problem with this approach, is that during a reconfigure, the main
  3381. # configure scripts gets invoked with these arguments, so we use separate
  3382. # variables understood by libgc's configure to pass CPPFLAGS and CFLAGS.
  3383. TMP_CPPFLAGS="$CPPFLAGS $CPPFLAGS_FOR_LIBGC"
  3384. if test x$TARGET = xSPARC -o x$TARGET = xSPARC64; then
  3385. TMP_CPPFLAGS=`echo $TMP_CPPFLAGS | sed -e 's/-D_FILE_OFFSET_BITS=64//g'`
  3386. fi
  3387. # Don't pass -finstrument-for-thread-suspension in,
  3388. # if these are instrumented it will be very bad news
  3389. # (infinite recursion, undefined parking behavior, etc)
  3390. TMP_CPPFLAGS=`echo $TMP_CPPFLAGS | sed -e 's/-finstrument-for-thread-suspension//g'`
  3391. ac_configure_args="$ac_configure_args --disable-embed-check --with-libgc-threads=$libgc_threads $libgc_configure_args \"CPPFLAGS_FOR_LIBGC=$TMP_CPPFLAGS\" \"CFLAGS_FOR_LIBGC=$CFLAGS_FOR_LIBGC\""
  3392. if test "x$support_boehm" = "xyes"; then
  3393. AC_CONFIG_SUBDIRS(libgc)
  3394. fi
  3395. ;;
  3396. esac
  3397. MALLOC_MEMPOOLS=no
  3398. AC_ARG_WITH(malloc_mempools,[ --with-malloc-mempools=yes,no Use malloc for each single mempool allocation (only for runtime debugging, defaults to no)],[
  3399. if test x$with_malloc_mempools = xyes; then
  3400. MALLOC_MEMPOOLS=yes
  3401. AC_DEFINE(USE_MALLOC_FOR_MEMPOOLS,1,[Use malloc for each single mempool allocation])
  3402. fi
  3403. ])
  3404. DISABLE_MCS_DOCS=default
  3405. AC_ARG_WITH(mcs_docs,[ --with-mcs-docs=yes,no If you want to build the documentation under mcs (defaults to yes)],[
  3406. if test x$with_mcs_docs != xyes; then
  3407. DISABLE_MCS_DOCS=yes
  3408. fi
  3409. ])
  3410. if test -n "$INSTALL_4_x_TRUE"; then :
  3411. DISABLE_MCS_DOCS=yes
  3412. fi
  3413. if test "x$DISABLE_MCS_DOCS" = "xdefault"; then
  3414. DISABLE_MCS_DOCS=$DISABLE_MCS_DOCS_default
  3415. fi
  3416. AC_ARG_WITH(lazy_gc_thread_creation, [ --with-lazy-gc-thread-creation=yes|no Enable lazy runtime thread creation, embedding host must do it explicitly (defaults to no)],[
  3417. if test x$with_lazy_gc_thread_creation != xno ; then
  3418. AC_DEFINE(LAZY_GC_THREAD_CREATION,1,[Enable lazy gc thread creation by the embedding host.])
  3419. fi
  3420. ], [with_lazy_gc_thread_creation=no])
  3421. AC_ARG_WITH(cooperative_gc, [ --with-cooperative-gc=yes|no Enable cooperative stop-the-world garbage collection (sgen only) (defaults to no)], [], [with_cooperative_gc=default])
  3422. if test x$with_cooperative_gc = xdefault; then
  3423. with_cooperative_gc=$with_cooperative_gc_default
  3424. fi
  3425. if test x$with_cooperative_gc != xno; then
  3426. AC_DEFINE(USE_COOP_GC,1,[Enable cooperative stop-the-world garbage collection.])
  3427. fi
  3428. AM_CONDITIONAL([ENABLE_COOP], [test x$with_cooperative_gc != xno])
  3429. AC_ARG_ENABLE(checked_build, [ --enable-checked-build=LIST To enable checked build (expensive asserts), configure with a comma-separated LIST of checked build modules and then include that same list in the environment variable MONO_CHECK_MODE at runtime. Recognized checked build modules: all, gc, metadata, thread],[
  3430. if test x$enable_checked_build != x ; then
  3431. AC_DEFINE(ENABLE_CHECKED_BUILD,1,[Enable checked build])
  3432. fi
  3433. for feature in `echo "$enable_checked_build" | sed -e "s/,/ /g"`; do
  3434. eval "mono_checked_build_test_enable_$feature='yes'"
  3435. done
  3436. if test "x$mono_checked_build_test_enable_all" = "xyes"; then
  3437. eval "mono_checked_build_test_enable_gc='yes'"
  3438. eval "mono_checked_build_test_enable_metadata='yes'"
  3439. eval "mono_checked_build_test_enable_thread='yes'"
  3440. fi
  3441. if test "x$mono_checked_build_test_enable_gc" = "xyes"; then
  3442. AC_DEFINE(ENABLE_CHECKED_BUILD_GC, 1, [Enable GC checked build])
  3443. fi
  3444. if test "x$mono_checked_build_test_enable_metadata" = "xyes"; then
  3445. AC_DEFINE(ENABLE_CHECKED_BUILD_METADATA, 1, [Enable metadata checked build])
  3446. fi
  3447. if test "x$mono_checked_build_test_enable_thread" = "xyes"; then
  3448. AC_DEFINE(ENABLE_CHECKED_BUILD_THREAD, 1, [Enable thread checked build])
  3449. fi
  3450. ], [])
  3451. AC_CHECK_HEADER([malloc.h],
  3452. [AC_DEFINE([HAVE_USR_INCLUDE_MALLOC_H], [1],
  3453. [Define to 1 if you have /usr/include/malloc.h.])],,)
  3454. if test x"$GCC" = xyes; then
  3455. # Implicit function declarations are not 64 bit safe
  3456. # Do this late, since this causes lots of configure tests to fail
  3457. CFLAGS="$CFLAGS -Werror-implicit-function-declaration"
  3458. # jay has a lot of implicit declarations
  3459. JAY_CFLAGS="-Wno-implicit-function-declaration"
  3460. fi
  3461. # When --disable-shared is used, libtool transforms libmono-2.0.la into libmono-2.0.so
  3462. # instead of libmono-static.a
  3463. if test "x$enable_shared" = "xno" -a "x$enable_executables" = "xyes"; then
  3464. LIBMONO_LA=libmini-static.la
  3465. else
  3466. if test x$buildsgen = xyes; then
  3467. LIBMONO_LA=libmonosgen-$API_VER.la
  3468. else
  3469. LIBMONO_LA=libmonoboehm-$API_VER.la
  3470. fi
  3471. fi
  3472. AC_SUBST(LIBMONO_LA)
  3473. if test x$DISABLE_MCS_DOCS = xyes; then
  3474. docs_dir=""
  3475. else
  3476. docs_dir=docs
  3477. fi
  3478. AC_SUBST(docs_dir)
  3479. ## Maybe should also disable if mcsdir is invalid. Let's punt the issue for now.
  3480. AM_CONDITIONAL(BUILD_MCS, [test x$cross_compiling = xno && test x$enable_mcs_build != xno])
  3481. libmono_ldflags="$libmono_ldflags $LIBS"
  3482. AM_CONDITIONAL(MIPS_GCC, test ${TARGET}${ac_cv_prog_gcc} = MIPSyes)
  3483. AM_CONDITIONAL(MIPS_SGI, test ${TARGET}${ac_cv_prog_gcc} = MIPSno)
  3484. AM_CONDITIONAL(SPARC, test x$TARGET = xSPARC)
  3485. AM_CONDITIONAL(SPARC64, test x$TARGET = xSPARC64)
  3486. AM_CONDITIONAL(X86, test x$TARGET = xX86)
  3487. AM_CONDITIONAL(AMD64, test x$TARGET = xAMD64)
  3488. AM_CONDITIONAL(IA64, test x$TARGET = xIA64)
  3489. AM_CONDITIONAL(MIPS, test x$TARGET = xMIPS)
  3490. AM_CONDITIONAL(POWERPC, test x$TARGET = xPOWERPC)
  3491. AM_CONDITIONAL(POWERPC64, test x$TARGET = xPOWERPC64)
  3492. AM_CONDITIONAL(ARM, test x$TARGET = xARM)
  3493. AM_CONDITIONAL(ARM64, test x$TARGET = xARM64)
  3494. AM_CONDITIONAL(S390X, test x$TARGET = xS390X)
  3495. AM_CONDITIONAL(HOST_X86, test x$HOST = xX86)
  3496. AM_CONDITIONAL(HOST_AMD64, test x$HOST = xAMD64)
  3497. AM_CONDITIONAL(HOST_ARM, test x$HOST = xARM)
  3498. AM_CONDITIONAL(HOST_ARM64, test x$HOST = xARM64)
  3499. AM_CONDITIONAL(CROSS_COMPILE, test "x$host" != "x$target")
  3500. AC_SUBST(LIBC)
  3501. AC_SUBST(INTL)
  3502. AC_SUBST(SQLITE)
  3503. AC_SUBST(SQLITE3)
  3504. AC_SUBST(X11)
  3505. AC_SUBST(GDKX11)
  3506. AC_SUBST(GTKX11)
  3507. AC_SUBST(XINERAMA)
  3508. AC_DEFINE_UNQUOTED(MONO_ARCHITECTURE,"$arch_target",[The architecture this is running on])
  3509. AC_SUBST(arch_target)
  3510. AC_SUBST(CFLAGS)
  3511. AC_SUBST(CPPFLAGS)
  3512. AC_SUBST(LDFLAGS)
  3513. #This must always be defined when building the runtime
  3514. AC_DEFINE(MONO_INSIDE_RUNTIME,1, [Disable banned functions from being used by the runtime])
  3515. mono_build_root=`pwd`
  3516. AC_SUBST(mono_build_root)
  3517. mono_runtime=mono/mini/mono
  3518. AC_SUBST(mono_runtime)
  3519. mono_cfg_root=$mono_build_root/runtime
  3520. if test x$host_win32 = xyes; then
  3521. if test "x$cross_compiling" = "xno"; then
  3522. mono_cfg_dir=`cygpath -w -a $mono_cfg_root`\\etc
  3523. else
  3524. mono_cfg_dir=`echo $mono_cfg_root | tr '/' '\\'`\\etc
  3525. fi
  3526. else
  3527. mono_cfg_dir=$mono_cfg_root/etc
  3528. fi
  3529. AC_SUBST(mono_cfg_dir)
  3530. AC_CONFIG_FILES([po/mcs/Makefile.in])
  3531. AC_CONFIG_FILES([runtime/mono-wrapper],[chmod +x runtime/mono-wrapper])
  3532. AC_CONFIG_FILES([runtime/monodis-wrapper],[chmod +x runtime/monodis-wrapper])
  3533. AC_CONFIG_COMMANDS([runtime/etc/mono/1.0/machine.config],
  3534. [ depth=../../../..
  3535. case $srcdir in
  3536. [[\\/$]]* | ?:[[\\/]]* ) reldir=$srcdir ;;
  3537. .) reldir=$depth ;;
  3538. *) reldir=$depth/$srcdir ;;
  3539. esac
  3540. $ac_aux_dir/install-sh -d runtime/etc/mono/1.0
  3541. cd runtime/etc/mono/1.0
  3542. rm -f machine.config
  3543. $LN_S $reldir/data/net_1_1/machine.config machine.config
  3544. cd $depth
  3545. ],[LN_S='$LN_S'])
  3546. AC_CONFIG_COMMANDS([runtime/etc/mono/2.0/machine.config],
  3547. [ depth=../../../..
  3548. case $srcdir in
  3549. [[\\/$]]* | ?:[[\\/]]* ) reldir=$srcdir ;;
  3550. .) reldir=$depth ;;
  3551. *) reldir=$depth/$srcdir ;;
  3552. esac
  3553. $ac_aux_dir/install-sh -d runtime/etc/mono/2.0
  3554. cd runtime/etc/mono/2.0
  3555. rm -f machine.config
  3556. $LN_S $reldir/data/net_2_0/machine.config machine.config
  3557. cd $depth
  3558. ],[LN_S='$LN_S'])
  3559. AC_CONFIG_COMMANDS([runtime/etc/mono/2.0/web.config],
  3560. [ depth=../../../..
  3561. case $srcdir in
  3562. [[\\/$]]* | ?:[[\\/]]* ) reldir=$srcdir ;;
  3563. .) reldir=$depth ;;
  3564. *) reldir=$depth/$srcdir ;;
  3565. esac
  3566. $ac_aux_dir/install-sh -d runtime/etc/mono/2.0
  3567. cd runtime/etc/mono/2.0
  3568. rm -f web.config
  3569. $LN_S $reldir/data/net_2_0/web.config web.config
  3570. cd $depth
  3571. ],[LN_S='$LN_S'])
  3572. AC_CONFIG_COMMANDS([runtime/etc/mono/browscap.ini],
  3573. [ depth=../../..
  3574. case $srcdir in
  3575. [[\\/$]]* | ?:[[\\/]]* ) reldir=$srcdir ;;
  3576. .) reldir=$depth ;;
  3577. *) reldir=$depth/$srcdir ;;
  3578. esac
  3579. $ac_aux_dir/install-sh -d runtime/etc/mono/
  3580. cd runtime/etc/mono/
  3581. rm -f browscap.ini
  3582. $LN_S $reldir/data/browscap.ini browscap.ini
  3583. cd $depth
  3584. ],[LN_S='$LN_S'])
  3585. AC_CONFIG_COMMANDS([runtime/etc/mono/2.0/Browsers/Compat.browser],
  3586. [ depth=../../../../..
  3587. case $srcdir in
  3588. [[\\/$]]* | ?:[[\\/]]* ) reldir=$srcdir ;;
  3589. .) reldir=$depth ;;
  3590. *) reldir=$depth/$srcdir ;;
  3591. esac
  3592. $ac_aux_dir/install-sh -d runtime/etc/mono/2.0/Browsers/
  3593. cd runtime/etc/mono/2.0/Browsers
  3594. rm -f Compat.browser
  3595. $LN_S $reldir/data/Browsers/Compat.browser Compat.browser
  3596. cd $depth
  3597. ],[LN_S='$LN_S'])
  3598. AC_CONFIG_COMMANDS([runtime/etc/mono/4.0/Browsers/Compat.browser],
  3599. [ depth=../../../../..
  3600. case $srcdir in
  3601. [[\\/$]]* | ?:[[\\/]]* ) reldir=$srcdir ;;
  3602. .) reldir=$depth ;;
  3603. *) reldir=$depth/$srcdir ;;
  3604. esac
  3605. $ac_aux_dir/install-sh -d runtime/etc/mono/4.0/Browsers/
  3606. cd runtime/etc/mono/4.0/Browsers
  3607. rm -f Compat.browser
  3608. $LN_S $reldir/data/Browsers/Compat.browser Compat.browser
  3609. cd $depth
  3610. ],[LN_S='$LN_S'])
  3611. AC_CONFIG_COMMANDS([runtime/etc/mono/4.5/Browsers/Compat.browser],
  3612. [ depth=../../../../..
  3613. case $srcdir in
  3614. [[\\/$]]* | ?:[[\\/]]* ) reldir=$srcdir ;;
  3615. .) reldir=$depth ;;
  3616. *) reldir=$depth/$srcdir ;;
  3617. esac
  3618. $ac_aux_dir/install-sh -d runtime/etc/mono/4.5/Browsers/
  3619. cd runtime/etc/mono/4.5/Browsers
  3620. rm -f Compat.browser
  3621. $LN_S $reldir/data/Browsers/Compat.browser Compat.browser
  3622. cd $depth
  3623. ],[LN_S='$LN_S'])
  3624. AC_CONFIG_COMMANDS([runtime/etc/mono/4.0/machine.config],
  3625. [ depth=../../../..
  3626. case $srcdir in
  3627. [[\\/$]]* | ?:[[\\/]]* ) reldir=$srcdir ;;
  3628. .) reldir=$depth ;;
  3629. *) reldir=$depth/$srcdir ;;
  3630. esac
  3631. $ac_aux_dir/install-sh -d runtime/etc/mono/4.0
  3632. cd runtime/etc/mono/4.0
  3633. rm -f machine.config
  3634. $LN_S $reldir/data/net_4_0/machine.config machine.config
  3635. cd $depth
  3636. ],[LN_S='$LN_S'])
  3637. AC_CONFIG_COMMANDS([runtime/etc/mono/4.0/web.config],
  3638. [ depth=../../../..
  3639. case $srcdir in
  3640. [[\\/$]]* | ?:[[\\/]]* ) reldir=$srcdir ;;
  3641. .) reldir=$depth ;;
  3642. *) reldir=$depth/$srcdir ;;
  3643. esac
  3644. $ac_aux_dir/install-sh -d runtime/etc/mono/4.0
  3645. cd runtime/etc/mono/4.0
  3646. rm -f web.config
  3647. $LN_S $reldir/data/net_4_0/web.config web.config
  3648. cd $depth
  3649. ],[LN_S='$LN_S'])
  3650. AC_CONFIG_COMMANDS([runtime/etc/mono/4.5/machine.config],
  3651. [ depth=../../../..
  3652. case $srcdir in
  3653. [[\\/$]]* | ?:[[\\/]]* ) reldir=$srcdir ;;
  3654. .) reldir=$depth ;;
  3655. *) reldir=$depth/$srcdir ;;
  3656. esac
  3657. $ac_aux_dir/install-sh -d runtime/etc/mono/4.5
  3658. cd runtime/etc/mono/4.5
  3659. rm -f machine.config
  3660. $LN_S $reldir/data/net_4_5/machine.config machine.config
  3661. cd $depth
  3662. ],[LN_S='$LN_S'])
  3663. AC_CONFIG_COMMANDS([runtime/etc/mono/4.5/web.config],
  3664. [ depth=../../../..
  3665. case $srcdir in
  3666. [[\\/$]]* | ?:[[\\/]]* ) reldir=$srcdir ;;
  3667. .) reldir=$depth ;;
  3668. *) reldir=$depth/$srcdir ;;
  3669. esac
  3670. $ac_aux_dir/install-sh -d runtime/etc/mono/4.5
  3671. cd runtime/etc/mono/4.5
  3672. rm -f web.config
  3673. $LN_S $reldir/data/net_4_5/web.config web.config
  3674. cd $depth
  3675. ],[LN_S='$LN_S'])
  3676. AC_CONFIG_COMMANDS([quiet-libtool], [sed -e 's/echo "copying selected/# "copying selected/g' < libtool > libtool.tmp && mv libtool.tmp libtool && chmod a+x libtool; sed -e 's/$ECHO "copying selected/# "copying selected/g' < libtool > libtool.tmp && mv libtool.tmp libtool && chmod a+x libtool])
  3677. AC_CONFIG_COMMANDS([nolock-libtool], [sed -e 's/lock_old_archive_extraction=yes/lock_old_archive_extraction=no/g' < libtool > libtool.tmp && mv libtool.tmp libtool && chmod a+x libtool])
  3678. AC_OUTPUT([
  3679. Makefile
  3680. mono-uninstalled.pc
  3681. acceptance-tests/Makefile
  3682. llvm/Makefile
  3683. scripts/mono-find-provides
  3684. scripts/mono-find-requires
  3685. mono/Makefile
  3686. mono/utils/Makefile
  3687. mono/metadata/Makefile
  3688. mono/dis/Makefile
  3689. mono/cil/Makefile
  3690. mono/arch/Makefile
  3691. mono/arch/x86/Makefile
  3692. mono/arch/amd64/Makefile
  3693. mono/arch/ppc/Makefile
  3694. mono/arch/sparc/Makefile
  3695. mono/arch/s390x/Makefile
  3696. mono/arch/arm/Makefile
  3697. mono/arch/arm64/Makefile
  3698. mono/arch/ia64/Makefile
  3699. mono/arch/mips/Makefile
  3700. mono/sgen/Makefile
  3701. mono/tests/Makefile
  3702. mono/tests/tests-config
  3703. mono/tests/assemblyresolve/Makefile
  3704. mono/tests/gc-descriptors/Makefile
  3705. mono/unit-tests/Makefile
  3706. mono/benchmark/Makefile
  3707. mono/io-layer/Makefile
  3708. mono/mini/Makefile
  3709. mono/profiler/Makefile
  3710. m4/Makefile
  3711. ikvm-native/Makefile
  3712. scripts/Makefile
  3713. man/Makefile
  3714. docs/Makefile
  3715. data/Makefile
  3716. data/net_2_0/Makefile
  3717. data/net_4_0/Makefile
  3718. data/net_4_5/Makefile
  3719. data/net_2_0/Browsers/Makefile
  3720. data/net_4_0/Browsers/Makefile
  3721. data/net_4_5/Browsers/Makefile
  3722. data/mint.pc
  3723. data/mono-2.pc
  3724. data/monosgen-2.pc
  3725. data/mono.pc
  3726. data/mono-cairo.pc
  3727. data/mono-nunit.pc
  3728. data/mono-options.pc
  3729. data/mono-lineeditor.pc
  3730. data/monodoc.pc
  3731. data/dotnet.pc
  3732. data/dotnet35.pc
  3733. data/wcf.pc
  3734. data/cecil.pc
  3735. data/system.web.extensions_1.0.pc
  3736. data/system.web.extensions.design_1.0.pc
  3737. data/system.web.mvc.pc
  3738. data/system.web.mvc2.pc
  3739. data/system.web.mvc3.pc
  3740. data/aspnetwebstack.pc
  3741. data/reactive.pc
  3742. samples/Makefile
  3743. support/Makefile
  3744. data/config
  3745. tools/Makefile
  3746. tools/locale-builder/Makefile
  3747. tools/sgen/Makefile
  3748. tools/monograph/Makefile
  3749. tools/pedump/Makefile
  3750. runtime/Makefile
  3751. msvc/Makefile
  3752. po/Makefile
  3753. ])
  3754. # Update all submodules recursively to ensure everything is checked out
  3755. $srcdir/scripts/update_submodules
  3756. if test x$host_win32 = xyes; then
  3757. # Get rid of 'cyg' prefixes in library names
  3758. sed -e "s/\/cyg\//\/\//" libtool > libtool.new; mv libtool.new libtool; chmod 755 libtool
  3759. # libtool seems to inherit -mno-cygwin from our CFLAGS, and uses it to compile its executable
  3760. # wrapper scripts which use exec(). gcc has no problem compiling+linking this, but the resulting
  3761. # executable doesn't work...
  3762. sed -e "s,-mno-cygwin,,g" libtool > libtool.new; mv libtool.new libtool; chmod 755 libtool
  3763. fi
  3764. if test x$host_darwin = xyes; then
  3765. # This doesn't seem to be required and it slows down parallel builds
  3766. sed -e 's,lock_old_archive_extraction=yes,lock_old_archive_extraction=no,g' < libtool > libtool.new && mv libtool.new libtool && chmod +x libtool
  3767. fi
  3768. (
  3769. case $prefix in
  3770. NONE) prefix=$ac_default_prefix ;;
  3771. esac
  3772. case $exec_prefix in
  3773. NONE) exec_prefix='${prefix}' ;;
  3774. esac
  3775. #
  3776. # If we are cross compiling, we don't build in the mcs/ tree. Let us not clobber
  3777. # any existing config.make. This allows people to share the same source tree
  3778. # with different build directories, one native and one cross
  3779. #
  3780. if test x$cross_compiling = xno && test x$enable_mcs_build != xno; then
  3781. test -w $mcs_topdir/build || chmod +w $mcs_topdir/build
  3782. echo "prefix=$prefix" > $mcs_topdir/build/config.make
  3783. echo "exec_prefix=$exec_prefix" >> $mcs_topdir/build/config.make
  3784. echo "sysconfdir=$sysconfdir" >> $mcs_topdir/build/config.make
  3785. echo 'mono_libdir=${exec_prefix}/lib' >> $mcs_topdir/build/config.make
  3786. echo 'IL_FLAGS = /debug' >> $mcs_topdir/build/config.make
  3787. echo "RUNTIME = $mono_build_root/runtime/mono-wrapper" >> $mcs_topdir/build/config.make
  3788. echo "ILDISASM = $mono_build_root/runtime/monodis-wrapper" >> $mcs_topdir/build/config.make
  3789. echo "JAY_CFLAGS = $JAY_CFLAGS" >> $mcs_topdir/build/config.make
  3790. case $INSTALL in
  3791. [[\\/$]]* | ?:[[\\/]]* ) mcs_INSTALL=$INSTALL ;;
  3792. *) mcs_INSTALL=$mono_build_root/$INSTALL ;;
  3793. esac
  3794. echo "INSTALL = $mcs_INSTALL" >> $mcs_topdir/build/config.make
  3795. export VERSION
  3796. [myver=$($AWK 'BEGIN {
  3797. split (ENVIRON["VERSION"] ".0.0.0", vsplit, ".")
  3798. if(length(vsplit [1]) > 4) {
  3799. split (substr(ENVIRON["VERSION"], 0, 4) "." substr(ENVIRON["VERSION"], 5) ".0.0", vsplit, ".")
  3800. }
  3801. print vsplit [1] "." vsplit [2] "." vsplit [3] "." vsplit [4]
  3802. }')]
  3803. echo "MONO_VERSION = $myver" >> $mcs_topdir/build/config.make
  3804. if test x$host_darwin = xyes; then
  3805. echo "PLATFORM = darwin" >> $mcs_topdir/build/config.make
  3806. fi
  3807. if test "x$PLATFORM_AOT_SUFFIX" != "x"; then
  3808. echo "PLATFORM_AOT_SUFFIX = $PLATFORM_AOT_SUFFIX" >> $mcs_topdir/build/config.make
  3809. fi
  3810. if test x$AOT_SUPPORTED = xyes -a x$enable_system_aot = xdefault; then
  3811. enable_system_aot=yes
  3812. fi
  3813. if test x$host_win32 = xno -a x$enable_system_aot = xyes; then
  3814. echo "ENABLE_AOT = 1" >> $mcs_topdir/build/config.make
  3815. fi
  3816. if test x$DISABLE_MCS_DOCS = xyes; then
  3817. echo "DISABLE_MCS_DOCS = yes" >> $mcs_topdir/build/config.make
  3818. fi
  3819. if test x$has_extension_module != xno; then
  3820. echo "EXTENSION_MODULE = 1" >> $srcdir/$mcsdir/build/config.make
  3821. fi
  3822. echo "DEFAULT_PROFILE = $default_profile" >> $srcdir/$mcsdir/build/config.make
  3823. if test "x$test_bcl_opt" = "xyes"; then
  3824. echo "BCL_OPTIMIZE = 1" >> $srcdir/$mcsdir/build/config.make
  3825. fi
  3826. if test "x$AOT_BUILD_FLAGS" != "x" ; then
  3827. echo "AOT_RUN_FLAGS=$AOT_RUN_FLAGS" >> $srcdir/$mcsdir/build/config.make
  3828. echo "AOT_BUILD_FLAGS=$AOT_BUILD_FLAGS" >> $srcdir/$mcsdir/build/config.make
  3829. fi
  3830. fi
  3831. )
  3832. libgdiplus_msg=${libgdiplus_loc:-assumed to be installed}
  3833. echo "
  3834. mcs source: $mcsdir
  3835. Engine:
  3836. Host: $host
  3837. Target: $target
  3838. GC: $gc_msg
  3839. TLS: $with_tls
  3840. SIGALTSTACK: $with_sigaltstack
  3841. Engine: $jit_status
  3842. BigArrays: $enable_big_arrays
  3843. DTrace: $enable_dtrace
  3844. LLVM Back End: $enable_llvm (dynamically loaded: $enable_loadedllvm)
  3845. Libraries:
  3846. .NET 4.x: $with_profile4_x
  3847. Xamarin.Android: $with_monodroid
  3848. Xamarin.iOS: $with_monotouch
  3849. Xamarin.WatchOS: $with_monotouch_watch
  3850. Xamarin.TVOS: $with_monotouch_tv
  3851. Xamarin.Mac: $with_xammac
  3852. mobile_static: $with_mobile_static
  3853. JNI support: $jdk_headers_found
  3854. libgdiplus: $libgdiplus_msg
  3855. zlib: $zlib_msg
  3856. $disabled
  3857. "
  3858. if test x$with_static_mono = xno -a "x$host_win32" != "xyes"; then
  3859. AC_MSG_WARN(Turning off static Mono is a risk, you might run into unexpected bugs)
  3860. fi