ltmain.sh 220 KB

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