ltmain.sh 182 KB

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