ltmain.sh 325 KB

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