ltmain.sh 321 KB

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