ltmain.sh 325 KB

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