ltmain.sh 198 KB

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