ltmain.sh 322 KB

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