ltmain.sh 176 KB

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