ltmain.sh 330 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534
  1. #! /usr/bin/env sh
  2. ## DO NOT EDIT - This file generated from ./build-aux/ltmain.in
  3. ## by inline-source v2019-02-19.15
  4. # libtool (GNU libtool) 2.5.4
  5. # Provide generalized library-building support services.
  6. # Written by Gordon Matzigkeit <[email protected]>, 1996
  7. # Copyright (C) 1996-2019, 2021-2024 Free Software Foundation, Inc.
  8. # This is free software; see the source for copying conditions. There is NO
  9. # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  10. # GNU Libtool is free software; you can redistribute it and/or modify
  11. # it under the terms of the GNU General Public License as published by
  12. # the Free Software Foundation; either version 2 of the License, or
  13. # (at your option) any later version.
  14. #
  15. # As a special exception to the GNU General Public License,
  16. # if you distribute this file as part of a program or library that
  17. # is built using GNU Libtool, you may include this file under the
  18. # same distribution terms that you use for the rest of that program.
  19. #
  20. # GNU Libtool is distributed in the hope that it will be useful, but
  21. # WITHOUT ANY WARRANTY; without even the implied warranty of
  22. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  23. # General Public License for more details.
  24. #
  25. # You should have received a copy of the GNU General Public License
  26. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  27. PROGRAM=libtool
  28. PACKAGE=libtool
  29. VERSION=2.5.4
  30. package_revision=2.5.4
  31. ## ------ ##
  32. ## Usage. ##
  33. ## ------ ##
  34. # Run './libtool --help' for help with using this script from the
  35. # command line.
  36. ## ------------------------------- ##
  37. ## User overridable command paths. ##
  38. ## ------------------------------- ##
  39. # After configure completes, it has a better idea of some of the
  40. # shell tools we need than the defaults used by the functions shared
  41. # with bootstrap, so set those here where they can still be over-
  42. # ridden by the user, but otherwise take precedence.
  43. : ${AUTOCONF="autoconf"}
  44. : ${AUTOMAKE="automake"}
  45. ## -------------------------- ##
  46. ## Source external libraries. ##
  47. ## -------------------------- ##
  48. # Much of our low-level functionality needs to be sourced from external
  49. # libraries, which are installed to $pkgauxdir.
  50. # Set a version string for this script.
  51. scriptversion=2019-02-19.15; # UTC
  52. # General shell script boiler plate, and helper functions.
  53. # Written by Gary V. Vaughan, 2004
  54. # This is free software. There is NO warranty; not even for
  55. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  56. #
  57. # Copyright (C) 2004-2019, 2021, 2023-2024 Bootstrap Authors
  58. #
  59. # This file is dual licensed under the terms of the MIT license
  60. # <https://opensource.org/licenses/MIT>, and GPL version 2 or later
  61. # <https://www.gnu.org/licenses/gpl-2.0.html>. You must apply one of
  62. # these licenses when using or redistributing this software or any of
  63. # the files within it. See the URLs above, or the file `LICENSE`
  64. # included in the Bootstrap distribution for the full license texts.
  65. # Please report bugs or propose patches to:
  66. # <https://github.com/gnulib-modules/bootstrap/issues>
  67. ## ------ ##
  68. ## Usage. ##
  69. ## ------ ##
  70. # Evaluate this file near the top of your script to gain access to
  71. # the functions and variables defined here:
  72. #
  73. # . `echo "$0" | ${SED-sed} 's|[^/]*$||'`/build-aux/funclib.sh
  74. #
  75. # If you need to override any of the default environment variable
  76. # settings, do that before evaluating this file.
  77. ## -------------------- ##
  78. ## Shell normalisation. ##
  79. ## -------------------- ##
  80. # Some shells need a little help to be as Bourne compatible as possible.
  81. # Before doing anything else, make sure all that help has been provided!
  82. DUALCASE=1; export DUALCASE # for MKS sh
  83. if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then :
  84. emulate sh
  85. NULLCMD=:
  86. # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
  87. # is contrary to our usage. Disable this feature.
  88. alias -g '${1+"$@"}'='"$@"'
  89. setopt NO_GLOB_SUBST
  90. else
  91. case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac
  92. fi
  93. # NLS nuisances: We save the old values in case they are required later.
  94. _G_user_locale=
  95. _G_safe_locale=
  96. for _G_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
  97. do
  98. eval "if test set = \"\${$_G_var+set}\"; then
  99. save_$_G_var=\$$_G_var
  100. $_G_var=C
  101. export $_G_var
  102. _G_user_locale=\"$_G_var=\\\$save_\$_G_var; \$_G_user_locale\"
  103. _G_safe_locale=\"$_G_var=C; \$_G_safe_locale\"
  104. fi"
  105. done
  106. # These NLS vars are set unconditionally (bootstrap issue #24). Unset those
  107. # in case the environment reset is needed later and the $save_* variant is not
  108. # defined (see the code above).
  109. LC_ALL=C
  110. LANGUAGE=C
  111. export LANGUAGE LC_ALL
  112. # Make sure IFS has a sensible default
  113. sp=' '
  114. nl='
  115. '
  116. IFS="$sp $nl"
  117. # There are apparently some systems that use ';' as a PATH separator!
  118. if test "${PATH_SEPARATOR+set}" != set; then
  119. PATH_SEPARATOR=:
  120. (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
  121. (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
  122. PATH_SEPARATOR=';'
  123. }
  124. fi
  125. # func_unset VAR
  126. # --------------
  127. # Portably unset VAR.
  128. # In some shells, an 'unset VAR' statement leaves a non-zero return
  129. # status if VAR is already unset, which might be problematic if the
  130. # statement is used at the end of a function (thus poisoning its return
  131. # value) or when 'set -e' is active (causing even a spurious abort of
  132. # the script in this case).
  133. func_unset ()
  134. {
  135. { eval $1=; (eval unset $1) >/dev/null 2>&1 && eval unset $1 || : ; }
  136. }
  137. # Make sure CDPATH doesn't cause `cd` commands to output the target dir.
  138. func_unset CDPATH
  139. # Make sure ${,E,F}GREP behave sanely.
  140. func_unset GREP_OPTIONS
  141. ## ------------------------- ##
  142. ## Locate command utilities. ##
  143. ## ------------------------- ##
  144. # func_executable_p FILE
  145. # ----------------------
  146. # Check that FILE is an executable regular file.
  147. func_executable_p ()
  148. {
  149. test -f "$1" && test -x "$1"
  150. }
  151. # func_path_progs PROGS_LIST CHECK_FUNC [PATH]
  152. # --------------------------------------------
  153. # Search for either a program that responds to --version with output
  154. # containing "GNU", or else returned by CHECK_FUNC otherwise, by
  155. # trying all the directories in PATH with each of the elements of
  156. # PROGS_LIST.
  157. #
  158. # CHECK_FUNC should accept the path to a candidate program, and
  159. # set $func_check_prog_result if it truncates its output less than
  160. # $_G_path_prog_max characters.
  161. func_path_progs ()
  162. {
  163. _G_progs_list=$1
  164. _G_check_func=$2
  165. _G_PATH=${3-"$PATH"}
  166. _G_path_prog_max=0
  167. _G_path_prog_found=false
  168. _G_save_IFS=$IFS; IFS=${PATH_SEPARATOR-:}
  169. for _G_dir in $_G_PATH; do
  170. IFS=$_G_save_IFS
  171. test -z "$_G_dir" && _G_dir=.
  172. for _G_prog_name in $_G_progs_list; do
  173. for _exeext in '' .EXE; do
  174. _G_path_prog=$_G_dir/$_G_prog_name$_exeext
  175. func_executable_p "$_G_path_prog" || continue
  176. case `"$_G_path_prog" --version 2>&1` in
  177. *GNU*) func_path_progs_result=$_G_path_prog _G_path_prog_found=: ;;
  178. *) $_G_check_func $_G_path_prog
  179. func_path_progs_result=$func_check_prog_result
  180. ;;
  181. esac
  182. $_G_path_prog_found && break 3
  183. done
  184. done
  185. done
  186. IFS=$_G_save_IFS
  187. test -z "$func_path_progs_result" && {
  188. echo "no acceptable sed could be found in \$PATH" >&2
  189. exit 1
  190. }
  191. }
  192. # We want to be able to use the functions in this file before configure
  193. # has figured out where the best binaries are kept, which means we have
  194. # to search for them ourselves - except when the results are already set
  195. # where we skip the searches.
  196. # Unless the user overrides by setting SED, search the path for either GNU
  197. # sed, or the sed that truncates its output the least.
  198. test -z "$SED" && {
  199. _G_sed_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/
  200. for _G_i in 1 2 3 4 5 6 7; do
  201. _G_sed_script=$_G_sed_script$nl$_G_sed_script
  202. done
  203. echo "$_G_sed_script" 2>/dev/null | sed 99q >conftest.sed
  204. _G_sed_script=
  205. func_check_prog_sed ()
  206. {
  207. _G_path_prog=$1
  208. _G_count=0
  209. printf 0123456789 >conftest.in
  210. while :
  211. do
  212. cat conftest.in conftest.in >conftest.tmp
  213. mv conftest.tmp conftest.in
  214. cp conftest.in conftest.nl
  215. echo '' >> conftest.nl
  216. "$_G_path_prog" -f conftest.sed <conftest.nl >conftest.out 2>/dev/null || break
  217. diff conftest.out conftest.nl >/dev/null 2>&1 || break
  218. _G_count=`expr $_G_count + 1`
  219. if test "$_G_count" -gt "$_G_path_prog_max"; then
  220. # Best one so far, save it but keep looking for a better one
  221. func_check_prog_result=$_G_path_prog
  222. _G_path_prog_max=$_G_count
  223. fi
  224. # 10*(2^10) chars as input seems more than enough
  225. test 10 -lt "$_G_count" && break
  226. done
  227. rm -f conftest.in conftest.tmp conftest.nl conftest.out
  228. }
  229. func_path_progs "sed gsed" func_check_prog_sed "$PATH:/usr/xpg4/bin"
  230. rm -f conftest.sed
  231. SED=$func_path_progs_result
  232. }
  233. # Unless the user overrides by setting GREP, search the path for either GNU
  234. # grep, or the grep that truncates its output the least.
  235. test -z "$GREP" && {
  236. func_check_prog_grep ()
  237. {
  238. _G_path_prog=$1
  239. _G_count=0
  240. _G_path_prog_max=0
  241. printf 0123456789 >conftest.in
  242. while :
  243. do
  244. cat conftest.in conftest.in >conftest.tmp
  245. mv conftest.tmp conftest.in
  246. cp conftest.in conftest.nl
  247. echo 'GREP' >> conftest.nl
  248. "$_G_path_prog" -e 'GREP$' -e '-(cannot match)-' <conftest.nl >conftest.out 2>/dev/null || break
  249. diff conftest.out conftest.nl >/dev/null 2>&1 || break
  250. _G_count=`expr $_G_count + 1`
  251. if test "$_G_count" -gt "$_G_path_prog_max"; then
  252. # Best one so far, save it but keep looking for a better one
  253. func_check_prog_result=$_G_path_prog
  254. _G_path_prog_max=$_G_count
  255. fi
  256. # 10*(2^10) chars as input seems more than enough
  257. test 10 -lt "$_G_count" && break
  258. done
  259. rm -f conftest.in conftest.tmp conftest.nl conftest.out
  260. }
  261. func_path_progs "grep ggrep" func_check_prog_grep "$PATH:/usr/xpg4/bin"
  262. GREP=$func_path_progs_result
  263. }
  264. ## ------------------------------- ##
  265. ## User overridable command paths. ##
  266. ## ------------------------------- ##
  267. # All uppercase variable names are used for environment variables. These
  268. # variables can be overridden by the user before calling a script that
  269. # uses them if a suitable command of that name is not already available
  270. # in the command search PATH.
  271. : ${CP="cp -f"}
  272. : ${ECHO="printf %s\n"}
  273. : ${EGREP="$GREP -E"}
  274. : ${FGREP="$GREP -F"}
  275. : ${LN_S="ln -s"}
  276. : ${MAKE="make"}
  277. : ${MKDIR="mkdir"}
  278. : ${MV="mv -f"}
  279. : ${RM="rm -f"}
  280. : ${SHELL="${CONFIG_SHELL-/bin/sh}"}
  281. ## -------------------- ##
  282. ## Useful sed snippets. ##
  283. ## -------------------- ##
  284. sed_dirname='s|/[^/]*$||'
  285. sed_basename='s|^.*/||'
  286. # Sed substitution that helps us do robust quoting. It backslashifies
  287. # metacharacters that are still active within double-quoted strings.
  288. sed_quote_subst='s|\([`"$\\]\)|\\\1|g'
  289. # Same as above, but do not quote variable references.
  290. sed_double_quote_subst='s/\(["`\\]\)/\\\1/g'
  291. # Sed substitution that turns a string into a regex matching for the
  292. # string literally.
  293. sed_make_literal_regex='s|[].[^$\\*\/]|\\&|g'
  294. # Sed substitution that converts a w32 file name or path
  295. # that contains forward slashes, into one that contains
  296. # (escaped) backslashes. A very naive implementation.
  297. sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
  298. # Re-'\' parameter expansions in output of sed_double_quote_subst that
  299. # were '\'-ed in input to the same. If an odd number of '\' preceded a
  300. # '$' in input to sed_double_quote_subst, that '$' was protected from
  301. # expansion. Since each input '\' is now two '\'s, look for any number
  302. # of runs of four '\'s followed by two '\'s and then a '$'. '\' that '$'.
  303. _G_bs='\\'
  304. _G_bs2='\\\\'
  305. _G_bs4='\\\\\\\\'
  306. _G_dollar='\$'
  307. sed_double_backslash="\
  308. s/$_G_bs4/&\\
  309. /g
  310. s/^$_G_bs2$_G_dollar/$_G_bs&/
  311. s/\\([^$_G_bs]\\)$_G_bs2$_G_dollar/\\1$_G_bs2$_G_bs$_G_dollar/g
  312. s/\n//g"
  313. # require_check_ifs_backslash
  314. # ---------------------------
  315. # Check if we can use backslash as IFS='\' separator, and set
  316. # $check_ifs_backshlash_broken to ':' or 'false'.
  317. require_check_ifs_backslash=func_require_check_ifs_backslash
  318. func_require_check_ifs_backslash ()
  319. {
  320. _G_save_IFS=$IFS
  321. IFS='\'
  322. _G_check_ifs_backshlash='a\\b'
  323. for _G_i in $_G_check_ifs_backshlash
  324. do
  325. case $_G_i in
  326. a)
  327. check_ifs_backshlash_broken=false
  328. ;;
  329. '')
  330. break
  331. ;;
  332. *)
  333. check_ifs_backshlash_broken=:
  334. break
  335. ;;
  336. esac
  337. done
  338. IFS=$_G_save_IFS
  339. require_check_ifs_backslash=:
  340. }
  341. ## ----------------- ##
  342. ## Global variables. ##
  343. ## ----------------- ##
  344. # Except for the global variables explicitly listed below, the following
  345. # functions in the '^func_' namespace, and the '^require_' namespace
  346. # variables initialised in the 'Resource management' section, sourcing
  347. # this file will not pollute your global namespace with anything
  348. # else. There's no portable way to scope variables in Bourne shell
  349. # though, so actually running these functions will sometimes place
  350. # results into a variable named after the function, and often use
  351. # temporary variables in the '^_G_' namespace. If you are careful to
  352. # avoid using those namespaces casually in your sourcing script, things
  353. # should continue to work as you expect. And, of course, you can freely
  354. # overwrite any of the functions or variables defined here before
  355. # calling anything to customize them.
  356. EXIT_SUCCESS=0
  357. EXIT_FAILURE=1
  358. EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing.
  359. EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake.
  360. # Allow overriding, eg assuming that you follow the convention of
  361. # putting '$debug_cmd' at the start of all your functions, you can get
  362. # bash to show function call trace with:
  363. #
  364. # debug_cmd='eval echo "${FUNCNAME[0]} $*" >&2' bash your-script-name
  365. debug_cmd=${debug_cmd-":"}
  366. exit_cmd=:
  367. # By convention, finish your script with:
  368. #
  369. # exit $exit_status
  370. #
  371. # so that you can set exit_status to non-zero if you want to indicate
  372. # something went wrong during execution without actually bailing out at
  373. # the point of failure.
  374. exit_status=$EXIT_SUCCESS
  375. # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
  376. # is ksh but when the shell is invoked as "sh" and the current value of
  377. # the _XPG environment variable is not equal to 1 (one), the special
  378. # positional parameter $0, within a function call, is the name of the
  379. # function.
  380. progpath=$0
  381. # The name of this program.
  382. progname=`$ECHO "$progpath" |$SED "$sed_basename"`
  383. # Make sure we have an absolute progpath for reexecution:
  384. case $progpath in
  385. [\\/]*|[A-Za-z]:\\*) ;;
  386. *[\\/]*)
  387. progdir=`$ECHO "$progpath" |$SED "$sed_dirname"`
  388. progdir=`cd "$progdir" && pwd`
  389. progpath=$progdir/$progname
  390. ;;
  391. *)
  392. _G_IFS=$IFS
  393. IFS=${PATH_SEPARATOR-:}
  394. for progdir in $PATH; do
  395. IFS=$_G_IFS
  396. test -x "$progdir/$progname" && break
  397. done
  398. IFS=$_G_IFS
  399. test -n "$progdir" || progdir=`pwd`
  400. progpath=$progdir/$progname
  401. ;;
  402. esac
  403. ## ----------------- ##
  404. ## Standard options. ##
  405. ## ----------------- ##
  406. # The following options affect the operation of the functions defined
  407. # below, and should be set appropriately depending on run-time para-
  408. # meters passed on the command line.
  409. opt_dry_run=false
  410. opt_quiet=false
  411. opt_verbose=false
  412. # Categories 'all' and 'none' are always available. Append any others
  413. # you will pass as the first argument to func_warning from your own
  414. # code.
  415. warning_categories=
  416. # By default, display warnings according to 'opt_warning_types'. Set
  417. # 'warning_func' to ':' to elide all warnings, or func_fatal_error to
  418. # treat the next displayed warning as a fatal error.
  419. warning_func=func_warn_and_continue
  420. # Set to 'all' to display all warnings, 'none' to suppress all
  421. # warnings, or a space delimited list of some subset of
  422. # 'warning_categories' to display only the listed warnings.
  423. opt_warning_types=all
  424. ## -------------------- ##
  425. ## Resource management. ##
  426. ## -------------------- ##
  427. # This section contains definitions for functions that each ensure a
  428. # particular resource (a file, or a non-empty configuration variable for
  429. # example) is available, and if appropriate to extract default values
  430. # from pertinent package files. Call them using their associated
  431. # 'require_*' variable to ensure that they are executed, at most, once.
  432. #
  433. # It's entirely deliberate that calling these functions can set
  434. # variables that don't obey the namespace limitations obeyed by the rest
  435. # of this file, in order that that they be as useful as possible to
  436. # callers.
  437. # require_term_colors
  438. # -------------------
  439. # Allow display of bold text on terminals that support it.
  440. require_term_colors=func_require_term_colors
  441. func_require_term_colors ()
  442. {
  443. $debug_cmd
  444. test -t 1 && {
  445. # COLORTERM and USE_ANSI_COLORS environment variables take
  446. # precedence, because most terminfo databases neglect to describe
  447. # whether color sequences are supported.
  448. test -n "${COLORTERM+set}" && : ${USE_ANSI_COLORS="1"}
  449. if test 1 = "$USE_ANSI_COLORS"; then
  450. # Standard ANSI escape sequences
  451. tc_reset=''
  452. tc_bold=''; tc_standout=''
  453. tc_red=''; tc_green=''
  454. tc_blue=''; tc_cyan=''
  455. else
  456. # Otherwise trust the terminfo database after all.
  457. test -n "`tput sgr0 2>/dev/null`" && {
  458. tc_reset=`tput sgr0`
  459. test -n "`tput bold 2>/dev/null`" && tc_bold=`tput bold`
  460. tc_standout=$tc_bold
  461. test -n "`tput smso 2>/dev/null`" && tc_standout=`tput smso`
  462. test -n "`tput setaf 1 2>/dev/null`" && tc_red=`tput setaf 1`
  463. test -n "`tput setaf 2 2>/dev/null`" && tc_green=`tput setaf 2`
  464. test -n "`tput setaf 4 2>/dev/null`" && tc_blue=`tput setaf 4`
  465. test -n "`tput setaf 5 2>/dev/null`" && tc_cyan=`tput setaf 5`
  466. }
  467. fi
  468. }
  469. require_term_colors=:
  470. }
  471. ## ----------------- ##
  472. ## Function library. ##
  473. ## ----------------- ##
  474. # This section contains a variety of useful functions to call in your
  475. # scripts. Take note of the portable wrappers for features provided by
  476. # some modern shells, which will fall back to slower equivalents on
  477. # less featureful shells.
  478. # func_append VAR VALUE
  479. # ---------------------
  480. # Append VALUE onto the existing contents of VAR.
  481. # We should try to minimise forks, especially on Windows where they are
  482. # unreasonably slow, so skip the feature probes when bash or zsh are
  483. # being used:
  484. if test set = "${BASH_VERSION+set}${ZSH_VERSION+set}"; then
  485. : ${_G_HAVE_ARITH_OP="yes"}
  486. : ${_G_HAVE_XSI_OPS="yes"}
  487. # The += operator was introduced in bash 3.1
  488. case $BASH_VERSION in
  489. [12].* | 3.0 | 3.0*) ;;
  490. *)
  491. : ${_G_HAVE_PLUSEQ_OP="yes"}
  492. ;;
  493. esac
  494. fi
  495. # _G_HAVE_PLUSEQ_OP
  496. # Can be empty, in which case the shell is probed, "yes" if += is
  497. # usable or anything else if it does not work.
  498. test -z "$_G_HAVE_PLUSEQ_OP" \
  499. && (eval 'x=a; x+=" b"; test "a b" = "$x"') 2>/dev/null \
  500. && _G_HAVE_PLUSEQ_OP=yes
  501. if test yes = "$_G_HAVE_PLUSEQ_OP"
  502. then
  503. # This is an XSI compatible shell, allowing a faster implementation...
  504. eval 'func_append ()
  505. {
  506. $debug_cmd
  507. eval "$1+=\$2"
  508. }'
  509. else
  510. # ...otherwise fall back to using expr, which is often a shell builtin.
  511. func_append ()
  512. {
  513. $debug_cmd
  514. eval "$1=\$$1\$2"
  515. }
  516. fi
  517. # func_append_quoted VAR VALUE
  518. # ----------------------------
  519. # Quote VALUE and append to the end of shell variable VAR, separated
  520. # by a space.
  521. if test yes = "$_G_HAVE_PLUSEQ_OP"; then
  522. eval 'func_append_quoted ()
  523. {
  524. $debug_cmd
  525. func_quote_arg pretty "$2"
  526. eval "$1+=\\ \$func_quote_arg_result"
  527. }'
  528. else
  529. func_append_quoted ()
  530. {
  531. $debug_cmd
  532. func_quote_arg pretty "$2"
  533. eval "$1=\$$1\\ \$func_quote_arg_result"
  534. }
  535. fi
  536. # func_append_uniq VAR VALUE
  537. # --------------------------
  538. # Append unique VALUE onto the existing contents of VAR, assuming
  539. # entries are delimited by the first character of VALUE. For example:
  540. #
  541. # func_append_uniq options " --another-option option-argument"
  542. #
  543. # will only append to $options if " --another-option option-argument "
  544. # is not already present somewhere in $options already (note spaces at
  545. # each end implied by leading space in second argument).
  546. func_append_uniq ()
  547. {
  548. $debug_cmd
  549. eval _G_current_value='`$ECHO $'$1'`'
  550. _G_delim=`expr "$2" : '\(.\)'`
  551. case $_G_delim$_G_current_value$_G_delim in
  552. *"$2$_G_delim"*) ;;
  553. *) func_append "$@" ;;
  554. esac
  555. }
  556. # func_arith TERM...
  557. # ------------------
  558. # Set func_arith_result to the result of evaluating TERMs.
  559. test -z "$_G_HAVE_ARITH_OP" \
  560. && (eval 'test 2 = $(( 1 + 1 ))') 2>/dev/null \
  561. && _G_HAVE_ARITH_OP=yes
  562. if test yes = "$_G_HAVE_ARITH_OP"; then
  563. eval 'func_arith ()
  564. {
  565. $debug_cmd
  566. func_arith_result=$(( $* ))
  567. }'
  568. else
  569. func_arith ()
  570. {
  571. $debug_cmd
  572. func_arith_result=`expr "$@"`
  573. }
  574. fi
  575. # func_basename FILE
  576. # ------------------
  577. # Set func_basename_result to FILE with everything up to and including
  578. # the last / stripped.
  579. if test yes = "$_G_HAVE_XSI_OPS"; then
  580. # If this shell supports suffix pattern removal, then use it to avoid
  581. # forking. Hide the definitions single quotes in case the shell chokes
  582. # on unsupported syntax...
  583. _b='func_basename_result=${1##*/}'
  584. _d='case $1 in
  585. */*) func_dirname_result=${1%/*}$2 ;;
  586. * ) func_dirname_result=$3 ;;
  587. esac'
  588. else
  589. # ...otherwise fall back to using sed.
  590. _b='func_basename_result=`$ECHO "$1" |$SED "$sed_basename"`'
  591. _d='func_dirname_result=`$ECHO "$1" |$SED "$sed_dirname"`
  592. if test "X$func_dirname_result" = "X$1"; then
  593. func_dirname_result=$3
  594. else
  595. func_append func_dirname_result "$2"
  596. fi'
  597. fi
  598. eval 'func_basename ()
  599. {
  600. $debug_cmd
  601. '"$_b"'
  602. }'
  603. # func_dirname FILE APPEND NONDIR_REPLACEMENT
  604. # -------------------------------------------
  605. # Compute the dirname of FILE. If nonempty, add APPEND to the result,
  606. # otherwise set result to NONDIR_REPLACEMENT.
  607. eval 'func_dirname ()
  608. {
  609. $debug_cmd
  610. '"$_d"'
  611. }'
  612. # func_dirname_and_basename FILE APPEND NONDIR_REPLACEMENT
  613. # --------------------------------------------------------
  614. # Perform func_basename and func_dirname in a single function
  615. # call:
  616. # dirname: Compute the dirname of FILE. If nonempty,
  617. # add APPEND to the result, otherwise set result
  618. # to NONDIR_REPLACEMENT.
  619. # value returned in "$func_dirname_result"
  620. # basename: Compute filename of FILE.
  621. # value returned in "$func_basename_result"
  622. # For efficiency, we do not delegate to the functions above but instead
  623. # duplicate the functionality here.
  624. eval 'func_dirname_and_basename ()
  625. {
  626. $debug_cmd
  627. '"$_b"'
  628. '"$_d"'
  629. }'
  630. # func_echo ARG...
  631. # ----------------
  632. # Echo program name prefixed message.
  633. func_echo ()
  634. {
  635. $debug_cmd
  636. _G_message=$*
  637. func_echo_IFS=$IFS
  638. IFS=$nl
  639. for _G_line in $_G_message; do
  640. IFS=$func_echo_IFS
  641. $ECHO "$progname: $_G_line"
  642. done
  643. IFS=$func_echo_IFS
  644. }
  645. # func_echo_all ARG...
  646. # --------------------
  647. # Invoke $ECHO with all args, space-separated.
  648. func_echo_all ()
  649. {
  650. $ECHO "$*"
  651. }
  652. # func_echo_infix_1 INFIX ARG...
  653. # ------------------------------
  654. # Echo program name, followed by INFIX on the first line, with any
  655. # additional lines not showing INFIX.
  656. func_echo_infix_1 ()
  657. {
  658. $debug_cmd
  659. $require_term_colors
  660. _G_infix=$1; shift
  661. _G_indent=$_G_infix
  662. _G_prefix="$progname: $_G_infix: "
  663. _G_message=$*
  664. # Strip color escape sequences before counting printable length
  665. for _G_tc in "$tc_reset" "$tc_bold" "$tc_standout" "$tc_red" "$tc_green" "$tc_blue" "$tc_cyan"
  666. do
  667. test -n "$_G_tc" && {
  668. _G_esc_tc=`$ECHO "$_G_tc" | $SED "$sed_make_literal_regex"`
  669. _G_indent=`$ECHO "$_G_indent" | $SED "s|$_G_esc_tc||g"`
  670. }
  671. done
  672. _G_indent="$progname: "`echo "$_G_indent" | $SED 's|.| |g'`" " ## exclude from sc_prohibit_nested_quotes
  673. func_echo_infix_1_IFS=$IFS
  674. IFS=$nl
  675. for _G_line in $_G_message; do
  676. IFS=$func_echo_infix_1_IFS
  677. $ECHO "$_G_prefix$tc_bold$_G_line$tc_reset" >&2
  678. _G_prefix=$_G_indent
  679. done
  680. IFS=$func_echo_infix_1_IFS
  681. }
  682. # func_error ARG...
  683. # -----------------
  684. # Echo program name prefixed message to standard error.
  685. func_error ()
  686. {
  687. $debug_cmd
  688. $require_term_colors
  689. func_echo_infix_1 " $tc_standout${tc_red}error$tc_reset" "$*" >&2
  690. }
  691. # func_fatal_error ARG...
  692. # -----------------------
  693. # Echo program name prefixed message to standard error, and exit.
  694. func_fatal_error ()
  695. {
  696. $debug_cmd
  697. func_error "$*"
  698. exit $EXIT_FAILURE
  699. }
  700. # func_grep EXPRESSION FILENAME
  701. # -----------------------------
  702. # Check whether EXPRESSION matches any line of FILENAME, without output.
  703. func_grep ()
  704. {
  705. $debug_cmd
  706. $GREP "$1" "$2" >/dev/null 2>&1
  707. }
  708. # func_len STRING
  709. # ---------------
  710. # Set func_len_result to the length of STRING. STRING may not
  711. # start with a hyphen.
  712. test -z "$_G_HAVE_XSI_OPS" \
  713. && (eval 'x=a/b/c;
  714. test 5aa/bb/cc = "${#x}${x%%/*}${x%/*}${x#*/}${x##*/}"') 2>/dev/null \
  715. && _G_HAVE_XSI_OPS=yes
  716. if test yes = "$_G_HAVE_XSI_OPS"; then
  717. eval 'func_len ()
  718. {
  719. $debug_cmd
  720. func_len_result=${#1}
  721. }'
  722. else
  723. func_len ()
  724. {
  725. $debug_cmd
  726. func_len_result=`expr "$1" : ".*" 2>/dev/null || echo $max_cmd_len`
  727. }
  728. fi
  729. # func_mkdir_p DIRECTORY-PATH
  730. # ---------------------------
  731. # Make sure the entire path to DIRECTORY-PATH is available.
  732. func_mkdir_p ()
  733. {
  734. $debug_cmd
  735. _G_directory_path=$1
  736. _G_dir_list=
  737. if test -n "$_G_directory_path" && test : != "$opt_dry_run"; then
  738. # Protect directory names starting with '-'
  739. case $_G_directory_path in
  740. -*) _G_directory_path=./$_G_directory_path ;;
  741. esac
  742. # While some portion of DIR does not yet exist...
  743. while test ! -d "$_G_directory_path"; do
  744. # ...make a list in topmost first order. Use a colon delimited
  745. # list in case some portion of path contains whitespace.
  746. _G_dir_list=$_G_directory_path:$_G_dir_list
  747. # If the last portion added has no slash in it, the list is done
  748. case $_G_directory_path in */*) ;; *) break ;; esac
  749. # ...otherwise throw away the child directory and loop
  750. _G_directory_path=`$ECHO "$_G_directory_path" | $SED -e "$sed_dirname"`
  751. done
  752. _G_dir_list=`$ECHO "$_G_dir_list" | $SED 's|:*$||'`
  753. func_mkdir_p_IFS=$IFS; IFS=:
  754. for _G_dir in $_G_dir_list; do
  755. IFS=$func_mkdir_p_IFS
  756. # mkdir can fail with a 'File exist' error if two processes
  757. # try to create one of the directories concurrently. Don't
  758. # stop in that case!
  759. $MKDIR "$_G_dir" 2>/dev/null || :
  760. done
  761. IFS=$func_mkdir_p_IFS
  762. # Bail out if we (or some other process) failed to create a directory.
  763. test -d "$_G_directory_path" || \
  764. func_fatal_error "Failed to create '$1'"
  765. fi
  766. }
  767. # func_mktempdir [BASENAME]
  768. # -------------------------
  769. # Make a temporary directory that won't clash with other running
  770. # libtool processes, and avoids race conditions if possible. If
  771. # given, BASENAME is the basename for that directory.
  772. func_mktempdir ()
  773. {
  774. $debug_cmd
  775. _G_template=${TMPDIR-/tmp}/${1-$progname}
  776. if test : = "$opt_dry_run"; then
  777. # Return a directory name, but don't create it in dry-run mode
  778. _G_tmpdir=$_G_template-$$
  779. else
  780. # If mktemp works, use that first and foremost
  781. _G_tmpdir=`mktemp -d "$_G_template-XXXXXXXX" 2>/dev/null`
  782. if test ! -d "$_G_tmpdir"; then
  783. # Failing that, at least try and use $RANDOM to avoid a race
  784. _G_tmpdir=$_G_template-${RANDOM-0}$$
  785. func_mktempdir_umask=`umask`
  786. umask 0077
  787. $MKDIR "$_G_tmpdir"
  788. umask $func_mktempdir_umask
  789. fi
  790. # If we're not in dry-run mode, bomb out on failure
  791. test -d "$_G_tmpdir" || \
  792. func_fatal_error "cannot create temporary directory '$_G_tmpdir'"
  793. fi
  794. $ECHO "$_G_tmpdir"
  795. }
  796. # func_normal_abspath PATH
  797. # ------------------------
  798. # Remove doubled-up and trailing slashes, "." path components,
  799. # and cancel out any ".." path components in PATH after making
  800. # it an absolute path.
  801. func_normal_abspath ()
  802. {
  803. $debug_cmd
  804. # These SED scripts presuppose an absolute path with a trailing slash.
  805. _G_pathcar='s|^/\([^/]*\).*$|\1|'
  806. _G_pathcdr='s|^/[^/]*||'
  807. _G_removedotparts=':dotsl
  808. s|/\./|/|g
  809. t dotsl
  810. s|/\.$|/|'
  811. _G_collapseslashes='s|/\{1,\}|/|g'
  812. _G_finalslash='s|/*$|/|'
  813. # Start from root dir and reassemble the path.
  814. func_normal_abspath_result=
  815. func_normal_abspath_tpath=$1
  816. func_normal_abspath_altnamespace=
  817. case $func_normal_abspath_tpath in
  818. "")
  819. # Empty path, that just means $cwd.
  820. func_stripname '' '/' "`pwd`"
  821. func_normal_abspath_result=$func_stripname_result
  822. return
  823. ;;
  824. # The next three entries are used to spot a run of precisely
  825. # two leading slashes without using negated character classes;
  826. # we take advantage of case's first-match behaviour.
  827. ///*)
  828. # Unusual form of absolute path, do nothing.
  829. ;;
  830. //*)
  831. # Not necessarily an ordinary path; POSIX reserves leading '//'
  832. # and for example Cygwin uses it to access remote file shares
  833. # over CIFS/SMB, so we conserve a leading double slash if found.
  834. func_normal_abspath_altnamespace=/
  835. ;;
  836. /*)
  837. # Absolute path, do nothing.
  838. ;;
  839. *)
  840. # Relative path, prepend $cwd.
  841. func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath
  842. ;;
  843. esac
  844. # Cancel out all the simple stuff to save iterations. We also want
  845. # the path to end with a slash for ease of parsing, so make sure
  846. # there is one (and only one) here.
  847. func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
  848. -e "$_G_removedotparts" -e "$_G_collapseslashes" -e "$_G_finalslash"`
  849. while :; do
  850. # Processed it all yet?
  851. if test / = "$func_normal_abspath_tpath"; then
  852. # If we ascended to the root using ".." the result may be empty now.
  853. if test -z "$func_normal_abspath_result"; then
  854. func_normal_abspath_result=/
  855. fi
  856. break
  857. fi
  858. func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \
  859. -e "$_G_pathcar"`
  860. func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
  861. -e "$_G_pathcdr"`
  862. # Figure out what to do with it
  863. case $func_normal_abspath_tcomponent in
  864. "")
  865. # Trailing empty path component, ignore it.
  866. ;;
  867. ..)
  868. # Parent dir; strip last assembled component from result.
  869. func_dirname "$func_normal_abspath_result"
  870. func_normal_abspath_result=$func_dirname_result
  871. ;;
  872. *)
  873. # Actual path component, append it.
  874. func_append func_normal_abspath_result "/$func_normal_abspath_tcomponent"
  875. ;;
  876. esac
  877. done
  878. # Restore leading double-slash if one was found on entry.
  879. func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result
  880. }
  881. # func_notquiet ARG...
  882. # --------------------
  883. # Echo program name prefixed message only when not in quiet mode.
  884. func_notquiet ()
  885. {
  886. $debug_cmd
  887. $opt_quiet || func_echo ${1+"$@"}
  888. # A bug in bash halts the script if the last line of a function
  889. # fails when set -e is in force, so we need another command to
  890. # work around that:
  891. :
  892. }
  893. # func_relative_path SRCDIR DSTDIR
  894. # --------------------------------
  895. # Set func_relative_path_result to the relative path from SRCDIR to DSTDIR.
  896. func_relative_path ()
  897. {
  898. $debug_cmd
  899. func_relative_path_result=
  900. func_normal_abspath "$1"
  901. func_relative_path_tlibdir=$func_normal_abspath_result
  902. func_normal_abspath "$2"
  903. func_relative_path_tbindir=$func_normal_abspath_result
  904. # Ascend the tree starting from libdir
  905. while :; do
  906. # check if we have found a prefix of bindir
  907. case $func_relative_path_tbindir in
  908. $func_relative_path_tlibdir)
  909. # found an exact match
  910. func_relative_path_tcancelled=
  911. break
  912. ;;
  913. $func_relative_path_tlibdir*)
  914. # found a matching prefix
  915. func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir"
  916. func_relative_path_tcancelled=$func_stripname_result
  917. if test -z "$func_relative_path_result"; then
  918. func_relative_path_result=.
  919. fi
  920. break
  921. ;;
  922. *)
  923. func_dirname $func_relative_path_tlibdir
  924. func_relative_path_tlibdir=$func_dirname_result
  925. if test -z "$func_relative_path_tlibdir"; then
  926. # Have to descend all the way to the root!
  927. func_relative_path_result=../$func_relative_path_result
  928. func_relative_path_tcancelled=$func_relative_path_tbindir
  929. break
  930. fi
  931. func_relative_path_result=../$func_relative_path_result
  932. ;;
  933. esac
  934. done
  935. # Now calculate path; take care to avoid doubling-up slashes.
  936. func_stripname '' '/' "$func_relative_path_result"
  937. func_relative_path_result=$func_stripname_result
  938. func_stripname '/' '/' "$func_relative_path_tcancelled"
  939. if test -n "$func_stripname_result"; then
  940. func_append func_relative_path_result "/$func_stripname_result"
  941. fi
  942. # Normalisation. If bindir is libdir, return '.' else relative path.
  943. if test -n "$func_relative_path_result"; then
  944. func_stripname './' '' "$func_relative_path_result"
  945. func_relative_path_result=$func_stripname_result
  946. fi
  947. test -n "$func_relative_path_result" || func_relative_path_result=.
  948. :
  949. }
  950. # func_quote_portable EVAL ARG
  951. # ----------------------------
  952. # Internal function to portably implement func_quote_arg. Note that we still
  953. # keep attention to performance here so we as much as possible try to avoid
  954. # calling sed binary (so far O(N) complexity as long as func_append is O(1)).
  955. func_quote_portable ()
  956. {
  957. $debug_cmd
  958. $require_check_ifs_backslash
  959. func_quote_portable_result=$2
  960. # one-time-loop (easy break)
  961. while true
  962. do
  963. if $1; then
  964. func_quote_portable_result=`$ECHO "$2" | $SED \
  965. -e "$sed_double_quote_subst" -e "$sed_double_backslash"`
  966. break
  967. fi
  968. # Quote for eval.
  969. case $func_quote_portable_result in
  970. *[\\\`\"\$]*)
  971. # Fallback to sed for $func_check_bs_ifs_broken=:, or when the string
  972. # contains the shell wildcard characters.
  973. case $check_ifs_backshlash_broken$func_quote_portable_result in
  974. :*|*[\[\*\?]*)
  975. func_quote_portable_result=`$ECHO "$func_quote_portable_result" \
  976. | $SED "$sed_quote_subst"`
  977. break
  978. ;;
  979. esac
  980. func_quote_portable_old_IFS=$IFS
  981. for _G_char in '\' '`' '"' '$'
  982. do
  983. # STATE($1) PREV($2) SEPARATOR($3)
  984. set start "" ""
  985. func_quote_portable_result=dummy"$_G_char$func_quote_portable_result$_G_char"dummy
  986. IFS=$_G_char
  987. for _G_part in $func_quote_portable_result
  988. do
  989. case $1 in
  990. quote)
  991. func_append func_quote_portable_result "$3$2"
  992. set quote "$_G_part" "\\$_G_char"
  993. ;;
  994. start)
  995. set first "" ""
  996. func_quote_portable_result=
  997. ;;
  998. first)
  999. set quote "$_G_part" ""
  1000. ;;
  1001. esac
  1002. done
  1003. done
  1004. IFS=$func_quote_portable_old_IFS
  1005. ;;
  1006. *) ;;
  1007. esac
  1008. break
  1009. done
  1010. func_quote_portable_unquoted_result=$func_quote_portable_result
  1011. case $func_quote_portable_result in
  1012. # double-quote args containing shell metacharacters to delay
  1013. # word splitting, command substitution and variable expansion
  1014. # for a subsequent eval.
  1015. # many bourne shells cannot handle close brackets correctly
  1016. # in scan sets, so we specify it separately.
  1017. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
  1018. func_quote_portable_result=\"$func_quote_portable_result\"
  1019. ;;
  1020. esac
  1021. }
  1022. # func_quotefast_eval ARG
  1023. # -----------------------
  1024. # Quote one ARG (internal). This is equivalent to 'func_quote_arg eval ARG',
  1025. # but optimized for speed. Result is stored in $func_quotefast_eval.
  1026. if test xyes = `(x=; printf -v x %q yes; echo x"$x") 2>/dev/null`; then
  1027. printf -v _GL_test_printf_tilde %q '~'
  1028. if test '\~' = "$_GL_test_printf_tilde"; then
  1029. func_quotefast_eval ()
  1030. {
  1031. printf -v func_quotefast_eval_result %q "$1"
  1032. }
  1033. else
  1034. # Broken older Bash implementations. Make those faster too if possible.
  1035. func_quotefast_eval ()
  1036. {
  1037. case $1 in
  1038. '~'*)
  1039. func_quote_portable false "$1"
  1040. func_quotefast_eval_result=$func_quote_portable_result
  1041. ;;
  1042. *)
  1043. printf -v func_quotefast_eval_result %q "$1"
  1044. ;;
  1045. esac
  1046. }
  1047. fi
  1048. else
  1049. func_quotefast_eval ()
  1050. {
  1051. func_quote_portable false "$1"
  1052. func_quotefast_eval_result=$func_quote_portable_result
  1053. }
  1054. fi
  1055. # func_quote_arg MODEs ARG
  1056. # ------------------------
  1057. # Quote one ARG to be evaled later. MODEs argument may contain zero or more
  1058. # specifiers listed below separated by ',' character. This function returns two
  1059. # values:
  1060. # i) func_quote_arg_result
  1061. # double-quoted (when needed), suitable for a subsequent eval
  1062. # ii) func_quote_arg_unquoted_result
  1063. # has all characters that are still active within double
  1064. # quotes backslashified. Available only if 'unquoted' is specified.
  1065. #
  1066. # Available modes:
  1067. # ----------------
  1068. # 'eval' (default)
  1069. # - escape shell special characters
  1070. # 'expand'
  1071. # - the same as 'eval'; but do not quote variable references
  1072. # 'pretty'
  1073. # - request aesthetic output, i.e. '"a b"' instead of 'a\ b'. This might
  1074. # be used later in func_quote to get output like: 'echo "a b"' instead
  1075. # of 'echo a\ b'. This is slower than default on some shells.
  1076. # 'unquoted'
  1077. # - produce also $func_quote_arg_unquoted_result which does not contain
  1078. # wrapping double-quotes.
  1079. #
  1080. # Examples for 'func_quote_arg pretty,unquoted string':
  1081. #
  1082. # string | *_result | *_unquoted_result
  1083. # ------------+-----------------------+-------------------
  1084. # " | \" | \"
  1085. # a b | "a b" | a b
  1086. # "a b" | "\"a b\"" | \"a b\"
  1087. # * | "*" | *
  1088. # z="${x-$y}" | "z=\"\${x-\$y}\"" | z=\"\${x-\$y}\"
  1089. #
  1090. # Examples for 'func_quote_arg pretty,unquoted,expand string':
  1091. #
  1092. # string | *_result | *_unquoted_result
  1093. # --------------+---------------------+--------------------
  1094. # z="${x-$y}" | "z=\"${x-$y}\"" | z=\"${x-$y}\"
  1095. func_quote_arg ()
  1096. {
  1097. _G_quote_expand=false
  1098. case ,$1, in
  1099. *,expand,*)
  1100. _G_quote_expand=:
  1101. ;;
  1102. esac
  1103. case ,$1, in
  1104. *,pretty,*|*,expand,*|*,unquoted,*)
  1105. func_quote_portable $_G_quote_expand "$2"
  1106. func_quote_arg_result=$func_quote_portable_result
  1107. func_quote_arg_unquoted_result=$func_quote_portable_unquoted_result
  1108. ;;
  1109. *)
  1110. # Faster quote-for-eval for some shells.
  1111. func_quotefast_eval "$2"
  1112. func_quote_arg_result=$func_quotefast_eval_result
  1113. ;;
  1114. esac
  1115. }
  1116. # func_quote MODEs ARGs...
  1117. # ------------------------
  1118. # Quote all ARGs to be evaled later and join them into single command. See
  1119. # func_quote_arg's description for more info.
  1120. func_quote ()
  1121. {
  1122. $debug_cmd
  1123. _G_func_quote_mode=$1 ; shift
  1124. func_quote_result=
  1125. while test 0 -lt $#; do
  1126. func_quote_arg "$_G_func_quote_mode" "$1"
  1127. if test -n "$func_quote_result"; then
  1128. func_append func_quote_result " $func_quote_arg_result"
  1129. else
  1130. func_append func_quote_result "$func_quote_arg_result"
  1131. fi
  1132. shift
  1133. done
  1134. }
  1135. # func_stripname PREFIX SUFFIX NAME
  1136. # ---------------------------------
  1137. # strip PREFIX and SUFFIX from NAME, and store in func_stripname_result.
  1138. # PREFIX and SUFFIX must not contain globbing or regex special
  1139. # characters, hashes, percent signs, but SUFFIX may contain a leading
  1140. # dot (in which case that matches only a dot).
  1141. if test yes = "$_G_HAVE_XSI_OPS"; then
  1142. eval 'func_stripname ()
  1143. {
  1144. $debug_cmd
  1145. # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are
  1146. # positional parameters, so assign one to ordinary variable first.
  1147. func_stripname_result=$3
  1148. func_stripname_result=${func_stripname_result#"$1"}
  1149. func_stripname_result=${func_stripname_result%"$2"}
  1150. }'
  1151. else
  1152. func_stripname ()
  1153. {
  1154. $debug_cmd
  1155. case $2 in
  1156. .*) func_stripname_result=`$ECHO "$3" | $SED -e "s%^$1%%" -e "s%\\\\$2\$%%"`;;
  1157. *) func_stripname_result=`$ECHO "$3" | $SED -e "s%^$1%%" -e "s%$2\$%%"`;;
  1158. esac
  1159. }
  1160. fi
  1161. # func_show_eval CMD [FAIL_EXP]
  1162. # -----------------------------
  1163. # Unless opt_quiet is true, then output CMD. Then, if opt_dryrun is
  1164. # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
  1165. # is given, then evaluate it.
  1166. func_show_eval ()
  1167. {
  1168. $debug_cmd
  1169. _G_cmd=$1
  1170. _G_fail_exp=${2-':'}
  1171. func_quote_arg pretty,expand "$_G_cmd"
  1172. eval "func_notquiet $func_quote_arg_result"
  1173. $opt_dry_run || {
  1174. eval "$_G_cmd"
  1175. _G_status=$?
  1176. if test 0 -ne "$_G_status"; then
  1177. eval "(exit $_G_status); $_G_fail_exp"
  1178. fi
  1179. }
  1180. }
  1181. # func_show_eval_locale CMD [FAIL_EXP]
  1182. # ------------------------------------
  1183. # Unless opt_quiet is true, then output CMD. Then, if opt_dryrun is
  1184. # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
  1185. # is given, then evaluate it. Use the saved locale for evaluation.
  1186. func_show_eval_locale ()
  1187. {
  1188. $debug_cmd
  1189. _G_cmd=$1
  1190. _G_fail_exp=${2-':'}
  1191. $opt_quiet || {
  1192. func_quote_arg expand,pretty "$_G_cmd"
  1193. eval "func_echo $func_quote_arg_result"
  1194. }
  1195. $opt_dry_run || {
  1196. eval "$_G_user_locale
  1197. $_G_cmd"
  1198. _G_status=$?
  1199. eval "$_G_safe_locale"
  1200. if test 0 -ne "$_G_status"; then
  1201. eval "(exit $_G_status); $_G_fail_exp"
  1202. fi
  1203. }
  1204. }
  1205. # func_tr_sh
  1206. # ----------
  1207. # Turn $1 into a string suitable for a shell variable name.
  1208. # Result is stored in $func_tr_sh_result. All characters
  1209. # not in the set a-zA-Z0-9_ are replaced with '_'. Further,
  1210. # if $1 begins with a digit, a '_' is prepended as well.
  1211. func_tr_sh ()
  1212. {
  1213. $debug_cmd
  1214. case $1 in
  1215. [0-9]* | *[!a-zA-Z0-9_]*)
  1216. func_tr_sh_result=`$ECHO "$1" | $SED -e 's/^\([0-9]\)/_\1/' -e 's/[^a-zA-Z0-9_]/_/g'`
  1217. ;;
  1218. * )
  1219. func_tr_sh_result=$1
  1220. ;;
  1221. esac
  1222. }
  1223. # func_verbose ARG...
  1224. # -------------------
  1225. # Echo program name prefixed message in verbose mode only.
  1226. func_verbose ()
  1227. {
  1228. $debug_cmd
  1229. $opt_verbose && func_echo "$*"
  1230. :
  1231. }
  1232. # func_warn_and_continue ARG...
  1233. # -----------------------------
  1234. # Echo program name prefixed warning message to standard error.
  1235. func_warn_and_continue ()
  1236. {
  1237. $debug_cmd
  1238. $require_term_colors
  1239. func_echo_infix_1 "${tc_red}warning$tc_reset" "$*" >&2
  1240. }
  1241. # func_warning CATEGORY ARG...
  1242. # ----------------------------
  1243. # Echo program name prefixed warning message to standard error. Warning
  1244. # messages can be filtered according to CATEGORY, where this function
  1245. # elides messages where CATEGORY is not listed in the global variable
  1246. # 'opt_warning_types'.
  1247. func_warning ()
  1248. {
  1249. $debug_cmd
  1250. # CATEGORY must be in the warning_categories list!
  1251. case " $warning_categories " in
  1252. *" $1 "*) ;;
  1253. *) func_internal_error "invalid warning category '$1'" ;;
  1254. esac
  1255. _G_category=$1
  1256. shift
  1257. case " $opt_warning_types " in
  1258. *" $_G_category "*) $warning_func ${1+"$@"} ;;
  1259. esac
  1260. }
  1261. # func_sort_ver VER1 VER2
  1262. # -----------------------
  1263. # 'sort -V' is not generally available.
  1264. # Note this deviates from the version comparison in automake
  1265. # in that it treats 1.5 < 1.5.0, and treats 1.4.4a < 1.4-p3a
  1266. # but this should suffice as we won't be specifying old
  1267. # version formats or redundant trailing .0 in bootstrap.conf.
  1268. # If we did want full compatibility then we should probably
  1269. # use m4_version_compare from autoconf.
  1270. func_sort_ver ()
  1271. {
  1272. $debug_cmd
  1273. printf '%s\n%s\n' "$1" "$2" \
  1274. | sort -t. -k 1,1n -k 2,2n -k 3,3n -k 4,4n -k 5,5n -k 6,6n -k 7,7n -k 8,8n -k 9,9n
  1275. }
  1276. # func_lt_ver PREV CURR
  1277. # ---------------------
  1278. # Return true if PREV and CURR are in the correct order according to
  1279. # func_sort_ver, otherwise false. Use it like this:
  1280. #
  1281. # func_lt_ver "$prev_ver" "$proposed_ver" || func_fatal_error "..."
  1282. func_lt_ver ()
  1283. {
  1284. $debug_cmd
  1285. test "x$1" = x`func_sort_ver "$1" "$2" | $SED 1q`
  1286. }
  1287. # Local variables:
  1288. # mode: shell-script
  1289. # sh-indentation: 2
  1290. # eval: (add-hook 'before-save-hook 'time-stamp)
  1291. # time-stamp-pattern: "10/scriptversion=%:y-%02m-%02d.%02H; # UTC"
  1292. # time-stamp-time-zone: "UTC"
  1293. # End:
  1294. #! /bin/sh
  1295. # A portable, pluggable option parser for Bourne shell.
  1296. # Written by Gary V. Vaughan, 2010
  1297. # This is free software. There is NO warranty; not even for
  1298. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  1299. #
  1300. # Copyright (C) 2010-2019, 2021, 2023-2024 Bootstrap Authors
  1301. #
  1302. # This file is dual licensed under the terms of the MIT license
  1303. # <https://opensource.org/licenses/MIT>, and GPL version 2 or later
  1304. # <https://www.gnu.org/licenses/gpl-2.0.html>. You must apply one of
  1305. # these licenses when using or redistributing this software or any of
  1306. # the files within it. See the URLs above, or the file `LICENSE`
  1307. # included in the Bootstrap distribution for the full license texts.
  1308. # Please report bugs or propose patches to:
  1309. # <https://github.com/gnulib-modules/bootstrap/issues>
  1310. # Set a version string for this script.
  1311. scriptversion=2019-02-19.15; # UTC
  1312. ## ------ ##
  1313. ## Usage. ##
  1314. ## ------ ##
  1315. # This file is a library for parsing options in your shell scripts along
  1316. # with assorted other useful supporting features that you can make use
  1317. # of too.
  1318. #
  1319. # For the simplest scripts you might need only:
  1320. #
  1321. # #!/bin/sh
  1322. # . relative/path/to/funclib.sh
  1323. # . relative/path/to/options-parser
  1324. # scriptversion=1.0
  1325. # func_options ${1+"$@"}
  1326. # eval set dummy "$func_options_result"; shift
  1327. # ...rest of your script...
  1328. #
  1329. # In order for the '--version' option to work, you will need to have a
  1330. # suitably formatted comment like the one at the top of this file
  1331. # starting with '# Written by ' and ending with '# Copyright'.
  1332. #
  1333. # For '-h' and '--help' to work, you will also need a one line
  1334. # description of your script's purpose in a comment directly above the
  1335. # '# Written by ' line, like the one at the top of this file.
  1336. #
  1337. # The default options also support '--debug', which will turn on shell
  1338. # execution tracing (see the comment above debug_cmd below for another
  1339. # use), and '--verbose' and the func_verbose function to allow your script
  1340. # to display verbose messages only when your user has specified
  1341. # '--verbose'.
  1342. #
  1343. # After sourcing this file, you can plug in processing for additional
  1344. # options by amending the variables from the 'Configuration' section
  1345. # below, and following the instructions in the 'Option parsing'
  1346. # section further down.
  1347. ## -------------- ##
  1348. ## Configuration. ##
  1349. ## -------------- ##
  1350. # You should override these variables in your script after sourcing this
  1351. # file so that they reflect the customisations you have added to the
  1352. # option parser.
  1353. # The usage line for option parsing errors and the start of '-h' and
  1354. # '--help' output messages. You can embed shell variables for delayed
  1355. # expansion at the time the message is displayed, but you will need to
  1356. # quote other shell meta-characters carefully to prevent them being
  1357. # expanded when the contents are evaled.
  1358. usage='$progpath [OPTION]...'
  1359. # Short help message in response to '-h' and '--help'. Add to this or
  1360. # override it after sourcing this library to reflect the full set of
  1361. # options your script accepts.
  1362. usage_message="\
  1363. --debug enable verbose shell tracing
  1364. -W, --warnings=CATEGORY
  1365. report the warnings falling in CATEGORY [all]
  1366. -v, --verbose verbosely report processing
  1367. --version print version information and exit
  1368. -h, --help print short or long help message and exit
  1369. "
  1370. # Additional text appended to 'usage_message' in response to '--help'.
  1371. long_help_message="
  1372. Warning categories include:
  1373. 'all' show all warnings
  1374. 'none' turn off all the warnings
  1375. 'error' warnings are treated as fatal errors"
  1376. # Help message printed before fatal option parsing errors.
  1377. fatal_help="Try '\$progname --help' for more information."
  1378. ## ------------------------- ##
  1379. ## Hook function management. ##
  1380. ## ------------------------- ##
  1381. # This section contains functions for adding, removing, and running hooks
  1382. # in the main code. A hook is just a list of function names that can be
  1383. # run in order later on.
  1384. # func_hookable FUNC_NAME
  1385. # -----------------------
  1386. # Declare that FUNC_NAME will run hooks added with
  1387. # 'func_add_hook FUNC_NAME ...'.
  1388. func_hookable ()
  1389. {
  1390. $debug_cmd
  1391. func_append hookable_fns " $1"
  1392. }
  1393. # func_add_hook FUNC_NAME HOOK_FUNC
  1394. # ---------------------------------
  1395. # Request that FUNC_NAME call HOOK_FUNC before it returns. FUNC_NAME must
  1396. # first have been declared "hookable" by a call to 'func_hookable'.
  1397. func_add_hook ()
  1398. {
  1399. $debug_cmd
  1400. case " $hookable_fns " in
  1401. *" $1 "*) ;;
  1402. *) func_fatal_error "'$1' does not accept hook functions." ;;
  1403. esac
  1404. eval func_append ${1}_hooks '" $2"'
  1405. }
  1406. # func_remove_hook FUNC_NAME HOOK_FUNC
  1407. # ------------------------------------
  1408. # Remove HOOK_FUNC from the list of hook functions to be called by
  1409. # FUNC_NAME.
  1410. func_remove_hook ()
  1411. {
  1412. $debug_cmd
  1413. eval ${1}_hooks='`$ECHO "\$'$1'_hooks" |$SED "s| '$2'||"`'
  1414. }
  1415. # func_propagate_result FUNC_NAME_A FUNC_NAME_B
  1416. # ---------------------------------------------
  1417. # If the *_result variable of FUNC_NAME_A _is set_, assign its value to
  1418. # *_result variable of FUNC_NAME_B.
  1419. func_propagate_result ()
  1420. {
  1421. $debug_cmd
  1422. func_propagate_result_result=:
  1423. if eval "test \"\${${1}_result+set}\" = set"
  1424. then
  1425. eval "${2}_result=\$${1}_result"
  1426. else
  1427. func_propagate_result_result=false
  1428. fi
  1429. }
  1430. # func_run_hooks FUNC_NAME [ARG]...
  1431. # ---------------------------------
  1432. # Run all hook functions registered to FUNC_NAME.
  1433. # It's assumed that the list of hook functions contains nothing more
  1434. # than a whitespace-delimited list of legal shell function names, and
  1435. # no effort is wasted trying to catch shell meta-characters or preserve
  1436. # whitespace.
  1437. func_run_hooks ()
  1438. {
  1439. $debug_cmd
  1440. case " $hookable_fns " in
  1441. *" $1 "*) ;;
  1442. *) func_fatal_error "'$1' does not support hook functions." ;;
  1443. esac
  1444. eval _G_hook_fns=\$$1_hooks; shift
  1445. for _G_hook in $_G_hook_fns; do
  1446. func_unset "${_G_hook}_result"
  1447. eval $_G_hook '${1+"$@"}'
  1448. func_propagate_result $_G_hook func_run_hooks
  1449. if $func_propagate_result_result; then
  1450. eval set dummy "$func_run_hooks_result"; shift
  1451. fi
  1452. done
  1453. }
  1454. ## --------------- ##
  1455. ## Option parsing. ##
  1456. ## --------------- ##
  1457. # In order to add your own option parsing hooks, you must accept the
  1458. # full positional parameter list from your hook function. You may remove
  1459. # or edit any options that you action, and then pass back the remaining
  1460. # unprocessed options in '<hooked_function_name>_result', escaped
  1461. # suitably for 'eval'.
  1462. #
  1463. # The '<hooked_function_name>_result' variable is automatically unset
  1464. # before your hook gets called; for best performance, only set the
  1465. # *_result variable when necessary (i.e. don't call the 'func_quote'
  1466. # function unnecessarily because it can be an expensive operation on some
  1467. # machines).
  1468. #
  1469. # Like this:
  1470. #
  1471. # my_options_prep ()
  1472. # {
  1473. # $debug_cmd
  1474. #
  1475. # # Extend the existing usage message.
  1476. # usage_message=$usage_message'
  1477. # -s, --silent don'\''t print informational messages
  1478. # '
  1479. # # No change in '$@' (ignored completely by this hook). Leave
  1480. # # my_options_prep_result variable intact.
  1481. # }
  1482. # func_add_hook func_options_prep my_options_prep
  1483. #
  1484. #
  1485. # my_silent_option ()
  1486. # {
  1487. # $debug_cmd
  1488. #
  1489. # args_changed=false
  1490. #
  1491. # # Note that, for efficiency, we parse as many options as we can
  1492. # # recognise in a loop before passing the remainder back to the
  1493. # # caller on the first unrecognised argument we encounter.
  1494. # while test $# -gt 0; do
  1495. # opt=$1; shift
  1496. # case $opt in
  1497. # --silent|-s) opt_silent=:
  1498. # args_changed=:
  1499. # ;;
  1500. # # Separate non-argument short options:
  1501. # -s*) func_split_short_opt "$_G_opt"
  1502. # set dummy "$func_split_short_opt_name" \
  1503. # "-$func_split_short_opt_arg" ${1+"$@"}
  1504. # shift
  1505. # args_changed=:
  1506. # ;;
  1507. # *) # Make sure the first unrecognised option "$_G_opt"
  1508. # # is added back to "$@" in case we need it later,
  1509. # # if $args_changed was set to 'true'.
  1510. # set dummy "$_G_opt" ${1+"$@"}; shift; break ;;
  1511. # esac
  1512. # done
  1513. #
  1514. # # Only call 'func_quote' here if we processed at least one argument.
  1515. # if $args_changed; then
  1516. # func_quote eval ${1+"$@"}
  1517. # my_silent_option_result=$func_quote_result
  1518. # fi
  1519. # }
  1520. # func_add_hook func_parse_options my_silent_option
  1521. #
  1522. #
  1523. # my_option_validation ()
  1524. # {
  1525. # $debug_cmd
  1526. #
  1527. # $opt_silent && $opt_verbose && func_fatal_help "\
  1528. # '--silent' and '--verbose' options are mutually exclusive."
  1529. # }
  1530. # func_add_hook func_validate_options my_option_validation
  1531. #
  1532. # You'll also need to manually amend $usage_message to reflect the extra
  1533. # options you parse. It's preferable to append if you can, so that
  1534. # multiple option parsing hooks can be added safely.
  1535. # func_options_finish [ARG]...
  1536. # ----------------------------
  1537. # Finishing the option parse loop (call 'func_options' hooks ATM).
  1538. func_options_finish ()
  1539. {
  1540. $debug_cmd
  1541. func_run_hooks func_options ${1+"$@"}
  1542. func_propagate_result func_run_hooks func_options_finish
  1543. }
  1544. # func_options [ARG]...
  1545. # ---------------------
  1546. # All the functions called inside func_options are hookable. See the
  1547. # individual implementations for details.
  1548. func_hookable func_options
  1549. func_options ()
  1550. {
  1551. $debug_cmd
  1552. _G_options_quoted=false
  1553. for my_func in options_prep parse_options validate_options options_finish
  1554. do
  1555. func_unset func_${my_func}_result
  1556. func_unset func_run_hooks_result
  1557. eval func_$my_func '${1+"$@"}'
  1558. func_propagate_result func_$my_func func_options
  1559. if $func_propagate_result_result; then
  1560. eval set dummy "$func_options_result"; shift
  1561. _G_options_quoted=:
  1562. fi
  1563. done
  1564. $_G_options_quoted || {
  1565. # As we (func_options) are top-level options-parser function and
  1566. # nobody quoted "$@" for us yet, we need to do it explicitly for
  1567. # caller.
  1568. func_quote eval ${1+"$@"}
  1569. func_options_result=$func_quote_result
  1570. }
  1571. }
  1572. # func_options_prep [ARG]...
  1573. # --------------------------
  1574. # All initialisations required before starting the option parse loop.
  1575. # Note that when calling hook functions, we pass through the list of
  1576. # positional parameters. If a hook function modifies that list, and
  1577. # needs to propagate that back to rest of this script, then the complete
  1578. # modified list must be put in 'func_run_hooks_result' before returning.
  1579. func_hookable func_options_prep
  1580. func_options_prep ()
  1581. {
  1582. $debug_cmd
  1583. # Option defaults:
  1584. opt_verbose=false
  1585. opt_warning_types=
  1586. func_run_hooks func_options_prep ${1+"$@"}
  1587. func_propagate_result func_run_hooks func_options_prep
  1588. }
  1589. # func_parse_options [ARG]...
  1590. # ---------------------------
  1591. # The main option parsing loop.
  1592. func_hookable func_parse_options
  1593. func_parse_options ()
  1594. {
  1595. $debug_cmd
  1596. _G_parse_options_requote=false
  1597. # this just eases exit handling
  1598. while test $# -gt 0; do
  1599. # Defer to hook functions for initial option parsing, so they
  1600. # get priority in the event of reusing an option name.
  1601. func_run_hooks func_parse_options ${1+"$@"}
  1602. func_propagate_result func_run_hooks func_parse_options
  1603. if $func_propagate_result_result; then
  1604. eval set dummy "$func_parse_options_result"; shift
  1605. # Even though we may have changed "$@", we passed the "$@" array
  1606. # down into the hook and it quoted it for us (because we are in
  1607. # this if-branch). No need to quote it again.
  1608. _G_parse_options_requote=false
  1609. fi
  1610. # Break out of the loop if we already parsed every option.
  1611. test $# -gt 0 || break
  1612. # We expect that one of the options parsed in this function matches
  1613. # and thus we remove _G_opt from "$@" and need to re-quote.
  1614. _G_match_parse_options=:
  1615. _G_opt=$1
  1616. shift
  1617. case $_G_opt in
  1618. --debug|-x) debug_cmd='set -x'
  1619. func_echo "enabling shell trace mode" >&2
  1620. $debug_cmd
  1621. ;;
  1622. --no-warnings|--no-warning|--no-warn)
  1623. set dummy --warnings none ${1+"$@"}
  1624. shift
  1625. ;;
  1626. --warnings|--warning|-W)
  1627. if test $# = 0 && func_missing_arg $_G_opt; then
  1628. _G_parse_options_requote=:
  1629. break
  1630. fi
  1631. case " $warning_categories $1" in
  1632. *" $1 "*)
  1633. # trailing space prevents matching last $1 above
  1634. func_append_uniq opt_warning_types " $1"
  1635. ;;
  1636. *all)
  1637. opt_warning_types=$warning_categories
  1638. ;;
  1639. *none)
  1640. opt_warning_types=none
  1641. warning_func=:
  1642. ;;
  1643. *error)
  1644. opt_warning_types=$warning_categories
  1645. warning_func=func_fatal_error
  1646. ;;
  1647. *)
  1648. func_fatal_error \
  1649. "unsupported warning category: '$1'"
  1650. ;;
  1651. esac
  1652. shift
  1653. ;;
  1654. --verbose|-v) opt_verbose=: ;;
  1655. --version) func_version ;;
  1656. -\?|-h) func_usage ;;
  1657. --help) func_help ;;
  1658. # Separate optargs to long options (plugins may need this):
  1659. --*=*) func_split_equals "$_G_opt"
  1660. set dummy "$func_split_equals_lhs" \
  1661. "$func_split_equals_rhs" ${1+"$@"}
  1662. shift
  1663. ;;
  1664. # Separate optargs to short options:
  1665. -W*)
  1666. func_split_short_opt "$_G_opt"
  1667. set dummy "$func_split_short_opt_name" \
  1668. "$func_split_short_opt_arg" ${1+"$@"}
  1669. shift
  1670. ;;
  1671. # Separate non-argument short options:
  1672. -\?*|-h*|-v*|-x*)
  1673. func_split_short_opt "$_G_opt"
  1674. set dummy "$func_split_short_opt_name" \
  1675. "-$func_split_short_opt_arg" ${1+"$@"}
  1676. shift
  1677. ;;
  1678. --) _G_parse_options_requote=: ; break ;;
  1679. -*) func_fatal_help "unrecognised option: '$_G_opt'" ;;
  1680. *) set dummy "$_G_opt" ${1+"$@"}; shift
  1681. _G_match_parse_options=false
  1682. break
  1683. ;;
  1684. esac
  1685. if $_G_match_parse_options; then
  1686. _G_parse_options_requote=:
  1687. fi
  1688. done
  1689. if $_G_parse_options_requote; then
  1690. # save modified positional parameters for caller
  1691. func_quote eval ${1+"$@"}
  1692. func_parse_options_result=$func_quote_result
  1693. fi
  1694. }
  1695. # func_validate_options [ARG]...
  1696. # ------------------------------
  1697. # Perform any sanity checks on option settings and/or unconsumed
  1698. # arguments.
  1699. func_hookable func_validate_options
  1700. func_validate_options ()
  1701. {
  1702. $debug_cmd
  1703. # Display all warnings if -W was not given.
  1704. test -n "$opt_warning_types" || opt_warning_types=" $warning_categories"
  1705. func_run_hooks func_validate_options ${1+"$@"}
  1706. func_propagate_result func_run_hooks func_validate_options
  1707. # Bail if the options were screwed!
  1708. $exit_cmd $EXIT_FAILURE
  1709. }
  1710. ## ----------------- ##
  1711. ## Helper functions. ##
  1712. ## ----------------- ##
  1713. # This section contains the helper functions used by the rest of the
  1714. # hookable option parser framework in ascii-betical order.
  1715. # func_fatal_help ARG...
  1716. # ----------------------
  1717. # Echo program name prefixed message to standard error, followed by
  1718. # a help hint, and exit.
  1719. func_fatal_help ()
  1720. {
  1721. $debug_cmd
  1722. eval \$ECHO \""Usage: $usage"\"
  1723. eval \$ECHO \""$fatal_help"\"
  1724. func_error ${1+"$@"}
  1725. exit $EXIT_FAILURE
  1726. }
  1727. # func_help
  1728. # ---------
  1729. # Echo long help message to standard output and exit.
  1730. func_help ()
  1731. {
  1732. $debug_cmd
  1733. func_usage_message
  1734. $ECHO "$long_help_message"
  1735. exit 0
  1736. }
  1737. # func_missing_arg ARGNAME
  1738. # ------------------------
  1739. # Echo program name prefixed message to standard error and set global
  1740. # exit_cmd.
  1741. func_missing_arg ()
  1742. {
  1743. $debug_cmd
  1744. func_error "Missing argument for '$1'."
  1745. exit_cmd=exit
  1746. }
  1747. # func_split_equals STRING
  1748. # ------------------------
  1749. # Set func_split_equals_lhs and func_split_equals_rhs shell variables
  1750. # after splitting STRING at the '=' sign.
  1751. test -z "$_G_HAVE_XSI_OPS" \
  1752. && (eval 'x=a/b/c;
  1753. test 5aa/bb/cc = "${#x}${x%%/*}${x%/*}${x#*/}${x##*/}"') 2>/dev/null \
  1754. && _G_HAVE_XSI_OPS=yes
  1755. if test yes = "$_G_HAVE_XSI_OPS"
  1756. then
  1757. # This is an XSI compatible shell, allowing a faster implementation...
  1758. eval 'func_split_equals ()
  1759. {
  1760. $debug_cmd
  1761. func_split_equals_lhs=${1%%=*}
  1762. func_split_equals_rhs=${1#*=}
  1763. if test "x$func_split_equals_lhs" = "x$1"; then
  1764. func_split_equals_rhs=
  1765. fi
  1766. }'
  1767. else
  1768. # ...otherwise fall back to using expr, which is often a shell builtin.
  1769. func_split_equals ()
  1770. {
  1771. $debug_cmd
  1772. func_split_equals_lhs=`expr "x$1" : 'x\([^=]*\)'`
  1773. func_split_equals_rhs=
  1774. test "x$func_split_equals_lhs=" = "x$1" \
  1775. || func_split_equals_rhs=`expr "x$1" : 'x[^=]*=\(.*\)$'`
  1776. }
  1777. fi #func_split_equals
  1778. # func_split_short_opt SHORTOPT
  1779. # -----------------------------
  1780. # Set func_split_short_opt_name and func_split_short_opt_arg shell
  1781. # variables after splitting SHORTOPT after the 2nd character.
  1782. if test yes = "$_G_HAVE_XSI_OPS"
  1783. then
  1784. # This is an XSI compatible shell, allowing a faster implementation...
  1785. eval 'func_split_short_opt ()
  1786. {
  1787. $debug_cmd
  1788. func_split_short_opt_arg=${1#??}
  1789. func_split_short_opt_name=${1%"$func_split_short_opt_arg"}
  1790. }'
  1791. else
  1792. # ...otherwise fall back to using expr, which is often a shell builtin.
  1793. func_split_short_opt ()
  1794. {
  1795. $debug_cmd
  1796. func_split_short_opt_name=`expr "x$1" : 'x\(-.\)'`
  1797. func_split_short_opt_arg=`expr "x$1" : 'x-.\(.*\)$'`
  1798. }
  1799. fi #func_split_short_opt
  1800. # func_usage
  1801. # ----------
  1802. # Echo short help message to standard output and exit.
  1803. func_usage ()
  1804. {
  1805. $debug_cmd
  1806. func_usage_message
  1807. $ECHO "Run '$progname --help |${PAGER-more}' for full usage"
  1808. exit 0
  1809. }
  1810. # func_usage_message
  1811. # ------------------
  1812. # Echo short help message to standard output.
  1813. func_usage_message ()
  1814. {
  1815. $debug_cmd
  1816. eval \$ECHO \""Usage: $usage"\"
  1817. echo
  1818. $SED -n 's|^# ||
  1819. /^Written by/{
  1820. x;p;x
  1821. }
  1822. h
  1823. /^Written by/q' < "$progpath"
  1824. echo
  1825. eval \$ECHO \""$usage_message"\"
  1826. }
  1827. # func_version
  1828. # ------------
  1829. # Echo version message to standard output and exit.
  1830. # The version message is extracted from the calling file's header
  1831. # comments, with leading '# ' stripped:
  1832. # 1. First display the progname and version
  1833. # 2. Followed by the header comment line matching /^# Written by /
  1834. # 3. Then a blank line followed by the first following line matching
  1835. # /^# Copyright /
  1836. # 4. Immediately followed by any lines between the previous matches,
  1837. # except lines preceding the intervening completely blank line.
  1838. # For example, see the header comments of this file.
  1839. func_version ()
  1840. {
  1841. $debug_cmd
  1842. printf '%s\n' "$progname $scriptversion"
  1843. $SED -n '
  1844. /^# Written by /!b
  1845. s|^# ||; p; n
  1846. :fwd2blnk
  1847. /./ {
  1848. n
  1849. b fwd2blnk
  1850. }
  1851. p; n
  1852. :holdwrnt
  1853. s|^# ||
  1854. s|^# *$||
  1855. /^Copyright /!{
  1856. /./H
  1857. n
  1858. b holdwrnt
  1859. }
  1860. s|\((C)\)[ 0-9,-]*[ ,-]\([1-9][0-9]* \)|\1 \2|
  1861. G
  1862. s|\(\n\)\n*|\1|g
  1863. p; q' < "$progpath"
  1864. exit $?
  1865. }
  1866. # Local variables:
  1867. # mode: shell-script
  1868. # sh-indentation: 2
  1869. # eval: (add-hook 'before-save-hook 'time-stamp)
  1870. # time-stamp-pattern: "30/scriptversion=%:y-%02m-%02d.%02H; # UTC"
  1871. # time-stamp-time-zone: "UTC"
  1872. # End:
  1873. # Set a version string.
  1874. scriptversion='(GNU libtool) 2.5.4'
  1875. # func_version
  1876. # ------------
  1877. # Echo version message to standard output and exit.
  1878. func_version ()
  1879. {
  1880. $debug_cmd
  1881. year=`date +%Y`
  1882. cat <<EOF
  1883. $progname $scriptversion
  1884. Copyright (C) $year Free Software Foundation, Inc.
  1885. License GPLv2+: GNU GPL version 2 or later <https://gnu.org/licenses/gpl.html>
  1886. This is free software: you are free to change and redistribute it.
  1887. There is NO WARRANTY, to the extent permitted by law.
  1888. Originally written by Gordon Matzigkeit, 1996
  1889. (See AUTHORS for complete contributor listing)
  1890. EOF
  1891. exit $?
  1892. }
  1893. # func_echo ARG...
  1894. # ----------------
  1895. # Libtool also displays the current mode in messages, so override
  1896. # funclib.sh func_echo with this custom definition.
  1897. func_echo ()
  1898. {
  1899. $debug_cmd
  1900. _G_message=$*
  1901. func_echo_IFS=$IFS
  1902. IFS=$nl
  1903. for _G_line in $_G_message; do
  1904. IFS=$func_echo_IFS
  1905. $ECHO "$progname${opt_mode+: $opt_mode}: $_G_line"
  1906. done
  1907. IFS=$func_echo_IFS
  1908. }
  1909. ## ---------------- ##
  1910. ## Options parsing. ##
  1911. ## ---------------- ##
  1912. # Hook in the functions to make sure our own options are parsed during
  1913. # the option parsing loop.
  1914. usage='$progpath [OPTION]... [MODE-ARG]...'
  1915. # Short help message in response to '-h'.
  1916. usage_message="Options:
  1917. --config show all configuration variables
  1918. --debug enable verbose shell tracing
  1919. -n, --dry-run display commands without modifying any files
  1920. --features display basic configuration information
  1921. --finish use operation '--mode=finish'
  1922. --mode=MODE use operation mode MODE
  1923. --no-finish don't update shared library cache
  1924. --no-quiet, --no-silent print default informational messages
  1925. --no-warnings equivalent to '-Wnone'
  1926. --preserve-dup-deps don't remove duplicate dependency libraries
  1927. --quiet, --silent don't print informational messages
  1928. --reorder-cache=DIRS reorder shared library cache for preferred DIRS
  1929. --tag=TAG use configuration variables from tag TAG
  1930. -v, --verbose print more informational messages than default
  1931. --version print version information
  1932. -W, --warnings=CATEGORY report the warnings falling in CATEGORY [all]
  1933. -h, --help, --help-all print short, long, or detailed help message
  1934. "
  1935. # Additional text appended to 'usage_message' in response to '--help'.
  1936. func_help ()
  1937. {
  1938. $debug_cmd
  1939. func_usage_message
  1940. $ECHO "$long_help_message
  1941. MODE must be one of the following:
  1942. clean remove files from the build directory
  1943. compile compile a source file into a libtool object
  1944. execute automatically set library path, then run a program
  1945. finish complete the installation of libtool libraries
  1946. install install libraries or executables
  1947. link create a library or an executable
  1948. uninstall remove libraries from an installed directory
  1949. MODE-ARGS vary depending on the MODE. When passed as first option,
  1950. '--mode=MODE' may be abbreviated as 'MODE' or a unique abbreviation of that.
  1951. Try '$progname --help --mode=MODE' for a more detailed description of MODE.
  1952. When reporting a bug, please describe a test case to reproduce it and
  1953. include the following information:
  1954. host-triplet: $host
  1955. shell: $SHELL
  1956. compiler: $LTCC
  1957. compiler flags: $LTCFLAGS
  1958. linker: $LD (gnu? $with_gnu_ld)
  1959. version: $progname $scriptversion
  1960. automake: `($AUTOMAKE --version) 2>/dev/null |$SED 1q`
  1961. autoconf: `($AUTOCONF --version) 2>/dev/null |$SED 1q`
  1962. Report bugs to <[email protected]>.
  1963. GNU libtool home page: <https://www.gnu.org/software/libtool/>.
  1964. General help using GNU software: <https://www.gnu.org/gethelp/>."
  1965. exit 0
  1966. }
  1967. # func_lo2o OBJECT-NAME
  1968. # ---------------------
  1969. # Transform OBJECT-NAME from a '.lo' suffix to the platform specific
  1970. # object suffix.
  1971. lo2o=s/\\.lo\$/.$objext/
  1972. o2lo=s/\\.$objext\$/.lo/
  1973. if test yes = "$_G_HAVE_XSI_OPS"; then
  1974. eval 'func_lo2o ()
  1975. {
  1976. case $1 in
  1977. *.lo) func_lo2o_result=${1%.lo}.$objext ;;
  1978. * ) func_lo2o_result=$1 ;;
  1979. esac
  1980. }'
  1981. # func_xform LIBOBJ-OR-SOURCE
  1982. # ---------------------------
  1983. # Transform LIBOBJ-OR-SOURCE from a '.o' or '.c' (or otherwise)
  1984. # suffix to a '.lo' libtool-object suffix.
  1985. eval 'func_xform ()
  1986. {
  1987. func_xform_result=${1%.*}.lo
  1988. }'
  1989. else
  1990. # ...otherwise fall back to using sed.
  1991. func_lo2o ()
  1992. {
  1993. func_lo2o_result=`$ECHO "$1" | $SED "$lo2o"`
  1994. }
  1995. func_xform ()
  1996. {
  1997. func_xform_result=`$ECHO "$1" | $SED 's|\.[^.]*$|.lo|'`
  1998. }
  1999. fi
  2000. # func_fatal_configuration ARG...
  2001. # -------------------------------
  2002. # Echo program name prefixed message to standard error, followed by
  2003. # a configuration failure hint, and exit.
  2004. func_fatal_configuration ()
  2005. {
  2006. func_fatal_error ${1+"$@"} \
  2007. "See the $PACKAGE documentation for more information." \
  2008. "Fatal configuration error."
  2009. }
  2010. # func_config
  2011. # -----------
  2012. # Display the configuration for all the tags in this script.
  2013. func_config ()
  2014. {
  2015. re_begincf='^# ### BEGIN LIBTOOL'
  2016. re_endcf='^# ### END LIBTOOL'
  2017. # Default configuration.
  2018. $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath"
  2019. # Now print the configurations for the tags.
  2020. for tagname in $taglist; do
  2021. $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath"
  2022. done
  2023. exit $?
  2024. }
  2025. # func_features
  2026. # -------------
  2027. # Display the features supported by this script.
  2028. func_features ()
  2029. {
  2030. echo "host: $host"
  2031. if test yes = "$build_libtool_libs"; then
  2032. echo "enable shared libraries"
  2033. else
  2034. echo "disable shared libraries"
  2035. fi
  2036. if test yes = "$build_old_libs"; then
  2037. echo "enable static libraries"
  2038. else
  2039. echo "disable static libraries"
  2040. fi
  2041. exit $?
  2042. }
  2043. # func_enable_tag TAGNAME
  2044. # -----------------------
  2045. # Verify that TAGNAME is valid, and either flag an error and exit, or
  2046. # enable the TAGNAME tag. We also add TAGNAME to the global $taglist
  2047. # variable here.
  2048. func_enable_tag ()
  2049. {
  2050. # Global variable:
  2051. tagname=$1
  2052. re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$"
  2053. re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$"
  2054. sed_extractcf=/$re_begincf/,/$re_endcf/p
  2055. # Validate tagname.
  2056. case $tagname in
  2057. *[!-_A-Za-z0-9,/]*)
  2058. func_fatal_error "invalid tag name: $tagname"
  2059. ;;
  2060. esac
  2061. # Don't test for the "default" C tag, as we know it's
  2062. # there but not specially marked.
  2063. case $tagname in
  2064. CC) ;;
  2065. *)
  2066. if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then
  2067. taglist="$taglist $tagname"
  2068. # Evaluate the configuration. Be careful to quote the path
  2069. # and the sed script, to avoid splitting on whitespace, but
  2070. # also don't use non-portable quotes within backquotes within
  2071. # quotes we have to do it in 2 steps:
  2072. extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"`
  2073. eval "$extractedcf"
  2074. else
  2075. func_error "ignoring unknown tag $tagname"
  2076. fi
  2077. ;;
  2078. esac
  2079. }
  2080. # func_check_version_match
  2081. # ------------------------
  2082. # Ensure that we are using m4 macros, and libtool script from the same
  2083. # release of libtool.
  2084. func_check_version_match ()
  2085. {
  2086. if test "$package_revision" != "$macro_revision"; then
  2087. if test "$VERSION" != "$macro_version"; then
  2088. if test -z "$macro_version"; then
  2089. cat >&2 <<_LT_EOF
  2090. $progname: Version mismatch error. This is $PACKAGE $VERSION, but the
  2091. $progname: definition of this LT_INIT comes from an older release.
  2092. $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
  2093. $progname: and run autoconf again.
  2094. _LT_EOF
  2095. else
  2096. cat >&2 <<_LT_EOF
  2097. $progname: Version mismatch error. This is $PACKAGE $VERSION, but the
  2098. $progname: definition of this LT_INIT comes from $PACKAGE $macro_version.
  2099. $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
  2100. $progname: and run autoconf again.
  2101. _LT_EOF
  2102. fi
  2103. else
  2104. cat >&2 <<_LT_EOF
  2105. $progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision,
  2106. $progname: but the definition of this LT_INIT comes from revision $macro_revision.
  2107. $progname: You should recreate aclocal.m4 with macros from revision $package_revision
  2108. $progname: of $PACKAGE $VERSION and run autoconf again.
  2109. _LT_EOF
  2110. fi
  2111. exit $EXIT_MISMATCH
  2112. fi
  2113. }
  2114. # libtool_options_prep [ARG]...
  2115. # -----------------------------
  2116. # Preparation for options parsed by libtool.
  2117. libtool_options_prep ()
  2118. {
  2119. $debug_mode
  2120. # Option defaults:
  2121. opt_config=false
  2122. opt_dlopen=
  2123. opt_dry_run=false
  2124. opt_help=false
  2125. opt_mode=
  2126. opt_reorder_cache=false
  2127. opt_preserve_dup_deps=false
  2128. opt_quiet=false
  2129. opt_finishing=true
  2130. opt_warning=
  2131. nonopt=
  2132. preserve_args=
  2133. _G_rc_lt_options_prep=:
  2134. # Shorthand for --mode=foo, only valid as the first argument
  2135. case $1 in
  2136. clean|clea|cle|cl)
  2137. shift; set dummy --mode clean ${1+"$@"}; shift
  2138. ;;
  2139. compile|compil|compi|comp|com|co|c)
  2140. shift; set dummy --mode compile ${1+"$@"}; shift
  2141. ;;
  2142. execute|execut|execu|exec|exe|ex|e)
  2143. shift; set dummy --mode execute ${1+"$@"}; shift
  2144. ;;
  2145. finish|finis|fini|fin|fi|f)
  2146. shift; set dummy --mode finish ${1+"$@"}; shift
  2147. ;;
  2148. install|instal|insta|inst|ins|in|i)
  2149. shift; set dummy --mode install ${1+"$@"}; shift
  2150. ;;
  2151. link|lin|li|l)
  2152. shift; set dummy --mode link ${1+"$@"}; shift
  2153. ;;
  2154. uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u)
  2155. shift; set dummy --mode uninstall ${1+"$@"}; shift
  2156. ;;
  2157. *)
  2158. _G_rc_lt_options_prep=false
  2159. ;;
  2160. esac
  2161. if $_G_rc_lt_options_prep; then
  2162. # Pass back the list of options.
  2163. func_quote eval ${1+"$@"}
  2164. libtool_options_prep_result=$func_quote_result
  2165. fi
  2166. }
  2167. func_add_hook func_options_prep libtool_options_prep
  2168. # libtool_parse_options [ARG]...
  2169. # ---------------------------------
  2170. # Provide handling for libtool specific options.
  2171. libtool_parse_options ()
  2172. {
  2173. $debug_cmd
  2174. _G_rc_lt_parse_options=false
  2175. # Perform our own loop to consume as many options as possible in
  2176. # each iteration.
  2177. while test $# -gt 0; do
  2178. _G_match_lt_parse_options=:
  2179. _G_opt=$1
  2180. shift
  2181. case $_G_opt in
  2182. --dry-run|--dryrun|-n)
  2183. opt_dry_run=:
  2184. ;;
  2185. --config) func_config ;;
  2186. --dlopen|-dlopen)
  2187. opt_dlopen="${opt_dlopen+$opt_dlopen
  2188. }$1"
  2189. shift
  2190. ;;
  2191. --preserve-dup-deps)
  2192. opt_preserve_dup_deps=: ;;
  2193. --features) func_features ;;
  2194. --finish) set dummy --mode finish ${1+"$@"}; shift ;;
  2195. --help) opt_help=: ;;
  2196. --help-all) opt_help=': help-all' ;;
  2197. --mode) test $# = 0 && func_missing_arg $_G_opt && break
  2198. opt_mode=$1
  2199. case $1 in
  2200. # Valid mode arguments:
  2201. clean|compile|execute|finish|install|link|relink|uninstall) ;;
  2202. # Catch anything else as an error
  2203. *) func_error "invalid argument '$1' for $_G_opt"
  2204. exit_cmd=exit
  2205. ;;
  2206. esac
  2207. shift
  2208. ;;
  2209. --no-finish)
  2210. opt_finishing=false
  2211. func_append preserve_args " $_G_opt"
  2212. ;;
  2213. --no-silent|--no-quiet)
  2214. opt_quiet=false
  2215. func_append preserve_args " $_G_opt"
  2216. ;;
  2217. --no-warnings|--no-warning|--no-warn)
  2218. opt_warning=false
  2219. func_append preserve_args " $_G_opt"
  2220. ;;
  2221. --no-verbose)
  2222. opt_verbose=false
  2223. func_append preserve_args " $_G_opt"
  2224. ;;
  2225. --reorder-cache)
  2226. opt_reorder_cache=true
  2227. shared_lib_dirs=$1
  2228. if test -n "$shared_lib_dirs"; then
  2229. case $1 in
  2230. # Must begin with /:
  2231. /*) ;;
  2232. # Catch anything else as an error (relative paths)
  2233. *) func_error "invalid argument '$1' for $_G_opt"
  2234. func_error "absolute paths are required for $_G_opt"
  2235. exit_cmd=exit
  2236. ;;
  2237. esac
  2238. fi
  2239. shift
  2240. ;;
  2241. --silent|--quiet)
  2242. opt_quiet=:
  2243. opt_verbose=false
  2244. func_append preserve_args " $_G_opt"
  2245. ;;
  2246. --tag) test $# = 0 && func_missing_arg $_G_opt && break
  2247. opt_tag=$1
  2248. func_append preserve_args " $_G_opt $1"
  2249. func_enable_tag "$1"
  2250. shift
  2251. ;;
  2252. --verbose|-v) opt_quiet=false
  2253. opt_verbose=:
  2254. func_append preserve_args " $_G_opt"
  2255. ;;
  2256. # An option not handled by this hook function:
  2257. *) set dummy "$_G_opt" ${1+"$@"} ; shift
  2258. _G_match_lt_parse_options=false
  2259. break
  2260. ;;
  2261. esac
  2262. $_G_match_lt_parse_options && _G_rc_lt_parse_options=:
  2263. done
  2264. if $_G_rc_lt_parse_options; then
  2265. # save modified positional parameters for caller
  2266. func_quote eval ${1+"$@"}
  2267. libtool_parse_options_result=$func_quote_result
  2268. fi
  2269. }
  2270. func_add_hook func_parse_options libtool_parse_options
  2271. # func_warning ARG...
  2272. # -------------------
  2273. # Libtool warnings are not categorized, so override funclib.sh
  2274. # func_warning with this simpler definition.
  2275. func_warning ()
  2276. {
  2277. if $opt_warning; then
  2278. $debug_cmd
  2279. $warning_func ${1+"$@"}
  2280. fi
  2281. }
  2282. # libtool_validate_options [ARG]...
  2283. # ---------------------------------
  2284. # Perform any sanity checks on option settings and/or unconsumed
  2285. # arguments.
  2286. libtool_validate_options ()
  2287. {
  2288. # save first non-option argument
  2289. if test 0 -lt $#; then
  2290. nonopt=$1
  2291. shift
  2292. fi
  2293. # preserve --debug
  2294. test : = "$debug_cmd" || func_append preserve_args " --debug"
  2295. case $host_os in
  2296. # Solaris2 added to fix http://debbugs.gnu.org/cgi/bugreport.cgi?bug=16452
  2297. # see also: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59788
  2298. cygwin* | mingw* | windows* | pw32* | cegcc* | solaris2* | os2*)
  2299. # don't eliminate duplications in $postdeps and $predeps
  2300. opt_duplicate_compiler_generated_deps=:
  2301. ;;
  2302. *)
  2303. opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps
  2304. ;;
  2305. esac
  2306. $opt_help || {
  2307. # Sanity checks first:
  2308. func_check_version_match
  2309. test yes != "$build_libtool_libs" \
  2310. && test yes != "$build_old_libs" \
  2311. && func_fatal_configuration "not configured to build any kind of library"
  2312. # Darwin sucks
  2313. eval std_shrext=\"$shrext_cmds\"
  2314. # Only execute mode is allowed to have -dlopen flags.
  2315. if test -n "$opt_dlopen" && test execute != "$opt_mode"; then
  2316. func_error "unrecognized option '-dlopen'"
  2317. $ECHO "$help" 1>&2
  2318. exit $EXIT_FAILURE
  2319. fi
  2320. # Change the help message to a mode-specific one.
  2321. generic_help=$help
  2322. help="Try '$progname --help --mode=$opt_mode' for more information."
  2323. }
  2324. # Pass back the unparsed argument list
  2325. func_quote eval ${1+"$@"}
  2326. libtool_validate_options_result=$func_quote_result
  2327. }
  2328. func_add_hook func_validate_options libtool_validate_options
  2329. # Process options as early as possible so that --help and --version
  2330. # can return quickly.
  2331. func_options ${1+"$@"}
  2332. eval set dummy "$func_options_result"; shift
  2333. ## ----------- ##
  2334. ## Main. ##
  2335. ## ----------- ##
  2336. magic='%%%MAGIC variable%%%'
  2337. magic_exe='%%%MAGIC EXE variable%%%'
  2338. # Global variables.
  2339. extracted_archives=
  2340. extracted_serial=0
  2341. # If this variable is set in any of the actions, the command in it
  2342. # will be execed at the end. This prevents here-documents from being
  2343. # left over by shells.
  2344. exec_cmd=
  2345. # A function that is used when there is no print builtin or printf.
  2346. func_fallback_echo ()
  2347. {
  2348. eval 'cat <<_LTECHO_EOF
  2349. $1
  2350. _LTECHO_EOF'
  2351. }
  2352. # func_generated_by_libtool
  2353. # True iff stdin has been generated by Libtool. This function is only
  2354. # a basic sanity check; it will hardly flush out determined imposters.
  2355. func_generated_by_libtool_p ()
  2356. {
  2357. $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1
  2358. }
  2359. # func_lalib_p file
  2360. # True iff FILE is a libtool '.la' library or '.lo' object file.
  2361. # This function is only a basic sanity check; it will hardly flush out
  2362. # determined imposters.
  2363. func_lalib_p ()
  2364. {
  2365. test -f "$1" &&
  2366. $SED -e 4q "$1" 2>/dev/null | func_generated_by_libtool_p
  2367. }
  2368. # func_lalib_unsafe_p file
  2369. # True iff FILE is a libtool '.la' library or '.lo' object file.
  2370. # This function implements the same check as func_lalib_p without
  2371. # resorting to external programs. To this end, it redirects stdin and
  2372. # closes it afterwards, without saving the original file descriptor.
  2373. # As a safety measure, use it only where a negative result would be
  2374. # fatal anyway. Works if 'file' does not exist.
  2375. func_lalib_unsafe_p ()
  2376. {
  2377. lalib_p=no
  2378. if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then
  2379. for lalib_p_l in 1 2 3 4
  2380. do
  2381. read lalib_p_line
  2382. case $lalib_p_line in
  2383. \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;;
  2384. esac
  2385. done
  2386. exec 0<&5 5<&-
  2387. fi
  2388. test yes = "$lalib_p"
  2389. }
  2390. # func_ltwrapper_script_p file
  2391. # True iff FILE is a libtool wrapper script
  2392. # This function is only a basic sanity check; it will hardly flush out
  2393. # determined imposters.
  2394. func_ltwrapper_script_p ()
  2395. {
  2396. test -f "$1" &&
  2397. $lt_truncate_bin < "$1" 2>/dev/null | func_generated_by_libtool_p
  2398. }
  2399. # func_ltwrapper_executable_p file
  2400. # True iff FILE is a libtool wrapper executable
  2401. # This function is only a basic sanity check; it will hardly flush out
  2402. # determined imposters.
  2403. func_ltwrapper_executable_p ()
  2404. {
  2405. func_ltwrapper_exec_suffix=
  2406. case $1 in
  2407. *.exe) ;;
  2408. *) func_ltwrapper_exec_suffix=.exe ;;
  2409. esac
  2410. $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1
  2411. }
  2412. # func_ltwrapper_scriptname file
  2413. # Assumes file is an ltwrapper_executable
  2414. # uses $file to determine the appropriate filename for a
  2415. # temporary ltwrapper_script.
  2416. func_ltwrapper_scriptname ()
  2417. {
  2418. func_dirname_and_basename "$1" "" "."
  2419. func_stripname '' '.exe' "$func_basename_result"
  2420. func_ltwrapper_scriptname_result=$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper
  2421. }
  2422. # func_ltwrapper_p file
  2423. # True iff FILE is a libtool wrapper script or wrapper executable
  2424. # This function is only a basic sanity check; it will hardly flush out
  2425. # determined imposters.
  2426. func_ltwrapper_p ()
  2427. {
  2428. func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1"
  2429. }
  2430. # func_execute_cmds commands fail_cmd
  2431. # Execute tilde-delimited COMMANDS.
  2432. # If FAIL_CMD is given, eval that upon failure.
  2433. # FAIL_CMD may read-access the current command in variable CMD!
  2434. func_execute_cmds ()
  2435. {
  2436. $debug_cmd
  2437. save_ifs=$IFS; IFS='~'
  2438. for cmd in $1; do
  2439. IFS=$sp$nl
  2440. eval cmd=\"$cmd\"
  2441. IFS=$save_ifs
  2442. func_show_eval "$cmd" "${2-:}"
  2443. done
  2444. IFS=$save_ifs
  2445. }
  2446. # func_source file
  2447. # Source FILE, adding directory component if necessary.
  2448. # Note that it is not necessary on cygwin/mingw to append a dot to
  2449. # FILE even if both FILE and FILE.exe exist: automatic-append-.exe
  2450. # behavior happens only for exec(3), not for open(2)! Also, sourcing
  2451. # 'FILE.' does not work on cygwin managed mounts.
  2452. func_source ()
  2453. {
  2454. $debug_cmd
  2455. case $1 in
  2456. */* | *\\*) . "$1" ;;
  2457. *) . "./$1" ;;
  2458. esac
  2459. }
  2460. # func_resolve_sysroot PATH
  2461. # Replace a leading = in PATH with a sysroot. Store the result into
  2462. # func_resolve_sysroot_result
  2463. func_resolve_sysroot ()
  2464. {
  2465. func_resolve_sysroot_result=$1
  2466. case $func_resolve_sysroot_result in
  2467. =*)
  2468. func_stripname '=' '' "$func_resolve_sysroot_result"
  2469. func_resolve_sysroot_result=$lt_sysroot$func_stripname_result
  2470. ;;
  2471. esac
  2472. }
  2473. # func_replace_sysroot PATH
  2474. # If PATH begins with the sysroot, replace it with = and
  2475. # store the result into func_replace_sysroot_result.
  2476. func_replace_sysroot ()
  2477. {
  2478. case $lt_sysroot:$1 in
  2479. ?*:"$lt_sysroot"*)
  2480. func_stripname "$lt_sysroot" '' "$1"
  2481. func_replace_sysroot_result='='$func_stripname_result
  2482. ;;
  2483. *)
  2484. # Including no sysroot.
  2485. func_replace_sysroot_result=$1
  2486. ;;
  2487. esac
  2488. }
  2489. # func_infer_tag arg
  2490. # Infer tagged configuration to use if any are available and
  2491. # if one wasn't chosen via the "--tag" command line option.
  2492. # Only attempt this if the compiler in the base compile
  2493. # command doesn't match the default compiler.
  2494. # arg is usually of the form 'gcc ...'
  2495. func_infer_tag ()
  2496. {
  2497. $debug_cmd
  2498. if test -n "$available_tags" && test -z "$tagname"; then
  2499. CC_quoted=
  2500. for arg in $CC; do
  2501. func_append_quoted CC_quoted "$arg"
  2502. done
  2503. CC_expanded=`func_echo_all $CC`
  2504. CC_quoted_expanded=`func_echo_all $CC_quoted`
  2505. case $@ in
  2506. # Blanks in the command may have been stripped by the calling shell,
  2507. # but not from the CC environment variable when configure was run.
  2508. " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
  2509. " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;;
  2510. # Blanks at the start of $base_compile will cause this to fail
  2511. # if we don't check for them as well.
  2512. *)
  2513. for z in $available_tags; do
  2514. if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
  2515. # Evaluate the configuration.
  2516. eval "`$SED -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
  2517. CC_quoted=
  2518. for arg in $CC; do
  2519. # Double-quote args containing other shell metacharacters.
  2520. func_append_quoted CC_quoted "$arg"
  2521. done
  2522. CC_expanded=`func_echo_all $CC`
  2523. CC_quoted_expanded=`func_echo_all $CC_quoted`
  2524. case "$@ " in
  2525. " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
  2526. " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*)
  2527. # The compiler in the base compile command matches
  2528. # the one in the tagged configuration.
  2529. # Assume this is the tagged configuration we want.
  2530. tagname=$z
  2531. break
  2532. ;;
  2533. esac
  2534. fi
  2535. done
  2536. # If $tagname still isn't set, then no tagged configuration
  2537. # was found and let the user know that the "--tag" command
  2538. # line option must be used.
  2539. if test -z "$tagname"; then
  2540. func_echo "unable to infer tagged configuration"
  2541. func_fatal_error "specify a tag with '--tag'"
  2542. # else
  2543. # func_verbose "using $tagname tagged configuration"
  2544. fi
  2545. ;;
  2546. esac
  2547. fi
  2548. }
  2549. # func_write_libtool_object output_name pic_name nonpic_name
  2550. # Create a libtool object file (analogous to a ".la" file),
  2551. # but don't create it if we're doing a dry run.
  2552. func_write_libtool_object ()
  2553. {
  2554. write_libobj=$1
  2555. if test yes = "$build_libtool_libs"; then
  2556. write_lobj=\'$2\'
  2557. else
  2558. write_lobj=none
  2559. fi
  2560. if test yes = "$build_old_libs"; then
  2561. write_oldobj=\'$3\'
  2562. else
  2563. write_oldobj=none
  2564. fi
  2565. $opt_dry_run || {
  2566. cat >${write_libobj}T <<EOF
  2567. # $write_libobj - a libtool object file
  2568. # Generated by $PROGRAM (GNU $PACKAGE) $VERSION
  2569. #
  2570. # Please DO NOT delete this file!
  2571. # It is necessary for linking the library.
  2572. # Name of the PIC object.
  2573. pic_object=$write_lobj
  2574. # Name of the non-PIC object
  2575. non_pic_object=$write_oldobj
  2576. EOF
  2577. $MV "${write_libobj}T" "$write_libobj"
  2578. }
  2579. }
  2580. ##################################################
  2581. # FILE NAME AND PATH CONVERSION HELPER FUNCTIONS #
  2582. ##################################################
  2583. # func_convert_core_file_wine_to_w32 ARG
  2584. # Helper function used by file name conversion functions when $build is *nix,
  2585. # and $host is mingw, windows, cygwin, or some other w32 environment. Relies on a
  2586. # correctly configured wine environment available, with the winepath program
  2587. # in $build's $PATH.
  2588. #
  2589. # ARG is the $build file name to be converted to w32 format.
  2590. # Result is available in $func_convert_core_file_wine_to_w32_result, and will
  2591. # be empty on error (or when ARG is empty)
  2592. func_convert_core_file_wine_to_w32 ()
  2593. {
  2594. $debug_cmd
  2595. func_convert_core_file_wine_to_w32_result=$1
  2596. if test -n "$1"; then
  2597. # Unfortunately, winepath does not exit with a non-zero error code, so we
  2598. # are forced to check the contents of stdout. On the other hand, if the
  2599. # command is not found, the shell will set an exit code of 127 and print
  2600. # *an error message* to stdout. So we must check for both error code of
  2601. # zero AND non-empty stdout, which explains the odd construction:
  2602. func_convert_core_file_wine_to_w32_tmp=`winepath -w "$1" 2>/dev/null`
  2603. if test "$?" -eq 0 && test -n "$func_convert_core_file_wine_to_w32_tmp"; then
  2604. func_convert_core_file_wine_to_w32_result=`$ECHO "$func_convert_core_file_wine_to_w32_tmp" |
  2605. $SED -e "$sed_naive_backslashify"`
  2606. else
  2607. func_convert_core_file_wine_to_w32_result=
  2608. fi
  2609. fi
  2610. }
  2611. # end: func_convert_core_file_wine_to_w32
  2612. # func_convert_core_path_wine_to_w32 ARG
  2613. # Helper function used by path conversion functions when $build is *nix, and
  2614. # $host is mingw, windows, cygwin, or some other w32 environment. Relies on a
  2615. # correctly configured wine environment available, with the winepath program
  2616. # in $build's $PATH. Assumes ARG has no leading or trailing path separator
  2617. # characters.
  2618. #
  2619. # ARG is path to be converted from $build format to win32.
  2620. # Result is available in $func_convert_core_path_wine_to_w32_result.
  2621. # Unconvertible file (directory) names in ARG are skipped; if no directory names
  2622. # are convertible, then the result may be empty.
  2623. func_convert_core_path_wine_to_w32 ()
  2624. {
  2625. $debug_cmd
  2626. # unfortunately, winepath doesn't convert paths, only file names
  2627. func_convert_core_path_wine_to_w32_result=
  2628. if test -n "$1"; then
  2629. oldIFS=$IFS
  2630. IFS=:
  2631. for func_convert_core_path_wine_to_w32_f in $1; do
  2632. IFS=$oldIFS
  2633. func_convert_core_file_wine_to_w32 "$func_convert_core_path_wine_to_w32_f"
  2634. if test -n "$func_convert_core_file_wine_to_w32_result"; then
  2635. if test -z "$func_convert_core_path_wine_to_w32_result"; then
  2636. func_convert_core_path_wine_to_w32_result=$func_convert_core_file_wine_to_w32_result
  2637. else
  2638. func_append func_convert_core_path_wine_to_w32_result ";$func_convert_core_file_wine_to_w32_result"
  2639. fi
  2640. fi
  2641. done
  2642. IFS=$oldIFS
  2643. fi
  2644. }
  2645. # end: func_convert_core_path_wine_to_w32
  2646. # func_cygpath ARGS...
  2647. # Wrapper around calling the cygpath program via LT_CYGPATH. This is used when
  2648. # when (1) $build is *nix and Cygwin is hosted via a wine environment; or (2)
  2649. # $build is MSYS and $host is Cygwin, or (3) $build is Cygwin. In case (1) or
  2650. # (2), returns the Cygwin file name or path in func_cygpath_result (input
  2651. # file name or path is assumed to be in w32 format, as previously converted
  2652. # from $build's *nix or MSYS format). In case (3), returns the w32 file name
  2653. # or path in func_cygpath_result (input file name or path is assumed to be in
  2654. # Cygwin format). Returns an empty string on error.
  2655. #
  2656. # ARGS are passed to cygpath, with the last one being the file name or path to
  2657. # be converted.
  2658. #
  2659. # Specify the absolute *nix (or w32) name to cygpath in the LT_CYGPATH
  2660. # environment variable; do not put it in $PATH.
  2661. func_cygpath ()
  2662. {
  2663. $debug_cmd
  2664. if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then
  2665. func_cygpath_result=`$LT_CYGPATH "$@" 2>/dev/null`
  2666. if test "$?" -ne 0; then
  2667. # on failure, ensure result is empty
  2668. func_cygpath_result=
  2669. fi
  2670. else
  2671. func_cygpath_result=
  2672. func_error "LT_CYGPATH is empty or specifies non-existent file: '$LT_CYGPATH'"
  2673. fi
  2674. }
  2675. #end: func_cygpath
  2676. # func_convert_core_msys_to_w32 ARG
  2677. # Convert file name or path ARG from MSYS format to w32 format. Return
  2678. # result in func_convert_core_msys_to_w32_result.
  2679. func_convert_core_msys_to_w32 ()
  2680. {
  2681. $debug_cmd
  2682. # awkward: cmd appends spaces to result
  2683. func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null |
  2684. $SED -e 's/[ ]*$//' -e "$sed_naive_backslashify"`
  2685. }
  2686. #end: func_convert_core_msys_to_w32
  2687. # func_convert_file_check ARG1 ARG2
  2688. # Verify that ARG1 (a file name in $build format) was converted to $host
  2689. # format in ARG2. Otherwise, emit an error message, but continue (resetting
  2690. # func_to_host_file_result to ARG1).
  2691. func_convert_file_check ()
  2692. {
  2693. $debug_cmd
  2694. if test -z "$2" && test -n "$1"; then
  2695. func_error "Could not determine host file name corresponding to"
  2696. func_error " '$1'"
  2697. func_error "Continuing, but uninstalled executables may not work."
  2698. # Fallback:
  2699. func_to_host_file_result=$1
  2700. fi
  2701. }
  2702. # end func_convert_file_check
  2703. # func_convert_path_check FROM_PATHSEP TO_PATHSEP FROM_PATH TO_PATH
  2704. # Verify that FROM_PATH (a path in $build format) was converted to $host
  2705. # format in TO_PATH. Otherwise, emit an error message, but continue, resetting
  2706. # func_to_host_file_result to a simplistic fallback value (see below).
  2707. func_convert_path_check ()
  2708. {
  2709. $debug_cmd
  2710. if test -z "$4" && test -n "$3"; then
  2711. func_error "Could not determine the host path corresponding to"
  2712. func_error " '$3'"
  2713. func_error "Continuing, but uninstalled executables may not work."
  2714. # Fallback. This is a deliberately simplistic "conversion" and
  2715. # should not be "improved". See libtool.info.
  2716. if test "x$1" != "x$2"; then
  2717. lt_replace_pathsep_chars="s|$1|$2|g"
  2718. func_to_host_path_result=`echo "$3" |
  2719. $SED -e "$lt_replace_pathsep_chars"`
  2720. else
  2721. func_to_host_path_result=$3
  2722. fi
  2723. fi
  2724. }
  2725. # end func_convert_path_check
  2726. # func_convert_path_front_back_pathsep FRONTPAT BACKPAT REPL ORIG
  2727. # Modifies func_to_host_path_result by prepending REPL if ORIG matches FRONTPAT
  2728. # and appending REPL if ORIG matches BACKPAT.
  2729. func_convert_path_front_back_pathsep ()
  2730. {
  2731. $debug_cmd
  2732. case $4 in
  2733. $1 ) func_to_host_path_result=$3$func_to_host_path_result
  2734. ;;
  2735. esac
  2736. case $4 in
  2737. $2 ) func_append func_to_host_path_result "$3"
  2738. ;;
  2739. esac
  2740. }
  2741. # end func_convert_path_front_back_pathsep
  2742. # func_convert_delimited_path PATH ORIG_DELIMITER NEW_DELIMITER
  2743. # Replaces a delimiter for a given path.
  2744. func_convert_delimited_path ()
  2745. {
  2746. converted_path=`$ECHO "$1" | $SED "s#$2#$3#g"`
  2747. }
  2748. # end func_convert_delimited_path
  2749. ##################################################
  2750. # $build to $host FILE NAME CONVERSION FUNCTIONS #
  2751. ##################################################
  2752. # invoked via '$to_host_file_cmd ARG'
  2753. #
  2754. # In each case, ARG is the path to be converted from $build to $host format.
  2755. # Result will be available in $func_to_host_file_result.
  2756. # func_to_host_file ARG
  2757. # Converts the file name ARG from $build format to $host format. Return result
  2758. # in func_to_host_file_result.
  2759. func_to_host_file ()
  2760. {
  2761. $debug_cmd
  2762. $to_host_file_cmd "$1"
  2763. }
  2764. # end func_to_host_file
  2765. # func_to_tool_file ARG LAZY
  2766. # converts the file name ARG from $build format to toolchain format. Return
  2767. # result in func_to_tool_file_result. If the conversion in use is listed
  2768. # in (the comma separated) LAZY, no conversion takes place.
  2769. func_to_tool_file ()
  2770. {
  2771. $debug_cmd
  2772. case ,$2, in
  2773. *,"$to_tool_file_cmd",*)
  2774. func_to_tool_file_result=$1
  2775. ;;
  2776. *)
  2777. $to_tool_file_cmd "$1"
  2778. func_to_tool_file_result=$func_to_host_file_result
  2779. ;;
  2780. esac
  2781. }
  2782. # end func_to_tool_file
  2783. # func_convert_file_noop ARG
  2784. # Copy ARG to func_to_host_file_result.
  2785. func_convert_file_noop ()
  2786. {
  2787. func_to_host_file_result=$1
  2788. }
  2789. # end func_convert_file_noop
  2790. # func_convert_file_msys_to_w32 ARG
  2791. # Convert file name ARG from (mingw) MSYS to (mingw) w32 format; automatic
  2792. # conversion to w32 is not available inside the cwrapper. Returns result in
  2793. # func_to_host_file_result.
  2794. func_convert_file_msys_to_w32 ()
  2795. {
  2796. $debug_cmd
  2797. func_to_host_file_result=$1
  2798. if test -n "$1"; then
  2799. func_convert_core_msys_to_w32 "$1"
  2800. func_to_host_file_result=$func_convert_core_msys_to_w32_result
  2801. fi
  2802. func_convert_file_check "$1" "$func_to_host_file_result"
  2803. }
  2804. # end func_convert_file_msys_to_w32
  2805. # func_convert_file_cygwin_to_w32 ARG
  2806. # Convert file name ARG from Cygwin to w32 format. Returns result in
  2807. # func_to_host_file_result.
  2808. func_convert_file_cygwin_to_w32 ()
  2809. {
  2810. $debug_cmd
  2811. func_to_host_file_result=$1
  2812. if test -n "$1"; then
  2813. # because $build is cygwin, we call "the" cygpath in $PATH; no need to use
  2814. # LT_CYGPATH in this case.
  2815. func_to_host_file_result=`cygpath -m "$1"`
  2816. fi
  2817. func_convert_file_check "$1" "$func_to_host_file_result"
  2818. }
  2819. # end func_convert_file_cygwin_to_w32
  2820. # func_convert_file_nix_to_w32 ARG
  2821. # Convert file name ARG from *nix to w32 format. Requires a wine environment
  2822. # and a working winepath. Returns result in func_to_host_file_result.
  2823. func_convert_file_nix_to_w32 ()
  2824. {
  2825. $debug_cmd
  2826. func_to_host_file_result=$1
  2827. if test -n "$1"; then
  2828. func_convert_core_file_wine_to_w32 "$1"
  2829. func_to_host_file_result=$func_convert_core_file_wine_to_w32_result
  2830. fi
  2831. func_convert_file_check "$1" "$func_to_host_file_result"
  2832. }
  2833. # end func_convert_file_nix_to_w32
  2834. # func_convert_file_msys_to_cygwin ARG
  2835. # Convert file name ARG from MSYS to Cygwin format. Requires LT_CYGPATH set.
  2836. # Returns result in func_to_host_file_result.
  2837. func_convert_file_msys_to_cygwin ()
  2838. {
  2839. $debug_cmd
  2840. func_to_host_file_result=$1
  2841. if test -n "$1"; then
  2842. func_convert_core_msys_to_w32 "$1"
  2843. func_cygpath -u "$func_convert_core_msys_to_w32_result"
  2844. func_to_host_file_result=$func_cygpath_result
  2845. fi
  2846. func_convert_file_check "$1" "$func_to_host_file_result"
  2847. }
  2848. # end func_convert_file_msys_to_cygwin
  2849. # func_convert_file_nix_to_cygwin ARG
  2850. # Convert file name ARG from *nix to Cygwin format. Requires Cygwin installed
  2851. # in a wine environment, working winepath, and LT_CYGPATH set. Returns result
  2852. # in func_to_host_file_result.
  2853. func_convert_file_nix_to_cygwin ()
  2854. {
  2855. $debug_cmd
  2856. func_to_host_file_result=$1
  2857. if test -n "$1"; then
  2858. # convert from *nix to w32, then use cygpath to convert from w32 to cygwin.
  2859. func_convert_core_file_wine_to_w32 "$1"
  2860. func_cygpath -u "$func_convert_core_file_wine_to_w32_result"
  2861. func_to_host_file_result=$func_cygpath_result
  2862. fi
  2863. func_convert_file_check "$1" "$func_to_host_file_result"
  2864. }
  2865. # end func_convert_file_nix_to_cygwin
  2866. #############################################
  2867. # $build to $host PATH CONVERSION FUNCTIONS #
  2868. #############################################
  2869. # invoked via '$to_host_path_cmd ARG'
  2870. #
  2871. # In each case, ARG is the path to be converted from $build to $host format.
  2872. # The result will be available in $func_to_host_path_result.
  2873. #
  2874. # Path separators are also converted from $build format to $host format. If
  2875. # ARG begins or ends with a path separator character, it is preserved (but
  2876. # converted to $host format) on output.
  2877. #
  2878. # All path conversion functions are named using the following convention:
  2879. # file name conversion function : func_convert_file_X_to_Y ()
  2880. # path conversion function : func_convert_path_X_to_Y ()
  2881. # where, for any given $build/$host combination the 'X_to_Y' value is the
  2882. # same. If conversion functions are added for new $build/$host combinations,
  2883. # the two new functions must follow this pattern, or func_init_to_host_path_cmd
  2884. # will break.
  2885. # func_init_to_host_path_cmd
  2886. # Ensures that function "pointer" variable $to_host_path_cmd is set to the
  2887. # appropriate value, based on the value of $to_host_file_cmd.
  2888. to_host_path_cmd=
  2889. func_init_to_host_path_cmd ()
  2890. {
  2891. $debug_cmd
  2892. if test -z "$to_host_path_cmd"; then
  2893. func_stripname 'func_convert_file_' '' "$to_host_file_cmd"
  2894. to_host_path_cmd=func_convert_path_$func_stripname_result
  2895. fi
  2896. }
  2897. # func_to_host_path ARG
  2898. # Converts the path ARG from $build format to $host format. Return result
  2899. # in func_to_host_path_result.
  2900. func_to_host_path ()
  2901. {
  2902. $debug_cmd
  2903. func_init_to_host_path_cmd
  2904. $to_host_path_cmd "$1"
  2905. }
  2906. # end func_to_host_path
  2907. # func_convert_path_noop ARG
  2908. # Copy ARG to func_to_host_path_result.
  2909. func_convert_path_noop ()
  2910. {
  2911. func_to_host_path_result=$1
  2912. }
  2913. # end func_convert_path_noop
  2914. # func_convert_path_msys_to_w32 ARG
  2915. # Convert path ARG from (mingw) MSYS to (mingw) w32 format; automatic
  2916. # conversion to w32 is not available inside the cwrapper. Returns result in
  2917. # func_to_host_path_result.
  2918. func_convert_path_msys_to_w32 ()
  2919. {
  2920. $debug_cmd
  2921. func_to_host_path_result=$1
  2922. if test -n "$1"; then
  2923. # Remove leading and trailing path separator characters from ARG. MSYS
  2924. # behavior is inconsistent here; cygpath turns them into '.;' and ';.';
  2925. # and winepath ignores them completely.
  2926. func_stripname : : "$1"
  2927. func_to_host_path_tmp1=$func_stripname_result
  2928. func_convert_core_msys_to_w32 "$func_to_host_path_tmp1"
  2929. func_to_host_path_result=$func_convert_core_msys_to_w32_result
  2930. func_convert_path_check : ";" \
  2931. "$func_to_host_path_tmp1" "$func_to_host_path_result"
  2932. func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
  2933. fi
  2934. }
  2935. # end func_convert_path_msys_to_w32
  2936. # func_convert_path_cygwin_to_w32 ARG
  2937. # Convert path ARG from Cygwin to w32 format. Returns result in
  2938. # func_to_host_file_result.
  2939. func_convert_path_cygwin_to_w32 ()
  2940. {
  2941. $debug_cmd
  2942. func_to_host_path_result=$1
  2943. if test -n "$1"; then
  2944. # See func_convert_path_msys_to_w32:
  2945. func_stripname : : "$1"
  2946. func_to_host_path_tmp1=$func_stripname_result
  2947. func_to_host_path_result=`cygpath -m -p "$func_to_host_path_tmp1"`
  2948. func_convert_path_check : ";" \
  2949. "$func_to_host_path_tmp1" "$func_to_host_path_result"
  2950. func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
  2951. fi
  2952. }
  2953. # end func_convert_path_cygwin_to_w32
  2954. # func_convert_path_nix_to_w32 ARG
  2955. # Convert path ARG from *nix to w32 format. Requires a wine environment and
  2956. # a working winepath. Returns result in func_to_host_file_result.
  2957. func_convert_path_nix_to_w32 ()
  2958. {
  2959. $debug_cmd
  2960. func_to_host_path_result=$1
  2961. if test -n "$1"; then
  2962. # See func_convert_path_msys_to_w32:
  2963. func_stripname : : "$1"
  2964. func_to_host_path_tmp1=$func_stripname_result
  2965. func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1"
  2966. func_to_host_path_result=$func_convert_core_path_wine_to_w32_result
  2967. func_convert_path_check : ";" \
  2968. "$func_to_host_path_tmp1" "$func_to_host_path_result"
  2969. func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
  2970. fi
  2971. }
  2972. # end func_convert_path_nix_to_w32
  2973. # func_convert_path_msys_to_cygwin ARG
  2974. # Convert path ARG from MSYS to Cygwin format. Requires LT_CYGPATH set.
  2975. # Returns result in func_to_host_file_result.
  2976. func_convert_path_msys_to_cygwin ()
  2977. {
  2978. $debug_cmd
  2979. func_to_host_path_result=$1
  2980. if test -n "$1"; then
  2981. # See func_convert_path_msys_to_w32:
  2982. func_stripname : : "$1"
  2983. func_to_host_path_tmp1=$func_stripname_result
  2984. func_convert_core_msys_to_w32 "$func_to_host_path_tmp1"
  2985. func_cygpath -u -p "$func_convert_core_msys_to_w32_result"
  2986. func_to_host_path_result=$func_cygpath_result
  2987. func_convert_path_check : : \
  2988. "$func_to_host_path_tmp1" "$func_to_host_path_result"
  2989. func_convert_path_front_back_pathsep ":*" "*:" : "$1"
  2990. fi
  2991. }
  2992. # end func_convert_path_msys_to_cygwin
  2993. # func_convert_path_nix_to_cygwin ARG
  2994. # Convert path ARG from *nix to Cygwin format. Requires Cygwin installed in a
  2995. # a wine environment, working winepath, and LT_CYGPATH set. Returns result in
  2996. # func_to_host_file_result.
  2997. func_convert_path_nix_to_cygwin ()
  2998. {
  2999. $debug_cmd
  3000. func_to_host_path_result=$1
  3001. if test -n "$1"; then
  3002. # Remove leading and trailing path separator characters from
  3003. # ARG. msys behavior is inconsistent here, cygpath turns them
  3004. # into '.;' and ';.', and winepath ignores them completely.
  3005. func_stripname : : "$1"
  3006. func_to_host_path_tmp1=$func_stripname_result
  3007. func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1"
  3008. func_cygpath -u -p "$func_convert_core_path_wine_to_w32_result"
  3009. func_to_host_path_result=$func_cygpath_result
  3010. func_convert_path_check : : \
  3011. "$func_to_host_path_tmp1" "$func_to_host_path_result"
  3012. func_convert_path_front_back_pathsep ":*" "*:" : "$1"
  3013. fi
  3014. }
  3015. # end func_convert_path_nix_to_cygwin
  3016. # func_dll_def_p FILE
  3017. # True iff FILE is a Windows DLL '.def' file.
  3018. # Keep in sync with _LT_DLL_DEF_P in libtool.m4
  3019. func_dll_def_p ()
  3020. {
  3021. $debug_cmd
  3022. func_dll_def_p_tmp=`$SED -n \
  3023. -e 's/^[ ]*//' \
  3024. -e '/^\(;.*\)*$/d' \
  3025. -e 's/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p' \
  3026. -e q \
  3027. "$1"`
  3028. test DEF = "$func_dll_def_p_tmp"
  3029. }
  3030. # func_reorder_shared_lib_cache DIRS
  3031. # Reorder the shared library cache by unconfiguring previous shared library cache
  3032. # and configuring preferred search directories before previous search directories.
  3033. # Previous shared library cache: /usr/lib /usr/local/lib
  3034. # Preferred search directories: /tmp/testing
  3035. # Reordered shared library cache: /tmp/testing /usr/lib /usr/local/lib
  3036. func_reorder_shared_lib_cache ()
  3037. {
  3038. $debug_cmd
  3039. case $host_os in
  3040. openbsd*)
  3041. get_search_directories=`PATH="$PATH:/sbin" ldconfig -r | $GREP "search directories" | $SED "s#.*search directories:\ ##g"`
  3042. func_convert_delimited_path "$get_search_directories" ':' '\ '
  3043. save_search_directories=$converted_path
  3044. func_convert_delimited_path "$1" ':' '\ '
  3045. # Ensure directories exist
  3046. for dir in $converted_path; do
  3047. # Ensure each directory is an absolute path
  3048. case $dir in
  3049. /*) ;;
  3050. *) func_error "Directory '$dir' is not an absolute path"
  3051. exit $EXIT_FAILURE ;;
  3052. esac
  3053. # Ensure no trailing slashes
  3054. func_stripname '' '/' "$dir"
  3055. dir=$func_stripname_result
  3056. if test -d "$dir"; then
  3057. if test -n "$preferred_search_directories"; then
  3058. preferred_search_directories="$preferred_search_directories $dir"
  3059. else
  3060. preferred_search_directories=$dir
  3061. fi
  3062. else
  3063. func_error "Directory '$dir' does not exist"
  3064. exit $EXIT_FAILURE
  3065. fi
  3066. done
  3067. PATH="$PATH:/sbin" ldconfig -U $save_search_directories
  3068. PATH="$PATH:/sbin" ldconfig -m $preferred_search_directories $save_search_directories
  3069. get_search_directories=`PATH="$PATH:/sbin" ldconfig -r | $GREP "search directories" | $SED "s#.*search directories:\ ##g"`
  3070. func_convert_delimited_path "$get_search_directories" ':' '\ '
  3071. reordered_search_directories=$converted_path
  3072. $ECHO "Original: $save_search_directories"
  3073. $ECHO "Reordered: $reordered_search_directories"
  3074. exit $EXIT_SUCCESS
  3075. ;;
  3076. *)
  3077. func_error "--reorder-cache is not supported for host_os=$host_os."
  3078. exit $EXIT_FAILURE
  3079. ;;
  3080. esac
  3081. }
  3082. # end func_reorder_shared_lib_cache
  3083. # func_mode_compile arg...
  3084. func_mode_compile ()
  3085. {
  3086. $debug_cmd
  3087. # Get the compilation command and the source file.
  3088. base_compile=
  3089. srcfile=$nonopt # always keep a non-empty value in "srcfile"
  3090. suppress_opt=yes
  3091. suppress_output=
  3092. arg_mode=normal
  3093. libobj=
  3094. later=
  3095. pie_flag=
  3096. for arg
  3097. do
  3098. case $arg_mode in
  3099. arg )
  3100. # do not "continue". Instead, add this to base_compile
  3101. lastarg=$arg
  3102. arg_mode=normal
  3103. ;;
  3104. target )
  3105. libobj=$arg
  3106. arg_mode=normal
  3107. continue
  3108. ;;
  3109. normal )
  3110. # Accept any command-line options.
  3111. case $arg in
  3112. -o)
  3113. test -n "$libobj" && \
  3114. func_fatal_error "you cannot specify '-o' more than once"
  3115. arg_mode=target
  3116. continue
  3117. ;;
  3118. -pie | -fpie | -fPIE)
  3119. func_append pie_flag " $arg"
  3120. continue
  3121. ;;
  3122. -shared | -static | -prefer-pic | -prefer-non-pic)
  3123. func_append later " $arg"
  3124. continue
  3125. ;;
  3126. -no-suppress)
  3127. suppress_opt=no
  3128. continue
  3129. ;;
  3130. -Xcompiler)
  3131. arg_mode=arg # the next one goes into the "base_compile" arg list
  3132. continue # The current "srcfile" will either be retained or
  3133. ;; # replaced later. I would guess that would be a bug.
  3134. -Wc,*)
  3135. func_stripname '-Wc,' '' "$arg"
  3136. args=$func_stripname_result
  3137. lastarg=
  3138. save_ifs=$IFS; IFS=,
  3139. for arg in $args; do
  3140. IFS=$save_ifs
  3141. func_append_quoted lastarg "$arg"
  3142. done
  3143. IFS=$save_ifs
  3144. func_stripname ' ' '' "$lastarg"
  3145. lastarg=$func_stripname_result
  3146. # Add the arguments to base_compile.
  3147. func_append base_compile " $lastarg"
  3148. continue
  3149. ;;
  3150. *)
  3151. # Accept the current argument as the source file.
  3152. # The previous "srcfile" becomes the current argument.
  3153. #
  3154. lastarg=$srcfile
  3155. srcfile=$arg
  3156. ;;
  3157. esac # case $arg
  3158. ;;
  3159. esac # case $arg_mode
  3160. # Aesthetically quote the previous argument.
  3161. func_append_quoted base_compile "$lastarg"
  3162. done # for arg
  3163. case $arg_mode in
  3164. arg)
  3165. func_fatal_error "you must specify an argument for -Xcompile"
  3166. ;;
  3167. target)
  3168. func_fatal_error "you must specify a target with '-o'"
  3169. ;;
  3170. *)
  3171. # Get the name of the library object.
  3172. test -z "$libobj" && {
  3173. func_basename "$srcfile"
  3174. libobj=$func_basename_result
  3175. }
  3176. ;;
  3177. esac
  3178. # Recognize several different file suffixes.
  3179. # If the user specifies -o file.o, it is replaced with file.lo
  3180. case $libobj in
  3181. *.[cCFSifmso] | \
  3182. *.ada | *.adb | *.ads | *.asm | \
  3183. *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \
  3184. *.[fF][09]? | *.for | *.java | *.go | *.obj | *.sx | *.cu | *.cup)
  3185. func_xform "$libobj"
  3186. libobj=$func_xform_result
  3187. ;;
  3188. esac
  3189. case $libobj in
  3190. *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;;
  3191. *)
  3192. func_fatal_error "cannot determine name of library object from '$libobj'"
  3193. ;;
  3194. esac
  3195. func_infer_tag $base_compile
  3196. for arg in $later; do
  3197. case $arg in
  3198. -shared)
  3199. test yes = "$build_libtool_libs" \
  3200. || func_fatal_configuration "cannot build a shared library"
  3201. build_old_libs=no
  3202. continue
  3203. ;;
  3204. -static)
  3205. build_libtool_libs=no
  3206. build_old_libs=yes
  3207. continue
  3208. ;;
  3209. -prefer-pic)
  3210. pic_mode=yes
  3211. continue
  3212. ;;
  3213. -prefer-non-pic)
  3214. pic_mode=no
  3215. continue
  3216. ;;
  3217. esac
  3218. done
  3219. func_quote_arg pretty "$libobj"
  3220. test "X$libobj" != "X$func_quote_arg_result" \
  3221. && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \
  3222. && func_warning "libobj name '$libobj' may not contain shell special characters."
  3223. func_dirname_and_basename "$obj" "/" ""
  3224. objname=$func_basename_result
  3225. xdir=$func_dirname_result
  3226. lobj=$xdir$objdir/$objname
  3227. test -z "$base_compile" && \
  3228. func_fatal_help "you must specify a compilation command"
  3229. # Delete any leftover library objects.
  3230. if test yes = "$build_old_libs"; then
  3231. removelist="$obj $lobj $libobj ${libobj}T"
  3232. else
  3233. removelist="$lobj $libobj ${libobj}T"
  3234. fi
  3235. # On Cygwin there's no "real" PIC flag so we must build both object types
  3236. case $host_os in
  3237. cygwin* | mingw* | windows* | pw32* | os2* | cegcc*)
  3238. pic_mode=default
  3239. ;;
  3240. esac
  3241. if test no = "$pic_mode" && test pass_all != "$deplibs_check_method"; then
  3242. # non-PIC code in shared libraries is not supported
  3243. pic_mode=default
  3244. fi
  3245. # Calculate the filename of the output object if compiler does
  3246. # not support -o with -c
  3247. if test no = "$compiler_c_o"; then
  3248. output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.$objext
  3249. lockfile=$output_obj.lock
  3250. else
  3251. output_obj=
  3252. need_locks=no
  3253. lockfile=
  3254. fi
  3255. # Lock this critical section if it is needed
  3256. # We use this script file to make the link, it avoids creating a new file
  3257. if test yes = "$need_locks"; then
  3258. until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
  3259. func_echo "Waiting for $lockfile to be removed"
  3260. sleep 2
  3261. done
  3262. elif test warn = "$need_locks"; then
  3263. if test -f "$lockfile"; then
  3264. $ECHO "\
  3265. *** ERROR, $lockfile exists and contains:
  3266. `cat $lockfile 2>/dev/null`
  3267. This indicates that another process is trying to use the same
  3268. temporary object file, and libtool could not work around it because
  3269. your compiler does not support '-c' and '-o' together. If you
  3270. repeat this compilation, it may succeed, by chance, but you had better
  3271. avoid parallel builds (make -j) in this platform, or get a better
  3272. compiler."
  3273. $opt_dry_run || $RM $removelist
  3274. exit $EXIT_FAILURE
  3275. fi
  3276. func_append removelist " $output_obj"
  3277. $ECHO "$srcfile" > "$lockfile"
  3278. fi
  3279. $opt_dry_run || $RM $removelist
  3280. func_append removelist " $lockfile"
  3281. trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15
  3282. func_to_tool_file "$srcfile" func_convert_file_msys_to_w32
  3283. srcfile=$func_to_tool_file_result
  3284. func_quote_arg pretty "$srcfile"
  3285. qsrcfile=$func_quote_arg_result
  3286. # Only build a PIC object if we are building libtool libraries.
  3287. if test yes = "$build_libtool_libs"; then
  3288. # Without this assignment, base_compile gets emptied.
  3289. fbsd_hideous_sh_bug=$base_compile
  3290. if test no != "$pic_mode"; then
  3291. command="$base_compile $qsrcfile $pic_flag"
  3292. else
  3293. # Don't build PIC code
  3294. command="$base_compile $qsrcfile"
  3295. fi
  3296. func_mkdir_p "$xdir$objdir"
  3297. if test -z "$output_obj"; then
  3298. # Place PIC objects in $objdir
  3299. func_append command " -o $lobj"
  3300. fi
  3301. func_show_eval_locale "$command" \
  3302. 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE'
  3303. if test warn = "$need_locks" &&
  3304. test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
  3305. $ECHO "\
  3306. *** ERROR, $lockfile contains:
  3307. `cat $lockfile 2>/dev/null`
  3308. but it should contain:
  3309. $srcfile
  3310. This indicates that another process is trying to use the same
  3311. temporary object file, and libtool could not work around it because
  3312. your compiler does not support '-c' and '-o' together. If you
  3313. repeat this compilation, it may succeed, by chance, but you had better
  3314. avoid parallel builds (make -j) in this platform, or get a better
  3315. compiler."
  3316. $opt_dry_run || $RM $removelist
  3317. exit $EXIT_FAILURE
  3318. fi
  3319. # Just move the object if needed, then go on to compile the next one
  3320. if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
  3321. func_show_eval '$MV "$output_obj" "$lobj"' \
  3322. 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
  3323. fi
  3324. # Allow error messages only from the first compilation.
  3325. if test yes = "$suppress_opt"; then
  3326. suppress_output=' >/dev/null 2>&1'
  3327. fi
  3328. fi
  3329. # Only build a position-dependent object if we build old libraries.
  3330. if test yes = "$build_old_libs"; then
  3331. if test yes != "$pic_mode"; then
  3332. # Don't build PIC code
  3333. command="$base_compile $qsrcfile$pie_flag"
  3334. else
  3335. command="$base_compile $qsrcfile $pic_flag"
  3336. fi
  3337. if test yes = "$compiler_c_o"; then
  3338. func_append command " -o $obj"
  3339. fi
  3340. # Suppress compiler output if we already did a PIC compilation.
  3341. func_append command "$suppress_output"
  3342. func_show_eval_locale "$command" \
  3343. '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE'
  3344. if test warn = "$need_locks" &&
  3345. test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
  3346. $ECHO "\
  3347. *** ERROR, $lockfile contains:
  3348. `cat $lockfile 2>/dev/null`
  3349. but it should contain:
  3350. $srcfile
  3351. This indicates that another process is trying to use the same
  3352. temporary object file, and libtool could not work around it because
  3353. your compiler does not support '-c' and '-o' together. If you
  3354. repeat this compilation, it may succeed, by chance, but you had better
  3355. avoid parallel builds (make -j) in this platform, or get a better
  3356. compiler."
  3357. $opt_dry_run || $RM $removelist
  3358. exit $EXIT_FAILURE
  3359. fi
  3360. # Just move the object if needed
  3361. if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
  3362. func_show_eval '$MV "$output_obj" "$obj"' \
  3363. 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
  3364. fi
  3365. fi
  3366. $opt_dry_run || {
  3367. func_write_libtool_object "$libobj" "$objdir/$objname" "$objname"
  3368. # Unlock the critical section if it was locked
  3369. if test no != "$need_locks"; then
  3370. removelist=$lockfile
  3371. $RM "$lockfile"
  3372. fi
  3373. }
  3374. exit $EXIT_SUCCESS
  3375. }
  3376. $opt_help || {
  3377. test compile = "$opt_mode" && func_mode_compile ${1+"$@"}
  3378. }
  3379. func_mode_help ()
  3380. {
  3381. # We need to display help for each of the modes.
  3382. case $opt_mode in
  3383. "")
  3384. # Generic help is extracted from the usage comments
  3385. # at the start of this file.
  3386. func_help
  3387. ;;
  3388. clean)
  3389. $ECHO \
  3390. "Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
  3391. Remove files from the build directory.
  3392. RM is the name of the program to use to delete files associated with each FILE
  3393. (typically '/bin/rm'). RM-OPTIONS are options (such as '-f') to be passed
  3394. to RM.
  3395. If FILE is a libtool library, object or program, all the files associated
  3396. with it are deleted. Otherwise, only FILE itself is deleted using RM."
  3397. ;;
  3398. compile)
  3399. $ECHO \
  3400. "Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
  3401. Compile a source file into a libtool library object.
  3402. This mode accepts the following additional options:
  3403. -o OUTPUT-FILE set the output file name to OUTPUT-FILE
  3404. -no-suppress do not suppress compiler output for multiple passes
  3405. -prefer-pic try to build PIC objects only
  3406. -prefer-non-pic try to build non-PIC objects only
  3407. -shared do not build a '.o' file suitable for static linking
  3408. -static only build a '.o' file suitable for static linking
  3409. -Wc,FLAG
  3410. -Xcompiler FLAG pass FLAG directly to the compiler
  3411. COMPILE-COMMAND is a command to be used in creating a 'standard' object file
  3412. from the given SOURCEFILE.
  3413. The output file name is determined by removing the directory component from
  3414. SOURCEFILE, then substituting the C source code suffix '.c' with the
  3415. library object suffix, '.lo'."
  3416. ;;
  3417. execute)
  3418. $ECHO \
  3419. "Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]...
  3420. Automatically set library path, then run a program.
  3421. This mode accepts the following additional options:
  3422. -dlopen FILE add the directory containing FILE to the library path
  3423. This mode sets the library path environment variable according to '-dlopen'
  3424. flags.
  3425. If any of the ARGS are libtool executable wrappers, then they are translated
  3426. into their corresponding uninstalled binary, and any of their required library
  3427. directories are added to the library path.
  3428. Then, COMMAND is executed, with ARGS as arguments."
  3429. ;;
  3430. finish)
  3431. $ECHO \
  3432. "Usage: $progname [OPTION]... --mode=finish [LIBDIR]...
  3433. Complete the installation of libtool libraries.
  3434. Each LIBDIR is a directory that contains libtool libraries.
  3435. The commands that this mode executes may require superuser privileges. Use
  3436. the '--dry-run' option if you just want to see what would be executed."
  3437. ;;
  3438. install)
  3439. $ECHO \
  3440. "Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND...
  3441. Install executables or libraries.
  3442. INSTALL-COMMAND is the installation command. The first component should be
  3443. either the 'install' or 'cp' program.
  3444. The following components of INSTALL-COMMAND are treated specially:
  3445. -inst-prefix-dir PREFIX-DIR Use PREFIX-DIR as a staging area for installation
  3446. The rest of the components are interpreted as arguments to that command (only
  3447. BSD-compatible install options are recognized)."
  3448. ;;
  3449. link)
  3450. $ECHO \
  3451. "Usage: $progname [OPTION]... --mode=link LINK-COMMAND...
  3452. Link object files or libraries together to form another library, or to
  3453. create an executable program.
  3454. LINK-COMMAND is a command using the C compiler that you would use to create
  3455. a program from several object files.
  3456. The following components of LINK-COMMAND are treated specially:
  3457. -all-static do not do any dynamic linking at all
  3458. -avoid-version do not add a version suffix if possible
  3459. -bindir BINDIR specify path to binaries directory (for systems where
  3460. libraries must be found in the PATH setting at runtime)
  3461. -dlopen FILE '-dlpreopen' FILE if it cannot be dlopened at runtime
  3462. -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
  3463. -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
  3464. -export-symbols SYMFILE
  3465. try to export only the symbols listed in SYMFILE
  3466. -export-symbols-regex REGEX
  3467. try to export only the symbols matching REGEX
  3468. -LLIBDIR search LIBDIR for required installed libraries
  3469. -lNAME OUTPUT-FILE requires the installed library libNAME
  3470. -module build a library that can dlopened
  3471. -no-fast-install disable the fast-install mode
  3472. -no-install link a not-installable executable
  3473. -no-undefined declare that a library does not refer to external symbols
  3474. -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
  3475. -objectlist FILE use a list of object files found in FILE to specify objects
  3476. -os2dllname NAME force a short DLL name on OS/2 (no effect on other OSes)
  3477. -precious-files-regex REGEX
  3478. don't remove output files matching REGEX
  3479. -release RELEASE specify package release information
  3480. -rpath LIBDIR the created library will eventually be installed in LIBDIR
  3481. -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
  3482. -shared only do dynamic linking of libtool libraries
  3483. -shrext SUFFIX override the standard shared library file extension
  3484. -static do not do any dynamic linking of uninstalled libtool libraries
  3485. -static-libtool-libs
  3486. do not do any dynamic linking of libtool libraries
  3487. -version-info CURRENT[:REVISION[:AGE]]
  3488. specify library version info [each variable defaults to 0]
  3489. -weak LIBNAME declare that the target provides the LIBNAME interface
  3490. -Wc,FLAG
  3491. -Xcompiler FLAG pass linker-specific FLAG directly to the compiler
  3492. -Wa,FLAG
  3493. -Xassembler FLAG pass linker-specific FLAG directly to the assembler
  3494. -Wl,FLAG
  3495. -Xlinker FLAG pass linker-specific FLAG directly to the linker
  3496. -XCClinker FLAG pass link-specific FLAG to the compiler driver (CC)
  3497. All other options (arguments beginning with '-') are ignored.
  3498. Every other argument is treated as a filename. Files ending in '.la' are
  3499. treated as uninstalled libtool libraries, other files are standard or library
  3500. object files.
  3501. If the OUTPUT-FILE ends in '.la', then a libtool library is created,
  3502. only library objects ('.lo' files) may be specified, and '-rpath' is
  3503. required, except when creating a convenience library.
  3504. If OUTPUT-FILE ends in '.a' or '.lib', then a standard library is created
  3505. using 'ar' and 'ranlib', or on Windows using 'lib'.
  3506. If OUTPUT-FILE ends in '.lo' or '.$objext', then a reloadable object file
  3507. is created, otherwise an executable program is created."
  3508. ;;
  3509. uninstall)
  3510. $ECHO \
  3511. "Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
  3512. Remove libraries from an installation directory.
  3513. RM is the name of the program to use to delete files associated with each FILE
  3514. (typically '/bin/rm'). RM-OPTIONS are options (such as '-f') to be passed
  3515. to RM.
  3516. If FILE is a libtool library, all the files associated with it are deleted.
  3517. Otherwise, only FILE itself is deleted using RM."
  3518. ;;
  3519. *)
  3520. func_fatal_help "invalid operation mode '$opt_mode'"
  3521. ;;
  3522. esac
  3523. echo
  3524. $ECHO "Try '$progname --help' for more information about other modes."
  3525. }
  3526. # Now that we've collected a possible --mode arg, show help if necessary
  3527. if $opt_help; then
  3528. if test : = "$opt_help"; then
  3529. func_mode_help
  3530. else
  3531. {
  3532. func_help noexit
  3533. for opt_mode in compile link execute install finish uninstall clean; do
  3534. func_mode_help
  3535. done
  3536. } | $SED -n '1p; 2,$s/^Usage:/ or: /p'
  3537. {
  3538. func_help noexit
  3539. for opt_mode in compile link execute install finish uninstall clean; do
  3540. echo
  3541. func_mode_help
  3542. done
  3543. } |
  3544. $SED '1d
  3545. /^When reporting/,/^Report/{
  3546. H
  3547. d
  3548. }
  3549. $x
  3550. /information about other modes/d
  3551. /more detailed .*MODE/d
  3552. s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/'
  3553. fi
  3554. exit $?
  3555. fi
  3556. # If option '--reorder-cache', reorder the shared library cache and exit.
  3557. if $opt_reorder_cache; then
  3558. func_reorder_shared_lib_cache $shared_lib_dirs
  3559. fi
  3560. # func_mode_execute arg...
  3561. func_mode_execute ()
  3562. {
  3563. $debug_cmd
  3564. # The first argument is the command name.
  3565. cmd=$nonopt
  3566. test -z "$cmd" && \
  3567. func_fatal_help "you must specify a COMMAND"
  3568. # Handle -dlopen flags immediately.
  3569. for file in $opt_dlopen; do
  3570. test -f "$file" \
  3571. || func_fatal_help "'$file' is not a file"
  3572. dir=
  3573. case $file in
  3574. *.la)
  3575. func_resolve_sysroot "$file"
  3576. file=$func_resolve_sysroot_result
  3577. # Check to see that this really is a libtool archive.
  3578. func_lalib_unsafe_p "$file" \
  3579. || func_fatal_help "'$lib' is not a valid libtool archive"
  3580. # Read the libtool library.
  3581. dlname=
  3582. library_names=
  3583. func_source "$file"
  3584. # Skip this library if it cannot be dlopened.
  3585. if test -z "$dlname"; then
  3586. # Warn if it was a shared library.
  3587. test -n "$library_names" && \
  3588. func_warning "'$file' was not linked with '-export-dynamic'"
  3589. continue
  3590. fi
  3591. func_dirname "$file" "" "."
  3592. dir=$func_dirname_result
  3593. if test -f "$dir/$objdir/$dlname"; then
  3594. func_append dir "/$objdir"
  3595. else
  3596. if test ! -f "$dir/$dlname"; then
  3597. func_fatal_error "cannot find '$dlname' in '$dir' or '$dir/$objdir'"
  3598. fi
  3599. fi
  3600. ;;
  3601. *.lo)
  3602. # Just add the directory containing the .lo file.
  3603. func_dirname "$file" "" "."
  3604. dir=$func_dirname_result
  3605. ;;
  3606. *)
  3607. func_warning "'-dlopen' is ignored for non-libtool libraries and objects"
  3608. continue
  3609. ;;
  3610. esac
  3611. # Get the absolute pathname.
  3612. absdir=`cd "$dir" && pwd`
  3613. test -n "$absdir" && dir=$absdir
  3614. # Now add the directory to shlibpath_var.
  3615. if eval "test -z \"\$$shlibpath_var\""; then
  3616. eval "$shlibpath_var=\"\$dir\""
  3617. else
  3618. eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
  3619. fi
  3620. done
  3621. # This variable tells wrapper scripts just to set shlibpath_var
  3622. # rather than running their programs.
  3623. libtool_execute_magic=$magic
  3624. # Check if any of the arguments is a wrapper script.
  3625. args=
  3626. for file
  3627. do
  3628. case $file in
  3629. -* | *.la | *.lo ) ;;
  3630. *)
  3631. # Do a test to see if this is really a libtool program.
  3632. if func_ltwrapper_script_p "$file"; then
  3633. func_source "$file"
  3634. # Transform arg to wrapped name.
  3635. file=$progdir/$program
  3636. elif func_ltwrapper_executable_p "$file"; then
  3637. func_ltwrapper_scriptname "$file"
  3638. func_source "$func_ltwrapper_scriptname_result"
  3639. # Transform arg to wrapped name.
  3640. file=$progdir/$program
  3641. fi
  3642. ;;
  3643. esac
  3644. # Quote arguments (to preserve shell metacharacters).
  3645. func_append_quoted args "$file"
  3646. done
  3647. if $opt_dry_run; then
  3648. # Display what would be done.
  3649. if test -n "$shlibpath_var"; then
  3650. eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\""
  3651. echo "export $shlibpath_var"
  3652. fi
  3653. $ECHO "$cmd$args"
  3654. exit $EXIT_SUCCESS
  3655. else
  3656. if test -n "$shlibpath_var"; then
  3657. # Export the shlibpath_var.
  3658. eval "export $shlibpath_var"
  3659. fi
  3660. # Restore saved environment variables
  3661. for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
  3662. do
  3663. eval "if test \"\${save_$lt_var+set}\" = set; then
  3664. $lt_var=\$save_$lt_var; export $lt_var
  3665. else
  3666. $lt_unset $lt_var
  3667. fi"
  3668. done
  3669. # Now prepare to actually exec the command.
  3670. exec_cmd=\$cmd$args
  3671. fi
  3672. }
  3673. test execute = "$opt_mode" && func_mode_execute ${1+"$@"}
  3674. # func_mode_finish arg...
  3675. func_mode_finish ()
  3676. {
  3677. $debug_cmd
  3678. libs=
  3679. libdirs=
  3680. admincmds=
  3681. for opt in "$nonopt" ${1+"$@"}
  3682. do
  3683. if test -d "$opt"; then
  3684. func_append libdirs " $opt"
  3685. elif test -f "$opt"; then
  3686. if func_lalib_unsafe_p "$opt"; then
  3687. func_append libs " $opt"
  3688. else
  3689. func_warning "'$opt' is not a valid libtool archive"
  3690. fi
  3691. else
  3692. func_fatal_error "invalid argument '$opt'"
  3693. fi
  3694. done
  3695. if test -n "$libs"; then
  3696. if test -n "$lt_sysroot"; then
  3697. sysroot_regex=`$ECHO "$lt_sysroot" | $SED "$sed_make_literal_regex"`
  3698. sysroot_cmd="s/\([ ']\)$sysroot_regex/\1/g;"
  3699. else
  3700. sysroot_cmd=
  3701. fi
  3702. # Remove sysroot references
  3703. if $opt_dry_run; then
  3704. for lib in $libs; do
  3705. echo "removing references to $lt_sysroot and '=' prefixes from $lib"
  3706. done
  3707. else
  3708. tmpdir=`func_mktempdir`
  3709. for lib in $libs; do
  3710. $SED -e "$sysroot_cmd s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \
  3711. > $tmpdir/tmp-la
  3712. mv -f $tmpdir/tmp-la $lib
  3713. done
  3714. ${RM}r "$tmpdir"
  3715. fi
  3716. fi
  3717. if test -n "$finish_cmds$finish_eval" && test -n "$libdirs" && $opt_finishing; then
  3718. for libdir in $libdirs; do
  3719. if test -n "$finish_cmds"; then
  3720. # Do each command in the finish commands.
  3721. func_execute_cmds "$finish_cmds" 'admincmds="$admincmds
  3722. '"$cmd"'"'
  3723. fi
  3724. if test -n "$finish_eval"; then
  3725. # Do the single finish_eval.
  3726. eval cmds=\"$finish_eval\"
  3727. $opt_dry_run || eval "$cmds" || func_append admincmds "
  3728. $cmds"
  3729. fi
  3730. done
  3731. fi
  3732. # Exit here if they wanted silent mode.
  3733. $opt_quiet && exit $EXIT_SUCCESS
  3734. if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
  3735. echo "----------------------------------------------------------------------"
  3736. echo "Libraries have been installed in:"
  3737. for libdir in $libdirs; do
  3738. $ECHO " $libdir"
  3739. done
  3740. if test "false" = "$opt_finishing"; then
  3741. echo
  3742. echo "NOTE: finish_cmds were not executed during testing, so you must"
  3743. echo "manually run ldconfig to add a given test directory, LIBDIR, to"
  3744. echo "the search path for generated executables."
  3745. fi
  3746. echo
  3747. echo "If you ever happen to want to link against installed libraries"
  3748. echo "in a given directory, LIBDIR, you must either use libtool, and"
  3749. echo "specify the full pathname of the library, or use the '-LLIBDIR'"
  3750. echo "flag during linking and do at least one of the following:"
  3751. if test -n "$shlibpath_var"; then
  3752. echo " - add LIBDIR to the '$shlibpath_var' environment variable"
  3753. echo " during execution"
  3754. fi
  3755. if test -n "$runpath_var"; then
  3756. echo " - add LIBDIR to the '$runpath_var' environment variable"
  3757. echo " during linking"
  3758. fi
  3759. if test -n "$hardcode_libdir_flag_spec"; then
  3760. libdir=LIBDIR
  3761. eval flag=\"$hardcode_libdir_flag_spec\"
  3762. $ECHO " - use the '$flag' linker flag"
  3763. fi
  3764. if test -n "$admincmds"; then
  3765. $ECHO " - have your system administrator run these commands:$admincmds"
  3766. fi
  3767. if test -f /etc/ld.so.conf; then
  3768. echo " - have your system administrator add LIBDIR to '/etc/ld.so.conf'"
  3769. fi
  3770. echo
  3771. echo "See any operating system documentation about shared libraries for"
  3772. case $host in
  3773. solaris2.[6789]|solaris2.1[0-9])
  3774. echo "more information, such as the ld(1), crle(1) and ld.so(8) manual"
  3775. echo "pages."
  3776. ;;
  3777. *)
  3778. echo "more information, such as the ld(1) and ld.so(8) manual pages."
  3779. ;;
  3780. esac
  3781. echo "----------------------------------------------------------------------"
  3782. fi
  3783. exit $EXIT_SUCCESS
  3784. }
  3785. test finish = "$opt_mode" && func_mode_finish ${1+"$@"}
  3786. # func_mode_install arg...
  3787. func_mode_install ()
  3788. {
  3789. $debug_cmd
  3790. # There may be an optional sh(1) argument at the beginning of
  3791. # install_prog (especially on Windows NT).
  3792. if test "$SHELL" = "$nonopt" || test /bin/sh = "$nonopt" ||
  3793. # Allow the use of GNU shtool's install command.
  3794. case $nonopt in *shtool*) :;; *) false;; esac
  3795. then
  3796. # Aesthetically quote it.
  3797. func_quote_arg pretty "$nonopt"
  3798. install_prog="$func_quote_arg_result "
  3799. arg=$1
  3800. shift
  3801. else
  3802. install_prog=
  3803. arg=$nonopt
  3804. fi
  3805. # The real first argument should be the name of the installation program.
  3806. # Aesthetically quote it.
  3807. func_quote_arg pretty "$arg"
  3808. func_append install_prog "$func_quote_arg_result"
  3809. install_shared_prog=$install_prog
  3810. case " $install_prog " in
  3811. *[\\\ /]cp\ *) install_cp=: ;;
  3812. *) install_cp=false ;;
  3813. esac
  3814. # We need to accept at least all the BSD install flags.
  3815. dest=
  3816. files=
  3817. opts=
  3818. prev=
  3819. install_type=
  3820. isdir=false
  3821. stripme=
  3822. no_mode=:
  3823. for arg
  3824. do
  3825. arg2=
  3826. if test -n "$dest"; then
  3827. func_append files " $dest"
  3828. dest=$arg
  3829. continue
  3830. fi
  3831. case $arg in
  3832. -d) isdir=: ;;
  3833. -f)
  3834. if $install_cp; then :; else
  3835. prev=$arg
  3836. fi
  3837. ;;
  3838. -g | -m | -o)
  3839. prev=$arg
  3840. ;;
  3841. -s)
  3842. stripme=" -s"
  3843. continue
  3844. ;;
  3845. -*)
  3846. ;;
  3847. *)
  3848. # If the previous option needed an argument, then skip it.
  3849. if test -n "$prev"; then
  3850. if test X-m = "X$prev" && test -n "$install_override_mode"; then
  3851. arg2=$install_override_mode
  3852. no_mode=false
  3853. fi
  3854. prev=
  3855. else
  3856. dest=$arg
  3857. continue
  3858. fi
  3859. ;;
  3860. esac
  3861. # Aesthetically quote the argument.
  3862. func_quote_arg pretty "$arg"
  3863. func_append install_prog " $func_quote_arg_result"
  3864. if test -n "$arg2"; then
  3865. func_quote_arg pretty "$arg2"
  3866. fi
  3867. func_append install_shared_prog " $func_quote_arg_result"
  3868. done
  3869. test -z "$install_prog" && \
  3870. func_fatal_help "you must specify an install program"
  3871. test -n "$prev" && \
  3872. func_fatal_help "the '$prev' option requires an argument"
  3873. if test -n "$install_override_mode" && $no_mode; then
  3874. if $install_cp; then :; else
  3875. func_quote_arg pretty "$install_override_mode"
  3876. func_append install_shared_prog " -m $func_quote_arg_result"
  3877. fi
  3878. fi
  3879. if test -z "$files"; then
  3880. if test -z "$dest"; then
  3881. func_fatal_help "no file or destination specified"
  3882. else
  3883. func_fatal_help "you must specify a destination"
  3884. fi
  3885. fi
  3886. # Strip any trailing slash from the destination.
  3887. func_stripname '' '/' "$dest"
  3888. dest=$func_stripname_result
  3889. # Check to see that the destination is a directory.
  3890. test -d "$dest" && isdir=:
  3891. if $isdir; then
  3892. destdir=$dest
  3893. destname=
  3894. else
  3895. func_dirname_and_basename "$dest" "" "."
  3896. destdir=$func_dirname_result
  3897. destname=$func_basename_result
  3898. # Not a directory, so check to see that there is only one file specified.
  3899. set dummy $files; shift
  3900. test "$#" -gt 1 && \
  3901. func_fatal_help "'$dest' is not a directory"
  3902. fi
  3903. case $destdir in
  3904. [\\/]* | [A-Za-z]:[\\/]*) ;;
  3905. *)
  3906. for file in $files; do
  3907. case $file in
  3908. *.lo) ;;
  3909. *)
  3910. func_fatal_help "'$destdir' must be an absolute directory name"
  3911. ;;
  3912. esac
  3913. done
  3914. ;;
  3915. esac
  3916. # This variable tells wrapper scripts just to set variables rather
  3917. # than running their programs.
  3918. libtool_install_magic=$magic
  3919. staticlibs=
  3920. future_libdirs=
  3921. current_libdirs=
  3922. for file in $files; do
  3923. # Do each installation.
  3924. case $file in
  3925. *.$libext)
  3926. # Do the static libraries later.
  3927. func_append staticlibs " $file"
  3928. ;;
  3929. *.la)
  3930. func_resolve_sysroot "$file"
  3931. file=$func_resolve_sysroot_result
  3932. # Check to see that this really is a libtool archive.
  3933. func_lalib_unsafe_p "$file" \
  3934. || func_fatal_help "'$file' is not a valid libtool archive"
  3935. library_names=
  3936. old_library=
  3937. relink_command=
  3938. func_source "$file"
  3939. # Add the libdir to current_libdirs if it is the destination.
  3940. if test "X$destdir" = "X$libdir"; then
  3941. case "$current_libdirs " in
  3942. *" $libdir "*) ;;
  3943. *) func_append current_libdirs " $libdir" ;;
  3944. esac
  3945. else
  3946. # Note the libdir as a future libdir.
  3947. case "$future_libdirs " in
  3948. *" $libdir "*) ;;
  3949. *) func_append future_libdirs " $libdir" ;;
  3950. esac
  3951. fi
  3952. func_dirname "$file" "/" ""
  3953. dir=$func_dirname_result
  3954. func_append dir "$objdir"
  3955. if test -n "$relink_command"; then
  3956. # Strip any trailing slash from the destination.
  3957. func_stripname '' '/' "$libdir"
  3958. destlibdir=$func_stripname_result
  3959. func_stripname '' '/' "$destdir"
  3960. s_destdir=$func_stripname_result
  3961. # Determine the prefix the user has applied to our future dir.
  3962. inst_prefix_dir=`$ECHO "X$s_destdir" | $Xsed -e "s%$destlibdir\$%%"`
  3963. # Don't allow the user to place us outside of our expected
  3964. # location b/c this prevents finding dependent libraries that
  3965. # are installed to the same prefix.
  3966. # At present, this check doesn't affect windows .dll's that
  3967. # are installed into $libdir/../bin (currently, that works fine)
  3968. # but it's something to keep an eye on.
  3969. test "$inst_prefix_dir" = "$destdir" && \
  3970. func_fatal_error "error: cannot install '$file' to a directory not ending in $libdir"
  3971. if test -n "$inst_prefix_dir"; then
  3972. # Stick the inst_prefix_dir data into the link command.
  3973. relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
  3974. else
  3975. relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"`
  3976. fi
  3977. func_warning "relinking '$file'"
  3978. func_show_eval "$relink_command" \
  3979. 'func_fatal_error "error: relink '\''$file'\'' with the above command before installing it"'
  3980. fi
  3981. # See the names of the shared library.
  3982. set dummy $library_names; shift
  3983. if test -n "$1"; then
  3984. realname=$1
  3985. shift
  3986. srcname=$realname
  3987. test -n "$relink_command" && srcname=${realname}T
  3988. # Install the shared library and build the symlinks.
  3989. func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \
  3990. 'exit $?'
  3991. tstripme=$stripme
  3992. case $host_os in
  3993. cygwin* | mingw* | windows* | pw32* | cegcc*)
  3994. case $realname in
  3995. *.dll.a)
  3996. tstripme=
  3997. ;;
  3998. esac
  3999. ;;
  4000. os2*)
  4001. case $realname in
  4002. *_dll.a)
  4003. tstripme=
  4004. ;;
  4005. esac
  4006. ;;
  4007. esac
  4008. if test -n "$tstripme" && test -n "$striplib"; then
  4009. func_show_eval "$striplib $destdir/$realname" 'exit $?'
  4010. fi
  4011. if test "$#" -gt 0; then
  4012. # Delete the old symlinks, and create new ones.
  4013. # Try 'ln -sf' first, because the 'ln' binary might depend on
  4014. # the symlink we replace! Solaris /bin/ln does not understand -f,
  4015. # so we also need to try rm && ln -s.
  4016. for linkname
  4017. do
  4018. test "$linkname" != "$realname" \
  4019. && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })"
  4020. done
  4021. fi
  4022. # Do each command in the postinstall commands.
  4023. lib=$destdir/$realname
  4024. func_execute_cmds "$postinstall_cmds" 'exit $?'
  4025. fi
  4026. # Install the pseudo-library for information purposes.
  4027. func_basename "$file"
  4028. name=$func_basename_result
  4029. instname=$dir/${name}i
  4030. func_show_eval "$install_prog $instname $destdir/$name" 'exit $?'
  4031. # Maybe install the static library, too.
  4032. test -n "$old_library" && func_append staticlibs " $dir/$old_library"
  4033. ;;
  4034. *.lo)
  4035. # Install (i.e. copy) a libtool object.
  4036. # Figure out destination file name, if it wasn't already specified.
  4037. if test -n "$destname"; then
  4038. destfile=$destdir/$destname
  4039. else
  4040. func_basename "$file"
  4041. destfile=$func_basename_result
  4042. destfile=$destdir/$destfile
  4043. fi
  4044. # Deduce the name of the destination old-style object file.
  4045. case $destfile in
  4046. *.lo)
  4047. func_lo2o "$destfile"
  4048. staticdest=$func_lo2o_result
  4049. ;;
  4050. *.$objext)
  4051. staticdest=$destfile
  4052. destfile=
  4053. ;;
  4054. *)
  4055. func_fatal_help "cannot copy a libtool object to '$destfile'"
  4056. ;;
  4057. esac
  4058. # Install the libtool object if requested.
  4059. test -n "$destfile" && \
  4060. func_show_eval "$install_prog $file $destfile" 'exit $?'
  4061. # Install the old object if enabled.
  4062. if test yes = "$build_old_libs"; then
  4063. # Deduce the name of the old-style object file.
  4064. func_lo2o "$file"
  4065. staticobj=$func_lo2o_result
  4066. func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?'
  4067. fi
  4068. exit $EXIT_SUCCESS
  4069. ;;
  4070. *)
  4071. # Figure out destination file name, if it wasn't already specified.
  4072. if test -n "$destname"; then
  4073. destfile=$destdir/$destname
  4074. else
  4075. func_basename "$file"
  4076. destfile=$func_basename_result
  4077. destfile=$destdir/$destfile
  4078. fi
  4079. # If the file is missing, and there is a .exe on the end, strip it
  4080. # because it is most likely a libtool script we actually want to
  4081. # install
  4082. stripped_ext=
  4083. case $file in
  4084. *.exe)
  4085. if test ! -f "$file"; then
  4086. func_stripname '' '.exe' "$file"
  4087. file=$func_stripname_result
  4088. stripped_ext=.exe
  4089. fi
  4090. ;;
  4091. esac
  4092. # Do a test to see if this is really a libtool program.
  4093. case $host in
  4094. *cygwin* | *mingw* | *windows*)
  4095. if func_ltwrapper_executable_p "$file"; then
  4096. func_ltwrapper_scriptname "$file"
  4097. wrapper=$func_ltwrapper_scriptname_result
  4098. else
  4099. func_stripname '' '.exe' "$file"
  4100. wrapper=$func_stripname_result
  4101. fi
  4102. ;;
  4103. *)
  4104. wrapper=$file
  4105. ;;
  4106. esac
  4107. if func_ltwrapper_script_p "$wrapper"; then
  4108. notinst_deplibs=
  4109. relink_command=
  4110. func_source "$wrapper"
  4111. # Check the variables that should have been set.
  4112. test -z "$generated_by_libtool_version" && \
  4113. func_fatal_error "invalid libtool wrapper script '$wrapper'"
  4114. finalize=:
  4115. for lib in $notinst_deplibs; do
  4116. # Check to see that each library is installed.
  4117. libdir=
  4118. if test -f "$lib"; then
  4119. func_source "$lib"
  4120. fi
  4121. libfile=$libdir/`$ECHO "$lib" | $SED 's%^.*/%%g'`
  4122. if test -n "$libdir" && test ! -f "$libfile"; then
  4123. func_warning "'$lib' has not been installed in '$libdir'"
  4124. finalize=false
  4125. fi
  4126. done
  4127. relink_command=
  4128. func_source "$wrapper"
  4129. outputname=
  4130. if test no = "$fast_install" && test -n "$relink_command"; then
  4131. $opt_dry_run || {
  4132. if $finalize; then
  4133. tmpdir=`func_mktempdir`
  4134. func_basename "$file$stripped_ext"
  4135. file=$func_basename_result
  4136. outputname=$tmpdir/$file
  4137. # Replace the output file specification.
  4138. relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'`
  4139. $opt_quiet || {
  4140. func_quote_arg expand,pretty "$relink_command"
  4141. eval "func_echo $func_quote_arg_result"
  4142. }
  4143. if eval "$relink_command"; then :
  4144. else
  4145. func_error "error: relink '$file' with the above command before installing it"
  4146. $opt_dry_run || ${RM}r "$tmpdir"
  4147. continue
  4148. fi
  4149. file=$outputname
  4150. else
  4151. func_warning "cannot relink '$file'"
  4152. fi
  4153. }
  4154. else
  4155. # Install the binary that we compiled earlier.
  4156. file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"`
  4157. fi
  4158. fi
  4159. # remove .exe since cygwin /usr/bin/install will append another
  4160. # one anyway
  4161. case $install_prog,$host in
  4162. */usr/bin/install*,*cygwin*)
  4163. case $file:$destfile in
  4164. *.exe:*.exe)
  4165. # this is ok
  4166. ;;
  4167. *.exe:*)
  4168. destfile=$destfile.exe
  4169. ;;
  4170. *:*.exe)
  4171. func_stripname '' '.exe' "$destfile"
  4172. destfile=$func_stripname_result
  4173. ;;
  4174. esac
  4175. ;;
  4176. esac
  4177. func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?'
  4178. $opt_dry_run || if test -n "$outputname"; then
  4179. ${RM}r "$tmpdir"
  4180. fi
  4181. ;;
  4182. esac
  4183. done
  4184. for file in $staticlibs; do
  4185. func_basename "$file"
  4186. name=$func_basename_result
  4187. # Set up the ranlib parameters.
  4188. oldlib=$destdir/$name
  4189. func_to_tool_file "$oldlib" func_convert_file_msys_to_w32
  4190. tool_oldlib=$func_to_tool_file_result
  4191. func_show_eval "$install_prog \$file \$oldlib" 'exit $?'
  4192. if test -n "$stripme" && test -n "$old_striplib"; then
  4193. func_show_eval "$old_striplib $tool_oldlib" 'exit $?'
  4194. fi
  4195. # Do each command in the postinstall commands.
  4196. func_execute_cmds "$old_postinstall_cmds" 'exit $?'
  4197. done
  4198. test -n "$future_libdirs" && \
  4199. func_warning "remember to run '$progname --finish$future_libdirs'"
  4200. if test -n "$current_libdirs"; then
  4201. # Maybe just do a dry run.
  4202. $opt_dry_run && current_libdirs=" -n$current_libdirs"
  4203. exec_cmd='$SHELL "$progpath" $preserve_args --finish$current_libdirs'
  4204. else
  4205. exit $EXIT_SUCCESS
  4206. fi
  4207. }
  4208. test install = "$opt_mode" && func_mode_install ${1+"$@"}
  4209. # func_generate_dlsyms outputname originator pic_p
  4210. # Extract symbols from dlprefiles and create ${outputname}S.o with
  4211. # a dlpreopen symbol table.
  4212. func_generate_dlsyms ()
  4213. {
  4214. $debug_cmd
  4215. my_outputname=$1
  4216. my_originator=$2
  4217. my_pic_p=${3-false}
  4218. my_prefix=`$ECHO "$my_originator" | $SED 's%[^a-zA-Z0-9]%_%g'`
  4219. my_dlsyms=
  4220. if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then
  4221. if test -n "$NM" && test -n "$global_symbol_pipe"; then
  4222. my_dlsyms=${my_outputname}S.c
  4223. else
  4224. func_error "not configured to extract global symbols from dlpreopened files"
  4225. fi
  4226. fi
  4227. if test -n "$my_dlsyms"; then
  4228. case $my_dlsyms in
  4229. "") ;;
  4230. *.c)
  4231. # Discover the nlist of each of the dlfiles.
  4232. nlist=$output_objdir/$my_outputname.nm
  4233. func_show_eval "$RM $nlist ${nlist}S ${nlist}T"
  4234. # Parse the name list into a source file.
  4235. func_verbose "creating $output_objdir/$my_dlsyms"
  4236. $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\
  4237. /* $my_dlsyms - symbol resolution table for '$my_outputname' dlsym emulation. */
  4238. /* Generated by $PROGRAM (GNU $PACKAGE) $VERSION */
  4239. #ifdef __cplusplus
  4240. extern \"C\" {
  4241. #endif
  4242. #if defined __GNUC__ && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4))
  4243. #pragma GCC diagnostic ignored \"-Wstrict-prototypes\"
  4244. #endif
  4245. /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */
  4246. #if defined _WIN32 || defined __CYGWIN__ || defined _WIN32_WCE
  4247. /* DATA imports from DLLs on WIN32 can't be const, because runtime
  4248. relocations are performed -- see ld's documentation on pseudo-relocs. */
  4249. # define LT_DLSYM_CONST
  4250. #elif defined __osf__
  4251. /* This system does not cope well with relocations in const data. */
  4252. # define LT_DLSYM_CONST
  4253. #else
  4254. # define LT_DLSYM_CONST const
  4255. #endif
  4256. #define STREQ(s1, s2) (strcmp ((s1), (s2)) == 0)
  4257. /* External symbol declarations for the compiler. */\
  4258. "
  4259. if test yes = "$dlself"; then
  4260. func_verbose "generating symbol list for '$output'"
  4261. $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist"
  4262. # Add our own program objects to the symbol list.
  4263. progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP`
  4264. for progfile in $progfiles; do
  4265. func_to_tool_file "$progfile" func_convert_file_msys_to_w32
  4266. func_verbose "extracting global C symbols from '$func_to_tool_file_result'"
  4267. $opt_dry_run || eval "$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'"
  4268. done
  4269. if test -n "$exclude_expsyms"; then
  4270. $opt_dry_run || {
  4271. eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
  4272. eval '$MV "$nlist"T "$nlist"'
  4273. }
  4274. fi
  4275. if test -n "$export_symbols_regex"; then
  4276. $opt_dry_run || {
  4277. eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
  4278. eval '$MV "$nlist"T "$nlist"'
  4279. }
  4280. fi
  4281. # Prepare the list of exported symbols
  4282. if test -z "$export_symbols"; then
  4283. export_symbols=$output_objdir/$outputname.exp
  4284. $opt_dry_run || {
  4285. $RM $export_symbols
  4286. eval "$SED -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
  4287. case $host in
  4288. *cygwin* | *mingw* | *windows* | *cegcc* )
  4289. eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
  4290. eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
  4291. ;;
  4292. esac
  4293. }
  4294. else
  4295. $opt_dry_run || {
  4296. eval "$SED -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
  4297. eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
  4298. eval '$MV "$nlist"T "$nlist"'
  4299. case $host in
  4300. *cygwin* | *mingw* | *windows* | *cegcc* )
  4301. eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
  4302. eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
  4303. ;;
  4304. esac
  4305. }
  4306. fi
  4307. fi
  4308. for dlprefile in $dlprefiles; do
  4309. func_verbose "extracting global C symbols from '$dlprefile'"
  4310. func_basename "$dlprefile"
  4311. name=$func_basename_result
  4312. case $host in
  4313. *cygwin* | *mingw* | *windows* | *cegcc* )
  4314. # if an import library, we need to obtain dlname
  4315. if func_win32_import_lib_p "$dlprefile"; then
  4316. func_tr_sh "$dlprefile"
  4317. eval "curr_lafile=\$libfile_$func_tr_sh_result"
  4318. dlprefile_dlbasename=
  4319. if test -n "$curr_lafile" && func_lalib_p "$curr_lafile"; then
  4320. # Use subshell, to avoid clobbering current variable values
  4321. dlprefile_dlname=`source "$curr_lafile" && echo "$dlname"`
  4322. if test -n "$dlprefile_dlname"; then
  4323. func_basename "$dlprefile_dlname"
  4324. dlprefile_dlbasename=$func_basename_result
  4325. else
  4326. # no lafile. user explicitly requested -dlpreopen <import library>.
  4327. $sharedlib_from_linklib_cmd "$dlprefile"
  4328. dlprefile_dlbasename=$sharedlib_from_linklib_result
  4329. fi
  4330. fi
  4331. $opt_dry_run || {
  4332. if test -n "$dlprefile_dlbasename"; then
  4333. eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"'
  4334. else
  4335. func_warning "Could not compute DLL name from $name"
  4336. eval '$ECHO ": $name " >> "$nlist"'
  4337. fi
  4338. func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
  4339. case $host in
  4340. i[3456]86-*-mingw32*)
  4341. eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe |
  4342. $SED -e '/I __imp/d' -e 's/I __nm_/D /;s/_nm__//' >> '$nlist'"
  4343. ;;
  4344. *)
  4345. eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe |
  4346. $SED -e '/I __imp/d' -e 's/I __nm_/D /;s/__nm_//' >> '$nlist'"
  4347. ;;
  4348. esac
  4349. }
  4350. else # not an import lib
  4351. $opt_dry_run || {
  4352. eval '$ECHO ": $name " >> "$nlist"'
  4353. func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
  4354. eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'"
  4355. }
  4356. fi
  4357. ;;
  4358. *)
  4359. $opt_dry_run || {
  4360. eval '$ECHO ": $name " >> "$nlist"'
  4361. func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
  4362. eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'"
  4363. }
  4364. ;;
  4365. esac
  4366. done
  4367. $opt_dry_run || {
  4368. # Make sure we have at least an empty file.
  4369. test -f "$nlist" || : > "$nlist"
  4370. if test -n "$exclude_expsyms"; then
  4371. $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
  4372. $MV "$nlist"T "$nlist"
  4373. fi
  4374. # Try sorting and uniquifying the output.
  4375. if $GREP -v "^: " < "$nlist" |
  4376. if sort -k 3 </dev/null >/dev/null 2>&1; then
  4377. sort -k 3
  4378. else
  4379. sort +2
  4380. fi |
  4381. uniq > "$nlist"S; then
  4382. :
  4383. else
  4384. $GREP -v "^: " < "$nlist" > "$nlist"S
  4385. fi
  4386. if test -f "$nlist"S; then
  4387. eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"'
  4388. else
  4389. echo '/* NONE */' >> "$output_objdir/$my_dlsyms"
  4390. fi
  4391. func_show_eval '$RM "${nlist}I"'
  4392. if test -n "$global_symbol_to_import"; then
  4393. eval "$global_symbol_to_import"' < "$nlist"S > "$nlist"I'
  4394. fi
  4395. echo >> "$output_objdir/$my_dlsyms" "\
  4396. /* The mapping between symbol names and symbols. */
  4397. typedef struct {
  4398. const char *name;
  4399. void *address;
  4400. } lt_dlsymlist;
  4401. extern LT_DLSYM_CONST lt_dlsymlist
  4402. lt_${my_prefix}_LTX_preloaded_symbols[];\
  4403. "
  4404. if test -s "$nlist"I; then
  4405. echo >> "$output_objdir/$my_dlsyms" "\
  4406. static void lt_syminit(void)
  4407. {
  4408. LT_DLSYM_CONST lt_dlsymlist *symbol = lt_${my_prefix}_LTX_preloaded_symbols;
  4409. for (; symbol->name; ++symbol)
  4410. {"
  4411. $SED 's/.*/ if (STREQ (symbol->name, \"&\")) symbol->address = (void *) \&&;/' < "$nlist"I >> "$output_objdir/$my_dlsyms"
  4412. echo >> "$output_objdir/$my_dlsyms" "\
  4413. }
  4414. }"
  4415. fi
  4416. echo >> "$output_objdir/$my_dlsyms" "\
  4417. LT_DLSYM_CONST lt_dlsymlist
  4418. lt_${my_prefix}_LTX_preloaded_symbols[] =
  4419. { {\"$my_originator\", (void *) 0},"
  4420. if test -s "$nlist"I; then
  4421. echo >> "$output_objdir/$my_dlsyms" "\
  4422. {\"@INIT@\", (void *) &lt_syminit},"
  4423. fi
  4424. case $need_lib_prefix in
  4425. no)
  4426. eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms"
  4427. ;;
  4428. *)
  4429. eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms"
  4430. ;;
  4431. esac
  4432. echo >> "$output_objdir/$my_dlsyms" "\
  4433. {0, (void *) 0}
  4434. };
  4435. /* This works around a problem in FreeBSD linker */
  4436. #ifdef FREEBSD_WORKAROUND
  4437. static const void *lt_preloaded_setup() {
  4438. return lt_${my_prefix}_LTX_preloaded_symbols;
  4439. }
  4440. #endif
  4441. #ifdef __cplusplus
  4442. }
  4443. #endif\
  4444. "
  4445. } # !$opt_dry_run
  4446. pic_flag_for_symtable=
  4447. case "$compile_command " in
  4448. *" -static "*) ;;
  4449. *)
  4450. case $host in
  4451. # compiling the symbol table file with pic_flag works around
  4452. # a FreeBSD bug that causes programs to crash when -lm is
  4453. # linked before any other PIC object. But we must not use
  4454. # pic_flag when linking with -static. The problem exists in
  4455. # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
  4456. *-*-freebsd2.*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
  4457. pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;;
  4458. *-*-hpux*)
  4459. pic_flag_for_symtable=" $pic_flag" ;;
  4460. *)
  4461. $my_pic_p && pic_flag_for_symtable=" $pic_flag"
  4462. ;;
  4463. esac
  4464. ;;
  4465. esac
  4466. symtab_cflags=
  4467. for arg in $LTCFLAGS; do
  4468. case $arg in
  4469. -pie | -fpie | -fPIE) ;;
  4470. *) func_append symtab_cflags " $arg" ;;
  4471. esac
  4472. done
  4473. # Now compile the dynamic symbol file.
  4474. func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?'
  4475. # Clean up the generated files.
  4476. func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T" "${nlist}I"'
  4477. # Transform the symbol file into the correct name.
  4478. symfileobj=$output_objdir/${my_outputname}S.$objext
  4479. case $host in
  4480. *cygwin* | *mingw* | *windows* | *cegcc* )
  4481. if test -f "$output_objdir/$my_outputname.def"; then
  4482. compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
  4483. finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
  4484. else
  4485. compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
  4486. finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
  4487. fi
  4488. ;;
  4489. *)
  4490. compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
  4491. finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
  4492. ;;
  4493. esac
  4494. ;;
  4495. *)
  4496. func_fatal_error "unknown suffix for '$my_dlsyms'"
  4497. ;;
  4498. esac
  4499. else
  4500. # We keep going just in case the user didn't refer to
  4501. # lt_preloaded_symbols. The linker will fail if global_symbol_pipe
  4502. # really was required.
  4503. # Nullify the symbol file.
  4504. compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"`
  4505. finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"`
  4506. fi
  4507. }
  4508. # func_cygming_gnu_implib_p ARG
  4509. # This predicate returns with zero status (TRUE) if
  4510. # ARG is a GNU/binutils-style import library. Returns
  4511. # with nonzero status (FALSE) otherwise.
  4512. func_cygming_gnu_implib_p ()
  4513. {
  4514. $debug_cmd
  4515. func_to_tool_file "$1" func_convert_file_msys_to_w32
  4516. func_cygming_gnu_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $EGREP ' (_head_[A-Za-z0-9_]+_[ad]l*|[A-Za-z0-9_]+_[ad]l*_iname)$'`
  4517. test -n "$func_cygming_gnu_implib_tmp"
  4518. }
  4519. # func_cygming_ms_implib_p ARG
  4520. # This predicate returns with zero status (TRUE) if
  4521. # ARG is an MS-style import library. Returns
  4522. # with nonzero status (FALSE) otherwise.
  4523. func_cygming_ms_implib_p ()
  4524. {
  4525. $debug_cmd
  4526. func_to_tool_file "$1" func_convert_file_msys_to_w32
  4527. func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'`
  4528. test -n "$func_cygming_ms_implib_tmp"
  4529. }
  4530. # func_win32_libid arg
  4531. # return the library type of file 'arg'
  4532. #
  4533. # Need a lot of goo to handle *both* DLLs and import libs
  4534. # Has to be a shell function in order to 'eat' the argument
  4535. # that is supplied when $file_magic_command is called.
  4536. # Despite the name, also deal with 64 bit binaries.
  4537. func_win32_libid ()
  4538. {
  4539. $debug_cmd
  4540. win32_libid_type=unknown
  4541. win32_fileres=`file -L $1 2>/dev/null`
  4542. case $win32_fileres in
  4543. *ar\ archive\ import\ library*) # definitely import
  4544. win32_libid_type="x86 archive import"
  4545. ;;
  4546. *ar\ archive*) # could be an import, or static
  4547. # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD.
  4548. if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null |
  4549. $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64|pe-aarch64)' >/dev/null; then
  4550. case $nm_interface in
  4551. "MS dumpbin")
  4552. if func_cygming_ms_implib_p "$1" ||
  4553. func_cygming_gnu_implib_p "$1"
  4554. then
  4555. win32_nmres=import
  4556. else
  4557. win32_nmres=
  4558. fi
  4559. ;;
  4560. *)
  4561. func_to_tool_file "$1" func_convert_file_msys_to_w32
  4562. win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" |
  4563. $SED -n -e '
  4564. 1,100{
  4565. / I /{
  4566. s|.*|import|
  4567. p
  4568. q
  4569. }
  4570. }'`
  4571. ;;
  4572. esac
  4573. case $win32_nmres in
  4574. import*) win32_libid_type="x86 archive import";;
  4575. *) win32_libid_type="x86 archive static";;
  4576. esac
  4577. fi
  4578. ;;
  4579. *DLL*)
  4580. win32_libid_type="x86 DLL"
  4581. ;;
  4582. *executable*) # but shell scripts are "executable" too...
  4583. case $win32_fileres in
  4584. *MS\ Windows\ PE\ Intel*)
  4585. win32_libid_type="x86 DLL"
  4586. ;;
  4587. esac
  4588. ;;
  4589. esac
  4590. $ECHO "$win32_libid_type"
  4591. }
  4592. # func_cygming_dll_for_implib ARG
  4593. #
  4594. # Platform-specific function to extract the
  4595. # name of the DLL associated with the specified
  4596. # import library ARG.
  4597. # Invoked by eval'ing the libtool variable
  4598. # $sharedlib_from_linklib_cmd
  4599. # Result is available in the variable
  4600. # $sharedlib_from_linklib_result
  4601. func_cygming_dll_for_implib ()
  4602. {
  4603. $debug_cmd
  4604. sharedlib_from_linklib_result=`$DLLTOOL --identify-strict --identify "$1"`
  4605. }
  4606. # func_cygming_dll_for_implib_fallback_core SECTION_NAME LIBNAMEs
  4607. #
  4608. # The is the core of a fallback implementation of a
  4609. # platform-specific function to extract the name of the
  4610. # DLL associated with the specified import library LIBNAME.
  4611. #
  4612. # SECTION_NAME is either .idata$6 or .idata$7, depending
  4613. # on the platform and compiler that created the implib.
  4614. #
  4615. # Echos the name of the DLL associated with the
  4616. # specified import library.
  4617. func_cygming_dll_for_implib_fallback_core ()
  4618. {
  4619. $debug_cmd
  4620. match_literal=`$ECHO "$1" | $SED "$sed_make_literal_regex"`
  4621. $OBJDUMP -s --section "$1" "$2" 2>/dev/null |
  4622. $SED '/^Contents of section '"$match_literal"':/{
  4623. # Place marker at beginning of archive member dllname section
  4624. s/.*/====MARK====/
  4625. p
  4626. d
  4627. }
  4628. # These lines can sometimes be longer than 43 characters, but
  4629. # are always uninteresting
  4630. /:[ ]*file format pe[i]\{,1\}-/d
  4631. /^In archive [^:]*:/d
  4632. # Ensure marker is printed
  4633. /^====MARK====/p
  4634. # Remove all lines with less than 43 characters
  4635. /^.\{43\}/!d
  4636. # From remaining lines, remove first 43 characters
  4637. s/^.\{43\}//' |
  4638. $SED -n '
  4639. # Join marker and all lines until next marker into a single line
  4640. /^====MARK====/ b para
  4641. H
  4642. $ b para
  4643. b
  4644. :para
  4645. x
  4646. s/\n//g
  4647. # Remove the marker
  4648. s/^====MARK====//
  4649. # Remove trailing dots and whitespace
  4650. s/[\. \t]*$//
  4651. # Print
  4652. /./p' |
  4653. # we now have a list, one entry per line, of the stringified
  4654. # contents of the appropriate section of all members of the
  4655. # archive that possess that section. Heuristic: eliminate
  4656. # all those that have a first or second character that is
  4657. # a '.' (that is, objdump's representation of an unprintable
  4658. # character.) This should work for all archives with less than
  4659. # 0x302f exports -- but will fail for DLLs whose name actually
  4660. # begins with a literal '.' or a single character followed by
  4661. # a '.'.
  4662. #
  4663. # Of those that remain, print the first one.
  4664. $SED -e '/^\./d;/^.\./d;q'
  4665. }
  4666. # func_cygming_dll_for_implib_fallback ARG
  4667. # Platform-specific function to extract the
  4668. # name of the DLL associated with the specified
  4669. # import library ARG.
  4670. #
  4671. # This fallback implementation is for use when $DLLTOOL
  4672. # does not support the --identify-strict option.
  4673. # Invoked by eval'ing the libtool variable
  4674. # $sharedlib_from_linklib_cmd
  4675. # Result is available in the variable
  4676. # $sharedlib_from_linklib_result
  4677. func_cygming_dll_for_implib_fallback ()
  4678. {
  4679. $debug_cmd
  4680. if func_cygming_gnu_implib_p "$1"; then
  4681. # binutils import library
  4682. sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$7' "$1"`
  4683. elif func_cygming_ms_implib_p "$1"; then
  4684. # ms-generated import library
  4685. sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$6' "$1"`
  4686. else
  4687. # unknown
  4688. sharedlib_from_linklib_result=
  4689. fi
  4690. }
  4691. # func_extract_an_archive dir oldlib
  4692. func_extract_an_archive ()
  4693. {
  4694. $debug_cmd
  4695. f_ex_an_ar_dir=$1; shift
  4696. f_ex_an_ar_oldlib=$1
  4697. if test yes = "$lock_old_archive_extraction"; then
  4698. lockfile=$f_ex_an_ar_oldlib.lock
  4699. until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
  4700. func_echo "Waiting for $lockfile to be removed"
  4701. sleep 2
  4702. done
  4703. fi
  4704. func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \
  4705. 'stat=$?; rm -f "$lockfile"; exit $stat'
  4706. if test yes = "$lock_old_archive_extraction"; then
  4707. $opt_dry_run || rm -f "$lockfile"
  4708. fi
  4709. if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
  4710. :
  4711. else
  4712. func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib"
  4713. fi
  4714. }
  4715. # func_extract_archives gentop oldlib ...
  4716. func_extract_archives ()
  4717. {
  4718. $debug_cmd
  4719. my_gentop=$1; shift
  4720. my_oldlibs=${1+"$@"}
  4721. my_oldobjs=
  4722. my_xlib=
  4723. my_xabs=
  4724. my_xdir=
  4725. for my_xlib in $my_oldlibs; do
  4726. # Extract the objects.
  4727. case $my_xlib in
  4728. [\\/]* | [A-Za-z]:[\\/]*) my_xabs=$my_xlib ;;
  4729. *) my_xabs=`pwd`"/$my_xlib" ;;
  4730. esac
  4731. func_basename "$my_xlib"
  4732. my_xlib=$func_basename_result
  4733. my_xlib_u=$my_xlib
  4734. while :; do
  4735. case " $extracted_archives " in
  4736. *" $my_xlib_u "*)
  4737. func_arith $extracted_serial + 1
  4738. extracted_serial=$func_arith_result
  4739. my_xlib_u=lt$extracted_serial-$my_xlib ;;
  4740. *) break ;;
  4741. esac
  4742. done
  4743. extracted_archives="$extracted_archives $my_xlib_u"
  4744. my_xdir=$my_gentop/$my_xlib_u
  4745. func_mkdir_p "$my_xdir"
  4746. case $host in
  4747. *-darwin*)
  4748. func_verbose "Extracting $my_xabs"
  4749. # Do not bother doing anything if just a dry run
  4750. $opt_dry_run || {
  4751. darwin_orig_dir=`pwd`
  4752. cd $my_xdir || exit $?
  4753. darwin_archive=$my_xabs
  4754. darwin_curdir=`pwd`
  4755. func_basename "$darwin_archive"
  4756. darwin_base_archive=$func_basename_result
  4757. darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true`
  4758. if test -n "$darwin_arches"; then
  4759. darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'`
  4760. darwin_arch=
  4761. func_verbose "$darwin_base_archive has multiple architectures $darwin_arches"
  4762. for darwin_arch in $darwin_arches; do
  4763. func_mkdir_p "unfat-$$/$darwin_base_archive-$darwin_arch"
  4764. $LIPO -thin $darwin_arch -output "unfat-$$/$darwin_base_archive-$darwin_arch/$darwin_base_archive" "$darwin_archive"
  4765. cd "unfat-$$/$darwin_base_archive-$darwin_arch"
  4766. func_extract_an_archive "`pwd`" "$darwin_base_archive"
  4767. cd "$darwin_curdir"
  4768. $RM "unfat-$$/$darwin_base_archive-$darwin_arch/$darwin_base_archive"
  4769. done # $darwin_arches
  4770. ## Okay now we've a bunch of thin objects, gotta fatten them up :)
  4771. darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$sed_basename" | sort -u`
  4772. darwin_file=
  4773. darwin_files=
  4774. for darwin_file in $darwin_filelist; do
  4775. darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP`
  4776. $LIPO -create -output "$darwin_file" $darwin_files
  4777. done # $darwin_filelist
  4778. $RM -rf unfat-$$
  4779. cd "$darwin_orig_dir"
  4780. else
  4781. cd $darwin_orig_dir
  4782. func_extract_an_archive "$my_xdir" "$my_xabs"
  4783. fi # $darwin_arches
  4784. } # !$opt_dry_run
  4785. ;;
  4786. *)
  4787. func_extract_an_archive "$my_xdir" "$my_xabs"
  4788. ;;
  4789. esac
  4790. my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP`
  4791. done
  4792. func_extract_archives_result=$my_oldobjs
  4793. }
  4794. # func_emit_wrapper [arg=no]
  4795. #
  4796. # Emit a libtool wrapper script on stdout.
  4797. # Don't directly open a file because we may want to
  4798. # incorporate the script contents within a cygwin/mingw/windows
  4799. # wrapper executable. Must ONLY be called from within
  4800. # func_mode_link because it depends on a number of variables
  4801. # set therein.
  4802. #
  4803. # ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR
  4804. # variable will take. If 'yes', then the emitted script
  4805. # will assume that the directory where it is stored is
  4806. # the $objdir directory. This is a cygwin/mingw/windows-specific
  4807. # behavior.
  4808. func_emit_wrapper ()
  4809. {
  4810. func_emit_wrapper_arg1=${1-no}
  4811. $ECHO "\
  4812. #! $SHELL
  4813. # $output - temporary wrapper script for $objdir/$outputname
  4814. # Generated by $PROGRAM (GNU $PACKAGE) $VERSION
  4815. #
  4816. # The $output program cannot be directly executed until all the libtool
  4817. # libraries that it depends on are installed.
  4818. #
  4819. # This wrapper script should never be moved out of the build directory.
  4820. # If it is, it will not operate correctly.
  4821. # Sed substitution that helps us do robust quoting. It backslashifies
  4822. # metacharacters that are still active within double-quoted strings.
  4823. sed_quote_subst='$sed_quote_subst'
  4824. # Be Bourne compatible
  4825. if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
  4826. emulate sh
  4827. NULLCMD=:
  4828. # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
  4829. # is contrary to our usage. Disable this feature.
  4830. alias -g '\${1+\"\$@\"}'='\"\$@\"'
  4831. setopt NO_GLOB_SUBST
  4832. else
  4833. case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
  4834. fi
  4835. BIN_SH=xpg4; export BIN_SH # for Tru64
  4836. DUALCASE=1; export DUALCASE # for MKS sh
  4837. # The HP-UX ksh and POSIX shell print the target directory to stdout
  4838. # if CDPATH is set.
  4839. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
  4840. relink_command=\"$relink_command\"
  4841. # This environment variable determines our operation mode.
  4842. if test \"\$libtool_install_magic\" = \"$magic\"; then
  4843. # install mode needs the following variables:
  4844. generated_by_libtool_version='$macro_version'
  4845. notinst_deplibs='$notinst_deplibs'
  4846. else
  4847. # When we are sourced in execute mode, \$file and \$ECHO are already set.
  4848. if test \"\$libtool_execute_magic\" != \"$magic\"; then
  4849. file=\"\$0\""
  4850. func_quote_arg pretty "$ECHO"
  4851. qECHO=$func_quote_arg_result
  4852. $ECHO "\
  4853. # A function that is used when there is no print builtin or printf.
  4854. func_fallback_echo ()
  4855. {
  4856. eval 'cat <<_LTECHO_EOF
  4857. \$1
  4858. _LTECHO_EOF'
  4859. }
  4860. ECHO=$qECHO
  4861. fi
  4862. # Very basic option parsing. These options are (a) specific to
  4863. # the libtool wrapper, (b) are identical between the wrapper
  4864. # /script/ and the wrapper /executable/ that is used only on
  4865. # windows platforms, and (c) all begin with the string "--lt-"
  4866. # (application programs are unlikely to have options that match
  4867. # this pattern).
  4868. #
  4869. # There are only two supported options: --lt-debug and
  4870. # --lt-dump-script. There is, deliberately, no --lt-help.
  4871. #
  4872. # The first argument to this parsing function should be the
  4873. # script's $0 value, followed by "$@".
  4874. lt_option_debug=
  4875. func_parse_lt_options ()
  4876. {
  4877. lt_script_arg0=\$0
  4878. shift
  4879. for lt_opt
  4880. do
  4881. case \"\$lt_opt\" in
  4882. --lt-debug) lt_option_debug=1 ;;
  4883. --lt-dump-script)
  4884. lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\`
  4885. test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=.
  4886. lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\`
  4887. cat \"\$lt_dump_D/\$lt_dump_F\"
  4888. exit 0
  4889. ;;
  4890. --lt-*)
  4891. \$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2
  4892. exit 1
  4893. ;;
  4894. esac
  4895. done
  4896. # Print the debug banner immediately:
  4897. if test -n \"\$lt_option_debug\"; then
  4898. echo \"$outputname:$output:\$LINENO: libtool wrapper (GNU $PACKAGE) $VERSION\" 1>&2
  4899. fi
  4900. }
  4901. # Used when --lt-debug. Prints its arguments to stdout
  4902. # (redirection is the responsibility of the caller)
  4903. func_lt_dump_args ()
  4904. {
  4905. lt_dump_args_N=1;
  4906. for lt_arg
  4907. do
  4908. \$ECHO \"$outputname:$output:\$LINENO: newargv[\$lt_dump_args_N]: \$lt_arg\"
  4909. lt_dump_args_N=\`expr \$lt_dump_args_N + 1\`
  4910. done
  4911. }
  4912. # Core function for launching the target application
  4913. func_exec_program_core ()
  4914. {
  4915. "
  4916. case $host in
  4917. # Backslashes separate directories on plain windows
  4918. *-*-mingw* | *-*-windows* | *-*-os2* | *-cegcc*)
  4919. $ECHO "\
  4920. if test -n \"\$lt_option_debug\"; then
  4921. \$ECHO \"$outputname:$output:\$LINENO: newargv[0]: \$progdir\\\\\$program\" 1>&2
  4922. func_lt_dump_args \${1+\"\$@\"} 1>&2
  4923. fi
  4924. exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
  4925. "
  4926. ;;
  4927. *)
  4928. $ECHO "\
  4929. if test -n \"\$lt_option_debug\"; then
  4930. \$ECHO \"$outputname:$output:\$LINENO: newargv[0]: \$progdir/\$program\" 1>&2
  4931. func_lt_dump_args \${1+\"\$@\"} 1>&2
  4932. fi
  4933. exec \"\$progdir/\$program\" \${1+\"\$@\"}
  4934. "
  4935. ;;
  4936. esac
  4937. $ECHO "\
  4938. \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2
  4939. exit 1
  4940. }
  4941. # A function to encapsulate launching the target application
  4942. # Strips options in the --lt-* namespace from \$@ and
  4943. # launches target application with the remaining arguments.
  4944. func_exec_program ()
  4945. {
  4946. case \" \$* \" in
  4947. *\\ --lt-*)
  4948. for lt_wr_arg
  4949. do
  4950. case \$lt_wr_arg in
  4951. --lt-*) ;;
  4952. *) set x \"\$@\" \"\$lt_wr_arg\"; shift;;
  4953. esac
  4954. shift
  4955. done ;;
  4956. esac
  4957. func_exec_program_core \${1+\"\$@\"}
  4958. }
  4959. # Parse options
  4960. func_parse_lt_options \"\$0\" \${1+\"\$@\"}
  4961. # Find the directory that this script lives in.
  4962. thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\`
  4963. test \"x\$thisdir\" = \"x\$file\" && thisdir=.
  4964. # Follow symbolic links until we get to the real thisdir.
  4965. file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\`
  4966. while test -n \"\$file\"; do
  4967. destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\`
  4968. # If there was a directory component, then change thisdir.
  4969. if test \"x\$destdir\" != \"x\$file\"; then
  4970. case \"\$destdir\" in
  4971. [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
  4972. *) thisdir=\"\$thisdir/\$destdir\" ;;
  4973. esac
  4974. fi
  4975. file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\`
  4976. file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\`
  4977. done
  4978. # Usually 'no', except on cygwin/mingw/windows when embedded into
  4979. # the cwrapper.
  4980. WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1
  4981. if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then
  4982. # special case for '.'
  4983. if test \"\$thisdir\" = \".\"; then
  4984. thisdir=\`pwd\`
  4985. fi
  4986. # remove .libs from thisdir
  4987. case \"\$thisdir\" in
  4988. *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;;
  4989. $objdir ) thisdir=. ;;
  4990. esac
  4991. fi
  4992. # Try to get the absolute directory name.
  4993. absdir=\`cd \"\$thisdir\" && pwd\`
  4994. test -n \"\$absdir\" && thisdir=\"\$absdir\"
  4995. "
  4996. if test yes = "$fast_install"; then
  4997. $ECHO "\
  4998. program=lt-'$outputname'$exeext
  4999. progdir=\"\$thisdir/$objdir\"
  5000. if test ! -f \"\$progdir/\$program\" ||
  5001. { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | $SED 1q\`; \\
  5002. test \"X\$file\" != \"X\$progdir/\$program\"; }; then
  5003. file=\"\$\$-\$program\"
  5004. if test ! -d \"\$progdir\"; then
  5005. $MKDIR \"\$progdir\"
  5006. else
  5007. $RM \"\$progdir/\$file\"
  5008. fi"
  5009. $ECHO "\
  5010. # relink executable if necessary
  5011. if test -n \"\$relink_command\"; then
  5012. if relink_command_output=\`eval \$relink_command 2>&1\`; then :
  5013. else
  5014. \$ECHO \"\$relink_command_output\" >&2
  5015. $RM \"\$progdir/\$file\"
  5016. exit 1
  5017. fi
  5018. fi
  5019. $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
  5020. { $RM \"\$progdir/\$program\";
  5021. $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; }
  5022. $RM \"\$progdir/\$file\"
  5023. fi"
  5024. else
  5025. $ECHO "\
  5026. program='$outputname'
  5027. progdir=\"\$thisdir/$objdir\"
  5028. "
  5029. fi
  5030. $ECHO "\
  5031. if test -f \"\$progdir/\$program\"; then"
  5032. # fixup the dll searchpath if we need to.
  5033. #
  5034. # Fix the DLL searchpath if we need to. Do this before prepending
  5035. # to shlibpath, because on Windows, both are PATH and uninstalled
  5036. # libraries must come first.
  5037. if test -n "$dllsearchpath"; then
  5038. $ECHO "\
  5039. # Add the dll search path components to the executable PATH
  5040. PATH=$dllsearchpath:\$PATH
  5041. "
  5042. fi
  5043. # Export our shlibpath_var if we have one.
  5044. if test yes = "$shlibpath_overrides_runpath" && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
  5045. $ECHO "\
  5046. # Add our own library path to $shlibpath_var
  5047. $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
  5048. # Some systems cannot cope with colon-terminated $shlibpath_var
  5049. # The second colon is a workaround for a bug in BeOS R4 sed
  5050. $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\`
  5051. export $shlibpath_var
  5052. "
  5053. fi
  5054. $ECHO "\
  5055. if test \"\$libtool_execute_magic\" != \"$magic\"; then
  5056. # Run the actual program with our arguments.
  5057. func_exec_program \${1+\"\$@\"}
  5058. fi
  5059. else
  5060. # The program doesn't exist.
  5061. \$ECHO \"\$0: error: '\$progdir/\$program' does not exist\" 1>&2
  5062. \$ECHO \"This script is just a wrapper for \$program.\" 1>&2
  5063. \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2
  5064. exit 1
  5065. fi
  5066. fi\
  5067. "
  5068. }
  5069. # func_emit_cwrapperexe_src
  5070. # emit the source code for a wrapper executable on stdout
  5071. # Must ONLY be called from within func_mode_link because
  5072. # it depends on a number of variable set therein.
  5073. func_emit_cwrapperexe_src ()
  5074. {
  5075. cat <<EOF
  5076. /* $cwrappersource - temporary wrapper executable for $objdir/$outputname
  5077. Generated by $PROGRAM (GNU $PACKAGE) $VERSION
  5078. The $output program cannot be directly executed until all the libtool
  5079. libraries that it depends on are installed.
  5080. This wrapper executable should never be moved out of the build directory.
  5081. If it is, it will not operate correctly.
  5082. */
  5083. EOF
  5084. cat <<"EOF"
  5085. #ifdef _MSC_VER
  5086. # define _CRT_SECURE_NO_DEPRECATE 1
  5087. #endif
  5088. #include <stdio.h>
  5089. #include <stdlib.h>
  5090. #if defined _WIN32 && !defined __GNUC__
  5091. # include <direct.h>
  5092. # include <process.h>
  5093. # include <io.h>
  5094. #else
  5095. # include <unistd.h>
  5096. # include <stdint.h>
  5097. # ifdef __CYGWIN__
  5098. # include <io.h>
  5099. # endif
  5100. #endif
  5101. #include <malloc.h>
  5102. #include <stdarg.h>
  5103. #include <assert.h>
  5104. #include <string.h>
  5105. #include <ctype.h>
  5106. #include <errno.h>
  5107. #include <fcntl.h>
  5108. #include <sys/stat.h>
  5109. #define STREQ(s1, s2) (strcmp ((s1), (s2)) == 0)
  5110. /* declarations of non-ANSI functions */
  5111. #if defined __MINGW32__
  5112. # ifdef __STRICT_ANSI__
  5113. _CRTIMP int __cdecl _putenv (const char *);
  5114. # endif
  5115. #elif defined __CYGWIN__
  5116. # ifdef __STRICT_ANSI__
  5117. char *realpath (const char *, char *);
  5118. int putenv (char *);
  5119. int setenv (const char *, const char *, int);
  5120. # endif
  5121. /* #elif defined other_platform || defined ... */
  5122. #endif
  5123. /* portability defines, excluding path handling macros */
  5124. #if defined _MSC_VER
  5125. # define setmode _setmode
  5126. # define stat _stat
  5127. # define chmod _chmod
  5128. # define getcwd _getcwd
  5129. # define putenv _putenv
  5130. # define S_IXUSR _S_IEXEC
  5131. #elif defined __MINGW32__
  5132. # define setmode _setmode
  5133. # define stat _stat
  5134. # define chmod _chmod
  5135. # define getcwd _getcwd
  5136. # define putenv _putenv
  5137. #elif defined __CYGWIN__
  5138. # define HAVE_SETENV
  5139. # define FOPEN_WB "wb"
  5140. /* #elif defined other platforms ... */
  5141. #endif
  5142. #if defined PATH_MAX
  5143. # define LT_PATHMAX PATH_MAX
  5144. #elif defined MAXPATHLEN
  5145. # define LT_PATHMAX MAXPATHLEN
  5146. #else
  5147. # define LT_PATHMAX 1024
  5148. #endif
  5149. #ifndef S_IXOTH
  5150. # define S_IXOTH 0
  5151. #endif
  5152. #ifndef S_IXGRP
  5153. # define S_IXGRP 0
  5154. #endif
  5155. /* path handling portability macros */
  5156. #ifndef DIR_SEPARATOR
  5157. # define DIR_SEPARATOR '/'
  5158. # define PATH_SEPARATOR ':'
  5159. #endif
  5160. #if defined _WIN32 || defined __MSDOS__ || defined __DJGPP__ || \
  5161. defined __OS2__
  5162. # define HAVE_DOS_BASED_FILE_SYSTEM
  5163. # define FOPEN_WB "wb"
  5164. # ifndef DIR_SEPARATOR_2
  5165. # define DIR_SEPARATOR_2 '\\'
  5166. # endif
  5167. # ifndef PATH_SEPARATOR_2
  5168. # define PATH_SEPARATOR_2 ';'
  5169. # endif
  5170. #endif
  5171. #ifndef DIR_SEPARATOR_2
  5172. # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
  5173. #else /* DIR_SEPARATOR_2 */
  5174. # define IS_DIR_SEPARATOR(ch) \
  5175. (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
  5176. #endif /* DIR_SEPARATOR_2 */
  5177. #ifndef PATH_SEPARATOR_2
  5178. # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
  5179. #else /* PATH_SEPARATOR_2 */
  5180. # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
  5181. #endif /* PATH_SEPARATOR_2 */
  5182. #ifndef FOPEN_WB
  5183. # define FOPEN_WB "w"
  5184. #endif
  5185. #ifndef _O_BINARY
  5186. # define _O_BINARY 0
  5187. #endif
  5188. #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type)))
  5189. #define XFREE(stale) do { \
  5190. if (stale) { free (stale); stale = 0; } \
  5191. } while (0)
  5192. #if defined LT_DEBUGWRAPPER
  5193. static int lt_debug = 1;
  5194. #else
  5195. static int lt_debug = 0;
  5196. #endif
  5197. const char *program_name = "libtool-wrapper"; /* in case xstrdup fails */
  5198. void *xmalloc (size_t num);
  5199. char *xstrdup (const char *string);
  5200. const char *base_name (const char *name);
  5201. char *find_executable (const char *wrapper);
  5202. char *chase_symlinks (const char *pathspec);
  5203. int make_executable (const char *path);
  5204. int check_executable (const char *path);
  5205. char *strendzap (char *str, const char *pat);
  5206. void lt_debugprintf (const char *file, int line, const char *fmt, ...);
  5207. void lt_fatal (const char *file, int line, const char *message, ...);
  5208. static const char *nonnull (const char *s);
  5209. static const char *nonempty (const char *s);
  5210. void lt_setenv (const char *name, const char *value);
  5211. char *lt_extend_str (const char *orig_value, const char *add, int to_end);
  5212. void lt_update_exe_path (const char *name, const char *value);
  5213. void lt_update_lib_path (const char *name, const char *value);
  5214. char **prepare_spawn (char **argv);
  5215. void lt_dump_script (FILE *f);
  5216. EOF
  5217. cat <<EOF
  5218. #if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 5)
  5219. # define externally_visible volatile
  5220. #else
  5221. # define externally_visible __attribute__((externally_visible)) volatile
  5222. #endif
  5223. externally_visible const char * MAGIC_EXE = "$magic_exe";
  5224. const char * LIB_PATH_VARNAME = "$shlibpath_var";
  5225. EOF
  5226. if test yes = "$shlibpath_overrides_runpath" && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
  5227. func_to_host_path "$temp_rpath"
  5228. cat <<EOF
  5229. const char * LIB_PATH_VALUE = "$func_to_host_path_result";
  5230. EOF
  5231. else
  5232. cat <<"EOF"
  5233. const char * LIB_PATH_VALUE = "";
  5234. EOF
  5235. fi
  5236. if test -n "$dllsearchpath"; then
  5237. func_to_host_path "$dllsearchpath:"
  5238. cat <<EOF
  5239. const char * EXE_PATH_VARNAME = "PATH";
  5240. const char * EXE_PATH_VALUE = "$func_to_host_path_result";
  5241. EOF
  5242. else
  5243. cat <<"EOF"
  5244. const char * EXE_PATH_VARNAME = "";
  5245. const char * EXE_PATH_VALUE = "";
  5246. EOF
  5247. fi
  5248. if test yes = "$fast_install"; then
  5249. cat <<EOF
  5250. const char * TARGET_PROGRAM_NAME = "lt-$outputname"; /* hopefully, no .exe */
  5251. EOF
  5252. else
  5253. cat <<EOF
  5254. const char * TARGET_PROGRAM_NAME = "$outputname"; /* hopefully, no .exe */
  5255. EOF
  5256. fi
  5257. cat <<"EOF"
  5258. #define LTWRAPPER_OPTION_PREFIX "--lt-"
  5259. static const char *ltwrapper_option_prefix = LTWRAPPER_OPTION_PREFIX;
  5260. static const char *dumpscript_opt = LTWRAPPER_OPTION_PREFIX "dump-script";
  5261. static const char *debug_opt = LTWRAPPER_OPTION_PREFIX "debug";
  5262. int
  5263. main (int argc, char *argv[])
  5264. {
  5265. char **newargz;
  5266. int newargc;
  5267. char *tmp_pathspec;
  5268. char *actual_cwrapper_path;
  5269. char *actual_cwrapper_name;
  5270. char *target_name;
  5271. char *lt_argv_zero;
  5272. int rval = 127;
  5273. int i;
  5274. program_name = (char *) xstrdup (base_name (argv[0]));
  5275. newargz = XMALLOC (char *, (size_t) argc + 1);
  5276. /* very simple arg parsing; don't want to rely on getopt
  5277. * also, copy all non cwrapper options to newargz, except
  5278. * argz[0], which is handled differently
  5279. */
  5280. newargc=0;
  5281. for (i = 1; i < argc; i++)
  5282. {
  5283. if (STREQ (argv[i], dumpscript_opt))
  5284. {
  5285. EOF
  5286. case $host in
  5287. *mingw* | *windows* | *cygwin* )
  5288. # make stdout use "unix" line endings
  5289. echo " setmode(1,_O_BINARY);"
  5290. ;;
  5291. esac
  5292. cat <<"EOF"
  5293. lt_dump_script (stdout);
  5294. return 0;
  5295. }
  5296. if (STREQ (argv[i], debug_opt))
  5297. {
  5298. lt_debug = 1;
  5299. continue;
  5300. }
  5301. if (STREQ (argv[i], ltwrapper_option_prefix))
  5302. {
  5303. /* however, if there is an option in the LTWRAPPER_OPTION_PREFIX
  5304. namespace, but it is not one of the ones we know about and
  5305. have already dealt with, above (including dump-script), then
  5306. report an error. Otherwise, targets might begin to believe
  5307. they are allowed to use options in the LTWRAPPER_OPTION_PREFIX
  5308. namespace. The first time any user complains about this, we'll
  5309. need to make LTWRAPPER_OPTION_PREFIX a configure-time option
  5310. or a configure.ac-settable value.
  5311. */
  5312. lt_fatal (__FILE__, __LINE__,
  5313. "unrecognized %s option: '%s'",
  5314. ltwrapper_option_prefix, argv[i]);
  5315. }
  5316. /* otherwise ... */
  5317. newargz[++newargc] = xstrdup (argv[i]);
  5318. }
  5319. newargz[++newargc] = NULL;
  5320. EOF
  5321. cat <<EOF
  5322. /* The GNU banner must be the first non-error debug message */
  5323. lt_debugprintf (__FILE__, __LINE__, "libtool wrapper (GNU $PACKAGE) $VERSION\n");
  5324. EOF
  5325. cat <<"EOF"
  5326. lt_debugprintf (__FILE__, __LINE__, "(main) argv[0]: %s\n", argv[0]);
  5327. lt_debugprintf (__FILE__, __LINE__, "(main) program_name: %s\n", program_name);
  5328. tmp_pathspec = find_executable (argv[0]);
  5329. if (tmp_pathspec == NULL)
  5330. lt_fatal (__FILE__, __LINE__, "couldn't find %s", argv[0]);
  5331. lt_debugprintf (__FILE__, __LINE__,
  5332. "(main) found exe (before symlink chase) at: %s\n",
  5333. tmp_pathspec);
  5334. actual_cwrapper_path = chase_symlinks (tmp_pathspec);
  5335. lt_debugprintf (__FILE__, __LINE__,
  5336. "(main) found exe (after symlink chase) at: %s\n",
  5337. actual_cwrapper_path);
  5338. XFREE (tmp_pathspec);
  5339. actual_cwrapper_name = xstrdup (base_name (actual_cwrapper_path));
  5340. strendzap (actual_cwrapper_path, actual_cwrapper_name);
  5341. /* wrapper name transforms */
  5342. strendzap (actual_cwrapper_name, ".exe");
  5343. tmp_pathspec = lt_extend_str (actual_cwrapper_name, ".exe", 1);
  5344. XFREE (actual_cwrapper_name);
  5345. actual_cwrapper_name = tmp_pathspec;
  5346. tmp_pathspec = 0;
  5347. /* target_name transforms -- use actual target program name; might have lt- prefix */
  5348. target_name = xstrdup (base_name (TARGET_PROGRAM_NAME));
  5349. strendzap (target_name, ".exe");
  5350. tmp_pathspec = lt_extend_str (target_name, ".exe", 1);
  5351. XFREE (target_name);
  5352. target_name = tmp_pathspec;
  5353. tmp_pathspec = 0;
  5354. lt_debugprintf (__FILE__, __LINE__,
  5355. "(main) libtool target name: %s\n",
  5356. target_name);
  5357. EOF
  5358. cat <<EOF
  5359. newargz[0] =
  5360. XMALLOC (char, (strlen (actual_cwrapper_path) +
  5361. strlen ("$objdir") + 1 + strlen (actual_cwrapper_name) + 1));
  5362. strcpy (newargz[0], actual_cwrapper_path);
  5363. strcat (newargz[0], "$objdir");
  5364. strcat (newargz[0], "/");
  5365. EOF
  5366. cat <<"EOF"
  5367. /* stop here, and copy so we don't have to do this twice */
  5368. tmp_pathspec = xstrdup (newargz[0]);
  5369. /* do NOT want the lt- prefix here, so use actual_cwrapper_name */
  5370. strcat (newargz[0], actual_cwrapper_name);
  5371. /* DO want the lt- prefix here if it exists, so use target_name */
  5372. lt_argv_zero = lt_extend_str (tmp_pathspec, target_name, 1);
  5373. XFREE (tmp_pathspec);
  5374. tmp_pathspec = NULL;
  5375. EOF
  5376. case $host_os in
  5377. mingw* | windows*)
  5378. cat <<"EOF"
  5379. {
  5380. char* p;
  5381. while ((p = strchr (newargz[0], '\\')) != NULL)
  5382. {
  5383. *p = '/';
  5384. }
  5385. while ((p = strchr (lt_argv_zero, '\\')) != NULL)
  5386. {
  5387. *p = '/';
  5388. }
  5389. }
  5390. EOF
  5391. ;;
  5392. esac
  5393. cat <<"EOF"
  5394. XFREE (target_name);
  5395. XFREE (actual_cwrapper_path);
  5396. XFREE (actual_cwrapper_name);
  5397. lt_setenv ("BIN_SH", "xpg4"); /* for Tru64 */
  5398. lt_setenv ("DUALCASE", "1"); /* for MSK sh */
  5399. /* Update the DLL searchpath. EXE_PATH_VALUE ($dllsearchpath) must
  5400. be prepended before (that is, appear after) LIB_PATH_VALUE ($temp_rpath)
  5401. because on Windows, both *_VARNAMEs are PATH but uninstalled
  5402. libraries must come first. */
  5403. lt_update_exe_path (EXE_PATH_VARNAME, EXE_PATH_VALUE);
  5404. lt_update_lib_path (LIB_PATH_VARNAME, LIB_PATH_VALUE);
  5405. lt_debugprintf (__FILE__, __LINE__, "(main) lt_argv_zero: %s\n",
  5406. nonnull (lt_argv_zero));
  5407. for (i = 0; i < newargc; i++)
  5408. {
  5409. lt_debugprintf (__FILE__, __LINE__, "(main) newargz[%d]: %s\n",
  5410. i, nonnull (newargz[i]));
  5411. }
  5412. EOF
  5413. case $host_os in
  5414. mingw* | windows*)
  5415. cat <<"EOF"
  5416. /* execv doesn't actually work on mingw as expected on unix */
  5417. newargz = prepare_spawn (newargz);
  5418. rval = (int) _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz);
  5419. if (rval == -1)
  5420. {
  5421. /* failed to start process */
  5422. lt_debugprintf (__FILE__, __LINE__,
  5423. "(main) failed to launch target \"%s\": %s\n",
  5424. lt_argv_zero, nonnull (strerror (errno)));
  5425. return 127;
  5426. }
  5427. return rval;
  5428. EOF
  5429. ;;
  5430. *)
  5431. cat <<"EOF"
  5432. execv (lt_argv_zero, newargz);
  5433. return rval; /* =127, but avoids unused variable warning */
  5434. EOF
  5435. ;;
  5436. esac
  5437. cat <<"EOF"
  5438. }
  5439. void *
  5440. xmalloc (size_t num)
  5441. {
  5442. void *p = (void *) malloc (num);
  5443. if (!p)
  5444. lt_fatal (__FILE__, __LINE__, "memory exhausted");
  5445. return p;
  5446. }
  5447. char *
  5448. xstrdup (const char *string)
  5449. {
  5450. return string ? strcpy ((char *) xmalloc (strlen (string) + 1),
  5451. string) : NULL;
  5452. }
  5453. const char *
  5454. base_name (const char *name)
  5455. {
  5456. const char *base;
  5457. #if defined HAVE_DOS_BASED_FILE_SYSTEM
  5458. /* Skip over the disk name in MSDOS pathnames. */
  5459. if (isalpha ((unsigned char) name[0]) && name[1] == ':')
  5460. name += 2;
  5461. #endif
  5462. for (base = name; *name; name++)
  5463. if (IS_DIR_SEPARATOR (*name))
  5464. base = name + 1;
  5465. return base;
  5466. }
  5467. int
  5468. check_executable (const char *path)
  5469. {
  5470. struct stat st;
  5471. lt_debugprintf (__FILE__, __LINE__, "(check_executable): %s\n",
  5472. nonempty (path));
  5473. if ((!path) || (!*path))
  5474. return 0;
  5475. if ((stat (path, &st) >= 0)
  5476. && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)))
  5477. return 1;
  5478. else
  5479. return 0;
  5480. }
  5481. int
  5482. make_executable (const char *path)
  5483. {
  5484. int rval = 0;
  5485. struct stat st;
  5486. lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n",
  5487. nonempty (path));
  5488. if ((!path) || (!*path))
  5489. return 0;
  5490. if (stat (path, &st) >= 0)
  5491. {
  5492. rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR);
  5493. }
  5494. return rval;
  5495. }
  5496. /* Searches for the full path of the wrapper. Returns
  5497. newly allocated full path name if found, NULL otherwise
  5498. Does not chase symlinks, even on platforms that support them.
  5499. */
  5500. char *
  5501. find_executable (const char *wrapper)
  5502. {
  5503. int has_slash = 0;
  5504. const char *p;
  5505. const char *p_next;
  5506. /* static buffer for getcwd */
  5507. char tmp[LT_PATHMAX + 1];
  5508. size_t tmp_len;
  5509. char *concat_name;
  5510. lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n",
  5511. nonempty (wrapper));
  5512. if ((wrapper == NULL) || (*wrapper == '\0'))
  5513. return NULL;
  5514. /* Absolute path? */
  5515. #if defined HAVE_DOS_BASED_FILE_SYSTEM
  5516. if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':')
  5517. {
  5518. concat_name = xstrdup (wrapper);
  5519. if (check_executable (concat_name))
  5520. return concat_name;
  5521. XFREE (concat_name);
  5522. }
  5523. else
  5524. {
  5525. #endif
  5526. if (IS_DIR_SEPARATOR (wrapper[0]))
  5527. {
  5528. concat_name = xstrdup (wrapper);
  5529. if (check_executable (concat_name))
  5530. return concat_name;
  5531. XFREE (concat_name);
  5532. }
  5533. #if defined HAVE_DOS_BASED_FILE_SYSTEM
  5534. }
  5535. #endif
  5536. for (p = wrapper; *p; p++)
  5537. if (*p == '/')
  5538. {
  5539. has_slash = 1;
  5540. break;
  5541. }
  5542. if (!has_slash)
  5543. {
  5544. /* no slashes; search PATH */
  5545. const char *path = getenv ("PATH");
  5546. if (path != NULL)
  5547. {
  5548. for (p = path; *p; p = p_next)
  5549. {
  5550. const char *q;
  5551. size_t p_len;
  5552. for (q = p; *q; q++)
  5553. if (IS_PATH_SEPARATOR (*q))
  5554. break;
  5555. p_len = (size_t) (q - p);
  5556. p_next = (*q == '\0' ? q : q + 1);
  5557. if (p_len == 0)
  5558. {
  5559. /* empty path: current directory */
  5560. if (getcwd (tmp, LT_PATHMAX) == NULL)
  5561. lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
  5562. nonnull (strerror (errno)));
  5563. tmp_len = strlen (tmp);
  5564. concat_name =
  5565. XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
  5566. memcpy (concat_name, tmp, tmp_len);
  5567. concat_name[tmp_len] = '/';
  5568. strcpy (concat_name + tmp_len + 1, wrapper);
  5569. }
  5570. else
  5571. {
  5572. concat_name =
  5573. XMALLOC (char, p_len + 1 + strlen (wrapper) + 1);
  5574. memcpy (concat_name, p, p_len);
  5575. concat_name[p_len] = '/';
  5576. strcpy (concat_name + p_len + 1, wrapper);
  5577. }
  5578. if (check_executable (concat_name))
  5579. return concat_name;
  5580. XFREE (concat_name);
  5581. }
  5582. }
  5583. /* not found in PATH; assume curdir */
  5584. }
  5585. /* Relative path | not found in path: prepend cwd */
  5586. if (getcwd (tmp, LT_PATHMAX) == NULL)
  5587. lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
  5588. nonnull (strerror (errno)));
  5589. tmp_len = strlen (tmp);
  5590. concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
  5591. memcpy (concat_name, tmp, tmp_len);
  5592. concat_name[tmp_len] = '/';
  5593. strcpy (concat_name + tmp_len + 1, wrapper);
  5594. if (check_executable (concat_name))
  5595. return concat_name;
  5596. XFREE (concat_name);
  5597. return NULL;
  5598. }
  5599. char *
  5600. chase_symlinks (const char *pathspec)
  5601. {
  5602. #ifndef S_ISLNK
  5603. return xstrdup (pathspec);
  5604. #else
  5605. char buf[LT_PATHMAX];
  5606. struct stat s;
  5607. char *tmp_pathspec = xstrdup (pathspec);
  5608. char *p;
  5609. int has_symlinks = 0;
  5610. while (strlen (tmp_pathspec) && !has_symlinks)
  5611. {
  5612. lt_debugprintf (__FILE__, __LINE__,
  5613. "checking path component for symlinks: %s\n",
  5614. tmp_pathspec);
  5615. if (lstat (tmp_pathspec, &s) == 0)
  5616. {
  5617. if (S_ISLNK (s.st_mode) != 0)
  5618. {
  5619. has_symlinks = 1;
  5620. break;
  5621. }
  5622. /* search backwards for last DIR_SEPARATOR */
  5623. p = tmp_pathspec + strlen (tmp_pathspec) - 1;
  5624. while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
  5625. p--;
  5626. if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
  5627. {
  5628. /* no more DIR_SEPARATORS left */
  5629. break;
  5630. }
  5631. *p = '\0';
  5632. }
  5633. else
  5634. {
  5635. lt_fatal (__FILE__, __LINE__,
  5636. "error accessing file \"%s\": %s",
  5637. tmp_pathspec, nonnull (strerror (errno)));
  5638. }
  5639. }
  5640. XFREE (tmp_pathspec);
  5641. if (!has_symlinks)
  5642. {
  5643. return xstrdup (pathspec);
  5644. }
  5645. tmp_pathspec = realpath (pathspec, buf);
  5646. if (tmp_pathspec == 0)
  5647. {
  5648. lt_fatal (__FILE__, __LINE__,
  5649. "could not follow symlinks for %s", pathspec);
  5650. }
  5651. return xstrdup (tmp_pathspec);
  5652. #endif
  5653. }
  5654. char *
  5655. strendzap (char *str, const char *pat)
  5656. {
  5657. size_t len, patlen;
  5658. assert (str != NULL);
  5659. assert (pat != NULL);
  5660. len = strlen (str);
  5661. patlen = strlen (pat);
  5662. if (patlen <= len)
  5663. {
  5664. str += len - patlen;
  5665. if (STREQ (str, pat))
  5666. *str = '\0';
  5667. }
  5668. return str;
  5669. }
  5670. void
  5671. lt_debugprintf (const char *file, int line, const char *fmt, ...)
  5672. {
  5673. va_list args;
  5674. if (lt_debug)
  5675. {
  5676. (void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line);
  5677. va_start (args, fmt);
  5678. (void) vfprintf (stderr, fmt, args);
  5679. va_end (args);
  5680. }
  5681. }
  5682. static void
  5683. lt_error_core (int exit_status, const char *file,
  5684. int line, const char *mode,
  5685. const char *message, va_list ap)
  5686. {
  5687. fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode);
  5688. vfprintf (stderr, message, ap);
  5689. fprintf (stderr, ".\n");
  5690. if (exit_status >= 0)
  5691. exit (exit_status);
  5692. }
  5693. void
  5694. lt_fatal (const char *file, int line, const char *message, ...)
  5695. {
  5696. va_list ap;
  5697. va_start (ap, message);
  5698. lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap);
  5699. va_end (ap);
  5700. }
  5701. static const char *
  5702. nonnull (const char *s)
  5703. {
  5704. return s ? s : "(null)";
  5705. }
  5706. static const char *
  5707. nonempty (const char *s)
  5708. {
  5709. return (s && !*s) ? "(empty)" : nonnull (s);
  5710. }
  5711. void
  5712. lt_setenv (const char *name, const char *value)
  5713. {
  5714. lt_debugprintf (__FILE__, __LINE__,
  5715. "(lt_setenv) setting '%s' to '%s'\n",
  5716. nonnull (name), nonnull (value));
  5717. {
  5718. #ifdef HAVE_SETENV
  5719. /* always make a copy, for consistency with !HAVE_SETENV */
  5720. char *str = xstrdup (value);
  5721. setenv (name, str, 1);
  5722. #else
  5723. size_t len = strlen (name) + 1 + strlen (value) + 1;
  5724. char *str = XMALLOC (char, len);
  5725. sprintf (str, "%s=%s", name, value);
  5726. if (putenv (str) != EXIT_SUCCESS)
  5727. {
  5728. XFREE (str);
  5729. }
  5730. #endif
  5731. }
  5732. }
  5733. char *
  5734. lt_extend_str (const char *orig_value, const char *add, int to_end)
  5735. {
  5736. char *new_value;
  5737. if (orig_value && *orig_value)
  5738. {
  5739. size_t orig_value_len = strlen (orig_value);
  5740. size_t add_len = strlen (add);
  5741. new_value = XMALLOC (char, add_len + orig_value_len + 1);
  5742. if (to_end)
  5743. {
  5744. strcpy (new_value, orig_value);
  5745. strcpy (new_value + orig_value_len, add);
  5746. }
  5747. else
  5748. {
  5749. strcpy (new_value, add);
  5750. strcpy (new_value + add_len, orig_value);
  5751. }
  5752. }
  5753. else
  5754. {
  5755. new_value = xstrdup (add);
  5756. }
  5757. return new_value;
  5758. }
  5759. void
  5760. lt_update_exe_path (const char *name, const char *value)
  5761. {
  5762. lt_debugprintf (__FILE__, __LINE__,
  5763. "(lt_update_exe_path) modifying '%s' by prepending '%s'\n",
  5764. nonnull (name), nonnull (value));
  5765. if (name && *name && value && *value)
  5766. {
  5767. char *new_value = lt_extend_str (getenv (name), value, 0);
  5768. /* some systems can't cope with a ':'-terminated path #' */
  5769. size_t len = strlen (new_value);
  5770. while ((len > 0) && IS_PATH_SEPARATOR (new_value[len-1]))
  5771. {
  5772. new_value[--len] = '\0';
  5773. }
  5774. lt_setenv (name, new_value);
  5775. XFREE (new_value);
  5776. }
  5777. }
  5778. void
  5779. lt_update_lib_path (const char *name, const char *value)
  5780. {
  5781. lt_debugprintf (__FILE__, __LINE__,
  5782. "(lt_update_lib_path) modifying '%s' by prepending '%s'\n",
  5783. nonnull (name), nonnull (value));
  5784. if (name && *name && value && *value)
  5785. {
  5786. char *new_value = lt_extend_str (getenv (name), value, 0);
  5787. lt_setenv (name, new_value);
  5788. XFREE (new_value);
  5789. }
  5790. }
  5791. EOF
  5792. case $host_os in
  5793. mingw* | windows*)
  5794. cat <<"EOF"
  5795. /* Prepares an argument vector before calling spawn().
  5796. Note that spawn() does not by itself call the command interpreter
  5797. (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") :
  5798. ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
  5799. GetVersionEx(&v);
  5800. v.dwPlatformId == VER_PLATFORM_WIN32_NT;
  5801. }) ? "cmd.exe" : "command.com").
  5802. Instead it simply concatenates the arguments, separated by ' ', and calls
  5803. CreateProcess(). We must quote the arguments since Win32 CreateProcess()
  5804. interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a
  5805. special way:
  5806. - Space and tab are interpreted as delimiters. They are not treated as
  5807. delimiters if they are surrounded by double quotes: "...".
  5808. - Unescaped double quotes are removed from the input. Their only effect is
  5809. that within double quotes, space and tab are treated like normal
  5810. characters.
  5811. - Backslashes not followed by double quotes are not special.
  5812. - But 2*n+1 backslashes followed by a double quote become
  5813. n backslashes followed by a double quote (n >= 0):
  5814. \" -> "
  5815. \\\" -> \"
  5816. \\\\\" -> \\"
  5817. */
  5818. #define SHELL_SPECIAL_CHARS "\"\\ \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037"
  5819. #define SHELL_SPACE_CHARS " \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037"
  5820. char **
  5821. prepare_spawn (char **argv)
  5822. {
  5823. size_t argc;
  5824. char **new_argv;
  5825. size_t i;
  5826. /* Count number of arguments. */
  5827. for (argc = 0; argv[argc] != NULL; argc++)
  5828. ;
  5829. /* Allocate new argument vector. */
  5830. new_argv = XMALLOC (char *, argc + 1);
  5831. /* Put quoted arguments into the new argument vector. */
  5832. for (i = 0; i < argc; i++)
  5833. {
  5834. const char *string = argv[i];
  5835. if (string[0] == '\0')
  5836. new_argv[i] = xstrdup ("\"\"");
  5837. else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL)
  5838. {
  5839. int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL);
  5840. size_t length;
  5841. unsigned int backslashes;
  5842. const char *s;
  5843. char *quoted_string;
  5844. char *p;
  5845. length = 0;
  5846. backslashes = 0;
  5847. if (quote_around)
  5848. length++;
  5849. for (s = string; *s != '\0'; s++)
  5850. {
  5851. char c = *s;
  5852. if (c == '"')
  5853. length += backslashes + 1;
  5854. length++;
  5855. if (c == '\\')
  5856. backslashes++;
  5857. else
  5858. backslashes = 0;
  5859. }
  5860. if (quote_around)
  5861. length += backslashes + 1;
  5862. quoted_string = XMALLOC (char, length + 1);
  5863. p = quoted_string;
  5864. backslashes = 0;
  5865. if (quote_around)
  5866. *p++ = '"';
  5867. for (s = string; *s != '\0'; s++)
  5868. {
  5869. char c = *s;
  5870. if (c == '"')
  5871. {
  5872. unsigned int j;
  5873. for (j = backslashes + 1; j > 0; j--)
  5874. *p++ = '\\';
  5875. }
  5876. *p++ = c;
  5877. if (c == '\\')
  5878. backslashes++;
  5879. else
  5880. backslashes = 0;
  5881. }
  5882. if (quote_around)
  5883. {
  5884. unsigned int j;
  5885. for (j = backslashes; j > 0; j--)
  5886. *p++ = '\\';
  5887. *p++ = '"';
  5888. }
  5889. *p = '\0';
  5890. new_argv[i] = quoted_string;
  5891. }
  5892. else
  5893. new_argv[i] = (char *) string;
  5894. }
  5895. new_argv[argc] = NULL;
  5896. return new_argv;
  5897. }
  5898. EOF
  5899. ;;
  5900. esac
  5901. cat <<"EOF"
  5902. void lt_dump_script (FILE* f)
  5903. {
  5904. EOF
  5905. func_emit_wrapper yes |
  5906. $SED -n -e '
  5907. s/^\(.\{79\}\)\(..*\)/\1\
  5908. \2/
  5909. h
  5910. s/\([\\"]\)/\\\1/g
  5911. s/$/\\n/
  5912. s/\([^\n]*\).*/ fputs ("\1", f);/p
  5913. g
  5914. D'
  5915. cat <<"EOF"
  5916. }
  5917. EOF
  5918. }
  5919. # end: func_emit_cwrapperexe_src
  5920. # func_win32_import_lib_p ARG
  5921. # True if ARG is an import lib, as indicated by $file_magic_cmd
  5922. func_win32_import_lib_p ()
  5923. {
  5924. $debug_cmd
  5925. case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in
  5926. *import*) : ;;
  5927. *) false ;;
  5928. esac
  5929. }
  5930. # func_suncc_cstd_abi
  5931. # !!ONLY CALL THIS FOR SUN CC AFTER $compile_command IS FULLY EXPANDED!!
  5932. # Several compiler flags select an ABI that is incompatible with the
  5933. # Cstd library. Avoid specifying it if any are in CXXFLAGS.
  5934. func_suncc_cstd_abi ()
  5935. {
  5936. $debug_cmd
  5937. case " $compile_command " in
  5938. *" -compat=g "*|*\ -std=c++[0-9][0-9]\ *|*" -library=stdcxx4 "*|*" -library=stlport4 "*)
  5939. suncc_use_cstd_abi=no
  5940. ;;
  5941. *)
  5942. suncc_use_cstd_abi=yes
  5943. ;;
  5944. esac
  5945. }
  5946. # func_mode_link arg...
  5947. func_mode_link ()
  5948. {
  5949. $debug_cmd
  5950. case $host in
  5951. *-*-cygwin* | *-*-mingw* | *-*-windows* | *-*-pw32* | *-*-os2* | *-cegcc*)
  5952. # It is impossible to link a dll without this setting, and
  5953. # we shouldn't force the makefile maintainer to figure out
  5954. # what system we are compiling for in order to pass an extra
  5955. # flag for every libtool invocation.
  5956. # allow_undefined=no
  5957. # FIXME: Unfortunately, there are problems with the above when trying
  5958. # to make a dll that has undefined symbols, in which case not
  5959. # even a static library is built. For now, we need to specify
  5960. # -no-undefined on the libtool link line when we can be certain
  5961. # that all symbols are satisfied, otherwise we get a static library.
  5962. allow_undefined=yes
  5963. ;;
  5964. *)
  5965. allow_undefined=yes
  5966. ;;
  5967. esac
  5968. libtool_args=$nonopt
  5969. base_compile="$nonopt $@"
  5970. compile_command=$nonopt
  5971. finalize_command=$nonopt
  5972. compile_rpath=
  5973. compile_rpath_tail=
  5974. finalize_rpath=
  5975. compile_shlibpath=
  5976. finalize_shlibpath=
  5977. convenience=
  5978. old_convenience=
  5979. deplibs=
  5980. old_deplibs=
  5981. compiler_flags=
  5982. linker_flags=
  5983. dllsearchpath=
  5984. lib_search_path=`pwd`
  5985. inst_prefix_dir=
  5986. new_inherited_linker_flags=
  5987. avoid_version=no
  5988. bindir=
  5989. dlfiles=
  5990. dlprefiles=
  5991. dlself=no
  5992. export_dynamic=no
  5993. export_symbols=
  5994. export_symbols_regex=
  5995. generated=
  5996. libobjs=
  5997. ltlibs=
  5998. module=no
  5999. no_install=no
  6000. objs=
  6001. os2dllname=
  6002. non_pic_objects=
  6003. precious_files_regex=
  6004. prefer_static_libs=no
  6005. preload=false
  6006. prev=
  6007. prevarg=
  6008. release=
  6009. rpath=
  6010. xrpath=
  6011. perm_rpath=
  6012. temp_rpath=
  6013. temp_rpath_tail=
  6014. thread_safe=no
  6015. vinfo=
  6016. vinfo_number=no
  6017. weak_libs=
  6018. rpath_arg=
  6019. single_module=$wl-single_module
  6020. func_infer_tag $base_compile
  6021. # We need to know -static, to get the right output filenames.
  6022. for arg
  6023. do
  6024. case $arg in
  6025. -shared)
  6026. test yes != "$build_libtool_libs" \
  6027. && func_fatal_configuration "cannot build a shared library"
  6028. build_old_libs=no
  6029. break
  6030. ;;
  6031. -all-static | -static | -static-libtool-libs)
  6032. case $arg in
  6033. -all-static)
  6034. if test yes = "$build_libtool_libs" && test -z "$link_static_flag"; then
  6035. func_warning "complete static linking is impossible in this configuration"
  6036. fi
  6037. if test -n "$link_static_flag"; then
  6038. dlopen_self=$dlopen_self_static
  6039. fi
  6040. prefer_static_libs=yes
  6041. ;;
  6042. -static)
  6043. if test -z "$pic_flag" && test -n "$link_static_flag"; then
  6044. dlopen_self=$dlopen_self_static
  6045. fi
  6046. prefer_static_libs=built
  6047. ;;
  6048. -static-libtool-libs)
  6049. if test -z "$pic_flag" && test -n "$link_static_flag"; then
  6050. dlopen_self=$dlopen_self_static
  6051. fi
  6052. prefer_static_libs=yes
  6053. ;;
  6054. esac
  6055. build_libtool_libs=no
  6056. build_old_libs=yes
  6057. break
  6058. ;;
  6059. esac
  6060. done
  6061. # See if our shared archives depend on static archives.
  6062. test -n "$old_archive_from_new_cmds" && build_old_libs=yes
  6063. # Go through the arguments, transforming them on the way.
  6064. while test "$#" -gt 0; do
  6065. arg=$1
  6066. shift
  6067. func_quote_arg pretty,unquoted "$arg"
  6068. qarg=$func_quote_arg_unquoted_result
  6069. func_append libtool_args " $func_quote_arg_result"
  6070. # If the previous option needs an argument, assign it.
  6071. if test -n "$prev"; then
  6072. case $prev in
  6073. output)
  6074. func_append compile_command " @OUTPUT@"
  6075. func_append finalize_command " @OUTPUT@"
  6076. ;;
  6077. esac
  6078. case $prev in
  6079. bindir)
  6080. bindir=$arg
  6081. prev=
  6082. continue
  6083. ;;
  6084. dlfiles|dlprefiles)
  6085. $preload || {
  6086. # Add the symbol object into the linking commands.
  6087. func_append compile_command " @SYMFILE@"
  6088. func_append finalize_command " @SYMFILE@"
  6089. preload=:
  6090. }
  6091. case $arg in
  6092. *.la | *.lo) ;; # We handle these cases below.
  6093. force)
  6094. if test no = "$dlself"; then
  6095. dlself=needless
  6096. export_dynamic=yes
  6097. fi
  6098. prev=
  6099. continue
  6100. ;;
  6101. self)
  6102. if test dlprefiles = "$prev"; then
  6103. dlself=yes
  6104. elif test dlfiles = "$prev" && test yes != "$dlopen_self"; then
  6105. dlself=yes
  6106. else
  6107. dlself=needless
  6108. export_dynamic=yes
  6109. fi
  6110. prev=
  6111. continue
  6112. ;;
  6113. *)
  6114. if test dlfiles = "$prev"; then
  6115. func_append dlfiles " $arg"
  6116. else
  6117. func_append dlprefiles " $arg"
  6118. fi
  6119. prev=
  6120. continue
  6121. ;;
  6122. esac
  6123. ;;
  6124. expsyms)
  6125. export_symbols=$arg
  6126. test -f "$arg" \
  6127. || func_fatal_error "symbol file '$arg' does not exist"
  6128. prev=
  6129. continue
  6130. ;;
  6131. expsyms_regex)
  6132. export_symbols_regex=$arg
  6133. prev=
  6134. continue
  6135. ;;
  6136. framework)
  6137. case $host in
  6138. *-*-darwin*)
  6139. case "$deplibs " in
  6140. *" $qarg.ltframework "*) ;;
  6141. *) func_append deplibs " $qarg.ltframework" # this is fixed later
  6142. ;;
  6143. esac
  6144. ;;
  6145. esac
  6146. prev=
  6147. continue
  6148. ;;
  6149. inst_prefix)
  6150. inst_prefix_dir=$arg
  6151. prev=
  6152. continue
  6153. ;;
  6154. mllvm)
  6155. # Clang does not use LLVM to link, so we can simply discard any
  6156. # '-mllvm $arg' options when doing the link step.
  6157. prev=
  6158. continue
  6159. ;;
  6160. objectlist)
  6161. if test -f "$arg"; then
  6162. save_arg=$arg
  6163. moreargs=
  6164. for fil in `cat "$save_arg"`
  6165. do
  6166. # func_append moreargs " $fil"
  6167. arg=$fil
  6168. # A libtool-controlled object.
  6169. # Check to see that this really is a libtool object.
  6170. if func_lalib_unsafe_p "$arg"; then
  6171. pic_object=
  6172. non_pic_object=
  6173. # Read the .lo file
  6174. func_source "$arg"
  6175. if test -z "$pic_object" ||
  6176. test -z "$non_pic_object" ||
  6177. test none = "$pic_object" &&
  6178. test none = "$non_pic_object"; then
  6179. func_fatal_error "cannot find name of object for '$arg'"
  6180. fi
  6181. # Extract subdirectory from the argument.
  6182. func_dirname "$arg" "/" ""
  6183. xdir=$func_dirname_result
  6184. if test none != "$pic_object"; then
  6185. # Prepend the subdirectory the object is found in.
  6186. pic_object=$xdir$pic_object
  6187. if test dlfiles = "$prev"; then
  6188. if test yes = "$build_libtool_libs" && test yes = "$dlopen_support"; then
  6189. func_append dlfiles " $pic_object"
  6190. prev=
  6191. continue
  6192. else
  6193. # If libtool objects are unsupported, then we need to preload.
  6194. prev=dlprefiles
  6195. fi
  6196. fi
  6197. # CHECK ME: I think I busted this. -Ossama
  6198. if test dlprefiles = "$prev"; then
  6199. # Preload the old-style object.
  6200. func_append dlprefiles " $pic_object"
  6201. prev=
  6202. fi
  6203. # A PIC object.
  6204. func_append libobjs " $pic_object"
  6205. arg=$pic_object
  6206. fi
  6207. # Non-PIC object.
  6208. if test none != "$non_pic_object"; then
  6209. # Prepend the subdirectory the object is found in.
  6210. non_pic_object=$xdir$non_pic_object
  6211. # A standard non-PIC object
  6212. func_append non_pic_objects " $non_pic_object"
  6213. if test -z "$pic_object" || test none = "$pic_object"; then
  6214. arg=$non_pic_object
  6215. fi
  6216. else
  6217. # If the PIC object exists, use it instead.
  6218. # $xdir was prepended to $pic_object above.
  6219. non_pic_object=$pic_object
  6220. func_append non_pic_objects " $non_pic_object"
  6221. fi
  6222. else
  6223. # Only an error if not doing a dry-run.
  6224. if $opt_dry_run; then
  6225. # Extract subdirectory from the argument.
  6226. func_dirname "$arg" "/" ""
  6227. xdir=$func_dirname_result
  6228. func_lo2o "$arg"
  6229. pic_object=$xdir$objdir/$func_lo2o_result
  6230. non_pic_object=$xdir$func_lo2o_result
  6231. func_append libobjs " $pic_object"
  6232. func_append non_pic_objects " $non_pic_object"
  6233. else
  6234. func_fatal_error "'$arg' is not a valid libtool object"
  6235. fi
  6236. fi
  6237. done
  6238. else
  6239. func_fatal_error "link input file '$arg' does not exist"
  6240. fi
  6241. arg=$save_arg
  6242. prev=
  6243. continue
  6244. ;;
  6245. os2dllname)
  6246. os2dllname=$arg
  6247. prev=
  6248. continue
  6249. ;;
  6250. precious_regex)
  6251. precious_files_regex=$arg
  6252. prev=
  6253. continue
  6254. ;;
  6255. release)
  6256. release=-$arg
  6257. prev=
  6258. continue
  6259. ;;
  6260. rpath | xrpath)
  6261. # We need an absolute path.
  6262. case $arg in
  6263. [\\/]* | [A-Za-z]:[\\/]*) ;;
  6264. *)
  6265. func_fatal_error "argument to -rpath is not absolute: $arg"
  6266. ;;
  6267. esac
  6268. if test rpath = "$prev"; then
  6269. case "$rpath " in
  6270. *" $arg "*) ;;
  6271. *) func_append rpath " $arg" ;;
  6272. esac
  6273. else
  6274. case "$xrpath " in
  6275. *" $arg "*) ;;
  6276. *) func_append xrpath " $arg" ;;
  6277. esac
  6278. fi
  6279. prev=
  6280. continue
  6281. ;;
  6282. shrext)
  6283. shrext_cmds=$arg
  6284. prev=
  6285. continue
  6286. ;;
  6287. weak)
  6288. func_append weak_libs " $arg"
  6289. prev=
  6290. continue
  6291. ;;
  6292. xassembler)
  6293. func_append compiler_flags " -Xassembler $qarg"
  6294. prev=
  6295. func_append compile_command " -Xassembler $qarg"
  6296. func_append finalize_command " -Xassembler $qarg"
  6297. continue
  6298. ;;
  6299. xcclinker)
  6300. func_append linker_flags " $qarg"
  6301. func_append compiler_flags " $qarg"
  6302. prev=
  6303. func_append compile_command " $qarg"
  6304. func_append finalize_command " $qarg"
  6305. continue
  6306. ;;
  6307. xcompiler)
  6308. func_append compiler_flags " $qarg"
  6309. prev=
  6310. func_append compile_command " $qarg"
  6311. func_append finalize_command " $qarg"
  6312. continue
  6313. ;;
  6314. xlinker)
  6315. func_append linker_flags " $qarg"
  6316. func_append compiler_flags " $wl$qarg"
  6317. prev=
  6318. func_append compile_command " $wl$qarg"
  6319. func_append finalize_command " $wl$qarg"
  6320. continue
  6321. ;;
  6322. *)
  6323. eval "$prev=\"\$arg\""
  6324. prev=
  6325. continue
  6326. ;;
  6327. esac
  6328. fi # test -n "$prev"
  6329. prevarg=$arg
  6330. case $arg in
  6331. -all-static)
  6332. if test -n "$link_static_flag"; then
  6333. # See comment for -static flag below, for more details.
  6334. func_append compile_command " $link_static_flag"
  6335. func_append finalize_command " $link_static_flag"
  6336. fi
  6337. continue
  6338. ;;
  6339. -allow-undefined)
  6340. # FIXME: remove this flag sometime in the future.
  6341. func_fatal_error "'-allow-undefined' must not be used because it is the default"
  6342. ;;
  6343. -avoid-version)
  6344. avoid_version=yes
  6345. continue
  6346. ;;
  6347. -bindir)
  6348. prev=bindir
  6349. continue
  6350. ;;
  6351. -dlopen)
  6352. prev=dlfiles
  6353. continue
  6354. ;;
  6355. -dlpreopen)
  6356. prev=dlprefiles
  6357. continue
  6358. ;;
  6359. -export-dynamic)
  6360. export_dynamic=yes
  6361. continue
  6362. ;;
  6363. -export-symbols | -export-symbols-regex)
  6364. if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
  6365. func_fatal_error "more than one -exported-symbols argument is not allowed"
  6366. fi
  6367. if test X-export-symbols = "X$arg"; then
  6368. prev=expsyms
  6369. else
  6370. prev=expsyms_regex
  6371. fi
  6372. continue
  6373. ;;
  6374. -framework)
  6375. prev=framework
  6376. continue
  6377. ;;
  6378. -inst-prefix-dir)
  6379. prev=inst_prefix
  6380. continue
  6381. ;;
  6382. # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
  6383. # so, if we see these flags be careful not to treat them like -L
  6384. -L[A-Z][A-Z]*:*)
  6385. case $with_gcc/$host in
  6386. no/*-*-irix* | /*-*-irix*)
  6387. func_append compile_command " $arg"
  6388. func_append finalize_command " $arg"
  6389. ;;
  6390. esac
  6391. continue
  6392. ;;
  6393. -L*)
  6394. func_stripname "-L" '' "$arg"
  6395. if test -z "$func_stripname_result"; then
  6396. if test "$#" -gt 0; then
  6397. func_fatal_error "require no space between '-L' and '$1'"
  6398. else
  6399. func_fatal_error "need path for '-L' option"
  6400. fi
  6401. fi
  6402. func_resolve_sysroot "$func_stripname_result"
  6403. dir=$func_resolve_sysroot_result
  6404. # We need an absolute path.
  6405. case $dir in
  6406. [\\/]* | [A-Za-z]:[\\/]*) ;;
  6407. *)
  6408. absdir=`cd "$dir" && pwd`
  6409. test -z "$absdir" && \
  6410. func_fatal_error "cannot determine absolute directory name of '$dir'"
  6411. dir=$absdir
  6412. ;;
  6413. esac
  6414. case "$deplibs " in
  6415. *" -L$dir "* | *" $arg "*)
  6416. # Will only happen for absolute or sysroot arguments
  6417. ;;
  6418. *)
  6419. # Preserve sysroot, but never include relative directories
  6420. case $dir in
  6421. [\\/]* | [A-Za-z]:[\\/]* | =*) func_append deplibs " $arg" ;;
  6422. *) func_append deplibs " -L$dir" ;;
  6423. esac
  6424. func_append lib_search_path " $dir"
  6425. ;;
  6426. esac
  6427. case $host in
  6428. *-*-cygwin* | *-*-mingw* | *-*-windows* | *-*-pw32* | *-*-os2* | *-cegcc*)
  6429. testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'`
  6430. case :$dllsearchpath: in
  6431. *":$dir:"*) ;;
  6432. ::) dllsearchpath=$dir;;
  6433. *) func_append dllsearchpath ":$dir";;
  6434. esac
  6435. case :$dllsearchpath: in
  6436. *":$testbindir:"*) ;;
  6437. ::) dllsearchpath=$testbindir;;
  6438. *) func_append dllsearchpath ":$testbindir";;
  6439. esac
  6440. ;;
  6441. esac
  6442. continue
  6443. ;;
  6444. -l*)
  6445. if test X-lc = "X$arg" || test X-lm = "X$arg"; then
  6446. case $host in
  6447. *-*-cygwin* | *-*-mingw* | *-*-windows* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*)
  6448. # These systems don't actually have a C or math library (as such)
  6449. continue
  6450. ;;
  6451. *-*-os2*)
  6452. # These systems don't actually have a C library (as such)
  6453. test X-lc = "X$arg" && continue
  6454. ;;
  6455. *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-midnightbsd*)
  6456. # Do not include libc due to us having libc/libc_r.
  6457. test X-lc = "X$arg" && continue
  6458. ;;
  6459. *-*-rhapsody* | *-*-darwin1.[012])
  6460. # Rhapsody C and math libraries are in the System framework
  6461. func_append deplibs " System.ltframework"
  6462. continue
  6463. ;;
  6464. *-*-sco3.2v5* | *-*-sco5v6*)
  6465. # Causes problems with __ctype
  6466. test X-lc = "X$arg" && continue
  6467. ;;
  6468. *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
  6469. # Compiler inserts libc in the correct place for threads to work
  6470. test X-lc = "X$arg" && continue
  6471. ;;
  6472. esac
  6473. elif test X-lc_r = "X$arg"; then
  6474. case $host in
  6475. *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-midnightbsd*)
  6476. # Do not include libc_r directly, use -pthread flag.
  6477. continue
  6478. ;;
  6479. esac
  6480. fi
  6481. func_append deplibs " $arg"
  6482. continue
  6483. ;;
  6484. -mllvm)
  6485. prev=mllvm
  6486. continue
  6487. ;;
  6488. -module)
  6489. module=yes
  6490. continue
  6491. ;;
  6492. # Tru64 UNIX uses -model [arg] to determine the layout of C++
  6493. # classes, name mangling, and exception handling.
  6494. # Darwin uses the -arch flag to determine output architecture.
  6495. # -q <option> for IBM XL C/C++ compiler.
  6496. -model|-arch|-isysroot|--sysroot|-q)
  6497. func_append compiler_flags " $arg"
  6498. func_append compile_command " $arg"
  6499. func_append finalize_command " $arg"
  6500. prev=xcompiler
  6501. continue
  6502. ;;
  6503. # Solaris ld rejects as of 11.4. Refer to Oracle bug 22985199.
  6504. -pthread)
  6505. case $host in
  6506. *solaris2*) ;;
  6507. *)
  6508. case "$new_inherited_linker_flags " in
  6509. *" $arg "*) ;;
  6510. * ) func_append new_inherited_linker_flags " $arg" ;;
  6511. esac
  6512. ;;
  6513. esac
  6514. continue
  6515. ;;
  6516. -mt|-mthreads|-kthread|-Kthread|-pthreads|--thread-safe \
  6517. |-threads|-fopenmp|-fopenmp=*|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
  6518. func_append compiler_flags " $arg"
  6519. func_append compile_command " $arg"
  6520. func_append finalize_command " $arg"
  6521. case "$new_inherited_linker_flags " in
  6522. *" $arg "*) ;;
  6523. * ) func_append new_inherited_linker_flags " $arg" ;;
  6524. esac
  6525. # As we are forced to pass -nostdlib to g++ during linking, the option
  6526. # -pthread{,s} is not in effect; add the -lpthread to $deplist
  6527. # explicitly to link correctly.
  6528. if test "$tagname" = CXX -a x"$with_gcc" = xyes; then
  6529. case "$arg" in
  6530. -pthread*) func_append deplibs " -lpthread" ;;
  6531. esac
  6532. fi
  6533. continue
  6534. ;;
  6535. -multi_module)
  6536. single_module=$wl-multi_module
  6537. continue
  6538. ;;
  6539. -no-fast-install)
  6540. fast_install=no
  6541. continue
  6542. ;;
  6543. -no-install)
  6544. case $host in
  6545. *-*-cygwin* | *-*-mingw* | *-*-windows* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*)
  6546. # The PATH hackery in wrapper scripts is required on Windows
  6547. # and Darwin in order for the loader to find any dlls it needs.
  6548. func_warning "'-no-install' is ignored for $host"
  6549. func_warning "assuming '-no-fast-install' instead"
  6550. fast_install=no
  6551. ;;
  6552. *) no_install=yes ;;
  6553. esac
  6554. continue
  6555. ;;
  6556. -no-undefined)
  6557. allow_undefined=no
  6558. continue
  6559. ;;
  6560. -objectlist)
  6561. prev=objectlist
  6562. continue
  6563. ;;
  6564. -os2dllname)
  6565. prev=os2dllname
  6566. continue
  6567. ;;
  6568. -o) prev=output ;;
  6569. -precious-files-regex)
  6570. prev=precious_regex
  6571. continue
  6572. ;;
  6573. -release)
  6574. prev=release
  6575. continue
  6576. ;;
  6577. -rpath)
  6578. prev=rpath
  6579. continue
  6580. ;;
  6581. -R)
  6582. prev=xrpath
  6583. continue
  6584. ;;
  6585. -R*)
  6586. func_stripname '-R' '' "$arg"
  6587. dir=$func_stripname_result
  6588. # We need an absolute path.
  6589. case $dir in
  6590. [\\/]* | [A-Za-z]:[\\/]*) ;;
  6591. =*)
  6592. func_stripname '=' '' "$dir"
  6593. dir=$lt_sysroot$func_stripname_result
  6594. ;;
  6595. *)
  6596. func_fatal_error "argument ($arg) to '-R' is not an absolute path: $dir"
  6597. ;;
  6598. esac
  6599. case "$xrpath " in
  6600. *" $dir "*) ;;
  6601. *) func_append xrpath " $dir" ;;
  6602. esac
  6603. continue
  6604. ;;
  6605. -shared)
  6606. # The effects of -shared are defined in a previous loop.
  6607. continue
  6608. ;;
  6609. -shrext)
  6610. prev=shrext
  6611. continue
  6612. ;;
  6613. -static | -static-libtool-libs)
  6614. # The effects of -static are defined in a previous loop.
  6615. # We used to do the same as -all-static on platforms that
  6616. # didn't have a PIC flag, but the assumption that the effects
  6617. # would be equivalent was wrong. It would break on at least
  6618. # Digital Unix and AIX.
  6619. continue
  6620. ;;
  6621. -thread-safe)
  6622. thread_safe=yes
  6623. continue
  6624. ;;
  6625. -version-info)
  6626. prev=vinfo
  6627. continue
  6628. ;;
  6629. -version-number)
  6630. prev=vinfo
  6631. vinfo_number=yes
  6632. continue
  6633. ;;
  6634. -weak)
  6635. prev=weak
  6636. continue
  6637. ;;
  6638. -Wc,*)
  6639. func_stripname '-Wc,' '' "$arg"
  6640. args=$func_stripname_result
  6641. arg=
  6642. save_ifs=$IFS; IFS=,
  6643. for flag in $args; do
  6644. IFS=$save_ifs
  6645. func_quote_arg pretty "$flag"
  6646. func_append arg " $func_quote_arg_result"
  6647. func_append compiler_flags " $func_quote_arg_result"
  6648. done
  6649. IFS=$save_ifs
  6650. func_stripname ' ' '' "$arg"
  6651. arg=$func_stripname_result
  6652. ;;
  6653. -Wl,*)
  6654. func_stripname '-Wl,' '' "$arg"
  6655. args=$func_stripname_result
  6656. arg=
  6657. save_ifs=$IFS; IFS=,
  6658. for flag in $args; do
  6659. IFS=$save_ifs
  6660. func_quote_arg pretty "$flag"
  6661. func_append arg " $wl$func_quote_arg_result"
  6662. func_append compiler_flags " $wl$func_quote_arg_result"
  6663. func_append linker_flags " $func_quote_arg_result"
  6664. done
  6665. IFS=$save_ifs
  6666. func_stripname ' ' '' "$arg"
  6667. arg=$func_stripname_result
  6668. ;;
  6669. -Xassembler)
  6670. prev=xassembler
  6671. continue
  6672. ;;
  6673. -Xcompiler)
  6674. prev=xcompiler
  6675. continue
  6676. ;;
  6677. -Xlinker)
  6678. prev=xlinker
  6679. continue
  6680. ;;
  6681. -XCClinker)
  6682. prev=xcclinker
  6683. continue
  6684. ;;
  6685. # -msg_* for osf cc
  6686. -msg_*)
  6687. func_quote_arg pretty "$arg"
  6688. arg=$func_quote_arg_result
  6689. ;;
  6690. # Flags to be passed through unchanged, with rationale:
  6691. # -64, -mips[0-9] enable 64-bit mode for the SGI compiler
  6692. # -r[0-9][0-9]* specify processor for the SGI compiler
  6693. # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler
  6694. # +DA*, +DD* enable 64-bit mode for the HP compiler
  6695. # -q* compiler args for the IBM compiler
  6696. # -m*, -t[45]*, -txscale* architecture-specific flags for GCC
  6697. # -F/path path to uninstalled frameworks, gcc on darwin
  6698. # -p, -pg, --coverage, -fprofile-* profiling flags for GCC
  6699. # -fstack-protector* stack protector flags for GCC
  6700. # @file GCC response files
  6701. # -tp=* Portland pgcc target processor selection
  6702. # --sysroot=* for sysroot support
  6703. # -O*, -g*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization
  6704. # -specs=* GCC specs files
  6705. # -stdlib=* select c++ std lib with clang
  6706. # -fdiagnostics-color* simply affects output
  6707. # -frecord-gcc-switches used to verify flags were respected
  6708. # -fsanitize=* Clang/GCC memory and address sanitizer
  6709. # -fno-sanitize* Clang/GCC memory and address sanitizer
  6710. # -shared-libsan Link with shared sanitizer runtimes (Clang)
  6711. # -static-libsan Link with static sanitizer runtimes (Clang)
  6712. # -no-canonical-prefixes Do not expand any symbolic links
  6713. # -fuse-ld=* Linker select flags for GCC
  6714. # -static-* direct GCC to link specific libraries statically
  6715. # -fcilkplus Cilk Plus language extension features for C/C++
  6716. # -rtlib=* select c runtime lib with clang
  6717. # --unwindlib=* select unwinder library with clang
  6718. # -f{file|debug|macro|profile}-prefix-map=* needed for lto linking
  6719. # -Wa,* Pass flags directly to the assembler
  6720. # -Werror, -Werror=* Report (specified) warnings as errors
  6721. -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
  6722. -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \
  6723. -O*|-g*|-flto*|-fwhopr*|-fuse-linker-plugin|-fstack-protector*|-no-canonical-prefixes| \
  6724. -stdlib=*|-rtlib=*|--unwindlib=*| \
  6725. -specs=*|-fsanitize=*|-fno-sanitize*|-shared-libsan|-static-libsan| \
  6726. -ffile-prefix-map=*|-fdebug-prefix-map=*|-fmacro-prefix-map=*|-fprofile-prefix-map=*| \
  6727. -fdiagnostics-color*|-frecord-gcc-switches| \
  6728. -fuse-ld=*|-static-*|-fcilkplus|-Wa,*|-Werror|-Werror=*)
  6729. func_quote_arg pretty "$arg"
  6730. arg=$func_quote_arg_result
  6731. func_append compile_command " $arg"
  6732. func_append finalize_command " $arg"
  6733. func_append compiler_flags " $arg"
  6734. continue
  6735. ;;
  6736. -Z*)
  6737. if test os2 = "`expr $host : '.*\(os2\)'`"; then
  6738. # OS/2 uses -Zxxx to specify OS/2-specific options
  6739. compiler_flags="$compiler_flags $arg"
  6740. func_append compile_command " $arg"
  6741. func_append finalize_command " $arg"
  6742. case $arg in
  6743. -Zlinker | -Zstack)
  6744. prev=xcompiler
  6745. ;;
  6746. esac
  6747. continue
  6748. else
  6749. # Otherwise treat like 'Some other compiler flag' below
  6750. func_quote_arg pretty "$arg"
  6751. arg=$func_quote_arg_result
  6752. fi
  6753. ;;
  6754. # Some other compiler flag.
  6755. -* | +*)
  6756. func_quote_arg pretty "$arg"
  6757. arg=$func_quote_arg_result
  6758. ;;
  6759. *.$objext)
  6760. # A standard object.
  6761. func_append objs " $arg"
  6762. ;;
  6763. *.lo)
  6764. # A libtool-controlled object.
  6765. # Check to see that this really is a libtool object.
  6766. if func_lalib_unsafe_p "$arg"; then
  6767. pic_object=
  6768. non_pic_object=
  6769. # Read the .lo file
  6770. func_source "$arg"
  6771. if test -z "$pic_object" ||
  6772. test -z "$non_pic_object" ||
  6773. test none = "$pic_object" &&
  6774. test none = "$non_pic_object"; then
  6775. func_fatal_error "cannot find name of object for '$arg'"
  6776. fi
  6777. # Extract subdirectory from the argument.
  6778. func_dirname "$arg" "/" ""
  6779. xdir=$func_dirname_result
  6780. test none = "$pic_object" || {
  6781. # Prepend the subdirectory the object is found in.
  6782. pic_object=$xdir$pic_object
  6783. if test dlfiles = "$prev"; then
  6784. if test yes = "$build_libtool_libs" && test yes = "$dlopen_support"; then
  6785. func_append dlfiles " $pic_object"
  6786. prev=
  6787. continue
  6788. else
  6789. # If libtool objects are unsupported, then we need to preload.
  6790. prev=dlprefiles
  6791. fi
  6792. fi
  6793. # CHECK ME: I think I busted this. -Ossama
  6794. if test dlprefiles = "$prev"; then
  6795. # Preload the old-style object.
  6796. func_append dlprefiles " $pic_object"
  6797. prev=
  6798. fi
  6799. # A PIC object.
  6800. func_append libobjs " $pic_object"
  6801. arg=$pic_object
  6802. }
  6803. # Non-PIC object.
  6804. if test none != "$non_pic_object"; then
  6805. # Prepend the subdirectory the object is found in.
  6806. non_pic_object=$xdir$non_pic_object
  6807. # A standard non-PIC object
  6808. func_append non_pic_objects " $non_pic_object"
  6809. if test -z "$pic_object" || test none = "$pic_object"; then
  6810. arg=$non_pic_object
  6811. fi
  6812. else
  6813. # If the PIC object exists, use it instead.
  6814. # $xdir was prepended to $pic_object above.
  6815. non_pic_object=$pic_object
  6816. func_append non_pic_objects " $non_pic_object"
  6817. fi
  6818. else
  6819. # Only an error if not doing a dry-run.
  6820. if $opt_dry_run; then
  6821. # Extract subdirectory from the argument.
  6822. func_dirname "$arg" "/" ""
  6823. xdir=$func_dirname_result
  6824. func_lo2o "$arg"
  6825. pic_object=$xdir$objdir/$func_lo2o_result
  6826. non_pic_object=$xdir$func_lo2o_result
  6827. func_append libobjs " $pic_object"
  6828. func_append non_pic_objects " $non_pic_object"
  6829. else
  6830. func_fatal_error "'$arg' is not a valid libtool object"
  6831. fi
  6832. fi
  6833. ;;
  6834. *.$libext)
  6835. # An archive.
  6836. func_append deplibs " $arg"
  6837. func_append old_deplibs " $arg"
  6838. continue
  6839. ;;
  6840. *.la)
  6841. # A libtool-controlled library.
  6842. func_resolve_sysroot "$arg"
  6843. if test dlfiles = "$prev"; then
  6844. # This library was specified with -dlopen.
  6845. func_append dlfiles " $func_resolve_sysroot_result"
  6846. prev=
  6847. elif test dlprefiles = "$prev"; then
  6848. # The library was specified with -dlpreopen.
  6849. func_append dlprefiles " $func_resolve_sysroot_result"
  6850. prev=
  6851. else
  6852. func_append deplibs " $func_resolve_sysroot_result"
  6853. fi
  6854. continue
  6855. ;;
  6856. # Some other compiler argument.
  6857. *)
  6858. # Unknown arguments in both finalize_command and compile_command need
  6859. # to be aesthetically quoted because they are evaled later.
  6860. func_quote_arg pretty "$arg"
  6861. arg=$func_quote_arg_result
  6862. ;;
  6863. esac # arg
  6864. # Now actually substitute the argument into the commands.
  6865. if test -n "$arg"; then
  6866. if test -n "$rpath_arg"; then
  6867. func_append finalize_rpath " ${arg##*,}"
  6868. unset rpath_arg
  6869. else
  6870. case $arg in
  6871. -Wl,-rpath,*)
  6872. func_append finalize_rpath " ${arg##*,}";;
  6873. -Wl,-rpath)
  6874. rpath_arg=1;;
  6875. *)
  6876. func_append compile_command " $arg"
  6877. func_append finalize_command " $arg"
  6878. esac
  6879. fi
  6880. fi
  6881. done # argument parsing loop
  6882. test -n "$prev" && \
  6883. func_fatal_help "the '$prevarg' option requires an argument"
  6884. if test yes = "$export_dynamic" && test -n "$export_dynamic_flag_spec"; then
  6885. eval arg=\"$export_dynamic_flag_spec\"
  6886. func_append compile_command " $arg"
  6887. func_append finalize_command " $arg"
  6888. fi
  6889. oldlibs=
  6890. # calculate the name of the file, without its directory
  6891. func_basename "$output"
  6892. outputname=$func_basename_result
  6893. libobjs_save=$libobjs
  6894. if test -n "$shlibpath_var"; then
  6895. # get the directories listed in $shlibpath_var
  6896. eval shlib_search_path=\`\$ECHO \"\$$shlibpath_var\" \| \$SED \'s/:/ /g\'\`
  6897. else
  6898. shlib_search_path=
  6899. fi
  6900. eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
  6901. eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
  6902. # Definition is injected by LT_CONFIG during libtool generation.
  6903. func_munge_path_list sys_lib_dlsearch_path "$LT_SYS_LIBRARY_PATH"
  6904. func_dirname "$output" "/" ""
  6905. output_objdir=$func_dirname_result$objdir
  6906. func_to_tool_file "$output_objdir/"
  6907. tool_output_objdir=$func_to_tool_file_result
  6908. # Create the object directory.
  6909. func_mkdir_p "$output_objdir"
  6910. # Determine the type of output
  6911. case $output in
  6912. "")
  6913. func_fatal_help "you must specify an output file"
  6914. ;;
  6915. *.$libext) linkmode=oldlib ;;
  6916. *.lo | *.$objext) linkmode=obj ;;
  6917. *.la) linkmode=lib ;;
  6918. *) linkmode=prog ;; # Anything else should be a program.
  6919. esac
  6920. specialdeplibs=
  6921. libs=
  6922. # Find all interdependent deplibs by searching for libraries
  6923. # that are linked more than once (e.g. -la -lb -la)
  6924. for deplib in $deplibs; do
  6925. if $opt_preserve_dup_deps; then
  6926. case "$libs " in
  6927. *" $deplib "*) func_append specialdeplibs " $deplib" ;;
  6928. esac
  6929. fi
  6930. func_append libs " $deplib"
  6931. done
  6932. if test lib = "$linkmode"; then
  6933. libs="$predeps $libs $compiler_lib_search_path $postdeps"
  6934. # Compute libraries that are listed more than once in $predeps
  6935. # $postdeps and mark them as special (i.e., whose duplicates are
  6936. # not to be eliminated).
  6937. pre_post_deps=
  6938. if $opt_duplicate_compiler_generated_deps; then
  6939. for pre_post_dep in $predeps $postdeps; do
  6940. case "$pre_post_deps " in
  6941. *" $pre_post_dep "*) func_append specialdeplibs " $pre_post_deps" ;;
  6942. esac
  6943. func_append pre_post_deps " $pre_post_dep"
  6944. done
  6945. fi
  6946. pre_post_deps=
  6947. fi
  6948. deplibs=
  6949. newdependency_libs=
  6950. newlib_search_path=
  6951. need_relink=no # whether we're linking any uninstalled libtool libraries
  6952. notinst_deplibs= # not-installed libtool libraries
  6953. notinst_path= # paths that contain not-installed libtool libraries
  6954. case $linkmode in
  6955. lib)
  6956. passes="conv dlpreopen link"
  6957. for file in $dlfiles $dlprefiles; do
  6958. case $file in
  6959. *.la) ;;
  6960. *)
  6961. func_fatal_help "libraries can '-dlopen' only libtool libraries: $file"
  6962. ;;
  6963. esac
  6964. done
  6965. ;;
  6966. prog)
  6967. compile_deplibs=
  6968. finalize_deplibs=
  6969. alldeplibs=false
  6970. newdlfiles=
  6971. newdlprefiles=
  6972. passes="conv scan dlopen dlpreopen link"
  6973. ;;
  6974. *) passes="conv"
  6975. ;;
  6976. esac
  6977. for pass in $passes; do
  6978. # The preopen pass in lib mode reverses $deplibs; put it back here
  6979. # so that -L comes before libs that need it for instance...
  6980. if test lib,link = "$linkmode,$pass"; then
  6981. ## FIXME: Find the place where the list is rebuilt in the wrong
  6982. ## order, and fix it there properly
  6983. tmp_deplibs=
  6984. for deplib in $deplibs; do
  6985. tmp_deplibs="$deplib $tmp_deplibs"
  6986. done
  6987. deplibs=$tmp_deplibs
  6988. fi
  6989. if test lib,link = "$linkmode,$pass" ||
  6990. test prog,scan = "$linkmode,$pass"; then
  6991. libs=$deplibs
  6992. deplibs=
  6993. fi
  6994. if test prog = "$linkmode"; then
  6995. case $pass in
  6996. dlopen) libs=$dlfiles ;;
  6997. dlpreopen) libs=$dlprefiles ;;
  6998. link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
  6999. esac
  7000. fi
  7001. if test lib,dlpreopen = "$linkmode,$pass"; then
  7002. # Collect and forward deplibs of preopened libtool libs
  7003. for lib in $dlprefiles; do
  7004. # Ignore non-libtool-libs
  7005. dependency_libs=
  7006. func_resolve_sysroot "$lib"
  7007. case $lib in
  7008. *.la) func_source "$func_resolve_sysroot_result" ;;
  7009. esac
  7010. # Collect preopened libtool deplibs, except any this library
  7011. # has declared as weak libs
  7012. for deplib in $dependency_libs; do
  7013. func_basename "$deplib"
  7014. deplib_base=$func_basename_result
  7015. case " $weak_libs " in
  7016. *" $deplib_base "*) ;;
  7017. *) func_append deplibs " $deplib" ;;
  7018. esac
  7019. done
  7020. done
  7021. libs=$dlprefiles
  7022. fi
  7023. if test dlopen = "$pass"; then
  7024. # Collect dlpreopened libraries
  7025. save_deplibs=$deplibs
  7026. deplibs=
  7027. fi
  7028. for deplib in $libs; do
  7029. lib=
  7030. found=false
  7031. case $deplib in
  7032. -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
  7033. |-threads|-fopenmp|-fopenmp=*|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
  7034. if test prog,link = "$linkmode,$pass"; then
  7035. compile_deplibs="$deplib $compile_deplibs"
  7036. finalize_deplibs="$deplib $finalize_deplibs"
  7037. else
  7038. func_append compiler_flags " $deplib"
  7039. if test lib = "$linkmode"; then
  7040. case "$new_inherited_linker_flags " in
  7041. *" $deplib "*) ;;
  7042. * ) func_append new_inherited_linker_flags " $deplib" ;;
  7043. esac
  7044. fi
  7045. fi
  7046. continue
  7047. ;;
  7048. -l*)
  7049. if test lib != "$linkmode" && test prog != "$linkmode"; then
  7050. func_warning "'-l' is ignored for archives/objects"
  7051. continue
  7052. fi
  7053. func_stripname '-l' '' "$deplib"
  7054. name=$func_stripname_result
  7055. if test lib = "$linkmode"; then
  7056. searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path"
  7057. else
  7058. searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path"
  7059. fi
  7060. for searchdir in $searchdirs; do
  7061. for search_ext in .la $std_shrext .so .a; do
  7062. # Search the libtool library
  7063. lib=$searchdir/lib$name$search_ext
  7064. if test -f "$lib"; then
  7065. if test .la = "$search_ext"; then
  7066. found=:
  7067. else
  7068. found=false
  7069. fi
  7070. break 2
  7071. fi
  7072. done
  7073. done
  7074. if $found; then
  7075. # deplib is a libtool library
  7076. # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
  7077. # We need to do some special things here, and not later.
  7078. if test yes = "$allow_libtool_libs_with_static_runtimes"; then
  7079. case " $predeps $postdeps " in
  7080. *" $deplib "*)
  7081. if func_lalib_p "$lib"; then
  7082. library_names=
  7083. old_library=
  7084. func_source "$lib"
  7085. for l in $old_library $library_names; do
  7086. ll=$l
  7087. done
  7088. if test "X$ll" = "X$old_library"; then # only static version available
  7089. found=false
  7090. func_dirname "$lib" "" "."
  7091. ladir=$func_dirname_result
  7092. lib=$ladir/$old_library
  7093. if test prog,link = "$linkmode,$pass"; then
  7094. compile_deplibs="$deplib $compile_deplibs"
  7095. finalize_deplibs="$deplib $finalize_deplibs"
  7096. else
  7097. deplibs="$deplib $deplibs"
  7098. test lib = "$linkmode" && newdependency_libs="$deplib $newdependency_libs"
  7099. fi
  7100. continue
  7101. fi
  7102. fi
  7103. ;;
  7104. *) ;;
  7105. esac
  7106. fi
  7107. else
  7108. # deplib doesn't seem to be a libtool library
  7109. if test prog,link = "$linkmode,$pass"; then
  7110. compile_deplibs="$deplib $compile_deplibs"
  7111. finalize_deplibs="$deplib $finalize_deplibs"
  7112. else
  7113. deplibs="$deplib $deplibs"
  7114. test lib = "$linkmode" && newdependency_libs="$deplib $newdependency_libs"
  7115. fi
  7116. continue
  7117. fi
  7118. ;; # -l
  7119. *.ltframework)
  7120. if test prog,link = "$linkmode,$pass"; then
  7121. compile_deplibs="$deplib $compile_deplibs"
  7122. finalize_deplibs="$deplib $finalize_deplibs"
  7123. else
  7124. deplibs="$deplib $deplibs"
  7125. if test lib = "$linkmode"; then
  7126. case "$new_inherited_linker_flags " in
  7127. *" $deplib "*) ;;
  7128. * ) func_append new_inherited_linker_flags " $deplib" ;;
  7129. esac
  7130. fi
  7131. fi
  7132. continue
  7133. ;;
  7134. -L*)
  7135. case $linkmode in
  7136. lib)
  7137. deplibs="$deplib $deplibs"
  7138. test conv = "$pass" && continue
  7139. newdependency_libs="$deplib $newdependency_libs"
  7140. func_stripname '-L' '' "$deplib"
  7141. func_resolve_sysroot "$func_stripname_result"
  7142. func_append newlib_search_path " $func_resolve_sysroot_result"
  7143. ;;
  7144. prog)
  7145. if test conv = "$pass"; then
  7146. deplibs="$deplib $deplibs"
  7147. continue
  7148. fi
  7149. if test scan = "$pass"; then
  7150. deplibs="$deplib $deplibs"
  7151. else
  7152. compile_deplibs="$deplib $compile_deplibs"
  7153. finalize_deplibs="$deplib $finalize_deplibs"
  7154. fi
  7155. func_stripname '-L' '' "$deplib"
  7156. func_resolve_sysroot "$func_stripname_result"
  7157. func_append newlib_search_path " $func_resolve_sysroot_result"
  7158. ;;
  7159. *)
  7160. func_warning "'-L' is ignored for archives/objects"
  7161. ;;
  7162. esac # linkmode
  7163. continue
  7164. ;; # -L
  7165. -R*)
  7166. if test link = "$pass"; then
  7167. func_stripname '-R' '' "$deplib"
  7168. func_resolve_sysroot "$func_stripname_result"
  7169. dir=$func_resolve_sysroot_result
  7170. # Make sure the xrpath contains only unique directories.
  7171. case "$xrpath " in
  7172. *" $dir "*) ;;
  7173. *) func_append xrpath " $dir" ;;
  7174. esac
  7175. fi
  7176. deplibs="$deplib $deplibs"
  7177. continue
  7178. ;;
  7179. *.la)
  7180. func_resolve_sysroot "$deplib"
  7181. lib=$func_resolve_sysroot_result
  7182. ;;
  7183. *.$libext)
  7184. if test conv = "$pass"; then
  7185. deplibs="$deplib $deplibs"
  7186. continue
  7187. fi
  7188. case $linkmode in
  7189. lib)
  7190. # Linking convenience modules into shared libraries is allowed,
  7191. # but linking other static libraries is non-portable.
  7192. case " $dlpreconveniencelibs " in
  7193. *" $deplib "*) ;;
  7194. *)
  7195. valid_a_lib=false
  7196. case $deplibs_check_method in
  7197. match_pattern*)
  7198. set dummy $deplibs_check_method; shift
  7199. match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
  7200. if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \
  7201. | $EGREP "$match_pattern_regex" > /dev/null; then
  7202. valid_a_lib=:
  7203. fi
  7204. ;;
  7205. pass_all)
  7206. valid_a_lib=:
  7207. ;;
  7208. esac
  7209. if $valid_a_lib; then
  7210. func_warning "Linking the shared library $output against the static library $deplib is not portable!"
  7211. deplibs="$deplib $deplibs"
  7212. else
  7213. func_warning "Trying to link with static lib archive $deplib."
  7214. func_warning "I have the capability to make that library automatically link in when"
  7215. func_warning "you link to this library. But I can only do this if you have a"
  7216. func_warning "shared version of the library, which you do not appear to have"
  7217. func_warning "because the file extensions .$libext of this argument makes me believe"
  7218. func_warning "that it is just a static archive that I should not use here."
  7219. fi
  7220. ;;
  7221. esac
  7222. continue
  7223. ;;
  7224. prog)
  7225. if test link != "$pass"; then
  7226. deplibs="$deplib $deplibs"
  7227. else
  7228. compile_deplibs="$deplib $compile_deplibs"
  7229. finalize_deplibs="$deplib $finalize_deplibs"
  7230. fi
  7231. continue
  7232. ;;
  7233. esac # linkmode
  7234. ;; # *.$libext
  7235. *.lo | *.$objext)
  7236. if test conv = "$pass"; then
  7237. deplibs="$deplib $deplibs"
  7238. elif test prog = "$linkmode"; then
  7239. if test dlpreopen = "$pass" || test yes != "$dlopen_support" || test no = "$build_libtool_libs"; then
  7240. # If there is no dlopen support or we're linking statically,
  7241. # we need to preload.
  7242. func_append newdlprefiles " $deplib"
  7243. compile_deplibs="$deplib $compile_deplibs"
  7244. finalize_deplibs="$deplib $finalize_deplibs"
  7245. else
  7246. func_append newdlfiles " $deplib"
  7247. fi
  7248. fi
  7249. continue
  7250. ;;
  7251. %DEPLIBS%)
  7252. alldeplibs=:
  7253. continue
  7254. ;;
  7255. esac # case $deplib
  7256. $found || test -f "$lib" \
  7257. || func_fatal_error "cannot find the library '$lib' or unhandled argument '$deplib'"
  7258. # Check to see that this really is a libtool archive.
  7259. func_lalib_unsafe_p "$lib" \
  7260. || func_fatal_error "'$lib' is not a valid libtool archive"
  7261. func_dirname "$lib" "" "."
  7262. ladir=$func_dirname_result
  7263. dlname=
  7264. dlopen=
  7265. dlpreopen=
  7266. libdir=
  7267. library_names=
  7268. old_library=
  7269. inherited_linker_flags=
  7270. # If the library was installed with an old release of libtool,
  7271. # it will not redefine variables installed, or shouldnotlink
  7272. installed=yes
  7273. shouldnotlink=no
  7274. avoidtemprpath=
  7275. # Read the .la file
  7276. func_source "$lib"
  7277. # Convert "-framework foo" to "foo.ltframework"
  7278. if test -n "$inherited_linker_flags"; then
  7279. tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'`
  7280. for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do
  7281. case " $new_inherited_linker_flags " in
  7282. *" $tmp_inherited_linker_flag "*) ;;
  7283. *) func_append new_inherited_linker_flags " $tmp_inherited_linker_flag";;
  7284. esac
  7285. done
  7286. fi
  7287. dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
  7288. if test lib,link = "$linkmode,$pass" ||
  7289. test prog,scan = "$linkmode,$pass" ||
  7290. { test prog != "$linkmode" && test lib != "$linkmode"; }; then
  7291. test -n "$dlopen" && func_append dlfiles " $dlopen"
  7292. test -n "$dlpreopen" && func_append dlprefiles " $dlpreopen"
  7293. fi
  7294. if test conv = "$pass"; then
  7295. # Only check for convenience libraries
  7296. deplibs="$lib $deplibs"
  7297. if test -z "$libdir"; then
  7298. if test -z "$old_library"; then
  7299. func_fatal_error "cannot find name of link library for '$lib'"
  7300. fi
  7301. # It is a libtool convenience library, so add in its objects.
  7302. func_append convenience " $ladir/$objdir/$old_library"
  7303. func_append old_convenience " $ladir/$objdir/$old_library"
  7304. elif test prog != "$linkmode" && test lib != "$linkmode"; then
  7305. func_fatal_error "'$lib' is not a convenience library"
  7306. fi
  7307. tmp_libs=
  7308. for deplib in $dependency_libs; do
  7309. deplibs="$deplib $deplibs"
  7310. if $opt_preserve_dup_deps; then
  7311. case "$tmp_libs " in
  7312. *" $deplib "*) func_append specialdeplibs " $deplib" ;;
  7313. esac
  7314. fi
  7315. func_append tmp_libs " $deplib"
  7316. done
  7317. continue
  7318. fi # $pass = conv
  7319. # Get the name of the library we link against.
  7320. linklib=
  7321. if test -n "$old_library" &&
  7322. { test yes = "$prefer_static_libs" ||
  7323. test built,no = "$prefer_static_libs,$installed"; }; then
  7324. linklib=$old_library
  7325. else
  7326. for l in $old_library $library_names; do
  7327. linklib=$l
  7328. done
  7329. fi
  7330. if test -z "$linklib"; then
  7331. func_fatal_error "cannot find name of link library for '$lib'"
  7332. fi
  7333. # This library was specified with -dlopen.
  7334. if test dlopen = "$pass"; then
  7335. test -z "$libdir" \
  7336. && func_fatal_error "cannot -dlopen a convenience library: '$lib'"
  7337. if test -z "$dlname" ||
  7338. test yes != "$dlopen_support" ||
  7339. test no = "$build_libtool_libs"
  7340. then
  7341. # If there is no dlname, no dlopen support or we're linking
  7342. # statically, we need to preload. We also need to preload any
  7343. # dependent libraries so libltdl's deplib preloader doesn't
  7344. # bomb out in the load deplibs phase.
  7345. func_append dlprefiles " $lib $dependency_libs"
  7346. else
  7347. func_append newdlfiles " $lib"
  7348. fi
  7349. continue
  7350. fi # $pass = dlopen
  7351. # We need an absolute path.
  7352. case $ladir in
  7353. [\\/]* | [A-Za-z]:[\\/]*) abs_ladir=$ladir ;;
  7354. *)
  7355. abs_ladir=`cd "$ladir" && pwd`
  7356. if test -z "$abs_ladir"; then
  7357. func_warning "cannot determine absolute directory name of '$ladir'"
  7358. func_warning "passing it literally to the linker, although it might fail"
  7359. abs_ladir=$ladir
  7360. fi
  7361. ;;
  7362. esac
  7363. func_basename "$lib"
  7364. laname=$func_basename_result
  7365. # Find the relevant object directory and library name.
  7366. if test yes = "$installed"; then
  7367. if test ! -f "$lt_sysroot$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
  7368. func_warning "library '$lib' was moved."
  7369. dir=$ladir
  7370. absdir=$abs_ladir
  7371. libdir=$abs_ladir
  7372. else
  7373. dir=$lt_sysroot$libdir
  7374. absdir=$lt_sysroot$libdir
  7375. fi
  7376. test yes = "$hardcode_automatic" && avoidtemprpath=yes
  7377. else
  7378. if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
  7379. dir=$ladir
  7380. absdir=$abs_ladir
  7381. # Remove this search path later
  7382. func_append notinst_path " $abs_ladir"
  7383. else
  7384. dir=$ladir/$objdir
  7385. absdir=$abs_ladir/$objdir
  7386. # Remove this search path later
  7387. func_append notinst_path " $abs_ladir"
  7388. fi
  7389. fi # $installed = yes
  7390. func_stripname 'lib' '.la' "$laname"
  7391. name=$func_stripname_result
  7392. # This library was specified with -dlpreopen.
  7393. if test dlpreopen = "$pass"; then
  7394. if test -z "$libdir" && test prog = "$linkmode"; then
  7395. func_fatal_error "only libraries may -dlpreopen a convenience library: '$lib'"
  7396. fi
  7397. case $host in
  7398. # special handling for platforms with PE-DLLs.
  7399. *cygwin* | *mingw* | *windows* | *cegcc* )
  7400. # Linker will automatically link against shared library if both
  7401. # static and shared are present. Therefore, ensure we extract
  7402. # symbols from the import library if a shared library is present
  7403. # (otherwise, the dlopen module name will be incorrect). We do
  7404. # this by putting the import library name into $newdlprefiles.
  7405. # We recover the dlopen module name by 'saving' the la file
  7406. # name in a special purpose variable, and (later) extracting the
  7407. # dlname from the la file.
  7408. if test -n "$dlname"; then
  7409. func_tr_sh "$dir/$linklib"
  7410. eval "libfile_$func_tr_sh_result=\$abs_ladir/\$laname"
  7411. func_append newdlprefiles " $dir/$linklib"
  7412. else
  7413. func_append newdlprefiles " $dir/$old_library"
  7414. # Keep a list of preopened convenience libraries to check
  7415. # that they are being used correctly in the link pass.
  7416. test -z "$libdir" && \
  7417. func_append dlpreconveniencelibs " $dir/$old_library"
  7418. fi
  7419. ;;
  7420. * )
  7421. # Prefer using a static library (so that no silly _DYNAMIC symbols
  7422. # are required to link).
  7423. if test -n "$old_library"; then
  7424. func_append newdlprefiles " $dir/$old_library"
  7425. # Keep a list of preopened convenience libraries to check
  7426. # that they are being used correctly in the link pass.
  7427. test -z "$libdir" && \
  7428. func_append dlpreconveniencelibs " $dir/$old_library"
  7429. # Otherwise, use the dlname, so that lt_dlopen finds it.
  7430. elif test -n "$dlname"; then
  7431. func_append newdlprefiles " $dir/$dlname"
  7432. else
  7433. func_append newdlprefiles " $dir/$linklib"
  7434. fi
  7435. ;;
  7436. esac
  7437. fi # $pass = dlpreopen
  7438. if test -z "$libdir"; then
  7439. # Link the convenience library
  7440. if test lib = "$linkmode"; then
  7441. deplibs="$dir/$old_library $deplibs"
  7442. elif test prog,link = "$linkmode,$pass"; then
  7443. compile_deplibs="$dir/$old_library $compile_deplibs"
  7444. finalize_deplibs="$dir/$old_library $finalize_deplibs"
  7445. else
  7446. deplibs="$lib $deplibs" # used for prog,scan pass
  7447. fi
  7448. continue
  7449. fi
  7450. if test prog = "$linkmode" && test link != "$pass"; then
  7451. func_append newlib_search_path " $ladir"
  7452. deplibs="$lib $deplibs"
  7453. linkalldeplibs=false
  7454. if test no != "$link_all_deplibs" || test -z "$library_names" ||
  7455. test no = "$build_libtool_libs"; then
  7456. linkalldeplibs=:
  7457. fi
  7458. tmp_libs=
  7459. for deplib in $dependency_libs; do
  7460. case $deplib in
  7461. -L*) func_stripname '-L' '' "$deplib"
  7462. func_resolve_sysroot "$func_stripname_result"
  7463. func_append newlib_search_path " $func_resolve_sysroot_result"
  7464. ;;
  7465. esac
  7466. # Need to link against all dependency_libs?
  7467. if $linkalldeplibs; then
  7468. deplibs="$deplib $deplibs"
  7469. else
  7470. # Need to hardcode shared library paths
  7471. # or/and link against static libraries
  7472. newdependency_libs="$deplib $newdependency_libs"
  7473. fi
  7474. if $opt_preserve_dup_deps; then
  7475. case "$tmp_libs " in
  7476. *" $deplib "*) func_append specialdeplibs " $deplib" ;;
  7477. esac
  7478. fi
  7479. func_append tmp_libs " $deplib"
  7480. done # for deplib
  7481. continue
  7482. fi # $linkmode = prog...
  7483. if test prog,link = "$linkmode,$pass"; then
  7484. if test -n "$library_names" &&
  7485. { { test no = "$prefer_static_libs" ||
  7486. test built,yes = "$prefer_static_libs,$installed"; } ||
  7487. test -z "$old_library"; }; then
  7488. # We need to hardcode the library path
  7489. if test -n "$shlibpath_var" && test -z "$avoidtemprpath"; then
  7490. # Make sure the rpath contains only unique directories.
  7491. case $temp_rpath: in
  7492. *"$absdir:"*) ;;
  7493. *) case $absdir in
  7494. "$progdir/"*) func_append temp_rpath "$absdir:" ;;
  7495. *) func_append temp_rpath_tail "$absdir:" ;;
  7496. esac
  7497. esac
  7498. fi
  7499. # Hardcode the library path.
  7500. # Skip directories that are in the system default run-time
  7501. # search path.
  7502. case " $sys_lib_dlsearch_path " in
  7503. *" $absdir "*) ;;
  7504. *)
  7505. case "$compile_rpath$compile_rpath_tail " in
  7506. *" $absdir "*) ;;
  7507. *) case $absdir in
  7508. "$progdir/"*) func_append compile_rpath " $absdir" ;;
  7509. *) func_append compile_rpath_tail " $absdir" ;;
  7510. esac
  7511. esac
  7512. ;;
  7513. esac
  7514. case " $sys_lib_dlsearch_path " in
  7515. *" $libdir "*) ;;
  7516. *)
  7517. case "$finalize_rpath " in
  7518. *" $libdir "*) ;;
  7519. *) func_append finalize_rpath " $libdir" ;;
  7520. esac
  7521. ;;
  7522. esac
  7523. fi # $linkmode,$pass = prog,link...
  7524. if $alldeplibs &&
  7525. { test pass_all = "$deplibs_check_method" ||
  7526. { test yes = "$build_libtool_libs" &&
  7527. test -n "$library_names"; }; }; then
  7528. # We only need to search for static libraries
  7529. continue
  7530. fi
  7531. fi
  7532. link_static=no # Whether the deplib will be linked statically
  7533. use_static_libs=$prefer_static_libs
  7534. if test built = "$use_static_libs" && test yes = "$installed"; then
  7535. use_static_libs=no
  7536. fi
  7537. if test -n "$library_names" &&
  7538. { test no = "$use_static_libs" || test -z "$old_library"; }; then
  7539. case $host_os in
  7540. cygwin* | mingw* | windows* | cegcc* | os2*)
  7541. # No point in relinking DLLs because paths are not encoded
  7542. func_append notinst_deplibs " $lib"
  7543. need_relink=no
  7544. ;;
  7545. *)
  7546. if test no = "$installed"; then
  7547. func_append notinst_deplibs " $lib"
  7548. need_relink=yes
  7549. fi
  7550. ;;
  7551. esac
  7552. # This is a shared library
  7553. # Warn about portability, can't link against -module's on some
  7554. # systems (darwin). Don't bleat about dlopened modules though!
  7555. dlopenmodule=
  7556. for dlpremoduletest in $dlprefiles; do
  7557. if test "X$dlpremoduletest" = "X$lib"; then
  7558. dlopenmodule=$dlpremoduletest
  7559. break
  7560. fi
  7561. done
  7562. if test -z "$dlopenmodule" && test yes = "$shouldnotlink" && test link = "$pass"; then
  7563. echo
  7564. if test prog = "$linkmode"; then
  7565. func_warning "Linking the executable $output against the loadable module"
  7566. else
  7567. func_warning "Linking the shared library $output against the loadable module"
  7568. fi
  7569. func_warning "$linklib is not portable!"
  7570. fi
  7571. if test lib = "$linkmode" &&
  7572. test yes = "$hardcode_into_libs"; then
  7573. # Hardcode the library path.
  7574. # Skip directories that are in the system default run-time
  7575. # search path.
  7576. case " $sys_lib_dlsearch_path " in
  7577. *" $absdir "*) ;;
  7578. *)
  7579. case "$compile_rpath$compile_rpath_tail " in
  7580. *" $absdir "*) ;;
  7581. *) case $absdir in
  7582. "$progdir/"*) func_append compile_rpath " $absdir" ;;
  7583. *) func_append compile_rpath_tail " $absdir" ;;
  7584. esac
  7585. esac
  7586. ;;
  7587. esac
  7588. case " $sys_lib_dlsearch_path " in
  7589. *" $libdir "*) ;;
  7590. *)
  7591. case "$finalize_rpath " in
  7592. *" $libdir "*) ;;
  7593. *) func_append finalize_rpath " $libdir" ;;
  7594. esac
  7595. ;;
  7596. esac
  7597. fi
  7598. if test -n "$old_archive_from_expsyms_cmds"; then
  7599. # figure out the soname
  7600. set dummy $library_names
  7601. shift
  7602. realname=$1
  7603. shift
  7604. libname=`eval "\\$ECHO \"$libname_spec\""`
  7605. # use dlname if we got it. it's perfectly good, no?
  7606. if test -n "$dlname"; then
  7607. soname=$dlname
  7608. elif test -n "$soname_spec"; then
  7609. # bleh windows
  7610. case $host_os in
  7611. cygwin* | mingw* | windows* | cegcc* | os2*)
  7612. func_arith $current - $age
  7613. major=$func_arith_result
  7614. versuffix=-$major
  7615. ;;
  7616. esac
  7617. eval soname=\"$soname_spec\"
  7618. else
  7619. soname=$realname
  7620. fi
  7621. # Make a new name for the extract_expsyms_cmds to use
  7622. soroot=$soname
  7623. func_basename "$soroot"
  7624. soname=$func_basename_result
  7625. func_stripname 'lib' '.dll' "$soname"
  7626. newlib=libimp-$func_stripname_result.a
  7627. # If the library has no export list, then create one now
  7628. if test -f "$output_objdir/$soname-def"; then :
  7629. else
  7630. func_verbose "extracting exported symbol list from '$soname'"
  7631. func_execute_cmds "$extract_expsyms_cmds" 'exit $?'
  7632. fi
  7633. # Create $newlib
  7634. if test -f "$output_objdir/$newlib"; then :; else
  7635. func_verbose "generating import library for '$soname'"
  7636. func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?'
  7637. fi
  7638. # make sure the library variables are pointing to the new library
  7639. dir=$output_objdir
  7640. linklib=$newlib
  7641. fi # test -n "$old_archive_from_expsyms_cmds"
  7642. if test prog = "$linkmode" || test relink != "$opt_mode"; then
  7643. add_shlibpath=
  7644. add_dir=
  7645. add=
  7646. lib_linked=yes
  7647. case $hardcode_action in
  7648. immediate | unsupported)
  7649. if test no = "$hardcode_direct"; then
  7650. add=$dir/$linklib
  7651. case $host in
  7652. *-*-sco3.2v5.0.[024]*) add_dir=-L$dir ;;
  7653. *-*-sysv4*uw2*) add_dir=-L$dir ;;
  7654. *-*-emscripten*) add_dir=-L$dir ;;
  7655. *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
  7656. *-*-unixware7*) add_dir=-L$dir ;;
  7657. *-*-darwin* )
  7658. # if the lib is a (non-dlopened) module then we cannot
  7659. # link against it, someone is ignoring the earlier warnings
  7660. if /usr/bin/file -L $add 2> /dev/null |
  7661. $GREP ": [^:]* bundle" >/dev/null; then
  7662. if test "X$dlopenmodule" != "X$lib"; then
  7663. func_warning "lib $linklib is a module, not a shared library"
  7664. if test -z "$old_library"; then
  7665. func_warning "And there doesn't seem to be a static archive available"
  7666. func_warning "The link will probably fail, sorry"
  7667. else
  7668. add=$dir/$old_library
  7669. fi
  7670. elif test -n "$old_library"; then
  7671. add=$dir/$old_library
  7672. fi
  7673. fi
  7674. esac
  7675. elif test no = "$hardcode_minus_L"; then
  7676. case $host in
  7677. *-*-sunos*) add_shlibpath=$dir ;;
  7678. esac
  7679. add_dir=-L$dir
  7680. add=-l$name
  7681. elif test no = "$hardcode_shlibpath_var"; then
  7682. add_shlibpath=$dir
  7683. add=-l$name
  7684. else
  7685. lib_linked=no
  7686. fi
  7687. ;;
  7688. relink)
  7689. if test yes = "$hardcode_direct" &&
  7690. test no = "$hardcode_direct_absolute"; then
  7691. add=$dir/$linklib
  7692. elif test yes = "$hardcode_minus_L"; then
  7693. add_dir=-L$absdir
  7694. # Try looking first in the location we're being installed to.
  7695. if test -n "$inst_prefix_dir"; then
  7696. case $libdir in
  7697. [\\/]*)
  7698. func_append add_dir " -L$inst_prefix_dir$libdir"
  7699. ;;
  7700. esac
  7701. fi
  7702. add=-l$name
  7703. elif test yes = "$hardcode_shlibpath_var"; then
  7704. add_shlibpath=$dir
  7705. add=-l$name
  7706. else
  7707. lib_linked=no
  7708. fi
  7709. ;;
  7710. *) lib_linked=no ;;
  7711. esac
  7712. if test yes != "$lib_linked"; then
  7713. func_fatal_configuration "unsupported hardcode properties"
  7714. fi
  7715. if test -n "$add_shlibpath"; then
  7716. case :$compile_shlibpath: in
  7717. *":$add_shlibpath:"*) ;;
  7718. *) func_append compile_shlibpath "$add_shlibpath:" ;;
  7719. esac
  7720. fi
  7721. if test prog = "$linkmode"; then
  7722. test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
  7723. test -n "$add" && compile_deplibs="$add $compile_deplibs"
  7724. else
  7725. test -n "$add_dir" && deplibs="$add_dir $deplibs"
  7726. test -n "$add" && deplibs="$add $deplibs"
  7727. if test yes != "$hardcode_direct" &&
  7728. test yes != "$hardcode_minus_L" &&
  7729. test yes = "$hardcode_shlibpath_var"; then
  7730. case :$finalize_shlibpath: in
  7731. *":$libdir:"*) ;;
  7732. *) func_append finalize_shlibpath "$libdir:" ;;
  7733. esac
  7734. fi
  7735. fi
  7736. fi
  7737. if test prog = "$linkmode" || test relink = "$opt_mode"; then
  7738. add_shlibpath=
  7739. add_dir=
  7740. add=
  7741. # Finalize command for both is simple: just hardcode it.
  7742. if test yes = "$hardcode_direct" &&
  7743. test no = "$hardcode_direct_absolute"; then
  7744. add=$libdir/$linklib
  7745. elif test yes = "$hardcode_minus_L"; then
  7746. add_dir=-L$lt_sysroot$libdir
  7747. add=-l$name
  7748. elif test yes = "$hardcode_shlibpath_var"; then
  7749. case :$finalize_shlibpath: in
  7750. *":$libdir:"*) ;;
  7751. *) func_append finalize_shlibpath "$libdir:" ;;
  7752. esac
  7753. add=-l$name
  7754. elif test yes = "$hardcode_automatic"; then
  7755. if test -n "$inst_prefix_dir" &&
  7756. test -f "$inst_prefix_dir$libdir/$linklib"; then
  7757. add=$inst_prefix_dir$libdir/$linklib
  7758. else
  7759. add=$libdir/$linklib
  7760. fi
  7761. else
  7762. # We cannot seem to hardcode it, guess we'll fake it.
  7763. add_dir=-L$lt_sysroot$libdir
  7764. # Try looking first in the location we're being installed to.
  7765. if test -n "$inst_prefix_dir"; then
  7766. case $libdir in
  7767. [\\/]*)
  7768. func_append add_dir " -L$inst_prefix_dir$libdir"
  7769. ;;
  7770. esac
  7771. fi
  7772. add=-l$name
  7773. fi
  7774. if test prog = "$linkmode"; then
  7775. test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
  7776. test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
  7777. else
  7778. test -n "$add_dir" && deplibs="$add_dir $deplibs"
  7779. test -n "$add" && deplibs="$add $deplibs"
  7780. fi
  7781. fi
  7782. elif test prog = "$linkmode"; then
  7783. # Here we assume that one of hardcode_direct or hardcode_minus_L
  7784. # is not unsupported. This is valid on all known static and
  7785. # shared platforms.
  7786. if test unsupported != "$hardcode_direct"; then
  7787. test -n "$old_library" && linklib=$old_library
  7788. compile_deplibs="$dir/$linklib $compile_deplibs"
  7789. finalize_deplibs="$dir/$linklib $finalize_deplibs"
  7790. else
  7791. compile_deplibs="-l$name -L$dir $compile_deplibs"
  7792. finalize_deplibs="-l$name -L$dir $finalize_deplibs"
  7793. fi
  7794. elif test yes = "$build_libtool_libs"; then
  7795. # Not a shared library
  7796. if test pass_all != "$deplibs_check_method"; then
  7797. # We're trying link a shared library against a static one
  7798. # but the system doesn't support it.
  7799. # Just print a warning and add the library to dependency_libs so
  7800. # that the program can be linked against the static library.
  7801. func_warning "This system cannot link to static lib archive $lib."
  7802. func_warning "I have the capability to make that library automatically link in when"
  7803. func_warning "you link to this library. But I can only do this if you have a"
  7804. func_warning "shared version of the library, which you do not appear to have."
  7805. if test yes = "$module"; then
  7806. func_warning "But as you try to build a module library, libtool will still create "
  7807. func_warning "a static module, that should work as long as the dlopening application"
  7808. func_warning "is linked with the -dlopen flag to resolve symbols at runtime."
  7809. if test -z "$global_symbol_pipe"; then
  7810. func_warning "However, this would only work if libtool was able to extract symbol"
  7811. func_warning "lists from a program, using 'nm' or equivalent, but libtool could"
  7812. func_warning "not find such a program. So, this module is probably useless."
  7813. func_warning "'nm' from GNU binutils and a full rebuild may help."
  7814. fi
  7815. if test no = "$build_old_libs"; then
  7816. build_libtool_libs=module
  7817. build_old_libs=yes
  7818. else
  7819. build_libtool_libs=no
  7820. fi
  7821. fi
  7822. else
  7823. deplibs="$dir/$old_library $deplibs"
  7824. link_static=yes
  7825. fi
  7826. fi # link shared/static library?
  7827. if test lib = "$linkmode"; then
  7828. if test -n "$dependency_libs" &&
  7829. { test yes != "$hardcode_into_libs" ||
  7830. test yes = "$build_old_libs" ||
  7831. test yes = "$link_static"; }; then
  7832. # Extract -R from dependency_libs
  7833. temp_deplibs=
  7834. for libdir in $dependency_libs; do
  7835. case $libdir in
  7836. -R*) func_stripname '-R' '' "$libdir"
  7837. temp_xrpath=$func_stripname_result
  7838. case " $xrpath " in
  7839. *" $temp_xrpath "*) ;;
  7840. *) func_append xrpath " $temp_xrpath";;
  7841. esac;;
  7842. *) func_append temp_deplibs " $libdir";;
  7843. esac
  7844. done
  7845. dependency_libs=$temp_deplibs
  7846. fi
  7847. func_append newlib_search_path " $absdir"
  7848. # Link against this library
  7849. test no = "$link_static" && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
  7850. # ... and its dependency_libs
  7851. tmp_libs=
  7852. for deplib in $dependency_libs; do
  7853. newdependency_libs="$deplib $newdependency_libs"
  7854. case $deplib in
  7855. -L*) func_stripname '-L' '' "$deplib"
  7856. func_resolve_sysroot "$func_stripname_result";;
  7857. *) func_resolve_sysroot "$deplib" ;;
  7858. esac
  7859. if $opt_preserve_dup_deps; then
  7860. case "$tmp_libs " in
  7861. *" $func_resolve_sysroot_result "*)
  7862. func_append specialdeplibs " $func_resolve_sysroot_result" ;;
  7863. esac
  7864. fi
  7865. func_append tmp_libs " $func_resolve_sysroot_result"
  7866. done
  7867. if test no != "$link_all_deplibs"; then
  7868. # Add the search paths of all dependency libraries
  7869. for deplib in $dependency_libs; do
  7870. path=
  7871. case $deplib in
  7872. -L*) path=$deplib ;;
  7873. *.la)
  7874. func_resolve_sysroot "$deplib"
  7875. deplib=$func_resolve_sysroot_result
  7876. func_dirname "$deplib" "" "."
  7877. dir=$func_dirname_result
  7878. # We need an absolute path.
  7879. case $dir in
  7880. [\\/]* | [A-Za-z]:[\\/]*) absdir=$dir ;;
  7881. *)
  7882. absdir=`cd "$dir" && pwd`
  7883. if test -z "$absdir"; then
  7884. func_warning "cannot determine absolute directory name of '$dir'"
  7885. absdir=$dir
  7886. fi
  7887. ;;
  7888. esac
  7889. if $GREP "^installed=no" $deplib > /dev/null; then
  7890. case $host in
  7891. *-*-darwin*)
  7892. depdepl=
  7893. eval deplibrary_names=`$SED -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
  7894. if test -n "$deplibrary_names"; then
  7895. for tmp in $deplibrary_names; do
  7896. depdepl=$tmp
  7897. done
  7898. if test -f "$absdir/$objdir/$depdepl"; then
  7899. depdepl=$absdir/$objdir/$depdepl
  7900. darwin_install_name=`$OTOOL -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
  7901. if test -z "$darwin_install_name"; then
  7902. darwin_install_name=`$OTOOL64 -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
  7903. fi
  7904. func_append compiler_flags " $wl-dylib_file $wl$darwin_install_name:$depdepl"
  7905. func_append linker_flags " -dylib_file $darwin_install_name:$depdepl"
  7906. path=
  7907. fi
  7908. fi
  7909. ;;
  7910. *)
  7911. path=-L$absdir/$objdir
  7912. ;;
  7913. esac
  7914. else
  7915. eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
  7916. test -z "$libdir" && \
  7917. func_fatal_error "'$deplib' is not a valid libtool archive"
  7918. test "$absdir" != "$libdir" && \
  7919. func_warning "'$deplib' seems to be moved"
  7920. path=-L$absdir
  7921. fi
  7922. ;;
  7923. esac
  7924. case " $deplibs " in
  7925. *" $path "*) ;;
  7926. *) deplibs="$path $deplibs" ;;
  7927. esac
  7928. done
  7929. fi # link_all_deplibs != no
  7930. fi # linkmode = lib
  7931. done # for deplib in $libs
  7932. func_append temp_rpath "$temp_rpath_tail"
  7933. func_append compile_rpath "$compile_rpath_tail"
  7934. if test link = "$pass"; then
  7935. if test prog = "$linkmode"; then
  7936. compile_deplibs="$new_inherited_linker_flags $compile_deplibs"
  7937. finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs"
  7938. else
  7939. compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
  7940. fi
  7941. fi
  7942. dependency_libs=$newdependency_libs
  7943. if test dlpreopen = "$pass"; then
  7944. # Link the dlpreopened libraries before other libraries
  7945. for deplib in $save_deplibs; do
  7946. deplibs="$deplib $deplibs"
  7947. done
  7948. fi
  7949. if test dlopen != "$pass"; then
  7950. test conv = "$pass" || {
  7951. # Make sure lib_search_path contains only unique directories.
  7952. lib_search_path=
  7953. for dir in $newlib_search_path; do
  7954. case "$lib_search_path " in
  7955. *" $dir "*) ;;
  7956. *) func_append lib_search_path " $dir" ;;
  7957. esac
  7958. done
  7959. newlib_search_path=
  7960. }
  7961. if test prog,link = "$linkmode,$pass"; then
  7962. vars="compile_deplibs finalize_deplibs"
  7963. else
  7964. vars=deplibs
  7965. fi
  7966. for var in $vars dependency_libs; do
  7967. # Add libraries to $var in reverse order
  7968. eval tmp_libs=\"\$$var\"
  7969. new_libs=
  7970. # FIXME: Pedantically, this is the right thing to do, so
  7971. # that some nasty dependency loop isn't accidentally
  7972. # broken: new_libs="$deplib $new_libs"
  7973. for deplib in $tmp_libs; do
  7974. if $opt_preserve_dup_deps; then
  7975. new_libs="$deplib $new_libs"
  7976. else
  7977. # Pragmatically, this seems to cause very few problems in
  7978. # practice:
  7979. case $deplib in
  7980. -L*) new_libs="$deplib $new_libs" ;;
  7981. -R*) ;;
  7982. *)
  7983. # And here is the reason: when a library appears more
  7984. # than once as an explicit dependence of a library, or
  7985. # is implicitly linked in more than once by the
  7986. # compiler, it is considered special, and multiple
  7987. # occurrences thereof are not removed. Compare this
  7988. # with having the same library being listed as a
  7989. # dependency of multiple other libraries: in this case,
  7990. # we know (pedantically, we assume) the library does not
  7991. # need to be listed more than once, so we keep only the
  7992. # last copy. This is not always right, but it is rare
  7993. # enough that we require users that really mean to play
  7994. # such unportable linking tricks to link the library
  7995. # using -Wl,-lname, so that libtool does not consider it
  7996. # for duplicate removal. And if not possible for portability
  7997. # reasons, then --preserve-dup-deps should be used.
  7998. case " $specialdeplibs " in
  7999. *" $deplib "*) new_libs="$deplib $new_libs" ;;
  8000. *)
  8001. case " $new_libs " in
  8002. *" $deplib "*) ;;
  8003. *) new_libs="$deplib $new_libs" ;;
  8004. esac
  8005. ;;
  8006. esac
  8007. ;;
  8008. esac
  8009. fi
  8010. done
  8011. tmp_libs=
  8012. for deplib in $new_libs; do
  8013. case $deplib in
  8014. -L*)
  8015. case " $tmp_libs " in
  8016. *" $deplib "*) ;;
  8017. *) func_append tmp_libs " $deplib" ;;
  8018. esac
  8019. ;;
  8020. *) func_append tmp_libs " $deplib" ;;
  8021. esac
  8022. done
  8023. eval $var=\"$tmp_libs\"
  8024. done # for var
  8025. fi
  8026. # Add Sun CC postdeps if required:
  8027. test CXX = "$tagname" && {
  8028. case $host_os in
  8029. linux*)
  8030. case `$CC -V 2>&1 | $SED 5q` in
  8031. *Sun\ C*) # Sun C++ 5.9
  8032. func_suncc_cstd_abi
  8033. if test no != "$suncc_use_cstd_abi"; then
  8034. func_append postdeps ' -library=Cstd -library=Crun'
  8035. fi
  8036. ;;
  8037. esac
  8038. ;;
  8039. solaris*)
  8040. func_cc_basename "$CC"
  8041. case $func_cc_basename_result in
  8042. CC* | sunCC*)
  8043. func_suncc_cstd_abi
  8044. if test no != "$suncc_use_cstd_abi"; then
  8045. func_append postdeps ' -library=Cstd -library=Crun'
  8046. fi
  8047. ;;
  8048. esac
  8049. ;;
  8050. esac
  8051. }
  8052. # Last step: remove runtime libs from dependency_libs
  8053. # (they stay in deplibs)
  8054. tmp_libs=
  8055. for i in $dependency_libs; do
  8056. case " $predeps $postdeps $compiler_lib_search_path " in
  8057. *" $i "*)
  8058. i=
  8059. ;;
  8060. esac
  8061. if test -n "$i"; then
  8062. func_append tmp_libs " $i"
  8063. fi
  8064. done
  8065. dependency_libs=$tmp_libs
  8066. done # for pass
  8067. if test prog = "$linkmode"; then
  8068. dlfiles=$newdlfiles
  8069. fi
  8070. if test prog = "$linkmode" || test lib = "$linkmode"; then
  8071. dlprefiles=$newdlprefiles
  8072. fi
  8073. case $linkmode in
  8074. oldlib)
  8075. if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then
  8076. func_warning "'-dlopen' is ignored for archives"
  8077. fi
  8078. case " $deplibs" in
  8079. *\ -l* | *\ -L*)
  8080. func_warning "'-l' and '-L' are ignored for archives" ;;
  8081. esac
  8082. test -n "$rpath" && \
  8083. func_warning "'-rpath' is ignored for archives"
  8084. test -n "$xrpath" && \
  8085. func_warning "'-R' is ignored for archives"
  8086. test -n "$vinfo" && \
  8087. func_warning "'-version-info/-version-number' is ignored for archives"
  8088. test -n "$release" && \
  8089. func_warning "'-release' is ignored for archives"
  8090. test -n "$export_symbols$export_symbols_regex" && \
  8091. func_warning "'-export-symbols' is ignored for archives"
  8092. # Now set the variables for building old libraries.
  8093. build_libtool_libs=no
  8094. oldlibs=$output
  8095. func_append objs "$old_deplibs"
  8096. ;;
  8097. lib)
  8098. # Make sure we only generate libraries of the form 'libNAME.la'.
  8099. case $outputname in
  8100. lib*)
  8101. func_stripname 'lib' '.la' "$outputname"
  8102. name=$func_stripname_result
  8103. eval shared_ext=\"$shrext_cmds\"
  8104. eval libname=\"$libname_spec\"
  8105. ;;
  8106. *)
  8107. test no = "$module" \
  8108. && func_fatal_help "libtool library '$output' must begin with 'lib'"
  8109. if test no != "$need_lib_prefix"; then
  8110. # Add the "lib" prefix for modules if required
  8111. func_stripname '' '.la' "$outputname"
  8112. name=$func_stripname_result
  8113. eval shared_ext=\"$shrext_cmds\"
  8114. eval libname=\"$libname_spec\"
  8115. else
  8116. func_stripname '' '.la' "$outputname"
  8117. libname=$func_stripname_result
  8118. fi
  8119. ;;
  8120. esac
  8121. if test -n "$objs"; then
  8122. if test pass_all != "$deplibs_check_method"; then
  8123. func_fatal_error "cannot build libtool library '$output' from non-libtool objects on this host:$objs"
  8124. else
  8125. func_warning "Linking the shared library $output against the non-libtool objects $objs is not portable!"
  8126. func_append libobjs " $objs"
  8127. fi
  8128. fi
  8129. test no = "$dlself" \
  8130. || func_warning "'-dlopen self' is ignored for libtool libraries"
  8131. set dummy $rpath
  8132. shift
  8133. test 1 -lt "$#" \
  8134. && func_warning "ignoring multiple '-rpath's for a libtool library"
  8135. install_libdir=$1
  8136. oldlibs=
  8137. if test -z "$rpath"; then
  8138. if test yes = "$build_libtool_libs"; then
  8139. # Building a libtool convenience library.
  8140. # Some compilers have problems with a '.al' extension so
  8141. # convenience libraries should have the same extension an
  8142. # archive normally would.
  8143. oldlibs="$output_objdir/$libname.$libext $oldlibs"
  8144. build_libtool_libs=convenience
  8145. build_old_libs=yes
  8146. fi
  8147. test -n "$vinfo" && \
  8148. func_warning "'-version-info/-version-number' is ignored for convenience libraries"
  8149. test -n "$release" && \
  8150. func_warning "'-release' is ignored for convenience libraries"
  8151. else
  8152. # Parse the version information argument.
  8153. save_ifs=$IFS; IFS=:
  8154. set dummy $vinfo 0 0 0
  8155. shift
  8156. IFS=$save_ifs
  8157. test -n "$7" && \
  8158. func_fatal_help "too many parameters to '-version-info'"
  8159. # convert absolute version numbers to libtool ages
  8160. # this retains compatibility with .la files and attempts
  8161. # to make the code below a bit more comprehensible
  8162. case $vinfo_number in
  8163. yes)
  8164. number_major=$1
  8165. number_minor=$2
  8166. number_revision=$3
  8167. #
  8168. # There are really only two kinds -- those that
  8169. # use the current revision as the major version
  8170. # and those that subtract age and use age as
  8171. # a minor version. But, then there is irix
  8172. # that has an extra 1 added just for fun
  8173. #
  8174. case $version_type in
  8175. # correct linux to gnu/linux during the next big refactor
  8176. darwin|freebsd-elf|linux|midnightbsd-elf|osf|qnx|windows|none)
  8177. func_arith $number_major + $number_minor
  8178. current=$func_arith_result
  8179. age=$number_minor
  8180. revision=$number_revision
  8181. ;;
  8182. freebsd-aout|sco|sunos)
  8183. current=$number_major
  8184. revision=$number_minor
  8185. age=0
  8186. ;;
  8187. irix|nonstopux)
  8188. func_arith $number_major + $number_minor
  8189. current=$func_arith_result
  8190. age=$number_minor
  8191. revision=$number_minor
  8192. lt_irix_increment=no
  8193. ;;
  8194. *)
  8195. func_fatal_configuration "$modename: unknown library version type '$version_type'"
  8196. ;;
  8197. esac
  8198. ;;
  8199. no)
  8200. current=$1
  8201. revision=$2
  8202. age=$3
  8203. ;;
  8204. esac
  8205. # Check that each of the things are valid numbers.
  8206. case $current in
  8207. 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
  8208. *)
  8209. func_error "CURRENT '$current' must be a nonnegative integer"
  8210. func_fatal_error "'$vinfo' is not valid version information"
  8211. ;;
  8212. esac
  8213. case $revision in
  8214. 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
  8215. *)
  8216. func_error "REVISION '$revision' must be a nonnegative integer"
  8217. func_fatal_error "'$vinfo' is not valid version information"
  8218. ;;
  8219. esac
  8220. case $age in
  8221. 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
  8222. *)
  8223. func_error "AGE '$age' must be a nonnegative integer"
  8224. func_fatal_error "'$vinfo' is not valid version information"
  8225. ;;
  8226. esac
  8227. if test "$age" -gt "$current"; then
  8228. func_error "AGE '$age' is greater than the current interface number '$current'"
  8229. func_fatal_error "'$vinfo' is not valid version information"
  8230. fi
  8231. # Calculate the version variables.
  8232. major=
  8233. versuffix=
  8234. verstring=
  8235. case $version_type in
  8236. none) ;;
  8237. darwin)
  8238. # Like Linux, but with the current version available in
  8239. # verstring for coding it into the library header
  8240. func_arith $current - $age
  8241. major=.$func_arith_result
  8242. versuffix=$major.$age.$revision
  8243. # Darwin ld doesn't like 0 for these options...
  8244. func_arith $current + 1
  8245. minor_current=$func_arith_result
  8246. xlcverstring="$wl-compatibility_version $wl$minor_current $wl-current_version $wl$minor_current.$revision"
  8247. verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
  8248. # On Darwin other compilers
  8249. case $CC in
  8250. nagfor*)
  8251. verstring="$wl-compatibility_version $wl$minor_current $wl-current_version $wl$minor_current.$revision"
  8252. ;;
  8253. *)
  8254. verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
  8255. ;;
  8256. esac
  8257. ;;
  8258. freebsd-aout)
  8259. major=.$current
  8260. versuffix=.$current.$revision
  8261. ;;
  8262. freebsd-elf | midnightbsd-elf)
  8263. func_arith $current - $age
  8264. major=.$func_arith_result
  8265. versuffix=$major.$age.$revision
  8266. ;;
  8267. irix | nonstopux)
  8268. if test no = "$lt_irix_increment"; then
  8269. func_arith $current - $age
  8270. else
  8271. func_arith $current - $age + 1
  8272. fi
  8273. major=$func_arith_result
  8274. case $version_type in
  8275. nonstopux) verstring_prefix=nonstopux ;;
  8276. *) verstring_prefix=sgi ;;
  8277. esac
  8278. verstring=$verstring_prefix$major.$revision
  8279. # Add in all the interfaces that we are compatible with.
  8280. loop=$revision
  8281. while test 0 -ne "$loop"; do
  8282. func_arith $revision - $loop
  8283. iface=$func_arith_result
  8284. func_arith $loop - 1
  8285. loop=$func_arith_result
  8286. verstring=$verstring_prefix$major.$iface:$verstring
  8287. done
  8288. # Before this point, $major must not contain '.'.
  8289. major=.$major
  8290. versuffix=$major.$revision
  8291. ;;
  8292. linux) # correct to gnu/linux during the next big refactor
  8293. func_arith $current - $age
  8294. major=.$func_arith_result
  8295. versuffix=$major.$age.$revision
  8296. ;;
  8297. osf)
  8298. func_arith $current - $age
  8299. major=.$func_arith_result
  8300. versuffix=.$current.$age.$revision
  8301. verstring=$current.$age.$revision
  8302. # Add in all the interfaces that we are compatible with.
  8303. loop=$age
  8304. while test 0 -ne "$loop"; do
  8305. func_arith $current - $loop
  8306. iface=$func_arith_result
  8307. func_arith $loop - 1
  8308. loop=$func_arith_result
  8309. verstring=$verstring:$iface.0
  8310. done
  8311. # Make executables depend on our current version.
  8312. func_append verstring ":$current.0"
  8313. ;;
  8314. qnx)
  8315. func_arith $current - $age
  8316. major=.$func_arith_result
  8317. versuffix=$major.$age.$revision
  8318. ;;
  8319. sco)
  8320. major=.$current
  8321. versuffix=.$current
  8322. ;;
  8323. sunos)
  8324. major=.$current
  8325. versuffix=.$current.$revision
  8326. ;;
  8327. windows)
  8328. # Use '-' rather than '.', since we only want one
  8329. # extension on DOS 8.3 file systems.
  8330. func_arith $current - $age
  8331. major=$func_arith_result
  8332. versuffix=-$major
  8333. ;;
  8334. *)
  8335. func_fatal_configuration "unknown library version type '$version_type'"
  8336. ;;
  8337. esac
  8338. # Clear the version info if we defaulted, and they specified a release.
  8339. if test -z "$vinfo" && test -n "$release"; then
  8340. major=
  8341. case $version_type in
  8342. darwin)
  8343. # we can't check for "0.0" in archive_cmds due to quoting
  8344. # problems, so we reset it completely
  8345. verstring=
  8346. ;;
  8347. *)
  8348. verstring=0.0
  8349. ;;
  8350. esac
  8351. if test no = "$need_version"; then
  8352. versuffix=
  8353. else
  8354. versuffix=.0.0
  8355. fi
  8356. fi
  8357. # Remove version info from name if versioning should be avoided
  8358. if test yes,no = "$avoid_version,$need_version"; then
  8359. major=
  8360. versuffix=
  8361. verstring=
  8362. fi
  8363. # Check to see if the archive will have undefined symbols.
  8364. if test yes = "$allow_undefined"; then
  8365. if test unsupported = "$allow_undefined_flag"; then
  8366. if test yes = "$build_old_libs"; then
  8367. func_warning "undefined symbols not allowed in $host shared libraries; building static only"
  8368. build_libtool_libs=no
  8369. else
  8370. func_fatal_error "can't build $host shared library unless -no-undefined is specified"
  8371. fi
  8372. fi
  8373. else
  8374. # Don't allow undefined symbols.
  8375. allow_undefined_flag=$no_undefined_flag
  8376. fi
  8377. fi
  8378. func_generate_dlsyms "$libname" "$libname" :
  8379. func_append libobjs " $symfileobj"
  8380. test " " = "$libobjs" && libobjs=
  8381. if test relink != "$opt_mode"; then
  8382. # Remove our outputs, but don't remove object files since they
  8383. # may have been created when compiling PIC objects.
  8384. removelist=
  8385. tempremovelist=`$ECHO "$output_objdir/*"`
  8386. for p in $tempremovelist; do
  8387. case $p in
  8388. *.$objext | *.gcno)
  8389. ;;
  8390. $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/$libname$release.*)
  8391. if test -n "$precious_files_regex"; then
  8392. if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
  8393. then
  8394. continue
  8395. fi
  8396. fi
  8397. func_append removelist " $p"
  8398. ;;
  8399. *) ;;
  8400. esac
  8401. done
  8402. test -n "$removelist" && \
  8403. func_show_eval "${RM}r \$removelist"
  8404. fi
  8405. # Now set the variables for building old libraries.
  8406. if test yes = "$build_old_libs" && test convenience != "$build_libtool_libs"; then
  8407. func_append oldlibs " $output_objdir/$libname.$libext"
  8408. # Transform .lo files to .o files.
  8409. oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.$libext$/d; $lo2o" | $NL2SP`
  8410. fi
  8411. # Eliminate all temporary directories.
  8412. #for path in $notinst_path; do
  8413. # lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"`
  8414. # deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"`
  8415. # dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"`
  8416. #done
  8417. if test -n "$xrpath"; then
  8418. # If the user specified any rpath flags, then add them.
  8419. temp_xrpath=
  8420. for libdir in $xrpath; do
  8421. func_replace_sysroot "$libdir"
  8422. func_append temp_xrpath " -R$func_replace_sysroot_result"
  8423. case "$finalize_rpath " in
  8424. *" $libdir "*) ;;
  8425. *) func_append finalize_rpath " $libdir" ;;
  8426. esac
  8427. done
  8428. if test yes != "$hardcode_into_libs" || test yes = "$build_old_libs"; then
  8429. dependency_libs="$temp_xrpath $dependency_libs"
  8430. fi
  8431. fi
  8432. # Make sure dlfiles contains only unique files that won't be dlpreopened
  8433. old_dlfiles=$dlfiles
  8434. dlfiles=
  8435. for lib in $old_dlfiles; do
  8436. case " $dlprefiles $dlfiles " in
  8437. *" $lib "*) ;;
  8438. *) func_append dlfiles " $lib" ;;
  8439. esac
  8440. done
  8441. # Make sure dlprefiles contains only unique files
  8442. old_dlprefiles=$dlprefiles
  8443. dlprefiles=
  8444. for lib in $old_dlprefiles; do
  8445. case "$dlprefiles " in
  8446. *" $lib "*) ;;
  8447. *) func_append dlprefiles " $lib" ;;
  8448. esac
  8449. done
  8450. if test yes = "$build_libtool_libs"; then
  8451. if test -n "$rpath"; then
  8452. case $host in
  8453. *-*-cygwin* | *-*-mingw* | *-*-windows* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*)
  8454. # these systems don't actually have a c library (as such)!
  8455. ;;
  8456. *-*-rhapsody* | *-*-darwin1.[012])
  8457. # Rhapsody C library is in the System framework
  8458. func_append deplibs " System.ltframework"
  8459. ;;
  8460. *-*-netbsd*)
  8461. # Don't link with libc until the a.out ld.so is fixed.
  8462. ;;
  8463. *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-midnightbsd*)
  8464. # Do not include libc due to us having libc/libc_r.
  8465. ;;
  8466. *-*-sco3.2v5* | *-*-sco5v6*)
  8467. # Causes problems with __ctype
  8468. ;;
  8469. *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
  8470. # Compiler inserts libc in the correct place for threads to work
  8471. ;;
  8472. *)
  8473. # Add libc to deplibs on all other systems if necessary.
  8474. if test yes = "$build_libtool_need_lc"; then
  8475. func_append deplibs " -lc"
  8476. fi
  8477. ;;
  8478. esac
  8479. fi
  8480. # Transform deplibs into only deplibs that can be linked in shared.
  8481. name_save=$name
  8482. libname_save=$libname
  8483. release_save=$release
  8484. versuffix_save=$versuffix
  8485. major_save=$major
  8486. # I'm not sure if I'm treating the release correctly. I think
  8487. # release should show up in the -l (ie -lgmp5) so we don't want to
  8488. # add it in twice. Is that correct?
  8489. release=
  8490. versuffix=
  8491. major=
  8492. newdeplibs=
  8493. droppeddeps=no
  8494. case $deplibs_check_method in
  8495. pass_all)
  8496. # Don't check for shared/static. Everything works.
  8497. # This might be a little naive. We might want to check
  8498. # whether the library exists or not. But this is on
  8499. # osf3 & osf4 and I'm not really sure... Just
  8500. # implementing what was already the behavior.
  8501. newdeplibs=$deplibs
  8502. ;;
  8503. file_magic*)
  8504. set dummy $deplibs_check_method; shift
  8505. file_magic_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
  8506. for a_deplib in $deplibs; do
  8507. case $a_deplib in
  8508. -l*)
  8509. func_stripname -l '' "$a_deplib"
  8510. name=$func_stripname_result
  8511. if test yes = "$allow_libtool_libs_with_static_runtimes"; then
  8512. case " $predeps $postdeps " in
  8513. *" $a_deplib "*)
  8514. func_append newdeplibs " $a_deplib"
  8515. a_deplib=
  8516. ;;
  8517. esac
  8518. fi
  8519. if test -n "$a_deplib"; then
  8520. libname=`eval "\\$ECHO \"$libname_spec\""`
  8521. if test -n "$file_magic_glob"; then
  8522. libnameglob=`func_echo_all "$libname" | $SED -e $file_magic_glob`
  8523. else
  8524. libnameglob=$libname
  8525. fi
  8526. test yes = "$want_nocaseglob" && nocaseglob=`shopt -p nocaseglob`
  8527. for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
  8528. if test yes = "$want_nocaseglob"; then
  8529. shopt -s nocaseglob
  8530. potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`
  8531. $nocaseglob
  8532. else
  8533. potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`
  8534. fi
  8535. for potent_lib in $potential_libs; do
  8536. # Follow soft links.
  8537. if ls -lLd "$potent_lib" 2>/dev/null |
  8538. $GREP " -> " >/dev/null; then
  8539. continue
  8540. fi
  8541. # The statement above tries to avoid entering an
  8542. # endless loop below, in case of cyclic links.
  8543. # We might still enter an endless loop, since a link
  8544. # loop can be closed while we follow links,
  8545. # but so what?
  8546. potlib=$potent_lib
  8547. while test -h "$potlib" 2>/dev/null; do
  8548. potliblink=`ls -ld $potlib | $SED 's/.* -> //'`
  8549. case $potliblink in
  8550. [\\/]* | [A-Za-z]:[\\/]*) potlib=$potliblink;;
  8551. *) potlib=`$ECHO "$potlib" | $SED 's|[^/]*$||'`"$potliblink";;
  8552. esac
  8553. done
  8554. if eval $file_magic_cmd \"\$potlib\" 2>/dev/null |
  8555. $SED -e 10q |
  8556. $EGREP "$file_magic_regex" > /dev/null; then
  8557. func_append newdeplibs " $a_deplib"
  8558. a_deplib=
  8559. break 2
  8560. fi
  8561. done
  8562. done
  8563. fi
  8564. if test -n "$a_deplib"; then
  8565. droppeddeps=yes
  8566. func_warning "Linker path does not have real file for library $a_deplib."
  8567. func_warning "I have the capability to make that library automatically link in when"
  8568. func_warning "you link to this library. But I can only do this if you have a"
  8569. func_warning "shared version of the library, which you do not appear to have"
  8570. func_warning "because I did check the linker path looking for a file starting"
  8571. if test -z "$potlib"; then
  8572. func_warning "with $libname but no candidates were found. (...for file magic test)"
  8573. else
  8574. func_warning "with $libname and none of the candidates passed a file format test"
  8575. func_warning "using a file magic. Last file checked: $potlib"
  8576. fi
  8577. fi
  8578. ;;
  8579. *)
  8580. # Add a -L argument.
  8581. func_append newdeplibs " $a_deplib"
  8582. ;;
  8583. esac
  8584. done # Gone through all deplibs.
  8585. ;;
  8586. match_pattern*)
  8587. set dummy $deplibs_check_method; shift
  8588. match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
  8589. for a_deplib in $deplibs; do
  8590. case $a_deplib in
  8591. -l*)
  8592. func_stripname -l '' "$a_deplib"
  8593. name=$func_stripname_result
  8594. if test yes = "$allow_libtool_libs_with_static_runtimes"; then
  8595. case " $predeps $postdeps " in
  8596. *" $a_deplib "*)
  8597. func_append newdeplibs " $a_deplib"
  8598. a_deplib=
  8599. ;;
  8600. esac
  8601. fi
  8602. if test -n "$a_deplib"; then
  8603. libname=`eval "\\$ECHO \"$libname_spec\""`
  8604. for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
  8605. potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
  8606. for potent_lib in $potential_libs; do
  8607. potlib=$potent_lib # see symlink-check above in file_magic test
  8608. if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \
  8609. $EGREP "$match_pattern_regex" > /dev/null; then
  8610. func_append newdeplibs " $a_deplib"
  8611. a_deplib=
  8612. break 2
  8613. fi
  8614. done
  8615. done
  8616. fi
  8617. if test -n "$a_deplib"; then
  8618. droppeddeps=yes
  8619. func_warning "Linker path does not have real file for library $a_deplib."
  8620. func_warning "I have the capability to make that library automatically link in when"
  8621. func_warning "you link to this library. But I can only do this if you have a"
  8622. func_warning "shared version of the library, which you do not appear to have"
  8623. func_warning "because I did check the linker path looking for a file starting"
  8624. if test -z "$potlib"; then
  8625. func_warning "with $libname but no candidates were found. (...for regex pattern test)"
  8626. else
  8627. func_warning "with $libname and none of the candidates passed a file format test"
  8628. func_warning "using a regex pattern. Last file checked: $potlib"
  8629. fi
  8630. fi
  8631. ;;
  8632. *)
  8633. # Add a -L argument.
  8634. func_append newdeplibs " $a_deplib"
  8635. ;;
  8636. esac
  8637. done # Gone through all deplibs.
  8638. ;;
  8639. none | unknown | *)
  8640. newdeplibs=
  8641. tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'`
  8642. if test yes = "$allow_libtool_libs_with_static_runtimes"; then
  8643. for i in $predeps $postdeps; do
  8644. # can't use Xsed below, because $i might contain '/'
  8645. tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s|$i||"`
  8646. done
  8647. fi
  8648. case $tmp_deplibs in
  8649. *[!\ \ ]*)
  8650. echo
  8651. if test none = "$deplibs_check_method"; then
  8652. func_warning "Inter-library dependencies are not supported in this platform."
  8653. else
  8654. func_warning "Inter-library dependencies are not known to be supported."
  8655. fi
  8656. func_warning "All declared inter-library dependencies are being dropped."
  8657. droppeddeps=yes
  8658. ;;
  8659. esac
  8660. ;;
  8661. esac
  8662. versuffix=$versuffix_save
  8663. major=$major_save
  8664. release=$release_save
  8665. libname=$libname_save
  8666. name=$name_save
  8667. case $host in
  8668. *-*-rhapsody* | *-*-darwin1.[012])
  8669. # On Rhapsody replace the C library with the System framework
  8670. newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'`
  8671. ;;
  8672. esac
  8673. if test yes = "$droppeddeps"; then
  8674. if test yes = "$module"; then
  8675. func_warning "libtool could not satisfy all declared inter-library"
  8676. func_warning "dependencies of module $libname. Therefore, libtool will create"
  8677. func_warning "a static module, that should work as long as the dlopening"
  8678. func_warning "application is linked with the -dlopen flag."
  8679. if test -z "$global_symbol_pipe"; then
  8680. func_warning "However, this would only work if libtool was able to extract symbol"
  8681. func_warning "lists from a program, using 'nm' or equivalent, but libtool could"
  8682. func_warning "not find such a program. So, this module is probably useless."
  8683. func_warning "'nm' from GNU binutils and a full rebuild may help."
  8684. fi
  8685. if test no = "$build_old_libs"; then
  8686. oldlibs=$output_objdir/$libname.$libext
  8687. build_libtool_libs=module
  8688. build_old_libs=yes
  8689. else
  8690. build_libtool_libs=no
  8691. fi
  8692. else
  8693. echo "*** The inter-library dependencies that have been dropped here will be"
  8694. echo "*** automatically added whenever a program is linked with this library"
  8695. echo "*** or is declared to -dlopen it."
  8696. if test no = "$allow_undefined"; then
  8697. echo
  8698. echo "*** Since this library must not contain undefined symbols,"
  8699. echo "*** because either the platform does not support them or"
  8700. echo "*** it was explicitly requested with -no-undefined,"
  8701. echo "*** libtool will only create a static version of it."
  8702. if test no = "$build_old_libs"; then
  8703. oldlibs=$output_objdir/$libname.$libext
  8704. build_libtool_libs=module
  8705. build_old_libs=yes
  8706. else
  8707. build_libtool_libs=no
  8708. fi
  8709. fi
  8710. fi
  8711. fi
  8712. # Done checking deplibs!
  8713. deplibs=$newdeplibs
  8714. fi
  8715. # Time to change all our "foo.ltframework" stuff back to "-framework foo"
  8716. case $host in
  8717. *-*-darwin*)
  8718. newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
  8719. new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
  8720. deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
  8721. ;;
  8722. esac
  8723. # move library search paths that coincide with paths to not yet
  8724. # installed libraries to the beginning of the library search list
  8725. new_libs=
  8726. for path in $notinst_path; do
  8727. case " $new_libs " in
  8728. *" -L$path/$objdir "*) ;;
  8729. *)
  8730. case " $deplibs " in
  8731. *" -L$path/$objdir "*)
  8732. func_append new_libs " -L$path/$objdir" ;;
  8733. esac
  8734. ;;
  8735. esac
  8736. done
  8737. for deplib in $deplibs; do
  8738. case $deplib in
  8739. -L*)
  8740. case " $new_libs " in
  8741. *" $deplib "*) ;;
  8742. *) func_append new_libs " $deplib" ;;
  8743. esac
  8744. ;;
  8745. *) func_append new_libs " $deplib" ;;
  8746. esac
  8747. done
  8748. deplibs=$new_libs
  8749. # All the library-specific variables (install_libdir is set above).
  8750. library_names=
  8751. old_library=
  8752. dlname=
  8753. # Test again, we may have decided not to build it any more
  8754. if test yes = "$build_libtool_libs"; then
  8755. # Remove $wl instances when linking with ld.
  8756. # FIXME: should test the right _cmds variable.
  8757. case $archive_cmds in
  8758. *\$LD\ *) wl= ;;
  8759. esac
  8760. if test yes = "$hardcode_into_libs"; then
  8761. # Hardcode the library paths
  8762. hardcode_libdirs=
  8763. dep_rpath=
  8764. rpath=$finalize_rpath
  8765. test relink = "$opt_mode" || rpath=$compile_rpath$rpath
  8766. for libdir in $rpath; do
  8767. if test -n "$hardcode_libdir_flag_spec"; then
  8768. if test -n "$hardcode_libdir_separator"; then
  8769. func_replace_sysroot "$libdir"
  8770. libdir=$func_replace_sysroot_result
  8771. if test -z "$hardcode_libdirs"; then
  8772. hardcode_libdirs=$libdir
  8773. else
  8774. # Just accumulate the unique libdirs.
  8775. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
  8776. *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
  8777. ;;
  8778. *)
  8779. func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
  8780. ;;
  8781. esac
  8782. fi
  8783. else
  8784. eval flag=\"$hardcode_libdir_flag_spec\"
  8785. func_append dep_rpath " $flag"
  8786. fi
  8787. elif test -n "$runpath_var"; then
  8788. case "$perm_rpath " in
  8789. *" $libdir "*) ;;
  8790. *) func_append perm_rpath " $libdir" ;;
  8791. esac
  8792. fi
  8793. done
  8794. # Substitute the hardcoded libdirs into the rpath.
  8795. if test -n "$hardcode_libdir_separator" &&
  8796. test -n "$hardcode_libdirs"; then
  8797. libdir=$hardcode_libdirs
  8798. eval "dep_rpath=\"$hardcode_libdir_flag_spec\""
  8799. fi
  8800. if test -n "$runpath_var" && test -n "$perm_rpath"; then
  8801. # We should set the runpath_var.
  8802. rpath=
  8803. for dir in $perm_rpath; do
  8804. func_append rpath "$dir:"
  8805. done
  8806. eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
  8807. fi
  8808. test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
  8809. fi
  8810. shlibpath=$finalize_shlibpath
  8811. test relink = "$opt_mode" || shlibpath=$compile_shlibpath$shlibpath
  8812. if test -n "$shlibpath"; then
  8813. eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
  8814. fi
  8815. # Get the real and link names of the library.
  8816. eval shared_ext=\"$shrext_cmds\"
  8817. eval library_names=\"$library_names_spec\"
  8818. set dummy $library_names
  8819. shift
  8820. realname=$1
  8821. shift
  8822. if test -n "$soname_spec"; then
  8823. eval soname=\"$soname_spec\"
  8824. else
  8825. soname=$realname
  8826. fi
  8827. if test -z "$dlname"; then
  8828. dlname=$soname
  8829. fi
  8830. lib=$output_objdir/$realname
  8831. linknames=
  8832. for link
  8833. do
  8834. func_append linknames " $link"
  8835. done
  8836. # Use standard objects if they are pic
  8837. test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP`
  8838. test "X$libobjs" = "X " && libobjs=
  8839. delfiles=
  8840. if test -n "$export_symbols" && test -n "$include_expsyms"; then
  8841. $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp"
  8842. export_symbols=$output_objdir/$libname.uexp
  8843. func_append delfiles " $export_symbols"
  8844. fi
  8845. orig_export_symbols=
  8846. case $host_os in
  8847. cygwin* | mingw* | windows* | cegcc*)
  8848. if test -n "$export_symbols" && test -z "$export_symbols_regex"; then
  8849. # exporting using user supplied symfile
  8850. func_dll_def_p "$export_symbols" || {
  8851. # and it's NOT already a .def file. Must figure out
  8852. # which of the given symbols are data symbols and tag
  8853. # them as such. So, trigger use of export_symbols_cmds.
  8854. # export_symbols gets reassigned inside the "prepare
  8855. # the list of exported symbols" if statement, so the
  8856. # include_expsyms logic still works.
  8857. orig_export_symbols=$export_symbols
  8858. export_symbols=
  8859. always_export_symbols=yes
  8860. }
  8861. fi
  8862. ;;
  8863. esac
  8864. # Prepare the list of exported symbols
  8865. if test -z "$export_symbols"; then
  8866. if test yes = "$always_export_symbols" || test -n "$export_symbols_regex"; then
  8867. func_verbose "generating symbol list for '$libname.la'"
  8868. export_symbols=$output_objdir/$libname.exp
  8869. $opt_dry_run || $RM $export_symbols
  8870. cmds=$export_symbols_cmds
  8871. save_ifs=$IFS; IFS='~'
  8872. for cmd1 in $cmds; do
  8873. IFS=$save_ifs
  8874. # Take the normal branch if the nm_file_list_spec branch
  8875. # doesn't work or if tool conversion is not needed.
  8876. case $nm_file_list_spec~$to_tool_file_cmd in
  8877. *~func_convert_file_noop | *~func_convert_file_msys_to_w32 | ~*)
  8878. try_normal_branch=yes
  8879. eval cmd=\"$cmd1\"
  8880. func_len " $cmd"
  8881. len=$func_len_result
  8882. ;;
  8883. *)
  8884. try_normal_branch=no
  8885. ;;
  8886. esac
  8887. if test yes = "$try_normal_branch" \
  8888. && { test "$len" -lt "$max_cmd_len" \
  8889. || test "$max_cmd_len" -le -1; }
  8890. then
  8891. func_show_eval "$cmd" 'exit $?'
  8892. skipped_export=false
  8893. elif test -n "$nm_file_list_spec"; then
  8894. func_basename "$output"
  8895. output_la=$func_basename_result
  8896. save_libobjs=$libobjs
  8897. save_output=$output
  8898. output=$output_objdir/$output_la.nm
  8899. func_to_tool_file "$output"
  8900. libobjs=$nm_file_list_spec$func_to_tool_file_result
  8901. func_append delfiles " $output"
  8902. func_verbose "creating $NM input file list: $output"
  8903. for obj in $save_libobjs; do
  8904. func_to_tool_file "$obj"
  8905. $ECHO "$func_to_tool_file_result"
  8906. done > "$output"
  8907. eval cmd=\"$cmd1\"
  8908. func_show_eval "$cmd" 'exit $?'
  8909. output=$save_output
  8910. libobjs=$save_libobjs
  8911. skipped_export=false
  8912. else
  8913. # The command line is too long to execute in one step.
  8914. func_verbose "using reloadable object file for export list..."
  8915. skipped_export=:
  8916. # Break out early, otherwise skipped_export may be
  8917. # set to false by a later but shorter cmd.
  8918. break
  8919. fi
  8920. done
  8921. IFS=$save_ifs
  8922. if test -n "$export_symbols_regex" && test : != "$skipped_export"; then
  8923. func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
  8924. func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
  8925. fi
  8926. fi
  8927. fi
  8928. if test -n "$export_symbols" && test -n "$include_expsyms"; then
  8929. tmp_export_symbols=$export_symbols
  8930. test -n "$orig_export_symbols" && tmp_export_symbols=$orig_export_symbols
  8931. $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
  8932. fi
  8933. if test : != "$skipped_export" && test -n "$orig_export_symbols"; then
  8934. # The given exports_symbols file has to be filtered, so filter it.
  8935. func_verbose "filter symbol list for '$libname.la' to tag DATA exports"
  8936. # FIXME: $output_objdir/$libname.filter potentially contains lots of
  8937. # 's' commands, which not all seds can handle. GNU sed should be fine
  8938. # though. Also, the filter scales superlinearly with the number of
  8939. # global variables. join(1) would be nice here, but unfortunately
  8940. # isn't a blessed tool.
  8941. $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
  8942. func_append delfiles " $export_symbols $output_objdir/$libname.filter"
  8943. export_symbols=$output_objdir/$libname.def
  8944. $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
  8945. fi
  8946. tmp_deplibs=
  8947. for test_deplib in $deplibs; do
  8948. case " $convenience " in
  8949. *" $test_deplib "*) ;;
  8950. *)
  8951. func_append tmp_deplibs " $test_deplib"
  8952. ;;
  8953. esac
  8954. done
  8955. deplibs=$tmp_deplibs
  8956. if test -n "$convenience"; then
  8957. if test -n "$whole_archive_flag_spec" &&
  8958. test yes = "$compiler_needs_object" &&
  8959. test -z "$libobjs"; then
  8960. # extract the archives, so we have objects to list.
  8961. # TODO: could optimize this to just extract one archive.
  8962. whole_archive_flag_spec=
  8963. fi
  8964. if test -n "$whole_archive_flag_spec"; then
  8965. save_libobjs=$libobjs
  8966. eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
  8967. test "X$libobjs" = "X " && libobjs=
  8968. else
  8969. gentop=$output_objdir/${outputname}x
  8970. func_append generated " $gentop"
  8971. func_extract_archives $gentop $convenience
  8972. func_append libobjs " $func_extract_archives_result"
  8973. test "X$libobjs" = "X " && libobjs=
  8974. fi
  8975. fi
  8976. if test yes = "$thread_safe" && test -n "$thread_safe_flag_spec"; then
  8977. eval flag=\"$thread_safe_flag_spec\"
  8978. func_append linker_flags " $flag"
  8979. fi
  8980. # Make a backup of the uninstalled library when relinking
  8981. if test relink = "$opt_mode"; then
  8982. $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $?
  8983. fi
  8984. # Do each of the archive commands.
  8985. if test yes = "$module" && test -n "$module_cmds"; then
  8986. if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
  8987. eval test_cmds=\"$module_expsym_cmds\"
  8988. cmds=$module_expsym_cmds
  8989. else
  8990. eval test_cmds=\"$module_cmds\"
  8991. cmds=$module_cmds
  8992. fi
  8993. else
  8994. if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
  8995. eval test_cmds=\"$archive_expsym_cmds\"
  8996. cmds=$archive_expsym_cmds
  8997. else
  8998. eval test_cmds=\"$archive_cmds\"
  8999. cmds=$archive_cmds
  9000. fi
  9001. fi
  9002. if test : != "$skipped_export" &&
  9003. func_len " $test_cmds" &&
  9004. len=$func_len_result &&
  9005. test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
  9006. :
  9007. else
  9008. # The command line is too long to link in one step, link piecewise
  9009. # or, if using GNU ld and skipped_export is not :, use a linker
  9010. # script.
  9011. # Save the value of $output and $libobjs because we want to
  9012. # use them later. If we have whole_archive_flag_spec, we
  9013. # want to use save_libobjs as it was before
  9014. # whole_archive_flag_spec was expanded, because we can't
  9015. # assume the linker understands whole_archive_flag_spec.
  9016. # This may have to be revisited, in case too many
  9017. # convenience libraries get linked in and end up exceeding
  9018. # the spec.
  9019. if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
  9020. save_libobjs=$libobjs
  9021. fi
  9022. save_output=$output
  9023. func_basename "$output"
  9024. output_la=$func_basename_result
  9025. # Clear the reloadable object creation command queue and
  9026. # initialize k to one.
  9027. test_cmds=
  9028. concat_cmds=
  9029. objlist=
  9030. last_robj=
  9031. k=1
  9032. if test -n "$save_libobjs" && test : != "$skipped_export" && test -n "$file_list_spec"; then
  9033. output=$output_objdir/$output_la.lnk
  9034. func_verbose "creating linker input file list: $output"
  9035. : > $output
  9036. set x $save_libobjs
  9037. shift
  9038. firstobj=
  9039. if test yes = "$compiler_needs_object"; then
  9040. firstobj="$1 "
  9041. shift
  9042. fi
  9043. for obj
  9044. do
  9045. func_to_tool_file "$obj"
  9046. $ECHO "$func_to_tool_file_result" >> $output
  9047. done
  9048. func_append delfiles " $output"
  9049. func_to_tool_file "$output"
  9050. output=$firstobj\"$file_list_spec$func_to_tool_file_result\"
  9051. elif test -n "$save_libobjs" && test : != "$skipped_export" && test yes = "$with_gnu_ld"; then
  9052. output=$output_objdir/$output_la.lnkscript
  9053. func_verbose "creating GNU ld script: $output"
  9054. echo 'INPUT (' > $output
  9055. for obj in $save_libobjs
  9056. do
  9057. func_to_tool_file "$obj"
  9058. $ECHO "$func_to_tool_file_result" >> $output
  9059. done
  9060. echo ')' >> $output
  9061. func_append delfiles " $output"
  9062. func_to_tool_file "$output"
  9063. output=$func_to_tool_file_result
  9064. else
  9065. if test -n "$save_libobjs"; then
  9066. func_verbose "creating reloadable object files..."
  9067. output=$output_objdir/$output_la-$k.$objext
  9068. eval test_cmds=\"$reload_cmds\"
  9069. func_len " $test_cmds"
  9070. len0=$func_len_result
  9071. len=$len0
  9072. # Loop over the list of objects to be linked.
  9073. for obj in $save_libobjs
  9074. do
  9075. func_len " $obj"
  9076. func_arith $len + $func_len_result
  9077. len=$func_arith_result
  9078. if test -z "$objlist" ||
  9079. test "$len" -lt "$max_cmd_len"; then
  9080. func_append objlist " $obj"
  9081. else
  9082. # The command $test_cmds is almost too long, add a
  9083. # command to the queue.
  9084. if test 1 -eq "$k"; then
  9085. # The first file doesn't have a previous command to add.
  9086. reload_objs=$objlist
  9087. eval concat_cmds=\"$reload_cmds\"
  9088. else
  9089. # All subsequent reloadable object files will link in
  9090. # the last one created.
  9091. reload_objs="$objlist $last_robj"
  9092. eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\"
  9093. fi
  9094. last_robj=$output_objdir/$output_la-$k.$objext
  9095. func_arith $k + 1
  9096. k=$func_arith_result
  9097. output=$output_objdir/$output_la-$k.$objext
  9098. objlist=" $obj"
  9099. func_len " $last_robj"
  9100. func_arith $len0 + $func_len_result
  9101. len=$func_arith_result
  9102. fi
  9103. done
  9104. # Handle the remaining objects by creating one last
  9105. # reloadable object file. All subsequent reloadable object
  9106. # files will link in the last one created.
  9107. test -z "$concat_cmds" || concat_cmds=$concat_cmds~
  9108. reload_objs="$objlist $last_robj"
  9109. eval concat_cmds=\"\$concat_cmds$reload_cmds\"
  9110. if test -n "$last_robj"; then
  9111. eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\"
  9112. fi
  9113. func_append delfiles " $output"
  9114. else
  9115. output=
  9116. fi
  9117. ${skipped_export-false} && {
  9118. func_verbose "generating symbol list for '$libname.la'"
  9119. export_symbols=$output_objdir/$libname.exp
  9120. $opt_dry_run || $RM $export_symbols
  9121. libobjs=$output
  9122. # Append the command to create the export file.
  9123. test -z "$concat_cmds" || concat_cmds=$concat_cmds~
  9124. eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\"
  9125. if test -n "$last_robj"; then
  9126. eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\"
  9127. fi
  9128. }
  9129. test -n "$save_libobjs" &&
  9130. func_verbose "creating a temporary reloadable object file: $output"
  9131. # Loop through the commands generated above and execute them.
  9132. save_ifs=$IFS; IFS='~'
  9133. for cmd in $concat_cmds; do
  9134. IFS=$save_ifs
  9135. $opt_quiet || {
  9136. func_quote_arg expand,pretty "$cmd"
  9137. eval "func_echo $func_quote_arg_result"
  9138. }
  9139. $opt_dry_run || eval "$cmd" || {
  9140. lt_exit=$?
  9141. # Restore the uninstalled library and exit
  9142. if test relink = "$opt_mode"; then
  9143. ( cd "$output_objdir" && \
  9144. $RM "${realname}T" && \
  9145. $MV "${realname}U" "$realname" )
  9146. fi
  9147. exit $lt_exit
  9148. }
  9149. done
  9150. IFS=$save_ifs
  9151. if test -n "$export_symbols_regex" && ${skipped_export-false}; then
  9152. func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
  9153. func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
  9154. fi
  9155. fi
  9156. ${skipped_export-false} && {
  9157. if test -n "$export_symbols" && test -n "$include_expsyms"; then
  9158. tmp_export_symbols=$export_symbols
  9159. test -n "$orig_export_symbols" && tmp_export_symbols=$orig_export_symbols
  9160. $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
  9161. fi
  9162. if test -n "$orig_export_symbols"; then
  9163. # The given exports_symbols file has to be filtered, so filter it.
  9164. func_verbose "filter symbol list for '$libname.la' to tag DATA exports"
  9165. # FIXME: $output_objdir/$libname.filter potentially contains lots of
  9166. # 's' commands, which not all seds can handle. GNU sed should be fine
  9167. # though. Also, the filter scales superlinearly with the number of
  9168. # global variables. join(1) would be nice here, but unfortunately
  9169. # isn't a blessed tool.
  9170. $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
  9171. func_append delfiles " $export_symbols $output_objdir/$libname.filter"
  9172. export_symbols=$output_objdir/$libname.def
  9173. $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
  9174. fi
  9175. }
  9176. libobjs=$output
  9177. # Restore the value of output.
  9178. output=$save_output
  9179. if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
  9180. eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
  9181. test "X$libobjs" = "X " && libobjs=
  9182. fi
  9183. # Expand the library linking commands again to reset the
  9184. # value of $libobjs for piecewise linking.
  9185. # Do each of the archive commands.
  9186. if test yes = "$module" && test -n "$module_cmds"; then
  9187. if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
  9188. cmds=$module_expsym_cmds
  9189. else
  9190. cmds=$module_cmds
  9191. fi
  9192. else
  9193. if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
  9194. cmds=$archive_expsym_cmds
  9195. else
  9196. cmds=$archive_cmds
  9197. fi
  9198. fi
  9199. fi
  9200. if test -n "$delfiles"; then
  9201. # Append the command to remove temporary files to $cmds.
  9202. eval cmds=\"\$cmds~\$RM $delfiles\"
  9203. fi
  9204. # Add any objects from preloaded convenience libraries
  9205. if test -n "$dlprefiles"; then
  9206. gentop=$output_objdir/${outputname}x
  9207. func_append generated " $gentop"
  9208. func_extract_archives $gentop $dlprefiles
  9209. func_append libobjs " $func_extract_archives_result"
  9210. test "X$libobjs" = "X " && libobjs=
  9211. fi
  9212. save_ifs=$IFS; IFS='~'
  9213. for cmd in $cmds; do
  9214. IFS=$sp$nl
  9215. eval cmd=\"$cmd\"
  9216. IFS=$save_ifs
  9217. $opt_quiet || {
  9218. func_quote_arg expand,pretty "$cmd"
  9219. eval "func_echo $func_quote_arg_result"
  9220. }
  9221. $opt_dry_run || eval "$cmd" || {
  9222. lt_exit=$?
  9223. # Restore the uninstalled library and exit
  9224. if test relink = "$opt_mode"; then
  9225. ( cd "$output_objdir" && \
  9226. $RM "${realname}T" && \
  9227. $MV "${realname}U" "$realname" )
  9228. fi
  9229. exit $lt_exit
  9230. }
  9231. done
  9232. IFS=$save_ifs
  9233. # Restore the uninstalled library and exit
  9234. if test relink = "$opt_mode"; then
  9235. $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $?
  9236. if test -n "$convenience"; then
  9237. if test -z "$whole_archive_flag_spec"; then
  9238. func_show_eval '${RM}r "$gentop"'
  9239. fi
  9240. fi
  9241. exit $EXIT_SUCCESS
  9242. fi
  9243. # Create links to the real library.
  9244. for linkname in $linknames; do
  9245. if test "$realname" != "$linkname"; then
  9246. func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?'
  9247. fi
  9248. done
  9249. # If -module or -export-dynamic was specified, set the dlname.
  9250. if test yes = "$module" || test yes = "$export_dynamic"; then
  9251. # On all known operating systems, these are identical.
  9252. dlname=$soname
  9253. fi
  9254. fi
  9255. ;;
  9256. obj)
  9257. if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then
  9258. func_warning "'-dlopen' is ignored for objects"
  9259. fi
  9260. case " $deplibs" in
  9261. *\ -l* | *\ -L*)
  9262. func_warning "'-l' and '-L' are ignored for objects" ;;
  9263. esac
  9264. test -n "$rpath" && \
  9265. func_warning "'-rpath' is ignored for objects"
  9266. test -n "$xrpath" && \
  9267. func_warning "'-R' is ignored for objects"
  9268. test -n "$vinfo" && \
  9269. func_warning "'-version-info' is ignored for objects"
  9270. test -n "$release" && \
  9271. func_warning "'-release' is ignored for objects"
  9272. case $output in
  9273. *.lo)
  9274. test -n "$objs$old_deplibs" && \
  9275. func_fatal_error "cannot build library object '$output' from non-libtool objects"
  9276. libobj=$output
  9277. func_lo2o "$libobj"
  9278. obj=$func_lo2o_result
  9279. ;;
  9280. *)
  9281. libobj=
  9282. obj=$output
  9283. ;;
  9284. esac
  9285. # Delete the old objects.
  9286. $opt_dry_run || $RM $obj $libobj
  9287. # Objects from convenience libraries. This assumes
  9288. # single-version convenience libraries. Whenever we create
  9289. # different ones for PIC/non-PIC, this we'll have to duplicate
  9290. # the extraction.
  9291. reload_conv_objs=
  9292. gentop=
  9293. # if reload_cmds runs $LD directly, get rid of -Wl from
  9294. # whole_archive_flag_spec and hope we can get by with turning comma
  9295. # into space.
  9296. case $reload_cmds in
  9297. *\$LD[\ \$]*) wl= ;;
  9298. esac
  9299. if test -n "$convenience"; then
  9300. if test -n "$whole_archive_flag_spec"; then
  9301. eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
  9302. test -n "$wl" || tmp_whole_archive_flags=`$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'`
  9303. reload_conv_objs=$reload_objs\ $tmp_whole_archive_flags
  9304. else
  9305. gentop=$output_objdir/${obj}x
  9306. func_append generated " $gentop"
  9307. func_extract_archives $gentop $convenience
  9308. reload_conv_objs="$reload_objs $func_extract_archives_result"
  9309. fi
  9310. fi
  9311. # If we're not building shared, we need to use non_pic_objs
  9312. test yes = "$build_libtool_libs" || libobjs=$non_pic_objects
  9313. # Create the old-style object.
  9314. reload_objs=$objs$old_deplibs' '`$ECHO "$libobjs" | $SP2NL | $SED "/\.$libext$/d; /\.lib$/d; $lo2o" | $NL2SP`' '$reload_conv_objs
  9315. output=$obj
  9316. func_execute_cmds "$reload_cmds" 'exit $?'
  9317. # Exit if we aren't doing a library object file.
  9318. if test -z "$libobj"; then
  9319. if test -n "$gentop"; then
  9320. func_show_eval '${RM}r "$gentop"'
  9321. fi
  9322. exit $EXIT_SUCCESS
  9323. fi
  9324. test yes = "$build_libtool_libs" || {
  9325. if test -n "$gentop"; then
  9326. func_show_eval '${RM}r "$gentop"'
  9327. fi
  9328. # Create an invalid libtool object if no PIC, so that we don't
  9329. # accidentally link it into a program.
  9330. # $show "echo timestamp > $libobj"
  9331. # $opt_dry_run || eval "echo timestamp > $libobj" || exit $?
  9332. exit $EXIT_SUCCESS
  9333. }
  9334. if test -n "$pic_flag" || test default != "$pic_mode"; then
  9335. # Only do commands if we really have different PIC objects.
  9336. reload_objs="$libobjs $reload_conv_objs"
  9337. output=$libobj
  9338. func_execute_cmds "$reload_cmds" 'exit $?'
  9339. fi
  9340. if test -n "$gentop"; then
  9341. func_show_eval '${RM}r "$gentop"'
  9342. fi
  9343. exit $EXIT_SUCCESS
  9344. ;;
  9345. prog)
  9346. case $host in
  9347. *cygwin*) func_stripname '' '.exe' "$output"
  9348. output=$func_stripname_result.exe;;
  9349. esac
  9350. test -n "$vinfo" && \
  9351. func_warning "'-version-info' is ignored for programs"
  9352. test -n "$release" && \
  9353. func_warning "'-release' is ignored for programs"
  9354. $preload \
  9355. && test unknown,unknown,unknown = "$dlopen_support,$dlopen_self,$dlopen_self_static" \
  9356. && func_warning "'LT_INIT([dlopen])' not used. Assuming no dlopen support."
  9357. case $host in
  9358. *-*-rhapsody* | *-*-darwin1.[012])
  9359. # On Rhapsody replace the C library is the System framework
  9360. compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'`
  9361. finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'`
  9362. ;;
  9363. esac
  9364. case $host in
  9365. *-*-darwin*)
  9366. # Don't allow lazy linking, it breaks C++ global constructors
  9367. # But is supposedly fixed on 10.4 or later (yay!).
  9368. if test CXX = "$tagname"; then
  9369. case ${MACOSX_DEPLOYMENT_TARGET-10.0} in
  9370. 10.[0123])
  9371. func_append compile_command " $wl-bind_at_load"
  9372. func_append finalize_command " $wl-bind_at_load"
  9373. ;;
  9374. esac
  9375. fi
  9376. # Time to change all our "foo.ltframework" stuff back to "-framework foo"
  9377. compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
  9378. finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
  9379. ;;
  9380. esac
  9381. # move library search paths that coincide with paths to not yet
  9382. # installed libraries to the beginning of the library search list
  9383. new_libs=
  9384. for path in $notinst_path; do
  9385. case " $new_libs " in
  9386. *" -L$path/$objdir "*) ;;
  9387. *)
  9388. case " $compile_deplibs " in
  9389. *" -L$path/$objdir "*)
  9390. func_append new_libs " -L$path/$objdir" ;;
  9391. esac
  9392. ;;
  9393. esac
  9394. done
  9395. for deplib in $compile_deplibs; do
  9396. case $deplib in
  9397. -L*)
  9398. case " $new_libs " in
  9399. *" $deplib "*) ;;
  9400. *) func_append new_libs " $deplib" ;;
  9401. esac
  9402. ;;
  9403. *) func_append new_libs " $deplib" ;;
  9404. esac
  9405. done
  9406. compile_deplibs=$new_libs
  9407. func_append compile_command " $compile_deplibs"
  9408. func_append finalize_command " $finalize_deplibs"
  9409. if test -n "$rpath$xrpath"; then
  9410. # If the user specified any rpath flags, then add them.
  9411. for libdir in $rpath $xrpath; do
  9412. # This is the magic to use -rpath.
  9413. case "$finalize_rpath " in
  9414. *" $libdir "*) ;;
  9415. *) func_append finalize_rpath " $libdir" ;;
  9416. esac
  9417. done
  9418. fi
  9419. # Now hardcode the library paths
  9420. rpath=
  9421. hardcode_libdirs=
  9422. for libdir in $compile_rpath $finalize_rpath; do
  9423. if test -n "$hardcode_libdir_flag_spec"; then
  9424. if test -n "$hardcode_libdir_separator"; then
  9425. if test -z "$hardcode_libdirs"; then
  9426. hardcode_libdirs=$libdir
  9427. else
  9428. # Just accumulate the unique libdirs.
  9429. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
  9430. *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
  9431. ;;
  9432. *)
  9433. func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
  9434. ;;
  9435. esac
  9436. fi
  9437. else
  9438. eval flag=\"$hardcode_libdir_flag_spec\"
  9439. func_append rpath " $flag"
  9440. fi
  9441. elif test -n "$runpath_var"; then
  9442. case "$perm_rpath " in
  9443. *" $libdir "*) ;;
  9444. *) func_append perm_rpath " $libdir" ;;
  9445. esac
  9446. fi
  9447. case $host in
  9448. *-*-cygwin* | *-*-mingw* | *-*-windows* | *-*-pw32* | *-*-os2* | *-cegcc*)
  9449. testbindir=`$ECHO "$libdir" | $SED -e 's*/lib$*/bin*'`
  9450. case :$dllsearchpath: in
  9451. *":$libdir:"*) ;;
  9452. ::) dllsearchpath=$libdir;;
  9453. *) func_append dllsearchpath ":$libdir";;
  9454. esac
  9455. case :$dllsearchpath: in
  9456. *":$testbindir:"*) ;;
  9457. ::) dllsearchpath=$testbindir;;
  9458. *) func_append dllsearchpath ":$testbindir";;
  9459. esac
  9460. ;;
  9461. esac
  9462. done
  9463. # Substitute the hardcoded libdirs into the rpath.
  9464. if test -n "$hardcode_libdir_separator" &&
  9465. test -n "$hardcode_libdirs"; then
  9466. libdir=$hardcode_libdirs
  9467. eval rpath=\" $hardcode_libdir_flag_spec\"
  9468. fi
  9469. compile_rpath=$rpath
  9470. rpath=
  9471. hardcode_libdirs=
  9472. for libdir in $finalize_rpath; do
  9473. if test -n "$hardcode_libdir_flag_spec"; then
  9474. if test -n "$hardcode_libdir_separator"; then
  9475. if test -z "$hardcode_libdirs"; then
  9476. hardcode_libdirs=$libdir
  9477. else
  9478. # Just accumulate the unique libdirs.
  9479. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
  9480. *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
  9481. ;;
  9482. *)
  9483. func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
  9484. ;;
  9485. esac
  9486. fi
  9487. else
  9488. eval flag=\"$hardcode_libdir_flag_spec\"
  9489. func_append rpath " $flag"
  9490. fi
  9491. elif test -n "$runpath_var"; then
  9492. case "$finalize_perm_rpath " in
  9493. *" $libdir "*) ;;
  9494. *) func_append finalize_perm_rpath " $libdir" ;;
  9495. esac
  9496. fi
  9497. done
  9498. # Substitute the hardcoded libdirs into the rpath.
  9499. if test -n "$hardcode_libdir_separator" &&
  9500. test -n "$hardcode_libdirs"; then
  9501. libdir=$hardcode_libdirs
  9502. eval rpath=\" $hardcode_libdir_flag_spec\"
  9503. fi
  9504. finalize_rpath=$rpath
  9505. if test -n "$libobjs" && test yes = "$build_old_libs"; then
  9506. # Transform all the library objects into standard objects.
  9507. compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
  9508. finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
  9509. fi
  9510. func_generate_dlsyms "$outputname" "@PROGRAM@" false
  9511. # template prelinking step
  9512. if test -n "$prelink_cmds"; then
  9513. func_execute_cmds "$prelink_cmds" 'exit $?'
  9514. fi
  9515. wrappers_required=:
  9516. case $host in
  9517. *cegcc* | *mingw32ce*)
  9518. # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway.
  9519. wrappers_required=false
  9520. ;;
  9521. *cygwin* | *mingw* | *windows* )
  9522. test yes = "$build_libtool_libs" || wrappers_required=false
  9523. ;;
  9524. *)
  9525. if test no = "$need_relink" || test yes != "$build_libtool_libs"; then
  9526. wrappers_required=false
  9527. fi
  9528. ;;
  9529. esac
  9530. $wrappers_required || {
  9531. # Replace the output file specification.
  9532. compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
  9533. link_command=$compile_command$compile_rpath
  9534. # We have no uninstalled library dependencies, so finalize right now.
  9535. exit_status=0
  9536. func_show_eval "$link_command" 'exit_status=$?'
  9537. if test -n "$postlink_cmds"; then
  9538. func_to_tool_file "$output"
  9539. postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
  9540. func_execute_cmds "$postlink_cmds" 'exit $?'
  9541. fi
  9542. # Delete the generated files.
  9543. if test -f "$output_objdir/${outputname}S.$objext"; then
  9544. func_show_eval '$RM "$output_objdir/${outputname}S.$objext"'
  9545. fi
  9546. exit $exit_status
  9547. }
  9548. if test -n "$compile_shlibpath$finalize_shlibpath"; then
  9549. compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
  9550. fi
  9551. if test -n "$finalize_shlibpath"; then
  9552. finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
  9553. fi
  9554. compile_var=
  9555. finalize_var=
  9556. if test -n "$runpath_var"; then
  9557. if test -n "$perm_rpath"; then
  9558. # We should set the runpath_var.
  9559. rpath=
  9560. for dir in $perm_rpath; do
  9561. func_append rpath "$dir:"
  9562. done
  9563. compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
  9564. fi
  9565. if test -n "$finalize_perm_rpath"; then
  9566. # We should set the runpath_var.
  9567. rpath=
  9568. for dir in $finalize_perm_rpath; do
  9569. func_append rpath "$dir:"
  9570. done
  9571. finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
  9572. fi
  9573. fi
  9574. if test yes = "$no_install"; then
  9575. # We don't need to create a wrapper script.
  9576. link_command=$compile_var$compile_command$compile_rpath
  9577. # Replace the output file specification.
  9578. link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
  9579. # Delete the old output file.
  9580. $opt_dry_run || $RM $output
  9581. # Link the executable and exit
  9582. func_show_eval "$link_command" 'exit $?'
  9583. if test -n "$postlink_cmds"; then
  9584. func_to_tool_file "$output"
  9585. postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
  9586. func_execute_cmds "$postlink_cmds" 'exit $?'
  9587. fi
  9588. exit $EXIT_SUCCESS
  9589. fi
  9590. case $hardcode_action,$fast_install in
  9591. relink,*)
  9592. # Fast installation is not supported
  9593. link_command=$compile_var$compile_command$compile_rpath
  9594. relink_command=$finalize_var$finalize_command$finalize_rpath
  9595. func_warning "this platform does not like uninstalled shared libraries"
  9596. func_warning "'$output' will be relinked during installation"
  9597. ;;
  9598. *,yes)
  9599. link_command=$finalize_var$compile_command$finalize_rpath
  9600. relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'`
  9601. ;;
  9602. *,no)
  9603. link_command=$compile_var$compile_command$compile_rpath
  9604. relink_command=$finalize_var$finalize_command$finalize_rpath
  9605. ;;
  9606. *,needless)
  9607. link_command=$finalize_var$compile_command$finalize_rpath
  9608. relink_command=
  9609. ;;
  9610. esac
  9611. # Replace the output file specification.
  9612. link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
  9613. # Delete the old output files.
  9614. $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname
  9615. func_show_eval "$link_command" 'exit $?'
  9616. if test -n "$postlink_cmds"; then
  9617. func_to_tool_file "$output_objdir/$outputname"
  9618. postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
  9619. func_execute_cmds "$postlink_cmds" 'exit $?'
  9620. fi
  9621. # Now create the wrapper script.
  9622. func_verbose "creating $output"
  9623. # Quote the relink command for shipping.
  9624. if test -n "$relink_command"; then
  9625. # Preserve any variables that may affect compiler behavior
  9626. for var in $variables_saved_for_relink; do
  9627. if eval test -z \"\${$var+set}\"; then
  9628. relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
  9629. elif eval var_value=\$$var; test -z "$var_value"; then
  9630. relink_command="$var=; export $var; $relink_command"
  9631. else
  9632. func_quote_arg pretty "$var_value"
  9633. relink_command="$var=$func_quote_arg_result; export $var; $relink_command"
  9634. fi
  9635. done
  9636. func_quote eval cd "`pwd`"
  9637. func_quote_arg pretty,unquoted "($func_quote_result; $relink_command)"
  9638. relink_command=$func_quote_arg_unquoted_result
  9639. fi
  9640. # Only actually do things if not in dry run mode.
  9641. $opt_dry_run || {
  9642. # win32 will think the script is a binary if it has
  9643. # a .exe suffix, so we strip it off here.
  9644. case $output in
  9645. *.exe) func_stripname '' '.exe' "$output"
  9646. output=$func_stripname_result ;;
  9647. esac
  9648. # test for cygwin because mv fails w/o .exe extensions
  9649. case $host in
  9650. *cygwin*)
  9651. exeext=.exe
  9652. func_stripname '' '.exe' "$outputname"
  9653. outputname=$func_stripname_result ;;
  9654. *) exeext= ;;
  9655. esac
  9656. case $host in
  9657. *cygwin* | *mingw* | windows* )
  9658. func_dirname_and_basename "$output" "" "."
  9659. output_name=$func_basename_result
  9660. output_path=$func_dirname_result
  9661. cwrappersource=$output_path/$objdir/lt-$output_name.c
  9662. cwrapper=$output_path/$output_name.exe
  9663. $RM $cwrappersource $cwrapper
  9664. trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
  9665. func_emit_cwrapperexe_src > $cwrappersource
  9666. # The wrapper executable is built using the $host compiler,
  9667. # because it contains $host paths and files. If cross-
  9668. # compiling, it, like the target executable, must be
  9669. # executed on the $host or under an emulation environment.
  9670. $opt_dry_run || {
  9671. $LTCC $LTCFLAGS -o $cwrapper $cwrappersource
  9672. $STRIP $cwrapper
  9673. }
  9674. # Now, create the wrapper script for func_source use:
  9675. func_ltwrapper_scriptname $cwrapper
  9676. $RM $func_ltwrapper_scriptname_result
  9677. trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15
  9678. $opt_dry_run || {
  9679. # note: this script will not be executed, so do not chmod.
  9680. if test "x$build" = "x$host"; then
  9681. $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result
  9682. else
  9683. func_emit_wrapper no > $func_ltwrapper_scriptname_result
  9684. fi
  9685. }
  9686. ;;
  9687. * )
  9688. $RM $output
  9689. trap "$RM $output; exit $EXIT_FAILURE" 1 2 15
  9690. func_emit_wrapper no > $output
  9691. chmod +x $output
  9692. ;;
  9693. esac
  9694. }
  9695. exit $EXIT_SUCCESS
  9696. ;;
  9697. esac
  9698. # See if we need to build an old-fashioned archive.
  9699. for oldlib in $oldlibs; do
  9700. case $build_libtool_libs in
  9701. convenience)
  9702. oldobjs="$libobjs_save $symfileobj"
  9703. addlibs=$convenience
  9704. build_libtool_libs=no
  9705. ;;
  9706. module)
  9707. oldobjs=$libobjs_save
  9708. addlibs=$old_convenience
  9709. build_libtool_libs=no
  9710. ;;
  9711. *)
  9712. oldobjs="$old_deplibs $non_pic_objects"
  9713. $preload && test -f "$symfileobj" \
  9714. && func_append oldobjs " $symfileobj"
  9715. addlibs=$old_convenience
  9716. ;;
  9717. esac
  9718. if test -n "$addlibs"; then
  9719. gentop=$output_objdir/${outputname}x
  9720. func_append generated " $gentop"
  9721. func_extract_archives $gentop $addlibs
  9722. func_append oldobjs " $func_extract_archives_result"
  9723. fi
  9724. # Do each command in the archive commands.
  9725. if test -n "$old_archive_from_new_cmds" && test yes = "$build_libtool_libs"; then
  9726. cmds=$old_archive_from_new_cmds
  9727. else
  9728. # Add any objects from preloaded convenience libraries
  9729. if test -n "$dlprefiles"; then
  9730. gentop=$output_objdir/${outputname}x
  9731. func_append generated " $gentop"
  9732. func_extract_archives $gentop $dlprefiles
  9733. func_append oldobjs " $func_extract_archives_result"
  9734. fi
  9735. # POSIX demands no paths to be encoded in archives. We have
  9736. # to avoid creating archives with duplicate basenames if we
  9737. # might have to extract them afterwards, e.g., when creating a
  9738. # static archive out of a convenience library, or when linking
  9739. # the entirety of a libtool archive into another (currently
  9740. # not supported by libtool).
  9741. if (for obj in $oldobjs
  9742. do
  9743. func_basename "$obj"
  9744. $ECHO "$func_basename_result"
  9745. done | sort | sort -uc >/dev/null 2>&1); then
  9746. :
  9747. else
  9748. echo "copying selected object files to avoid basename conflicts..."
  9749. gentop=$output_objdir/${outputname}x
  9750. func_append generated " $gentop"
  9751. func_mkdir_p "$gentop"
  9752. save_oldobjs=$oldobjs
  9753. oldobjs=
  9754. counter=1
  9755. for obj in $save_oldobjs
  9756. do
  9757. func_basename "$obj"
  9758. objbase=$func_basename_result
  9759. case " $oldobjs " in
  9760. " ") oldobjs=$obj ;;
  9761. *[\ /]"$objbase "*)
  9762. while :; do
  9763. # Make sure we don't pick an alternate name that also
  9764. # overlaps.
  9765. newobj=lt$counter-$objbase
  9766. func_arith $counter + 1
  9767. counter=$func_arith_result
  9768. case " $oldobjs " in
  9769. *[\ /]"$newobj "*) ;;
  9770. *) if test ! -f "$gentop/$newobj"; then break; fi ;;
  9771. esac
  9772. done
  9773. func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
  9774. func_append oldobjs " $gentop/$newobj"
  9775. ;;
  9776. *) func_append oldobjs " $obj" ;;
  9777. esac
  9778. done
  9779. fi
  9780. func_to_tool_file "$oldlib" func_convert_file_msys_to_w32
  9781. tool_oldlib=$func_to_tool_file_result
  9782. eval cmds=\"$old_archive_cmds\"
  9783. func_len " $cmds"
  9784. len=$func_len_result
  9785. if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
  9786. cmds=$old_archive_cmds
  9787. elif test -n "$archiver_list_spec"; then
  9788. func_verbose "using command file archive linking..."
  9789. for obj in $oldobjs
  9790. do
  9791. func_to_tool_file "$obj"
  9792. $ECHO "$func_to_tool_file_result"
  9793. done > $output_objdir/$libname.libcmd
  9794. func_to_tool_file "$output_objdir/$libname.libcmd"
  9795. oldobjs=" $archiver_list_spec$func_to_tool_file_result"
  9796. cmds=$old_archive_cmds
  9797. else
  9798. # the command line is too long to link in one step, link in parts
  9799. func_verbose "using piecewise archive linking..."
  9800. save_RANLIB=$RANLIB
  9801. RANLIB=:
  9802. objlist=
  9803. concat_cmds=
  9804. save_oldobjs=$oldobjs
  9805. oldobjs=
  9806. # Is there a better way of finding the last object in the list?
  9807. for obj in $save_oldobjs
  9808. do
  9809. last_oldobj=$obj
  9810. done
  9811. eval test_cmds=\"$old_archive_cmds\"
  9812. func_len " $test_cmds"
  9813. len0=$func_len_result
  9814. len=$len0
  9815. for obj in $save_oldobjs
  9816. do
  9817. func_len " $obj"
  9818. func_arith $len + $func_len_result
  9819. len=$func_arith_result
  9820. func_append objlist " $obj"
  9821. if test "$len" -lt "$max_cmd_len"; then
  9822. :
  9823. else
  9824. # the above command should be used before it gets too long
  9825. oldobjs=$objlist
  9826. if test "$obj" = "$last_oldobj"; then
  9827. RANLIB=$save_RANLIB
  9828. fi
  9829. test -z "$concat_cmds" || concat_cmds=$concat_cmds~
  9830. eval concat_cmds=\"\$concat_cmds$old_archive_cmds\"
  9831. objlist=
  9832. len=$len0
  9833. fi
  9834. done
  9835. RANLIB=$save_RANLIB
  9836. oldobjs=$objlist
  9837. if test -z "$oldobjs"; then
  9838. eval cmds=\"\$concat_cmds\"
  9839. else
  9840. eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
  9841. fi
  9842. fi
  9843. fi
  9844. func_execute_cmds "$cmds" 'exit $?'
  9845. done
  9846. test -n "$generated" && \
  9847. func_show_eval "${RM}r$generated"
  9848. # Now create the libtool archive.
  9849. case $output in
  9850. *.la)
  9851. old_library=
  9852. test yes = "$build_old_libs" && old_library=$libname.$libext
  9853. func_verbose "creating $output"
  9854. # Preserve any variables that may affect compiler behavior
  9855. for var in $variables_saved_for_relink; do
  9856. if eval test -z \"\${$var+set}\"; then
  9857. relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
  9858. elif eval var_value=\$$var; test -z "$var_value"; then
  9859. relink_command="$var=; export $var; $relink_command"
  9860. else
  9861. func_quote_arg pretty,unquoted "$var_value"
  9862. relink_command="$var=$func_quote_arg_unquoted_result; export $var; $relink_command"
  9863. fi
  9864. done
  9865. # Quote the link command for shipping.
  9866. func_quote eval cd "`pwd`"
  9867. relink_command="($func_quote_result; $SHELL \"$progpath\" $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
  9868. func_quote_arg pretty,unquoted "$relink_command"
  9869. relink_command=$func_quote_arg_unquoted_result
  9870. if test yes = "$hardcode_automatic"; then
  9871. relink_command=
  9872. fi
  9873. # Only create the output if not a dry run.
  9874. $opt_dry_run || {
  9875. for installed in no yes; do
  9876. if test yes = "$installed"; then
  9877. if test -z "$install_libdir"; then
  9878. break
  9879. fi
  9880. output=$output_objdir/${outputname}i
  9881. # Replace all uninstalled libtool libraries with the installed ones
  9882. newdependency_libs=
  9883. for deplib in $dependency_libs; do
  9884. case $deplib in
  9885. *.la)
  9886. func_basename "$deplib"
  9887. name=$func_basename_result
  9888. func_resolve_sysroot "$deplib"
  9889. eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $func_resolve_sysroot_result`
  9890. test -z "$libdir" && \
  9891. func_fatal_error "'$deplib' is not a valid libtool archive"
  9892. func_append newdependency_libs " ${lt_sysroot:+=}$libdir/$name"
  9893. ;;
  9894. -L*)
  9895. func_stripname -L '' "$deplib"
  9896. func_replace_sysroot "$func_stripname_result"
  9897. func_append newdependency_libs " -L$func_replace_sysroot_result"
  9898. ;;
  9899. -R*)
  9900. func_stripname -R '' "$deplib"
  9901. func_replace_sysroot "$func_stripname_result"
  9902. func_append newdependency_libs " -R$func_replace_sysroot_result"
  9903. ;;
  9904. *) func_append newdependency_libs " $deplib" ;;
  9905. esac
  9906. done
  9907. dependency_libs=$newdependency_libs
  9908. newdlfiles=
  9909. for lib in $dlfiles; do
  9910. case $lib in
  9911. *.la)
  9912. func_basename "$lib"
  9913. name=$func_basename_result
  9914. eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
  9915. test -z "$libdir" && \
  9916. func_fatal_error "'$lib' is not a valid libtool archive"
  9917. func_append newdlfiles " ${lt_sysroot:+=}$libdir/$name"
  9918. ;;
  9919. *) func_append newdlfiles " $lib" ;;
  9920. esac
  9921. done
  9922. dlfiles=$newdlfiles
  9923. newdlprefiles=
  9924. for lib in $dlprefiles; do
  9925. case $lib in
  9926. *.la)
  9927. # Only pass preopened files to the pseudo-archive (for
  9928. # eventual linking with the app. that links it) if we
  9929. # didn't already link the preopened objects directly into
  9930. # the library:
  9931. func_basename "$lib"
  9932. name=$func_basename_result
  9933. eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
  9934. test -z "$libdir" && \
  9935. func_fatal_error "'$lib' is not a valid libtool archive"
  9936. func_append newdlprefiles " ${lt_sysroot:+=}$libdir/$name"
  9937. ;;
  9938. esac
  9939. done
  9940. dlprefiles=$newdlprefiles
  9941. else
  9942. newdlfiles=
  9943. for lib in $dlfiles; do
  9944. case $lib in
  9945. [\\/]* | [A-Za-z]:[\\/]*) abs=$lib ;;
  9946. *) abs=`pwd`"/$lib" ;;
  9947. esac
  9948. func_append newdlfiles " $abs"
  9949. done
  9950. dlfiles=$newdlfiles
  9951. newdlprefiles=
  9952. for lib in $dlprefiles; do
  9953. case $lib in
  9954. [\\/]* | [A-Za-z]:[\\/]*) abs=$lib ;;
  9955. *) abs=`pwd`"/$lib" ;;
  9956. esac
  9957. func_append newdlprefiles " $abs"
  9958. done
  9959. dlprefiles=$newdlprefiles
  9960. fi
  9961. $RM $output
  9962. # place dlname in correct position for cygwin
  9963. # In fact, it would be nice if we could use this code for all target
  9964. # systems that can't hard-code library paths into their executables
  9965. # and that have no shared library path variable independent of PATH,
  9966. # but it turns out we can't easily determine that from inspecting
  9967. # libtool variables, so we have to hard-code the OSs to which it
  9968. # applies here; at the moment, that means platforms that use the PE
  9969. # object format with DLL files. See the long comment at the top of
  9970. # tests/bindir.at for full details.
  9971. tdlname=$dlname
  9972. case $host,$output,$installed,$module,$dlname in
  9973. *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *windows*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll)
  9974. # If a -bindir argument was supplied, place the dll there.
  9975. if test -n "$bindir"; then
  9976. func_relative_path "$install_libdir" "$bindir"
  9977. tdlname=$func_relative_path_result/$dlname
  9978. else
  9979. # Otherwise fall back on heuristic.
  9980. tdlname=../bin/$dlname
  9981. fi
  9982. ;;
  9983. esac
  9984. $ECHO > $output "\
  9985. # $outputname - a libtool library file
  9986. # Generated by $PROGRAM (GNU $PACKAGE) $VERSION
  9987. #
  9988. # Please DO NOT delete this file!
  9989. # It is necessary for linking the library.
  9990. # The name that we can dlopen(3).
  9991. dlname='$tdlname'
  9992. # Names of this library.
  9993. library_names='$library_names'
  9994. # The name of the static archive.
  9995. old_library='$old_library'
  9996. # Linker flags that cannot go in dependency_libs.
  9997. inherited_linker_flags='$new_inherited_linker_flags'
  9998. # Libraries that this one depends upon.
  9999. dependency_libs='$dependency_libs'
  10000. # Names of additional weak libraries provided by this library
  10001. weak_library_names='$weak_libs'
  10002. # Version information for $libname.
  10003. current=$current
  10004. age=$age
  10005. revision=$revision
  10006. # Is this an already installed library?
  10007. installed=$installed
  10008. # Should we warn about portability when linking against -modules?
  10009. shouldnotlink=$module
  10010. # Files to dlopen/dlpreopen
  10011. dlopen='$dlfiles'
  10012. dlpreopen='$dlprefiles'
  10013. # Directory that this library needs to be installed in:
  10014. libdir='$install_libdir'"
  10015. if test no,yes = "$installed,$need_relink"; then
  10016. $ECHO >> $output "\
  10017. relink_command=\"$relink_command\""
  10018. fi
  10019. done
  10020. }
  10021. # Do a symbolic link so that the libtool archive can be found in
  10022. # LD_LIBRARY_PATH before the program is installed.
  10023. func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?'
  10024. ;;
  10025. esac
  10026. exit $EXIT_SUCCESS
  10027. }
  10028. if test link = "$opt_mode" || test relink = "$opt_mode"; then
  10029. func_mode_link ${1+"$@"}
  10030. fi
  10031. # func_mode_uninstall arg...
  10032. func_mode_uninstall ()
  10033. {
  10034. $debug_cmd
  10035. RM=$nonopt
  10036. files=
  10037. rmforce=false
  10038. exit_status=0
  10039. # This variable tells wrapper scripts just to set variables rather
  10040. # than running their programs.
  10041. libtool_install_magic=$magic
  10042. for arg
  10043. do
  10044. case $arg in
  10045. -f) func_append RM " $arg"; rmforce=: ;;
  10046. -*) func_append RM " $arg" ;;
  10047. *) func_append files " $arg" ;;
  10048. esac
  10049. done
  10050. test -z "$RM" && \
  10051. func_fatal_help "you must specify an RM program"
  10052. rmdirs=
  10053. for file in $files; do
  10054. func_dirname "$file" "" "."
  10055. dir=$func_dirname_result
  10056. if test . = "$dir"; then
  10057. odir=$objdir
  10058. else
  10059. odir=$dir/$objdir
  10060. fi
  10061. func_basename "$file"
  10062. name=$func_basename_result
  10063. test uninstall = "$opt_mode" && odir=$dir
  10064. # Remember odir for removal later, being careful to avoid duplicates
  10065. if test clean = "$opt_mode"; then
  10066. case " $rmdirs " in
  10067. *" $odir "*) ;;
  10068. *) func_append rmdirs " $odir" ;;
  10069. esac
  10070. fi
  10071. # Don't error if the file doesn't exist and rm -f was used.
  10072. if { test -L "$file"; } >/dev/null 2>&1 ||
  10073. { test -h "$file"; } >/dev/null 2>&1 ||
  10074. test -f "$file"; then
  10075. :
  10076. elif test -d "$file"; then
  10077. exit_status=1
  10078. continue
  10079. elif $rmforce; then
  10080. continue
  10081. fi
  10082. rmfiles=$file
  10083. case $name in
  10084. *.la)
  10085. # Possibly a libtool archive, so verify it.
  10086. if func_lalib_p "$file"; then
  10087. func_source $dir/$name
  10088. # Delete the libtool libraries and symlinks.
  10089. for n in $library_names; do
  10090. func_append rmfiles " $odir/$n"
  10091. done
  10092. test -n "$old_library" && func_append rmfiles " $odir/$old_library"
  10093. case $opt_mode in
  10094. clean)
  10095. case " $library_names " in
  10096. *" $dlname "*) ;;
  10097. *) test -n "$dlname" && func_append rmfiles " $odir/$dlname" ;;
  10098. esac
  10099. test -n "$libdir" && func_append rmfiles " $odir/$name $odir/${name}i"
  10100. ;;
  10101. uninstall)
  10102. if test -n "$library_names"; then
  10103. # Do each command in the postuninstall commands.
  10104. func_execute_cmds "$postuninstall_cmds" '$rmforce || exit_status=1'
  10105. fi
  10106. if test -n "$old_library"; then
  10107. # Do each command in the old_postuninstall commands.
  10108. func_execute_cmds "$old_postuninstall_cmds" '$rmforce || exit_status=1'
  10109. fi
  10110. # FIXME: should reinstall the best remaining shared library.
  10111. ;;
  10112. esac
  10113. fi
  10114. ;;
  10115. *.lo)
  10116. # Possibly a libtool object, so verify it.
  10117. if func_lalib_p "$file"; then
  10118. # Read the .lo file
  10119. func_source $dir/$name
  10120. # Add PIC object to the list of files to remove.
  10121. if test -n "$pic_object" && test none != "$pic_object"; then
  10122. func_append rmfiles " $dir/$pic_object"
  10123. fi
  10124. # Add non-PIC object to the list of files to remove.
  10125. if test -n "$non_pic_object" && test none != "$non_pic_object"; then
  10126. func_append rmfiles " $dir/$non_pic_object"
  10127. fi
  10128. fi
  10129. ;;
  10130. *)
  10131. if test clean = "$opt_mode"; then
  10132. noexename=$name
  10133. case $file in
  10134. *.exe)
  10135. func_stripname '' '.exe' "$file"
  10136. file=$func_stripname_result
  10137. func_stripname '' '.exe' "$name"
  10138. noexename=$func_stripname_result
  10139. # $file with .exe has already been added to rmfiles,
  10140. # add $file without .exe
  10141. func_append rmfiles " $file"
  10142. ;;
  10143. esac
  10144. # Do a test to see if this is a libtool program.
  10145. if func_ltwrapper_p "$file"; then
  10146. if func_ltwrapper_executable_p "$file"; then
  10147. func_ltwrapper_scriptname "$file"
  10148. relink_command=
  10149. func_source $func_ltwrapper_scriptname_result
  10150. func_append rmfiles " $func_ltwrapper_scriptname_result"
  10151. else
  10152. relink_command=
  10153. func_source $dir/$noexename
  10154. fi
  10155. # note $name still contains .exe if it was in $file originally
  10156. # as does the version of $file that was added into $rmfiles
  10157. func_append rmfiles " $odir/$name $odir/${name}S.$objext"
  10158. if test yes = "$fast_install" && test -n "$relink_command"; then
  10159. func_append rmfiles " $odir/lt-$name"
  10160. fi
  10161. if test "X$noexename" != "X$name"; then
  10162. func_append rmfiles " $odir/lt-$noexename.c"
  10163. fi
  10164. fi
  10165. fi
  10166. ;;
  10167. esac
  10168. func_show_eval "$RM $rmfiles" 'exit_status=1'
  10169. done
  10170. # Try to remove the $objdir's in the directories where we deleted files
  10171. for dir in $rmdirs; do
  10172. if test -d "$dir"; then
  10173. func_show_eval "rmdir $dir >/dev/null 2>&1"
  10174. fi
  10175. done
  10176. exit $exit_status
  10177. }
  10178. if test uninstall = "$opt_mode" || test clean = "$opt_mode"; then
  10179. func_mode_uninstall ${1+"$@"}
  10180. fi
  10181. test -z "$opt_mode" && {
  10182. help=$generic_help
  10183. func_fatal_help "you must specify a MODE"
  10184. }
  10185. test -z "$exec_cmd" && \
  10186. func_fatal_help "invalid operation mode '$opt_mode'"
  10187. if test -n "$exec_cmd"; then
  10188. eval exec "$exec_cmd"
  10189. exit $EXIT_FAILURE
  10190. fi
  10191. exit $exit_status
  10192. # The TAGs below are defined such that we never get into a situation
  10193. # where we disable both kinds of libraries. Given conflicting
  10194. # choices, we go for a static library, that is the most portable,
  10195. # since we can't tell whether shared libraries were disabled because
  10196. # the user asked for that or because the platform doesn't support
  10197. # them. This is particularly important on AIX, because we don't
  10198. # support having both static and shared libraries enabled at the same
  10199. # time on that platform, so we default to a shared-only configuration.
  10200. # If a disable-shared tag is given, we'll fallback to a static-only
  10201. # configuration. But we'll never go from static-only to shared-only.
  10202. # ### BEGIN LIBTOOL TAG CONFIG: disable-shared
  10203. build_libtool_libs=no
  10204. build_old_libs=yes
  10205. # ### END LIBTOOL TAG CONFIG: disable-shared
  10206. # ### BEGIN LIBTOOL TAG CONFIG: disable-static
  10207. build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
  10208. # ### END LIBTOOL TAG CONFIG: disable-static
  10209. # Local Variables:
  10210. # mode:shell-script
  10211. # sh-indentation:2
  10212. # End: