ltmain.sh 326 KB

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