ltmain.sh 194 KB

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