ltmain.sh 244 KB

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