ltmain.sh 195 KB

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