ltmain.sh 277 KB

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