libtool 336 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752
  1. #! /bin/bash
  2. # Generated automatically by config.status (bluez) 5.62
  3. # NOTE: Changes made to this file will be lost: look at ltmain.sh.
  4. # Provide generalized library-building support services.
  5. # Written by Gordon Matzigkeit, 1996
  6. # Copyright (C) 2014 Free Software Foundation, Inc.
  7. # This is free software; see the source for copying conditions. There is NO
  8. # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  9. # GNU Libtool is free software; you can redistribute it and/or modify
  10. # it under the terms of the GNU General Public License as published by
  11. # the Free Software Foundation; either version 2 of of the License, or
  12. # (at your option) any later version.
  13. #
  14. # As a special exception to the GNU General Public License, if you
  15. # distribute this file as part of a program or library that is built
  16. # using GNU Libtool, you may include this file under the same
  17. # distribution terms that you use for the rest of that program.
  18. #
  19. # GNU Libtool is distributed in the hope that it will be useful, but
  20. # WITHOUT ANY WARRANTY; without even the implied warranty of
  21. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  22. # GNU General Public License for more details.
  23. #
  24. # You should have received a copy of the GNU General Public License
  25. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  26. # The names of the tagged configurations supported by this script.
  27. available_tags=''
  28. # Configured defaults for sys_lib_dlsearch_path munging.
  29. : ${LT_SYS_LIBRARY_PATH=""}
  30. # ### BEGIN LIBTOOL CONFIG
  31. # Whether or not to build static libraries.
  32. build_old_libs=no
  33. # Which release of libtool.m4 was used?
  34. macro_version=2.4.6
  35. macro_revision=2.4.6
  36. # Whether or not to build shared libraries.
  37. build_libtool_libs=yes
  38. # What type of objects to build.
  39. pic_mode=default
  40. # Whether or not to optimize for fast installation.
  41. fast_install=yes
  42. # Shared archive member basename,for filename based shared library versioning on AIX.
  43. shared_archive_member_spec=
  44. # Shell to use when invoking shell scripts.
  45. SHELL="/bin/bash"
  46. # An echo program that protects backslashes.
  47. ECHO="printf %s\\n"
  48. # The PATH separator for the build system.
  49. PATH_SEPARATOR=":"
  50. # The host system.
  51. host_alias=aarch64-buildroot-linux-gnu
  52. host=aarch64-buildroot-linux-gnu
  53. host_os=linux-gnu
  54. # The build system.
  55. build_alias=x86_64-pc-linux-gnu
  56. build=x86_64-pc-linux-gnu
  57. build_os=linux-gnu
  58. # A sed program that does not truncate output.
  59. SED="/usr/bin/sed"
  60. # Sed that helps us avoid accidentally triggering echo(1) options like -n.
  61. Xsed="$SED -e 1s/^X//"
  62. # A grep program that handles long lines.
  63. GREP="/usr/bin/grep"
  64. # An ERE matcher.
  65. EGREP="/usr/bin/grep -E"
  66. # A literal string matcher.
  67. FGREP="/usr/bin/grep -F"
  68. # A BSD- or MS-compatible name lister.
  69. NM="/media/seagate_500G/rk3308_linux5.10/buildroot/output/rockchip_rk3308_b_release/host/bin/aarch64-buildroot-linux-gnu-nm"
  70. # Whether we need soft or hard links.
  71. LN_S="ln -s"
  72. # What is the maximum length of a command?
  73. max_cmd_len=1572864
  74. # Object file suffix (normally "o").
  75. objext=o
  76. # Executable file suffix (normally "").
  77. exeext=
  78. # whether the shell understands "unset".
  79. lt_unset=unset
  80. # turn spaces into newlines.
  81. SP2NL="tr \\040 \\012"
  82. # turn newlines into spaces.
  83. NL2SP="tr \\015\\012 \\040\\040"
  84. # convert $build file names to $host format.
  85. to_host_file_cmd=func_convert_file_noop
  86. # convert $build files to toolchain format.
  87. to_tool_file_cmd=func_convert_file_noop
  88. # An object symbol dumper.
  89. OBJDUMP="/media/seagate_500G/rk3308_linux5.10/buildroot/output/rockchip_rk3308_b_release/host/bin/aarch64-buildroot-linux-gnu-objdump"
  90. # Method to check whether dependent libraries are shared objects.
  91. deplibs_check_method="pass_all"
  92. # Command to use when deplibs_check_method = "file_magic".
  93. file_magic_cmd="\$MAGIC_CMD"
  94. # How to find potential files when deplibs_check_method = "file_magic".
  95. file_magic_glob=""
  96. # Find potential files using nocaseglob when deplibs_check_method = "file_magic".
  97. want_nocaseglob="no"
  98. # DLL creation program.
  99. DLLTOOL="false"
  100. # Command to associate shared and link libraries.
  101. sharedlib_from_linklib_cmd="printf %s\\n"
  102. # The archiver.
  103. AR="/media/seagate_500G/rk3308_linux5.10/buildroot/output/rockchip_rk3308_b_release/host/bin/aarch64-buildroot-linux-gnu-ar"
  104. # Flags to create an archive.
  105. AR_FLAGS="cr"
  106. # How to feed a file listing to the archiver.
  107. archiver_list_spec="@"
  108. # A symbol stripping program.
  109. STRIP="/media/seagate_500G/rk3308_linux5.10/buildroot/output/rockchip_rk3308_b_release/host/bin/aarch64-buildroot-linux-gnu-strip"
  110. # Commands used to install an old-style archive.
  111. RANLIB="/media/seagate_500G/rk3308_linux5.10/buildroot/output/rockchip_rk3308_b_release/host/bin/aarch64-buildroot-linux-gnu-ranlib"
  112. old_postinstall_cmds="chmod 644 \$oldlib~\$RANLIB \$tool_oldlib"
  113. old_postuninstall_cmds=""
  114. # Whether to use a lock for old archive extraction.
  115. lock_old_archive_extraction=no
  116. # A C compiler.
  117. LTCC="/media/seagate_500G/rk3308_linux5.10/buildroot/output/rockchip_rk3308_b_release/host/bin/aarch64-buildroot-linux-gnu-gcc"
  118. # LTCC compiler flags.
  119. LTCFLAGS="-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -Os -g0 -D_FORTIFY_SOURCE=1"
  120. # Take the output of nm and produce a listing of raw symbols and C names.
  121. global_symbol_pipe="sed -n -e 's/^.*[ ]\\([ABCDGIRSTW][ABCDGIRSTW]*\\)[ ][ ]*\\([_A-Za-z][_A-Za-z0-9]*\\)\$/\\1 \\2 \\2/p' | sed '/ __gnu_lto/d'"
  122. # Transform the output of nm in a proper C declaration.
  123. global_symbol_to_cdecl="sed -n -e 's/^T .* \\(.*\\)\$/extern int \\1();/p' -e 's/^[ABCDGIRSTW][ABCDGIRSTW]* .* \\(.*\\)\$/extern char \\1;/p'"
  124. # Transform the output of nm into a list of symbols to manually relocate.
  125. global_symbol_to_import=""
  126. # Transform the output of nm in a C name address pair.
  127. global_symbol_to_c_name_address="sed -n -e 's/^: \\(.*\\) .*\$/ {\"\\1\", (void *) 0},/p' -e 's/^[ABCDGIRSTW][ABCDGIRSTW]* .* \\(.*\\)\$/ {\"\\1\", (void *) \\&\\1},/p'"
  128. # Transform the output of nm in a C name address pair when lib prefix is needed.
  129. global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \\(.*\\) .*\$/ {\"\\1\", (void *) 0},/p' -e 's/^[ABCDGIRSTW][ABCDGIRSTW]* .* \\(lib.*\\)\$/ {\"\\1\", (void *) \\&\\1},/p' -e 's/^[ABCDGIRSTW][ABCDGIRSTW]* .* \\(.*\\)\$/ {\"lib\\1\", (void *) \\&\\1},/p'"
  130. # The name lister interface.
  131. nm_interface="BSD nm"
  132. # Specify filename containing input files for $NM.
  133. nm_file_list_spec="@"
  134. # The root where to search for dependent libraries,and where our libraries should be installed.
  135. lt_sysroot=
  136. # Command to truncate a binary pipe.
  137. lt_truncate_bin="/usr/bin/dd bs=4096 count=1"
  138. # The name of the directory that contains temporary libtool files.
  139. objdir=.libs
  140. # Used to examine libraries when file_magic_cmd begins with "file".
  141. MAGIC_CMD=file
  142. # Must we lock files when doing compilation?
  143. need_locks="no"
  144. # Manifest tool.
  145. MANIFEST_TOOL=":"
  146. # Tool to manipulate archived DWARF debug symbol files on Mac OS X.
  147. DSYMUTIL=""
  148. # Tool to change global to local symbols on Mac OS X.
  149. NMEDIT=""
  150. # Tool to manipulate fat objects and archives on Mac OS X.
  151. LIPO=""
  152. # ldd/readelf like tool for Mach-O binaries on Mac OS X.
  153. OTOOL=""
  154. # ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4.
  155. OTOOL64=""
  156. # Old archive suffix (normally "a").
  157. libext=a
  158. # Shared library suffix (normally ".so").
  159. shrext_cmds=".so"
  160. # The commands to extract the exported symbol list from a shared archive.
  161. extract_expsyms_cmds=""
  162. # Variables whose values should be saved in libtool wrapper scripts and
  163. # restored at link time.
  164. variables_saved_for_relink="PATH LD_LIBRARY_PATH LD_RUN_PATH GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
  165. # Do we need the "lib" prefix for modules?
  166. need_lib_prefix=no
  167. # Do we need a version for libraries?
  168. need_version=no
  169. # Library versioning type.
  170. version_type=linux
  171. # Shared library runtime path variable.
  172. runpath_var=LD_RUN_PATH
  173. # Shared library path variable.
  174. shlibpath_var=LD_LIBRARY_PATH
  175. # Is shlibpath searched before the hard-coded library search path?
  176. shlibpath_overrides_runpath=no
  177. # Format of library name prefix.
  178. libname_spec="lib\$name"
  179. # List of archive names. First name is the real one, the rest are links.
  180. # The last name is the one that the linker finds with -lNAME
  181. library_names_spec="\$libname\$release\$shared_ext\$versuffix \$libname\$release\$shared_ext\$major \$libname\$shared_ext"
  182. # The coded name of the library, if different from the real name.
  183. soname_spec="\$libname\$release\$shared_ext\$major"
  184. # Permission mode override for installation of shared libraries.
  185. install_override_mode=""
  186. # Command to use after installation of a shared archive.
  187. postinstall_cmds=""
  188. # Command to use after uninstallation of a shared archive.
  189. postuninstall_cmds=""
  190. # Commands used to finish a libtool library installation in a directory.
  191. finish_cmds="PATH=\\\"\\\$PATH:/sbin\\\" ldconfig -n \$libdir"
  192. # As "finish_cmds", except a single script fragment to be evaled but
  193. # not shown.
  194. finish_eval=""
  195. # Whether we should hardcode library paths into libraries.
  196. hardcode_into_libs=yes
  197. # Compile-time system search path for libraries.
  198. sys_lib_search_path_spec=""
  199. # Detected run-time system search path for libraries.
  200. sys_lib_dlsearch_path_spec="/lib /usr/lib /usr/lib/x86_64-linux-gnu/libfakeroot /usr/local/lib/i386-linux-gnu /lib/i386-linux-gnu /usr/lib/i386-linux-gnu /usr/local/lib/i686-linux-gnu /lib/i686-linux-gnu /usr/lib/i686-linux-gnu /usr/local/lib /usr/local/lib/x86_64-linux-gnu /lib/x86_64-linux-gnu /usr/lib/x86_64-linux-gnu /lib32 /usr/lib32 /libx32 /usr/libx32 "
  201. # Explicit LT_SYS_LIBRARY_PATH set during ./configure time.
  202. configure_time_lt_sys_library_path=""
  203. # Whether dlopen is supported.
  204. dlopen_support=unknown
  205. # Whether dlopen of programs is supported.
  206. dlopen_self=unknown
  207. # Whether dlopen of statically linked programs is supported.
  208. dlopen_self_static=unknown
  209. # Commands to strip libraries.
  210. old_striplib="/media/seagate_500G/rk3308_linux5.10/buildroot/output/rockchip_rk3308_b_release/host/bin/aarch64-buildroot-linux-gnu-strip --strip-debug"
  211. striplib="/media/seagate_500G/rk3308_linux5.10/buildroot/output/rockchip_rk3308_b_release/host/bin/aarch64-buildroot-linux-gnu-strip --strip-unneeded"
  212. # The linker used to build libraries.
  213. LD="/media/seagate_500G/rk3308_linux5.10/buildroot/output/rockchip_rk3308_b_release/host/bin/aarch64-buildroot-linux-gnu-ld"
  214. # How to create reloadable object files.
  215. reload_flag=" -r"
  216. reload_cmds="\$LD\$reload_flag -o \$output\$reload_objs"
  217. # Commands used to build an old-style archive.
  218. old_archive_cmds="\$AR \$AR_FLAGS \$oldlib\$oldobjs~\$RANLIB \$tool_oldlib"
  219. # A language specific compiler.
  220. CC="/media/seagate_500G/rk3308_linux5.10/buildroot/output/rockchip_rk3308_b_release/host/bin/aarch64-buildroot-linux-gnu-gcc"
  221. # Is the compiler the GNU compiler?
  222. with_gcc=yes
  223. # Compiler flag to turn off builtin functions.
  224. no_builtin_flag=" -fno-builtin"
  225. # Additional compiler flags for building library objects.
  226. pic_flag=" -fPIC -DPIC"
  227. # How to pass a linker flag through the compiler.
  228. wl="-Wl,"
  229. # Compiler flag to prevent dynamic linking.
  230. link_static_flag="-static"
  231. # Does compiler simultaneously support -c and -o options?
  232. compiler_c_o="yes"
  233. # Whether or not to add -lc for building shared libraries.
  234. build_libtool_need_lc=no
  235. # Whether or not to disallow shared libs when runtime libs are static.
  236. allow_libtool_libs_with_static_runtimes=no
  237. # Compiler flag to allow reflexive dlopens.
  238. export_dynamic_flag_spec="\$wl--export-dynamic"
  239. # Compiler flag to generate shared objects directly from archives.
  240. whole_archive_flag_spec="\$wl--whole-archive\$convenience \$wl--no-whole-archive"
  241. # Whether the compiler copes with passing no objects directly.
  242. compiler_needs_object="no"
  243. # Create an old-style archive from a shared archive.
  244. old_archive_from_new_cmds=""
  245. # Create a temporary old-style archive to link instead of a shared archive.
  246. old_archive_from_expsyms_cmds=""
  247. # Commands used to build a shared archive.
  248. archive_cmds="\$CC -shared \$pic_flag \$libobjs \$deplibs \$compiler_flags \$wl-soname \$wl\$soname -o \$lib"
  249. archive_expsym_cmds="echo \\\"{ global:\\\" > \$output_objdir/\$libname.ver~
  250. cat \$export_symbols | sed -e \\\"s/\\\\(.*\\\\)/\\\\1;/\\\" >> \$output_objdir/\$libname.ver~
  251. echo \\\"local: *; };\\\" >> \$output_objdir/\$libname.ver~
  252. \$CC -shared \$pic_flag \$libobjs \$deplibs \$compiler_flags \$wl-soname \$wl\$soname \$wl-version-script \$wl\$output_objdir/\$libname.ver -o \$lib"
  253. # Commands used to build a loadable module if different from building
  254. # a shared archive.
  255. module_cmds=""
  256. module_expsym_cmds=""
  257. # Whether we are building with GNU ld or not.
  258. with_gnu_ld="yes"
  259. # Flag that allows shared libraries with undefined symbols to be built.
  260. allow_undefined_flag=""
  261. # Flag that enforces no undefined symbols.
  262. no_undefined_flag=""
  263. # Flag to hardcode $libdir into a binary during linking.
  264. # This must work even if $libdir does not exist
  265. hardcode_libdir_flag_spec="\$wl-rpath \$wl\$libdir"
  266. # Whether we need a single "-rpath" flag with a separated argument.
  267. hardcode_libdir_separator=""
  268. # Set to "yes" if using DIR/libNAME$shared_ext during linking hardcodes
  269. # DIR into the resulting binary.
  270. hardcode_direct=no
  271. # Set to "yes" if using DIR/libNAME$shared_ext during linking hardcodes
  272. # DIR into the resulting binary and the resulting library dependency is
  273. # "absolute",i.e impossible to change by setting $shlibpath_var if the
  274. # library is relocated.
  275. hardcode_direct_absolute=no
  276. # Set to "yes" if using the -LDIR flag during linking hardcodes DIR
  277. # into the resulting binary.
  278. hardcode_minus_L=no
  279. # Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR
  280. # into the resulting binary.
  281. hardcode_shlibpath_var=unsupported
  282. # Set to "yes" if building a shared library automatically hardcodes DIR
  283. # into the library and all subsequent libraries and executables linked
  284. # against it.
  285. hardcode_automatic=no
  286. # Set to yes if linker adds runtime paths of dependent libraries
  287. # to runtime path list.
  288. inherit_rpath=no
  289. # Whether libtool must link a program against all its dependency libraries.
  290. link_all_deplibs=no
  291. # Set to "yes" if exported symbols are required.
  292. always_export_symbols=no
  293. # The commands to list exported symbols.
  294. export_symbols_cmds="\$NM \$libobjs \$convenience | \$global_symbol_pipe | \$SED 's/.* //' | sort | uniq > \$export_symbols"
  295. # Symbols that should not be listed in the preloaded symbols.
  296. exclude_expsyms="_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*"
  297. # Symbols that must always be exported.
  298. include_expsyms=""
  299. # Commands necessary for linking programs (against libraries) with templates.
  300. prelink_cmds=""
  301. # Commands necessary for finishing linking programs.
  302. postlink_cmds=""
  303. # Specify filename containing input files.
  304. file_list_spec=""
  305. # How to hardcode a shared library path into an executable.
  306. hardcode_action=immediate
  307. # ### END LIBTOOL CONFIG
  308. # ### BEGIN FUNCTIONS SHARED WITH CONFIGURE
  309. # func_munge_path_list VARIABLE PATH
  310. # -----------------------------------
  311. # VARIABLE is name of variable containing _space_ separated list of
  312. # directories to be munged by the contents of PATH, which is string
  313. # having a format:
  314. # "DIR[:DIR]:"
  315. # string "DIR[ DIR]" will be prepended to VARIABLE
  316. # ":DIR[:DIR]"
  317. # string "DIR[ DIR]" will be appended to VARIABLE
  318. # "DIRP[:DIRP]::[DIRA:]DIRA"
  319. # string "DIRP[ DIRP]" will be prepended to VARIABLE and string
  320. # "DIRA[ DIRA]" will be appended to VARIABLE
  321. # "DIR[:DIR]"
  322. # VARIABLE will be replaced by "DIR[ DIR]"
  323. func_munge_path_list ()
  324. {
  325. case x$2 in
  326. x)
  327. ;;
  328. *:)
  329. eval $1=\"`$ECHO $2 | $SED 's/:/ /g'` \$$1\"
  330. ;;
  331. x:*)
  332. eval $1=\"\$$1 `$ECHO $2 | $SED 's/:/ /g'`\"
  333. ;;
  334. *::*)
  335. eval $1=\"\$$1\ `$ECHO $2 | $SED -e 's/.*:://' -e 's/:/ /g'`\"
  336. eval $1=\"`$ECHO $2 | $SED -e 's/::.*//' -e 's/:/ /g'`\ \$$1\"
  337. ;;
  338. *)
  339. eval $1=\"`$ECHO $2 | $SED 's/:/ /g'`\"
  340. ;;
  341. esac
  342. }
  343. # Calculate cc_basename. Skip known compiler wrappers and cross-prefix.
  344. func_cc_basename ()
  345. {
  346. for cc_temp in $*""; do
  347. case $cc_temp in
  348. compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
  349. distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
  350. \-*) ;;
  351. *) break;;
  352. esac
  353. done
  354. func_cc_basename_result=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"`
  355. }
  356. # ### END FUNCTIONS SHARED WITH CONFIGURE
  357. #! /bin/sh
  358. ## DO NOT EDIT - This file generated from ./build-aux/ltmain.in
  359. ## by inline-source v2014-01-03.01
  360. # libtool (GNU libtool) 2.4.6
  361. # Provide generalized library-building support services.
  362. # Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
  363. # Copyright (C) 1996-2015 Free Software Foundation, Inc.
  364. # This is free software; see the source for copying conditions. There is NO
  365. # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  366. # GNU Libtool is free software; you can redistribute it and/or modify
  367. # it under the terms of the GNU General Public License as published by
  368. # the Free Software Foundation; either version 2 of the License, or
  369. # (at your option) any later version.
  370. #
  371. # As a special exception to the GNU General Public License,
  372. # if you distribute this file as part of a program or library that
  373. # is built using GNU Libtool, you may include this file under the
  374. # same distribution terms that you use for the rest of that program.
  375. #
  376. # GNU Libtool is distributed in the hope that it will be useful, but
  377. # WITHOUT ANY WARRANTY; without even the implied warranty of
  378. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  379. # General Public License for more details.
  380. #
  381. # You should have received a copy of the GNU General Public License
  382. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  383. PROGRAM=libtool
  384. PACKAGE=libtool
  385. VERSION="2.4.6 Debian-2.4.6-15"
  386. package_revision=2.4.6
  387. ## ------ ##
  388. ## Usage. ##
  389. ## ------ ##
  390. # Run './libtool --help' for help with using this script from the
  391. # command line.
  392. ## ------------------------------- ##
  393. ## User overridable command paths. ##
  394. ## ------------------------------- ##
  395. # After configure completes, it has a better idea of some of the
  396. # shell tools we need than the defaults used by the functions shared
  397. # with bootstrap, so set those here where they can still be over-
  398. # ridden by the user, but otherwise take precedence.
  399. : ${AUTOCONF="autoconf"}
  400. : ${AUTOMAKE="automake"}
  401. ## -------------------------- ##
  402. ## Source external libraries. ##
  403. ## -------------------------- ##
  404. # Much of our low-level functionality needs to be sourced from external
  405. # libraries, which are installed to $pkgauxdir.
  406. # Set a version string for this script.
  407. scriptversion=2015-01-20.17; # UTC
  408. # General shell script boiler plate, and helper functions.
  409. # Written by Gary V. Vaughan, 2004
  410. # Copyright (C) 2004-2015 Free Software Foundation, Inc.
  411. # This is free software; see the source for copying conditions. There is NO
  412. # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  413. # This program is free software; you can redistribute it and/or modify
  414. # it under the terms of the GNU General Public License as published by
  415. # the Free Software Foundation; either version 3 of the License, or
  416. # (at your option) any later version.
  417. # As a special exception to the GNU General Public License, if you distribute
  418. # this file as part of a program or library that is built using GNU Libtool,
  419. # you may include this file under the same distribution terms that you use
  420. # for the rest of that program.
  421. # This program is distributed in the hope that it will be useful,
  422. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  423. # MERCHANTABILITY or FITNES FOR A PARTICULAR PURPOSE. See the GNU
  424. # General Public License for more details.
  425. # You should have received a copy of the GNU General Public License
  426. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  427. # Please report bugs or propose patches to gary@gnu.org.
  428. ## ------ ##
  429. ## Usage. ##
  430. ## ------ ##
  431. # Evaluate this file near the top of your script to gain access to
  432. # the functions and variables defined here:
  433. #
  434. # . `echo "$0" | ${SED-sed} 's|[^/]*$||'`/build-aux/funclib.sh
  435. #
  436. # If you need to override any of the default environment variable
  437. # settings, do that before evaluating this file.
  438. ## -------------------- ##
  439. ## Shell normalisation. ##
  440. ## -------------------- ##
  441. # Some shells need a little help to be as Bourne compatible as possible.
  442. # Before doing anything else, make sure all that help has been provided!
  443. DUALCASE=1; export DUALCASE # for MKS sh
  444. if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then :
  445. emulate sh
  446. NULLCMD=:
  447. # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
  448. # is contrary to our usage. Disable this feature.
  449. alias -g '${1+"$@"}'='"$@"'
  450. setopt NO_GLOB_SUBST
  451. else
  452. case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac
  453. fi
  454. # NLS nuisances: We save the old values in case they are required later.
  455. _G_user_locale=
  456. _G_safe_locale=
  457. for _G_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
  458. do
  459. eval "if test set = \"\${$_G_var+set}\"; then
  460. save_$_G_var=\$$_G_var
  461. $_G_var=C
  462. export $_G_var
  463. _G_user_locale=\"$_G_var=\\\$save_\$_G_var; \$_G_user_locale\"
  464. _G_safe_locale=\"$_G_var=C; \$_G_safe_locale\"
  465. fi"
  466. done
  467. # CDPATH.
  468. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
  469. # Make sure IFS has a sensible default
  470. sp=' '
  471. nl='
  472. '
  473. IFS="$sp $nl"
  474. # There are apparently some retarded systems that use ';' as a PATH separator!
  475. if test "${PATH_SEPARATOR+set}" != set; then
  476. PATH_SEPARATOR=:
  477. (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
  478. (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
  479. PATH_SEPARATOR=';'
  480. }
  481. fi
  482. ## ------------------------- ##
  483. ## Locate command utilities. ##
  484. ## ------------------------- ##
  485. # func_executable_p FILE
  486. # ----------------------
  487. # Check that FILE is an executable regular file.
  488. func_executable_p ()
  489. {
  490. test -f "$1" && test -x "$1"
  491. }
  492. # func_path_progs PROGS_LIST CHECK_FUNC [PATH]
  493. # --------------------------------------------
  494. # Search for either a program that responds to --version with output
  495. # containing "GNU", or else returned by CHECK_FUNC otherwise, by
  496. # trying all the directories in PATH with each of the elements of
  497. # PROGS_LIST.
  498. #
  499. # CHECK_FUNC should accept the path to a candidate program, and
  500. # set $func_check_prog_result if it truncates its output less than
  501. # $_G_path_prog_max characters.
  502. func_path_progs ()
  503. {
  504. _G_progs_list=$1
  505. _G_check_func=$2
  506. _G_PATH=${3-"$PATH"}
  507. _G_path_prog_max=0
  508. _G_path_prog_found=false
  509. _G_save_IFS=$IFS; IFS=${PATH_SEPARATOR-:}
  510. for _G_dir in $_G_PATH; do
  511. IFS=$_G_save_IFS
  512. test -z "$_G_dir" && _G_dir=.
  513. for _G_prog_name in $_G_progs_list; do
  514. for _exeext in '' .EXE; do
  515. _G_path_prog=$_G_dir/$_G_prog_name$_exeext
  516. func_executable_p "$_G_path_prog" || continue
  517. case `"$_G_path_prog" --version 2>&1` in
  518. *GNU*) func_path_progs_result=$_G_path_prog _G_path_prog_found=: ;;
  519. *) $_G_check_func $_G_path_prog
  520. func_path_progs_result=$func_check_prog_result
  521. ;;
  522. esac
  523. $_G_path_prog_found && break 3
  524. done
  525. done
  526. done
  527. IFS=$_G_save_IFS
  528. test -z "$func_path_progs_result" && {
  529. echo "no acceptable sed could be found in \$PATH" >&2
  530. exit 1
  531. }
  532. }
  533. # We want to be able to use the functions in this file before configure
  534. # has figured out where the best binaries are kept, which means we have
  535. # to search for them ourselves - except when the results are already set
  536. # where we skip the searches.
  537. # Unless the user overrides by setting SED, search the path for either GNU
  538. # sed, or the sed that truncates its output the least.
  539. test -z "$SED" && {
  540. _G_sed_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/
  541. for _G_i in 1 2 3 4 5 6 7; do
  542. _G_sed_script=$_G_sed_script$nl$_G_sed_script
  543. done
  544. echo "$_G_sed_script" 2>/dev/null | sed 99q >conftest.sed
  545. _G_sed_script=
  546. func_check_prog_sed ()
  547. {
  548. _G_path_prog=$1
  549. _G_count=0
  550. printf 0123456789 >conftest.in
  551. while :
  552. do
  553. cat conftest.in conftest.in >conftest.tmp
  554. mv conftest.tmp conftest.in
  555. cp conftest.in conftest.nl
  556. echo '' >> conftest.nl
  557. "$_G_path_prog" -f conftest.sed <conftest.nl >conftest.out 2>/dev/null || break
  558. diff conftest.out conftest.nl >/dev/null 2>&1 || break
  559. _G_count=`expr $_G_count + 1`
  560. if test "$_G_count" -gt "$_G_path_prog_max"; then
  561. # Best one so far, save it but keep looking for a better one
  562. func_check_prog_result=$_G_path_prog
  563. _G_path_prog_max=$_G_count
  564. fi
  565. # 10*(2^10) chars as input seems more than enough
  566. test 10 -lt "$_G_count" && break
  567. done
  568. rm -f conftest.in conftest.tmp conftest.nl conftest.out
  569. }
  570. func_path_progs "sed gsed" func_check_prog_sed $PATH:/usr/xpg4/bin
  571. rm -f conftest.sed
  572. SED=$func_path_progs_result
  573. }
  574. # Unless the user overrides by setting GREP, search the path for either GNU
  575. # grep, or the grep that truncates its output the least.
  576. test -z "$GREP" && {
  577. func_check_prog_grep ()
  578. {
  579. _G_path_prog=$1
  580. _G_count=0
  581. _G_path_prog_max=0
  582. printf 0123456789 >conftest.in
  583. while :
  584. do
  585. cat conftest.in conftest.in >conftest.tmp
  586. mv conftest.tmp conftest.in
  587. cp conftest.in conftest.nl
  588. echo 'GREP' >> conftest.nl
  589. "$_G_path_prog" -e 'GREP$' -e '-(cannot match)-' <conftest.nl >conftest.out 2>/dev/null || break
  590. diff conftest.out conftest.nl >/dev/null 2>&1 || break
  591. _G_count=`expr $_G_count + 1`
  592. if test "$_G_count" -gt "$_G_path_prog_max"; then
  593. # Best one so far, save it but keep looking for a better one
  594. func_check_prog_result=$_G_path_prog
  595. _G_path_prog_max=$_G_count
  596. fi
  597. # 10*(2^10) chars as input seems more than enough
  598. test 10 -lt "$_G_count" && break
  599. done
  600. rm -f conftest.in conftest.tmp conftest.nl conftest.out
  601. }
  602. func_path_progs "grep ggrep" func_check_prog_grep $PATH:/usr/xpg4/bin
  603. GREP=$func_path_progs_result
  604. }
  605. ## ------------------------------- ##
  606. ## User overridable command paths. ##
  607. ## ------------------------------- ##
  608. # All uppercase variable names are used for environment variables. These
  609. # variables can be overridden by the user before calling a script that
  610. # uses them if a suitable command of that name is not already available
  611. # in the command search PATH.
  612. : ${CP="cp -f"}
  613. : ${ECHO="printf %s\n"}
  614. : ${EGREP="$GREP -E"}
  615. : ${FGREP="$GREP -F"}
  616. : ${LN_S="ln -s"}
  617. : ${MAKE="make"}
  618. : ${MKDIR="mkdir"}
  619. : ${MV="mv -f"}
  620. : ${RM="rm -f"}
  621. : ${SHELL="${CONFIG_SHELL-/bin/sh}"}
  622. ## -------------------- ##
  623. ## Useful sed snippets. ##
  624. ## -------------------- ##
  625. sed_dirname='s|/[^/]*$||'
  626. sed_basename='s|^.*/||'
  627. # Sed substitution that helps us do robust quoting. It backslashifies
  628. # metacharacters that are still active within double-quoted strings.
  629. sed_quote_subst='s|\([`"$\\]\)|\\\1|g'
  630. # Same as above, but do not quote variable references.
  631. sed_double_quote_subst='s/\(["`\\]\)/\\\1/g'
  632. # Sed substitution that turns a string into a regex matching for the
  633. # string literally.
  634. sed_make_literal_regex='s|[].[^$\\*\/]|\\&|g'
  635. # Sed substitution that converts a w32 file name or path
  636. # that contains forward slashes, into one that contains
  637. # (escaped) backslashes. A very naive implementation.
  638. sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
  639. # Re-'\' parameter expansions in output of sed_double_quote_subst that
  640. # were '\'-ed in input to the same. If an odd number of '\' preceded a
  641. # '$' in input to sed_double_quote_subst, that '$' was protected from
  642. # expansion. Since each input '\' is now two '\'s, look for any number
  643. # of runs of four '\'s followed by two '\'s and then a '$'. '\' that '$'.
  644. _G_bs='\\'
  645. _G_bs2='\\\\'
  646. _G_bs4='\\\\\\\\'
  647. _G_dollar='\$'
  648. sed_double_backslash="\
  649. s/$_G_bs4/&\\
  650. /g
  651. s/^$_G_bs2$_G_dollar/$_G_bs&/
  652. s/\\([^$_G_bs]\\)$_G_bs2$_G_dollar/\\1$_G_bs2$_G_bs$_G_dollar/g
  653. s/\n//g"
  654. ## ----------------- ##
  655. ## Global variables. ##
  656. ## ----------------- ##
  657. # Except for the global variables explicitly listed below, the following
  658. # functions in the '^func_' namespace, and the '^require_' namespace
  659. # variables initialised in the 'Resource management' section, sourcing
  660. # this file will not pollute your global namespace with anything
  661. # else. There's no portable way to scope variables in Bourne shell
  662. # though, so actually running these functions will sometimes place
  663. # results into a variable named after the function, and often use
  664. # temporary variables in the '^_G_' namespace. If you are careful to
  665. # avoid using those namespaces casually in your sourcing script, things
  666. # should continue to work as you expect. And, of course, you can freely
  667. # overwrite any of the functions or variables defined here before
  668. # calling anything to customize them.
  669. EXIT_SUCCESS=0
  670. EXIT_FAILURE=1
  671. EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing.
  672. EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake.
  673. # Allow overriding, eg assuming that you follow the convention of
  674. # putting '$debug_cmd' at the start of all your functions, you can get
  675. # bash to show function call trace with:
  676. #
  677. # debug_cmd='echo "${FUNCNAME[0]} $*" >&2' bash your-script-name
  678. debug_cmd=${debug_cmd-":"}
  679. exit_cmd=:
  680. # By convention, finish your script with:
  681. #
  682. # exit $exit_status
  683. #
  684. # so that you can set exit_status to non-zero if you want to indicate
  685. # something went wrong during execution without actually bailing out at
  686. # the point of failure.
  687. exit_status=$EXIT_SUCCESS
  688. # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
  689. # is ksh but when the shell is invoked as "sh" and the current value of
  690. # the _XPG environment variable is not equal to 1 (one), the special
  691. # positional parameter $0, within a function call, is the name of the
  692. # function.
  693. progpath=$0
  694. # The name of this program.
  695. progname=`$ECHO "$progpath" |$SED "$sed_basename"`
  696. # Make sure we have an absolute progpath for reexecution:
  697. case $progpath in
  698. [\\/]*|[A-Za-z]:\\*) ;;
  699. *[\\/]*)
  700. progdir=`$ECHO "$progpath" |$SED "$sed_dirname"`
  701. progdir=`cd "$progdir" && pwd`
  702. progpath=$progdir/$progname
  703. ;;
  704. *)
  705. _G_IFS=$IFS
  706. IFS=${PATH_SEPARATOR-:}
  707. for progdir in $PATH; do
  708. IFS=$_G_IFS
  709. test -x "$progdir/$progname" && break
  710. done
  711. IFS=$_G_IFS
  712. test -n "$progdir" || progdir=`pwd`
  713. progpath=$progdir/$progname
  714. ;;
  715. esac
  716. ## ----------------- ##
  717. ## Standard options. ##
  718. ## ----------------- ##
  719. # The following options affect the operation of the functions defined
  720. # below, and should be set appropriately depending on run-time para-
  721. # meters passed on the command line.
  722. opt_dry_run=false
  723. opt_quiet=false
  724. opt_verbose=false
  725. # Categories 'all' and 'none' are always available. Append any others
  726. # you will pass as the first argument to func_warning from your own
  727. # code.
  728. warning_categories=
  729. # By default, display warnings according to 'opt_warning_types'. Set
  730. # 'warning_func' to ':' to elide all warnings, or func_fatal_error to
  731. # treat the next displayed warning as a fatal error.
  732. warning_func=func_warn_and_continue
  733. # Set to 'all' to display all warnings, 'none' to suppress all
  734. # warnings, or a space delimited list of some subset of
  735. # 'warning_categories' to display only the listed warnings.
  736. opt_warning_types=all
  737. ## -------------------- ##
  738. ## Resource management. ##
  739. ## -------------------- ##
  740. # This section contains definitions for functions that each ensure a
  741. # particular resource (a file, or a non-empty configuration variable for
  742. # example) is available, and if appropriate to extract default values
  743. # from pertinent package files. Call them using their associated
  744. # 'require_*' variable to ensure that they are executed, at most, once.
  745. #
  746. # It's entirely deliberate that calling these functions can set
  747. # variables that don't obey the namespace limitations obeyed by the rest
  748. # of this file, in order that that they be as useful as possible to
  749. # callers.
  750. # require_term_colors
  751. # -------------------
  752. # Allow display of bold text on terminals that support it.
  753. require_term_colors=func_require_term_colors
  754. func_require_term_colors ()
  755. {
  756. $debug_cmd
  757. test -t 1 && {
  758. # COLORTERM and USE_ANSI_COLORS environment variables take
  759. # precedence, because most terminfo databases neglect to describe
  760. # whether color sequences are supported.
  761. test -n "${COLORTERM+set}" && : ${USE_ANSI_COLORS="1"}
  762. if test 1 = "$USE_ANSI_COLORS"; then
  763. # Standard ANSI escape sequences
  764. tc_reset=''
  765. tc_bold=''; tc_standout=''
  766. tc_red=''; tc_green=''
  767. tc_blue=''; tc_cyan=''
  768. else
  769. # Otherwise trust the terminfo database after all.
  770. test -n "`tput sgr0 2>/dev/null`" && {
  771. tc_reset=`tput sgr0`
  772. test -n "`tput bold 2>/dev/null`" && tc_bold=`tput bold`
  773. tc_standout=$tc_bold
  774. test -n "`tput smso 2>/dev/null`" && tc_standout=`tput smso`
  775. test -n "`tput setaf 1 2>/dev/null`" && tc_red=`tput setaf 1`
  776. test -n "`tput setaf 2 2>/dev/null`" && tc_green=`tput setaf 2`
  777. test -n "`tput setaf 4 2>/dev/null`" && tc_blue=`tput setaf 4`
  778. test -n "`tput setaf 5 2>/dev/null`" && tc_cyan=`tput setaf 5`
  779. }
  780. fi
  781. }
  782. require_term_colors=:
  783. }
  784. ## ----------------- ##
  785. ## Function library. ##
  786. ## ----------------- ##
  787. # This section contains a variety of useful functions to call in your
  788. # scripts. Take note of the portable wrappers for features provided by
  789. # some modern shells, which will fall back to slower equivalents on
  790. # less featureful shells.
  791. # func_append VAR VALUE
  792. # ---------------------
  793. # Append VALUE onto the existing contents of VAR.
  794. # We should try to minimise forks, especially on Windows where they are
  795. # unreasonably slow, so skip the feature probes when bash or zsh are
  796. # being used:
  797. if test set = "${BASH_VERSION+set}${ZSH_VERSION+set}"; then
  798. : ${_G_HAVE_ARITH_OP="yes"}
  799. : ${_G_HAVE_XSI_OPS="yes"}
  800. # The += operator was introduced in bash 3.1
  801. case $BASH_VERSION in
  802. [12].* | 3.0 | 3.0*) ;;
  803. *)
  804. : ${_G_HAVE_PLUSEQ_OP="yes"}
  805. ;;
  806. esac
  807. fi
  808. # _G_HAVE_PLUSEQ_OP
  809. # Can be empty, in which case the shell is probed, "yes" if += is
  810. # useable or anything else if it does not work.
  811. test -z "$_G_HAVE_PLUSEQ_OP" \
  812. && (eval 'x=a; x+=" b"; test "a b" = "$x"') 2>/dev/null \
  813. && _G_HAVE_PLUSEQ_OP=yes
  814. if test yes = "$_G_HAVE_PLUSEQ_OP"
  815. then
  816. # This is an XSI compatible shell, allowing a faster implementation...
  817. eval 'func_append ()
  818. {
  819. $debug_cmd
  820. eval "$1+=\$2"
  821. }'
  822. else
  823. # ...otherwise fall back to using expr, which is often a shell builtin.
  824. func_append ()
  825. {
  826. $debug_cmd
  827. eval "$1=\$$1\$2"
  828. }
  829. fi
  830. # func_append_quoted VAR VALUE
  831. # ----------------------------
  832. # Quote VALUE and append to the end of shell variable VAR, separated
  833. # by a space.
  834. if test yes = "$_G_HAVE_PLUSEQ_OP"; then
  835. eval 'func_append_quoted ()
  836. {
  837. $debug_cmd
  838. func_quote_for_eval "$2"
  839. eval "$1+=\\ \$func_quote_for_eval_result"
  840. }'
  841. else
  842. func_append_quoted ()
  843. {
  844. $debug_cmd
  845. func_quote_for_eval "$2"
  846. eval "$1=\$$1\\ \$func_quote_for_eval_result"
  847. }
  848. fi
  849. # func_append_uniq VAR VALUE
  850. # --------------------------
  851. # Append unique VALUE onto the existing contents of VAR, assuming
  852. # entries are delimited by the first character of VALUE. For example:
  853. #
  854. # func_append_uniq options " --another-option option-argument"
  855. #
  856. # will only append to $options if " --another-option option-argument "
  857. # is not already present somewhere in $options already (note spaces at
  858. # each end implied by leading space in second argument).
  859. func_append_uniq ()
  860. {
  861. $debug_cmd
  862. eval _G_current_value='`$ECHO $'$1'`'
  863. _G_delim=`expr "$2" : '\(.\)'`
  864. case $_G_delim$_G_current_value$_G_delim in
  865. *"$2$_G_delim"*) ;;
  866. *) func_append "$@" ;;
  867. esac
  868. }
  869. # func_arith TERM...
  870. # ------------------
  871. # Set func_arith_result to the result of evaluating TERMs.
  872. test -z "$_G_HAVE_ARITH_OP" \
  873. && (eval 'test 2 = $(( 1 + 1 ))') 2>/dev/null \
  874. && _G_HAVE_ARITH_OP=yes
  875. if test yes = "$_G_HAVE_ARITH_OP"; then
  876. eval 'func_arith ()
  877. {
  878. $debug_cmd
  879. func_arith_result=$(( $* ))
  880. }'
  881. else
  882. func_arith ()
  883. {
  884. $debug_cmd
  885. func_arith_result=`expr "$@"`
  886. }
  887. fi
  888. # func_basename FILE
  889. # ------------------
  890. # Set func_basename_result to FILE with everything up to and including
  891. # the last / stripped.
  892. if test yes = "$_G_HAVE_XSI_OPS"; then
  893. # If this shell supports suffix pattern removal, then use it to avoid
  894. # forking. Hide the definitions single quotes in case the shell chokes
  895. # on unsupported syntax...
  896. _b='func_basename_result=${1##*/}'
  897. _d='case $1 in
  898. */*) func_dirname_result=${1%/*}$2 ;;
  899. * ) func_dirname_result=$3 ;;
  900. esac'
  901. else
  902. # ...otherwise fall back to using sed.
  903. _b='func_basename_result=`$ECHO "$1" |$SED "$sed_basename"`'
  904. _d='func_dirname_result=`$ECHO "$1" |$SED "$sed_dirname"`
  905. if test "X$func_dirname_result" = "X$1"; then
  906. func_dirname_result=$3
  907. else
  908. func_append func_dirname_result "$2"
  909. fi'
  910. fi
  911. eval 'func_basename ()
  912. {
  913. $debug_cmd
  914. '"$_b"'
  915. }'
  916. # func_dirname FILE APPEND NONDIR_REPLACEMENT
  917. # -------------------------------------------
  918. # Compute the dirname of FILE. If nonempty, add APPEND to the result,
  919. # otherwise set result to NONDIR_REPLACEMENT.
  920. eval 'func_dirname ()
  921. {
  922. $debug_cmd
  923. '"$_d"'
  924. }'
  925. # func_dirname_and_basename FILE APPEND NONDIR_REPLACEMENT
  926. # --------------------------------------------------------
  927. # Perform func_basename and func_dirname in a single function
  928. # call:
  929. # dirname: Compute the dirname of FILE. If nonempty,
  930. # add APPEND to the result, otherwise set result
  931. # to NONDIR_REPLACEMENT.
  932. # value returned in "$func_dirname_result"
  933. # basename: Compute filename of FILE.
  934. # value retuned in "$func_basename_result"
  935. # For efficiency, we do not delegate to the functions above but instead
  936. # duplicate the functionality here.
  937. eval 'func_dirname_and_basename ()
  938. {
  939. $debug_cmd
  940. '"$_b"'
  941. '"$_d"'
  942. }'
  943. # func_echo ARG...
  944. # ----------------
  945. # Echo program name prefixed message.
  946. func_echo ()
  947. {
  948. $debug_cmd
  949. _G_message=$*
  950. func_echo_IFS=$IFS
  951. IFS=$nl
  952. for _G_line in $_G_message; do
  953. IFS=$func_echo_IFS
  954. $ECHO "$progname: $_G_line"
  955. done
  956. IFS=$func_echo_IFS
  957. }
  958. # func_echo_all ARG...
  959. # --------------------
  960. # Invoke $ECHO with all args, space-separated.
  961. func_echo_all ()
  962. {
  963. $ECHO "$*"
  964. }
  965. # func_echo_infix_1 INFIX ARG...
  966. # ------------------------------
  967. # Echo program name, followed by INFIX on the first line, with any
  968. # additional lines not showing INFIX.
  969. func_echo_infix_1 ()
  970. {
  971. $debug_cmd
  972. $require_term_colors
  973. _G_infix=$1; shift
  974. _G_indent=$_G_infix
  975. _G_prefix="$progname: $_G_infix: "
  976. _G_message=$*
  977. # Strip color escape sequences before counting printable length
  978. for _G_tc in "$tc_reset" "$tc_bold" "$tc_standout" "$tc_red" "$tc_green" "$tc_blue" "$tc_cyan"
  979. do
  980. test -n "$_G_tc" && {
  981. _G_esc_tc=`$ECHO "$_G_tc" | $SED "$sed_make_literal_regex"`
  982. _G_indent=`$ECHO "$_G_indent" | $SED "s|$_G_esc_tc||g"`
  983. }
  984. done
  985. _G_indent="$progname: "`echo "$_G_indent" | $SED 's|.| |g'`" " ## exclude from sc_prohibit_nested_quotes
  986. func_echo_infix_1_IFS=$IFS
  987. IFS=$nl
  988. for _G_line in $_G_message; do
  989. IFS=$func_echo_infix_1_IFS
  990. $ECHO "$_G_prefix$tc_bold$_G_line$tc_reset" >&2
  991. _G_prefix=$_G_indent
  992. done
  993. IFS=$func_echo_infix_1_IFS
  994. }
  995. # func_error ARG...
  996. # -----------------
  997. # Echo program name prefixed message to standard error.
  998. func_error ()
  999. {
  1000. $debug_cmd
  1001. $require_term_colors
  1002. func_echo_infix_1 " $tc_standout${tc_red}error$tc_reset" "$*" >&2
  1003. }
  1004. # func_fatal_error ARG...
  1005. # -----------------------
  1006. # Echo program name prefixed message to standard error, and exit.
  1007. func_fatal_error ()
  1008. {
  1009. $debug_cmd
  1010. func_error "$*"
  1011. exit $EXIT_FAILURE
  1012. }
  1013. # func_grep EXPRESSION FILENAME
  1014. # -----------------------------
  1015. # Check whether EXPRESSION matches any line of FILENAME, without output.
  1016. func_grep ()
  1017. {
  1018. $debug_cmd
  1019. $GREP "$1" "$2" >/dev/null 2>&1
  1020. }
  1021. # func_len STRING
  1022. # ---------------
  1023. # Set func_len_result to the length of STRING. STRING may not
  1024. # start with a hyphen.
  1025. test -z "$_G_HAVE_XSI_OPS" \
  1026. && (eval 'x=a/b/c;
  1027. test 5aa/bb/cc = "${#x}${x%%/*}${x%/*}${x#*/}${x##*/}"') 2>/dev/null \
  1028. && _G_HAVE_XSI_OPS=yes
  1029. if test yes = "$_G_HAVE_XSI_OPS"; then
  1030. eval 'func_len ()
  1031. {
  1032. $debug_cmd
  1033. func_len_result=${#1}
  1034. }'
  1035. else
  1036. func_len ()
  1037. {
  1038. $debug_cmd
  1039. func_len_result=`expr "$1" : ".*" 2>/dev/null || echo $max_cmd_len`
  1040. }
  1041. fi
  1042. # func_mkdir_p DIRECTORY-PATH
  1043. # ---------------------------
  1044. # Make sure the entire path to DIRECTORY-PATH is available.
  1045. func_mkdir_p ()
  1046. {
  1047. $debug_cmd
  1048. _G_directory_path=$1
  1049. _G_dir_list=
  1050. if test -n "$_G_directory_path" && test : != "$opt_dry_run"; then
  1051. # Protect directory names starting with '-'
  1052. case $_G_directory_path in
  1053. -*) _G_directory_path=./$_G_directory_path ;;
  1054. esac
  1055. # While some portion of DIR does not yet exist...
  1056. while test ! -d "$_G_directory_path"; do
  1057. # ...make a list in topmost first order. Use a colon delimited
  1058. # list incase some portion of path contains whitespace.
  1059. _G_dir_list=$_G_directory_path:$_G_dir_list
  1060. # If the last portion added has no slash in it, the list is done
  1061. case $_G_directory_path in */*) ;; *) break ;; esac
  1062. # ...otherwise throw away the child directory and loop
  1063. _G_directory_path=`$ECHO "$_G_directory_path" | $SED -e "$sed_dirname"`
  1064. done
  1065. _G_dir_list=`$ECHO "$_G_dir_list" | $SED 's|:*$||'`
  1066. func_mkdir_p_IFS=$IFS; IFS=:
  1067. for _G_dir in $_G_dir_list; do
  1068. IFS=$func_mkdir_p_IFS
  1069. # mkdir can fail with a 'File exist' error if two processes
  1070. # try to create one of the directories concurrently. Don't
  1071. # stop in that case!
  1072. $MKDIR "$_G_dir" 2>/dev/null || :
  1073. done
  1074. IFS=$func_mkdir_p_IFS
  1075. # Bail out if we (or some other process) failed to create a directory.
  1076. test -d "$_G_directory_path" || \
  1077. func_fatal_error "Failed to create '$1'"
  1078. fi
  1079. }
  1080. # func_mktempdir [BASENAME]
  1081. # -------------------------
  1082. # Make a temporary directory that won't clash with other running
  1083. # libtool processes, and avoids race conditions if possible. If
  1084. # given, BASENAME is the basename for that directory.
  1085. func_mktempdir ()
  1086. {
  1087. $debug_cmd
  1088. _G_template=${TMPDIR-/tmp}/${1-$progname}
  1089. if test : = "$opt_dry_run"; then
  1090. # Return a directory name, but don't create it in dry-run mode
  1091. _G_tmpdir=$_G_template-$$
  1092. else
  1093. # If mktemp works, use that first and foremost
  1094. _G_tmpdir=`mktemp -d "$_G_template-XXXXXXXX" 2>/dev/null`
  1095. if test ! -d "$_G_tmpdir"; then
  1096. # Failing that, at least try and use $RANDOM to avoid a race
  1097. _G_tmpdir=$_G_template-${RANDOM-0}$$
  1098. func_mktempdir_umask=`umask`
  1099. umask 0077
  1100. $MKDIR "$_G_tmpdir"
  1101. umask $func_mktempdir_umask
  1102. fi
  1103. # If we're not in dry-run mode, bomb out on failure
  1104. test -d "$_G_tmpdir" || \
  1105. func_fatal_error "cannot create temporary directory '$_G_tmpdir'"
  1106. fi
  1107. $ECHO "$_G_tmpdir"
  1108. }
  1109. # func_normal_abspath PATH
  1110. # ------------------------
  1111. # Remove doubled-up and trailing slashes, "." path components,
  1112. # and cancel out any ".." path components in PATH after making
  1113. # it an absolute path.
  1114. func_normal_abspath ()
  1115. {
  1116. $debug_cmd
  1117. # These SED scripts presuppose an absolute path with a trailing slash.
  1118. _G_pathcar='s|^/\([^/]*\).*$|\1|'
  1119. _G_pathcdr='s|^/[^/]*||'
  1120. _G_removedotparts=':dotsl
  1121. s|/\./|/|g
  1122. t dotsl
  1123. s|/\.$|/|'
  1124. _G_collapseslashes='s|/\{1,\}|/|g'
  1125. _G_finalslash='s|/*$|/|'
  1126. # Start from root dir and reassemble the path.
  1127. func_normal_abspath_result=
  1128. func_normal_abspath_tpath=$1
  1129. func_normal_abspath_altnamespace=
  1130. case $func_normal_abspath_tpath in
  1131. "")
  1132. # Empty path, that just means $cwd.
  1133. func_stripname '' '/' "`pwd`"
  1134. func_normal_abspath_result=$func_stripname_result
  1135. return
  1136. ;;
  1137. # The next three entries are used to spot a run of precisely
  1138. # two leading slashes without using negated character classes;
  1139. # we take advantage of case's first-match behaviour.
  1140. ///*)
  1141. # Unusual form of absolute path, do nothing.
  1142. ;;
  1143. //*)
  1144. # Not necessarily an ordinary path; POSIX reserves leading '//'
  1145. # and for example Cygwin uses it to access remote file shares
  1146. # over CIFS/SMB, so we conserve a leading double slash if found.
  1147. func_normal_abspath_altnamespace=/
  1148. ;;
  1149. /*)
  1150. # Absolute path, do nothing.
  1151. ;;
  1152. *)
  1153. # Relative path, prepend $cwd.
  1154. func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath
  1155. ;;
  1156. esac
  1157. # Cancel out all the simple stuff to save iterations. We also want
  1158. # the path to end with a slash for ease of parsing, so make sure
  1159. # there is one (and only one) here.
  1160. func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
  1161. -e "$_G_removedotparts" -e "$_G_collapseslashes" -e "$_G_finalslash"`
  1162. while :; do
  1163. # Processed it all yet?
  1164. if test / = "$func_normal_abspath_tpath"; then
  1165. # If we ascended to the root using ".." the result may be empty now.
  1166. if test -z "$func_normal_abspath_result"; then
  1167. func_normal_abspath_result=/
  1168. fi
  1169. break
  1170. fi
  1171. func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \
  1172. -e "$_G_pathcar"`
  1173. func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
  1174. -e "$_G_pathcdr"`
  1175. # Figure out what to do with it
  1176. case $func_normal_abspath_tcomponent in
  1177. "")
  1178. # Trailing empty path component, ignore it.
  1179. ;;
  1180. ..)
  1181. # Parent dir; strip last assembled component from result.
  1182. func_dirname "$func_normal_abspath_result"
  1183. func_normal_abspath_result=$func_dirname_result
  1184. ;;
  1185. *)
  1186. # Actual path component, append it.
  1187. func_append func_normal_abspath_result "/$func_normal_abspath_tcomponent"
  1188. ;;
  1189. esac
  1190. done
  1191. # Restore leading double-slash if one was found on entry.
  1192. func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result
  1193. }
  1194. # func_notquiet ARG...
  1195. # --------------------
  1196. # Echo program name prefixed message only when not in quiet mode.
  1197. func_notquiet ()
  1198. {
  1199. $debug_cmd
  1200. $opt_quiet || func_echo ${1+"$@"}
  1201. # A bug in bash halts the script if the last line of a function
  1202. # fails when set -e is in force, so we need another command to
  1203. # work around that:
  1204. :
  1205. }
  1206. # func_relative_path SRCDIR DSTDIR
  1207. # --------------------------------
  1208. # Set func_relative_path_result to the relative path from SRCDIR to DSTDIR.
  1209. func_relative_path ()
  1210. {
  1211. $debug_cmd
  1212. func_relative_path_result=
  1213. func_normal_abspath "$1"
  1214. func_relative_path_tlibdir=$func_normal_abspath_result
  1215. func_normal_abspath "$2"
  1216. func_relative_path_tbindir=$func_normal_abspath_result
  1217. # Ascend the tree starting from libdir
  1218. while :; do
  1219. # check if we have found a prefix of bindir
  1220. case $func_relative_path_tbindir in
  1221. $func_relative_path_tlibdir)
  1222. # found an exact match
  1223. func_relative_path_tcancelled=
  1224. break
  1225. ;;
  1226. $func_relative_path_tlibdir*)
  1227. # found a matching prefix
  1228. func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir"
  1229. func_relative_path_tcancelled=$func_stripname_result
  1230. if test -z "$func_relative_path_result"; then
  1231. func_relative_path_result=.
  1232. fi
  1233. break
  1234. ;;
  1235. *)
  1236. func_dirname $func_relative_path_tlibdir
  1237. func_relative_path_tlibdir=$func_dirname_result
  1238. if test -z "$func_relative_path_tlibdir"; then
  1239. # Have to descend all the way to the root!
  1240. func_relative_path_result=../$func_relative_path_result
  1241. func_relative_path_tcancelled=$func_relative_path_tbindir
  1242. break
  1243. fi
  1244. func_relative_path_result=../$func_relative_path_result
  1245. ;;
  1246. esac
  1247. done
  1248. # Now calculate path; take care to avoid doubling-up slashes.
  1249. func_stripname '' '/' "$func_relative_path_result"
  1250. func_relative_path_result=$func_stripname_result
  1251. func_stripname '/' '/' "$func_relative_path_tcancelled"
  1252. if test -n "$func_stripname_result"; then
  1253. func_append func_relative_path_result "/$func_stripname_result"
  1254. fi
  1255. # Normalisation. If bindir is libdir, return '.' else relative path.
  1256. if test -n "$func_relative_path_result"; then
  1257. func_stripname './' '' "$func_relative_path_result"
  1258. func_relative_path_result=$func_stripname_result
  1259. fi
  1260. test -n "$func_relative_path_result" || func_relative_path_result=.
  1261. :
  1262. }
  1263. # func_quote_for_eval ARG...
  1264. # --------------------------
  1265. # Aesthetically quote ARGs to be evaled later.
  1266. # This function returns two values:
  1267. # i) func_quote_for_eval_result
  1268. # double-quoted, suitable for a subsequent eval
  1269. # ii) func_quote_for_eval_unquoted_result
  1270. # has all characters that are still active within double
  1271. # quotes backslashified.
  1272. func_quote_for_eval ()
  1273. {
  1274. $debug_cmd
  1275. func_quote_for_eval_unquoted_result=
  1276. func_quote_for_eval_result=
  1277. while test 0 -lt $#; do
  1278. case $1 in
  1279. *[\\\`\"\$]*)
  1280. _G_unquoted_arg=`printf '%s\n' "$1" |$SED "$sed_quote_subst"` ;;
  1281. *)
  1282. _G_unquoted_arg=$1 ;;
  1283. esac
  1284. if test -n "$func_quote_for_eval_unquoted_result"; then
  1285. func_append func_quote_for_eval_unquoted_result " $_G_unquoted_arg"
  1286. else
  1287. func_append func_quote_for_eval_unquoted_result "$_G_unquoted_arg"
  1288. fi
  1289. case $_G_unquoted_arg in
  1290. # Double-quote args containing shell metacharacters to delay
  1291. # word splitting, command substitution and variable expansion
  1292. # for a subsequent eval.
  1293. # Many Bourne shells cannot handle close brackets correctly
  1294. # in scan sets, so we specify it separately.
  1295. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
  1296. _G_quoted_arg=\"$_G_unquoted_arg\"
  1297. ;;
  1298. *)
  1299. _G_quoted_arg=$_G_unquoted_arg
  1300. ;;
  1301. esac
  1302. if test -n "$func_quote_for_eval_result"; then
  1303. func_append func_quote_for_eval_result " $_G_quoted_arg"
  1304. else
  1305. func_append func_quote_for_eval_result "$_G_quoted_arg"
  1306. fi
  1307. shift
  1308. done
  1309. }
  1310. # func_quote_for_expand ARG
  1311. # -------------------------
  1312. # Aesthetically quote ARG to be evaled later; same as above,
  1313. # but do not quote variable references.
  1314. func_quote_for_expand ()
  1315. {
  1316. $debug_cmd
  1317. case $1 in
  1318. *[\\\`\"]*)
  1319. _G_arg=`$ECHO "$1" | $SED \
  1320. -e "$sed_double_quote_subst" -e "$sed_double_backslash"` ;;
  1321. *)
  1322. _G_arg=$1 ;;
  1323. esac
  1324. case $_G_arg in
  1325. # Double-quote args containing shell metacharacters to delay
  1326. # word splitting and command substitution for a subsequent eval.
  1327. # Many Bourne shells cannot handle close brackets correctly
  1328. # in scan sets, so we specify it separately.
  1329. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
  1330. _G_arg=\"$_G_arg\"
  1331. ;;
  1332. esac
  1333. func_quote_for_expand_result=$_G_arg
  1334. }
  1335. # func_stripname PREFIX SUFFIX NAME
  1336. # ---------------------------------
  1337. # strip PREFIX and SUFFIX from NAME, and store in func_stripname_result.
  1338. # PREFIX and SUFFIX must not contain globbing or regex special
  1339. # characters, hashes, percent signs, but SUFFIX may contain a leading
  1340. # dot (in which case that matches only a dot).
  1341. if test yes = "$_G_HAVE_XSI_OPS"; then
  1342. eval 'func_stripname ()
  1343. {
  1344. $debug_cmd
  1345. # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are
  1346. # positional parameters, so assign one to ordinary variable first.
  1347. func_stripname_result=$3
  1348. func_stripname_result=${func_stripname_result#"$1"}
  1349. func_stripname_result=${func_stripname_result%"$2"}
  1350. }'
  1351. else
  1352. func_stripname ()
  1353. {
  1354. $debug_cmd
  1355. case $2 in
  1356. .*) func_stripname_result=`$ECHO "$3" | $SED -e "s%^$1%%" -e "s%\\\\$2\$%%"`;;
  1357. *) func_stripname_result=`$ECHO "$3" | $SED -e "s%^$1%%" -e "s%$2\$%%"`;;
  1358. esac
  1359. }
  1360. fi
  1361. # func_show_eval CMD [FAIL_EXP]
  1362. # -----------------------------
  1363. # Unless opt_quiet is true, then output CMD. Then, if opt_dryrun is
  1364. # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
  1365. # is given, then evaluate it.
  1366. func_show_eval ()
  1367. {
  1368. $debug_cmd
  1369. _G_cmd=$1
  1370. _G_fail_exp=${2-':'}
  1371. func_quote_for_expand "$_G_cmd"
  1372. eval "func_notquiet $func_quote_for_expand_result"
  1373. $opt_dry_run || {
  1374. eval "$_G_cmd"
  1375. _G_status=$?
  1376. if test 0 -ne "$_G_status"; then
  1377. eval "(exit $_G_status); $_G_fail_exp"
  1378. fi
  1379. }
  1380. }
  1381. # func_show_eval_locale CMD [FAIL_EXP]
  1382. # ------------------------------------
  1383. # Unless opt_quiet is true, then output CMD. Then, if opt_dryrun is
  1384. # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
  1385. # is given, then evaluate it. Use the saved locale for evaluation.
  1386. func_show_eval_locale ()
  1387. {
  1388. $debug_cmd
  1389. _G_cmd=$1
  1390. _G_fail_exp=${2-':'}
  1391. $opt_quiet || {
  1392. func_quote_for_expand "$_G_cmd"
  1393. eval "func_echo $func_quote_for_expand_result"
  1394. }
  1395. $opt_dry_run || {
  1396. eval "$_G_user_locale
  1397. $_G_cmd"
  1398. _G_status=$?
  1399. eval "$_G_safe_locale"
  1400. if test 0 -ne "$_G_status"; then
  1401. eval "(exit $_G_status); $_G_fail_exp"
  1402. fi
  1403. }
  1404. }
  1405. # func_tr_sh
  1406. # ----------
  1407. # Turn $1 into a string suitable for a shell variable name.
  1408. # Result is stored in $func_tr_sh_result. All characters
  1409. # not in the set a-zA-Z0-9_ are replaced with '_'. Further,
  1410. # if $1 begins with a digit, a '_' is prepended as well.
  1411. func_tr_sh ()
  1412. {
  1413. $debug_cmd
  1414. case $1 in
  1415. [0-9]* | *[!a-zA-Z0-9_]*)
  1416. func_tr_sh_result=`$ECHO "$1" | $SED -e 's/^\([0-9]\)/_\1/' -e 's/[^a-zA-Z0-9_]/_/g'`
  1417. ;;
  1418. * )
  1419. func_tr_sh_result=$1
  1420. ;;
  1421. esac
  1422. }
  1423. # func_verbose ARG...
  1424. # -------------------
  1425. # Echo program name prefixed message in verbose mode only.
  1426. func_verbose ()
  1427. {
  1428. $debug_cmd
  1429. $opt_verbose && func_echo "$*"
  1430. :
  1431. }
  1432. # func_warn_and_continue ARG...
  1433. # -----------------------------
  1434. # Echo program name prefixed warning message to standard error.
  1435. func_warn_and_continue ()
  1436. {
  1437. $debug_cmd
  1438. $require_term_colors
  1439. func_echo_infix_1 "${tc_red}warning$tc_reset" "$*" >&2
  1440. }
  1441. # func_warning CATEGORY ARG...
  1442. # ----------------------------
  1443. # Echo program name prefixed warning message to standard error. Warning
  1444. # messages can be filtered according to CATEGORY, where this function
  1445. # elides messages where CATEGORY is not listed in the global variable
  1446. # 'opt_warning_types'.
  1447. func_warning ()
  1448. {
  1449. $debug_cmd
  1450. # CATEGORY must be in the warning_categories list!
  1451. case " $warning_categories " in
  1452. *" $1 "*) ;;
  1453. *) func_internal_error "invalid warning category '$1'" ;;
  1454. esac
  1455. _G_category=$1
  1456. shift
  1457. case " $opt_warning_types " in
  1458. *" $_G_category "*) $warning_func ${1+"$@"} ;;
  1459. esac
  1460. }
  1461. # func_sort_ver VER1 VER2
  1462. # -----------------------
  1463. # 'sort -V' is not generally available.
  1464. # Note this deviates from the version comparison in automake
  1465. # in that it treats 1.5 < 1.5.0, and treats 1.4.4a < 1.4-p3a
  1466. # but this should suffice as we won't be specifying old
  1467. # version formats or redundant trailing .0 in bootstrap.conf.
  1468. # If we did want full compatibility then we should probably
  1469. # use m4_version_compare from autoconf.
  1470. func_sort_ver ()
  1471. {
  1472. $debug_cmd
  1473. printf '%s\n%s\n' "$1" "$2" \
  1474. | sort -t. -k 1,1n -k 2,2n -k 3,3n -k 4,4n -k 5,5n -k 6,6n -k 7,7n -k 8,8n -k 9,9n
  1475. }
  1476. # func_lt_ver PREV CURR
  1477. # ---------------------
  1478. # Return true if PREV and CURR are in the correct order according to
  1479. # func_sort_ver, otherwise false. Use it like this:
  1480. #
  1481. # func_lt_ver "$prev_ver" "$proposed_ver" || func_fatal_error "..."
  1482. func_lt_ver ()
  1483. {
  1484. $debug_cmd
  1485. test "x$1" = x`func_sort_ver "$1" "$2" | $SED 1q`
  1486. }
  1487. # Local variables:
  1488. # mode: shell-script
  1489. # sh-indentation: 2
  1490. # eval: (add-hook 'before-save-hook 'time-stamp)
  1491. # time-stamp-pattern: "10/scriptversion=%:y-%02m-%02d.%02H; # UTC"
  1492. # time-stamp-time-zone: "UTC"
  1493. # End:
  1494. #! /bin/sh
  1495. # Set a version string for this script.
  1496. scriptversion=2015-10-07.11; # UTC
  1497. # A portable, pluggable option parser for Bourne shell.
  1498. # Written by Gary V. Vaughan, 2010
  1499. # Copyright (C) 2010-2015 Free Software Foundation, Inc.
  1500. # This is free software; see the source for copying conditions. There is NO
  1501. # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  1502. # This program is free software: you can redistribute it and/or modify
  1503. # it under the terms of the GNU General Public License as published by
  1504. # the Free Software Foundation, either version 3 of the License, or
  1505. # (at your option) any later version.
  1506. # This program is distributed in the hope that it will be useful,
  1507. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  1508. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  1509. # GNU General Public License for more details.
  1510. # You should have received a copy of the GNU General Public License
  1511. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  1512. # Please report bugs or propose patches to gary@gnu.org.
  1513. ## ------ ##
  1514. ## Usage. ##
  1515. ## ------ ##
  1516. # This file is a library for parsing options in your shell scripts along
  1517. # with assorted other useful supporting features that you can make use
  1518. # of too.
  1519. #
  1520. # For the simplest scripts you might need only:
  1521. #
  1522. # #!/bin/sh
  1523. # . relative/path/to/funclib.sh
  1524. # . relative/path/to/options-parser
  1525. # scriptversion=1.0
  1526. # func_options ${1+"$@"}
  1527. # eval set dummy "$func_options_result"; shift
  1528. # ...rest of your script...
  1529. #
  1530. # In order for the '--version' option to work, you will need to have a
  1531. # suitably formatted comment like the one at the top of this file
  1532. # starting with '# Written by ' and ending with '# warranty; '.
  1533. #
  1534. # For '-h' and '--help' to work, you will also need a one line
  1535. # description of your script's purpose in a comment directly above the
  1536. # '# Written by ' line, like the one at the top of this file.
  1537. #
  1538. # The default options also support '--debug', which will turn on shell
  1539. # execution tracing (see the comment above debug_cmd below for another
  1540. # use), and '--verbose' and the func_verbose function to allow your script
  1541. # to display verbose messages only when your user has specified
  1542. # '--verbose'.
  1543. #
  1544. # After sourcing this file, you can plug processing for additional
  1545. # options by amending the variables from the 'Configuration' section
  1546. # below, and following the instructions in the 'Option parsing'
  1547. # section further down.
  1548. ## -------------- ##
  1549. ## Configuration. ##
  1550. ## -------------- ##
  1551. # You should override these variables in your script after sourcing this
  1552. # file so that they reflect the customisations you have added to the
  1553. # option parser.
  1554. # The usage line for option parsing errors and the start of '-h' and
  1555. # '--help' output messages. You can embed shell variables for delayed
  1556. # expansion at the time the message is displayed, but you will need to
  1557. # quote other shell meta-characters carefully to prevent them being
  1558. # expanded when the contents are evaled.
  1559. usage='$progpath [OPTION]...'
  1560. # Short help message in response to '-h' and '--help'. Add to this or
  1561. # override it after sourcing this library to reflect the full set of
  1562. # options your script accepts.
  1563. usage_message="\
  1564. --debug enable verbose shell tracing
  1565. -W, --warnings=CATEGORY
  1566. report the warnings falling in CATEGORY [all]
  1567. -v, --verbose verbosely report processing
  1568. --version print version information and exit
  1569. -h, --help print short or long help message and exit
  1570. "
  1571. # Additional text appended to 'usage_message' in response to '--help'.
  1572. long_help_message="
  1573. Warning categories include:
  1574. 'all' show all warnings
  1575. 'none' turn off all the warnings
  1576. 'error' warnings are treated as fatal errors"
  1577. # Help message printed before fatal option parsing errors.
  1578. fatal_help="Try '\$progname --help' for more information."
  1579. ## ------------------------- ##
  1580. ## Hook function management. ##
  1581. ## ------------------------- ##
  1582. # This section contains functions for adding, removing, and running hooks
  1583. # to the main code. A hook is just a named list of of function, that can
  1584. # be run in order later on.
  1585. # func_hookable FUNC_NAME
  1586. # -----------------------
  1587. # Declare that FUNC_NAME will run hooks added with
  1588. # 'func_add_hook FUNC_NAME ...'.
  1589. func_hookable ()
  1590. {
  1591. $debug_cmd
  1592. func_append hookable_fns " $1"
  1593. }
  1594. # func_add_hook FUNC_NAME HOOK_FUNC
  1595. # ---------------------------------
  1596. # Request that FUNC_NAME call HOOK_FUNC before it returns. FUNC_NAME must
  1597. # first have been declared "hookable" by a call to 'func_hookable'.
  1598. func_add_hook ()
  1599. {
  1600. $debug_cmd
  1601. case " $hookable_fns " in
  1602. *" $1 "*) ;;
  1603. *) func_fatal_error "'$1' does not accept hook functions." ;;
  1604. esac
  1605. eval func_append ${1}_hooks '" $2"'
  1606. }
  1607. # func_remove_hook FUNC_NAME HOOK_FUNC
  1608. # ------------------------------------
  1609. # Remove HOOK_FUNC from the list of functions called by FUNC_NAME.
  1610. func_remove_hook ()
  1611. {
  1612. $debug_cmd
  1613. eval ${1}_hooks='`$ECHO "\$'$1'_hooks" |$SED "s| '$2'||"`'
  1614. }
  1615. # func_run_hooks FUNC_NAME [ARG]...
  1616. # ---------------------------------
  1617. # Run all hook functions registered to FUNC_NAME.
  1618. # It is assumed that the list of hook functions contains nothing more
  1619. # than a whitespace-delimited list of legal shell function names, and
  1620. # no effort is wasted trying to catch shell meta-characters or preserve
  1621. # whitespace.
  1622. func_run_hooks ()
  1623. {
  1624. $debug_cmd
  1625. _G_rc_run_hooks=false
  1626. case " $hookable_fns " in
  1627. *" $1 "*) ;;
  1628. *) func_fatal_error "'$1' does not support hook funcions.n" ;;
  1629. esac
  1630. eval _G_hook_fns=\$$1_hooks; shift
  1631. for _G_hook in $_G_hook_fns; do
  1632. if eval $_G_hook '"$@"'; then
  1633. # store returned options list back into positional
  1634. # parameters for next 'cmd' execution.
  1635. eval _G_hook_result=\$${_G_hook}_result
  1636. eval set dummy "$_G_hook_result"; shift
  1637. _G_rc_run_hooks=:
  1638. fi
  1639. done
  1640. $_G_rc_run_hooks && func_run_hooks_result=$_G_hook_result
  1641. }
  1642. ## --------------- ##
  1643. ## Option parsing. ##
  1644. ## --------------- ##
  1645. # In order to add your own option parsing hooks, you must accept the
  1646. # full positional parameter list in your hook function, you may remove/edit
  1647. # any options that you action, and then pass back the remaining unprocessed
  1648. # options in '<hooked_function_name>_result', escaped suitably for
  1649. # 'eval'. In this case you also must return $EXIT_SUCCESS to let the
  1650. # hook's caller know that it should pay attention to
  1651. # '<hooked_function_name>_result'. Returning $EXIT_FAILURE signalizes that
  1652. # arguments are left untouched by the hook and therefore caller will ignore the
  1653. # result variable.
  1654. #
  1655. # Like this:
  1656. #
  1657. # my_options_prep ()
  1658. # {
  1659. # $debug_cmd
  1660. #
  1661. # # Extend the existing usage message.
  1662. # usage_message=$usage_message'
  1663. # -s, --silent don'\''t print informational messages
  1664. # '
  1665. # # No change in '$@' (ignored completely by this hook). There is
  1666. # # no need to do the equivalent (but slower) action:
  1667. # # func_quote_for_eval ${1+"$@"}
  1668. # # my_options_prep_result=$func_quote_for_eval_result
  1669. # false
  1670. # }
  1671. # func_add_hook func_options_prep my_options_prep
  1672. #
  1673. #
  1674. # my_silent_option ()
  1675. # {
  1676. # $debug_cmd
  1677. #
  1678. # args_changed=false
  1679. #
  1680. # # Note that for efficiency, we parse as many options as we can
  1681. # # recognise in a loop before passing the remainder back to the
  1682. # # caller on the first unrecognised argument we encounter.
  1683. # while test $# -gt 0; do
  1684. # opt=$1; shift
  1685. # case $opt in
  1686. # --silent|-s) opt_silent=:
  1687. # args_changed=:
  1688. # ;;
  1689. # # Separate non-argument short options:
  1690. # -s*) func_split_short_opt "$_G_opt"
  1691. # set dummy "$func_split_short_opt_name" \
  1692. # "-$func_split_short_opt_arg" ${1+"$@"}
  1693. # shift
  1694. # args_changed=:
  1695. # ;;
  1696. # *) # Make sure the first unrecognised option "$_G_opt"
  1697. # # is added back to "$@", we could need that later
  1698. # # if $args_changed is true.
  1699. # set dummy "$_G_opt" ${1+"$@"}; shift; break ;;
  1700. # esac
  1701. # done
  1702. #
  1703. # if $args_changed; then
  1704. # func_quote_for_eval ${1+"$@"}
  1705. # my_silent_option_result=$func_quote_for_eval_result
  1706. # fi
  1707. #
  1708. # $args_changed
  1709. # }
  1710. # func_add_hook func_parse_options my_silent_option
  1711. #
  1712. #
  1713. # my_option_validation ()
  1714. # {
  1715. # $debug_cmd
  1716. #
  1717. # $opt_silent && $opt_verbose && func_fatal_help "\
  1718. # '--silent' and '--verbose' options are mutually exclusive."
  1719. #
  1720. # false
  1721. # }
  1722. # func_add_hook func_validate_options my_option_validation
  1723. #
  1724. # You'll also need to manually amend $usage_message to reflect the extra
  1725. # options you parse. It's preferable to append if you can, so that
  1726. # multiple option parsing hooks can be added safely.
  1727. # func_options_finish [ARG]...
  1728. # ----------------------------
  1729. # Finishing the option parse loop (call 'func_options' hooks ATM).
  1730. func_options_finish ()
  1731. {
  1732. $debug_cmd
  1733. _G_func_options_finish_exit=false
  1734. if func_run_hooks func_options ${1+"$@"}; then
  1735. func_options_finish_result=$func_run_hooks_result
  1736. _G_func_options_finish_exit=:
  1737. fi
  1738. $_G_func_options_finish_exit
  1739. }
  1740. # func_options [ARG]...
  1741. # ---------------------
  1742. # All the functions called inside func_options are hookable. See the
  1743. # individual implementations for details.
  1744. func_hookable func_options
  1745. func_options ()
  1746. {
  1747. $debug_cmd
  1748. _G_rc_options=false
  1749. for my_func in options_prep parse_options validate_options options_finish
  1750. do
  1751. if eval func_$my_func '${1+"$@"}'; then
  1752. eval _G_res_var='$'"func_${my_func}_result"
  1753. eval set dummy "$_G_res_var" ; shift
  1754. _G_rc_options=:
  1755. fi
  1756. done
  1757. # Save modified positional parameters for caller. As a top-level
  1758. # options-parser function we always need to set the 'func_options_result'
  1759. # variable (regardless the $_G_rc_options value).
  1760. if $_G_rc_options; then
  1761. func_options_result=$_G_res_var
  1762. else
  1763. func_quote_for_eval ${1+"$@"}
  1764. func_options_result=$func_quote_for_eval_result
  1765. fi
  1766. $_G_rc_options
  1767. }
  1768. # func_options_prep [ARG]...
  1769. # --------------------------
  1770. # All initialisations required before starting the option parse loop.
  1771. # Note that when calling hook functions, we pass through the list of
  1772. # positional parameters. If a hook function modifies that list, and
  1773. # needs to propagate that back to rest of this script, then the complete
  1774. # modified list must be put in 'func_run_hooks_result' before
  1775. # returning $EXIT_SUCCESS (otherwise $EXIT_FAILURE is returned).
  1776. func_hookable func_options_prep
  1777. func_options_prep ()
  1778. {
  1779. $debug_cmd
  1780. # Option defaults:
  1781. opt_verbose=false
  1782. opt_warning_types=
  1783. _G_rc_options_prep=false
  1784. if func_run_hooks func_options_prep ${1+"$@"}; then
  1785. _G_rc_options_prep=:
  1786. # save modified positional parameters for caller
  1787. func_options_prep_result=$func_run_hooks_result
  1788. fi
  1789. $_G_rc_options_prep
  1790. }
  1791. # func_parse_options [ARG]...
  1792. # ---------------------------
  1793. # The main option parsing loop.
  1794. func_hookable func_parse_options
  1795. func_parse_options ()
  1796. {
  1797. $debug_cmd
  1798. func_parse_options_result=
  1799. _G_rc_parse_options=false
  1800. # this just eases exit handling
  1801. while test $# -gt 0; do
  1802. # Defer to hook functions for initial option parsing, so they
  1803. # get priority in the event of reusing an option name.
  1804. if func_run_hooks func_parse_options ${1+"$@"}; then
  1805. eval set dummy "$func_run_hooks_result"; shift
  1806. _G_rc_parse_options=:
  1807. fi
  1808. # Break out of the loop if we already parsed every option.
  1809. test $# -gt 0 || break
  1810. _G_match_parse_options=:
  1811. _G_opt=$1
  1812. shift
  1813. case $_G_opt in
  1814. --debug|-x) debug_cmd='set -x'
  1815. func_echo "enabling shell trace mode"
  1816. $debug_cmd
  1817. ;;
  1818. --no-warnings|--no-warning|--no-warn)
  1819. set dummy --warnings none ${1+"$@"}
  1820. shift
  1821. ;;
  1822. --warnings|--warning|-W)
  1823. if test $# = 0 && func_missing_arg $_G_opt; then
  1824. _G_rc_parse_options=:
  1825. break
  1826. fi
  1827. case " $warning_categories $1" in
  1828. *" $1 "*)
  1829. # trailing space prevents matching last $1 above
  1830. func_append_uniq opt_warning_types " $1"
  1831. ;;
  1832. *all)
  1833. opt_warning_types=$warning_categories
  1834. ;;
  1835. *none)
  1836. opt_warning_types=none
  1837. warning_func=:
  1838. ;;
  1839. *error)
  1840. opt_warning_types=$warning_categories
  1841. warning_func=func_fatal_error
  1842. ;;
  1843. *)
  1844. func_fatal_error \
  1845. "unsupported warning category: '$1'"
  1846. ;;
  1847. esac
  1848. shift
  1849. ;;
  1850. --verbose|-v) opt_verbose=: ;;
  1851. --version) func_version ;;
  1852. -\?|-h) func_usage ;;
  1853. --help) func_help ;;
  1854. # Separate optargs to long options (plugins may need this):
  1855. --*=*) func_split_equals "$_G_opt"
  1856. set dummy "$func_split_equals_lhs" \
  1857. "$func_split_equals_rhs" ${1+"$@"}
  1858. shift
  1859. ;;
  1860. # Separate optargs to short options:
  1861. -W*)
  1862. func_split_short_opt "$_G_opt"
  1863. set dummy "$func_split_short_opt_name" \
  1864. "$func_split_short_opt_arg" ${1+"$@"}
  1865. shift
  1866. ;;
  1867. # Separate non-argument short options:
  1868. -\?*|-h*|-v*|-x*)
  1869. func_split_short_opt "$_G_opt"
  1870. set dummy "$func_split_short_opt_name" \
  1871. "-$func_split_short_opt_arg" ${1+"$@"}
  1872. shift
  1873. ;;
  1874. --) _G_rc_parse_options=: ; break ;;
  1875. -*) func_fatal_help "unrecognised option: '$_G_opt'" ;;
  1876. *) set dummy "$_G_opt" ${1+"$@"}; shift
  1877. _G_match_parse_options=false
  1878. break
  1879. ;;
  1880. esac
  1881. $_G_match_parse_options && _G_rc_parse_options=:
  1882. done
  1883. if $_G_rc_parse_options; then
  1884. # save modified positional parameters for caller
  1885. func_quote_for_eval ${1+"$@"}
  1886. func_parse_options_result=$func_quote_for_eval_result
  1887. fi
  1888. $_G_rc_parse_options
  1889. }
  1890. # func_validate_options [ARG]...
  1891. # ------------------------------
  1892. # Perform any sanity checks on option settings and/or unconsumed
  1893. # arguments.
  1894. func_hookable func_validate_options
  1895. func_validate_options ()
  1896. {
  1897. $debug_cmd
  1898. _G_rc_validate_options=false
  1899. # Display all warnings if -W was not given.
  1900. test -n "$opt_warning_types" || opt_warning_types=" $warning_categories"
  1901. if func_run_hooks func_validate_options ${1+"$@"}; then
  1902. # save modified positional parameters for caller
  1903. func_validate_options_result=$func_run_hooks_result
  1904. _G_rc_validate_options=:
  1905. fi
  1906. # Bail if the options were screwed!
  1907. $exit_cmd $EXIT_FAILURE
  1908. $_G_rc_validate_options
  1909. }
  1910. ## ----------------- ##
  1911. ## Helper functions. ##
  1912. ## ----------------- ##
  1913. # This section contains the helper functions used by the rest of the
  1914. # hookable option parser framework in ascii-betical order.
  1915. # func_fatal_help ARG...
  1916. # ----------------------
  1917. # Echo program name prefixed message to standard error, followed by
  1918. # a help hint, and exit.
  1919. func_fatal_help ()
  1920. {
  1921. $debug_cmd
  1922. eval \$ECHO \""Usage: $usage"\"
  1923. eval \$ECHO \""$fatal_help"\"
  1924. func_error ${1+"$@"}
  1925. exit $EXIT_FAILURE
  1926. }
  1927. # func_help
  1928. # ---------
  1929. # Echo long help message to standard output and exit.
  1930. func_help ()
  1931. {
  1932. $debug_cmd
  1933. func_usage_message
  1934. $ECHO "$long_help_message"
  1935. exit 0
  1936. }
  1937. # func_missing_arg ARGNAME
  1938. # ------------------------
  1939. # Echo program name prefixed message to standard error and set global
  1940. # exit_cmd.
  1941. func_missing_arg ()
  1942. {
  1943. $debug_cmd
  1944. func_error "Missing argument for '$1'."
  1945. exit_cmd=exit
  1946. }
  1947. # func_split_equals STRING
  1948. # ------------------------
  1949. # Set func_split_equals_lhs and func_split_equals_rhs shell variables after
  1950. # splitting STRING at the '=' sign.
  1951. test -z "$_G_HAVE_XSI_OPS" \
  1952. && (eval 'x=a/b/c;
  1953. test 5aa/bb/cc = "${#x}${x%%/*}${x%/*}${x#*/}${x##*/}"') 2>/dev/null \
  1954. && _G_HAVE_XSI_OPS=yes
  1955. if test yes = "$_G_HAVE_XSI_OPS"
  1956. then
  1957. # This is an XSI compatible shell, allowing a faster implementation...
  1958. eval 'func_split_equals ()
  1959. {
  1960. $debug_cmd
  1961. func_split_equals_lhs=${1%%=*}
  1962. func_split_equals_rhs=${1#*=}
  1963. test "x$func_split_equals_lhs" = "x$1" \
  1964. && func_split_equals_rhs=
  1965. }'
  1966. else
  1967. # ...otherwise fall back to using expr, which is often a shell builtin.
  1968. func_split_equals ()
  1969. {
  1970. $debug_cmd
  1971. func_split_equals_lhs=`expr "x$1" : 'x\([^=]*\)'`
  1972. func_split_equals_rhs=
  1973. test "x$func_split_equals_lhs" = "x$1" \
  1974. || func_split_equals_rhs=`expr "x$1" : 'x[^=]*=\(.*\)$'`
  1975. }
  1976. fi #func_split_equals
  1977. # func_split_short_opt SHORTOPT
  1978. # -----------------------------
  1979. # Set func_split_short_opt_name and func_split_short_opt_arg shell
  1980. # variables after splitting SHORTOPT after the 2nd character.
  1981. if test yes = "$_G_HAVE_XSI_OPS"
  1982. then
  1983. # This is an XSI compatible shell, allowing a faster implementation...
  1984. eval 'func_split_short_opt ()
  1985. {
  1986. $debug_cmd
  1987. func_split_short_opt_arg=${1#??}
  1988. func_split_short_opt_name=${1%"$func_split_short_opt_arg"}
  1989. }'
  1990. else
  1991. # ...otherwise fall back to using expr, which is often a shell builtin.
  1992. func_split_short_opt ()
  1993. {
  1994. $debug_cmd
  1995. func_split_short_opt_name=`expr "x$1" : 'x-\(.\)'`
  1996. func_split_short_opt_arg=`expr "x$1" : 'x-.\(.*\)$'`
  1997. }
  1998. fi #func_split_short_opt
  1999. # func_usage
  2000. # ----------
  2001. # Echo short help message to standard output and exit.
  2002. func_usage ()
  2003. {
  2004. $debug_cmd
  2005. func_usage_message
  2006. $ECHO "Run '$progname --help |${PAGER-more}' for full usage"
  2007. exit 0
  2008. }
  2009. # func_usage_message
  2010. # ------------------
  2011. # Echo short help message to standard output.
  2012. func_usage_message ()
  2013. {
  2014. $debug_cmd
  2015. eval \$ECHO \""Usage: $usage"\"
  2016. echo
  2017. $SED -n 's|^# ||
  2018. /^Written by/{
  2019. x;p;x
  2020. }
  2021. h
  2022. /^Written by/q' < "$progpath"
  2023. echo
  2024. eval \$ECHO \""$usage_message"\"
  2025. }
  2026. # func_version
  2027. # ------------
  2028. # Echo version message to standard output and exit.
  2029. func_version ()
  2030. {
  2031. $debug_cmd
  2032. printf '%s\n' "$progname $scriptversion"
  2033. $SED -n '
  2034. /(C)/!b go
  2035. :more
  2036. /\./!{
  2037. N
  2038. s|\n# | |
  2039. b more
  2040. }
  2041. :go
  2042. /^# Written by /,/# warranty; / {
  2043. s|^# ||
  2044. s|^# *$||
  2045. s|\((C)\)[ 0-9,-]*[ ,-]\([1-9][0-9]* \)|\1 \2|
  2046. p
  2047. }
  2048. /^# Written by / {
  2049. s|^# ||
  2050. p
  2051. }
  2052. /^warranty; /q' < "$progpath"
  2053. exit $?
  2054. }
  2055. # Local variables:
  2056. # mode: shell-script
  2057. # sh-indentation: 2
  2058. # eval: (add-hook 'before-save-hook 'time-stamp)
  2059. # time-stamp-pattern: "10/scriptversion=%:y-%02m-%02d.%02H; # UTC"
  2060. # time-stamp-time-zone: "UTC"
  2061. # End:
  2062. # Set a version string.
  2063. scriptversion='(GNU libtool) 2.4.6'
  2064. # func_echo ARG...
  2065. # ----------------
  2066. # Libtool also displays the current mode in messages, so override
  2067. # funclib.sh func_echo with this custom definition.
  2068. func_echo ()
  2069. {
  2070. $debug_cmd
  2071. _G_message=$*
  2072. func_echo_IFS=$IFS
  2073. IFS=$nl
  2074. for _G_line in $_G_message; do
  2075. IFS=$func_echo_IFS
  2076. $ECHO "$progname${opt_mode+: $opt_mode}: $_G_line"
  2077. done
  2078. IFS=$func_echo_IFS
  2079. }
  2080. # func_warning ARG...
  2081. # -------------------
  2082. # Libtool warnings are not categorized, so override funclib.sh
  2083. # func_warning with this simpler definition.
  2084. func_warning ()
  2085. {
  2086. $debug_cmd
  2087. $warning_func ${1+"$@"}
  2088. }
  2089. ## ---------------- ##
  2090. ## Options parsing. ##
  2091. ## ---------------- ##
  2092. # Hook in the functions to make sure our own options are parsed during
  2093. # the option parsing loop.
  2094. usage='$progpath [OPTION]... [MODE-ARG]...'
  2095. # Short help message in response to '-h'.
  2096. usage_message="Options:
  2097. --config show all configuration variables
  2098. --debug enable verbose shell tracing
  2099. -n, --dry-run display commands without modifying any files
  2100. --features display basic configuration information and exit
  2101. --mode=MODE use operation mode MODE
  2102. --no-warnings equivalent to '-Wnone'
  2103. --preserve-dup-deps don't remove duplicate dependency libraries
  2104. --quiet, --silent don't print informational messages
  2105. --tag=TAG use configuration variables from tag TAG
  2106. -v, --verbose print more informational messages than default
  2107. --version print version information
  2108. -W, --warnings=CATEGORY report the warnings falling in CATEGORY [all]
  2109. -h, --help, --help-all print short, long, or detailed help message
  2110. "
  2111. # Additional text appended to 'usage_message' in response to '--help'.
  2112. func_help ()
  2113. {
  2114. $debug_cmd
  2115. func_usage_message
  2116. $ECHO "$long_help_message
  2117. MODE must be one of the following:
  2118. clean remove files from the build directory
  2119. compile compile a source file into a libtool object
  2120. execute automatically set library path, then run a program
  2121. finish complete the installation of libtool libraries
  2122. install install libraries or executables
  2123. link create a library or an executable
  2124. uninstall remove libraries from an installed directory
  2125. MODE-ARGS vary depending on the MODE. When passed as first option,
  2126. '--mode=MODE' may be abbreviated as 'MODE' or a unique abbreviation of that.
  2127. Try '$progname --help --mode=MODE' for a more detailed description of MODE.
  2128. When reporting a bug, please describe a test case to reproduce it and
  2129. include the following information:
  2130. host-triplet: $host
  2131. shell: $SHELL
  2132. compiler: $LTCC
  2133. compiler flags: $LTCFLAGS
  2134. linker: $LD (gnu? $with_gnu_ld)
  2135. version: $progname $scriptversion Debian-2.4.6-15
  2136. automake: `($AUTOMAKE --version) 2>/dev/null |$SED 1q`
  2137. autoconf: `($AUTOCONF --version) 2>/dev/null |$SED 1q`
  2138. Report bugs to <bug-libtool@gnu.org>.
  2139. GNU libtool home page: <http://www.gnu.org/s/libtool/>.
  2140. General help using GNU software: <http://www.gnu.org/gethelp/>."
  2141. exit 0
  2142. }
  2143. # func_lo2o OBJECT-NAME
  2144. # ---------------------
  2145. # Transform OBJECT-NAME from a '.lo' suffix to the platform specific
  2146. # object suffix.
  2147. lo2o=s/\\.lo\$/.$objext/
  2148. o2lo=s/\\.$objext\$/.lo/
  2149. if test yes = "$_G_HAVE_XSI_OPS"; then
  2150. eval 'func_lo2o ()
  2151. {
  2152. case $1 in
  2153. *.lo) func_lo2o_result=${1%.lo}.$objext ;;
  2154. * ) func_lo2o_result=$1 ;;
  2155. esac
  2156. }'
  2157. # func_xform LIBOBJ-OR-SOURCE
  2158. # ---------------------------
  2159. # Transform LIBOBJ-OR-SOURCE from a '.o' or '.c' (or otherwise)
  2160. # suffix to a '.lo' libtool-object suffix.
  2161. eval 'func_xform ()
  2162. {
  2163. func_xform_result=${1%.*}.lo
  2164. }'
  2165. else
  2166. # ...otherwise fall back to using sed.
  2167. func_lo2o ()
  2168. {
  2169. func_lo2o_result=`$ECHO "$1" | $SED "$lo2o"`
  2170. }
  2171. func_xform ()
  2172. {
  2173. func_xform_result=`$ECHO "$1" | $SED 's|\.[^.]*$|.lo|'`
  2174. }
  2175. fi
  2176. # func_fatal_configuration ARG...
  2177. # -------------------------------
  2178. # Echo program name prefixed message to standard error, followed by
  2179. # a configuration failure hint, and exit.
  2180. func_fatal_configuration ()
  2181. {
  2182. func__fatal_error ${1+"$@"} \
  2183. "See the $PACKAGE documentation for more information." \
  2184. "Fatal configuration error."
  2185. }
  2186. # func_config
  2187. # -----------
  2188. # Display the configuration for all the tags in this script.
  2189. func_config ()
  2190. {
  2191. re_begincf='^# ### BEGIN LIBTOOL'
  2192. re_endcf='^# ### END LIBTOOL'
  2193. # Default configuration.
  2194. $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath"
  2195. # Now print the configurations for the tags.
  2196. for tagname in $taglist; do
  2197. $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath"
  2198. done
  2199. exit $?
  2200. }
  2201. # func_features
  2202. # -------------
  2203. # Display the features supported by this script.
  2204. func_features ()
  2205. {
  2206. echo "host: $host"
  2207. if test yes = "$build_libtool_libs"; then
  2208. echo "enable shared libraries"
  2209. else
  2210. echo "disable shared libraries"
  2211. fi
  2212. if test yes = "$build_old_libs"; then
  2213. echo "enable static libraries"
  2214. else
  2215. echo "disable static libraries"
  2216. fi
  2217. exit $?
  2218. }
  2219. # func_enable_tag TAGNAME
  2220. # -----------------------
  2221. # Verify that TAGNAME is valid, and either flag an error and exit, or
  2222. # enable the TAGNAME tag. We also add TAGNAME to the global $taglist
  2223. # variable here.
  2224. func_enable_tag ()
  2225. {
  2226. # Global variable:
  2227. tagname=$1
  2228. re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$"
  2229. re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$"
  2230. sed_extractcf=/$re_begincf/,/$re_endcf/p
  2231. # Validate tagname.
  2232. case $tagname in
  2233. *[!-_A-Za-z0-9,/]*)
  2234. func_fatal_error "invalid tag name: $tagname"
  2235. ;;
  2236. esac
  2237. # Don't test for the "default" C tag, as we know it's
  2238. # there but not specially marked.
  2239. case $tagname in
  2240. CC) ;;
  2241. *)
  2242. if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then
  2243. taglist="$taglist $tagname"
  2244. # Evaluate the configuration. Be careful to quote the path
  2245. # and the sed script, to avoid splitting on whitespace, but
  2246. # also don't use non-portable quotes within backquotes within
  2247. # quotes we have to do it in 2 steps:
  2248. extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"`
  2249. eval "$extractedcf"
  2250. else
  2251. func_error "ignoring unknown tag $tagname"
  2252. fi
  2253. ;;
  2254. esac
  2255. }
  2256. # func_check_version_match
  2257. # ------------------------
  2258. # Ensure that we are using m4 macros, and libtool script from the same
  2259. # release of libtool.
  2260. func_check_version_match ()
  2261. {
  2262. if test "$package_revision" != "$macro_revision"; then
  2263. if test "$VERSION" != "$macro_version"; then
  2264. if test -z "$macro_version"; then
  2265. cat >&2 <<_LT_EOF
  2266. $progname: Version mismatch error. This is $PACKAGE $VERSION, but the
  2267. $progname: definition of this LT_INIT comes from an older release.
  2268. $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
  2269. $progname: and run autoconf again.
  2270. _LT_EOF
  2271. else
  2272. cat >&2 <<_LT_EOF
  2273. $progname: Version mismatch error. This is $PACKAGE $VERSION, but the
  2274. $progname: definition of this LT_INIT comes from $PACKAGE $macro_version.
  2275. $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
  2276. $progname: and run autoconf again.
  2277. _LT_EOF
  2278. fi
  2279. else
  2280. cat >&2 <<_LT_EOF
  2281. $progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision,
  2282. $progname: but the definition of this LT_INIT comes from revision $macro_revision.
  2283. $progname: You should recreate aclocal.m4 with macros from revision $package_revision
  2284. $progname: of $PACKAGE $VERSION and run autoconf again.
  2285. _LT_EOF
  2286. fi
  2287. exit $EXIT_MISMATCH
  2288. fi
  2289. }
  2290. # libtool_options_prep [ARG]...
  2291. # -----------------------------
  2292. # Preparation for options parsed by libtool.
  2293. libtool_options_prep ()
  2294. {
  2295. $debug_mode
  2296. # Option defaults:
  2297. opt_config=false
  2298. opt_dlopen=
  2299. opt_dry_run=false
  2300. opt_help=false
  2301. opt_mode=
  2302. opt_preserve_dup_deps=false
  2303. opt_quiet=false
  2304. nonopt=
  2305. preserve_args=
  2306. _G_rc_lt_options_prep=:
  2307. # Shorthand for --mode=foo, only valid as the first argument
  2308. case $1 in
  2309. clean|clea|cle|cl)
  2310. shift; set dummy --mode clean ${1+"$@"}; shift
  2311. ;;
  2312. compile|compil|compi|comp|com|co|c)
  2313. shift; set dummy --mode compile ${1+"$@"}; shift
  2314. ;;
  2315. execute|execut|execu|exec|exe|ex|e)
  2316. shift; set dummy --mode execute ${1+"$@"}; shift
  2317. ;;
  2318. finish|finis|fini|fin|fi|f)
  2319. shift; set dummy --mode finish ${1+"$@"}; shift
  2320. ;;
  2321. install|instal|insta|inst|ins|in|i)
  2322. shift; set dummy --mode install ${1+"$@"}; shift
  2323. ;;
  2324. link|lin|li|l)
  2325. shift; set dummy --mode link ${1+"$@"}; shift
  2326. ;;
  2327. uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u)
  2328. shift; set dummy --mode uninstall ${1+"$@"}; shift
  2329. ;;
  2330. *)
  2331. _G_rc_lt_options_prep=false
  2332. ;;
  2333. esac
  2334. if $_G_rc_lt_options_prep; then
  2335. # Pass back the list of options.
  2336. func_quote_for_eval ${1+"$@"}
  2337. libtool_options_prep_result=$func_quote_for_eval_result
  2338. fi
  2339. $_G_rc_lt_options_prep
  2340. }
  2341. func_add_hook func_options_prep libtool_options_prep
  2342. # libtool_parse_options [ARG]...
  2343. # ---------------------------------
  2344. # Provide handling for libtool specific options.
  2345. libtool_parse_options ()
  2346. {
  2347. $debug_cmd
  2348. _G_rc_lt_parse_options=false
  2349. # Perform our own loop to consume as many options as possible in
  2350. # each iteration.
  2351. while test $# -gt 0; do
  2352. _G_match_lt_parse_options=:
  2353. _G_opt=$1
  2354. shift
  2355. case $_G_opt in
  2356. --dry-run|--dryrun|-n)
  2357. opt_dry_run=:
  2358. ;;
  2359. --config) func_config ;;
  2360. --dlopen|-dlopen)
  2361. opt_dlopen="${opt_dlopen+$opt_dlopen
  2362. }$1"
  2363. shift
  2364. ;;
  2365. --preserve-dup-deps)
  2366. opt_preserve_dup_deps=: ;;
  2367. --features) func_features ;;
  2368. --finish) set dummy --mode finish ${1+"$@"}; shift ;;
  2369. --help) opt_help=: ;;
  2370. --help-all) opt_help=': help-all' ;;
  2371. --mode) test $# = 0 && func_missing_arg $_G_opt && break
  2372. opt_mode=$1
  2373. case $1 in
  2374. # Valid mode arguments:
  2375. clean|compile|execute|finish|install|link|relink|uninstall) ;;
  2376. # Catch anything else as an error
  2377. *) func_error "invalid argument for $_G_opt"
  2378. exit_cmd=exit
  2379. break
  2380. ;;
  2381. esac
  2382. shift
  2383. ;;
  2384. --no-silent|--no-quiet)
  2385. opt_quiet=false
  2386. func_append preserve_args " $_G_opt"
  2387. ;;
  2388. --no-warnings|--no-warning|--no-warn)
  2389. opt_warning=false
  2390. func_append preserve_args " $_G_opt"
  2391. ;;
  2392. --no-verbose)
  2393. opt_verbose=false
  2394. func_append preserve_args " $_G_opt"
  2395. ;;
  2396. --silent|--quiet)
  2397. opt_quiet=:
  2398. opt_verbose=false
  2399. func_append preserve_args " $_G_opt"
  2400. ;;
  2401. --tag) test $# = 0 && func_missing_arg $_G_opt && break
  2402. opt_tag=$1
  2403. func_append preserve_args " $_G_opt $1"
  2404. func_enable_tag "$1"
  2405. shift
  2406. ;;
  2407. --verbose|-v) opt_quiet=false
  2408. opt_verbose=:
  2409. func_append preserve_args " $_G_opt"
  2410. ;;
  2411. # An option not handled by this hook function:
  2412. *) set dummy "$_G_opt" ${1+"$@"} ; shift
  2413. _G_match_lt_parse_options=false
  2414. break
  2415. ;;
  2416. esac
  2417. $_G_match_lt_parse_options && _G_rc_lt_parse_options=:
  2418. done
  2419. if $_G_rc_lt_parse_options; then
  2420. # save modified positional parameters for caller
  2421. func_quote_for_eval ${1+"$@"}
  2422. libtool_parse_options_result=$func_quote_for_eval_result
  2423. fi
  2424. $_G_rc_lt_parse_options
  2425. }
  2426. func_add_hook func_parse_options libtool_parse_options
  2427. # libtool_validate_options [ARG]...
  2428. # ---------------------------------
  2429. # Perform any sanity checks on option settings and/or unconsumed
  2430. # arguments.
  2431. libtool_validate_options ()
  2432. {
  2433. # save first non-option argument
  2434. if test 0 -lt $#; then
  2435. nonopt=$1
  2436. shift
  2437. fi
  2438. # preserve --debug
  2439. test : = "$debug_cmd" || func_append preserve_args " --debug"
  2440. case $host in
  2441. # Solaris2 added to fix http://debbugs.gnu.org/cgi/bugreport.cgi?bug=16452
  2442. # see also: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59788
  2443. *cygwin* | *mingw* | *pw32* | *cegcc* | *solaris2* | *os2*)
  2444. # don't eliminate duplications in $postdeps and $predeps
  2445. opt_duplicate_compiler_generated_deps=:
  2446. ;;
  2447. *)
  2448. opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps
  2449. ;;
  2450. esac
  2451. $opt_help || {
  2452. # Sanity checks first:
  2453. func_check_version_match
  2454. test yes != "$build_libtool_libs" \
  2455. && test yes != "$build_old_libs" \
  2456. && func_fatal_configuration "not configured to build any kind of library"
  2457. # Darwin sucks
  2458. eval std_shrext=\"$shrext_cmds\"
  2459. # Only execute mode is allowed to have -dlopen flags.
  2460. if test -n "$opt_dlopen" && test execute != "$opt_mode"; then
  2461. func_error "unrecognized option '-dlopen'"
  2462. $ECHO "$help" 1>&2
  2463. exit $EXIT_FAILURE
  2464. fi
  2465. # Change the help message to a mode-specific one.
  2466. generic_help=$help
  2467. help="Try '$progname --help --mode=$opt_mode' for more information."
  2468. }
  2469. # Pass back the unparsed argument list
  2470. func_quote_for_eval ${1+"$@"}
  2471. libtool_validate_options_result=$func_quote_for_eval_result
  2472. }
  2473. func_add_hook func_validate_options libtool_validate_options
  2474. # Process options as early as possible so that --help and --version
  2475. # can return quickly.
  2476. func_options ${1+"$@"}
  2477. eval set dummy "$func_options_result"; shift
  2478. ## ----------- ##
  2479. ## Main. ##
  2480. ## ----------- ##
  2481. magic='%%%MAGIC variable%%%'
  2482. magic_exe='%%%MAGIC EXE variable%%%'
  2483. # Global variables.
  2484. extracted_archives=
  2485. extracted_serial=0
  2486. # If this variable is set in any of the actions, the command in it
  2487. # will be execed at the end. This prevents here-documents from being
  2488. # left over by shells.
  2489. exec_cmd=
  2490. # A function that is used when there is no print builtin or printf.
  2491. func_fallback_echo ()
  2492. {
  2493. eval 'cat <<_LTECHO_EOF
  2494. $1
  2495. _LTECHO_EOF'
  2496. }
  2497. # func_generated_by_libtool
  2498. # True iff stdin has been generated by Libtool. This function is only
  2499. # a basic sanity check; it will hardly flush out determined imposters.
  2500. func_generated_by_libtool_p ()
  2501. {
  2502. $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1
  2503. }
  2504. # func_lalib_p file
  2505. # True iff FILE is a libtool '.la' library or '.lo' object file.
  2506. # This function is only a basic sanity check; it will hardly flush out
  2507. # determined imposters.
  2508. func_lalib_p ()
  2509. {
  2510. test -f "$1" &&
  2511. $SED -e 4q "$1" 2>/dev/null | func_generated_by_libtool_p
  2512. }
  2513. # func_lalib_unsafe_p file
  2514. # True iff FILE is a libtool '.la' library or '.lo' object file.
  2515. # This function implements the same check as func_lalib_p without
  2516. # resorting to external programs. To this end, it redirects stdin and
  2517. # closes it afterwards, without saving the original file descriptor.
  2518. # As a safety measure, use it only where a negative result would be
  2519. # fatal anyway. Works if 'file' does not exist.
  2520. func_lalib_unsafe_p ()
  2521. {
  2522. lalib_p=no
  2523. if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then
  2524. for lalib_p_l in 1 2 3 4
  2525. do
  2526. read lalib_p_line
  2527. case $lalib_p_line in
  2528. \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;;
  2529. esac
  2530. done
  2531. exec 0<&5 5<&-
  2532. fi
  2533. test yes = "$lalib_p"
  2534. }
  2535. # func_ltwrapper_script_p file
  2536. # True iff FILE is a libtool wrapper script
  2537. # This function is only a basic sanity check; it will hardly flush out
  2538. # determined imposters.
  2539. func_ltwrapper_script_p ()
  2540. {
  2541. test -f "$1" &&
  2542. $lt_truncate_bin < "$1" 2>/dev/null | func_generated_by_libtool_p
  2543. }
  2544. # func_ltwrapper_executable_p file
  2545. # True iff FILE is a libtool wrapper executable
  2546. # This function is only a basic sanity check; it will hardly flush out
  2547. # determined imposters.
  2548. func_ltwrapper_executable_p ()
  2549. {
  2550. func_ltwrapper_exec_suffix=
  2551. case $1 in
  2552. *.exe) ;;
  2553. *) func_ltwrapper_exec_suffix=.exe ;;
  2554. esac
  2555. $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1
  2556. }
  2557. # func_ltwrapper_scriptname file
  2558. # Assumes file is an ltwrapper_executable
  2559. # uses $file to determine the appropriate filename for a
  2560. # temporary ltwrapper_script.
  2561. func_ltwrapper_scriptname ()
  2562. {
  2563. func_dirname_and_basename "$1" "" "."
  2564. func_stripname '' '.exe' "$func_basename_result"
  2565. func_ltwrapper_scriptname_result=$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper
  2566. }
  2567. # func_ltwrapper_p file
  2568. # True iff FILE is a libtool wrapper script or wrapper executable
  2569. # This function is only a basic sanity check; it will hardly flush out
  2570. # determined imposters.
  2571. func_ltwrapper_p ()
  2572. {
  2573. func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1"
  2574. }
  2575. # func_execute_cmds commands fail_cmd
  2576. # Execute tilde-delimited COMMANDS.
  2577. # If FAIL_CMD is given, eval that upon failure.
  2578. # FAIL_CMD may read-access the current command in variable CMD!
  2579. func_execute_cmds ()
  2580. {
  2581. $debug_cmd
  2582. save_ifs=$IFS; IFS='~'
  2583. for cmd in $1; do
  2584. IFS=$sp$nl
  2585. eval cmd=\"$cmd\"
  2586. IFS=$save_ifs
  2587. func_show_eval "$cmd" "${2-:}"
  2588. done
  2589. IFS=$save_ifs
  2590. }
  2591. # func_source file
  2592. # Source FILE, adding directory component if necessary.
  2593. # Note that it is not necessary on cygwin/mingw to append a dot to
  2594. # FILE even if both FILE and FILE.exe exist: automatic-append-.exe
  2595. # behavior happens only for exec(3), not for open(2)! Also, sourcing
  2596. # 'FILE.' does not work on cygwin managed mounts.
  2597. func_source ()
  2598. {
  2599. $debug_cmd
  2600. case $1 in
  2601. */* | *\\*) . "$1" ;;
  2602. *) . "./$1" ;;
  2603. esac
  2604. }
  2605. # func_resolve_sysroot PATH
  2606. # Replace a leading = in PATH with a sysroot. Store the result into
  2607. # func_resolve_sysroot_result
  2608. func_resolve_sysroot ()
  2609. {
  2610. func_resolve_sysroot_result=$1
  2611. case $func_resolve_sysroot_result in
  2612. =*)
  2613. func_stripname '=' '' "$func_resolve_sysroot_result"
  2614. func_resolve_sysroot_result=$lt_sysroot$func_stripname_result
  2615. ;;
  2616. esac
  2617. }
  2618. # func_replace_sysroot PATH
  2619. # If PATH begins with the sysroot, replace it with = and
  2620. # store the result into func_replace_sysroot_result.
  2621. func_replace_sysroot ()
  2622. {
  2623. case $lt_sysroot:$1 in
  2624. ?*:"$lt_sysroot"*)
  2625. func_stripname "$lt_sysroot" '' "$1"
  2626. func_replace_sysroot_result='='$func_stripname_result
  2627. ;;
  2628. *)
  2629. # Including no sysroot.
  2630. func_replace_sysroot_result=$1
  2631. ;;
  2632. esac
  2633. }
  2634. # func_infer_tag arg
  2635. # Infer tagged configuration to use if any are available and
  2636. # if one wasn't chosen via the "--tag" command line option.
  2637. # Only attempt this if the compiler in the base compile
  2638. # command doesn't match the default compiler.
  2639. # arg is usually of the form 'gcc ...'
  2640. func_infer_tag ()
  2641. {
  2642. $debug_cmd
  2643. if test -n "$available_tags" && test -z "$tagname"; then
  2644. CC_quoted=
  2645. for arg in $CC; do
  2646. func_append_quoted CC_quoted "$arg"
  2647. done
  2648. CC_expanded=`func_echo_all $CC`
  2649. CC_quoted_expanded=`func_echo_all $CC_quoted`
  2650. case $@ in
  2651. # Blanks in the command may have been stripped by the calling shell,
  2652. # but not from the CC environment variable when configure was run.
  2653. " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
  2654. " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;;
  2655. # Blanks at the start of $base_compile will cause this to fail
  2656. # if we don't check for them as well.
  2657. *)
  2658. for z in $available_tags; do
  2659. if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
  2660. # Evaluate the configuration.
  2661. eval "`$SED -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
  2662. CC_quoted=
  2663. for arg in $CC; do
  2664. # Double-quote args containing other shell metacharacters.
  2665. func_append_quoted CC_quoted "$arg"
  2666. done
  2667. CC_expanded=`func_echo_all $CC`
  2668. CC_quoted_expanded=`func_echo_all $CC_quoted`
  2669. case "$@ " in
  2670. " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
  2671. " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*)
  2672. # The compiler in the base compile command matches
  2673. # the one in the tagged configuration.
  2674. # Assume this is the tagged configuration we want.
  2675. tagname=$z
  2676. break
  2677. ;;
  2678. esac
  2679. fi
  2680. done
  2681. # If $tagname still isn't set, then no tagged configuration
  2682. # was found and let the user know that the "--tag" command
  2683. # line option must be used.
  2684. if test -z "$tagname"; then
  2685. func_echo "defaulting to \`CC'"
  2686. func_echo "if this is not correct, specify a tag with \`--tag'"
  2687. # else
  2688. # func_verbose "using $tagname tagged configuration"
  2689. fi
  2690. ;;
  2691. esac
  2692. fi
  2693. }
  2694. # func_write_libtool_object output_name pic_name nonpic_name
  2695. # Create a libtool object file (analogous to a ".la" file),
  2696. # but don't create it if we're doing a dry run.
  2697. func_write_libtool_object ()
  2698. {
  2699. write_libobj=$1
  2700. if test yes = "$build_libtool_libs"; then
  2701. write_lobj=\'$2\'
  2702. else
  2703. write_lobj=none
  2704. fi
  2705. if test yes = "$build_old_libs"; then
  2706. write_oldobj=\'$3\'
  2707. else
  2708. write_oldobj=none
  2709. fi
  2710. $opt_dry_run || {
  2711. cat >${write_libobj}T <<EOF
  2712. # $write_libobj - a libtool object file
  2713. # Generated by $PROGRAM (GNU $PACKAGE) $VERSION
  2714. #
  2715. # Please DO NOT delete this file!
  2716. # It is necessary for linking the library.
  2717. # Name of the PIC object.
  2718. pic_object=$write_lobj
  2719. # Name of the non-PIC object
  2720. non_pic_object=$write_oldobj
  2721. EOF
  2722. $MV "${write_libobj}T" "$write_libobj"
  2723. }
  2724. }
  2725. ##################################################
  2726. # FILE NAME AND PATH CONVERSION HELPER FUNCTIONS #
  2727. ##################################################
  2728. # func_convert_core_file_wine_to_w32 ARG
  2729. # Helper function used by file name conversion functions when $build is *nix,
  2730. # and $host is mingw, cygwin, or some other w32 environment. Relies on a
  2731. # correctly configured wine environment available, with the winepath program
  2732. # in $build's $PATH.
  2733. #
  2734. # ARG is the $build file name to be converted to w32 format.
  2735. # Result is available in $func_convert_core_file_wine_to_w32_result, and will
  2736. # be empty on error (or when ARG is empty)
  2737. func_convert_core_file_wine_to_w32 ()
  2738. {
  2739. $debug_cmd
  2740. func_convert_core_file_wine_to_w32_result=$1
  2741. if test -n "$1"; then
  2742. # Unfortunately, winepath does not exit with a non-zero error code, so we
  2743. # are forced to check the contents of stdout. On the other hand, if the
  2744. # command is not found, the shell will set an exit code of 127 and print
  2745. # *an error message* to stdout. So we must check for both error code of
  2746. # zero AND non-empty stdout, which explains the odd construction:
  2747. func_convert_core_file_wine_to_w32_tmp=`winepath -w "$1" 2>/dev/null`
  2748. if test "$?" -eq 0 && test -n "$func_convert_core_file_wine_to_w32_tmp"; then
  2749. func_convert_core_file_wine_to_w32_result=`$ECHO "$func_convert_core_file_wine_to_w32_tmp" |
  2750. $SED -e "$sed_naive_backslashify"`
  2751. else
  2752. func_convert_core_file_wine_to_w32_result=
  2753. fi
  2754. fi
  2755. }
  2756. # end: func_convert_core_file_wine_to_w32
  2757. # func_convert_core_path_wine_to_w32 ARG
  2758. # Helper function used by path conversion functions when $build is *nix, and
  2759. # $host is mingw, cygwin, or some other w32 environment. Relies on a correctly
  2760. # configured wine environment available, with the winepath program in $build's
  2761. # $PATH. Assumes ARG has no leading or trailing path separator characters.
  2762. #
  2763. # ARG is path to be converted from $build format to win32.
  2764. # Result is available in $func_convert_core_path_wine_to_w32_result.
  2765. # Unconvertible file (directory) names in ARG are skipped; if no directory names
  2766. # are convertible, then the result may be empty.
  2767. func_convert_core_path_wine_to_w32 ()
  2768. {
  2769. $debug_cmd
  2770. # unfortunately, winepath doesn't convert paths, only file names
  2771. func_convert_core_path_wine_to_w32_result=
  2772. if test -n "$1"; then
  2773. oldIFS=$IFS
  2774. IFS=:
  2775. for func_convert_core_path_wine_to_w32_f in $1; do
  2776. IFS=$oldIFS
  2777. func_convert_core_file_wine_to_w32 "$func_convert_core_path_wine_to_w32_f"
  2778. if test -n "$func_convert_core_file_wine_to_w32_result"; then
  2779. if test -z "$func_convert_core_path_wine_to_w32_result"; then
  2780. func_convert_core_path_wine_to_w32_result=$func_convert_core_file_wine_to_w32_result
  2781. else
  2782. func_append func_convert_core_path_wine_to_w32_result ";$func_convert_core_file_wine_to_w32_result"
  2783. fi
  2784. fi
  2785. done
  2786. IFS=$oldIFS
  2787. fi
  2788. }
  2789. # end: func_convert_core_path_wine_to_w32
  2790. # func_cygpath ARGS...
  2791. # Wrapper around calling the cygpath program via LT_CYGPATH. This is used when
  2792. # when (1) $build is *nix and Cygwin is hosted via a wine environment; or (2)
  2793. # $build is MSYS and $host is Cygwin, or (3) $build is Cygwin. In case (1) or
  2794. # (2), returns the Cygwin file name or path in func_cygpath_result (input
  2795. # file name or path is assumed to be in w32 format, as previously converted
  2796. # from $build's *nix or MSYS format). In case (3), returns the w32 file name
  2797. # or path in func_cygpath_result (input file name or path is assumed to be in
  2798. # Cygwin format). Returns an empty string on error.
  2799. #
  2800. # ARGS are passed to cygpath, with the last one being the file name or path to
  2801. # be converted.
  2802. #
  2803. # Specify the absolute *nix (or w32) name to cygpath in the LT_CYGPATH
  2804. # environment variable; do not put it in $PATH.
  2805. func_cygpath ()
  2806. {
  2807. $debug_cmd
  2808. if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then
  2809. func_cygpath_result=`$LT_CYGPATH "$@" 2>/dev/null`
  2810. if test "$?" -ne 0; then
  2811. # on failure, ensure result is empty
  2812. func_cygpath_result=
  2813. fi
  2814. else
  2815. func_cygpath_result=
  2816. func_error "LT_CYGPATH is empty or specifies non-existent file: '$LT_CYGPATH'"
  2817. fi
  2818. }
  2819. #end: func_cygpath
  2820. # func_convert_core_msys_to_w32 ARG
  2821. # Convert file name or path ARG from MSYS format to w32 format. Return
  2822. # result in func_convert_core_msys_to_w32_result.
  2823. func_convert_core_msys_to_w32 ()
  2824. {
  2825. $debug_cmd
  2826. # awkward: cmd appends spaces to result
  2827. func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null |
  2828. $SED -e 's/[ ]*$//' -e "$sed_naive_backslashify"`
  2829. }
  2830. #end: func_convert_core_msys_to_w32
  2831. # func_convert_file_check ARG1 ARG2
  2832. # Verify that ARG1 (a file name in $build format) was converted to $host
  2833. # format in ARG2. Otherwise, emit an error message, but continue (resetting
  2834. # func_to_host_file_result to ARG1).
  2835. func_convert_file_check ()
  2836. {
  2837. $debug_cmd
  2838. if test -z "$2" && test -n "$1"; then
  2839. func_error "Could not determine host file name corresponding to"
  2840. func_error " '$1'"
  2841. func_error "Continuing, but uninstalled executables may not work."
  2842. # Fallback:
  2843. func_to_host_file_result=$1
  2844. fi
  2845. }
  2846. # end func_convert_file_check
  2847. # func_convert_path_check FROM_PATHSEP TO_PATHSEP FROM_PATH TO_PATH
  2848. # Verify that FROM_PATH (a path in $build format) was converted to $host
  2849. # format in TO_PATH. Otherwise, emit an error message, but continue, resetting
  2850. # func_to_host_file_result to a simplistic fallback value (see below).
  2851. func_convert_path_check ()
  2852. {
  2853. $debug_cmd
  2854. if test -z "$4" && test -n "$3"; then
  2855. func_error "Could not determine the host path corresponding to"
  2856. func_error " '$3'"
  2857. func_error "Continuing, but uninstalled executables may not work."
  2858. # Fallback. This is a deliberately simplistic "conversion" and
  2859. # should not be "improved". See libtool.info.
  2860. if test "x$1" != "x$2"; then
  2861. lt_replace_pathsep_chars="s|$1|$2|g"
  2862. func_to_host_path_result=`echo "$3" |
  2863. $SED -e "$lt_replace_pathsep_chars"`
  2864. else
  2865. func_to_host_path_result=$3
  2866. fi
  2867. fi
  2868. }
  2869. # end func_convert_path_check
  2870. # func_convert_path_front_back_pathsep FRONTPAT BACKPAT REPL ORIG
  2871. # Modifies func_to_host_path_result by prepending REPL if ORIG matches FRONTPAT
  2872. # and appending REPL if ORIG matches BACKPAT.
  2873. func_convert_path_front_back_pathsep ()
  2874. {
  2875. $debug_cmd
  2876. case $4 in
  2877. $1 ) func_to_host_path_result=$3$func_to_host_path_result
  2878. ;;
  2879. esac
  2880. case $4 in
  2881. $2 ) func_append func_to_host_path_result "$3"
  2882. ;;
  2883. esac
  2884. }
  2885. # end func_convert_path_front_back_pathsep
  2886. ##################################################
  2887. # $build to $host FILE NAME CONVERSION FUNCTIONS #
  2888. ##################################################
  2889. # invoked via '$to_host_file_cmd ARG'
  2890. #
  2891. # In each case, ARG is the path to be converted from $build to $host format.
  2892. # Result will be available in $func_to_host_file_result.
  2893. # func_to_host_file ARG
  2894. # Converts the file name ARG from $build format to $host format. Return result
  2895. # in func_to_host_file_result.
  2896. func_to_host_file ()
  2897. {
  2898. $debug_cmd
  2899. $to_host_file_cmd "$1"
  2900. }
  2901. # end func_to_host_file
  2902. # func_to_tool_file ARG LAZY
  2903. # converts the file name ARG from $build format to toolchain format. Return
  2904. # result in func_to_tool_file_result. If the conversion in use is listed
  2905. # in (the comma separated) LAZY, no conversion takes place.
  2906. func_to_tool_file ()
  2907. {
  2908. $debug_cmd
  2909. case ,$2, in
  2910. *,"$to_tool_file_cmd",*)
  2911. func_to_tool_file_result=$1
  2912. ;;
  2913. *)
  2914. $to_tool_file_cmd "$1"
  2915. func_to_tool_file_result=$func_to_host_file_result
  2916. ;;
  2917. esac
  2918. }
  2919. # end func_to_tool_file
  2920. # func_convert_file_noop ARG
  2921. # Copy ARG to func_to_host_file_result.
  2922. func_convert_file_noop ()
  2923. {
  2924. func_to_host_file_result=$1
  2925. }
  2926. # end func_convert_file_noop
  2927. # func_convert_file_msys_to_w32 ARG
  2928. # Convert file name ARG from (mingw) MSYS to (mingw) w32 format; automatic
  2929. # conversion to w32 is not available inside the cwrapper. Returns result in
  2930. # func_to_host_file_result.
  2931. func_convert_file_msys_to_w32 ()
  2932. {
  2933. $debug_cmd
  2934. func_to_host_file_result=$1
  2935. if test -n "$1"; then
  2936. func_convert_core_msys_to_w32 "$1"
  2937. func_to_host_file_result=$func_convert_core_msys_to_w32_result
  2938. fi
  2939. func_convert_file_check "$1" "$func_to_host_file_result"
  2940. }
  2941. # end func_convert_file_msys_to_w32
  2942. # func_convert_file_cygwin_to_w32 ARG
  2943. # Convert file name ARG from Cygwin to w32 format. Returns result in
  2944. # func_to_host_file_result.
  2945. func_convert_file_cygwin_to_w32 ()
  2946. {
  2947. $debug_cmd
  2948. func_to_host_file_result=$1
  2949. if test -n "$1"; then
  2950. # because $build is cygwin, we call "the" cygpath in $PATH; no need to use
  2951. # LT_CYGPATH in this case.
  2952. func_to_host_file_result=`cygpath -m "$1"`
  2953. fi
  2954. func_convert_file_check "$1" "$func_to_host_file_result"
  2955. }
  2956. # end func_convert_file_cygwin_to_w32
  2957. # func_convert_file_nix_to_w32 ARG
  2958. # Convert file name ARG from *nix to w32 format. Requires a wine environment
  2959. # and a working winepath. Returns result in func_to_host_file_result.
  2960. func_convert_file_nix_to_w32 ()
  2961. {
  2962. $debug_cmd
  2963. func_to_host_file_result=$1
  2964. if test -n "$1"; then
  2965. func_convert_core_file_wine_to_w32 "$1"
  2966. func_to_host_file_result=$func_convert_core_file_wine_to_w32_result
  2967. fi
  2968. func_convert_file_check "$1" "$func_to_host_file_result"
  2969. }
  2970. # end func_convert_file_nix_to_w32
  2971. # func_convert_file_msys_to_cygwin ARG
  2972. # Convert file name ARG from MSYS to Cygwin format. Requires LT_CYGPATH set.
  2973. # Returns result in func_to_host_file_result.
  2974. func_convert_file_msys_to_cygwin ()
  2975. {
  2976. $debug_cmd
  2977. func_to_host_file_result=$1
  2978. if test -n "$1"; then
  2979. func_convert_core_msys_to_w32 "$1"
  2980. func_cygpath -u "$func_convert_core_msys_to_w32_result"
  2981. func_to_host_file_result=$func_cygpath_result
  2982. fi
  2983. func_convert_file_check "$1" "$func_to_host_file_result"
  2984. }
  2985. # end func_convert_file_msys_to_cygwin
  2986. # func_convert_file_nix_to_cygwin ARG
  2987. # Convert file name ARG from *nix to Cygwin format. Requires Cygwin installed
  2988. # in a wine environment, working winepath, and LT_CYGPATH set. Returns result
  2989. # in func_to_host_file_result.
  2990. func_convert_file_nix_to_cygwin ()
  2991. {
  2992. $debug_cmd
  2993. func_to_host_file_result=$1
  2994. if test -n "$1"; then
  2995. # convert from *nix to w32, then use cygpath to convert from w32 to cygwin.
  2996. func_convert_core_file_wine_to_w32 "$1"
  2997. func_cygpath -u "$func_convert_core_file_wine_to_w32_result"
  2998. func_to_host_file_result=$func_cygpath_result
  2999. fi
  3000. func_convert_file_check "$1" "$func_to_host_file_result"
  3001. }
  3002. # end func_convert_file_nix_to_cygwin
  3003. #############################################
  3004. # $build to $host PATH CONVERSION FUNCTIONS #
  3005. #############################################
  3006. # invoked via '$to_host_path_cmd ARG'
  3007. #
  3008. # In each case, ARG is the path to be converted from $build to $host format.
  3009. # The result will be available in $func_to_host_path_result.
  3010. #
  3011. # Path separators are also converted from $build format to $host format. If
  3012. # ARG begins or ends with a path separator character, it is preserved (but
  3013. # converted to $host format) on output.
  3014. #
  3015. # All path conversion functions are named using the following convention:
  3016. # file name conversion function : func_convert_file_X_to_Y ()
  3017. # path conversion function : func_convert_path_X_to_Y ()
  3018. # where, for any given $build/$host combination the 'X_to_Y' value is the
  3019. # same. If conversion functions are added for new $build/$host combinations,
  3020. # the two new functions must follow this pattern, or func_init_to_host_path_cmd
  3021. # will break.
  3022. # func_init_to_host_path_cmd
  3023. # Ensures that function "pointer" variable $to_host_path_cmd is set to the
  3024. # appropriate value, based on the value of $to_host_file_cmd.
  3025. to_host_path_cmd=
  3026. func_init_to_host_path_cmd ()
  3027. {
  3028. $debug_cmd
  3029. if test -z "$to_host_path_cmd"; then
  3030. func_stripname 'func_convert_file_' '' "$to_host_file_cmd"
  3031. to_host_path_cmd=func_convert_path_$func_stripname_result
  3032. fi
  3033. }
  3034. # func_to_host_path ARG
  3035. # Converts the path ARG from $build format to $host format. Return result
  3036. # in func_to_host_path_result.
  3037. func_to_host_path ()
  3038. {
  3039. $debug_cmd
  3040. func_init_to_host_path_cmd
  3041. $to_host_path_cmd "$1"
  3042. }
  3043. # end func_to_host_path
  3044. # func_convert_path_noop ARG
  3045. # Copy ARG to func_to_host_path_result.
  3046. func_convert_path_noop ()
  3047. {
  3048. func_to_host_path_result=$1
  3049. }
  3050. # end func_convert_path_noop
  3051. # func_convert_path_msys_to_w32 ARG
  3052. # Convert path ARG from (mingw) MSYS to (mingw) w32 format; automatic
  3053. # conversion to w32 is not available inside the cwrapper. Returns result in
  3054. # func_to_host_path_result.
  3055. func_convert_path_msys_to_w32 ()
  3056. {
  3057. $debug_cmd
  3058. func_to_host_path_result=$1
  3059. if test -n "$1"; then
  3060. # Remove leading and trailing path separator characters from ARG. MSYS
  3061. # behavior is inconsistent here; cygpath turns them into '.;' and ';.';
  3062. # and winepath ignores them completely.
  3063. func_stripname : : "$1"
  3064. func_to_host_path_tmp1=$func_stripname_result
  3065. func_convert_core_msys_to_w32 "$func_to_host_path_tmp1"
  3066. func_to_host_path_result=$func_convert_core_msys_to_w32_result
  3067. func_convert_path_check : ";" \
  3068. "$func_to_host_path_tmp1" "$func_to_host_path_result"
  3069. func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
  3070. fi
  3071. }
  3072. # end func_convert_path_msys_to_w32
  3073. # func_convert_path_cygwin_to_w32 ARG
  3074. # Convert path ARG from Cygwin to w32 format. Returns result in
  3075. # func_to_host_file_result.
  3076. func_convert_path_cygwin_to_w32 ()
  3077. {
  3078. $debug_cmd
  3079. func_to_host_path_result=$1
  3080. if test -n "$1"; then
  3081. # See func_convert_path_msys_to_w32:
  3082. func_stripname : : "$1"
  3083. func_to_host_path_tmp1=$func_stripname_result
  3084. func_to_host_path_result=`cygpath -m -p "$func_to_host_path_tmp1"`
  3085. func_convert_path_check : ";" \
  3086. "$func_to_host_path_tmp1" "$func_to_host_path_result"
  3087. func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
  3088. fi
  3089. }
  3090. # end func_convert_path_cygwin_to_w32
  3091. # func_convert_path_nix_to_w32 ARG
  3092. # Convert path ARG from *nix to w32 format. Requires a wine environment and
  3093. # a working winepath. Returns result in func_to_host_file_result.
  3094. func_convert_path_nix_to_w32 ()
  3095. {
  3096. $debug_cmd
  3097. func_to_host_path_result=$1
  3098. if test -n "$1"; then
  3099. # See func_convert_path_msys_to_w32:
  3100. func_stripname : : "$1"
  3101. func_to_host_path_tmp1=$func_stripname_result
  3102. func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1"
  3103. func_to_host_path_result=$func_convert_core_path_wine_to_w32_result
  3104. func_convert_path_check : ";" \
  3105. "$func_to_host_path_tmp1" "$func_to_host_path_result"
  3106. func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
  3107. fi
  3108. }
  3109. # end func_convert_path_nix_to_w32
  3110. # func_convert_path_msys_to_cygwin ARG
  3111. # Convert path ARG from MSYS to Cygwin format. Requires LT_CYGPATH set.
  3112. # Returns result in func_to_host_file_result.
  3113. func_convert_path_msys_to_cygwin ()
  3114. {
  3115. $debug_cmd
  3116. func_to_host_path_result=$1
  3117. if test -n "$1"; then
  3118. # See func_convert_path_msys_to_w32:
  3119. func_stripname : : "$1"
  3120. func_to_host_path_tmp1=$func_stripname_result
  3121. func_convert_core_msys_to_w32 "$func_to_host_path_tmp1"
  3122. func_cygpath -u -p "$func_convert_core_msys_to_w32_result"
  3123. func_to_host_path_result=$func_cygpath_result
  3124. func_convert_path_check : : \
  3125. "$func_to_host_path_tmp1" "$func_to_host_path_result"
  3126. func_convert_path_front_back_pathsep ":*" "*:" : "$1"
  3127. fi
  3128. }
  3129. # end func_convert_path_msys_to_cygwin
  3130. # func_convert_path_nix_to_cygwin ARG
  3131. # Convert path ARG from *nix to Cygwin format. Requires Cygwin installed in a
  3132. # a wine environment, working winepath, and LT_CYGPATH set. Returns result in
  3133. # func_to_host_file_result.
  3134. func_convert_path_nix_to_cygwin ()
  3135. {
  3136. $debug_cmd
  3137. func_to_host_path_result=$1
  3138. if test -n "$1"; then
  3139. # Remove leading and trailing path separator characters from
  3140. # ARG. msys behavior is inconsistent here, cygpath turns them
  3141. # into '.;' and ';.', and winepath ignores them completely.
  3142. func_stripname : : "$1"
  3143. func_to_host_path_tmp1=$func_stripname_result
  3144. func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1"
  3145. func_cygpath -u -p "$func_convert_core_path_wine_to_w32_result"
  3146. func_to_host_path_result=$func_cygpath_result
  3147. func_convert_path_check : : \
  3148. "$func_to_host_path_tmp1" "$func_to_host_path_result"
  3149. func_convert_path_front_back_pathsep ":*" "*:" : "$1"
  3150. fi
  3151. }
  3152. # end func_convert_path_nix_to_cygwin
  3153. # func_dll_def_p FILE
  3154. # True iff FILE is a Windows DLL '.def' file.
  3155. # Keep in sync with _LT_DLL_DEF_P in libtool.m4
  3156. func_dll_def_p ()
  3157. {
  3158. $debug_cmd
  3159. func_dll_def_p_tmp=`$SED -n \
  3160. -e 's/^[ ]*//' \
  3161. -e '/^\(;.*\)*$/d' \
  3162. -e 's/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p' \
  3163. -e q \
  3164. "$1"`
  3165. test DEF = "$func_dll_def_p_tmp"
  3166. }
  3167. # func_mode_compile arg...
  3168. func_mode_compile ()
  3169. {
  3170. $debug_cmd
  3171. # Get the compilation command and the source file.
  3172. base_compile=
  3173. srcfile=$nonopt # always keep a non-empty value in "srcfile"
  3174. suppress_opt=yes
  3175. suppress_output=
  3176. arg_mode=normal
  3177. libobj=
  3178. later=
  3179. pie_flag=
  3180. for arg
  3181. do
  3182. case $arg_mode in
  3183. arg )
  3184. # do not "continue". Instead, add this to base_compile
  3185. lastarg=$arg
  3186. arg_mode=normal
  3187. ;;
  3188. target )
  3189. libobj=$arg
  3190. arg_mode=normal
  3191. continue
  3192. ;;
  3193. normal )
  3194. # Accept any command-line options.
  3195. case $arg in
  3196. -o)
  3197. test -n "$libobj" && \
  3198. func_fatal_error "you cannot specify '-o' more than once"
  3199. arg_mode=target
  3200. continue
  3201. ;;
  3202. -pie | -fpie | -fPIE)
  3203. func_append pie_flag " $arg"
  3204. continue
  3205. ;;
  3206. -shared | -static | -prefer-pic | -prefer-non-pic)
  3207. func_append later " $arg"
  3208. continue
  3209. ;;
  3210. -no-suppress)
  3211. suppress_opt=no
  3212. continue
  3213. ;;
  3214. -Xcompiler)
  3215. arg_mode=arg # the next one goes into the "base_compile" arg list
  3216. continue # The current "srcfile" will either be retained or
  3217. ;; # replaced later. I would guess that would be a bug.
  3218. -Wc,*)
  3219. func_stripname '-Wc,' '' "$arg"
  3220. args=$func_stripname_result
  3221. lastarg=
  3222. save_ifs=$IFS; IFS=,
  3223. for arg in $args; do
  3224. IFS=$save_ifs
  3225. func_append_quoted lastarg "$arg"
  3226. done
  3227. IFS=$save_ifs
  3228. func_stripname ' ' '' "$lastarg"
  3229. lastarg=$func_stripname_result
  3230. # Add the arguments to base_compile.
  3231. func_append base_compile " $lastarg"
  3232. continue
  3233. ;;
  3234. *)
  3235. # Accept the current argument as the source file.
  3236. # The previous "srcfile" becomes the current argument.
  3237. #
  3238. lastarg=$srcfile
  3239. srcfile=$arg
  3240. ;;
  3241. esac # case $arg
  3242. ;;
  3243. esac # case $arg_mode
  3244. # Aesthetically quote the previous argument.
  3245. func_append_quoted base_compile "$lastarg"
  3246. done # for arg
  3247. case $arg_mode in
  3248. arg)
  3249. func_fatal_error "you must specify an argument for -Xcompile"
  3250. ;;
  3251. target)
  3252. func_fatal_error "you must specify a target with '-o'"
  3253. ;;
  3254. *)
  3255. # Get the name of the library object.
  3256. test -z "$libobj" && {
  3257. func_basename "$srcfile"
  3258. libobj=$func_basename_result
  3259. }
  3260. ;;
  3261. esac
  3262. # Recognize several different file suffixes.
  3263. # If the user specifies -o file.o, it is replaced with file.lo
  3264. case $libobj in
  3265. *.[cCFSifmso] | \
  3266. *.ada | *.adb | *.ads | *.asm | \
  3267. *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \
  3268. *.[fF][09]? | *.for | *.java | *.go | *.obj | *.sx | *.cu | *.cup)
  3269. func_xform "$libobj"
  3270. libobj=$func_xform_result
  3271. ;;
  3272. esac
  3273. case $libobj in
  3274. *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;;
  3275. *)
  3276. func_fatal_error "cannot determine name of library object from '$libobj'"
  3277. ;;
  3278. esac
  3279. func_infer_tag $base_compile
  3280. for arg in $later; do
  3281. case $arg in
  3282. -shared)
  3283. test yes = "$build_libtool_libs" \
  3284. || func_fatal_configuration "cannot build a shared library"
  3285. build_old_libs=no
  3286. continue
  3287. ;;
  3288. -static)
  3289. build_libtool_libs=no
  3290. build_old_libs=yes
  3291. continue
  3292. ;;
  3293. -prefer-pic)
  3294. pic_mode=yes
  3295. continue
  3296. ;;
  3297. -prefer-non-pic)
  3298. pic_mode=no
  3299. continue
  3300. ;;
  3301. esac
  3302. done
  3303. func_quote_for_eval "$libobj"
  3304. test "X$libobj" != "X$func_quote_for_eval_result" \
  3305. && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \
  3306. && func_warning "libobj name '$libobj' may not contain shell special characters."
  3307. func_dirname_and_basename "$obj" "/" ""
  3308. objname=$func_basename_result
  3309. xdir=$func_dirname_result
  3310. lobj=$xdir$objdir/$objname
  3311. test -z "$base_compile" && \
  3312. func_fatal_help "you must specify a compilation command"
  3313. # Delete any leftover library objects.
  3314. if test yes = "$build_old_libs"; then
  3315. removelist="$obj $lobj $libobj ${libobj}T"
  3316. else
  3317. removelist="$lobj $libobj ${libobj}T"
  3318. fi
  3319. # On Cygwin there's no "real" PIC flag so we must build both object types
  3320. case $host_os in
  3321. cygwin* | mingw* | pw32* | os2* | cegcc*)
  3322. pic_mode=default
  3323. ;;
  3324. esac
  3325. if test no = "$pic_mode" && test pass_all != "$deplibs_check_method"; then
  3326. # non-PIC code in shared libraries is not supported
  3327. pic_mode=default
  3328. fi
  3329. # Calculate the filename of the output object if compiler does
  3330. # not support -o with -c
  3331. if test no = "$compiler_c_o"; then
  3332. output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.$objext
  3333. lockfile=$output_obj.lock
  3334. else
  3335. output_obj=
  3336. need_locks=no
  3337. lockfile=
  3338. fi
  3339. # Lock this critical section if it is needed
  3340. # We use this script file to make the link, it avoids creating a new file
  3341. if test yes = "$need_locks"; then
  3342. until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
  3343. func_echo "Waiting for $lockfile to be removed"
  3344. sleep 2
  3345. done
  3346. elif test warn = "$need_locks"; then
  3347. if test -f "$lockfile"; then
  3348. $ECHO "\
  3349. *** ERROR, $lockfile exists and contains:
  3350. `cat $lockfile 2>/dev/null`
  3351. This indicates that another process is trying to use the same
  3352. temporary object file, and libtool could not work around it because
  3353. your compiler does not support '-c' and '-o' together. If you
  3354. repeat this compilation, it may succeed, by chance, but you had better
  3355. avoid parallel builds (make -j) in this platform, or get a better
  3356. compiler."
  3357. $opt_dry_run || $RM $removelist
  3358. exit $EXIT_FAILURE
  3359. fi
  3360. func_append removelist " $output_obj"
  3361. $ECHO "$srcfile" > "$lockfile"
  3362. fi
  3363. $opt_dry_run || $RM $removelist
  3364. func_append removelist " $lockfile"
  3365. trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15
  3366. func_to_tool_file "$srcfile" func_convert_file_msys_to_w32
  3367. srcfile=$func_to_tool_file_result
  3368. func_quote_for_eval "$srcfile"
  3369. qsrcfile=$func_quote_for_eval_result
  3370. # Only build a PIC object if we are building libtool libraries.
  3371. if test yes = "$build_libtool_libs"; then
  3372. # Without this assignment, base_compile gets emptied.
  3373. fbsd_hideous_sh_bug=$base_compile
  3374. if test no != "$pic_mode"; then
  3375. command="$base_compile $qsrcfile $pic_flag"
  3376. else
  3377. # Don't build PIC code
  3378. command="$base_compile $qsrcfile"
  3379. fi
  3380. func_mkdir_p "$xdir$objdir"
  3381. if test -z "$output_obj"; then
  3382. # Place PIC objects in $objdir
  3383. func_append command " -o $lobj"
  3384. fi
  3385. func_show_eval_locale "$command" \
  3386. 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE'
  3387. if test warn = "$need_locks" &&
  3388. test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
  3389. $ECHO "\
  3390. *** ERROR, $lockfile contains:
  3391. `cat $lockfile 2>/dev/null`
  3392. but it should contain:
  3393. $srcfile
  3394. This indicates that another process is trying to use the same
  3395. temporary object file, and libtool could not work around it because
  3396. your compiler does not support '-c' and '-o' together. If you
  3397. repeat this compilation, it may succeed, by chance, but you had better
  3398. avoid parallel builds (make -j) in this platform, or get a better
  3399. compiler."
  3400. $opt_dry_run || $RM $removelist
  3401. exit $EXIT_FAILURE
  3402. fi
  3403. # Just move the object if needed, then go on to compile the next one
  3404. if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
  3405. func_show_eval '$MV "$output_obj" "$lobj"' \
  3406. 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
  3407. fi
  3408. # Allow error messages only from the first compilation.
  3409. if test yes = "$suppress_opt"; then
  3410. suppress_output=' >/dev/null 2>&1'
  3411. fi
  3412. fi
  3413. # Only build a position-dependent object if we build old libraries.
  3414. if test yes = "$build_old_libs"; then
  3415. if test yes != "$pic_mode"; then
  3416. # Don't build PIC code
  3417. command="$base_compile $qsrcfile$pie_flag"
  3418. else
  3419. command="$base_compile $qsrcfile $pic_flag"
  3420. fi
  3421. if test yes = "$compiler_c_o"; then
  3422. func_append command " -o $obj"
  3423. fi
  3424. # Suppress compiler output if we already did a PIC compilation.
  3425. func_append command "$suppress_output"
  3426. func_show_eval_locale "$command" \
  3427. '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE'
  3428. if test warn = "$need_locks" &&
  3429. test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
  3430. $ECHO "\
  3431. *** ERROR, $lockfile contains:
  3432. `cat $lockfile 2>/dev/null`
  3433. but it should contain:
  3434. $srcfile
  3435. This indicates that another process is trying to use the same
  3436. temporary object file, and libtool could not work around it because
  3437. your compiler does not support '-c' and '-o' together. If you
  3438. repeat this compilation, it may succeed, by chance, but you had better
  3439. avoid parallel builds (make -j) in this platform, or get a better
  3440. compiler."
  3441. $opt_dry_run || $RM $removelist
  3442. exit $EXIT_FAILURE
  3443. fi
  3444. # Just move the object if needed
  3445. if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
  3446. func_show_eval '$MV "$output_obj" "$obj"' \
  3447. 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
  3448. fi
  3449. fi
  3450. $opt_dry_run || {
  3451. func_write_libtool_object "$libobj" "$objdir/$objname" "$objname"
  3452. # Unlock the critical section if it was locked
  3453. if test no != "$need_locks"; then
  3454. removelist=$lockfile
  3455. $RM "$lockfile"
  3456. fi
  3457. }
  3458. exit $EXIT_SUCCESS
  3459. }
  3460. $opt_help || {
  3461. test compile = "$opt_mode" && func_mode_compile ${1+"$@"}
  3462. }
  3463. func_mode_help ()
  3464. {
  3465. # We need to display help for each of the modes.
  3466. case $opt_mode in
  3467. "")
  3468. # Generic help is extracted from the usage comments
  3469. # at the start of this file.
  3470. func_help
  3471. ;;
  3472. clean)
  3473. $ECHO \
  3474. "Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
  3475. Remove files from the build directory.
  3476. RM is the name of the program to use to delete files associated with each FILE
  3477. (typically '/bin/rm'). RM-OPTIONS are options (such as '-f') to be passed
  3478. to RM.
  3479. If FILE is a libtool library, object or program, all the files associated
  3480. with it are deleted. Otherwise, only FILE itself is deleted using RM."
  3481. ;;
  3482. compile)
  3483. $ECHO \
  3484. "Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
  3485. Compile a source file into a libtool library object.
  3486. This mode accepts the following additional options:
  3487. -o OUTPUT-FILE set the output file name to OUTPUT-FILE
  3488. -no-suppress do not suppress compiler output for multiple passes
  3489. -prefer-pic try to build PIC objects only
  3490. -prefer-non-pic try to build non-PIC objects only
  3491. -shared do not build a '.o' file suitable for static linking
  3492. -static only build a '.o' file suitable for static linking
  3493. -Wc,FLAG pass FLAG directly to the compiler
  3494. COMPILE-COMMAND is a command to be used in creating a 'standard' object file
  3495. from the given SOURCEFILE.
  3496. The output file name is determined by removing the directory component from
  3497. SOURCEFILE, then substituting the C source code suffix '.c' with the
  3498. library object suffix, '.lo'."
  3499. ;;
  3500. execute)
  3501. $ECHO \
  3502. "Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]...
  3503. Automatically set library path, then run a program.
  3504. This mode accepts the following additional options:
  3505. -dlopen FILE add the directory containing FILE to the library path
  3506. This mode sets the library path environment variable according to '-dlopen'
  3507. flags.
  3508. If any of the ARGS are libtool executable wrappers, then they are translated
  3509. into their corresponding uninstalled binary, and any of their required library
  3510. directories are added to the library path.
  3511. Then, COMMAND is executed, with ARGS as arguments."
  3512. ;;
  3513. finish)
  3514. $ECHO \
  3515. "Usage: $progname [OPTION]... --mode=finish [LIBDIR]...
  3516. Complete the installation of libtool libraries.
  3517. Each LIBDIR is a directory that contains libtool libraries.
  3518. The commands that this mode executes may require superuser privileges. Use
  3519. the '--dry-run' option if you just want to see what would be executed."
  3520. ;;
  3521. install)
  3522. $ECHO \
  3523. "Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND...
  3524. Install executables or libraries.
  3525. INSTALL-COMMAND is the installation command. The first component should be
  3526. either the 'install' or 'cp' program.
  3527. The following components of INSTALL-COMMAND are treated specially:
  3528. -inst-prefix-dir PREFIX-DIR Use PREFIX-DIR as a staging area for installation
  3529. The rest of the components are interpreted as arguments to that command (only
  3530. BSD-compatible install options are recognized)."
  3531. ;;
  3532. link)
  3533. $ECHO \
  3534. "Usage: $progname [OPTION]... --mode=link LINK-COMMAND...
  3535. Link object files or libraries together to form another library, or to
  3536. create an executable program.
  3537. LINK-COMMAND is a command using the C compiler that you would use to create
  3538. a program from several object files.
  3539. The following components of LINK-COMMAND are treated specially:
  3540. -all-static do not do any dynamic linking at all
  3541. -avoid-version do not add a version suffix if possible
  3542. -bindir BINDIR specify path to binaries directory (for systems where
  3543. libraries must be found in the PATH setting at runtime)
  3544. -dlopen FILE '-dlpreopen' FILE if it cannot be dlopened at runtime
  3545. -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
  3546. -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
  3547. -export-symbols SYMFILE
  3548. try to export only the symbols listed in SYMFILE
  3549. -export-symbols-regex REGEX
  3550. try to export only the symbols matching REGEX
  3551. -LLIBDIR search LIBDIR for required installed libraries
  3552. -lNAME OUTPUT-FILE requires the installed library libNAME
  3553. -module build a library that can dlopened
  3554. -no-fast-install disable the fast-install mode
  3555. -no-install link a not-installable executable
  3556. -no-undefined declare that a library does not refer to external symbols
  3557. -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
  3558. -objectlist FILE use a list of object files found in FILE to specify objects
  3559. -os2dllname NAME force a short DLL name on OS/2 (no effect on other OSes)
  3560. -precious-files-regex REGEX
  3561. don't remove output files matching REGEX
  3562. -release RELEASE specify package release information
  3563. -rpath LIBDIR the created library will eventually be installed in LIBDIR
  3564. -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
  3565. -shared only do dynamic linking of libtool libraries
  3566. -shrext SUFFIX override the standard shared library file extension
  3567. -static do not do any dynamic linking of uninstalled libtool libraries
  3568. -static-libtool-libs
  3569. do not do any dynamic linking of libtool libraries
  3570. -version-info CURRENT[:REVISION[:AGE]]
  3571. specify library version info [each variable defaults to 0]
  3572. -weak LIBNAME declare that the target provides the LIBNAME interface
  3573. -Wc,FLAG
  3574. -Xcompiler FLAG pass linker-specific FLAG directly to the compiler
  3575. -Wl,FLAG
  3576. -Xlinker FLAG pass linker-specific FLAG directly to the linker
  3577. -XCClinker FLAG pass link-specific FLAG to the compiler driver (CC)
  3578. All other options (arguments beginning with '-') are ignored.
  3579. Every other argument is treated as a filename. Files ending in '.la' are
  3580. treated as uninstalled libtool libraries, other files are standard or library
  3581. object files.
  3582. If the OUTPUT-FILE ends in '.la', then a libtool library is created,
  3583. only library objects ('.lo' files) may be specified, and '-rpath' is
  3584. required, except when creating a convenience library.
  3585. If OUTPUT-FILE ends in '.a' or '.lib', then a standard library is created
  3586. using 'ar' and 'ranlib', or on Windows using 'lib'.
  3587. If OUTPUT-FILE ends in '.lo' or '.$objext', then a reloadable object file
  3588. is created, otherwise an executable program is created."
  3589. ;;
  3590. uninstall)
  3591. $ECHO \
  3592. "Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
  3593. Remove libraries from an installation directory.
  3594. RM is the name of the program to use to delete files associated with each FILE
  3595. (typically '/bin/rm'). RM-OPTIONS are options (such as '-f') to be passed
  3596. to RM.
  3597. If FILE is a libtool library, all the files associated with it are deleted.
  3598. Otherwise, only FILE itself is deleted using RM."
  3599. ;;
  3600. *)
  3601. func_fatal_help "invalid operation mode '$opt_mode'"
  3602. ;;
  3603. esac
  3604. echo
  3605. $ECHO "Try '$progname --help' for more information about other modes."
  3606. }
  3607. # Now that we've collected a possible --mode arg, show help if necessary
  3608. if $opt_help; then
  3609. if test : = "$opt_help"; then
  3610. func_mode_help
  3611. else
  3612. {
  3613. func_help noexit
  3614. for opt_mode in compile link execute install finish uninstall clean; do
  3615. func_mode_help
  3616. done
  3617. } | $SED -n '1p; 2,$s/^Usage:/ or: /p'
  3618. {
  3619. func_help noexit
  3620. for opt_mode in compile link execute install finish uninstall clean; do
  3621. echo
  3622. func_mode_help
  3623. done
  3624. } |
  3625. $SED '1d
  3626. /^When reporting/,/^Report/{
  3627. H
  3628. d
  3629. }
  3630. $x
  3631. /information about other modes/d
  3632. /more detailed .*MODE/d
  3633. s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/'
  3634. fi
  3635. exit $?
  3636. fi
  3637. # func_mode_execute arg...
  3638. func_mode_execute ()
  3639. {
  3640. $debug_cmd
  3641. # The first argument is the command name.
  3642. cmd=$nonopt
  3643. test -z "$cmd" && \
  3644. func_fatal_help "you must specify a COMMAND"
  3645. # Handle -dlopen flags immediately.
  3646. for file in $opt_dlopen; do
  3647. test -f "$file" \
  3648. || func_fatal_help "'$file' is not a file"
  3649. dir=
  3650. case $file in
  3651. *.la)
  3652. func_resolve_sysroot "$file"
  3653. file=$func_resolve_sysroot_result
  3654. # Check to see that this really is a libtool archive.
  3655. func_lalib_unsafe_p "$file" \
  3656. || func_fatal_help "'$lib' is not a valid libtool archive"
  3657. # Read the libtool library.
  3658. dlname=
  3659. library_names=
  3660. func_source "$file"
  3661. # Skip this library if it cannot be dlopened.
  3662. if test -z "$dlname"; then
  3663. # Warn if it was a shared library.
  3664. test -n "$library_names" && \
  3665. func_warning "'$file' was not linked with '-export-dynamic'"
  3666. continue
  3667. fi
  3668. func_dirname "$file" "" "."
  3669. dir=$func_dirname_result
  3670. if test -f "$dir/$objdir/$dlname"; then
  3671. func_append dir "/$objdir"
  3672. else
  3673. if test ! -f "$dir/$dlname"; then
  3674. func_fatal_error "cannot find '$dlname' in '$dir' or '$dir/$objdir'"
  3675. fi
  3676. fi
  3677. ;;
  3678. *.lo)
  3679. # Just add the directory containing the .lo file.
  3680. func_dirname "$file" "" "."
  3681. dir=$func_dirname_result
  3682. ;;
  3683. *)
  3684. func_warning "'-dlopen' is ignored for non-libtool libraries and objects"
  3685. continue
  3686. ;;
  3687. esac
  3688. # Get the absolute pathname.
  3689. absdir=`cd "$dir" && pwd`
  3690. test -n "$absdir" && dir=$absdir
  3691. # Now add the directory to shlibpath_var.
  3692. if eval "test -z \"\$$shlibpath_var\""; then
  3693. eval "$shlibpath_var=\"\$dir\""
  3694. else
  3695. eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
  3696. fi
  3697. done
  3698. # This variable tells wrapper scripts just to set shlibpath_var
  3699. # rather than running their programs.
  3700. libtool_execute_magic=$magic
  3701. # Check if any of the arguments is a wrapper script.
  3702. args=
  3703. for file
  3704. do
  3705. case $file in
  3706. -* | *.la | *.lo ) ;;
  3707. *)
  3708. # Do a test to see if this is really a libtool program.
  3709. if func_ltwrapper_script_p "$file"; then
  3710. func_source "$file"
  3711. # Transform arg to wrapped name.
  3712. file=$progdir/$program
  3713. elif func_ltwrapper_executable_p "$file"; then
  3714. func_ltwrapper_scriptname "$file"
  3715. func_source "$func_ltwrapper_scriptname_result"
  3716. # Transform arg to wrapped name.
  3717. file=$progdir/$program
  3718. fi
  3719. ;;
  3720. esac
  3721. # Quote arguments (to preserve shell metacharacters).
  3722. func_append_quoted args "$file"
  3723. done
  3724. if $opt_dry_run; then
  3725. # Display what would be done.
  3726. if test -n "$shlibpath_var"; then
  3727. eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\""
  3728. echo "export $shlibpath_var"
  3729. fi
  3730. $ECHO "$cmd$args"
  3731. exit $EXIT_SUCCESS
  3732. else
  3733. if test -n "$shlibpath_var"; then
  3734. # Export the shlibpath_var.
  3735. eval "export $shlibpath_var"
  3736. fi
  3737. # Restore saved environment variables
  3738. for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
  3739. do
  3740. eval "if test \"\${save_$lt_var+set}\" = set; then
  3741. $lt_var=\$save_$lt_var; export $lt_var
  3742. else
  3743. $lt_unset $lt_var
  3744. fi"
  3745. done
  3746. # Now prepare to actually exec the command.
  3747. exec_cmd=\$cmd$args
  3748. fi
  3749. }
  3750. test execute = "$opt_mode" && func_mode_execute ${1+"$@"}
  3751. # func_mode_finish arg...
  3752. func_mode_finish ()
  3753. {
  3754. $debug_cmd
  3755. libs=
  3756. libdirs=
  3757. admincmds=
  3758. for opt in "$nonopt" ${1+"$@"}
  3759. do
  3760. if test -d "$opt"; then
  3761. func_append libdirs " $opt"
  3762. elif test -f "$opt"; then
  3763. if func_lalib_unsafe_p "$opt"; then
  3764. func_append libs " $opt"
  3765. else
  3766. func_warning "'$opt' is not a valid libtool archive"
  3767. fi
  3768. else
  3769. func_fatal_error "invalid argument '$opt'"
  3770. fi
  3771. done
  3772. if test -n "$libs"; then
  3773. if test -n "$lt_sysroot"; then
  3774. sysroot_regex=`$ECHO "$lt_sysroot" | $SED "$sed_make_literal_regex"`
  3775. sysroot_cmd="s/\([ ']\)$sysroot_regex/\1/g;"
  3776. else
  3777. sysroot_cmd=
  3778. fi
  3779. # Remove sysroot references
  3780. if $opt_dry_run; then
  3781. for lib in $libs; do
  3782. echo "removing references to $lt_sysroot and '=' prefixes from $lib"
  3783. done
  3784. else
  3785. tmpdir=`func_mktempdir`
  3786. for lib in $libs; do
  3787. $SED -e "$sysroot_cmd s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \
  3788. > $tmpdir/tmp-la
  3789. mv -f $tmpdir/tmp-la $lib
  3790. done
  3791. ${RM}r "$tmpdir"
  3792. fi
  3793. fi
  3794. if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
  3795. for libdir in $libdirs; do
  3796. if test -n "$finish_cmds"; then
  3797. # Do each command in the finish commands.
  3798. func_execute_cmds "$finish_cmds" 'admincmds="$admincmds
  3799. '"$cmd"'"'
  3800. fi
  3801. if test -n "$finish_eval"; then
  3802. # Do the single finish_eval.
  3803. eval cmds=\"$finish_eval\"
  3804. $opt_dry_run || eval "$cmds" || func_append admincmds "
  3805. $cmds"
  3806. fi
  3807. done
  3808. fi
  3809. # Exit here if they wanted silent mode.
  3810. $opt_quiet && exit $EXIT_SUCCESS
  3811. if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
  3812. echo "----------------------------------------------------------------------"
  3813. echo "Libraries have been installed in:"
  3814. for libdir in $libdirs; do
  3815. $ECHO " $libdir"
  3816. done
  3817. echo
  3818. echo "If you ever happen to want to link against installed libraries"
  3819. echo "in a given directory, LIBDIR, you must either use libtool, and"
  3820. echo "specify the full pathname of the library, or use the '-LLIBDIR'"
  3821. echo "flag during linking and do at least one of the following:"
  3822. if test -n "$shlibpath_var"; then
  3823. echo " - add LIBDIR to the '$shlibpath_var' environment variable"
  3824. echo " during execution"
  3825. fi
  3826. if test -n "$runpath_var"; then
  3827. echo " - add LIBDIR to the '$runpath_var' environment variable"
  3828. echo " during linking"
  3829. fi
  3830. if test -n "$hardcode_libdir_flag_spec"; then
  3831. libdir=LIBDIR
  3832. eval flag=\"$hardcode_libdir_flag_spec\"
  3833. $ECHO " - use the '$flag' linker flag"
  3834. fi
  3835. if test -n "$admincmds"; then
  3836. $ECHO " - have your system administrator run these commands:$admincmds"
  3837. fi
  3838. if test -f /etc/ld.so.conf; then
  3839. echo " - have your system administrator add LIBDIR to '/etc/ld.so.conf'"
  3840. fi
  3841. echo
  3842. echo "See any operating system documentation about shared libraries for"
  3843. case $host in
  3844. solaris2.[6789]|solaris2.1[0-9])
  3845. echo "more information, such as the ld(1), crle(1) and ld.so(8) manual"
  3846. echo "pages."
  3847. ;;
  3848. *)
  3849. echo "more information, such as the ld(1) and ld.so(8) manual pages."
  3850. ;;
  3851. esac
  3852. echo "----------------------------------------------------------------------"
  3853. fi
  3854. exit $EXIT_SUCCESS
  3855. }
  3856. test finish = "$opt_mode" && func_mode_finish ${1+"$@"}
  3857. # func_mode_install arg...
  3858. func_mode_install ()
  3859. {
  3860. $debug_cmd
  3861. # There may be an optional sh(1) argument at the beginning of
  3862. # install_prog (especially on Windows NT).
  3863. if test "$SHELL" = "$nonopt" || test /bin/sh = "$nonopt" ||
  3864. # Allow the use of GNU shtool's install command.
  3865. case $nonopt in *shtool*) :;; *) false;; esac
  3866. then
  3867. # Aesthetically quote it.
  3868. func_quote_for_eval "$nonopt"
  3869. install_prog="$func_quote_for_eval_result "
  3870. arg=$1
  3871. shift
  3872. else
  3873. install_prog=
  3874. arg=$nonopt
  3875. fi
  3876. # The real first argument should be the name of the installation program.
  3877. # Aesthetically quote it.
  3878. func_quote_for_eval "$arg"
  3879. func_append install_prog "$func_quote_for_eval_result"
  3880. install_shared_prog=$install_prog
  3881. case " $install_prog " in
  3882. *[\\\ /]cp\ *) install_cp=: ;;
  3883. *) install_cp=false ;;
  3884. esac
  3885. # We need to accept at least all the BSD install flags.
  3886. dest=
  3887. files=
  3888. opts=
  3889. prev=
  3890. install_type=
  3891. isdir=false
  3892. stripme=
  3893. no_mode=:
  3894. for arg
  3895. do
  3896. arg2=
  3897. if test -n "$dest"; then
  3898. func_append files " $dest"
  3899. dest=$arg
  3900. continue
  3901. fi
  3902. case $arg in
  3903. -d) isdir=: ;;
  3904. -f)
  3905. if $install_cp; then :; else
  3906. prev=$arg
  3907. fi
  3908. ;;
  3909. -g | -m | -o)
  3910. prev=$arg
  3911. ;;
  3912. -s)
  3913. stripme=" -s"
  3914. continue
  3915. ;;
  3916. -*)
  3917. ;;
  3918. *)
  3919. # If the previous option needed an argument, then skip it.
  3920. if test -n "$prev"; then
  3921. if test X-m = "X$prev" && test -n "$install_override_mode"; then
  3922. arg2=$install_override_mode
  3923. no_mode=false
  3924. fi
  3925. prev=
  3926. else
  3927. dest=$arg
  3928. continue
  3929. fi
  3930. ;;
  3931. esac
  3932. # Aesthetically quote the argument.
  3933. func_quote_for_eval "$arg"
  3934. func_append install_prog " $func_quote_for_eval_result"
  3935. if test -n "$arg2"; then
  3936. func_quote_for_eval "$arg2"
  3937. fi
  3938. func_append install_shared_prog " $func_quote_for_eval_result"
  3939. done
  3940. test -z "$install_prog" && \
  3941. func_fatal_help "you must specify an install program"
  3942. test -n "$prev" && \
  3943. func_fatal_help "the '$prev' option requires an argument"
  3944. if test -n "$install_override_mode" && $no_mode; then
  3945. if $install_cp; then :; else
  3946. func_quote_for_eval "$install_override_mode"
  3947. func_append install_shared_prog " -m $func_quote_for_eval_result"
  3948. fi
  3949. fi
  3950. if test -z "$files"; then
  3951. if test -z "$dest"; then
  3952. func_fatal_help "no file or destination specified"
  3953. else
  3954. func_fatal_help "you must specify a destination"
  3955. fi
  3956. fi
  3957. # Strip any trailing slash from the destination.
  3958. func_stripname '' '/' "$dest"
  3959. dest=$func_stripname_result
  3960. # Check to see that the destination is a directory.
  3961. test -d "$dest" && isdir=:
  3962. if $isdir; then
  3963. destdir=$dest
  3964. destname=
  3965. else
  3966. func_dirname_and_basename "$dest" "" "."
  3967. destdir=$func_dirname_result
  3968. destname=$func_basename_result
  3969. # Not a directory, so check to see that there is only one file specified.
  3970. set dummy $files; shift
  3971. test "$#" -gt 1 && \
  3972. func_fatal_help "'$dest' is not a directory"
  3973. fi
  3974. case $destdir in
  3975. [\\/]* | [A-Za-z]:[\\/]*) ;;
  3976. *)
  3977. for file in $files; do
  3978. case $file in
  3979. *.lo) ;;
  3980. *)
  3981. func_fatal_help "'$destdir' must be an absolute directory name"
  3982. ;;
  3983. esac
  3984. done
  3985. ;;
  3986. esac
  3987. # This variable tells wrapper scripts just to set variables rather
  3988. # than running their programs.
  3989. libtool_install_magic=$magic
  3990. staticlibs=
  3991. future_libdirs=
  3992. current_libdirs=
  3993. for file in $files; do
  3994. # Do each installation.
  3995. case $file in
  3996. *.$libext)
  3997. # Do the static libraries later.
  3998. func_append staticlibs " $file"
  3999. ;;
  4000. *.la)
  4001. func_resolve_sysroot "$file"
  4002. file=$func_resolve_sysroot_result
  4003. # Check to see that this really is a libtool archive.
  4004. func_lalib_unsafe_p "$file" \
  4005. || func_fatal_help "'$file' is not a valid libtool archive"
  4006. library_names=
  4007. old_library=
  4008. relink_command=
  4009. func_source "$file"
  4010. # Add the libdir to current_libdirs if it is the destination.
  4011. if test "X$destdir" = "X$libdir"; then
  4012. case "$current_libdirs " in
  4013. *" $libdir "*) ;;
  4014. *) func_append current_libdirs " $libdir" ;;
  4015. esac
  4016. else
  4017. # Note the libdir as a future libdir.
  4018. case "$future_libdirs " in
  4019. *" $libdir "*) ;;
  4020. *) func_append future_libdirs " $libdir" ;;
  4021. esac
  4022. fi
  4023. func_dirname "$file" "/" ""
  4024. dir=$func_dirname_result
  4025. func_append dir "$objdir"
  4026. if test -n "$relink_command"; then
  4027. # Determine the prefix the user has applied to our future dir.
  4028. inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"`
  4029. # Don't allow the user to place us outside of our expected
  4030. # location b/c this prevents finding dependent libraries that
  4031. # are installed to the same prefix.
  4032. # At present, this check doesn't affect windows .dll's that
  4033. # are installed into $libdir/../bin (currently, that works fine)
  4034. # but it's something to keep an eye on.
  4035. #
  4036. # This breaks install into our staging area. -PB
  4037. #
  4038. #test "$inst_prefix_dir" = "$destdir" && \
  4039. # func_fatal_error "error: cannot install '$file' to a directory not ending in $libdir"
  4040. if test -n "$inst_prefix_dir"; then
  4041. # Stick the inst_prefix_dir data into the link command.
  4042. relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
  4043. else
  4044. relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"`
  4045. fi
  4046. func_warning "relinking '$file'"
  4047. func_show_eval "$relink_command" \
  4048. 'func_fatal_error "error: relink '\''$file'\'' with the above command before installing it"'
  4049. fi
  4050. # See the names of the shared library.
  4051. set dummy $library_names; shift
  4052. if test -n "$1"; then
  4053. realname=$1
  4054. shift
  4055. srcname=$realname
  4056. test -n "$relink_command" && srcname=${realname}T
  4057. # Install the shared library and build the symlinks.
  4058. func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \
  4059. 'exit $?'
  4060. tstripme=$stripme
  4061. case $host_os in
  4062. cygwin* | mingw* | pw32* | cegcc*)
  4063. case $realname in
  4064. *.dll.a)
  4065. tstripme=
  4066. ;;
  4067. esac
  4068. ;;
  4069. os2*)
  4070. case $realname in
  4071. *_dll.a)
  4072. tstripme=
  4073. ;;
  4074. esac
  4075. ;;
  4076. esac
  4077. if test -n "$tstripme" && test -n "$striplib"; then
  4078. func_show_eval "$striplib $destdir/$realname" 'exit $?'
  4079. fi
  4080. if test "$#" -gt 0; then
  4081. # Delete the old symlinks, and create new ones.
  4082. # Try 'ln -sf' first, because the 'ln' binary might depend on
  4083. # the symlink we replace! Solaris /bin/ln does not understand -f,
  4084. # so we also need to try rm && ln -s.
  4085. for linkname
  4086. do
  4087. test "$linkname" != "$realname" \
  4088. && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })"
  4089. done
  4090. fi
  4091. # Do each command in the postinstall commands.
  4092. lib=$destdir/$realname
  4093. func_execute_cmds "$postinstall_cmds" 'exit $?'
  4094. fi
  4095. # Install the pseudo-library for information purposes.
  4096. func_basename "$file"
  4097. name=$func_basename_result
  4098. instname=$dir/${name}i
  4099. func_show_eval "$install_prog $instname $destdir/$name" 'exit $?'
  4100. # Maybe install the static library, too.
  4101. test -n "$old_library" && func_append staticlibs " $dir/$old_library"
  4102. ;;
  4103. *.lo)
  4104. # Install (i.e. copy) a libtool object.
  4105. # Figure out destination file name, if it wasn't already specified.
  4106. if test -n "$destname"; then
  4107. destfile=$destdir/$destname
  4108. else
  4109. func_basename "$file"
  4110. destfile=$func_basename_result
  4111. destfile=$destdir/$destfile
  4112. fi
  4113. # Deduce the name of the destination old-style object file.
  4114. case $destfile in
  4115. *.lo)
  4116. func_lo2o "$destfile"
  4117. staticdest=$func_lo2o_result
  4118. ;;
  4119. *.$objext)
  4120. staticdest=$destfile
  4121. destfile=
  4122. ;;
  4123. *)
  4124. func_fatal_help "cannot copy a libtool object to '$destfile'"
  4125. ;;
  4126. esac
  4127. # Install the libtool object if requested.
  4128. test -n "$destfile" && \
  4129. func_show_eval "$install_prog $file $destfile" 'exit $?'
  4130. # Install the old object if enabled.
  4131. if test yes = "$build_old_libs"; then
  4132. # Deduce the name of the old-style object file.
  4133. func_lo2o "$file"
  4134. staticobj=$func_lo2o_result
  4135. func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?'
  4136. fi
  4137. exit $EXIT_SUCCESS
  4138. ;;
  4139. *)
  4140. # Figure out destination file name, if it wasn't already specified.
  4141. if test -n "$destname"; then
  4142. destfile=$destdir/$destname
  4143. else
  4144. func_basename "$file"
  4145. destfile=$func_basename_result
  4146. destfile=$destdir/$destfile
  4147. fi
  4148. # If the file is missing, and there is a .exe on the end, strip it
  4149. # because it is most likely a libtool script we actually want to
  4150. # install
  4151. stripped_ext=
  4152. case $file in
  4153. *.exe)
  4154. if test ! -f "$file"; then
  4155. func_stripname '' '.exe' "$file"
  4156. file=$func_stripname_result
  4157. stripped_ext=.exe
  4158. fi
  4159. ;;
  4160. esac
  4161. # Do a test to see if this is really a libtool program.
  4162. case $host in
  4163. *cygwin* | *mingw*)
  4164. if func_ltwrapper_executable_p "$file"; then
  4165. func_ltwrapper_scriptname "$file"
  4166. wrapper=$func_ltwrapper_scriptname_result
  4167. else
  4168. func_stripname '' '.exe' "$file"
  4169. wrapper=$func_stripname_result
  4170. fi
  4171. ;;
  4172. *)
  4173. wrapper=$file
  4174. ;;
  4175. esac
  4176. if func_ltwrapper_script_p "$wrapper"; then
  4177. notinst_deplibs=
  4178. relink_command=
  4179. func_source "$wrapper"
  4180. # Check the variables that should have been set.
  4181. test -z "$generated_by_libtool_version" && \
  4182. func_fatal_error "invalid libtool wrapper script '$wrapper'"
  4183. finalize=:
  4184. for lib in $notinst_deplibs; do
  4185. # Check to see that each library is installed.
  4186. libdir=
  4187. if test -f "$lib"; then
  4188. func_source "$lib"
  4189. fi
  4190. libfile=$libdir/`$ECHO "$lib" | $SED 's%^.*/%%g'`
  4191. if test -n "$libdir" && test ! -f "$libfile"; then
  4192. func_warning "'$lib' has not been installed in '$libdir'"
  4193. finalize=false
  4194. fi
  4195. done
  4196. relink_command=
  4197. func_source "$wrapper"
  4198. outputname=
  4199. if test no = "$fast_install" && test -n "$relink_command"; then
  4200. $opt_dry_run || {
  4201. if $finalize; then
  4202. tmpdir=`func_mktempdir`
  4203. func_basename "$file$stripped_ext"
  4204. file=$func_basename_result
  4205. outputname=$tmpdir/$file
  4206. # Replace the output file specification.
  4207. relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'`
  4208. $opt_quiet || {
  4209. func_quote_for_expand "$relink_command"
  4210. eval "func_echo $func_quote_for_expand_result"
  4211. }
  4212. if eval "$relink_command"; then :
  4213. else
  4214. func_error "error: relink '$file' with the above command before installing it"
  4215. $opt_dry_run || ${RM}r "$tmpdir"
  4216. continue
  4217. fi
  4218. file=$outputname
  4219. else
  4220. func_warning "cannot relink '$file'"
  4221. fi
  4222. }
  4223. else
  4224. # Install the binary that we compiled earlier.
  4225. file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"`
  4226. fi
  4227. fi
  4228. # remove .exe since cygwin /usr/bin/install will append another
  4229. # one anyway
  4230. case $install_prog,$host in
  4231. */usr/bin/install*,*cygwin*)
  4232. case $file:$destfile in
  4233. *.exe:*.exe)
  4234. # this is ok
  4235. ;;
  4236. *.exe:*)
  4237. destfile=$destfile.exe
  4238. ;;
  4239. *:*.exe)
  4240. func_stripname '' '.exe' "$destfile"
  4241. destfile=$func_stripname_result
  4242. ;;
  4243. esac
  4244. ;;
  4245. esac
  4246. func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?'
  4247. $opt_dry_run || if test -n "$outputname"; then
  4248. ${RM}r "$tmpdir"
  4249. fi
  4250. ;;
  4251. esac
  4252. done
  4253. for file in $staticlibs; do
  4254. func_basename "$file"
  4255. name=$func_basename_result
  4256. # Set up the ranlib parameters.
  4257. oldlib=$destdir/$name
  4258. func_to_tool_file "$oldlib" func_convert_file_msys_to_w32
  4259. tool_oldlib=$func_to_tool_file_result
  4260. func_show_eval "$install_prog \$file \$oldlib" 'exit $?'
  4261. if test -n "$stripme" && test -n "$old_striplib"; then
  4262. func_show_eval "$old_striplib $tool_oldlib" 'exit $?'
  4263. fi
  4264. # Do each command in the postinstall commands.
  4265. func_execute_cmds "$old_postinstall_cmds" 'exit $?'
  4266. done
  4267. test -n "$future_libdirs" && \
  4268. func_warning "remember to run '$progname --finish$future_libdirs'"
  4269. if test -n "$current_libdirs"; then
  4270. # Maybe just do a dry run.
  4271. $opt_dry_run && current_libdirs=" -n$current_libdirs"
  4272. exec_cmd='$SHELL "$progpath" $preserve_args --finish$current_libdirs'
  4273. else
  4274. exit $EXIT_SUCCESS
  4275. fi
  4276. }
  4277. test install = "$opt_mode" && func_mode_install ${1+"$@"}
  4278. # func_generate_dlsyms outputname originator pic_p
  4279. # Extract symbols from dlprefiles and create ${outputname}S.o with
  4280. # a dlpreopen symbol table.
  4281. func_generate_dlsyms ()
  4282. {
  4283. $debug_cmd
  4284. my_outputname=$1
  4285. my_originator=$2
  4286. my_pic_p=${3-false}
  4287. my_prefix=`$ECHO "$my_originator" | $SED 's%[^a-zA-Z0-9]%_%g'`
  4288. my_dlsyms=
  4289. if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then
  4290. if test -n "$NM" && test -n "$global_symbol_pipe"; then
  4291. my_dlsyms=${my_outputname}S.c
  4292. else
  4293. func_error "not configured to extract global symbols from dlpreopened files"
  4294. fi
  4295. fi
  4296. if test -n "$my_dlsyms"; then
  4297. case $my_dlsyms in
  4298. "") ;;
  4299. *.c)
  4300. # Discover the nlist of each of the dlfiles.
  4301. nlist=$output_objdir/$my_outputname.nm
  4302. func_show_eval "$RM $nlist ${nlist}S ${nlist}T"
  4303. # Parse the name list into a source file.
  4304. func_verbose "creating $output_objdir/$my_dlsyms"
  4305. $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\
  4306. /* $my_dlsyms - symbol resolution table for '$my_outputname' dlsym emulation. */
  4307. /* Generated by $PROGRAM (GNU $PACKAGE) $VERSION */
  4308. #ifdef __cplusplus
  4309. extern \"C\" {
  4310. #endif
  4311. #if defined __GNUC__ && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4))
  4312. #pragma GCC diagnostic ignored \"-Wstrict-prototypes\"
  4313. #endif
  4314. /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */
  4315. #if defined _WIN32 || defined __CYGWIN__ || defined _WIN32_WCE
  4316. /* DATA imports from DLLs on WIN32 can't be const, because runtime
  4317. relocations are performed -- see ld's documentation on pseudo-relocs. */
  4318. # define LT_DLSYM_CONST
  4319. #elif defined __osf__
  4320. /* This system does not cope well with relocations in const data. */
  4321. # define LT_DLSYM_CONST
  4322. #else
  4323. # define LT_DLSYM_CONST const
  4324. #endif
  4325. #define STREQ(s1, s2) (strcmp ((s1), (s2)) == 0)
  4326. /* External symbol declarations for the compiler. */\
  4327. "
  4328. if test yes = "$dlself"; then
  4329. func_verbose "generating symbol list for '$output'"
  4330. $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist"
  4331. # Add our own program objects to the symbol list.
  4332. progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP`
  4333. for progfile in $progfiles; do
  4334. func_to_tool_file "$progfile" func_convert_file_msys_to_w32
  4335. func_verbose "extracting global C symbols from '$func_to_tool_file_result'"
  4336. $opt_dry_run || eval "$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'"
  4337. done
  4338. if test -n "$exclude_expsyms"; then
  4339. $opt_dry_run || {
  4340. eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
  4341. eval '$MV "$nlist"T "$nlist"'
  4342. }
  4343. fi
  4344. if test -n "$export_symbols_regex"; then
  4345. $opt_dry_run || {
  4346. eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
  4347. eval '$MV "$nlist"T "$nlist"'
  4348. }
  4349. fi
  4350. # Prepare the list of exported symbols
  4351. if test -z "$export_symbols"; then
  4352. export_symbols=$output_objdir/$outputname.exp
  4353. $opt_dry_run || {
  4354. $RM $export_symbols
  4355. eval "$SED -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
  4356. case $host in
  4357. *cygwin* | *mingw* | *cegcc* )
  4358. eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
  4359. eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
  4360. ;;
  4361. esac
  4362. }
  4363. else
  4364. $opt_dry_run || {
  4365. eval "$SED -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
  4366. eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
  4367. eval '$MV "$nlist"T "$nlist"'
  4368. case $host in
  4369. *cygwin* | *mingw* | *cegcc* )
  4370. eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
  4371. eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
  4372. ;;
  4373. esac
  4374. }
  4375. fi
  4376. fi
  4377. for dlprefile in $dlprefiles; do
  4378. func_verbose "extracting global C symbols from '$dlprefile'"
  4379. func_basename "$dlprefile"
  4380. name=$func_basename_result
  4381. case $host in
  4382. *cygwin* | *mingw* | *cegcc* )
  4383. # if an import library, we need to obtain dlname
  4384. if func_win32_import_lib_p "$dlprefile"; then
  4385. func_tr_sh "$dlprefile"
  4386. eval "curr_lafile=\$libfile_$func_tr_sh_result"
  4387. dlprefile_dlbasename=
  4388. if test -n "$curr_lafile" && func_lalib_p "$curr_lafile"; then
  4389. # Use subshell, to avoid clobbering current variable values
  4390. dlprefile_dlname=`source "$curr_lafile" && echo "$dlname"`
  4391. if test -n "$dlprefile_dlname"; then
  4392. func_basename "$dlprefile_dlname"
  4393. dlprefile_dlbasename=$func_basename_result
  4394. else
  4395. # no lafile. user explicitly requested -dlpreopen <import library>.
  4396. $sharedlib_from_linklib_cmd "$dlprefile"
  4397. dlprefile_dlbasename=$sharedlib_from_linklib_result
  4398. fi
  4399. fi
  4400. $opt_dry_run || {
  4401. if test -n "$dlprefile_dlbasename"; then
  4402. eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"'
  4403. else
  4404. func_warning "Could not compute DLL name from $name"
  4405. eval '$ECHO ": $name " >> "$nlist"'
  4406. fi
  4407. func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
  4408. eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe |
  4409. $SED -e '/I __imp/d' -e 's/I __nm_/D /;s/_nm__//' >> '$nlist'"
  4410. }
  4411. else # not an import lib
  4412. $opt_dry_run || {
  4413. eval '$ECHO ": $name " >> "$nlist"'
  4414. func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
  4415. eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'"
  4416. }
  4417. fi
  4418. ;;
  4419. *)
  4420. $opt_dry_run || {
  4421. eval '$ECHO ": $name " >> "$nlist"'
  4422. func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
  4423. eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'"
  4424. }
  4425. ;;
  4426. esac
  4427. done
  4428. $opt_dry_run || {
  4429. # Make sure we have at least an empty file.
  4430. test -f "$nlist" || : > "$nlist"
  4431. if test -n "$exclude_expsyms"; then
  4432. $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
  4433. $MV "$nlist"T "$nlist"
  4434. fi
  4435. # Try sorting and uniquifying the output.
  4436. if $GREP -v "^: " < "$nlist" |
  4437. if sort -k 3 </dev/null >/dev/null 2>&1; then
  4438. sort -k 3
  4439. else
  4440. sort +2
  4441. fi |
  4442. uniq > "$nlist"S; then
  4443. :
  4444. else
  4445. $GREP -v "^: " < "$nlist" > "$nlist"S
  4446. fi
  4447. if test -f "$nlist"S; then
  4448. eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"'
  4449. else
  4450. echo '/* NONE */' >> "$output_objdir/$my_dlsyms"
  4451. fi
  4452. func_show_eval '$RM "${nlist}I"'
  4453. if test -n "$global_symbol_to_import"; then
  4454. eval "$global_symbol_to_import"' < "$nlist"S > "$nlist"I'
  4455. fi
  4456. echo >> "$output_objdir/$my_dlsyms" "\
  4457. /* The mapping between symbol names and symbols. */
  4458. typedef struct {
  4459. const char *name;
  4460. void *address;
  4461. } lt_dlsymlist;
  4462. extern LT_DLSYM_CONST lt_dlsymlist
  4463. lt_${my_prefix}_LTX_preloaded_symbols[];\
  4464. "
  4465. if test -s "$nlist"I; then
  4466. echo >> "$output_objdir/$my_dlsyms" "\
  4467. static void lt_syminit(void)
  4468. {
  4469. LT_DLSYM_CONST lt_dlsymlist *symbol = lt_${my_prefix}_LTX_preloaded_symbols;
  4470. for (; symbol->name; ++symbol)
  4471. {"
  4472. $SED 's/.*/ if (STREQ (symbol->name, \"&\")) symbol->address = (void *) \&&;/' < "$nlist"I >> "$output_objdir/$my_dlsyms"
  4473. echo >> "$output_objdir/$my_dlsyms" "\
  4474. }
  4475. }"
  4476. fi
  4477. echo >> "$output_objdir/$my_dlsyms" "\
  4478. LT_DLSYM_CONST lt_dlsymlist
  4479. lt_${my_prefix}_LTX_preloaded_symbols[] =
  4480. { {\"$my_originator\", (void *) 0},"
  4481. if test -s "$nlist"I; then
  4482. echo >> "$output_objdir/$my_dlsyms" "\
  4483. {\"@INIT@\", (void *) &lt_syminit},"
  4484. fi
  4485. case $need_lib_prefix in
  4486. no)
  4487. eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms"
  4488. ;;
  4489. *)
  4490. eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms"
  4491. ;;
  4492. esac
  4493. echo >> "$output_objdir/$my_dlsyms" "\
  4494. {0, (void *) 0}
  4495. };
  4496. /* This works around a problem in FreeBSD linker */
  4497. #ifdef FREEBSD_WORKAROUND
  4498. static const void *lt_preloaded_setup() {
  4499. return lt_${my_prefix}_LTX_preloaded_symbols;
  4500. }
  4501. #endif
  4502. #ifdef __cplusplus
  4503. }
  4504. #endif\
  4505. "
  4506. } # !$opt_dry_run
  4507. pic_flag_for_symtable=
  4508. case "$compile_command " in
  4509. *" -static "*) ;;
  4510. *)
  4511. case $host in
  4512. # compiling the symbol table file with pic_flag works around
  4513. # a FreeBSD bug that causes programs to crash when -lm is
  4514. # linked before any other PIC object. But we must not use
  4515. # pic_flag when linking with -static. The problem exists in
  4516. # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
  4517. *-*-freebsd2.*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
  4518. pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;;
  4519. *-*-hpux*)
  4520. pic_flag_for_symtable=" $pic_flag" ;;
  4521. *)
  4522. $my_pic_p && pic_flag_for_symtable=" $pic_flag"
  4523. ;;
  4524. esac
  4525. ;;
  4526. esac
  4527. symtab_cflags=
  4528. for arg in $LTCFLAGS; do
  4529. case $arg in
  4530. -pie | -fpie | -fPIE) ;;
  4531. *) func_append symtab_cflags " $arg" ;;
  4532. esac
  4533. done
  4534. # Now compile the dynamic symbol file.
  4535. func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?'
  4536. # Clean up the generated files.
  4537. func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T" "${nlist}I"'
  4538. # Transform the symbol file into the correct name.
  4539. symfileobj=$output_objdir/${my_outputname}S.$objext
  4540. case $host in
  4541. *cygwin* | *mingw* | *cegcc* )
  4542. if test -f "$output_objdir/$my_outputname.def"; then
  4543. compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
  4544. finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
  4545. else
  4546. compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
  4547. finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
  4548. fi
  4549. ;;
  4550. *)
  4551. compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
  4552. finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
  4553. ;;
  4554. esac
  4555. ;;
  4556. *)
  4557. func_fatal_error "unknown suffix for '$my_dlsyms'"
  4558. ;;
  4559. esac
  4560. else
  4561. # We keep going just in case the user didn't refer to
  4562. # lt_preloaded_symbols. The linker will fail if global_symbol_pipe
  4563. # really was required.
  4564. # Nullify the symbol file.
  4565. compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"`
  4566. finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"`
  4567. fi
  4568. }
  4569. # func_cygming_gnu_implib_p ARG
  4570. # This predicate returns with zero status (TRUE) if
  4571. # ARG is a GNU/binutils-style import library. Returns
  4572. # with nonzero status (FALSE) otherwise.
  4573. func_cygming_gnu_implib_p ()
  4574. {
  4575. $debug_cmd
  4576. func_to_tool_file "$1" func_convert_file_msys_to_w32
  4577. func_cygming_gnu_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $EGREP ' (_head_[A-Za-z0-9_]+_[ad]l*|[A-Za-z0-9_]+_[ad]l*_iname)$'`
  4578. test -n "$func_cygming_gnu_implib_tmp"
  4579. }
  4580. # func_cygming_ms_implib_p ARG
  4581. # This predicate returns with zero status (TRUE) if
  4582. # ARG is an MS-style import library. Returns
  4583. # with nonzero status (FALSE) otherwise.
  4584. func_cygming_ms_implib_p ()
  4585. {
  4586. $debug_cmd
  4587. func_to_tool_file "$1" func_convert_file_msys_to_w32
  4588. func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'`
  4589. test -n "$func_cygming_ms_implib_tmp"
  4590. }
  4591. # func_win32_libid arg
  4592. # return the library type of file 'arg'
  4593. #
  4594. # Need a lot of goo to handle *both* DLLs and import libs
  4595. # Has to be a shell function in order to 'eat' the argument
  4596. # that is supplied when $file_magic_command is called.
  4597. # Despite the name, also deal with 64 bit binaries.
  4598. func_win32_libid ()
  4599. {
  4600. $debug_cmd
  4601. win32_libid_type=unknown
  4602. win32_fileres=`file -L $1 2>/dev/null`
  4603. case $win32_fileres in
  4604. *ar\ archive\ import\ library*) # definitely import
  4605. win32_libid_type="x86 archive import"
  4606. ;;
  4607. *ar\ archive*) # could be an import, or static
  4608. # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD.
  4609. if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null |
  4610. $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then
  4611. case $nm_interface in
  4612. "MS dumpbin")
  4613. if func_cygming_ms_implib_p "$1" ||
  4614. func_cygming_gnu_implib_p "$1"
  4615. then
  4616. win32_nmres=import
  4617. else
  4618. win32_nmres=
  4619. fi
  4620. ;;
  4621. *)
  4622. func_to_tool_file "$1" func_convert_file_msys_to_w32
  4623. win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" |
  4624. $SED -n -e '
  4625. 1,100{
  4626. / I /{
  4627. s|.*|import|
  4628. p
  4629. q
  4630. }
  4631. }'`
  4632. ;;
  4633. esac
  4634. case $win32_nmres in
  4635. import*) win32_libid_type="x86 archive import";;
  4636. *) win32_libid_type="x86 archive static";;
  4637. esac
  4638. fi
  4639. ;;
  4640. *DLL*)
  4641. win32_libid_type="x86 DLL"
  4642. ;;
  4643. *executable*) # but shell scripts are "executable" too...
  4644. case $win32_fileres in
  4645. *MS\ Windows\ PE\ Intel*)
  4646. win32_libid_type="x86 DLL"
  4647. ;;
  4648. esac
  4649. ;;
  4650. esac
  4651. $ECHO "$win32_libid_type"
  4652. }
  4653. # func_cygming_dll_for_implib ARG
  4654. #
  4655. # Platform-specific function to extract the
  4656. # name of the DLL associated with the specified
  4657. # import library ARG.
  4658. # Invoked by eval'ing the libtool variable
  4659. # $sharedlib_from_linklib_cmd
  4660. # Result is available in the variable
  4661. # $sharedlib_from_linklib_result
  4662. func_cygming_dll_for_implib ()
  4663. {
  4664. $debug_cmd
  4665. sharedlib_from_linklib_result=`$DLLTOOL --identify-strict --identify "$1"`
  4666. }
  4667. # func_cygming_dll_for_implib_fallback_core SECTION_NAME LIBNAMEs
  4668. #
  4669. # The is the core of a fallback implementation of a
  4670. # platform-specific function to extract the name of the
  4671. # DLL associated with the specified import library LIBNAME.
  4672. #
  4673. # SECTION_NAME is either .idata$6 or .idata$7, depending
  4674. # on the platform and compiler that created the implib.
  4675. #
  4676. # Echos the name of the DLL associated with the
  4677. # specified import library.
  4678. func_cygming_dll_for_implib_fallback_core ()
  4679. {
  4680. $debug_cmd
  4681. match_literal=`$ECHO "$1" | $SED "$sed_make_literal_regex"`
  4682. $OBJDUMP -s --section "$1" "$2" 2>/dev/null |
  4683. $SED '/^Contents of section '"$match_literal"':/{
  4684. # Place marker at beginning of archive member dllname section
  4685. s/.*/====MARK====/
  4686. p
  4687. d
  4688. }
  4689. # These lines can sometimes be longer than 43 characters, but
  4690. # are always uninteresting
  4691. /:[ ]*file format pe[i]\{,1\}-/d
  4692. /^In archive [^:]*:/d
  4693. # Ensure marker is printed
  4694. /^====MARK====/p
  4695. # Remove all lines with less than 43 characters
  4696. /^.\{43\}/!d
  4697. # From remaining lines, remove first 43 characters
  4698. s/^.\{43\}//' |
  4699. $SED -n '
  4700. # Join marker and all lines until next marker into a single line
  4701. /^====MARK====/ b para
  4702. H
  4703. $ b para
  4704. b
  4705. :para
  4706. x
  4707. s/\n//g
  4708. # Remove the marker
  4709. s/^====MARK====//
  4710. # Remove trailing dots and whitespace
  4711. s/[\. \t]*$//
  4712. # Print
  4713. /./p' |
  4714. # we now have a list, one entry per line, of the stringified
  4715. # contents of the appropriate section of all members of the
  4716. # archive that possess that section. Heuristic: eliminate
  4717. # all those that have a first or second character that is
  4718. # a '.' (that is, objdump's representation of an unprintable
  4719. # character.) This should work for all archives with less than
  4720. # 0x302f exports -- but will fail for DLLs whose name actually
  4721. # begins with a literal '.' or a single character followed by
  4722. # a '.'.
  4723. #
  4724. # Of those that remain, print the first one.
  4725. $SED -e '/^\./d;/^.\./d;q'
  4726. }
  4727. # func_cygming_dll_for_implib_fallback ARG
  4728. # Platform-specific function to extract the
  4729. # name of the DLL associated with the specified
  4730. # import library ARG.
  4731. #
  4732. # This fallback implementation is for use when $DLLTOOL
  4733. # does not support the --identify-strict option.
  4734. # Invoked by eval'ing the libtool variable
  4735. # $sharedlib_from_linklib_cmd
  4736. # Result is available in the variable
  4737. # $sharedlib_from_linklib_result
  4738. func_cygming_dll_for_implib_fallback ()
  4739. {
  4740. $debug_cmd
  4741. if func_cygming_gnu_implib_p "$1"; then
  4742. # binutils import library
  4743. sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$7' "$1"`
  4744. elif func_cygming_ms_implib_p "$1"; then
  4745. # ms-generated import library
  4746. sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$6' "$1"`
  4747. else
  4748. # unknown
  4749. sharedlib_from_linklib_result=
  4750. fi
  4751. }
  4752. # func_extract_an_archive dir oldlib
  4753. func_extract_an_archive ()
  4754. {
  4755. $debug_cmd
  4756. f_ex_an_ar_dir=$1; shift
  4757. f_ex_an_ar_oldlib=$1
  4758. if test yes = "$lock_old_archive_extraction"; then
  4759. lockfile=$f_ex_an_ar_oldlib.lock
  4760. until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
  4761. func_echo "Waiting for $lockfile to be removed"
  4762. sleep 2
  4763. done
  4764. fi
  4765. func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \
  4766. 'stat=$?; rm -f "$lockfile"; exit $stat'
  4767. if test yes = "$lock_old_archive_extraction"; then
  4768. $opt_dry_run || rm -f "$lockfile"
  4769. fi
  4770. if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
  4771. :
  4772. else
  4773. func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib"
  4774. fi
  4775. }
  4776. # func_extract_archives gentop oldlib ...
  4777. func_extract_archives ()
  4778. {
  4779. $debug_cmd
  4780. my_gentop=$1; shift
  4781. my_oldlibs=${1+"$@"}
  4782. my_oldobjs=
  4783. my_xlib=
  4784. my_xabs=
  4785. my_xdir=
  4786. for my_xlib in $my_oldlibs; do
  4787. # Extract the objects.
  4788. case $my_xlib in
  4789. [\\/]* | [A-Za-z]:[\\/]*) my_xabs=$my_xlib ;;
  4790. *) my_xabs=`pwd`"/$my_xlib" ;;
  4791. esac
  4792. func_basename "$my_xlib"
  4793. my_xlib=$func_basename_result
  4794. my_xlib_u=$my_xlib
  4795. while :; do
  4796. case " $extracted_archives " in
  4797. *" $my_xlib_u "*)
  4798. func_arith $extracted_serial + 1
  4799. extracted_serial=$func_arith_result
  4800. my_xlib_u=lt$extracted_serial-$my_xlib ;;
  4801. *) break ;;
  4802. esac
  4803. done
  4804. extracted_archives="$extracted_archives $my_xlib_u"
  4805. my_xdir=$my_gentop/$my_xlib_u
  4806. func_mkdir_p "$my_xdir"
  4807. case $host in
  4808. *-darwin*)
  4809. func_verbose "Extracting $my_xabs"
  4810. # Do not bother doing anything if just a dry run
  4811. $opt_dry_run || {
  4812. darwin_orig_dir=`pwd`
  4813. cd $my_xdir || exit $?
  4814. darwin_archive=$my_xabs
  4815. darwin_curdir=`pwd`
  4816. func_basename "$darwin_archive"
  4817. darwin_base_archive=$func_basename_result
  4818. darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true`
  4819. if test -n "$darwin_arches"; then
  4820. darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'`
  4821. darwin_arch=
  4822. func_verbose "$darwin_base_archive has multiple architectures $darwin_arches"
  4823. for darwin_arch in $darwin_arches; do
  4824. func_mkdir_p "unfat-$$/$darwin_base_archive-$darwin_arch"
  4825. $LIPO -thin $darwin_arch -output "unfat-$$/$darwin_base_archive-$darwin_arch/$darwin_base_archive" "$darwin_archive"
  4826. cd "unfat-$$/$darwin_base_archive-$darwin_arch"
  4827. func_extract_an_archive "`pwd`" "$darwin_base_archive"
  4828. cd "$darwin_curdir"
  4829. $RM "unfat-$$/$darwin_base_archive-$darwin_arch/$darwin_base_archive"
  4830. done # $darwin_arches
  4831. ## Okay now we've a bunch of thin objects, gotta fatten them up :)
  4832. darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$sed_basename" | sort -u`
  4833. darwin_file=
  4834. darwin_files=
  4835. for darwin_file in $darwin_filelist; do
  4836. darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP`
  4837. $LIPO -create -output "$darwin_file" $darwin_files
  4838. done # $darwin_filelist
  4839. $RM -rf unfat-$$
  4840. cd "$darwin_orig_dir"
  4841. else
  4842. cd $darwin_orig_dir
  4843. func_extract_an_archive "$my_xdir" "$my_xabs"
  4844. fi # $darwin_arches
  4845. } # !$opt_dry_run
  4846. ;;
  4847. *)
  4848. func_extract_an_archive "$my_xdir" "$my_xabs"
  4849. ;;
  4850. esac
  4851. my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP`
  4852. done
  4853. func_extract_archives_result=$my_oldobjs
  4854. }
  4855. # func_emit_wrapper [arg=no]
  4856. #
  4857. # Emit a libtool wrapper script on stdout.
  4858. # Don't directly open a file because we may want to
  4859. # incorporate the script contents within a cygwin/mingw
  4860. # wrapper executable. Must ONLY be called from within
  4861. # func_mode_link because it depends on a number of variables
  4862. # set therein.
  4863. #
  4864. # ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR
  4865. # variable will take. If 'yes', then the emitted script
  4866. # will assume that the directory where it is stored is
  4867. # the $objdir directory. This is a cygwin/mingw-specific
  4868. # behavior.
  4869. func_emit_wrapper ()
  4870. {
  4871. func_emit_wrapper_arg1=${1-no}
  4872. $ECHO "\
  4873. #! $SHELL
  4874. # $output - temporary wrapper script for $objdir/$outputname
  4875. # Generated by $PROGRAM (GNU $PACKAGE) $VERSION
  4876. #
  4877. # The $output program cannot be directly executed until all the libtool
  4878. # libraries that it depends on are installed.
  4879. #
  4880. # This wrapper script should never be moved out of the build directory.
  4881. # If it is, it will not operate correctly.
  4882. # Sed substitution that helps us do robust quoting. It backslashifies
  4883. # metacharacters that are still active within double-quoted strings.
  4884. sed_quote_subst='$sed_quote_subst'
  4885. # Be Bourne compatible
  4886. if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
  4887. emulate sh
  4888. NULLCMD=:
  4889. # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
  4890. # is contrary to our usage. Disable this feature.
  4891. alias -g '\${1+\"\$@\"}'='\"\$@\"'
  4892. setopt NO_GLOB_SUBST
  4893. else
  4894. case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
  4895. fi
  4896. BIN_SH=xpg4; export BIN_SH # for Tru64
  4897. DUALCASE=1; export DUALCASE # for MKS sh
  4898. # The HP-UX ksh and POSIX shell print the target directory to stdout
  4899. # if CDPATH is set.
  4900. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
  4901. relink_command=\"$relink_command\"
  4902. # This environment variable determines our operation mode.
  4903. if test \"\$libtool_install_magic\" = \"$magic\"; then
  4904. # install mode needs the following variables:
  4905. generated_by_libtool_version='$macro_version'
  4906. notinst_deplibs='$notinst_deplibs'
  4907. else
  4908. # When we are sourced in execute mode, \$file and \$ECHO are already set.
  4909. if test \"\$libtool_execute_magic\" != \"$magic\"; then
  4910. file=\"\$0\""
  4911. qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"`
  4912. $ECHO "\
  4913. # A function that is used when there is no print builtin or printf.
  4914. func_fallback_echo ()
  4915. {
  4916. eval 'cat <<_LTECHO_EOF
  4917. \$1
  4918. _LTECHO_EOF'
  4919. }
  4920. ECHO=\"$qECHO\"
  4921. fi
  4922. # Very basic option parsing. These options are (a) specific to
  4923. # the libtool wrapper, (b) are identical between the wrapper
  4924. # /script/ and the wrapper /executable/ that is used only on
  4925. # windows platforms, and (c) all begin with the string "--lt-"
  4926. # (application programs are unlikely to have options that match
  4927. # this pattern).
  4928. #
  4929. # There are only two supported options: --lt-debug and
  4930. # --lt-dump-script. There is, deliberately, no --lt-help.
  4931. #
  4932. # The first argument to this parsing function should be the
  4933. # script's $0 value, followed by "$@".
  4934. lt_option_debug=
  4935. func_parse_lt_options ()
  4936. {
  4937. lt_script_arg0=\$0
  4938. shift
  4939. for lt_opt
  4940. do
  4941. case \"\$lt_opt\" in
  4942. --lt-debug) lt_option_debug=1 ;;
  4943. --lt-dump-script)
  4944. lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\`
  4945. test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=.
  4946. lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\`
  4947. cat \"\$lt_dump_D/\$lt_dump_F\"
  4948. exit 0
  4949. ;;
  4950. --lt-*)
  4951. \$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2
  4952. exit 1
  4953. ;;
  4954. esac
  4955. done
  4956. # Print the debug banner immediately:
  4957. if test -n \"\$lt_option_debug\"; then
  4958. echo \"$outputname:$output:\$LINENO: libtool wrapper (GNU $PACKAGE) $VERSION\" 1>&2
  4959. fi
  4960. }
  4961. # Used when --lt-debug. Prints its arguments to stdout
  4962. # (redirection is the responsibility of the caller)
  4963. func_lt_dump_args ()
  4964. {
  4965. lt_dump_args_N=1;
  4966. for lt_arg
  4967. do
  4968. \$ECHO \"$outputname:$output:\$LINENO: newargv[\$lt_dump_args_N]: \$lt_arg\"
  4969. lt_dump_args_N=\`expr \$lt_dump_args_N + 1\`
  4970. done
  4971. }
  4972. # Core function for launching the target application
  4973. func_exec_program_core ()
  4974. {
  4975. "
  4976. case $host in
  4977. # Backslashes separate directories on plain windows
  4978. *-*-mingw | *-*-os2* | *-cegcc*)
  4979. $ECHO "\
  4980. if test -n \"\$lt_option_debug\"; then
  4981. \$ECHO \"$outputname:$output:\$LINENO: newargv[0]: \$progdir\\\\\$program\" 1>&2
  4982. func_lt_dump_args \${1+\"\$@\"} 1>&2
  4983. fi
  4984. exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
  4985. "
  4986. ;;
  4987. *)
  4988. $ECHO "\
  4989. if test -n \"\$lt_option_debug\"; then
  4990. \$ECHO \"$outputname:$output:\$LINENO: newargv[0]: \$progdir/\$program\" 1>&2
  4991. func_lt_dump_args \${1+\"\$@\"} 1>&2
  4992. fi
  4993. exec \"\$progdir/\$program\" \${1+\"\$@\"}
  4994. "
  4995. ;;
  4996. esac
  4997. $ECHO "\
  4998. \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2
  4999. exit 1
  5000. }
  5001. # A function to encapsulate launching the target application
  5002. # Strips options in the --lt-* namespace from \$@ and
  5003. # launches target application with the remaining arguments.
  5004. func_exec_program ()
  5005. {
  5006. case \" \$* \" in
  5007. *\\ --lt-*)
  5008. for lt_wr_arg
  5009. do
  5010. case \$lt_wr_arg in
  5011. --lt-*) ;;
  5012. *) set x \"\$@\" \"\$lt_wr_arg\"; shift;;
  5013. esac
  5014. shift
  5015. done ;;
  5016. esac
  5017. func_exec_program_core \${1+\"\$@\"}
  5018. }
  5019. # Parse options
  5020. func_parse_lt_options \"\$0\" \${1+\"\$@\"}
  5021. # Find the directory that this script lives in.
  5022. thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\`
  5023. test \"x\$thisdir\" = \"x\$file\" && thisdir=.
  5024. # Follow symbolic links until we get to the real thisdir.
  5025. file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\`
  5026. while test -n \"\$file\"; do
  5027. destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\`
  5028. # If there was a directory component, then change thisdir.
  5029. if test \"x\$destdir\" != \"x\$file\"; then
  5030. case \"\$destdir\" in
  5031. [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
  5032. *) thisdir=\"\$thisdir/\$destdir\" ;;
  5033. esac
  5034. fi
  5035. file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\`
  5036. file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\`
  5037. done
  5038. # Usually 'no', except on cygwin/mingw when embedded into
  5039. # the cwrapper.
  5040. WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1
  5041. if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then
  5042. # special case for '.'
  5043. if test \"\$thisdir\" = \".\"; then
  5044. thisdir=\`pwd\`
  5045. fi
  5046. # remove .libs from thisdir
  5047. case \"\$thisdir\" in
  5048. *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;;
  5049. $objdir ) thisdir=. ;;
  5050. esac
  5051. fi
  5052. # Try to get the absolute directory name.
  5053. absdir=\`cd \"\$thisdir\" && pwd\`
  5054. test -n \"\$absdir\" && thisdir=\"\$absdir\"
  5055. "
  5056. if test yes = "$fast_install"; then
  5057. $ECHO "\
  5058. program=lt-'$outputname'$exeext
  5059. progdir=\"\$thisdir/$objdir\"
  5060. if test ! -f \"\$progdir/\$program\" ||
  5061. { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | $SED 1q\`; \\
  5062. test \"X\$file\" != \"X\$progdir/\$program\"; }; then
  5063. file=\"\$\$-\$program\"
  5064. if test ! -d \"\$progdir\"; then
  5065. $MKDIR \"\$progdir\"
  5066. else
  5067. $RM \"\$progdir/\$file\"
  5068. fi"
  5069. $ECHO "\
  5070. # relink executable if necessary
  5071. if test -n \"\$relink_command\"; then
  5072. if relink_command_output=\`eval \$relink_command 2>&1\`; then :
  5073. else
  5074. \$ECHO \"\$relink_command_output\" >&2
  5075. $RM \"\$progdir/\$file\"
  5076. exit 1
  5077. fi
  5078. fi
  5079. $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
  5080. { $RM \"\$progdir/\$program\";
  5081. $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; }
  5082. $RM \"\$progdir/\$file\"
  5083. fi"
  5084. else
  5085. $ECHO "\
  5086. program='$outputname'
  5087. progdir=\"\$thisdir/$objdir\"
  5088. "
  5089. fi
  5090. $ECHO "\
  5091. if test -f \"\$progdir/\$program\"; then"
  5092. # fixup the dll searchpath if we need to.
  5093. #
  5094. # Fix the DLL searchpath if we need to. Do this before prepending
  5095. # to shlibpath, because on Windows, both are PATH and uninstalled
  5096. # libraries must come first.
  5097. if test -n "$dllsearchpath"; then
  5098. $ECHO "\
  5099. # Add the dll search path components to the executable PATH
  5100. PATH=$dllsearchpath:\$PATH
  5101. "
  5102. fi
  5103. # Export our shlibpath_var if we have one.
  5104. if test yes = "$shlibpath_overrides_runpath" && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
  5105. $ECHO "\
  5106. # Add our own library path to $shlibpath_var
  5107. $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
  5108. # Some systems cannot cope with colon-terminated $shlibpath_var
  5109. # The second colon is a workaround for a bug in BeOS R4 sed
  5110. $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\`
  5111. export $shlibpath_var
  5112. "
  5113. fi
  5114. $ECHO "\
  5115. if test \"\$libtool_execute_magic\" != \"$magic\"; then
  5116. # Run the actual program with our arguments.
  5117. func_exec_program \${1+\"\$@\"}
  5118. fi
  5119. else
  5120. # The program doesn't exist.
  5121. \$ECHO \"\$0: error: '\$progdir/\$program' does not exist\" 1>&2
  5122. \$ECHO \"This script is just a wrapper for \$program.\" 1>&2
  5123. \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2
  5124. exit 1
  5125. fi
  5126. fi\
  5127. "
  5128. }
  5129. # func_emit_cwrapperexe_src
  5130. # emit the source code for a wrapper executable on stdout
  5131. # Must ONLY be called from within func_mode_link because
  5132. # it depends on a number of variable set therein.
  5133. func_emit_cwrapperexe_src ()
  5134. {
  5135. cat <<EOF
  5136. /* $cwrappersource - temporary wrapper executable for $objdir/$outputname
  5137. Generated by $PROGRAM (GNU $PACKAGE) $VERSION
  5138. The $output program cannot be directly executed until all the libtool
  5139. libraries that it depends on are installed.
  5140. This wrapper executable should never be moved out of the build directory.
  5141. If it is, it will not operate correctly.
  5142. */
  5143. EOF
  5144. cat <<"EOF"
  5145. #ifdef _MSC_VER
  5146. # define _CRT_SECURE_NO_DEPRECATE 1
  5147. #endif
  5148. #include <stdio.h>
  5149. #include <stdlib.h>
  5150. #ifdef _MSC_VER
  5151. # include <direct.h>
  5152. # include <process.h>
  5153. # include <io.h>
  5154. #else
  5155. # include <unistd.h>
  5156. # include <stdint.h>
  5157. # ifdef __CYGWIN__
  5158. # include <io.h>
  5159. # endif
  5160. #endif
  5161. #include <malloc.h>
  5162. #include <stdarg.h>
  5163. #include <assert.h>
  5164. #include <string.h>
  5165. #include <ctype.h>
  5166. #include <errno.h>
  5167. #include <fcntl.h>
  5168. #include <sys/stat.h>
  5169. #define STREQ(s1, s2) (strcmp ((s1), (s2)) == 0)
  5170. /* declarations of non-ANSI functions */
  5171. #if defined __MINGW32__
  5172. # ifdef __STRICT_ANSI__
  5173. int _putenv (const char *);
  5174. # endif
  5175. #elif defined __CYGWIN__
  5176. # ifdef __STRICT_ANSI__
  5177. char *realpath (const char *, char *);
  5178. int putenv (char *);
  5179. int setenv (const char *, const char *, int);
  5180. # endif
  5181. /* #elif defined other_platform || defined ... */
  5182. #endif
  5183. /* portability defines, excluding path handling macros */
  5184. #if defined _MSC_VER
  5185. # define setmode _setmode
  5186. # define stat _stat
  5187. # define chmod _chmod
  5188. # define getcwd _getcwd
  5189. # define putenv _putenv
  5190. # define S_IXUSR _S_IEXEC
  5191. #elif defined __MINGW32__
  5192. # define setmode _setmode
  5193. # define stat _stat
  5194. # define chmod _chmod
  5195. # define getcwd _getcwd
  5196. # define putenv _putenv
  5197. #elif defined __CYGWIN__
  5198. # define HAVE_SETENV
  5199. # define FOPEN_WB "wb"
  5200. /* #elif defined other platforms ... */
  5201. #endif
  5202. #if defined PATH_MAX
  5203. # define LT_PATHMAX PATH_MAX
  5204. #elif defined MAXPATHLEN
  5205. # define LT_PATHMAX MAXPATHLEN
  5206. #else
  5207. # define LT_PATHMAX 1024
  5208. #endif
  5209. #ifndef S_IXOTH
  5210. # define S_IXOTH 0
  5211. #endif
  5212. #ifndef S_IXGRP
  5213. # define S_IXGRP 0
  5214. #endif
  5215. /* path handling portability macros */
  5216. #ifndef DIR_SEPARATOR
  5217. # define DIR_SEPARATOR '/'
  5218. # define PATH_SEPARATOR ':'
  5219. #endif
  5220. #if defined _WIN32 || defined __MSDOS__ || defined __DJGPP__ || \
  5221. defined __OS2__
  5222. # define HAVE_DOS_BASED_FILE_SYSTEM
  5223. # define FOPEN_WB "wb"
  5224. # ifndef DIR_SEPARATOR_2
  5225. # define DIR_SEPARATOR_2 '\\'
  5226. # endif
  5227. # ifndef PATH_SEPARATOR_2
  5228. # define PATH_SEPARATOR_2 ';'
  5229. # endif
  5230. #endif
  5231. #ifndef DIR_SEPARATOR_2
  5232. # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
  5233. #else /* DIR_SEPARATOR_2 */
  5234. # define IS_DIR_SEPARATOR(ch) \
  5235. (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
  5236. #endif /* DIR_SEPARATOR_2 */
  5237. #ifndef PATH_SEPARATOR_2
  5238. # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
  5239. #else /* PATH_SEPARATOR_2 */
  5240. # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
  5241. #endif /* PATH_SEPARATOR_2 */
  5242. #ifndef FOPEN_WB
  5243. # define FOPEN_WB "w"
  5244. #endif
  5245. #ifndef _O_BINARY
  5246. # define _O_BINARY 0
  5247. #endif
  5248. #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type)))
  5249. #define XFREE(stale) do { \
  5250. if (stale) { free (stale); stale = 0; } \
  5251. } while (0)
  5252. #if defined LT_DEBUGWRAPPER
  5253. static int lt_debug = 1;
  5254. #else
  5255. static int lt_debug = 0;
  5256. #endif
  5257. const char *program_name = "libtool-wrapper"; /* in case xstrdup fails */
  5258. void *xmalloc (size_t num);
  5259. char *xstrdup (const char *string);
  5260. const char *base_name (const char *name);
  5261. char *find_executable (const char *wrapper);
  5262. char *chase_symlinks (const char *pathspec);
  5263. int make_executable (const char *path);
  5264. int check_executable (const char *path);
  5265. char *strendzap (char *str, const char *pat);
  5266. void lt_debugprintf (const char *file, int line, const char *fmt, ...);
  5267. void lt_fatal (const char *file, int line, const char *message, ...);
  5268. static const char *nonnull (const char *s);
  5269. static const char *nonempty (const char *s);
  5270. void lt_setenv (const char *name, const char *value);
  5271. char *lt_extend_str (const char *orig_value, const char *add, int to_end);
  5272. void lt_update_exe_path (const char *name, const char *value);
  5273. void lt_update_lib_path (const char *name, const char *value);
  5274. char **prepare_spawn (char **argv);
  5275. void lt_dump_script (FILE *f);
  5276. EOF
  5277. cat <<EOF
  5278. #if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 5)
  5279. # define externally_visible volatile
  5280. #else
  5281. # define externally_visible __attribute__((externally_visible)) volatile
  5282. #endif
  5283. externally_visible const char * MAGIC_EXE = "$magic_exe";
  5284. const char * LIB_PATH_VARNAME = "$shlibpath_var";
  5285. EOF
  5286. if test yes = "$shlibpath_overrides_runpath" && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
  5287. func_to_host_path "$temp_rpath"
  5288. cat <<EOF
  5289. const char * LIB_PATH_VALUE = "$func_to_host_path_result";
  5290. EOF
  5291. else
  5292. cat <<"EOF"
  5293. const char * LIB_PATH_VALUE = "";
  5294. EOF
  5295. fi
  5296. if test -n "$dllsearchpath"; then
  5297. func_to_host_path "$dllsearchpath:"
  5298. cat <<EOF
  5299. const char * EXE_PATH_VARNAME = "PATH";
  5300. const char * EXE_PATH_VALUE = "$func_to_host_path_result";
  5301. EOF
  5302. else
  5303. cat <<"EOF"
  5304. const char * EXE_PATH_VARNAME = "";
  5305. const char * EXE_PATH_VALUE = "";
  5306. EOF
  5307. fi
  5308. if test yes = "$fast_install"; then
  5309. cat <<EOF
  5310. const char * TARGET_PROGRAM_NAME = "lt-$outputname"; /* hopefully, no .exe */
  5311. EOF
  5312. else
  5313. cat <<EOF
  5314. const char * TARGET_PROGRAM_NAME = "$outputname"; /* hopefully, no .exe */
  5315. EOF
  5316. fi
  5317. cat <<"EOF"
  5318. #define LTWRAPPER_OPTION_PREFIX "--lt-"
  5319. static const char *ltwrapper_option_prefix = LTWRAPPER_OPTION_PREFIX;
  5320. static const char *dumpscript_opt = LTWRAPPER_OPTION_PREFIX "dump-script";
  5321. static const char *debug_opt = LTWRAPPER_OPTION_PREFIX "debug";
  5322. int
  5323. main (int argc, char *argv[])
  5324. {
  5325. char **newargz;
  5326. int newargc;
  5327. char *tmp_pathspec;
  5328. char *actual_cwrapper_path;
  5329. char *actual_cwrapper_name;
  5330. char *target_name;
  5331. char *lt_argv_zero;
  5332. int rval = 127;
  5333. int i;
  5334. program_name = (char *) xstrdup (base_name (argv[0]));
  5335. newargz = XMALLOC (char *, (size_t) argc + 1);
  5336. /* very simple arg parsing; don't want to rely on getopt
  5337. * also, copy all non cwrapper options to newargz, except
  5338. * argz[0], which is handled differently
  5339. */
  5340. newargc=0;
  5341. for (i = 1; i < argc; i++)
  5342. {
  5343. if (STREQ (argv[i], dumpscript_opt))
  5344. {
  5345. EOF
  5346. case $host in
  5347. *mingw* | *cygwin* )
  5348. # make stdout use "unix" line endings
  5349. echo " setmode(1,_O_BINARY);"
  5350. ;;
  5351. esac
  5352. cat <<"EOF"
  5353. lt_dump_script (stdout);
  5354. return 0;
  5355. }
  5356. if (STREQ (argv[i], debug_opt))
  5357. {
  5358. lt_debug = 1;
  5359. continue;
  5360. }
  5361. if (STREQ (argv[i], ltwrapper_option_prefix))
  5362. {
  5363. /* however, if there is an option in the LTWRAPPER_OPTION_PREFIX
  5364. namespace, but it is not one of the ones we know about and
  5365. have already dealt with, above (inluding dump-script), then
  5366. report an error. Otherwise, targets might begin to believe
  5367. they are allowed to use options in the LTWRAPPER_OPTION_PREFIX
  5368. namespace. The first time any user complains about this, we'll
  5369. need to make LTWRAPPER_OPTION_PREFIX a configure-time option
  5370. or a configure.ac-settable value.
  5371. */
  5372. lt_fatal (__FILE__, __LINE__,
  5373. "unrecognized %s option: '%s'",
  5374. ltwrapper_option_prefix, argv[i]);
  5375. }
  5376. /* otherwise ... */
  5377. newargz[++newargc] = xstrdup (argv[i]);
  5378. }
  5379. newargz[++newargc] = NULL;
  5380. EOF
  5381. cat <<EOF
  5382. /* The GNU banner must be the first non-error debug message */
  5383. lt_debugprintf (__FILE__, __LINE__, "libtool wrapper (GNU $PACKAGE) $VERSION\n");
  5384. EOF
  5385. cat <<"EOF"
  5386. lt_debugprintf (__FILE__, __LINE__, "(main) argv[0]: %s\n", argv[0]);
  5387. lt_debugprintf (__FILE__, __LINE__, "(main) program_name: %s\n", program_name);
  5388. tmp_pathspec = find_executable (argv[0]);
  5389. if (tmp_pathspec == NULL)
  5390. lt_fatal (__FILE__, __LINE__, "couldn't find %s", argv[0]);
  5391. lt_debugprintf (__FILE__, __LINE__,
  5392. "(main) found exe (before symlink chase) at: %s\n",
  5393. tmp_pathspec);
  5394. actual_cwrapper_path = chase_symlinks (tmp_pathspec);
  5395. lt_debugprintf (__FILE__, __LINE__,
  5396. "(main) found exe (after symlink chase) at: %s\n",
  5397. actual_cwrapper_path);
  5398. XFREE (tmp_pathspec);
  5399. actual_cwrapper_name = xstrdup (base_name (actual_cwrapper_path));
  5400. strendzap (actual_cwrapper_path, actual_cwrapper_name);
  5401. /* wrapper name transforms */
  5402. strendzap (actual_cwrapper_name, ".exe");
  5403. tmp_pathspec = lt_extend_str (actual_cwrapper_name, ".exe", 1);
  5404. XFREE (actual_cwrapper_name);
  5405. actual_cwrapper_name = tmp_pathspec;
  5406. tmp_pathspec = 0;
  5407. /* target_name transforms -- use actual target program name; might have lt- prefix */
  5408. target_name = xstrdup (base_name (TARGET_PROGRAM_NAME));
  5409. strendzap (target_name, ".exe");
  5410. tmp_pathspec = lt_extend_str (target_name, ".exe", 1);
  5411. XFREE (target_name);
  5412. target_name = tmp_pathspec;
  5413. tmp_pathspec = 0;
  5414. lt_debugprintf (__FILE__, __LINE__,
  5415. "(main) libtool target name: %s\n",
  5416. target_name);
  5417. EOF
  5418. cat <<EOF
  5419. newargz[0] =
  5420. XMALLOC (char, (strlen (actual_cwrapper_path) +
  5421. strlen ("$objdir") + 1 + strlen (actual_cwrapper_name) + 1));
  5422. strcpy (newargz[0], actual_cwrapper_path);
  5423. strcat (newargz[0], "$objdir");
  5424. strcat (newargz[0], "/");
  5425. EOF
  5426. cat <<"EOF"
  5427. /* stop here, and copy so we don't have to do this twice */
  5428. tmp_pathspec = xstrdup (newargz[0]);
  5429. /* do NOT want the lt- prefix here, so use actual_cwrapper_name */
  5430. strcat (newargz[0], actual_cwrapper_name);
  5431. /* DO want the lt- prefix here if it exists, so use target_name */
  5432. lt_argv_zero = lt_extend_str (tmp_pathspec, target_name, 1);
  5433. XFREE (tmp_pathspec);
  5434. tmp_pathspec = NULL;
  5435. EOF
  5436. case $host_os in
  5437. mingw*)
  5438. cat <<"EOF"
  5439. {
  5440. char* p;
  5441. while ((p = strchr (newargz[0], '\\')) != NULL)
  5442. {
  5443. *p = '/';
  5444. }
  5445. while ((p = strchr (lt_argv_zero, '\\')) != NULL)
  5446. {
  5447. *p = '/';
  5448. }
  5449. }
  5450. EOF
  5451. ;;
  5452. esac
  5453. cat <<"EOF"
  5454. XFREE (target_name);
  5455. XFREE (actual_cwrapper_path);
  5456. XFREE (actual_cwrapper_name);
  5457. lt_setenv ("BIN_SH", "xpg4"); /* for Tru64 */
  5458. lt_setenv ("DUALCASE", "1"); /* for MSK sh */
  5459. /* Update the DLL searchpath. EXE_PATH_VALUE ($dllsearchpath) must
  5460. be prepended before (that is, appear after) LIB_PATH_VALUE ($temp_rpath)
  5461. because on Windows, both *_VARNAMEs are PATH but uninstalled
  5462. libraries must come first. */
  5463. lt_update_exe_path (EXE_PATH_VARNAME, EXE_PATH_VALUE);
  5464. lt_update_lib_path (LIB_PATH_VARNAME, LIB_PATH_VALUE);
  5465. lt_debugprintf (__FILE__, __LINE__, "(main) lt_argv_zero: %s\n",
  5466. nonnull (lt_argv_zero));
  5467. for (i = 0; i < newargc; i++)
  5468. {
  5469. lt_debugprintf (__FILE__, __LINE__, "(main) newargz[%d]: %s\n",
  5470. i, nonnull (newargz[i]));
  5471. }
  5472. EOF
  5473. case $host_os in
  5474. mingw*)
  5475. cat <<"EOF"
  5476. /* execv doesn't actually work on mingw as expected on unix */
  5477. newargz = prepare_spawn (newargz);
  5478. rval = (int) _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz);
  5479. if (rval == -1)
  5480. {
  5481. /* failed to start process */
  5482. lt_debugprintf (__FILE__, __LINE__,
  5483. "(main) failed to launch target \"%s\": %s\n",
  5484. lt_argv_zero, nonnull (strerror (errno)));
  5485. return 127;
  5486. }
  5487. return rval;
  5488. EOF
  5489. ;;
  5490. *)
  5491. cat <<"EOF"
  5492. execv (lt_argv_zero, newargz);
  5493. return rval; /* =127, but avoids unused variable warning */
  5494. EOF
  5495. ;;
  5496. esac
  5497. cat <<"EOF"
  5498. }
  5499. void *
  5500. xmalloc (size_t num)
  5501. {
  5502. void *p = (void *) malloc (num);
  5503. if (!p)
  5504. lt_fatal (__FILE__, __LINE__, "memory exhausted");
  5505. return p;
  5506. }
  5507. char *
  5508. xstrdup (const char *string)
  5509. {
  5510. return string ? strcpy ((char *) xmalloc (strlen (string) + 1),
  5511. string) : NULL;
  5512. }
  5513. const char *
  5514. base_name (const char *name)
  5515. {
  5516. const char *base;
  5517. #if defined HAVE_DOS_BASED_FILE_SYSTEM
  5518. /* Skip over the disk name in MSDOS pathnames. */
  5519. if (isalpha ((unsigned char) name[0]) && name[1] == ':')
  5520. name += 2;
  5521. #endif
  5522. for (base = name; *name; name++)
  5523. if (IS_DIR_SEPARATOR (*name))
  5524. base = name + 1;
  5525. return base;
  5526. }
  5527. int
  5528. check_executable (const char *path)
  5529. {
  5530. struct stat st;
  5531. lt_debugprintf (__FILE__, __LINE__, "(check_executable): %s\n",
  5532. nonempty (path));
  5533. if ((!path) || (!*path))
  5534. return 0;
  5535. if ((stat (path, &st) >= 0)
  5536. && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)))
  5537. return 1;
  5538. else
  5539. return 0;
  5540. }
  5541. int
  5542. make_executable (const char *path)
  5543. {
  5544. int rval = 0;
  5545. struct stat st;
  5546. lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n",
  5547. nonempty (path));
  5548. if ((!path) || (!*path))
  5549. return 0;
  5550. if (stat (path, &st) >= 0)
  5551. {
  5552. rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR);
  5553. }
  5554. return rval;
  5555. }
  5556. /* Searches for the full path of the wrapper. Returns
  5557. newly allocated full path name if found, NULL otherwise
  5558. Does not chase symlinks, even on platforms that support them.
  5559. */
  5560. char *
  5561. find_executable (const char *wrapper)
  5562. {
  5563. int has_slash = 0;
  5564. const char *p;
  5565. const char *p_next;
  5566. /* static buffer for getcwd */
  5567. char tmp[LT_PATHMAX + 1];
  5568. size_t tmp_len;
  5569. char *concat_name;
  5570. lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n",
  5571. nonempty (wrapper));
  5572. if ((wrapper == NULL) || (*wrapper == '\0'))
  5573. return NULL;
  5574. /* Absolute path? */
  5575. #if defined HAVE_DOS_BASED_FILE_SYSTEM
  5576. if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':')
  5577. {
  5578. concat_name = xstrdup (wrapper);
  5579. if (check_executable (concat_name))
  5580. return concat_name;
  5581. XFREE (concat_name);
  5582. }
  5583. else
  5584. {
  5585. #endif
  5586. if (IS_DIR_SEPARATOR (wrapper[0]))
  5587. {
  5588. concat_name = xstrdup (wrapper);
  5589. if (check_executable (concat_name))
  5590. return concat_name;
  5591. XFREE (concat_name);
  5592. }
  5593. #if defined HAVE_DOS_BASED_FILE_SYSTEM
  5594. }
  5595. #endif
  5596. for (p = wrapper; *p; p++)
  5597. if (*p == '/')
  5598. {
  5599. has_slash = 1;
  5600. break;
  5601. }
  5602. if (!has_slash)
  5603. {
  5604. /* no slashes; search PATH */
  5605. const char *path = getenv ("PATH");
  5606. if (path != NULL)
  5607. {
  5608. for (p = path; *p; p = p_next)
  5609. {
  5610. const char *q;
  5611. size_t p_len;
  5612. for (q = p; *q; q++)
  5613. if (IS_PATH_SEPARATOR (*q))
  5614. break;
  5615. p_len = (size_t) (q - p);
  5616. p_next = (*q == '\0' ? q : q + 1);
  5617. if (p_len == 0)
  5618. {
  5619. /* empty path: current directory */
  5620. if (getcwd (tmp, LT_PATHMAX) == NULL)
  5621. lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
  5622. nonnull (strerror (errno)));
  5623. tmp_len = strlen (tmp);
  5624. concat_name =
  5625. XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
  5626. memcpy (concat_name, tmp, tmp_len);
  5627. concat_name[tmp_len] = '/';
  5628. strcpy (concat_name + tmp_len + 1, wrapper);
  5629. }
  5630. else
  5631. {
  5632. concat_name =
  5633. XMALLOC (char, p_len + 1 + strlen (wrapper) + 1);
  5634. memcpy (concat_name, p, p_len);
  5635. concat_name[p_len] = '/';
  5636. strcpy (concat_name + p_len + 1, wrapper);
  5637. }
  5638. if (check_executable (concat_name))
  5639. return concat_name;
  5640. XFREE (concat_name);
  5641. }
  5642. }
  5643. /* not found in PATH; assume curdir */
  5644. }
  5645. /* Relative path | not found in path: prepend cwd */
  5646. if (getcwd (tmp, LT_PATHMAX) == NULL)
  5647. lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
  5648. nonnull (strerror (errno)));
  5649. tmp_len = strlen (tmp);
  5650. concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
  5651. memcpy (concat_name, tmp, tmp_len);
  5652. concat_name[tmp_len] = '/';
  5653. strcpy (concat_name + tmp_len + 1, wrapper);
  5654. if (check_executable (concat_name))
  5655. return concat_name;
  5656. XFREE (concat_name);
  5657. return NULL;
  5658. }
  5659. char *
  5660. chase_symlinks (const char *pathspec)
  5661. {
  5662. #ifndef S_ISLNK
  5663. return xstrdup (pathspec);
  5664. #else
  5665. char buf[LT_PATHMAX];
  5666. struct stat s;
  5667. char *tmp_pathspec = xstrdup (pathspec);
  5668. char *p;
  5669. int has_symlinks = 0;
  5670. while (strlen (tmp_pathspec) && !has_symlinks)
  5671. {
  5672. lt_debugprintf (__FILE__, __LINE__,
  5673. "checking path component for symlinks: %s\n",
  5674. tmp_pathspec);
  5675. if (lstat (tmp_pathspec, &s) == 0)
  5676. {
  5677. if (S_ISLNK (s.st_mode) != 0)
  5678. {
  5679. has_symlinks = 1;
  5680. break;
  5681. }
  5682. /* search backwards for last DIR_SEPARATOR */
  5683. p = tmp_pathspec + strlen (tmp_pathspec) - 1;
  5684. while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
  5685. p--;
  5686. if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
  5687. {
  5688. /* no more DIR_SEPARATORS left */
  5689. break;
  5690. }
  5691. *p = '\0';
  5692. }
  5693. else
  5694. {
  5695. lt_fatal (__FILE__, __LINE__,
  5696. "error accessing file \"%s\": %s",
  5697. tmp_pathspec, nonnull (strerror (errno)));
  5698. }
  5699. }
  5700. XFREE (tmp_pathspec);
  5701. if (!has_symlinks)
  5702. {
  5703. return xstrdup (pathspec);
  5704. }
  5705. tmp_pathspec = realpath (pathspec, buf);
  5706. if (tmp_pathspec == 0)
  5707. {
  5708. lt_fatal (__FILE__, __LINE__,
  5709. "could not follow symlinks for %s", pathspec);
  5710. }
  5711. return xstrdup (tmp_pathspec);
  5712. #endif
  5713. }
  5714. char *
  5715. strendzap (char *str, const char *pat)
  5716. {
  5717. size_t len, patlen;
  5718. assert (str != NULL);
  5719. assert (pat != NULL);
  5720. len = strlen (str);
  5721. patlen = strlen (pat);
  5722. if (patlen <= len)
  5723. {
  5724. str += len - patlen;
  5725. if (STREQ (str, pat))
  5726. *str = '\0';
  5727. }
  5728. return str;
  5729. }
  5730. void
  5731. lt_debugprintf (const char *file, int line, const char *fmt, ...)
  5732. {
  5733. va_list args;
  5734. if (lt_debug)
  5735. {
  5736. (void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line);
  5737. va_start (args, fmt);
  5738. (void) vfprintf (stderr, fmt, args);
  5739. va_end (args);
  5740. }
  5741. }
  5742. static void
  5743. lt_error_core (int exit_status, const char *file,
  5744. int line, const char *mode,
  5745. const char *message, va_list ap)
  5746. {
  5747. fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode);
  5748. vfprintf (stderr, message, ap);
  5749. fprintf (stderr, ".\n");
  5750. if (exit_status >= 0)
  5751. exit (exit_status);
  5752. }
  5753. void
  5754. lt_fatal (const char *file, int line, const char *message, ...)
  5755. {
  5756. va_list ap;
  5757. va_start (ap, message);
  5758. lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap);
  5759. va_end (ap);
  5760. }
  5761. static const char *
  5762. nonnull (const char *s)
  5763. {
  5764. return s ? s : "(null)";
  5765. }
  5766. static const char *
  5767. nonempty (const char *s)
  5768. {
  5769. return (s && !*s) ? "(empty)" : nonnull (s);
  5770. }
  5771. void
  5772. lt_setenv (const char *name, const char *value)
  5773. {
  5774. lt_debugprintf (__FILE__, __LINE__,
  5775. "(lt_setenv) setting '%s' to '%s'\n",
  5776. nonnull (name), nonnull (value));
  5777. {
  5778. #ifdef HAVE_SETENV
  5779. /* always make a copy, for consistency with !HAVE_SETENV */
  5780. char *str = xstrdup (value);
  5781. setenv (name, str, 1);
  5782. #else
  5783. size_t len = strlen (name) + 1 + strlen (value) + 1;
  5784. char *str = XMALLOC (char, len);
  5785. sprintf (str, "%s=%s", name, value);
  5786. if (putenv (str) != EXIT_SUCCESS)
  5787. {
  5788. XFREE (str);
  5789. }
  5790. #endif
  5791. }
  5792. }
  5793. char *
  5794. lt_extend_str (const char *orig_value, const char *add, int to_end)
  5795. {
  5796. char *new_value;
  5797. if (orig_value && *orig_value)
  5798. {
  5799. size_t orig_value_len = strlen (orig_value);
  5800. size_t add_len = strlen (add);
  5801. new_value = XMALLOC (char, add_len + orig_value_len + 1);
  5802. if (to_end)
  5803. {
  5804. strcpy (new_value, orig_value);
  5805. strcpy (new_value + orig_value_len, add);
  5806. }
  5807. else
  5808. {
  5809. strcpy (new_value, add);
  5810. strcpy (new_value + add_len, orig_value);
  5811. }
  5812. }
  5813. else
  5814. {
  5815. new_value = xstrdup (add);
  5816. }
  5817. return new_value;
  5818. }
  5819. void
  5820. lt_update_exe_path (const char *name, const char *value)
  5821. {
  5822. lt_debugprintf (__FILE__, __LINE__,
  5823. "(lt_update_exe_path) modifying '%s' by prepending '%s'\n",
  5824. nonnull (name), nonnull (value));
  5825. if (name && *name && value && *value)
  5826. {
  5827. char *new_value = lt_extend_str (getenv (name), value, 0);
  5828. /* some systems can't cope with a ':'-terminated path #' */
  5829. size_t len = strlen (new_value);
  5830. while ((len > 0) && IS_PATH_SEPARATOR (new_value[len-1]))
  5831. {
  5832. new_value[--len] = '\0';
  5833. }
  5834. lt_setenv (name, new_value);
  5835. XFREE (new_value);
  5836. }
  5837. }
  5838. void
  5839. lt_update_lib_path (const char *name, const char *value)
  5840. {
  5841. lt_debugprintf (__FILE__, __LINE__,
  5842. "(lt_update_lib_path) modifying '%s' by prepending '%s'\n",
  5843. nonnull (name), nonnull (value));
  5844. if (name && *name && value && *value)
  5845. {
  5846. char *new_value = lt_extend_str (getenv (name), value, 0);
  5847. lt_setenv (name, new_value);
  5848. XFREE (new_value);
  5849. }
  5850. }
  5851. EOF
  5852. case $host_os in
  5853. mingw*)
  5854. cat <<"EOF"
  5855. /* Prepares an argument vector before calling spawn().
  5856. Note that spawn() does not by itself call the command interpreter
  5857. (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") :
  5858. ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
  5859. GetVersionEx(&v);
  5860. v.dwPlatformId == VER_PLATFORM_WIN32_NT;
  5861. }) ? "cmd.exe" : "command.com").
  5862. Instead it simply concatenates the arguments, separated by ' ', and calls
  5863. CreateProcess(). We must quote the arguments since Win32 CreateProcess()
  5864. interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a
  5865. special way:
  5866. - Space and tab are interpreted as delimiters. They are not treated as
  5867. delimiters if they are surrounded by double quotes: "...".
  5868. - Unescaped double quotes are removed from the input. Their only effect is
  5869. that within double quotes, space and tab are treated like normal
  5870. characters.
  5871. - Backslashes not followed by double quotes are not special.
  5872. - But 2*n+1 backslashes followed by a double quote become
  5873. n backslashes followed by a double quote (n >= 0):
  5874. \" -> "
  5875. \\\" -> \"
  5876. \\\\\" -> \\"
  5877. */
  5878. #define SHELL_SPECIAL_CHARS "\"\\ \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037"
  5879. #define SHELL_SPACE_CHARS " \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037"
  5880. char **
  5881. prepare_spawn (char **argv)
  5882. {
  5883. size_t argc;
  5884. char **new_argv;
  5885. size_t i;
  5886. /* Count number of arguments. */
  5887. for (argc = 0; argv[argc] != NULL; argc++)
  5888. ;
  5889. /* Allocate new argument vector. */
  5890. new_argv = XMALLOC (char *, argc + 1);
  5891. /* Put quoted arguments into the new argument vector. */
  5892. for (i = 0; i < argc; i++)
  5893. {
  5894. const char *string = argv[i];
  5895. if (string[0] == '\0')
  5896. new_argv[i] = xstrdup ("\"\"");
  5897. else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL)
  5898. {
  5899. int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL);
  5900. size_t length;
  5901. unsigned int backslashes;
  5902. const char *s;
  5903. char *quoted_string;
  5904. char *p;
  5905. length = 0;
  5906. backslashes = 0;
  5907. if (quote_around)
  5908. length++;
  5909. for (s = string; *s != '\0'; s++)
  5910. {
  5911. char c = *s;
  5912. if (c == '"')
  5913. length += backslashes + 1;
  5914. length++;
  5915. if (c == '\\')
  5916. backslashes++;
  5917. else
  5918. backslashes = 0;
  5919. }
  5920. if (quote_around)
  5921. length += backslashes + 1;
  5922. quoted_string = XMALLOC (char, length + 1);
  5923. p = quoted_string;
  5924. backslashes = 0;
  5925. if (quote_around)
  5926. *p++ = '"';
  5927. for (s = string; *s != '\0'; s++)
  5928. {
  5929. char c = *s;
  5930. if (c == '"')
  5931. {
  5932. unsigned int j;
  5933. for (j = backslashes + 1; j > 0; j--)
  5934. *p++ = '\\';
  5935. }
  5936. *p++ = c;
  5937. if (c == '\\')
  5938. backslashes++;
  5939. else
  5940. backslashes = 0;
  5941. }
  5942. if (quote_around)
  5943. {
  5944. unsigned int j;
  5945. for (j = backslashes; j > 0; j--)
  5946. *p++ = '\\';
  5947. *p++ = '"';
  5948. }
  5949. *p = '\0';
  5950. new_argv[i] = quoted_string;
  5951. }
  5952. else
  5953. new_argv[i] = (char *) string;
  5954. }
  5955. new_argv[argc] = NULL;
  5956. return new_argv;
  5957. }
  5958. EOF
  5959. ;;
  5960. esac
  5961. cat <<"EOF"
  5962. void lt_dump_script (FILE* f)
  5963. {
  5964. EOF
  5965. func_emit_wrapper yes |
  5966. $SED -n -e '
  5967. s/^\(.\{79\}\)\(..*\)/\1\
  5968. \2/
  5969. h
  5970. s/\([\\"]\)/\\\1/g
  5971. s/$/\\n/
  5972. s/\([^\n]*\).*/ fputs ("\1", f);/p
  5973. g
  5974. D'
  5975. cat <<"EOF"
  5976. }
  5977. EOF
  5978. }
  5979. # end: func_emit_cwrapperexe_src
  5980. # func_win32_import_lib_p ARG
  5981. # True if ARG is an import lib, as indicated by $file_magic_cmd
  5982. func_win32_import_lib_p ()
  5983. {
  5984. $debug_cmd
  5985. case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in
  5986. *import*) : ;;
  5987. *) false ;;
  5988. esac
  5989. }
  5990. # func_suncc_cstd_abi
  5991. # !!ONLY CALL THIS FOR SUN CC AFTER $compile_command IS FULLY EXPANDED!!
  5992. # Several compiler flags select an ABI that is incompatible with the
  5993. # Cstd library. Avoid specifying it if any are in CXXFLAGS.
  5994. func_suncc_cstd_abi ()
  5995. {
  5996. $debug_cmd
  5997. case " $compile_command " in
  5998. *" -compat=g "*|*\ -std=c++[0-9][0-9]\ *|*" -library=stdcxx4 "*|*" -library=stlport4 "*)
  5999. suncc_use_cstd_abi=no
  6000. ;;
  6001. *)
  6002. suncc_use_cstd_abi=yes
  6003. ;;
  6004. esac
  6005. }
  6006. # func_mode_link arg...
  6007. func_mode_link ()
  6008. {
  6009. $debug_cmd
  6010. case $host in
  6011. *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
  6012. # It is impossible to link a dll without this setting, and
  6013. # we shouldn't force the makefile maintainer to figure out
  6014. # what system we are compiling for in order to pass an extra
  6015. # flag for every libtool invocation.
  6016. # allow_undefined=no
  6017. # FIXME: Unfortunately, there are problems with the above when trying
  6018. # to make a dll that has undefined symbols, in which case not
  6019. # even a static library is built. For now, we need to specify
  6020. # -no-undefined on the libtool link line when we can be certain
  6021. # that all symbols are satisfied, otherwise we get a static library.
  6022. allow_undefined=yes
  6023. ;;
  6024. *)
  6025. allow_undefined=yes
  6026. ;;
  6027. esac
  6028. libtool_args=$nonopt
  6029. base_compile="$nonopt $@"
  6030. compile_command=$nonopt
  6031. finalize_command=$nonopt
  6032. compile_rpath=
  6033. finalize_rpath=
  6034. compile_shlibpath=
  6035. finalize_shlibpath=
  6036. convenience=
  6037. old_convenience=
  6038. deplibs=
  6039. old_deplibs=
  6040. compiler_flags=
  6041. linker_flags=
  6042. dllsearchpath=
  6043. lib_search_path=`pwd`
  6044. inst_prefix_dir=
  6045. new_inherited_linker_flags=
  6046. avoid_version=no
  6047. bindir=
  6048. dlfiles=
  6049. dlprefiles=
  6050. dlself=no
  6051. export_dynamic=no
  6052. export_symbols=
  6053. export_symbols_regex=
  6054. generated=
  6055. libobjs=
  6056. ltlibs=
  6057. module=no
  6058. no_install=no
  6059. objs=
  6060. os2dllname=
  6061. non_pic_objects=
  6062. precious_files_regex=
  6063. prefer_static_libs=no
  6064. preload=false
  6065. prev=
  6066. prevarg=
  6067. release=
  6068. rpath=
  6069. xrpath=
  6070. perm_rpath=
  6071. temp_rpath=
  6072. thread_safe=no
  6073. vinfo=
  6074. vinfo_number=no
  6075. weak_libs=
  6076. single_module=$wl-single_module
  6077. func_infer_tag $base_compile
  6078. # We need to know -static, to get the right output filenames.
  6079. for arg
  6080. do
  6081. case $arg in
  6082. -shared)
  6083. test yes != "$build_libtool_libs" \
  6084. && func_fatal_configuration "cannot build a shared library"
  6085. build_old_libs=no
  6086. break
  6087. ;;
  6088. -all-static | -static | -static-libtool-libs)
  6089. case $arg in
  6090. # Make -static behave like -all-static -GZ
  6091. -all-static | -static)
  6092. if test yes = "$build_libtool_libs" && test -z "$link_static_flag"; then
  6093. func_warning "complete static linking is impossible in this configuration"
  6094. fi
  6095. if test -n "$link_static_flag"; then
  6096. dlopen_self=$dlopen_self_static
  6097. fi
  6098. prefer_static_libs=yes
  6099. ;;
  6100. -static-libtool-libs)
  6101. if test -z "$pic_flag" && test -n "$link_static_flag"; then
  6102. dlopen_self=$dlopen_self_static
  6103. fi
  6104. prefer_static_libs=yes
  6105. ;;
  6106. esac
  6107. build_libtool_libs=no
  6108. build_old_libs=yes
  6109. break
  6110. ;;
  6111. esac
  6112. done
  6113. # See if our shared archives depend on static archives.
  6114. test -n "$old_archive_from_new_cmds" && build_old_libs=yes
  6115. # Go through the arguments, transforming them on the way.
  6116. while test "$#" -gt 0; do
  6117. arg=$1
  6118. shift
  6119. func_quote_for_eval "$arg"
  6120. qarg=$func_quote_for_eval_unquoted_result
  6121. func_append libtool_args " $func_quote_for_eval_result"
  6122. # If the previous option needs an argument, assign it.
  6123. if test -n "$prev"; then
  6124. case $prev in
  6125. output)
  6126. func_append compile_command " @OUTPUT@"
  6127. func_append finalize_command " @OUTPUT@"
  6128. ;;
  6129. esac
  6130. case $prev in
  6131. bindir)
  6132. bindir=$arg
  6133. prev=
  6134. continue
  6135. ;;
  6136. dlfiles|dlprefiles)
  6137. $preload || {
  6138. # Add the symbol object into the linking commands.
  6139. func_append compile_command " @SYMFILE@"
  6140. func_append finalize_command " @SYMFILE@"
  6141. preload=:
  6142. }
  6143. case $arg in
  6144. *.la | *.lo) ;; # We handle these cases below.
  6145. force)
  6146. if test no = "$dlself"; then
  6147. dlself=needless
  6148. export_dynamic=yes
  6149. fi
  6150. prev=
  6151. continue
  6152. ;;
  6153. self)
  6154. if test dlprefiles = "$prev"; then
  6155. dlself=yes
  6156. elif test dlfiles = "$prev" && test yes != "$dlopen_self"; then
  6157. dlself=yes
  6158. else
  6159. dlself=needless
  6160. export_dynamic=yes
  6161. fi
  6162. prev=
  6163. continue
  6164. ;;
  6165. *)
  6166. if test dlfiles = "$prev"; then
  6167. func_append dlfiles " $arg"
  6168. else
  6169. func_append dlprefiles " $arg"
  6170. fi
  6171. prev=
  6172. continue
  6173. ;;
  6174. esac
  6175. ;;
  6176. expsyms)
  6177. export_symbols=$arg
  6178. test -f "$arg" \
  6179. || func_fatal_error "symbol file '$arg' does not exist"
  6180. prev=
  6181. continue
  6182. ;;
  6183. expsyms_regex)
  6184. export_symbols_regex=$arg
  6185. prev=
  6186. continue
  6187. ;;
  6188. framework)
  6189. case $host in
  6190. *-*-darwin*)
  6191. case "$deplibs " in
  6192. *" $qarg.ltframework "*) ;;
  6193. *) func_append deplibs " $qarg.ltframework" # this is fixed later
  6194. ;;
  6195. esac
  6196. ;;
  6197. esac
  6198. prev=
  6199. continue
  6200. ;;
  6201. inst_prefix)
  6202. inst_prefix_dir=$arg
  6203. prev=
  6204. continue
  6205. ;;
  6206. mllvm)
  6207. # Clang does not use LLVM to link, so we can simply discard any
  6208. # '-mllvm $arg' options when doing the link step.
  6209. prev=
  6210. continue
  6211. ;;
  6212. objectlist)
  6213. if test -f "$arg"; then
  6214. save_arg=$arg
  6215. moreargs=
  6216. for fil in `cat "$save_arg"`
  6217. do
  6218. # func_append moreargs " $fil"
  6219. arg=$fil
  6220. # A libtool-controlled object.
  6221. # Check to see that this really is a libtool object.
  6222. if func_lalib_unsafe_p "$arg"; then
  6223. pic_object=
  6224. non_pic_object=
  6225. # Read the .lo file
  6226. func_source "$arg"
  6227. if test -z "$pic_object" ||
  6228. test -z "$non_pic_object" ||
  6229. test none = "$pic_object" &&
  6230. test none = "$non_pic_object"; then
  6231. func_fatal_error "cannot find name of object for '$arg'"
  6232. fi
  6233. # Extract subdirectory from the argument.
  6234. func_dirname "$arg" "/" ""
  6235. xdir=$func_dirname_result
  6236. if test none != "$pic_object"; then
  6237. # Prepend the subdirectory the object is found in.
  6238. pic_object=$xdir$pic_object
  6239. if test dlfiles = "$prev"; then
  6240. if test yes = "$build_libtool_libs" && test yes = "$dlopen_support"; then
  6241. func_append dlfiles " $pic_object"
  6242. prev=
  6243. continue
  6244. else
  6245. # If libtool objects are unsupported, then we need to preload.
  6246. prev=dlprefiles
  6247. fi
  6248. fi
  6249. # CHECK ME: I think I busted this. -Ossama
  6250. if test dlprefiles = "$prev"; then
  6251. # Preload the old-style object.
  6252. func_append dlprefiles " $pic_object"
  6253. prev=
  6254. fi
  6255. # A PIC object.
  6256. func_append libobjs " $pic_object"
  6257. arg=$pic_object
  6258. fi
  6259. # Non-PIC object.
  6260. if test none != "$non_pic_object"; then
  6261. # Prepend the subdirectory the object is found in.
  6262. non_pic_object=$xdir$non_pic_object
  6263. # A standard non-PIC object
  6264. func_append non_pic_objects " $non_pic_object"
  6265. if test -z "$pic_object" || test none = "$pic_object"; then
  6266. arg=$non_pic_object
  6267. fi
  6268. else
  6269. # If the PIC object exists, use it instead.
  6270. # $xdir was prepended to $pic_object above.
  6271. non_pic_object=$pic_object
  6272. func_append non_pic_objects " $non_pic_object"
  6273. fi
  6274. else
  6275. # Only an error if not doing a dry-run.
  6276. if $opt_dry_run; then
  6277. # Extract subdirectory from the argument.
  6278. func_dirname "$arg" "/" ""
  6279. xdir=$func_dirname_result
  6280. func_lo2o "$arg"
  6281. pic_object=$xdir$objdir/$func_lo2o_result
  6282. non_pic_object=$xdir$func_lo2o_result
  6283. func_append libobjs " $pic_object"
  6284. func_append non_pic_objects " $non_pic_object"
  6285. else
  6286. func_fatal_error "'$arg' is not a valid libtool object"
  6287. fi
  6288. fi
  6289. done
  6290. else
  6291. func_fatal_error "link input file '$arg' does not exist"
  6292. fi
  6293. arg=$save_arg
  6294. prev=
  6295. continue
  6296. ;;
  6297. os2dllname)
  6298. os2dllname=$arg
  6299. prev=
  6300. continue
  6301. ;;
  6302. precious_regex)
  6303. precious_files_regex=$arg
  6304. prev=
  6305. continue
  6306. ;;
  6307. release)
  6308. release=-$arg
  6309. prev=
  6310. continue
  6311. ;;
  6312. rpath | xrpath)
  6313. # We need an absolute path.
  6314. case $arg in
  6315. [\\/]* | [A-Za-z]:[\\/]*) ;;
  6316. *)
  6317. func_fatal_error "only absolute run-paths are allowed"
  6318. ;;
  6319. esac
  6320. if test rpath = "$prev"; then
  6321. case "$rpath " in
  6322. *" $arg "*) ;;
  6323. *) func_append rpath " $arg" ;;
  6324. esac
  6325. else
  6326. case "$xrpath " in
  6327. *" $arg "*) ;;
  6328. *) func_append xrpath " $arg" ;;
  6329. esac
  6330. fi
  6331. prev=
  6332. continue
  6333. ;;
  6334. shrext)
  6335. shrext_cmds=$arg
  6336. prev=
  6337. continue
  6338. ;;
  6339. weak)
  6340. func_append weak_libs " $arg"
  6341. prev=
  6342. continue
  6343. ;;
  6344. xcclinker)
  6345. func_append linker_flags " $qarg"
  6346. func_append compiler_flags " $qarg"
  6347. prev=
  6348. func_append compile_command " $qarg"
  6349. func_append finalize_command " $qarg"
  6350. continue
  6351. ;;
  6352. xcompiler)
  6353. func_append compiler_flags " $qarg"
  6354. prev=
  6355. func_append compile_command " $qarg"
  6356. func_append finalize_command " $qarg"
  6357. continue
  6358. ;;
  6359. xlinker)
  6360. func_append linker_flags " $qarg"
  6361. func_append compiler_flags " $wl$qarg"
  6362. prev=
  6363. func_append compile_command " $wl$qarg"
  6364. func_append finalize_command " $wl$qarg"
  6365. continue
  6366. ;;
  6367. *)
  6368. eval "$prev=\"\$arg\""
  6369. prev=
  6370. continue
  6371. ;;
  6372. esac
  6373. fi # test -n "$prev"
  6374. prevarg=$arg
  6375. case $arg in
  6376. # Make -static behave like -all-static -GZ
  6377. -all-static | -static)
  6378. if test -n "$link_static_flag"; then
  6379. # See comment for -static flag below, for more details.
  6380. func_append compile_command " $link_static_flag"
  6381. func_append finalize_command " $link_static_flag"
  6382. fi
  6383. continue
  6384. ;;
  6385. -allow-undefined)
  6386. # FIXME: remove this flag sometime in the future.
  6387. func_fatal_error "'-allow-undefined' must not be used because it is the default"
  6388. ;;
  6389. -avoid-version)
  6390. avoid_version=yes
  6391. continue
  6392. ;;
  6393. -bindir)
  6394. prev=bindir
  6395. continue
  6396. ;;
  6397. -dlopen)
  6398. prev=dlfiles
  6399. continue
  6400. ;;
  6401. -dlpreopen)
  6402. prev=dlprefiles
  6403. continue
  6404. ;;
  6405. -export-dynamic)
  6406. export_dynamic=yes
  6407. continue
  6408. ;;
  6409. -export-symbols | -export-symbols-regex)
  6410. if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
  6411. func_fatal_error "more than one -exported-symbols argument is not allowed"
  6412. fi
  6413. if test X-export-symbols = "X$arg"; then
  6414. prev=expsyms
  6415. else
  6416. prev=expsyms_regex
  6417. fi
  6418. continue
  6419. ;;
  6420. -framework)
  6421. prev=framework
  6422. continue
  6423. ;;
  6424. -inst-prefix-dir)
  6425. prev=inst_prefix
  6426. continue
  6427. ;;
  6428. # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
  6429. # so, if we see these flags be careful not to treat them like -L
  6430. -L[A-Z][A-Z]*:*)
  6431. case $with_gcc/$host in
  6432. no/*-*-irix* | /*-*-irix*)
  6433. func_append compile_command " $arg"
  6434. func_append finalize_command " $arg"
  6435. ;;
  6436. esac
  6437. continue
  6438. ;;
  6439. -L*)
  6440. func_stripname "-L" '' "$arg"
  6441. if test -z "$func_stripname_result"; then
  6442. if test "$#" -gt 0; then
  6443. func_fatal_error "require no space between '-L' and '$1'"
  6444. else
  6445. func_fatal_error "need path for '-L' option"
  6446. fi
  6447. fi
  6448. func_resolve_sysroot "$func_stripname_result"
  6449. dir=$func_resolve_sysroot_result
  6450. # We need an absolute path.
  6451. case $dir in
  6452. [\\/]* | [A-Za-z]:[\\/]*) ;;
  6453. *)
  6454. absdir=`cd "$dir" && pwd`
  6455. test -z "$absdir" && \
  6456. func_fatal_error "cannot determine absolute directory name of '$dir'"
  6457. dir=$absdir
  6458. ;;
  6459. esac
  6460. case "$deplibs " in
  6461. *" -L$dir "* | *" $arg "*)
  6462. # Will only happen for absolute or sysroot arguments
  6463. ;;
  6464. *)
  6465. # Preserve sysroot, but never include relative directories
  6466. case $dir in
  6467. [\\/]* | [A-Za-z]:[\\/]* | =*) func_append deplibs " $arg" ;;
  6468. *) func_append deplibs " -L$dir" ;;
  6469. esac
  6470. func_append lib_search_path " $dir"
  6471. ;;
  6472. esac
  6473. case $host in
  6474. *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
  6475. testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'`
  6476. case :$dllsearchpath: in
  6477. *":$dir:"*) ;;
  6478. ::) dllsearchpath=$dir;;
  6479. *) func_append dllsearchpath ":$dir";;
  6480. esac
  6481. case :$dllsearchpath: in
  6482. *":$testbindir:"*) ;;
  6483. ::) dllsearchpath=$testbindir;;
  6484. *) func_append dllsearchpath ":$testbindir";;
  6485. esac
  6486. ;;
  6487. esac
  6488. continue
  6489. ;;
  6490. -l*)
  6491. if test X-lc = "X$arg" || test X-lm = "X$arg"; then
  6492. case $host in
  6493. *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*)
  6494. # These systems don't actually have a C or math library (as such)
  6495. continue
  6496. ;;
  6497. *-*-os2*)
  6498. # These systems don't actually have a C library (as such)
  6499. test X-lc = "X$arg" && continue
  6500. ;;
  6501. *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig*)
  6502. # Do not include libc due to us having libc/libc_r.
  6503. test X-lc = "X$arg" && continue
  6504. ;;
  6505. *-*-rhapsody* | *-*-darwin1.[012])
  6506. # Rhapsody C and math libraries are in the System framework
  6507. func_append deplibs " System.ltframework"
  6508. continue
  6509. ;;
  6510. *-*-sco3.2v5* | *-*-sco5v6*)
  6511. # Causes problems with __ctype
  6512. test X-lc = "X$arg" && continue
  6513. ;;
  6514. *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
  6515. # Compiler inserts libc in the correct place for threads to work
  6516. test X-lc = "X$arg" && continue
  6517. ;;
  6518. esac
  6519. elif test X-lc_r = "X$arg"; then
  6520. case $host in
  6521. *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig*)
  6522. # Do not include libc_r directly, use -pthread flag.
  6523. continue
  6524. ;;
  6525. esac
  6526. fi
  6527. func_append deplibs " $arg"
  6528. continue
  6529. ;;
  6530. -mllvm)
  6531. prev=mllvm
  6532. continue
  6533. ;;
  6534. -module)
  6535. module=yes
  6536. continue
  6537. ;;
  6538. # Tru64 UNIX uses -model [arg] to determine the layout of C++
  6539. # classes, name mangling, and exception handling.
  6540. # Darwin uses the -arch flag to determine output architecture.
  6541. -model|-arch|-isysroot|--sysroot)
  6542. func_append compiler_flags " $arg"
  6543. func_append compile_command " $arg"
  6544. func_append finalize_command " $arg"
  6545. prev=xcompiler
  6546. continue
  6547. ;;
  6548. -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
  6549. |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
  6550. func_append compiler_flags " $arg"
  6551. func_append compile_command " $arg"
  6552. func_append finalize_command " $arg"
  6553. case "$new_inherited_linker_flags " in
  6554. *" $arg "*) ;;
  6555. * ) func_append new_inherited_linker_flags " $arg" ;;
  6556. esac
  6557. continue
  6558. ;;
  6559. -multi_module)
  6560. single_module=$wl-multi_module
  6561. continue
  6562. ;;
  6563. -no-fast-install)
  6564. fast_install=no
  6565. continue
  6566. ;;
  6567. -no-install)
  6568. case $host in
  6569. *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*)
  6570. # The PATH hackery in wrapper scripts is required on Windows
  6571. # and Darwin in order for the loader to find any dlls it needs.
  6572. func_warning "'-no-install' is ignored for $host"
  6573. func_warning "assuming '-no-fast-install' instead"
  6574. fast_install=no
  6575. ;;
  6576. *) no_install=yes ;;
  6577. esac
  6578. continue
  6579. ;;
  6580. -no-undefined)
  6581. allow_undefined=no
  6582. continue
  6583. ;;
  6584. -objectlist)
  6585. prev=objectlist
  6586. continue
  6587. ;;
  6588. -os2dllname)
  6589. prev=os2dllname
  6590. continue
  6591. ;;
  6592. -o) prev=output ;;
  6593. -precious-files-regex)
  6594. prev=precious_regex
  6595. continue
  6596. ;;
  6597. -release)
  6598. prev=release
  6599. continue
  6600. ;;
  6601. -rpath)
  6602. prev=rpath
  6603. continue
  6604. ;;
  6605. -R)
  6606. prev=xrpath
  6607. continue
  6608. ;;
  6609. -R*)
  6610. func_stripname '-R' '' "$arg"
  6611. dir=$func_stripname_result
  6612. # We need an absolute path.
  6613. case $dir in
  6614. [\\/]* | [A-Za-z]:[\\/]*) ;;
  6615. =*)
  6616. func_stripname '=' '' "$dir"
  6617. dir=$lt_sysroot$func_stripname_result
  6618. ;;
  6619. *)
  6620. func_fatal_error "only absolute run-paths are allowed"
  6621. ;;
  6622. esac
  6623. case "$xrpath " in
  6624. *" $dir "*) ;;
  6625. *) func_append xrpath " $dir" ;;
  6626. esac
  6627. continue
  6628. ;;
  6629. -shared)
  6630. # The effects of -shared are defined in a previous loop.
  6631. continue
  6632. ;;
  6633. -shrext)
  6634. prev=shrext
  6635. continue
  6636. ;;
  6637. -static-libtool-libs)
  6638. # The effects of -static are defined in a previous loop.
  6639. # We used to do the same as -all-static on platforms that
  6640. # didn't have a PIC flag, but the assumption that the effects
  6641. # would be equivalent was wrong. It would break on at least
  6642. # Digital Unix and AIX.
  6643. continue
  6644. ;;
  6645. -thread-safe)
  6646. thread_safe=yes
  6647. continue
  6648. ;;
  6649. -version-info)
  6650. prev=vinfo
  6651. continue
  6652. ;;
  6653. -version-number)
  6654. prev=vinfo
  6655. vinfo_number=yes
  6656. continue
  6657. ;;
  6658. -weak)
  6659. prev=weak
  6660. continue
  6661. ;;
  6662. -Wc,*)
  6663. func_stripname '-Wc,' '' "$arg"
  6664. args=$func_stripname_result
  6665. arg=
  6666. save_ifs=$IFS; IFS=,
  6667. for flag in $args; do
  6668. IFS=$save_ifs
  6669. func_quote_for_eval "$flag"
  6670. func_append arg " $func_quote_for_eval_result"
  6671. func_append compiler_flags " $func_quote_for_eval_result"
  6672. done
  6673. IFS=$save_ifs
  6674. func_stripname ' ' '' "$arg"
  6675. arg=$func_stripname_result
  6676. ;;
  6677. -Wl,*)
  6678. func_stripname '-Wl,' '' "$arg"
  6679. args=$func_stripname_result
  6680. arg=
  6681. save_ifs=$IFS; IFS=,
  6682. for flag in $args; do
  6683. IFS=$save_ifs
  6684. func_quote_for_eval "$flag"
  6685. func_append arg " $wl$func_quote_for_eval_result"
  6686. func_append compiler_flags " $wl$func_quote_for_eval_result"
  6687. func_append linker_flags " $func_quote_for_eval_result"
  6688. done
  6689. IFS=$save_ifs
  6690. func_stripname ' ' '' "$arg"
  6691. arg=$func_stripname_result
  6692. ;;
  6693. -Xcompiler)
  6694. prev=xcompiler
  6695. continue
  6696. ;;
  6697. -Xlinker)
  6698. prev=xlinker
  6699. continue
  6700. ;;
  6701. -XCClinker)
  6702. prev=xcclinker
  6703. continue
  6704. ;;
  6705. # -msg_* for osf cc
  6706. -msg_*)
  6707. func_quote_for_eval "$arg"
  6708. arg=$func_quote_for_eval_result
  6709. ;;
  6710. # Flags to be passed through unchanged, with rationale:
  6711. # -64, -mips[0-9] enable 64-bit mode for the SGI compiler
  6712. # -r[0-9][0-9]* specify processor for the SGI compiler
  6713. # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler
  6714. # +DA*, +DD* enable 64-bit mode for the HP compiler
  6715. # -q* compiler args for the IBM compiler
  6716. # -m*, -t[45]*, -txscale* architecture-specific flags for GCC
  6717. # -F/path path to uninstalled frameworks, gcc on darwin
  6718. # -p, -pg, --coverage, -fprofile-* profiling flags for GCC
  6719. # -fstack-protector* stack protector flags for GCC
  6720. # @file GCC response files
  6721. # -tp=* Portland pgcc target processor selection
  6722. # --sysroot=* for sysroot support
  6723. # -O*, -g*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization
  6724. # -specs=* GCC specs files
  6725. # -stdlib=* select c++ std lib with clang
  6726. # -fsanitize=* Clang/GCC memory and address sanitizer
  6727. # -fuse-ld=* Linker select flags for GCC
  6728. # -static-* direct GCC to link specific libraries statically
  6729. # -fcilkplus Cilk Plus language extension features for C/C++
  6730. -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
  6731. -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \
  6732. -O*|-g*|-flto*|-fwhopr*|-fuse-linker-plugin|-fstack-protector*|-stdlib=*| \
  6733. -specs=*|-fsanitize=*|-fuse-ld=*|-static-*|-fcilkplus)
  6734. func_quote_for_eval "$arg"
  6735. arg=$func_quote_for_eval_result
  6736. func_append compile_command " $arg"
  6737. func_append finalize_command " $arg"
  6738. func_append compiler_flags " $arg"
  6739. continue
  6740. ;;
  6741. -Z*)
  6742. if test os2 = "`expr $host : '.*\(os2\)'`"; then
  6743. # OS/2 uses -Zxxx to specify OS/2-specific options
  6744. compiler_flags="$compiler_flags $arg"
  6745. func_append compile_command " $arg"
  6746. func_append finalize_command " $arg"
  6747. case $arg in
  6748. -Zlinker | -Zstack)
  6749. prev=xcompiler
  6750. ;;
  6751. esac
  6752. continue
  6753. else
  6754. # Otherwise treat like 'Some other compiler flag' below
  6755. func_quote_for_eval "$arg"
  6756. arg=$func_quote_for_eval_result
  6757. fi
  6758. ;;
  6759. # Some other compiler flag.
  6760. -* | +*)
  6761. func_quote_for_eval "$arg"
  6762. arg=$func_quote_for_eval_result
  6763. ;;
  6764. *.$objext)
  6765. # A standard object.
  6766. func_append objs " $arg"
  6767. ;;
  6768. *.lo)
  6769. # A libtool-controlled object.
  6770. # Check to see that this really is a libtool object.
  6771. if func_lalib_unsafe_p "$arg"; then
  6772. pic_object=
  6773. non_pic_object=
  6774. # Read the .lo file
  6775. func_source "$arg"
  6776. if test -z "$pic_object" ||
  6777. test -z "$non_pic_object" ||
  6778. test none = "$pic_object" &&
  6779. test none = "$non_pic_object"; then
  6780. func_fatal_error "cannot find name of object for '$arg'"
  6781. fi
  6782. # Extract subdirectory from the argument.
  6783. func_dirname "$arg" "/" ""
  6784. xdir=$func_dirname_result
  6785. test none = "$pic_object" || {
  6786. # Prepend the subdirectory the object is found in.
  6787. pic_object=$xdir$pic_object
  6788. if test dlfiles = "$prev"; then
  6789. if test yes = "$build_libtool_libs" && test yes = "$dlopen_support"; then
  6790. func_append dlfiles " $pic_object"
  6791. prev=
  6792. continue
  6793. else
  6794. # If libtool objects are unsupported, then we need to preload.
  6795. prev=dlprefiles
  6796. fi
  6797. fi
  6798. # CHECK ME: I think I busted this. -Ossama
  6799. if test dlprefiles = "$prev"; then
  6800. # Preload the old-style object.
  6801. func_append dlprefiles " $pic_object"
  6802. prev=
  6803. fi
  6804. # A PIC object.
  6805. func_append libobjs " $pic_object"
  6806. arg=$pic_object
  6807. }
  6808. # Non-PIC object.
  6809. if test none != "$non_pic_object"; then
  6810. # Prepend the subdirectory the object is found in.
  6811. non_pic_object=$xdir$non_pic_object
  6812. # A standard non-PIC object
  6813. func_append non_pic_objects " $non_pic_object"
  6814. if test -z "$pic_object" || test none = "$pic_object"; then
  6815. arg=$non_pic_object
  6816. fi
  6817. else
  6818. # If the PIC object exists, use it instead.
  6819. # $xdir was prepended to $pic_object above.
  6820. non_pic_object=$pic_object
  6821. func_append non_pic_objects " $non_pic_object"
  6822. fi
  6823. else
  6824. # Only an error if not doing a dry-run.
  6825. if $opt_dry_run; then
  6826. # Extract subdirectory from the argument.
  6827. func_dirname "$arg" "/" ""
  6828. xdir=$func_dirname_result
  6829. func_lo2o "$arg"
  6830. pic_object=$xdir$objdir/$func_lo2o_result
  6831. non_pic_object=$xdir$func_lo2o_result
  6832. func_append libobjs " $pic_object"
  6833. func_append non_pic_objects " $non_pic_object"
  6834. else
  6835. func_fatal_error "'$arg' is not a valid libtool object"
  6836. fi
  6837. fi
  6838. ;;
  6839. *.$libext)
  6840. # An archive.
  6841. func_append deplibs " $arg"
  6842. func_append old_deplibs " $arg"
  6843. continue
  6844. ;;
  6845. *.la)
  6846. # A libtool-controlled library.
  6847. func_resolve_sysroot "$arg"
  6848. if test dlfiles = "$prev"; then
  6849. # This library was specified with -dlopen.
  6850. func_append dlfiles " $func_resolve_sysroot_result"
  6851. prev=
  6852. elif test dlprefiles = "$prev"; then
  6853. # The library was specified with -dlpreopen.
  6854. func_append dlprefiles " $func_resolve_sysroot_result"
  6855. prev=
  6856. else
  6857. func_append deplibs " $func_resolve_sysroot_result"
  6858. fi
  6859. continue
  6860. ;;
  6861. # Some other compiler argument.
  6862. *)
  6863. # Unknown arguments in both finalize_command and compile_command need
  6864. # to be aesthetically quoted because they are evaled later.
  6865. func_quote_for_eval "$arg"
  6866. arg=$func_quote_for_eval_result
  6867. ;;
  6868. esac # arg
  6869. # Now actually substitute the argument into the commands.
  6870. if test -n "$arg"; then
  6871. func_append compile_command " $arg"
  6872. func_append finalize_command " $arg"
  6873. fi
  6874. done # argument parsing loop
  6875. test -n "$prev" && \
  6876. func_fatal_help "the '$prevarg' option requires an argument"
  6877. if test yes = "$export_dynamic" && test -n "$export_dynamic_flag_spec"; then
  6878. eval arg=\"$export_dynamic_flag_spec\"
  6879. func_append compile_command " $arg"
  6880. func_append finalize_command " $arg"
  6881. fi
  6882. oldlibs=
  6883. # calculate the name of the file, without its directory
  6884. func_basename "$output"
  6885. outputname=$func_basename_result
  6886. libobjs_save=$libobjs
  6887. if test -n "$shlibpath_var"; then
  6888. # get the directories listed in $shlibpath_var
  6889. eval shlib_search_path=\`\$ECHO \"\$$shlibpath_var\" \| \$SED \'s/:/ /g\'\`
  6890. else
  6891. shlib_search_path=
  6892. fi
  6893. eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
  6894. eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
  6895. # Definition is injected by LT_CONFIG during libtool generation.
  6896. func_munge_path_list sys_lib_dlsearch_path "$LT_SYS_LIBRARY_PATH"
  6897. func_dirname "$output" "/" ""
  6898. output_objdir=$func_dirname_result$objdir
  6899. func_to_tool_file "$output_objdir/"
  6900. tool_output_objdir=$func_to_tool_file_result
  6901. # Create the object directory.
  6902. func_mkdir_p "$output_objdir"
  6903. # Determine the type of output
  6904. case $output in
  6905. "")
  6906. func_fatal_help "you must specify an output file"
  6907. ;;
  6908. *.$libext) linkmode=oldlib ;;
  6909. *.lo | *.$objext) linkmode=obj ;;
  6910. *.la) linkmode=lib ;;
  6911. *) linkmode=prog ;; # Anything else should be a program.
  6912. esac
  6913. specialdeplibs=
  6914. libs=
  6915. # Find all interdependent deplibs by searching for libraries
  6916. # that are linked more than once (e.g. -la -lb -la)
  6917. for deplib in $deplibs; do
  6918. if $opt_preserve_dup_deps; then
  6919. case "$libs " in
  6920. *" $deplib "*) func_append specialdeplibs " $deplib" ;;
  6921. esac
  6922. fi
  6923. func_append libs " $deplib"
  6924. done
  6925. if test lib = "$linkmode"; then
  6926. libs="$predeps $libs $compiler_lib_search_path $postdeps"
  6927. # Compute libraries that are listed more than once in $predeps
  6928. # $postdeps and mark them as special (i.e., whose duplicates are
  6929. # not to be eliminated).
  6930. pre_post_deps=
  6931. if $opt_duplicate_compiler_generated_deps; then
  6932. for pre_post_dep in $predeps $postdeps; do
  6933. case "$pre_post_deps " in
  6934. *" $pre_post_dep "*) func_append specialdeplibs " $pre_post_deps" ;;
  6935. esac
  6936. func_append pre_post_deps " $pre_post_dep"
  6937. done
  6938. fi
  6939. pre_post_deps=
  6940. fi
  6941. deplibs=
  6942. newdependency_libs=
  6943. newlib_search_path=
  6944. need_relink=no # whether we're linking any uninstalled libtool libraries
  6945. notinst_deplibs= # not-installed libtool libraries
  6946. notinst_path= # paths that contain not-installed libtool libraries
  6947. case $linkmode in
  6948. lib)
  6949. passes="conv dlpreopen link"
  6950. for file in $dlfiles $dlprefiles; do
  6951. case $file in
  6952. *.la) ;;
  6953. *)
  6954. func_fatal_help "libraries can '-dlopen' only libtool libraries: $file"
  6955. ;;
  6956. esac
  6957. done
  6958. ;;
  6959. prog)
  6960. compile_deplibs=
  6961. finalize_deplibs=
  6962. alldeplibs=false
  6963. newdlfiles=
  6964. newdlprefiles=
  6965. passes="conv scan dlopen dlpreopen link"
  6966. ;;
  6967. *) passes="conv"
  6968. ;;
  6969. esac
  6970. for pass in $passes; do
  6971. # The preopen pass in lib mode reverses $deplibs; put it back here
  6972. # so that -L comes before libs that need it for instance...
  6973. if test lib,link = "$linkmode,$pass"; then
  6974. ## FIXME: Find the place where the list is rebuilt in the wrong
  6975. ## order, and fix it there properly
  6976. tmp_deplibs=
  6977. for deplib in $deplibs; do
  6978. tmp_deplibs="$deplib $tmp_deplibs"
  6979. done
  6980. deplibs=$tmp_deplibs
  6981. fi
  6982. if test lib,link = "$linkmode,$pass" ||
  6983. test prog,scan = "$linkmode,$pass"; then
  6984. libs=$deplibs
  6985. deplibs=
  6986. fi
  6987. if test prog = "$linkmode"; then
  6988. case $pass in
  6989. dlopen) libs=$dlfiles ;;
  6990. dlpreopen) libs=$dlprefiles ;;
  6991. link)
  6992. libs="$deplibs %DEPLIBS%"
  6993. test "X$link_all_deplibs" != Xno && libs="$libs $dependency_libs"
  6994. ;;
  6995. esac
  6996. fi
  6997. if test lib,dlpreopen = "$linkmode,$pass"; then
  6998. # Collect and forward deplibs of preopened libtool libs
  6999. for lib in $dlprefiles; do
  7000. # Ignore non-libtool-libs
  7001. dependency_libs=
  7002. func_resolve_sysroot "$lib"
  7003. case $lib in
  7004. *.la) func_source "$func_resolve_sysroot_result" ;;
  7005. esac
  7006. # Collect preopened libtool deplibs, except any this library
  7007. # has declared as weak libs
  7008. for deplib in $dependency_libs; do
  7009. func_basename "$deplib"
  7010. deplib_base=$func_basename_result
  7011. case " $weak_libs " in
  7012. *" $deplib_base "*) ;;
  7013. *) func_append deplibs " $deplib" ;;
  7014. esac
  7015. done
  7016. done
  7017. libs=$dlprefiles
  7018. fi
  7019. if test dlopen = "$pass"; then
  7020. # Collect dlpreopened libraries
  7021. save_deplibs=$deplibs
  7022. deplibs=
  7023. fi
  7024. for deplib in $libs; do
  7025. lib=
  7026. found=false
  7027. case $deplib in
  7028. -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
  7029. |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
  7030. if test prog,link = "$linkmode,$pass"; then
  7031. compile_deplibs="$deplib $compile_deplibs"
  7032. finalize_deplibs="$deplib $finalize_deplibs"
  7033. else
  7034. func_append compiler_flags " $deplib"
  7035. if test lib = "$linkmode"; then
  7036. case "$new_inherited_linker_flags " in
  7037. *" $deplib "*) ;;
  7038. * ) func_append new_inherited_linker_flags " $deplib" ;;
  7039. esac
  7040. fi
  7041. fi
  7042. continue
  7043. ;;
  7044. -l*)
  7045. if test lib != "$linkmode" && test prog != "$linkmode"; then
  7046. func_warning "'-l' is ignored for archives/objects"
  7047. continue
  7048. fi
  7049. func_stripname '-l' '' "$deplib"
  7050. name=$func_stripname_result
  7051. if test lib = "$linkmode"; then
  7052. searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path"
  7053. else
  7054. searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path"
  7055. fi
  7056. for searchdir in $searchdirs; do
  7057. for search_ext in .la $std_shrext .so .a; do
  7058. # Search the libtool library
  7059. lib=$searchdir/lib$name$search_ext
  7060. if test -f "$lib"; then
  7061. if test .la = "$search_ext"; then
  7062. found=:
  7063. else
  7064. found=false
  7065. fi
  7066. break 2
  7067. fi
  7068. done
  7069. done
  7070. if $found; then
  7071. # deplib is a libtool library
  7072. # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
  7073. # We need to do some special things here, and not later.
  7074. if test yes = "$allow_libtool_libs_with_static_runtimes"; then
  7075. case " $predeps $postdeps " in
  7076. *" $deplib "*)
  7077. if func_lalib_p "$lib"; then
  7078. library_names=
  7079. old_library=
  7080. func_source "$lib"
  7081. for l in $old_library $library_names; do
  7082. ll=$l
  7083. done
  7084. if test "X$ll" = "X$old_library"; then # only static version available
  7085. found=false
  7086. func_dirname "$lib" "" "."
  7087. ladir=$func_dirname_result
  7088. lib=$ladir/$old_library
  7089. if test prog,link = "$linkmode,$pass"; then
  7090. compile_deplibs="$deplib $compile_deplibs"
  7091. finalize_deplibs="$deplib $finalize_deplibs"
  7092. else
  7093. deplibs="$deplib $deplibs"
  7094. test lib = "$linkmode" && newdependency_libs="$deplib $newdependency_libs"
  7095. fi
  7096. continue
  7097. fi
  7098. fi
  7099. ;;
  7100. *) ;;
  7101. esac
  7102. fi
  7103. else
  7104. # deplib doesn't seem to be a libtool library
  7105. if test prog,link = "$linkmode,$pass"; then
  7106. compile_deplibs="$deplib $compile_deplibs"
  7107. finalize_deplibs="$deplib $finalize_deplibs"
  7108. else
  7109. deplibs="$deplib $deplibs"
  7110. test lib = "$linkmode" && newdependency_libs="$deplib $newdependency_libs"
  7111. fi
  7112. continue
  7113. fi
  7114. ;; # -l
  7115. *.ltframework)
  7116. if test prog,link = "$linkmode,$pass"; then
  7117. compile_deplibs="$deplib $compile_deplibs"
  7118. finalize_deplibs="$deplib $finalize_deplibs"
  7119. else
  7120. deplibs="$deplib $deplibs"
  7121. if test lib = "$linkmode"; then
  7122. case "$new_inherited_linker_flags " in
  7123. *" $deplib "*) ;;
  7124. * ) func_append new_inherited_linker_flags " $deplib" ;;
  7125. esac
  7126. fi
  7127. fi
  7128. continue
  7129. ;;
  7130. -L*)
  7131. case $linkmode in
  7132. lib)
  7133. deplibs="$deplib $deplibs"
  7134. test conv = "$pass" && continue
  7135. newdependency_libs="$deplib $newdependency_libs"
  7136. func_stripname '-L' '' "$deplib"
  7137. func_resolve_sysroot "$func_stripname_result"
  7138. func_append newlib_search_path " $func_resolve_sysroot_result"
  7139. ;;
  7140. prog)
  7141. if test conv = "$pass"; then
  7142. deplibs="$deplib $deplibs"
  7143. continue
  7144. fi
  7145. if test scan = "$pass"; then
  7146. deplibs="$deplib $deplibs"
  7147. else
  7148. compile_deplibs="$deplib $compile_deplibs"
  7149. finalize_deplibs="$deplib $finalize_deplibs"
  7150. fi
  7151. func_stripname '-L' '' "$deplib"
  7152. func_resolve_sysroot "$func_stripname_result"
  7153. func_append newlib_search_path " $func_resolve_sysroot_result"
  7154. ;;
  7155. *)
  7156. func_warning "'-L' is ignored for archives/objects"
  7157. ;;
  7158. esac # linkmode
  7159. continue
  7160. ;; # -L
  7161. -R*)
  7162. if test link = "$pass"; then
  7163. func_stripname '-R' '' "$deplib"
  7164. func_resolve_sysroot "$func_stripname_result"
  7165. dir=$func_resolve_sysroot_result
  7166. # Make sure the xrpath contains only unique directories.
  7167. case "$xrpath " in
  7168. *" $dir "*) ;;
  7169. *) func_append xrpath " $dir" ;;
  7170. esac
  7171. fi
  7172. deplibs="$deplib $deplibs"
  7173. continue
  7174. ;;
  7175. *.la)
  7176. func_resolve_sysroot "$deplib"
  7177. lib=$func_resolve_sysroot_result
  7178. ;;
  7179. *.$libext)
  7180. if test conv = "$pass"; then
  7181. deplibs="$deplib $deplibs"
  7182. continue
  7183. fi
  7184. case $linkmode in
  7185. lib)
  7186. # Linking convenience modules into shared libraries is allowed,
  7187. # but linking other static libraries is non-portable.
  7188. case " $dlpreconveniencelibs " in
  7189. *" $deplib "*) ;;
  7190. *)
  7191. valid_a_lib=false
  7192. case $deplibs_check_method in
  7193. match_pattern*)
  7194. set dummy $deplibs_check_method; shift
  7195. match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
  7196. if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \
  7197. | $EGREP "$match_pattern_regex" > /dev/null; then
  7198. valid_a_lib=:
  7199. fi
  7200. ;;
  7201. pass_all)
  7202. valid_a_lib=:
  7203. ;;
  7204. esac
  7205. if $valid_a_lib; then
  7206. echo
  7207. $ECHO "*** Warning: Linking the shared library $output against the"
  7208. $ECHO "*** static library $deplib is not portable!"
  7209. deplibs="$deplib $deplibs"
  7210. else
  7211. echo
  7212. $ECHO "*** Warning: Trying to link with static lib archive $deplib."
  7213. echo "*** I have the capability to make that library automatically link in when"
  7214. echo "*** you link to this library. But I can only do this if you have a"
  7215. echo "*** shared version of the library, which you do not appear to have"
  7216. echo "*** because the file extensions .$libext of this argument makes me believe"
  7217. echo "*** that it is just a static archive that I should not use here."
  7218. fi
  7219. ;;
  7220. esac
  7221. continue
  7222. ;;
  7223. prog)
  7224. if test link != "$pass"; then
  7225. deplibs="$deplib $deplibs"
  7226. else
  7227. compile_deplibs="$deplib $compile_deplibs"
  7228. finalize_deplibs="$deplib $finalize_deplibs"
  7229. fi
  7230. continue
  7231. ;;
  7232. esac # linkmode
  7233. ;; # *.$libext
  7234. *.lo | *.$objext)
  7235. if test conv = "$pass"; then
  7236. deplibs="$deplib $deplibs"
  7237. elif test prog = "$linkmode"; then
  7238. if test dlpreopen = "$pass" || test yes != "$dlopen_support" || test no = "$build_libtool_libs"; then
  7239. # If there is no dlopen support or we're linking statically,
  7240. # we need to preload.
  7241. func_append newdlprefiles " $deplib"
  7242. compile_deplibs="$deplib $compile_deplibs"
  7243. finalize_deplibs="$deplib $finalize_deplibs"
  7244. else
  7245. func_append newdlfiles " $deplib"
  7246. fi
  7247. fi
  7248. continue
  7249. ;;
  7250. %DEPLIBS%)
  7251. alldeplibs=:
  7252. continue
  7253. ;;
  7254. esac # case $deplib
  7255. $found || test -f "$lib" \
  7256. || func_fatal_error "cannot find the library '$lib' or unhandled argument '$deplib'"
  7257. # Check to see that this really is a libtool archive.
  7258. func_lalib_unsafe_p "$lib" \
  7259. || func_fatal_error "'$lib' is not a valid libtool archive"
  7260. func_dirname "$lib" "" "."
  7261. ladir=$func_dirname_result
  7262. dlname=
  7263. dlopen=
  7264. dlpreopen=
  7265. libdir=
  7266. library_names=
  7267. old_library=
  7268. inherited_linker_flags=
  7269. # If the library was installed with an old release of libtool,
  7270. # it will not redefine variables installed, or shouldnotlink
  7271. installed=yes
  7272. shouldnotlink=no
  7273. avoidtemprpath=
  7274. # Read the .la file
  7275. func_source "$lib"
  7276. # Convert "-framework foo" to "foo.ltframework"
  7277. if test -n "$inherited_linker_flags"; then
  7278. tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'`
  7279. for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do
  7280. case " $new_inherited_linker_flags " in
  7281. *" $tmp_inherited_linker_flag "*) ;;
  7282. *) func_append new_inherited_linker_flags " $tmp_inherited_linker_flag";;
  7283. esac
  7284. done
  7285. fi
  7286. dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
  7287. if test lib,link = "$linkmode,$pass" ||
  7288. test prog,scan = "$linkmode,$pass" ||
  7289. { test prog != "$linkmode" && test lib != "$linkmode"; }; then
  7290. test -n "$dlopen" && func_append dlfiles " $dlopen"
  7291. test -n "$dlpreopen" && func_append dlprefiles " $dlpreopen"
  7292. fi
  7293. if test conv = "$pass"; then
  7294. # Only check for convenience libraries
  7295. deplibs="$lib $deplibs"
  7296. if test -z "$libdir"; then
  7297. if test -z "$old_library"; then
  7298. func_fatal_error "cannot find name of link library for '$lib'"
  7299. fi
  7300. # It is a libtool convenience library, so add in its objects.
  7301. func_append convenience " $ladir/$objdir/$old_library"
  7302. func_append old_convenience " $ladir/$objdir/$old_library"
  7303. tmp_libs=
  7304. for deplib in $dependency_libs; do
  7305. deplibs="$deplib $deplibs"
  7306. if $opt_preserve_dup_deps; then
  7307. case "$tmp_libs " in
  7308. *" $deplib "*) func_append specialdeplibs " $deplib" ;;
  7309. esac
  7310. fi
  7311. func_append tmp_libs " $deplib"
  7312. done
  7313. elif test prog != "$linkmode" && test lib != "$linkmode"; then
  7314. func_fatal_error "'$lib' is not a convenience library"
  7315. fi
  7316. continue
  7317. fi # $pass = conv
  7318. # Get the name of the library we link against.
  7319. linklib=
  7320. if test -n "$old_library" &&
  7321. { test yes = "$prefer_static_libs" ||
  7322. test built,no = "$prefer_static_libs,$installed"; }; then
  7323. linklib=$old_library
  7324. else
  7325. for l in $old_library $library_names; do
  7326. linklib=$l
  7327. done
  7328. fi
  7329. if test -z "$linklib"; then
  7330. func_fatal_error "cannot find name of link library for '$lib'"
  7331. fi
  7332. # This library was specified with -dlopen.
  7333. if test dlopen = "$pass"; then
  7334. test -z "$libdir" \
  7335. && func_fatal_error "cannot -dlopen a convenience library: '$lib'"
  7336. if test -z "$dlname" ||
  7337. test yes != "$dlopen_support" ||
  7338. test no = "$build_libtool_libs"
  7339. then
  7340. # If there is no dlname, no dlopen support or we're linking
  7341. # statically, we need to preload. We also need to preload any
  7342. # dependent libraries so libltdl's deplib preloader doesn't
  7343. # bomb out in the load deplibs phase.
  7344. func_append dlprefiles " $lib $dependency_libs"
  7345. else
  7346. func_append newdlfiles " $lib"
  7347. fi
  7348. continue
  7349. fi # $pass = dlopen
  7350. # We need an absolute path.
  7351. case $ladir in
  7352. [\\/]* | [A-Za-z]:[\\/]*) abs_ladir=$ladir ;;
  7353. *)
  7354. abs_ladir=`cd "$ladir" && pwd`
  7355. if test -z "$abs_ladir"; then
  7356. func_warning "cannot determine absolute directory name of '$ladir'"
  7357. func_warning "passing it literally to the linker, although it might fail"
  7358. abs_ladir=$ladir
  7359. fi
  7360. ;;
  7361. esac
  7362. func_basename "$lib"
  7363. laname=$func_basename_result
  7364. # Find the relevant object directory and library name.
  7365. if test yes = "$installed"; then
  7366. if test ! -f "$lt_sysroot$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
  7367. func_warning "library '$lib' was moved."
  7368. dir=$ladir
  7369. absdir=$abs_ladir
  7370. libdir=$abs_ladir
  7371. else
  7372. dir=$lt_sysroot$libdir
  7373. absdir=$lt_sysroot$libdir
  7374. fi
  7375. test yes = "$hardcode_automatic" && avoidtemprpath=yes
  7376. else
  7377. if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
  7378. dir=$ladir
  7379. absdir=$abs_ladir
  7380. # Remove this search path later
  7381. func_append notinst_path " $abs_ladir"
  7382. else
  7383. dir=$ladir/$objdir
  7384. absdir=$abs_ladir/$objdir
  7385. # Remove this search path later
  7386. func_append notinst_path " $abs_ladir"
  7387. fi
  7388. fi # $installed = yes
  7389. func_stripname 'lib' '.la' "$laname"
  7390. name=$func_stripname_result
  7391. # This library was specified with -dlpreopen.
  7392. if test dlpreopen = "$pass"; then
  7393. if test -z "$libdir" && test prog = "$linkmode"; then
  7394. func_fatal_error "only libraries may -dlpreopen a convenience library: '$lib'"
  7395. fi
  7396. case $host in
  7397. # special handling for platforms with PE-DLLs.
  7398. *cygwin* | *mingw* | *cegcc* )
  7399. # Linker will automatically link against shared library if both
  7400. # static and shared are present. Therefore, ensure we extract
  7401. # symbols from the import library if a shared library is present
  7402. # (otherwise, the dlopen module name will be incorrect). We do
  7403. # this by putting the import library name into $newdlprefiles.
  7404. # We recover the dlopen module name by 'saving' the la file
  7405. # name in a special purpose variable, and (later) extracting the
  7406. # dlname from the la file.
  7407. if test -n "$dlname"; then
  7408. func_tr_sh "$dir/$linklib"
  7409. eval "libfile_$func_tr_sh_result=\$abs_ladir/\$laname"
  7410. func_append newdlprefiles " $dir/$linklib"
  7411. else
  7412. func_append newdlprefiles " $dir/$old_library"
  7413. # Keep a list of preopened convenience libraries to check
  7414. # that they are being used correctly in the link pass.
  7415. test -z "$libdir" && \
  7416. func_append dlpreconveniencelibs " $dir/$old_library"
  7417. fi
  7418. ;;
  7419. * )
  7420. # Prefer using a static library (so that no silly _DYNAMIC symbols
  7421. # are required to link).
  7422. if test -n "$old_library"; then
  7423. func_append newdlprefiles " $dir/$old_library"
  7424. # Keep a list of preopened convenience libraries to check
  7425. # that they are being used correctly in the link pass.
  7426. test -z "$libdir" && \
  7427. func_append dlpreconveniencelibs " $dir/$old_library"
  7428. # Otherwise, use the dlname, so that lt_dlopen finds it.
  7429. elif test -n "$dlname"; then
  7430. func_append newdlprefiles " $dir/$dlname"
  7431. else
  7432. func_append newdlprefiles " $dir/$linklib"
  7433. fi
  7434. ;;
  7435. esac
  7436. fi # $pass = dlpreopen
  7437. if test -z "$libdir"; then
  7438. # Link the convenience library
  7439. if test lib = "$linkmode"; then
  7440. deplibs="$dir/$old_library $deplibs"
  7441. elif test prog,link = "$linkmode,$pass"; then
  7442. compile_deplibs="$dir/$old_library $compile_deplibs"
  7443. finalize_deplibs="$dir/$old_library $finalize_deplibs"
  7444. else
  7445. deplibs="$lib $deplibs" # used for prog,scan pass
  7446. fi
  7447. continue
  7448. fi
  7449. if test prog = "$linkmode" && test link != "$pass"; then
  7450. func_append newlib_search_path " $ladir"
  7451. deplibs="$lib $deplibs"
  7452. linkalldeplibs=false
  7453. if test no != "$link_all_deplibs" || test -z "$library_names" ||
  7454. test no = "$build_libtool_libs"; then
  7455. linkalldeplibs=:
  7456. fi
  7457. tmp_libs=
  7458. for deplib in $dependency_libs; do
  7459. case $deplib in
  7460. -L*) func_stripname '-L' '' "$deplib"
  7461. func_resolve_sysroot "$func_stripname_result"
  7462. func_append newlib_search_path " $func_resolve_sysroot_result"
  7463. ;;
  7464. esac
  7465. # Need to link against all dependency_libs?
  7466. if $linkalldeplibs; then
  7467. deplibs="$deplib $deplibs"
  7468. else
  7469. # Need to hardcode shared library paths
  7470. # or/and link against static libraries
  7471. newdependency_libs="$deplib $newdependency_libs"
  7472. fi
  7473. if $opt_preserve_dup_deps; then
  7474. case "$tmp_libs " in
  7475. *" $deplib "*) func_append specialdeplibs " $deplib" ;;
  7476. esac
  7477. fi
  7478. func_append tmp_libs " $deplib"
  7479. done # for deplib
  7480. continue
  7481. fi # $linkmode = prog...
  7482. if test prog,link = "$linkmode,$pass"; then
  7483. if test -n "$library_names" &&
  7484. { { test no = "$prefer_static_libs" ||
  7485. test built,yes = "$prefer_static_libs,$installed"; } ||
  7486. test -z "$old_library"; }; then
  7487. # We need to hardcode the library path
  7488. if test -n "$shlibpath_var" && test -z "$avoidtemprpath"; then
  7489. # Make sure the rpath contains only unique directories.
  7490. case $temp_rpath: in
  7491. *"$absdir:"*) ;;
  7492. *) func_append temp_rpath "$absdir:" ;;
  7493. esac
  7494. fi
  7495. # Hardcode the library path.
  7496. # Skip directories that are in the system default run-time
  7497. # search path.
  7498. case " $sys_lib_dlsearch_path " in
  7499. *" $absdir "*) ;;
  7500. *)
  7501. case "$compile_rpath " in
  7502. *" $absdir "*) ;;
  7503. *) func_append compile_rpath " $absdir" ;;
  7504. esac
  7505. ;;
  7506. esac
  7507. case " $sys_lib_dlsearch_path " in
  7508. *" $libdir "*) ;;
  7509. *)
  7510. case "$finalize_rpath " in
  7511. *" $libdir "*) ;;
  7512. *) func_append finalize_rpath " $libdir" ;;
  7513. esac
  7514. ;;
  7515. esac
  7516. fi # $linkmode,$pass = prog,link...
  7517. if $alldeplibs &&
  7518. { test pass_all = "$deplibs_check_method" ||
  7519. { test yes = "$build_libtool_libs" &&
  7520. test -n "$library_names"; }; }; then
  7521. # We only need to search for static libraries
  7522. continue
  7523. fi
  7524. fi
  7525. link_static=no # Whether the deplib will be linked statically
  7526. use_static_libs=$prefer_static_libs
  7527. if test built = "$use_static_libs" && test yes = "$installed"; then
  7528. use_static_libs=no
  7529. fi
  7530. if test -n "$library_names" &&
  7531. { test no = "$use_static_libs" || test -z "$old_library"; }; then
  7532. case $host in
  7533. *cygwin* | *mingw* | *cegcc* | *os2*)
  7534. # No point in relinking DLLs because paths are not encoded
  7535. func_append notinst_deplibs " $lib"
  7536. need_relink=no
  7537. ;;
  7538. *)
  7539. if test no = "$installed"; then
  7540. func_append notinst_deplibs " $lib"
  7541. need_relink=no
  7542. fi
  7543. ;;
  7544. esac
  7545. # This is a shared library
  7546. # Warn about portability, can't link against -module's on some
  7547. # systems (darwin). Don't bleat about dlopened modules though!
  7548. dlopenmodule=
  7549. for dlpremoduletest in $dlprefiles; do
  7550. if test "X$dlpremoduletest" = "X$lib"; then
  7551. dlopenmodule=$dlpremoduletest
  7552. break
  7553. fi
  7554. done
  7555. if test -z "$dlopenmodule" && test yes = "$shouldnotlink" && test link = "$pass"; then
  7556. echo
  7557. if test prog = "$linkmode"; then
  7558. $ECHO "*** Warning: Linking the executable $output against the loadable module"
  7559. else
  7560. $ECHO "*** Warning: Linking the shared library $output against the loadable module"
  7561. fi
  7562. $ECHO "*** $linklib is not portable!"
  7563. fi
  7564. if test lib = "$linkmode" &&
  7565. test yes = "$hardcode_into_libs"; then
  7566. # Hardcode the library path.
  7567. # Skip directories that are in the system default run-time
  7568. # search path.
  7569. case " $sys_lib_dlsearch_path " in
  7570. *" $absdir "*) ;;
  7571. *)
  7572. case "$compile_rpath " in
  7573. *" $absdir "*) ;;
  7574. *) func_append compile_rpath " $absdir" ;;
  7575. esac
  7576. ;;
  7577. esac
  7578. case " $sys_lib_dlsearch_path " in
  7579. *" $libdir "*) ;;
  7580. *)
  7581. case "$finalize_rpath " in
  7582. *" $libdir "*) ;;
  7583. *) func_append finalize_rpath " $libdir" ;;
  7584. esac
  7585. ;;
  7586. esac
  7587. fi
  7588. if test -n "$old_archive_from_expsyms_cmds"; then
  7589. # figure out the soname
  7590. set dummy $library_names
  7591. shift
  7592. realname=$1
  7593. shift
  7594. libname=`eval "\\$ECHO \"$libname_spec\""`
  7595. # use dlname if we got it. it's perfectly good, no?
  7596. if test -n "$dlname"; then
  7597. soname=$dlname
  7598. elif test -n "$soname_spec"; then
  7599. # bleh windows
  7600. case $host in
  7601. *cygwin* | mingw* | *cegcc* | *os2*)
  7602. func_arith $current - $age
  7603. major=$func_arith_result
  7604. versuffix=-$major
  7605. ;;
  7606. esac
  7607. eval soname=\"$soname_spec\"
  7608. else
  7609. soname=$realname
  7610. fi
  7611. # Make a new name for the extract_expsyms_cmds to use
  7612. soroot=$soname
  7613. func_basename "$soroot"
  7614. soname=$func_basename_result
  7615. func_stripname 'lib' '.dll' "$soname"
  7616. newlib=libimp-$func_stripname_result.a
  7617. # If the library has no export list, then create one now
  7618. if test -f "$output_objdir/$soname-def"; then :
  7619. else
  7620. func_verbose "extracting exported symbol list from '$soname'"
  7621. func_execute_cmds "$extract_expsyms_cmds" 'exit $?'
  7622. fi
  7623. # Create $newlib
  7624. if test -f "$output_objdir/$newlib"; then :; else
  7625. func_verbose "generating import library for '$soname'"
  7626. func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?'
  7627. fi
  7628. # make sure the library variables are pointing to the new library
  7629. dir=$output_objdir
  7630. linklib=$newlib
  7631. fi # test -n "$old_archive_from_expsyms_cmds"
  7632. if test prog = "$linkmode" || test relink != "$opt_mode"; then
  7633. add_shlibpath=
  7634. add_dir=
  7635. add=
  7636. lib_linked=yes
  7637. case $hardcode_action in
  7638. immediate | unsupported)
  7639. if test no = "$hardcode_direct"; then
  7640. add=$dir/$linklib
  7641. case $host in
  7642. *-*-sco3.2v5.0.[024]*) add_dir=-L$dir ;;
  7643. *-*-sysv4*uw2*) add_dir=-L$dir ;;
  7644. *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
  7645. *-*-unixware7*) add_dir=-L$dir ;;
  7646. *-*-darwin* )
  7647. # if the lib is a (non-dlopened) module then we cannot
  7648. # link against it, someone is ignoring the earlier warnings
  7649. if /usr/bin/file -L $add 2> /dev/null |
  7650. $GREP ": [^:]* bundle" >/dev/null; then
  7651. if test "X$dlopenmodule" != "X$lib"; then
  7652. $ECHO "*** Warning: lib $linklib is a module, not a shared library"
  7653. if test -z "$old_library"; then
  7654. echo
  7655. echo "*** And there doesn't seem to be a static archive available"
  7656. echo "*** The link will probably fail, sorry"
  7657. else
  7658. add=$dir/$old_library
  7659. fi
  7660. elif test -n "$old_library"; then
  7661. add=$dir/$old_library
  7662. fi
  7663. fi
  7664. esac
  7665. elif test no = "$hardcode_minus_L"; then
  7666. case $host in
  7667. *-*-sunos*) add_shlibpath=$dir ;;
  7668. esac
  7669. add_dir=-L$dir
  7670. add=-l$name
  7671. elif test no = "$hardcode_shlibpath_var"; then
  7672. add_shlibpath=$dir
  7673. add=-l$name
  7674. else
  7675. lib_linked=no
  7676. fi
  7677. ;;
  7678. relink)
  7679. if test yes = "$hardcode_direct" &&
  7680. test no = "$hardcode_direct_absolute"; then
  7681. add=$dir/$linklib
  7682. elif test yes = "$hardcode_minus_L"; then
  7683. add_dir=-L$absdir
  7684. # Try looking first in the location we're being installed to.
  7685. if test -n "$inst_prefix_dir"; then
  7686. case $libdir in
  7687. [\\/]*)
  7688. func_append add_dir " -L$inst_prefix_dir$libdir"
  7689. ;;
  7690. esac
  7691. fi
  7692. add=-l$name
  7693. elif test yes = "$hardcode_shlibpath_var"; then
  7694. add_shlibpath=$dir
  7695. add=-l$name
  7696. else
  7697. lib_linked=no
  7698. fi
  7699. ;;
  7700. *) lib_linked=no ;;
  7701. esac
  7702. if test yes != "$lib_linked"; then
  7703. func_fatal_configuration "unsupported hardcode properties"
  7704. fi
  7705. if test -n "$add_shlibpath"; then
  7706. case :$compile_shlibpath: in
  7707. *":$add_shlibpath:"*) ;;
  7708. *) func_append compile_shlibpath "$add_shlibpath:" ;;
  7709. esac
  7710. fi
  7711. if test prog = "$linkmode"; then
  7712. test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
  7713. test -n "$add" && compile_deplibs="$add $compile_deplibs"
  7714. else
  7715. test -n "$add_dir" && deplibs="$add_dir $deplibs"
  7716. test -n "$add" && deplibs="$add $deplibs"
  7717. if test yes != "$hardcode_direct" &&
  7718. test yes != "$hardcode_minus_L" &&
  7719. test yes = "$hardcode_shlibpath_var"; then
  7720. case :$finalize_shlibpath: in
  7721. *":$libdir:"*) ;;
  7722. *) func_append finalize_shlibpath "$libdir:" ;;
  7723. esac
  7724. fi
  7725. fi
  7726. fi
  7727. if test prog = "$linkmode" || test relink = "$opt_mode"; then
  7728. add_shlibpath=
  7729. add_dir=
  7730. add=
  7731. # Finalize command for both is simple: just hardcode it.
  7732. if test yes = "$hardcode_direct" &&
  7733. test no = "$hardcode_direct_absolute"; then
  7734. add=$libdir/$linklib
  7735. elif test yes = "$hardcode_minus_L"; then
  7736. add_dir=-L$libdir
  7737. add=-l$name
  7738. elif test yes = "$hardcode_shlibpath_var"; then
  7739. case :$finalize_shlibpath: in
  7740. *":$libdir:"*) ;;
  7741. *) func_append finalize_shlibpath "$libdir:" ;;
  7742. esac
  7743. add=-l$name
  7744. elif test yes = "$hardcode_automatic"; then
  7745. if test -n "$inst_prefix_dir" &&
  7746. test -f "$inst_prefix_dir$libdir/$linklib"; then
  7747. add=$inst_prefix_dir$libdir/$linklib
  7748. else
  7749. add=$libdir/$linklib
  7750. fi
  7751. else
  7752. # We cannot seem to hardcode it, guess we'll fake it.
  7753. add_dir=-L$libdir
  7754. # Try looking first in the location we're being installed to.
  7755. if test -n "$inst_prefix_dir"; then
  7756. case $libdir in
  7757. [\\/]*)
  7758. func_append add_dir " -L$inst_prefix_dir$libdir"
  7759. ;;
  7760. esac
  7761. fi
  7762. add=-l$name
  7763. fi
  7764. if test prog = "$linkmode"; then
  7765. test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
  7766. test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
  7767. else
  7768. test -n "$add_dir" && deplibs="$add_dir $deplibs"
  7769. test -n "$add" && deplibs="$add $deplibs"
  7770. fi
  7771. fi
  7772. elif test prog = "$linkmode"; then
  7773. # Here we assume that one of hardcode_direct or hardcode_minus_L
  7774. # is not unsupported. This is valid on all known static and
  7775. # shared platforms.
  7776. if test unsupported != "$hardcode_direct"; then
  7777. test -n "$old_library" && linklib=$old_library
  7778. compile_deplibs="$dir/$linklib $compile_deplibs"
  7779. finalize_deplibs="$dir/$linklib $finalize_deplibs"
  7780. else
  7781. compile_deplibs="-l$name -L$dir $compile_deplibs"
  7782. finalize_deplibs="-l$name -L$dir $finalize_deplibs"
  7783. fi
  7784. elif test yes = "$build_libtool_libs"; then
  7785. # Not a shared library
  7786. if test pass_all != "$deplibs_check_method"; then
  7787. # We're trying link a shared library against a static one
  7788. # but the system doesn't support it.
  7789. # Just print a warning and add the library to dependency_libs so
  7790. # that the program can be linked against the static library.
  7791. echo
  7792. $ECHO "*** Warning: This system cannot link to static lib archive $lib."
  7793. echo "*** I have the capability to make that library automatically link in when"
  7794. echo "*** you link to this library. But I can only do this if you have a"
  7795. echo "*** shared version of the library, which you do not appear to have."
  7796. if test yes = "$module"; then
  7797. echo "*** But as you try to build a module library, libtool will still create "
  7798. echo "*** a static module, that should work as long as the dlopening application"
  7799. echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
  7800. if test -z "$global_symbol_pipe"; then
  7801. echo
  7802. echo "*** However, this would only work if libtool was able to extract symbol"
  7803. echo "*** lists from a program, using 'nm' or equivalent, but libtool could"
  7804. echo "*** not find such a program. So, this module is probably useless."
  7805. echo "*** 'nm' from GNU binutils and a full rebuild may help."
  7806. fi
  7807. if test no = "$build_old_libs"; then
  7808. build_libtool_libs=module
  7809. build_old_libs=yes
  7810. else
  7811. build_libtool_libs=no
  7812. fi
  7813. fi
  7814. else
  7815. deplibs="$dir/$old_library $deplibs"
  7816. link_static=yes
  7817. fi
  7818. fi # link shared/static library?
  7819. if test lib = "$linkmode"; then
  7820. if test -n "$dependency_libs" &&
  7821. { test yes != "$hardcode_into_libs" ||
  7822. test yes = "$build_old_libs" ||
  7823. test yes = "$link_static"; }; then
  7824. # Extract -R from dependency_libs
  7825. temp_deplibs=
  7826. for libdir in $dependency_libs; do
  7827. case $libdir in
  7828. -R*) func_stripname '-R' '' "$libdir"
  7829. temp_xrpath=$func_stripname_result
  7830. case " $xrpath " in
  7831. *" $temp_xrpath "*) ;;
  7832. *) func_append xrpath " $temp_xrpath";;
  7833. esac;;
  7834. *) func_append temp_deplibs " $libdir";;
  7835. esac
  7836. done
  7837. dependency_libs=$temp_deplibs
  7838. fi
  7839. func_append newlib_search_path " $absdir"
  7840. # Link against this library
  7841. test no = "$link_static" && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
  7842. # ... and its dependency_libs
  7843. tmp_libs=
  7844. for deplib in $dependency_libs; do
  7845. newdependency_libs="$deplib $newdependency_libs"
  7846. case $deplib in
  7847. -L*) func_stripname '-L' '' "$deplib"
  7848. func_resolve_sysroot "$func_stripname_result";;
  7849. *) func_resolve_sysroot "$deplib" ;;
  7850. esac
  7851. if $opt_preserve_dup_deps; then
  7852. case "$tmp_libs " in
  7853. *" $func_resolve_sysroot_result "*)
  7854. func_append specialdeplibs " $func_resolve_sysroot_result" ;;
  7855. esac
  7856. fi
  7857. func_append tmp_libs " $func_resolve_sysroot_result"
  7858. done
  7859. if test no != "$link_all_deplibs"; then
  7860. # Add the search paths of all dependency libraries
  7861. for deplib in $dependency_libs; do
  7862. path=
  7863. case $deplib in
  7864. -L*) path=$deplib ;;
  7865. *.la)
  7866. func_resolve_sysroot "$deplib"
  7867. deplib=$func_resolve_sysroot_result
  7868. func_dirname "$deplib" "" "."
  7869. dir=$func_dirname_result
  7870. # We need an absolute path.
  7871. case $dir in
  7872. [\\/]* | [A-Za-z]:[\\/]*) absdir=$dir ;;
  7873. *)
  7874. absdir=`cd "$dir" && pwd`
  7875. if test -z "$absdir"; then
  7876. func_warning "cannot determine absolute directory name of '$dir'"
  7877. absdir=$dir
  7878. fi
  7879. ;;
  7880. esac
  7881. if $GREP "^installed=no" $deplib > /dev/null; then
  7882. case $host in
  7883. *-*-darwin*)
  7884. depdepl=
  7885. eval deplibrary_names=`$SED -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
  7886. if test -n "$deplibrary_names"; then
  7887. for tmp in $deplibrary_names; do
  7888. depdepl=$tmp
  7889. done
  7890. if test -f "$absdir/$objdir/$depdepl"; then
  7891. depdepl=$absdir/$objdir/$depdepl
  7892. darwin_install_name=`$OTOOL -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
  7893. if test -z "$darwin_install_name"; then
  7894. darwin_install_name=`$OTOOL64 -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
  7895. fi
  7896. func_append compiler_flags " $wl-dylib_file $wl$darwin_install_name:$depdepl"
  7897. func_append linker_flags " -dylib_file $darwin_install_name:$depdepl"
  7898. path=
  7899. fi
  7900. fi
  7901. ;;
  7902. *)
  7903. path=-L$absdir/$objdir
  7904. ;;
  7905. esac
  7906. else
  7907. eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
  7908. test -z "$libdir" && \
  7909. func_fatal_error "'$deplib' is not a valid libtool archive"
  7910. test "$absdir" != "$libdir" && \
  7911. func_warning "'$deplib' seems to be moved"
  7912. path=-L$absdir
  7913. fi
  7914. ;;
  7915. esac
  7916. case " $deplibs " in
  7917. *" $path "*) ;;
  7918. *) deplibs="$path $deplibs" ;;
  7919. esac
  7920. done
  7921. fi # link_all_deplibs != no
  7922. fi # linkmode = lib
  7923. done # for deplib in $libs
  7924. if test link = "$pass"; then
  7925. if test prog = "$linkmode"; then
  7926. compile_deplibs="$new_inherited_linker_flags $compile_deplibs"
  7927. finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs"
  7928. else
  7929. compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
  7930. fi
  7931. fi
  7932. dependency_libs=$newdependency_libs
  7933. if test dlpreopen = "$pass"; then
  7934. # Link the dlpreopened libraries before other libraries
  7935. for deplib in $save_deplibs; do
  7936. deplibs="$deplib $deplibs"
  7937. done
  7938. fi
  7939. if test dlopen != "$pass"; then
  7940. test conv = "$pass" || {
  7941. # Make sure lib_search_path contains only unique directories.
  7942. lib_search_path=
  7943. for dir in $newlib_search_path; do
  7944. case "$lib_search_path " in
  7945. *" $dir "*) ;;
  7946. *) func_append lib_search_path " $dir" ;;
  7947. esac
  7948. done
  7949. newlib_search_path=
  7950. }
  7951. if test prog,link = "$linkmode,$pass"; then
  7952. vars="compile_deplibs finalize_deplibs"
  7953. else
  7954. vars=deplibs
  7955. fi
  7956. for var in $vars dependency_libs; do
  7957. # Add libraries to $var in reverse order
  7958. eval tmp_libs=\"\$$var\"
  7959. new_libs=
  7960. for deplib in $tmp_libs; do
  7961. # FIXME: Pedantically, this is the right thing to do, so
  7962. # that some nasty dependency loop isn't accidentally
  7963. # broken:
  7964. #new_libs="$deplib $new_libs"
  7965. # Pragmatically, this seems to cause very few problems in
  7966. # practice:
  7967. case $deplib in
  7968. -L*) new_libs="$deplib $new_libs" ;;
  7969. -R*) ;;
  7970. *)
  7971. # And here is the reason: when a library appears more
  7972. # than once as an explicit dependence of a library, or
  7973. # is implicitly linked in more than once by the
  7974. # compiler, it is considered special, and multiple
  7975. # occurrences thereof are not removed. Compare this
  7976. # with having the same library being listed as a
  7977. # dependency of multiple other libraries: in this case,
  7978. # we know (pedantically, we assume) the library does not
  7979. # need to be listed more than once, so we keep only the
  7980. # last copy. This is not always right, but it is rare
  7981. # enough that we require users that really mean to play
  7982. # such unportable linking tricks to link the library
  7983. # using -Wl,-lname, so that libtool does not consider it
  7984. # for duplicate removal.
  7985. case " $specialdeplibs " in
  7986. *" $deplib "*) new_libs="$deplib $new_libs" ;;
  7987. *)
  7988. case " $new_libs " in
  7989. *" $deplib "*) ;;
  7990. *) new_libs="$deplib $new_libs" ;;
  7991. esac
  7992. ;;
  7993. esac
  7994. ;;
  7995. esac
  7996. done
  7997. tmp_libs=
  7998. for deplib in $new_libs; do
  7999. case $deplib in
  8000. -L*)
  8001. case " $tmp_libs " in
  8002. *" $deplib "*) ;;
  8003. *) func_append tmp_libs " $deplib" ;;
  8004. esac
  8005. ;;
  8006. *) func_append tmp_libs " $deplib" ;;
  8007. esac
  8008. done
  8009. eval $var=\"$tmp_libs\"
  8010. done # for var
  8011. fi
  8012. # Add Sun CC postdeps if required:
  8013. test CXX = "$tagname" && {
  8014. case $host_os in
  8015. linux*)
  8016. case `$CC -V 2>&1 | sed 5q` in
  8017. *Sun\ C*) # Sun C++ 5.9
  8018. func_suncc_cstd_abi
  8019. if test no != "$suncc_use_cstd_abi"; then
  8020. func_append postdeps ' -library=Cstd -library=Crun'
  8021. fi
  8022. ;;
  8023. esac
  8024. ;;
  8025. solaris*)
  8026. func_cc_basename "$CC"
  8027. case $func_cc_basename_result in
  8028. CC* | sunCC*)
  8029. func_suncc_cstd_abi
  8030. if test no != "$suncc_use_cstd_abi"; then
  8031. func_append postdeps ' -library=Cstd -library=Crun'
  8032. fi
  8033. ;;
  8034. esac
  8035. ;;
  8036. esac
  8037. }
  8038. # Last step: remove runtime libs from dependency_libs
  8039. # (they stay in deplibs)
  8040. tmp_libs=
  8041. for i in $dependency_libs; do
  8042. case " $predeps $postdeps $compiler_lib_search_path " in
  8043. *" $i "*)
  8044. i=
  8045. ;;
  8046. esac
  8047. if test -n "$i"; then
  8048. func_append tmp_libs " $i"
  8049. fi
  8050. done
  8051. dependency_libs=$tmp_libs
  8052. done # for pass
  8053. if test prog = "$linkmode"; then
  8054. dlfiles=$newdlfiles
  8055. fi
  8056. if test prog = "$linkmode" || test lib = "$linkmode"; then
  8057. dlprefiles=$newdlprefiles
  8058. fi
  8059. case $linkmode in
  8060. oldlib)
  8061. if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then
  8062. func_warning "'-dlopen' is ignored for archives"
  8063. fi
  8064. case " $deplibs" in
  8065. *\ -l* | *\ -L*)
  8066. func_warning "'-l' and '-L' are ignored for archives" ;;
  8067. esac
  8068. test -n "$rpath" && \
  8069. func_warning "'-rpath' is ignored for archives"
  8070. test -n "$xrpath" && \
  8071. func_warning "'-R' is ignored for archives"
  8072. test -n "$vinfo" && \
  8073. func_warning "'-version-info/-version-number' is ignored for archives"
  8074. test -n "$release" && \
  8075. func_warning "'-release' is ignored for archives"
  8076. test -n "$export_symbols$export_symbols_regex" && \
  8077. func_warning "'-export-symbols' is ignored for archives"
  8078. # Now set the variables for building old libraries.
  8079. build_libtool_libs=no
  8080. oldlibs=$output
  8081. func_append objs "$old_deplibs"
  8082. ;;
  8083. lib)
  8084. # Make sure we only generate libraries of the form 'libNAME.la'.
  8085. case $outputname in
  8086. lib*)
  8087. func_stripname 'lib' '.la' "$outputname"
  8088. name=$func_stripname_result
  8089. eval shared_ext=\"$shrext_cmds\"
  8090. eval libname=\"$libname_spec\"
  8091. ;;
  8092. *)
  8093. test no = "$module" \
  8094. && func_fatal_help "libtool library '$output' must begin with 'lib'"
  8095. if test no != "$need_lib_prefix"; then
  8096. # Add the "lib" prefix for modules if required
  8097. func_stripname '' '.la' "$outputname"
  8098. name=$func_stripname_result
  8099. eval shared_ext=\"$shrext_cmds\"
  8100. eval libname=\"$libname_spec\"
  8101. else
  8102. func_stripname '' '.la' "$outputname"
  8103. libname=$func_stripname_result
  8104. fi
  8105. ;;
  8106. esac
  8107. if test -n "$objs"; then
  8108. if test pass_all != "$deplibs_check_method"; then
  8109. func_fatal_error "cannot build libtool library '$output' from non-libtool objects on this host:$objs"
  8110. else
  8111. echo
  8112. $ECHO "*** Warning: Linking the shared library $output against the non-libtool"
  8113. $ECHO "*** objects $objs is not portable!"
  8114. func_append libobjs " $objs"
  8115. fi
  8116. fi
  8117. test no = "$dlself" \
  8118. || func_warning "'-dlopen self' is ignored for libtool libraries"
  8119. set dummy $rpath
  8120. shift
  8121. test 1 -lt "$#" \
  8122. && func_warning "ignoring multiple '-rpath's for a libtool library"
  8123. install_libdir=$1
  8124. oldlibs=
  8125. if test -z "$rpath"; then
  8126. if test yes = "$build_libtool_libs"; then
  8127. # Building a libtool convenience library.
  8128. # Some compilers have problems with a '.al' extension so
  8129. # convenience libraries should have the same extension an
  8130. # archive normally would.
  8131. oldlibs="$output_objdir/$libname.$libext $oldlibs"
  8132. build_libtool_libs=convenience
  8133. build_old_libs=yes
  8134. fi
  8135. test -n "$vinfo" && \
  8136. func_warning "'-version-info/-version-number' is ignored for convenience libraries"
  8137. test -n "$release" && \
  8138. func_warning "'-release' is ignored for convenience libraries"
  8139. else
  8140. # Parse the version information argument.
  8141. save_ifs=$IFS; IFS=:
  8142. set dummy $vinfo 0 0 0
  8143. shift
  8144. IFS=$save_ifs
  8145. test -n "$7" && \
  8146. func_fatal_help "too many parameters to '-version-info'"
  8147. # convert absolute version numbers to libtool ages
  8148. # this retains compatibility with .la files and attempts
  8149. # to make the code below a bit more comprehensible
  8150. case $vinfo_number in
  8151. yes)
  8152. number_major=$1
  8153. number_minor=$2
  8154. number_revision=$3
  8155. #
  8156. # There are really only two kinds -- those that
  8157. # use the current revision as the major version
  8158. # and those that subtract age and use age as
  8159. # a minor version. But, then there is irix
  8160. # that has an extra 1 added just for fun
  8161. #
  8162. case $version_type in
  8163. # correct linux to gnu/linux during the next big refactor
  8164. darwin|freebsd-elf|linux|osf|windows|none)
  8165. func_arith $number_major + $number_minor
  8166. current=$func_arith_result
  8167. age=$number_minor
  8168. revision=$number_revision
  8169. ;;
  8170. freebsd-aout|qnx|sunos)
  8171. current=$number_major
  8172. revision=$number_minor
  8173. age=0
  8174. ;;
  8175. irix|nonstopux)
  8176. func_arith $number_major + $number_minor
  8177. current=$func_arith_result
  8178. age=$number_minor
  8179. revision=$number_minor
  8180. lt_irix_increment=no
  8181. ;;
  8182. *)
  8183. func_fatal_configuration "$modename: unknown library version type '$version_type'"
  8184. ;;
  8185. esac
  8186. ;;
  8187. no)
  8188. current=$1
  8189. revision=$2
  8190. age=$3
  8191. ;;
  8192. esac
  8193. # Check that each of the things are valid numbers.
  8194. case $current in
  8195. 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]) ;;
  8196. *)
  8197. func_error "CURRENT '$current' must be a nonnegative integer"
  8198. func_fatal_error "'$vinfo' is not valid version information"
  8199. ;;
  8200. esac
  8201. case $revision in
  8202. 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]) ;;
  8203. *)
  8204. func_error "REVISION '$revision' must be a nonnegative integer"
  8205. func_fatal_error "'$vinfo' is not valid version information"
  8206. ;;
  8207. esac
  8208. case $age in
  8209. 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]) ;;
  8210. *)
  8211. func_error "AGE '$age' must be a nonnegative integer"
  8212. func_fatal_error "'$vinfo' is not valid version information"
  8213. ;;
  8214. esac
  8215. if test "$age" -gt "$current"; then
  8216. func_error "AGE '$age' is greater than the current interface number '$current'"
  8217. func_fatal_error "'$vinfo' is not valid version information"
  8218. fi
  8219. # Calculate the version variables.
  8220. major=
  8221. versuffix=
  8222. verstring=
  8223. case $version_type in
  8224. none) ;;
  8225. darwin)
  8226. # Like Linux, but with the current version available in
  8227. # verstring for coding it into the library header
  8228. func_arith $current - $age
  8229. major=.$func_arith_result
  8230. versuffix=$major.$age.$revision
  8231. # Darwin ld doesn't like 0 for these options...
  8232. func_arith $current + 1
  8233. minor_current=$func_arith_result
  8234. xlcverstring="$wl-compatibility_version $wl$minor_current $wl-current_version $wl$minor_current.$revision"
  8235. verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
  8236. # On Darwin other compilers
  8237. case $CC in
  8238. nagfor*)
  8239. verstring="$wl-compatibility_version $wl$minor_current $wl-current_version $wl$minor_current.$revision"
  8240. ;;
  8241. *)
  8242. verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
  8243. ;;
  8244. esac
  8245. ;;
  8246. freebsd-aout)
  8247. major=.$current
  8248. versuffix=.$current.$revision
  8249. ;;
  8250. freebsd-elf)
  8251. func_arith $current - $age
  8252. major=.$func_arith_result
  8253. versuffix=$major.$age.$revision
  8254. ;;
  8255. irix | nonstopux)
  8256. if test no = "$lt_irix_increment"; then
  8257. func_arith $current - $age
  8258. else
  8259. func_arith $current - $age + 1
  8260. fi
  8261. major=$func_arith_result
  8262. case $version_type in
  8263. nonstopux) verstring_prefix=nonstopux ;;
  8264. *) verstring_prefix=sgi ;;
  8265. esac
  8266. verstring=$verstring_prefix$major.$revision
  8267. # Add in all the interfaces that we are compatible with.
  8268. loop=$revision
  8269. while test 0 -ne "$loop"; do
  8270. func_arith $revision - $loop
  8271. iface=$func_arith_result
  8272. func_arith $loop - 1
  8273. loop=$func_arith_result
  8274. verstring=$verstring_prefix$major.$iface:$verstring
  8275. done
  8276. # Before this point, $major must not contain '.'.
  8277. major=.$major
  8278. versuffix=$major.$revision
  8279. ;;
  8280. linux) # correct to gnu/linux during the next big refactor
  8281. func_arith $current - $age
  8282. major=.$func_arith_result
  8283. versuffix=$major.$age.$revision
  8284. ;;
  8285. osf)
  8286. func_arith $current - $age
  8287. major=.$func_arith_result
  8288. versuffix=.$current.$age.$revision
  8289. verstring=$current.$age.$revision
  8290. # Add in all the interfaces that we are compatible with.
  8291. loop=$age
  8292. while test 0 -ne "$loop"; do
  8293. func_arith $current - $loop
  8294. iface=$func_arith_result
  8295. func_arith $loop - 1
  8296. loop=$func_arith_result
  8297. verstring=$verstring:$iface.0
  8298. done
  8299. # Make executables depend on our current version.
  8300. func_append verstring ":$current.0"
  8301. ;;
  8302. qnx)
  8303. major=.$current
  8304. versuffix=.$current
  8305. ;;
  8306. sco)
  8307. major=.$current
  8308. versuffix=.$current
  8309. ;;
  8310. sunos)
  8311. major=.$current
  8312. versuffix=.$current.$revision
  8313. ;;
  8314. windows)
  8315. # Use '-' rather than '.', since we only want one
  8316. # extension on DOS 8.3 file systems.
  8317. func_arith $current - $age
  8318. major=$func_arith_result
  8319. versuffix=-$major
  8320. ;;
  8321. *)
  8322. func_fatal_configuration "unknown library version type '$version_type'"
  8323. ;;
  8324. esac
  8325. # Clear the version info if we defaulted, and they specified a release.
  8326. if test -z "$vinfo" && test -n "$release"; then
  8327. major=
  8328. case $version_type in
  8329. darwin)
  8330. # we can't check for "0.0" in archive_cmds due to quoting
  8331. # problems, so we reset it completely
  8332. verstring=
  8333. ;;
  8334. *)
  8335. verstring=0.0
  8336. ;;
  8337. esac
  8338. if test no = "$need_version"; then
  8339. versuffix=
  8340. else
  8341. versuffix=.0.0
  8342. fi
  8343. fi
  8344. # Remove version info from name if versioning should be avoided
  8345. if test yes,no = "$avoid_version,$need_version"; then
  8346. major=
  8347. versuffix=
  8348. verstring=
  8349. fi
  8350. # Check to see if the archive will have undefined symbols.
  8351. if test yes = "$allow_undefined"; then
  8352. if test unsupported = "$allow_undefined_flag"; then
  8353. if test yes = "$build_old_libs"; then
  8354. func_warning "undefined symbols not allowed in $host shared libraries; building static only"
  8355. build_libtool_libs=no
  8356. else
  8357. func_fatal_error "can't build $host shared library unless -no-undefined is specified"
  8358. fi
  8359. fi
  8360. else
  8361. # Don't allow undefined symbols.
  8362. allow_undefined_flag=$no_undefined_flag
  8363. fi
  8364. fi
  8365. func_generate_dlsyms "$libname" "$libname" :
  8366. func_append libobjs " $symfileobj"
  8367. test " " = "$libobjs" && libobjs=
  8368. if test relink != "$opt_mode"; then
  8369. # Remove our outputs, but don't remove object files since they
  8370. # may have been created when compiling PIC objects.
  8371. removelist=
  8372. tempremovelist=`$ECHO "$output_objdir/*"`
  8373. for p in $tempremovelist; do
  8374. case $p in
  8375. *.$objext | *.gcno)
  8376. ;;
  8377. $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/$libname$release.*)
  8378. if test -n "$precious_files_regex"; then
  8379. if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
  8380. then
  8381. continue
  8382. fi
  8383. fi
  8384. func_append removelist " $p"
  8385. ;;
  8386. *) ;;
  8387. esac
  8388. done
  8389. test -n "$removelist" && \
  8390. func_show_eval "${RM}r \$removelist"
  8391. fi
  8392. # Now set the variables for building old libraries.
  8393. if test yes = "$build_old_libs" && test convenience != "$build_libtool_libs"; then
  8394. func_append oldlibs " $output_objdir/$libname.$libext"
  8395. # Transform .lo files to .o files.
  8396. oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.$libext$/d; $lo2o" | $NL2SP`
  8397. fi
  8398. # Eliminate all temporary directories.
  8399. #for path in $notinst_path; do
  8400. # lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"`
  8401. # deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"`
  8402. # dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"`
  8403. #done
  8404. if test -n "$xrpath"; then
  8405. # If the user specified any rpath flags, then add them.
  8406. temp_xrpath=
  8407. for libdir in $xrpath; do
  8408. func_replace_sysroot "$libdir"
  8409. func_append temp_xrpath " -R$func_replace_sysroot_result"
  8410. case "$finalize_rpath " in
  8411. *" $libdir "*) ;;
  8412. *) func_append finalize_rpath " $libdir" ;;
  8413. esac
  8414. done
  8415. if test yes != "$hardcode_into_libs" || test yes = "$build_old_libs"; then
  8416. dependency_libs="$temp_xrpath $dependency_libs"
  8417. fi
  8418. fi
  8419. # Make sure dlfiles contains only unique files that won't be dlpreopened
  8420. old_dlfiles=$dlfiles
  8421. dlfiles=
  8422. for lib in $old_dlfiles; do
  8423. case " $dlprefiles $dlfiles " in
  8424. *" $lib "*) ;;
  8425. *) func_append dlfiles " $lib" ;;
  8426. esac
  8427. done
  8428. # Make sure dlprefiles contains only unique files
  8429. old_dlprefiles=$dlprefiles
  8430. dlprefiles=
  8431. for lib in $old_dlprefiles; do
  8432. case "$dlprefiles " in
  8433. *" $lib "*) ;;
  8434. *) func_append dlprefiles " $lib" ;;
  8435. esac
  8436. done
  8437. if test yes = "$build_libtool_libs"; then
  8438. if test -n "$rpath"; then
  8439. case $host in
  8440. *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*)
  8441. # these systems don't actually have a c library (as such)!
  8442. ;;
  8443. *-*-rhapsody* | *-*-darwin1.[012])
  8444. # Rhapsody C library is in the System framework
  8445. func_append deplibs " System.ltframework"
  8446. ;;
  8447. *-*-netbsd*)
  8448. # Don't link with libc until the a.out ld.so is fixed.
  8449. ;;
  8450. *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
  8451. # Do not include libc due to us having libc/libc_r.
  8452. ;;
  8453. *-*-sco3.2v5* | *-*-sco5v6*)
  8454. # Causes problems with __ctype
  8455. ;;
  8456. *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
  8457. # Compiler inserts libc in the correct place for threads to work
  8458. ;;
  8459. *)
  8460. # Add libc to deplibs on all other systems if necessary.
  8461. if test yes = "$build_libtool_need_lc"; then
  8462. func_append deplibs " -lc"
  8463. fi
  8464. ;;
  8465. esac
  8466. fi
  8467. # Transform deplibs into only deplibs that can be linked in shared.
  8468. name_save=$name
  8469. libname_save=$libname
  8470. release_save=$release
  8471. versuffix_save=$versuffix
  8472. major_save=$major
  8473. # I'm not sure if I'm treating the release correctly. I think
  8474. # release should show up in the -l (ie -lgmp5) so we don't want to
  8475. # add it in twice. Is that correct?
  8476. release=
  8477. versuffix=
  8478. major=
  8479. newdeplibs=
  8480. droppeddeps=no
  8481. case $deplibs_check_method in
  8482. pass_all)
  8483. # Don't check for shared/static. Everything works.
  8484. # This might be a little naive. We might want to check
  8485. # whether the library exists or not. But this is on
  8486. # osf3 & osf4 and I'm not really sure... Just
  8487. # implementing what was already the behavior.
  8488. newdeplibs=$deplibs
  8489. ;;
  8490. test_compile)
  8491. # This code stresses the "libraries are programs" paradigm to its
  8492. # limits. Maybe even breaks it. We compile a program, linking it
  8493. # against the deplibs as a proxy for the library. Then we can check
  8494. # whether they linked in statically or dynamically with ldd.
  8495. $opt_dry_run || $RM conftest.c
  8496. cat > conftest.c <<EOF
  8497. int main() { return 0; }
  8498. EOF
  8499. $opt_dry_run || $RM conftest
  8500. if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then
  8501. ldd_output=`ldd conftest`
  8502. for i in $deplibs; do
  8503. case $i in
  8504. -l*)
  8505. func_stripname -l '' "$i"
  8506. name=$func_stripname_result
  8507. if test yes = "$allow_libtool_libs_with_static_runtimes"; then
  8508. case " $predeps $postdeps " in
  8509. *" $i "*)
  8510. func_append newdeplibs " $i"
  8511. i=
  8512. ;;
  8513. esac
  8514. fi
  8515. if test -n "$i"; then
  8516. libname=`eval "\\$ECHO \"$libname_spec\""`
  8517. deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
  8518. set dummy $deplib_matches; shift
  8519. deplib_match=$1
  8520. if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0; then
  8521. func_append newdeplibs " $i"
  8522. else
  8523. droppeddeps=yes
  8524. echo
  8525. $ECHO "*** Warning: dynamic linker does not accept needed library $i."
  8526. echo "*** I have the capability to make that library automatically link in when"
  8527. echo "*** you link to this library. But I can only do this if you have a"
  8528. echo "*** shared version of the library, which I believe you do not have"
  8529. echo "*** because a test_compile did reveal that the linker did not use it for"
  8530. echo "*** its dynamic dependency list that programs get resolved with at runtime."
  8531. fi
  8532. fi
  8533. ;;
  8534. *)
  8535. func_append newdeplibs " $i"
  8536. ;;
  8537. esac
  8538. done
  8539. else
  8540. # Error occurred in the first compile. Let's try to salvage
  8541. # the situation: Compile a separate program for each library.
  8542. for i in $deplibs; do
  8543. case $i in
  8544. -l*)
  8545. func_stripname -l '' "$i"
  8546. name=$func_stripname_result
  8547. $opt_dry_run || $RM conftest
  8548. if $LTCC $LTCFLAGS -o conftest conftest.c $i; then
  8549. ldd_output=`ldd conftest`
  8550. if test yes = "$allow_libtool_libs_with_static_runtimes"; then
  8551. case " $predeps $postdeps " in
  8552. *" $i "*)
  8553. func_append newdeplibs " $i"
  8554. i=
  8555. ;;
  8556. esac
  8557. fi
  8558. if test -n "$i"; then
  8559. libname=`eval "\\$ECHO \"$libname_spec\""`
  8560. deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
  8561. set dummy $deplib_matches; shift
  8562. deplib_match=$1
  8563. if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0; then
  8564. func_append newdeplibs " $i"
  8565. else
  8566. droppeddeps=yes
  8567. echo
  8568. $ECHO "*** Warning: dynamic linker does not accept needed library $i."
  8569. echo "*** I have the capability to make that library automatically link in when"
  8570. echo "*** you link to this library. But I can only do this if you have a"
  8571. echo "*** shared version of the library, which you do not appear to have"
  8572. echo "*** because a test_compile did reveal that the linker did not use this one"
  8573. echo "*** as a dynamic dependency that programs can get resolved with at runtime."
  8574. fi
  8575. fi
  8576. else
  8577. droppeddeps=yes
  8578. echo
  8579. $ECHO "*** Warning! Library $i is needed by this library but I was not able to"
  8580. echo "*** make it link in! You will probably need to install it or some"
  8581. echo "*** library that it depends on before this library will be fully"
  8582. echo "*** functional. Installing it before continuing would be even better."
  8583. fi
  8584. ;;
  8585. *)
  8586. func_append newdeplibs " $i"
  8587. ;;
  8588. esac
  8589. done
  8590. fi
  8591. ;;
  8592. file_magic*)
  8593. set dummy $deplibs_check_method; shift
  8594. file_magic_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
  8595. for a_deplib in $deplibs; do
  8596. case $a_deplib in
  8597. -l*)
  8598. func_stripname -l '' "$a_deplib"
  8599. name=$func_stripname_result
  8600. if test yes = "$allow_libtool_libs_with_static_runtimes"; then
  8601. case " $predeps $postdeps " in
  8602. *" $a_deplib "*)
  8603. func_append newdeplibs " $a_deplib"
  8604. a_deplib=
  8605. ;;
  8606. esac
  8607. fi
  8608. if test -n "$a_deplib"; then
  8609. libname=`eval "\\$ECHO \"$libname_spec\""`
  8610. if test -n "$file_magic_glob"; then
  8611. libnameglob=`func_echo_all "$libname" | $SED -e $file_magic_glob`
  8612. else
  8613. libnameglob=$libname
  8614. fi
  8615. test yes = "$want_nocaseglob" && nocaseglob=`shopt -p nocaseglob`
  8616. for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
  8617. if test yes = "$want_nocaseglob"; then
  8618. shopt -s nocaseglob
  8619. potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`
  8620. $nocaseglob
  8621. else
  8622. potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`
  8623. fi
  8624. for potent_lib in $potential_libs; do
  8625. # Follow soft links.
  8626. if ls -lLd "$potent_lib" 2>/dev/null |
  8627. $GREP " -> " >/dev/null; then
  8628. continue
  8629. fi
  8630. # The statement above tries to avoid entering an
  8631. # endless loop below, in case of cyclic links.
  8632. # We might still enter an endless loop, since a link
  8633. # loop can be closed while we follow links,
  8634. # but so what?
  8635. potlib=$potent_lib
  8636. while test -h "$potlib" 2>/dev/null; do
  8637. potliblink=`ls -ld $potlib | $SED 's/.* -> //'`
  8638. case $potliblink in
  8639. [\\/]* | [A-Za-z]:[\\/]*) potlib=$potliblink;;
  8640. *) potlib=`$ECHO "$potlib" | $SED 's|[^/]*$||'`"$potliblink";;
  8641. esac
  8642. done
  8643. if eval $file_magic_cmd \"\$potlib\" 2>/dev/null |
  8644. $SED -e 10q |
  8645. $EGREP "$file_magic_regex" > /dev/null; then
  8646. func_append newdeplibs " $a_deplib"
  8647. a_deplib=
  8648. break 2
  8649. fi
  8650. done
  8651. done
  8652. fi
  8653. if test -n "$a_deplib"; then
  8654. droppeddeps=yes
  8655. echo
  8656. $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
  8657. echo "*** I have the capability to make that library automatically link in when"
  8658. echo "*** you link to this library. But I can only do this if you have a"
  8659. echo "*** shared version of the library, which you do not appear to have"
  8660. echo "*** because I did check the linker path looking for a file starting"
  8661. if test -z "$potlib"; then
  8662. $ECHO "*** with $libname but no candidates were found. (...for file magic test)"
  8663. else
  8664. $ECHO "*** with $libname and none of the candidates passed a file format test"
  8665. $ECHO "*** using a file magic. Last file checked: $potlib"
  8666. fi
  8667. fi
  8668. ;;
  8669. *)
  8670. # Add a -L argument.
  8671. func_append newdeplibs " $a_deplib"
  8672. ;;
  8673. esac
  8674. done # Gone through all deplibs.
  8675. ;;
  8676. match_pattern*)
  8677. set dummy $deplibs_check_method; shift
  8678. match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
  8679. for a_deplib in $deplibs; do
  8680. case $a_deplib in
  8681. -l*)
  8682. func_stripname -l '' "$a_deplib"
  8683. name=$func_stripname_result
  8684. if test yes = "$allow_libtool_libs_with_static_runtimes"; then
  8685. case " $predeps $postdeps " in
  8686. *" $a_deplib "*)
  8687. func_append newdeplibs " $a_deplib"
  8688. a_deplib=
  8689. ;;
  8690. esac
  8691. fi
  8692. if test -n "$a_deplib"; then
  8693. libname=`eval "\\$ECHO \"$libname_spec\""`
  8694. for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
  8695. potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
  8696. for potent_lib in $potential_libs; do
  8697. potlib=$potent_lib # see symlink-check above in file_magic test
  8698. if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \
  8699. $EGREP "$match_pattern_regex" > /dev/null; then
  8700. func_append newdeplibs " $a_deplib"
  8701. a_deplib=
  8702. break 2
  8703. fi
  8704. done
  8705. done
  8706. fi
  8707. if test -n "$a_deplib"; then
  8708. droppeddeps=yes
  8709. echo
  8710. $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
  8711. echo "*** I have the capability to make that library automatically link in when"
  8712. echo "*** you link to this library. But I can only do this if you have a"
  8713. echo "*** shared version of the library, which you do not appear to have"
  8714. echo "*** because I did check the linker path looking for a file starting"
  8715. if test -z "$potlib"; then
  8716. $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)"
  8717. else
  8718. $ECHO "*** with $libname and none of the candidates passed a file format test"
  8719. $ECHO "*** using a regex pattern. Last file checked: $potlib"
  8720. fi
  8721. fi
  8722. ;;
  8723. *)
  8724. # Add a -L argument.
  8725. func_append newdeplibs " $a_deplib"
  8726. ;;
  8727. esac
  8728. done # Gone through all deplibs.
  8729. ;;
  8730. none | unknown | *)
  8731. newdeplibs=
  8732. tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'`
  8733. if test yes = "$allow_libtool_libs_with_static_runtimes"; then
  8734. for i in $predeps $postdeps; do
  8735. # can't use Xsed below, because $i might contain '/'
  8736. tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s|$i||"`
  8737. done
  8738. fi
  8739. case $tmp_deplibs in
  8740. *[!\ \ ]*)
  8741. echo
  8742. if test none = "$deplibs_check_method"; then
  8743. echo "*** Warning: inter-library dependencies are not supported in this platform."
  8744. else
  8745. echo "*** Warning: inter-library dependencies are not known to be supported."
  8746. fi
  8747. echo "*** All declared inter-library dependencies are being dropped."
  8748. droppeddeps=yes
  8749. ;;
  8750. esac
  8751. ;;
  8752. esac
  8753. versuffix=$versuffix_save
  8754. major=$major_save
  8755. release=$release_save
  8756. libname=$libname_save
  8757. name=$name_save
  8758. case $host in
  8759. *-*-rhapsody* | *-*-darwin1.[012])
  8760. # On Rhapsody replace the C library with the System framework
  8761. newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'`
  8762. ;;
  8763. esac
  8764. if test yes = "$droppeddeps"; then
  8765. if test yes = "$module"; then
  8766. echo
  8767. echo "*** Warning: libtool could not satisfy all declared inter-library"
  8768. $ECHO "*** dependencies of module $libname. Therefore, libtool will create"
  8769. echo "*** a static module, that should work as long as the dlopening"
  8770. echo "*** application is linked with the -dlopen flag."
  8771. if test -z "$global_symbol_pipe"; then
  8772. echo
  8773. echo "*** However, this would only work if libtool was able to extract symbol"
  8774. echo "*** lists from a program, using 'nm' or equivalent, but libtool could"
  8775. echo "*** not find such a program. So, this module is probably useless."
  8776. echo "*** 'nm' from GNU binutils and a full rebuild may help."
  8777. fi
  8778. if test no = "$build_old_libs"; then
  8779. oldlibs=$output_objdir/$libname.$libext
  8780. build_libtool_libs=module
  8781. build_old_libs=yes
  8782. else
  8783. build_libtool_libs=no
  8784. fi
  8785. else
  8786. echo "*** The inter-library dependencies that have been dropped here will be"
  8787. echo "*** automatically added whenever a program is linked with this library"
  8788. echo "*** or is declared to -dlopen it."
  8789. if test no = "$allow_undefined"; then
  8790. echo
  8791. echo "*** Since this library must not contain undefined symbols,"
  8792. echo "*** because either the platform does not support them or"
  8793. echo "*** it was explicitly requested with -no-undefined,"
  8794. echo "*** libtool will only create a static version of it."
  8795. if test no = "$build_old_libs"; then
  8796. oldlibs=$output_objdir/$libname.$libext
  8797. build_libtool_libs=module
  8798. build_old_libs=yes
  8799. else
  8800. build_libtool_libs=no
  8801. fi
  8802. fi
  8803. fi
  8804. fi
  8805. # Done checking deplibs!
  8806. deplibs=$newdeplibs
  8807. fi
  8808. # Time to change all our "foo.ltframework" stuff back to "-framework foo"
  8809. case $host in
  8810. *-*-darwin*)
  8811. newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
  8812. new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
  8813. deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
  8814. ;;
  8815. esac
  8816. # move library search paths that coincide with paths to not yet
  8817. # installed libraries to the beginning of the library search list
  8818. new_libs=
  8819. for path in $notinst_path; do
  8820. case " $new_libs " in
  8821. *" -L$path/$objdir "*) ;;
  8822. *)
  8823. case " $deplibs " in
  8824. *" -L$path/$objdir "*)
  8825. func_append new_libs " -L$path/$objdir" ;;
  8826. esac
  8827. ;;
  8828. esac
  8829. done
  8830. for deplib in $deplibs; do
  8831. case $deplib in
  8832. -L*)
  8833. case " $new_libs " in
  8834. *" $deplib "*) ;;
  8835. *) func_append new_libs " $deplib" ;;
  8836. esac
  8837. ;;
  8838. *) func_append new_libs " $deplib" ;;
  8839. esac
  8840. done
  8841. deplibs=$new_libs
  8842. # All the library-specific variables (install_libdir is set above).
  8843. library_names=
  8844. old_library=
  8845. dlname=
  8846. # Test again, we may have decided not to build it any more
  8847. if test yes = "$build_libtool_libs"; then
  8848. # Remove $wl instances when linking with ld.
  8849. # FIXME: should test the right _cmds variable.
  8850. case $archive_cmds in
  8851. *\$LD\ *) wl= ;;
  8852. esac
  8853. if test yes = "$hardcode_into_libs"; then
  8854. # Hardcode the library paths
  8855. hardcode_libdirs=
  8856. dep_rpath=
  8857. rpath=$finalize_rpath
  8858. test relink = "$opt_mode" || rpath=$compile_rpath$rpath
  8859. for libdir in $rpath; do
  8860. if test -n "$hardcode_libdir_flag_spec"; then
  8861. if test -n "$hardcode_libdir_separator"; then
  8862. func_replace_sysroot "$libdir"
  8863. libdir=$func_replace_sysroot_result
  8864. if test -z "$hardcode_libdirs"; then
  8865. hardcode_libdirs=$libdir
  8866. else
  8867. # Just accumulate the unique libdirs.
  8868. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
  8869. *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
  8870. ;;
  8871. *)
  8872. func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
  8873. ;;
  8874. esac
  8875. fi
  8876. else
  8877. eval flag=\"$hardcode_libdir_flag_spec\"
  8878. func_append dep_rpath " $flag"
  8879. fi
  8880. elif test -n "$runpath_var"; then
  8881. case "$perm_rpath " in
  8882. *" $libdir "*) ;;
  8883. *) func_append perm_rpath " $libdir" ;;
  8884. esac
  8885. fi
  8886. done
  8887. # Substitute the hardcoded libdirs into the rpath.
  8888. if test -n "$hardcode_libdir_separator" &&
  8889. test -n "$hardcode_libdirs"; then
  8890. libdir=$hardcode_libdirs
  8891. eval "dep_rpath=\"$hardcode_libdir_flag_spec\""
  8892. fi
  8893. if test -n "$runpath_var" && test -n "$perm_rpath"; then
  8894. # We should set the runpath_var.
  8895. rpath=
  8896. for dir in $perm_rpath; do
  8897. func_append rpath "$dir:"
  8898. done
  8899. eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
  8900. fi
  8901. test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
  8902. fi
  8903. shlibpath=$finalize_shlibpath
  8904. test relink = "$opt_mode" || shlibpath=$compile_shlibpath$shlibpath
  8905. if test -n "$shlibpath"; then
  8906. eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
  8907. fi
  8908. # Get the real and link names of the library.
  8909. eval shared_ext=\"$shrext_cmds\"
  8910. eval library_names=\"$library_names_spec\"
  8911. set dummy $library_names
  8912. shift
  8913. realname=$1
  8914. shift
  8915. if test -n "$soname_spec"; then
  8916. eval soname=\"$soname_spec\"
  8917. else
  8918. soname=$realname
  8919. fi
  8920. if test -z "$dlname"; then
  8921. dlname=$soname
  8922. fi
  8923. lib=$output_objdir/$realname
  8924. linknames=
  8925. for link
  8926. do
  8927. func_append linknames " $link"
  8928. done
  8929. # Use standard objects if they are pic
  8930. test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP`
  8931. test "X$libobjs" = "X " && libobjs=
  8932. delfiles=
  8933. if test -n "$export_symbols" && test -n "$include_expsyms"; then
  8934. $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp"
  8935. export_symbols=$output_objdir/$libname.uexp
  8936. func_append delfiles " $export_symbols"
  8937. fi
  8938. orig_export_symbols=
  8939. case $host_os in
  8940. cygwin* | mingw* | cegcc*)
  8941. if test -n "$export_symbols" && test -z "$export_symbols_regex"; then
  8942. # exporting using user supplied symfile
  8943. func_dll_def_p "$export_symbols" || {
  8944. # and it's NOT already a .def file. Must figure out
  8945. # which of the given symbols are data symbols and tag
  8946. # them as such. So, trigger use of export_symbols_cmds.
  8947. # export_symbols gets reassigned inside the "prepare
  8948. # the list of exported symbols" if statement, so the
  8949. # include_expsyms logic still works.
  8950. orig_export_symbols=$export_symbols
  8951. export_symbols=
  8952. always_export_symbols=yes
  8953. }
  8954. fi
  8955. ;;
  8956. esac
  8957. # Prepare the list of exported symbols
  8958. if test -z "$export_symbols"; then
  8959. if test yes = "$always_export_symbols" || test -n "$export_symbols_regex"; then
  8960. func_verbose "generating symbol list for '$libname.la'"
  8961. export_symbols=$output_objdir/$libname.exp
  8962. $opt_dry_run || $RM $export_symbols
  8963. cmds=$export_symbols_cmds
  8964. save_ifs=$IFS; IFS='~'
  8965. for cmd1 in $cmds; do
  8966. IFS=$save_ifs
  8967. # Take the normal branch if the nm_file_list_spec branch
  8968. # doesn't work or if tool conversion is not needed.
  8969. case $nm_file_list_spec~$to_tool_file_cmd in
  8970. *~func_convert_file_noop | *~func_convert_file_msys_to_w32 | ~*)
  8971. try_normal_branch=yes
  8972. eval cmd=\"$cmd1\"
  8973. func_len " $cmd"
  8974. len=$func_len_result
  8975. ;;
  8976. *)
  8977. try_normal_branch=no
  8978. ;;
  8979. esac
  8980. if test yes = "$try_normal_branch" \
  8981. && { test "$len" -lt "$max_cmd_len" \
  8982. || test "$max_cmd_len" -le -1; }
  8983. then
  8984. func_show_eval "$cmd" 'exit $?'
  8985. skipped_export=false
  8986. elif test -n "$nm_file_list_spec"; then
  8987. func_basename "$output"
  8988. output_la=$func_basename_result
  8989. save_libobjs=$libobjs
  8990. save_output=$output
  8991. output=$output_objdir/$output_la.nm
  8992. func_to_tool_file "$output"
  8993. libobjs=$nm_file_list_spec$func_to_tool_file_result
  8994. func_append delfiles " $output"
  8995. func_verbose "creating $NM input file list: $output"
  8996. for obj in $save_libobjs; do
  8997. func_to_tool_file "$obj"
  8998. $ECHO "$func_to_tool_file_result"
  8999. done > "$output"
  9000. eval cmd=\"$cmd1\"
  9001. func_show_eval "$cmd" 'exit $?'
  9002. output=$save_output
  9003. libobjs=$save_libobjs
  9004. skipped_export=false
  9005. else
  9006. # The command line is too long to execute in one step.
  9007. func_verbose "using reloadable object file for export list..."
  9008. skipped_export=:
  9009. # Break out early, otherwise skipped_export may be
  9010. # set to false by a later but shorter cmd.
  9011. break
  9012. fi
  9013. done
  9014. IFS=$save_ifs
  9015. if test -n "$export_symbols_regex" && test : != "$skipped_export"; then
  9016. func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
  9017. func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
  9018. fi
  9019. fi
  9020. fi
  9021. if test -n "$export_symbols" && test -n "$include_expsyms"; then
  9022. tmp_export_symbols=$export_symbols
  9023. test -n "$orig_export_symbols" && tmp_export_symbols=$orig_export_symbols
  9024. $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
  9025. fi
  9026. if test : != "$skipped_export" && test -n "$orig_export_symbols"; then
  9027. # The given exports_symbols file has to be filtered, so filter it.
  9028. func_verbose "filter symbol list for '$libname.la' to tag DATA exports"
  9029. # FIXME: $output_objdir/$libname.filter potentially contains lots of
  9030. # 's' commands, which not all seds can handle. GNU sed should be fine
  9031. # though. Also, the filter scales superlinearly with the number of
  9032. # global variables. join(1) would be nice here, but unfortunately
  9033. # isn't a blessed tool.
  9034. $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
  9035. func_append delfiles " $export_symbols $output_objdir/$libname.filter"
  9036. export_symbols=$output_objdir/$libname.def
  9037. $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
  9038. fi
  9039. tmp_deplibs=
  9040. for test_deplib in $deplibs; do
  9041. case " $convenience " in
  9042. *" $test_deplib "*) ;;
  9043. *)
  9044. func_append tmp_deplibs " $test_deplib"
  9045. ;;
  9046. esac
  9047. done
  9048. deplibs=$tmp_deplibs
  9049. if test -n "$convenience"; then
  9050. if test -n "$whole_archive_flag_spec" &&
  9051. test yes = "$compiler_needs_object" &&
  9052. test -z "$libobjs"; then
  9053. # extract the archives, so we have objects to list.
  9054. # TODO: could optimize this to just extract one archive.
  9055. whole_archive_flag_spec=
  9056. fi
  9057. if test -n "$whole_archive_flag_spec"; then
  9058. save_libobjs=$libobjs
  9059. eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
  9060. test "X$libobjs" = "X " && libobjs=
  9061. else
  9062. gentop=$output_objdir/${outputname}x
  9063. func_append generated " $gentop"
  9064. func_extract_archives $gentop $convenience
  9065. func_append libobjs " $func_extract_archives_result"
  9066. test "X$libobjs" = "X " && libobjs=
  9067. fi
  9068. fi
  9069. if test yes = "$thread_safe" && test -n "$thread_safe_flag_spec"; then
  9070. eval flag=\"$thread_safe_flag_spec\"
  9071. func_append linker_flags " $flag"
  9072. fi
  9073. # Make a backup of the uninstalled library when relinking
  9074. if test relink = "$opt_mode"; then
  9075. $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $?
  9076. fi
  9077. # Do each of the archive commands.
  9078. if test yes = "$module" && test -n "$module_cmds"; then
  9079. if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
  9080. eval test_cmds=\"$module_expsym_cmds\"
  9081. cmds=$module_expsym_cmds
  9082. else
  9083. eval test_cmds=\"$module_cmds\"
  9084. cmds=$module_cmds
  9085. fi
  9086. else
  9087. if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
  9088. eval test_cmds=\"$archive_expsym_cmds\"
  9089. cmds=$archive_expsym_cmds
  9090. else
  9091. eval test_cmds=\"$archive_cmds\"
  9092. cmds=$archive_cmds
  9093. fi
  9094. fi
  9095. if test : != "$skipped_export" &&
  9096. func_len " $test_cmds" &&
  9097. len=$func_len_result &&
  9098. test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
  9099. :
  9100. else
  9101. # The command line is too long to link in one step, link piecewise
  9102. # or, if using GNU ld and skipped_export is not :, use a linker
  9103. # script.
  9104. # Save the value of $output and $libobjs because we want to
  9105. # use them later. If we have whole_archive_flag_spec, we
  9106. # want to use save_libobjs as it was before
  9107. # whole_archive_flag_spec was expanded, because we can't
  9108. # assume the linker understands whole_archive_flag_spec.
  9109. # This may have to be revisited, in case too many
  9110. # convenience libraries get linked in and end up exceeding
  9111. # the spec.
  9112. if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
  9113. save_libobjs=$libobjs
  9114. fi
  9115. save_output=$output
  9116. func_basename "$output"
  9117. output_la=$func_basename_result
  9118. # Clear the reloadable object creation command queue and
  9119. # initialize k to one.
  9120. test_cmds=
  9121. concat_cmds=
  9122. objlist=
  9123. last_robj=
  9124. k=1
  9125. if test -n "$save_libobjs" && test : != "$skipped_export" && test yes = "$with_gnu_ld"; then
  9126. output=$output_objdir/$output_la.lnkscript
  9127. func_verbose "creating GNU ld script: $output"
  9128. echo 'INPUT (' > $output
  9129. for obj in $save_libobjs
  9130. do
  9131. func_to_tool_file "$obj"
  9132. $ECHO "$func_to_tool_file_result" >> $output
  9133. done
  9134. echo ')' >> $output
  9135. func_append delfiles " $output"
  9136. func_to_tool_file "$output"
  9137. output=$func_to_tool_file_result
  9138. elif test -n "$save_libobjs" && test : != "$skipped_export" && test -n "$file_list_spec"; then
  9139. output=$output_objdir/$output_la.lnk
  9140. func_verbose "creating linker input file list: $output"
  9141. : > $output
  9142. set x $save_libobjs
  9143. shift
  9144. firstobj=
  9145. if test yes = "$compiler_needs_object"; then
  9146. firstobj="$1 "
  9147. shift
  9148. fi
  9149. for obj
  9150. do
  9151. func_to_tool_file "$obj"
  9152. $ECHO "$func_to_tool_file_result" >> $output
  9153. done
  9154. func_append delfiles " $output"
  9155. func_to_tool_file "$output"
  9156. output=$firstobj\"$file_list_spec$func_to_tool_file_result\"
  9157. else
  9158. if test -n "$save_libobjs"; then
  9159. func_verbose "creating reloadable object files..."
  9160. output=$output_objdir/$output_la-$k.$objext
  9161. eval test_cmds=\"$reload_cmds\"
  9162. func_len " $test_cmds"
  9163. len0=$func_len_result
  9164. len=$len0
  9165. # Loop over the list of objects to be linked.
  9166. for obj in $save_libobjs
  9167. do
  9168. func_len " $obj"
  9169. func_arith $len + $func_len_result
  9170. len=$func_arith_result
  9171. if test -z "$objlist" ||
  9172. test "$len" -lt "$max_cmd_len"; then
  9173. func_append objlist " $obj"
  9174. else
  9175. # The command $test_cmds is almost too long, add a
  9176. # command to the queue.
  9177. if test 1 -eq "$k"; then
  9178. # The first file doesn't have a previous command to add.
  9179. reload_objs=$objlist
  9180. eval concat_cmds=\"$reload_cmds\"
  9181. else
  9182. # All subsequent reloadable object files will link in
  9183. # the last one created.
  9184. reload_objs="$objlist $last_robj"
  9185. eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\"
  9186. fi
  9187. last_robj=$output_objdir/$output_la-$k.$objext
  9188. func_arith $k + 1
  9189. k=$func_arith_result
  9190. output=$output_objdir/$output_la-$k.$objext
  9191. objlist=" $obj"
  9192. func_len " $last_robj"
  9193. func_arith $len0 + $func_len_result
  9194. len=$func_arith_result
  9195. fi
  9196. done
  9197. # Handle the remaining objects by creating one last
  9198. # reloadable object file. All subsequent reloadable object
  9199. # files will link in the last one created.
  9200. test -z "$concat_cmds" || concat_cmds=$concat_cmds~
  9201. reload_objs="$objlist $last_robj"
  9202. eval concat_cmds=\"\$concat_cmds$reload_cmds\"
  9203. if test -n "$last_robj"; then
  9204. eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\"
  9205. fi
  9206. func_append delfiles " $output"
  9207. else
  9208. output=
  9209. fi
  9210. ${skipped_export-false} && {
  9211. func_verbose "generating symbol list for '$libname.la'"
  9212. export_symbols=$output_objdir/$libname.exp
  9213. $opt_dry_run || $RM $export_symbols
  9214. libobjs=$output
  9215. # Append the command to create the export file.
  9216. test -z "$concat_cmds" || concat_cmds=$concat_cmds~
  9217. eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\"
  9218. if test -n "$last_robj"; then
  9219. eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\"
  9220. fi
  9221. }
  9222. test -n "$save_libobjs" &&
  9223. func_verbose "creating a temporary reloadable object file: $output"
  9224. # Loop through the commands generated above and execute them.
  9225. save_ifs=$IFS; IFS='~'
  9226. for cmd in $concat_cmds; do
  9227. IFS=$save_ifs
  9228. $opt_quiet || {
  9229. func_quote_for_expand "$cmd"
  9230. eval "func_echo $func_quote_for_expand_result"
  9231. }
  9232. $opt_dry_run || eval "$cmd" || {
  9233. lt_exit=$?
  9234. # Restore the uninstalled library and exit
  9235. if test relink = "$opt_mode"; then
  9236. ( cd "$output_objdir" && \
  9237. $RM "${realname}T" && \
  9238. $MV "${realname}U" "$realname" )
  9239. fi
  9240. exit $lt_exit
  9241. }
  9242. done
  9243. IFS=$save_ifs
  9244. if test -n "$export_symbols_regex" && ${skipped_export-false}; then
  9245. func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
  9246. func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
  9247. fi
  9248. fi
  9249. ${skipped_export-false} && {
  9250. if test -n "$export_symbols" && test -n "$include_expsyms"; then
  9251. tmp_export_symbols=$export_symbols
  9252. test -n "$orig_export_symbols" && tmp_export_symbols=$orig_export_symbols
  9253. $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
  9254. fi
  9255. if test -n "$orig_export_symbols"; then
  9256. # The given exports_symbols file has to be filtered, so filter it.
  9257. func_verbose "filter symbol list for '$libname.la' to tag DATA exports"
  9258. # FIXME: $output_objdir/$libname.filter potentially contains lots of
  9259. # 's' commands, which not all seds can handle. GNU sed should be fine
  9260. # though. Also, the filter scales superlinearly with the number of
  9261. # global variables. join(1) would be nice here, but unfortunately
  9262. # isn't a blessed tool.
  9263. $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
  9264. func_append delfiles " $export_symbols $output_objdir/$libname.filter"
  9265. export_symbols=$output_objdir/$libname.def
  9266. $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
  9267. fi
  9268. }
  9269. libobjs=$output
  9270. # Restore the value of output.
  9271. output=$save_output
  9272. if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
  9273. eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
  9274. test "X$libobjs" = "X " && libobjs=
  9275. fi
  9276. # Expand the library linking commands again to reset the
  9277. # value of $libobjs for piecewise linking.
  9278. # Do each of the archive commands.
  9279. if test yes = "$module" && test -n "$module_cmds"; then
  9280. if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
  9281. cmds=$module_expsym_cmds
  9282. else
  9283. cmds=$module_cmds
  9284. fi
  9285. else
  9286. if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
  9287. cmds=$archive_expsym_cmds
  9288. else
  9289. cmds=$archive_cmds
  9290. fi
  9291. fi
  9292. fi
  9293. if test -n "$delfiles"; then
  9294. # Append the command to remove temporary files to $cmds.
  9295. eval cmds=\"\$cmds~\$RM $delfiles\"
  9296. fi
  9297. # Add any objects from preloaded convenience libraries
  9298. if test -n "$dlprefiles"; then
  9299. gentop=$output_objdir/${outputname}x
  9300. func_append generated " $gentop"
  9301. func_extract_archives $gentop $dlprefiles
  9302. func_append libobjs " $func_extract_archives_result"
  9303. test "X$libobjs" = "X " && libobjs=
  9304. fi
  9305. save_ifs=$IFS; IFS='~'
  9306. for cmd in $cmds; do
  9307. IFS=$sp$nl
  9308. eval cmd=\"$cmd\"
  9309. IFS=$save_ifs
  9310. $opt_quiet || {
  9311. func_quote_for_expand "$cmd"
  9312. eval "func_echo $func_quote_for_expand_result"
  9313. }
  9314. $opt_dry_run || eval "$cmd" || {
  9315. lt_exit=$?
  9316. # Restore the uninstalled library and exit
  9317. if test relink = "$opt_mode"; then
  9318. ( cd "$output_objdir" && \
  9319. $RM "${realname}T" && \
  9320. $MV "${realname}U" "$realname" )
  9321. fi
  9322. exit $lt_exit
  9323. }
  9324. done
  9325. IFS=$save_ifs
  9326. # Restore the uninstalled library and exit
  9327. if test relink = "$opt_mode"; then
  9328. $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $?
  9329. if test -n "$convenience"; then
  9330. if test -z "$whole_archive_flag_spec"; then
  9331. func_show_eval '${RM}r "$gentop"'
  9332. fi
  9333. fi
  9334. exit $EXIT_SUCCESS
  9335. fi
  9336. # Create links to the real library.
  9337. for linkname in $linknames; do
  9338. if test "$realname" != "$linkname"; then
  9339. func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?'
  9340. fi
  9341. done
  9342. # If -module or -export-dynamic was specified, set the dlname.
  9343. if test yes = "$module" || test yes = "$export_dynamic"; then
  9344. # On all known operating systems, these are identical.
  9345. dlname=$soname
  9346. fi
  9347. fi
  9348. ;;
  9349. obj)
  9350. if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then
  9351. func_warning "'-dlopen' is ignored for objects"
  9352. fi
  9353. case " $deplibs" in
  9354. *\ -l* | *\ -L*)
  9355. func_warning "'-l' and '-L' are ignored for objects" ;;
  9356. esac
  9357. test -n "$rpath" && \
  9358. func_warning "'-rpath' is ignored for objects"
  9359. test -n "$xrpath" && \
  9360. func_warning "'-R' is ignored for objects"
  9361. test -n "$vinfo" && \
  9362. func_warning "'-version-info' is ignored for objects"
  9363. test -n "$release" && \
  9364. func_warning "'-release' is ignored for objects"
  9365. case $output in
  9366. *.lo)
  9367. test -n "$objs$old_deplibs" && \
  9368. func_fatal_error "cannot build library object '$output' from non-libtool objects"
  9369. libobj=$output
  9370. func_lo2o "$libobj"
  9371. obj=$func_lo2o_result
  9372. ;;
  9373. *)
  9374. libobj=
  9375. obj=$output
  9376. ;;
  9377. esac
  9378. # Delete the old objects.
  9379. $opt_dry_run || $RM $obj $libobj
  9380. # Objects from convenience libraries. This assumes
  9381. # single-version convenience libraries. Whenever we create
  9382. # different ones for PIC/non-PIC, this we'll have to duplicate
  9383. # the extraction.
  9384. reload_conv_objs=
  9385. gentop=
  9386. # if reload_cmds runs $LD directly, get rid of -Wl from
  9387. # whole_archive_flag_spec and hope we can get by with turning comma
  9388. # into space.
  9389. case $reload_cmds in
  9390. *\$LD[\ \$]*) wl= ;;
  9391. esac
  9392. if test -n "$convenience"; then
  9393. if test -n "$whole_archive_flag_spec"; then
  9394. eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
  9395. test -n "$wl" || tmp_whole_archive_flags=`$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'`
  9396. reload_conv_objs=$reload_objs\ $tmp_whole_archive_flags
  9397. else
  9398. gentop=$output_objdir/${obj}x
  9399. func_append generated " $gentop"
  9400. func_extract_archives $gentop $convenience
  9401. reload_conv_objs="$reload_objs $func_extract_archives_result"
  9402. fi
  9403. fi
  9404. # If we're not building shared, we need to use non_pic_objs
  9405. test yes = "$build_libtool_libs" || libobjs=$non_pic_objects
  9406. # Create the old-style object.
  9407. reload_objs=$objs$old_deplibs' '`$ECHO "$libobjs" | $SP2NL | $SED "/\.$libext$/d; /\.lib$/d; $lo2o" | $NL2SP`' '$reload_conv_objs
  9408. output=$obj
  9409. func_execute_cmds "$reload_cmds" 'exit $?'
  9410. # Exit if we aren't doing a library object file.
  9411. if test -z "$libobj"; then
  9412. if test -n "$gentop"; then
  9413. func_show_eval '${RM}r "$gentop"'
  9414. fi
  9415. exit $EXIT_SUCCESS
  9416. fi
  9417. test yes = "$build_libtool_libs" || {
  9418. if test -n "$gentop"; then
  9419. func_show_eval '${RM}r "$gentop"'
  9420. fi
  9421. # Create an invalid libtool object if no PIC, so that we don't
  9422. # accidentally link it into a program.
  9423. # $show "echo timestamp > $libobj"
  9424. # $opt_dry_run || eval "echo timestamp > $libobj" || exit $?
  9425. exit $EXIT_SUCCESS
  9426. }
  9427. if test -n "$pic_flag" || test default != "$pic_mode"; then
  9428. # Only do commands if we really have different PIC objects.
  9429. reload_objs="$libobjs $reload_conv_objs"
  9430. output=$libobj
  9431. func_execute_cmds "$reload_cmds" 'exit $?'
  9432. fi
  9433. if test -n "$gentop"; then
  9434. func_show_eval '${RM}r "$gentop"'
  9435. fi
  9436. exit $EXIT_SUCCESS
  9437. ;;
  9438. prog)
  9439. case $host in
  9440. *cygwin*) func_stripname '' '.exe' "$output"
  9441. output=$func_stripname_result.exe;;
  9442. esac
  9443. test -n "$vinfo" && \
  9444. func_warning "'-version-info' is ignored for programs"
  9445. test -n "$release" && \
  9446. func_warning "'-release' is ignored for programs"
  9447. $preload \
  9448. && test unknown,unknown,unknown = "$dlopen_support,$dlopen_self,$dlopen_self_static" \
  9449. && func_warning "'LT_INIT([dlopen])' not used. Assuming no dlopen support."
  9450. case $host in
  9451. *-*-rhapsody* | *-*-darwin1.[012])
  9452. # On Rhapsody replace the C library is the System framework
  9453. compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'`
  9454. finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'`
  9455. ;;
  9456. esac
  9457. case $host in
  9458. *-*-darwin*)
  9459. # Don't allow lazy linking, it breaks C++ global constructors
  9460. # But is supposedly fixed on 10.4 or later (yay!).
  9461. if test CXX = "$tagname"; then
  9462. case ${MACOSX_DEPLOYMENT_TARGET-10.0} in
  9463. 10.[0123])
  9464. func_append compile_command " $wl-bind_at_load"
  9465. func_append finalize_command " $wl-bind_at_load"
  9466. ;;
  9467. esac
  9468. fi
  9469. # Time to change all our "foo.ltframework" stuff back to "-framework foo"
  9470. compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
  9471. finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
  9472. ;;
  9473. esac
  9474. # move library search paths that coincide with paths to not yet
  9475. # installed libraries to the beginning of the library search list
  9476. new_libs=
  9477. for path in $notinst_path; do
  9478. case " $new_libs " in
  9479. *" -L$path/$objdir "*) ;;
  9480. *)
  9481. case " $compile_deplibs " in
  9482. *" -L$path/$objdir "*)
  9483. func_append new_libs " -L$path/$objdir" ;;
  9484. esac
  9485. ;;
  9486. esac
  9487. done
  9488. for deplib in $compile_deplibs; do
  9489. case $deplib in
  9490. -L*)
  9491. case " $new_libs " in
  9492. *" $deplib "*) ;;
  9493. *) func_append new_libs " $deplib" ;;
  9494. esac
  9495. ;;
  9496. *) func_append new_libs " $deplib" ;;
  9497. esac
  9498. done
  9499. compile_deplibs=$new_libs
  9500. func_append compile_command " $compile_deplibs"
  9501. func_append finalize_command " $finalize_deplibs"
  9502. if test -n "$rpath$xrpath"; then
  9503. # If the user specified any rpath flags, then add them.
  9504. for libdir in $rpath $xrpath; do
  9505. # This is the magic to use -rpath.
  9506. case "$finalize_rpath " in
  9507. *" $libdir "*) ;;
  9508. *) func_append finalize_rpath " $libdir" ;;
  9509. esac
  9510. done
  9511. fi
  9512. # Now hardcode the library paths
  9513. rpath=
  9514. hardcode_libdirs=
  9515. for libdir in $compile_rpath $finalize_rpath; do
  9516. if test -n "$hardcode_libdir_flag_spec"; then
  9517. if test -n "$hardcode_libdir_separator"; then
  9518. if test -z "$hardcode_libdirs"; then
  9519. hardcode_libdirs=$libdir
  9520. else
  9521. # Just accumulate the unique libdirs.
  9522. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
  9523. *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
  9524. ;;
  9525. *)
  9526. func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
  9527. ;;
  9528. esac
  9529. fi
  9530. else
  9531. eval flag=\"$hardcode_libdir_flag_spec\"
  9532. func_append rpath " $flag"
  9533. fi
  9534. elif test -n "$runpath_var"; then
  9535. case "$perm_rpath " in
  9536. *" $libdir "*) ;;
  9537. *) func_append perm_rpath " $libdir" ;;
  9538. esac
  9539. fi
  9540. case $host in
  9541. *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
  9542. testbindir=`$ECHO "$libdir" | $SED -e 's*/lib$*/bin*'`
  9543. case :$dllsearchpath: in
  9544. *":$libdir:"*) ;;
  9545. ::) dllsearchpath=$libdir;;
  9546. *) func_append dllsearchpath ":$libdir";;
  9547. esac
  9548. case :$dllsearchpath: in
  9549. *":$testbindir:"*) ;;
  9550. ::) dllsearchpath=$testbindir;;
  9551. *) func_append dllsearchpath ":$testbindir";;
  9552. esac
  9553. ;;
  9554. esac
  9555. done
  9556. # Substitute the hardcoded libdirs into the rpath.
  9557. if test -n "$hardcode_libdir_separator" &&
  9558. test -n "$hardcode_libdirs"; then
  9559. libdir=$hardcode_libdirs
  9560. eval rpath=\" $hardcode_libdir_flag_spec\"
  9561. fi
  9562. compile_rpath=$rpath
  9563. rpath=
  9564. hardcode_libdirs=
  9565. for libdir in $finalize_rpath; do
  9566. if test -n "$hardcode_libdir_flag_spec"; then
  9567. if test -n "$hardcode_libdir_separator"; then
  9568. if test -z "$hardcode_libdirs"; then
  9569. hardcode_libdirs=$libdir
  9570. else
  9571. # Just accumulate the unique libdirs.
  9572. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
  9573. *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
  9574. ;;
  9575. *)
  9576. func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
  9577. ;;
  9578. esac
  9579. fi
  9580. else
  9581. eval flag=\"$hardcode_libdir_flag_spec\"
  9582. func_append rpath " $flag"
  9583. fi
  9584. elif test -n "$runpath_var"; then
  9585. case "$finalize_perm_rpath " in
  9586. *" $libdir "*) ;;
  9587. *) func_append finalize_perm_rpath " $libdir" ;;
  9588. esac
  9589. fi
  9590. done
  9591. # Substitute the hardcoded libdirs into the rpath.
  9592. if test -n "$hardcode_libdir_separator" &&
  9593. test -n "$hardcode_libdirs"; then
  9594. libdir=$hardcode_libdirs
  9595. eval rpath=\" $hardcode_libdir_flag_spec\"
  9596. fi
  9597. finalize_rpath=$rpath
  9598. if test -n "$libobjs" && test yes = "$build_old_libs"; then
  9599. # Transform all the library objects into standard objects.
  9600. compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
  9601. finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
  9602. fi
  9603. func_generate_dlsyms "$outputname" "@PROGRAM@" false
  9604. # template prelinking step
  9605. if test -n "$prelink_cmds"; then
  9606. func_execute_cmds "$prelink_cmds" 'exit $?'
  9607. fi
  9608. wrappers_required=:
  9609. case $host in
  9610. *cegcc* | *mingw32ce*)
  9611. # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway.
  9612. wrappers_required=false
  9613. ;;
  9614. *cygwin* | *mingw* )
  9615. test yes = "$build_libtool_libs" || wrappers_required=false
  9616. ;;
  9617. *)
  9618. if test no = "$need_relink" || test yes != "$build_libtool_libs"; then
  9619. wrappers_required=false
  9620. fi
  9621. ;;
  9622. esac
  9623. $wrappers_required || {
  9624. # Replace the output file specification.
  9625. compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
  9626. link_command=$compile_command$compile_rpath
  9627. # We have no uninstalled library dependencies, so finalize right now.
  9628. exit_status=0
  9629. func_show_eval "$link_command" 'exit_status=$?'
  9630. if test -n "$postlink_cmds"; then
  9631. func_to_tool_file "$output"
  9632. postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
  9633. func_execute_cmds "$postlink_cmds" 'exit $?'
  9634. fi
  9635. # Delete the generated files.
  9636. if test -f "$output_objdir/${outputname}S.$objext"; then
  9637. func_show_eval '$RM "$output_objdir/${outputname}S.$objext"'
  9638. fi
  9639. exit $exit_status
  9640. }
  9641. if test -n "$compile_shlibpath$finalize_shlibpath"; then
  9642. compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
  9643. fi
  9644. if test -n "$finalize_shlibpath"; then
  9645. finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
  9646. fi
  9647. compile_var=
  9648. finalize_var=
  9649. if test -n "$runpath_var"; then
  9650. if test -n "$perm_rpath"; then
  9651. # We should set the runpath_var.
  9652. rpath=
  9653. for dir in $perm_rpath; do
  9654. func_append rpath "$dir:"
  9655. done
  9656. compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
  9657. fi
  9658. if test -n "$finalize_perm_rpath"; then
  9659. # We should set the runpath_var.
  9660. rpath=
  9661. for dir in $finalize_perm_rpath; do
  9662. func_append rpath "$dir:"
  9663. done
  9664. finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
  9665. fi
  9666. fi
  9667. if test yes = "$no_install"; then
  9668. # We don't need to create a wrapper script.
  9669. link_command=$compile_var$compile_command$compile_rpath
  9670. # Replace the output file specification.
  9671. link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
  9672. # Delete the old output file.
  9673. $opt_dry_run || $RM $output
  9674. # Link the executable and exit
  9675. func_show_eval "$link_command" 'exit $?'
  9676. if test -n "$postlink_cmds"; then
  9677. func_to_tool_file "$output"
  9678. postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
  9679. func_execute_cmds "$postlink_cmds" 'exit $?'
  9680. fi
  9681. exit $EXIT_SUCCESS
  9682. fi
  9683. case $hardcode_action,$fast_install in
  9684. relink,*)
  9685. # Fast installation is not supported
  9686. link_command=$compile_var$compile_command$compile_rpath
  9687. relink_command=$finalize_var$finalize_command$finalize_rpath
  9688. func_warning "this platform does not like uninstalled shared libraries"
  9689. func_warning "'$output' will be relinked during installation"
  9690. ;;
  9691. *,yes)
  9692. link_command=$finalize_var$compile_command$finalize_rpath
  9693. relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'`
  9694. ;;
  9695. *,no)
  9696. link_command=$compile_var$compile_command$compile_rpath
  9697. relink_command=$finalize_var$finalize_command$finalize_rpath
  9698. ;;
  9699. *,needless)
  9700. link_command=$finalize_var$compile_command$finalize_rpath
  9701. relink_command=
  9702. ;;
  9703. esac
  9704. # Replace the output file specification.
  9705. link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
  9706. # Delete the old output files.
  9707. $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname
  9708. func_show_eval "$link_command" 'exit $?'
  9709. if test -n "$postlink_cmds"; then
  9710. func_to_tool_file "$output_objdir/$outputname"
  9711. postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
  9712. func_execute_cmds "$postlink_cmds" 'exit $?'
  9713. fi
  9714. # Now create the wrapper script.
  9715. func_verbose "creating $output"
  9716. # Quote the relink command for shipping.
  9717. if test -n "$relink_command"; then
  9718. # Preserve any variables that may affect compiler behavior
  9719. for var in $variables_saved_for_relink; do
  9720. if eval test -z \"\${$var+set}\"; then
  9721. relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
  9722. elif eval var_value=\$$var; test -z "$var_value"; then
  9723. relink_command="$var=; export $var; $relink_command"
  9724. else
  9725. func_quote_for_eval "$var_value"
  9726. relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
  9727. fi
  9728. done
  9729. relink_command="(cd `pwd`; $relink_command)"
  9730. relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
  9731. fi
  9732. # Only actually do things if not in dry run mode.
  9733. $opt_dry_run || {
  9734. # win32 will think the script is a binary if it has
  9735. # a .exe suffix, so we strip it off here.
  9736. case $output in
  9737. *.exe) func_stripname '' '.exe' "$output"
  9738. output=$func_stripname_result ;;
  9739. esac
  9740. # test for cygwin because mv fails w/o .exe extensions
  9741. case $host in
  9742. *cygwin*)
  9743. exeext=.exe
  9744. func_stripname '' '.exe' "$outputname"
  9745. outputname=$func_stripname_result ;;
  9746. *) exeext= ;;
  9747. esac
  9748. case $host in
  9749. *cygwin* | *mingw* )
  9750. func_dirname_and_basename "$output" "" "."
  9751. output_name=$func_basename_result
  9752. output_path=$func_dirname_result
  9753. cwrappersource=$output_path/$objdir/lt-$output_name.c
  9754. cwrapper=$output_path/$output_name.exe
  9755. $RM $cwrappersource $cwrapper
  9756. trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
  9757. func_emit_cwrapperexe_src > $cwrappersource
  9758. # The wrapper executable is built using the $host compiler,
  9759. # because it contains $host paths and files. If cross-
  9760. # compiling, it, like the target executable, must be
  9761. # executed on the $host or under an emulation environment.
  9762. $opt_dry_run || {
  9763. $LTCC $LTCFLAGS -o $cwrapper $cwrappersource
  9764. $STRIP $cwrapper
  9765. }
  9766. # Now, create the wrapper script for func_source use:
  9767. func_ltwrapper_scriptname $cwrapper
  9768. $RM $func_ltwrapper_scriptname_result
  9769. trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15
  9770. $opt_dry_run || {
  9771. # note: this script will not be executed, so do not chmod.
  9772. if test "x$build" = "x$host"; then
  9773. $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result
  9774. else
  9775. func_emit_wrapper no > $func_ltwrapper_scriptname_result
  9776. fi
  9777. }
  9778. ;;
  9779. * )
  9780. $RM $output
  9781. trap "$RM $output; exit $EXIT_FAILURE" 1 2 15
  9782. func_emit_wrapper no > $output
  9783. chmod +x $output
  9784. ;;
  9785. esac
  9786. }
  9787. exit $EXIT_SUCCESS
  9788. ;;
  9789. esac
  9790. # See if we need to build an old-fashioned archive.
  9791. for oldlib in $oldlibs; do
  9792. case $build_libtool_libs in
  9793. convenience)
  9794. oldobjs="$libobjs_save $symfileobj"
  9795. addlibs=$convenience
  9796. build_libtool_libs=no
  9797. ;;
  9798. module)
  9799. oldobjs=$libobjs_save
  9800. addlibs=$old_convenience
  9801. build_libtool_libs=no
  9802. ;;
  9803. *)
  9804. oldobjs="$old_deplibs $non_pic_objects"
  9805. $preload && test -f "$symfileobj" \
  9806. && func_append oldobjs " $symfileobj"
  9807. addlibs=$old_convenience
  9808. ;;
  9809. esac
  9810. if test -n "$addlibs"; then
  9811. gentop=$output_objdir/${outputname}x
  9812. func_append generated " $gentop"
  9813. func_extract_archives $gentop $addlibs
  9814. func_append oldobjs " $func_extract_archives_result"
  9815. fi
  9816. # Do each command in the archive commands.
  9817. if test -n "$old_archive_from_new_cmds" && test yes = "$build_libtool_libs"; then
  9818. cmds=$old_archive_from_new_cmds
  9819. else
  9820. # Add any objects from preloaded convenience libraries
  9821. if test -n "$dlprefiles"; then
  9822. gentop=$output_objdir/${outputname}x
  9823. func_append generated " $gentop"
  9824. func_extract_archives $gentop $dlprefiles
  9825. func_append oldobjs " $func_extract_archives_result"
  9826. fi
  9827. # POSIX demands no paths to be encoded in archives. We have
  9828. # to avoid creating archives with duplicate basenames if we
  9829. # might have to extract them afterwards, e.g., when creating a
  9830. # static archive out of a convenience library, or when linking
  9831. # the entirety of a libtool archive into another (currently
  9832. # not supported by libtool).
  9833. if (for obj in $oldobjs
  9834. do
  9835. func_basename "$obj"
  9836. $ECHO "$func_basename_result"
  9837. done | sort | sort -uc >/dev/null 2>&1); then
  9838. :
  9839. else
  9840. echo "copying selected object files to avoid basename conflicts..."
  9841. gentop=$output_objdir/${outputname}x
  9842. func_append generated " $gentop"
  9843. func_mkdir_p "$gentop"
  9844. save_oldobjs=$oldobjs
  9845. oldobjs=
  9846. counter=1
  9847. for obj in $save_oldobjs
  9848. do
  9849. func_basename "$obj"
  9850. objbase=$func_basename_result
  9851. case " $oldobjs " in
  9852. " ") oldobjs=$obj ;;
  9853. *[\ /]"$objbase "*)
  9854. while :; do
  9855. # Make sure we don't pick an alternate name that also
  9856. # overlaps.
  9857. newobj=lt$counter-$objbase
  9858. func_arith $counter + 1
  9859. counter=$func_arith_result
  9860. case " $oldobjs " in
  9861. *[\ /]"$newobj "*) ;;
  9862. *) if test ! -f "$gentop/$newobj"; then break; fi ;;
  9863. esac
  9864. done
  9865. func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
  9866. func_append oldobjs " $gentop/$newobj"
  9867. ;;
  9868. *) func_append oldobjs " $obj" ;;
  9869. esac
  9870. done
  9871. fi
  9872. func_to_tool_file "$oldlib" func_convert_file_msys_to_w32
  9873. tool_oldlib=$func_to_tool_file_result
  9874. eval cmds=\"$old_archive_cmds\"
  9875. func_len " $cmds"
  9876. len=$func_len_result
  9877. if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
  9878. cmds=$old_archive_cmds
  9879. elif test -n "$archiver_list_spec"; then
  9880. func_verbose "using command file archive linking..."
  9881. for obj in $oldobjs
  9882. do
  9883. func_to_tool_file "$obj"
  9884. $ECHO "$func_to_tool_file_result"
  9885. done > $output_objdir/$libname.libcmd
  9886. func_to_tool_file "$output_objdir/$libname.libcmd"
  9887. oldobjs=" $archiver_list_spec$func_to_tool_file_result"
  9888. cmds=$old_archive_cmds
  9889. else
  9890. # the command line is too long to link in one step, link in parts
  9891. func_verbose "using piecewise archive linking..."
  9892. save_RANLIB=$RANLIB
  9893. RANLIB=:
  9894. objlist=
  9895. concat_cmds=
  9896. save_oldobjs=$oldobjs
  9897. oldobjs=
  9898. # Is there a better way of finding the last object in the list?
  9899. for obj in $save_oldobjs
  9900. do
  9901. last_oldobj=$obj
  9902. done
  9903. eval test_cmds=\"$old_archive_cmds\"
  9904. func_len " $test_cmds"
  9905. len0=$func_len_result
  9906. len=$len0
  9907. for obj in $save_oldobjs
  9908. do
  9909. func_len " $obj"
  9910. func_arith $len + $func_len_result
  9911. len=$func_arith_result
  9912. func_append objlist " $obj"
  9913. if test "$len" -lt "$max_cmd_len"; then
  9914. :
  9915. else
  9916. # the above command should be used before it gets too long
  9917. oldobjs=$objlist
  9918. if test "$obj" = "$last_oldobj"; then
  9919. RANLIB=$save_RANLIB
  9920. fi
  9921. test -z "$concat_cmds" || concat_cmds=$concat_cmds~
  9922. eval concat_cmds=\"\$concat_cmds$old_archive_cmds\"
  9923. objlist=
  9924. len=$len0
  9925. fi
  9926. done
  9927. RANLIB=$save_RANLIB
  9928. oldobjs=$objlist
  9929. if test -z "$oldobjs"; then
  9930. eval cmds=\"\$concat_cmds\"
  9931. else
  9932. eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
  9933. fi
  9934. fi
  9935. fi
  9936. func_execute_cmds "$cmds" 'exit $?'
  9937. done
  9938. test -n "$generated" && \
  9939. func_show_eval "${RM}r$generated"
  9940. # Now create the libtool archive.
  9941. case $output in
  9942. *.la)
  9943. old_library=
  9944. test yes = "$build_old_libs" && old_library=$libname.$libext
  9945. func_verbose "creating $output"
  9946. # Preserve any variables that may affect compiler behavior
  9947. for var in $variables_saved_for_relink; do
  9948. if eval test -z \"\${$var+set}\"; then
  9949. relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
  9950. elif eval var_value=\$$var; test -z "$var_value"; then
  9951. relink_command="$var=; export $var; $relink_command"
  9952. else
  9953. func_quote_for_eval "$var_value"
  9954. relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
  9955. fi
  9956. done
  9957. # Quote the link command for shipping.
  9958. relink_command="(cd `pwd`; $SHELL \"$progpath\" $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
  9959. relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
  9960. if test yes = "$hardcode_automatic"; then
  9961. relink_command=
  9962. fi
  9963. # Only create the output if not a dry run.
  9964. $opt_dry_run || {
  9965. for installed in no yes; do
  9966. if test yes = "$installed"; then
  9967. if test -z "$install_libdir"; then
  9968. break
  9969. fi
  9970. output=$output_objdir/${outputname}i
  9971. # Replace all uninstalled libtool libraries with the installed ones
  9972. newdependency_libs=
  9973. for deplib in $dependency_libs; do
  9974. # Replacing uninstalled with installed can easily break crosscompilation,
  9975. # since the installed path is generally the wrong architecture. -CL
  9976. newdependency_libs="$newdependency_libs $deplib"
  9977. continue
  9978. case $deplib in
  9979. *.la)
  9980. func_basename "$deplib"
  9981. name=$func_basename_result
  9982. func_resolve_sysroot "$deplib"
  9983. eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $func_resolve_sysroot_result`
  9984. test -z "$libdir" && \
  9985. func_fatal_error "'$deplib' is not a valid libtool archive"
  9986. func_append newdependency_libs " ${lt_sysroot:+=}$libdir/$name"
  9987. ;;
  9988. -L*)
  9989. func_stripname -L '' "$deplib"
  9990. func_replace_sysroot "$func_stripname_result"
  9991. func_append newdependency_libs " -L$func_replace_sysroot_result"
  9992. ;;
  9993. -R*)
  9994. func_stripname -R '' "$deplib"
  9995. func_replace_sysroot "$func_stripname_result"
  9996. func_append newdependency_libs " -R$func_replace_sysroot_result"
  9997. ;;
  9998. *) func_append newdependency_libs " $deplib" ;;
  9999. esac
  10000. done
  10001. dependency_libs=$newdependency_libs
  10002. newdlfiles=
  10003. for lib in $dlfiles; do
  10004. case $lib in
  10005. *.la)
  10006. func_basename "$lib"
  10007. name=$func_basename_result
  10008. eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
  10009. test -z "$libdir" && \
  10010. func_fatal_error "'$lib' is not a valid libtool archive"
  10011. func_append newdlfiles " ${lt_sysroot:+=}$libdir/$name"
  10012. ;;
  10013. *) func_append newdlfiles " $lib" ;;
  10014. esac
  10015. done
  10016. dlfiles=$newdlfiles
  10017. newdlprefiles=
  10018. for lib in $dlprefiles; do
  10019. case $lib in
  10020. *.la)
  10021. # Only pass preopened files to the pseudo-archive (for
  10022. # eventual linking with the app. that links it) if we
  10023. # didn't already link the preopened objects directly into
  10024. # the library:
  10025. func_basename "$lib"
  10026. name=$func_basename_result
  10027. eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
  10028. test -z "$libdir" && \
  10029. func_fatal_error "'$lib' is not a valid libtool archive"
  10030. func_append newdlprefiles " ${lt_sysroot:+=}$libdir/$name"
  10031. ;;
  10032. esac
  10033. done
  10034. dlprefiles=$newdlprefiles
  10035. else
  10036. newdlfiles=
  10037. for lib in $dlfiles; do
  10038. case $lib in
  10039. [\\/]* | [A-Za-z]:[\\/]*) abs=$lib ;;
  10040. *) abs=`pwd`"/$lib" ;;
  10041. esac
  10042. func_append newdlfiles " $abs"
  10043. done
  10044. dlfiles=$newdlfiles
  10045. newdlprefiles=
  10046. for lib in $dlprefiles; do
  10047. case $lib in
  10048. [\\/]* | [A-Za-z]:[\\/]*) abs=$lib ;;
  10049. *) abs=`pwd`"/$lib" ;;
  10050. esac
  10051. func_append newdlprefiles " $abs"
  10052. done
  10053. dlprefiles=$newdlprefiles
  10054. fi
  10055. $RM $output
  10056. # place dlname in correct position for cygwin
  10057. # In fact, it would be nice if we could use this code for all target
  10058. # systems that can't hard-code library paths into their executables
  10059. # and that have no shared library path variable independent of PATH,
  10060. # but it turns out we can't easily determine that from inspecting
  10061. # libtool variables, so we have to hard-code the OSs to which it
  10062. # applies here; at the moment, that means platforms that use the PE
  10063. # object format with DLL files. See the long comment at the top of
  10064. # tests/bindir.at for full details.
  10065. tdlname=$dlname
  10066. case $host,$output,$installed,$module,$dlname in
  10067. *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll)
  10068. # If a -bindir argument was supplied, place the dll there.
  10069. if test -n "$bindir"; then
  10070. func_relative_path "$install_libdir" "$bindir"
  10071. tdlname=$func_relative_path_result/$dlname
  10072. else
  10073. # Otherwise fall back on heuristic.
  10074. tdlname=../bin/$dlname
  10075. fi
  10076. ;;
  10077. esac
  10078. $ECHO > $output "\
  10079. # $outputname - a libtool library file
  10080. # Generated by $PROGRAM (GNU $PACKAGE) $VERSION
  10081. #
  10082. # Please DO NOT delete this file!
  10083. # It is necessary for linking the library.
  10084. # The name that we can dlopen(3).
  10085. dlname='$tdlname'
  10086. # Names of this library.
  10087. library_names='$library_names'
  10088. # The name of the static archive.
  10089. old_library='$old_library'
  10090. # Linker flags that cannot go in dependency_libs.
  10091. inherited_linker_flags='$new_inherited_linker_flags'
  10092. # Libraries that this one depends upon.
  10093. dependency_libs='$dependency_libs'
  10094. # Names of additional weak libraries provided by this library
  10095. weak_library_names='$weak_libs'
  10096. # Version information for $libname.
  10097. current=$current
  10098. age=$age
  10099. revision=$revision
  10100. # Is this an already installed library?
  10101. installed=$installed
  10102. # Should we warn about portability when linking against -modules?
  10103. shouldnotlink=$module
  10104. # Files to dlopen/dlpreopen
  10105. dlopen='$dlfiles'
  10106. dlpreopen='$dlprefiles'
  10107. # Directory that this library needs to be installed in:
  10108. libdir='$install_libdir'"
  10109. if test no,yes = "$installed,$need_relink"; then
  10110. $ECHO >> $output "\
  10111. relink_command=\"$relink_command\""
  10112. fi
  10113. done
  10114. }
  10115. # Do a symbolic link so that the libtool archive can be found in
  10116. # LD_LIBRARY_PATH before the program is installed.
  10117. func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?'
  10118. ;;
  10119. esac
  10120. exit $EXIT_SUCCESS
  10121. }
  10122. if test link = "$opt_mode" || test relink = "$opt_mode"; then
  10123. func_mode_link ${1+"$@"}
  10124. fi
  10125. # func_mode_uninstall arg...
  10126. func_mode_uninstall ()
  10127. {
  10128. $debug_cmd
  10129. RM=$nonopt
  10130. files=
  10131. rmforce=false
  10132. exit_status=0
  10133. # This variable tells wrapper scripts just to set variables rather
  10134. # than running their programs.
  10135. libtool_install_magic=$magic
  10136. for arg
  10137. do
  10138. case $arg in
  10139. -f) func_append RM " $arg"; rmforce=: ;;
  10140. -*) func_append RM " $arg" ;;
  10141. *) func_append files " $arg" ;;
  10142. esac
  10143. done
  10144. test -z "$RM" && \
  10145. func_fatal_help "you must specify an RM program"
  10146. rmdirs=
  10147. for file in $files; do
  10148. func_dirname "$file" "" "."
  10149. dir=$func_dirname_result
  10150. if test . = "$dir"; then
  10151. odir=$objdir
  10152. else
  10153. odir=$dir/$objdir
  10154. fi
  10155. func_basename "$file"
  10156. name=$func_basename_result
  10157. test uninstall = "$opt_mode" && odir=$dir
  10158. # Remember odir for removal later, being careful to avoid duplicates
  10159. if test clean = "$opt_mode"; then
  10160. case " $rmdirs " in
  10161. *" $odir "*) ;;
  10162. *) func_append rmdirs " $odir" ;;
  10163. esac
  10164. fi
  10165. # Don't error if the file doesn't exist and rm -f was used.
  10166. if { test -L "$file"; } >/dev/null 2>&1 ||
  10167. { test -h "$file"; } >/dev/null 2>&1 ||
  10168. test -f "$file"; then
  10169. :
  10170. elif test -d "$file"; then
  10171. exit_status=1
  10172. continue
  10173. elif $rmforce; then
  10174. continue
  10175. fi
  10176. rmfiles=$file
  10177. case $name in
  10178. *.la)
  10179. # Possibly a libtool archive, so verify it.
  10180. if func_lalib_p "$file"; then
  10181. func_source $dir/$name
  10182. # Delete the libtool libraries and symlinks.
  10183. for n in $library_names; do
  10184. func_append rmfiles " $odir/$n"
  10185. done
  10186. test -n "$old_library" && func_append rmfiles " $odir/$old_library"
  10187. case $opt_mode in
  10188. clean)
  10189. case " $library_names " in
  10190. *" $dlname "*) ;;
  10191. *) test -n "$dlname" && func_append rmfiles " $odir/$dlname" ;;
  10192. esac
  10193. test -n "$libdir" && func_append rmfiles " $odir/$name $odir/${name}i"
  10194. ;;
  10195. uninstall)
  10196. if test -n "$library_names"; then
  10197. # Do each command in the postuninstall commands.
  10198. func_execute_cmds "$postuninstall_cmds" '$rmforce || exit_status=1'
  10199. fi
  10200. if test -n "$old_library"; then
  10201. # Do each command in the old_postuninstall commands.
  10202. func_execute_cmds "$old_postuninstall_cmds" '$rmforce || exit_status=1'
  10203. fi
  10204. # FIXME: should reinstall the best remaining shared library.
  10205. ;;
  10206. esac
  10207. fi
  10208. ;;
  10209. *.lo)
  10210. # Possibly a libtool object, so verify it.
  10211. if func_lalib_p "$file"; then
  10212. # Read the .lo file
  10213. func_source $dir/$name
  10214. # Add PIC object to the list of files to remove.
  10215. if test -n "$pic_object" && test none != "$pic_object"; then
  10216. func_append rmfiles " $dir/$pic_object"
  10217. fi
  10218. # Add non-PIC object to the list of files to remove.
  10219. if test -n "$non_pic_object" && test none != "$non_pic_object"; then
  10220. func_append rmfiles " $dir/$non_pic_object"
  10221. fi
  10222. fi
  10223. ;;
  10224. *)
  10225. if test clean = "$opt_mode"; then
  10226. noexename=$name
  10227. case $file in
  10228. *.exe)
  10229. func_stripname '' '.exe' "$file"
  10230. file=$func_stripname_result
  10231. func_stripname '' '.exe' "$name"
  10232. noexename=$func_stripname_result
  10233. # $file with .exe has already been added to rmfiles,
  10234. # add $file without .exe
  10235. func_append rmfiles " $file"
  10236. ;;
  10237. esac
  10238. # Do a test to see if this is a libtool program.
  10239. if func_ltwrapper_p "$file"; then
  10240. if func_ltwrapper_executable_p "$file"; then
  10241. func_ltwrapper_scriptname "$file"
  10242. relink_command=
  10243. func_source $func_ltwrapper_scriptname_result
  10244. func_append rmfiles " $func_ltwrapper_scriptname_result"
  10245. else
  10246. relink_command=
  10247. func_source $dir/$noexename
  10248. fi
  10249. # note $name still contains .exe if it was in $file originally
  10250. # as does the version of $file that was added into $rmfiles
  10251. func_append rmfiles " $odir/$name $odir/${name}S.$objext"
  10252. if test yes = "$fast_install" && test -n "$relink_command"; then
  10253. func_append rmfiles " $odir/lt-$name"
  10254. fi
  10255. if test "X$noexename" != "X$name"; then
  10256. func_append rmfiles " $odir/lt-$noexename.c"
  10257. fi
  10258. fi
  10259. fi
  10260. ;;
  10261. esac
  10262. func_show_eval "$RM $rmfiles" 'exit_status=1'
  10263. done
  10264. # Try to remove the $objdir's in the directories where we deleted files
  10265. for dir in $rmdirs; do
  10266. if test -d "$dir"; then
  10267. func_show_eval "rmdir $dir >/dev/null 2>&1"
  10268. fi
  10269. done
  10270. exit $exit_status
  10271. }
  10272. if test uninstall = "$opt_mode" || test clean = "$opt_mode"; then
  10273. func_mode_uninstall ${1+"$@"}
  10274. fi
  10275. test -z "$opt_mode" && {
  10276. help=$generic_help
  10277. func_fatal_help "you must specify a MODE"
  10278. }
  10279. test -z "$exec_cmd" && \
  10280. func_fatal_help "invalid operation mode '$opt_mode'"
  10281. if test -n "$exec_cmd"; then
  10282. eval exec "$exec_cmd"
  10283. exit $EXIT_FAILURE
  10284. fi
  10285. exit $exit_status
  10286. # The TAGs below are defined such that we never get into a situation
  10287. # where we disable both kinds of libraries. Given conflicting
  10288. # choices, we go for a static library, that is the most portable,
  10289. # since we can't tell whether shared libraries were disabled because
  10290. # the user asked for that or because the platform doesn't support
  10291. # them. This is particularly important on AIX, because we don't
  10292. # support having both static and shared libraries enabled at the same
  10293. # time on that platform, so we default to a shared-only configuration.
  10294. # If a disable-shared tag is given, we'll fallback to a static-only
  10295. # configuration. But we'll never go from static-only to shared-only.
  10296. # ### BEGIN LIBTOOL TAG CONFIG: disable-shared
  10297. build_libtool_libs=no
  10298. build_old_libs=yes
  10299. # ### END LIBTOOL TAG CONFIG: disable-shared
  10300. # ### BEGIN LIBTOOL TAG CONFIG: disable-static
  10301. build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
  10302. # ### END LIBTOOL TAG CONFIG: disable-static
  10303. # Local Variables:
  10304. # mode:shell-script
  10305. # sh-indentation:2
  10306. # End: