ltmain.sh 329 KB

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