configure.ac 110 KB

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