1
0

ltmain.sh 329 KB

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