ltmain.sh 311 KB

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