ltmain.sh 241 KB

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