ltmain.sh 317 KB

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