ltmain.sh 196 KB

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