configure.ac 118 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799
  1. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
  2. # 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012,
  3. # 2014, 2015, 2016, 2019, 2022 Free Software Foundation, Inc.
  4. #
  5. # This file is free software; you can redistribute it and/or modify it
  6. # under the terms of the GNU General Public License as published by
  7. # the Free Software Foundation; either version 3 of the License, or
  8. # (at your option) any later version.
  9. #
  10. # This program is distributed in the hope that it will be useful, but
  11. # WITHOUT ANY WARRANTY; without even the implied warranty of
  12. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  13. # General Public License for more details.
  14. #
  15. # You should have received a copy of the GNU General Public License
  16. # along with this program; see the file COPYING3. If not see
  17. # <http://www.gnu.org/licenses/>.
  18. ##############################################################################
  19. ### WARNING: this file contains embedded tabs. Do not run untabify on this file.
  20. m4_include(config/acx.m4)
  21. m4_include(config/override.m4)
  22. m4_include(config/proginstall.m4)
  23. m4_include(config/elf.m4)
  24. m4_include(config/ax_cxx_compile_stdcxx.m4)
  25. m4_include([libtool.m4])
  26. m4_include([ltoptions.m4])
  27. m4_include([ltsugar.m4])
  28. m4_include([ltversion.m4])
  29. m4_include([lt~obsolete.m4])
  30. m4_include([config/isl.m4])
  31. AC_INIT(move-if-change)
  32. AC_DISABLE_OPTION_CHECKING
  33. progname=$0
  34. # if PWD already has a value, it is probably wrong.
  35. if test -n "$PWD" ; then PWD=`${PWDCMD-pwd}`; fi
  36. # Export original configure arguments for use by sub-configures.
  37. # Quote arguments with shell meta charatcers.
  38. TOPLEVEL_CONFIGURE_ARGUMENTS=
  39. set -- "$progname" "$@"
  40. for ac_arg
  41. do
  42. case "$ac_arg" in
  43. *" "*|*" "*|*[[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\']]*)
  44. ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"`
  45. # if the argument is of the form -foo=baz, quote the baz part only
  46. ac_arg=`echo "'$ac_arg'" | sed "s/^'\([[-a-zA-Z0-9]]*=\)/\\1'/"` ;;
  47. *) ;;
  48. esac
  49. # Add the quoted argument to the list.
  50. TOPLEVEL_CONFIGURE_ARGUMENTS="$TOPLEVEL_CONFIGURE_ARGUMENTS $ac_arg"
  51. done
  52. if test "$silent" = yes; then
  53. TOPLEVEL_CONFIGURE_ARGUMENTS="$TOPLEVEL_CONFIGURE_ARGUMENTS --silent"
  54. fi
  55. # Remove the initial space we just introduced and, as these will be
  56. # expanded by make, quote '$'.
  57. TOPLEVEL_CONFIGURE_ARGUMENTS=`echo "x$TOPLEVEL_CONFIGURE_ARGUMENTS" | sed -e 's/^x *//' -e 's,\\$,$$,g'`
  58. AC_SUBST(TOPLEVEL_CONFIGURE_ARGUMENTS)
  59. # Find the build, host, and target systems.
  60. ACX_NONCANONICAL_BUILD
  61. ACX_NONCANONICAL_HOST
  62. ACX_NONCANONICAL_TARGET
  63. dnl Autoconf 2.5x and later will set a default program prefix if
  64. dnl --target was used, even if it was the same as --host. Disable
  65. dnl that behavior. This must be done before AC_CANONICAL_SYSTEM
  66. dnl to take effect.
  67. test "$host_noncanonical" = "$target_noncanonical" &&
  68. test "$program_prefix$program_suffix$program_transform_name" = \
  69. NONENONEs,x,x, &&
  70. program_transform_name=s,y,y,
  71. AC_CANONICAL_SYSTEM
  72. AC_ARG_PROGRAM
  73. m4_pattern_allow([^AS_FOR_TARGET$])dnl
  74. m4_pattern_allow([^AS_FOR_BUILD$])dnl
  75. # Get 'install' or 'install-sh' and its variants.
  76. AC_PROG_INSTALL
  77. ACX_PROG_LN
  78. AC_PROG_LN_S
  79. AC_PROG_SED
  80. AC_PROG_AWK
  81. srcpwd=`cd ${srcdir} ; ${PWDCMD-pwd}`
  82. # We pass INSTALL explicitly to sub-makes. Make sure that it is not
  83. # a relative path.
  84. if test "$INSTALL" = "${srcdir}/install-sh -c"; then
  85. INSTALL="${srcpwd}/install-sh -c"
  86. fi
  87. # Set srcdir to "." if that's what it is.
  88. # This is important for multilib support.
  89. pwd=`${PWDCMD-pwd}`
  90. if test "${pwd}" = "${srcpwd}" ; then
  91. srcdir=.
  92. fi
  93. topsrcdir=$srcpwd
  94. extra_host_args=
  95. ### To add a new directory to the tree, first choose whether it is a target
  96. ### or a host dependent tool. Then put it into the appropriate list
  97. ### (library or tools, host or target), doing a dependency sort.
  98. # Subdirs will be configured in the order listed in build_configdirs,
  99. # configdirs, or target_configdirs; see the serialization section below.
  100. # Dependency sorting is only needed when *configuration* must be done in
  101. # a particular order. In all cases a dependency should be specified in
  102. # the Makefile, whether or not it's implicitly specified here.
  103. # Double entries in build_configdirs, configdirs, or target_configdirs may
  104. # cause circular dependencies and break everything horribly.
  105. # these library is used by various programs built for the build
  106. # environment
  107. #
  108. build_libs="build-libiberty build-libcpp"
  109. # these tools are built for the build environment
  110. build_tools="build-texinfo build-flex build-bison build-m4 build-fixincludes"
  111. # these libraries are used by various programs built for the host environment
  112. #f
  113. host_libs="intl libiberty opcodes bfd readline tcl tk itcl libgui zlib libbacktrace libcpp libcody libdecnumber gmp mpfr mpc isl libelf libiconv libctf"
  114. # these tools are built for the host environment
  115. # Note, the powerpc-eabi build depends on sim occurring before gdb in order to
  116. # know that we are building the simulator.
  117. # binutils, gas and ld appear in that order because it makes sense to run
  118. # "make check" in that particular order.
  119. # If --enable-gold is used, "gold" may replace "ld".
  120. host_tools="texinfo flex bison binutils gas ld fixincludes gcc cgen sid sim gdb gdbserver gprof etc expect dejagnu m4 utils guile fastjar gnattools libcc1 gotools c++tools"
  121. # these libraries are built for the target environment, and are built after
  122. # the host libraries and the host tools (which may be a cross compiler)
  123. # Note that libiberty is not a target library.
  124. target_libraries="target-libgcc \
  125. target-libbacktrace \
  126. target-libgloss \
  127. target-newlib \
  128. target-libgomp \
  129. target-liboffloadmic \
  130. target-libatomic \
  131. target-libitm \
  132. target-libstdc++-v3 \
  133. target-libsanitizer \
  134. target-libvtv \
  135. target-libssp \
  136. target-libquadmath \
  137. target-libgfortran \
  138. target-libffi \
  139. target-libobjc \
  140. target-libada \
  141. target-libgo \
  142. target-libphobos \
  143. target-zlib"
  144. # these tools are built using the target libraries, and are intended to
  145. # run only in the target environment
  146. #
  147. # note: any program that *uses* libraries that are in the "target_libraries"
  148. # list belongs in this list.
  149. #
  150. target_tools="target-rda"
  151. ################################################################################
  152. ## All tools belong in one of the four categories, and are assigned above
  153. ## We assign ${configdirs} this way to remove all embedded newlines. This
  154. ## is important because configure will choke if they ever get through.
  155. ## ${configdirs} is directories we build using the host tools.
  156. ## ${target_configdirs} is directories we build using the target tools.
  157. configdirs=`echo ${host_libs} ${host_tools}`
  158. target_configdirs=`echo ${target_libraries} ${target_tools}`
  159. build_configdirs=`echo ${build_libs} ${build_tools}`
  160. m4_divert_text([PARSE_ARGS],
  161. [case $srcdir in
  162. *" "*)
  163. m4_pushdef([AS_MESSAGE_LOG_FD], [])dnl
  164. AC_MSG_ERROR([path to source, $srcdir, contains spaces])
  165. m4_popdef([AS_MESSAGE_LOG_FD])dnl
  166. ;;
  167. esac
  168. ac_subdirs_all=`cd $srcdir && echo */configure | sed 's,/configure,,g'`
  169. ])
  170. ################################################################################
  171. srcname="gnu development package"
  172. # This gets set non-empty for some net releases of packages.
  173. appdirs=""
  174. # Define is_cross_compiler to save on calls to 'test'.
  175. is_cross_compiler=
  176. if test x"${host}" = x"${target}" ; then
  177. is_cross_compiler=no
  178. else
  179. is_cross_compiler=yes
  180. fi
  181. # Find the build and target subdir names.
  182. GCC_TOPLEV_SUBDIRS
  183. # Be sure to cover against remnants of an in-tree build.
  184. if test $srcdir != . && test -d $srcdir/host-${host_noncanonical}; then
  185. AC_MSG_ERROR([building out of tree but $srcdir contains host-${host_noncanonical}.
  186. Use a pristine source tree when building in a separate tree])
  187. fi
  188. # Skipdirs are removed silently.
  189. skipdirs=
  190. # Noconfigdirs are removed loudly.
  191. noconfigdirs=""
  192. use_gnu_ld=
  193. # Make sure we don't let GNU ld be added if we didn't want it.
  194. if test x$with_gnu_ld = xno ; then
  195. use_gnu_ld=no
  196. noconfigdirs="$noconfigdirs ld gold"
  197. fi
  198. use_gnu_as=
  199. # Make sure we don't let GNU as be added if we didn't want it.
  200. if test x$with_gnu_as = xno ; then
  201. use_gnu_as=no
  202. noconfigdirs="$noconfigdirs gas"
  203. fi
  204. use_included_zlib=
  205. AC_ARG_WITH(system-zlib,
  206. [AS_HELP_STRING([--with-system-zlib], [use installed libz])])
  207. # Make sure we don't let ZLIB be added if we didn't want it.
  208. if test x$with_system_zlib = xyes ; then
  209. use_included_zlib=no
  210. noconfigdirs="$noconfigdirs zlib"
  211. fi
  212. # some tools are so dependent upon X11 that if we're not building with X,
  213. # it's not even worth trying to configure, much less build, that tool.
  214. case ${with_x} in
  215. yes | "") ;; # the default value for this tree is that X11 is available
  216. no)
  217. skipdirs="${skipdirs} tk itcl libgui"
  218. # We won't be able to build gdbtk without X.
  219. enable_gdbtk=no
  220. ;;
  221. *) echo "*** bad value \"${with_x}\" for -with-x flag; ignored" 1>&2 ;;
  222. esac
  223. # Some are only suitable for cross toolchains.
  224. # Remove these if host=target.
  225. cross_only="target-libgloss target-newlib target-opcodes"
  226. case $is_cross_compiler in
  227. no) skipdirs="${skipdirs} ${cross_only}" ;;
  228. esac
  229. # If both --with-headers and --with-libs are specified, default to
  230. # --without-newlib.
  231. if test x"${with_headers}" != x && test x"${with_headers}" != xno \
  232. && test x"${with_libs}" != x && test x"${with_libs}" != xno ; then
  233. if test x"${with_newlib}" = x ; then
  234. with_newlib=no
  235. fi
  236. fi
  237. # Recognize --with-newlib/--without-newlib.
  238. case ${with_newlib} in
  239. no) skipdirs="${skipdirs} target-newlib" ;;
  240. yes) skipdirs=`echo " ${skipdirs} " | sed -e 's/ target-newlib / /'` ;;
  241. esac
  242. AC_ARG_ENABLE(as-accelerator-for,
  243. [AS_HELP_STRING([--enable-as-accelerator-for=ARG],
  244. [build as offload target compiler.
  245. Specify offload host triple by ARG])])
  246. AC_ARG_ENABLE(offload-targets,
  247. [AS_HELP_STRING([--enable-offload-targets=LIST],
  248. [enable offloading to devices from comma-separated LIST of
  249. TARGET[=DIR]. Use optional path to find offload target compiler
  250. during the build])],
  251. [
  252. if test x"$enable_offload_targets" = x; then
  253. AC_MSG_ERROR([no offload targets specified])
  254. fi
  255. ], [enable_offload_targets=])
  256. AC_ARG_ENABLE(offload-defaulted,
  257. [AS_HELP_STRING([--enable-offload-defaulted]
  258. [If enabled, configured but not installed offload compilers and
  259. libgomp plugins are silently ignored. Useful for distribution
  260. compilers where those are in separate optional packages.])],
  261. [enable_offload_defaulted=$enableval],
  262. [enable_offload_defaulted=])
  263. # Handle --enable-gold, --enable-ld.
  264. # --disable-gold [--enable-ld]
  265. # Build only ld. Default option.
  266. # --enable-gold [--enable-ld]
  267. # Build both gold and ld. Install gold as "ld.gold", install ld
  268. # as "ld.bfd" and "ld".
  269. # --enable-gold=default [--enable-ld]
  270. # Build both gold and ld. Install gold as "ld.gold" and "ld",
  271. # install ld as "ld.bfd".
  272. # --enable-gold[=default] --disable-ld
  273. # Build only gold, which is then installed as both "ld.gold" and "ld".
  274. # --enable-gold --enable-ld=default
  275. # Build both gold (installed as "ld.gold") and ld (installed as "ld"
  276. # and ld.bfd).
  277. # In other words, ld is default
  278. # --enable-gold=default --enable-ld=default
  279. # Error.
  280. default_ld=
  281. AC_ARG_ENABLE(gold,
  282. [AS_HELP_STRING([[--enable-gold[=ARG]]],
  283. [build gold @<:@ARG={default,yes,no}@:>@])],
  284. ENABLE_GOLD=$enableval,
  285. ENABLE_GOLD=no)
  286. case "${ENABLE_GOLD}" in
  287. yes|default)
  288. # Check for ELF target.
  289. is_elf=no
  290. case "${target}" in
  291. *-*-elf* | *-*-sysv4* | *-*-unixware* | *-*-eabi* | hppa*64*-*-hpux* \
  292. | *-*-linux* | *-*-gnu* | frv-*-uclinux* | *-*-irix5* | *-*-irix6* \
  293. | *-*-netbsd* | *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* \
  294. | *-*-solaris2* | *-*-nto* | *-*-nacl*)
  295. case "${target}" in
  296. *-*-linux*aout* | *-*-linux*oldld*)
  297. ;;
  298. *)
  299. is_elf=yes
  300. ;;
  301. esac
  302. esac
  303. if test "$is_elf" = "yes"; then
  304. # Check for target supported by gold.
  305. case "${target}" in
  306. i?86-*-* | x86_64-*-* | sparc*-*-* | powerpc*-*-* | arm*-*-* \
  307. | aarch64*-*-* | tilegx*-*-* | mips*-*-* | s390*-*-* | loongarch*-*-*)
  308. configdirs="$configdirs gold"
  309. if test x${ENABLE_GOLD} = xdefault; then
  310. default_ld=gold
  311. fi
  312. ENABLE_GOLD=yes
  313. ;;
  314. esac
  315. fi
  316. ;;
  317. no)
  318. ;;
  319. *)
  320. AC_MSG_ERROR([invalid --enable-gold argument])
  321. ;;
  322. esac
  323. AC_ARG_ENABLE(ld,
  324. [AS_HELP_STRING([[--enable-ld[=ARG]]],
  325. [build ld @<:@ARG={default,yes,no}@:>@])],
  326. ENABLE_LD=$enableval,
  327. ENABLE_LD=yes)
  328. case "${ENABLE_LD}" in
  329. default)
  330. if test x${default_ld} != x; then
  331. AC_MSG_ERROR([either gold or ld can be the default ld])
  332. fi
  333. ;;
  334. yes)
  335. ;;
  336. no)
  337. if test x${ENABLE_GOLD} != xyes; then
  338. AC_MSG_WARN([neither ld nor gold are enabled])
  339. fi
  340. configdirs=`echo " ${configdirs} " | sed -e 's/ ld / /'`
  341. ;;
  342. *)
  343. AC_MSG_ERROR([invalid --enable-ld argument])
  344. ;;
  345. esac
  346. # PR gas/19109
  347. # Decide the default method for compressing debug sections.
  348. # Provide a configure time option to override our default.
  349. AC_ARG_ENABLE(compressed_debug_sections,
  350. [AS_HELP_STRING([--enable-compressed-debug-sections={all,gas,gold,ld,none}],
  351. [Enable compressed debug sections for gas, gold or ld by
  352. default])],
  353. [
  354. if test x"$enable_compressed_debug_sections" = xyes; then
  355. AC_MSG_ERROR([no program with compressed debug sections specified])
  356. fi
  357. ], [enable_compressed_debug_sections=])
  358. # Configure extra directories which are host specific
  359. case "${host}" in
  360. *-cygwin*)
  361. configdirs="$configdirs libtermcap" ;;
  362. esac
  363. # A target can indicate whether a language isn't supported for some reason.
  364. # Only spaces may be used in this macro; not newlines or tabs.
  365. unsupported_languages=
  366. # Remove more programs from consideration, based on the host or
  367. # target this usually means that a port of the program doesn't
  368. # exist yet.
  369. case "${host}" in
  370. i[[3456789]]86-*-msdosdjgpp*)
  371. noconfigdirs="$noconfigdirs tcl tk itcl"
  372. ;;
  373. esac
  374. AC_ARG_ENABLE(libquadmath,
  375. AS_HELP_STRING([--disable-libquadmath],
  376. [do not build libquadmath directory]),
  377. ENABLE_LIBQUADMATH=$enableval,
  378. ENABLE_LIBQUADMATH=yes)
  379. if test "${ENABLE_LIBQUADMATH}" = "no" ; then
  380. noconfigdirs="$noconfigdirs target-libquadmath"
  381. fi
  382. AC_ARG_ENABLE(libquadmath-support,
  383. AS_HELP_STRING([--disable-libquadmath-support],
  384. [disable libquadmath support for Fortran]),
  385. ENABLE_LIBQUADMATH_SUPPORT=$enableval,
  386. ENABLE_LIBQUADMATH_SUPPORT=yes)
  387. enable_libquadmath_support=
  388. if test "${ENABLE_LIBQUADMATH_SUPPORT}" = "no" ; then
  389. enable_libquadmath_support=no
  390. fi
  391. AC_ARG_ENABLE(libada,
  392. [AS_HELP_STRING([--enable-libada], [build libada directory])],
  393. ENABLE_LIBADA=$enableval,
  394. ENABLE_LIBADA=yes)
  395. if test "${ENABLE_LIBADA}" != "yes" ; then
  396. noconfigdirs="$noconfigdirs gnattools"
  397. fi
  398. AC_ARG_ENABLE(libssp,
  399. [AS_HELP_STRING([--enable-libssp], [build libssp directory])],
  400. ENABLE_LIBSSP=$enableval,
  401. ENABLE_LIBSSP=yes)
  402. AC_ARG_ENABLE(libstdcxx,
  403. AS_HELP_STRING([--disable-libstdcxx],
  404. [do not build libstdc++-v3 directory]),
  405. ENABLE_LIBSTDCXX=$enableval,
  406. ENABLE_LIBSTDCXX=default)
  407. [if test "${ENABLE_LIBSTDCXX}" = "no" ; then
  408. noconfigdirs="$noconfigdirs target-libstdc++-v3"
  409. fi]
  410. # If this is accelerator compiler and its target is intelmic we enable
  411. # target liboffloadmic by default. If this is compiler with offloading
  412. # for intelmic we enable host liboffloadmic by default. Otherwise
  413. # liboffloadmic is disabled by default.
  414. AC_ARG_ENABLE([liboffloadmic],
  415. AC_HELP_STRING([[--enable-liboffloadmic[=ARG]]],
  416. [build liboffloadmic @<:@ARG={no,host,target}@:>@]),
  417. [case "$enableval" in
  418. no | host | target)
  419. enable_liboffloadmic=$enableval ;;
  420. *)
  421. AC_MSG_ERROR([--enable-liboffloadmic=no/host/target]) ;;
  422. esac],
  423. [if test x"$enable_as_accelerator_for" != x; then
  424. case "${target}" in
  425. *-intelmic-* | *-intelmicemul-*)
  426. enable_liboffloadmic=target
  427. extra_liboffloadmic_configure_flags="--enable-liboffloadmic=target"
  428. ;;
  429. *)
  430. enable_liboffloadmic=no
  431. ;;
  432. esac
  433. else
  434. case "${enable_offload_targets}" in
  435. *-intelmic-* | *-intelmicemul-*)
  436. enable_liboffloadmic=host
  437. extra_liboffloadmic_configure_flags="--enable-liboffloadmic=host"
  438. ;;
  439. *)
  440. enable_liboffloadmic=no
  441. ;;
  442. esac
  443. fi])
  444. AC_SUBST(extra_liboffloadmic_configure_flags)
  445. # Enable libgomp by default on hosted POSIX systems, and a few others.
  446. if test x$enable_libgomp = x ; then
  447. case "${target}" in
  448. *-*-linux* | *-*-gnu* | *-*-k*bsd*-gnu | *-*-kopensolaris*-gnu)
  449. ;;
  450. *-*-netbsd* | *-*-freebsd* | *-*-openbsd* | *-*-dragonfly*)
  451. ;;
  452. *-*-solaris2* | *-*-hpux11*)
  453. ;;
  454. *-*-darwin* | *-*-aix*)
  455. ;;
  456. nvptx*-*-* | amdgcn*-*-*)
  457. ;;
  458. *)
  459. noconfigdirs="$noconfigdirs target-libgomp"
  460. ;;
  461. esac
  462. fi
  463. # Disable libatomic on unsupported systems.
  464. if test -d ${srcdir}/libatomic; then
  465. if test x$enable_libatomic = x; then
  466. AC_MSG_CHECKING([for libatomic support])
  467. if (srcdir=${srcdir}/libatomic; \
  468. . ${srcdir}/configure.tgt; \
  469. test -n "$UNSUPPORTED")
  470. then
  471. AC_MSG_RESULT([no])
  472. noconfigdirs="$noconfigdirs target-libatomic"
  473. else
  474. AC_MSG_RESULT([yes])
  475. fi
  476. fi
  477. fi
  478. # Disable liboffloadmic on unsupported systems.
  479. if test -d ${srcdir}/liboffloadmic; then
  480. if test x$enable_liboffloadmic != xno; then
  481. AC_MSG_CHECKING([for liboffloadmic support])
  482. if (srcdir=${srcdir}/liboffloadmic; \
  483. . ${srcdir}/configure.tgt; \
  484. test -n "$UNSUPPORTED")
  485. then
  486. AC_MSG_RESULT([no])
  487. noconfigdirs="$noconfigdirs target-liboffloadmic"
  488. else
  489. AC_MSG_RESULT([yes])
  490. fi
  491. fi
  492. fi
  493. # Disable libitm on unsupported systems.
  494. if test -d ${srcdir}/libitm; then
  495. if test x$enable_libitm = x; then
  496. AC_MSG_CHECKING([for libitm support])
  497. if (srcdir=${srcdir}/libitm; \
  498. . ${srcdir}/configure.tgt; \
  499. test -n "$UNSUPPORTED")
  500. then
  501. AC_MSG_RESULT([no])
  502. noconfigdirs="$noconfigdirs target-libitm"
  503. else
  504. AC_MSG_RESULT([yes])
  505. fi
  506. fi
  507. fi
  508. # Disable libsanitizer on unsupported systems.
  509. if test -d ${srcdir}/libsanitizer; then
  510. if test x$enable_libsanitizer = x; then
  511. AC_MSG_CHECKING([for libsanitizer support])
  512. if (srcdir=${srcdir}/libsanitizer; \
  513. . ${srcdir}/configure.tgt; \
  514. test -n "$UNSUPPORTED")
  515. then
  516. AC_MSG_RESULT([no])
  517. noconfigdirs="$noconfigdirs target-libsanitizer"
  518. else
  519. AC_MSG_RESULT([yes])
  520. fi
  521. fi
  522. fi
  523. # Disable libvtv on unsupported systems.
  524. if test -d ${srcdir}/libvtv; then
  525. if test x$enable_libvtv = x; then
  526. AC_MSG_CHECKING([for libvtv support])
  527. if (srcdir=${srcdir}/libvtv; \
  528. . ${srcdir}/configure.tgt; \
  529. test "$VTV_SUPPORTED" != "yes")
  530. then
  531. AC_MSG_RESULT([no])
  532. noconfigdirs="$noconfigdirs target-libvtv"
  533. else
  534. AC_MSG_RESULT([yes])
  535. fi
  536. fi
  537. fi
  538. # Disable libquadmath for some systems.
  539. case "${target}" in
  540. avr-*-*)
  541. noconfigdirs="$noconfigdirs target-libquadmath"
  542. ;;
  543. # libquadmath is unused on AIX and libquadmath build process use of
  544. # LD_LIBRARY_PATH can break AIX bootstrap.
  545. powerpc-*-aix* | rs6000-*-aix*)
  546. noconfigdirs="$noconfigdirs target-libquadmath"
  547. ;;
  548. esac
  549. # Disable libssp for some systems.
  550. case "${target}" in
  551. avr-*-*)
  552. # No hosted I/O support.
  553. noconfigdirs="$noconfigdirs target-libssp"
  554. ;;
  555. bpf-*-*)
  556. noconfigdirs="$noconfigdirs target-libssp"
  557. ;;
  558. powerpc-*-aix* | rs6000-*-aix*)
  559. noconfigdirs="$noconfigdirs target-libssp"
  560. ;;
  561. pru-*-*)
  562. # No hosted I/O support.
  563. noconfigdirs="$noconfigdirs target-libssp"
  564. ;;
  565. rl78-*-*)
  566. # libssp uses a misaligned load to trigger a fault, but the RL78
  567. # doesn't fault for those - instead, it gives a build-time error
  568. # for explicit misaligned loads.
  569. noconfigdirs="$noconfigdirs target-libssp"
  570. ;;
  571. visium-*-*)
  572. # No hosted I/O support.
  573. noconfigdirs="$noconfigdirs target-libssp"
  574. ;;
  575. esac
  576. # Disable libstdc++-v3 for some systems.
  577. # Allow user to override this if they pass --enable-libstdcxx
  578. if test "${ENABLE_LIBSTDCXX}" = "default" ; then
  579. case "${target}" in
  580. *-*-vxworks*)
  581. # VxWorks uses the Dinkumware C++ library.
  582. noconfigdirs="$noconfigdirs target-libstdc++-v3"
  583. ;;
  584. amdgcn*-*-*)
  585. # Not ported/fails to build when using newlib.
  586. noconfigdirs="$noconfigdirs target-libstdc++-v3"
  587. ;;
  588. arm*-wince-pe*)
  589. # the C++ libraries don't build on top of CE's C libraries
  590. noconfigdirs="$noconfigdirs target-libstdc++-v3"
  591. ;;
  592. avr-*-*)
  593. noconfigdirs="$noconfigdirs target-libstdc++-v3"
  594. ;;
  595. bpf-*-*)
  596. noconfigdirs="$noconfigdirs target-libstdc++-v3"
  597. ;;
  598. ft32-*-*)
  599. noconfigdirs="$noconfigdirs target-libstdc++-v3"
  600. ;;
  601. esac
  602. fi
  603. # Disable C++ on systems where it is known to not work.
  604. # For testing, you can override this with --enable-languages=c++.
  605. case ,${enable_languages}, in
  606. *,c++,*)
  607. ;;
  608. *)
  609. case "${target}" in
  610. bpf-*-*)
  611. unsupported_languages="$unsupported_languages c++"
  612. ;;
  613. esac
  614. ;;
  615. esac
  616. # Disable Objc on systems where it is known to not work.
  617. # For testing, you can override this with --enable-languages=objc.
  618. case ,${enable_languages}, in
  619. *,objc,*)
  620. ;;
  621. *)
  622. case "${target}" in
  623. bpf-*-*)
  624. unsupported_languages="$unsupported_languages objc"
  625. ;;
  626. esac
  627. ;;
  628. esac
  629. # Disable D on systems where it is known to not work.
  630. # For testing, you can override this with --enable-languages=d.
  631. case ,${enable_languages}, in
  632. *,d,*)
  633. ;;
  634. *)
  635. case "${target}" in
  636. bpf-*-*)
  637. unsupported_languages="$unsupported_languages d"
  638. ;;
  639. esac
  640. ;;
  641. esac
  642. # Disable libphobos on unsupported systems.
  643. # For testing, you can override this with --enable-libphobos.
  644. if test -d ${srcdir}/libphobos; then
  645. if test x$enable_libphobos = x; then
  646. AC_MSG_CHECKING([for libphobos support])
  647. if (srcdir=${srcdir}/libphobos; \
  648. . ${srcdir}/configure.tgt; \
  649. test "$LIBPHOBOS_SUPPORTED" != "yes")
  650. then
  651. AC_MSG_RESULT([no])
  652. noconfigdirs="$noconfigdirs target-libphobos"
  653. else
  654. AC_MSG_RESULT([yes])
  655. fi
  656. fi
  657. fi
  658. # Disable Fortran for some systems.
  659. case "${target}" in
  660. mmix-*-*)
  661. # See <http://gcc.gnu.org/ml/gcc-patches/2004-11/msg00572.html>.
  662. unsupported_languages="$unsupported_languages fortran"
  663. ;;
  664. bpf-*-*)
  665. unsupported_languages="$unsupported_languages fortran"
  666. ;;
  667. esac
  668. # Disable libffi for some systems.
  669. case "${target}" in
  670. powerpc-*-darwin*)
  671. ;;
  672. i[[3456789]]86-*-darwin*)
  673. ;;
  674. x86_64-*-darwin[[912]]*)
  675. ;;
  676. *-*-darwin*)
  677. noconfigdirs="$noconfigdirs target-libffi"
  678. ;;
  679. *-*-netware*)
  680. noconfigdirs="$noconfigdirs target-libffi"
  681. ;;
  682. *-*-phoenix*)
  683. noconfigdirs="$noconfigdirs target-libffi"
  684. ;;
  685. *-*-rtems*)
  686. noconfigdirs="$noconfigdirs target-libffi"
  687. ;;
  688. *-*-tpf*)
  689. noconfigdirs="$noconfigdirs target-libffi"
  690. ;;
  691. *-*-uclinux*)
  692. noconfigdirs="$noconfigdirs target-libffi"
  693. ;;
  694. *-*-vxworks*)
  695. noconfigdirs="$noconfigdirs target-libffi"
  696. ;;
  697. aarch64*-*-freebsd*)
  698. noconfigdirs="$noconfigdirs target-libffi"
  699. ;;
  700. alpha*-*-*vms*)
  701. noconfigdirs="$noconfigdirs target-libffi"
  702. ;;
  703. arm*-*-freebsd*)
  704. noconfigdirs="$noconfigdirs target-libffi"
  705. ;;
  706. arm-wince-pe)
  707. noconfigdirs="$noconfigdirs target-libffi"
  708. ;;
  709. arm*-*-symbianelf*)
  710. noconfigdirs="$noconfigdirs target-libffi"
  711. ;;
  712. bpf-*-*)
  713. noconfigdirs="$noconfigdirs target-libffi"
  714. ;;
  715. cris-*-* | crisv32-*-*)
  716. case "${target}" in
  717. *-*-linux*)
  718. ;;
  719. *) # See PR46792 regarding target-libffi.
  720. noconfigdirs="$noconfigdirs target-libffi";;
  721. esac
  722. ;;
  723. hppa*64*-*-hpux*)
  724. noconfigdirs="$noconfigdirs target-libffi"
  725. ;;
  726. hppa*-hp-hpux11*)
  727. ;;
  728. hppa*-*-hpux*)
  729. noconfigdirs="$noconfigdirs target-libffi"
  730. ;;
  731. ia64*-*-*vms*)
  732. noconfigdirs="$noconfigdirs target-libffi"
  733. ;;
  734. i[[3456789]]86-w64-mingw*)
  735. noconfigdirs="$noconfigdirs target-libffi"
  736. ;;
  737. i[[3456789]]86-*-mingw*)
  738. noconfigdirs="$noconfigdirs target-libffi"
  739. ;;
  740. x86_64-*-mingw*)
  741. noconfigdirs="$noconfigdirs target-libffi"
  742. ;;
  743. mmix-*-*)
  744. noconfigdirs="$noconfigdirs target-libffi"
  745. ;;
  746. powerpc-*-aix*)
  747. ;;
  748. rs6000-*-aix*)
  749. ;;
  750. ft32-*-*)
  751. noconfigdirs="$noconfigdirs target-libffi"
  752. ;;
  753. *-*-lynxos*)
  754. noconfigdirs="$noconfigdirs target-libffi"
  755. ;;
  756. esac
  757. # Disable the go frontend on systems where it is known to not work. Please keep
  758. # this in sync with contrib/config-list.mk.
  759. case "${target}" in
  760. *-*-darwin* | *-*-cygwin* | *-*-mingw* | bpf-* )
  761. unsupported_languages="$unsupported_languages go"
  762. ;;
  763. esac
  764. # Only allow gdbserver on some systems.
  765. if test -d ${srcdir}/gdbserver; then
  766. if test x$enable_gdbserver = x; then
  767. AC_MSG_CHECKING([for gdbserver support])
  768. if (srcdir=${srcdir}/gdbserver; \
  769. . ${srcdir}/configure.srv; \
  770. test -n "$UNSUPPORTED")
  771. then
  772. AC_MSG_RESULT([no])
  773. noconfigdirs="$noconfigdirs gdbserver"
  774. else
  775. AC_MSG_RESULT([yes])
  776. fi
  777. fi
  778. fi
  779. # Disable libgo for some systems where it is known to not work.
  780. # For testing, you can easily override this with --enable-libgo.
  781. if test x$enable_libgo = x; then
  782. case "${target}" in
  783. *-*-darwin*)
  784. # PR 46986
  785. noconfigdirs="$noconfigdirs target-libgo"
  786. ;;
  787. *-*-cygwin* | *-*-mingw*)
  788. noconfigdirs="$noconfigdirs target-libgo"
  789. ;;
  790. bpf-*-*)
  791. noconfigdirs="$noconfigdirs target-libgo"
  792. ;;
  793. esac
  794. fi
  795. # Default libgloss CPU subdirectory.
  796. libgloss_dir="$target_cpu"
  797. case "${target}" in
  798. sh*-*-pe|mips*-*-pe|*arm-wince-pe)
  799. libgloss_dir=wince
  800. ;;
  801. aarch64*-*-* )
  802. libgloss_dir=aarch64
  803. ;;
  804. arm*-*-*)
  805. libgloss_dir=arm
  806. ;;
  807. cris-*-* | crisv32-*-*)
  808. libgloss_dir=cris
  809. ;;
  810. hppa*-*-*)
  811. libgloss_dir=pa
  812. ;;
  813. i[[3456789]]86-*-*)
  814. libgloss_dir=i386
  815. ;;
  816. loongarch*-*-*)
  817. libgloss_dir=loongarch
  818. ;;
  819. m68hc11-*-*|m6811-*-*|m68hc12-*-*|m6812-*-*)
  820. libgloss_dir=m68hc11
  821. ;;
  822. m68*-*-* | fido-*-*)
  823. libgloss_dir=m68k
  824. ;;
  825. mips*-*-*)
  826. libgloss_dir=mips
  827. ;;
  828. powerpc*-*-*)
  829. libgloss_dir=rs6000
  830. ;;
  831. pru-*-*)
  832. libgloss_dir=pru
  833. ;;
  834. sparc*-*-*)
  835. libgloss_dir=sparc
  836. ;;
  837. esac
  838. # Disable newlib and libgloss for various target OSes.
  839. case "${target}" in
  840. alpha*-dec-osf*)
  841. noconfigdirs="$noconfigdirs target-newlib target-libgloss"
  842. ;;
  843. i[[3456789]]86-*-linux*)
  844. # This section makes it possible to build newlib natively on linux.
  845. # If we are using a cross compiler then don't configure newlib.
  846. if test x${is_cross_compiler} != xno ; then
  847. noconfigdirs="$noconfigdirs target-newlib"
  848. fi
  849. noconfigdirs="$noconfigdirs target-libgloss"
  850. # If we are not using a cross compiler, do configure newlib.
  851. # Note however, that newlib will only be configured in this situation
  852. # if the --with-newlib option has been given, because otherwise
  853. # 'target-newlib' will appear in skipdirs.
  854. ;;
  855. i[[3456789]]86-*-rdos*)
  856. noconfigdirs="$noconfigdirs target-newlib target-libgloss"
  857. ;;
  858. sh*-*-pe|mips*-*-pe|arm-wince-pe)
  859. noconfigdirs="$noconfigdirs target-newlib target-libgloss"
  860. ;;
  861. sparc-*-sunos4*)
  862. noconfigdirs="$noconfigdirs target-newlib target-libgloss"
  863. ;;
  864. bpf-*-*)
  865. noconfigdirs="$noconfigdirs target-newlib target-libgloss"
  866. ;;
  867. *-*-aix*)
  868. noconfigdirs="$noconfigdirs target-newlib target-libgloss"
  869. ;;
  870. *-*-beos*)
  871. noconfigdirs="$noconfigdirs target-newlib target-libgloss"
  872. ;;
  873. *-*-chorusos)
  874. noconfigdirs="$noconfigdirs target-newlib target-libgloss"
  875. ;;
  876. *-*-dragonfly*)
  877. noconfigdirs="$noconfigdirs target-newlib target-libgloss"
  878. ;;
  879. *-*-freebsd*)
  880. noconfigdirs="$noconfigdirs target-newlib target-libgloss"
  881. ;;
  882. *-*-linux* | *-*-gnu* | *-*-k*bsd*-gnu | *-*-kopensolaris*-gnu)
  883. noconfigdirs="$noconfigdirs target-newlib target-libgloss"
  884. ;;
  885. *-*-lynxos*)
  886. noconfigdirs="$noconfigdirs target-newlib target-libgloss"
  887. ;;
  888. *-*-mingw*)
  889. noconfigdirs="$noconfigdirs target-newlib target-libgloss"
  890. ;;
  891. *-*-netbsd*)
  892. noconfigdirs="$noconfigdirs target-newlib target-libgloss"
  893. ;;
  894. *-*-netware*)
  895. noconfigdirs="$noconfigdirs target-newlib target-libgloss"
  896. ;;
  897. *-*-tpf*)
  898. noconfigdirs="$noconfigdirs target-newlib target-libgloss"
  899. ;;
  900. *-*-uclinux*)
  901. noconfigdirs="$noconfigdirs target-newlib target-libgloss"
  902. ;;
  903. *-*-vxworks*)
  904. noconfigdirs="$noconfigdirs target-newlib target-libgloss"
  905. ;;
  906. esac
  907. case "${target}" in
  908. *-*-chorusos)
  909. ;;
  910. aarch64-*-darwin*)
  911. noconfigdirs="$noconfigdirs ld gas gdb gprof"
  912. noconfigdirs="$noconfigdirs sim target-rda"
  913. ;;
  914. amdgcn*-*-*)
  915. ;;
  916. arm-*-darwin*)
  917. noconfigdirs="$noconfigdirs ld gas gdb gprof"
  918. noconfigdirs="$noconfigdirs sim target-rda"
  919. ;;
  920. powerpc-*-darwin*)
  921. noconfigdirs="$noconfigdirs ld gas gdb gprof"
  922. noconfigdirs="$noconfigdirs sim target-rda"
  923. ;;
  924. i[[3456789]]86-*-darwin*)
  925. noconfigdirs="$noconfigdirs ld gprof"
  926. noconfigdirs="$noconfigdirs sim target-rda"
  927. ;;
  928. x86_64-*-darwin[[912]]*)
  929. noconfigdirs="$noconfigdirs ld gas gprof"
  930. noconfigdirs="$noconfigdirs sim target-rda"
  931. ;;
  932. *-*-darwin*)
  933. noconfigdirs="$noconfigdirs ld gas gdb gprof"
  934. noconfigdirs="$noconfigdirs sim target-rda"
  935. ;;
  936. *-*-dragonfly*)
  937. ;;
  938. *-*-freebsd*)
  939. if test "x$with_gmp" = x \
  940. && ! test -d ${srcdir}/gmp \
  941. && test -f /usr/local/include/gmp.h; then
  942. with_gmp=/usr/local
  943. fi
  944. ;;
  945. *-*-kaos*)
  946. # Remove unsupported stuff on all kaOS configurations.
  947. noconfigdirs="$noconfigdirs target-libgloss"
  948. ;;
  949. *-*-netbsd*)
  950. ;;
  951. *-*-netware*)
  952. ;;
  953. *-*-phoenix*)
  954. noconfigdirs="$noconfigdirs target-libgloss"
  955. ;;
  956. *-*-rtems*)
  957. noconfigdirs="$noconfigdirs target-libgloss"
  958. ;;
  959. # The tpf target doesn't support gdb yet.
  960. *-*-tpf*)
  961. noconfigdirs="$noconfigdirs gdb tcl tk libgui itcl"
  962. ;;
  963. *-*-uclinux*)
  964. noconfigdirs="$noconfigdirs target-rda"
  965. ;;
  966. *-*-vxworks*)
  967. ;;
  968. alpha*-dec-osf*)
  969. # ld works, but does not support shared libraries.
  970. # gas doesn't generate exception information.
  971. noconfigdirs="$noconfigdirs gas ld"
  972. ;;
  973. alpha*-*-*vms*)
  974. noconfigdirs="$noconfigdirs gdb target-newlib target-libgloss"
  975. ;;
  976. alpha*-*-*)
  977. # newlib is not 64 bit ready
  978. noconfigdirs="$noconfigdirs target-newlib target-libgloss"
  979. ;;
  980. bpf-*-*)
  981. noconfigdirs="$noconfigdirs target-libobjc target-libbacktrace"
  982. ;;
  983. sh*-*-pe|mips*-*-pe|*arm-wince-pe)
  984. noconfigdirs="$noconfigdirs tcl tk itcl libgui sim"
  985. ;;
  986. arc*-*-*)
  987. noconfigdirs="$noconfigdirs sim"
  988. ;;
  989. arm-*-pe*)
  990. noconfigdirs="$noconfigdirs target-libgloss"
  991. ;;
  992. arm-*-riscix*)
  993. noconfigdirs="$noconfigdirs ld target-libgloss"
  994. ;;
  995. avr-*-*)
  996. if test x${with_avrlibc} != xno; then
  997. noconfigdirs="$noconfigdirs target-newlib target-libgloss"
  998. fi
  999. ;;
  1000. c4x-*-* | tic4x-*-*)
  1001. noconfigdirs="$noconfigdirs target-libgloss"
  1002. ;;
  1003. tic54x-*-*)
  1004. noconfigdirs="$noconfigdirs target-libgloss gdb"
  1005. ;;
  1006. d10v-*-*)
  1007. noconfigdirs="$noconfigdirs target-libgloss"
  1008. ;;
  1009. d30v-*-*)
  1010. noconfigdirs="$noconfigdirs gdb"
  1011. ;;
  1012. fr30-*-elf*)
  1013. noconfigdirs="$noconfigdirs gdb"
  1014. ;;
  1015. ft32-*-*)
  1016. noconfigdirs="$noconfigdirs target-rda gprof"
  1017. ;;
  1018. moxie-*-*)
  1019. noconfigdirs="$noconfigdirs"
  1020. ;;
  1021. h8300*-*-*)
  1022. noconfigdirs="$noconfigdirs target-libgloss"
  1023. ;;
  1024. h8500-*-*)
  1025. noconfigdirs="$noconfigdirs target-libgloss"
  1026. ;;
  1027. hppa1.1-*-osf* | hppa1.1-*-bsd* )
  1028. ;;
  1029. hppa*64*-*-hpux*)
  1030. noconfigdirs="$noconfigdirs gdb"
  1031. ;;
  1032. hppa*-*-hpux11*)
  1033. noconfigdirs="$noconfigdirs gdb ld"
  1034. ;;
  1035. hppa*64*-*-linux*)
  1036. ;;
  1037. hppa*-*-linux*)
  1038. ;;
  1039. hppa*-*-*elf* | \
  1040. hppa*-*-lites* | \
  1041. hppa*-*-openbsd* | \
  1042. hppa*64*-*-*)
  1043. ;;
  1044. hppa*-*-pro*)
  1045. ;;
  1046. hppa*-*-*)
  1047. noconfigdirs="$noconfigdirs ld"
  1048. ;;
  1049. i960-*-*)
  1050. noconfigdirs="$noconfigdirs gdb"
  1051. ;;
  1052. ia64*-*-elf*)
  1053. # No gdb support yet.
  1054. noconfigdirs="$noconfigdirs readline libgui itcl gdb"
  1055. ;;
  1056. ia64*-**-hpux*)
  1057. # No ld support yet.
  1058. noconfigdirs="$noconfigdirs gdb libgui itcl ld"
  1059. ;;
  1060. ia64*-*-*vms*)
  1061. # No ld support yet.
  1062. noconfigdirs="$noconfigdirs libgui itcl ld"
  1063. ;;
  1064. i[[3456789]]86-w64-mingw*)
  1065. ;;
  1066. i[[3456789]]86-*-mingw*)
  1067. target_configdirs="$target_configdirs target-winsup"
  1068. ;;
  1069. *-*-cygwin*)
  1070. target_configdirs="$target_configdirs target-libtermcap target-winsup"
  1071. noconfigdirs="$noconfigdirs target-libgloss"
  1072. # always build newlib if winsup directory is present.
  1073. if test -d "$srcdir/winsup/cygwin"; then
  1074. skipdirs=`echo " ${skipdirs} " | sed -e 's/ target-newlib / /'`
  1075. elif test -d "$srcdir/newlib"; then
  1076. echo "Warning: winsup/cygwin is missing so newlib can't be built."
  1077. fi
  1078. ;;
  1079. i[[3456789]]86-*-pe)
  1080. noconfigdirs="$noconfigdirs target-libgloss"
  1081. ;;
  1082. i[[3456789]]86-*-sco3.2v5*)
  1083. # The linker does not yet know about weak symbols in COFF,
  1084. # and is not configured to handle mixed ELF and COFF.
  1085. noconfigdirs="$noconfigdirs ld target-libgloss"
  1086. ;;
  1087. i[[3456789]]86-*-sco*)
  1088. noconfigdirs="$noconfigdirs gprof target-libgloss"
  1089. ;;
  1090. i[[3456789]]86-*-solaris2* | x86_64-*-solaris2.1[[0-9]]*)
  1091. noconfigdirs="$noconfigdirs target-libgloss"
  1092. ;;
  1093. i[[3456789]]86-*-sysv4*)
  1094. noconfigdirs="$noconfigdirs target-libgloss"
  1095. ;;
  1096. i[[3456789]]86-*-beos*)
  1097. noconfigdirs="$noconfigdirs gdb"
  1098. ;;
  1099. i[[3456789]]86-*-rdos*)
  1100. noconfigdirs="$noconfigdirs gdb"
  1101. ;;
  1102. mmix-*-*)
  1103. noconfigdirs="$noconfigdirs gdb"
  1104. ;;
  1105. mt-*-*)
  1106. noconfigdirs="$noconfigdirs sim"
  1107. ;;
  1108. nfp-*-*)
  1109. noconfigdirs="$noconfigdirs ld gas gdb gprof sim"
  1110. noconfigdirs="$noconfigdirs $target_libraries"
  1111. ;;
  1112. pdp11-*-*)
  1113. noconfigdirs="$noconfigdirs gdb gprof"
  1114. ;;
  1115. powerpc-*-aix*)
  1116. # copied from rs6000-*-* entry
  1117. noconfigdirs="$noconfigdirs gprof"
  1118. ;;
  1119. powerpc*-*-winnt* | powerpc*-*-pe*)
  1120. target_configdirs="$target_configdirs target-winsup"
  1121. noconfigdirs="$noconfigdirs gdb tcl tk target-libgloss itcl"
  1122. # always build newlib.
  1123. skipdirs=`echo " ${skipdirs} " | sed -e 's/ target-newlib / /'`
  1124. ;;
  1125. # This is temporary until we can link against shared libraries
  1126. powerpcle-*-solaris*)
  1127. noconfigdirs="$noconfigdirs gdb sim tcl tk itcl"
  1128. ;;
  1129. powerpc-*-beos*)
  1130. noconfigdirs="$noconfigdirs gdb"
  1131. ;;
  1132. rs6000-*-lynxos*)
  1133. noconfigdirs="$noconfigdirs gprof"
  1134. ;;
  1135. rs6000-*-aix*)
  1136. noconfigdirs="$noconfigdirs gprof"
  1137. ;;
  1138. rs6000-*-*)
  1139. noconfigdirs="$noconfigdirs gprof"
  1140. ;;
  1141. m68k-apollo-*)
  1142. noconfigdirs="$noconfigdirs ld binutils gprof target-libgloss"
  1143. ;;
  1144. microblaze*)
  1145. noconfigdirs="$noconfigdirs gprof"
  1146. ;;
  1147. mips*-sde-elf* | mips*-mti-elf* | mips*-img-elf*)
  1148. if test x$with_newlib = xyes; then
  1149. noconfigdirs="$noconfigdirs gprof"
  1150. fi
  1151. ;;
  1152. mips*-*-irix5*)
  1153. noconfigdirs="$noconfigdirs gprof target-libgloss"
  1154. ;;
  1155. mips*-*-irix6*)
  1156. noconfigdirs="$noconfigdirs gprof target-libgloss"
  1157. ;;
  1158. mips*-*-bsd*)
  1159. noconfigdirs="$noconfigdirs ld gas gprof target-libgloss"
  1160. ;;
  1161. mips*-*-linux*)
  1162. ;;
  1163. mips*-*-ultrix* | mips*-*-osf* | mips*-*-ecoff* | mips*-*-pe* \
  1164. | mips*-*-irix* | mips*-*-lnews* | mips*-*-riscos*)
  1165. noconfigdirs="$noconfigdirs ld gas gprof"
  1166. ;;
  1167. mips*-*-*)
  1168. noconfigdirs="$noconfigdirs gprof"
  1169. ;;
  1170. nvptx*-*-*)
  1171. noconfigdirs="$noconfigdirs target-libssp target-libstdc++-v3 target-libobjc"
  1172. ;;
  1173. sh-*-*)
  1174. case "${target}" in
  1175. sh*-*-elf)
  1176. ;;
  1177. *)
  1178. noconfigdirs="$noconfigdirs target-libgloss" ;;
  1179. esac
  1180. ;;
  1181. sparc-*-sunos4*)
  1182. if test x${is_cross_compiler} = xno ; then
  1183. use_gnu_ld=no
  1184. fi
  1185. ;;
  1186. tic6x-*-*)
  1187. noconfigdirs="$noconfigdirs sim"
  1188. ;;
  1189. tilepro*-*-* | tilegx*-*-*)
  1190. noconfigdirs="$noconfigdirs sim"
  1191. ;;
  1192. v810-*-*)
  1193. noconfigdirs="$noconfigdirs bfd binutils gas gdb ld opcodes target-libgloss"
  1194. ;;
  1195. vax-*-*)
  1196. noconfigdirs="$noconfigdirs target-newlib target-libgloss"
  1197. ;;
  1198. wasm32-*-*)
  1199. noconfigdirs="$noconfigdirs ld"
  1200. ;;
  1201. loongarch*-*-linux*)
  1202. ;;
  1203. loongarch*-*-*)
  1204. noconfigdirs="$noconfigdirs gprof"
  1205. ;;
  1206. esac
  1207. # If we aren't building newlib, then don't build libgloss, since libgloss
  1208. # depends upon some newlib header files.
  1209. case "${noconfigdirs}" in
  1210. *target-libgloss*) ;;
  1211. *target-newlib*) noconfigdirs="$noconfigdirs target-libgloss" ;;
  1212. esac
  1213. # Work in distributions that contain no compiler tools, like Autoconf.
  1214. host_makefile_frag=/dev/null
  1215. if test -d ${srcdir}/config ; then
  1216. case "${host}" in
  1217. i[[3456789]]86-*-msdosdjgpp*)
  1218. host_makefile_frag="config/mh-djgpp"
  1219. ;;
  1220. *-cygwin*)
  1221. ACX_CHECK_CYGWIN_CAT_WORKS
  1222. host_makefile_frag="config/mh-cygwin"
  1223. ;;
  1224. *-mingw*)
  1225. host_makefile_frag="config/mh-mingw"
  1226. ;;
  1227. alpha*-linux*)
  1228. host_makefile_frag="config/mh-alpha-linux"
  1229. ;;
  1230. hppa*-hp-hpux10*)
  1231. host_makefile_frag="config/mh-pa-hpux10"
  1232. ;;
  1233. hppa*-hp-hpux*)
  1234. host_makefile_frag="config/mh-pa"
  1235. ;;
  1236. hppa*-*)
  1237. host_makefile_frag="config/mh-pa"
  1238. ;;
  1239. i?86-*-darwin[[89]]* | i?86-*-darwin1[[0-7]]* | powerpc*-*-darwin*)
  1240. host_makefile_frag="config/mh-darwin"
  1241. ;;
  1242. powerpc-*-aix*)
  1243. host_makefile_frag="config/mh-ppc-aix"
  1244. ;;
  1245. rs6000-*-aix*)
  1246. host_makefile_frag="config/mh-ppc-aix"
  1247. ;;
  1248. esac
  1249. fi
  1250. if test "${build}" != "${host}" ; then
  1251. AR_FOR_BUILD=${AR_FOR_BUILD-ar}
  1252. AS_FOR_BUILD=${AS_FOR_BUILD-as}
  1253. CC_FOR_BUILD=${CC_FOR_BUILD-gcc}
  1254. CPP_FOR_BUILD="${CPP_FOR_BUILD-\$(CC_FOR_BUILD) -E}"
  1255. CXX_FOR_BUILD=${CXX_FOR_BUILD-g++}
  1256. DSYMUTIL_FOR_BUILD=${DSYMUTIL_FOR_BUILD-dsymutil}
  1257. GFORTRAN_FOR_BUILD=${GFORTRAN_FOR_BUILD-gfortran}
  1258. GOC_FOR_BUILD=${GOC_FOR_BUILD-gccgo}
  1259. GDC_FOR_BUILD=${GDC_FOR_BUILD-gdc}
  1260. DLLTOOL_FOR_BUILD=${DLLTOOL_FOR_BUILD-dlltool}
  1261. LD_FOR_BUILD=${LD_FOR_BUILD-ld}
  1262. NM_FOR_BUILD=${NM_FOR_BUILD-nm}
  1263. RANLIB_FOR_BUILD=${RANLIB_FOR_BUILD-ranlib}
  1264. WINDRES_FOR_BUILD=${WINDRES_FOR_BUILD-windres}
  1265. WINDMC_FOR_BUILD=${WINDMC_FOR_BUILD-windmc}
  1266. else
  1267. AR_FOR_BUILD="\$(AR)"
  1268. AS_FOR_BUILD="\$(AS)"
  1269. CC_FOR_BUILD="\$(CC)"
  1270. CXX_FOR_BUILD="\$(CXX)"
  1271. DSYMUTIL_FOR_BUILD="\$(DSYMUTIL)"
  1272. GFORTRAN_FOR_BUILD="\$(GFORTRAN)"
  1273. GOC_FOR_BUILD="\$(GOC)"
  1274. GDC_FOR_BUILD="\$(GDC)"
  1275. DLLTOOL_FOR_BUILD="\$(DLLTOOL)"
  1276. LD_FOR_BUILD="\$(LD)"
  1277. NM_FOR_BUILD="\$(NM)"
  1278. RANLIB_FOR_BUILD="\$(RANLIB)"
  1279. WINDRES_FOR_BUILD="\$(WINDRES)"
  1280. WINDMC_FOR_BUILD="\$(WINDMC)"
  1281. fi
  1282. AC_PROG_CC_C99
  1283. AC_PROG_CXX
  1284. # We must set the default linker to the linker used by gcc for the correct
  1285. # operation of libtool. If LD is not defined and we are using gcc, try to
  1286. # set the LD default to the ld used by gcc.
  1287. if test -z "$LD"; then
  1288. if test "$GCC" = yes; then
  1289. case $build in
  1290. *-*-mingw*)
  1291. gcc_prog_ld=`$CC -print-prog-name=ld 2>&1 | tr -d '\015'` ;;
  1292. *)
  1293. gcc_prog_ld=`$CC -print-prog-name=ld 2>&1` ;;
  1294. esac
  1295. case $gcc_prog_ld in
  1296. # Accept absolute paths.
  1297. [[\\/]* | [A-Za-z]:[\\/]*)]
  1298. LD="$gcc_prog_ld" ;;
  1299. esac
  1300. fi
  1301. fi
  1302. # Check whether -static-libstdc++ -static-libgcc is supported.
  1303. have_static_libs=no
  1304. if test "$GCC" = yes; then
  1305. saved_LDFLAGS="$LDFLAGS"
  1306. LDFLAGS="$LDFLAGS -static-libstdc++ -static-libgcc"
  1307. AC_MSG_CHECKING([whether g++ accepts -static-libstdc++ -static-libgcc])
  1308. AC_LANG_PUSH(C++)
  1309. AC_LINK_IFELSE([AC_LANG_SOURCE([
  1310. #if (__GNUC__ < 4) || (__GNUC__ == 4 && __GNUC_MINOR__ < 5)
  1311. #error -static-libstdc++ not implemented
  1312. #endif
  1313. int main() {}])],
  1314. [AC_MSG_RESULT([yes]); have_static_libs=yes],
  1315. [AC_MSG_RESULT([no])])
  1316. AC_LANG_POP(C++)
  1317. LDFLAGS="$saved_LDFLAGS"
  1318. fi
  1319. ACX_PROG_GNAT
  1320. ACX_PROG_GDC
  1321. ACX_PROG_CMP_IGNORE_INITIAL
  1322. AC_ARG_ENABLE([bootstrap],
  1323. [AS_HELP_STRING([--enable-bootstrap],
  1324. [enable bootstrapping @<:@yes if native build@:>@])],,
  1325. enable_bootstrap=default)
  1326. # Issue errors and warnings for invalid/strange bootstrap combinations.
  1327. if test -r $srcdir/gcc/configure; then
  1328. have_compiler=yes
  1329. else
  1330. have_compiler=no
  1331. fi
  1332. case "$have_compiler:$host:$target:$enable_bootstrap" in
  1333. *:*:*:no) ;;
  1334. # Default behavior. Enable bootstrap if we have a compiler
  1335. # and we are in a native configuration.
  1336. yes:$build:$build:default)
  1337. enable_bootstrap=yes ;;
  1338. *:*:*:default)
  1339. enable_bootstrap=no ;;
  1340. # We have a compiler and we are in a native configuration, bootstrap is ok
  1341. yes:$build:$build:yes)
  1342. ;;
  1343. # Other configurations, but we have a compiler. Assume the user knows
  1344. # what he's doing.
  1345. yes:*:*:yes)
  1346. AC_MSG_WARN([trying to bootstrap a cross compiler])
  1347. ;;
  1348. # No compiler: if they passed --enable-bootstrap explicitly, fail
  1349. no:*:*:yes)
  1350. AC_MSG_ERROR([cannot bootstrap without a compiler]) ;;
  1351. # Fail if wrong command line
  1352. *)
  1353. AC_MSG_ERROR([invalid option for --enable-bootstrap])
  1354. ;;
  1355. esac
  1356. # When bootstrapping with GCC, build stage 1 in C++11 mode to ensure that a
  1357. # C++11 compiler can still start the bootstrap. Otherwise, if building GCC,
  1358. # require C++11 (or higher).
  1359. if test "$enable_bootstrap:$GXX" = "yes:yes"; then
  1360. CXX="$CXX -std=c++11"
  1361. elif test "$have_compiler" = yes; then
  1362. AX_CXX_COMPILE_STDCXX(11)
  1363. if test "${build}" != "${host}"; then
  1364. AX_CXX_COMPILE_STDCXX(11, [], [], [_FOR_BUILD])
  1365. fi
  1366. fi
  1367. AC_ARG_ENABLE([pgo-build],
  1368. [AS_HELP_STRING([--enable-pgo-build[[=lto]]],
  1369. [enable the PGO build])],
  1370. [enable_pgo_build=$enableval],
  1371. [enable_pgo_build=no])
  1372. # Issue errors and warnings for invalid/strange PGO build combinations.
  1373. case "$have_compiler:$host:$target:$enable_pgo_build" in
  1374. *:*:*:no) ;;
  1375. # Allow the PGO build only if we aren't building a compiler and
  1376. # we are in a native configuration.
  1377. no:$build:$build:yes | no:$build:$build:lto) ;;
  1378. # Disallow the PGO bootstrap if we are building a compiler.
  1379. yes:*:*:yes | yes:*:*:lto)
  1380. AC_MSG_ERROR([cannot perform the PGO bootstrap when building a compiler]) ;;
  1381. *)
  1382. AC_MSG_ERROR([invalid option for --enable-pgo-build])
  1383. ;;
  1384. esac
  1385. if test "$enable_pgo_build" != "no"; then
  1386. AC_MSG_CHECKING([whether the compiler supports -fprofile-generate])
  1387. old_CFLAGS="$CFLAGS"
  1388. PGO_BUILD_GEN_CFLAGS="-fprofile-generate"
  1389. CFLAGS="$CFLAGS $PGO_BUILD_CFLAGS"
  1390. AC_COMPILE_IFELSE([AC_LANG_SOURCE([int foo;])],,
  1391. [PGO_BUILD_GEN_CFLAGS=])
  1392. CFLAGS="$old_CFLAGS"
  1393. if test -n "$PGO_BUILD_GEN_CFLAGS"; then
  1394. AC_MSG_RESULT([yes])
  1395. PGO_BUILD_USE_CFLAGS="-fprofile-use"
  1396. else
  1397. AC_MSG_RESULT([no])
  1398. AC_MSG_ERROR([cannot perform the PGO build without -fprofile-generate])
  1399. fi
  1400. if test "$enable_pgo_build" = "lto"; then
  1401. AC_MSG_CHECKING([whether the compiler supports -flto=jobserver -ffat-lto-objects])
  1402. old_CFLAGS="$CFLAGS"
  1403. PGO_BUILD_LTO_CFLAGS="-flto=jobserver -ffat-lto-objects"
  1404. CFLAGS="$CFLAGS $PGO_BUILD_LTO_CFLAGS"
  1405. AC_COMPILE_IFELSE([AC_LANG_SOURCE([int foo;])],,
  1406. [PGO_BUILD_LTO_CFLAGS=])
  1407. CFLAGS="$old_CFLAGS"
  1408. if test -n "$PGO_BUILD_LTO_CFLAGS"; then
  1409. AC_MSG_RESULT([yes])
  1410. else
  1411. AC_MSG_RESULT([no])
  1412. AC_MSG_WARN([LTO is disabled for the PGO build])
  1413. fi
  1414. fi
  1415. fi
  1416. AC_SUBST(PGO_BUILD_GEN_CFLAGS)
  1417. AC_SUBST(PGO_BUILD_USE_CFLAGS)
  1418. AC_SUBST(PGO_BUILD_LTO_CFLAGS)
  1419. # Used for setting $lt_cv_objdir
  1420. _LT_CHECK_OBJDIR
  1421. # Check for GMP, MPFR and MPC
  1422. gmplibs="-lmpc -lmpfr -lgmp"
  1423. gmpinc=
  1424. have_gmp=no
  1425. # Specify a location for mpc
  1426. # check for this first so it ends up on the link line before mpfr.
  1427. AC_ARG_WITH(mpc,
  1428. [AS_HELP_STRING([--with-mpc=PATH],
  1429. [specify prefix directory for installed MPC package.
  1430. Equivalent to --with-mpc-include=PATH/include
  1431. plus --with-mpc-lib=PATH/lib])])
  1432. AC_ARG_WITH(mpc-include,
  1433. [AS_HELP_STRING([--with-mpc-include=PATH],
  1434. [specify directory for installed MPC include files])])
  1435. AC_ARG_WITH(mpc-lib,
  1436. [AS_HELP_STRING([--with-mpc-lib=PATH],
  1437. [specify directory for the installed MPC library])])
  1438. if test "x$with_mpc" != x; then
  1439. gmplibs="-L$with_mpc/lib $gmplibs"
  1440. gmpinc="-I$with_mpc/include $gmpinc"
  1441. fi
  1442. if test "x$with_mpc_include" != x; then
  1443. gmpinc="-I$with_mpc_include $gmpinc"
  1444. fi
  1445. if test "x$with_mpc_lib" != x; then
  1446. gmplibs="-L$with_mpc_lib $gmplibs"
  1447. fi
  1448. if test "x$with_mpc$with_mpc_include$with_mpc_lib" = x && test -d ${srcdir}/mpc; then
  1449. gmplibs='-L$$r/$(HOST_SUBDIR)/mpc/src/'"$lt_cv_objdir $gmplibs"
  1450. gmpinc='-I$$s/mpc/src '"$gmpinc"
  1451. # Do not test the mpc version. Assume that it is sufficient, since
  1452. # it is in the source tree, and the library has not been built yet
  1453. # but it would be included on the link line in the version check below
  1454. # hence making the test fail.
  1455. have_gmp=yes
  1456. fi
  1457. # Specify a location for mpfr
  1458. # check for this first so it ends up on the link line before gmp.
  1459. AC_ARG_WITH(mpfr,
  1460. [AS_HELP_STRING([--with-mpfr=PATH],
  1461. [specify prefix directory for installed MPFR package.
  1462. Equivalent to --with-mpfr-include=PATH/include
  1463. plus --with-mpfr-lib=PATH/lib])])
  1464. AC_ARG_WITH(mpfr-include,
  1465. [AS_HELP_STRING([--with-mpfr-include=PATH],
  1466. [specify directory for installed MPFR include files])])
  1467. AC_ARG_WITH(mpfr-lib,
  1468. [AS_HELP_STRING([--with-mpfr-lib=PATH],
  1469. [specify directory for the installed MPFR library])])
  1470. if test "x$with_mpfr" != x; then
  1471. gmplibs="-L$with_mpfr/lib $gmplibs"
  1472. gmpinc="-I$with_mpfr/include $gmpinc"
  1473. fi
  1474. if test "x$with_mpfr_include" != x; then
  1475. gmpinc="-I$with_mpfr_include $gmpinc"
  1476. fi
  1477. if test "x$with_mpfr_lib" != x; then
  1478. gmplibs="-L$with_mpfr_lib $gmplibs"
  1479. fi
  1480. if test "x$with_mpfr$with_mpfr_include$with_mpfr_lib" = x && test -d ${srcdir}/mpfr; then
  1481. # MPFR v3.1.0 moved the sources into a src sub-directory.
  1482. if ! test -d ${srcdir}/mpfr/src; then
  1483. AC_MSG_ERROR([dnl
  1484. Building GCC with MPFR in the source tree is only handled for MPFR 3.1.0+.])
  1485. fi
  1486. gmplibs='-L$$r/$(HOST_SUBDIR)/mpfr/src/'"$lt_cv_objdir $gmplibs"
  1487. gmpinc='-I$$r/$(HOST_SUBDIR)/mpfr/src -I$$s/mpfr/src '"$gmpinc"
  1488. extra_mpc_mpfr_configure_flags='--with-mpfr-include=$$s/mpfr/src --with-mpfr-lib=$$r/$(HOST_SUBDIR)/mpfr/src/'"$lt_cv_objdir"
  1489. # Do not test the mpfr version. Assume that it is sufficient, since
  1490. # it is in the source tree, and the library has not been built yet
  1491. # but it would be included on the link line in the version check below
  1492. # hence making the test fail.
  1493. have_gmp=yes
  1494. fi
  1495. # Specify a location for gmp
  1496. AC_ARG_WITH(gmp,
  1497. [AS_HELP_STRING([--with-gmp=PATH],
  1498. [specify prefix directory for the installed GMP package.
  1499. Equivalent to --with-gmp-include=PATH/include
  1500. plus --with-gmp-lib=PATH/lib])])
  1501. AC_ARG_WITH(gmp-include,
  1502. [AS_HELP_STRING([--with-gmp-include=PATH],
  1503. [specify directory for installed GMP include files])])
  1504. AC_ARG_WITH(gmp-lib,
  1505. [AS_HELP_STRING([--with-gmp-lib=PATH],
  1506. [specify directory for the installed GMP library])])
  1507. if test "x$with_gmp" != x; then
  1508. gmplibs="-L$with_gmp/lib $gmplibs"
  1509. gmpinc="-I$with_gmp/include $gmpinc"
  1510. fi
  1511. if test "x$with_gmp_include" != x; then
  1512. gmpinc="-I$with_gmp_include $gmpinc"
  1513. fi
  1514. if test "x$with_gmp_lib" != x; then
  1515. gmplibs="-L$with_gmp_lib $gmplibs"
  1516. fi
  1517. if test "x$with_gmp$with_gmp_include$with_gmp_lib" = x && test -d ${srcdir}/gmp; then
  1518. gmplibs='-L$$r/$(HOST_SUBDIR)/gmp/'"$lt_cv_objdir $gmplibs"
  1519. gmpinc='-I$$r/$(HOST_SUBDIR)/gmp -I$$s/gmp '"$gmpinc"
  1520. extra_mpfr_configure_flags='--with-gmp-include=$$r/$(HOST_SUBDIR)/gmp --with-gmp-lib=$$r/$(HOST_SUBDIR)/gmp/'"$lt_cv_objdir"
  1521. extra_mpc_gmp_configure_flags='--with-gmp-include=$$r/$(HOST_SUBDIR)/gmp --with-gmp-lib=$$r/$(HOST_SUBDIR)/gmp/'"$lt_cv_objdir"
  1522. extra_isl_gmp_configure_flags='--with-gmp-builddir=$$r/$(HOST_SUBDIR)/gmp'
  1523. # Do not test the gmp version. Assume that it is sufficient, since
  1524. # it is in the source tree, and the library has not been built yet
  1525. # but it would be included on the link line in the version check below
  1526. # hence making the test fail.
  1527. have_gmp=yes
  1528. fi
  1529. if test -d ${srcdir}/gcc && test "x$have_gmp" = xno; then
  1530. have_gmp=yes
  1531. saved_CFLAGS="$CFLAGS"
  1532. CFLAGS="$CFLAGS $gmpinc"
  1533. # Check for the recommended and required versions of GMP.
  1534. AC_MSG_CHECKING([for the correct version of gmp.h])
  1535. AC_TRY_COMPILE([#include "gmp.h"],[
  1536. #define GCC_GMP_VERSION_NUM(a,b,c) (((a) << 16L) | ((b) << 8) | (c))
  1537. #define GCC_GMP_VERSION GCC_GMP_VERSION_NUM(__GNU_MP_VERSION,__GNU_MP_VERSION_MINOR,__GNU_MP_VERSION_PATCHLEVEL)
  1538. #if GCC_GMP_VERSION < GCC_GMP_VERSION_NUM(4,2,3)
  1539. choke me
  1540. #endif
  1541. ], [AC_TRY_COMPILE([#include <gmp.h>],[
  1542. #define GCC_GMP_VERSION_NUM(a,b,c) (((a) << 16L) | ((b) << 8) | (c))
  1543. #define GCC_GMP_VERSION GCC_GMP_VERSION_NUM(__GNU_MP_VERSION,__GNU_MP_VERSION_MINOR,__GNU_MP_VERSION_PATCHLEVEL)
  1544. #if GCC_GMP_VERSION < GCC_GMP_VERSION_NUM(4,3,2)
  1545. choke me
  1546. #endif
  1547. ], [AC_MSG_RESULT([yes])], [AC_MSG_RESULT([buggy but acceptable])])],
  1548. [AC_MSG_RESULT([no]); have_gmp=no])
  1549. # If we have GMP, check the MPFR version.
  1550. if test x"$have_gmp" = xyes; then
  1551. # Check for the recommended and required versions of MPFR.
  1552. AC_MSG_CHECKING([for the correct version of mpfr.h])
  1553. AC_TRY_COMPILE([#include <gmp.h>
  1554. #include <mpfr.h>],[
  1555. #if MPFR_VERSION < MPFR_VERSION_NUM(3,1,0)
  1556. choke me
  1557. #endif
  1558. ], [AC_TRY_COMPILE([#include <gmp.h>
  1559. #include <mpfr.h>],[
  1560. #if MPFR_VERSION < MPFR_VERSION_NUM(3,1,6)
  1561. choke me
  1562. #endif
  1563. ], [AC_MSG_RESULT([yes])], [AC_MSG_RESULT([buggy but acceptable])])],
  1564. [AC_MSG_RESULT([no]); have_gmp=no])
  1565. fi
  1566. # Check for the MPC header version.
  1567. if test x"$have_gmp" = xyes ; then
  1568. # Check for the recommended and required versions of MPC.
  1569. AC_MSG_CHECKING([for the correct version of mpc.h])
  1570. AC_TRY_COMPILE([#include <mpc.h>],[
  1571. #if MPC_VERSION < MPC_VERSION_NUM(0,8,0)
  1572. choke me
  1573. #endif
  1574. ], [AC_TRY_COMPILE([#include <mpc.h>],[
  1575. #if MPC_VERSION < MPC_VERSION_NUM(0,8,1)
  1576. choke me
  1577. #endif
  1578. ], [AC_MSG_RESULT([yes])], [AC_MSG_RESULT([buggy but acceptable])])],
  1579. [AC_MSG_RESULT([no]); have_gmp=no])
  1580. fi
  1581. # Now check the MPFR library.
  1582. if test x"$have_gmp" = xyes; then
  1583. saved_LIBS="$LIBS"
  1584. LIBS="$LIBS $gmplibs"
  1585. AC_MSG_CHECKING([for the correct version of the gmp/mpfr/mpc libraries])
  1586. AC_TRY_LINK([#include <mpc.h>],[
  1587. mpfr_t n;
  1588. mpfr_t x;
  1589. mpc_t c;
  1590. int t;
  1591. mpfr_init (n);
  1592. mpfr_init (x);
  1593. mpfr_atan2 (n, n, x, MPFR_RNDN);
  1594. mpfr_erfc (n, x, MPFR_RNDN);
  1595. mpfr_subnormalize (x, t, MPFR_RNDN);
  1596. mpfr_clear(n);
  1597. mpfr_clear(x);
  1598. mpc_init2 (c, 53);
  1599. mpc_set_ui_ui (c, 1, 1, MPC_RNDNN);
  1600. mpc_cosh (c, c, MPC_RNDNN);
  1601. mpc_pow (c, c, c, MPC_RNDNN);
  1602. mpc_acosh (c, c, MPC_RNDNN);
  1603. mpc_clear (c);
  1604. ], [AC_MSG_RESULT([yes])], [AC_MSG_RESULT([no]); have_gmp=no])
  1605. LIBS="$saved_LIBS"
  1606. fi
  1607. CFLAGS="$saved_CFLAGS"
  1608. # The library versions listed in the error message below should match
  1609. # the HARD-minimums enforced above.
  1610. if test x$have_gmp != xyes; then
  1611. AC_MSG_ERROR([Building GCC requires GMP 4.2+, MPFR 3.1.0+ and MPC 0.8.0+.
  1612. Try the --with-gmp, --with-mpfr and/or --with-mpc options to specify
  1613. their locations. Source code for these libraries can be found at
  1614. their respective hosting sites as well as at
  1615. https://gcc.gnu.org/pub/gcc/infrastructure/. See also
  1616. http://gcc.gnu.org/install/prerequisites.html for additional info. If
  1617. you obtained GMP, MPFR and/or MPC from a vendor distribution package,
  1618. make sure that you have installed both the libraries and the header
  1619. files. They may be located in separate packages.])
  1620. fi
  1621. fi
  1622. # Flags needed for both GMP, MPFR and/or MPC.
  1623. AC_SUBST(gmplibs)
  1624. AC_SUBST(gmpinc)
  1625. AC_SUBST(extra_mpfr_configure_flags)
  1626. AC_SUBST(extra_mpc_gmp_configure_flags)
  1627. AC_SUBST(extra_mpc_mpfr_configure_flags)
  1628. AC_SUBST(extra_isl_gmp_configure_flags)
  1629. # Libraries to use for stage1 or when not bootstrapping.
  1630. AC_ARG_WITH(stage1-libs,
  1631. [AS_HELP_STRING([--with-stage1-libs=LIBS], [libraries for stage1])],
  1632. [if test "$withval" = "no" -o "$withval" = "yes"; then
  1633. stage1_libs=
  1634. else
  1635. stage1_libs=$withval
  1636. fi],
  1637. [stage1_libs=])
  1638. AC_SUBST(stage1_libs)
  1639. # Whether or not to use -static-libstdc++ and -static-libgcc. The
  1640. # default is yes if gcc is being built; no otherwise. The reason for
  1641. # this default is that gdb is sometimes linked against GNU Source
  1642. # Highlight, which is a shared library that uses C++ exceptions. In
  1643. # this case, -static-libstdc++ will cause crashes.
  1644. AC_ARG_WITH(static-standard-libraries,
  1645. [AS_HELP_STRING([--with-static-standard-libraries],
  1646. [use -static-libstdc++ and -static-libgcc (default=auto)])],
  1647. [], [with_static_standard_libraries=auto])
  1648. if test "$with_static_standard_libraries" = auto; then
  1649. with_static_standard_libraries=$have_compiler
  1650. fi
  1651. # Linker flags to use for stage1 or when not bootstrapping.
  1652. AC_ARG_WITH(stage1-ldflags,
  1653. [AS_HELP_STRING([--with-stage1-ldflags=FLAGS], [linker flags for stage1])],
  1654. [if test "$withval" = "no" -o "$withval" = "yes"; then
  1655. stage1_ldflags=
  1656. else
  1657. stage1_ldflags=$withval
  1658. fi],
  1659. [stage1_ldflags=
  1660. # In stage 1, default to linking libstdc++ and libgcc statically with GCC
  1661. # if supported. But if the user explicitly specified the libraries to use,
  1662. # trust that they are doing what they want.
  1663. if test "$with_static_standard_libraries" = yes -a "$stage1_libs" = "" \
  1664. -a "$have_static_libs" = yes; then
  1665. stage1_ldflags="-static-libstdc++ -static-libgcc"
  1666. fi])
  1667. AC_SUBST(stage1_ldflags)
  1668. # Libraries to use for stage2 and later builds.
  1669. AC_ARG_WITH(boot-libs,
  1670. [AS_HELP_STRING([--with-boot-libs=LIBS], [libraries for stage2 and later])],
  1671. [if test "$withval" = "no" -o "$withval" = "yes"; then
  1672. poststage1_libs=
  1673. else
  1674. poststage1_libs=$withval
  1675. fi],
  1676. [poststage1_libs=])
  1677. AC_SUBST(poststage1_libs)
  1678. # Linker flags to use for stage2 and later builds.
  1679. AC_ARG_WITH(boot-ldflags,
  1680. [AS_HELP_STRING([--with-boot-ldflags=FLAGS],
  1681. [linker flags for stage2 and later])],
  1682. [if test "$withval" = "no" -o "$withval" = "yes"; then
  1683. poststage1_ldflags=
  1684. else
  1685. poststage1_ldflags=$withval
  1686. fi],
  1687. [poststage1_ldflags=
  1688. # In stages 2 and 3, default to linking libstdc++ and libgcc
  1689. # statically. But if the user explicitly specified the libraries to
  1690. # use, trust that they are doing what they want.
  1691. if test "$poststage1_libs" = ""; then
  1692. poststage1_ldflags="-static-libstdc++ -static-libgcc"
  1693. fi])
  1694. AC_SUBST(poststage1_ldflags)
  1695. # GCC GRAPHITE dependency isl.
  1696. # Basic setup is inlined here, actual checks are in config/isl.m4
  1697. AC_ARG_WITH(isl,
  1698. [AS_HELP_STRING(
  1699. [--with-isl=PATH],
  1700. [Specify prefix directory for the installed isl package.
  1701. Equivalent to --with-isl-include=PATH/include
  1702. plus --with-isl-lib=PATH/lib])])
  1703. # Treat --without-isl as a request to disable
  1704. # GRAPHITE support and skip all following checks.
  1705. if test "x$with_isl" != "xno"; then
  1706. # Check for isl
  1707. dnl Provide configure switches and initialize islinc & isllibs
  1708. dnl with user input.
  1709. ISL_INIT_FLAGS
  1710. dnl The versions of isl that work for Graphite
  1711. ISL_CHECK_VERSION()
  1712. dnl Only execute fail-action, if isl has been requested.
  1713. ISL_IF_FAILED([
  1714. AC_MSG_ERROR([Unable to find a usable isl. See config.log for details.])])
  1715. fi
  1716. # If the isl check failed, disable builds of in-tree variant of isl
  1717. if test "x$with_isl" = xno ||
  1718. test "x$gcc_cv_isl" = xno; then
  1719. noconfigdirs="$noconfigdirs isl"
  1720. islinc=
  1721. fi
  1722. AC_SUBST(isllibs)
  1723. AC_SUBST(islinc)
  1724. # Check for LTO support.
  1725. AC_ARG_ENABLE(lto,
  1726. [AS_HELP_STRING([--enable-lto], [enable link time optimization support])],
  1727. enable_lto=$enableval,
  1728. enable_lto=yes; default_enable_lto=yes)
  1729. ACX_ELF_TARGET_IFELSE([# ELF platforms build the lto-plugin always.
  1730. build_lto_plugin=yes
  1731. ],[if test x"$default_enable_lto" = x"yes" ; then
  1732. case $target in
  1733. *-apple-darwin[[912]]* | *-cygwin* | *-mingw* | *djgpp*) ;;
  1734. # On other non-ELF platforms, LTO has yet to be validated.
  1735. *) enable_lto=no ;;
  1736. esac
  1737. else
  1738. # Apart from ELF platforms, only Windows and Darwin support LTO so far.
  1739. # It would also be nice to check the binutils support, but we don't
  1740. # have gcc_GAS_CHECK_FEATURE available here. For now, we'll just
  1741. # warn during gcc/ subconfigure; unless you're bootstrapping with
  1742. # -flto it won't be needed until after installation anyway.
  1743. case $target in
  1744. *-cygwin* | *-mingw* | *-apple-darwin* | *djgpp*) ;;
  1745. *) if test x"$enable_lto" = x"yes"; then
  1746. AC_MSG_ERROR([LTO support is not enabled for this target.])
  1747. fi
  1748. ;;
  1749. esac
  1750. fi
  1751. # Among non-ELF, only Windows platforms support the lto-plugin so far.
  1752. # Build it unless LTO was explicitly disabled.
  1753. case $target in
  1754. *-cygwin* | *-mingw*) build_lto_plugin=$enable_lto ;;
  1755. *) ;;
  1756. esac
  1757. ])
  1758. AC_ARG_ENABLE(linker-plugin-configure-flags,
  1759. [AS_HELP_STRING([[--enable-linker-plugin-configure-flags=FLAGS]],
  1760. [additional flags for configuring linker plugins @<:@none@:>@])],
  1761. extra_linker_plugin_configure_flags=$enableval,
  1762. extra_linker_plugin_configure_flags=)
  1763. AC_SUBST(extra_linker_plugin_configure_flags)
  1764. AC_ARG_ENABLE(linker-plugin-flags,
  1765. [AS_HELP_STRING([[--enable-linker-plugin-flags=FLAGS]],
  1766. [additional flags for configuring and building linker plugins @<:@none@:>@])],
  1767. extra_linker_plugin_flags=$enableval,
  1768. extra_linker_plugin_flags=)
  1769. AC_SUBST(extra_linker_plugin_flags)
  1770. # Enable --enable-host-shared.
  1771. # Checked early to determine whether jit is an 'all' language
  1772. AC_ARG_ENABLE(host-shared,
  1773. [AS_HELP_STRING([--enable-host-shared],
  1774. [build host code as shared libraries])],
  1775. [host_shared=$enableval
  1776. case $target in
  1777. x86_64-*-darwin* | aarch64-*-darwin*)
  1778. if test x$host_shared != xyes ; then
  1779. # PIC is the default, and actually cannot be switched off.
  1780. echo configure.ac: warning: PIC code is required for the configured target, host-shared setting ignored. 1>&2
  1781. host_shared=yes
  1782. fi ;;
  1783. *) ;;
  1784. esac],
  1785. [case $target in
  1786. x86_64-*-darwin* | aarch64-*-darwin*) host_shared=yes ;;
  1787. *) host_shared=no ;;
  1788. esac])
  1789. AC_SUBST(host_shared)
  1790. # By default, C and C++ are the only stage 1 languages.
  1791. stage1_languages=,c,
  1792. # Target libraries that we bootstrap.
  1793. bootstrap_target_libs=,target-libgcc,
  1794. # Figure out what language subdirectories are present.
  1795. # Look if the user specified --enable-languages="..."; if not, use
  1796. # the environment variable $LANGUAGES if defined. $LANGUAGES might
  1797. # go away some day.
  1798. # NB: embedded tabs in this IF block -- do not untabify
  1799. if test -d ${srcdir}/gcc; then
  1800. if test x"${enable_languages+set}" != xset; then
  1801. if test x"${LANGUAGES+set}" = xset; then
  1802. enable_languages="${LANGUAGES}"
  1803. echo configure.ac: warning: setting LANGUAGES is deprecated, use --enable-languages instead 1>&2
  1804. else
  1805. enable_languages=default
  1806. fi
  1807. else
  1808. if test x"${enable_languages}" = x ||
  1809. test x"${enable_languages}" = xyes;
  1810. then
  1811. echo configure.ac: --enable-languages needs at least one language argument 1>&2
  1812. exit 1
  1813. fi
  1814. fi
  1815. enable_languages=`echo "${enable_languages}" | sed -e 's/[[ ,]][[ ,]]*/,/g' -e 's/,$//'`
  1816. # 'f95' is the old name for the 'fortran' language. We issue a warning
  1817. # and make the substitution.
  1818. case ,${enable_languages}, in
  1819. *,f95,*)
  1820. echo configure.ac: warning: 'f95' as language name is deprecated, use 'fortran' instead 1>&2
  1821. enable_languages=`echo "${enable_languages}" | sed -e 's/f95/fortran/g'`
  1822. ;;
  1823. esac
  1824. # If bootstrapping, C++ must be enabled.
  1825. case ",$enable_languages,:$enable_bootstrap" in
  1826. *,c++,*:*) ;;
  1827. *:yes)
  1828. if test -f ${srcdir}/gcc/cp/config-lang.in; then
  1829. enable_languages="${enable_languages},c++"
  1830. else
  1831. AC_MSG_ERROR([bootstrapping requires c++ sources])
  1832. fi
  1833. ;;
  1834. esac
  1835. # First scan to see if an enabled language requires some other language.
  1836. # We assume that a given config-lang.in will list all the language
  1837. # front ends it requires, even if some are required indirectly.
  1838. for lang_frag in ${srcdir}/gcc/*/config-lang.in .. ; do
  1839. case ${lang_frag} in
  1840. ..) ;;
  1841. # The odd quoting in the next line works around
  1842. # an apparent bug in bash 1.12 on linux.
  1843. ${srcdir}/gcc/[[*]]/config-lang.in) ;;
  1844. *)
  1845. # From the config-lang.in, get $language, $lang_requires, and
  1846. # $lang_requires_boot_languages.
  1847. language=
  1848. lang_requires=
  1849. lang_requires_boot_languages=
  1850. # set srcdir during sourcing lang_frag to the gcc dir.
  1851. # Sadly overriding srcdir on the . line doesn't work in plain sh as it
  1852. # polutes this shell
  1853. saved_srcdir=${srcdir}
  1854. srcdir=${srcdir}/gcc . ${lang_frag}
  1855. srcdir=${saved_srcdir}
  1856. for other in ${lang_requires} ${lang_requires_boot_languages}; do
  1857. case ,${enable_languages}, in
  1858. *,$other,*) ;;
  1859. *,default,*) ;;
  1860. *,all,*) ;;
  1861. *,$language,*)
  1862. echo " \`$other' language required by \`$language'; enabling" 1>&2
  1863. enable_languages="${enable_languages},${other}"
  1864. ;;
  1865. esac
  1866. done
  1867. for other in ${lang_requires_boot_languages} ; do
  1868. if test "$other" != "c"; then
  1869. case ,${enable_stage1_languages}, in
  1870. *,$other,*) ;;
  1871. *,default,*) ;;
  1872. *,all,*) ;;
  1873. *)
  1874. case ,${enable_languages}, in
  1875. *,$language,*)
  1876. echo " '$other' language required by '$language' in stage 1; enabling" 1>&2
  1877. enable_stage1_languages="$enable_stage1_languages,${other}"
  1878. ;;
  1879. esac
  1880. ;;
  1881. esac
  1882. fi
  1883. done
  1884. ;;
  1885. esac
  1886. done
  1887. new_enable_languages=,c,
  1888. # If LTO is enabled, add the LTO front end.
  1889. if test "$enable_lto" = "yes" ; then
  1890. case ,${enable_languages}, in
  1891. *,lto,*) ;;
  1892. *) enable_languages="${enable_languages},lto" ;;
  1893. esac
  1894. if test "${build_lto_plugin}" = "yes" ; then
  1895. configdirs="$configdirs lto-plugin"
  1896. fi
  1897. fi
  1898. # If we're building an offloading compiler, add the LTO front end.
  1899. if test x"$enable_as_accelerator_for" != x ; then
  1900. case ,${enable_languages}, in
  1901. *,lto,*) ;;
  1902. *) enable_languages="${enable_languages},lto" ;;
  1903. esac
  1904. fi
  1905. missing_languages=`echo ",$enable_languages," | sed -e s/,default,/,/ -e s/,all,/,/ -e s/,c,/,/ `
  1906. potential_languages=,c,
  1907. enabled_target_libs=
  1908. disabled_target_libs=
  1909. for lang_frag in ${srcdir}/gcc/*/config-lang.in .. ; do
  1910. case ${lang_frag} in
  1911. ..) ;;
  1912. # The odd quoting in the next line works around
  1913. # an apparent bug in bash 1.12 on linux.
  1914. ${srcdir}/gcc/[[*]]/config-lang.in) ;;
  1915. *)
  1916. # From the config-lang.in, get $language, $target_libs,
  1917. # $lang_dirs, $boot_language, and $build_by_default
  1918. language=
  1919. target_libs=
  1920. lang_dirs=
  1921. subdir_requires=
  1922. boot_language=no
  1923. build_by_default=yes
  1924. # set srcdir during sourcing. See above about save & restore
  1925. saved_srcdir=${srcdir}
  1926. srcdir=${srcdir}/gcc . ${lang_frag}
  1927. srcdir=${saved_srcdir}
  1928. if test x${language} = x; then
  1929. echo "${lang_frag} doesn't set \$language." 1>&2
  1930. exit 1
  1931. fi
  1932. if test "$language" = "c++"; then
  1933. boot_language=yes
  1934. fi
  1935. add_this_lang=no
  1936. # C is always enabled, so no need to add it again
  1937. if test "$language" != "c"; then
  1938. case ,${enable_languages}, in
  1939. *,${language},*)
  1940. # Language was explicitly selected; include it
  1941. add_this_lang=yes
  1942. ;;
  1943. *,all,*)
  1944. # All languages are enabled
  1945. add_this_lang=all
  1946. ;;
  1947. *,default,*)
  1948. # 'default' was selected, select it if it is a default language
  1949. add_this_lang=${build_by_default}
  1950. ;;
  1951. esac
  1952. fi
  1953. # Disable languages that need other directories if these aren't available.
  1954. for i in $subdir_requires; do
  1955. test -f "$srcdir/gcc/$i/config-lang.in" && continue
  1956. case ${add_this_lang} in
  1957. yes)
  1958. # Specifically requested language; tell them.
  1959. AC_MSG_ERROR([The gcc/$i directory contains parts of $language but is missing])
  1960. ;;
  1961. all)
  1962. AC_MSG_WARN([The gcc/$i directory contains parts of $language but is missing])
  1963. add_this_lang=unsupported
  1964. ;;
  1965. *)
  1966. # Silently disable.
  1967. add_this_lang=unsupported
  1968. ;;
  1969. esac
  1970. done
  1971. # Disable Ada if no preexisting GNAT is available.
  1972. case ${add_this_lang}:${language}:${have_gnat} in
  1973. yes:ada:no)
  1974. # Specifically requested language; tell them.
  1975. AC_MSG_ERROR([GNAT is required to build $language])
  1976. ;;
  1977. all:ada:no)
  1978. AC_MSG_WARN([GNAT is required to build $language])
  1979. add_this_lang=unsupported
  1980. ;;
  1981. *:ada:no)
  1982. # Silently disable.
  1983. add_this_lang=unsupported
  1984. ;;
  1985. esac
  1986. # Disable D if no preexisting GDC is available.
  1987. case ${add_this_lang}:${language}:${have_gdc} in
  1988. yes:d:no)
  1989. # Specifically requested language; tell them.
  1990. AC_MSG_ERROR([GDC is required to build $language])
  1991. ;;
  1992. all:d:no)
  1993. AC_MSG_WARN([GDC is required to build $language])
  1994. add_this_lang=unsupported
  1995. ;;
  1996. *:d:no)
  1997. # Silently disable.
  1998. add_this_lang=unsupported
  1999. ;;
  2000. esac
  2001. # Disable jit if -enable-host-shared not specified
  2002. # but not if building for Mingw. All code in Windows
  2003. # is position independent code (PIC).
  2004. case $target in
  2005. *mingw*) ;;
  2006. *)
  2007. case ${add_this_lang}:${language}:${host_shared} in
  2008. yes:jit:no)
  2009. # PR jit/64780: explicitly specify --enable-host-shared
  2010. AC_MSG_ERROR([
  2011. Enabling language "jit" requires --enable-host-shared.
  2012. --enable-host-shared typically slows the rest of the compiler down by
  2013. a few %, so you must explicitly enable it.
  2014. If you want to build both the jit and the regular compiler, it is often
  2015. best to do this via two separate configure/builds, in separate
  2016. directories, to avoid imposing the performance cost of
  2017. --enable-host-shared on the regular compiler.])
  2018. ;;
  2019. all:jit:no)
  2020. AC_MSG_WARN([--enable-host-shared required to build $language])
  2021. add_this_lang=unsupported
  2022. ;;
  2023. *:jit:no)
  2024. # Silently disable.
  2025. add_this_lang=unsupported
  2026. ;;
  2027. esac
  2028. ;;
  2029. esac
  2030. # Disable a language that is unsupported by the target.
  2031. case "${add_this_lang}: $unsupported_languages " in
  2032. no:*) ;;
  2033. unsupported:*) ;;
  2034. *:*" $language "*)
  2035. AC_MSG_WARN([${language} not supported for this target])
  2036. add_this_lang=unsupported
  2037. ;;
  2038. esac
  2039. case $add_this_lang in
  2040. unsupported)
  2041. # Remove language-dependent dirs.
  2042. disabled_target_libs="$disabled_target_libs $target_libs"
  2043. noconfigdirs="$noconfigdirs $lang_dirs"
  2044. ;;
  2045. no)
  2046. # Remove language-dependent dirs; still show language as supported.
  2047. disabled_target_libs="$disabled_target_libs $target_libs"
  2048. noconfigdirs="$noconfigdirs $lang_dirs"
  2049. potential_languages="${potential_languages}${language},"
  2050. ;;
  2051. all|yes)
  2052. new_enable_languages="${new_enable_languages}${language},"
  2053. potential_languages="${potential_languages}${language},"
  2054. missing_languages=`echo "$missing_languages" | sed "s/,$language,/,/"`
  2055. enabled_target_libs="$enabled_target_libs $target_libs"
  2056. case "${boot_language}:,$enable_stage1_languages," in
  2057. yes:* | *:*,$language,* | *:*,yes, | *:*,all,)
  2058. # Add to (comma-separated) list of stage 1 languages.
  2059. case ",$stage1_languages," in
  2060. *,$language,* | ,yes, | ,all,) ;;
  2061. *) stage1_languages="${stage1_languages}${language}," ;;
  2062. esac
  2063. # We need to bootstrap any supporting libraries.
  2064. bootstrap_target_libs=`echo "${bootstrap_target_libs}${target_libs}," | sed "s/ /,/g"`
  2065. ;;
  2066. esac
  2067. ;;
  2068. esac
  2069. ;;
  2070. esac
  2071. done
  2072. # Add target libraries which are only needed for disabled languages
  2073. # to noconfigdirs.
  2074. if test -n "$disabled_target_libs"; then
  2075. for dir in $disabled_target_libs; do
  2076. case " $enabled_target_libs " in
  2077. *" ${dir} "*) ;;
  2078. *) noconfigdirs="$noconfigdirs $dir" ;;
  2079. esac
  2080. done
  2081. fi
  2082. AC_ARG_ENABLE(stage1-languages,
  2083. [AS_HELP_STRING([[--enable-stage1-languages[=all]]],
  2084. [choose additional languages to build during
  2085. stage1. Mostly useful for compiler development])],
  2086. [case ,${enable_stage1_languages}, in
  2087. ,no,|,,)
  2088. # Set it to something that will have no effect in the loop below
  2089. enable_stage1_languages=c ;;
  2090. ,yes,)
  2091. enable_stage1_languages=`echo $new_enable_languages | \
  2092. sed -e "s/^,//" -e "s/,$//" ` ;;
  2093. *,all,*)
  2094. enable_stage1_languages=`echo ,$enable_stage1_languages, | \
  2095. sed -e "s/,all,/$new_enable_languages/" -e "s/^,//" -e "s/,$//" ` ;;
  2096. esac
  2097. # Add "good" languages from enable_stage1_languages to stage1_languages,
  2098. # while "bad" languages go in missing_languages. Leave no duplicates.
  2099. for i in `echo $enable_stage1_languages | sed 's/,/ /g' `; do
  2100. case $potential_languages in
  2101. *,$i,*)
  2102. case $stage1_languages in
  2103. *,$i,*) ;;
  2104. *) stage1_languages="$stage1_languages$i," ;;
  2105. esac ;;
  2106. *)
  2107. case $missing_languages in
  2108. *,$i,*) ;;
  2109. *) missing_languages="$missing_languages$i," ;;
  2110. esac ;;
  2111. esac
  2112. done])
  2113. # Remove leading/trailing commas that were added for simplicity
  2114. potential_languages=`echo "$potential_languages" | sed -e "s/^,//" -e "s/,$//"`
  2115. missing_languages=`echo "$missing_languages" | sed -e "s/^,//" -e "s/,$//"`
  2116. stage1_languages=`echo "$stage1_languages" | sed -e "s/^,//" -e "s/,$//"`
  2117. new_enable_languages=`echo "$new_enable_languages" | sed -e "s/^,//" -e "s/,$//"`
  2118. if test "x$missing_languages" != x; then
  2119. AC_MSG_ERROR([
  2120. The following requested languages could not be built: ${missing_languages}
  2121. Supported languages are: ${potential_languages}])
  2122. fi
  2123. if test "x$new_enable_languages" != "x$enable_languages"; then
  2124. echo The following languages will be built: ${new_enable_languages}
  2125. enable_languages="$new_enable_languages"
  2126. fi
  2127. AC_SUBST(stage1_languages)
  2128. ac_configure_args=`echo " $ac_configure_args" | sed -e "s/ '--enable-languages=[[^ ]]*'//g" -e "s/$/ '--enable-languages="$enable_languages"'/" `
  2129. fi
  2130. # Handle --disable-<component> generically.
  2131. for dir in $configdirs $build_configdirs $target_configdirs ; do
  2132. dirname=`echo $dir | sed -e s/target-//g -e s/build-//g -e s/-/_/g`
  2133. varname=`echo $dirname | sed -e s/+/_/g`
  2134. if eval test x\${enable_${varname}} "=" xno ; then
  2135. noconfigdirs="$noconfigdirs $dir"
  2136. fi
  2137. done
  2138. # Check for Boehm's garbage collector
  2139. AC_ARG_ENABLE(objc-gc,
  2140. [AS_HELP_STRING([--enable-objc-gc],
  2141. [enable use of Boehm's garbage collector with the
  2142. GNU Objective-C runtime])])
  2143. AC_ARG_WITH([target-bdw-gc],
  2144. [AS_HELP_STRING([--with-target-bdw-gc=PATHLIST],
  2145. [specify prefix directory for installed bdw-gc package.
  2146. Equivalent to --with-target-bdw-gc-include=PATH/include
  2147. plus --with-target-bdw-gc-lib=PATH/lib])])
  2148. AC_ARG_WITH([target-bdw-gc-include],
  2149. [AS_HELP_STRING([--with-target-bdw-gc-include=PATHLIST],
  2150. [specify directories for installed bdw-gc include files])])
  2151. AC_ARG_WITH([target-bdw-gc-lib],
  2152. [AS_HELP_STRING([--with-target-bdw-gc-lib=PATHLIST],
  2153. [specify directories for installed bdw-gc library])])
  2154. case ,${enable_languages},:${enable_objc_gc} in *,objc,*:yes|*,objc,*:auto)
  2155. AC_MSG_CHECKING([for bdw garbage collector])
  2156. if test "x$with_target_bdw_gc$with_target_bdw_gc_include$with_target_bdw_gc_lib" = x; then
  2157. dnl no bdw-gw options, assume default locations
  2158. AC_MSG_RESULT([using bdw-gc in default locations])
  2159. else
  2160. dnl bdw-gw options, first error checking, complete checking in libobjc
  2161. if test "x$with_target_bdw_gc_include" = x && test "x$with_target_bdw_gc_lib" != x; then
  2162. AC_MSG_ERROR([found --with-target-bdw-gc-lib but --with-target-bdw-gc-include missing])
  2163. elif test "x$with_target_bdw_gc_include" != x && test "x$with_target_bdw_gc_lib" = x; then
  2164. AC_MSG_ERROR([found --with-target-bdw-gc-include but --with-target-bdw-gc-lib missing])
  2165. else
  2166. AC_MSG_RESULT([using paths configured with --with-target-bdw-gc options])
  2167. fi
  2168. fi
  2169. esac
  2170. # Disable libitm, libsanitizer, libvtv, liboffloadmic if we're not building C++
  2171. case ,${enable_languages}, in
  2172. *,c++,*)
  2173. # Disable libitm, libsanitizer if we're not building libstdc++
  2174. case "${noconfigdirs}" in
  2175. *target-libstdc++-v3*)
  2176. noconfigdirs="$noconfigdirs target-libitm target-libsanitizer"
  2177. ;;
  2178. *) ;;
  2179. esac
  2180. ;;
  2181. *)
  2182. noconfigdirs="$noconfigdirs target-liboffloadmic target-libitm target-libsanitizer target-libvtv"
  2183. ;;
  2184. esac
  2185. # If gcc/ is not in the source tree then we'll not be building a
  2186. # target compiler, assume in that case we don't want to build any
  2187. # target libraries or tools.
  2188. #
  2189. # This was added primarily for the benefit for binutils-gdb who reuse
  2190. # this configure script, but don't always have target tools available.
  2191. if test ! -d ${srcdir}/gcc; then
  2192. skipdirs="${skipdirs} ${target_configdirs}"
  2193. fi
  2194. # Remove the entries in $skipdirs and $noconfigdirs from $configdirs,
  2195. # $build_configdirs and $target_configdirs.
  2196. # If we have the source for $noconfigdirs entries, add them to $notsupp.
  2197. notsupp=""
  2198. for dir in . $skipdirs $noconfigdirs ; do
  2199. dirname=`echo $dir | sed -e s/target-//g -e s/build-//g`
  2200. if test $dir != . && echo " ${configdirs} " | grep " ${dir} " >/dev/null 2>&1; then
  2201. configdirs=`echo " ${configdirs} " | sed -e "s/ ${dir} / /"`
  2202. if test -r $srcdir/$dirname/configure ; then
  2203. if echo " ${skipdirs} " | grep " ${dir} " >/dev/null 2>&1; then
  2204. true
  2205. else
  2206. notsupp="$notsupp $dir"
  2207. fi
  2208. fi
  2209. fi
  2210. if test $dir != . && echo " ${build_configdirs} " | grep " ${dir} " >/dev/null 2>&1; then
  2211. build_configdirs=`echo " ${build_configdirs} " | sed -e "s/ ${dir} / /"`
  2212. if test -r $srcdir/$dirname/configure ; then
  2213. if echo " ${skipdirs} " | grep " ${dir} " >/dev/null 2>&1; then
  2214. true
  2215. else
  2216. notsupp="$notsupp $dir"
  2217. fi
  2218. fi
  2219. fi
  2220. if test $dir != . && echo " ${target_configdirs} " | grep " ${dir} " >/dev/null 2>&1; then
  2221. target_configdirs=`echo " ${target_configdirs} " | sed -e "s/ ${dir} / /"`
  2222. if test -r $srcdir/$dirname/configure ; then
  2223. if echo " ${skipdirs} " | grep " ${dir} " >/dev/null 2>&1; then
  2224. true
  2225. else
  2226. notsupp="$notsupp $dir"
  2227. fi
  2228. fi
  2229. fi
  2230. done
  2231. # Quietly strip out all directories which aren't configurable in this tree.
  2232. # This relies on all configurable subdirectories being autoconfiscated, which
  2233. # is now the case.
  2234. build_configdirs_all="$build_configdirs"
  2235. build_configdirs=
  2236. for i in ${build_configdirs_all} ; do
  2237. j=`echo $i | sed -e s/build-//g`
  2238. if test -f ${srcdir}/$j/configure ; then
  2239. build_configdirs="${build_configdirs} $i"
  2240. fi
  2241. done
  2242. configdirs_all="$configdirs"
  2243. configdirs=
  2244. for i in ${configdirs_all} ; do
  2245. if test -f ${srcdir}/$i/configure ; then
  2246. configdirs="${configdirs} $i"
  2247. fi
  2248. done
  2249. target_configdirs_all="$target_configdirs"
  2250. target_configdirs=
  2251. for i in ${target_configdirs_all} ; do
  2252. j=`echo $i | sed -e s/target-//g`
  2253. if test -f ${srcdir}/$j/configure ; then
  2254. target_configdirs="${target_configdirs} $i"
  2255. fi
  2256. done
  2257. # libiberty-linker-plugin is special: it doesn't have its own source directory,
  2258. # so we have to add it after the preceding checks.
  2259. if test x"$extra_linker_plugin_flags$extra_linker_plugin_configure_flags" != x
  2260. then
  2261. case " $configdirs " in
  2262. *" libiberty "*)
  2263. # If we can build libiberty, we can also build libiberty-linker-plugin.
  2264. configdirs="$configdirs libiberty-linker-plugin"
  2265. extra_linker_plugin_configure_flags="$extra_linker_plugin_configure_flags \
  2266. --with-libiberty=../libiberty-linker-plugin";;
  2267. *)
  2268. AC_MSG_ERROR([libiberty missing]);;
  2269. esac
  2270. fi
  2271. # Sometimes we have special requirements for the host libiberty.
  2272. extra_host_libiberty_configure_flags=
  2273. extra_host_zlib_configure_flags=
  2274. case " $configdirs " in
  2275. *" lto-plugin "* | *" libcc1 "*)
  2276. # When these are to be built as shared libraries, the same applies to
  2277. # libiberty.
  2278. extra_host_libiberty_configure_flags=--enable-shared
  2279. ;;
  2280. *" bfd "*)
  2281. # When bfd is to be built as a shared library, the same applies to
  2282. # zlib.
  2283. if test "$enable_shared" = "yes"; then
  2284. extra_host_zlib_configure_flags=--enable-host-shared
  2285. fi
  2286. ;;
  2287. esac
  2288. AC_SUBST(extra_host_libiberty_configure_flags)
  2289. AC_SUBST(extra_host_zlib_configure_flags)
  2290. # Produce a warning message for the subdirs we can't configure.
  2291. # This isn't especially interesting in the Cygnus tree, but in the individual
  2292. # FSF releases, it's important to let people know when their machine isn't
  2293. # supported by the one or two programs in a package.
  2294. if test -n "${notsupp}" && test -z "${norecursion}" ; then
  2295. # If $appdirs is non-empty, at least one of those directories must still
  2296. # be configured, or we error out. (E.g., if the gas release supports a
  2297. # specified target in some subdirs but not the gas subdir, we shouldn't
  2298. # pretend that all is well.)
  2299. if test -n "$appdirs" ; then
  2300. for dir in $appdirs ; do
  2301. if test -r $dir/Makefile.in ; then
  2302. if echo " ${configdirs} " | grep " ${dir} " >/dev/null 2>&1; then
  2303. appdirs=""
  2304. break
  2305. fi
  2306. if echo " ${target_configdirs} " | grep " target-${dir} " >/dev/null 2>&1; then
  2307. appdirs=""
  2308. break
  2309. fi
  2310. fi
  2311. done
  2312. if test -n "$appdirs" ; then
  2313. echo "*** This configuration is not supported by this package." 1>&2
  2314. exit 1
  2315. fi
  2316. fi
  2317. # Okay, some application will build, or we don't care to check. Still
  2318. # notify of subdirs not getting built.
  2319. echo "*** This configuration is not supported in the following subdirectories:" 1>&2
  2320. echo " ${notsupp}" 1>&2
  2321. echo " (Any other directories should still work fine.)" 1>&2
  2322. fi
  2323. case "$host" in
  2324. *msdosdjgpp*)
  2325. enable_gdbtk=no ;;
  2326. esac
  2327. # To find our prefix, in gcc_cv_tool_prefix.
  2328. ACX_TOOL_DIRS
  2329. copy_dirs=
  2330. AC_ARG_WITH([build-sysroot],
  2331. [AS_HELP_STRING([--with-build-sysroot=SYSROOT],
  2332. [use sysroot as the system root during the build])],
  2333. [if test x"$withval" != x ; then
  2334. SYSROOT_CFLAGS_FOR_TARGET="--sysroot=$withval"
  2335. fi],
  2336. [SYSROOT_CFLAGS_FOR_TARGET=])
  2337. AC_SUBST(SYSROOT_CFLAGS_FOR_TARGET)
  2338. AC_ARG_WITH([debug-prefix-map],
  2339. [AS_HELP_STRING([--with-debug-prefix-map='A=B C=D ...'],
  2340. [map A to B, C to D ... in debug information])],
  2341. [if test x"$withval" != x; then
  2342. DEBUG_PREFIX_CFLAGS_FOR_TARGET=
  2343. for debug_map in $withval; do
  2344. DEBUG_PREFIX_CFLAGS_FOR_TARGET="$DEBUG_PREFIX_CFLAGS_FOR_TARGET -fdebug-prefix-map=$debug_map"
  2345. done
  2346. fi],
  2347. [DEBUG_PREFIX_CFLAGS_FOR_TARGET=])
  2348. AC_SUBST(DEBUG_PREFIX_CFLAGS_FOR_TARGET)
  2349. # During gcc bootstrap, if we use some random cc for stage1 then CFLAGS
  2350. # might be empty or "-g". We don't require a C++ compiler, so CXXFLAGS
  2351. # might also be empty (or "-g", if a non-GCC C++ compiler is in the path).
  2352. # We want to ensure that TARGET libraries (which we know are built with
  2353. # gcc) are built with "-O2 -g", so include those options when setting
  2354. # CFLAGS_FOR_TARGET and CXXFLAGS_FOR_TARGET.
  2355. if test "x$CFLAGS_FOR_TARGET" = x; then
  2356. if test "x${is_cross_compiler}" = xyes; then
  2357. CFLAGS_FOR_TARGET="-g -O2"
  2358. else
  2359. CFLAGS_FOR_TARGET=$CFLAGS
  2360. case " $CFLAGS " in
  2361. *" -O2 "*) ;;
  2362. *) CFLAGS_FOR_TARGET="-O2 $CFLAGS_FOR_TARGET" ;;
  2363. esac
  2364. case " $CFLAGS " in
  2365. *" -g "* | *" -g3 "*) ;;
  2366. *) CFLAGS_FOR_TARGET="-g $CFLAGS_FOR_TARGET" ;;
  2367. esac
  2368. fi
  2369. fi
  2370. AC_SUBST(CFLAGS_FOR_TARGET)
  2371. if test "x$CXXFLAGS_FOR_TARGET" = x; then
  2372. if test "x${is_cross_compiler}" = xyes; then
  2373. CXXFLAGS_FOR_TARGET="-g -O2"
  2374. else
  2375. CXXFLAGS_FOR_TARGET=$CXXFLAGS
  2376. case " $CXXFLAGS " in
  2377. *" -O2 "*) ;;
  2378. *) CXXFLAGS_FOR_TARGET="-O2 $CXXFLAGS_FOR_TARGET" ;;
  2379. esac
  2380. case " $CXXFLAGS " in
  2381. *" -g "* | *" -g3 "*) ;;
  2382. *) CXXFLAGS_FOR_TARGET="-g $CXXFLAGS_FOR_TARGET" ;;
  2383. esac
  2384. fi
  2385. fi
  2386. AC_SUBST(CXXFLAGS_FOR_TARGET)
  2387. AC_SUBST(LDFLAGS_FOR_TARGET)
  2388. # Handle --with-headers=XXX. If the value is not "yes", the contents of
  2389. # the named directory are copied to $(tooldir)/sys-include.
  2390. if test x"${with_headers}" != x && test x"${with_headers}" != xno ; then
  2391. if test x${is_cross_compiler} = xno ; then
  2392. echo 1>&2 '***' --with-headers is only supported when cross compiling
  2393. exit 1
  2394. fi
  2395. if test x"${with_headers}" != xyes ; then
  2396. x=${gcc_cv_tool_prefix}
  2397. copy_dirs="${copy_dirs} ${with_headers} $x/${target_noncanonical}/sys-include"
  2398. fi
  2399. fi
  2400. # Handle --with-libs=XXX. If the value is not "yes", the contents of
  2401. # the name directories are copied to $(tooldir)/lib. Multiple directories
  2402. # are permitted.
  2403. if test x"${with_libs}" != x && test x"${with_libs}" != xno ; then
  2404. if test x${is_cross_compiler} = xno ; then
  2405. echo 1>&2 '***' --with-libs is only supported when cross compiling
  2406. exit 1
  2407. fi
  2408. if test x"${with_libs}" != xyes ; then
  2409. # Copy the libraries in reverse order, so that files in the first named
  2410. # library override files in subsequent libraries.
  2411. x=${gcc_cv_tool_prefix}
  2412. for l in ${with_libs}; do
  2413. copy_dirs="$l $x/${target_noncanonical}/lib ${copy_dirs}"
  2414. done
  2415. fi
  2416. fi
  2417. # Set with_gnu_as, with_gnu_ld, and with_system_zlib as appropriate.
  2418. #
  2419. # This is done by determining whether or not the appropriate directory
  2420. # is available, and by checking whether or not specific configurations
  2421. # have requested that this magic not happen.
  2422. #
  2423. # The command line options always override the explicit settings in
  2424. # configure.ac, and the settings in configure.ac override this magic.
  2425. #
  2426. # If the default for a toolchain is to use GNU as and ld, and you don't
  2427. # want to do that, then you should use the --without-gnu-as and
  2428. # --without-gnu-ld options for the configure script. Similarly, if
  2429. # the default is to use the included zlib and you don't want to do that,
  2430. # you should use the --with-system-zlib option for the configure script.
  2431. if test x${use_gnu_as} = x &&
  2432. echo " ${configdirs} " | grep " gas " > /dev/null 2>&1 ; then
  2433. with_gnu_as=yes
  2434. extra_host_args="$extra_host_args --with-gnu-as"
  2435. fi
  2436. if test x${use_gnu_ld} = x &&
  2437. echo " ${configdirs} " | egrep " (go)?ld " > /dev/null 2>&1 ; then
  2438. with_gnu_ld=yes
  2439. extra_host_args="$extra_host_args --with-gnu-ld"
  2440. fi
  2441. if test x${use_included_zlib} = x &&
  2442. echo " ${configdirs} " | grep " zlib " > /dev/null 2>&1 ; then
  2443. :
  2444. else
  2445. with_system_zlib=yes
  2446. extra_host_args="$extra_host_args --with-system-zlib"
  2447. fi
  2448. # If using newlib, add --with-newlib to the extra_host_args so that gcc/configure
  2449. # can detect this case.
  2450. if test x${with_newlib} != xno && echo " ${target_configdirs} " | grep " target-newlib " > /dev/null 2>&1 ; then
  2451. with_newlib=yes
  2452. extra_host_args="$extra_host_args --with-newlib"
  2453. fi
  2454. # Handle ${copy_dirs}
  2455. set fnord ${copy_dirs}
  2456. shift
  2457. while test $# != 0 ; do
  2458. if test -f $2/COPIED && test x"`cat $2/COPIED`" = x"$1" ; then
  2459. :
  2460. else
  2461. echo Copying $1 to $2
  2462. # Use the install script to create the directory and all required
  2463. # parent directories.
  2464. if test -d $2 ; then
  2465. :
  2466. else
  2467. echo >config.temp
  2468. ${srcdir}/install-sh -c -m 644 config.temp $2/COPIED
  2469. fi
  2470. # Copy the directory, assuming we have tar.
  2471. # FIXME: Should we use B in the second tar? Not all systems support it.
  2472. (cd $1; tar -cf - .) | (cd $2; tar -xpf -)
  2473. # It is the responsibility of the user to correctly adjust all
  2474. # symlinks. If somebody can figure out how to handle them correctly
  2475. # here, feel free to add the code.
  2476. echo $1 > $2/COPIED
  2477. fi
  2478. shift; shift
  2479. done
  2480. # Determine a target-dependent exec_prefix that the installed
  2481. # gcc will search in. Keep this list sorted by triplet, with
  2482. # the *-*-osname triplets last.
  2483. md_exec_prefix=
  2484. case "${target}" in
  2485. i[[34567]]86-pc-msdosdjgpp*)
  2486. md_exec_prefix=/dev/env/DJDIR/bin
  2487. ;;
  2488. *-*-hpux* | \
  2489. *-*-nto-qnx* | \
  2490. *-*-solaris2*)
  2491. md_exec_prefix=/usr/ccs/bin
  2492. ;;
  2493. esac
  2494. extra_arflags_for_target=
  2495. extra_nmflags_for_target=
  2496. extra_ranlibflags_for_target=
  2497. target_makefile_frag=/dev/null
  2498. case "${target}" in
  2499. spu-*-*)
  2500. target_makefile_frag="config/mt-spu"
  2501. ;;
  2502. mips*-sde-elf* | mips*-mti-elf* | mips*-img-elf*)
  2503. target_makefile_frag="config/mt-sde"
  2504. ;;
  2505. mipsisa*-*-elfoabi*)
  2506. target_makefile_frag="config/mt-mips-elfoabi"
  2507. ;;
  2508. mips*-*-*linux* | mips*-*-gnu*)
  2509. target_makefile_frag="config/mt-mips-gnu"
  2510. ;;
  2511. nios2-*-elf*)
  2512. target_makefile_frag="config/mt-nios2-elf"
  2513. ;;
  2514. *-*-linux-android*)
  2515. target_makefile_frag="config/mt-android"
  2516. ;;
  2517. *-*-linux* | *-*-gnu* | *-*-k*bsd*-gnu | *-*-kopensolaris*-gnu)
  2518. target_makefile_frag="config/mt-gnu"
  2519. ;;
  2520. *-*-aix4.[[3456789]]* | *-*-aix[[56789]].*)
  2521. # nm and ar from AIX 4.3 and above require -X32_64 flag to all ar and nm
  2522. # commands to handle both 32-bit and 64-bit objects. These flags are
  2523. # harmless if we're using GNU nm or ar.
  2524. extra_arflags_for_target=" -X32_64"
  2525. extra_nmflags_for_target=" -B -X32_64"
  2526. ;;
  2527. esac
  2528. alphaieee_frag=/dev/null
  2529. case $target in
  2530. alpha*-*-*)
  2531. # This just makes sure to use the -mieee option to build target libs.
  2532. # This should probably be set individually by each library.
  2533. alphaieee_frag="config/mt-alphaieee"
  2534. ;;
  2535. esac
  2536. # If --enable-target-optspace always use -Os instead of -O2 to build
  2537. # the target libraries, similarly if it is not specified, use -Os
  2538. # on selected platforms.
  2539. ospace_frag=/dev/null
  2540. case "${enable_target_optspace}:${target}" in
  2541. yes:*)
  2542. ospace_frag="config/mt-ospace"
  2543. ;;
  2544. :d30v-*)
  2545. ospace_frag="config/mt-d30v"
  2546. ;;
  2547. :m32r-* | :d10v-* | :fr30-* | :i?86*-*-elfiamcu)
  2548. ospace_frag="config/mt-ospace"
  2549. ;;
  2550. no:* | :*)
  2551. ;;
  2552. *)
  2553. echo "*** bad value \"${enable_target_optspace}\" for --enable-target-optspace flag; ignored" 1>&2
  2554. ;;
  2555. esac
  2556. # Some systems (e.g., one of the i386-aix systems the gas testers are
  2557. # using) don't handle "\$" correctly, so don't use it here.
  2558. tooldir='${exec_prefix}'/${target_noncanonical}
  2559. build_tooldir=${tooldir}
  2560. # Create a .gdbinit file which runs the one in srcdir
  2561. # and tells GDB to look there for source files.
  2562. if test -r ${srcdir}/.gdbinit ; then
  2563. case ${srcdir} in
  2564. .) ;;
  2565. *) cat > ./.gdbinit <<EOF
  2566. # ${NO_EDIT}
  2567. dir ${srcdir}
  2568. dir .
  2569. source ${srcdir}/.gdbinit
  2570. EOF
  2571. ;;
  2572. esac
  2573. fi
  2574. # Make sure that the compiler is able to generate an executable. If it
  2575. # can't, we are probably in trouble. We don't care whether we can run the
  2576. # executable--we might be using a cross compiler--we only care whether it
  2577. # can be created. At this point the main configure script has set CC.
  2578. we_are_ok=no
  2579. echo "int main () { return 0; }" > conftest.c
  2580. ${CC} -o conftest ${CFLAGS} ${CPPFLAGS} ${LDFLAGS} conftest.c
  2581. if test $? = 0 ; then
  2582. if test -s conftest || test -s conftest.exe ; then
  2583. we_are_ok=yes
  2584. fi
  2585. fi
  2586. case $we_are_ok in
  2587. no)
  2588. echo 1>&2 "*** The command '${CC} -o conftest ${CFLAGS} ${CPPFLAGS} ${LDFLAGS} conftest.c' failed."
  2589. echo 1>&2 "*** You must set the environment variable CC to a working compiler."
  2590. rm -f conftest*
  2591. exit 1
  2592. ;;
  2593. esac
  2594. rm -f conftest*
  2595. # Decide which environment variable is used to find dynamic libraries.
  2596. case "${host}" in
  2597. *-*-hpux*) RPATH_ENVVAR=SHLIB_PATH ;;
  2598. *-*-darwin*) RPATH_ENVVAR=DYLD_LIBRARY_PATH ;;
  2599. *-*-mingw* | *-*-cygwin ) RPATH_ENVVAR=PATH ;;
  2600. *) RPATH_ENVVAR=LD_LIBRARY_PATH ;;
  2601. esac
  2602. # On systems where the dynamic library environment variable is PATH,
  2603. # gcc/ will put dynamic libraries into a subdirectory to avoid adding
  2604. # built executables to PATH.
  2605. if test "$RPATH_ENVVAR" = PATH; then
  2606. GCC_SHLIB_SUBDIR=/shlib
  2607. else
  2608. GCC_SHLIB_SUBDIR=
  2609. fi
  2610. # Adjust the toplevel makefile according to whether bootstrap was selected.
  2611. case $enable_bootstrap in
  2612. yes)
  2613. bootstrap_suffix=bootstrap
  2614. BUILD_CONFIG=bootstrap-debug
  2615. ;;
  2616. no)
  2617. bootstrap_suffix=no-bootstrap
  2618. BUILD_CONFIG=
  2619. ;;
  2620. esac
  2621. AC_MSG_CHECKING(for default BUILD_CONFIG)
  2622. AC_ARG_WITH([build-config],
  2623. [AS_HELP_STRING([--with-build-config='NAME NAME2...'],
  2624. [use config/NAME.mk build configuration])],
  2625. [case $with_build_config in
  2626. yes) with_build_config= ;;
  2627. no) with_build_config= BUILD_CONFIG= ;;
  2628. esac])
  2629. if test "x${with_build_config}" != x; then
  2630. BUILD_CONFIG=$with_build_config
  2631. else
  2632. case $BUILD_CONFIG in
  2633. bootstrap-debug)
  2634. if echo "int f (void) { return 0; }" > conftest.c &&
  2635. ${CC} -c conftest.c &&
  2636. mv conftest.o conftest.o.g0 &&
  2637. ${CC} -c -g conftest.c &&
  2638. mv conftest.o conftest.o.g &&
  2639. ${srcdir}/contrib/compare-debug conftest.o.g0 conftest.o.g > /dev/null 2>&1; then
  2640. :
  2641. else
  2642. BUILD_CONFIG=
  2643. fi
  2644. rm -f conftest.c conftest.o conftest.o.g0 conftest.o.g
  2645. ;;
  2646. esac
  2647. fi
  2648. AC_MSG_RESULT($BUILD_CONFIG)
  2649. AC_SUBST(BUILD_CONFIG)
  2650. # Use same top-level configure hooks in libgcc/libstdc++/libvtv.
  2651. AC_MSG_CHECKING([for --enable-vtable-verify])
  2652. AC_ARG_ENABLE(vtable-verify,
  2653. [AS_HELP_STRING([--enable-vtable-verify],
  2654. [Enable vtable verification feature])],
  2655. [case "$enableval" in
  2656. yes) enable_vtable_verify=yes ;;
  2657. no) enable_vtable_verify=no ;;
  2658. *) enable_vtable_verify=no;;
  2659. esac],
  2660. [enable_vtable_verify=no])
  2661. AC_MSG_RESULT($enable_vtable_verify)
  2662. # Record target_configdirs and the configure arguments for target and
  2663. # build configuration in Makefile.
  2664. target_configdirs=`echo "${target_configdirs}" | sed -e 's/target-//g'`
  2665. build_configdirs=`echo "${build_configdirs}" | sed -e 's/build-//g'`
  2666. bootstrap_fixincludes=no
  2667. # If we are building libgomp, bootstrap it.
  2668. if echo " ${target_configdirs} " | grep " libgomp " > /dev/null 2>&1 ; then
  2669. bootstrap_target_libs=${bootstrap_target_libs}target-libgomp,
  2670. fi
  2671. # If we are building libsanitizer and $BUILD_CONFIG contains bootstrap-asan
  2672. # or bootstrap-ubsan, bootstrap it.
  2673. if echo " ${target_configdirs} " | grep " libsanitizer " > /dev/null 2>&1; then
  2674. case "$BUILD_CONFIG" in
  2675. *bootstrap-hwasan* | *bootstrap-asan* | *bootstrap-ubsan* )
  2676. bootstrap_target_libs=${bootstrap_target_libs}target-libsanitizer,
  2677. bootstrap_fixincludes=yes
  2678. ;;
  2679. esac
  2680. fi
  2681. # If we are building libvtv and --enable-vtable-verify, bootstrap it.
  2682. if echo " ${target_configdirs} " | grep " libvtv " > /dev/null 2>&1 &&
  2683. test "$enable_vtable_verify" != no; then
  2684. bootstrap_target_libs=${bootstrap_target_libs}target-libvtv,
  2685. fi
  2686. # If we are building libatomic and the list of enabled languages includes the
  2687. # D frontend, bootstrap it.
  2688. if echo " ${target_configdirs} " | grep " libatomic " > /dev/null 2>&1; then
  2689. case ,${enable_languages}, in
  2690. *,d,*)
  2691. bootstrap_target_libs=${bootstrap_target_libs}target-libatomic,
  2692. ;;
  2693. esac
  2694. fi
  2695. # Determine whether gdb needs tk/tcl or not.
  2696. # Use 'maybe' since enable_gdbtk might be true even if tk isn't available
  2697. # and in that case we want gdb to be built without tk. Ugh!
  2698. # In fact I believe gdb is the *only* package directly dependent on tk,
  2699. # so we should be able to put the 'maybe's in unconditionally and
  2700. # leave out the maybe dependencies when enable_gdbtk is false. I'm not
  2701. # 100% sure that that's safe though.
  2702. gdb_tk="maybe-all-tcl maybe-all-tk maybe-all-itcl maybe-all-libgui"
  2703. case "$enable_gdbtk" in
  2704. no)
  2705. GDB_TK="" ;;
  2706. yes)
  2707. GDB_TK="${gdb_tk}" ;;
  2708. *)
  2709. # Only add the dependency on gdbtk when GDBtk is part of the gdb
  2710. # distro. Eventually someone will fix this and move Insight, nee
  2711. # gdbtk to a separate directory.
  2712. if test -d ${srcdir}/gdb/gdbtk ; then
  2713. GDB_TK="${gdb_tk}"
  2714. else
  2715. GDB_TK=""
  2716. fi
  2717. ;;
  2718. esac
  2719. CONFIGURE_GDB_TK=`echo ${GDB_TK} | sed s/-all-/-configure-/g`
  2720. INSTALL_GDB_TK=`echo ${GDB_TK} | sed s/-all-/-install-/g`
  2721. # gdb and gdbserver depend on gnulib and gdbsupport, but as nothing
  2722. # else does, only include them if one of these is built. The Makefile
  2723. # provides the ordering, so it's enough here to add to the list.
  2724. case " ${configdirs} " in
  2725. *\ gdb\ *)
  2726. configdirs="${configdirs} gnulib gdbsupport"
  2727. ;;
  2728. *\ gdbserver\ *)
  2729. configdirs="${configdirs} gnulib gdbsupport"
  2730. ;;
  2731. *\ sim\ *)
  2732. configdirs="${configdirs} gnulib"
  2733. ;;
  2734. esac
  2735. # Strip out unwanted targets.
  2736. # While at that, we remove Makefiles if we were started for recursive
  2737. # configuration, so that the top-level Makefile reconfigures them,
  2738. # like we used to do when configure itself was recursive.
  2739. # Loop over modules. We used to use the "$extrasub" feature from Autoconf
  2740. # but now we're fixing up the Makefile ourselves with the additional
  2741. # commands passed to AC_CONFIG_FILES. Use separate variables
  2742. # extrasub-{build,host,target} not because there is any reason to split
  2743. # the substitutions up that way, but only to remain below the limit of
  2744. # 99 commands in a script, for HP-UX sed.
  2745. # Do not nest @if/@endif or @unless/@endunless pairs, because
  2746. # configure will not warn you at all.
  2747. case "$enable_bootstrap:$ENABLE_GOLD: $configdirs :,$stage1_languages," in
  2748. yes:yes:*\ gold\ *:*,c++,*) ;;
  2749. yes:yes:*\ gold\ *:*)
  2750. AC_MSG_ERROR([in a combined tree, bootstrapping with --enable-gold requires c++ in stage1_languages])
  2751. ;;
  2752. esac
  2753. extrasub_build=
  2754. for module in ${build_configdirs} ; do
  2755. if test -z "${no_recursion}" \
  2756. && test -f ${build_subdir}/${module}/Makefile; then
  2757. echo 1>&2 "*** removing ${build_subdir}/${module}/Makefile to force reconfigure"
  2758. rm -f ${build_subdir}/${module}/Makefile
  2759. fi
  2760. extrasub_build="$extrasub_build
  2761. /^@if build-$module\$/d
  2762. /^@endif build-$module\$/d
  2763. /^@unless build-$module\$/,/^@endunless build-$module\$/d
  2764. /^@if build-$module-$bootstrap_suffix\$/d
  2765. /^@endif build-$module-$bootstrap_suffix\$/d
  2766. /^@unless build-$module-$bootstrap_suffix\$/,/^@endunless build-$module-$bootstrap_suffix\$/d"
  2767. done
  2768. extrasub_host=
  2769. for module in ${configdirs} ; do
  2770. if test -z "${no_recursion}"; then
  2771. for file in stage*-${module}/Makefile prev-${module}/Makefile ${module}/Makefile; do
  2772. if test -f ${file}; then
  2773. echo 1>&2 "*** removing ${file} to force reconfigure"
  2774. rm -f ${file}
  2775. fi
  2776. done
  2777. fi
  2778. case ${module},${bootstrap_fixincludes} in
  2779. fixincludes,no) host_bootstrap_suffix=no-bootstrap ;;
  2780. *) host_bootstrap_suffix=$bootstrap_suffix ;;
  2781. esac
  2782. extrasub_host="$extrasub_host
  2783. /^@if $module\$/d
  2784. /^@endif $module\$/d
  2785. /^@unless $module\$/,/^@endunless $module\$/d
  2786. /^@if $module-$host_bootstrap_suffix\$/d
  2787. /^@endif $module-$host_bootstrap_suffix\$/d
  2788. /^@unless $module-$host_bootstrap_suffix\$/,/^@endunless $module-$host_bootstrap_suffix\$/d"
  2789. done
  2790. extrasub_target=
  2791. for module in ${target_configdirs} ; do
  2792. if test -z "${no_recursion}" \
  2793. && test -f ${target_subdir}/${module}/Makefile; then
  2794. echo 1>&2 "*** removing ${target_subdir}/${module}/Makefile to force reconfigure"
  2795. rm -f ${target_subdir}/${module}/Makefile
  2796. fi
  2797. # We only bootstrap target libraries listed in bootstrap_target_libs.
  2798. case $bootstrap_target_libs in
  2799. *,target-$module,*) target_bootstrap_suffix=$bootstrap_suffix ;;
  2800. *) target_bootstrap_suffix=no-bootstrap ;;
  2801. esac
  2802. extrasub_target="$extrasub_target
  2803. /^@if target-$module\$/d
  2804. /^@endif target-$module\$/d
  2805. /^@unless target-$module\$/,/^@endunless target-$module\$/d
  2806. /^@if target-$module-$target_bootstrap_suffix\$/d
  2807. /^@endif target-$module-$target_bootstrap_suffix\$/d
  2808. /^@unless target-$module-$target_bootstrap_suffix\$/,/^@endunless target-$module-$target_bootstrap_suffix\$/d"
  2809. done
  2810. # Do the final fixup along with target modules.
  2811. extrasub_target="$extrasub_target
  2812. /^@if /,/^@endif /d
  2813. /^@unless /d
  2814. /^@endunless /d"
  2815. if test "$enable_pgo_build" != "no"; then
  2816. extrasub_build="$extrasub_build
  2817. /^@if pgo-build\$/d
  2818. /^@endif pgo-build\$/d"
  2819. fi
  2820. # Create the serialization dependencies. This uses a temporary file.
  2821. AC_ARG_ENABLE([serial-configure],
  2822. [AS_HELP_STRING([[--enable-serial-[{host,target,build}-]configure]],
  2823. [force sequential configuration of
  2824. sub-packages for the host, target or build
  2825. machine, or all sub-packages])])
  2826. case ${enable_serial_configure} in
  2827. yes)
  2828. enable_serial_build_configure=yes
  2829. enable_serial_host_configure=yes
  2830. enable_serial_target_configure=yes
  2831. ;;
  2832. esac
  2833. # These force 'configure's to be done one at a time, to avoid problems
  2834. # with contention over a shared config.cache.
  2835. rm -f serdep.tmp
  2836. echo '# serdep.tmp' > serdep.tmp
  2837. olditem=
  2838. test "x${enable_serial_build_configure}" = xyes &&
  2839. for item in ${build_configdirs} ; do
  2840. case ${olditem} in
  2841. "") ;;
  2842. *) echo "configure-build-${item}: configure-build-${olditem}" >> serdep.tmp ;;
  2843. esac
  2844. olditem=${item}
  2845. done
  2846. olditem=
  2847. test "x${enable_serial_host_configure}" = xyes &&
  2848. for item in ${configdirs} ; do
  2849. case ${olditem} in
  2850. "") ;;
  2851. *) echo "configure-${item}: configure-${olditem}" >> serdep.tmp ;;
  2852. esac
  2853. olditem=${item}
  2854. done
  2855. olditem=
  2856. test "x${enable_serial_target_configure}" = xyes &&
  2857. for item in ${target_configdirs} ; do
  2858. case ${olditem} in
  2859. "") ;;
  2860. *) echo "configure-target-${item}: configure-target-${olditem}" >> serdep.tmp ;;
  2861. esac
  2862. olditem=${item}
  2863. done
  2864. serialization_dependencies=serdep.tmp
  2865. AC_SUBST_FILE(serialization_dependencies)
  2866. # Base args. Strip norecursion, cache-file, srcdir, host, build,
  2867. # target, nonopt, and variable assignments. These are the ones we
  2868. # might not want to pass down to subconfigures. The exception being
  2869. # --cache-file=/dev/null, which is used to turn off the use of cache
  2870. # files altogether, and which should be passed on to subconfigures.
  2871. # Also strip program-prefix, program-suffix, and program-transform-name,
  2872. # so that we can pass down a consistent program-transform-name.
  2873. baseargs=
  2874. tbaseargs=
  2875. keep_next=no
  2876. skip_next=no
  2877. eval "set -- $ac_configure_args"
  2878. for ac_arg
  2879. do
  2880. if test X"$skip_next" = X"yes"; then
  2881. skip_next=no
  2882. continue
  2883. fi
  2884. if test X"$keep_next" = X"yes"; then
  2885. case $ac_arg in
  2886. *\'*)
  2887. ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
  2888. esac
  2889. baseargs="$baseargs '$ac_arg'"
  2890. tbaseargs="$tbaseargs '$ac_arg'"
  2891. keep_next=no
  2892. continue
  2893. fi
  2894. # Handle separated arguments. Based on the logic generated by
  2895. # autoconf 2.59.
  2896. case $ac_arg in
  2897. *=* | --config-cache | -C | -disable-* | --disable-* \
  2898. | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \
  2899. | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \
  2900. | -with-* | --with-* | -without-* | --without-* | --x)
  2901. separate_arg=no
  2902. ;;
  2903. -*)
  2904. separate_arg=yes
  2905. ;;
  2906. *)
  2907. separate_arg=no
  2908. ;;
  2909. esac
  2910. skip_targ=no
  2911. case $ac_arg in
  2912. changequote(,)
  2913. --with-* | --without-*)
  2914. libopt=`echo "$ac_arg" | sed -e 's,^--[^-_]*[-_],,' -e 's,=.*$,,'`
  2915. case $libopt in
  2916. *[-_]include)
  2917. lib=`echo "$libopt" | sed 's,[-_]include$,,'`
  2918. ;;
  2919. *[-_]lib)
  2920. lib=`echo "$libopt" | sed 's,[-_]lib$,,'`
  2921. ;;
  2922. *)
  2923. lib=$libopt
  2924. ;;
  2925. esac
  2926. changequote([,])
  2927. case $lib in
  2928. mpc | mpfr | gmp | isl)
  2929. # If we're processing --with-$lib, --with-$lib-include or
  2930. # --with-$lib-lib, for one of the libs above, and target is
  2931. # different from host, don't pass the current argument to any
  2932. # target library's configure.
  2933. if test x$is_cross_compiler = xyes; then
  2934. skip_targ=yes
  2935. fi
  2936. ;;
  2937. esac
  2938. ;;
  2939. esac
  2940. case "$ac_arg" in
  2941. --cache-file=/dev/null | \
  2942. -cache-file=/dev/null )
  2943. # Handled here to avoid the test to skip args below.
  2944. baseargs="$baseargs '$ac_arg'"
  2945. tbaseargs="$tbaseargs '$ac_arg'"
  2946. # Assert: $separate_arg should always be no.
  2947. keep_next=$separate_arg
  2948. ;;
  2949. --no*)
  2950. continue
  2951. ;;
  2952. --c* | \
  2953. --sr* | \
  2954. --ho* | \
  2955. --bu* | \
  2956. --t* | \
  2957. --program-* | \
  2958. -cache_file* | \
  2959. -srcdir* | \
  2960. -host* | \
  2961. -build* | \
  2962. -target* | \
  2963. -program-prefix* | \
  2964. -program-suffix* | \
  2965. -program-transform-name* )
  2966. skip_next=$separate_arg
  2967. continue
  2968. ;;
  2969. -*)
  2970. # An option. Add it.
  2971. case $ac_arg in
  2972. *\'*)
  2973. ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
  2974. esac
  2975. baseargs="$baseargs '$ac_arg'"
  2976. if test X"$skip_targ" = Xno; then
  2977. tbaseargs="$tbaseargs '$ac_arg'"
  2978. fi
  2979. keep_next=$separate_arg
  2980. ;;
  2981. *)
  2982. # Either a variable assignment, or a nonopt (triplet). Don't
  2983. # pass it down; let the Makefile handle this.
  2984. continue
  2985. ;;
  2986. esac
  2987. done
  2988. # Remove the initial space we just introduced and, as these will be
  2989. # expanded by make, quote '$'.
  2990. baseargs=`echo "x$baseargs" | sed -e 's/^x *//' -e 's,\\$,$$,g'`
  2991. # Add in --program-transform-name, after --program-prefix and
  2992. # --program-suffix have been applied to it. Autoconf has already
  2993. # doubled dollar signs and backslashes in program_transform_name; we want
  2994. # the backslashes un-doubled, and then the entire thing wrapped in single
  2995. # quotes, because this will be expanded first by make and then by the shell.
  2996. # Also, because we want to override the logic in subdir configure scripts to
  2997. # choose program_transform_name, replace any s,x,x, with s,y,y,.
  2998. sed -e "s,\\\\\\\\,\\\\,g; s,','\\\\'',g; s/s,x,x,/s,y,y,/" <<EOF_SED > conftestsed.out
  2999. ${program_transform_name}
  3000. EOF_SED
  3001. gcc_transform_name=`cat conftestsed.out`
  3002. rm -f conftestsed.out
  3003. baseargs="$baseargs --program-transform-name='${gcc_transform_name}'"
  3004. tbaseargs="$tbaseargs --program-transform-name='${gcc_transform_name}'"
  3005. if test "$silent" = yes; then
  3006. baseargs="$baseargs --silent"
  3007. tbaseargs="$tbaseargs --silent"
  3008. fi
  3009. baseargs="$baseargs --disable-option-checking"
  3010. tbaseargs="$tbaseargs --disable-option-checking"
  3011. # Record and document user additions to sub configure arguments.
  3012. AC_ARG_VAR([build_configargs],
  3013. [additional configure arguments for build directories])
  3014. AC_ARG_VAR([host_configargs],
  3015. [additional configure arguments for host directories])
  3016. AC_ARG_VAR([target_configargs],
  3017. [additional configure arguments for target directories])
  3018. # For the build-side libraries, we just need to pretend we're native,
  3019. # and not use the same cache file. Multilibs are neither needed nor
  3020. # desired. We can't even use the same cache file for all build-side
  3021. # libraries, as they're compiled differently; some with C, some with
  3022. # C++ or with different feature-enabling options.
  3023. build_configargs="$build_configargs --cache-file=./config.cache ${baseargs}"
  3024. # For host modules, accept cache file option, or specification as blank.
  3025. case "${cache_file}" in
  3026. "") # empty
  3027. cache_file_option="" ;;
  3028. /* | [[A-Za-z]]:[[\\/]]* ) # absolute path
  3029. cache_file_option="--cache-file=${cache_file}" ;;
  3030. *) # relative path
  3031. cache_file_option="--cache-file=../${cache_file}" ;;
  3032. esac
  3033. # Host dirs don't like to share a cache file either, horribly enough.
  3034. # This seems to be due to autoconf 2.5x stupidity.
  3035. host_configargs="$host_configargs --cache-file=./config.cache ${extra_host_args} ${baseargs}"
  3036. target_configargs="$target_configargs ${tbaseargs}"
  3037. # Passing a --with-cross-host argument lets the target libraries know
  3038. # whether they are being built with a cross-compiler or being built
  3039. # native. However, it would be better to use other mechanisms to make the
  3040. # sorts of decisions they want to make on this basis. Please consider
  3041. # this option to be deprecated. FIXME.
  3042. if test x${is_cross_compiler} = xyes ; then
  3043. target_configargs="--with-cross-host=${host_noncanonical} ${target_configargs}"
  3044. fi
  3045. # Special user-friendly check for native x86_64-linux build, if
  3046. # multilib is not explicitly enabled.
  3047. case "$target:$have_compiler:$host:$target:$enable_multilib" in
  3048. x86_64-*linux*:yes:$build:$build:)
  3049. # Make sure we have a development environment that handles 32-bit
  3050. dev64=no
  3051. echo "int main () { return 0; }" > conftest.c
  3052. ${CC} -m32 -o conftest ${CFLAGS} ${CPPFLAGS} ${LDFLAGS} conftest.c
  3053. if test $? = 0 ; then
  3054. if test -s conftest || test -s conftest.exe ; then
  3055. dev64=yes
  3056. fi
  3057. fi
  3058. rm -f conftest*
  3059. if test x${dev64} != xyes ; then
  3060. AC_MSG_ERROR([I suspect your system does not have 32-bit development libraries (libc and headers). If you have them, rerun configure with --enable-multilib. If you do not have them, and want to build a 64-bit-only compiler, rerun configure with --disable-multilib.])
  3061. fi
  3062. ;;
  3063. esac
  3064. # Default to --enable-multilib.
  3065. if test x${enable_multilib} = x ; then
  3066. target_configargs="--enable-multilib ${target_configargs}"
  3067. fi
  3068. # Pass --with-newlib if appropriate. Note that target_configdirs has
  3069. # changed from the earlier setting of with_newlib.
  3070. if test x${with_newlib} != xno && echo " ${target_configdirs} " | grep " newlib " > /dev/null 2>&1 && test -d ${srcdir}/newlib ; then
  3071. target_configargs="--with-newlib ${target_configargs}"
  3072. fi
  3073. # Different target subdirs use different values of certain variables
  3074. # (notably CXX). Worse, multilibs use *lots* of different values.
  3075. # Worse yet, autoconf 2.5x makes some of these 'precious', meaning that
  3076. # it doesn't automatically accept command-line overrides of them.
  3077. # This means it's not safe for target subdirs to share a cache file,
  3078. # which is disgusting, but there you have it. Hopefully this can be
  3079. # fixed in future. It's still worthwhile to use a cache file for each
  3080. # directory. I think.
  3081. # Pass the appropriate --build, --host, --target and --cache-file arguments.
  3082. # We need to pass --target, as newer autoconf's requires consistency
  3083. # for target_alias and gcc doesn't manage it consistently.
  3084. target_configargs="--cache-file=./config.cache ${target_configargs}"
  3085. FLAGS_FOR_TARGET=
  3086. case " $target_configdirs " in
  3087. *" newlib "*)
  3088. case " $target_configargs " in
  3089. *" --with-newlib "*)
  3090. case "$target" in
  3091. *-cygwin*)
  3092. FLAGS_FOR_TARGET=$FLAGS_FOR_TARGET' -L$$r/$(TARGET_SUBDIR)/winsup/cygwin -isystem $$s/winsup/cygwin/include'
  3093. ;;
  3094. esac
  3095. # If we're not building GCC, don't discard standard headers.
  3096. if test -d ${srcdir}/gcc; then
  3097. FLAGS_FOR_TARGET=$FLAGS_FOR_TARGET' -nostdinc'
  3098. if test "${build}" != "${host}"; then
  3099. # On Canadian crosses, CC_FOR_TARGET will have already been set
  3100. # by `configure', so we won't have an opportunity to add -Bgcc/
  3101. # to it. This is right: we don't want to search that directory
  3102. # for binaries, but we want the header files in there, so add
  3103. # them explicitly.
  3104. FLAGS_FOR_TARGET=$FLAGS_FOR_TARGET' -isystem $$r/$(HOST_SUBDIR)/gcc/include -isystem $$r/$(HOST_SUBDIR)/gcc/include-fixed'
  3105. # Someone might think of using the pre-installed headers on
  3106. # Canadian crosses, in case the installed compiler is not fully
  3107. # compatible with the compiler being built. In this case, it
  3108. # would be better to flag an error than risking having
  3109. # incompatible object files being constructed. We can't
  3110. # guarantee that an error will be flagged, but let's hope the
  3111. # compiler will do it, when presented with incompatible header
  3112. # files.
  3113. fi
  3114. fi
  3115. case "${target}-${is_cross_compiler}" in
  3116. i[[3456789]]86-*-linux*-no)
  3117. # Here host == target, so we don't need to build gcc,
  3118. # so we don't want to discard standard headers.
  3119. FLAGS_FOR_TARGET=`echo " $FLAGS_FOR_TARGET " | sed -e 's/ -nostdinc / /'`
  3120. ;;
  3121. *)
  3122. # If we're building newlib, use its generic headers last, but search
  3123. # for any libc-related directories first (so make it the last -B
  3124. # switch).
  3125. FLAGS_FOR_TARGET=$FLAGS_FOR_TARGET' -B$$r/$(TARGET_SUBDIR)/newlib/ -isystem $$r/$(TARGET_SUBDIR)/newlib/targ-include -isystem $$s/newlib/libc/include'
  3126. # If we're building libgloss, find the startup file, simulator library
  3127. # and linker script.
  3128. case " $target_configdirs " in
  3129. *" libgloss "*)
  3130. # Look for startup file, simulator library and maybe linker script.
  3131. FLAGS_FOR_TARGET=$FLAGS_FOR_TARGET' -B$$r/$(TARGET_SUBDIR)/libgloss/'"$libgloss_dir"
  3132. # Look for libnosys.a in case the target needs it.
  3133. FLAGS_FOR_TARGET=$FLAGS_FOR_TARGET' -L$$r/$(TARGET_SUBDIR)/libgloss/libnosys'
  3134. # Most targets have the linker script in the source directory.
  3135. FLAGS_FOR_TARGET=$FLAGS_FOR_TARGET' -L$$s/libgloss/'"$libgloss_dir"
  3136. ;;
  3137. esac
  3138. ;;
  3139. esac
  3140. ;;
  3141. esac
  3142. ;;
  3143. esac
  3144. case "$target" in
  3145. x86_64-*mingw* | *-w64-mingw*)
  3146. # MinGW-w64 does not use newlib, nor does it use winsup. It may,
  3147. # however, use a symlink named 'mingw' in ${prefix} .
  3148. FLAGS_FOR_TARGET=$FLAGS_FOR_TARGET' -L${prefix}/${target}/lib -L${prefix}/mingw/lib -isystem ${prefix}/${target}/include -isystem ${prefix}/mingw/include'
  3149. ;;
  3150. *-mingw*)
  3151. # MinGW can't be handled as Cygwin above since it does not use newlib.
  3152. FLAGS_FOR_TARGET=$FLAGS_FOR_TARGET' -L$$r/$(TARGET_SUBDIR)/winsup/mingw -L$$r/$(TARGET_SUBDIR)/winsup/w32api/lib -isystem $$s/winsup/mingw/include -isystem $$s/winsup/w32api/include'
  3153. ;;
  3154. esac
  3155. # Allow the user to override the flags for
  3156. # our build compiler if desired.
  3157. if test x"${build}" = x"${host}" ; then
  3158. CFLAGS_FOR_BUILD=${CFLAGS_FOR_BUILD-${CFLAGS}}
  3159. CPPFLAGS_FOR_BUILD=${CPPFLAGS_FOR_BUILD-${CPPFLAGS}}
  3160. CXXFLAGS_FOR_BUILD=${CXXFLAGS_FOR_BUILD-${CXXFLAGS}}
  3161. LDFLAGS_FOR_BUILD=${LDFLAGS_FOR_BUILD-${LDFLAGS}}
  3162. fi
  3163. # On Canadian crosses, we'll be searching the right directories for
  3164. # the previously-installed cross compiler, so don't bother to add
  3165. # flags for directories within the install tree of the compiler
  3166. # being built; programs in there won't even run.
  3167. if test "${build}" = "${host}" && test -d ${srcdir}/gcc; then
  3168. # Search for pre-installed headers if nothing else fits.
  3169. FLAGS_FOR_TARGET=$FLAGS_FOR_TARGET' -B$(build_tooldir)/bin/ -B$(build_tooldir)/lib/ -isystem $(build_tooldir)/include -isystem $(build_tooldir)/sys-include'
  3170. fi
  3171. if test "x${use_gnu_ld}" = x &&
  3172. echo " ${configdirs} " | grep " ld " > /dev/null ; then
  3173. # Arrange for us to find uninstalled linker scripts.
  3174. FLAGS_FOR_TARGET=$FLAGS_FOR_TARGET' -L$$r/$(HOST_SUBDIR)/ld'
  3175. fi
  3176. # Search for other target-specific linker scripts and such.
  3177. case "${target}" in
  3178. mep*)
  3179. FLAGS_FOR_TARGET="$FLAGS_FOR_TARGET -mlibrary"
  3180. ;;
  3181. esac
  3182. # Makefile fragments.
  3183. for frag in host_makefile_frag target_makefile_frag alphaieee_frag ospace_frag;
  3184. do
  3185. eval fragval=\$$frag
  3186. if test $fragval != /dev/null; then
  3187. eval $frag=${srcdir}/$fragval
  3188. fi
  3189. done
  3190. AC_SUBST_FILE(host_makefile_frag)
  3191. AC_SUBST_FILE(target_makefile_frag)
  3192. AC_SUBST_FILE(alphaieee_frag)
  3193. AC_SUBST_FILE(ospace_frag)
  3194. # Miscellanea: directories, flags, etc.
  3195. AC_SUBST(RPATH_ENVVAR)
  3196. AC_SUBST(GCC_SHLIB_SUBDIR)
  3197. AC_SUBST(tooldir)
  3198. AC_SUBST(build_tooldir)
  3199. AC_SUBST(CONFIGURE_GDB_TK)
  3200. AC_SUBST(GDB_TK)
  3201. AC_SUBST(INSTALL_GDB_TK)
  3202. # Build module lists & subconfigure args.
  3203. AC_SUBST(build_configargs)
  3204. AC_SUBST(build_configdirs)
  3205. # Host module lists & subconfigure args.
  3206. AC_SUBST(host_configargs)
  3207. AC_SUBST(configdirs)
  3208. AC_SUBST(target_configdirs)
  3209. # Target module lists & subconfigure args.
  3210. AC_SUBST(target_configargs)
  3211. # Build tools.
  3212. AC_SUBST(AR_FOR_BUILD)
  3213. AC_SUBST(AS_FOR_BUILD)
  3214. AC_SUBST(CC_FOR_BUILD)
  3215. AC_SUBST(CFLAGS_FOR_BUILD)
  3216. AC_SUBST(CPP_FOR_BUILD)
  3217. AC_SUBST(CPPFLAGS_FOR_BUILD)
  3218. AC_SUBST(CXXFLAGS_FOR_BUILD)
  3219. AC_SUBST(CXX_FOR_BUILD)
  3220. AC_SUBST(DLLTOOL_FOR_BUILD)
  3221. AC_SUBST(DSYMUTIL_FOR_BUILD)
  3222. AC_SUBST(GFORTRAN_FOR_BUILD)
  3223. AC_SUBST(GOC_FOR_BUILD)
  3224. AC_SUBST(GDC_FOR_BUILD)
  3225. AC_SUBST(LDFLAGS_FOR_BUILD)
  3226. AC_SUBST(LD_FOR_BUILD)
  3227. AC_SUBST(NM_FOR_BUILD)
  3228. AC_SUBST(RANLIB_FOR_BUILD)
  3229. AC_SUBST(WINDMC_FOR_BUILD)
  3230. AC_SUBST(WINDRES_FOR_BUILD)
  3231. # Generate default definitions for YACC, M4, LEX and other programs that run
  3232. # on the build machine. These are used if the Makefile can't locate these
  3233. # programs in objdir.
  3234. MISSING=`cd $ac_aux_dir && ${PWDCMD-pwd}`/missing
  3235. AC_CHECK_PROGS([YACC], ['bison -y' byacc yacc], [$MISSING bison -y])
  3236. case " $build_configdirs " in
  3237. *" bison "*) YACC='$$r/$(BUILD_SUBDIR)/bison/tests/bison -y' ;;
  3238. esac
  3239. AC_CHECK_PROGS([BISON], [bison], [$MISSING bison])
  3240. case " $build_configdirs " in
  3241. *" bison "*) BISON='$$r/$(BUILD_SUBDIR)/bison/tests/bison' ;;
  3242. esac
  3243. AC_CHECK_PROGS([M4], [gm4 gnum4 m4], [$MISSING m4])
  3244. case " $build_configdirs " in
  3245. *" m4 "*) M4='$$r/$(BUILD_SUBDIR)/m4/m4' ;;
  3246. esac
  3247. AC_CHECK_PROGS([LEX], [flex lex], [$MISSING flex])
  3248. case " $build_configdirs " in
  3249. *" flex "*) LEX='$$r/$(BUILD_SUBDIR)/flex/flex' ;;
  3250. *" lex "*) LEX='$$r/$(BUILD_SUBDIR)/lex/lex' ;;
  3251. esac
  3252. AC_CHECK_PROGS([FLEX], [flex], [$MISSING flex])
  3253. case " $build_configdirs " in
  3254. *" flex "*) FLEX='$$r/$(BUILD_SUBDIR)/flex/flex' ;;
  3255. esac
  3256. AC_CHECK_PROGS([MAKEINFO], makeinfo, [$MISSING makeinfo])
  3257. case " $build_configdirs " in
  3258. *" texinfo "*) MAKEINFO='$$r/$(BUILD_SUBDIR)/texinfo/makeinfo/makeinfo' ;;
  3259. *)
  3260. changequote(,)
  3261. # For an installed makeinfo, we require it to be from texinfo 4.7 or
  3262. # higher, else we use the "missing" dummy.
  3263. if ${MAKEINFO} --version \
  3264. | egrep 'texinfo[^0-9]*(4\.([7-9]|[1-9][0-9])|[5-9]|[1-9][0-9])' >/dev/null 2>&1; then
  3265. :
  3266. else
  3267. MAKEINFO="$MISSING makeinfo"
  3268. fi
  3269. ;;
  3270. changequote([,])
  3271. esac
  3272. # FIXME: expect and dejagnu may become build tools?
  3273. AC_CHECK_PROGS(EXPECT, expect, expect)
  3274. case " $configdirs " in
  3275. *" expect "*)
  3276. test $host = $build && EXPECT='$$r/$(HOST_SUBDIR)/expect/expect'
  3277. ;;
  3278. esac
  3279. AC_CHECK_PROGS(RUNTEST, runtest, runtest)
  3280. case " $configdirs " in
  3281. *" dejagnu "*)
  3282. test $host = $build && RUNTEST='$$s/$(HOST_SUBDIR)/dejagnu/runtest'
  3283. ;;
  3284. esac
  3285. # Host tools.
  3286. NCN_STRICT_CHECK_TOOLS(AR, ar)
  3287. NCN_STRICT_CHECK_TOOLS(AS, as)
  3288. NCN_STRICT_CHECK_TOOLS(DLLTOOL, dlltool)
  3289. NCN_STRICT_CHECK_TOOLS(DSYMUTIL, dsymutil)
  3290. NCN_STRICT_CHECK_TOOLS(LD, ld)
  3291. NCN_STRICT_CHECK_TOOLS(LIPO, lipo)
  3292. NCN_STRICT_CHECK_TOOLS(NM, nm)
  3293. NCN_STRICT_CHECK_TOOLS(RANLIB, ranlib, true)
  3294. NCN_STRICT_CHECK_TOOLS(STRIP, strip, true)
  3295. NCN_STRICT_CHECK_TOOLS(WINDRES, windres)
  3296. NCN_STRICT_CHECK_TOOLS(WINDMC, windmc)
  3297. NCN_STRICT_CHECK_TOOLS(OBJCOPY, objcopy)
  3298. NCN_STRICT_CHECK_TOOLS(OBJDUMP, objdump)
  3299. NCN_STRICT_CHECK_TOOLS(OTOOL, otool)
  3300. NCN_STRICT_CHECK_TOOLS(READELF, readelf)
  3301. AC_SUBST(CC)
  3302. AC_SUBST(CXX)
  3303. AC_SUBST(CFLAGS)
  3304. AC_SUBST(CXXFLAGS)
  3305. AC_SUBST(GDC)
  3306. AC_SUBST(GDCFLAGS)
  3307. # Target tools.
  3308. AC_ARG_WITH([build-time-tools],
  3309. [AS_HELP_STRING([--with-build-time-tools=PATH],
  3310. [use given path to find target tools during the build])],
  3311. [case x"$withval" in
  3312. x/*) ;;
  3313. *)
  3314. with_build_time_tools=
  3315. AC_MSG_WARN([argument to --with-build-time-tools must be an absolute path])
  3316. ;;
  3317. esac],
  3318. [with_build_time_tools=])
  3319. NCN_STRICT_CHECK_TARGET_TOOLS(CC_FOR_TARGET, cc gcc)
  3320. NCN_STRICT_CHECK_TARGET_TOOLS(CXX_FOR_TARGET, c++ g++ cxx gxx)
  3321. NCN_STRICT_CHECK_TARGET_TOOLS(GCC_FOR_TARGET, gcc, ${CC_FOR_TARGET})
  3322. NCN_STRICT_CHECK_TARGET_TOOLS(GFORTRAN_FOR_TARGET, gfortran)
  3323. NCN_STRICT_CHECK_TARGET_TOOLS(GOC_FOR_TARGET, gccgo)
  3324. NCN_STRICT_CHECK_TARGET_TOOLS(GDC_FOR_TARGET, gdc)
  3325. ACX_CHECK_INSTALLED_TARGET_TOOL(AR_FOR_TARGET, ar)
  3326. ACX_CHECK_INSTALLED_TARGET_TOOL(AS_FOR_TARGET, as)
  3327. ACX_CHECK_INSTALLED_TARGET_TOOL(DLLTOOL_FOR_TARGET, dlltool)
  3328. ACX_CHECK_INSTALLED_TARGET_TOOL(DSYMUTIL_FOR_TARGET, dsymutil)
  3329. ACX_CHECK_INSTALLED_TARGET_TOOL(LD_FOR_TARGET, ld)
  3330. ACX_CHECK_INSTALLED_TARGET_TOOL(LIPO_FOR_TARGET, lipo)
  3331. ACX_CHECK_INSTALLED_TARGET_TOOL(NM_FOR_TARGET, nm)
  3332. ACX_CHECK_INSTALLED_TARGET_TOOL(OBJCOPY_FOR_TARGET, objcopy)
  3333. ACX_CHECK_INSTALLED_TARGET_TOOL(OBJDUMP_FOR_TARGET, objdump)
  3334. ACX_CHECK_INSTALLED_TARGET_TOOL(OTOOL_FOR_TARGET, otool)
  3335. ACX_CHECK_INSTALLED_TARGET_TOOL(RANLIB_FOR_TARGET, ranlib)
  3336. ACX_CHECK_INSTALLED_TARGET_TOOL(READELF_FOR_TARGET, readelf)
  3337. ACX_CHECK_INSTALLED_TARGET_TOOL(STRIP_FOR_TARGET, strip)
  3338. ACX_CHECK_INSTALLED_TARGET_TOOL(WINDRES_FOR_TARGET, windres)
  3339. ACX_CHECK_INSTALLED_TARGET_TOOL(WINDMC_FOR_TARGET, windmc)
  3340. RAW_CXX_FOR_TARGET="$CXX_FOR_TARGET"
  3341. GCC_TARGET_TOOL(ar, AR_FOR_TARGET, AR, [binutils/ar])
  3342. GCC_TARGET_TOOL(as, AS_FOR_TARGET, AS, [gas/as-new])
  3343. GCC_TARGET_TOOL(cc, CC_FOR_TARGET, CC, [gcc/xgcc -B$$r/$(HOST_SUBDIR)/gcc/])
  3344. dnl see comments for CXX_FOR_TARGET_FLAG_TO_PASS
  3345. GCC_TARGET_TOOL(c++, CXX_FOR_TARGET, CXX,
  3346. [gcc/xg++ -B$$r/$(HOST_SUBDIR)/gcc/ -nostdinc++ `if test -f $$r/$(TARGET_SUBDIR)/libstdc++-v3/scripts/testsuite_flags; then $(SHELL) $$r/$(TARGET_SUBDIR)/libstdc++-v3/scripts/testsuite_flags --build-includes; else echo -funconfigured-libstdc++-v3 ; fi` -L$$r/$(TARGET_SUBDIR)/libstdc++-v3/src -L$$r/$(TARGET_SUBDIR)/libstdc++-v3/src/.libs -L$$r/$(TARGET_SUBDIR)/libstdc++-v3/libsupc++/.libs],
  3347. c++)
  3348. GCC_TARGET_TOOL(c++ for libstdc++, RAW_CXX_FOR_TARGET, CXX,
  3349. [gcc/xgcc -shared-libgcc -B$$r/$(HOST_SUBDIR)/gcc -nostdinc++ -L$$r/$(TARGET_SUBDIR)/libstdc++-v3/src -L$$r/$(TARGET_SUBDIR)/libstdc++-v3/src/.libs -L$$r/$(TARGET_SUBDIR)/libstdc++-v3/libsupc++/.libs],
  3350. c++)
  3351. GCC_TARGET_TOOL(dlltool, DLLTOOL_FOR_TARGET, DLLTOOL, [binutils/dlltool])
  3352. GCC_TARGET_TOOL(dsymutil, DSYMUTIL_FOR_TARGET, DSYMUTIL)
  3353. GCC_TARGET_TOOL(gcc, GCC_FOR_TARGET, , [gcc/xgcc -B$$r/$(HOST_SUBDIR)/gcc/])
  3354. GCC_TARGET_TOOL(gfortran, GFORTRAN_FOR_TARGET, GFORTRAN,
  3355. [gcc/gfortran -B$$r/$(HOST_SUBDIR)/gcc/], fortran)
  3356. GCC_TARGET_TOOL(gccgo, GOC_FOR_TARGET, GOC,
  3357. [gcc/gccgo -B$$r/$(HOST_SUBDIR)/gcc/], go)
  3358. GCC_TARGET_TOOL(gdc, GDC_FOR_TARGET, GDC,
  3359. [gcc/gdc -B$$r/$(HOST_SUBDIR)/gcc/], d)
  3360. GCC_TARGET_TOOL(ld, LD_FOR_TARGET, LD, [ld/ld-new])
  3361. GCC_TARGET_TOOL(lipo, LIPO_FOR_TARGET, LIPO)
  3362. GCC_TARGET_TOOL(nm, NM_FOR_TARGET, NM, [binutils/nm-new])
  3363. GCC_TARGET_TOOL(objcopy, OBJCOPY_FOR_TARGET, OBJCOPY, [binutils/objcopy])
  3364. GCC_TARGET_TOOL(objdump, OBJDUMP_FOR_TARGET, OBJDUMP, [binutils/objdump])
  3365. GCC_TARGET_TOOL(otool, OTOOL_FOR_TARGET, OTOOL)
  3366. GCC_TARGET_TOOL(ranlib, RANLIB_FOR_TARGET, RANLIB, [binutils/ranlib])
  3367. GCC_TARGET_TOOL(readelf, READELF_FOR_TARGET, READELF, [binutils/readelf])
  3368. GCC_TARGET_TOOL(strip, STRIP_FOR_TARGET, STRIP, [binutils/strip-new])
  3369. GCC_TARGET_TOOL(windres, WINDRES_FOR_TARGET, WINDRES, [binutils/windres])
  3370. GCC_TARGET_TOOL(windmc, WINDMC_FOR_TARGET, WINDMC, [binutils/windmc])
  3371. AC_SUBST(FLAGS_FOR_TARGET)
  3372. AC_SUBST(RAW_CXX_FOR_TARGET)
  3373. # Certain tools may need extra flags.
  3374. AR_FOR_TARGET=${AR_FOR_TARGET}${extra_arflags_for_target}
  3375. RANLIB_FOR_TARGET=${RANLIB_FOR_TARGET}${extra_ranlibflags_for_target}
  3376. NM_FOR_TARGET=${NM_FOR_TARGET}${extra_nmflags_for_target}
  3377. # When building target libraries, except in a Canadian cross, we use
  3378. # the same toolchain as the compiler we just built.
  3379. COMPILER_AS_FOR_TARGET='$(AS_FOR_TARGET)'
  3380. COMPILER_LD_FOR_TARGET='$(LD_FOR_TARGET)'
  3381. COMPILER_NM_FOR_TARGET='$(NM_FOR_TARGET)'
  3382. if test $host = $build; then
  3383. case " $configdirs " in
  3384. *" gcc "*)
  3385. COMPILER_AS_FOR_TARGET='$$r/$(HOST_SUBDIR)/gcc/as'
  3386. COMPILER_LD_FOR_TARGET='$$r/$(HOST_SUBDIR)/gcc/collect-ld'
  3387. COMPILER_NM_FOR_TARGET='$$r/$(HOST_SUBDIR)/gcc/nm'${extra_nmflags_for_target}
  3388. ;;
  3389. esac
  3390. fi
  3391. AC_SUBST(COMPILER_AS_FOR_TARGET)
  3392. AC_SUBST(COMPILER_LD_FOR_TARGET)
  3393. AC_SUBST(COMPILER_NM_FOR_TARGET)
  3394. AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
  3395. AC_ARG_ENABLE(maintainer-mode,
  3396. [AS_HELP_STRING([--enable-maintainer-mode],
  3397. [enable make rules and dependencies not useful
  3398. (and sometimes confusing) to the casual installer])],
  3399. USE_MAINTAINER_MODE=$enableval,
  3400. USE_MAINTAINER_MODE=no)
  3401. AC_MSG_RESULT($USE_MAINTAINER_MODE)
  3402. AC_SUBST(MAINTAINER_MODE_TRUE)
  3403. AC_SUBST(MAINTAINER_MODE_FALSE)
  3404. if test "$USE_MAINTAINER_MODE" = yes; then
  3405. MAINTAINER_MODE_TRUE=
  3406. MAINTAINER_MODE_FALSE='#'
  3407. else
  3408. MAINTAINER_MODE_TRUE='#'
  3409. MAINTAINER_MODE_FALSE=
  3410. fi
  3411. MAINT=$MAINTAINER_MODE_TRUE
  3412. AC_SUBST(MAINT)dnl
  3413. # ---------------------
  3414. # GCC bootstrap support
  3415. # ---------------------
  3416. # Stage specific cflags for build.
  3417. stage1_cflags="-g"
  3418. case $build in
  3419. vax-*-*)
  3420. case ${GCC} in
  3421. yes) stage1_cflags="-g -Wa,-J" ;;
  3422. *) stage1_cflags="-g -J" ;;
  3423. esac ;;
  3424. esac
  3425. AC_SUBST(stage1_cflags)
  3426. # Enable --enable-checking in stage1 of the compiler.
  3427. AC_ARG_ENABLE(stage1-checking,
  3428. [AS_HELP_STRING([[--enable-stage1-checking[=all]]],
  3429. [choose additional checking for stage1 of the compiler])],
  3430. [stage1_checking=--enable-checking=${enable_stage1_checking}],
  3431. [if test "x$enable_checking" = xno || test "x$enable_checking" = x; then
  3432. # For --disable-checking or implicit --enable-checking=release, avoid
  3433. # setting --enable-checking=gc in the default stage1 checking for LTO
  3434. # bootstraps. See PR62077.
  3435. case $BUILD_CONFIG in
  3436. *lto*)
  3437. stage1_checking=--enable-checking=release,misc,gimple,rtlflag,tree,types;;
  3438. *)
  3439. stage1_checking=--enable-checking=yes,types;;
  3440. esac
  3441. if test "x$enable_checking" = x && \
  3442. test -d ${srcdir}/gcc && \
  3443. test x"`cat ${srcdir}/gcc/DEV-PHASE`" = xexperimental; then
  3444. stage1_checking=--enable-checking=yes,types,extra
  3445. fi
  3446. else
  3447. stage1_checking=--enable-checking=$enable_checking,types
  3448. fi])
  3449. AC_SUBST(stage1_checking)
  3450. # Enable -Werror in bootstrap stage2 and later.
  3451. AC_ARG_ENABLE(werror,
  3452. [AS_HELP_STRING([--enable-werror],
  3453. [enable -Werror in bootstrap stage2 and later])],
  3454. [
  3455. case ${enable_werror} in
  3456. yes) stage2_werror_flag="--enable-werror-always" ;;
  3457. *) stage2_werror_flag="" ;;
  3458. esac
  3459. ],
  3460. [
  3461. if test -d ${srcdir}/gcc && test x"`cat $srcdir/gcc/DEV-PHASE`" = xexperimental; then
  3462. case $BUILD_CONFIG in
  3463. bootstrap-debug)
  3464. stage2_werror_flag="--enable-werror-always" ;;
  3465. "")
  3466. stage2_werror_flag="--enable-werror-always" ;;
  3467. esac
  3468. fi
  3469. ])
  3470. AC_SUBST(stage2_werror_flag)
  3471. # Specify what files to not compare during bootstrap.
  3472. compare_exclusions="gcc/cc*-checksum\$(objext) | gcc/ada/*tools/*"
  3473. case "$target" in
  3474. hppa*64*-*-hpux*) ;;
  3475. hppa*-*-hpux*) compare_exclusions="$compare_exclusions | */libgcc/lib2funcs* | gcc/function-tests.o" ;;
  3476. powerpc*-ibm-aix*) compare_exclusions="$compare_exclusions | *libgomp*\$(objext)" ;;
  3477. esac
  3478. AC_SUBST(compare_exclusions)
  3479. AC_CONFIG_FILES([Makefile],
  3480. [sed "$extrasub_build" Makefile |
  3481. sed "$extrasub_host" |
  3482. sed "$extrasub_target" > mf$$
  3483. mv -f mf$$ Makefile],
  3484. [extrasub_build="$extrasub_build"
  3485. extrasub_host="$extrasub_host"
  3486. extrasub_target="$extrasub_target"])
  3487. AC_OUTPUT