ltmain.sh 278 KB

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