ltmain.sh 276 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636
  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.3293
  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="grep -E"}
  126. : ${FGREP="grep -F"}
  127. : ${GREP="grep"}
  128. : ${LN_S="ln -s"}
  129. : ${MAKE="make"}
  130. : ${MKDIR="mkdir"}
  131. : ${MV="mv -f"}
  132. : ${RM="rm -f"}
  133. : ${SED="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_win32_import_lib_p ARG
  4467. # True if ARG is an import lib, as indicated by $file_magic_cmd
  4468. func_win32_import_lib_p ()
  4469. {
  4470. $opt_debug
  4471. case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in
  4472. *import*) : ;;
  4473. *) false ;;
  4474. esac
  4475. }
  4476. # func_mode_link arg...
  4477. func_mode_link ()
  4478. {
  4479. $opt_debug
  4480. case $host in
  4481. *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
  4482. # It is impossible to link a dll without this setting, and
  4483. # we shouldn't force the makefile maintainer to figure out
  4484. # which system we are compiling for in order to pass an extra
  4485. # flag for every libtool invocation.
  4486. # allow_undefined=no
  4487. # FIXME: Unfortunately, there are problems with the above when trying
  4488. # to make a dll which has undefined symbols, in which case not
  4489. # even a static library is built. For now, we need to specify
  4490. # -no-undefined on the libtool link line when we can be certain
  4491. # that all symbols are satisfied, otherwise we get a static library.
  4492. allow_undefined=yes
  4493. ;;
  4494. *)
  4495. allow_undefined=yes
  4496. ;;
  4497. esac
  4498. libtool_args=$nonopt
  4499. base_compile="$nonopt $@"
  4500. compile_command=$nonopt
  4501. finalize_command=$nonopt
  4502. compile_rpath=
  4503. finalize_rpath=
  4504. compile_shlibpath=
  4505. finalize_shlibpath=
  4506. convenience=
  4507. old_convenience=
  4508. deplibs=
  4509. old_deplibs=
  4510. compiler_flags=
  4511. linker_flags=
  4512. dllsearchpath=
  4513. lib_search_path=`pwd`
  4514. inst_prefix_dir=
  4515. new_inherited_linker_flags=
  4516. avoid_version=no
  4517. bindir=
  4518. dlfiles=
  4519. dlprefiles=
  4520. dlself=no
  4521. export_dynamic=no
  4522. export_symbols=
  4523. export_symbols_regex=
  4524. generated=
  4525. libobjs=
  4526. ltlibs=
  4527. module=no
  4528. no_install=no
  4529. objs=
  4530. non_pic_objects=
  4531. precious_files_regex=
  4532. prefer_static_libs=no
  4533. preload=no
  4534. prev=
  4535. prevarg=
  4536. release=
  4537. rpath=
  4538. xrpath=
  4539. perm_rpath=
  4540. temp_rpath=
  4541. thread_safe=no
  4542. vinfo=
  4543. vinfo_number=no
  4544. weak_libs=
  4545. single_module="${wl}-single_module"
  4546. func_infer_tag $base_compile
  4547. # We need to know -static, to get the right output filenames.
  4548. for arg
  4549. do
  4550. case $arg in
  4551. -shared)
  4552. test "$build_libtool_libs" != yes && \
  4553. func_fatal_configuration "can not build a shared library"
  4554. build_old_libs=no
  4555. break
  4556. ;;
  4557. -all-static | -static | -static-libtool-libs)
  4558. case $arg in
  4559. -all-static)
  4560. if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
  4561. func_warning "complete static linking is impossible in this configuration"
  4562. fi
  4563. if test -n "$link_static_flag"; then
  4564. dlopen_self=$dlopen_self_static
  4565. fi
  4566. prefer_static_libs=yes
  4567. ;;
  4568. -static)
  4569. if test -z "$pic_flag" && test -n "$link_static_flag"; then
  4570. dlopen_self=$dlopen_self_static
  4571. fi
  4572. prefer_static_libs=built
  4573. ;;
  4574. -static-libtool-libs)
  4575. if test -z "$pic_flag" && test -n "$link_static_flag"; then
  4576. dlopen_self=$dlopen_self_static
  4577. fi
  4578. prefer_static_libs=yes
  4579. ;;
  4580. esac
  4581. build_libtool_libs=no
  4582. build_old_libs=yes
  4583. break
  4584. ;;
  4585. esac
  4586. done
  4587. # See if our shared archives depend on static archives.
  4588. test -n "$old_archive_from_new_cmds" && build_old_libs=yes
  4589. # Go through the arguments, transforming them on the way.
  4590. while test "$#" -gt 0; do
  4591. arg="$1"
  4592. shift
  4593. func_quote_for_eval "$arg"
  4594. qarg=$func_quote_for_eval_unquoted_result
  4595. func_append libtool_args " $func_quote_for_eval_result"
  4596. # If the previous option needs an argument, assign it.
  4597. if test -n "$prev"; then
  4598. case $prev in
  4599. output)
  4600. func_append compile_command " @OUTPUT@"
  4601. func_append finalize_command " @OUTPUT@"
  4602. ;;
  4603. esac
  4604. case $prev in
  4605. bindir)
  4606. bindir="$arg"
  4607. prev=
  4608. continue
  4609. ;;
  4610. dlfiles|dlprefiles)
  4611. if test "$preload" = no; then
  4612. # Add the symbol object into the linking commands.
  4613. func_append compile_command " @SYMFILE@"
  4614. func_append finalize_command " @SYMFILE@"
  4615. preload=yes
  4616. fi
  4617. case $arg in
  4618. *.la | *.lo) ;; # We handle these cases below.
  4619. force)
  4620. if test "$dlself" = no; then
  4621. dlself=needless
  4622. export_dynamic=yes
  4623. fi
  4624. prev=
  4625. continue
  4626. ;;
  4627. self)
  4628. if test "$prev" = dlprefiles; then
  4629. dlself=yes
  4630. elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
  4631. dlself=yes
  4632. else
  4633. dlself=needless
  4634. export_dynamic=yes
  4635. fi
  4636. prev=
  4637. continue
  4638. ;;
  4639. *)
  4640. if test "$prev" = dlfiles; then
  4641. func_append dlfiles " $arg"
  4642. else
  4643. func_append dlprefiles " $arg"
  4644. fi
  4645. prev=
  4646. continue
  4647. ;;
  4648. esac
  4649. ;;
  4650. expsyms)
  4651. export_symbols="$arg"
  4652. test -f "$arg" \
  4653. || func_fatal_error "symbol file \`$arg' does not exist"
  4654. prev=
  4655. continue
  4656. ;;
  4657. expsyms_regex)
  4658. export_symbols_regex="$arg"
  4659. prev=
  4660. continue
  4661. ;;
  4662. framework)
  4663. case $host in
  4664. *-*-darwin*)
  4665. case "$deplibs " in
  4666. *" $qarg.ltframework "*) ;;
  4667. *) func_append deplibs " $qarg.ltframework" # this is fixed later
  4668. ;;
  4669. esac
  4670. ;;
  4671. esac
  4672. prev=
  4673. continue
  4674. ;;
  4675. inst_prefix)
  4676. inst_prefix_dir="$arg"
  4677. prev=
  4678. continue
  4679. ;;
  4680. objectlist)
  4681. if test -f "$arg"; then
  4682. save_arg=$arg
  4683. moreargs=
  4684. for fil in `cat "$save_arg"`
  4685. do
  4686. # func_append moreargs " $fil"
  4687. arg=$fil
  4688. # A libtool-controlled object.
  4689. # Check to see that this really is a libtool object.
  4690. if func_lalib_unsafe_p "$arg"; then
  4691. pic_object=
  4692. non_pic_object=
  4693. # Read the .lo file
  4694. func_source "$arg"
  4695. if test -z "$pic_object" ||
  4696. test -z "$non_pic_object" ||
  4697. test "$pic_object" = none &&
  4698. test "$non_pic_object" = none; then
  4699. func_fatal_error "cannot find name of object for \`$arg'"
  4700. fi
  4701. # Extract subdirectory from the argument.
  4702. func_dirname "$arg" "/" ""
  4703. xdir="$func_dirname_result"
  4704. if test "$pic_object" != none; then
  4705. # Prepend the subdirectory the object is found in.
  4706. pic_object="$xdir$pic_object"
  4707. if test "$prev" = dlfiles; then
  4708. if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
  4709. func_append dlfiles " $pic_object"
  4710. prev=
  4711. continue
  4712. else
  4713. # If libtool objects are unsupported, then we need to preload.
  4714. prev=dlprefiles
  4715. fi
  4716. fi
  4717. # CHECK ME: I think I busted this. -Ossama
  4718. if test "$prev" = dlprefiles; then
  4719. # Preload the old-style object.
  4720. func_append dlprefiles " $pic_object"
  4721. prev=
  4722. fi
  4723. # A PIC object.
  4724. func_append libobjs " $pic_object"
  4725. arg="$pic_object"
  4726. fi
  4727. # Non-PIC object.
  4728. if test "$non_pic_object" != none; then
  4729. # Prepend the subdirectory the object is found in.
  4730. non_pic_object="$xdir$non_pic_object"
  4731. # A standard non-PIC object
  4732. func_append non_pic_objects " $non_pic_object"
  4733. if test -z "$pic_object" || test "$pic_object" = none ; then
  4734. arg="$non_pic_object"
  4735. fi
  4736. else
  4737. # If the PIC object exists, use it instead.
  4738. # $xdir was prepended to $pic_object above.
  4739. non_pic_object="$pic_object"
  4740. func_append non_pic_objects " $non_pic_object"
  4741. fi
  4742. else
  4743. # Only an error if not doing a dry-run.
  4744. if $opt_dry_run; then
  4745. # Extract subdirectory from the argument.
  4746. func_dirname "$arg" "/" ""
  4747. xdir="$func_dirname_result"
  4748. func_lo2o "$arg"
  4749. pic_object=$xdir$objdir/$func_lo2o_result
  4750. non_pic_object=$xdir$func_lo2o_result
  4751. func_append libobjs " $pic_object"
  4752. func_append non_pic_objects " $non_pic_object"
  4753. else
  4754. func_fatal_error "\`$arg' is not a valid libtool object"
  4755. fi
  4756. fi
  4757. done
  4758. else
  4759. func_fatal_error "link input file \`$arg' does not exist"
  4760. fi
  4761. arg=$save_arg
  4762. prev=
  4763. continue
  4764. ;;
  4765. precious_regex)
  4766. precious_files_regex="$arg"
  4767. prev=
  4768. continue
  4769. ;;
  4770. release)
  4771. release="-$arg"
  4772. prev=
  4773. continue
  4774. ;;
  4775. rpath | xrpath)
  4776. # We need an absolute path.
  4777. case $arg in
  4778. [\\/]* | [A-Za-z]:[\\/]*) ;;
  4779. *)
  4780. func_fatal_error "only absolute run-paths are allowed"
  4781. ;;
  4782. esac
  4783. if test "$prev" = rpath; then
  4784. case "$rpath " in
  4785. *" $arg "*) ;;
  4786. *) func_append rpath " $arg" ;;
  4787. esac
  4788. else
  4789. case "$xrpath " in
  4790. *" $arg "*) ;;
  4791. *) func_append xrpath " $arg" ;;
  4792. esac
  4793. fi
  4794. prev=
  4795. continue
  4796. ;;
  4797. shrext)
  4798. shrext_cmds="$arg"
  4799. prev=
  4800. continue
  4801. ;;
  4802. weak)
  4803. func_append weak_libs " $arg"
  4804. prev=
  4805. continue
  4806. ;;
  4807. xcclinker)
  4808. func_append linker_flags " $qarg"
  4809. func_append compiler_flags " $qarg"
  4810. prev=
  4811. func_append compile_command " $qarg"
  4812. func_append finalize_command " $qarg"
  4813. continue
  4814. ;;
  4815. xcompiler)
  4816. func_append compiler_flags " $qarg"
  4817. prev=
  4818. func_append compile_command " $qarg"
  4819. func_append finalize_command " $qarg"
  4820. continue
  4821. ;;
  4822. xlinker)
  4823. func_append linker_flags " $qarg"
  4824. func_append compiler_flags " $wl$qarg"
  4825. prev=
  4826. func_append compile_command " $wl$qarg"
  4827. func_append finalize_command " $wl$qarg"
  4828. continue
  4829. ;;
  4830. *)
  4831. eval "$prev=\"\$arg\""
  4832. prev=
  4833. continue
  4834. ;;
  4835. esac
  4836. fi # test -n "$prev"
  4837. prevarg="$arg"
  4838. case $arg in
  4839. -all-static)
  4840. if test -n "$link_static_flag"; then
  4841. # See comment for -static flag below, for more details.
  4842. func_append compile_command " $link_static_flag"
  4843. func_append finalize_command " $link_static_flag"
  4844. fi
  4845. continue
  4846. ;;
  4847. -allow-undefined)
  4848. # FIXME: remove this flag sometime in the future.
  4849. func_fatal_error "\`-allow-undefined' must not be used because it is the default"
  4850. ;;
  4851. -avoid-version)
  4852. avoid_version=yes
  4853. continue
  4854. ;;
  4855. -bindir)
  4856. prev=bindir
  4857. continue
  4858. ;;
  4859. -dlopen)
  4860. prev=dlfiles
  4861. continue
  4862. ;;
  4863. -dlpreopen)
  4864. prev=dlprefiles
  4865. continue
  4866. ;;
  4867. -export-dynamic)
  4868. export_dynamic=yes
  4869. continue
  4870. ;;
  4871. -export-symbols | -export-symbols-regex)
  4872. if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
  4873. func_fatal_error "more than one -exported-symbols argument is not allowed"
  4874. fi
  4875. if test "X$arg" = "X-export-symbols"; then
  4876. prev=expsyms
  4877. else
  4878. prev=expsyms_regex
  4879. fi
  4880. continue
  4881. ;;
  4882. -framework)
  4883. prev=framework
  4884. continue
  4885. ;;
  4886. -inst-prefix-dir)
  4887. prev=inst_prefix
  4888. continue
  4889. ;;
  4890. # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
  4891. # so, if we see these flags be careful not to treat them like -L
  4892. -L[A-Z][A-Z]*:*)
  4893. case $with_gcc/$host in
  4894. no/*-*-irix* | /*-*-irix*)
  4895. func_append compile_command " $arg"
  4896. func_append finalize_command " $arg"
  4897. ;;
  4898. esac
  4899. continue
  4900. ;;
  4901. -L*)
  4902. func_stripname "-L" '' "$arg"
  4903. if test -z "$func_stripname_result"; then
  4904. if test "$#" -gt 0; then
  4905. func_fatal_error "require no space between \`-L' and \`$1'"
  4906. else
  4907. func_fatal_error "need path for \`-L' option"
  4908. fi
  4909. fi
  4910. func_resolve_sysroot "$func_stripname_result"
  4911. dir=$func_resolve_sysroot_result
  4912. # We need an absolute path.
  4913. case $dir in
  4914. [\\/]* | [A-Za-z]:[\\/]*) ;;
  4915. *)
  4916. absdir=`cd "$dir" && pwd`
  4917. test -z "$absdir" && \
  4918. func_fatal_error "cannot determine absolute directory name of \`$dir'"
  4919. dir="$absdir"
  4920. ;;
  4921. esac
  4922. case "$deplibs " in
  4923. *" -L$dir "* | *" $arg "*)
  4924. # Will only happen for absolute or sysroot arguments
  4925. ;;
  4926. *)
  4927. # Preserve sysroot, but never include relative directories
  4928. case $dir in
  4929. [\\/]* | [A-Za-z]:[\\/]* | =*) func_append deplibs " $arg" ;;
  4930. *) func_append deplibs " -L$dir" ;;
  4931. esac
  4932. func_append lib_search_path " $dir"
  4933. ;;
  4934. esac
  4935. case $host in
  4936. *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
  4937. testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'`
  4938. case :$dllsearchpath: in
  4939. *":$dir:"*) ;;
  4940. ::) dllsearchpath=$dir;;
  4941. *) func_append dllsearchpath ":$dir";;
  4942. esac
  4943. case :$dllsearchpath: in
  4944. *":$testbindir:"*) ;;
  4945. ::) dllsearchpath=$testbindir;;
  4946. *) func_append dllsearchpath ":$testbindir";;
  4947. esac
  4948. ;;
  4949. esac
  4950. continue
  4951. ;;
  4952. -l*)
  4953. if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
  4954. case $host in
  4955. *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*)
  4956. # These systems don't actually have a C or math library (as such)
  4957. continue
  4958. ;;
  4959. *-*-os2*)
  4960. # These systems don't actually have a C library (as such)
  4961. test "X$arg" = "X-lc" && continue
  4962. ;;
  4963. *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
  4964. # Do not include libc due to us having libc/libc_r.
  4965. test "X$arg" = "X-lc" && continue
  4966. ;;
  4967. *-*-rhapsody* | *-*-darwin1.[012])
  4968. # Rhapsody C and math libraries are in the System framework
  4969. func_append deplibs " System.ltframework"
  4970. continue
  4971. ;;
  4972. *-*-sco3.2v5* | *-*-sco5v6*)
  4973. # Causes problems with __ctype
  4974. test "X$arg" = "X-lc" && continue
  4975. ;;
  4976. *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
  4977. # Compiler inserts libc in the correct place for threads to work
  4978. test "X$arg" = "X-lc" && continue
  4979. ;;
  4980. esac
  4981. elif test "X$arg" = "X-lc_r"; then
  4982. case $host in
  4983. *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
  4984. # Do not include libc_r directly, use -pthread flag.
  4985. continue
  4986. ;;
  4987. esac
  4988. fi
  4989. func_append deplibs " $arg"
  4990. continue
  4991. ;;
  4992. -module)
  4993. module=yes
  4994. continue
  4995. ;;
  4996. # Tru64 UNIX uses -model [arg] to determine the layout of C++
  4997. # classes, name mangling, and exception handling.
  4998. # Darwin uses the -arch flag to determine output architecture.
  4999. -model|-arch|-isysroot|--sysroot)
  5000. func_append compiler_flags " $arg"
  5001. func_append compile_command " $arg"
  5002. func_append finalize_command " $arg"
  5003. prev=xcompiler
  5004. continue
  5005. ;;
  5006. -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
  5007. func_append compiler_flags " $arg"
  5008. func_append compile_command " $arg"
  5009. func_append finalize_command " $arg"
  5010. case "$new_inherited_linker_flags " in
  5011. *" $arg "*) ;;
  5012. * ) func_append new_inherited_linker_flags " $arg" ;;
  5013. esac
  5014. continue
  5015. ;;
  5016. -multi_module)
  5017. single_module="${wl}-multi_module"
  5018. continue
  5019. ;;
  5020. -no-fast-install)
  5021. fast_install=no
  5022. continue
  5023. ;;
  5024. -no-install)
  5025. case $host in
  5026. *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*)
  5027. # The PATH hackery in wrapper scripts is required on Windows
  5028. # and Darwin in order for the loader to find any dlls it needs.
  5029. func_warning "\`-no-install' is ignored for $host"
  5030. func_warning "assuming \`-no-fast-install' instead"
  5031. fast_install=no
  5032. ;;
  5033. *) no_install=yes ;;
  5034. esac
  5035. continue
  5036. ;;
  5037. -no-undefined)
  5038. allow_undefined=no
  5039. continue
  5040. ;;
  5041. -objectlist)
  5042. prev=objectlist
  5043. continue
  5044. ;;
  5045. -o) prev=output ;;
  5046. -precious-files-regex)
  5047. prev=precious_regex
  5048. continue
  5049. ;;
  5050. -release)
  5051. prev=release
  5052. continue
  5053. ;;
  5054. -rpath)
  5055. prev=rpath
  5056. continue
  5057. ;;
  5058. -R)
  5059. prev=xrpath
  5060. continue
  5061. ;;
  5062. -R*)
  5063. func_stripname '-R' '' "$arg"
  5064. dir=$func_stripname_result
  5065. # We need an absolute path.
  5066. case $dir in
  5067. [\\/]* | [A-Za-z]:[\\/]*) ;;
  5068. =*)
  5069. func_stripname '=' '' "$dir"
  5070. dir=$lt_sysroot$func_stripname_result
  5071. ;;
  5072. *)
  5073. func_fatal_error "only absolute run-paths are allowed"
  5074. ;;
  5075. esac
  5076. case "$xrpath " in
  5077. *" $dir "*) ;;
  5078. *) func_append xrpath " $dir" ;;
  5079. esac
  5080. continue
  5081. ;;
  5082. -shared)
  5083. # The effects of -shared are defined in a previous loop.
  5084. continue
  5085. ;;
  5086. -shrext)
  5087. prev=shrext
  5088. continue
  5089. ;;
  5090. -static | -static-libtool-libs)
  5091. # The effects of -static are defined in a previous loop.
  5092. # We used to do the same as -all-static on platforms that
  5093. # didn't have a PIC flag, but the assumption that the effects
  5094. # would be equivalent was wrong. It would break on at least
  5095. # Digital Unix and AIX.
  5096. continue
  5097. ;;
  5098. -thread-safe)
  5099. thread_safe=yes
  5100. continue
  5101. ;;
  5102. -version-info)
  5103. prev=vinfo
  5104. continue
  5105. ;;
  5106. -version-number)
  5107. prev=vinfo
  5108. vinfo_number=yes
  5109. continue
  5110. ;;
  5111. -weak)
  5112. prev=weak
  5113. continue
  5114. ;;
  5115. -Wc,*)
  5116. func_stripname '-Wc,' '' "$arg"
  5117. args=$func_stripname_result
  5118. arg=
  5119. save_ifs="$IFS"; IFS=','
  5120. for flag in $args; do
  5121. IFS="$save_ifs"
  5122. func_quote_for_eval "$flag"
  5123. func_append arg " $func_quote_for_eval_result"
  5124. func_append compiler_flags " $func_quote_for_eval_result"
  5125. done
  5126. IFS="$save_ifs"
  5127. func_stripname ' ' '' "$arg"
  5128. arg=$func_stripname_result
  5129. ;;
  5130. -Wl,*)
  5131. func_stripname '-Wl,' '' "$arg"
  5132. args=$func_stripname_result
  5133. arg=
  5134. save_ifs="$IFS"; IFS=','
  5135. for flag in $args; do
  5136. IFS="$save_ifs"
  5137. func_quote_for_eval "$flag"
  5138. func_append arg " $wl$func_quote_for_eval_result"
  5139. func_append compiler_flags " $wl$func_quote_for_eval_result"
  5140. func_append linker_flags " $func_quote_for_eval_result"
  5141. done
  5142. IFS="$save_ifs"
  5143. func_stripname ' ' '' "$arg"
  5144. arg=$func_stripname_result
  5145. ;;
  5146. -Xcompiler)
  5147. prev=xcompiler
  5148. continue
  5149. ;;
  5150. -Xlinker)
  5151. prev=xlinker
  5152. continue
  5153. ;;
  5154. -XCClinker)
  5155. prev=xcclinker
  5156. continue
  5157. ;;
  5158. # -msg_* for osf cc
  5159. -msg_*)
  5160. func_quote_for_eval "$arg"
  5161. arg="$func_quote_for_eval_result"
  5162. ;;
  5163. # Flags to be passed through unchanged, with rationale:
  5164. # -64, -mips[0-9] enable 64-bit mode for the SGI compiler
  5165. # -r[0-9][0-9]* specify processor for the SGI compiler
  5166. # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler
  5167. # +DA*, +DD* enable 64-bit mode for the HP compiler
  5168. # -q* compiler args for the IBM compiler
  5169. # -m*, -t[45]*, -txscale* architecture-specific flags for GCC
  5170. # -F/path path to uninstalled frameworks, gcc on darwin
  5171. # -p, -pg, --coverage, -fprofile-* profiling flags for GCC
  5172. # @file GCC response files
  5173. # -tp=* Portland pgcc target processor selection
  5174. # --sysroot=* for sysroot support
  5175. # -O*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization
  5176. -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
  5177. -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \
  5178. -O*|-flto*|-fwhopr*|-fuse-linker-plugin)
  5179. func_quote_for_eval "$arg"
  5180. arg="$func_quote_for_eval_result"
  5181. func_append compile_command " $arg"
  5182. func_append finalize_command " $arg"
  5183. func_append compiler_flags " $arg"
  5184. continue
  5185. ;;
  5186. # Some other compiler flag.
  5187. -* | +*)
  5188. func_quote_for_eval "$arg"
  5189. arg="$func_quote_for_eval_result"
  5190. ;;
  5191. *.$objext)
  5192. # A standard object.
  5193. func_append objs " $arg"
  5194. ;;
  5195. *.lo)
  5196. # A libtool-controlled object.
  5197. # Check to see that this really is a libtool object.
  5198. if func_lalib_unsafe_p "$arg"; then
  5199. pic_object=
  5200. non_pic_object=
  5201. # Read the .lo file
  5202. func_source "$arg"
  5203. if test -z "$pic_object" ||
  5204. test -z "$non_pic_object" ||
  5205. test "$pic_object" = none &&
  5206. test "$non_pic_object" = none; then
  5207. func_fatal_error "cannot find name of object for \`$arg'"
  5208. fi
  5209. # Extract subdirectory from the argument.
  5210. func_dirname "$arg" "/" ""
  5211. xdir="$func_dirname_result"
  5212. if test "$pic_object" != none; then
  5213. # Prepend the subdirectory the object is found in.
  5214. pic_object="$xdir$pic_object"
  5215. if test "$prev" = dlfiles; then
  5216. if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
  5217. func_append dlfiles " $pic_object"
  5218. prev=
  5219. continue
  5220. else
  5221. # If libtool objects are unsupported, then we need to preload.
  5222. prev=dlprefiles
  5223. fi
  5224. fi
  5225. # CHECK ME: I think I busted this. -Ossama
  5226. if test "$prev" = dlprefiles; then
  5227. # Preload the old-style object.
  5228. func_append dlprefiles " $pic_object"
  5229. prev=
  5230. fi
  5231. # A PIC object.
  5232. func_append libobjs " $pic_object"
  5233. arg="$pic_object"
  5234. fi
  5235. # Non-PIC object.
  5236. if test "$non_pic_object" != none; then
  5237. # Prepend the subdirectory the object is found in.
  5238. non_pic_object="$xdir$non_pic_object"
  5239. # A standard non-PIC object
  5240. func_append non_pic_objects " $non_pic_object"
  5241. if test -z "$pic_object" || test "$pic_object" = none ; then
  5242. arg="$non_pic_object"
  5243. fi
  5244. else
  5245. # If the PIC object exists, use it instead.
  5246. # $xdir was prepended to $pic_object above.
  5247. non_pic_object="$pic_object"
  5248. func_append non_pic_objects " $non_pic_object"
  5249. fi
  5250. else
  5251. # Only an error if not doing a dry-run.
  5252. if $opt_dry_run; then
  5253. # Extract subdirectory from the argument.
  5254. func_dirname "$arg" "/" ""
  5255. xdir="$func_dirname_result"
  5256. func_lo2o "$arg"
  5257. pic_object=$xdir$objdir/$func_lo2o_result
  5258. non_pic_object=$xdir$func_lo2o_result
  5259. func_append libobjs " $pic_object"
  5260. func_append non_pic_objects " $non_pic_object"
  5261. else
  5262. func_fatal_error "\`$arg' is not a valid libtool object"
  5263. fi
  5264. fi
  5265. ;;
  5266. *.$libext)
  5267. # An archive.
  5268. func_append deplibs " $arg"
  5269. func_append old_deplibs " $arg"
  5270. continue
  5271. ;;
  5272. *.la)
  5273. # A libtool-controlled library.
  5274. func_resolve_sysroot "$arg"
  5275. if test "$prev" = dlfiles; then
  5276. # This library was specified with -dlopen.
  5277. func_append dlfiles " $func_resolve_sysroot_result"
  5278. prev=
  5279. elif test "$prev" = dlprefiles; then
  5280. # The library was specified with -dlpreopen.
  5281. func_append dlprefiles " $func_resolve_sysroot_result"
  5282. prev=
  5283. else
  5284. func_append deplibs " $func_resolve_sysroot_result"
  5285. fi
  5286. continue
  5287. ;;
  5288. # Some other compiler argument.
  5289. *)
  5290. # Unknown arguments in both finalize_command and compile_command need
  5291. # to be aesthetically quoted because they are evaled later.
  5292. func_quote_for_eval "$arg"
  5293. arg="$func_quote_for_eval_result"
  5294. ;;
  5295. esac # arg
  5296. # Now actually substitute the argument into the commands.
  5297. if test -n "$arg"; then
  5298. func_append compile_command " $arg"
  5299. func_append finalize_command " $arg"
  5300. fi
  5301. done # argument parsing loop
  5302. test -n "$prev" && \
  5303. func_fatal_help "the \`$prevarg' option requires an argument"
  5304. if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
  5305. eval arg=\"$export_dynamic_flag_spec\"
  5306. func_append compile_command " $arg"
  5307. func_append finalize_command " $arg"
  5308. fi
  5309. oldlibs=
  5310. # calculate the name of the file, without its directory
  5311. func_basename "$output"
  5312. outputname="$func_basename_result"
  5313. libobjs_save="$libobjs"
  5314. if test -n "$shlibpath_var"; then
  5315. # get the directories listed in $shlibpath_var
  5316. eval shlib_search_path=\`\$ECHO \"\${$shlibpath_var}\" \| \$SED \'s/:/ /g\'\`
  5317. else
  5318. shlib_search_path=
  5319. fi
  5320. eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
  5321. eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
  5322. func_dirname "$output" "/" ""
  5323. output_objdir="$func_dirname_result$objdir"
  5324. func_to_tool_file "$output_objdir/"
  5325. tool_output_objdir=$func_to_tool_file_result
  5326. # Create the object directory.
  5327. func_mkdir_p "$output_objdir"
  5328. # Determine the type of output
  5329. case $output in
  5330. "")
  5331. func_fatal_help "you must specify an output file"
  5332. ;;
  5333. *.$libext) linkmode=oldlib ;;
  5334. *.lo | *.$objext) linkmode=obj ;;
  5335. *.la) linkmode=lib ;;
  5336. *) linkmode=prog ;; # Anything else should be a program.
  5337. esac
  5338. specialdeplibs=
  5339. libs=
  5340. # Find all interdependent deplibs by searching for libraries
  5341. # that are linked more than once (e.g. -la -lb -la)
  5342. for deplib in $deplibs; do
  5343. if $opt_preserve_dup_deps ; then
  5344. case "$libs " in
  5345. *" $deplib "*) func_append specialdeplibs " $deplib" ;;
  5346. esac
  5347. fi
  5348. func_append libs " $deplib"
  5349. done
  5350. if test "$linkmode" = lib; then
  5351. libs="$predeps $libs $compiler_lib_search_path $postdeps"
  5352. # Compute libraries that are listed more than once in $predeps
  5353. # $postdeps and mark them as special (i.e., whose duplicates are
  5354. # not to be eliminated).
  5355. pre_post_deps=
  5356. if $opt_duplicate_compiler_generated_deps; then
  5357. for pre_post_dep in $predeps $postdeps; do
  5358. case "$pre_post_deps " in
  5359. *" $pre_post_dep "*) func_append specialdeplibs " $pre_post_deps" ;;
  5360. esac
  5361. func_append pre_post_deps " $pre_post_dep"
  5362. done
  5363. fi
  5364. pre_post_deps=
  5365. fi
  5366. deplibs=
  5367. newdependency_libs=
  5368. newlib_search_path=
  5369. need_relink=no # whether we're linking any uninstalled libtool libraries
  5370. notinst_deplibs= # not-installed libtool libraries
  5371. notinst_path= # paths that contain not-installed libtool libraries
  5372. case $linkmode in
  5373. lib)
  5374. passes="conv dlpreopen link"
  5375. for file in $dlfiles $dlprefiles; do
  5376. case $file in
  5377. *.la) ;;
  5378. *)
  5379. func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file"
  5380. ;;
  5381. esac
  5382. done
  5383. ;;
  5384. prog)
  5385. compile_deplibs=
  5386. finalize_deplibs=
  5387. alldeplibs=no
  5388. newdlfiles=
  5389. newdlprefiles=
  5390. passes="conv scan dlopen dlpreopen link"
  5391. ;;
  5392. *) passes="conv"
  5393. ;;
  5394. esac
  5395. for pass in $passes; do
  5396. # The preopen pass in lib mode reverses $deplibs; put it back here
  5397. # so that -L comes before libs that need it for instance...
  5398. if test "$linkmode,$pass" = "lib,link"; then
  5399. ## FIXME: Find the place where the list is rebuilt in the wrong
  5400. ## order, and fix it there properly
  5401. tmp_deplibs=
  5402. for deplib in $deplibs; do
  5403. tmp_deplibs="$deplib $tmp_deplibs"
  5404. done
  5405. deplibs="$tmp_deplibs"
  5406. fi
  5407. if test "$linkmode,$pass" = "lib,link" ||
  5408. test "$linkmode,$pass" = "prog,scan"; then
  5409. libs="$deplibs"
  5410. deplibs=
  5411. fi
  5412. if test "$linkmode" = prog; then
  5413. case $pass in
  5414. dlopen) libs="$dlfiles" ;;
  5415. dlpreopen) libs="$dlprefiles" ;;
  5416. link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
  5417. esac
  5418. fi
  5419. if test "$linkmode,$pass" = "lib,dlpreopen"; then
  5420. # Collect and forward deplibs of preopened libtool libs
  5421. for lib in $dlprefiles; do
  5422. # Ignore non-libtool-libs
  5423. dependency_libs=
  5424. func_resolve_sysroot "$lib"
  5425. case $lib in
  5426. *.la) func_source "$func_resolve_sysroot_result" ;;
  5427. esac
  5428. # Collect preopened libtool deplibs, except any this library
  5429. # has declared as weak libs
  5430. for deplib in $dependency_libs; do
  5431. func_basename "$deplib"
  5432. deplib_base=$func_basename_result
  5433. case " $weak_libs " in
  5434. *" $deplib_base "*) ;;
  5435. *) func_append deplibs " $deplib" ;;
  5436. esac
  5437. done
  5438. done
  5439. libs="$dlprefiles"
  5440. fi
  5441. if test "$pass" = dlopen; then
  5442. # Collect dlpreopened libraries
  5443. save_deplibs="$deplibs"
  5444. deplibs=
  5445. fi
  5446. for deplib in $libs; do
  5447. lib=
  5448. found=no
  5449. case $deplib in
  5450. -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
  5451. if test "$linkmode,$pass" = "prog,link"; then
  5452. compile_deplibs="$deplib $compile_deplibs"
  5453. finalize_deplibs="$deplib $finalize_deplibs"
  5454. else
  5455. func_append compiler_flags " $deplib"
  5456. if test "$linkmode" = lib ; then
  5457. case "$new_inherited_linker_flags " in
  5458. *" $deplib "*) ;;
  5459. * ) func_append new_inherited_linker_flags " $deplib" ;;
  5460. esac
  5461. fi
  5462. fi
  5463. continue
  5464. ;;
  5465. -l*)
  5466. if test "$linkmode" != lib && test "$linkmode" != prog; then
  5467. func_warning "\`-l' is ignored for archives/objects"
  5468. continue
  5469. fi
  5470. func_stripname '-l' '' "$deplib"
  5471. name=$func_stripname_result
  5472. if test "$linkmode" = lib; then
  5473. searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path"
  5474. else
  5475. searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path"
  5476. fi
  5477. for searchdir in $searchdirs; do
  5478. for search_ext in .la $std_shrext .so .a; do
  5479. # Search the libtool library
  5480. lib="$searchdir/lib${name}${search_ext}"
  5481. if test -f "$lib"; then
  5482. if test "$search_ext" = ".la"; then
  5483. found=yes
  5484. else
  5485. found=no
  5486. fi
  5487. break 2
  5488. fi
  5489. done
  5490. done
  5491. if test "$found" != yes; then
  5492. # deplib doesn't seem to be a libtool library
  5493. if test "$linkmode,$pass" = "prog,link"; then
  5494. compile_deplibs="$deplib $compile_deplibs"
  5495. finalize_deplibs="$deplib $finalize_deplibs"
  5496. else
  5497. deplibs="$deplib $deplibs"
  5498. test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
  5499. fi
  5500. continue
  5501. else # deplib is a libtool library
  5502. # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
  5503. # We need to do some special things here, and not later.
  5504. if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
  5505. case " $predeps $postdeps " in
  5506. *" $deplib "*)
  5507. if func_lalib_p "$lib"; then
  5508. library_names=
  5509. old_library=
  5510. func_source "$lib"
  5511. for l in $old_library $library_names; do
  5512. ll="$l"
  5513. done
  5514. if test "X$ll" = "X$old_library" ; then # only static version available
  5515. found=no
  5516. func_dirname "$lib" "" "."
  5517. ladir="$func_dirname_result"
  5518. lib=$ladir/$old_library
  5519. if test "$linkmode,$pass" = "prog,link"; then
  5520. compile_deplibs="$deplib $compile_deplibs"
  5521. finalize_deplibs="$deplib $finalize_deplibs"
  5522. else
  5523. deplibs="$deplib $deplibs"
  5524. test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
  5525. fi
  5526. continue
  5527. fi
  5528. fi
  5529. ;;
  5530. *) ;;
  5531. esac
  5532. fi
  5533. fi
  5534. ;; # -l
  5535. *.ltframework)
  5536. if test "$linkmode,$pass" = "prog,link"; then
  5537. compile_deplibs="$deplib $compile_deplibs"
  5538. finalize_deplibs="$deplib $finalize_deplibs"
  5539. else
  5540. deplibs="$deplib $deplibs"
  5541. if test "$linkmode" = lib ; then
  5542. case "$new_inherited_linker_flags " in
  5543. *" $deplib "*) ;;
  5544. * ) func_append new_inherited_linker_flags " $deplib" ;;
  5545. esac
  5546. fi
  5547. fi
  5548. continue
  5549. ;;
  5550. -L*)
  5551. case $linkmode in
  5552. lib)
  5553. deplibs="$deplib $deplibs"
  5554. test "$pass" = conv && continue
  5555. newdependency_libs="$deplib $newdependency_libs"
  5556. func_stripname '-L' '' "$deplib"
  5557. func_resolve_sysroot "$func_stripname_result"
  5558. func_append newlib_search_path " $func_resolve_sysroot_result"
  5559. ;;
  5560. prog)
  5561. if test "$pass" = conv; then
  5562. deplibs="$deplib $deplibs"
  5563. continue
  5564. fi
  5565. if test "$pass" = scan; then
  5566. deplibs="$deplib $deplibs"
  5567. else
  5568. compile_deplibs="$deplib $compile_deplibs"
  5569. finalize_deplibs="$deplib $finalize_deplibs"
  5570. fi
  5571. func_stripname '-L' '' "$deplib"
  5572. func_resolve_sysroot "$func_stripname_result"
  5573. func_append newlib_search_path " $func_resolve_sysroot_result"
  5574. ;;
  5575. *)
  5576. func_warning "\`-L' is ignored for archives/objects"
  5577. ;;
  5578. esac # linkmode
  5579. continue
  5580. ;; # -L
  5581. -R*)
  5582. if test "$pass" = link; then
  5583. func_stripname '-R' '' "$deplib"
  5584. func_resolve_sysroot "$func_stripname_result"
  5585. dir=$func_resolve_sysroot_result
  5586. # Make sure the xrpath contains only unique directories.
  5587. case "$xrpath " in
  5588. *" $dir "*) ;;
  5589. *) func_append xrpath " $dir" ;;
  5590. esac
  5591. fi
  5592. deplibs="$deplib $deplibs"
  5593. continue
  5594. ;;
  5595. *.la)
  5596. func_resolve_sysroot "$deplib"
  5597. lib=$func_resolve_sysroot_result
  5598. ;;
  5599. *.$libext)
  5600. if test "$pass" = conv; then
  5601. deplibs="$deplib $deplibs"
  5602. continue
  5603. fi
  5604. case $linkmode in
  5605. lib)
  5606. # Linking convenience modules into shared libraries is allowed,
  5607. # but linking other static libraries is non-portable.
  5608. case " $dlpreconveniencelibs " in
  5609. *" $deplib "*) ;;
  5610. *)
  5611. valid_a_lib=no
  5612. case $deplibs_check_method in
  5613. match_pattern*)
  5614. set dummy $deplibs_check_method; shift
  5615. match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
  5616. if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \
  5617. | $EGREP "$match_pattern_regex" > /dev/null; then
  5618. valid_a_lib=yes
  5619. fi
  5620. ;;
  5621. pass_all)
  5622. valid_a_lib=yes
  5623. ;;
  5624. esac
  5625. if test "$valid_a_lib" != yes; then
  5626. echo
  5627. $ECHO "*** Warning: Trying to link with static lib archive $deplib."
  5628. echo "*** I have the capability to make that library automatically link in when"
  5629. echo "*** you link to this library. But I can only do this if you have a"
  5630. echo "*** shared version of the library, which you do not appear to have"
  5631. echo "*** because the file extensions .$libext of this argument makes me believe"
  5632. echo "*** that it is just a static archive that I should not use here."
  5633. else
  5634. echo
  5635. $ECHO "*** Warning: Linking the shared library $output against the"
  5636. $ECHO "*** static library $deplib is not portable!"
  5637. deplibs="$deplib $deplibs"
  5638. fi
  5639. ;;
  5640. esac
  5641. continue
  5642. ;;
  5643. prog)
  5644. if test "$pass" != link; then
  5645. deplibs="$deplib $deplibs"
  5646. else
  5647. compile_deplibs="$deplib $compile_deplibs"
  5648. finalize_deplibs="$deplib $finalize_deplibs"
  5649. fi
  5650. continue
  5651. ;;
  5652. esac # linkmode
  5653. ;; # *.$libext
  5654. *.lo | *.$objext)
  5655. if test "$pass" = conv; then
  5656. deplibs="$deplib $deplibs"
  5657. elif test "$linkmode" = prog; then
  5658. if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
  5659. # If there is no dlopen support or we're linking statically,
  5660. # we need to preload.
  5661. func_append newdlprefiles " $deplib"
  5662. compile_deplibs="$deplib $compile_deplibs"
  5663. finalize_deplibs="$deplib $finalize_deplibs"
  5664. else
  5665. func_append newdlfiles " $deplib"
  5666. fi
  5667. fi
  5668. continue
  5669. ;;
  5670. %DEPLIBS%)
  5671. alldeplibs=yes
  5672. continue
  5673. ;;
  5674. esac # case $deplib
  5675. if test "$found" = yes || test -f "$lib"; then :
  5676. else
  5677. func_fatal_error "cannot find the library \`$lib' or unhandled argument \`$deplib'"
  5678. fi
  5679. # Check to see that this really is a libtool archive.
  5680. func_lalib_unsafe_p "$lib" \
  5681. || func_fatal_error "\`$lib' is not a valid libtool archive"
  5682. func_dirname "$lib" "" "."
  5683. ladir="$func_dirname_result"
  5684. dlname=
  5685. dlopen=
  5686. dlpreopen=
  5687. libdir=
  5688. library_names=
  5689. old_library=
  5690. inherited_linker_flags=
  5691. # If the library was installed with an old release of libtool,
  5692. # it will not redefine variables installed, or shouldnotlink
  5693. installed=yes
  5694. shouldnotlink=no
  5695. avoidtemprpath=
  5696. # Read the .la file
  5697. func_source "$lib"
  5698. # Convert "-framework foo" to "foo.ltframework"
  5699. if test -n "$inherited_linker_flags"; then
  5700. tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'`
  5701. for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do
  5702. case " $new_inherited_linker_flags " in
  5703. *" $tmp_inherited_linker_flag "*) ;;
  5704. *) func_append new_inherited_linker_flags " $tmp_inherited_linker_flag";;
  5705. esac
  5706. done
  5707. fi
  5708. dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
  5709. if test "$linkmode,$pass" = "lib,link" ||
  5710. test "$linkmode,$pass" = "prog,scan" ||
  5711. { test "$linkmode" != prog && test "$linkmode" != lib; }; then
  5712. test -n "$dlopen" && func_append dlfiles " $dlopen"
  5713. test -n "$dlpreopen" && func_append dlprefiles " $dlpreopen"
  5714. fi
  5715. if test "$pass" = conv; then
  5716. # Only check for convenience libraries
  5717. deplibs="$lib $deplibs"
  5718. if test -z "$libdir"; then
  5719. if test -z "$old_library"; then
  5720. func_fatal_error "cannot find name of link library for \`$lib'"
  5721. fi
  5722. # It is a libtool convenience library, so add in its objects.
  5723. func_append convenience " $ladir/$objdir/$old_library"
  5724. func_append old_convenience " $ladir/$objdir/$old_library"
  5725. elif test "$linkmode" != prog && test "$linkmode" != lib; then
  5726. func_fatal_error "\`$lib' is not a convenience library"
  5727. fi
  5728. tmp_libs=
  5729. for deplib in $dependency_libs; do
  5730. deplibs="$deplib $deplibs"
  5731. if $opt_preserve_dup_deps ; then
  5732. case "$tmp_libs " in
  5733. *" $deplib "*) func_append specialdeplibs " $deplib" ;;
  5734. esac
  5735. fi
  5736. func_append tmp_libs " $deplib"
  5737. done
  5738. continue
  5739. fi # $pass = conv
  5740. # Get the name of the library we link against.
  5741. linklib=
  5742. if test -n "$old_library" &&
  5743. { test "$prefer_static_libs" = yes ||
  5744. test "$prefer_static_libs,$installed" = "built,no"; }; then
  5745. linklib=$old_library
  5746. else
  5747. for l in $old_library $library_names; do
  5748. linklib="$l"
  5749. done
  5750. fi
  5751. if test -z "$linklib"; then
  5752. func_fatal_error "cannot find name of link library for \`$lib'"
  5753. fi
  5754. # This library was specified with -dlopen.
  5755. if test "$pass" = dlopen; then
  5756. if test -z "$libdir"; then
  5757. func_fatal_error "cannot -dlopen a convenience library: \`$lib'"
  5758. fi
  5759. if test -z "$dlname" ||
  5760. test "$dlopen_support" != yes ||
  5761. test "$build_libtool_libs" = no; then
  5762. # If there is no dlname, no dlopen support or we're linking
  5763. # statically, we need to preload. We also need to preload any
  5764. # dependent libraries so libltdl's deplib preloader doesn't
  5765. # bomb out in the load deplibs phase.
  5766. func_append dlprefiles " $lib $dependency_libs"
  5767. else
  5768. func_append newdlfiles " $lib"
  5769. fi
  5770. continue
  5771. fi # $pass = dlopen
  5772. # We need an absolute path.
  5773. case $ladir in
  5774. [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
  5775. *)
  5776. abs_ladir=`cd "$ladir" && pwd`
  5777. if test -z "$abs_ladir"; then
  5778. func_warning "cannot determine absolute directory name of \`$ladir'"
  5779. func_warning "passing it literally to the linker, although it might fail"
  5780. abs_ladir="$ladir"
  5781. fi
  5782. ;;
  5783. esac
  5784. func_basename "$lib"
  5785. laname="$func_basename_result"
  5786. # Find the relevant object directory and library name.
  5787. if test "X$installed" = Xyes; then
  5788. if test ! -f "$lt_sysroot$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
  5789. func_warning "library \`$lib' was moved."
  5790. dir="$ladir"
  5791. absdir="$abs_ladir"
  5792. libdir="$abs_ladir"
  5793. else
  5794. dir="$lt_sysroot$libdir"
  5795. absdir="$lt_sysroot$libdir"
  5796. fi
  5797. test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
  5798. else
  5799. if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
  5800. dir="$ladir"
  5801. absdir="$abs_ladir"
  5802. # Remove this search path later
  5803. func_append notinst_path " $abs_ladir"
  5804. else
  5805. dir="$ladir/$objdir"
  5806. absdir="$abs_ladir/$objdir"
  5807. # Remove this search path later
  5808. func_append notinst_path " $abs_ladir"
  5809. fi
  5810. fi # $installed = yes
  5811. func_stripname 'lib' '.la' "$laname"
  5812. name=$func_stripname_result
  5813. # This library was specified with -dlpreopen.
  5814. if test "$pass" = dlpreopen; then
  5815. if test -z "$libdir" && test "$linkmode" = prog; then
  5816. func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'"
  5817. fi
  5818. case "$host" in
  5819. # special handling for platforms with PE-DLLs.
  5820. *cygwin* | *mingw* | *cegcc* )
  5821. # Linker will automatically link against shared library if both
  5822. # static and shared are present. Therefore, ensure we extract
  5823. # symbols from the import library if a shared library is present
  5824. # (otherwise, the dlopen module name will be incorrect). We do
  5825. # this by putting the import library name into $newdlprefiles.
  5826. # We recover the dlopen module name by 'saving' the la file
  5827. # name in a special purpose variable, and (later) extracting the
  5828. # dlname from the la file.
  5829. if test -n "$dlname"; then
  5830. func_tr_sh "$dir/$linklib"
  5831. eval "libfile_$func_tr_sh_result=\$abs_ladir/\$laname"
  5832. func_append newdlprefiles " $dir/$linklib"
  5833. else
  5834. func_append newdlprefiles " $dir/$old_library"
  5835. # Keep a list of preopened convenience libraries to check
  5836. # that they are being used correctly in the link pass.
  5837. test -z "$libdir" && \
  5838. func_append dlpreconveniencelibs " $dir/$old_library"
  5839. fi
  5840. ;;
  5841. * )
  5842. # Prefer using a static library (so that no silly _DYNAMIC symbols
  5843. # are required to link).
  5844. if test -n "$old_library"; then
  5845. func_append newdlprefiles " $dir/$old_library"
  5846. # Keep a list of preopened convenience libraries to check
  5847. # that they are being used correctly in the link pass.
  5848. test -z "$libdir" && \
  5849. func_append dlpreconveniencelibs " $dir/$old_library"
  5850. # Otherwise, use the dlname, so that lt_dlopen finds it.
  5851. elif test -n "$dlname"; then
  5852. func_append newdlprefiles " $dir/$dlname"
  5853. else
  5854. func_append newdlprefiles " $dir/$linklib"
  5855. fi
  5856. ;;
  5857. esac
  5858. fi # $pass = dlpreopen
  5859. if test -z "$libdir"; then
  5860. # Link the convenience library
  5861. if test "$linkmode" = lib; then
  5862. deplibs="$dir/$old_library $deplibs"
  5863. elif test "$linkmode,$pass" = "prog,link"; then
  5864. compile_deplibs="$dir/$old_library $compile_deplibs"
  5865. finalize_deplibs="$dir/$old_library $finalize_deplibs"
  5866. else
  5867. deplibs="$lib $deplibs" # used for prog,scan pass
  5868. fi
  5869. continue
  5870. fi
  5871. if test "$linkmode" = prog && test "$pass" != link; then
  5872. func_append newlib_search_path " $ladir"
  5873. deplibs="$lib $deplibs"
  5874. linkalldeplibs=no
  5875. if test "$link_all_deplibs" != no || test -z "$library_names" ||
  5876. test "$build_libtool_libs" = no; then
  5877. linkalldeplibs=yes
  5878. fi
  5879. tmp_libs=
  5880. for deplib in $dependency_libs; do
  5881. case $deplib in
  5882. -L*) func_stripname '-L' '' "$deplib"
  5883. func_resolve_sysroot "$func_stripname_result"
  5884. func_append newlib_search_path " $func_resolve_sysroot_result"
  5885. ;;
  5886. esac
  5887. # Need to link against all dependency_libs?
  5888. if test "$linkalldeplibs" = yes; then
  5889. deplibs="$deplib $deplibs"
  5890. else
  5891. # Need to hardcode shared library paths
  5892. # or/and link against static libraries
  5893. newdependency_libs="$deplib $newdependency_libs"
  5894. fi
  5895. if $opt_preserve_dup_deps ; then
  5896. case "$tmp_libs " in
  5897. *" $deplib "*) func_append specialdeplibs " $deplib" ;;
  5898. esac
  5899. fi
  5900. func_append tmp_libs " $deplib"
  5901. done # for deplib
  5902. continue
  5903. fi # $linkmode = prog...
  5904. if test "$linkmode,$pass" = "prog,link"; then
  5905. if test -n "$library_names" &&
  5906. { { test "$prefer_static_libs" = no ||
  5907. test "$prefer_static_libs,$installed" = "built,yes"; } ||
  5908. test -z "$old_library"; }; then
  5909. # We need to hardcode the library path
  5910. if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
  5911. # Make sure the rpath contains only unique directories.
  5912. case "$temp_rpath:" in
  5913. *"$absdir:"*) ;;
  5914. *) func_append temp_rpath "$absdir:" ;;
  5915. esac
  5916. fi
  5917. # Hardcode the library path.
  5918. # Skip directories that are in the system default run-time
  5919. # search path.
  5920. case " $sys_lib_dlsearch_path " in
  5921. *" $absdir "*) ;;
  5922. *)
  5923. case "$compile_rpath " in
  5924. *" $absdir "*) ;;
  5925. *) func_append compile_rpath " $absdir" ;;
  5926. esac
  5927. ;;
  5928. esac
  5929. case " $sys_lib_dlsearch_path " in
  5930. *" $libdir "*) ;;
  5931. *)
  5932. case "$finalize_rpath " in
  5933. *" $libdir "*) ;;
  5934. *) func_append finalize_rpath " $libdir" ;;
  5935. esac
  5936. ;;
  5937. esac
  5938. fi # $linkmode,$pass = prog,link...
  5939. if test "$alldeplibs" = yes &&
  5940. { test "$deplibs_check_method" = pass_all ||
  5941. { test "$build_libtool_libs" = yes &&
  5942. test -n "$library_names"; }; }; then
  5943. # We only need to search for static libraries
  5944. continue
  5945. fi
  5946. fi
  5947. link_static=no # Whether the deplib will be linked statically
  5948. use_static_libs=$prefer_static_libs
  5949. if test "$use_static_libs" = built && test "$installed" = yes; then
  5950. use_static_libs=no
  5951. fi
  5952. if test -n "$library_names" &&
  5953. { test "$use_static_libs" = no || test -z "$old_library"; }; then
  5954. case $host in
  5955. *cygwin* | *mingw* | *cegcc*)
  5956. # No point in relinking DLLs because paths are not encoded
  5957. func_append notinst_deplibs " $lib"
  5958. need_relink=no
  5959. ;;
  5960. *)
  5961. if test "$installed" = no; then
  5962. func_append notinst_deplibs " $lib"
  5963. need_relink=yes
  5964. fi
  5965. ;;
  5966. esac
  5967. # This is a shared library
  5968. # Warn about portability, can't link against -module's on some
  5969. # systems (darwin). Don't bleat about dlopened modules though!
  5970. dlopenmodule=""
  5971. for dlpremoduletest in $dlprefiles; do
  5972. if test "X$dlpremoduletest" = "X$lib"; then
  5973. dlopenmodule="$dlpremoduletest"
  5974. break
  5975. fi
  5976. done
  5977. if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then
  5978. echo
  5979. if test "$linkmode" = prog; then
  5980. $ECHO "*** Warning: Linking the executable $output against the loadable module"
  5981. else
  5982. $ECHO "*** Warning: Linking the shared library $output against the loadable module"
  5983. fi
  5984. $ECHO "*** $linklib is not portable!"
  5985. fi
  5986. if test "$linkmode" = lib &&
  5987. test "$hardcode_into_libs" = yes; then
  5988. # Hardcode the library path.
  5989. # Skip directories that are in the system default run-time
  5990. # search path.
  5991. case " $sys_lib_dlsearch_path " in
  5992. *" $absdir "*) ;;
  5993. *)
  5994. case "$compile_rpath " in
  5995. *" $absdir "*) ;;
  5996. *) func_append compile_rpath " $absdir" ;;
  5997. esac
  5998. ;;
  5999. esac
  6000. case " $sys_lib_dlsearch_path " in
  6001. *" $libdir "*) ;;
  6002. *)
  6003. case "$finalize_rpath " in
  6004. *" $libdir "*) ;;
  6005. *) func_append finalize_rpath " $libdir" ;;
  6006. esac
  6007. ;;
  6008. esac
  6009. fi
  6010. if test -n "$old_archive_from_expsyms_cmds"; then
  6011. # figure out the soname
  6012. set dummy $library_names
  6013. shift
  6014. realname="$1"
  6015. shift
  6016. libname=`eval "\\$ECHO \"$libname_spec\""`
  6017. # use dlname if we got it. it's perfectly good, no?
  6018. if test -n "$dlname"; then
  6019. soname="$dlname"
  6020. elif test -n "$soname_spec"; then
  6021. # bleh windows
  6022. case $host in
  6023. *cygwin* | mingw* | *cegcc*)
  6024. func_arith $current - $age
  6025. major=$func_arith_result
  6026. versuffix="-$major"
  6027. ;;
  6028. esac
  6029. eval soname=\"$soname_spec\"
  6030. else
  6031. soname="$realname"
  6032. fi
  6033. # Make a new name for the extract_expsyms_cmds to use
  6034. soroot="$soname"
  6035. func_basename "$soroot"
  6036. soname="$func_basename_result"
  6037. func_stripname 'lib' '.dll' "$soname"
  6038. newlib=libimp-$func_stripname_result.a
  6039. # If the library has no export list, then create one now
  6040. if test -f "$output_objdir/$soname-def"; then :
  6041. else
  6042. func_verbose "extracting exported symbol list from \`$soname'"
  6043. func_execute_cmds "$extract_expsyms_cmds" 'exit $?'
  6044. fi
  6045. # Create $newlib
  6046. if test -f "$output_objdir/$newlib"; then :; else
  6047. func_verbose "generating import library for \`$soname'"
  6048. func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?'
  6049. fi
  6050. # make sure the library variables are pointing to the new library
  6051. dir=$output_objdir
  6052. linklib=$newlib
  6053. fi # test -n "$old_archive_from_expsyms_cmds"
  6054. if test "$linkmode" = prog || test "$opt_mode" != relink; then
  6055. add_shlibpath=
  6056. add_dir=
  6057. add=
  6058. lib_linked=yes
  6059. case $hardcode_action in
  6060. immediate | unsupported)
  6061. if test "$hardcode_direct" = no; then
  6062. add="$dir/$linklib"
  6063. case $host in
  6064. *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;;
  6065. *-*-sysv4*uw2*) add_dir="-L$dir" ;;
  6066. *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
  6067. *-*-unixware7*) add_dir="-L$dir" ;;
  6068. *-*-darwin* )
  6069. # if the lib is a (non-dlopened) module then we can not
  6070. # link against it, someone is ignoring the earlier warnings
  6071. if /usr/bin/file -L $add 2> /dev/null |
  6072. $GREP ": [^:]* bundle" >/dev/null ; then
  6073. if test "X$dlopenmodule" != "X$lib"; then
  6074. $ECHO "*** Warning: lib $linklib is a module, not a shared library"
  6075. if test -z "$old_library" ; then
  6076. echo
  6077. echo "*** And there doesn't seem to be a static archive available"
  6078. echo "*** The link will probably fail, sorry"
  6079. else
  6080. add="$dir/$old_library"
  6081. fi
  6082. elif test -n "$old_library"; then
  6083. add="$dir/$old_library"
  6084. fi
  6085. fi
  6086. esac
  6087. elif test "$hardcode_minus_L" = no; then
  6088. case $host in
  6089. *-*-sunos*) add_shlibpath="$dir" ;;
  6090. esac
  6091. add_dir="-L$dir"
  6092. add="-l$name"
  6093. elif test "$hardcode_shlibpath_var" = no; then
  6094. add_shlibpath="$dir"
  6095. add="-l$name"
  6096. else
  6097. lib_linked=no
  6098. fi
  6099. ;;
  6100. relink)
  6101. if test "$hardcode_direct" = yes &&
  6102. test "$hardcode_direct_absolute" = no; then
  6103. add="$dir/$linklib"
  6104. elif test "$hardcode_minus_L" = yes; then
  6105. add_dir="-L$dir"
  6106. # Try looking first in the location we're being installed to.
  6107. if test -n "$inst_prefix_dir"; then
  6108. case $libdir in
  6109. [\\/]*)
  6110. func_append add_dir " -L$inst_prefix_dir$libdir"
  6111. ;;
  6112. esac
  6113. fi
  6114. add="-l$name"
  6115. elif test "$hardcode_shlibpath_var" = yes; then
  6116. add_shlibpath="$dir"
  6117. add="-l$name"
  6118. else
  6119. lib_linked=no
  6120. fi
  6121. ;;
  6122. *) lib_linked=no ;;
  6123. esac
  6124. if test "$lib_linked" != yes; then
  6125. func_fatal_configuration "unsupported hardcode properties"
  6126. fi
  6127. if test -n "$add_shlibpath"; then
  6128. case :$compile_shlibpath: in
  6129. *":$add_shlibpath:"*) ;;
  6130. *) func_append compile_shlibpath "$add_shlibpath:" ;;
  6131. esac
  6132. fi
  6133. if test "$linkmode" = prog; then
  6134. test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
  6135. test -n "$add" && compile_deplibs="$add $compile_deplibs"
  6136. else
  6137. test -n "$add_dir" && deplibs="$add_dir $deplibs"
  6138. test -n "$add" && deplibs="$add $deplibs"
  6139. if test "$hardcode_direct" != yes &&
  6140. test "$hardcode_minus_L" != yes &&
  6141. test "$hardcode_shlibpath_var" = yes; then
  6142. case :$finalize_shlibpath: in
  6143. *":$libdir:"*) ;;
  6144. *) func_append finalize_shlibpath "$libdir:" ;;
  6145. esac
  6146. fi
  6147. fi
  6148. fi
  6149. if test "$linkmode" = prog || test "$opt_mode" = relink; then
  6150. add_shlibpath=
  6151. add_dir=
  6152. add=
  6153. # Finalize command for both is simple: just hardcode it.
  6154. if test "$hardcode_direct" = yes &&
  6155. test "$hardcode_direct_absolute" = no; then
  6156. add="$libdir/$linklib"
  6157. elif test "$hardcode_minus_L" = yes; then
  6158. add_dir="-L$libdir"
  6159. add="-l$name"
  6160. elif test "$hardcode_shlibpath_var" = yes; then
  6161. case :$finalize_shlibpath: in
  6162. *":$libdir:"*) ;;
  6163. *) func_append finalize_shlibpath "$libdir:" ;;
  6164. esac
  6165. add="-l$name"
  6166. elif test "$hardcode_automatic" = yes; then
  6167. if test -n "$inst_prefix_dir" &&
  6168. test -f "$inst_prefix_dir$libdir/$linklib" ; then
  6169. add="$inst_prefix_dir$libdir/$linklib"
  6170. else
  6171. add="$libdir/$linklib"
  6172. fi
  6173. else
  6174. # We cannot seem to hardcode it, guess we'll fake it.
  6175. add_dir="-L$libdir"
  6176. # Try looking first in the location we're being installed to.
  6177. if test -n "$inst_prefix_dir"; then
  6178. case $libdir in
  6179. [\\/]*)
  6180. func_append add_dir " -L$inst_prefix_dir$libdir"
  6181. ;;
  6182. esac
  6183. fi
  6184. add="-l$name"
  6185. fi
  6186. if test "$linkmode" = prog; then
  6187. test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
  6188. test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
  6189. else
  6190. test -n "$add_dir" && deplibs="$add_dir $deplibs"
  6191. test -n "$add" && deplibs="$add $deplibs"
  6192. fi
  6193. fi
  6194. elif test "$linkmode" = prog; then
  6195. # Here we assume that one of hardcode_direct or hardcode_minus_L
  6196. # is not unsupported. This is valid on all known static and
  6197. # shared platforms.
  6198. if test "$hardcode_direct" != unsupported; then
  6199. test -n "$old_library" && linklib="$old_library"
  6200. compile_deplibs="$dir/$linklib $compile_deplibs"
  6201. finalize_deplibs="$dir/$linklib $finalize_deplibs"
  6202. else
  6203. compile_deplibs="-l$name -L$dir $compile_deplibs"
  6204. finalize_deplibs="-l$name -L$dir $finalize_deplibs"
  6205. fi
  6206. elif test "$build_libtool_libs" = yes; then
  6207. # Not a shared library
  6208. if test "$deplibs_check_method" != pass_all; then
  6209. # We're trying link a shared library against a static one
  6210. # but the system doesn't support it.
  6211. # Just print a warning and add the library to dependency_libs so
  6212. # that the program can be linked against the static library.
  6213. echo
  6214. $ECHO "*** Warning: This system can not link to static lib archive $lib."
  6215. echo "*** I have the capability to make that library automatically link in when"
  6216. echo "*** you link to this library. But I can only do this if you have a"
  6217. echo "*** shared version of the library, which you do not appear to have."
  6218. if test "$module" = yes; then
  6219. echo "*** But as you try to build a module library, libtool will still create "
  6220. echo "*** a static module, that should work as long as the dlopening application"
  6221. echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
  6222. if test -z "$global_symbol_pipe"; then
  6223. echo
  6224. echo "*** However, this would only work if libtool was able to extract symbol"
  6225. echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
  6226. echo "*** not find such a program. So, this module is probably useless."
  6227. echo "*** \`nm' from GNU binutils and a full rebuild may help."
  6228. fi
  6229. if test "$build_old_libs" = no; then
  6230. build_libtool_libs=module
  6231. build_old_libs=yes
  6232. else
  6233. build_libtool_libs=no
  6234. fi
  6235. fi
  6236. else
  6237. deplibs="$dir/$old_library $deplibs"
  6238. link_static=yes
  6239. fi
  6240. fi # link shared/static library?
  6241. if test "$linkmode" = lib; then
  6242. if test -n "$dependency_libs" &&
  6243. { test "$hardcode_into_libs" != yes ||
  6244. test "$build_old_libs" = yes ||
  6245. test "$link_static" = yes; }; then
  6246. # Extract -R from dependency_libs
  6247. temp_deplibs=
  6248. for libdir in $dependency_libs; do
  6249. case $libdir in
  6250. -R*) func_stripname '-R' '' "$libdir"
  6251. temp_xrpath=$func_stripname_result
  6252. case " $xrpath " in
  6253. *" $temp_xrpath "*) ;;
  6254. *) func_append xrpath " $temp_xrpath";;
  6255. esac;;
  6256. *) func_append temp_deplibs " $libdir";;
  6257. esac
  6258. done
  6259. dependency_libs="$temp_deplibs"
  6260. fi
  6261. func_append newlib_search_path " $absdir"
  6262. # Link against this library
  6263. test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
  6264. # ... and its dependency_libs
  6265. tmp_libs=
  6266. for deplib in $dependency_libs; do
  6267. newdependency_libs="$deplib $newdependency_libs"
  6268. case $deplib in
  6269. -L*) func_stripname '-L' '' "$deplib"
  6270. func_resolve_sysroot "$func_stripname_result";;
  6271. *) func_resolve_sysroot "$deplib" ;;
  6272. esac
  6273. if $opt_preserve_dup_deps ; then
  6274. case "$tmp_libs " in
  6275. *" $func_resolve_sysroot_result "*)
  6276. func_append specialdeplibs " $func_resolve_sysroot_result" ;;
  6277. esac
  6278. fi
  6279. func_append tmp_libs " $func_resolve_sysroot_result"
  6280. done
  6281. if test "$link_all_deplibs" != no; then
  6282. # Add the search paths of all dependency libraries
  6283. for deplib in $dependency_libs; do
  6284. path=
  6285. case $deplib in
  6286. -L*) path="$deplib" ;;
  6287. *.la)
  6288. func_resolve_sysroot "$deplib"
  6289. deplib=$func_resolve_sysroot_result
  6290. func_dirname "$deplib" "" "."
  6291. dir=$func_dirname_result
  6292. # We need an absolute path.
  6293. case $dir in
  6294. [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
  6295. *)
  6296. absdir=`cd "$dir" && pwd`
  6297. if test -z "$absdir"; then
  6298. func_warning "cannot determine absolute directory name of \`$dir'"
  6299. absdir="$dir"
  6300. fi
  6301. ;;
  6302. esac
  6303. if $GREP "^installed=no" $deplib > /dev/null; then
  6304. case $host in
  6305. *-*-darwin*)
  6306. depdepl=
  6307. eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
  6308. if test -n "$deplibrary_names" ; then
  6309. for tmp in $deplibrary_names ; do
  6310. depdepl=$tmp
  6311. done
  6312. if test -f "$absdir/$objdir/$depdepl" ; then
  6313. depdepl="$absdir/$objdir/$depdepl"
  6314. darwin_install_name=`${OTOOL} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
  6315. if test -z "$darwin_install_name"; then
  6316. darwin_install_name=`${OTOOL64} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
  6317. fi
  6318. func_append compiler_flags " ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}"
  6319. func_append linker_flags " -dylib_file ${darwin_install_name}:${depdepl}"
  6320. path=
  6321. fi
  6322. fi
  6323. ;;
  6324. *)
  6325. path="-L$absdir/$objdir"
  6326. ;;
  6327. esac
  6328. else
  6329. eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
  6330. test -z "$libdir" && \
  6331. func_fatal_error "\`$deplib' is not a valid libtool archive"
  6332. test "$absdir" != "$libdir" && \
  6333. func_warning "\`$deplib' seems to be moved"
  6334. path="-L$absdir"
  6335. fi
  6336. ;;
  6337. esac
  6338. case " $deplibs " in
  6339. *" $path "*) ;;
  6340. *) deplibs="$path $deplibs" ;;
  6341. esac
  6342. done
  6343. fi # link_all_deplibs != no
  6344. fi # linkmode = lib
  6345. done # for deplib in $libs
  6346. if test "$pass" = link; then
  6347. if test "$linkmode" = "prog"; then
  6348. compile_deplibs="$new_inherited_linker_flags $compile_deplibs"
  6349. finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs"
  6350. else
  6351. compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
  6352. fi
  6353. fi
  6354. dependency_libs="$newdependency_libs"
  6355. if test "$pass" = dlpreopen; then
  6356. # Link the dlpreopened libraries before other libraries
  6357. for deplib in $save_deplibs; do
  6358. deplibs="$deplib $deplibs"
  6359. done
  6360. fi
  6361. if test "$pass" != dlopen; then
  6362. if test "$pass" != conv; then
  6363. # Make sure lib_search_path contains only unique directories.
  6364. lib_search_path=
  6365. for dir in $newlib_search_path; do
  6366. case "$lib_search_path " in
  6367. *" $dir "*) ;;
  6368. *) func_append lib_search_path " $dir" ;;
  6369. esac
  6370. done
  6371. newlib_search_path=
  6372. fi
  6373. if test "$linkmode,$pass" != "prog,link"; then
  6374. vars="deplibs"
  6375. else
  6376. vars="compile_deplibs finalize_deplibs"
  6377. fi
  6378. for var in $vars dependency_libs; do
  6379. # Add libraries to $var in reverse order
  6380. eval tmp_libs=\"\$$var\"
  6381. new_libs=
  6382. for deplib in $tmp_libs; do
  6383. # FIXME: Pedantically, this is the right thing to do, so
  6384. # that some nasty dependency loop isn't accidentally
  6385. # broken:
  6386. #new_libs="$deplib $new_libs"
  6387. # Pragmatically, this seems to cause very few problems in
  6388. # practice:
  6389. case $deplib in
  6390. -L*) new_libs="$deplib $new_libs" ;;
  6391. -R*) ;;
  6392. *)
  6393. # And here is the reason: when a library appears more
  6394. # than once as an explicit dependence of a library, or
  6395. # is implicitly linked in more than once by the
  6396. # compiler, it is considered special, and multiple
  6397. # occurrences thereof are not removed. Compare this
  6398. # with having the same library being listed as a
  6399. # dependency of multiple other libraries: in this case,
  6400. # we know (pedantically, we assume) the library does not
  6401. # need to be listed more than once, so we keep only the
  6402. # last copy. This is not always right, but it is rare
  6403. # enough that we require users that really mean to play
  6404. # such unportable linking tricks to link the library
  6405. # using -Wl,-lname, so that libtool does not consider it
  6406. # for duplicate removal.
  6407. case " $specialdeplibs " in
  6408. *" $deplib "*) new_libs="$deplib $new_libs" ;;
  6409. *)
  6410. case " $new_libs " in
  6411. *" $deplib "*) ;;
  6412. *) new_libs="$deplib $new_libs" ;;
  6413. esac
  6414. ;;
  6415. esac
  6416. ;;
  6417. esac
  6418. done
  6419. tmp_libs=
  6420. for deplib in $new_libs; do
  6421. case $deplib in
  6422. -L*)
  6423. case " $tmp_libs " in
  6424. *" $deplib "*) ;;
  6425. *) func_append tmp_libs " $deplib" ;;
  6426. esac
  6427. ;;
  6428. *) func_append tmp_libs " $deplib" ;;
  6429. esac
  6430. done
  6431. eval $var=\"$tmp_libs\"
  6432. done # for var
  6433. fi
  6434. # Last step: remove runtime libs from dependency_libs
  6435. # (they stay in deplibs)
  6436. tmp_libs=
  6437. for i in $dependency_libs ; do
  6438. case " $predeps $postdeps $compiler_lib_search_path " in
  6439. *" $i "*)
  6440. i=""
  6441. ;;
  6442. esac
  6443. if test -n "$i" ; then
  6444. func_append tmp_libs " $i"
  6445. fi
  6446. done
  6447. dependency_libs=$tmp_libs
  6448. done # for pass
  6449. if test "$linkmode" = prog; then
  6450. dlfiles="$newdlfiles"
  6451. fi
  6452. if test "$linkmode" = prog || test "$linkmode" = lib; then
  6453. dlprefiles="$newdlprefiles"
  6454. fi
  6455. case $linkmode in
  6456. oldlib)
  6457. if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
  6458. func_warning "\`-dlopen' is ignored for archives"
  6459. fi
  6460. case " $deplibs" in
  6461. *\ -l* | *\ -L*)
  6462. func_warning "\`-l' and \`-L' are ignored for archives" ;;
  6463. esac
  6464. test -n "$rpath" && \
  6465. func_warning "\`-rpath' is ignored for archives"
  6466. test -n "$xrpath" && \
  6467. func_warning "\`-R' is ignored for archives"
  6468. test -n "$vinfo" && \
  6469. func_warning "\`-version-info/-version-number' is ignored for archives"
  6470. test -n "$release" && \
  6471. func_warning "\`-release' is ignored for archives"
  6472. test -n "$export_symbols$export_symbols_regex" && \
  6473. func_warning "\`-export-symbols' is ignored for archives"
  6474. # Now set the variables for building old libraries.
  6475. build_libtool_libs=no
  6476. oldlibs="$output"
  6477. func_append objs "$old_deplibs"
  6478. ;;
  6479. lib)
  6480. # Make sure we only generate libraries of the form `libNAME.la'.
  6481. case $outputname in
  6482. lib*)
  6483. func_stripname 'lib' '.la' "$outputname"
  6484. name=$func_stripname_result
  6485. eval shared_ext=\"$shrext_cmds\"
  6486. eval libname=\"$libname_spec\"
  6487. ;;
  6488. *)
  6489. test "$module" = no && \
  6490. func_fatal_help "libtool library \`$output' must begin with \`lib'"
  6491. if test "$need_lib_prefix" != no; then
  6492. # Add the "lib" prefix for modules if required
  6493. func_stripname '' '.la' "$outputname"
  6494. name=$func_stripname_result
  6495. eval shared_ext=\"$shrext_cmds\"
  6496. eval libname=\"$libname_spec\"
  6497. else
  6498. func_stripname '' '.la' "$outputname"
  6499. libname=$func_stripname_result
  6500. fi
  6501. ;;
  6502. esac
  6503. if test -n "$objs"; then
  6504. if test "$deplibs_check_method" != pass_all; then
  6505. func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs"
  6506. else
  6507. echo
  6508. $ECHO "*** Warning: Linking the shared library $output against the non-libtool"
  6509. $ECHO "*** objects $objs is not portable!"
  6510. func_append libobjs " $objs"
  6511. fi
  6512. fi
  6513. test "$dlself" != no && \
  6514. func_warning "\`-dlopen self' is ignored for libtool libraries"
  6515. set dummy $rpath
  6516. shift
  6517. test "$#" -gt 1 && \
  6518. func_warning "ignoring multiple \`-rpath's for a libtool library"
  6519. install_libdir="$1"
  6520. oldlibs=
  6521. if test -z "$rpath"; then
  6522. if test "$build_libtool_libs" = yes; then
  6523. # Building a libtool convenience library.
  6524. # Some compilers have problems with a `.al' extension so
  6525. # convenience libraries should have the same extension an
  6526. # archive normally would.
  6527. oldlibs="$output_objdir/$libname.$libext $oldlibs"
  6528. build_libtool_libs=convenience
  6529. build_old_libs=yes
  6530. fi
  6531. test -n "$vinfo" && \
  6532. func_warning "\`-version-info/-version-number' is ignored for convenience libraries"
  6533. test -n "$release" && \
  6534. func_warning "\`-release' is ignored for convenience libraries"
  6535. else
  6536. # Parse the version information argument.
  6537. save_ifs="$IFS"; IFS=':'
  6538. set dummy $vinfo 0 0 0
  6539. shift
  6540. IFS="$save_ifs"
  6541. test -n "$7" && \
  6542. func_fatal_help "too many parameters to \`-version-info'"
  6543. # convert absolute version numbers to libtool ages
  6544. # this retains compatibility with .la files and attempts
  6545. # to make the code below a bit more comprehensible
  6546. case $vinfo_number in
  6547. yes)
  6548. number_major="$1"
  6549. number_minor="$2"
  6550. number_revision="$3"
  6551. #
  6552. # There are really only two kinds -- those that
  6553. # use the current revision as the major version
  6554. # and those that subtract age and use age as
  6555. # a minor version. But, then there is irix
  6556. # which has an extra 1 added just for fun
  6557. #
  6558. case $version_type in
  6559. darwin|linux|osf|windows|none)
  6560. func_arith $number_major + $number_minor
  6561. current=$func_arith_result
  6562. age="$number_minor"
  6563. revision="$number_revision"
  6564. ;;
  6565. freebsd-aout|freebsd-elf|qnx|sunos)
  6566. current="$number_major"
  6567. revision="$number_minor"
  6568. age="0"
  6569. ;;
  6570. irix|nonstopux)
  6571. func_arith $number_major + $number_minor
  6572. current=$func_arith_result
  6573. age="$number_minor"
  6574. revision="$number_minor"
  6575. lt_irix_increment=no
  6576. ;;
  6577. esac
  6578. ;;
  6579. no)
  6580. current="$1"
  6581. revision="$2"
  6582. age="$3"
  6583. ;;
  6584. esac
  6585. # Check that each of the things are valid numbers.
  6586. case $current in
  6587. 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]) ;;
  6588. *)
  6589. func_error "CURRENT \`$current' must be a nonnegative integer"
  6590. func_fatal_error "\`$vinfo' is not valid version information"
  6591. ;;
  6592. esac
  6593. case $revision in
  6594. 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]) ;;
  6595. *)
  6596. func_error "REVISION \`$revision' must be a nonnegative integer"
  6597. func_fatal_error "\`$vinfo' is not valid version information"
  6598. ;;
  6599. esac
  6600. case $age in
  6601. 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]) ;;
  6602. *)
  6603. func_error "AGE \`$age' must be a nonnegative integer"
  6604. func_fatal_error "\`$vinfo' is not valid version information"
  6605. ;;
  6606. esac
  6607. if test "$age" -gt "$current"; then
  6608. func_error "AGE \`$age' is greater than the current interface number \`$current'"
  6609. func_fatal_error "\`$vinfo' is not valid version information"
  6610. fi
  6611. # Calculate the version variables.
  6612. major=
  6613. versuffix=
  6614. verstring=
  6615. case $version_type in
  6616. none) ;;
  6617. darwin)
  6618. # Like Linux, but with the current version available in
  6619. # verstring for coding it into the library header
  6620. func_arith $current - $age
  6621. major=.$func_arith_result
  6622. versuffix="$major.$age.$revision"
  6623. # Darwin ld doesn't like 0 for these options...
  6624. func_arith $current + 1
  6625. minor_current=$func_arith_result
  6626. xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
  6627. verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
  6628. ;;
  6629. freebsd-aout)
  6630. major=".$current"
  6631. versuffix=".$current.$revision";
  6632. ;;
  6633. freebsd-elf)
  6634. major=".$current"
  6635. versuffix=".$current"
  6636. ;;
  6637. irix | nonstopux)
  6638. if test "X$lt_irix_increment" = "Xno"; then
  6639. func_arith $current - $age
  6640. else
  6641. func_arith $current - $age + 1
  6642. fi
  6643. major=$func_arith_result
  6644. case $version_type in
  6645. nonstopux) verstring_prefix=nonstopux ;;
  6646. *) verstring_prefix=sgi ;;
  6647. esac
  6648. verstring="$verstring_prefix$major.$revision"
  6649. # Add in all the interfaces that we are compatible with.
  6650. loop=$revision
  6651. while test "$loop" -ne 0; do
  6652. func_arith $revision - $loop
  6653. iface=$func_arith_result
  6654. func_arith $loop - 1
  6655. loop=$func_arith_result
  6656. verstring="$verstring_prefix$major.$iface:$verstring"
  6657. done
  6658. # Before this point, $major must not contain `.'.
  6659. major=.$major
  6660. versuffix="$major.$revision"
  6661. ;;
  6662. linux)
  6663. func_arith $current - $age
  6664. major=.$func_arith_result
  6665. versuffix="$major.$age.$revision"
  6666. ;;
  6667. osf)
  6668. func_arith $current - $age
  6669. major=.$func_arith_result
  6670. versuffix=".$current.$age.$revision"
  6671. verstring="$current.$age.$revision"
  6672. # Add in all the interfaces that we are compatible with.
  6673. loop=$age
  6674. while test "$loop" -ne 0; do
  6675. func_arith $current - $loop
  6676. iface=$func_arith_result
  6677. func_arith $loop - 1
  6678. loop=$func_arith_result
  6679. verstring="$verstring:${iface}.0"
  6680. done
  6681. # Make executables depend on our current version.
  6682. func_append verstring ":${current}.0"
  6683. ;;
  6684. qnx)
  6685. major=".$current"
  6686. versuffix=".$current"
  6687. ;;
  6688. sunos)
  6689. major=".$current"
  6690. versuffix=".$current.$revision"
  6691. ;;
  6692. windows)
  6693. # Use '-' rather than '.', since we only want one
  6694. # extension on DOS 8.3 filesystems.
  6695. func_arith $current - $age
  6696. major=$func_arith_result
  6697. versuffix="-$major"
  6698. ;;
  6699. *)
  6700. func_fatal_configuration "unknown library version type \`$version_type'"
  6701. ;;
  6702. esac
  6703. # Clear the version info if we defaulted, and they specified a release.
  6704. if test -z "$vinfo" && test -n "$release"; then
  6705. major=
  6706. case $version_type in
  6707. darwin)
  6708. # we can't check for "0.0" in archive_cmds due to quoting
  6709. # problems, so we reset it completely
  6710. verstring=
  6711. ;;
  6712. *)
  6713. verstring="0.0"
  6714. ;;
  6715. esac
  6716. if test "$need_version" = no; then
  6717. versuffix=
  6718. else
  6719. versuffix=".0.0"
  6720. fi
  6721. fi
  6722. # Remove version info from name if versioning should be avoided
  6723. if test "$avoid_version" = yes && test "$need_version" = no; then
  6724. major=
  6725. versuffix=
  6726. verstring=""
  6727. fi
  6728. # Check to see if the archive will have undefined symbols.
  6729. if test "$allow_undefined" = yes; then
  6730. if test "$allow_undefined_flag" = unsupported; then
  6731. func_warning "undefined symbols not allowed in $host shared libraries"
  6732. build_libtool_libs=no
  6733. build_old_libs=yes
  6734. fi
  6735. else
  6736. # Don't allow undefined symbols.
  6737. allow_undefined_flag="$no_undefined_flag"
  6738. fi
  6739. fi
  6740. func_generate_dlsyms "$libname" "$libname" "yes"
  6741. func_append libobjs " $symfileobj"
  6742. test "X$libobjs" = "X " && libobjs=
  6743. if test "$opt_mode" != relink; then
  6744. # Remove our outputs, but don't remove object files since they
  6745. # may have been created when compiling PIC objects.
  6746. removelist=
  6747. tempremovelist=`$ECHO "$output_objdir/*"`
  6748. for p in $tempremovelist; do
  6749. case $p in
  6750. *.$objext | *.gcno)
  6751. ;;
  6752. $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
  6753. if test "X$precious_files_regex" != "X"; then
  6754. if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
  6755. then
  6756. continue
  6757. fi
  6758. fi
  6759. func_append removelist " $p"
  6760. ;;
  6761. *) ;;
  6762. esac
  6763. done
  6764. test -n "$removelist" && \
  6765. func_show_eval "${RM}r \$removelist"
  6766. fi
  6767. # Now set the variables for building old libraries.
  6768. if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
  6769. func_append oldlibs " $output_objdir/$libname.$libext"
  6770. # Transform .lo files to .o files.
  6771. oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; $lo2o" | $NL2SP`
  6772. fi
  6773. # Eliminate all temporary directories.
  6774. #for path in $notinst_path; do
  6775. # lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"`
  6776. # deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"`
  6777. # dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"`
  6778. #done
  6779. if test -n "$xrpath"; then
  6780. # If the user specified any rpath flags, then add them.
  6781. temp_xrpath=
  6782. for libdir in $xrpath; do
  6783. func_replace_sysroot "$libdir"
  6784. func_append temp_xrpath " -R$func_replace_sysroot_result"
  6785. case "$finalize_rpath " in
  6786. *" $libdir "*) ;;
  6787. *) func_append finalize_rpath " $libdir" ;;
  6788. esac
  6789. done
  6790. if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
  6791. dependency_libs="$temp_xrpath $dependency_libs"
  6792. fi
  6793. fi
  6794. # Make sure dlfiles contains only unique files that won't be dlpreopened
  6795. old_dlfiles="$dlfiles"
  6796. dlfiles=
  6797. for lib in $old_dlfiles; do
  6798. case " $dlprefiles $dlfiles " in
  6799. *" $lib "*) ;;
  6800. *) func_append dlfiles " $lib" ;;
  6801. esac
  6802. done
  6803. # Make sure dlprefiles contains only unique files
  6804. old_dlprefiles="$dlprefiles"
  6805. dlprefiles=
  6806. for lib in $old_dlprefiles; do
  6807. case "$dlprefiles " in
  6808. *" $lib "*) ;;
  6809. *) func_append dlprefiles " $lib" ;;
  6810. esac
  6811. done
  6812. if test "$build_libtool_libs" = yes; then
  6813. if test -n "$rpath"; then
  6814. case $host in
  6815. *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*)
  6816. # these systems don't actually have a c library (as such)!
  6817. ;;
  6818. *-*-rhapsody* | *-*-darwin1.[012])
  6819. # Rhapsody C library is in the System framework
  6820. func_append deplibs " System.ltframework"
  6821. ;;
  6822. *-*-netbsd*)
  6823. # Don't link with libc until the a.out ld.so is fixed.
  6824. ;;
  6825. *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
  6826. # Do not include libc due to us having libc/libc_r.
  6827. ;;
  6828. *-*-sco3.2v5* | *-*-sco5v6*)
  6829. # Causes problems with __ctype
  6830. ;;
  6831. *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
  6832. # Compiler inserts libc in the correct place for threads to work
  6833. ;;
  6834. *)
  6835. # Add libc to deplibs on all other systems if necessary.
  6836. if test "$build_libtool_need_lc" = "yes"; then
  6837. func_append deplibs " -lc"
  6838. fi
  6839. ;;
  6840. esac
  6841. fi
  6842. # Transform deplibs into only deplibs that can be linked in shared.
  6843. name_save=$name
  6844. libname_save=$libname
  6845. release_save=$release
  6846. versuffix_save=$versuffix
  6847. major_save=$major
  6848. # I'm not sure if I'm treating the release correctly. I think
  6849. # release should show up in the -l (ie -lgmp5) so we don't want to
  6850. # add it in twice. Is that correct?
  6851. release=""
  6852. versuffix=""
  6853. major=""
  6854. newdeplibs=
  6855. droppeddeps=no
  6856. case $deplibs_check_method in
  6857. pass_all)
  6858. # Don't check for shared/static. Everything works.
  6859. # This might be a little naive. We might want to check
  6860. # whether the library exists or not. But this is on
  6861. # osf3 & osf4 and I'm not really sure... Just
  6862. # implementing what was already the behavior.
  6863. newdeplibs=$deplibs
  6864. ;;
  6865. test_compile)
  6866. # This code stresses the "libraries are programs" paradigm to its
  6867. # limits. Maybe even breaks it. We compile a program, linking it
  6868. # against the deplibs as a proxy for the library. Then we can check
  6869. # whether they linked in statically or dynamically with ldd.
  6870. $opt_dry_run || $RM conftest.c
  6871. cat > conftest.c <<EOF
  6872. int main() { return 0; }
  6873. EOF
  6874. $opt_dry_run || $RM conftest
  6875. if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then
  6876. ldd_output=`ldd conftest`
  6877. for i in $deplibs; do
  6878. case $i in
  6879. -l*)
  6880. func_stripname -l '' "$i"
  6881. name=$func_stripname_result
  6882. if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
  6883. case " $predeps $postdeps " in
  6884. *" $i "*)
  6885. func_append newdeplibs " $i"
  6886. i=""
  6887. ;;
  6888. esac
  6889. fi
  6890. if test -n "$i" ; then
  6891. libname=`eval "\\$ECHO \"$libname_spec\""`
  6892. deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
  6893. set dummy $deplib_matches; shift
  6894. deplib_match=$1
  6895. if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
  6896. func_append newdeplibs " $i"
  6897. else
  6898. droppeddeps=yes
  6899. echo
  6900. $ECHO "*** Warning: dynamic linker does not accept needed library $i."
  6901. echo "*** I have the capability to make that library automatically link in when"
  6902. echo "*** you link to this library. But I can only do this if you have a"
  6903. echo "*** shared version of the library, which I believe you do not have"
  6904. echo "*** because a test_compile did reveal that the linker did not use it for"
  6905. echo "*** its dynamic dependency list that programs get resolved with at runtime."
  6906. fi
  6907. fi
  6908. ;;
  6909. *)
  6910. func_append newdeplibs " $i"
  6911. ;;
  6912. esac
  6913. done
  6914. else
  6915. # Error occurred in the first compile. Let's try to salvage
  6916. # the situation: Compile a separate program for each library.
  6917. for i in $deplibs; do
  6918. case $i in
  6919. -l*)
  6920. func_stripname -l '' "$i"
  6921. name=$func_stripname_result
  6922. $opt_dry_run || $RM conftest
  6923. if $LTCC $LTCFLAGS -o conftest conftest.c $i; then
  6924. ldd_output=`ldd conftest`
  6925. if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
  6926. case " $predeps $postdeps " in
  6927. *" $i "*)
  6928. func_append newdeplibs " $i"
  6929. i=""
  6930. ;;
  6931. esac
  6932. fi
  6933. if test -n "$i" ; then
  6934. libname=`eval "\\$ECHO \"$libname_spec\""`
  6935. deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
  6936. set dummy $deplib_matches; shift
  6937. deplib_match=$1
  6938. if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
  6939. func_append newdeplibs " $i"
  6940. else
  6941. droppeddeps=yes
  6942. echo
  6943. $ECHO "*** Warning: dynamic linker does not accept needed library $i."
  6944. echo "*** I have the capability to make that library automatically link in when"
  6945. echo "*** you link to this library. But I can only do this if you have a"
  6946. echo "*** shared version of the library, which you do not appear to have"
  6947. echo "*** because a test_compile did reveal that the linker did not use this one"
  6948. echo "*** as a dynamic dependency that programs can get resolved with at runtime."
  6949. fi
  6950. fi
  6951. else
  6952. droppeddeps=yes
  6953. echo
  6954. $ECHO "*** Warning! Library $i is needed by this library but I was not able to"
  6955. echo "*** make it link in! You will probably need to install it or some"
  6956. echo "*** library that it depends on before this library will be fully"
  6957. echo "*** functional. Installing it before continuing would be even better."
  6958. fi
  6959. ;;
  6960. *)
  6961. func_append newdeplibs " $i"
  6962. ;;
  6963. esac
  6964. done
  6965. fi
  6966. ;;
  6967. file_magic*)
  6968. set dummy $deplibs_check_method; shift
  6969. file_magic_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
  6970. for a_deplib in $deplibs; do
  6971. case $a_deplib in
  6972. -l*)
  6973. func_stripname -l '' "$a_deplib"
  6974. name=$func_stripname_result
  6975. if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
  6976. case " $predeps $postdeps " in
  6977. *" $a_deplib "*)
  6978. func_append newdeplibs " $a_deplib"
  6979. a_deplib=""
  6980. ;;
  6981. esac
  6982. fi
  6983. if test -n "$a_deplib" ; then
  6984. libname=`eval "\\$ECHO \"$libname_spec\""`
  6985. if test -n "$file_magic_glob"; then
  6986. libnameglob=`func_echo_all "$libname" | $SED -e $file_magic_glob`
  6987. else
  6988. libnameglob=$libname
  6989. fi
  6990. test "$want_nocaseglob" = yes && nocaseglob=`shopt -p nocaseglob`
  6991. for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
  6992. if test "$want_nocaseglob" = yes; then
  6993. shopt -s nocaseglob
  6994. potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`
  6995. $nocaseglob
  6996. else
  6997. potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`
  6998. fi
  6999. for potent_lib in $potential_libs; do
  7000. # Follow soft links.
  7001. if ls -lLd "$potent_lib" 2>/dev/null |
  7002. $GREP " -> " >/dev/null; then
  7003. continue
  7004. fi
  7005. # The statement above tries to avoid entering an
  7006. # endless loop below, in case of cyclic links.
  7007. # We might still enter an endless loop, since a link
  7008. # loop can be closed while we follow links,
  7009. # but so what?
  7010. potlib="$potent_lib"
  7011. while test -h "$potlib" 2>/dev/null; do
  7012. potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
  7013. case $potliblink in
  7014. [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
  7015. *) potlib=`$ECHO "$potlib" | $SED 's,[^/]*$,,'`"$potliblink";;
  7016. esac
  7017. done
  7018. if eval $file_magic_cmd \"\$potlib\" 2>/dev/null |
  7019. $SED -e 10q |
  7020. $EGREP "$file_magic_regex" > /dev/null; then
  7021. func_append newdeplibs " $a_deplib"
  7022. a_deplib=""
  7023. break 2
  7024. fi
  7025. done
  7026. done
  7027. fi
  7028. if test -n "$a_deplib" ; then
  7029. droppeddeps=yes
  7030. echo
  7031. $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
  7032. echo "*** I have the capability to make that library automatically link in when"
  7033. echo "*** you link to this library. But I can only do this if you have a"
  7034. echo "*** shared version of the library, which you do not appear to have"
  7035. echo "*** because I did check the linker path looking for a file starting"
  7036. if test -z "$potlib" ; then
  7037. $ECHO "*** with $libname but no candidates were found. (...for file magic test)"
  7038. else
  7039. $ECHO "*** with $libname and none of the candidates passed a file format test"
  7040. $ECHO "*** using a file magic. Last file checked: $potlib"
  7041. fi
  7042. fi
  7043. ;;
  7044. *)
  7045. # Add a -L argument.
  7046. func_append newdeplibs " $a_deplib"
  7047. ;;
  7048. esac
  7049. done # Gone through all deplibs.
  7050. ;;
  7051. match_pattern*)
  7052. set dummy $deplibs_check_method; shift
  7053. match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
  7054. for a_deplib in $deplibs; do
  7055. case $a_deplib in
  7056. -l*)
  7057. func_stripname -l '' "$a_deplib"
  7058. name=$func_stripname_result
  7059. if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
  7060. case " $predeps $postdeps " in
  7061. *" $a_deplib "*)
  7062. func_append newdeplibs " $a_deplib"
  7063. a_deplib=""
  7064. ;;
  7065. esac
  7066. fi
  7067. if test -n "$a_deplib" ; then
  7068. libname=`eval "\\$ECHO \"$libname_spec\""`
  7069. for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
  7070. potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
  7071. for potent_lib in $potential_libs; do
  7072. potlib="$potent_lib" # see symlink-check above in file_magic test
  7073. if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \
  7074. $EGREP "$match_pattern_regex" > /dev/null; then
  7075. func_append newdeplibs " $a_deplib"
  7076. a_deplib=""
  7077. break 2
  7078. fi
  7079. done
  7080. done
  7081. fi
  7082. if test -n "$a_deplib" ; then
  7083. droppeddeps=yes
  7084. echo
  7085. $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
  7086. echo "*** I have the capability to make that library automatically link in when"
  7087. echo "*** you link to this library. But I can only do this if you have a"
  7088. echo "*** shared version of the library, which you do not appear to have"
  7089. echo "*** because I did check the linker path looking for a file starting"
  7090. if test -z "$potlib" ; then
  7091. $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)"
  7092. else
  7093. $ECHO "*** with $libname and none of the candidates passed a file format test"
  7094. $ECHO "*** using a regex pattern. Last file checked: $potlib"
  7095. fi
  7096. fi
  7097. ;;
  7098. *)
  7099. # Add a -L argument.
  7100. func_append newdeplibs " $a_deplib"
  7101. ;;
  7102. esac
  7103. done # Gone through all deplibs.
  7104. ;;
  7105. none | unknown | *)
  7106. newdeplibs=""
  7107. tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'`
  7108. if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
  7109. for i in $predeps $postdeps ; do
  7110. # can't use Xsed below, because $i might contain '/'
  7111. tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s,$i,,"`
  7112. done
  7113. fi
  7114. case $tmp_deplibs in
  7115. *[!\ \ ]*)
  7116. echo
  7117. if test "X$deplibs_check_method" = "Xnone"; then
  7118. echo "*** Warning: inter-library dependencies are not supported in this platform."
  7119. else
  7120. echo "*** Warning: inter-library dependencies are not known to be supported."
  7121. fi
  7122. echo "*** All declared inter-library dependencies are being dropped."
  7123. droppeddeps=yes
  7124. ;;
  7125. esac
  7126. ;;
  7127. esac
  7128. versuffix=$versuffix_save
  7129. major=$major_save
  7130. release=$release_save
  7131. libname=$libname_save
  7132. name=$name_save
  7133. case $host in
  7134. *-*-rhapsody* | *-*-darwin1.[012])
  7135. # On Rhapsody replace the C library with the System framework
  7136. newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'`
  7137. ;;
  7138. esac
  7139. if test "$droppeddeps" = yes; then
  7140. if test "$module" = yes; then
  7141. echo
  7142. echo "*** Warning: libtool could not satisfy all declared inter-library"
  7143. $ECHO "*** dependencies of module $libname. Therefore, libtool will create"
  7144. echo "*** a static module, that should work as long as the dlopening"
  7145. echo "*** application is linked with the -dlopen flag."
  7146. if test -z "$global_symbol_pipe"; then
  7147. echo
  7148. echo "*** However, this would only work if libtool was able to extract symbol"
  7149. echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
  7150. echo "*** not find such a program. So, this module is probably useless."
  7151. echo "*** \`nm' from GNU binutils and a full rebuild may help."
  7152. fi
  7153. if test "$build_old_libs" = no; then
  7154. oldlibs="$output_objdir/$libname.$libext"
  7155. build_libtool_libs=module
  7156. build_old_libs=yes
  7157. else
  7158. build_libtool_libs=no
  7159. fi
  7160. else
  7161. echo "*** The inter-library dependencies that have been dropped here will be"
  7162. echo "*** automatically added whenever a program is linked with this library"
  7163. echo "*** or is declared to -dlopen it."
  7164. if test "$allow_undefined" = no; then
  7165. echo
  7166. echo "*** Since this library must not contain undefined symbols,"
  7167. echo "*** because either the platform does not support them or"
  7168. echo "*** it was explicitly requested with -no-undefined,"
  7169. echo "*** libtool will only create a static version of it."
  7170. if test "$build_old_libs" = no; then
  7171. oldlibs="$output_objdir/$libname.$libext"
  7172. build_libtool_libs=module
  7173. build_old_libs=yes
  7174. else
  7175. build_libtool_libs=no
  7176. fi
  7177. fi
  7178. fi
  7179. fi
  7180. # Done checking deplibs!
  7181. deplibs=$newdeplibs
  7182. fi
  7183. # Time to change all our "foo.ltframework" stuff back to "-framework foo"
  7184. case $host in
  7185. *-*-darwin*)
  7186. newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
  7187. new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
  7188. deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
  7189. ;;
  7190. esac
  7191. # move library search paths that coincide with paths to not yet
  7192. # installed libraries to the beginning of the library search list
  7193. new_libs=
  7194. for path in $notinst_path; do
  7195. case " $new_libs " in
  7196. *" -L$path/$objdir "*) ;;
  7197. *)
  7198. case " $deplibs " in
  7199. *" -L$path/$objdir "*)
  7200. func_append new_libs " -L$path/$objdir" ;;
  7201. esac
  7202. ;;
  7203. esac
  7204. done
  7205. for deplib in $deplibs; do
  7206. case $deplib in
  7207. -L*)
  7208. case " $new_libs " in
  7209. *" $deplib "*) ;;
  7210. *) func_append new_libs " $deplib" ;;
  7211. esac
  7212. ;;
  7213. *) func_append new_libs " $deplib" ;;
  7214. esac
  7215. done
  7216. deplibs="$new_libs"
  7217. # All the library-specific variables (install_libdir is set above).
  7218. library_names=
  7219. old_library=
  7220. dlname=
  7221. # Test again, we may have decided not to build it any more
  7222. if test "$build_libtool_libs" = yes; then
  7223. if test "$hardcode_into_libs" = yes; then
  7224. # Hardcode the library paths
  7225. hardcode_libdirs=
  7226. dep_rpath=
  7227. rpath="$finalize_rpath"
  7228. test "$opt_mode" != relink && rpath="$compile_rpath$rpath"
  7229. for libdir in $rpath; do
  7230. if test -n "$hardcode_libdir_flag_spec"; then
  7231. if test -n "$hardcode_libdir_separator"; then
  7232. func_replace_sysroot "$libdir"
  7233. libdir=$func_replace_sysroot_result
  7234. if test -z "$hardcode_libdirs"; then
  7235. hardcode_libdirs="$libdir"
  7236. else
  7237. # Just accumulate the unique libdirs.
  7238. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
  7239. *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
  7240. ;;
  7241. *)
  7242. func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
  7243. ;;
  7244. esac
  7245. fi
  7246. else
  7247. eval flag=\"$hardcode_libdir_flag_spec\"
  7248. func_append dep_rpath " $flag"
  7249. fi
  7250. elif test -n "$runpath_var"; then
  7251. case "$perm_rpath " in
  7252. *" $libdir "*) ;;
  7253. *) func_apped perm_rpath " $libdir" ;;
  7254. esac
  7255. fi
  7256. done
  7257. # Substitute the hardcoded libdirs into the rpath.
  7258. if test -n "$hardcode_libdir_separator" &&
  7259. test -n "$hardcode_libdirs"; then
  7260. libdir="$hardcode_libdirs"
  7261. if test -n "$hardcode_libdir_flag_spec_ld"; then
  7262. eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\"
  7263. else
  7264. eval dep_rpath=\"$hardcode_libdir_flag_spec\"
  7265. fi
  7266. fi
  7267. if test -n "$runpath_var" && test -n "$perm_rpath"; then
  7268. # We should set the runpath_var.
  7269. rpath=
  7270. for dir in $perm_rpath; do
  7271. func_append rpath "$dir:"
  7272. done
  7273. eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
  7274. fi
  7275. test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
  7276. fi
  7277. shlibpath="$finalize_shlibpath"
  7278. test "$opt_mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
  7279. if test -n "$shlibpath"; then
  7280. eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
  7281. fi
  7282. # Get the real and link names of the library.
  7283. eval shared_ext=\"$shrext_cmds\"
  7284. eval library_names=\"$library_names_spec\"
  7285. set dummy $library_names
  7286. shift
  7287. realname="$1"
  7288. shift
  7289. if test -n "$soname_spec"; then
  7290. eval soname=\"$soname_spec\"
  7291. else
  7292. soname="$realname"
  7293. fi
  7294. if test -z "$dlname"; then
  7295. dlname=$soname
  7296. fi
  7297. lib="$output_objdir/$realname"
  7298. linknames=
  7299. for link
  7300. do
  7301. func_append linknames " $link"
  7302. done
  7303. # Use standard objects if they are pic
  7304. test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP`
  7305. test "X$libobjs" = "X " && libobjs=
  7306. delfiles=
  7307. if test -n "$export_symbols" && test -n "$include_expsyms"; then
  7308. $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp"
  7309. export_symbols="$output_objdir/$libname.uexp"
  7310. func_append delfiles " $export_symbols"
  7311. fi
  7312. orig_export_symbols=
  7313. case $host_os in
  7314. cygwin* | mingw* | cegcc*)
  7315. if test -n "$export_symbols" && test -z "$export_symbols_regex"; then
  7316. # exporting using user supplied symfile
  7317. if test "x`$SED 1q $export_symbols`" != xEXPORTS; then
  7318. # and it's NOT already a .def file. Must figure out
  7319. # which of the given symbols are data symbols and tag
  7320. # them as such. So, trigger use of export_symbols_cmds.
  7321. # export_symbols gets reassigned inside the "prepare
  7322. # the list of exported symbols" if statement, so the
  7323. # include_expsyms logic still works.
  7324. orig_export_symbols="$export_symbols"
  7325. export_symbols=
  7326. always_export_symbols=yes
  7327. fi
  7328. fi
  7329. ;;
  7330. esac
  7331. # Prepare the list of exported symbols
  7332. if test -z "$export_symbols"; then
  7333. if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
  7334. func_verbose "generating symbol list for \`$libname.la'"
  7335. export_symbols="$output_objdir/$libname.exp"
  7336. $opt_dry_run || $RM $export_symbols
  7337. cmds=$export_symbols_cmds
  7338. save_ifs="$IFS"; IFS='~'
  7339. for cmd1 in $cmds; do
  7340. IFS="$save_ifs"
  7341. # Take the normal branch if the nm_file_list_spec branch
  7342. # doesn't work or if tool conversion is not needed.
  7343. case $nm_file_list_spec~$to_tool_file_cmd in
  7344. *~func_convert_file_noop | *~func_convert_file_msys_to_w32 | ~*)
  7345. try_normal_branch=yes
  7346. eval cmd=\"$cmd1\"
  7347. func_len " $cmd"
  7348. len=$func_len_result
  7349. ;;
  7350. *)
  7351. try_normal_branch=no
  7352. ;;
  7353. esac
  7354. if test "$try_normal_branch" = yes \
  7355. && { test "$len" -lt "$max_cmd_len" \
  7356. || test "$max_cmd_len" -le -1; }
  7357. then
  7358. func_show_eval "$cmd" 'exit $?'
  7359. skipped_export=false
  7360. elif test -n "$nm_file_list_spec"; then
  7361. func_basename "$output"
  7362. output_la=$func_basename_result
  7363. save_libobjs=$libobjs
  7364. save_output=$output
  7365. output=${output_objdir}/${output_la}.nm
  7366. func_to_tool_file "$output"
  7367. libobjs=$nm_file_list_spec$func_to_tool_file_result
  7368. func_append delfiles " $output"
  7369. func_verbose "creating $NM input file list: $output"
  7370. for obj in $save_libobjs; do
  7371. func_to_tool_file "$obj"
  7372. $ECHO "$func_to_tool_file_result"
  7373. done > "$output"
  7374. eval cmd=\"$cmd1\"
  7375. func_show_eval "$cmd" 'exit $?'
  7376. output=$save_output
  7377. libobjs=$save_libobjs
  7378. skipped_export=false
  7379. else
  7380. # The command line is too long to execute in one step.
  7381. func_verbose "using reloadable object file for export list..."
  7382. skipped_export=:
  7383. # Break out early, otherwise skipped_export may be
  7384. # set to false by a later but shorter cmd.
  7385. break
  7386. fi
  7387. done
  7388. IFS="$save_ifs"
  7389. if test -n "$export_symbols_regex" && test "X$skipped_export" != "X:"; then
  7390. func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
  7391. func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
  7392. fi
  7393. fi
  7394. fi
  7395. if test -n "$export_symbols" && test -n "$include_expsyms"; then
  7396. tmp_export_symbols="$export_symbols"
  7397. test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
  7398. $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
  7399. fi
  7400. if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then
  7401. # The given exports_symbols file has to be filtered, so filter it.
  7402. func_verbose "filter symbol list for \`$libname.la' to tag DATA exports"
  7403. # FIXME: $output_objdir/$libname.filter potentially contains lots of
  7404. # 's' commands which not all seds can handle. GNU sed should be fine
  7405. # though. Also, the filter scales superlinearly with the number of
  7406. # global variables. join(1) would be nice here, but unfortunately
  7407. # isn't a blessed tool.
  7408. $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
  7409. func_append delfiles " $export_symbols $output_objdir/$libname.filter"
  7410. export_symbols=$output_objdir/$libname.def
  7411. $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
  7412. fi
  7413. tmp_deplibs=
  7414. for test_deplib in $deplibs; do
  7415. case " $convenience " in
  7416. *" $test_deplib "*) ;;
  7417. *)
  7418. func_append tmp_deplibs " $test_deplib"
  7419. ;;
  7420. esac
  7421. done
  7422. deplibs="$tmp_deplibs"
  7423. if test -n "$convenience"; then
  7424. if test -n "$whole_archive_flag_spec" &&
  7425. test "$compiler_needs_object" = yes &&
  7426. test -z "$libobjs"; then
  7427. # extract the archives, so we have objects to list.
  7428. # TODO: could optimize this to just extract one archive.
  7429. whole_archive_flag_spec=
  7430. fi
  7431. if test -n "$whole_archive_flag_spec"; then
  7432. save_libobjs=$libobjs
  7433. eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
  7434. test "X$libobjs" = "X " && libobjs=
  7435. else
  7436. gentop="$output_objdir/${outputname}x"
  7437. func_append generated " $gentop"
  7438. func_extract_archives $gentop $convenience
  7439. func_append libobjs " $func_extract_archives_result"
  7440. test "X$libobjs" = "X " && libobjs=
  7441. fi
  7442. fi
  7443. if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
  7444. eval flag=\"$thread_safe_flag_spec\"
  7445. func_append linker_flags " $flag"
  7446. fi
  7447. # Make a backup of the uninstalled library when relinking
  7448. if test "$opt_mode" = relink; then
  7449. $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $?
  7450. fi
  7451. # Do each of the archive commands.
  7452. if test "$module" = yes && test -n "$module_cmds" ; then
  7453. if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
  7454. eval test_cmds=\"$module_expsym_cmds\"
  7455. cmds=$module_expsym_cmds
  7456. else
  7457. eval test_cmds=\"$module_cmds\"
  7458. cmds=$module_cmds
  7459. fi
  7460. else
  7461. if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
  7462. eval test_cmds=\"$archive_expsym_cmds\"
  7463. cmds=$archive_expsym_cmds
  7464. else
  7465. eval test_cmds=\"$archive_cmds\"
  7466. cmds=$archive_cmds
  7467. fi
  7468. fi
  7469. if test "X$skipped_export" != "X:" &&
  7470. func_len " $test_cmds" &&
  7471. len=$func_len_result &&
  7472. test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
  7473. :
  7474. else
  7475. # The command line is too long to link in one step, link piecewise
  7476. # or, if using GNU ld and skipped_export is not :, use a linker
  7477. # script.
  7478. # Save the value of $output and $libobjs because we want to
  7479. # use them later. If we have whole_archive_flag_spec, we
  7480. # want to use save_libobjs as it was before
  7481. # whole_archive_flag_spec was expanded, because we can't
  7482. # assume the linker understands whole_archive_flag_spec.
  7483. # This may have to be revisited, in case too many
  7484. # convenience libraries get linked in and end up exceeding
  7485. # the spec.
  7486. if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
  7487. save_libobjs=$libobjs
  7488. fi
  7489. save_output=$output
  7490. func_basename "$output"
  7491. output_la=$func_basename_result
  7492. # Clear the reloadable object creation command queue and
  7493. # initialize k to one.
  7494. test_cmds=
  7495. concat_cmds=
  7496. objlist=
  7497. last_robj=
  7498. k=1
  7499. if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then
  7500. output=${output_objdir}/${output_la}.lnkscript
  7501. func_verbose "creating GNU ld script: $output"
  7502. echo 'INPUT (' > $output
  7503. for obj in $save_libobjs
  7504. do
  7505. func_to_tool_file "$obj"
  7506. $ECHO "$func_to_tool_file_result" >> $output
  7507. done
  7508. echo ')' >> $output
  7509. func_append delfiles " $output"
  7510. func_to_tool_file "$output"
  7511. output=$func_to_tool_file_result
  7512. elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then
  7513. output=${output_objdir}/${output_la}.lnk
  7514. func_verbose "creating linker input file list: $output"
  7515. : > $output
  7516. set x $save_libobjs
  7517. shift
  7518. firstobj=
  7519. if test "$compiler_needs_object" = yes; then
  7520. firstobj="$1 "
  7521. shift
  7522. fi
  7523. for obj
  7524. do
  7525. func_to_tool_file "$obj"
  7526. $ECHO "$func_to_tool_file_result" >> $output
  7527. done
  7528. func_append delfiles " $output"
  7529. func_to_tool_file "$output"
  7530. output=$firstobj\"$file_list_spec$func_to_tool_file_result\"
  7531. else
  7532. if test -n "$save_libobjs"; then
  7533. func_verbose "creating reloadable object files..."
  7534. output=$output_objdir/$output_la-${k}.$objext
  7535. eval test_cmds=\"$reload_cmds\"
  7536. func_len " $test_cmds"
  7537. len0=$func_len_result
  7538. len=$len0
  7539. # Loop over the list of objects to be linked.
  7540. for obj in $save_libobjs
  7541. do
  7542. func_len " $obj"
  7543. func_arith $len + $func_len_result
  7544. len=$func_arith_result
  7545. if test "X$objlist" = X ||
  7546. test "$len" -lt "$max_cmd_len"; then
  7547. func_append objlist " $obj"
  7548. else
  7549. # The command $test_cmds is almost too long, add a
  7550. # command to the queue.
  7551. if test "$k" -eq 1 ; then
  7552. # The first file doesn't have a previous command to add.
  7553. reload_objs=$objlist
  7554. eval concat_cmds=\"$reload_cmds\"
  7555. else
  7556. # All subsequent reloadable object files will link in
  7557. # the last one created.
  7558. reload_objs="$objlist $last_robj"
  7559. eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\"
  7560. fi
  7561. last_robj=$output_objdir/$output_la-${k}.$objext
  7562. func_arith $k + 1
  7563. k=$func_arith_result
  7564. output=$output_objdir/$output_la-${k}.$objext
  7565. objlist=" $obj"
  7566. func_len " $last_robj"
  7567. func_arith $len0 + $func_len_result
  7568. len=$func_arith_result
  7569. fi
  7570. done
  7571. # Handle the remaining objects by creating one last
  7572. # reloadable object file. All subsequent reloadable object
  7573. # files will link in the last one created.
  7574. test -z "$concat_cmds" || concat_cmds=$concat_cmds~
  7575. reload_objs="$objlist $last_robj"
  7576. eval concat_cmds=\"\${concat_cmds}$reload_cmds\"
  7577. if test -n "$last_robj"; then
  7578. eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\"
  7579. fi
  7580. func_append delfiles " $output"
  7581. else
  7582. output=
  7583. fi
  7584. if ${skipped_export-false}; then
  7585. func_verbose "generating symbol list for \`$libname.la'"
  7586. export_symbols="$output_objdir/$libname.exp"
  7587. $opt_dry_run || $RM $export_symbols
  7588. libobjs=$output
  7589. # Append the command to create the export file.
  7590. test -z "$concat_cmds" || concat_cmds=$concat_cmds~
  7591. eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\"
  7592. if test -n "$last_robj"; then
  7593. eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\"
  7594. fi
  7595. fi
  7596. test -n "$save_libobjs" &&
  7597. func_verbose "creating a temporary reloadable object file: $output"
  7598. # Loop through the commands generated above and execute them.
  7599. save_ifs="$IFS"; IFS='~'
  7600. for cmd in $concat_cmds; do
  7601. IFS="$save_ifs"
  7602. $opt_silent || {
  7603. func_quote_for_expand "$cmd"
  7604. eval "func_echo $func_quote_for_expand_result"
  7605. }
  7606. $opt_dry_run || eval "$cmd" || {
  7607. lt_exit=$?
  7608. # Restore the uninstalled library and exit
  7609. if test "$opt_mode" = relink; then
  7610. ( cd "$output_objdir" && \
  7611. $RM "${realname}T" && \
  7612. $MV "${realname}U" "$realname" )
  7613. fi
  7614. exit $lt_exit
  7615. }
  7616. done
  7617. IFS="$save_ifs"
  7618. if test -n "$export_symbols_regex" && ${skipped_export-false}; then
  7619. func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
  7620. func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
  7621. fi
  7622. fi
  7623. if ${skipped_export-false}; then
  7624. if test -n "$export_symbols" && test -n "$include_expsyms"; then
  7625. tmp_export_symbols="$export_symbols"
  7626. test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
  7627. $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
  7628. fi
  7629. if test -n "$orig_export_symbols"; then
  7630. # The given exports_symbols file has to be filtered, so filter it.
  7631. func_verbose "filter symbol list for \`$libname.la' to tag DATA exports"
  7632. # FIXME: $output_objdir/$libname.filter potentially contains lots of
  7633. # 's' commands which not all seds can handle. GNU sed should be fine
  7634. # though. Also, the filter scales superlinearly with the number of
  7635. # global variables. join(1) would be nice here, but unfortunately
  7636. # isn't a blessed tool.
  7637. $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
  7638. func_append delfiles " $export_symbols $output_objdir/$libname.filter"
  7639. export_symbols=$output_objdir/$libname.def
  7640. $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
  7641. fi
  7642. fi
  7643. libobjs=$output
  7644. # Restore the value of output.
  7645. output=$save_output
  7646. if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
  7647. eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
  7648. test "X$libobjs" = "X " && libobjs=
  7649. fi
  7650. # Expand the library linking commands again to reset the
  7651. # value of $libobjs for piecewise linking.
  7652. # Do each of the archive commands.
  7653. if test "$module" = yes && test -n "$module_cmds" ; then
  7654. if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
  7655. cmds=$module_expsym_cmds
  7656. else
  7657. cmds=$module_cmds
  7658. fi
  7659. else
  7660. if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
  7661. cmds=$archive_expsym_cmds
  7662. else
  7663. cmds=$archive_cmds
  7664. fi
  7665. fi
  7666. fi
  7667. if test -n "$delfiles"; then
  7668. # Append the command to remove temporary files to $cmds.
  7669. eval cmds=\"\$cmds~\$RM $delfiles\"
  7670. fi
  7671. # Add any objects from preloaded convenience libraries
  7672. if test -n "$dlprefiles"; then
  7673. gentop="$output_objdir/${outputname}x"
  7674. func_append generated " $gentop"
  7675. func_extract_archives $gentop $dlprefiles
  7676. func_append libobjs " $func_extract_archives_result"
  7677. test "X$libobjs" = "X " && libobjs=
  7678. fi
  7679. save_ifs="$IFS"; IFS='~'
  7680. for cmd in $cmds; do
  7681. IFS="$save_ifs"
  7682. eval cmd=\"$cmd\"
  7683. $opt_silent || {
  7684. func_quote_for_expand "$cmd"
  7685. eval "func_echo $func_quote_for_expand_result"
  7686. }
  7687. $opt_dry_run || eval "$cmd" || {
  7688. lt_exit=$?
  7689. # Restore the uninstalled library and exit
  7690. if test "$opt_mode" = relink; then
  7691. ( cd "$output_objdir" && \
  7692. $RM "${realname}T" && \
  7693. $MV "${realname}U" "$realname" )
  7694. fi
  7695. exit $lt_exit
  7696. }
  7697. done
  7698. IFS="$save_ifs"
  7699. # Restore the uninstalled library and exit
  7700. if test "$opt_mode" = relink; then
  7701. $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $?
  7702. if test -n "$convenience"; then
  7703. if test -z "$whole_archive_flag_spec"; then
  7704. func_show_eval '${RM}r "$gentop"'
  7705. fi
  7706. fi
  7707. exit $EXIT_SUCCESS
  7708. fi
  7709. # Create links to the real library.
  7710. for linkname in $linknames; do
  7711. if test "$realname" != "$linkname"; then
  7712. func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?'
  7713. fi
  7714. done
  7715. # If -module or -export-dynamic was specified, set the dlname.
  7716. if test "$module" = yes || test "$export_dynamic" = yes; then
  7717. # On all known operating systems, these are identical.
  7718. dlname="$soname"
  7719. fi
  7720. fi
  7721. ;;
  7722. obj)
  7723. if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
  7724. func_warning "\`-dlopen' is ignored for objects"
  7725. fi
  7726. case " $deplibs" in
  7727. *\ -l* | *\ -L*)
  7728. func_warning "\`-l' and \`-L' are ignored for objects" ;;
  7729. esac
  7730. test -n "$rpath" && \
  7731. func_warning "\`-rpath' is ignored for objects"
  7732. test -n "$xrpath" && \
  7733. func_warning "\`-R' is ignored for objects"
  7734. test -n "$vinfo" && \
  7735. func_warning "\`-version-info' is ignored for objects"
  7736. test -n "$release" && \
  7737. func_warning "\`-release' is ignored for objects"
  7738. case $output in
  7739. *.lo)
  7740. test -n "$objs$old_deplibs" && \
  7741. func_fatal_error "cannot build library object \`$output' from non-libtool objects"
  7742. libobj=$output
  7743. func_lo2o "$libobj"
  7744. obj=$func_lo2o_result
  7745. ;;
  7746. *)
  7747. libobj=
  7748. obj="$output"
  7749. ;;
  7750. esac
  7751. # Delete the old objects.
  7752. $opt_dry_run || $RM $obj $libobj
  7753. # Objects from convenience libraries. This assumes
  7754. # single-version convenience libraries. Whenever we create
  7755. # different ones for PIC/non-PIC, this we'll have to duplicate
  7756. # the extraction.
  7757. reload_conv_objs=
  7758. gentop=
  7759. # reload_cmds runs $LD directly, so let us get rid of
  7760. # -Wl from whole_archive_flag_spec and hope we can get by with
  7761. # turning comma into space..
  7762. wl=
  7763. if test -n "$convenience"; then
  7764. if test -n "$whole_archive_flag_spec"; then
  7765. eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
  7766. reload_conv_objs=$reload_objs\ `$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'`
  7767. else
  7768. gentop="$output_objdir/${obj}x"
  7769. func_append generated " $gentop"
  7770. func_extract_archives $gentop $convenience
  7771. reload_conv_objs="$reload_objs $func_extract_archives_result"
  7772. fi
  7773. fi
  7774. # If we're not building shared, we need to use non_pic_objs
  7775. test "$build_libtool_libs" != yes && libobjs="$non_pic_objects"
  7776. # Create the old-style object.
  7777. reload_objs="$objs$old_deplibs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; /\.lib$/d; $lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test
  7778. output="$obj"
  7779. func_execute_cmds "$reload_cmds" 'exit $?'
  7780. # Exit if we aren't doing a library object file.
  7781. if test -z "$libobj"; then
  7782. if test -n "$gentop"; then
  7783. func_show_eval '${RM}r "$gentop"'
  7784. fi
  7785. exit $EXIT_SUCCESS
  7786. fi
  7787. if test "$build_libtool_libs" != yes; then
  7788. if test -n "$gentop"; then
  7789. func_show_eval '${RM}r "$gentop"'
  7790. fi
  7791. # Create an invalid libtool object if no PIC, so that we don't
  7792. # accidentally link it into a program.
  7793. # $show "echo timestamp > $libobj"
  7794. # $opt_dry_run || eval "echo timestamp > $libobj" || exit $?
  7795. exit $EXIT_SUCCESS
  7796. fi
  7797. if test -n "$pic_flag" || test "$pic_mode" != default; then
  7798. # Only do commands if we really have different PIC objects.
  7799. reload_objs="$libobjs $reload_conv_objs"
  7800. output="$libobj"
  7801. func_execute_cmds "$reload_cmds" 'exit $?'
  7802. fi
  7803. if test -n "$gentop"; then
  7804. func_show_eval '${RM}r "$gentop"'
  7805. fi
  7806. exit $EXIT_SUCCESS
  7807. ;;
  7808. prog)
  7809. case $host in
  7810. *cygwin*) func_stripname '' '.exe' "$output"
  7811. output=$func_stripname_result.exe;;
  7812. esac
  7813. test -n "$vinfo" && \
  7814. func_warning "\`-version-info' is ignored for programs"
  7815. test -n "$release" && \
  7816. func_warning "\`-release' is ignored for programs"
  7817. test "$preload" = yes \
  7818. && test "$dlopen_support" = unknown \
  7819. && test "$dlopen_self" = unknown \
  7820. && test "$dlopen_self_static" = unknown && \
  7821. func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support."
  7822. case $host in
  7823. *-*-rhapsody* | *-*-darwin1.[012])
  7824. # On Rhapsody replace the C library is the System framework
  7825. compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'`
  7826. finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'`
  7827. ;;
  7828. esac
  7829. case $host in
  7830. *-*-darwin*)
  7831. # Don't allow lazy linking, it breaks C++ global constructors
  7832. # But is supposedly fixed on 10.4 or later (yay!).
  7833. if test "$tagname" = CXX ; then
  7834. case ${MACOSX_DEPLOYMENT_TARGET-10.0} in
  7835. 10.[0123])
  7836. func_append compile_command " ${wl}-bind_at_load"
  7837. func_append finalize_command " ${wl}-bind_at_load"
  7838. ;;
  7839. esac
  7840. fi
  7841. # Time to change all our "foo.ltframework" stuff back to "-framework foo"
  7842. compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
  7843. finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
  7844. ;;
  7845. esac
  7846. # move library search paths that coincide with paths to not yet
  7847. # installed libraries to the beginning of the library search list
  7848. new_libs=
  7849. for path in $notinst_path; do
  7850. case " $new_libs " in
  7851. *" -L$path/$objdir "*) ;;
  7852. *)
  7853. case " $compile_deplibs " in
  7854. *" -L$path/$objdir "*)
  7855. func_append new_libs " -L$path/$objdir" ;;
  7856. esac
  7857. ;;
  7858. esac
  7859. done
  7860. for deplib in $compile_deplibs; do
  7861. case $deplib in
  7862. -L*)
  7863. case " $new_libs " in
  7864. *" $deplib "*) ;;
  7865. *) func_append new_libs " $deplib" ;;
  7866. esac
  7867. ;;
  7868. *) func_append new_libs " $deplib" ;;
  7869. esac
  7870. done
  7871. compile_deplibs="$new_libs"
  7872. func_append compile_command " $compile_deplibs"
  7873. func_append finalize_command " $finalize_deplibs"
  7874. if test -n "$rpath$xrpath"; then
  7875. # If the user specified any rpath flags, then add them.
  7876. for libdir in $rpath $xrpath; do
  7877. # This is the magic to use -rpath.
  7878. case "$finalize_rpath " in
  7879. *" $libdir "*) ;;
  7880. *) func_append finalize_rpath " $libdir" ;;
  7881. esac
  7882. done
  7883. fi
  7884. # Now hardcode the library paths
  7885. rpath=
  7886. hardcode_libdirs=
  7887. for libdir in $compile_rpath $finalize_rpath; do
  7888. if test -n "$hardcode_libdir_flag_spec"; then
  7889. if test -n "$hardcode_libdir_separator"; then
  7890. if test -z "$hardcode_libdirs"; then
  7891. hardcode_libdirs="$libdir"
  7892. else
  7893. # Just accumulate the unique libdirs.
  7894. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
  7895. *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
  7896. ;;
  7897. *)
  7898. func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
  7899. ;;
  7900. esac
  7901. fi
  7902. else
  7903. eval flag=\"$hardcode_libdir_flag_spec\"
  7904. func_append rpath " $flag"
  7905. fi
  7906. elif test -n "$runpath_var"; then
  7907. case "$perm_rpath " in
  7908. *" $libdir "*) ;;
  7909. *) func_append perm_rpath " $libdir" ;;
  7910. esac
  7911. fi
  7912. case $host in
  7913. *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
  7914. testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'`
  7915. case :$dllsearchpath: in
  7916. *":$libdir:"*) ;;
  7917. ::) dllsearchpath=$libdir;;
  7918. *) func_append dllsearchpath ":$libdir";;
  7919. esac
  7920. case :$dllsearchpath: in
  7921. *":$testbindir:"*) ;;
  7922. ::) dllsearchpath=$testbindir;;
  7923. *) func_append dllsearchpath ":$testbindir";;
  7924. esac
  7925. ;;
  7926. esac
  7927. done
  7928. # Substitute the hardcoded libdirs into the rpath.
  7929. if test -n "$hardcode_libdir_separator" &&
  7930. test -n "$hardcode_libdirs"; then
  7931. libdir="$hardcode_libdirs"
  7932. eval rpath=\" $hardcode_libdir_flag_spec\"
  7933. fi
  7934. compile_rpath="$rpath"
  7935. rpath=
  7936. hardcode_libdirs=
  7937. for libdir in $finalize_rpath; do
  7938. if test -n "$hardcode_libdir_flag_spec"; then
  7939. if test -n "$hardcode_libdir_separator"; then
  7940. if test -z "$hardcode_libdirs"; then
  7941. hardcode_libdirs="$libdir"
  7942. else
  7943. # Just accumulate the unique libdirs.
  7944. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
  7945. *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
  7946. ;;
  7947. *)
  7948. func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
  7949. ;;
  7950. esac
  7951. fi
  7952. else
  7953. eval flag=\"$hardcode_libdir_flag_spec\"
  7954. func_append rpath " $flag"
  7955. fi
  7956. elif test -n "$runpath_var"; then
  7957. case "$finalize_perm_rpath " in
  7958. *" $libdir "*) ;;
  7959. *) func_append finalize_perm_rpath " $libdir" ;;
  7960. esac
  7961. fi
  7962. done
  7963. # Substitute the hardcoded libdirs into the rpath.
  7964. if test -n "$hardcode_libdir_separator" &&
  7965. test -n "$hardcode_libdirs"; then
  7966. libdir="$hardcode_libdirs"
  7967. eval rpath=\" $hardcode_libdir_flag_spec\"
  7968. fi
  7969. finalize_rpath="$rpath"
  7970. if test -n "$libobjs" && test "$build_old_libs" = yes; then
  7971. # Transform all the library objects into standard objects.
  7972. compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
  7973. finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
  7974. fi
  7975. func_generate_dlsyms "$outputname" "@PROGRAM@" "no"
  7976. # template prelinking step
  7977. if test -n "$prelink_cmds"; then
  7978. func_execute_cmds "$prelink_cmds" 'exit $?'
  7979. fi
  7980. wrappers_required=yes
  7981. case $host in
  7982. *cegcc* | *mingw32ce*)
  7983. # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway.
  7984. wrappers_required=no
  7985. ;;
  7986. *cygwin* | *mingw* )
  7987. if test "$build_libtool_libs" != yes; then
  7988. wrappers_required=no
  7989. fi
  7990. ;;
  7991. *)
  7992. if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
  7993. wrappers_required=no
  7994. fi
  7995. ;;
  7996. esac
  7997. if test "$wrappers_required" = no; then
  7998. # Replace the output file specification.
  7999. compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
  8000. link_command="$compile_command$compile_rpath"
  8001. # We have no uninstalled library dependencies, so finalize right now.
  8002. exit_status=0
  8003. func_show_eval "$link_command" 'exit_status=$?'
  8004. if test -n "$postlink_cmds"; then
  8005. func_to_tool_file "$output"
  8006. postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
  8007. func_execute_cmds "$postlink_cmds" 'exit $?'
  8008. fi
  8009. # Delete the generated files.
  8010. if test -f "$output_objdir/${outputname}S.${objext}"; then
  8011. func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"'
  8012. fi
  8013. exit $exit_status
  8014. fi
  8015. if test -n "$compile_shlibpath$finalize_shlibpath"; then
  8016. compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
  8017. fi
  8018. if test -n "$finalize_shlibpath"; then
  8019. finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
  8020. fi
  8021. compile_var=
  8022. finalize_var=
  8023. if test -n "$runpath_var"; then
  8024. if test -n "$perm_rpath"; then
  8025. # We should set the runpath_var.
  8026. rpath=
  8027. for dir in $perm_rpath; do
  8028. func_append rpath "$dir:"
  8029. done
  8030. compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
  8031. fi
  8032. if test -n "$finalize_perm_rpath"; then
  8033. # We should set the runpath_var.
  8034. rpath=
  8035. for dir in $finalize_perm_rpath; do
  8036. func_append rpath "$dir:"
  8037. done
  8038. finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
  8039. fi
  8040. fi
  8041. if test "$no_install" = yes; then
  8042. # We don't need to create a wrapper script.
  8043. link_command="$compile_var$compile_command$compile_rpath"
  8044. # Replace the output file specification.
  8045. link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
  8046. # Delete the old output file.
  8047. $opt_dry_run || $RM $output
  8048. # Link the executable and exit
  8049. func_show_eval "$link_command" 'exit $?'
  8050. if test -n "$postlink_cmds"; then
  8051. func_to_tool_file "$output"
  8052. postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
  8053. func_execute_cmds "$postlink_cmds" 'exit $?'
  8054. fi
  8055. exit $EXIT_SUCCESS
  8056. fi
  8057. if test "$hardcode_action" = relink; then
  8058. # Fast installation is not supported
  8059. link_command="$compile_var$compile_command$compile_rpath"
  8060. relink_command="$finalize_var$finalize_command$finalize_rpath"
  8061. func_warning "this platform does not like uninstalled shared libraries"
  8062. func_warning "\`$output' will be relinked during installation"
  8063. else
  8064. if test "$fast_install" != no; then
  8065. link_command="$finalize_var$compile_command$finalize_rpath"
  8066. if test "$fast_install" = yes; then
  8067. relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'`
  8068. else
  8069. # fast_install is set to needless
  8070. relink_command=
  8071. fi
  8072. else
  8073. link_command="$compile_var$compile_command$compile_rpath"
  8074. relink_command="$finalize_var$finalize_command$finalize_rpath"
  8075. fi
  8076. fi
  8077. # Replace the output file specification.
  8078. link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
  8079. # Delete the old output files.
  8080. $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname
  8081. func_show_eval "$link_command" 'exit $?'
  8082. if test -n "$postlink_cmds"; then
  8083. func_to_tool_file "$output_objdir/$outputname"
  8084. 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'`
  8085. func_execute_cmds "$postlink_cmds" 'exit $?'
  8086. fi
  8087. # Now create the wrapper script.
  8088. func_verbose "creating $output"
  8089. # Quote the relink command for shipping.
  8090. if test -n "$relink_command"; then
  8091. # Preserve any variables that may affect compiler behavior
  8092. for var in $variables_saved_for_relink; do
  8093. if eval test -z \"\${$var+set}\"; then
  8094. relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
  8095. elif eval var_value=\$$var; test -z "$var_value"; then
  8096. relink_command="$var=; export $var; $relink_command"
  8097. else
  8098. func_quote_for_eval "$var_value"
  8099. relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
  8100. fi
  8101. done
  8102. relink_command="(cd `pwd`; $relink_command)"
  8103. relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
  8104. fi
  8105. # Only actually do things if not in dry run mode.
  8106. $opt_dry_run || {
  8107. # win32 will think the script is a binary if it has
  8108. # a .exe suffix, so we strip it off here.
  8109. case $output in
  8110. *.exe) func_stripname '' '.exe' "$output"
  8111. output=$func_stripname_result ;;
  8112. esac
  8113. # test for cygwin because mv fails w/o .exe extensions
  8114. case $host in
  8115. *cygwin*)
  8116. exeext=.exe
  8117. func_stripname '' '.exe' "$outputname"
  8118. outputname=$func_stripname_result ;;
  8119. *) exeext= ;;
  8120. esac
  8121. case $host in
  8122. *cygwin* | *mingw* )
  8123. func_dirname_and_basename "$output" "" "."
  8124. output_name=$func_basename_result
  8125. output_path=$func_dirname_result
  8126. cwrappersource="$output_path/$objdir/lt-$output_name.c"
  8127. cwrapper="$output_path/$output_name.exe"
  8128. $RM $cwrappersource $cwrapper
  8129. trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
  8130. func_emit_cwrapperexe_src > $cwrappersource
  8131. # The wrapper executable is built using the $host compiler,
  8132. # because it contains $host paths and files. If cross-
  8133. # compiling, it, like the target executable, must be
  8134. # executed on the $host or under an emulation environment.
  8135. $opt_dry_run || {
  8136. $LTCC $LTCFLAGS -o $cwrapper $cwrappersource
  8137. $STRIP $cwrapper
  8138. }
  8139. # Now, create the wrapper script for func_source use:
  8140. func_ltwrapper_scriptname $cwrapper
  8141. $RM $func_ltwrapper_scriptname_result
  8142. trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15
  8143. $opt_dry_run || {
  8144. # note: this script will not be executed, so do not chmod.
  8145. if test "x$build" = "x$host" ; then
  8146. $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result
  8147. else
  8148. func_emit_wrapper no > $func_ltwrapper_scriptname_result
  8149. fi
  8150. }
  8151. ;;
  8152. * )
  8153. $RM $output
  8154. trap "$RM $output; exit $EXIT_FAILURE" 1 2 15
  8155. func_emit_wrapper no > $output
  8156. chmod +x $output
  8157. ;;
  8158. esac
  8159. }
  8160. exit $EXIT_SUCCESS
  8161. ;;
  8162. esac
  8163. # See if we need to build an old-fashioned archive.
  8164. for oldlib in $oldlibs; do
  8165. if test "$build_libtool_libs" = convenience; then
  8166. oldobjs="$libobjs_save $symfileobj"
  8167. addlibs="$convenience"
  8168. build_libtool_libs=no
  8169. else
  8170. if test "$build_libtool_libs" = module; then
  8171. oldobjs="$libobjs_save"
  8172. build_libtool_libs=no
  8173. else
  8174. oldobjs="$old_deplibs $non_pic_objects"
  8175. if test "$preload" = yes && test -f "$symfileobj"; then
  8176. func_append oldobjs " $symfileobj"
  8177. fi
  8178. fi
  8179. addlibs="$old_convenience"
  8180. fi
  8181. if test -n "$addlibs"; then
  8182. gentop="$output_objdir/${outputname}x"
  8183. func_append generated " $gentop"
  8184. func_extract_archives $gentop $addlibs
  8185. func_append oldobjs " $func_extract_archives_result"
  8186. fi
  8187. # Do each command in the archive commands.
  8188. if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
  8189. cmds=$old_archive_from_new_cmds
  8190. else
  8191. # Add any objects from preloaded convenience libraries
  8192. if test -n "$dlprefiles"; then
  8193. gentop="$output_objdir/${outputname}x"
  8194. func_append generated " $gentop"
  8195. func_extract_archives $gentop $dlprefiles
  8196. func_append oldobjs " $func_extract_archives_result"
  8197. fi
  8198. # POSIX demands no paths to be encoded in archives. We have
  8199. # to avoid creating archives with duplicate basenames if we
  8200. # might have to extract them afterwards, e.g., when creating a
  8201. # static archive out of a convenience library, or when linking
  8202. # the entirety of a libtool archive into another (currently
  8203. # not supported by libtool).
  8204. if (for obj in $oldobjs
  8205. do
  8206. func_basename "$obj"
  8207. $ECHO "$func_basename_result"
  8208. done | sort | sort -uc >/dev/null 2>&1); then
  8209. :
  8210. else
  8211. echo "copying selected object files to avoid basename conflicts..."
  8212. gentop="$output_objdir/${outputname}x"
  8213. func_append generated " $gentop"
  8214. func_mkdir_p "$gentop"
  8215. save_oldobjs=$oldobjs
  8216. oldobjs=
  8217. counter=1
  8218. for obj in $save_oldobjs
  8219. do
  8220. func_basename "$obj"
  8221. objbase="$func_basename_result"
  8222. case " $oldobjs " in
  8223. " ") oldobjs=$obj ;;
  8224. *[\ /]"$objbase "*)
  8225. while :; do
  8226. # Make sure we don't pick an alternate name that also
  8227. # overlaps.
  8228. newobj=lt$counter-$objbase
  8229. func_arith $counter + 1
  8230. counter=$func_arith_result
  8231. case " $oldobjs " in
  8232. *[\ /]"$newobj "*) ;;
  8233. *) if test ! -f "$gentop/$newobj"; then break; fi ;;
  8234. esac
  8235. done
  8236. func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
  8237. func_append oldobjs " $gentop/$newobj"
  8238. ;;
  8239. *) func_append oldobjs " $obj" ;;
  8240. esac
  8241. done
  8242. fi
  8243. eval cmds=\"$old_archive_cmds\"
  8244. func_len " $cmds"
  8245. len=$func_len_result
  8246. if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
  8247. cmds=$old_archive_cmds
  8248. elif test -n "$archiver_list_spec"; then
  8249. func_verbose "using command file archive linking..."
  8250. for obj in $oldobjs
  8251. do
  8252. func_to_tool_file "$obj"
  8253. $ECHO "$func_to_tool_file_result"
  8254. done > $output_objdir/$libname.libcmd
  8255. func_to_tool_file "$output_objdir/$libname.libcmd"
  8256. oldobjs=" $archiver_list_spec$func_to_tool_file_result"
  8257. cmds=$old_archive_cmds
  8258. else
  8259. # the command line is too long to link in one step, link in parts
  8260. func_verbose "using piecewise archive linking..."
  8261. save_RANLIB=$RANLIB
  8262. RANLIB=:
  8263. objlist=
  8264. concat_cmds=
  8265. save_oldobjs=$oldobjs
  8266. oldobjs=
  8267. # Is there a better way of finding the last object in the list?
  8268. for obj in $save_oldobjs
  8269. do
  8270. last_oldobj=$obj
  8271. done
  8272. eval test_cmds=\"$old_archive_cmds\"
  8273. func_len " $test_cmds"
  8274. len0=$func_len_result
  8275. len=$len0
  8276. for obj in $save_oldobjs
  8277. do
  8278. func_len " $obj"
  8279. func_arith $len + $func_len_result
  8280. len=$func_arith_result
  8281. func_append objlist " $obj"
  8282. if test "$len" -lt "$max_cmd_len"; then
  8283. :
  8284. else
  8285. # the above command should be used before it gets too long
  8286. oldobjs=$objlist
  8287. if test "$obj" = "$last_oldobj" ; then
  8288. RANLIB=$save_RANLIB
  8289. fi
  8290. test -z "$concat_cmds" || concat_cmds=$concat_cmds~
  8291. eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
  8292. objlist=
  8293. len=$len0
  8294. fi
  8295. done
  8296. RANLIB=$save_RANLIB
  8297. oldobjs=$objlist
  8298. if test "X$oldobjs" = "X" ; then
  8299. eval cmds=\"\$concat_cmds\"
  8300. else
  8301. eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
  8302. fi
  8303. fi
  8304. fi
  8305. func_execute_cmds "$cmds" 'exit $?'
  8306. done
  8307. test -n "$generated" && \
  8308. func_show_eval "${RM}r$generated"
  8309. # Now create the libtool archive.
  8310. case $output in
  8311. *.la)
  8312. old_library=
  8313. test "$build_old_libs" = yes && old_library="$libname.$libext"
  8314. func_verbose "creating $output"
  8315. # Preserve any variables that may affect compiler behavior
  8316. for var in $variables_saved_for_relink; do
  8317. if eval test -z \"\${$var+set}\"; then
  8318. relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
  8319. elif eval var_value=\$$var; test -z "$var_value"; then
  8320. relink_command="$var=; export $var; $relink_command"
  8321. else
  8322. func_quote_for_eval "$var_value"
  8323. relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
  8324. fi
  8325. done
  8326. # Quote the link command for shipping.
  8327. relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
  8328. relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
  8329. if test "$hardcode_automatic" = yes ; then
  8330. relink_command=
  8331. fi
  8332. # Only create the output if not a dry run.
  8333. $opt_dry_run || {
  8334. for installed in no yes; do
  8335. if test "$installed" = yes; then
  8336. if test -z "$install_libdir"; then
  8337. break
  8338. fi
  8339. output="$output_objdir/$outputname"i
  8340. # Replace all uninstalled libtool libraries with the installed ones
  8341. newdependency_libs=
  8342. for deplib in $dependency_libs; do
  8343. case $deplib in
  8344. *.la)
  8345. func_basename "$deplib"
  8346. name="$func_basename_result"
  8347. eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
  8348. test -z "$libdir" && \
  8349. func_fatal_error "\`$deplib' is not a valid libtool archive"
  8350. func_append newdependency_libs " ${lt_sysroot:+=}$libdir/$name"
  8351. ;;
  8352. -L*)
  8353. func_stripname -L '' "$deplib"
  8354. func_replace_sysroot "$func_stripname_result"
  8355. func_append newdependency_libs " -L$func_replace_sysroot_result"
  8356. ;;
  8357. -R*)
  8358. func_stripname -R '' "$deplib"
  8359. func_replace_sysroot "$func_stripname_result"
  8360. func_append newdependency_libs " -R$func_replace_sysroot_result"
  8361. ;;
  8362. *) func_append newdependency_libs " $deplib" ;;
  8363. esac
  8364. done
  8365. dependency_libs="$newdependency_libs"
  8366. newdlfiles=
  8367. for lib in $dlfiles; do
  8368. case $lib in
  8369. *.la)
  8370. func_basename "$lib"
  8371. name="$func_basename_result"
  8372. eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
  8373. test -z "$libdir" && \
  8374. func_fatal_error "\`$lib' is not a valid libtool archive"
  8375. func_append newdlfiles " ${lt_sysroot:+=}$libdir/$name"
  8376. ;;
  8377. *) func_append newdlfiles " $lib" ;;
  8378. esac
  8379. done
  8380. dlfiles="$newdlfiles"
  8381. newdlprefiles=
  8382. for lib in $dlprefiles; do
  8383. case $lib in
  8384. *.la)
  8385. # Only pass preopened files to the pseudo-archive (for
  8386. # eventual linking with the app. that links it) if we
  8387. # didn't already link the preopened objects directly into
  8388. # the library:
  8389. func_basename "$lib"
  8390. name="$func_basename_result"
  8391. eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
  8392. test -z "$libdir" && \
  8393. func_fatal_error "\`$lib' is not a valid libtool archive"
  8394. func_append newdlprefiles " ${lt_sysroot:+=}$libdir/$name"
  8395. ;;
  8396. esac
  8397. done
  8398. dlprefiles="$newdlprefiles"
  8399. else
  8400. newdlfiles=
  8401. for lib in $dlfiles; do
  8402. case $lib in
  8403. [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
  8404. *) abs=`pwd`"/$lib" ;;
  8405. esac
  8406. func_append newdlfiles " $abs"
  8407. done
  8408. dlfiles="$newdlfiles"
  8409. newdlprefiles=
  8410. for lib in $dlprefiles; do
  8411. case $lib in
  8412. [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
  8413. *) abs=`pwd`"/$lib" ;;
  8414. esac
  8415. func_append newdlprefiles " $abs"
  8416. done
  8417. dlprefiles="$newdlprefiles"
  8418. fi
  8419. $RM $output
  8420. # place dlname in correct position for cygwin
  8421. # In fact, it would be nice if we could use this code for all target
  8422. # systems that can't hard-code library paths into their executables
  8423. # and that have no shared library path variable independent of PATH,
  8424. # but it turns out we can't easily determine that from inspecting
  8425. # libtool variables, so we have to hard-code the OSs to which it
  8426. # applies here; at the moment, that means platforms that use the PE
  8427. # object format with DLL files. See the long comment at the top of
  8428. # tests/bindir.at for full details.
  8429. tdlname=$dlname
  8430. case $host,$output,$installed,$module,$dlname in
  8431. *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll)
  8432. # If a -bindir argument was supplied, place the dll there.
  8433. if test "x$bindir" != x ;
  8434. then
  8435. func_relative_path "$install_libdir" "$bindir"
  8436. tdlname=$func_relative_path_result$dlname
  8437. else
  8438. # Otherwise fall back on heuristic.
  8439. tdlname=../bin/$dlname
  8440. fi
  8441. ;;
  8442. esac
  8443. $ECHO > $output "\
  8444. # $outputname - a libtool library file
  8445. # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
  8446. #
  8447. # Please DO NOT delete this file!
  8448. # It is necessary for linking the library.
  8449. # The name that we can dlopen(3).
  8450. dlname='$tdlname'
  8451. # Names of this library.
  8452. library_names='$library_names'
  8453. # The name of the static archive.
  8454. old_library='$old_library'
  8455. # Linker flags that can not go in dependency_libs.
  8456. inherited_linker_flags='$new_inherited_linker_flags'
  8457. # Libraries that this one depends upon.
  8458. dependency_libs='$dependency_libs'
  8459. # Names of additional weak libraries provided by this library
  8460. weak_library_names='$weak_libs'
  8461. # Version information for $libname.
  8462. current=$current
  8463. age=$age
  8464. revision=$revision
  8465. # Is this an already installed library?
  8466. installed=$installed
  8467. # Should we warn about portability when linking against -modules?
  8468. shouldnotlink=$module
  8469. # Files to dlopen/dlpreopen
  8470. dlopen='$dlfiles'
  8471. dlpreopen='$dlprefiles'
  8472. # Directory that this library needs to be installed in:
  8473. libdir='$install_libdir'"
  8474. if test "$installed" = no && test "$need_relink" = yes; then
  8475. $ECHO >> $output "\
  8476. relink_command=\"$relink_command\""
  8477. fi
  8478. done
  8479. }
  8480. # Do a symbolic link so that the libtool archive can be found in
  8481. # LD_LIBRARY_PATH before the program is installed.
  8482. func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?'
  8483. ;;
  8484. esac
  8485. exit $EXIT_SUCCESS
  8486. }
  8487. { test "$opt_mode" = link || test "$opt_mode" = relink; } &&
  8488. func_mode_link ${1+"$@"}
  8489. # func_mode_uninstall arg...
  8490. func_mode_uninstall ()
  8491. {
  8492. $opt_debug
  8493. RM="$nonopt"
  8494. files=
  8495. rmforce=
  8496. exit_status=0
  8497. # This variable tells wrapper scripts just to set variables rather
  8498. # than running their programs.
  8499. libtool_install_magic="$magic"
  8500. for arg
  8501. do
  8502. case $arg in
  8503. -f) func_append RM " $arg"; rmforce=yes ;;
  8504. -*) func_append RM " $arg" ;;
  8505. *) func_append files " $arg" ;;
  8506. esac
  8507. done
  8508. test -z "$RM" && \
  8509. func_fatal_help "you must specify an RM program"
  8510. rmdirs=
  8511. for file in $files; do
  8512. func_dirname "$file" "" "."
  8513. dir="$func_dirname_result"
  8514. if test "X$dir" = X.; then
  8515. odir="$objdir"
  8516. else
  8517. odir="$dir/$objdir"
  8518. fi
  8519. func_basename "$file"
  8520. name="$func_basename_result"
  8521. test "$opt_mode" = uninstall && odir="$dir"
  8522. # Remember odir for removal later, being careful to avoid duplicates
  8523. if test "$opt_mode" = clean; then
  8524. case " $rmdirs " in
  8525. *" $odir "*) ;;
  8526. *) func_append rmdirs " $odir" ;;
  8527. esac
  8528. fi
  8529. # Don't error if the file doesn't exist and rm -f was used.
  8530. if { test -L "$file"; } >/dev/null 2>&1 ||
  8531. { test -h "$file"; } >/dev/null 2>&1 ||
  8532. test -f "$file"; then
  8533. :
  8534. elif test -d "$file"; then
  8535. exit_status=1
  8536. continue
  8537. elif test "$rmforce" = yes; then
  8538. continue
  8539. fi
  8540. rmfiles="$file"
  8541. case $name in
  8542. *.la)
  8543. # Possibly a libtool archive, so verify it.
  8544. if func_lalib_p "$file"; then
  8545. func_source $dir/$name
  8546. # Delete the libtool libraries and symlinks.
  8547. for n in $library_names; do
  8548. func_append rmfiles " $odir/$n"
  8549. done
  8550. test -n "$old_library" && func_append rmfiles " $odir/$old_library"
  8551. case "$opt_mode" in
  8552. clean)
  8553. case " $library_names " in
  8554. *" $dlname "*) ;;
  8555. *) test -n "$dlname" && func_append rmfiles " $odir/$dlname" ;;
  8556. esac
  8557. test -n "$libdir" && func_append rmfiles " $odir/$name $odir/${name}i"
  8558. ;;
  8559. uninstall)
  8560. if test -n "$library_names"; then
  8561. # Do each command in the postuninstall commands.
  8562. func_execute_cmds "$postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
  8563. fi
  8564. if test -n "$old_library"; then
  8565. # Do each command in the old_postuninstall commands.
  8566. func_execute_cmds "$old_postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
  8567. fi
  8568. # FIXME: should reinstall the best remaining shared library.
  8569. ;;
  8570. esac
  8571. fi
  8572. ;;
  8573. *.lo)
  8574. # Possibly a libtool object, so verify it.
  8575. if func_lalib_p "$file"; then
  8576. # Read the .lo file
  8577. func_source $dir/$name
  8578. # Add PIC object to the list of files to remove.
  8579. if test -n "$pic_object" &&
  8580. test "$pic_object" != none; then
  8581. func_append rmfiles " $dir/$pic_object"
  8582. fi
  8583. # Add non-PIC object to the list of files to remove.
  8584. if test -n "$non_pic_object" &&
  8585. test "$non_pic_object" != none; then
  8586. func_append rmfiles " $dir/$non_pic_object"
  8587. fi
  8588. fi
  8589. ;;
  8590. *)
  8591. if test "$opt_mode" = clean ; then
  8592. noexename=$name
  8593. case $file in
  8594. *.exe)
  8595. func_stripname '' '.exe' "$file"
  8596. file=$func_stripname_result
  8597. func_stripname '' '.exe' "$name"
  8598. noexename=$func_stripname_result
  8599. # $file with .exe has already been added to rmfiles,
  8600. # add $file without .exe
  8601. func_append rmfiles " $file"
  8602. ;;
  8603. esac
  8604. # Do a test to see if this is a libtool program.
  8605. if func_ltwrapper_p "$file"; then
  8606. if func_ltwrapper_executable_p "$file"; then
  8607. func_ltwrapper_scriptname "$file"
  8608. relink_command=
  8609. func_source $func_ltwrapper_scriptname_result
  8610. func_append rmfiles " $func_ltwrapper_scriptname_result"
  8611. else
  8612. relink_command=
  8613. func_source $dir/$noexename
  8614. fi
  8615. # note $name still contains .exe if it was in $file originally
  8616. # as does the version of $file that was added into $rmfiles
  8617. func_append rmfiles " $odir/$name $odir/${name}S.${objext}"
  8618. if test "$fast_install" = yes && test -n "$relink_command"; then
  8619. func_append rmfiles " $odir/lt-$name"
  8620. fi
  8621. if test "X$noexename" != "X$name" ; then
  8622. func_append rmfiles " $odir/lt-${noexename}.c"
  8623. fi
  8624. fi
  8625. fi
  8626. ;;
  8627. esac
  8628. func_show_eval "$RM $rmfiles" 'exit_status=1'
  8629. done
  8630. # Try to remove the ${objdir}s in the directories where we deleted files
  8631. for dir in $rmdirs; do
  8632. if test -d "$dir"; then
  8633. func_show_eval "rmdir $dir >/dev/null 2>&1"
  8634. fi
  8635. done
  8636. exit $exit_status
  8637. }
  8638. { test "$opt_mode" = uninstall || test "$opt_mode" = clean; } &&
  8639. func_mode_uninstall ${1+"$@"}
  8640. test -z "$opt_mode" && {
  8641. help="$generic_help"
  8642. func_fatal_help "you must specify a MODE"
  8643. }
  8644. test -z "$exec_cmd" && \
  8645. func_fatal_help "invalid operation mode \`$opt_mode'"
  8646. if test -n "$exec_cmd"; then
  8647. eval exec "$exec_cmd"
  8648. exit $EXIT_FAILURE
  8649. fi
  8650. exit $exit_status
  8651. # The TAGs below are defined such that we never get into a situation
  8652. # in which we disable both kinds of libraries. Given conflicting
  8653. # choices, we go for a static library, that is the most portable,
  8654. # since we can't tell whether shared libraries were disabled because
  8655. # the user asked for that or because the platform doesn't support
  8656. # them. This is particularly important on AIX, because we don't
  8657. # support having both static and shared libraries enabled at the same
  8658. # time on that platform, so we default to a shared-only configuration.
  8659. # If a disable-shared tag is given, we'll fallback to a static-only
  8660. # configuration. But we'll never go from static-only to shared-only.
  8661. # ### BEGIN LIBTOOL TAG CONFIG: disable-shared
  8662. build_libtool_libs=no
  8663. build_old_libs=yes
  8664. # ### END LIBTOOL TAG CONFIG: disable-shared
  8665. # ### BEGIN LIBTOOL TAG CONFIG: disable-static
  8666. build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
  8667. # ### END LIBTOOL TAG CONFIG: disable-static
  8668. # Local Variables:
  8669. # mode:shell-script
  8670. # sh-indentation:2
  8671. # End:
  8672. # vi:sw=2