ltmain.sh 320 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251
  1. #! /bin/sh
  2. ## DO NOT EDIT - This file generated from ./build-aux/ltmain.in
  3. ## by inline-source v2014-01-03.01
  4. # libtool (GNU libtool) 2.4.6
  5. # Provide generalized library-building support services.
  6. # Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
  7. # Copyright (C) 1996-2015 Free Software Foundation, Inc.
  8. # This is free software; see the source for copying conditions. There is NO
  9. # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  10. # GNU Libtool is free software; you can redistribute it and/or modify
  11. # it under the terms of the GNU General Public License as published by
  12. # the Free Software Foundation; either version 2 of the License, or
  13. # (at your option) any later version.
  14. #
  15. # As a special exception to the GNU General Public License,
  16. # if you distribute this file as part of a program or library that
  17. # is built using GNU Libtool, you may include this file under the
  18. # same distribution terms that you use for the rest of that program.
  19. #
  20. # GNU Libtool is distributed in the hope that it will be useful, but
  21. # WITHOUT ANY WARRANTY; without even the implied warranty of
  22. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  23. # General Public License for more details.
  24. #
  25. # You should have received a copy of the GNU General Public License
  26. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  27. PROGRAM=libtool
  28. PACKAGE=libtool
  29. VERSION="2.4.6 Debian-2.4.6-14"
  30. package_revision=2.4.6
  31. ## ------ ##
  32. ## Usage. ##
  33. ## ------ ##
  34. # Run './libtool --help' for help with using this script from the
  35. # command line.
  36. ## ------------------------------- ##
  37. ## User overridable command paths. ##
  38. ## ------------------------------- ##
  39. # After configure completes, it has a better idea of some of the
  40. # shell tools we need than the defaults used by the functions shared
  41. # with bootstrap, so set those here where they can still be over-
  42. # ridden by the user, but otherwise take precedence.
  43. : ${AUTOCONF="autoconf"}
  44. : ${AUTOMAKE="automake"}
  45. ## -------------------------- ##
  46. ## Source external libraries. ##
  47. ## -------------------------- ##
  48. # Much of our low-level functionality needs to be sourced from external
  49. # libraries, which are installed to $pkgauxdir.
  50. # Set a version string for this script.
  51. scriptversion=2015-01-20.17; # UTC
  52. # General shell script boiler plate, and helper functions.
  53. # Written by Gary V. Vaughan, 2004
  54. # Copyright (C) 2004-2015 Free Software Foundation, Inc.
  55. # This is free software; see the source for copying conditions. There is NO
  56. # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  57. # This program is free software; you can redistribute it and/or modify
  58. # it under the terms of the GNU General Public License as published by
  59. # the Free Software Foundation; either version 3 of the License, or
  60. # (at your option) any later version.
  61. # As a special exception to the GNU General Public License, if you distribute
  62. # this file as part of a program or library that is built using GNU Libtool,
  63. # you may include this file under the same distribution terms that you use
  64. # for the rest of that program.
  65. # This program is distributed in the hope that it will be useful,
  66. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  67. # MERCHANTABILITY or FITNES FOR A PARTICULAR PURPOSE. See the GNU
  68. # General Public License for more details.
  69. # You should have received a copy of the GNU General Public License
  70. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  71. # Please report bugs or propose patches to gary@gnu.org.
  72. ## ------ ##
  73. ## Usage. ##
  74. ## ------ ##
  75. # Evaluate this file near the top of your script to gain access to
  76. # the functions and variables defined here:
  77. #
  78. # . `echo "$0" | ${SED-sed} 's|[^/]*$||'`/build-aux/funclib.sh
  79. #
  80. # If you need to override any of the default environment variable
  81. # settings, do that before evaluating this file.
  82. ## -------------------- ##
  83. ## Shell normalisation. ##
  84. ## -------------------- ##
  85. # Some shells need a little help to be as Bourne compatible as possible.
  86. # Before doing anything else, make sure all that help has been provided!
  87. DUALCASE=1; export DUALCASE # for MKS sh
  88. if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then :
  89. emulate sh
  90. NULLCMD=:
  91. # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
  92. # is contrary to our usage. Disable this feature.
  93. alias -g '${1+"$@"}'='"$@"'
  94. setopt NO_GLOB_SUBST
  95. else
  96. case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac
  97. fi
  98. # NLS nuisances: We save the old values in case they are required later.
  99. _G_user_locale=
  100. _G_safe_locale=
  101. for _G_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
  102. do
  103. eval "if test set = \"\${$_G_var+set}\"; then
  104. save_$_G_var=\$$_G_var
  105. $_G_var=C
  106. export $_G_var
  107. _G_user_locale=\"$_G_var=\\\$save_\$_G_var; \$_G_user_locale\"
  108. _G_safe_locale=\"$_G_var=C; \$_G_safe_locale\"
  109. fi"
  110. done
  111. # CDPATH.
  112. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
  113. # Make sure IFS has a sensible default
  114. sp=' '
  115. nl='
  116. '
  117. IFS="$sp $nl"
  118. # There are apparently some retarded systems that use ';' as a PATH separator!
  119. if test "${PATH_SEPARATOR+set}" != set; then
  120. PATH_SEPARATOR=:
  121. (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
  122. (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
  123. PATH_SEPARATOR=';'
  124. }
  125. fi
  126. ## ------------------------- ##
  127. ## Locate command utilities. ##
  128. ## ------------------------- ##
  129. # func_executable_p FILE
  130. # ----------------------
  131. # Check that FILE is an executable regular file.
  132. func_executable_p ()
  133. {
  134. test -f "$1" && test -x "$1"
  135. }
  136. # func_path_progs PROGS_LIST CHECK_FUNC [PATH]
  137. # --------------------------------------------
  138. # Search for either a program that responds to --version with output
  139. # containing "GNU", or else returned by CHECK_FUNC otherwise, by
  140. # trying all the directories in PATH with each of the elements of
  141. # PROGS_LIST.
  142. #
  143. # CHECK_FUNC should accept the path to a candidate program, and
  144. # set $func_check_prog_result if it truncates its output less than
  145. # $_G_path_prog_max characters.
  146. func_path_progs ()
  147. {
  148. _G_progs_list=$1
  149. _G_check_func=$2
  150. _G_PATH=${3-"$PATH"}
  151. _G_path_prog_max=0
  152. _G_path_prog_found=false
  153. _G_save_IFS=$IFS; IFS=${PATH_SEPARATOR-:}
  154. for _G_dir in $_G_PATH; do
  155. IFS=$_G_save_IFS
  156. test -z "$_G_dir" && _G_dir=.
  157. for _G_prog_name in $_G_progs_list; do
  158. for _exeext in '' .EXE; do
  159. _G_path_prog=$_G_dir/$_G_prog_name$_exeext
  160. func_executable_p "$_G_path_prog" || continue
  161. case `"$_G_path_prog" --version 2>&1` in
  162. *GNU*) func_path_progs_result=$_G_path_prog _G_path_prog_found=: ;;
  163. *) $_G_check_func $_G_path_prog
  164. func_path_progs_result=$func_check_prog_result
  165. ;;
  166. esac
  167. $_G_path_prog_found && break 3
  168. done
  169. done
  170. done
  171. IFS=$_G_save_IFS
  172. test -z "$func_path_progs_result" && {
  173. echo "no acceptable sed could be found in \$PATH" >&2
  174. exit 1
  175. }
  176. }
  177. # We want to be able to use the functions in this file before configure
  178. # has figured out where the best binaries are kept, which means we have
  179. # to search for them ourselves - except when the results are already set
  180. # where we skip the searches.
  181. # Unless the user overrides by setting SED, search the path for either GNU
  182. # sed, or the sed that truncates its output the least.
  183. test -z "$SED" && {
  184. _G_sed_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/
  185. for _G_i in 1 2 3 4 5 6 7; do
  186. _G_sed_script=$_G_sed_script$nl$_G_sed_script
  187. done
  188. echo "$_G_sed_script" 2>/dev/null | sed 99q >conftest.sed
  189. _G_sed_script=
  190. func_check_prog_sed ()
  191. {
  192. _G_path_prog=$1
  193. _G_count=0
  194. printf 0123456789 >conftest.in
  195. while :
  196. do
  197. cat conftest.in conftest.in >conftest.tmp
  198. mv conftest.tmp conftest.in
  199. cp conftest.in conftest.nl
  200. echo '' >> conftest.nl
  201. "$_G_path_prog" -f conftest.sed <conftest.nl >conftest.out 2>/dev/null || break
  202. diff conftest.out conftest.nl >/dev/null 2>&1 || break
  203. _G_count=`expr $_G_count + 1`
  204. if test "$_G_count" -gt "$_G_path_prog_max"; then
  205. # Best one so far, save it but keep looking for a better one
  206. func_check_prog_result=$_G_path_prog
  207. _G_path_prog_max=$_G_count
  208. fi
  209. # 10*(2^10) chars as input seems more than enough
  210. test 10 -lt "$_G_count" && break
  211. done
  212. rm -f conftest.in conftest.tmp conftest.nl conftest.out
  213. }
  214. func_path_progs "sed gsed" func_check_prog_sed $PATH:/usr/xpg4/bin
  215. rm -f conftest.sed
  216. SED=$func_path_progs_result
  217. }
  218. # Unless the user overrides by setting GREP, search the path for either GNU
  219. # grep, or the grep that truncates its output the least.
  220. test -z "$GREP" && {
  221. func_check_prog_grep ()
  222. {
  223. _G_path_prog=$1
  224. _G_count=0
  225. _G_path_prog_max=0
  226. printf 0123456789 >conftest.in
  227. while :
  228. do
  229. cat conftest.in conftest.in >conftest.tmp
  230. mv conftest.tmp conftest.in
  231. cp conftest.in conftest.nl
  232. echo 'GREP' >> conftest.nl
  233. "$_G_path_prog" -e 'GREP$' -e '-(cannot match)-' <conftest.nl >conftest.out 2>/dev/null || break
  234. diff conftest.out conftest.nl >/dev/null 2>&1 || break
  235. _G_count=`expr $_G_count + 1`
  236. if test "$_G_count" -gt "$_G_path_prog_max"; then
  237. # Best one so far, save it but keep looking for a better one
  238. func_check_prog_result=$_G_path_prog
  239. _G_path_prog_max=$_G_count
  240. fi
  241. # 10*(2^10) chars as input seems more than enough
  242. test 10 -lt "$_G_count" && break
  243. done
  244. rm -f conftest.in conftest.tmp conftest.nl conftest.out
  245. }
  246. func_path_progs "grep ggrep" func_check_prog_grep $PATH:/usr/xpg4/bin
  247. GREP=$func_path_progs_result
  248. }
  249. ## ------------------------------- ##
  250. ## User overridable command paths. ##
  251. ## ------------------------------- ##
  252. # All uppercase variable names are used for environment variables. These
  253. # variables can be overridden by the user before calling a script that
  254. # uses them if a suitable command of that name is not already available
  255. # in the command search PATH.
  256. : ${CP="cp -f"}
  257. : ${ECHO="printf %s\n"}
  258. : ${EGREP="$GREP -E"}
  259. : ${FGREP="$GREP -F"}
  260. : ${LN_S="ln -s"}
  261. : ${MAKE="make"}
  262. : ${MKDIR="mkdir"}
  263. : ${MV="mv -f"}
  264. : ${RM="rm -f"}
  265. : ${SHELL="${CONFIG_SHELL-/bin/sh}"}
  266. ## -------------------- ##
  267. ## Useful sed snippets. ##
  268. ## -------------------- ##
  269. sed_dirname='s|/[^/]*$||'
  270. sed_basename='s|^.*/||'
  271. # Sed substitution that helps us do robust quoting. It backslashifies
  272. # metacharacters that are still active within double-quoted strings.
  273. sed_quote_subst='s|\([`"$\\]\)|\\\1|g'
  274. # Same as above, but do not quote variable references.
  275. sed_double_quote_subst='s/\(["`\\]\)/\\\1/g'
  276. # Sed substitution that turns a string into a regex matching for the
  277. # string literally.
  278. sed_make_literal_regex='s|[].[^$\\*\/]|\\&|g'
  279. # Sed substitution that converts a w32 file name or path
  280. # that contains forward slashes, into one that contains
  281. # (escaped) backslashes. A very naive implementation.
  282. sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
  283. # Re-'\' parameter expansions in output of sed_double_quote_subst that
  284. # were '\'-ed in input to the same. If an odd number of '\' preceded a
  285. # '$' in input to sed_double_quote_subst, that '$' was protected from
  286. # expansion. Since each input '\' is now two '\'s, look for any number
  287. # of runs of four '\'s followed by two '\'s and then a '$'. '\' that '$'.
  288. _G_bs='\\'
  289. _G_bs2='\\\\'
  290. _G_bs4='\\\\\\\\'
  291. _G_dollar='\$'
  292. sed_double_backslash="\
  293. s/$_G_bs4/&\\
  294. /g
  295. s/^$_G_bs2$_G_dollar/$_G_bs&/
  296. s/\\([^$_G_bs]\\)$_G_bs2$_G_dollar/\\1$_G_bs2$_G_bs$_G_dollar/g
  297. s/\n//g"
  298. ## ----------------- ##
  299. ## Global variables. ##
  300. ## ----------------- ##
  301. # Except for the global variables explicitly listed below, the following
  302. # functions in the '^func_' namespace, and the '^require_' namespace
  303. # variables initialised in the 'Resource management' section, sourcing
  304. # this file will not pollute your global namespace with anything
  305. # else. There's no portable way to scope variables in Bourne shell
  306. # though, so actually running these functions will sometimes place
  307. # results into a variable named after the function, and often use
  308. # temporary variables in the '^_G_' namespace. If you are careful to
  309. # avoid using those namespaces casually in your sourcing script, things
  310. # should continue to work as you expect. And, of course, you can freely
  311. # overwrite any of the functions or variables defined here before
  312. # calling anything to customize them.
  313. EXIT_SUCCESS=0
  314. EXIT_FAILURE=1
  315. EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing.
  316. EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake.
  317. # Allow overriding, eg assuming that you follow the convention of
  318. # putting '$debug_cmd' at the start of all your functions, you can get
  319. # bash to show function call trace with:
  320. #
  321. # debug_cmd='echo "${FUNCNAME[0]} $*" >&2' bash your-script-name
  322. debug_cmd=${debug_cmd-":"}
  323. exit_cmd=:
  324. # By convention, finish your script with:
  325. #
  326. # exit $exit_status
  327. #
  328. # so that you can set exit_status to non-zero if you want to indicate
  329. # something went wrong during execution without actually bailing out at
  330. # the point of failure.
  331. exit_status=$EXIT_SUCCESS
  332. # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
  333. # is ksh but when the shell is invoked as "sh" and the current value of
  334. # the _XPG environment variable is not equal to 1 (one), the special
  335. # positional parameter $0, within a function call, is the name of the
  336. # function.
  337. progpath=$0
  338. # The name of this program.
  339. progname=`$ECHO "$progpath" |$SED "$sed_basename"`
  340. # Make sure we have an absolute progpath for reexecution:
  341. case $progpath in
  342. [\\/]*|[A-Za-z]:\\*) ;;
  343. *[\\/]*)
  344. progdir=`$ECHO "$progpath" |$SED "$sed_dirname"`
  345. progdir=`cd "$progdir" && pwd`
  346. progpath=$progdir/$progname
  347. ;;
  348. *)
  349. _G_IFS=$IFS
  350. IFS=${PATH_SEPARATOR-:}
  351. for progdir in $PATH; do
  352. IFS=$_G_IFS
  353. test -x "$progdir/$progname" && break
  354. done
  355. IFS=$_G_IFS
  356. test -n "$progdir" || progdir=`pwd`
  357. progpath=$progdir/$progname
  358. ;;
  359. esac
  360. ## ----------------- ##
  361. ## Standard options. ##
  362. ## ----------------- ##
  363. # The following options affect the operation of the functions defined
  364. # below, and should be set appropriately depending on run-time para-
  365. # meters passed on the command line.
  366. opt_dry_run=false
  367. opt_quiet=false
  368. opt_verbose=false
  369. # Categories 'all' and 'none' are always available. Append any others
  370. # you will pass as the first argument to func_warning from your own
  371. # code.
  372. warning_categories=
  373. # By default, display warnings according to 'opt_warning_types'. Set
  374. # 'warning_func' to ':' to elide all warnings, or func_fatal_error to
  375. # treat the next displayed warning as a fatal error.
  376. warning_func=func_warn_and_continue
  377. # Set to 'all' to display all warnings, 'none' to suppress all
  378. # warnings, or a space delimited list of some subset of
  379. # 'warning_categories' to display only the listed warnings.
  380. opt_warning_types=all
  381. ## -------------------- ##
  382. ## Resource management. ##
  383. ## -------------------- ##
  384. # This section contains definitions for functions that each ensure a
  385. # particular resource (a file, or a non-empty configuration variable for
  386. # example) is available, and if appropriate to extract default values
  387. # from pertinent package files. Call them using their associated
  388. # 'require_*' variable to ensure that they are executed, at most, once.
  389. #
  390. # It's entirely deliberate that calling these functions can set
  391. # variables that don't obey the namespace limitations obeyed by the rest
  392. # of this file, in order that that they be as useful as possible to
  393. # callers.
  394. # require_term_colors
  395. # -------------------
  396. # Allow display of bold text on terminals that support it.
  397. require_term_colors=func_require_term_colors
  398. func_require_term_colors ()
  399. {
  400. $debug_cmd
  401. test -t 1 && {
  402. # COLORTERM and USE_ANSI_COLORS environment variables take
  403. # precedence, because most terminfo databases neglect to describe
  404. # whether color sequences are supported.
  405. test -n "${COLORTERM+set}" && : ${USE_ANSI_COLORS="1"}
  406. if test 1 = "$USE_ANSI_COLORS"; then
  407. # Standard ANSI escape sequences
  408. tc_reset=''
  409. tc_bold=''; tc_standout=''
  410. tc_red=''; tc_green=''
  411. tc_blue=''; tc_cyan=''
  412. else
  413. # Otherwise trust the terminfo database after all.
  414. test -n "`tput sgr0 2>/dev/null`" && {
  415. tc_reset=`tput sgr0`
  416. test -n "`tput bold 2>/dev/null`" && tc_bold=`tput bold`
  417. tc_standout=$tc_bold
  418. test -n "`tput smso 2>/dev/null`" && tc_standout=`tput smso`
  419. test -n "`tput setaf 1 2>/dev/null`" && tc_red=`tput setaf 1`
  420. test -n "`tput setaf 2 2>/dev/null`" && tc_green=`tput setaf 2`
  421. test -n "`tput setaf 4 2>/dev/null`" && tc_blue=`tput setaf 4`
  422. test -n "`tput setaf 5 2>/dev/null`" && tc_cyan=`tput setaf 5`
  423. }
  424. fi
  425. }
  426. require_term_colors=:
  427. }
  428. ## ----------------- ##
  429. ## Function library. ##
  430. ## ----------------- ##
  431. # This section contains a variety of useful functions to call in your
  432. # scripts. Take note of the portable wrappers for features provided by
  433. # some modern shells, which will fall back to slower equivalents on
  434. # less featureful shells.
  435. # func_append VAR VALUE
  436. # ---------------------
  437. # Append VALUE onto the existing contents of VAR.
  438. # We should try to minimise forks, especially on Windows where they are
  439. # unreasonably slow, so skip the feature probes when bash or zsh are
  440. # being used:
  441. if test set = "${BASH_VERSION+set}${ZSH_VERSION+set}"; then
  442. : ${_G_HAVE_ARITH_OP="yes"}
  443. : ${_G_HAVE_XSI_OPS="yes"}
  444. # The += operator was introduced in bash 3.1
  445. case $BASH_VERSION in
  446. [12].* | 3.0 | 3.0*) ;;
  447. *)
  448. : ${_G_HAVE_PLUSEQ_OP="yes"}
  449. ;;
  450. esac
  451. fi
  452. # _G_HAVE_PLUSEQ_OP
  453. # Can be empty, in which case the shell is probed, "yes" if += is
  454. # useable or anything else if it does not work.
  455. test -z "$_G_HAVE_PLUSEQ_OP" \
  456. && (eval 'x=a; x+=" b"; test "a b" = "$x"') 2>/dev/null \
  457. && _G_HAVE_PLUSEQ_OP=yes
  458. if test yes = "$_G_HAVE_PLUSEQ_OP"
  459. then
  460. # This is an XSI compatible shell, allowing a faster implementation...
  461. eval 'func_append ()
  462. {
  463. $debug_cmd
  464. eval "$1+=\$2"
  465. }'
  466. else
  467. # ...otherwise fall back to using expr, which is often a shell builtin.
  468. func_append ()
  469. {
  470. $debug_cmd
  471. eval "$1=\$$1\$2"
  472. }
  473. fi
  474. # func_append_quoted VAR VALUE
  475. # ----------------------------
  476. # Quote VALUE and append to the end of shell variable VAR, separated
  477. # by a space.
  478. if test yes = "$_G_HAVE_PLUSEQ_OP"; then
  479. eval 'func_append_quoted ()
  480. {
  481. $debug_cmd
  482. func_quote_for_eval "$2"
  483. eval "$1+=\\ \$func_quote_for_eval_result"
  484. }'
  485. else
  486. func_append_quoted ()
  487. {
  488. $debug_cmd
  489. func_quote_for_eval "$2"
  490. eval "$1=\$$1\\ \$func_quote_for_eval_result"
  491. }
  492. fi
  493. # func_append_uniq VAR VALUE
  494. # --------------------------
  495. # Append unique VALUE onto the existing contents of VAR, assuming
  496. # entries are delimited by the first character of VALUE. For example:
  497. #
  498. # func_append_uniq options " --another-option option-argument"
  499. #
  500. # will only append to $options if " --another-option option-argument "
  501. # is not already present somewhere in $options already (note spaces at
  502. # each end implied by leading space in second argument).
  503. func_append_uniq ()
  504. {
  505. $debug_cmd
  506. eval _G_current_value='`$ECHO $'$1'`'
  507. _G_delim=`expr "$2" : '\(.\)'`
  508. case $_G_delim$_G_current_value$_G_delim in
  509. *"$2$_G_delim"*) ;;
  510. *) func_append "$@" ;;
  511. esac
  512. }
  513. # func_arith TERM...
  514. # ------------------
  515. # Set func_arith_result to the result of evaluating TERMs.
  516. test -z "$_G_HAVE_ARITH_OP" \
  517. && (eval 'test 2 = $(( 1 + 1 ))') 2>/dev/null \
  518. && _G_HAVE_ARITH_OP=yes
  519. if test yes = "$_G_HAVE_ARITH_OP"; then
  520. eval 'func_arith ()
  521. {
  522. $debug_cmd
  523. func_arith_result=$(( $* ))
  524. }'
  525. else
  526. func_arith ()
  527. {
  528. $debug_cmd
  529. func_arith_result=`expr "$@"`
  530. }
  531. fi
  532. # func_basename FILE
  533. # ------------------
  534. # Set func_basename_result to FILE with everything up to and including
  535. # the last / stripped.
  536. if test yes = "$_G_HAVE_XSI_OPS"; then
  537. # If this shell supports suffix pattern removal, then use it to avoid
  538. # forking. Hide the definitions single quotes in case the shell chokes
  539. # on unsupported syntax...
  540. _b='func_basename_result=${1##*/}'
  541. _d='case $1 in
  542. */*) func_dirname_result=${1%/*}$2 ;;
  543. * ) func_dirname_result=$3 ;;
  544. esac'
  545. else
  546. # ...otherwise fall back to using sed.
  547. _b='func_basename_result=`$ECHO "$1" |$SED "$sed_basename"`'
  548. _d='func_dirname_result=`$ECHO "$1" |$SED "$sed_dirname"`
  549. if test "X$func_dirname_result" = "X$1"; then
  550. func_dirname_result=$3
  551. else
  552. func_append func_dirname_result "$2"
  553. fi'
  554. fi
  555. eval 'func_basename ()
  556. {
  557. $debug_cmd
  558. '"$_b"'
  559. }'
  560. # func_dirname FILE APPEND NONDIR_REPLACEMENT
  561. # -------------------------------------------
  562. # Compute the dirname of FILE. If nonempty, add APPEND to the result,
  563. # otherwise set result to NONDIR_REPLACEMENT.
  564. eval 'func_dirname ()
  565. {
  566. $debug_cmd
  567. '"$_d"'
  568. }'
  569. # func_dirname_and_basename FILE APPEND NONDIR_REPLACEMENT
  570. # --------------------------------------------------------
  571. # Perform func_basename and func_dirname in a single function
  572. # call:
  573. # dirname: Compute the dirname of FILE. If nonempty,
  574. # add APPEND to the result, otherwise set result
  575. # to NONDIR_REPLACEMENT.
  576. # value returned in "$func_dirname_result"
  577. # basename: Compute filename of FILE.
  578. # value retuned in "$func_basename_result"
  579. # For efficiency, we do not delegate to the functions above but instead
  580. # duplicate the functionality here.
  581. eval 'func_dirname_and_basename ()
  582. {
  583. $debug_cmd
  584. '"$_b"'
  585. '"$_d"'
  586. }'
  587. # func_echo ARG...
  588. # ----------------
  589. # Echo program name prefixed message.
  590. func_echo ()
  591. {
  592. $debug_cmd
  593. _G_message=$*
  594. func_echo_IFS=$IFS
  595. IFS=$nl
  596. for _G_line in $_G_message; do
  597. IFS=$func_echo_IFS
  598. $ECHO "$progname: $_G_line"
  599. done
  600. IFS=$func_echo_IFS
  601. }
  602. # func_echo_all ARG...
  603. # --------------------
  604. # Invoke $ECHO with all args, space-separated.
  605. func_echo_all ()
  606. {
  607. $ECHO "$*"
  608. }
  609. # func_echo_infix_1 INFIX ARG...
  610. # ------------------------------
  611. # Echo program name, followed by INFIX on the first line, with any
  612. # additional lines not showing INFIX.
  613. func_echo_infix_1 ()
  614. {
  615. $debug_cmd
  616. $require_term_colors
  617. _G_infix=$1; shift
  618. _G_indent=$_G_infix
  619. _G_prefix="$progname: $_G_infix: "
  620. _G_message=$*
  621. # Strip color escape sequences before counting printable length
  622. for _G_tc in "$tc_reset" "$tc_bold" "$tc_standout" "$tc_red" "$tc_green" "$tc_blue" "$tc_cyan"
  623. do
  624. test -n "$_G_tc" && {
  625. _G_esc_tc=`$ECHO "$_G_tc" | $SED "$sed_make_literal_regex"`
  626. _G_indent=`$ECHO "$_G_indent" | $SED "s|$_G_esc_tc||g"`
  627. }
  628. done
  629. _G_indent="$progname: "`echo "$_G_indent" | $SED 's|.| |g'`" " ## exclude from sc_prohibit_nested_quotes
  630. func_echo_infix_1_IFS=$IFS
  631. IFS=$nl
  632. for _G_line in $_G_message; do
  633. IFS=$func_echo_infix_1_IFS
  634. $ECHO "$_G_prefix$tc_bold$_G_line$tc_reset" >&2
  635. _G_prefix=$_G_indent
  636. done
  637. IFS=$func_echo_infix_1_IFS
  638. }
  639. # func_error ARG...
  640. # -----------------
  641. # Echo program name prefixed message to standard error.
  642. func_error ()
  643. {
  644. $debug_cmd
  645. $require_term_colors
  646. func_echo_infix_1 " $tc_standout${tc_red}error$tc_reset" "$*" >&2
  647. }
  648. # func_fatal_error ARG...
  649. # -----------------------
  650. # Echo program name prefixed message to standard error, and exit.
  651. func_fatal_error ()
  652. {
  653. $debug_cmd
  654. func_error "$*"
  655. exit $EXIT_FAILURE
  656. }
  657. # func_grep EXPRESSION FILENAME
  658. # -----------------------------
  659. # Check whether EXPRESSION matches any line of FILENAME, without output.
  660. func_grep ()
  661. {
  662. $debug_cmd
  663. $GREP "$1" "$2" >/dev/null 2>&1
  664. }
  665. # func_len STRING
  666. # ---------------
  667. # Set func_len_result to the length of STRING. STRING may not
  668. # start with a hyphen.
  669. test -z "$_G_HAVE_XSI_OPS" \
  670. && (eval 'x=a/b/c;
  671. test 5aa/bb/cc = "${#x}${x%%/*}${x%/*}${x#*/}${x##*/}"') 2>/dev/null \
  672. && _G_HAVE_XSI_OPS=yes
  673. if test yes = "$_G_HAVE_XSI_OPS"; then
  674. eval 'func_len ()
  675. {
  676. $debug_cmd
  677. func_len_result=${#1}
  678. }'
  679. else
  680. func_len ()
  681. {
  682. $debug_cmd
  683. func_len_result=`expr "$1" : ".*" 2>/dev/null || echo $max_cmd_len`
  684. }
  685. fi
  686. # func_mkdir_p DIRECTORY-PATH
  687. # ---------------------------
  688. # Make sure the entire path to DIRECTORY-PATH is available.
  689. func_mkdir_p ()
  690. {
  691. $debug_cmd
  692. _G_directory_path=$1
  693. _G_dir_list=
  694. if test -n "$_G_directory_path" && test : != "$opt_dry_run"; then
  695. # Protect directory names starting with '-'
  696. case $_G_directory_path in
  697. -*) _G_directory_path=./$_G_directory_path ;;
  698. esac
  699. # While some portion of DIR does not yet exist...
  700. while test ! -d "$_G_directory_path"; do
  701. # ...make a list in topmost first order. Use a colon delimited
  702. # list incase some portion of path contains whitespace.
  703. _G_dir_list=$_G_directory_path:$_G_dir_list
  704. # If the last portion added has no slash in it, the list is done
  705. case $_G_directory_path in */*) ;; *) break ;; esac
  706. # ...otherwise throw away the child directory and loop
  707. _G_directory_path=`$ECHO "$_G_directory_path" | $SED -e "$sed_dirname"`
  708. done
  709. _G_dir_list=`$ECHO "$_G_dir_list" | $SED 's|:*$||'`
  710. func_mkdir_p_IFS=$IFS; IFS=:
  711. for _G_dir in $_G_dir_list; do
  712. IFS=$func_mkdir_p_IFS
  713. # mkdir can fail with a 'File exist' error if two processes
  714. # try to create one of the directories concurrently. Don't
  715. # stop in that case!
  716. $MKDIR "$_G_dir" 2>/dev/null || :
  717. done
  718. IFS=$func_mkdir_p_IFS
  719. # Bail out if we (or some other process) failed to create a directory.
  720. test -d "$_G_directory_path" || \
  721. func_fatal_error "Failed to create '$1'"
  722. fi
  723. }
  724. # func_mktempdir [BASENAME]
  725. # -------------------------
  726. # Make a temporary directory that won't clash with other running
  727. # libtool processes, and avoids race conditions if possible. If
  728. # given, BASENAME is the basename for that directory.
  729. func_mktempdir ()
  730. {
  731. $debug_cmd
  732. _G_template=${TMPDIR-/tmp}/${1-$progname}
  733. if test : = "$opt_dry_run"; then
  734. # Return a directory name, but don't create it in dry-run mode
  735. _G_tmpdir=$_G_template-$$
  736. else
  737. # If mktemp works, use that first and foremost
  738. _G_tmpdir=`mktemp -d "$_G_template-XXXXXXXX" 2>/dev/null`
  739. if test ! -d "$_G_tmpdir"; then
  740. # Failing that, at least try and use $RANDOM to avoid a race
  741. _G_tmpdir=$_G_template-${RANDOM-0}$$
  742. func_mktempdir_umask=`umask`
  743. umask 0077
  744. $MKDIR "$_G_tmpdir"
  745. umask $func_mktempdir_umask
  746. fi
  747. # If we're not in dry-run mode, bomb out on failure
  748. test -d "$_G_tmpdir" || \
  749. func_fatal_error "cannot create temporary directory '$_G_tmpdir'"
  750. fi
  751. $ECHO "$_G_tmpdir"
  752. }
  753. # func_normal_abspath PATH
  754. # ------------------------
  755. # Remove doubled-up and trailing slashes, "." path components,
  756. # and cancel out any ".." path components in PATH after making
  757. # it an absolute path.
  758. func_normal_abspath ()
  759. {
  760. $debug_cmd
  761. # These SED scripts presuppose an absolute path with a trailing slash.
  762. _G_pathcar='s|^/\([^/]*\).*$|\1|'
  763. _G_pathcdr='s|^/[^/]*||'
  764. _G_removedotparts=':dotsl
  765. s|/\./|/|g
  766. t dotsl
  767. s|/\.$|/|'
  768. _G_collapseslashes='s|/\{1,\}|/|g'
  769. _G_finalslash='s|/*$|/|'
  770. # Start from root dir and reassemble the path.
  771. func_normal_abspath_result=
  772. func_normal_abspath_tpath=$1
  773. func_normal_abspath_altnamespace=
  774. case $func_normal_abspath_tpath in
  775. "")
  776. # Empty path, that just means $cwd.
  777. func_stripname '' '/' "`pwd`"
  778. func_normal_abspath_result=$func_stripname_result
  779. return
  780. ;;
  781. # The next three entries are used to spot a run of precisely
  782. # two leading slashes without using negated character classes;
  783. # we take advantage of case's first-match behaviour.
  784. ///*)
  785. # Unusual form of absolute path, do nothing.
  786. ;;
  787. //*)
  788. # Not necessarily an ordinary path; POSIX reserves leading '//'
  789. # and for example Cygwin uses it to access remote file shares
  790. # over CIFS/SMB, so we conserve a leading double slash if found.
  791. func_normal_abspath_altnamespace=/
  792. ;;
  793. /*)
  794. # Absolute path, do nothing.
  795. ;;
  796. *)
  797. # Relative path, prepend $cwd.
  798. func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath
  799. ;;
  800. esac
  801. # Cancel out all the simple stuff to save iterations. We also want
  802. # the path to end with a slash for ease of parsing, so make sure
  803. # there is one (and only one) here.
  804. func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
  805. -e "$_G_removedotparts" -e "$_G_collapseslashes" -e "$_G_finalslash"`
  806. while :; do
  807. # Processed it all yet?
  808. if test / = "$func_normal_abspath_tpath"; then
  809. # If we ascended to the root using ".." the result may be empty now.
  810. if test -z "$func_normal_abspath_result"; then
  811. func_normal_abspath_result=/
  812. fi
  813. break
  814. fi
  815. func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \
  816. -e "$_G_pathcar"`
  817. func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
  818. -e "$_G_pathcdr"`
  819. # Figure out what to do with it
  820. case $func_normal_abspath_tcomponent in
  821. "")
  822. # Trailing empty path component, ignore it.
  823. ;;
  824. ..)
  825. # Parent dir; strip last assembled component from result.
  826. func_dirname "$func_normal_abspath_result"
  827. func_normal_abspath_result=$func_dirname_result
  828. ;;
  829. *)
  830. # Actual path component, append it.
  831. func_append func_normal_abspath_result "/$func_normal_abspath_tcomponent"
  832. ;;
  833. esac
  834. done
  835. # Restore leading double-slash if one was found on entry.
  836. func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result
  837. }
  838. # func_notquiet ARG...
  839. # --------------------
  840. # Echo program name prefixed message only when not in quiet mode.
  841. func_notquiet ()
  842. {
  843. $debug_cmd
  844. $opt_quiet || func_echo ${1+"$@"}
  845. # A bug in bash halts the script if the last line of a function
  846. # fails when set -e is in force, so we need another command to
  847. # work around that:
  848. :
  849. }
  850. # func_relative_path SRCDIR DSTDIR
  851. # --------------------------------
  852. # Set func_relative_path_result to the relative path from SRCDIR to DSTDIR.
  853. func_relative_path ()
  854. {
  855. $debug_cmd
  856. func_relative_path_result=
  857. func_normal_abspath "$1"
  858. func_relative_path_tlibdir=$func_normal_abspath_result
  859. func_normal_abspath "$2"
  860. func_relative_path_tbindir=$func_normal_abspath_result
  861. # Ascend the tree starting from libdir
  862. while :; do
  863. # check if we have found a prefix of bindir
  864. case $func_relative_path_tbindir in
  865. $func_relative_path_tlibdir)
  866. # found an exact match
  867. func_relative_path_tcancelled=
  868. break
  869. ;;
  870. $func_relative_path_tlibdir*)
  871. # found a matching prefix
  872. func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir"
  873. func_relative_path_tcancelled=$func_stripname_result
  874. if test -z "$func_relative_path_result"; then
  875. func_relative_path_result=.
  876. fi
  877. break
  878. ;;
  879. *)
  880. func_dirname $func_relative_path_tlibdir
  881. func_relative_path_tlibdir=$func_dirname_result
  882. if test -z "$func_relative_path_tlibdir"; then
  883. # Have to descend all the way to the root!
  884. func_relative_path_result=../$func_relative_path_result
  885. func_relative_path_tcancelled=$func_relative_path_tbindir
  886. break
  887. fi
  888. func_relative_path_result=../$func_relative_path_result
  889. ;;
  890. esac
  891. done
  892. # Now calculate path; take care to avoid doubling-up slashes.
  893. func_stripname '' '/' "$func_relative_path_result"
  894. func_relative_path_result=$func_stripname_result
  895. func_stripname '/' '/' "$func_relative_path_tcancelled"
  896. if test -n "$func_stripname_result"; then
  897. func_append func_relative_path_result "/$func_stripname_result"
  898. fi
  899. # Normalisation. If bindir is libdir, return '.' else relative path.
  900. if test -n "$func_relative_path_result"; then
  901. func_stripname './' '' "$func_relative_path_result"
  902. func_relative_path_result=$func_stripname_result
  903. fi
  904. test -n "$func_relative_path_result" || func_relative_path_result=.
  905. :
  906. }
  907. # func_quote_for_eval ARG...
  908. # --------------------------
  909. # Aesthetically quote ARGs to be evaled later.
  910. # This function returns two values:
  911. # i) func_quote_for_eval_result
  912. # double-quoted, suitable for a subsequent eval
  913. # ii) func_quote_for_eval_unquoted_result
  914. # has all characters that are still active within double
  915. # quotes backslashified.
  916. func_quote_for_eval ()
  917. {
  918. $debug_cmd
  919. func_quote_for_eval_unquoted_result=
  920. func_quote_for_eval_result=
  921. while test 0 -lt $#; do
  922. case $1 in
  923. *[\\\`\"\$]*)
  924. _G_unquoted_arg=`printf '%s\n' "$1" |$SED "$sed_quote_subst"` ;;
  925. *)
  926. _G_unquoted_arg=$1 ;;
  927. esac
  928. if test -n "$func_quote_for_eval_unquoted_result"; then
  929. func_append func_quote_for_eval_unquoted_result " $_G_unquoted_arg"
  930. else
  931. func_append func_quote_for_eval_unquoted_result "$_G_unquoted_arg"
  932. fi
  933. case $_G_unquoted_arg in
  934. # Double-quote args containing shell metacharacters to delay
  935. # word splitting, command substitution and variable expansion
  936. # for a subsequent eval.
  937. # Many Bourne shells cannot handle close brackets correctly
  938. # in scan sets, so we specify it separately.
  939. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
  940. _G_quoted_arg=\"$_G_unquoted_arg\"
  941. ;;
  942. *)
  943. _G_quoted_arg=$_G_unquoted_arg
  944. ;;
  945. esac
  946. if test -n "$func_quote_for_eval_result"; then
  947. func_append func_quote_for_eval_result " $_G_quoted_arg"
  948. else
  949. func_append func_quote_for_eval_result "$_G_quoted_arg"
  950. fi
  951. shift
  952. done
  953. }
  954. # func_quote_for_expand ARG
  955. # -------------------------
  956. # Aesthetically quote ARG to be evaled later; same as above,
  957. # but do not quote variable references.
  958. func_quote_for_expand ()
  959. {
  960. $debug_cmd
  961. case $1 in
  962. *[\\\`\"]*)
  963. _G_arg=`$ECHO "$1" | $SED \
  964. -e "$sed_double_quote_subst" -e "$sed_double_backslash"` ;;
  965. *)
  966. _G_arg=$1 ;;
  967. esac
  968. case $_G_arg in
  969. # Double-quote args containing shell metacharacters to delay
  970. # word splitting and command substitution for a subsequent eval.
  971. # Many Bourne shells cannot handle close brackets correctly
  972. # in scan sets, so we specify it separately.
  973. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
  974. _G_arg=\"$_G_arg\"
  975. ;;
  976. esac
  977. func_quote_for_expand_result=$_G_arg
  978. }
  979. # func_stripname PREFIX SUFFIX NAME
  980. # ---------------------------------
  981. # strip PREFIX and SUFFIX from NAME, and store in func_stripname_result.
  982. # PREFIX and SUFFIX must not contain globbing or regex special
  983. # characters, hashes, percent signs, but SUFFIX may contain a leading
  984. # dot (in which case that matches only a dot).
  985. if test yes = "$_G_HAVE_XSI_OPS"; then
  986. eval 'func_stripname ()
  987. {
  988. $debug_cmd
  989. # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are
  990. # positional parameters, so assign one to ordinary variable first.
  991. func_stripname_result=$3
  992. func_stripname_result=${func_stripname_result#"$1"}
  993. func_stripname_result=${func_stripname_result%"$2"}
  994. }'
  995. else
  996. func_stripname ()
  997. {
  998. $debug_cmd
  999. case $2 in
  1000. .*) func_stripname_result=`$ECHO "$3" | $SED -e "s%^$1%%" -e "s%\\\\$2\$%%"`;;
  1001. *) func_stripname_result=`$ECHO "$3" | $SED -e "s%^$1%%" -e "s%$2\$%%"`;;
  1002. esac
  1003. }
  1004. fi
  1005. # func_show_eval CMD [FAIL_EXP]
  1006. # -----------------------------
  1007. # Unless opt_quiet is true, then output CMD. Then, if opt_dryrun is
  1008. # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
  1009. # is given, then evaluate it.
  1010. func_show_eval ()
  1011. {
  1012. $debug_cmd
  1013. _G_cmd=$1
  1014. _G_fail_exp=${2-':'}
  1015. func_quote_for_expand "$_G_cmd"
  1016. eval "func_notquiet $func_quote_for_expand_result"
  1017. $opt_dry_run || {
  1018. eval "$_G_cmd"
  1019. _G_status=$?
  1020. if test 0 -ne "$_G_status"; then
  1021. eval "(exit $_G_status); $_G_fail_exp"
  1022. fi
  1023. }
  1024. }
  1025. # func_show_eval_locale CMD [FAIL_EXP]
  1026. # ------------------------------------
  1027. # Unless opt_quiet is true, then output CMD. Then, if opt_dryrun is
  1028. # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
  1029. # is given, then evaluate it. Use the saved locale for evaluation.
  1030. func_show_eval_locale ()
  1031. {
  1032. $debug_cmd
  1033. _G_cmd=$1
  1034. _G_fail_exp=${2-':'}
  1035. $opt_quiet || {
  1036. func_quote_for_expand "$_G_cmd"
  1037. eval "func_echo $func_quote_for_expand_result"
  1038. }
  1039. $opt_dry_run || {
  1040. eval "$_G_user_locale
  1041. $_G_cmd"
  1042. _G_status=$?
  1043. eval "$_G_safe_locale"
  1044. if test 0 -ne "$_G_status"; then
  1045. eval "(exit $_G_status); $_G_fail_exp"
  1046. fi
  1047. }
  1048. }
  1049. # func_tr_sh
  1050. # ----------
  1051. # Turn $1 into a string suitable for a shell variable name.
  1052. # Result is stored in $func_tr_sh_result. All characters
  1053. # not in the set a-zA-Z0-9_ are replaced with '_'. Further,
  1054. # if $1 begins with a digit, a '_' is prepended as well.
  1055. func_tr_sh ()
  1056. {
  1057. $debug_cmd
  1058. case $1 in
  1059. [0-9]* | *[!a-zA-Z0-9_]*)
  1060. func_tr_sh_result=`$ECHO "$1" | $SED -e 's/^\([0-9]\)/_\1/' -e 's/[^a-zA-Z0-9_]/_/g'`
  1061. ;;
  1062. * )
  1063. func_tr_sh_result=$1
  1064. ;;
  1065. esac
  1066. }
  1067. # func_verbose ARG...
  1068. # -------------------
  1069. # Echo program name prefixed message in verbose mode only.
  1070. func_verbose ()
  1071. {
  1072. $debug_cmd
  1073. $opt_verbose && func_echo "$*"
  1074. :
  1075. }
  1076. # func_warn_and_continue ARG...
  1077. # -----------------------------
  1078. # Echo program name prefixed warning message to standard error.
  1079. func_warn_and_continue ()
  1080. {
  1081. $debug_cmd
  1082. $require_term_colors
  1083. func_echo_infix_1 "${tc_red}warning$tc_reset" "$*" >&2
  1084. }
  1085. # func_warning CATEGORY ARG...
  1086. # ----------------------------
  1087. # Echo program name prefixed warning message to standard error. Warning
  1088. # messages can be filtered according to CATEGORY, where this function
  1089. # elides messages where CATEGORY is not listed in the global variable
  1090. # 'opt_warning_types'.
  1091. func_warning ()
  1092. {
  1093. $debug_cmd
  1094. # CATEGORY must be in the warning_categories list!
  1095. case " $warning_categories " in
  1096. *" $1 "*) ;;
  1097. *) func_internal_error "invalid warning category '$1'" ;;
  1098. esac
  1099. _G_category=$1
  1100. shift
  1101. case " $opt_warning_types " in
  1102. *" $_G_category "*) $warning_func ${1+"$@"} ;;
  1103. esac
  1104. }
  1105. # func_sort_ver VER1 VER2
  1106. # -----------------------
  1107. # 'sort -V' is not generally available.
  1108. # Note this deviates from the version comparison in automake
  1109. # in that it treats 1.5 < 1.5.0, and treats 1.4.4a < 1.4-p3a
  1110. # but this should suffice as we won't be specifying old
  1111. # version formats or redundant trailing .0 in bootstrap.conf.
  1112. # If we did want full compatibility then we should probably
  1113. # use m4_version_compare from autoconf.
  1114. func_sort_ver ()
  1115. {
  1116. $debug_cmd
  1117. printf '%s\n%s\n' "$1" "$2" \
  1118. | 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
  1119. }
  1120. # func_lt_ver PREV CURR
  1121. # ---------------------
  1122. # Return true if PREV and CURR are in the correct order according to
  1123. # func_sort_ver, otherwise false. Use it like this:
  1124. #
  1125. # func_lt_ver "$prev_ver" "$proposed_ver" || func_fatal_error "..."
  1126. func_lt_ver ()
  1127. {
  1128. $debug_cmd
  1129. test "x$1" = x`func_sort_ver "$1" "$2" | $SED 1q`
  1130. }
  1131. # Local variables:
  1132. # mode: shell-script
  1133. # sh-indentation: 2
  1134. # eval: (add-hook 'before-save-hook 'time-stamp)
  1135. # time-stamp-pattern: "10/scriptversion=%:y-%02m-%02d.%02H; # UTC"
  1136. # time-stamp-time-zone: "UTC"
  1137. # End:
  1138. #! /bin/sh
  1139. # Set a version string for this script.
  1140. scriptversion=2015-10-07.11; # UTC
  1141. # A portable, pluggable option parser for Bourne shell.
  1142. # Written by Gary V. Vaughan, 2010
  1143. # Copyright (C) 2010-2015 Free Software Foundation, Inc.
  1144. # This is free software; see the source for copying conditions. There is NO
  1145. # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  1146. # This program is free software: you can redistribute it and/or modify
  1147. # it under the terms of the GNU General Public License as published by
  1148. # the Free Software Foundation, either version 3 of the License, or
  1149. # (at your option) any later version.
  1150. # This program is distributed in the hope that it will be useful,
  1151. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  1152. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  1153. # GNU General Public License for more details.
  1154. # You should have received a copy of the GNU General Public License
  1155. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  1156. # Please report bugs or propose patches to gary@gnu.org.
  1157. ## ------ ##
  1158. ## Usage. ##
  1159. ## ------ ##
  1160. # This file is a library for parsing options in your shell scripts along
  1161. # with assorted other useful supporting features that you can make use
  1162. # of too.
  1163. #
  1164. # For the simplest scripts you might need only:
  1165. #
  1166. # #!/bin/sh
  1167. # . relative/path/to/funclib.sh
  1168. # . relative/path/to/options-parser
  1169. # scriptversion=1.0
  1170. # func_options ${1+"$@"}
  1171. # eval set dummy "$func_options_result"; shift
  1172. # ...rest of your script...
  1173. #
  1174. # In order for the '--version' option to work, you will need to have a
  1175. # suitably formatted comment like the one at the top of this file
  1176. # starting with '# Written by ' and ending with '# warranty; '.
  1177. #
  1178. # For '-h' and '--help' to work, you will also need a one line
  1179. # description of your script's purpose in a comment directly above the
  1180. # '# Written by ' line, like the one at the top of this file.
  1181. #
  1182. # The default options also support '--debug', which will turn on shell
  1183. # execution tracing (see the comment above debug_cmd below for another
  1184. # use), and '--verbose' and the func_verbose function to allow your script
  1185. # to display verbose messages only when your user has specified
  1186. # '--verbose'.
  1187. #
  1188. # After sourcing this file, you can plug processing for additional
  1189. # options by amending the variables from the 'Configuration' section
  1190. # below, and following the instructions in the 'Option parsing'
  1191. # section further down.
  1192. ## -------------- ##
  1193. ## Configuration. ##
  1194. ## -------------- ##
  1195. # You should override these variables in your script after sourcing this
  1196. # file so that they reflect the customisations you have added to the
  1197. # option parser.
  1198. # The usage line for option parsing errors and the start of '-h' and
  1199. # '--help' output messages. You can embed shell variables for delayed
  1200. # expansion at the time the message is displayed, but you will need to
  1201. # quote other shell meta-characters carefully to prevent them being
  1202. # expanded when the contents are evaled.
  1203. usage='$progpath [OPTION]...'
  1204. # Short help message in response to '-h' and '--help'. Add to this or
  1205. # override it after sourcing this library to reflect the full set of
  1206. # options your script accepts.
  1207. usage_message="\
  1208. --debug enable verbose shell tracing
  1209. -W, --warnings=CATEGORY
  1210. report the warnings falling in CATEGORY [all]
  1211. -v, --verbose verbosely report processing
  1212. --version print version information and exit
  1213. -h, --help print short or long help message and exit
  1214. "
  1215. # Additional text appended to 'usage_message' in response to '--help'.
  1216. long_help_message="
  1217. Warning categories include:
  1218. 'all' show all warnings
  1219. 'none' turn off all the warnings
  1220. 'error' warnings are treated as fatal errors"
  1221. # Help message printed before fatal option parsing errors.
  1222. fatal_help="Try '\$progname --help' for more information."
  1223. ## ------------------------- ##
  1224. ## Hook function management. ##
  1225. ## ------------------------- ##
  1226. # This section contains functions for adding, removing, and running hooks
  1227. # to the main code. A hook is just a named list of of function, that can
  1228. # be run in order later on.
  1229. # func_hookable FUNC_NAME
  1230. # -----------------------
  1231. # Declare that FUNC_NAME will run hooks added with
  1232. # 'func_add_hook FUNC_NAME ...'.
  1233. func_hookable ()
  1234. {
  1235. $debug_cmd
  1236. func_append hookable_fns " $1"
  1237. }
  1238. # func_add_hook FUNC_NAME HOOK_FUNC
  1239. # ---------------------------------
  1240. # Request that FUNC_NAME call HOOK_FUNC before it returns. FUNC_NAME must
  1241. # first have been declared "hookable" by a call to 'func_hookable'.
  1242. func_add_hook ()
  1243. {
  1244. $debug_cmd
  1245. case " $hookable_fns " in
  1246. *" $1 "*) ;;
  1247. *) func_fatal_error "'$1' does not accept hook functions." ;;
  1248. esac
  1249. eval func_append ${1}_hooks '" $2"'
  1250. }
  1251. # func_remove_hook FUNC_NAME HOOK_FUNC
  1252. # ------------------------------------
  1253. # Remove HOOK_FUNC from the list of functions called by FUNC_NAME.
  1254. func_remove_hook ()
  1255. {
  1256. $debug_cmd
  1257. eval ${1}_hooks='`$ECHO "\$'$1'_hooks" |$SED "s| '$2'||"`'
  1258. }
  1259. # func_run_hooks FUNC_NAME [ARG]...
  1260. # ---------------------------------
  1261. # Run all hook functions registered to FUNC_NAME.
  1262. # It is assumed that the list of hook functions contains nothing more
  1263. # than a whitespace-delimited list of legal shell function names, and
  1264. # no effort is wasted trying to catch shell meta-characters or preserve
  1265. # whitespace.
  1266. func_run_hooks ()
  1267. {
  1268. $debug_cmd
  1269. _G_rc_run_hooks=false
  1270. case " $hookable_fns " in
  1271. *" $1 "*) ;;
  1272. *) func_fatal_error "'$1' does not support hook funcions.n" ;;
  1273. esac
  1274. eval _G_hook_fns=\$$1_hooks; shift
  1275. for _G_hook in $_G_hook_fns; do
  1276. if eval $_G_hook '"$@"'; then
  1277. # store returned options list back into positional
  1278. # parameters for next 'cmd' execution.
  1279. eval _G_hook_result=\$${_G_hook}_result
  1280. eval set dummy "$_G_hook_result"; shift
  1281. _G_rc_run_hooks=:
  1282. fi
  1283. done
  1284. $_G_rc_run_hooks && func_run_hooks_result=$_G_hook_result
  1285. }
  1286. ## --------------- ##
  1287. ## Option parsing. ##
  1288. ## --------------- ##
  1289. # In order to add your own option parsing hooks, you must accept the
  1290. # full positional parameter list in your hook function, you may remove/edit
  1291. # any options that you action, and then pass back the remaining unprocessed
  1292. # options in '<hooked_function_name>_result', escaped suitably for
  1293. # 'eval'. In this case you also must return $EXIT_SUCCESS to let the
  1294. # hook's caller know that it should pay attention to
  1295. # '<hooked_function_name>_result'. Returning $EXIT_FAILURE signalizes that
  1296. # arguments are left untouched by the hook and therefore caller will ignore the
  1297. # result variable.
  1298. #
  1299. # Like this:
  1300. #
  1301. # my_options_prep ()
  1302. # {
  1303. # $debug_cmd
  1304. #
  1305. # # Extend the existing usage message.
  1306. # usage_message=$usage_message'
  1307. # -s, --silent don'\''t print informational messages
  1308. # '
  1309. # # No change in '$@' (ignored completely by this hook). There is
  1310. # # no need to do the equivalent (but slower) action:
  1311. # # func_quote_for_eval ${1+"$@"}
  1312. # # my_options_prep_result=$func_quote_for_eval_result
  1313. # false
  1314. # }
  1315. # func_add_hook func_options_prep my_options_prep
  1316. #
  1317. #
  1318. # my_silent_option ()
  1319. # {
  1320. # $debug_cmd
  1321. #
  1322. # args_changed=false
  1323. #
  1324. # # Note that for efficiency, we parse as many options as we can
  1325. # # recognise in a loop before passing the remainder back to the
  1326. # # caller on the first unrecognised argument we encounter.
  1327. # while test $# -gt 0; do
  1328. # opt=$1; shift
  1329. # case $opt in
  1330. # --silent|-s) opt_silent=:
  1331. # args_changed=:
  1332. # ;;
  1333. # # Separate non-argument short options:
  1334. # -s*) func_split_short_opt "$_G_opt"
  1335. # set dummy "$func_split_short_opt_name" \
  1336. # "-$func_split_short_opt_arg" ${1+"$@"}
  1337. # shift
  1338. # args_changed=:
  1339. # ;;
  1340. # *) # Make sure the first unrecognised option "$_G_opt"
  1341. # # is added back to "$@", we could need that later
  1342. # # if $args_changed is true.
  1343. # set dummy "$_G_opt" ${1+"$@"}; shift; break ;;
  1344. # esac
  1345. # done
  1346. #
  1347. # if $args_changed; then
  1348. # func_quote_for_eval ${1+"$@"}
  1349. # my_silent_option_result=$func_quote_for_eval_result
  1350. # fi
  1351. #
  1352. # $args_changed
  1353. # }
  1354. # func_add_hook func_parse_options my_silent_option
  1355. #
  1356. #
  1357. # my_option_validation ()
  1358. # {
  1359. # $debug_cmd
  1360. #
  1361. # $opt_silent && $opt_verbose && func_fatal_help "\
  1362. # '--silent' and '--verbose' options are mutually exclusive."
  1363. #
  1364. # false
  1365. # }
  1366. # func_add_hook func_validate_options my_option_validation
  1367. #
  1368. # You'll also need to manually amend $usage_message to reflect the extra
  1369. # options you parse. It's preferable to append if you can, so that
  1370. # multiple option parsing hooks can be added safely.
  1371. # func_options_finish [ARG]...
  1372. # ----------------------------
  1373. # Finishing the option parse loop (call 'func_options' hooks ATM).
  1374. func_options_finish ()
  1375. {
  1376. $debug_cmd
  1377. _G_func_options_finish_exit=false
  1378. if func_run_hooks func_options ${1+"$@"}; then
  1379. func_options_finish_result=$func_run_hooks_result
  1380. _G_func_options_finish_exit=:
  1381. fi
  1382. $_G_func_options_finish_exit
  1383. }
  1384. # func_options [ARG]...
  1385. # ---------------------
  1386. # All the functions called inside func_options are hookable. See the
  1387. # individual implementations for details.
  1388. func_hookable func_options
  1389. func_options ()
  1390. {
  1391. $debug_cmd
  1392. _G_rc_options=false
  1393. for my_func in options_prep parse_options validate_options options_finish
  1394. do
  1395. if eval func_$my_func '${1+"$@"}'; then
  1396. eval _G_res_var='$'"func_${my_func}_result"
  1397. eval set dummy "$_G_res_var" ; shift
  1398. _G_rc_options=:
  1399. fi
  1400. done
  1401. # Save modified positional parameters for caller. As a top-level
  1402. # options-parser function we always need to set the 'func_options_result'
  1403. # variable (regardless the $_G_rc_options value).
  1404. if $_G_rc_options; then
  1405. func_options_result=$_G_res_var
  1406. else
  1407. func_quote_for_eval ${1+"$@"}
  1408. func_options_result=$func_quote_for_eval_result
  1409. fi
  1410. $_G_rc_options
  1411. }
  1412. # func_options_prep [ARG]...
  1413. # --------------------------
  1414. # All initialisations required before starting the option parse loop.
  1415. # Note that when calling hook functions, we pass through the list of
  1416. # positional parameters. If a hook function modifies that list, and
  1417. # needs to propagate that back to rest of this script, then the complete
  1418. # modified list must be put in 'func_run_hooks_result' before
  1419. # returning $EXIT_SUCCESS (otherwise $EXIT_FAILURE is returned).
  1420. func_hookable func_options_prep
  1421. func_options_prep ()
  1422. {
  1423. $debug_cmd
  1424. # Option defaults:
  1425. opt_verbose=false
  1426. opt_warning_types=
  1427. _G_rc_options_prep=false
  1428. if func_run_hooks func_options_prep ${1+"$@"}; then
  1429. _G_rc_options_prep=:
  1430. # save modified positional parameters for caller
  1431. func_options_prep_result=$func_run_hooks_result
  1432. fi
  1433. $_G_rc_options_prep
  1434. }
  1435. # func_parse_options [ARG]...
  1436. # ---------------------------
  1437. # The main option parsing loop.
  1438. func_hookable func_parse_options
  1439. func_parse_options ()
  1440. {
  1441. $debug_cmd
  1442. func_parse_options_result=
  1443. _G_rc_parse_options=false
  1444. # this just eases exit handling
  1445. while test $# -gt 0; do
  1446. # Defer to hook functions for initial option parsing, so they
  1447. # get priority in the event of reusing an option name.
  1448. if func_run_hooks func_parse_options ${1+"$@"}; then
  1449. eval set dummy "$func_run_hooks_result"; shift
  1450. _G_rc_parse_options=:
  1451. fi
  1452. # Break out of the loop if we already parsed every option.
  1453. test $# -gt 0 || break
  1454. _G_match_parse_options=:
  1455. _G_opt=$1
  1456. shift
  1457. case $_G_opt in
  1458. --debug|-x) debug_cmd='set -x'
  1459. func_echo "enabling shell trace mode"
  1460. $debug_cmd
  1461. ;;
  1462. --no-warnings|--no-warning|--no-warn)
  1463. set dummy --warnings none ${1+"$@"}
  1464. shift
  1465. ;;
  1466. --warnings|--warning|-W)
  1467. if test $# = 0 && func_missing_arg $_G_opt; then
  1468. _G_rc_parse_options=:
  1469. break
  1470. fi
  1471. case " $warning_categories $1" in
  1472. *" $1 "*)
  1473. # trailing space prevents matching last $1 above
  1474. func_append_uniq opt_warning_types " $1"
  1475. ;;
  1476. *all)
  1477. opt_warning_types=$warning_categories
  1478. ;;
  1479. *none)
  1480. opt_warning_types=none
  1481. warning_func=:
  1482. ;;
  1483. *error)
  1484. opt_warning_types=$warning_categories
  1485. warning_func=func_fatal_error
  1486. ;;
  1487. *)
  1488. func_fatal_error \
  1489. "unsupported warning category: '$1'"
  1490. ;;
  1491. esac
  1492. shift
  1493. ;;
  1494. --verbose|-v) opt_verbose=: ;;
  1495. --version) func_version ;;
  1496. -\?|-h) func_usage ;;
  1497. --help) func_help ;;
  1498. # Separate optargs to long options (plugins may need this):
  1499. --*=*) func_split_equals "$_G_opt"
  1500. set dummy "$func_split_equals_lhs" \
  1501. "$func_split_equals_rhs" ${1+"$@"}
  1502. shift
  1503. ;;
  1504. # Separate optargs to short options:
  1505. -W*)
  1506. func_split_short_opt "$_G_opt"
  1507. set dummy "$func_split_short_opt_name" \
  1508. "$func_split_short_opt_arg" ${1+"$@"}
  1509. shift
  1510. ;;
  1511. # Separate non-argument short options:
  1512. -\?*|-h*|-v*|-x*)
  1513. func_split_short_opt "$_G_opt"
  1514. set dummy "$func_split_short_opt_name" \
  1515. "-$func_split_short_opt_arg" ${1+"$@"}
  1516. shift
  1517. ;;
  1518. --) _G_rc_parse_options=: ; break ;;
  1519. -*) func_fatal_help "unrecognised option: '$_G_opt'" ;;
  1520. *) set dummy "$_G_opt" ${1+"$@"}; shift
  1521. _G_match_parse_options=false
  1522. break
  1523. ;;
  1524. esac
  1525. $_G_match_parse_options && _G_rc_parse_options=:
  1526. done
  1527. if $_G_rc_parse_options; then
  1528. # save modified positional parameters for caller
  1529. func_quote_for_eval ${1+"$@"}
  1530. func_parse_options_result=$func_quote_for_eval_result
  1531. fi
  1532. $_G_rc_parse_options
  1533. }
  1534. # func_validate_options [ARG]...
  1535. # ------------------------------
  1536. # Perform any sanity checks on option settings and/or unconsumed
  1537. # arguments.
  1538. func_hookable func_validate_options
  1539. func_validate_options ()
  1540. {
  1541. $debug_cmd
  1542. _G_rc_validate_options=false
  1543. # Display all warnings if -W was not given.
  1544. test -n "$opt_warning_types" || opt_warning_types=" $warning_categories"
  1545. if func_run_hooks func_validate_options ${1+"$@"}; then
  1546. # save modified positional parameters for caller
  1547. func_validate_options_result=$func_run_hooks_result
  1548. _G_rc_validate_options=:
  1549. fi
  1550. # Bail if the options were screwed!
  1551. $exit_cmd $EXIT_FAILURE
  1552. $_G_rc_validate_options
  1553. }
  1554. ## ----------------- ##
  1555. ## Helper functions. ##
  1556. ## ----------------- ##
  1557. # This section contains the helper functions used by the rest of the
  1558. # hookable option parser framework in ascii-betical order.
  1559. # func_fatal_help ARG...
  1560. # ----------------------
  1561. # Echo program name prefixed message to standard error, followed by
  1562. # a help hint, and exit.
  1563. func_fatal_help ()
  1564. {
  1565. $debug_cmd
  1566. eval \$ECHO \""Usage: $usage"\"
  1567. eval \$ECHO \""$fatal_help"\"
  1568. func_error ${1+"$@"}
  1569. exit $EXIT_FAILURE
  1570. }
  1571. # func_help
  1572. # ---------
  1573. # Echo long help message to standard output and exit.
  1574. func_help ()
  1575. {
  1576. $debug_cmd
  1577. func_usage_message
  1578. $ECHO "$long_help_message"
  1579. exit 0
  1580. }
  1581. # func_missing_arg ARGNAME
  1582. # ------------------------
  1583. # Echo program name prefixed message to standard error and set global
  1584. # exit_cmd.
  1585. func_missing_arg ()
  1586. {
  1587. $debug_cmd
  1588. func_error "Missing argument for '$1'."
  1589. exit_cmd=exit
  1590. }
  1591. # func_split_equals STRING
  1592. # ------------------------
  1593. # Set func_split_equals_lhs and func_split_equals_rhs shell variables after
  1594. # splitting STRING at the '=' sign.
  1595. test -z "$_G_HAVE_XSI_OPS" \
  1596. && (eval 'x=a/b/c;
  1597. test 5aa/bb/cc = "${#x}${x%%/*}${x%/*}${x#*/}${x##*/}"') 2>/dev/null \
  1598. && _G_HAVE_XSI_OPS=yes
  1599. if test yes = "$_G_HAVE_XSI_OPS"
  1600. then
  1601. # This is an XSI compatible shell, allowing a faster implementation...
  1602. eval 'func_split_equals ()
  1603. {
  1604. $debug_cmd
  1605. func_split_equals_lhs=${1%%=*}
  1606. func_split_equals_rhs=${1#*=}
  1607. test "x$func_split_equals_lhs" = "x$1" \
  1608. && func_split_equals_rhs=
  1609. }'
  1610. else
  1611. # ...otherwise fall back to using expr, which is often a shell builtin.
  1612. func_split_equals ()
  1613. {
  1614. $debug_cmd
  1615. func_split_equals_lhs=`expr "x$1" : 'x\([^=]*\)'`
  1616. func_split_equals_rhs=
  1617. test "x$func_split_equals_lhs" = "x$1" \
  1618. || func_split_equals_rhs=`expr "x$1" : 'x[^=]*=\(.*\)$'`
  1619. }
  1620. fi #func_split_equals
  1621. # func_split_short_opt SHORTOPT
  1622. # -----------------------------
  1623. # Set func_split_short_opt_name and func_split_short_opt_arg shell
  1624. # variables after splitting SHORTOPT after the 2nd character.
  1625. if test yes = "$_G_HAVE_XSI_OPS"
  1626. then
  1627. # This is an XSI compatible shell, allowing a faster implementation...
  1628. eval 'func_split_short_opt ()
  1629. {
  1630. $debug_cmd
  1631. func_split_short_opt_arg=${1#??}
  1632. func_split_short_opt_name=${1%"$func_split_short_opt_arg"}
  1633. }'
  1634. else
  1635. # ...otherwise fall back to using expr, which is often a shell builtin.
  1636. func_split_short_opt ()
  1637. {
  1638. $debug_cmd
  1639. func_split_short_opt_name=`expr "x$1" : 'x-\(.\)'`
  1640. func_split_short_opt_arg=`expr "x$1" : 'x-.\(.*\)$'`
  1641. }
  1642. fi #func_split_short_opt
  1643. # func_usage
  1644. # ----------
  1645. # Echo short help message to standard output and exit.
  1646. func_usage ()
  1647. {
  1648. $debug_cmd
  1649. func_usage_message
  1650. $ECHO "Run '$progname --help |${PAGER-more}' for full usage"
  1651. exit 0
  1652. }
  1653. # func_usage_message
  1654. # ------------------
  1655. # Echo short help message to standard output.
  1656. func_usage_message ()
  1657. {
  1658. $debug_cmd
  1659. eval \$ECHO \""Usage: $usage"\"
  1660. echo
  1661. $SED -n 's|^# ||
  1662. /^Written by/{
  1663. x;p;x
  1664. }
  1665. h
  1666. /^Written by/q' < "$progpath"
  1667. echo
  1668. eval \$ECHO \""$usage_message"\"
  1669. }
  1670. # func_version
  1671. # ------------
  1672. # Echo version message to standard output and exit.
  1673. func_version ()
  1674. {
  1675. $debug_cmd
  1676. printf '%s\n' "$progname $scriptversion"
  1677. $SED -n '
  1678. /(C)/!b go
  1679. :more
  1680. /\./!{
  1681. N
  1682. s|\n# | |
  1683. b more
  1684. }
  1685. :go
  1686. /^# Written by /,/# warranty; / {
  1687. s|^# ||
  1688. s|^# *$||
  1689. s|\((C)\)[ 0-9,-]*[ ,-]\([1-9][0-9]* \)|\1 \2|
  1690. p
  1691. }
  1692. /^# Written by / {
  1693. s|^# ||
  1694. p
  1695. }
  1696. /^warranty; /q' < "$progpath"
  1697. exit $?
  1698. }
  1699. # Local variables:
  1700. # mode: shell-script
  1701. # sh-indentation: 2
  1702. # eval: (add-hook 'before-save-hook 'time-stamp)
  1703. # time-stamp-pattern: "10/scriptversion=%:y-%02m-%02d.%02H; # UTC"
  1704. # time-stamp-time-zone: "UTC"
  1705. # End:
  1706. # Set a version string.
  1707. scriptversion='(GNU libtool) 2.4.6'
  1708. # func_echo ARG...
  1709. # ----------------
  1710. # Libtool also displays the current mode in messages, so override
  1711. # funclib.sh func_echo with this custom definition.
  1712. func_echo ()
  1713. {
  1714. $debug_cmd
  1715. _G_message=$*
  1716. func_echo_IFS=$IFS
  1717. IFS=$nl
  1718. for _G_line in $_G_message; do
  1719. IFS=$func_echo_IFS
  1720. $ECHO "$progname${opt_mode+: $opt_mode}: $_G_line"
  1721. done
  1722. IFS=$func_echo_IFS
  1723. }
  1724. # func_warning ARG...
  1725. # -------------------
  1726. # Libtool warnings are not categorized, so override funclib.sh
  1727. # func_warning with this simpler definition.
  1728. func_warning ()
  1729. {
  1730. $debug_cmd
  1731. $warning_func ${1+"$@"}
  1732. }
  1733. ## ---------------- ##
  1734. ## Options parsing. ##
  1735. ## ---------------- ##
  1736. # Hook in the functions to make sure our own options are parsed during
  1737. # the option parsing loop.
  1738. usage='$progpath [OPTION]... [MODE-ARG]...'
  1739. # Short help message in response to '-h'.
  1740. usage_message="Options:
  1741. --config show all configuration variables
  1742. --debug enable verbose shell tracing
  1743. -n, --dry-run display commands without modifying any files
  1744. --features display basic configuration information and exit
  1745. --mode=MODE use operation mode MODE
  1746. --no-warnings equivalent to '-Wnone'
  1747. --preserve-dup-deps don't remove duplicate dependency libraries
  1748. --quiet, --silent don't print informational messages
  1749. --tag=TAG use configuration variables from tag TAG
  1750. -v, --verbose print more informational messages than default
  1751. --version print version information
  1752. -W, --warnings=CATEGORY report the warnings falling in CATEGORY [all]
  1753. -h, --help, --help-all print short, long, or detailed help message
  1754. "
  1755. # Additional text appended to 'usage_message' in response to '--help'.
  1756. func_help ()
  1757. {
  1758. $debug_cmd
  1759. func_usage_message
  1760. $ECHO "$long_help_message
  1761. MODE must be one of the following:
  1762. clean remove files from the build directory
  1763. compile compile a source file into a libtool object
  1764. execute automatically set library path, then run a program
  1765. finish complete the installation of libtool libraries
  1766. install install libraries or executables
  1767. link create a library or an executable
  1768. uninstall remove libraries from an installed directory
  1769. MODE-ARGS vary depending on the MODE. When passed as first option,
  1770. '--mode=MODE' may be abbreviated as 'MODE' or a unique abbreviation of that.
  1771. Try '$progname --help --mode=MODE' for a more detailed description of MODE.
  1772. When reporting a bug, please describe a test case to reproduce it and
  1773. include the following information:
  1774. host-triplet: $host
  1775. shell: $SHELL
  1776. compiler: $LTCC
  1777. compiler flags: $LTCFLAGS
  1778. linker: $LD (gnu? $with_gnu_ld)
  1779. version: $progname $scriptversion Debian-2.4.6-14
  1780. automake: `($AUTOMAKE --version) 2>/dev/null |$SED 1q`
  1781. autoconf: `($AUTOCONF --version) 2>/dev/null |$SED 1q`
  1782. Report bugs to <bug-libtool@gnu.org>.
  1783. GNU libtool home page: <http://www.gnu.org/s/libtool/>.
  1784. General help using GNU software: <http://www.gnu.org/gethelp/>."
  1785. exit 0
  1786. }
  1787. # func_lo2o OBJECT-NAME
  1788. # ---------------------
  1789. # Transform OBJECT-NAME from a '.lo' suffix to the platform specific
  1790. # object suffix.
  1791. lo2o=s/\\.lo\$/.$objext/
  1792. o2lo=s/\\.$objext\$/.lo/
  1793. if test yes = "$_G_HAVE_XSI_OPS"; then
  1794. eval 'func_lo2o ()
  1795. {
  1796. case $1 in
  1797. *.lo) func_lo2o_result=${1%.lo}.$objext ;;
  1798. * ) func_lo2o_result=$1 ;;
  1799. esac
  1800. }'
  1801. # func_xform LIBOBJ-OR-SOURCE
  1802. # ---------------------------
  1803. # Transform LIBOBJ-OR-SOURCE from a '.o' or '.c' (or otherwise)
  1804. # suffix to a '.lo' libtool-object suffix.
  1805. eval 'func_xform ()
  1806. {
  1807. func_xform_result=${1%.*}.lo
  1808. }'
  1809. else
  1810. # ...otherwise fall back to using sed.
  1811. func_lo2o ()
  1812. {
  1813. func_lo2o_result=`$ECHO "$1" | $SED "$lo2o"`
  1814. }
  1815. func_xform ()
  1816. {
  1817. func_xform_result=`$ECHO "$1" | $SED 's|\.[^.]*$|.lo|'`
  1818. }
  1819. fi
  1820. # func_fatal_configuration ARG...
  1821. # -------------------------------
  1822. # Echo program name prefixed message to standard error, followed by
  1823. # a configuration failure hint, and exit.
  1824. func_fatal_configuration ()
  1825. {
  1826. func__fatal_error ${1+"$@"} \
  1827. "See the $PACKAGE documentation for more information." \
  1828. "Fatal configuration error."
  1829. }
  1830. # func_config
  1831. # -----------
  1832. # Display the configuration for all the tags in this script.
  1833. func_config ()
  1834. {
  1835. re_begincf='^# ### BEGIN LIBTOOL'
  1836. re_endcf='^# ### END LIBTOOL'
  1837. # Default configuration.
  1838. $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath"
  1839. # Now print the configurations for the tags.
  1840. for tagname in $taglist; do
  1841. $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath"
  1842. done
  1843. exit $?
  1844. }
  1845. # func_features
  1846. # -------------
  1847. # Display the features supported by this script.
  1848. func_features ()
  1849. {
  1850. echo "host: $host"
  1851. if test yes = "$build_libtool_libs"; then
  1852. echo "enable shared libraries"
  1853. else
  1854. echo "disable shared libraries"
  1855. fi
  1856. if test yes = "$build_old_libs"; then
  1857. echo "enable static libraries"
  1858. else
  1859. echo "disable static libraries"
  1860. fi
  1861. exit $?
  1862. }
  1863. # func_enable_tag TAGNAME
  1864. # -----------------------
  1865. # Verify that TAGNAME is valid, and either flag an error and exit, or
  1866. # enable the TAGNAME tag. We also add TAGNAME to the global $taglist
  1867. # variable here.
  1868. func_enable_tag ()
  1869. {
  1870. # Global variable:
  1871. tagname=$1
  1872. re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$"
  1873. re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$"
  1874. sed_extractcf=/$re_begincf/,/$re_endcf/p
  1875. # Validate tagname.
  1876. case $tagname in
  1877. *[!-_A-Za-z0-9,/]*)
  1878. func_fatal_error "invalid tag name: $tagname"
  1879. ;;
  1880. esac
  1881. # Don't test for the "default" C tag, as we know it's
  1882. # there but not specially marked.
  1883. case $tagname in
  1884. CC) ;;
  1885. *)
  1886. if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then
  1887. taglist="$taglist $tagname"
  1888. # Evaluate the configuration. Be careful to quote the path
  1889. # and the sed script, to avoid splitting on whitespace, but
  1890. # also don't use non-portable quotes within backquotes within
  1891. # quotes we have to do it in 2 steps:
  1892. extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"`
  1893. eval "$extractedcf"
  1894. else
  1895. func_error "ignoring unknown tag $tagname"
  1896. fi
  1897. ;;
  1898. esac
  1899. }
  1900. # func_check_version_match
  1901. # ------------------------
  1902. # Ensure that we are using m4 macros, and libtool script from the same
  1903. # release of libtool.
  1904. func_check_version_match ()
  1905. {
  1906. if test "$package_revision" != "$macro_revision"; then
  1907. if test "$VERSION" != "$macro_version"; then
  1908. if test -z "$macro_version"; then
  1909. cat >&2 <<_LT_EOF
  1910. $progname: Version mismatch error. This is $PACKAGE $VERSION, but the
  1911. $progname: definition of this LT_INIT comes from an older release.
  1912. $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
  1913. $progname: and run autoconf again.
  1914. _LT_EOF
  1915. else
  1916. cat >&2 <<_LT_EOF
  1917. $progname: Version mismatch error. This is $PACKAGE $VERSION, but the
  1918. $progname: definition of this LT_INIT comes from $PACKAGE $macro_version.
  1919. $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
  1920. $progname: and run autoconf again.
  1921. _LT_EOF
  1922. fi
  1923. else
  1924. cat >&2 <<_LT_EOF
  1925. $progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision,
  1926. $progname: but the definition of this LT_INIT comes from revision $macro_revision.
  1927. $progname: You should recreate aclocal.m4 with macros from revision $package_revision
  1928. $progname: of $PACKAGE $VERSION and run autoconf again.
  1929. _LT_EOF
  1930. fi
  1931. exit $EXIT_MISMATCH
  1932. fi
  1933. }
  1934. # libtool_options_prep [ARG]...
  1935. # -----------------------------
  1936. # Preparation for options parsed by libtool.
  1937. libtool_options_prep ()
  1938. {
  1939. $debug_mode
  1940. # Option defaults:
  1941. opt_config=false
  1942. opt_dlopen=
  1943. opt_dry_run=false
  1944. opt_help=false
  1945. opt_mode=
  1946. opt_preserve_dup_deps=false
  1947. opt_quiet=false
  1948. nonopt=
  1949. preserve_args=
  1950. _G_rc_lt_options_prep=:
  1951. # Shorthand for --mode=foo, only valid as the first argument
  1952. case $1 in
  1953. clean|clea|cle|cl)
  1954. shift; set dummy --mode clean ${1+"$@"}; shift
  1955. ;;
  1956. compile|compil|compi|comp|com|co|c)
  1957. shift; set dummy --mode compile ${1+"$@"}; shift
  1958. ;;
  1959. execute|execut|execu|exec|exe|ex|e)
  1960. shift; set dummy --mode execute ${1+"$@"}; shift
  1961. ;;
  1962. finish|finis|fini|fin|fi|f)
  1963. shift; set dummy --mode finish ${1+"$@"}; shift
  1964. ;;
  1965. install|instal|insta|inst|ins|in|i)
  1966. shift; set dummy --mode install ${1+"$@"}; shift
  1967. ;;
  1968. link|lin|li|l)
  1969. shift; set dummy --mode link ${1+"$@"}; shift
  1970. ;;
  1971. uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u)
  1972. shift; set dummy --mode uninstall ${1+"$@"}; shift
  1973. ;;
  1974. *)
  1975. _G_rc_lt_options_prep=false
  1976. ;;
  1977. esac
  1978. if $_G_rc_lt_options_prep; then
  1979. # Pass back the list of options.
  1980. func_quote_for_eval ${1+"$@"}
  1981. libtool_options_prep_result=$func_quote_for_eval_result
  1982. fi
  1983. $_G_rc_lt_options_prep
  1984. }
  1985. func_add_hook func_options_prep libtool_options_prep
  1986. # libtool_parse_options [ARG]...
  1987. # ---------------------------------
  1988. # Provide handling for libtool specific options.
  1989. libtool_parse_options ()
  1990. {
  1991. $debug_cmd
  1992. _G_rc_lt_parse_options=false
  1993. # Perform our own loop to consume as many options as possible in
  1994. # each iteration.
  1995. while test $# -gt 0; do
  1996. _G_match_lt_parse_options=:
  1997. _G_opt=$1
  1998. shift
  1999. case $_G_opt in
  2000. --dry-run|--dryrun|-n)
  2001. opt_dry_run=:
  2002. ;;
  2003. --config) func_config ;;
  2004. --dlopen|-dlopen)
  2005. opt_dlopen="${opt_dlopen+$opt_dlopen
  2006. }$1"
  2007. shift
  2008. ;;
  2009. --preserve-dup-deps)
  2010. opt_preserve_dup_deps=: ;;
  2011. --features) func_features ;;
  2012. --finish) set dummy --mode finish ${1+"$@"}; shift ;;
  2013. --help) opt_help=: ;;
  2014. --help-all) opt_help=': help-all' ;;
  2015. --mode) test $# = 0 && func_missing_arg $_G_opt && break
  2016. opt_mode=$1
  2017. case $1 in
  2018. # Valid mode arguments:
  2019. clean|compile|execute|finish|install|link|relink|uninstall) ;;
  2020. # Catch anything else as an error
  2021. *) func_error "invalid argument for $_G_opt"
  2022. exit_cmd=exit
  2023. break
  2024. ;;
  2025. esac
  2026. shift
  2027. ;;
  2028. --no-silent|--no-quiet)
  2029. opt_quiet=false
  2030. func_append preserve_args " $_G_opt"
  2031. ;;
  2032. --no-warnings|--no-warning|--no-warn)
  2033. opt_warning=false
  2034. func_append preserve_args " $_G_opt"
  2035. ;;
  2036. --no-verbose)
  2037. opt_verbose=false
  2038. func_append preserve_args " $_G_opt"
  2039. ;;
  2040. --silent|--quiet)
  2041. opt_quiet=:
  2042. opt_verbose=false
  2043. func_append preserve_args " $_G_opt"
  2044. ;;
  2045. --tag) test $# = 0 && func_missing_arg $_G_opt && break
  2046. opt_tag=$1
  2047. func_append preserve_args " $_G_opt $1"
  2048. func_enable_tag "$1"
  2049. shift
  2050. ;;
  2051. --verbose|-v) opt_quiet=false
  2052. opt_verbose=:
  2053. func_append preserve_args " $_G_opt"
  2054. ;;
  2055. # An option not handled by this hook function:
  2056. *) set dummy "$_G_opt" ${1+"$@"} ; shift
  2057. _G_match_lt_parse_options=false
  2058. break
  2059. ;;
  2060. esac
  2061. $_G_match_lt_parse_options && _G_rc_lt_parse_options=:
  2062. done
  2063. if $_G_rc_lt_parse_options; then
  2064. # save modified positional parameters for caller
  2065. func_quote_for_eval ${1+"$@"}
  2066. libtool_parse_options_result=$func_quote_for_eval_result
  2067. fi
  2068. $_G_rc_lt_parse_options
  2069. }
  2070. func_add_hook func_parse_options libtool_parse_options
  2071. # libtool_validate_options [ARG]...
  2072. # ---------------------------------
  2073. # Perform any sanity checks on option settings and/or unconsumed
  2074. # arguments.
  2075. libtool_validate_options ()
  2076. {
  2077. # save first non-option argument
  2078. if test 0 -lt $#; then
  2079. nonopt=$1
  2080. shift
  2081. fi
  2082. # preserve --debug
  2083. test : = "$debug_cmd" || func_append preserve_args " --debug"
  2084. case $host in
  2085. # Solaris2 added to fix http://debbugs.gnu.org/cgi/bugreport.cgi?bug=16452
  2086. # see also: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59788
  2087. *cygwin* | *mingw* | *pw32* | *cegcc* | *solaris2* | *os2*)
  2088. # don't eliminate duplications in $postdeps and $predeps
  2089. opt_duplicate_compiler_generated_deps=:
  2090. ;;
  2091. *)
  2092. opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps
  2093. ;;
  2094. esac
  2095. $opt_help || {
  2096. # Sanity checks first:
  2097. func_check_version_match
  2098. test yes != "$build_libtool_libs" \
  2099. && test yes != "$build_old_libs" \
  2100. && func_fatal_configuration "not configured to build any kind of library"
  2101. # Darwin sucks
  2102. eval std_shrext=\"$shrext_cmds\"
  2103. # Only execute mode is allowed to have -dlopen flags.
  2104. if test -n "$opt_dlopen" && test execute != "$opt_mode"; then
  2105. func_error "unrecognized option '-dlopen'"
  2106. $ECHO "$help" 1>&2
  2107. exit $EXIT_FAILURE
  2108. fi
  2109. # Change the help message to a mode-specific one.
  2110. generic_help=$help
  2111. help="Try '$progname --help --mode=$opt_mode' for more information."
  2112. }
  2113. # Pass back the unparsed argument list
  2114. func_quote_for_eval ${1+"$@"}
  2115. libtool_validate_options_result=$func_quote_for_eval_result
  2116. }
  2117. func_add_hook func_validate_options libtool_validate_options
  2118. # Process options as early as possible so that --help and --version
  2119. # can return quickly.
  2120. func_options ${1+"$@"}
  2121. eval set dummy "$func_options_result"; shift
  2122. ## ----------- ##
  2123. ## Main. ##
  2124. ## ----------- ##
  2125. magic='%%%MAGIC variable%%%'
  2126. magic_exe='%%%MAGIC EXE variable%%%'
  2127. # Global variables.
  2128. extracted_archives=
  2129. extracted_serial=0
  2130. # If this variable is set in any of the actions, the command in it
  2131. # will be execed at the end. This prevents here-documents from being
  2132. # left over by shells.
  2133. exec_cmd=
  2134. # A function that is used when there is no print builtin or printf.
  2135. func_fallback_echo ()
  2136. {
  2137. eval 'cat <<_LTECHO_EOF
  2138. $1
  2139. _LTECHO_EOF'
  2140. }
  2141. # func_generated_by_libtool
  2142. # True iff stdin has been generated by Libtool. This function is only
  2143. # a basic sanity check; it will hardly flush out determined imposters.
  2144. func_generated_by_libtool_p ()
  2145. {
  2146. $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1
  2147. }
  2148. # func_lalib_p file
  2149. # True iff FILE is a libtool '.la' library or '.lo' object file.
  2150. # This function is only a basic sanity check; it will hardly flush out
  2151. # determined imposters.
  2152. func_lalib_p ()
  2153. {
  2154. test -f "$1" &&
  2155. $SED -e 4q "$1" 2>/dev/null | func_generated_by_libtool_p
  2156. }
  2157. # func_lalib_unsafe_p file
  2158. # True iff FILE is a libtool '.la' library or '.lo' object file.
  2159. # This function implements the same check as func_lalib_p without
  2160. # resorting to external programs. To this end, it redirects stdin and
  2161. # closes it afterwards, without saving the original file descriptor.
  2162. # As a safety measure, use it only where a negative result would be
  2163. # fatal anyway. Works if 'file' does not exist.
  2164. func_lalib_unsafe_p ()
  2165. {
  2166. lalib_p=no
  2167. if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then
  2168. for lalib_p_l in 1 2 3 4
  2169. do
  2170. read lalib_p_line
  2171. case $lalib_p_line in
  2172. \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;;
  2173. esac
  2174. done
  2175. exec 0<&5 5<&-
  2176. fi
  2177. test yes = "$lalib_p"
  2178. }
  2179. # func_ltwrapper_script_p file
  2180. # True iff FILE is a libtool wrapper script
  2181. # This function is only a basic sanity check; it will hardly flush out
  2182. # determined imposters.
  2183. func_ltwrapper_script_p ()
  2184. {
  2185. test -f "$1" &&
  2186. $lt_truncate_bin < "$1" 2>/dev/null | func_generated_by_libtool_p
  2187. }
  2188. # func_ltwrapper_executable_p file
  2189. # True iff FILE is a libtool wrapper executable
  2190. # This function is only a basic sanity check; it will hardly flush out
  2191. # determined imposters.
  2192. func_ltwrapper_executable_p ()
  2193. {
  2194. func_ltwrapper_exec_suffix=
  2195. case $1 in
  2196. *.exe) ;;
  2197. *) func_ltwrapper_exec_suffix=.exe ;;
  2198. esac
  2199. $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1
  2200. }
  2201. # func_ltwrapper_scriptname file
  2202. # Assumes file is an ltwrapper_executable
  2203. # uses $file to determine the appropriate filename for a
  2204. # temporary ltwrapper_script.
  2205. func_ltwrapper_scriptname ()
  2206. {
  2207. func_dirname_and_basename "$1" "" "."
  2208. func_stripname '' '.exe' "$func_basename_result"
  2209. func_ltwrapper_scriptname_result=$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper
  2210. }
  2211. # func_ltwrapper_p file
  2212. # True iff FILE is a libtool wrapper script or wrapper executable
  2213. # This function is only a basic sanity check; it will hardly flush out
  2214. # determined imposters.
  2215. func_ltwrapper_p ()
  2216. {
  2217. func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1"
  2218. }
  2219. # func_execute_cmds commands fail_cmd
  2220. # Execute tilde-delimited COMMANDS.
  2221. # If FAIL_CMD is given, eval that upon failure.
  2222. # FAIL_CMD may read-access the current command in variable CMD!
  2223. func_execute_cmds ()
  2224. {
  2225. $debug_cmd
  2226. save_ifs=$IFS; IFS='~'
  2227. for cmd in $1; do
  2228. IFS=$sp$nl
  2229. eval cmd=\"$cmd\"
  2230. IFS=$save_ifs
  2231. func_show_eval "$cmd" "${2-:}"
  2232. done
  2233. IFS=$save_ifs
  2234. }
  2235. # func_source file
  2236. # Source FILE, adding directory component if necessary.
  2237. # Note that it is not necessary on cygwin/mingw to append a dot to
  2238. # FILE even if both FILE and FILE.exe exist: automatic-append-.exe
  2239. # behavior happens only for exec(3), not for open(2)! Also, sourcing
  2240. # 'FILE.' does not work on cygwin managed mounts.
  2241. func_source ()
  2242. {
  2243. $debug_cmd
  2244. case $1 in
  2245. */* | *\\*) . "$1" ;;
  2246. *) . "./$1" ;;
  2247. esac
  2248. }
  2249. # func_resolve_sysroot PATH
  2250. # Replace a leading = in PATH with a sysroot. Store the result into
  2251. # func_resolve_sysroot_result
  2252. func_resolve_sysroot ()
  2253. {
  2254. func_resolve_sysroot_result=$1
  2255. case $func_resolve_sysroot_result in
  2256. =*)
  2257. func_stripname '=' '' "$func_resolve_sysroot_result"
  2258. func_resolve_sysroot_result=$lt_sysroot$func_stripname_result
  2259. ;;
  2260. esac
  2261. }
  2262. # func_replace_sysroot PATH
  2263. # If PATH begins with the sysroot, replace it with = and
  2264. # store the result into func_replace_sysroot_result.
  2265. func_replace_sysroot ()
  2266. {
  2267. case $lt_sysroot:$1 in
  2268. ?*:"$lt_sysroot"*)
  2269. func_stripname "$lt_sysroot" '' "$1"
  2270. func_replace_sysroot_result='='$func_stripname_result
  2271. ;;
  2272. *)
  2273. # Including no sysroot.
  2274. func_replace_sysroot_result=$1
  2275. ;;
  2276. esac
  2277. }
  2278. # func_infer_tag arg
  2279. # Infer tagged configuration to use if any are available and
  2280. # if one wasn't chosen via the "--tag" command line option.
  2281. # Only attempt this if the compiler in the base compile
  2282. # command doesn't match the default compiler.
  2283. # arg is usually of the form 'gcc ...'
  2284. func_infer_tag ()
  2285. {
  2286. $debug_cmd
  2287. if test -n "$available_tags" && test -z "$tagname"; then
  2288. CC_quoted=
  2289. for arg in $CC; do
  2290. func_append_quoted CC_quoted "$arg"
  2291. done
  2292. CC_expanded=`func_echo_all $CC`
  2293. CC_quoted_expanded=`func_echo_all $CC_quoted`
  2294. case $@ in
  2295. # Blanks in the command may have been stripped by the calling shell,
  2296. # but not from the CC environment variable when configure was run.
  2297. " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
  2298. " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;;
  2299. # Blanks at the start of $base_compile will cause this to fail
  2300. # if we don't check for them as well.
  2301. *)
  2302. for z in $available_tags; do
  2303. if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
  2304. # Evaluate the configuration.
  2305. eval "`$SED -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
  2306. CC_quoted=
  2307. for arg in $CC; do
  2308. # Double-quote args containing other shell metacharacters.
  2309. func_append_quoted CC_quoted "$arg"
  2310. done
  2311. CC_expanded=`func_echo_all $CC`
  2312. CC_quoted_expanded=`func_echo_all $CC_quoted`
  2313. case "$@ " in
  2314. " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
  2315. " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*)
  2316. # The compiler in the base compile command matches
  2317. # the one in the tagged configuration.
  2318. # Assume this is the tagged configuration we want.
  2319. tagname=$z
  2320. break
  2321. ;;
  2322. esac
  2323. fi
  2324. done
  2325. # If $tagname still isn't set, then no tagged configuration
  2326. # was found and let the user know that the "--tag" command
  2327. # line option must be used.
  2328. if test -z "$tagname"; then
  2329. func_echo "unable to infer tagged configuration"
  2330. func_fatal_error "specify a tag with '--tag'"
  2331. # else
  2332. # func_verbose "using $tagname tagged configuration"
  2333. fi
  2334. ;;
  2335. esac
  2336. fi
  2337. }
  2338. # func_write_libtool_object output_name pic_name nonpic_name
  2339. # Create a libtool object file (analogous to a ".la" file),
  2340. # but don't create it if we're doing a dry run.
  2341. func_write_libtool_object ()
  2342. {
  2343. write_libobj=$1
  2344. if test yes = "$build_libtool_libs"; then
  2345. write_lobj=\'$2\'
  2346. else
  2347. write_lobj=none
  2348. fi
  2349. if test yes = "$build_old_libs"; then
  2350. write_oldobj=\'$3\'
  2351. else
  2352. write_oldobj=none
  2353. fi
  2354. $opt_dry_run || {
  2355. cat >${write_libobj}T <<EOF
  2356. # $write_libobj - a libtool object file
  2357. # Generated by $PROGRAM (GNU $PACKAGE) $VERSION
  2358. #
  2359. # Please DO NOT delete this file!
  2360. # It is necessary for linking the library.
  2361. # Name of the PIC object.
  2362. pic_object=$write_lobj
  2363. # Name of the non-PIC object
  2364. non_pic_object=$write_oldobj
  2365. EOF
  2366. $MV "${write_libobj}T" "$write_libobj"
  2367. }
  2368. }
  2369. ##################################################
  2370. # FILE NAME AND PATH CONVERSION HELPER FUNCTIONS #
  2371. ##################################################
  2372. # func_convert_core_file_wine_to_w32 ARG
  2373. # Helper function used by file name conversion functions when $build is *nix,
  2374. # and $host is mingw, cygwin, or some other w32 environment. Relies on a
  2375. # correctly configured wine environment available, with the winepath program
  2376. # in $build's $PATH.
  2377. #
  2378. # ARG is the $build file name to be converted to w32 format.
  2379. # Result is available in $func_convert_core_file_wine_to_w32_result, and will
  2380. # be empty on error (or when ARG is empty)
  2381. func_convert_core_file_wine_to_w32 ()
  2382. {
  2383. $debug_cmd
  2384. func_convert_core_file_wine_to_w32_result=$1
  2385. if test -n "$1"; then
  2386. # Unfortunately, winepath does not exit with a non-zero error code, so we
  2387. # are forced to check the contents of stdout. On the other hand, if the
  2388. # command is not found, the shell will set an exit code of 127 and print
  2389. # *an error message* to stdout. So we must check for both error code of
  2390. # zero AND non-empty stdout, which explains the odd construction:
  2391. func_convert_core_file_wine_to_w32_tmp=`winepath -w "$1" 2>/dev/null`
  2392. if test "$?" -eq 0 && test -n "$func_convert_core_file_wine_to_w32_tmp"; then
  2393. func_convert_core_file_wine_to_w32_result=`$ECHO "$func_convert_core_file_wine_to_w32_tmp" |
  2394. $SED -e "$sed_naive_backslashify"`
  2395. else
  2396. func_convert_core_file_wine_to_w32_result=
  2397. fi
  2398. fi
  2399. }
  2400. # end: func_convert_core_file_wine_to_w32
  2401. # func_convert_core_path_wine_to_w32 ARG
  2402. # Helper function used by path conversion functions when $build is *nix, and
  2403. # $host is mingw, cygwin, or some other w32 environment. Relies on a correctly
  2404. # configured wine environment available, with the winepath program in $build's
  2405. # $PATH. Assumes ARG has no leading or trailing path separator characters.
  2406. #
  2407. # ARG is path to be converted from $build format to win32.
  2408. # Result is available in $func_convert_core_path_wine_to_w32_result.
  2409. # Unconvertible file (directory) names in ARG are skipped; if no directory names
  2410. # are convertible, then the result may be empty.
  2411. func_convert_core_path_wine_to_w32 ()
  2412. {
  2413. $debug_cmd
  2414. # unfortunately, winepath doesn't convert paths, only file names
  2415. func_convert_core_path_wine_to_w32_result=
  2416. if test -n "$1"; then
  2417. oldIFS=$IFS
  2418. IFS=:
  2419. for func_convert_core_path_wine_to_w32_f in $1; do
  2420. IFS=$oldIFS
  2421. func_convert_core_file_wine_to_w32 "$func_convert_core_path_wine_to_w32_f"
  2422. if test -n "$func_convert_core_file_wine_to_w32_result"; then
  2423. if test -z "$func_convert_core_path_wine_to_w32_result"; then
  2424. func_convert_core_path_wine_to_w32_result=$func_convert_core_file_wine_to_w32_result
  2425. else
  2426. func_append func_convert_core_path_wine_to_w32_result ";$func_convert_core_file_wine_to_w32_result"
  2427. fi
  2428. fi
  2429. done
  2430. IFS=$oldIFS
  2431. fi
  2432. }
  2433. # end: func_convert_core_path_wine_to_w32
  2434. # func_cygpath ARGS...
  2435. # Wrapper around calling the cygpath program via LT_CYGPATH. This is used when
  2436. # when (1) $build is *nix and Cygwin is hosted via a wine environment; or (2)
  2437. # $build is MSYS and $host is Cygwin, or (3) $build is Cygwin. In case (1) or
  2438. # (2), returns the Cygwin file name or path in func_cygpath_result (input
  2439. # file name or path is assumed to be in w32 format, as previously converted
  2440. # from $build's *nix or MSYS format). In case (3), returns the w32 file name
  2441. # or path in func_cygpath_result (input file name or path is assumed to be in
  2442. # Cygwin format). Returns an empty string on error.
  2443. #
  2444. # ARGS are passed to cygpath, with the last one being the file name or path to
  2445. # be converted.
  2446. #
  2447. # Specify the absolute *nix (or w32) name to cygpath in the LT_CYGPATH
  2448. # environment variable; do not put it in $PATH.
  2449. func_cygpath ()
  2450. {
  2451. $debug_cmd
  2452. if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then
  2453. func_cygpath_result=`$LT_CYGPATH "$@" 2>/dev/null`
  2454. if test "$?" -ne 0; then
  2455. # on failure, ensure result is empty
  2456. func_cygpath_result=
  2457. fi
  2458. else
  2459. func_cygpath_result=
  2460. func_error "LT_CYGPATH is empty or specifies non-existent file: '$LT_CYGPATH'"
  2461. fi
  2462. }
  2463. #end: func_cygpath
  2464. # func_convert_core_msys_to_w32 ARG
  2465. # Convert file name or path ARG from MSYS format to w32 format. Return
  2466. # result in func_convert_core_msys_to_w32_result.
  2467. func_convert_core_msys_to_w32 ()
  2468. {
  2469. $debug_cmd
  2470. # awkward: cmd appends spaces to result
  2471. func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null |
  2472. $SED -e 's/[ ]*$//' -e "$sed_naive_backslashify"`
  2473. }
  2474. #end: func_convert_core_msys_to_w32
  2475. # func_convert_file_check ARG1 ARG2
  2476. # Verify that ARG1 (a file name in $build format) was converted to $host
  2477. # format in ARG2. Otherwise, emit an error message, but continue (resetting
  2478. # func_to_host_file_result to ARG1).
  2479. func_convert_file_check ()
  2480. {
  2481. $debug_cmd
  2482. if test -z "$2" && test -n "$1"; then
  2483. func_error "Could not determine host file name corresponding to"
  2484. func_error " '$1'"
  2485. func_error "Continuing, but uninstalled executables may not work."
  2486. # Fallback:
  2487. func_to_host_file_result=$1
  2488. fi
  2489. }
  2490. # end func_convert_file_check
  2491. # func_convert_path_check FROM_PATHSEP TO_PATHSEP FROM_PATH TO_PATH
  2492. # Verify that FROM_PATH (a path in $build format) was converted to $host
  2493. # format in TO_PATH. Otherwise, emit an error message, but continue, resetting
  2494. # func_to_host_file_result to a simplistic fallback value (see below).
  2495. func_convert_path_check ()
  2496. {
  2497. $debug_cmd
  2498. if test -z "$4" && test -n "$3"; then
  2499. func_error "Could not determine the host path corresponding to"
  2500. func_error " '$3'"
  2501. func_error "Continuing, but uninstalled executables may not work."
  2502. # Fallback. This is a deliberately simplistic "conversion" and
  2503. # should not be "improved". See libtool.info.
  2504. if test "x$1" != "x$2"; then
  2505. lt_replace_pathsep_chars="s|$1|$2|g"
  2506. func_to_host_path_result=`echo "$3" |
  2507. $SED -e "$lt_replace_pathsep_chars"`
  2508. else
  2509. func_to_host_path_result=$3
  2510. fi
  2511. fi
  2512. }
  2513. # end func_convert_path_check
  2514. # func_convert_path_front_back_pathsep FRONTPAT BACKPAT REPL ORIG
  2515. # Modifies func_to_host_path_result by prepending REPL if ORIG matches FRONTPAT
  2516. # and appending REPL if ORIG matches BACKPAT.
  2517. func_convert_path_front_back_pathsep ()
  2518. {
  2519. $debug_cmd
  2520. case $4 in
  2521. $1 ) func_to_host_path_result=$3$func_to_host_path_result
  2522. ;;
  2523. esac
  2524. case $4 in
  2525. $2 ) func_append func_to_host_path_result "$3"
  2526. ;;
  2527. esac
  2528. }
  2529. # end func_convert_path_front_back_pathsep
  2530. ##################################################
  2531. # $build to $host FILE NAME CONVERSION FUNCTIONS #
  2532. ##################################################
  2533. # invoked via '$to_host_file_cmd ARG'
  2534. #
  2535. # In each case, ARG is the path to be converted from $build to $host format.
  2536. # Result will be available in $func_to_host_file_result.
  2537. # func_to_host_file ARG
  2538. # Converts the file name ARG from $build format to $host format. Return result
  2539. # in func_to_host_file_result.
  2540. func_to_host_file ()
  2541. {
  2542. $debug_cmd
  2543. $to_host_file_cmd "$1"
  2544. }
  2545. # end func_to_host_file
  2546. # func_to_tool_file ARG LAZY
  2547. # converts the file name ARG from $build format to toolchain format. Return
  2548. # result in func_to_tool_file_result. If the conversion in use is listed
  2549. # in (the comma separated) LAZY, no conversion takes place.
  2550. func_to_tool_file ()
  2551. {
  2552. $debug_cmd
  2553. case ,$2, in
  2554. *,"$to_tool_file_cmd",*)
  2555. func_to_tool_file_result=$1
  2556. ;;
  2557. *)
  2558. $to_tool_file_cmd "$1"
  2559. func_to_tool_file_result=$func_to_host_file_result
  2560. ;;
  2561. esac
  2562. }
  2563. # end func_to_tool_file
  2564. # func_convert_file_noop ARG
  2565. # Copy ARG to func_to_host_file_result.
  2566. func_convert_file_noop ()
  2567. {
  2568. func_to_host_file_result=$1
  2569. }
  2570. # end func_convert_file_noop
  2571. # func_convert_file_msys_to_w32 ARG
  2572. # Convert file name ARG from (mingw) MSYS to (mingw) w32 format; automatic
  2573. # conversion to w32 is not available inside the cwrapper. Returns result in
  2574. # func_to_host_file_result.
  2575. func_convert_file_msys_to_w32 ()
  2576. {
  2577. $debug_cmd
  2578. func_to_host_file_result=$1
  2579. if test -n "$1"; then
  2580. func_convert_core_msys_to_w32 "$1"
  2581. func_to_host_file_result=$func_convert_core_msys_to_w32_result
  2582. fi
  2583. func_convert_file_check "$1" "$func_to_host_file_result"
  2584. }
  2585. # end func_convert_file_msys_to_w32
  2586. # func_convert_file_cygwin_to_w32 ARG
  2587. # Convert file name ARG from Cygwin to w32 format. Returns result in
  2588. # func_to_host_file_result.
  2589. func_convert_file_cygwin_to_w32 ()
  2590. {
  2591. $debug_cmd
  2592. func_to_host_file_result=$1
  2593. if test -n "$1"; then
  2594. # because $build is cygwin, we call "the" cygpath in $PATH; no need to use
  2595. # LT_CYGPATH in this case.
  2596. func_to_host_file_result=`cygpath -m "$1"`
  2597. fi
  2598. func_convert_file_check "$1" "$func_to_host_file_result"
  2599. }
  2600. # end func_convert_file_cygwin_to_w32
  2601. # func_convert_file_nix_to_w32 ARG
  2602. # Convert file name ARG from *nix to w32 format. Requires a wine environment
  2603. # and a working winepath. Returns result in func_to_host_file_result.
  2604. func_convert_file_nix_to_w32 ()
  2605. {
  2606. $debug_cmd
  2607. func_to_host_file_result=$1
  2608. if test -n "$1"; then
  2609. func_convert_core_file_wine_to_w32 "$1"
  2610. func_to_host_file_result=$func_convert_core_file_wine_to_w32_result
  2611. fi
  2612. func_convert_file_check "$1" "$func_to_host_file_result"
  2613. }
  2614. # end func_convert_file_nix_to_w32
  2615. # func_convert_file_msys_to_cygwin ARG
  2616. # Convert file name ARG from MSYS to Cygwin format. Requires LT_CYGPATH set.
  2617. # Returns result in func_to_host_file_result.
  2618. func_convert_file_msys_to_cygwin ()
  2619. {
  2620. $debug_cmd
  2621. func_to_host_file_result=$1
  2622. if test -n "$1"; then
  2623. func_convert_core_msys_to_w32 "$1"
  2624. func_cygpath -u "$func_convert_core_msys_to_w32_result"
  2625. func_to_host_file_result=$func_cygpath_result
  2626. fi
  2627. func_convert_file_check "$1" "$func_to_host_file_result"
  2628. }
  2629. # end func_convert_file_msys_to_cygwin
  2630. # func_convert_file_nix_to_cygwin ARG
  2631. # Convert file name ARG from *nix to Cygwin format. Requires Cygwin installed
  2632. # in a wine environment, working winepath, and LT_CYGPATH set. Returns result
  2633. # in func_to_host_file_result.
  2634. func_convert_file_nix_to_cygwin ()
  2635. {
  2636. $debug_cmd
  2637. func_to_host_file_result=$1
  2638. if test -n "$1"; then
  2639. # convert from *nix to w32, then use cygpath to convert from w32 to cygwin.
  2640. func_convert_core_file_wine_to_w32 "$1"
  2641. func_cygpath -u "$func_convert_core_file_wine_to_w32_result"
  2642. func_to_host_file_result=$func_cygpath_result
  2643. fi
  2644. func_convert_file_check "$1" "$func_to_host_file_result"
  2645. }
  2646. # end func_convert_file_nix_to_cygwin
  2647. #############################################
  2648. # $build to $host PATH CONVERSION FUNCTIONS #
  2649. #############################################
  2650. # invoked via '$to_host_path_cmd ARG'
  2651. #
  2652. # In each case, ARG is the path to be converted from $build to $host format.
  2653. # The result will be available in $func_to_host_path_result.
  2654. #
  2655. # Path separators are also converted from $build format to $host format. If
  2656. # ARG begins or ends with a path separator character, it is preserved (but
  2657. # converted to $host format) on output.
  2658. #
  2659. # All path conversion functions are named using the following convention:
  2660. # file name conversion function : func_convert_file_X_to_Y ()
  2661. # path conversion function : func_convert_path_X_to_Y ()
  2662. # where, for any given $build/$host combination the 'X_to_Y' value is the
  2663. # same. If conversion functions are added for new $build/$host combinations,
  2664. # the two new functions must follow this pattern, or func_init_to_host_path_cmd
  2665. # will break.
  2666. # func_init_to_host_path_cmd
  2667. # Ensures that function "pointer" variable $to_host_path_cmd is set to the
  2668. # appropriate value, based on the value of $to_host_file_cmd.
  2669. to_host_path_cmd=
  2670. func_init_to_host_path_cmd ()
  2671. {
  2672. $debug_cmd
  2673. if test -z "$to_host_path_cmd"; then
  2674. func_stripname 'func_convert_file_' '' "$to_host_file_cmd"
  2675. to_host_path_cmd=func_convert_path_$func_stripname_result
  2676. fi
  2677. }
  2678. # func_to_host_path ARG
  2679. # Converts the path ARG from $build format to $host format. Return result
  2680. # in func_to_host_path_result.
  2681. func_to_host_path ()
  2682. {
  2683. $debug_cmd
  2684. func_init_to_host_path_cmd
  2685. $to_host_path_cmd "$1"
  2686. }
  2687. # end func_to_host_path
  2688. # func_convert_path_noop ARG
  2689. # Copy ARG to func_to_host_path_result.
  2690. func_convert_path_noop ()
  2691. {
  2692. func_to_host_path_result=$1
  2693. }
  2694. # end func_convert_path_noop
  2695. # func_convert_path_msys_to_w32 ARG
  2696. # Convert path ARG from (mingw) MSYS to (mingw) w32 format; automatic
  2697. # conversion to w32 is not available inside the cwrapper. Returns result in
  2698. # func_to_host_path_result.
  2699. func_convert_path_msys_to_w32 ()
  2700. {
  2701. $debug_cmd
  2702. func_to_host_path_result=$1
  2703. if test -n "$1"; then
  2704. # Remove leading and trailing path separator characters from ARG. MSYS
  2705. # behavior is inconsistent here; cygpath turns them into '.;' and ';.';
  2706. # and winepath ignores them completely.
  2707. func_stripname : : "$1"
  2708. func_to_host_path_tmp1=$func_stripname_result
  2709. func_convert_core_msys_to_w32 "$func_to_host_path_tmp1"
  2710. func_to_host_path_result=$func_convert_core_msys_to_w32_result
  2711. func_convert_path_check : ";" \
  2712. "$func_to_host_path_tmp1" "$func_to_host_path_result"
  2713. func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
  2714. fi
  2715. }
  2716. # end func_convert_path_msys_to_w32
  2717. # func_convert_path_cygwin_to_w32 ARG
  2718. # Convert path ARG from Cygwin to w32 format. Returns result in
  2719. # func_to_host_file_result.
  2720. func_convert_path_cygwin_to_w32 ()
  2721. {
  2722. $debug_cmd
  2723. func_to_host_path_result=$1
  2724. if test -n "$1"; then
  2725. # See func_convert_path_msys_to_w32:
  2726. func_stripname : : "$1"
  2727. func_to_host_path_tmp1=$func_stripname_result
  2728. func_to_host_path_result=`cygpath -m -p "$func_to_host_path_tmp1"`
  2729. func_convert_path_check : ";" \
  2730. "$func_to_host_path_tmp1" "$func_to_host_path_result"
  2731. func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
  2732. fi
  2733. }
  2734. # end func_convert_path_cygwin_to_w32
  2735. # func_convert_path_nix_to_w32 ARG
  2736. # Convert path ARG from *nix to w32 format. Requires a wine environment and
  2737. # a working winepath. Returns result in func_to_host_file_result.
  2738. func_convert_path_nix_to_w32 ()
  2739. {
  2740. $debug_cmd
  2741. func_to_host_path_result=$1
  2742. if test -n "$1"; then
  2743. # See func_convert_path_msys_to_w32:
  2744. func_stripname : : "$1"
  2745. func_to_host_path_tmp1=$func_stripname_result
  2746. func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1"
  2747. func_to_host_path_result=$func_convert_core_path_wine_to_w32_result
  2748. func_convert_path_check : ";" \
  2749. "$func_to_host_path_tmp1" "$func_to_host_path_result"
  2750. func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
  2751. fi
  2752. }
  2753. # end func_convert_path_nix_to_w32
  2754. # func_convert_path_msys_to_cygwin ARG
  2755. # Convert path ARG from MSYS to Cygwin format. Requires LT_CYGPATH set.
  2756. # Returns result in func_to_host_file_result.
  2757. func_convert_path_msys_to_cygwin ()
  2758. {
  2759. $debug_cmd
  2760. func_to_host_path_result=$1
  2761. if test -n "$1"; then
  2762. # See func_convert_path_msys_to_w32:
  2763. func_stripname : : "$1"
  2764. func_to_host_path_tmp1=$func_stripname_result
  2765. func_convert_core_msys_to_w32 "$func_to_host_path_tmp1"
  2766. func_cygpath -u -p "$func_convert_core_msys_to_w32_result"
  2767. func_to_host_path_result=$func_cygpath_result
  2768. func_convert_path_check : : \
  2769. "$func_to_host_path_tmp1" "$func_to_host_path_result"
  2770. func_convert_path_front_back_pathsep ":*" "*:" : "$1"
  2771. fi
  2772. }
  2773. # end func_convert_path_msys_to_cygwin
  2774. # func_convert_path_nix_to_cygwin ARG
  2775. # Convert path ARG from *nix to Cygwin format. Requires Cygwin installed in a
  2776. # a wine environment, working winepath, and LT_CYGPATH set. Returns result in
  2777. # func_to_host_file_result.
  2778. func_convert_path_nix_to_cygwin ()
  2779. {
  2780. $debug_cmd
  2781. func_to_host_path_result=$1
  2782. if test -n "$1"; then
  2783. # Remove leading and trailing path separator characters from
  2784. # ARG. msys behavior is inconsistent here, cygpath turns them
  2785. # into '.;' and ';.', and winepath ignores them completely.
  2786. func_stripname : : "$1"
  2787. func_to_host_path_tmp1=$func_stripname_result
  2788. func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1"
  2789. func_cygpath -u -p "$func_convert_core_path_wine_to_w32_result"
  2790. func_to_host_path_result=$func_cygpath_result
  2791. func_convert_path_check : : \
  2792. "$func_to_host_path_tmp1" "$func_to_host_path_result"
  2793. func_convert_path_front_back_pathsep ":*" "*:" : "$1"
  2794. fi
  2795. }
  2796. # end func_convert_path_nix_to_cygwin
  2797. # func_dll_def_p FILE
  2798. # True iff FILE is a Windows DLL '.def' file.
  2799. # Keep in sync with _LT_DLL_DEF_P in libtool.m4
  2800. func_dll_def_p ()
  2801. {
  2802. $debug_cmd
  2803. func_dll_def_p_tmp=`$SED -n \
  2804. -e 's/^[ ]*//' \
  2805. -e '/^\(;.*\)*$/d' \
  2806. -e 's/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p' \
  2807. -e q \
  2808. "$1"`
  2809. test DEF = "$func_dll_def_p_tmp"
  2810. }
  2811. # func_mode_compile arg...
  2812. func_mode_compile ()
  2813. {
  2814. $debug_cmd
  2815. # Get the compilation command and the source file.
  2816. base_compile=
  2817. srcfile=$nonopt # always keep a non-empty value in "srcfile"
  2818. suppress_opt=yes
  2819. suppress_output=
  2820. arg_mode=normal
  2821. libobj=
  2822. later=
  2823. pie_flag=
  2824. for arg
  2825. do
  2826. case $arg_mode in
  2827. arg )
  2828. # do not "continue". Instead, add this to base_compile
  2829. lastarg=$arg
  2830. arg_mode=normal
  2831. ;;
  2832. target )
  2833. libobj=$arg
  2834. arg_mode=normal
  2835. continue
  2836. ;;
  2837. normal )
  2838. # Accept any command-line options.
  2839. case $arg in
  2840. -o)
  2841. test -n "$libobj" && \
  2842. func_fatal_error "you cannot specify '-o' more than once"
  2843. arg_mode=target
  2844. continue
  2845. ;;
  2846. -pie | -fpie | -fPIE)
  2847. func_append pie_flag " $arg"
  2848. continue
  2849. ;;
  2850. -shared | -static | -prefer-pic | -prefer-non-pic)
  2851. func_append later " $arg"
  2852. continue
  2853. ;;
  2854. -no-suppress)
  2855. suppress_opt=no
  2856. continue
  2857. ;;
  2858. -Xcompiler)
  2859. arg_mode=arg # the next one goes into the "base_compile" arg list
  2860. continue # The current "srcfile" will either be retained or
  2861. ;; # replaced later. I would guess that would be a bug.
  2862. -Wc,*)
  2863. func_stripname '-Wc,' '' "$arg"
  2864. args=$func_stripname_result
  2865. lastarg=
  2866. save_ifs=$IFS; IFS=,
  2867. for arg in $args; do
  2868. IFS=$save_ifs
  2869. func_append_quoted lastarg "$arg"
  2870. done
  2871. IFS=$save_ifs
  2872. func_stripname ' ' '' "$lastarg"
  2873. lastarg=$func_stripname_result
  2874. # Add the arguments to base_compile.
  2875. func_append base_compile " $lastarg"
  2876. continue
  2877. ;;
  2878. *)
  2879. # Accept the current argument as the source file.
  2880. # The previous "srcfile" becomes the current argument.
  2881. #
  2882. lastarg=$srcfile
  2883. srcfile=$arg
  2884. ;;
  2885. esac # case $arg
  2886. ;;
  2887. esac # case $arg_mode
  2888. # Aesthetically quote the previous argument.
  2889. func_append_quoted base_compile "$lastarg"
  2890. done # for arg
  2891. case $arg_mode in
  2892. arg)
  2893. func_fatal_error "you must specify an argument for -Xcompile"
  2894. ;;
  2895. target)
  2896. func_fatal_error "you must specify a target with '-o'"
  2897. ;;
  2898. *)
  2899. # Get the name of the library object.
  2900. test -z "$libobj" && {
  2901. func_basename "$srcfile"
  2902. libobj=$func_basename_result
  2903. }
  2904. ;;
  2905. esac
  2906. # Recognize several different file suffixes.
  2907. # If the user specifies -o file.o, it is replaced with file.lo
  2908. case $libobj in
  2909. *.[cCFSifmso] | \
  2910. *.ada | *.adb | *.ads | *.asm | \
  2911. *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \
  2912. *.[fF][09]? | *.for | *.java | *.go | *.obj | *.sx | *.cu | *.cup)
  2913. func_xform "$libobj"
  2914. libobj=$func_xform_result
  2915. ;;
  2916. esac
  2917. case $libobj in
  2918. *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;;
  2919. *)
  2920. func_fatal_error "cannot determine name of library object from '$libobj'"
  2921. ;;
  2922. esac
  2923. func_infer_tag $base_compile
  2924. for arg in $later; do
  2925. case $arg in
  2926. -shared)
  2927. test yes = "$build_libtool_libs" \
  2928. || func_fatal_configuration "cannot build a shared library"
  2929. build_old_libs=no
  2930. continue
  2931. ;;
  2932. -static)
  2933. build_libtool_libs=no
  2934. build_old_libs=yes
  2935. continue
  2936. ;;
  2937. -prefer-pic)
  2938. pic_mode=yes
  2939. continue
  2940. ;;
  2941. -prefer-non-pic)
  2942. pic_mode=no
  2943. continue
  2944. ;;
  2945. esac
  2946. done
  2947. func_quote_for_eval "$libobj"
  2948. test "X$libobj" != "X$func_quote_for_eval_result" \
  2949. && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \
  2950. && func_warning "libobj name '$libobj' may not contain shell special characters."
  2951. func_dirname_and_basename "$obj" "/" ""
  2952. objname=$func_basename_result
  2953. xdir=$func_dirname_result
  2954. lobj=$xdir$objdir/$objname
  2955. test -z "$base_compile" && \
  2956. func_fatal_help "you must specify a compilation command"
  2957. # Delete any leftover library objects.
  2958. if test yes = "$build_old_libs"; then
  2959. removelist="$obj $lobj $libobj ${libobj}T"
  2960. else
  2961. removelist="$lobj $libobj ${libobj}T"
  2962. fi
  2963. # On Cygwin there's no "real" PIC flag so we must build both object types
  2964. case $host_os in
  2965. cygwin* | mingw* | pw32* | os2* | cegcc*)
  2966. pic_mode=default
  2967. ;;
  2968. esac
  2969. if test no = "$pic_mode" && test pass_all != "$deplibs_check_method"; then
  2970. # non-PIC code in shared libraries is not supported
  2971. pic_mode=default
  2972. fi
  2973. # Calculate the filename of the output object if compiler does
  2974. # not support -o with -c
  2975. if test no = "$compiler_c_o"; then
  2976. output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.$objext
  2977. lockfile=$output_obj.lock
  2978. else
  2979. output_obj=
  2980. need_locks=no
  2981. lockfile=
  2982. fi
  2983. # Lock this critical section if it is needed
  2984. # We use this script file to make the link, it avoids creating a new file
  2985. if test yes = "$need_locks"; then
  2986. until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
  2987. func_echo "Waiting for $lockfile to be removed"
  2988. sleep 2
  2989. done
  2990. elif test warn = "$need_locks"; then
  2991. if test -f "$lockfile"; then
  2992. $ECHO "\
  2993. *** ERROR, $lockfile exists and contains:
  2994. `cat $lockfile 2>/dev/null`
  2995. This indicates that another process is trying to use the same
  2996. temporary object file, and libtool could not work around it because
  2997. your compiler does not support '-c' and '-o' together. If you
  2998. repeat this compilation, it may succeed, by chance, but you had better
  2999. avoid parallel builds (make -j) in this platform, or get a better
  3000. compiler."
  3001. $opt_dry_run || $RM $removelist
  3002. exit $EXIT_FAILURE
  3003. fi
  3004. func_append removelist " $output_obj"
  3005. $ECHO "$srcfile" > "$lockfile"
  3006. fi
  3007. $opt_dry_run || $RM $removelist
  3008. func_append removelist " $lockfile"
  3009. trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15
  3010. func_to_tool_file "$srcfile" func_convert_file_msys_to_w32
  3011. srcfile=$func_to_tool_file_result
  3012. func_quote_for_eval "$srcfile"
  3013. qsrcfile=$func_quote_for_eval_result
  3014. # Only build a PIC object if we are building libtool libraries.
  3015. if test yes = "$build_libtool_libs"; then
  3016. # Without this assignment, base_compile gets emptied.
  3017. fbsd_hideous_sh_bug=$base_compile
  3018. if test no != "$pic_mode"; then
  3019. command="$base_compile $qsrcfile $pic_flag"
  3020. else
  3021. # Don't build PIC code
  3022. command="$base_compile $qsrcfile"
  3023. fi
  3024. func_mkdir_p "$xdir$objdir"
  3025. if test -z "$output_obj"; then
  3026. # Place PIC objects in $objdir
  3027. func_append command " -o $lobj"
  3028. fi
  3029. func_show_eval_locale "$command" \
  3030. 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE'
  3031. if test warn = "$need_locks" &&
  3032. test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
  3033. $ECHO "\
  3034. *** ERROR, $lockfile contains:
  3035. `cat $lockfile 2>/dev/null`
  3036. but it should contain:
  3037. $srcfile
  3038. This indicates that another process is trying to use the same
  3039. temporary object file, and libtool could not work around it because
  3040. your compiler does not support '-c' and '-o' together. If you
  3041. repeat this compilation, it may succeed, by chance, but you had better
  3042. avoid parallel builds (make -j) in this platform, or get a better
  3043. compiler."
  3044. $opt_dry_run || $RM $removelist
  3045. exit $EXIT_FAILURE
  3046. fi
  3047. # Just move the object if needed, then go on to compile the next one
  3048. if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
  3049. func_show_eval '$MV "$output_obj" "$lobj"' \
  3050. 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
  3051. fi
  3052. # Allow error messages only from the first compilation.
  3053. if test yes = "$suppress_opt"; then
  3054. suppress_output=' >/dev/null 2>&1'
  3055. fi
  3056. fi
  3057. # Only build a position-dependent object if we build old libraries.
  3058. if test yes = "$build_old_libs"; then
  3059. if test yes != "$pic_mode"; then
  3060. # Don't build PIC code
  3061. command="$base_compile $qsrcfile$pie_flag"
  3062. else
  3063. command="$base_compile $qsrcfile $pic_flag"
  3064. fi
  3065. if test yes = "$compiler_c_o"; then
  3066. func_append command " -o $obj"
  3067. fi
  3068. # Suppress compiler output if we already did a PIC compilation.
  3069. func_append command "$suppress_output"
  3070. func_show_eval_locale "$command" \
  3071. '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE'
  3072. if test warn = "$need_locks" &&
  3073. test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
  3074. $ECHO "\
  3075. *** ERROR, $lockfile contains:
  3076. `cat $lockfile 2>/dev/null`
  3077. but it should contain:
  3078. $srcfile
  3079. This indicates that another process is trying to use the same
  3080. temporary object file, and libtool could not work around it because
  3081. your compiler does not support '-c' and '-o' together. If you
  3082. repeat this compilation, it may succeed, by chance, but you had better
  3083. avoid parallel builds (make -j) in this platform, or get a better
  3084. compiler."
  3085. $opt_dry_run || $RM $removelist
  3086. exit $EXIT_FAILURE
  3087. fi
  3088. # Just move the object if needed
  3089. if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
  3090. func_show_eval '$MV "$output_obj" "$obj"' \
  3091. 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
  3092. fi
  3093. fi
  3094. $opt_dry_run || {
  3095. func_write_libtool_object "$libobj" "$objdir/$objname" "$objname"
  3096. # Unlock the critical section if it was locked
  3097. if test no != "$need_locks"; then
  3098. removelist=$lockfile
  3099. $RM "$lockfile"
  3100. fi
  3101. }
  3102. exit $EXIT_SUCCESS
  3103. }
  3104. $opt_help || {
  3105. test compile = "$opt_mode" && func_mode_compile ${1+"$@"}
  3106. }
  3107. func_mode_help ()
  3108. {
  3109. # We need to display help for each of the modes.
  3110. case $opt_mode in
  3111. "")
  3112. # Generic help is extracted from the usage comments
  3113. # at the start of this file.
  3114. func_help
  3115. ;;
  3116. clean)
  3117. $ECHO \
  3118. "Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
  3119. Remove files from the build directory.
  3120. RM is the name of the program to use to delete files associated with each FILE
  3121. (typically '/bin/rm'). RM-OPTIONS are options (such as '-f') to be passed
  3122. to RM.
  3123. If FILE is a libtool library, object or program, all the files associated
  3124. with it are deleted. Otherwise, only FILE itself is deleted using RM."
  3125. ;;
  3126. compile)
  3127. $ECHO \
  3128. "Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
  3129. Compile a source file into a libtool library object.
  3130. This mode accepts the following additional options:
  3131. -o OUTPUT-FILE set the output file name to OUTPUT-FILE
  3132. -no-suppress do not suppress compiler output for multiple passes
  3133. -prefer-pic try to build PIC objects only
  3134. -prefer-non-pic try to build non-PIC objects only
  3135. -shared do not build a '.o' file suitable for static linking
  3136. -static only build a '.o' file suitable for static linking
  3137. -Wc,FLAG pass FLAG directly to the compiler
  3138. COMPILE-COMMAND is a command to be used in creating a 'standard' object file
  3139. from the given SOURCEFILE.
  3140. The output file name is determined by removing the directory component from
  3141. SOURCEFILE, then substituting the C source code suffix '.c' with the
  3142. library object suffix, '.lo'."
  3143. ;;
  3144. execute)
  3145. $ECHO \
  3146. "Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]...
  3147. Automatically set library path, then run a program.
  3148. This mode accepts the following additional options:
  3149. -dlopen FILE add the directory containing FILE to the library path
  3150. This mode sets the library path environment variable according to '-dlopen'
  3151. flags.
  3152. If any of the ARGS are libtool executable wrappers, then they are translated
  3153. into their corresponding uninstalled binary, and any of their required library
  3154. directories are added to the library path.
  3155. Then, COMMAND is executed, with ARGS as arguments."
  3156. ;;
  3157. finish)
  3158. $ECHO \
  3159. "Usage: $progname [OPTION]... --mode=finish [LIBDIR]...
  3160. Complete the installation of libtool libraries.
  3161. Each LIBDIR is a directory that contains libtool libraries.
  3162. The commands that this mode executes may require superuser privileges. Use
  3163. the '--dry-run' option if you just want to see what would be executed."
  3164. ;;
  3165. install)
  3166. $ECHO \
  3167. "Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND...
  3168. Install executables or libraries.
  3169. INSTALL-COMMAND is the installation command. The first component should be
  3170. either the 'install' or 'cp' program.
  3171. The following components of INSTALL-COMMAND are treated specially:
  3172. -inst-prefix-dir PREFIX-DIR Use PREFIX-DIR as a staging area for installation
  3173. The rest of the components are interpreted as arguments to that command (only
  3174. BSD-compatible install options are recognized)."
  3175. ;;
  3176. link)
  3177. $ECHO \
  3178. "Usage: $progname [OPTION]... --mode=link LINK-COMMAND...
  3179. Link object files or libraries together to form another library, or to
  3180. create an executable program.
  3181. LINK-COMMAND is a command using the C compiler that you would use to create
  3182. a program from several object files.
  3183. The following components of LINK-COMMAND are treated specially:
  3184. -all-static do not do any dynamic linking at all
  3185. -avoid-version do not add a version suffix if possible
  3186. -bindir BINDIR specify path to binaries directory (for systems where
  3187. libraries must be found in the PATH setting at runtime)
  3188. -dlopen FILE '-dlpreopen' FILE if it cannot be dlopened at runtime
  3189. -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
  3190. -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
  3191. -export-symbols SYMFILE
  3192. try to export only the symbols listed in SYMFILE
  3193. -export-symbols-regex REGEX
  3194. try to export only the symbols matching REGEX
  3195. -LLIBDIR search LIBDIR for required installed libraries
  3196. -lNAME OUTPUT-FILE requires the installed library libNAME
  3197. -module build a library that can dlopened
  3198. -no-fast-install disable the fast-install mode
  3199. -no-install link a not-installable executable
  3200. -no-undefined declare that a library does not refer to external symbols
  3201. -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
  3202. -objectlist FILE use a list of object files found in FILE to specify objects
  3203. -os2dllname NAME force a short DLL name on OS/2 (no effect on other OSes)
  3204. -precious-files-regex REGEX
  3205. don't remove output files matching REGEX
  3206. -release RELEASE specify package release information
  3207. -rpath LIBDIR the created library will eventually be installed in LIBDIR
  3208. -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
  3209. -shared only do dynamic linking of libtool libraries
  3210. -shrext SUFFIX override the standard shared library file extension
  3211. -static do not do any dynamic linking of uninstalled libtool libraries
  3212. -static-libtool-libs
  3213. do not do any dynamic linking of libtool libraries
  3214. -version-info CURRENT[:REVISION[:AGE]]
  3215. specify library version info [each variable defaults to 0]
  3216. -weak LIBNAME declare that the target provides the LIBNAME interface
  3217. -Wc,FLAG
  3218. -Xcompiler FLAG pass linker-specific FLAG directly to the compiler
  3219. -Wl,FLAG
  3220. -Xlinker FLAG pass linker-specific FLAG directly to the linker
  3221. -XCClinker FLAG pass link-specific FLAG to the compiler driver (CC)
  3222. All other options (arguments beginning with '-') are ignored.
  3223. Every other argument is treated as a filename. Files ending in '.la' are
  3224. treated as uninstalled libtool libraries, other files are standard or library
  3225. object files.
  3226. If the OUTPUT-FILE ends in '.la', then a libtool library is created,
  3227. only library objects ('.lo' files) may be specified, and '-rpath' is
  3228. required, except when creating a convenience library.
  3229. If OUTPUT-FILE ends in '.a' or '.lib', then a standard library is created
  3230. using 'ar' and 'ranlib', or on Windows using 'lib'.
  3231. If OUTPUT-FILE ends in '.lo' or '.$objext', then a reloadable object file
  3232. is created, otherwise an executable program is created."
  3233. ;;
  3234. uninstall)
  3235. $ECHO \
  3236. "Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
  3237. Remove libraries from an installation directory.
  3238. RM is the name of the program to use to delete files associated with each FILE
  3239. (typically '/bin/rm'). RM-OPTIONS are options (such as '-f') to be passed
  3240. to RM.
  3241. If FILE is a libtool library, all the files associated with it are deleted.
  3242. Otherwise, only FILE itself is deleted using RM."
  3243. ;;
  3244. *)
  3245. func_fatal_help "invalid operation mode '$opt_mode'"
  3246. ;;
  3247. esac
  3248. echo
  3249. $ECHO "Try '$progname --help' for more information about other modes."
  3250. }
  3251. # Now that we've collected a possible --mode arg, show help if necessary
  3252. if $opt_help; then
  3253. if test : = "$opt_help"; then
  3254. func_mode_help
  3255. else
  3256. {
  3257. func_help noexit
  3258. for opt_mode in compile link execute install finish uninstall clean; do
  3259. func_mode_help
  3260. done
  3261. } | $SED -n '1p; 2,$s/^Usage:/ or: /p'
  3262. {
  3263. func_help noexit
  3264. for opt_mode in compile link execute install finish uninstall clean; do
  3265. echo
  3266. func_mode_help
  3267. done
  3268. } |
  3269. $SED '1d
  3270. /^When reporting/,/^Report/{
  3271. H
  3272. d
  3273. }
  3274. $x
  3275. /information about other modes/d
  3276. /more detailed .*MODE/d
  3277. s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/'
  3278. fi
  3279. exit $?
  3280. fi
  3281. # func_mode_execute arg...
  3282. func_mode_execute ()
  3283. {
  3284. $debug_cmd
  3285. # The first argument is the command name.
  3286. cmd=$nonopt
  3287. test -z "$cmd" && \
  3288. func_fatal_help "you must specify a COMMAND"
  3289. # Handle -dlopen flags immediately.
  3290. for file in $opt_dlopen; do
  3291. test -f "$file" \
  3292. || func_fatal_help "'$file' is not a file"
  3293. dir=
  3294. case $file in
  3295. *.la)
  3296. func_resolve_sysroot "$file"
  3297. file=$func_resolve_sysroot_result
  3298. # Check to see that this really is a libtool archive.
  3299. func_lalib_unsafe_p "$file" \
  3300. || func_fatal_help "'$lib' is not a valid libtool archive"
  3301. # Read the libtool library.
  3302. dlname=
  3303. library_names=
  3304. func_source "$file"
  3305. # Skip this library if it cannot be dlopened.
  3306. if test -z "$dlname"; then
  3307. # Warn if it was a shared library.
  3308. test -n "$library_names" && \
  3309. func_warning "'$file' was not linked with '-export-dynamic'"
  3310. continue
  3311. fi
  3312. func_dirname "$file" "" "."
  3313. dir=$func_dirname_result
  3314. if test -f "$dir/$objdir/$dlname"; then
  3315. func_append dir "/$objdir"
  3316. else
  3317. if test ! -f "$dir/$dlname"; then
  3318. func_fatal_error "cannot find '$dlname' in '$dir' or '$dir/$objdir'"
  3319. fi
  3320. fi
  3321. ;;
  3322. *.lo)
  3323. # Just add the directory containing the .lo file.
  3324. func_dirname "$file" "" "."
  3325. dir=$func_dirname_result
  3326. ;;
  3327. *)
  3328. func_warning "'-dlopen' is ignored for non-libtool libraries and objects"
  3329. continue
  3330. ;;
  3331. esac
  3332. # Get the absolute pathname.
  3333. absdir=`cd "$dir" && pwd`
  3334. test -n "$absdir" && dir=$absdir
  3335. # Now add the directory to shlibpath_var.
  3336. if eval "test -z \"\$$shlibpath_var\""; then
  3337. eval "$shlibpath_var=\"\$dir\""
  3338. else
  3339. eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
  3340. fi
  3341. done
  3342. # This variable tells wrapper scripts just to set shlibpath_var
  3343. # rather than running their programs.
  3344. libtool_execute_magic=$magic
  3345. # Check if any of the arguments is a wrapper script.
  3346. args=
  3347. for file
  3348. do
  3349. case $file in
  3350. -* | *.la | *.lo ) ;;
  3351. *)
  3352. # Do a test to see if this is really a libtool program.
  3353. if func_ltwrapper_script_p "$file"; then
  3354. func_source "$file"
  3355. # Transform arg to wrapped name.
  3356. file=$progdir/$program
  3357. elif func_ltwrapper_executable_p "$file"; then
  3358. func_ltwrapper_scriptname "$file"
  3359. func_source "$func_ltwrapper_scriptname_result"
  3360. # Transform arg to wrapped name.
  3361. file=$progdir/$program
  3362. fi
  3363. ;;
  3364. esac
  3365. # Quote arguments (to preserve shell metacharacters).
  3366. func_append_quoted args "$file"
  3367. done
  3368. if $opt_dry_run; then
  3369. # Display what would be done.
  3370. if test -n "$shlibpath_var"; then
  3371. eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\""
  3372. echo "export $shlibpath_var"
  3373. fi
  3374. $ECHO "$cmd$args"
  3375. exit $EXIT_SUCCESS
  3376. else
  3377. if test -n "$shlibpath_var"; then
  3378. # Export the shlibpath_var.
  3379. eval "export $shlibpath_var"
  3380. fi
  3381. # Restore saved environment variables
  3382. for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
  3383. do
  3384. eval "if test \"\${save_$lt_var+set}\" = set; then
  3385. $lt_var=\$save_$lt_var; export $lt_var
  3386. else
  3387. $lt_unset $lt_var
  3388. fi"
  3389. done
  3390. # Now prepare to actually exec the command.
  3391. exec_cmd=\$cmd$args
  3392. fi
  3393. }
  3394. test execute = "$opt_mode" && func_mode_execute ${1+"$@"}
  3395. # func_mode_finish arg...
  3396. func_mode_finish ()
  3397. {
  3398. $debug_cmd
  3399. libs=
  3400. libdirs=
  3401. admincmds=
  3402. for opt in "$nonopt" ${1+"$@"}
  3403. do
  3404. if test -d "$opt"; then
  3405. func_append libdirs " $opt"
  3406. elif test -f "$opt"; then
  3407. if func_lalib_unsafe_p "$opt"; then
  3408. func_append libs " $opt"
  3409. else
  3410. func_warning "'$opt' is not a valid libtool archive"
  3411. fi
  3412. else
  3413. func_fatal_error "invalid argument '$opt'"
  3414. fi
  3415. done
  3416. if test -n "$libs"; then
  3417. if test -n "$lt_sysroot"; then
  3418. sysroot_regex=`$ECHO "$lt_sysroot" | $SED "$sed_make_literal_regex"`
  3419. sysroot_cmd="s/\([ ']\)$sysroot_regex/\1/g;"
  3420. else
  3421. sysroot_cmd=
  3422. fi
  3423. # Remove sysroot references
  3424. if $opt_dry_run; then
  3425. for lib in $libs; do
  3426. echo "removing references to $lt_sysroot and '=' prefixes from $lib"
  3427. done
  3428. else
  3429. tmpdir=`func_mktempdir`
  3430. for lib in $libs; do
  3431. $SED -e "$sysroot_cmd s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \
  3432. > $tmpdir/tmp-la
  3433. mv -f $tmpdir/tmp-la $lib
  3434. done
  3435. ${RM}r "$tmpdir"
  3436. fi
  3437. fi
  3438. if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
  3439. for libdir in $libdirs; do
  3440. if test -n "$finish_cmds"; then
  3441. # Do each command in the finish commands.
  3442. func_execute_cmds "$finish_cmds" 'admincmds="$admincmds
  3443. '"$cmd"'"'
  3444. fi
  3445. if test -n "$finish_eval"; then
  3446. # Do the single finish_eval.
  3447. eval cmds=\"$finish_eval\"
  3448. $opt_dry_run || eval "$cmds" || func_append admincmds "
  3449. $cmds"
  3450. fi
  3451. done
  3452. fi
  3453. # Exit here if they wanted silent mode.
  3454. $opt_quiet && exit $EXIT_SUCCESS
  3455. if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
  3456. echo "----------------------------------------------------------------------"
  3457. echo "Libraries have been installed in:"
  3458. for libdir in $libdirs; do
  3459. $ECHO " $libdir"
  3460. done
  3461. echo
  3462. echo "If you ever happen to want to link against installed libraries"
  3463. echo "in a given directory, LIBDIR, you must either use libtool, and"
  3464. echo "specify the full pathname of the library, or use the '-LLIBDIR'"
  3465. echo "flag during linking and do at least one of the following:"
  3466. if test -n "$shlibpath_var"; then
  3467. echo " - add LIBDIR to the '$shlibpath_var' environment variable"
  3468. echo " during execution"
  3469. fi
  3470. if test -n "$runpath_var"; then
  3471. echo " - add LIBDIR to the '$runpath_var' environment variable"
  3472. echo " during linking"
  3473. fi
  3474. if test -n "$hardcode_libdir_flag_spec"; then
  3475. libdir=LIBDIR
  3476. eval flag=\"$hardcode_libdir_flag_spec\"
  3477. $ECHO " - use the '$flag' linker flag"
  3478. fi
  3479. if test -n "$admincmds"; then
  3480. $ECHO " - have your system administrator run these commands:$admincmds"
  3481. fi
  3482. if test -f /etc/ld.so.conf; then
  3483. echo " - have your system administrator add LIBDIR to '/etc/ld.so.conf'"
  3484. fi
  3485. echo
  3486. echo "See any operating system documentation about shared libraries for"
  3487. case $host in
  3488. solaris2.[6789]|solaris2.1[0-9])
  3489. echo "more information, such as the ld(1), crle(1) and ld.so(8) manual"
  3490. echo "pages."
  3491. ;;
  3492. *)
  3493. echo "more information, such as the ld(1) and ld.so(8) manual pages."
  3494. ;;
  3495. esac
  3496. echo "----------------------------------------------------------------------"
  3497. fi
  3498. exit $EXIT_SUCCESS
  3499. }
  3500. test finish = "$opt_mode" && func_mode_finish ${1+"$@"}
  3501. # func_mode_install arg...
  3502. func_mode_install ()
  3503. {
  3504. $debug_cmd
  3505. # There may be an optional sh(1) argument at the beginning of
  3506. # install_prog (especially on Windows NT).
  3507. if test "$SHELL" = "$nonopt" || test /bin/sh = "$nonopt" ||
  3508. # Allow the use of GNU shtool's install command.
  3509. case $nonopt in *shtool*) :;; *) false;; esac
  3510. then
  3511. # Aesthetically quote it.
  3512. func_quote_for_eval "$nonopt"
  3513. install_prog="$func_quote_for_eval_result "
  3514. arg=$1
  3515. shift
  3516. else
  3517. install_prog=
  3518. arg=$nonopt
  3519. fi
  3520. # The real first argument should be the name of the installation program.
  3521. # Aesthetically quote it.
  3522. func_quote_for_eval "$arg"
  3523. func_append install_prog "$func_quote_for_eval_result"
  3524. install_shared_prog=$install_prog
  3525. case " $install_prog " in
  3526. *[\\\ /]cp\ *) install_cp=: ;;
  3527. *) install_cp=false ;;
  3528. esac
  3529. # We need to accept at least all the BSD install flags.
  3530. dest=
  3531. files=
  3532. opts=
  3533. prev=
  3534. install_type=
  3535. isdir=false
  3536. stripme=
  3537. no_mode=:
  3538. for arg
  3539. do
  3540. arg2=
  3541. if test -n "$dest"; then
  3542. func_append files " $dest"
  3543. dest=$arg
  3544. continue
  3545. fi
  3546. case $arg in
  3547. -d) isdir=: ;;
  3548. -f)
  3549. if $install_cp; then :; else
  3550. prev=$arg
  3551. fi
  3552. ;;
  3553. -g | -m | -o)
  3554. prev=$arg
  3555. ;;
  3556. -s)
  3557. stripme=" -s"
  3558. continue
  3559. ;;
  3560. -*)
  3561. ;;
  3562. *)
  3563. # If the previous option needed an argument, then skip it.
  3564. if test -n "$prev"; then
  3565. if test X-m = "X$prev" && test -n "$install_override_mode"; then
  3566. arg2=$install_override_mode
  3567. no_mode=false
  3568. fi
  3569. prev=
  3570. else
  3571. dest=$arg
  3572. continue
  3573. fi
  3574. ;;
  3575. esac
  3576. # Aesthetically quote the argument.
  3577. func_quote_for_eval "$arg"
  3578. func_append install_prog " $func_quote_for_eval_result"
  3579. if test -n "$arg2"; then
  3580. func_quote_for_eval "$arg2"
  3581. fi
  3582. func_append install_shared_prog " $func_quote_for_eval_result"
  3583. done
  3584. test -z "$install_prog" && \
  3585. func_fatal_help "you must specify an install program"
  3586. test -n "$prev" && \
  3587. func_fatal_help "the '$prev' option requires an argument"
  3588. if test -n "$install_override_mode" && $no_mode; then
  3589. if $install_cp; then :; else
  3590. func_quote_for_eval "$install_override_mode"
  3591. func_append install_shared_prog " -m $func_quote_for_eval_result"
  3592. fi
  3593. fi
  3594. if test -z "$files"; then
  3595. if test -z "$dest"; then
  3596. func_fatal_help "no file or destination specified"
  3597. else
  3598. func_fatal_help "you must specify a destination"
  3599. fi
  3600. fi
  3601. # Strip any trailing slash from the destination.
  3602. func_stripname '' '/' "$dest"
  3603. dest=$func_stripname_result
  3604. # Check to see that the destination is a directory.
  3605. test -d "$dest" && isdir=:
  3606. if $isdir; then
  3607. destdir=$dest
  3608. destname=
  3609. else
  3610. func_dirname_and_basename "$dest" "" "."
  3611. destdir=$func_dirname_result
  3612. destname=$func_basename_result
  3613. # Not a directory, so check to see that there is only one file specified.
  3614. set dummy $files; shift
  3615. test "$#" -gt 1 && \
  3616. func_fatal_help "'$dest' is not a directory"
  3617. fi
  3618. case $destdir in
  3619. [\\/]* | [A-Za-z]:[\\/]*) ;;
  3620. *)
  3621. for file in $files; do
  3622. case $file in
  3623. *.lo) ;;
  3624. *)
  3625. func_fatal_help "'$destdir' must be an absolute directory name"
  3626. ;;
  3627. esac
  3628. done
  3629. ;;
  3630. esac
  3631. # This variable tells wrapper scripts just to set variables rather
  3632. # than running their programs.
  3633. libtool_install_magic=$magic
  3634. staticlibs=
  3635. future_libdirs=
  3636. current_libdirs=
  3637. for file in $files; do
  3638. # Do each installation.
  3639. case $file in
  3640. *.$libext)
  3641. # Do the static libraries later.
  3642. func_append staticlibs " $file"
  3643. ;;
  3644. *.la)
  3645. func_resolve_sysroot "$file"
  3646. file=$func_resolve_sysroot_result
  3647. # Check to see that this really is a libtool archive.
  3648. func_lalib_unsafe_p "$file" \
  3649. || func_fatal_help "'$file' is not a valid libtool archive"
  3650. library_names=
  3651. old_library=
  3652. relink_command=
  3653. func_source "$file"
  3654. # Add the libdir to current_libdirs if it is the destination.
  3655. if test "X$destdir" = "X$libdir"; then
  3656. case "$current_libdirs " in
  3657. *" $libdir "*) ;;
  3658. *) func_append current_libdirs " $libdir" ;;
  3659. esac
  3660. else
  3661. # Note the libdir as a future libdir.
  3662. case "$future_libdirs " in
  3663. *" $libdir "*) ;;
  3664. *) func_append future_libdirs " $libdir" ;;
  3665. esac
  3666. fi
  3667. func_dirname "$file" "/" ""
  3668. dir=$func_dirname_result
  3669. func_append dir "$objdir"
  3670. if test -n "$relink_command"; then
  3671. # Determine the prefix the user has applied to our future dir.
  3672. inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"`
  3673. # Don't allow the user to place us outside of our expected
  3674. # location b/c this prevents finding dependent libraries that
  3675. # are installed to the same prefix.
  3676. # At present, this check doesn't affect windows .dll's that
  3677. # are installed into $libdir/../bin (currently, that works fine)
  3678. # but it's something to keep an eye on.
  3679. test "$inst_prefix_dir" = "$destdir" && \
  3680. func_fatal_error "error: cannot install '$file' to a directory not ending in $libdir"
  3681. if test -n "$inst_prefix_dir"; then
  3682. # Stick the inst_prefix_dir data into the link command.
  3683. relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
  3684. else
  3685. relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"`
  3686. fi
  3687. func_warning "relinking '$file'"
  3688. func_show_eval "$relink_command" \
  3689. 'func_fatal_error "error: relink '\''$file'\'' with the above command before installing it"'
  3690. fi
  3691. # See the names of the shared library.
  3692. set dummy $library_names; shift
  3693. if test -n "$1"; then
  3694. realname=$1
  3695. shift
  3696. srcname=$realname
  3697. test -n "$relink_command" && srcname=${realname}T
  3698. # Install the shared library and build the symlinks.
  3699. func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \
  3700. 'exit $?'
  3701. tstripme=$stripme
  3702. case $host_os in
  3703. cygwin* | mingw* | pw32* | cegcc*)
  3704. case $realname in
  3705. *.dll.a)
  3706. tstripme=
  3707. ;;
  3708. esac
  3709. ;;
  3710. os2*)
  3711. case $realname in
  3712. *_dll.a)
  3713. tstripme=
  3714. ;;
  3715. esac
  3716. ;;
  3717. esac
  3718. if test -n "$tstripme" && test -n "$striplib"; then
  3719. func_show_eval "$striplib $destdir/$realname" 'exit $?'
  3720. fi
  3721. if test "$#" -gt 0; then
  3722. # Delete the old symlinks, and create new ones.
  3723. # Try 'ln -sf' first, because the 'ln' binary might depend on
  3724. # the symlink we replace! Solaris /bin/ln does not understand -f,
  3725. # so we also need to try rm && ln -s.
  3726. for linkname
  3727. do
  3728. test "$linkname" != "$realname" \
  3729. && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })"
  3730. done
  3731. fi
  3732. # Do each command in the postinstall commands.
  3733. lib=$destdir/$realname
  3734. func_execute_cmds "$postinstall_cmds" 'exit $?'
  3735. fi
  3736. # Install the pseudo-library for information purposes.
  3737. func_basename "$file"
  3738. name=$func_basename_result
  3739. instname=$dir/${name}i
  3740. func_show_eval "$install_prog $instname $destdir/$name" 'exit $?'
  3741. # Maybe install the static library, too.
  3742. test -n "$old_library" && func_append staticlibs " $dir/$old_library"
  3743. ;;
  3744. *.lo)
  3745. # Install (i.e. copy) a libtool object.
  3746. # Figure out destination file name, if it wasn't already specified.
  3747. if test -n "$destname"; then
  3748. destfile=$destdir/$destname
  3749. else
  3750. func_basename "$file"
  3751. destfile=$func_basename_result
  3752. destfile=$destdir/$destfile
  3753. fi
  3754. # Deduce the name of the destination old-style object file.
  3755. case $destfile in
  3756. *.lo)
  3757. func_lo2o "$destfile"
  3758. staticdest=$func_lo2o_result
  3759. ;;
  3760. *.$objext)
  3761. staticdest=$destfile
  3762. destfile=
  3763. ;;
  3764. *)
  3765. func_fatal_help "cannot copy a libtool object to '$destfile'"
  3766. ;;
  3767. esac
  3768. # Install the libtool object if requested.
  3769. test -n "$destfile" && \
  3770. func_show_eval "$install_prog $file $destfile" 'exit $?'
  3771. # Install the old object if enabled.
  3772. if test yes = "$build_old_libs"; then
  3773. # Deduce the name of the old-style object file.
  3774. func_lo2o "$file"
  3775. staticobj=$func_lo2o_result
  3776. func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?'
  3777. fi
  3778. exit $EXIT_SUCCESS
  3779. ;;
  3780. *)
  3781. # Figure out destination file name, if it wasn't already specified.
  3782. if test -n "$destname"; then
  3783. destfile=$destdir/$destname
  3784. else
  3785. func_basename "$file"
  3786. destfile=$func_basename_result
  3787. destfile=$destdir/$destfile
  3788. fi
  3789. # If the file is missing, and there is a .exe on the end, strip it
  3790. # because it is most likely a libtool script we actually want to
  3791. # install
  3792. stripped_ext=
  3793. case $file in
  3794. *.exe)
  3795. if test ! -f "$file"; then
  3796. func_stripname '' '.exe' "$file"
  3797. file=$func_stripname_result
  3798. stripped_ext=.exe
  3799. fi
  3800. ;;
  3801. esac
  3802. # Do a test to see if this is really a libtool program.
  3803. case $host in
  3804. *cygwin* | *mingw*)
  3805. if func_ltwrapper_executable_p "$file"; then
  3806. func_ltwrapper_scriptname "$file"
  3807. wrapper=$func_ltwrapper_scriptname_result
  3808. else
  3809. func_stripname '' '.exe' "$file"
  3810. wrapper=$func_stripname_result
  3811. fi
  3812. ;;
  3813. *)
  3814. wrapper=$file
  3815. ;;
  3816. esac
  3817. if func_ltwrapper_script_p "$wrapper"; then
  3818. notinst_deplibs=
  3819. relink_command=
  3820. func_source "$wrapper"
  3821. # Check the variables that should have been set.
  3822. test -z "$generated_by_libtool_version" && \
  3823. func_fatal_error "invalid libtool wrapper script '$wrapper'"
  3824. finalize=:
  3825. for lib in $notinst_deplibs; do
  3826. # Check to see that each library is installed.
  3827. libdir=
  3828. if test -f "$lib"; then
  3829. func_source "$lib"
  3830. fi
  3831. libfile=$libdir/`$ECHO "$lib" | $SED 's%^.*/%%g'`
  3832. if test -n "$libdir" && test ! -f "$libfile"; then
  3833. func_warning "'$lib' has not been installed in '$libdir'"
  3834. finalize=false
  3835. fi
  3836. done
  3837. relink_command=
  3838. func_source "$wrapper"
  3839. outputname=
  3840. if test no = "$fast_install" && test -n "$relink_command"; then
  3841. $opt_dry_run || {
  3842. if $finalize; then
  3843. tmpdir=`func_mktempdir`
  3844. func_basename "$file$stripped_ext"
  3845. file=$func_basename_result
  3846. outputname=$tmpdir/$file
  3847. # Replace the output file specification.
  3848. relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'`
  3849. $opt_quiet || {
  3850. func_quote_for_expand "$relink_command"
  3851. eval "func_echo $func_quote_for_expand_result"
  3852. }
  3853. if eval "$relink_command"; then :
  3854. else
  3855. func_error "error: relink '$file' with the above command before installing it"
  3856. $opt_dry_run || ${RM}r "$tmpdir"
  3857. continue
  3858. fi
  3859. file=$outputname
  3860. else
  3861. func_warning "cannot relink '$file'"
  3862. fi
  3863. }
  3864. else
  3865. # Install the binary that we compiled earlier.
  3866. file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"`
  3867. fi
  3868. fi
  3869. # remove .exe since cygwin /usr/bin/install will append another
  3870. # one anyway
  3871. case $install_prog,$host in
  3872. */usr/bin/install*,*cygwin*)
  3873. case $file:$destfile in
  3874. *.exe:*.exe)
  3875. # this is ok
  3876. ;;
  3877. *.exe:*)
  3878. destfile=$destfile.exe
  3879. ;;
  3880. *:*.exe)
  3881. func_stripname '' '.exe' "$destfile"
  3882. destfile=$func_stripname_result
  3883. ;;
  3884. esac
  3885. ;;
  3886. esac
  3887. func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?'
  3888. $opt_dry_run || if test -n "$outputname"; then
  3889. ${RM}r "$tmpdir"
  3890. fi
  3891. ;;
  3892. esac
  3893. done
  3894. for file in $staticlibs; do
  3895. func_basename "$file"
  3896. name=$func_basename_result
  3897. # Set up the ranlib parameters.
  3898. oldlib=$destdir/$name
  3899. func_to_tool_file "$oldlib" func_convert_file_msys_to_w32
  3900. tool_oldlib=$func_to_tool_file_result
  3901. func_show_eval "$install_prog \$file \$oldlib" 'exit $?'
  3902. if test -n "$stripme" && test -n "$old_striplib"; then
  3903. func_show_eval "$old_striplib $tool_oldlib" 'exit $?'
  3904. fi
  3905. # Do each command in the postinstall commands.
  3906. func_execute_cmds "$old_postinstall_cmds" 'exit $?'
  3907. done
  3908. test -n "$future_libdirs" && \
  3909. func_warning "remember to run '$progname --finish$future_libdirs'"
  3910. if test -n "$current_libdirs"; then
  3911. # Maybe just do a dry run.
  3912. $opt_dry_run && current_libdirs=" -n$current_libdirs"
  3913. exec_cmd='$SHELL "$progpath" $preserve_args --finish$current_libdirs'
  3914. else
  3915. exit $EXIT_SUCCESS
  3916. fi
  3917. }
  3918. test install = "$opt_mode" && func_mode_install ${1+"$@"}
  3919. # func_generate_dlsyms outputname originator pic_p
  3920. # Extract symbols from dlprefiles and create ${outputname}S.o with
  3921. # a dlpreopen symbol table.
  3922. func_generate_dlsyms ()
  3923. {
  3924. $debug_cmd
  3925. my_outputname=$1
  3926. my_originator=$2
  3927. my_pic_p=${3-false}
  3928. my_prefix=`$ECHO "$my_originator" | $SED 's%[^a-zA-Z0-9]%_%g'`
  3929. my_dlsyms=
  3930. if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then
  3931. if test -n "$NM" && test -n "$global_symbol_pipe"; then
  3932. my_dlsyms=${my_outputname}S.c
  3933. else
  3934. func_error "not configured to extract global symbols from dlpreopened files"
  3935. fi
  3936. fi
  3937. if test -n "$my_dlsyms"; then
  3938. case $my_dlsyms in
  3939. "") ;;
  3940. *.c)
  3941. # Discover the nlist of each of the dlfiles.
  3942. nlist=$output_objdir/$my_outputname.nm
  3943. func_show_eval "$RM $nlist ${nlist}S ${nlist}T"
  3944. # Parse the name list into a source file.
  3945. func_verbose "creating $output_objdir/$my_dlsyms"
  3946. $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\
  3947. /* $my_dlsyms - symbol resolution table for '$my_outputname' dlsym emulation. */
  3948. /* Generated by $PROGRAM (GNU $PACKAGE) $VERSION */
  3949. #ifdef __cplusplus
  3950. extern \"C\" {
  3951. #endif
  3952. #if defined __GNUC__ && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4))
  3953. #pragma GCC diagnostic ignored \"-Wstrict-prototypes\"
  3954. #endif
  3955. /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */
  3956. #if defined _WIN32 || defined __CYGWIN__ || defined _WIN32_WCE
  3957. /* DATA imports from DLLs on WIN32 can't be const, because runtime
  3958. relocations are performed -- see ld's documentation on pseudo-relocs. */
  3959. # define LT_DLSYM_CONST
  3960. #elif defined __osf__
  3961. /* This system does not cope well with relocations in const data. */
  3962. # define LT_DLSYM_CONST
  3963. #else
  3964. # define LT_DLSYM_CONST const
  3965. #endif
  3966. #define STREQ(s1, s2) (strcmp ((s1), (s2)) == 0)
  3967. /* External symbol declarations for the compiler. */\
  3968. "
  3969. if test yes = "$dlself"; then
  3970. func_verbose "generating symbol list for '$output'"
  3971. $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist"
  3972. # Add our own program objects to the symbol list.
  3973. progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP`
  3974. for progfile in $progfiles; do
  3975. func_to_tool_file "$progfile" func_convert_file_msys_to_w32
  3976. func_verbose "extracting global C symbols from '$func_to_tool_file_result'"
  3977. $opt_dry_run || eval "$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'"
  3978. done
  3979. if test -n "$exclude_expsyms"; then
  3980. $opt_dry_run || {
  3981. eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
  3982. eval '$MV "$nlist"T "$nlist"'
  3983. }
  3984. fi
  3985. if test -n "$export_symbols_regex"; then
  3986. $opt_dry_run || {
  3987. eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
  3988. eval '$MV "$nlist"T "$nlist"'
  3989. }
  3990. fi
  3991. # Prepare the list of exported symbols
  3992. if test -z "$export_symbols"; then
  3993. export_symbols=$output_objdir/$outputname.exp
  3994. $opt_dry_run || {
  3995. $RM $export_symbols
  3996. eval "$SED -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
  3997. case $host in
  3998. *cygwin* | *mingw* | *cegcc* )
  3999. eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
  4000. eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
  4001. ;;
  4002. esac
  4003. }
  4004. else
  4005. $opt_dry_run || {
  4006. eval "$SED -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
  4007. eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
  4008. eval '$MV "$nlist"T "$nlist"'
  4009. case $host in
  4010. *cygwin* | *mingw* | *cegcc* )
  4011. eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
  4012. eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
  4013. ;;
  4014. esac
  4015. }
  4016. fi
  4017. fi
  4018. for dlprefile in $dlprefiles; do
  4019. func_verbose "extracting global C symbols from '$dlprefile'"
  4020. func_basename "$dlprefile"
  4021. name=$func_basename_result
  4022. case $host in
  4023. *cygwin* | *mingw* | *cegcc* )
  4024. # if an import library, we need to obtain dlname
  4025. if func_win32_import_lib_p "$dlprefile"; then
  4026. func_tr_sh "$dlprefile"
  4027. eval "curr_lafile=\$libfile_$func_tr_sh_result"
  4028. dlprefile_dlbasename=
  4029. if test -n "$curr_lafile" && func_lalib_p "$curr_lafile"; then
  4030. # Use subshell, to avoid clobbering current variable values
  4031. dlprefile_dlname=`source "$curr_lafile" && echo "$dlname"`
  4032. if test -n "$dlprefile_dlname"; then
  4033. func_basename "$dlprefile_dlname"
  4034. dlprefile_dlbasename=$func_basename_result
  4035. else
  4036. # no lafile. user explicitly requested -dlpreopen <import library>.
  4037. $sharedlib_from_linklib_cmd "$dlprefile"
  4038. dlprefile_dlbasename=$sharedlib_from_linklib_result
  4039. fi
  4040. fi
  4041. $opt_dry_run || {
  4042. if test -n "$dlprefile_dlbasename"; then
  4043. eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"'
  4044. else
  4045. func_warning "Could not compute DLL name from $name"
  4046. eval '$ECHO ": $name " >> "$nlist"'
  4047. fi
  4048. func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
  4049. eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe |
  4050. $SED -e '/I __imp/d' -e 's/I __nm_/D /;s/_nm__//' >> '$nlist'"
  4051. }
  4052. else # not an import lib
  4053. $opt_dry_run || {
  4054. eval '$ECHO ": $name " >> "$nlist"'
  4055. func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
  4056. eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'"
  4057. }
  4058. fi
  4059. ;;
  4060. *)
  4061. $opt_dry_run || {
  4062. eval '$ECHO ": $name " >> "$nlist"'
  4063. func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
  4064. eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'"
  4065. }
  4066. ;;
  4067. esac
  4068. done
  4069. $opt_dry_run || {
  4070. # Make sure we have at least an empty file.
  4071. test -f "$nlist" || : > "$nlist"
  4072. if test -n "$exclude_expsyms"; then
  4073. $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
  4074. $MV "$nlist"T "$nlist"
  4075. fi
  4076. # Try sorting and uniquifying the output.
  4077. if $GREP -v "^: " < "$nlist" |
  4078. if sort -k 3 </dev/null >/dev/null 2>&1; then
  4079. sort -k 3
  4080. else
  4081. sort +2
  4082. fi |
  4083. uniq > "$nlist"S; then
  4084. :
  4085. else
  4086. $GREP -v "^: " < "$nlist" > "$nlist"S
  4087. fi
  4088. if test -f "$nlist"S; then
  4089. eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"'
  4090. else
  4091. echo '/* NONE */' >> "$output_objdir/$my_dlsyms"
  4092. fi
  4093. func_show_eval '$RM "${nlist}I"'
  4094. if test -n "$global_symbol_to_import"; then
  4095. eval "$global_symbol_to_import"' < "$nlist"S > "$nlist"I'
  4096. fi
  4097. echo >> "$output_objdir/$my_dlsyms" "\
  4098. /* The mapping between symbol names and symbols. */
  4099. typedef struct {
  4100. const char *name;
  4101. void *address;
  4102. } lt_dlsymlist;
  4103. extern LT_DLSYM_CONST lt_dlsymlist
  4104. lt_${my_prefix}_LTX_preloaded_symbols[];\
  4105. "
  4106. if test -s "$nlist"I; then
  4107. echo >> "$output_objdir/$my_dlsyms" "\
  4108. static void lt_syminit(void)
  4109. {
  4110. LT_DLSYM_CONST lt_dlsymlist *symbol = lt_${my_prefix}_LTX_preloaded_symbols;
  4111. for (; symbol->name; ++symbol)
  4112. {"
  4113. $SED 's/.*/ if (STREQ (symbol->name, \"&\")) symbol->address = (void *) \&&;/' < "$nlist"I >> "$output_objdir/$my_dlsyms"
  4114. echo >> "$output_objdir/$my_dlsyms" "\
  4115. }
  4116. }"
  4117. fi
  4118. echo >> "$output_objdir/$my_dlsyms" "\
  4119. LT_DLSYM_CONST lt_dlsymlist
  4120. lt_${my_prefix}_LTX_preloaded_symbols[] =
  4121. { {\"$my_originator\", (void *) 0},"
  4122. if test -s "$nlist"I; then
  4123. echo >> "$output_objdir/$my_dlsyms" "\
  4124. {\"@INIT@\", (void *) &lt_syminit},"
  4125. fi
  4126. case $need_lib_prefix in
  4127. no)
  4128. eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms"
  4129. ;;
  4130. *)
  4131. eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms"
  4132. ;;
  4133. esac
  4134. echo >> "$output_objdir/$my_dlsyms" "\
  4135. {0, (void *) 0}
  4136. };
  4137. /* This works around a problem in FreeBSD linker */
  4138. #ifdef FREEBSD_WORKAROUND
  4139. static const void *lt_preloaded_setup() {
  4140. return lt_${my_prefix}_LTX_preloaded_symbols;
  4141. }
  4142. #endif
  4143. #ifdef __cplusplus
  4144. }
  4145. #endif\
  4146. "
  4147. } # !$opt_dry_run
  4148. pic_flag_for_symtable=
  4149. case "$compile_command " in
  4150. *" -static "*) ;;
  4151. *)
  4152. case $host in
  4153. # compiling the symbol table file with pic_flag works around
  4154. # a FreeBSD bug that causes programs to crash when -lm is
  4155. # linked before any other PIC object. But we must not use
  4156. # pic_flag when linking with -static. The problem exists in
  4157. # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
  4158. *-*-freebsd2.*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
  4159. pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;;
  4160. *-*-hpux*)
  4161. pic_flag_for_symtable=" $pic_flag" ;;
  4162. *)
  4163. $my_pic_p && pic_flag_for_symtable=" $pic_flag"
  4164. ;;
  4165. esac
  4166. ;;
  4167. esac
  4168. symtab_cflags=
  4169. for arg in $LTCFLAGS; do
  4170. case $arg in
  4171. -pie | -fpie | -fPIE) ;;
  4172. *) func_append symtab_cflags " $arg" ;;
  4173. esac
  4174. done
  4175. # Now compile the dynamic symbol file.
  4176. func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?'
  4177. # Clean up the generated files.
  4178. func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T" "${nlist}I"'
  4179. # Transform the symbol file into the correct name.
  4180. symfileobj=$output_objdir/${my_outputname}S.$objext
  4181. case $host in
  4182. *cygwin* | *mingw* | *cegcc* )
  4183. if test -f "$output_objdir/$my_outputname.def"; then
  4184. compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
  4185. finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
  4186. else
  4187. compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
  4188. finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
  4189. fi
  4190. ;;
  4191. *)
  4192. compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
  4193. finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
  4194. ;;
  4195. esac
  4196. ;;
  4197. *)
  4198. func_fatal_error "unknown suffix for '$my_dlsyms'"
  4199. ;;
  4200. esac
  4201. else
  4202. # We keep going just in case the user didn't refer to
  4203. # lt_preloaded_symbols. The linker will fail if global_symbol_pipe
  4204. # really was required.
  4205. # Nullify the symbol file.
  4206. compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"`
  4207. finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"`
  4208. fi
  4209. }
  4210. # func_cygming_gnu_implib_p ARG
  4211. # This predicate returns with zero status (TRUE) if
  4212. # ARG is a GNU/binutils-style import library. Returns
  4213. # with nonzero status (FALSE) otherwise.
  4214. func_cygming_gnu_implib_p ()
  4215. {
  4216. $debug_cmd
  4217. func_to_tool_file "$1" func_convert_file_msys_to_w32
  4218. 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)$'`
  4219. test -n "$func_cygming_gnu_implib_tmp"
  4220. }
  4221. # func_cygming_ms_implib_p ARG
  4222. # This predicate returns with zero status (TRUE) if
  4223. # ARG is an MS-style import library. Returns
  4224. # with nonzero status (FALSE) otherwise.
  4225. func_cygming_ms_implib_p ()
  4226. {
  4227. $debug_cmd
  4228. func_to_tool_file "$1" func_convert_file_msys_to_w32
  4229. func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'`
  4230. test -n "$func_cygming_ms_implib_tmp"
  4231. }
  4232. # func_win32_libid arg
  4233. # return the library type of file 'arg'
  4234. #
  4235. # Need a lot of goo to handle *both* DLLs and import libs
  4236. # Has to be a shell function in order to 'eat' the argument
  4237. # that is supplied when $file_magic_command is called.
  4238. # Despite the name, also deal with 64 bit binaries.
  4239. func_win32_libid ()
  4240. {
  4241. $debug_cmd
  4242. win32_libid_type=unknown
  4243. win32_fileres=`file -L $1 2>/dev/null`
  4244. case $win32_fileres in
  4245. *ar\ archive\ import\ library*) # definitely import
  4246. win32_libid_type="x86 archive import"
  4247. ;;
  4248. *ar\ archive*) # could be an import, or static
  4249. # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD.
  4250. if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null |
  4251. $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then
  4252. case $nm_interface in
  4253. "MS dumpbin")
  4254. if func_cygming_ms_implib_p "$1" ||
  4255. func_cygming_gnu_implib_p "$1"
  4256. then
  4257. win32_nmres=import
  4258. else
  4259. win32_nmres=
  4260. fi
  4261. ;;
  4262. *)
  4263. func_to_tool_file "$1" func_convert_file_msys_to_w32
  4264. win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" |
  4265. $SED -n -e '
  4266. 1,100{
  4267. / I /{
  4268. s|.*|import|
  4269. p
  4270. q
  4271. }
  4272. }'`
  4273. ;;
  4274. esac
  4275. case $win32_nmres in
  4276. import*) win32_libid_type="x86 archive import";;
  4277. *) win32_libid_type="x86 archive static";;
  4278. esac
  4279. fi
  4280. ;;
  4281. *DLL*)
  4282. win32_libid_type="x86 DLL"
  4283. ;;
  4284. *executable*) # but shell scripts are "executable" too...
  4285. case $win32_fileres in
  4286. *MS\ Windows\ PE\ Intel*)
  4287. win32_libid_type="x86 DLL"
  4288. ;;
  4289. esac
  4290. ;;
  4291. esac
  4292. $ECHO "$win32_libid_type"
  4293. }
  4294. # func_cygming_dll_for_implib ARG
  4295. #
  4296. # Platform-specific function to extract the
  4297. # name of the DLL associated with the specified
  4298. # import library ARG.
  4299. # Invoked by eval'ing the libtool variable
  4300. # $sharedlib_from_linklib_cmd
  4301. # Result is available in the variable
  4302. # $sharedlib_from_linklib_result
  4303. func_cygming_dll_for_implib ()
  4304. {
  4305. $debug_cmd
  4306. sharedlib_from_linklib_result=`$DLLTOOL --identify-strict --identify "$1"`
  4307. }
  4308. # func_cygming_dll_for_implib_fallback_core SECTION_NAME LIBNAMEs
  4309. #
  4310. # The is the core of a fallback implementation of a
  4311. # platform-specific function to extract the name of the
  4312. # DLL associated with the specified import library LIBNAME.
  4313. #
  4314. # SECTION_NAME is either .idata$6 or .idata$7, depending
  4315. # on the platform and compiler that created the implib.
  4316. #
  4317. # Echos the name of the DLL associated with the
  4318. # specified import library.
  4319. func_cygming_dll_for_implib_fallback_core ()
  4320. {
  4321. $debug_cmd
  4322. match_literal=`$ECHO "$1" | $SED "$sed_make_literal_regex"`
  4323. $OBJDUMP -s --section "$1" "$2" 2>/dev/null |
  4324. $SED '/^Contents of section '"$match_literal"':/{
  4325. # Place marker at beginning of archive member dllname section
  4326. s/.*/====MARK====/
  4327. p
  4328. d
  4329. }
  4330. # These lines can sometimes be longer than 43 characters, but
  4331. # are always uninteresting
  4332. /:[ ]*file format pe[i]\{,1\}-/d
  4333. /^In archive [^:]*:/d
  4334. # Ensure marker is printed
  4335. /^====MARK====/p
  4336. # Remove all lines with less than 43 characters
  4337. /^.\{43\}/!d
  4338. # From remaining lines, remove first 43 characters
  4339. s/^.\{43\}//' |
  4340. $SED -n '
  4341. # Join marker and all lines until next marker into a single line
  4342. /^====MARK====/ b para
  4343. H
  4344. $ b para
  4345. b
  4346. :para
  4347. x
  4348. s/\n//g
  4349. # Remove the marker
  4350. s/^====MARK====//
  4351. # Remove trailing dots and whitespace
  4352. s/[\. \t]*$//
  4353. # Print
  4354. /./p' |
  4355. # we now have a list, one entry per line, of the stringified
  4356. # contents of the appropriate section of all members of the
  4357. # archive that possess that section. Heuristic: eliminate
  4358. # all those that have a first or second character that is
  4359. # a '.' (that is, objdump's representation of an unprintable
  4360. # character.) This should work for all archives with less than
  4361. # 0x302f exports -- but will fail for DLLs whose name actually
  4362. # begins with a literal '.' or a single character followed by
  4363. # a '.'.
  4364. #
  4365. # Of those that remain, print the first one.
  4366. $SED -e '/^\./d;/^.\./d;q'
  4367. }
  4368. # func_cygming_dll_for_implib_fallback ARG
  4369. # Platform-specific function to extract the
  4370. # name of the DLL associated with the specified
  4371. # import library ARG.
  4372. #
  4373. # This fallback implementation is for use when $DLLTOOL
  4374. # does not support the --identify-strict option.
  4375. # Invoked by eval'ing the libtool variable
  4376. # $sharedlib_from_linklib_cmd
  4377. # Result is available in the variable
  4378. # $sharedlib_from_linklib_result
  4379. func_cygming_dll_for_implib_fallback ()
  4380. {
  4381. $debug_cmd
  4382. if func_cygming_gnu_implib_p "$1"; then
  4383. # binutils import library
  4384. sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$7' "$1"`
  4385. elif func_cygming_ms_implib_p "$1"; then
  4386. # ms-generated import library
  4387. sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$6' "$1"`
  4388. else
  4389. # unknown
  4390. sharedlib_from_linklib_result=
  4391. fi
  4392. }
  4393. # func_extract_an_archive dir oldlib
  4394. func_extract_an_archive ()
  4395. {
  4396. $debug_cmd
  4397. f_ex_an_ar_dir=$1; shift
  4398. f_ex_an_ar_oldlib=$1
  4399. if test yes = "$lock_old_archive_extraction"; then
  4400. lockfile=$f_ex_an_ar_oldlib.lock
  4401. until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
  4402. func_echo "Waiting for $lockfile to be removed"
  4403. sleep 2
  4404. done
  4405. fi
  4406. func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \
  4407. 'stat=$?; rm -f "$lockfile"; exit $stat'
  4408. if test yes = "$lock_old_archive_extraction"; then
  4409. $opt_dry_run || rm -f "$lockfile"
  4410. fi
  4411. if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
  4412. :
  4413. else
  4414. func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib"
  4415. fi
  4416. }
  4417. # func_extract_archives gentop oldlib ...
  4418. func_extract_archives ()
  4419. {
  4420. $debug_cmd
  4421. my_gentop=$1; shift
  4422. my_oldlibs=${1+"$@"}
  4423. my_oldobjs=
  4424. my_xlib=
  4425. my_xabs=
  4426. my_xdir=
  4427. for my_xlib in $my_oldlibs; do
  4428. # Extract the objects.
  4429. case $my_xlib in
  4430. [\\/]* | [A-Za-z]:[\\/]*) my_xabs=$my_xlib ;;
  4431. *) my_xabs=`pwd`"/$my_xlib" ;;
  4432. esac
  4433. func_basename "$my_xlib"
  4434. my_xlib=$func_basename_result
  4435. my_xlib_u=$my_xlib
  4436. while :; do
  4437. case " $extracted_archives " in
  4438. *" $my_xlib_u "*)
  4439. func_arith $extracted_serial + 1
  4440. extracted_serial=$func_arith_result
  4441. my_xlib_u=lt$extracted_serial-$my_xlib ;;
  4442. *) break ;;
  4443. esac
  4444. done
  4445. extracted_archives="$extracted_archives $my_xlib_u"
  4446. my_xdir=$my_gentop/$my_xlib_u
  4447. func_mkdir_p "$my_xdir"
  4448. case $host in
  4449. *-darwin*)
  4450. func_verbose "Extracting $my_xabs"
  4451. # Do not bother doing anything if just a dry run
  4452. $opt_dry_run || {
  4453. darwin_orig_dir=`pwd`
  4454. cd $my_xdir || exit $?
  4455. darwin_archive=$my_xabs
  4456. darwin_curdir=`pwd`
  4457. func_basename "$darwin_archive"
  4458. darwin_base_archive=$func_basename_result
  4459. darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true`
  4460. if test -n "$darwin_arches"; then
  4461. darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'`
  4462. darwin_arch=
  4463. func_verbose "$darwin_base_archive has multiple architectures $darwin_arches"
  4464. for darwin_arch in $darwin_arches; do
  4465. func_mkdir_p "unfat-$$/$darwin_base_archive-$darwin_arch"
  4466. $LIPO -thin $darwin_arch -output "unfat-$$/$darwin_base_archive-$darwin_arch/$darwin_base_archive" "$darwin_archive"
  4467. cd "unfat-$$/$darwin_base_archive-$darwin_arch"
  4468. func_extract_an_archive "`pwd`" "$darwin_base_archive"
  4469. cd "$darwin_curdir"
  4470. $RM "unfat-$$/$darwin_base_archive-$darwin_arch/$darwin_base_archive"
  4471. done # $darwin_arches
  4472. ## Okay now we've a bunch of thin objects, gotta fatten them up :)
  4473. darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$sed_basename" | sort -u`
  4474. darwin_file=
  4475. darwin_files=
  4476. for darwin_file in $darwin_filelist; do
  4477. darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP`
  4478. $LIPO -create -output "$darwin_file" $darwin_files
  4479. done # $darwin_filelist
  4480. $RM -rf unfat-$$
  4481. cd "$darwin_orig_dir"
  4482. else
  4483. cd $darwin_orig_dir
  4484. func_extract_an_archive "$my_xdir" "$my_xabs"
  4485. fi # $darwin_arches
  4486. } # !$opt_dry_run
  4487. ;;
  4488. *)
  4489. func_extract_an_archive "$my_xdir" "$my_xabs"
  4490. ;;
  4491. esac
  4492. my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP`
  4493. done
  4494. func_extract_archives_result=$my_oldobjs
  4495. }
  4496. # func_emit_wrapper [arg=no]
  4497. #
  4498. # Emit a libtool wrapper script on stdout.
  4499. # Don't directly open a file because we may want to
  4500. # incorporate the script contents within a cygwin/mingw
  4501. # wrapper executable. Must ONLY be called from within
  4502. # func_mode_link because it depends on a number of variables
  4503. # set therein.
  4504. #
  4505. # ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR
  4506. # variable will take. If 'yes', then the emitted script
  4507. # will assume that the directory where it is stored is
  4508. # the $objdir directory. This is a cygwin/mingw-specific
  4509. # behavior.
  4510. func_emit_wrapper ()
  4511. {
  4512. func_emit_wrapper_arg1=${1-no}
  4513. $ECHO "\
  4514. #! $SHELL
  4515. # $output - temporary wrapper script for $objdir/$outputname
  4516. # Generated by $PROGRAM (GNU $PACKAGE) $VERSION
  4517. #
  4518. # The $output program cannot be directly executed until all the libtool
  4519. # libraries that it depends on are installed.
  4520. #
  4521. # This wrapper script should never be moved out of the build directory.
  4522. # If it is, it will not operate correctly.
  4523. # Sed substitution that helps us do robust quoting. It backslashifies
  4524. # metacharacters that are still active within double-quoted strings.
  4525. sed_quote_subst='$sed_quote_subst'
  4526. # Be Bourne compatible
  4527. if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
  4528. emulate sh
  4529. NULLCMD=:
  4530. # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
  4531. # is contrary to our usage. Disable this feature.
  4532. alias -g '\${1+\"\$@\"}'='\"\$@\"'
  4533. setopt NO_GLOB_SUBST
  4534. else
  4535. case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
  4536. fi
  4537. BIN_SH=xpg4; export BIN_SH # for Tru64
  4538. DUALCASE=1; export DUALCASE # for MKS sh
  4539. # The HP-UX ksh and POSIX shell print the target directory to stdout
  4540. # if CDPATH is set.
  4541. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
  4542. relink_command=\"$relink_command\"
  4543. # This environment variable determines our operation mode.
  4544. if test \"\$libtool_install_magic\" = \"$magic\"; then
  4545. # install mode needs the following variables:
  4546. generated_by_libtool_version='$macro_version'
  4547. notinst_deplibs='$notinst_deplibs'
  4548. else
  4549. # When we are sourced in execute mode, \$file and \$ECHO are already set.
  4550. if test \"\$libtool_execute_magic\" != \"$magic\"; then
  4551. file=\"\$0\""
  4552. qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"`
  4553. $ECHO "\
  4554. # A function that is used when there is no print builtin or printf.
  4555. func_fallback_echo ()
  4556. {
  4557. eval 'cat <<_LTECHO_EOF
  4558. \$1
  4559. _LTECHO_EOF'
  4560. }
  4561. ECHO=\"$qECHO\"
  4562. fi
  4563. # Very basic option parsing. These options are (a) specific to
  4564. # the libtool wrapper, (b) are identical between the wrapper
  4565. # /script/ and the wrapper /executable/ that is used only on
  4566. # windows platforms, and (c) all begin with the string "--lt-"
  4567. # (application programs are unlikely to have options that match
  4568. # this pattern).
  4569. #
  4570. # There are only two supported options: --lt-debug and
  4571. # --lt-dump-script. There is, deliberately, no --lt-help.
  4572. #
  4573. # The first argument to this parsing function should be the
  4574. # script's $0 value, followed by "$@".
  4575. lt_option_debug=
  4576. func_parse_lt_options ()
  4577. {
  4578. lt_script_arg0=\$0
  4579. shift
  4580. for lt_opt
  4581. do
  4582. case \"\$lt_opt\" in
  4583. --lt-debug) lt_option_debug=1 ;;
  4584. --lt-dump-script)
  4585. lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\`
  4586. test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=.
  4587. lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\`
  4588. cat \"\$lt_dump_D/\$lt_dump_F\"
  4589. exit 0
  4590. ;;
  4591. --lt-*)
  4592. \$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2
  4593. exit 1
  4594. ;;
  4595. esac
  4596. done
  4597. # Print the debug banner immediately:
  4598. if test -n \"\$lt_option_debug\"; then
  4599. echo \"$outputname:$output:\$LINENO: libtool wrapper (GNU $PACKAGE) $VERSION\" 1>&2
  4600. fi
  4601. }
  4602. # Used when --lt-debug. Prints its arguments to stdout
  4603. # (redirection is the responsibility of the caller)
  4604. func_lt_dump_args ()
  4605. {
  4606. lt_dump_args_N=1;
  4607. for lt_arg
  4608. do
  4609. \$ECHO \"$outputname:$output:\$LINENO: newargv[\$lt_dump_args_N]: \$lt_arg\"
  4610. lt_dump_args_N=\`expr \$lt_dump_args_N + 1\`
  4611. done
  4612. }
  4613. # Core function for launching the target application
  4614. func_exec_program_core ()
  4615. {
  4616. "
  4617. case $host in
  4618. # Backslashes separate directories on plain windows
  4619. *-*-mingw | *-*-os2* | *-cegcc*)
  4620. $ECHO "\
  4621. if test -n \"\$lt_option_debug\"; then
  4622. \$ECHO \"$outputname:$output:\$LINENO: newargv[0]: \$progdir\\\\\$program\" 1>&2
  4623. func_lt_dump_args \${1+\"\$@\"} 1>&2
  4624. fi
  4625. exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
  4626. "
  4627. ;;
  4628. *)
  4629. $ECHO "\
  4630. if test -n \"\$lt_option_debug\"; then
  4631. \$ECHO \"$outputname:$output:\$LINENO: newargv[0]: \$progdir/\$program\" 1>&2
  4632. func_lt_dump_args \${1+\"\$@\"} 1>&2
  4633. fi
  4634. exec \"\$progdir/\$program\" \${1+\"\$@\"}
  4635. "
  4636. ;;
  4637. esac
  4638. $ECHO "\
  4639. \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2
  4640. exit 1
  4641. }
  4642. # A function to encapsulate launching the target application
  4643. # Strips options in the --lt-* namespace from \$@ and
  4644. # launches target application with the remaining arguments.
  4645. func_exec_program ()
  4646. {
  4647. case \" \$* \" in
  4648. *\\ --lt-*)
  4649. for lt_wr_arg
  4650. do
  4651. case \$lt_wr_arg in
  4652. --lt-*) ;;
  4653. *) set x \"\$@\" \"\$lt_wr_arg\"; shift;;
  4654. esac
  4655. shift
  4656. done ;;
  4657. esac
  4658. func_exec_program_core \${1+\"\$@\"}
  4659. }
  4660. # Parse options
  4661. func_parse_lt_options \"\$0\" \${1+\"\$@\"}
  4662. # Find the directory that this script lives in.
  4663. thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\`
  4664. test \"x\$thisdir\" = \"x\$file\" && thisdir=.
  4665. # Follow symbolic links until we get to the real thisdir.
  4666. file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\`
  4667. while test -n \"\$file\"; do
  4668. destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\`
  4669. # If there was a directory component, then change thisdir.
  4670. if test \"x\$destdir\" != \"x\$file\"; then
  4671. case \"\$destdir\" in
  4672. [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
  4673. *) thisdir=\"\$thisdir/\$destdir\" ;;
  4674. esac
  4675. fi
  4676. file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\`
  4677. file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\`
  4678. done
  4679. # Usually 'no', except on cygwin/mingw when embedded into
  4680. # the cwrapper.
  4681. WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1
  4682. if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then
  4683. # special case for '.'
  4684. if test \"\$thisdir\" = \".\"; then
  4685. thisdir=\`pwd\`
  4686. fi
  4687. # remove .libs from thisdir
  4688. case \"\$thisdir\" in
  4689. *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;;
  4690. $objdir ) thisdir=. ;;
  4691. esac
  4692. fi
  4693. # Try to get the absolute directory name.
  4694. absdir=\`cd \"\$thisdir\" && pwd\`
  4695. test -n \"\$absdir\" && thisdir=\"\$absdir\"
  4696. "
  4697. if test yes = "$fast_install"; then
  4698. $ECHO "\
  4699. program=lt-'$outputname'$exeext
  4700. progdir=\"\$thisdir/$objdir\"
  4701. if test ! -f \"\$progdir/\$program\" ||
  4702. { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | $SED 1q\`; \\
  4703. test \"X\$file\" != \"X\$progdir/\$program\"; }; then
  4704. file=\"\$\$-\$program\"
  4705. if test ! -d \"\$progdir\"; then
  4706. $MKDIR \"\$progdir\"
  4707. else
  4708. $RM \"\$progdir/\$file\"
  4709. fi"
  4710. $ECHO "\
  4711. # relink executable if necessary
  4712. if test -n \"\$relink_command\"; then
  4713. if relink_command_output=\`eval \$relink_command 2>&1\`; then :
  4714. else
  4715. \$ECHO \"\$relink_command_output\" >&2
  4716. $RM \"\$progdir/\$file\"
  4717. exit 1
  4718. fi
  4719. fi
  4720. $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
  4721. { $RM \"\$progdir/\$program\";
  4722. $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; }
  4723. $RM \"\$progdir/\$file\"
  4724. fi"
  4725. else
  4726. $ECHO "\
  4727. program='$outputname'
  4728. progdir=\"\$thisdir/$objdir\"
  4729. "
  4730. fi
  4731. $ECHO "\
  4732. if test -f \"\$progdir/\$program\"; then"
  4733. # fixup the dll searchpath if we need to.
  4734. #
  4735. # Fix the DLL searchpath if we need to. Do this before prepending
  4736. # to shlibpath, because on Windows, both are PATH and uninstalled
  4737. # libraries must come first.
  4738. if test -n "$dllsearchpath"; then
  4739. $ECHO "\
  4740. # Add the dll search path components to the executable PATH
  4741. PATH=$dllsearchpath:\$PATH
  4742. "
  4743. fi
  4744. # Export our shlibpath_var if we have one.
  4745. if test yes = "$shlibpath_overrides_runpath" && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
  4746. $ECHO "\
  4747. # Add our own library path to $shlibpath_var
  4748. $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
  4749. # Some systems cannot cope with colon-terminated $shlibpath_var
  4750. # The second colon is a workaround for a bug in BeOS R4 sed
  4751. $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\`
  4752. export $shlibpath_var
  4753. "
  4754. fi
  4755. $ECHO "\
  4756. if test \"\$libtool_execute_magic\" != \"$magic\"; then
  4757. # Run the actual program with our arguments.
  4758. func_exec_program \${1+\"\$@\"}
  4759. fi
  4760. else
  4761. # The program doesn't exist.
  4762. \$ECHO \"\$0: error: '\$progdir/\$program' does not exist\" 1>&2
  4763. \$ECHO \"This script is just a wrapper for \$program.\" 1>&2
  4764. \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2
  4765. exit 1
  4766. fi
  4767. fi\
  4768. "
  4769. }
  4770. # func_emit_cwrapperexe_src
  4771. # emit the source code for a wrapper executable on stdout
  4772. # Must ONLY be called from within func_mode_link because
  4773. # it depends on a number of variable set therein.
  4774. func_emit_cwrapperexe_src ()
  4775. {
  4776. cat <<EOF
  4777. /* $cwrappersource - temporary wrapper executable for $objdir/$outputname
  4778. Generated by $PROGRAM (GNU $PACKAGE) $VERSION
  4779. The $output program cannot be directly executed until all the libtool
  4780. libraries that it depends on are installed.
  4781. This wrapper executable should never be moved out of the build directory.
  4782. If it is, it will not operate correctly.
  4783. */
  4784. EOF
  4785. cat <<"EOF"
  4786. #ifdef _MSC_VER
  4787. # define _CRT_SECURE_NO_DEPRECATE 1
  4788. #endif
  4789. #include <stdio.h>
  4790. #include <stdlib.h>
  4791. #ifdef _MSC_VER
  4792. # include <direct.h>
  4793. # include <process.h>
  4794. # include <io.h>
  4795. #else
  4796. # include <unistd.h>
  4797. # include <stdint.h>
  4798. # ifdef __CYGWIN__
  4799. # include <io.h>
  4800. # endif
  4801. #endif
  4802. #include <malloc.h>
  4803. #include <stdarg.h>
  4804. #include <assert.h>
  4805. #include <string.h>
  4806. #include <ctype.h>
  4807. #include <errno.h>
  4808. #include <fcntl.h>
  4809. #include <sys/stat.h>
  4810. #define STREQ(s1, s2) (strcmp ((s1), (s2)) == 0)
  4811. /* declarations of non-ANSI functions */
  4812. #if defined __MINGW32__
  4813. # ifdef __STRICT_ANSI__
  4814. int _putenv (const char *);
  4815. # endif
  4816. #elif defined __CYGWIN__
  4817. # ifdef __STRICT_ANSI__
  4818. char *realpath (const char *, char *);
  4819. int putenv (char *);
  4820. int setenv (const char *, const char *, int);
  4821. # endif
  4822. /* #elif defined other_platform || defined ... */
  4823. #endif
  4824. /* portability defines, excluding path handling macros */
  4825. #if defined _MSC_VER
  4826. # define setmode _setmode
  4827. # define stat _stat
  4828. # define chmod _chmod
  4829. # define getcwd _getcwd
  4830. # define putenv _putenv
  4831. # define S_IXUSR _S_IEXEC
  4832. #elif defined __MINGW32__
  4833. # define setmode _setmode
  4834. # define stat _stat
  4835. # define chmod _chmod
  4836. # define getcwd _getcwd
  4837. # define putenv _putenv
  4838. #elif defined __CYGWIN__
  4839. # define HAVE_SETENV
  4840. # define FOPEN_WB "wb"
  4841. /* #elif defined other platforms ... */
  4842. #endif
  4843. #if defined PATH_MAX
  4844. # define LT_PATHMAX PATH_MAX
  4845. #elif defined MAXPATHLEN
  4846. # define LT_PATHMAX MAXPATHLEN
  4847. #else
  4848. # define LT_PATHMAX 1024
  4849. #endif
  4850. #ifndef S_IXOTH
  4851. # define S_IXOTH 0
  4852. #endif
  4853. #ifndef S_IXGRP
  4854. # define S_IXGRP 0
  4855. #endif
  4856. /* path handling portability macros */
  4857. #ifndef DIR_SEPARATOR
  4858. # define DIR_SEPARATOR '/'
  4859. # define PATH_SEPARATOR ':'
  4860. #endif
  4861. #if defined _WIN32 || defined __MSDOS__ || defined __DJGPP__ || \
  4862. defined __OS2__
  4863. # define HAVE_DOS_BASED_FILE_SYSTEM
  4864. # define FOPEN_WB "wb"
  4865. # ifndef DIR_SEPARATOR_2
  4866. # define DIR_SEPARATOR_2 '\\'
  4867. # endif
  4868. # ifndef PATH_SEPARATOR_2
  4869. # define PATH_SEPARATOR_2 ';'
  4870. # endif
  4871. #endif
  4872. #ifndef DIR_SEPARATOR_2
  4873. # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
  4874. #else /* DIR_SEPARATOR_2 */
  4875. # define IS_DIR_SEPARATOR(ch) \
  4876. (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
  4877. #endif /* DIR_SEPARATOR_2 */
  4878. #ifndef PATH_SEPARATOR_2
  4879. # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
  4880. #else /* PATH_SEPARATOR_2 */
  4881. # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
  4882. #endif /* PATH_SEPARATOR_2 */
  4883. #ifndef FOPEN_WB
  4884. # define FOPEN_WB "w"
  4885. #endif
  4886. #ifndef _O_BINARY
  4887. # define _O_BINARY 0
  4888. #endif
  4889. #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type)))
  4890. #define XFREE(stale) do { \
  4891. if (stale) { free (stale); stale = 0; } \
  4892. } while (0)
  4893. #if defined LT_DEBUGWRAPPER
  4894. static int lt_debug = 1;
  4895. #else
  4896. static int lt_debug = 0;
  4897. #endif
  4898. const char *program_name = "libtool-wrapper"; /* in case xstrdup fails */
  4899. void *xmalloc (size_t num);
  4900. char *xstrdup (const char *string);
  4901. const char *base_name (const char *name);
  4902. char *find_executable (const char *wrapper);
  4903. char *chase_symlinks (const char *pathspec);
  4904. int make_executable (const char *path);
  4905. int check_executable (const char *path);
  4906. char *strendzap (char *str, const char *pat);
  4907. void lt_debugprintf (const char *file, int line, const char *fmt, ...);
  4908. void lt_fatal (const char *file, int line, const char *message, ...);
  4909. static const char *nonnull (const char *s);
  4910. static const char *nonempty (const char *s);
  4911. void lt_setenv (const char *name, const char *value);
  4912. char *lt_extend_str (const char *orig_value, const char *add, int to_end);
  4913. void lt_update_exe_path (const char *name, const char *value);
  4914. void lt_update_lib_path (const char *name, const char *value);
  4915. char **prepare_spawn (char **argv);
  4916. void lt_dump_script (FILE *f);
  4917. EOF
  4918. cat <<EOF
  4919. #if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 5)
  4920. # define externally_visible volatile
  4921. #else
  4922. # define externally_visible __attribute__((externally_visible)) volatile
  4923. #endif
  4924. externally_visible const char * MAGIC_EXE = "$magic_exe";
  4925. const char * LIB_PATH_VARNAME = "$shlibpath_var";
  4926. EOF
  4927. if test yes = "$shlibpath_overrides_runpath" && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
  4928. func_to_host_path "$temp_rpath"
  4929. cat <<EOF
  4930. const char * LIB_PATH_VALUE = "$func_to_host_path_result";
  4931. EOF
  4932. else
  4933. cat <<"EOF"
  4934. const char * LIB_PATH_VALUE = "";
  4935. EOF
  4936. fi
  4937. if test -n "$dllsearchpath"; then
  4938. func_to_host_path "$dllsearchpath:"
  4939. cat <<EOF
  4940. const char * EXE_PATH_VARNAME = "PATH";
  4941. const char * EXE_PATH_VALUE = "$func_to_host_path_result";
  4942. EOF
  4943. else
  4944. cat <<"EOF"
  4945. const char * EXE_PATH_VARNAME = "";
  4946. const char * EXE_PATH_VALUE = "";
  4947. EOF
  4948. fi
  4949. if test yes = "$fast_install"; then
  4950. cat <<EOF
  4951. const char * TARGET_PROGRAM_NAME = "lt-$outputname"; /* hopefully, no .exe */
  4952. EOF
  4953. else
  4954. cat <<EOF
  4955. const char * TARGET_PROGRAM_NAME = "$outputname"; /* hopefully, no .exe */
  4956. EOF
  4957. fi
  4958. cat <<"EOF"
  4959. #define LTWRAPPER_OPTION_PREFIX "--lt-"
  4960. static const char *ltwrapper_option_prefix = LTWRAPPER_OPTION_PREFIX;
  4961. static const char *dumpscript_opt = LTWRAPPER_OPTION_PREFIX "dump-script";
  4962. static const char *debug_opt = LTWRAPPER_OPTION_PREFIX "debug";
  4963. int
  4964. main (int argc, char *argv[])
  4965. {
  4966. char **newargz;
  4967. int newargc;
  4968. char *tmp_pathspec;
  4969. char *actual_cwrapper_path;
  4970. char *actual_cwrapper_name;
  4971. char *target_name;
  4972. char *lt_argv_zero;
  4973. int rval = 127;
  4974. int i;
  4975. program_name = (char *) xstrdup (base_name (argv[0]));
  4976. newargz = XMALLOC (char *, (size_t) argc + 1);
  4977. /* very simple arg parsing; don't want to rely on getopt
  4978. * also, copy all non cwrapper options to newargz, except
  4979. * argz[0], which is handled differently
  4980. */
  4981. newargc=0;
  4982. for (i = 1; i < argc; i++)
  4983. {
  4984. if (STREQ (argv[i], dumpscript_opt))
  4985. {
  4986. EOF
  4987. case $host in
  4988. *mingw* | *cygwin* )
  4989. # make stdout use "unix" line endings
  4990. echo " setmode(1,_O_BINARY);"
  4991. ;;
  4992. esac
  4993. cat <<"EOF"
  4994. lt_dump_script (stdout);
  4995. return 0;
  4996. }
  4997. if (STREQ (argv[i], debug_opt))
  4998. {
  4999. lt_debug = 1;
  5000. continue;
  5001. }
  5002. if (STREQ (argv[i], ltwrapper_option_prefix))
  5003. {
  5004. /* however, if there is an option in the LTWRAPPER_OPTION_PREFIX
  5005. namespace, but it is not one of the ones we know about and
  5006. have already dealt with, above (inluding dump-script), then
  5007. report an error. Otherwise, targets might begin to believe
  5008. they are allowed to use options in the LTWRAPPER_OPTION_PREFIX
  5009. namespace. The first time any user complains about this, we'll
  5010. need to make LTWRAPPER_OPTION_PREFIX a configure-time option
  5011. or a configure.ac-settable value.
  5012. */
  5013. lt_fatal (__FILE__, __LINE__,
  5014. "unrecognized %s option: '%s'",
  5015. ltwrapper_option_prefix, argv[i]);
  5016. }
  5017. /* otherwise ... */
  5018. newargz[++newargc] = xstrdup (argv[i]);
  5019. }
  5020. newargz[++newargc] = NULL;
  5021. EOF
  5022. cat <<EOF
  5023. /* The GNU banner must be the first non-error debug message */
  5024. lt_debugprintf (__FILE__, __LINE__, "libtool wrapper (GNU $PACKAGE) $VERSION\n");
  5025. EOF
  5026. cat <<"EOF"
  5027. lt_debugprintf (__FILE__, __LINE__, "(main) argv[0]: %s\n", argv[0]);
  5028. lt_debugprintf (__FILE__, __LINE__, "(main) program_name: %s\n", program_name);
  5029. tmp_pathspec = find_executable (argv[0]);
  5030. if (tmp_pathspec == NULL)
  5031. lt_fatal (__FILE__, __LINE__, "couldn't find %s", argv[0]);
  5032. lt_debugprintf (__FILE__, __LINE__,
  5033. "(main) found exe (before symlink chase) at: %s\n",
  5034. tmp_pathspec);
  5035. actual_cwrapper_path = chase_symlinks (tmp_pathspec);
  5036. lt_debugprintf (__FILE__, __LINE__,
  5037. "(main) found exe (after symlink chase) at: %s\n",
  5038. actual_cwrapper_path);
  5039. XFREE (tmp_pathspec);
  5040. actual_cwrapper_name = xstrdup (base_name (actual_cwrapper_path));
  5041. strendzap (actual_cwrapper_path, actual_cwrapper_name);
  5042. /* wrapper name transforms */
  5043. strendzap (actual_cwrapper_name, ".exe");
  5044. tmp_pathspec = lt_extend_str (actual_cwrapper_name, ".exe", 1);
  5045. XFREE (actual_cwrapper_name);
  5046. actual_cwrapper_name = tmp_pathspec;
  5047. tmp_pathspec = 0;
  5048. /* target_name transforms -- use actual target program name; might have lt- prefix */
  5049. target_name = xstrdup (base_name (TARGET_PROGRAM_NAME));
  5050. strendzap (target_name, ".exe");
  5051. tmp_pathspec = lt_extend_str (target_name, ".exe", 1);
  5052. XFREE (target_name);
  5053. target_name = tmp_pathspec;
  5054. tmp_pathspec = 0;
  5055. lt_debugprintf (__FILE__, __LINE__,
  5056. "(main) libtool target name: %s\n",
  5057. target_name);
  5058. EOF
  5059. cat <<EOF
  5060. newargz[0] =
  5061. XMALLOC (char, (strlen (actual_cwrapper_path) +
  5062. strlen ("$objdir") + 1 + strlen (actual_cwrapper_name) + 1));
  5063. strcpy (newargz[0], actual_cwrapper_path);
  5064. strcat (newargz[0], "$objdir");
  5065. strcat (newargz[0], "/");
  5066. EOF
  5067. cat <<"EOF"
  5068. /* stop here, and copy so we don't have to do this twice */
  5069. tmp_pathspec = xstrdup (newargz[0]);
  5070. /* do NOT want the lt- prefix here, so use actual_cwrapper_name */
  5071. strcat (newargz[0], actual_cwrapper_name);
  5072. /* DO want the lt- prefix here if it exists, so use target_name */
  5073. lt_argv_zero = lt_extend_str (tmp_pathspec, target_name, 1);
  5074. XFREE (tmp_pathspec);
  5075. tmp_pathspec = NULL;
  5076. EOF
  5077. case $host_os in
  5078. mingw*)
  5079. cat <<"EOF"
  5080. {
  5081. char* p;
  5082. while ((p = strchr (newargz[0], '\\')) != NULL)
  5083. {
  5084. *p = '/';
  5085. }
  5086. while ((p = strchr (lt_argv_zero, '\\')) != NULL)
  5087. {
  5088. *p = '/';
  5089. }
  5090. }
  5091. EOF
  5092. ;;
  5093. esac
  5094. cat <<"EOF"
  5095. XFREE (target_name);
  5096. XFREE (actual_cwrapper_path);
  5097. XFREE (actual_cwrapper_name);
  5098. lt_setenv ("BIN_SH", "xpg4"); /* for Tru64 */
  5099. lt_setenv ("DUALCASE", "1"); /* for MSK sh */
  5100. /* Update the DLL searchpath. EXE_PATH_VALUE ($dllsearchpath) must
  5101. be prepended before (that is, appear after) LIB_PATH_VALUE ($temp_rpath)
  5102. because on Windows, both *_VARNAMEs are PATH but uninstalled
  5103. libraries must come first. */
  5104. lt_update_exe_path (EXE_PATH_VARNAME, EXE_PATH_VALUE);
  5105. lt_update_lib_path (LIB_PATH_VARNAME, LIB_PATH_VALUE);
  5106. lt_debugprintf (__FILE__, __LINE__, "(main) lt_argv_zero: %s\n",
  5107. nonnull (lt_argv_zero));
  5108. for (i = 0; i < newargc; i++)
  5109. {
  5110. lt_debugprintf (__FILE__, __LINE__, "(main) newargz[%d]: %s\n",
  5111. i, nonnull (newargz[i]));
  5112. }
  5113. EOF
  5114. case $host_os in
  5115. mingw*)
  5116. cat <<"EOF"
  5117. /* execv doesn't actually work on mingw as expected on unix */
  5118. newargz = prepare_spawn (newargz);
  5119. rval = (int) _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz);
  5120. if (rval == -1)
  5121. {
  5122. /* failed to start process */
  5123. lt_debugprintf (__FILE__, __LINE__,
  5124. "(main) failed to launch target \"%s\": %s\n",
  5125. lt_argv_zero, nonnull (strerror (errno)));
  5126. return 127;
  5127. }
  5128. return rval;
  5129. EOF
  5130. ;;
  5131. *)
  5132. cat <<"EOF"
  5133. execv (lt_argv_zero, newargz);
  5134. return rval; /* =127, but avoids unused variable warning */
  5135. EOF
  5136. ;;
  5137. esac
  5138. cat <<"EOF"
  5139. }
  5140. void *
  5141. xmalloc (size_t num)
  5142. {
  5143. void *p = (void *) malloc (num);
  5144. if (!p)
  5145. lt_fatal (__FILE__, __LINE__, "memory exhausted");
  5146. return p;
  5147. }
  5148. char *
  5149. xstrdup (const char *string)
  5150. {
  5151. return string ? strcpy ((char *) xmalloc (strlen (string) + 1),
  5152. string) : NULL;
  5153. }
  5154. const char *
  5155. base_name (const char *name)
  5156. {
  5157. const char *base;
  5158. #if defined HAVE_DOS_BASED_FILE_SYSTEM
  5159. /* Skip over the disk name in MSDOS pathnames. */
  5160. if (isalpha ((unsigned char) name[0]) && name[1] == ':')
  5161. name += 2;
  5162. #endif
  5163. for (base = name; *name; name++)
  5164. if (IS_DIR_SEPARATOR (*name))
  5165. base = name + 1;
  5166. return base;
  5167. }
  5168. int
  5169. check_executable (const char *path)
  5170. {
  5171. struct stat st;
  5172. lt_debugprintf (__FILE__, __LINE__, "(check_executable): %s\n",
  5173. nonempty (path));
  5174. if ((!path) || (!*path))
  5175. return 0;
  5176. if ((stat (path, &st) >= 0)
  5177. && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)))
  5178. return 1;
  5179. else
  5180. return 0;
  5181. }
  5182. int
  5183. make_executable (const char *path)
  5184. {
  5185. int rval = 0;
  5186. struct stat st;
  5187. lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n",
  5188. nonempty (path));
  5189. if ((!path) || (!*path))
  5190. return 0;
  5191. if (stat (path, &st) >= 0)
  5192. {
  5193. rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR);
  5194. }
  5195. return rval;
  5196. }
  5197. /* Searches for the full path of the wrapper. Returns
  5198. newly allocated full path name if found, NULL otherwise
  5199. Does not chase symlinks, even on platforms that support them.
  5200. */
  5201. char *
  5202. find_executable (const char *wrapper)
  5203. {
  5204. int has_slash = 0;
  5205. const char *p;
  5206. const char *p_next;
  5207. /* static buffer for getcwd */
  5208. char tmp[LT_PATHMAX + 1];
  5209. size_t tmp_len;
  5210. char *concat_name;
  5211. lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n",
  5212. nonempty (wrapper));
  5213. if ((wrapper == NULL) || (*wrapper == '\0'))
  5214. return NULL;
  5215. /* Absolute path? */
  5216. #if defined HAVE_DOS_BASED_FILE_SYSTEM
  5217. if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':')
  5218. {
  5219. concat_name = xstrdup (wrapper);
  5220. if (check_executable (concat_name))
  5221. return concat_name;
  5222. XFREE (concat_name);
  5223. }
  5224. else
  5225. {
  5226. #endif
  5227. if (IS_DIR_SEPARATOR (wrapper[0]))
  5228. {
  5229. concat_name = xstrdup (wrapper);
  5230. if (check_executable (concat_name))
  5231. return concat_name;
  5232. XFREE (concat_name);
  5233. }
  5234. #if defined HAVE_DOS_BASED_FILE_SYSTEM
  5235. }
  5236. #endif
  5237. for (p = wrapper; *p; p++)
  5238. if (*p == '/')
  5239. {
  5240. has_slash = 1;
  5241. break;
  5242. }
  5243. if (!has_slash)
  5244. {
  5245. /* no slashes; search PATH */
  5246. const char *path = getenv ("PATH");
  5247. if (path != NULL)
  5248. {
  5249. for (p = path; *p; p = p_next)
  5250. {
  5251. const char *q;
  5252. size_t p_len;
  5253. for (q = p; *q; q++)
  5254. if (IS_PATH_SEPARATOR (*q))
  5255. break;
  5256. p_len = (size_t) (q - p);
  5257. p_next = (*q == '\0' ? q : q + 1);
  5258. if (p_len == 0)
  5259. {
  5260. /* empty path: current directory */
  5261. if (getcwd (tmp, LT_PATHMAX) == NULL)
  5262. lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
  5263. nonnull (strerror (errno)));
  5264. tmp_len = strlen (tmp);
  5265. concat_name =
  5266. XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
  5267. memcpy (concat_name, tmp, tmp_len);
  5268. concat_name[tmp_len] = '/';
  5269. strcpy (concat_name + tmp_len + 1, wrapper);
  5270. }
  5271. else
  5272. {
  5273. concat_name =
  5274. XMALLOC (char, p_len + 1 + strlen (wrapper) + 1);
  5275. memcpy (concat_name, p, p_len);
  5276. concat_name[p_len] = '/';
  5277. strcpy (concat_name + p_len + 1, wrapper);
  5278. }
  5279. if (check_executable (concat_name))
  5280. return concat_name;
  5281. XFREE (concat_name);
  5282. }
  5283. }
  5284. /* not found in PATH; assume curdir */
  5285. }
  5286. /* Relative path | not found in path: prepend cwd */
  5287. if (getcwd (tmp, LT_PATHMAX) == NULL)
  5288. lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
  5289. nonnull (strerror (errno)));
  5290. tmp_len = strlen (tmp);
  5291. concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
  5292. memcpy (concat_name, tmp, tmp_len);
  5293. concat_name[tmp_len] = '/';
  5294. strcpy (concat_name + tmp_len + 1, wrapper);
  5295. if (check_executable (concat_name))
  5296. return concat_name;
  5297. XFREE (concat_name);
  5298. return NULL;
  5299. }
  5300. char *
  5301. chase_symlinks (const char *pathspec)
  5302. {
  5303. #ifndef S_ISLNK
  5304. return xstrdup (pathspec);
  5305. #else
  5306. char buf[LT_PATHMAX];
  5307. struct stat s;
  5308. char *tmp_pathspec = xstrdup (pathspec);
  5309. char *p;
  5310. int has_symlinks = 0;
  5311. while (strlen (tmp_pathspec) && !has_symlinks)
  5312. {
  5313. lt_debugprintf (__FILE__, __LINE__,
  5314. "checking path component for symlinks: %s\n",
  5315. tmp_pathspec);
  5316. if (lstat (tmp_pathspec, &s) == 0)
  5317. {
  5318. if (S_ISLNK (s.st_mode) != 0)
  5319. {
  5320. has_symlinks = 1;
  5321. break;
  5322. }
  5323. /* search backwards for last DIR_SEPARATOR */
  5324. p = tmp_pathspec + strlen (tmp_pathspec) - 1;
  5325. while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
  5326. p--;
  5327. if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
  5328. {
  5329. /* no more DIR_SEPARATORS left */
  5330. break;
  5331. }
  5332. *p = '\0';
  5333. }
  5334. else
  5335. {
  5336. lt_fatal (__FILE__, __LINE__,
  5337. "error accessing file \"%s\": %s",
  5338. tmp_pathspec, nonnull (strerror (errno)));
  5339. }
  5340. }
  5341. XFREE (tmp_pathspec);
  5342. if (!has_symlinks)
  5343. {
  5344. return xstrdup (pathspec);
  5345. }
  5346. tmp_pathspec = realpath (pathspec, buf);
  5347. if (tmp_pathspec == 0)
  5348. {
  5349. lt_fatal (__FILE__, __LINE__,
  5350. "could not follow symlinks for %s", pathspec);
  5351. }
  5352. return xstrdup (tmp_pathspec);
  5353. #endif
  5354. }
  5355. char *
  5356. strendzap (char *str, const char *pat)
  5357. {
  5358. size_t len, patlen;
  5359. assert (str != NULL);
  5360. assert (pat != NULL);
  5361. len = strlen (str);
  5362. patlen = strlen (pat);
  5363. if (patlen <= len)
  5364. {
  5365. str += len - patlen;
  5366. if (STREQ (str, pat))
  5367. *str = '\0';
  5368. }
  5369. return str;
  5370. }
  5371. void
  5372. lt_debugprintf (const char *file, int line, const char *fmt, ...)
  5373. {
  5374. va_list args;
  5375. if (lt_debug)
  5376. {
  5377. (void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line);
  5378. va_start (args, fmt);
  5379. (void) vfprintf (stderr, fmt, args);
  5380. va_end (args);
  5381. }
  5382. }
  5383. static void
  5384. lt_error_core (int exit_status, const char *file,
  5385. int line, const char *mode,
  5386. const char *message, va_list ap)
  5387. {
  5388. fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode);
  5389. vfprintf (stderr, message, ap);
  5390. fprintf (stderr, ".\n");
  5391. if (exit_status >= 0)
  5392. exit (exit_status);
  5393. }
  5394. void
  5395. lt_fatal (const char *file, int line, const char *message, ...)
  5396. {
  5397. va_list ap;
  5398. va_start (ap, message);
  5399. lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap);
  5400. va_end (ap);
  5401. }
  5402. static const char *
  5403. nonnull (const char *s)
  5404. {
  5405. return s ? s : "(null)";
  5406. }
  5407. static const char *
  5408. nonempty (const char *s)
  5409. {
  5410. return (s && !*s) ? "(empty)" : nonnull (s);
  5411. }
  5412. void
  5413. lt_setenv (const char *name, const char *value)
  5414. {
  5415. lt_debugprintf (__FILE__, __LINE__,
  5416. "(lt_setenv) setting '%s' to '%s'\n",
  5417. nonnull (name), nonnull (value));
  5418. {
  5419. #ifdef HAVE_SETENV
  5420. /* always make a copy, for consistency with !HAVE_SETENV */
  5421. char *str = xstrdup (value);
  5422. setenv (name, str, 1);
  5423. #else
  5424. size_t len = strlen (name) + 1 + strlen (value) + 1;
  5425. char *str = XMALLOC (char, len);
  5426. sprintf (str, "%s=%s", name, value);
  5427. if (putenv (str) != EXIT_SUCCESS)
  5428. {
  5429. XFREE (str);
  5430. }
  5431. #endif
  5432. }
  5433. }
  5434. char *
  5435. lt_extend_str (const char *orig_value, const char *add, int to_end)
  5436. {
  5437. char *new_value;
  5438. if (orig_value && *orig_value)
  5439. {
  5440. size_t orig_value_len = strlen (orig_value);
  5441. size_t add_len = strlen (add);
  5442. new_value = XMALLOC (char, add_len + orig_value_len + 1);
  5443. if (to_end)
  5444. {
  5445. strcpy (new_value, orig_value);
  5446. strcpy (new_value + orig_value_len, add);
  5447. }
  5448. else
  5449. {
  5450. strcpy (new_value, add);
  5451. strcpy (new_value + add_len, orig_value);
  5452. }
  5453. }
  5454. else
  5455. {
  5456. new_value = xstrdup (add);
  5457. }
  5458. return new_value;
  5459. }
  5460. void
  5461. lt_update_exe_path (const char *name, const char *value)
  5462. {
  5463. lt_debugprintf (__FILE__, __LINE__,
  5464. "(lt_update_exe_path) modifying '%s' by prepending '%s'\n",
  5465. nonnull (name), nonnull (value));
  5466. if (name && *name && value && *value)
  5467. {
  5468. char *new_value = lt_extend_str (getenv (name), value, 0);
  5469. /* some systems can't cope with a ':'-terminated path #' */
  5470. size_t len = strlen (new_value);
  5471. while ((len > 0) && IS_PATH_SEPARATOR (new_value[len-1]))
  5472. {
  5473. new_value[--len] = '\0';
  5474. }
  5475. lt_setenv (name, new_value);
  5476. XFREE (new_value);
  5477. }
  5478. }
  5479. void
  5480. lt_update_lib_path (const char *name, const char *value)
  5481. {
  5482. lt_debugprintf (__FILE__, __LINE__,
  5483. "(lt_update_lib_path) modifying '%s' by prepending '%s'\n",
  5484. nonnull (name), nonnull (value));
  5485. if (name && *name && value && *value)
  5486. {
  5487. char *new_value = lt_extend_str (getenv (name), value, 0);
  5488. lt_setenv (name, new_value);
  5489. XFREE (new_value);
  5490. }
  5491. }
  5492. EOF
  5493. case $host_os in
  5494. mingw*)
  5495. cat <<"EOF"
  5496. /* Prepares an argument vector before calling spawn().
  5497. Note that spawn() does not by itself call the command interpreter
  5498. (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") :
  5499. ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
  5500. GetVersionEx(&v);
  5501. v.dwPlatformId == VER_PLATFORM_WIN32_NT;
  5502. }) ? "cmd.exe" : "command.com").
  5503. Instead it simply concatenates the arguments, separated by ' ', and calls
  5504. CreateProcess(). We must quote the arguments since Win32 CreateProcess()
  5505. interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a
  5506. special way:
  5507. - Space and tab are interpreted as delimiters. They are not treated as
  5508. delimiters if they are surrounded by double quotes: "...".
  5509. - Unescaped double quotes are removed from the input. Their only effect is
  5510. that within double quotes, space and tab are treated like normal
  5511. characters.
  5512. - Backslashes not followed by double quotes are not special.
  5513. - But 2*n+1 backslashes followed by a double quote become
  5514. n backslashes followed by a double quote (n >= 0):
  5515. \" -> "
  5516. \\\" -> \"
  5517. \\\\\" -> \\"
  5518. */
  5519. #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"
  5520. #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"
  5521. char **
  5522. prepare_spawn (char **argv)
  5523. {
  5524. size_t argc;
  5525. char **new_argv;
  5526. size_t i;
  5527. /* Count number of arguments. */
  5528. for (argc = 0; argv[argc] != NULL; argc++)
  5529. ;
  5530. /* Allocate new argument vector. */
  5531. new_argv = XMALLOC (char *, argc + 1);
  5532. /* Put quoted arguments into the new argument vector. */
  5533. for (i = 0; i < argc; i++)
  5534. {
  5535. const char *string = argv[i];
  5536. if (string[0] == '\0')
  5537. new_argv[i] = xstrdup ("\"\"");
  5538. else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL)
  5539. {
  5540. int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL);
  5541. size_t length;
  5542. unsigned int backslashes;
  5543. const char *s;
  5544. char *quoted_string;
  5545. char *p;
  5546. length = 0;
  5547. backslashes = 0;
  5548. if (quote_around)
  5549. length++;
  5550. for (s = string; *s != '\0'; s++)
  5551. {
  5552. char c = *s;
  5553. if (c == '"')
  5554. length += backslashes + 1;
  5555. length++;
  5556. if (c == '\\')
  5557. backslashes++;
  5558. else
  5559. backslashes = 0;
  5560. }
  5561. if (quote_around)
  5562. length += backslashes + 1;
  5563. quoted_string = XMALLOC (char, length + 1);
  5564. p = quoted_string;
  5565. backslashes = 0;
  5566. if (quote_around)
  5567. *p++ = '"';
  5568. for (s = string; *s != '\0'; s++)
  5569. {
  5570. char c = *s;
  5571. if (c == '"')
  5572. {
  5573. unsigned int j;
  5574. for (j = backslashes + 1; j > 0; j--)
  5575. *p++ = '\\';
  5576. }
  5577. *p++ = c;
  5578. if (c == '\\')
  5579. backslashes++;
  5580. else
  5581. backslashes = 0;
  5582. }
  5583. if (quote_around)
  5584. {
  5585. unsigned int j;
  5586. for (j = backslashes; j > 0; j--)
  5587. *p++ = '\\';
  5588. *p++ = '"';
  5589. }
  5590. *p = '\0';
  5591. new_argv[i] = quoted_string;
  5592. }
  5593. else
  5594. new_argv[i] = (char *) string;
  5595. }
  5596. new_argv[argc] = NULL;
  5597. return new_argv;
  5598. }
  5599. EOF
  5600. ;;
  5601. esac
  5602. cat <<"EOF"
  5603. void lt_dump_script (FILE* f)
  5604. {
  5605. EOF
  5606. func_emit_wrapper yes |
  5607. $SED -n -e '
  5608. s/^\(.\{79\}\)\(..*\)/\1\
  5609. \2/
  5610. h
  5611. s/\([\\"]\)/\\\1/g
  5612. s/$/\\n/
  5613. s/\([^\n]*\).*/ fputs ("\1", f);/p
  5614. g
  5615. D'
  5616. cat <<"EOF"
  5617. }
  5618. EOF
  5619. }
  5620. # end: func_emit_cwrapperexe_src
  5621. # func_win32_import_lib_p ARG
  5622. # True if ARG is an import lib, as indicated by $file_magic_cmd
  5623. func_win32_import_lib_p ()
  5624. {
  5625. $debug_cmd
  5626. case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in
  5627. *import*) : ;;
  5628. *) false ;;
  5629. esac
  5630. }
  5631. # func_suncc_cstd_abi
  5632. # !!ONLY CALL THIS FOR SUN CC AFTER $compile_command IS FULLY EXPANDED!!
  5633. # Several compiler flags select an ABI that is incompatible with the
  5634. # Cstd library. Avoid specifying it if any are in CXXFLAGS.
  5635. func_suncc_cstd_abi ()
  5636. {
  5637. $debug_cmd
  5638. case " $compile_command " in
  5639. *" -compat=g "*|*\ -std=c++[0-9][0-9]\ *|*" -library=stdcxx4 "*|*" -library=stlport4 "*)
  5640. suncc_use_cstd_abi=no
  5641. ;;
  5642. *)
  5643. suncc_use_cstd_abi=yes
  5644. ;;
  5645. esac
  5646. }
  5647. # func_mode_link arg...
  5648. func_mode_link ()
  5649. {
  5650. $debug_cmd
  5651. case $host in
  5652. *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
  5653. # It is impossible to link a dll without this setting, and
  5654. # we shouldn't force the makefile maintainer to figure out
  5655. # what system we are compiling for in order to pass an extra
  5656. # flag for every libtool invocation.
  5657. # allow_undefined=no
  5658. # FIXME: Unfortunately, there are problems with the above when trying
  5659. # to make a dll that has undefined symbols, in which case not
  5660. # even a static library is built. For now, we need to specify
  5661. # -no-undefined on the libtool link line when we can be certain
  5662. # that all symbols are satisfied, otherwise we get a static library.
  5663. allow_undefined=yes
  5664. ;;
  5665. *)
  5666. allow_undefined=yes
  5667. ;;
  5668. esac
  5669. libtool_args=$nonopt
  5670. base_compile="$nonopt $@"
  5671. compile_command=$nonopt
  5672. finalize_command=$nonopt
  5673. compile_rpath=
  5674. finalize_rpath=
  5675. compile_shlibpath=
  5676. finalize_shlibpath=
  5677. convenience=
  5678. old_convenience=
  5679. deplibs=
  5680. old_deplibs=
  5681. compiler_flags=
  5682. linker_flags=
  5683. dllsearchpath=
  5684. lib_search_path=`pwd`
  5685. inst_prefix_dir=
  5686. new_inherited_linker_flags=
  5687. avoid_version=no
  5688. bindir=
  5689. dlfiles=
  5690. dlprefiles=
  5691. dlself=no
  5692. export_dynamic=no
  5693. export_symbols=
  5694. export_symbols_regex=
  5695. generated=
  5696. libobjs=
  5697. ltlibs=
  5698. module=no
  5699. no_install=no
  5700. objs=
  5701. os2dllname=
  5702. non_pic_objects=
  5703. precious_files_regex=
  5704. prefer_static_libs=no
  5705. preload=false
  5706. prev=
  5707. prevarg=
  5708. release=
  5709. rpath=
  5710. xrpath=
  5711. perm_rpath=
  5712. temp_rpath=
  5713. thread_safe=no
  5714. vinfo=
  5715. vinfo_number=no
  5716. weak_libs=
  5717. single_module=$wl-single_module
  5718. func_infer_tag $base_compile
  5719. # We need to know -static, to get the right output filenames.
  5720. for arg
  5721. do
  5722. case $arg in
  5723. -shared)
  5724. test yes != "$build_libtool_libs" \
  5725. && func_fatal_configuration "cannot build a shared library"
  5726. build_old_libs=no
  5727. break
  5728. ;;
  5729. -all-static | -static | -static-libtool-libs)
  5730. case $arg in
  5731. -all-static)
  5732. if test yes = "$build_libtool_libs" && test -z "$link_static_flag"; then
  5733. func_warning "complete static linking is impossible in this configuration"
  5734. fi
  5735. if test -n "$link_static_flag"; then
  5736. dlopen_self=$dlopen_self_static
  5737. fi
  5738. prefer_static_libs=yes
  5739. ;;
  5740. -static)
  5741. if test -z "$pic_flag" && test -n "$link_static_flag"; then
  5742. dlopen_self=$dlopen_self_static
  5743. fi
  5744. prefer_static_libs=built
  5745. ;;
  5746. -static-libtool-libs)
  5747. if test -z "$pic_flag" && test -n "$link_static_flag"; then
  5748. dlopen_self=$dlopen_self_static
  5749. fi
  5750. prefer_static_libs=yes
  5751. ;;
  5752. esac
  5753. build_libtool_libs=no
  5754. build_old_libs=yes
  5755. break
  5756. ;;
  5757. esac
  5758. done
  5759. # See if our shared archives depend on static archives.
  5760. test -n "$old_archive_from_new_cmds" && build_old_libs=yes
  5761. # Go through the arguments, transforming them on the way.
  5762. while test "$#" -gt 0; do
  5763. arg=$1
  5764. shift
  5765. func_quote_for_eval "$arg"
  5766. qarg=$func_quote_for_eval_unquoted_result
  5767. func_append libtool_args " $func_quote_for_eval_result"
  5768. # If the previous option needs an argument, assign it.
  5769. if test -n "$prev"; then
  5770. case $prev in
  5771. output)
  5772. func_append compile_command " @OUTPUT@"
  5773. func_append finalize_command " @OUTPUT@"
  5774. ;;
  5775. esac
  5776. case $prev in
  5777. bindir)
  5778. bindir=$arg
  5779. prev=
  5780. continue
  5781. ;;
  5782. dlfiles|dlprefiles)
  5783. $preload || {
  5784. # Add the symbol object into the linking commands.
  5785. func_append compile_command " @SYMFILE@"
  5786. func_append finalize_command " @SYMFILE@"
  5787. preload=:
  5788. }
  5789. case $arg in
  5790. *.la | *.lo) ;; # We handle these cases below.
  5791. force)
  5792. if test no = "$dlself"; then
  5793. dlself=needless
  5794. export_dynamic=yes
  5795. fi
  5796. prev=
  5797. continue
  5798. ;;
  5799. self)
  5800. if test dlprefiles = "$prev"; then
  5801. dlself=yes
  5802. elif test dlfiles = "$prev" && test yes != "$dlopen_self"; then
  5803. dlself=yes
  5804. else
  5805. dlself=needless
  5806. export_dynamic=yes
  5807. fi
  5808. prev=
  5809. continue
  5810. ;;
  5811. *)
  5812. if test dlfiles = "$prev"; then
  5813. func_append dlfiles " $arg"
  5814. else
  5815. func_append dlprefiles " $arg"
  5816. fi
  5817. prev=
  5818. continue
  5819. ;;
  5820. esac
  5821. ;;
  5822. expsyms)
  5823. export_symbols=$arg
  5824. test -f "$arg" \
  5825. || func_fatal_error "symbol file '$arg' does not exist"
  5826. prev=
  5827. continue
  5828. ;;
  5829. expsyms_regex)
  5830. export_symbols_regex=$arg
  5831. prev=
  5832. continue
  5833. ;;
  5834. framework)
  5835. case $host in
  5836. *-*-darwin*)
  5837. case "$deplibs " in
  5838. *" $qarg.ltframework "*) ;;
  5839. *) func_append deplibs " $qarg.ltframework" # this is fixed later
  5840. ;;
  5841. esac
  5842. ;;
  5843. esac
  5844. prev=
  5845. continue
  5846. ;;
  5847. inst_prefix)
  5848. inst_prefix_dir=$arg
  5849. prev=
  5850. continue
  5851. ;;
  5852. mllvm)
  5853. # Clang does not use LLVM to link, so we can simply discard any
  5854. # '-mllvm $arg' options when doing the link step.
  5855. prev=
  5856. continue
  5857. ;;
  5858. objectlist)
  5859. if test -f "$arg"; then
  5860. save_arg=$arg
  5861. moreargs=
  5862. for fil in `cat "$save_arg"`
  5863. do
  5864. # func_append moreargs " $fil"
  5865. arg=$fil
  5866. # A libtool-controlled object.
  5867. # Check to see that this really is a libtool object.
  5868. if func_lalib_unsafe_p "$arg"; then
  5869. pic_object=
  5870. non_pic_object=
  5871. # Read the .lo file
  5872. func_source "$arg"
  5873. if test -z "$pic_object" ||
  5874. test -z "$non_pic_object" ||
  5875. test none = "$pic_object" &&
  5876. test none = "$non_pic_object"; then
  5877. func_fatal_error "cannot find name of object for '$arg'"
  5878. fi
  5879. # Extract subdirectory from the argument.
  5880. func_dirname "$arg" "/" ""
  5881. xdir=$func_dirname_result
  5882. if test none != "$pic_object"; then
  5883. # Prepend the subdirectory the object is found in.
  5884. pic_object=$xdir$pic_object
  5885. if test dlfiles = "$prev"; then
  5886. if test yes = "$build_libtool_libs" && test yes = "$dlopen_support"; then
  5887. func_append dlfiles " $pic_object"
  5888. prev=
  5889. continue
  5890. else
  5891. # If libtool objects are unsupported, then we need to preload.
  5892. prev=dlprefiles
  5893. fi
  5894. fi
  5895. # CHECK ME: I think I busted this. -Ossama
  5896. if test dlprefiles = "$prev"; then
  5897. # Preload the old-style object.
  5898. func_append dlprefiles " $pic_object"
  5899. prev=
  5900. fi
  5901. # A PIC object.
  5902. func_append libobjs " $pic_object"
  5903. arg=$pic_object
  5904. fi
  5905. # Non-PIC object.
  5906. if test none != "$non_pic_object"; then
  5907. # Prepend the subdirectory the object is found in.
  5908. non_pic_object=$xdir$non_pic_object
  5909. # A standard non-PIC object
  5910. func_append non_pic_objects " $non_pic_object"
  5911. if test -z "$pic_object" || test none = "$pic_object"; then
  5912. arg=$non_pic_object
  5913. fi
  5914. else
  5915. # If the PIC object exists, use it instead.
  5916. # $xdir was prepended to $pic_object above.
  5917. non_pic_object=$pic_object
  5918. func_append non_pic_objects " $non_pic_object"
  5919. fi
  5920. else
  5921. # Only an error if not doing a dry-run.
  5922. if $opt_dry_run; then
  5923. # Extract subdirectory from the argument.
  5924. func_dirname "$arg" "/" ""
  5925. xdir=$func_dirname_result
  5926. func_lo2o "$arg"
  5927. pic_object=$xdir$objdir/$func_lo2o_result
  5928. non_pic_object=$xdir$func_lo2o_result
  5929. func_append libobjs " $pic_object"
  5930. func_append non_pic_objects " $non_pic_object"
  5931. else
  5932. func_fatal_error "'$arg' is not a valid libtool object"
  5933. fi
  5934. fi
  5935. done
  5936. else
  5937. func_fatal_error "link input file '$arg' does not exist"
  5938. fi
  5939. arg=$save_arg
  5940. prev=
  5941. continue
  5942. ;;
  5943. os2dllname)
  5944. os2dllname=$arg
  5945. prev=
  5946. continue
  5947. ;;
  5948. precious_regex)
  5949. precious_files_regex=$arg
  5950. prev=
  5951. continue
  5952. ;;
  5953. release)
  5954. release=-$arg
  5955. prev=
  5956. continue
  5957. ;;
  5958. rpath | xrpath)
  5959. # We need an absolute path.
  5960. case $arg in
  5961. [\\/]* | [A-Za-z]:[\\/]*) ;;
  5962. *)
  5963. func_fatal_error "only absolute run-paths are allowed"
  5964. ;;
  5965. esac
  5966. if test rpath = "$prev"; then
  5967. case "$rpath " in
  5968. *" $arg "*) ;;
  5969. *) func_append rpath " $arg" ;;
  5970. esac
  5971. else
  5972. case "$xrpath " in
  5973. *" $arg "*) ;;
  5974. *) func_append xrpath " $arg" ;;
  5975. esac
  5976. fi
  5977. prev=
  5978. continue
  5979. ;;
  5980. shrext)
  5981. shrext_cmds=$arg
  5982. prev=
  5983. continue
  5984. ;;
  5985. weak)
  5986. func_append weak_libs " $arg"
  5987. prev=
  5988. continue
  5989. ;;
  5990. xcclinker)
  5991. func_append linker_flags " $qarg"
  5992. func_append compiler_flags " $qarg"
  5993. prev=
  5994. func_append compile_command " $qarg"
  5995. func_append finalize_command " $qarg"
  5996. continue
  5997. ;;
  5998. xcompiler)
  5999. func_append compiler_flags " $qarg"
  6000. prev=
  6001. func_append compile_command " $qarg"
  6002. func_append finalize_command " $qarg"
  6003. continue
  6004. ;;
  6005. xlinker)
  6006. func_append linker_flags " $qarg"
  6007. func_append compiler_flags " $wl$qarg"
  6008. prev=
  6009. func_append compile_command " $wl$qarg"
  6010. func_append finalize_command " $wl$qarg"
  6011. continue
  6012. ;;
  6013. *)
  6014. eval "$prev=\"\$arg\""
  6015. prev=
  6016. continue
  6017. ;;
  6018. esac
  6019. fi # test -n "$prev"
  6020. prevarg=$arg
  6021. case $arg in
  6022. -all-static)
  6023. if test -n "$link_static_flag"; then
  6024. # See comment for -static flag below, for more details.
  6025. func_append compile_command " $link_static_flag"
  6026. func_append finalize_command " $link_static_flag"
  6027. fi
  6028. continue
  6029. ;;
  6030. -allow-undefined)
  6031. # FIXME: remove this flag sometime in the future.
  6032. func_fatal_error "'-allow-undefined' must not be used because it is the default"
  6033. ;;
  6034. -avoid-version)
  6035. avoid_version=yes
  6036. continue
  6037. ;;
  6038. -bindir)
  6039. prev=bindir
  6040. continue
  6041. ;;
  6042. -dlopen)
  6043. prev=dlfiles
  6044. continue
  6045. ;;
  6046. -dlpreopen)
  6047. prev=dlprefiles
  6048. continue
  6049. ;;
  6050. -export-dynamic)
  6051. export_dynamic=yes
  6052. continue
  6053. ;;
  6054. -export-symbols | -export-symbols-regex)
  6055. if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
  6056. func_fatal_error "more than one -exported-symbols argument is not allowed"
  6057. fi
  6058. if test X-export-symbols = "X$arg"; then
  6059. prev=expsyms
  6060. else
  6061. prev=expsyms_regex
  6062. fi
  6063. continue
  6064. ;;
  6065. -framework)
  6066. prev=framework
  6067. continue
  6068. ;;
  6069. -inst-prefix-dir)
  6070. prev=inst_prefix
  6071. continue
  6072. ;;
  6073. # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
  6074. # so, if we see these flags be careful not to treat them like -L
  6075. -L[A-Z][A-Z]*:*)
  6076. case $with_gcc/$host in
  6077. no/*-*-irix* | /*-*-irix*)
  6078. func_append compile_command " $arg"
  6079. func_append finalize_command " $arg"
  6080. ;;
  6081. esac
  6082. continue
  6083. ;;
  6084. -L*)
  6085. func_stripname "-L" '' "$arg"
  6086. if test -z "$func_stripname_result"; then
  6087. if test "$#" -gt 0; then
  6088. func_fatal_error "require no space between '-L' and '$1'"
  6089. else
  6090. func_fatal_error "need path for '-L' option"
  6091. fi
  6092. fi
  6093. func_resolve_sysroot "$func_stripname_result"
  6094. dir=$func_resolve_sysroot_result
  6095. # We need an absolute path.
  6096. case $dir in
  6097. [\\/]* | [A-Za-z]:[\\/]*) ;;
  6098. *)
  6099. absdir=`cd "$dir" && pwd`
  6100. test -z "$absdir" && \
  6101. func_fatal_error "cannot determine absolute directory name of '$dir'"
  6102. dir=$absdir
  6103. ;;
  6104. esac
  6105. case "$deplibs " in
  6106. *" -L$dir "* | *" $arg "*)
  6107. # Will only happen for absolute or sysroot arguments
  6108. ;;
  6109. *)
  6110. # Preserve sysroot, but never include relative directories
  6111. case $dir in
  6112. [\\/]* | [A-Za-z]:[\\/]* | =*) func_append deplibs " $arg" ;;
  6113. *) func_append deplibs " -L$dir" ;;
  6114. esac
  6115. func_append lib_search_path " $dir"
  6116. ;;
  6117. esac
  6118. case $host in
  6119. *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
  6120. testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'`
  6121. case :$dllsearchpath: in
  6122. *":$dir:"*) ;;
  6123. ::) dllsearchpath=$dir;;
  6124. *) func_append dllsearchpath ":$dir";;
  6125. esac
  6126. case :$dllsearchpath: in
  6127. *":$testbindir:"*) ;;
  6128. ::) dllsearchpath=$testbindir;;
  6129. *) func_append dllsearchpath ":$testbindir";;
  6130. esac
  6131. ;;
  6132. esac
  6133. continue
  6134. ;;
  6135. -l*)
  6136. if test X-lc = "X$arg" || test X-lm = "X$arg"; then
  6137. case $host in
  6138. *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*)
  6139. # These systems don't actually have a C or math library (as such)
  6140. continue
  6141. ;;
  6142. *-*-os2*)
  6143. # These systems don't actually have a C library (as such)
  6144. test X-lc = "X$arg" && continue
  6145. ;;
  6146. *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig*)
  6147. # Do not include libc due to us having libc/libc_r.
  6148. test X-lc = "X$arg" && continue
  6149. ;;
  6150. *-*-rhapsody* | *-*-darwin1.[012])
  6151. # Rhapsody C and math libraries are in the System framework
  6152. func_append deplibs " System.ltframework"
  6153. continue
  6154. ;;
  6155. *-*-sco3.2v5* | *-*-sco5v6*)
  6156. # Causes problems with __ctype
  6157. test X-lc = "X$arg" && continue
  6158. ;;
  6159. *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
  6160. # Compiler inserts libc in the correct place for threads to work
  6161. test X-lc = "X$arg" && continue
  6162. ;;
  6163. esac
  6164. elif test X-lc_r = "X$arg"; then
  6165. case $host in
  6166. *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig*)
  6167. # Do not include libc_r directly, use -pthread flag.
  6168. continue
  6169. ;;
  6170. esac
  6171. fi
  6172. func_append deplibs " $arg"
  6173. continue
  6174. ;;
  6175. -mllvm)
  6176. prev=mllvm
  6177. continue
  6178. ;;
  6179. -module)
  6180. module=yes
  6181. continue
  6182. ;;
  6183. # Tru64 UNIX uses -model [arg] to determine the layout of C++
  6184. # classes, name mangling, and exception handling.
  6185. # Darwin uses the -arch flag to determine output architecture.
  6186. -model|-arch|-isysroot|--sysroot)
  6187. func_append compiler_flags " $arg"
  6188. func_append compile_command " $arg"
  6189. func_append finalize_command " $arg"
  6190. prev=xcompiler
  6191. continue
  6192. ;;
  6193. -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
  6194. |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
  6195. func_append compiler_flags " $arg"
  6196. func_append compile_command " $arg"
  6197. func_append finalize_command " $arg"
  6198. case "$new_inherited_linker_flags " in
  6199. *" $arg "*) ;;
  6200. * ) func_append new_inherited_linker_flags " $arg" ;;
  6201. esac
  6202. continue
  6203. ;;
  6204. -multi_module)
  6205. single_module=$wl-multi_module
  6206. continue
  6207. ;;
  6208. -no-fast-install)
  6209. fast_install=no
  6210. continue
  6211. ;;
  6212. -no-install)
  6213. case $host in
  6214. *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*)
  6215. # The PATH hackery in wrapper scripts is required on Windows
  6216. # and Darwin in order for the loader to find any dlls it needs.
  6217. func_warning "'-no-install' is ignored for $host"
  6218. func_warning "assuming '-no-fast-install' instead"
  6219. fast_install=no
  6220. ;;
  6221. *) no_install=yes ;;
  6222. esac
  6223. continue
  6224. ;;
  6225. -no-undefined)
  6226. allow_undefined=no
  6227. continue
  6228. ;;
  6229. -objectlist)
  6230. prev=objectlist
  6231. continue
  6232. ;;
  6233. -os2dllname)
  6234. prev=os2dllname
  6235. continue
  6236. ;;
  6237. -o) prev=output ;;
  6238. -precious-files-regex)
  6239. prev=precious_regex
  6240. continue
  6241. ;;
  6242. -release)
  6243. prev=release
  6244. continue
  6245. ;;
  6246. -rpath)
  6247. prev=rpath
  6248. continue
  6249. ;;
  6250. -R)
  6251. prev=xrpath
  6252. continue
  6253. ;;
  6254. -R*)
  6255. func_stripname '-R' '' "$arg"
  6256. dir=$func_stripname_result
  6257. # We need an absolute path.
  6258. case $dir in
  6259. [\\/]* | [A-Za-z]:[\\/]*) ;;
  6260. =*)
  6261. func_stripname '=' '' "$dir"
  6262. dir=$lt_sysroot$func_stripname_result
  6263. ;;
  6264. *)
  6265. func_fatal_error "only absolute run-paths are allowed"
  6266. ;;
  6267. esac
  6268. case "$xrpath " in
  6269. *" $dir "*) ;;
  6270. *) func_append xrpath " $dir" ;;
  6271. esac
  6272. continue
  6273. ;;
  6274. -shared)
  6275. # The effects of -shared are defined in a previous loop.
  6276. continue
  6277. ;;
  6278. -shrext)
  6279. prev=shrext
  6280. continue
  6281. ;;
  6282. -static | -static-libtool-libs)
  6283. # The effects of -static are defined in a previous loop.
  6284. # We used to do the same as -all-static on platforms that
  6285. # didn't have a PIC flag, but the assumption that the effects
  6286. # would be equivalent was wrong. It would break on at least
  6287. # Digital Unix and AIX.
  6288. continue
  6289. ;;
  6290. -thread-safe)
  6291. thread_safe=yes
  6292. continue
  6293. ;;
  6294. -version-info)
  6295. prev=vinfo
  6296. continue
  6297. ;;
  6298. -version-number)
  6299. prev=vinfo
  6300. vinfo_number=yes
  6301. continue
  6302. ;;
  6303. -weak)
  6304. prev=weak
  6305. continue
  6306. ;;
  6307. -Wc,*)
  6308. func_stripname '-Wc,' '' "$arg"
  6309. args=$func_stripname_result
  6310. arg=
  6311. save_ifs=$IFS; IFS=,
  6312. for flag in $args; do
  6313. IFS=$save_ifs
  6314. func_quote_for_eval "$flag"
  6315. func_append arg " $func_quote_for_eval_result"
  6316. func_append compiler_flags " $func_quote_for_eval_result"
  6317. done
  6318. IFS=$save_ifs
  6319. func_stripname ' ' '' "$arg"
  6320. arg=$func_stripname_result
  6321. ;;
  6322. -Wl,*)
  6323. func_stripname '-Wl,' '' "$arg"
  6324. args=$func_stripname_result
  6325. arg=
  6326. save_ifs=$IFS; IFS=,
  6327. for flag in $args; do
  6328. IFS=$save_ifs
  6329. func_quote_for_eval "$flag"
  6330. func_append arg " $wl$func_quote_for_eval_result"
  6331. func_append compiler_flags " $wl$func_quote_for_eval_result"
  6332. func_append linker_flags " $func_quote_for_eval_result"
  6333. done
  6334. IFS=$save_ifs
  6335. func_stripname ' ' '' "$arg"
  6336. arg=$func_stripname_result
  6337. ;;
  6338. -Xcompiler)
  6339. prev=xcompiler
  6340. continue
  6341. ;;
  6342. -Xlinker)
  6343. prev=xlinker
  6344. continue
  6345. ;;
  6346. -XCClinker)
  6347. prev=xcclinker
  6348. continue
  6349. ;;
  6350. # -msg_* for osf cc
  6351. -msg_*)
  6352. func_quote_for_eval "$arg"
  6353. arg=$func_quote_for_eval_result
  6354. ;;
  6355. # Flags to be passed through unchanged, with rationale:
  6356. # -64, -mips[0-9] enable 64-bit mode for the SGI compiler
  6357. # -r[0-9][0-9]* specify processor for the SGI compiler
  6358. # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler
  6359. # +DA*, +DD* enable 64-bit mode for the HP compiler
  6360. # -q* compiler args for the IBM compiler
  6361. # -m*, -t[45]*, -txscale* architecture-specific flags for GCC
  6362. # -F/path path to uninstalled frameworks, gcc on darwin
  6363. # -p, -pg, --coverage, -fprofile-* profiling flags for GCC
  6364. # -fstack-protector* stack protector flags for GCC
  6365. # @file GCC response files
  6366. # -tp=* Portland pgcc target processor selection
  6367. # --sysroot=* for sysroot support
  6368. # -O*, -g*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization
  6369. # -specs=* GCC specs files
  6370. # -stdlib=* select c++ std lib with clang
  6371. # -fsanitize=* Clang/GCC memory and address sanitizer
  6372. # -fuse-ld=* Linker select flags for GCC
  6373. # -static-* direct GCC to link specific libraries statically
  6374. # -fcilkplus Cilk Plus language extension features for C/C++
  6375. -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
  6376. -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \
  6377. -O*|-g*|-flto*|-fwhopr*|-fuse-linker-plugin|-fstack-protector*|-stdlib=*| \
  6378. -specs=*|-fsanitize=*|-fuse-ld=*|-static-*|-fcilkplus)
  6379. func_quote_for_eval "$arg"
  6380. arg=$func_quote_for_eval_result
  6381. func_append compile_command " $arg"
  6382. func_append finalize_command " $arg"
  6383. func_append compiler_flags " $arg"
  6384. continue
  6385. ;;
  6386. -Z*)
  6387. if test os2 = "`expr $host : '.*\(os2\)'`"; then
  6388. # OS/2 uses -Zxxx to specify OS/2-specific options
  6389. compiler_flags="$compiler_flags $arg"
  6390. func_append compile_command " $arg"
  6391. func_append finalize_command " $arg"
  6392. case $arg in
  6393. -Zlinker | -Zstack)
  6394. prev=xcompiler
  6395. ;;
  6396. esac
  6397. continue
  6398. else
  6399. # Otherwise treat like 'Some other compiler flag' below
  6400. func_quote_for_eval "$arg"
  6401. arg=$func_quote_for_eval_result
  6402. fi
  6403. ;;
  6404. # Some other compiler flag.
  6405. -* | +*)
  6406. func_quote_for_eval "$arg"
  6407. arg=$func_quote_for_eval_result
  6408. ;;
  6409. *.$objext)
  6410. # A standard object.
  6411. func_append objs " $arg"
  6412. ;;
  6413. *.lo)
  6414. # A libtool-controlled object.
  6415. # Check to see that this really is a libtool object.
  6416. if func_lalib_unsafe_p "$arg"; then
  6417. pic_object=
  6418. non_pic_object=
  6419. # Read the .lo file
  6420. func_source "$arg"
  6421. if test -z "$pic_object" ||
  6422. test -z "$non_pic_object" ||
  6423. test none = "$pic_object" &&
  6424. test none = "$non_pic_object"; then
  6425. func_fatal_error "cannot find name of object for '$arg'"
  6426. fi
  6427. # Extract subdirectory from the argument.
  6428. func_dirname "$arg" "/" ""
  6429. xdir=$func_dirname_result
  6430. test none = "$pic_object" || {
  6431. # Prepend the subdirectory the object is found in.
  6432. pic_object=$xdir$pic_object
  6433. if test dlfiles = "$prev"; then
  6434. if test yes = "$build_libtool_libs" && test yes = "$dlopen_support"; then
  6435. func_append dlfiles " $pic_object"
  6436. prev=
  6437. continue
  6438. else
  6439. # If libtool objects are unsupported, then we need to preload.
  6440. prev=dlprefiles
  6441. fi
  6442. fi
  6443. # CHECK ME: I think I busted this. -Ossama
  6444. if test dlprefiles = "$prev"; then
  6445. # Preload the old-style object.
  6446. func_append dlprefiles " $pic_object"
  6447. prev=
  6448. fi
  6449. # A PIC object.
  6450. func_append libobjs " $pic_object"
  6451. arg=$pic_object
  6452. }
  6453. # Non-PIC object.
  6454. if test none != "$non_pic_object"; then
  6455. # Prepend the subdirectory the object is found in.
  6456. non_pic_object=$xdir$non_pic_object
  6457. # A standard non-PIC object
  6458. func_append non_pic_objects " $non_pic_object"
  6459. if test -z "$pic_object" || test none = "$pic_object"; then
  6460. arg=$non_pic_object
  6461. fi
  6462. else
  6463. # If the PIC object exists, use it instead.
  6464. # $xdir was prepended to $pic_object above.
  6465. non_pic_object=$pic_object
  6466. func_append non_pic_objects " $non_pic_object"
  6467. fi
  6468. else
  6469. # Only an error if not doing a dry-run.
  6470. if $opt_dry_run; then
  6471. # Extract subdirectory from the argument.
  6472. func_dirname "$arg" "/" ""
  6473. xdir=$func_dirname_result
  6474. func_lo2o "$arg"
  6475. pic_object=$xdir$objdir/$func_lo2o_result
  6476. non_pic_object=$xdir$func_lo2o_result
  6477. func_append libobjs " $pic_object"
  6478. func_append non_pic_objects " $non_pic_object"
  6479. else
  6480. func_fatal_error "'$arg' is not a valid libtool object"
  6481. fi
  6482. fi
  6483. ;;
  6484. *.$libext)
  6485. # An archive.
  6486. func_append deplibs " $arg"
  6487. func_append old_deplibs " $arg"
  6488. continue
  6489. ;;
  6490. *.la)
  6491. # A libtool-controlled library.
  6492. func_resolve_sysroot "$arg"
  6493. if test dlfiles = "$prev"; then
  6494. # This library was specified with -dlopen.
  6495. func_append dlfiles " $func_resolve_sysroot_result"
  6496. prev=
  6497. elif test dlprefiles = "$prev"; then
  6498. # The library was specified with -dlpreopen.
  6499. func_append dlprefiles " $func_resolve_sysroot_result"
  6500. prev=
  6501. else
  6502. func_append deplibs " $func_resolve_sysroot_result"
  6503. fi
  6504. continue
  6505. ;;
  6506. # Some other compiler argument.
  6507. *)
  6508. # Unknown arguments in both finalize_command and compile_command need
  6509. # to be aesthetically quoted because they are evaled later.
  6510. func_quote_for_eval "$arg"
  6511. arg=$func_quote_for_eval_result
  6512. ;;
  6513. esac # arg
  6514. # Now actually substitute the argument into the commands.
  6515. if test -n "$arg"; then
  6516. func_append compile_command " $arg"
  6517. func_append finalize_command " $arg"
  6518. fi
  6519. done # argument parsing loop
  6520. test -n "$prev" && \
  6521. func_fatal_help "the '$prevarg' option requires an argument"
  6522. if test yes = "$export_dynamic" && test -n "$export_dynamic_flag_spec"; then
  6523. eval arg=\"$export_dynamic_flag_spec\"
  6524. func_append compile_command " $arg"
  6525. func_append finalize_command " $arg"
  6526. fi
  6527. oldlibs=
  6528. # calculate the name of the file, without its directory
  6529. func_basename "$output"
  6530. outputname=$func_basename_result
  6531. libobjs_save=$libobjs
  6532. if test -n "$shlibpath_var"; then
  6533. # get the directories listed in $shlibpath_var
  6534. eval shlib_search_path=\`\$ECHO \"\$$shlibpath_var\" \| \$SED \'s/:/ /g\'\`
  6535. else
  6536. shlib_search_path=
  6537. fi
  6538. eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
  6539. eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
  6540. # Definition is injected by LT_CONFIG during libtool generation.
  6541. func_munge_path_list sys_lib_dlsearch_path "$LT_SYS_LIBRARY_PATH"
  6542. func_dirname "$output" "/" ""
  6543. output_objdir=$func_dirname_result$objdir
  6544. func_to_tool_file "$output_objdir/"
  6545. tool_output_objdir=$func_to_tool_file_result
  6546. # Create the object directory.
  6547. func_mkdir_p "$output_objdir"
  6548. # Determine the type of output
  6549. case $output in
  6550. "")
  6551. func_fatal_help "you must specify an output file"
  6552. ;;
  6553. *.$libext) linkmode=oldlib ;;
  6554. *.lo | *.$objext) linkmode=obj ;;
  6555. *.la) linkmode=lib ;;
  6556. *) linkmode=prog ;; # Anything else should be a program.
  6557. esac
  6558. specialdeplibs=
  6559. libs=
  6560. # Find all interdependent deplibs by searching for libraries
  6561. # that are linked more than once (e.g. -la -lb -la)
  6562. for deplib in $deplibs; do
  6563. if $opt_preserve_dup_deps; then
  6564. case "$libs " in
  6565. *" $deplib "*) func_append specialdeplibs " $deplib" ;;
  6566. esac
  6567. fi
  6568. func_append libs " $deplib"
  6569. done
  6570. if test lib = "$linkmode"; then
  6571. libs="$predeps $libs $compiler_lib_search_path $postdeps"
  6572. # Compute libraries that are listed more than once in $predeps
  6573. # $postdeps and mark them as special (i.e., whose duplicates are
  6574. # not to be eliminated).
  6575. pre_post_deps=
  6576. if $opt_duplicate_compiler_generated_deps; then
  6577. for pre_post_dep in $predeps $postdeps; do
  6578. case "$pre_post_deps " in
  6579. *" $pre_post_dep "*) func_append specialdeplibs " $pre_post_deps" ;;
  6580. esac
  6581. func_append pre_post_deps " $pre_post_dep"
  6582. done
  6583. fi
  6584. pre_post_deps=
  6585. fi
  6586. deplibs=
  6587. newdependency_libs=
  6588. newlib_search_path=
  6589. need_relink=no # whether we're linking any uninstalled libtool libraries
  6590. notinst_deplibs= # not-installed libtool libraries
  6591. notinst_path= # paths that contain not-installed libtool libraries
  6592. case $linkmode in
  6593. lib)
  6594. passes="conv dlpreopen link"
  6595. for file in $dlfiles $dlprefiles; do
  6596. case $file in
  6597. *.la) ;;
  6598. *)
  6599. func_fatal_help "libraries can '-dlopen' only libtool libraries: $file"
  6600. ;;
  6601. esac
  6602. done
  6603. ;;
  6604. prog)
  6605. compile_deplibs=
  6606. finalize_deplibs=
  6607. alldeplibs=false
  6608. newdlfiles=
  6609. newdlprefiles=
  6610. passes="conv scan dlopen dlpreopen link"
  6611. ;;
  6612. *) passes="conv"
  6613. ;;
  6614. esac
  6615. for pass in $passes; do
  6616. # The preopen pass in lib mode reverses $deplibs; put it back here
  6617. # so that -L comes before libs that need it for instance...
  6618. if test lib,link = "$linkmode,$pass"; then
  6619. ## FIXME: Find the place where the list is rebuilt in the wrong
  6620. ## order, and fix it there properly
  6621. tmp_deplibs=
  6622. for deplib in $deplibs; do
  6623. tmp_deplibs="$deplib $tmp_deplibs"
  6624. done
  6625. deplibs=$tmp_deplibs
  6626. fi
  6627. if test lib,link = "$linkmode,$pass" ||
  6628. test prog,scan = "$linkmode,$pass"; then
  6629. libs=$deplibs
  6630. deplibs=
  6631. fi
  6632. if test prog = "$linkmode"; then
  6633. case $pass in
  6634. dlopen) libs=$dlfiles ;;
  6635. dlpreopen) libs=$dlprefiles ;;
  6636. link)
  6637. libs="$deplibs %DEPLIBS%"
  6638. test "X$link_all_deplibs" != Xno && libs="$libs $dependency_libs"
  6639. ;;
  6640. esac
  6641. fi
  6642. if test lib,dlpreopen = "$linkmode,$pass"; then
  6643. # Collect and forward deplibs of preopened libtool libs
  6644. for lib in $dlprefiles; do
  6645. # Ignore non-libtool-libs
  6646. dependency_libs=
  6647. func_resolve_sysroot "$lib"
  6648. case $lib in
  6649. *.la) func_source "$func_resolve_sysroot_result" ;;
  6650. esac
  6651. # Collect preopened libtool deplibs, except any this library
  6652. # has declared as weak libs
  6653. for deplib in $dependency_libs; do
  6654. func_basename "$deplib"
  6655. deplib_base=$func_basename_result
  6656. case " $weak_libs " in
  6657. *" $deplib_base "*) ;;
  6658. *) func_append deplibs " $deplib" ;;
  6659. esac
  6660. done
  6661. done
  6662. libs=$dlprefiles
  6663. fi
  6664. if test dlopen = "$pass"; then
  6665. # Collect dlpreopened libraries
  6666. save_deplibs=$deplibs
  6667. deplibs=
  6668. fi
  6669. for deplib in $libs; do
  6670. lib=
  6671. found=false
  6672. case $deplib in
  6673. -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
  6674. |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
  6675. if test prog,link = "$linkmode,$pass"; then
  6676. compile_deplibs="$deplib $compile_deplibs"
  6677. finalize_deplibs="$deplib $finalize_deplibs"
  6678. else
  6679. func_append compiler_flags " $deplib"
  6680. if test lib = "$linkmode"; then
  6681. case "$new_inherited_linker_flags " in
  6682. *" $deplib "*) ;;
  6683. * ) func_append new_inherited_linker_flags " $deplib" ;;
  6684. esac
  6685. fi
  6686. fi
  6687. continue
  6688. ;;
  6689. -l*)
  6690. if test lib != "$linkmode" && test prog != "$linkmode"; then
  6691. func_warning "'-l' is ignored for archives/objects"
  6692. continue
  6693. fi
  6694. func_stripname '-l' '' "$deplib"
  6695. name=$func_stripname_result
  6696. if test lib = "$linkmode"; then
  6697. searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path"
  6698. else
  6699. searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path"
  6700. fi
  6701. for searchdir in $searchdirs; do
  6702. for search_ext in .la $std_shrext .so .a; do
  6703. # Search the libtool library
  6704. lib=$searchdir/lib$name$search_ext
  6705. if test -f "$lib"; then
  6706. if test .la = "$search_ext"; then
  6707. found=:
  6708. else
  6709. found=false
  6710. fi
  6711. break 2
  6712. fi
  6713. done
  6714. done
  6715. if $found; then
  6716. # deplib is a libtool library
  6717. # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
  6718. # We need to do some special things here, and not later.
  6719. if test yes = "$allow_libtool_libs_with_static_runtimes"; then
  6720. case " $predeps $postdeps " in
  6721. *" $deplib "*)
  6722. if func_lalib_p "$lib"; then
  6723. library_names=
  6724. old_library=
  6725. func_source "$lib"
  6726. for l in $old_library $library_names; do
  6727. ll=$l
  6728. done
  6729. if test "X$ll" = "X$old_library"; then # only static version available
  6730. found=false
  6731. func_dirname "$lib" "" "."
  6732. ladir=$func_dirname_result
  6733. lib=$ladir/$old_library
  6734. if test prog,link = "$linkmode,$pass"; then
  6735. compile_deplibs="$deplib $compile_deplibs"
  6736. finalize_deplibs="$deplib $finalize_deplibs"
  6737. else
  6738. deplibs="$deplib $deplibs"
  6739. test lib = "$linkmode" && newdependency_libs="$deplib $newdependency_libs"
  6740. fi
  6741. continue
  6742. fi
  6743. fi
  6744. ;;
  6745. *) ;;
  6746. esac
  6747. fi
  6748. else
  6749. # deplib doesn't seem to be a libtool library
  6750. if test prog,link = "$linkmode,$pass"; then
  6751. compile_deplibs="$deplib $compile_deplibs"
  6752. finalize_deplibs="$deplib $finalize_deplibs"
  6753. else
  6754. deplibs="$deplib $deplibs"
  6755. test lib = "$linkmode" && newdependency_libs="$deplib $newdependency_libs"
  6756. fi
  6757. continue
  6758. fi
  6759. ;; # -l
  6760. *.ltframework)
  6761. if test prog,link = "$linkmode,$pass"; then
  6762. compile_deplibs="$deplib $compile_deplibs"
  6763. finalize_deplibs="$deplib $finalize_deplibs"
  6764. else
  6765. deplibs="$deplib $deplibs"
  6766. if test lib = "$linkmode"; then
  6767. case "$new_inherited_linker_flags " in
  6768. *" $deplib "*) ;;
  6769. * ) func_append new_inherited_linker_flags " $deplib" ;;
  6770. esac
  6771. fi
  6772. fi
  6773. continue
  6774. ;;
  6775. -L*)
  6776. case $linkmode in
  6777. lib)
  6778. deplibs="$deplib $deplibs"
  6779. test conv = "$pass" && continue
  6780. newdependency_libs="$deplib $newdependency_libs"
  6781. func_stripname '-L' '' "$deplib"
  6782. func_resolve_sysroot "$func_stripname_result"
  6783. func_append newlib_search_path " $func_resolve_sysroot_result"
  6784. ;;
  6785. prog)
  6786. if test conv = "$pass"; then
  6787. deplibs="$deplib $deplibs"
  6788. continue
  6789. fi
  6790. if test scan = "$pass"; then
  6791. deplibs="$deplib $deplibs"
  6792. else
  6793. compile_deplibs="$deplib $compile_deplibs"
  6794. finalize_deplibs="$deplib $finalize_deplibs"
  6795. fi
  6796. func_stripname '-L' '' "$deplib"
  6797. func_resolve_sysroot "$func_stripname_result"
  6798. func_append newlib_search_path " $func_resolve_sysroot_result"
  6799. ;;
  6800. *)
  6801. func_warning "'-L' is ignored for archives/objects"
  6802. ;;
  6803. esac # linkmode
  6804. continue
  6805. ;; # -L
  6806. -R*)
  6807. if test link = "$pass"; then
  6808. func_stripname '-R' '' "$deplib"
  6809. func_resolve_sysroot "$func_stripname_result"
  6810. dir=$func_resolve_sysroot_result
  6811. # Make sure the xrpath contains only unique directories.
  6812. case "$xrpath " in
  6813. *" $dir "*) ;;
  6814. *) func_append xrpath " $dir" ;;
  6815. esac
  6816. fi
  6817. deplibs="$deplib $deplibs"
  6818. continue
  6819. ;;
  6820. *.la)
  6821. func_resolve_sysroot "$deplib"
  6822. lib=$func_resolve_sysroot_result
  6823. ;;
  6824. *.$libext)
  6825. if test conv = "$pass"; then
  6826. deplibs="$deplib $deplibs"
  6827. continue
  6828. fi
  6829. case $linkmode in
  6830. lib)
  6831. # Linking convenience modules into shared libraries is allowed,
  6832. # but linking other static libraries is non-portable.
  6833. case " $dlpreconveniencelibs " in
  6834. *" $deplib "*) ;;
  6835. *)
  6836. valid_a_lib=false
  6837. case $deplibs_check_method in
  6838. match_pattern*)
  6839. set dummy $deplibs_check_method; shift
  6840. match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
  6841. if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \
  6842. | $EGREP "$match_pattern_regex" > /dev/null; then
  6843. valid_a_lib=:
  6844. fi
  6845. ;;
  6846. pass_all)
  6847. valid_a_lib=:
  6848. ;;
  6849. esac
  6850. if $valid_a_lib; then
  6851. echo
  6852. $ECHO "*** Warning: Linking the shared library $output against the"
  6853. $ECHO "*** static library $deplib is not portable!"
  6854. deplibs="$deplib $deplibs"
  6855. else
  6856. echo
  6857. $ECHO "*** Warning: Trying to link with static lib archive $deplib."
  6858. echo "*** I have the capability to make that library automatically link in when"
  6859. echo "*** you link to this library. But I can only do this if you have a"
  6860. echo "*** shared version of the library, which you do not appear to have"
  6861. echo "*** because the file extensions .$libext of this argument makes me believe"
  6862. echo "*** that it is just a static archive that I should not use here."
  6863. fi
  6864. ;;
  6865. esac
  6866. continue
  6867. ;;
  6868. prog)
  6869. if test link != "$pass"; then
  6870. deplibs="$deplib $deplibs"
  6871. else
  6872. compile_deplibs="$deplib $compile_deplibs"
  6873. finalize_deplibs="$deplib $finalize_deplibs"
  6874. fi
  6875. continue
  6876. ;;
  6877. esac # linkmode
  6878. ;; # *.$libext
  6879. *.lo | *.$objext)
  6880. if test conv = "$pass"; then
  6881. deplibs="$deplib $deplibs"
  6882. elif test prog = "$linkmode"; then
  6883. if test dlpreopen = "$pass" || test yes != "$dlopen_support" || test no = "$build_libtool_libs"; then
  6884. # If there is no dlopen support or we're linking statically,
  6885. # we need to preload.
  6886. func_append newdlprefiles " $deplib"
  6887. compile_deplibs="$deplib $compile_deplibs"
  6888. finalize_deplibs="$deplib $finalize_deplibs"
  6889. else
  6890. func_append newdlfiles " $deplib"
  6891. fi
  6892. fi
  6893. continue
  6894. ;;
  6895. %DEPLIBS%)
  6896. alldeplibs=:
  6897. continue
  6898. ;;
  6899. esac # case $deplib
  6900. $found || test -f "$lib" \
  6901. || func_fatal_error "cannot find the library '$lib' or unhandled argument '$deplib'"
  6902. # Check to see that this really is a libtool archive.
  6903. func_lalib_unsafe_p "$lib" \
  6904. || func_fatal_error "'$lib' is not a valid libtool archive"
  6905. func_dirname "$lib" "" "."
  6906. ladir=$func_dirname_result
  6907. dlname=
  6908. dlopen=
  6909. dlpreopen=
  6910. libdir=
  6911. library_names=
  6912. old_library=
  6913. inherited_linker_flags=
  6914. # If the library was installed with an old release of libtool,
  6915. # it will not redefine variables installed, or shouldnotlink
  6916. installed=yes
  6917. shouldnotlink=no
  6918. avoidtemprpath=
  6919. # Read the .la file
  6920. func_source "$lib"
  6921. # Convert "-framework foo" to "foo.ltframework"
  6922. if test -n "$inherited_linker_flags"; then
  6923. tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'`
  6924. for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do
  6925. case " $new_inherited_linker_flags " in
  6926. *" $tmp_inherited_linker_flag "*) ;;
  6927. *) func_append new_inherited_linker_flags " $tmp_inherited_linker_flag";;
  6928. esac
  6929. done
  6930. fi
  6931. dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
  6932. if test lib,link = "$linkmode,$pass" ||
  6933. test prog,scan = "$linkmode,$pass" ||
  6934. { test prog != "$linkmode" && test lib != "$linkmode"; }; then
  6935. test -n "$dlopen" && func_append dlfiles " $dlopen"
  6936. test -n "$dlpreopen" && func_append dlprefiles " $dlpreopen"
  6937. fi
  6938. if test conv = "$pass"; then
  6939. # Only check for convenience libraries
  6940. deplibs="$lib $deplibs"
  6941. if test -z "$libdir"; then
  6942. if test -z "$old_library"; then
  6943. func_fatal_error "cannot find name of link library for '$lib'"
  6944. fi
  6945. # It is a libtool convenience library, so add in its objects.
  6946. func_append convenience " $ladir/$objdir/$old_library"
  6947. func_append old_convenience " $ladir/$objdir/$old_library"
  6948. tmp_libs=
  6949. for deplib in $dependency_libs; do
  6950. deplibs="$deplib $deplibs"
  6951. if $opt_preserve_dup_deps; then
  6952. case "$tmp_libs " in
  6953. *" $deplib "*) func_append specialdeplibs " $deplib" ;;
  6954. esac
  6955. fi
  6956. func_append tmp_libs " $deplib"
  6957. done
  6958. elif test prog != "$linkmode" && test lib != "$linkmode"; then
  6959. func_fatal_error "'$lib' is not a convenience library"
  6960. fi
  6961. continue
  6962. fi # $pass = conv
  6963. # Get the name of the library we link against.
  6964. linklib=
  6965. if test -n "$old_library" &&
  6966. { test yes = "$prefer_static_libs" ||
  6967. test built,no = "$prefer_static_libs,$installed"; }; then
  6968. linklib=$old_library
  6969. else
  6970. for l in $old_library $library_names; do
  6971. linklib=$l
  6972. done
  6973. fi
  6974. if test -z "$linklib"; then
  6975. func_fatal_error "cannot find name of link library for '$lib'"
  6976. fi
  6977. # This library was specified with -dlopen.
  6978. if test dlopen = "$pass"; then
  6979. test -z "$libdir" \
  6980. && func_fatal_error "cannot -dlopen a convenience library: '$lib'"
  6981. if test -z "$dlname" ||
  6982. test yes != "$dlopen_support" ||
  6983. test no = "$build_libtool_libs"
  6984. then
  6985. # If there is no dlname, no dlopen support or we're linking
  6986. # statically, we need to preload. We also need to preload any
  6987. # dependent libraries so libltdl's deplib preloader doesn't
  6988. # bomb out in the load deplibs phase.
  6989. func_append dlprefiles " $lib $dependency_libs"
  6990. else
  6991. func_append newdlfiles " $lib"
  6992. fi
  6993. continue
  6994. fi # $pass = dlopen
  6995. # We need an absolute path.
  6996. case $ladir in
  6997. [\\/]* | [A-Za-z]:[\\/]*) abs_ladir=$ladir ;;
  6998. *)
  6999. abs_ladir=`cd "$ladir" && pwd`
  7000. if test -z "$abs_ladir"; then
  7001. func_warning "cannot determine absolute directory name of '$ladir'"
  7002. func_warning "passing it literally to the linker, although it might fail"
  7003. abs_ladir=$ladir
  7004. fi
  7005. ;;
  7006. esac
  7007. func_basename "$lib"
  7008. laname=$func_basename_result
  7009. # Find the relevant object directory and library name.
  7010. if test yes = "$installed"; then
  7011. if test ! -f "$lt_sysroot$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
  7012. func_warning "library '$lib' was moved."
  7013. dir=$ladir
  7014. absdir=$abs_ladir
  7015. libdir=$abs_ladir
  7016. else
  7017. dir=$lt_sysroot$libdir
  7018. absdir=$lt_sysroot$libdir
  7019. fi
  7020. test yes = "$hardcode_automatic" && avoidtemprpath=yes
  7021. else
  7022. if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
  7023. dir=$ladir
  7024. absdir=$abs_ladir
  7025. # Remove this search path later
  7026. func_append notinst_path " $abs_ladir"
  7027. else
  7028. dir=$ladir/$objdir
  7029. absdir=$abs_ladir/$objdir
  7030. # Remove this search path later
  7031. func_append notinst_path " $abs_ladir"
  7032. fi
  7033. fi # $installed = yes
  7034. func_stripname 'lib' '.la' "$laname"
  7035. name=$func_stripname_result
  7036. # This library was specified with -dlpreopen.
  7037. if test dlpreopen = "$pass"; then
  7038. if test -z "$libdir" && test prog = "$linkmode"; then
  7039. func_fatal_error "only libraries may -dlpreopen a convenience library: '$lib'"
  7040. fi
  7041. case $host in
  7042. # special handling for platforms with PE-DLLs.
  7043. *cygwin* | *mingw* | *cegcc* )
  7044. # Linker will automatically link against shared library if both
  7045. # static and shared are present. Therefore, ensure we extract
  7046. # symbols from the import library if a shared library is present
  7047. # (otherwise, the dlopen module name will be incorrect). We do
  7048. # this by putting the import library name into $newdlprefiles.
  7049. # We recover the dlopen module name by 'saving' the la file
  7050. # name in a special purpose variable, and (later) extracting the
  7051. # dlname from the la file.
  7052. if test -n "$dlname"; then
  7053. func_tr_sh "$dir/$linklib"
  7054. eval "libfile_$func_tr_sh_result=\$abs_ladir/\$laname"
  7055. func_append newdlprefiles " $dir/$linklib"
  7056. else
  7057. func_append newdlprefiles " $dir/$old_library"
  7058. # Keep a list of preopened convenience libraries to check
  7059. # that they are being used correctly in the link pass.
  7060. test -z "$libdir" && \
  7061. func_append dlpreconveniencelibs " $dir/$old_library"
  7062. fi
  7063. ;;
  7064. * )
  7065. # Prefer using a static library (so that no silly _DYNAMIC symbols
  7066. # are required to link).
  7067. if test -n "$old_library"; then
  7068. func_append newdlprefiles " $dir/$old_library"
  7069. # Keep a list of preopened convenience libraries to check
  7070. # that they are being used correctly in the link pass.
  7071. test -z "$libdir" && \
  7072. func_append dlpreconveniencelibs " $dir/$old_library"
  7073. # Otherwise, use the dlname, so that lt_dlopen finds it.
  7074. elif test -n "$dlname"; then
  7075. func_append newdlprefiles " $dir/$dlname"
  7076. else
  7077. func_append newdlprefiles " $dir/$linklib"
  7078. fi
  7079. ;;
  7080. esac
  7081. fi # $pass = dlpreopen
  7082. if test -z "$libdir"; then
  7083. # Link the convenience library
  7084. if test lib = "$linkmode"; then
  7085. deplibs="$dir/$old_library $deplibs"
  7086. elif test prog,link = "$linkmode,$pass"; then
  7087. compile_deplibs="$dir/$old_library $compile_deplibs"
  7088. finalize_deplibs="$dir/$old_library $finalize_deplibs"
  7089. else
  7090. deplibs="$lib $deplibs" # used for prog,scan pass
  7091. fi
  7092. continue
  7093. fi
  7094. if test prog = "$linkmode" && test link != "$pass"; then
  7095. func_append newlib_search_path " $ladir"
  7096. deplibs="$lib $deplibs"
  7097. linkalldeplibs=false
  7098. if test no != "$link_all_deplibs" || test -z "$library_names" ||
  7099. test no = "$build_libtool_libs"; then
  7100. linkalldeplibs=:
  7101. fi
  7102. tmp_libs=
  7103. for deplib in $dependency_libs; do
  7104. case $deplib in
  7105. -L*) func_stripname '-L' '' "$deplib"
  7106. func_resolve_sysroot "$func_stripname_result"
  7107. func_append newlib_search_path " $func_resolve_sysroot_result"
  7108. ;;
  7109. esac
  7110. # Need to link against all dependency_libs?
  7111. if $linkalldeplibs; then
  7112. deplibs="$deplib $deplibs"
  7113. else
  7114. # Need to hardcode shared library paths
  7115. # or/and link against static libraries
  7116. newdependency_libs="$deplib $newdependency_libs"
  7117. fi
  7118. if $opt_preserve_dup_deps; then
  7119. case "$tmp_libs " in
  7120. *" $deplib "*) func_append specialdeplibs " $deplib" ;;
  7121. esac
  7122. fi
  7123. func_append tmp_libs " $deplib"
  7124. done # for deplib
  7125. continue
  7126. fi # $linkmode = prog...
  7127. if test prog,link = "$linkmode,$pass"; then
  7128. if test -n "$library_names" &&
  7129. { { test no = "$prefer_static_libs" ||
  7130. test built,yes = "$prefer_static_libs,$installed"; } ||
  7131. test -z "$old_library"; }; then
  7132. # We need to hardcode the library path
  7133. if test -n "$shlibpath_var" && test -z "$avoidtemprpath"; then
  7134. # Make sure the rpath contains only unique directories.
  7135. case $temp_rpath: in
  7136. *"$absdir:"*) ;;
  7137. *) func_append temp_rpath "$absdir:" ;;
  7138. esac
  7139. fi
  7140. # Hardcode the library path.
  7141. # Skip directories that are in the system default run-time
  7142. # search path.
  7143. case " $sys_lib_dlsearch_path " in
  7144. *" $absdir "*) ;;
  7145. *)
  7146. case "$compile_rpath " in
  7147. *" $absdir "*) ;;
  7148. *) func_append compile_rpath " $absdir" ;;
  7149. esac
  7150. ;;
  7151. esac
  7152. case " $sys_lib_dlsearch_path " in
  7153. *" $libdir "*) ;;
  7154. *)
  7155. case "$finalize_rpath " in
  7156. *" $libdir "*) ;;
  7157. *) func_append finalize_rpath " $libdir" ;;
  7158. esac
  7159. ;;
  7160. esac
  7161. fi # $linkmode,$pass = prog,link...
  7162. if $alldeplibs &&
  7163. { test pass_all = "$deplibs_check_method" ||
  7164. { test yes = "$build_libtool_libs" &&
  7165. test -n "$library_names"; }; }; then
  7166. # We only need to search for static libraries
  7167. continue
  7168. fi
  7169. fi
  7170. link_static=no # Whether the deplib will be linked statically
  7171. use_static_libs=$prefer_static_libs
  7172. if test built = "$use_static_libs" && test yes = "$installed"; then
  7173. use_static_libs=no
  7174. fi
  7175. if test -n "$library_names" &&
  7176. { test no = "$use_static_libs" || test -z "$old_library"; }; then
  7177. case $host in
  7178. *cygwin* | *mingw* | *cegcc* | *os2*)
  7179. # No point in relinking DLLs because paths are not encoded
  7180. func_append notinst_deplibs " $lib"
  7181. need_relink=no
  7182. ;;
  7183. *)
  7184. if test no = "$installed"; then
  7185. func_append notinst_deplibs " $lib"
  7186. need_relink=yes
  7187. fi
  7188. ;;
  7189. esac
  7190. # This is a shared library
  7191. # Warn about portability, can't link against -module's on some
  7192. # systems (darwin). Don't bleat about dlopened modules though!
  7193. dlopenmodule=
  7194. for dlpremoduletest in $dlprefiles; do
  7195. if test "X$dlpremoduletest" = "X$lib"; then
  7196. dlopenmodule=$dlpremoduletest
  7197. break
  7198. fi
  7199. done
  7200. if test -z "$dlopenmodule" && test yes = "$shouldnotlink" && test link = "$pass"; then
  7201. echo
  7202. if test prog = "$linkmode"; then
  7203. $ECHO "*** Warning: Linking the executable $output against the loadable module"
  7204. else
  7205. $ECHO "*** Warning: Linking the shared library $output against the loadable module"
  7206. fi
  7207. $ECHO "*** $linklib is not portable!"
  7208. fi
  7209. if test lib = "$linkmode" &&
  7210. test yes = "$hardcode_into_libs"; then
  7211. # Hardcode the library path.
  7212. # Skip directories that are in the system default run-time
  7213. # search path.
  7214. case " $sys_lib_dlsearch_path " in
  7215. *" $absdir "*) ;;
  7216. *)
  7217. case "$compile_rpath " in
  7218. *" $absdir "*) ;;
  7219. *) func_append compile_rpath " $absdir" ;;
  7220. esac
  7221. ;;
  7222. esac
  7223. case " $sys_lib_dlsearch_path " in
  7224. *" $libdir "*) ;;
  7225. *)
  7226. case "$finalize_rpath " in
  7227. *" $libdir "*) ;;
  7228. *) func_append finalize_rpath " $libdir" ;;
  7229. esac
  7230. ;;
  7231. esac
  7232. fi
  7233. if test -n "$old_archive_from_expsyms_cmds"; then
  7234. # figure out the soname
  7235. set dummy $library_names
  7236. shift
  7237. realname=$1
  7238. shift
  7239. libname=`eval "\\$ECHO \"$libname_spec\""`
  7240. # use dlname if we got it. it's perfectly good, no?
  7241. if test -n "$dlname"; then
  7242. soname=$dlname
  7243. elif test -n "$soname_spec"; then
  7244. # bleh windows
  7245. case $host in
  7246. *cygwin* | mingw* | *cegcc* | *os2*)
  7247. func_arith $current - $age
  7248. major=$func_arith_result
  7249. versuffix=-$major
  7250. ;;
  7251. esac
  7252. eval soname=\"$soname_spec\"
  7253. else
  7254. soname=$realname
  7255. fi
  7256. # Make a new name for the extract_expsyms_cmds to use
  7257. soroot=$soname
  7258. func_basename "$soroot"
  7259. soname=$func_basename_result
  7260. func_stripname 'lib' '.dll' "$soname"
  7261. newlib=libimp-$func_stripname_result.a
  7262. # If the library has no export list, then create one now
  7263. if test -f "$output_objdir/$soname-def"; then :
  7264. else
  7265. func_verbose "extracting exported symbol list from '$soname'"
  7266. func_execute_cmds "$extract_expsyms_cmds" 'exit $?'
  7267. fi
  7268. # Create $newlib
  7269. if test -f "$output_objdir/$newlib"; then :; else
  7270. func_verbose "generating import library for '$soname'"
  7271. func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?'
  7272. fi
  7273. # make sure the library variables are pointing to the new library
  7274. dir=$output_objdir
  7275. linklib=$newlib
  7276. fi # test -n "$old_archive_from_expsyms_cmds"
  7277. if test prog = "$linkmode" || test relink != "$opt_mode"; then
  7278. add_shlibpath=
  7279. add_dir=
  7280. add=
  7281. lib_linked=yes
  7282. case $hardcode_action in
  7283. immediate | unsupported)
  7284. if test no = "$hardcode_direct"; then
  7285. add=$dir/$linklib
  7286. case $host in
  7287. *-*-sco3.2v5.0.[024]*) add_dir=-L$dir ;;
  7288. *-*-sysv4*uw2*) add_dir=-L$dir ;;
  7289. *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
  7290. *-*-unixware7*) add_dir=-L$dir ;;
  7291. *-*-darwin* )
  7292. # if the lib is a (non-dlopened) module then we cannot
  7293. # link against it, someone is ignoring the earlier warnings
  7294. if /usr/bin/file -L $add 2> /dev/null |
  7295. $GREP ": [^:]* bundle" >/dev/null; then
  7296. if test "X$dlopenmodule" != "X$lib"; then
  7297. $ECHO "*** Warning: lib $linklib is a module, not a shared library"
  7298. if test -z "$old_library"; then
  7299. echo
  7300. echo "*** And there doesn't seem to be a static archive available"
  7301. echo "*** The link will probably fail, sorry"
  7302. else
  7303. add=$dir/$old_library
  7304. fi
  7305. elif test -n "$old_library"; then
  7306. add=$dir/$old_library
  7307. fi
  7308. fi
  7309. esac
  7310. elif test no = "$hardcode_minus_L"; then
  7311. case $host in
  7312. *-*-sunos*) add_shlibpath=$dir ;;
  7313. esac
  7314. add_dir=-L$dir
  7315. add=-l$name
  7316. elif test no = "$hardcode_shlibpath_var"; then
  7317. add_shlibpath=$dir
  7318. add=-l$name
  7319. else
  7320. lib_linked=no
  7321. fi
  7322. ;;
  7323. relink)
  7324. if test yes = "$hardcode_direct" &&
  7325. test no = "$hardcode_direct_absolute"; then
  7326. add=$dir/$linklib
  7327. elif test yes = "$hardcode_minus_L"; then
  7328. add_dir=-L$absdir
  7329. # Try looking first in the location we're being installed to.
  7330. if test -n "$inst_prefix_dir"; then
  7331. case $libdir in
  7332. [\\/]*)
  7333. func_append add_dir " -L$inst_prefix_dir$libdir"
  7334. ;;
  7335. esac
  7336. fi
  7337. add=-l$name
  7338. elif test yes = "$hardcode_shlibpath_var"; then
  7339. add_shlibpath=$dir
  7340. add=-l$name
  7341. else
  7342. lib_linked=no
  7343. fi
  7344. ;;
  7345. *) lib_linked=no ;;
  7346. esac
  7347. if test yes != "$lib_linked"; then
  7348. func_fatal_configuration "unsupported hardcode properties"
  7349. fi
  7350. if test -n "$add_shlibpath"; then
  7351. case :$compile_shlibpath: in
  7352. *":$add_shlibpath:"*) ;;
  7353. *) func_append compile_shlibpath "$add_shlibpath:" ;;
  7354. esac
  7355. fi
  7356. if test prog = "$linkmode"; then
  7357. test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
  7358. test -n "$add" && compile_deplibs="$add $compile_deplibs"
  7359. else
  7360. test -n "$add_dir" && deplibs="$add_dir $deplibs"
  7361. test -n "$add" && deplibs="$add $deplibs"
  7362. if test yes != "$hardcode_direct" &&
  7363. test yes != "$hardcode_minus_L" &&
  7364. test yes = "$hardcode_shlibpath_var"; then
  7365. case :$finalize_shlibpath: in
  7366. *":$libdir:"*) ;;
  7367. *) func_append finalize_shlibpath "$libdir:" ;;
  7368. esac
  7369. fi
  7370. fi
  7371. fi
  7372. if test prog = "$linkmode" || test relink = "$opt_mode"; then
  7373. add_shlibpath=
  7374. add_dir=
  7375. add=
  7376. # Finalize command for both is simple: just hardcode it.
  7377. if test yes = "$hardcode_direct" &&
  7378. test no = "$hardcode_direct_absolute"; then
  7379. add=$libdir/$linklib
  7380. elif test yes = "$hardcode_minus_L"; then
  7381. add_dir=-L$libdir
  7382. add=-l$name
  7383. elif test yes = "$hardcode_shlibpath_var"; then
  7384. case :$finalize_shlibpath: in
  7385. *":$libdir:"*) ;;
  7386. *) func_append finalize_shlibpath "$libdir:" ;;
  7387. esac
  7388. add=-l$name
  7389. elif test yes = "$hardcode_automatic"; then
  7390. if test -n "$inst_prefix_dir" &&
  7391. test -f "$inst_prefix_dir$libdir/$linklib"; then
  7392. add=$inst_prefix_dir$libdir/$linklib
  7393. else
  7394. add=$libdir/$linklib
  7395. fi
  7396. else
  7397. # We cannot seem to hardcode it, guess we'll fake it.
  7398. add_dir=-L$libdir
  7399. # Try looking first in the location we're being installed to.
  7400. if test -n "$inst_prefix_dir"; then
  7401. case $libdir in
  7402. [\\/]*)
  7403. func_append add_dir " -L$inst_prefix_dir$libdir"
  7404. ;;
  7405. esac
  7406. fi
  7407. add=-l$name
  7408. fi
  7409. if test prog = "$linkmode"; then
  7410. test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
  7411. test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
  7412. else
  7413. test -n "$add_dir" && deplibs="$add_dir $deplibs"
  7414. test -n "$add" && deplibs="$add $deplibs"
  7415. fi
  7416. fi
  7417. elif test prog = "$linkmode"; then
  7418. # Here we assume that one of hardcode_direct or hardcode_minus_L
  7419. # is not unsupported. This is valid on all known static and
  7420. # shared platforms.
  7421. if test unsupported != "$hardcode_direct"; then
  7422. test -n "$old_library" && linklib=$old_library
  7423. compile_deplibs="$dir/$linklib $compile_deplibs"
  7424. finalize_deplibs="$dir/$linklib $finalize_deplibs"
  7425. else
  7426. compile_deplibs="-l$name -L$dir $compile_deplibs"
  7427. finalize_deplibs="-l$name -L$dir $finalize_deplibs"
  7428. fi
  7429. elif test yes = "$build_libtool_libs"; then
  7430. # Not a shared library
  7431. if test pass_all != "$deplibs_check_method"; then
  7432. # We're trying link a shared library against a static one
  7433. # but the system doesn't support it.
  7434. # Just print a warning and add the library to dependency_libs so
  7435. # that the program can be linked against the static library.
  7436. echo
  7437. $ECHO "*** Warning: This system cannot link to static lib archive $lib."
  7438. echo "*** I have the capability to make that library automatically link in when"
  7439. echo "*** you link to this library. But I can only do this if you have a"
  7440. echo "*** shared version of the library, which you do not appear to have."
  7441. if test yes = "$module"; then
  7442. echo "*** But as you try to build a module library, libtool will still create "
  7443. echo "*** a static module, that should work as long as the dlopening application"
  7444. echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
  7445. if test -z "$global_symbol_pipe"; then
  7446. echo
  7447. echo "*** However, this would only work if libtool was able to extract symbol"
  7448. echo "*** lists from a program, using 'nm' or equivalent, but libtool could"
  7449. echo "*** not find such a program. So, this module is probably useless."
  7450. echo "*** 'nm' from GNU binutils and a full rebuild may help."
  7451. fi
  7452. if test no = "$build_old_libs"; then
  7453. build_libtool_libs=module
  7454. build_old_libs=yes
  7455. else
  7456. build_libtool_libs=no
  7457. fi
  7458. fi
  7459. else
  7460. deplibs="$dir/$old_library $deplibs"
  7461. link_static=yes
  7462. fi
  7463. fi # link shared/static library?
  7464. if test lib = "$linkmode"; then
  7465. if test -n "$dependency_libs" &&
  7466. { test yes != "$hardcode_into_libs" ||
  7467. test yes = "$build_old_libs" ||
  7468. test yes = "$link_static"; }; then
  7469. # Extract -R from dependency_libs
  7470. temp_deplibs=
  7471. for libdir in $dependency_libs; do
  7472. case $libdir in
  7473. -R*) func_stripname '-R' '' "$libdir"
  7474. temp_xrpath=$func_stripname_result
  7475. case " $xrpath " in
  7476. *" $temp_xrpath "*) ;;
  7477. *) func_append xrpath " $temp_xrpath";;
  7478. esac;;
  7479. *) func_append temp_deplibs " $libdir";;
  7480. esac
  7481. done
  7482. dependency_libs=$temp_deplibs
  7483. fi
  7484. func_append newlib_search_path " $absdir"
  7485. # Link against this library
  7486. test no = "$link_static" && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
  7487. # ... and its dependency_libs
  7488. tmp_libs=
  7489. for deplib in $dependency_libs; do
  7490. newdependency_libs="$deplib $newdependency_libs"
  7491. case $deplib in
  7492. -L*) func_stripname '-L' '' "$deplib"
  7493. func_resolve_sysroot "$func_stripname_result";;
  7494. *) func_resolve_sysroot "$deplib" ;;
  7495. esac
  7496. if $opt_preserve_dup_deps; then
  7497. case "$tmp_libs " in
  7498. *" $func_resolve_sysroot_result "*)
  7499. func_append specialdeplibs " $func_resolve_sysroot_result" ;;
  7500. esac
  7501. fi
  7502. func_append tmp_libs " $func_resolve_sysroot_result"
  7503. done
  7504. if test no != "$link_all_deplibs"; then
  7505. # Add the search paths of all dependency libraries
  7506. for deplib in $dependency_libs; do
  7507. path=
  7508. case $deplib in
  7509. -L*) path=$deplib ;;
  7510. *.la)
  7511. func_resolve_sysroot "$deplib"
  7512. deplib=$func_resolve_sysroot_result
  7513. func_dirname "$deplib" "" "."
  7514. dir=$func_dirname_result
  7515. # We need an absolute path.
  7516. case $dir in
  7517. [\\/]* | [A-Za-z]:[\\/]*) absdir=$dir ;;
  7518. *)
  7519. absdir=`cd "$dir" && pwd`
  7520. if test -z "$absdir"; then
  7521. func_warning "cannot determine absolute directory name of '$dir'"
  7522. absdir=$dir
  7523. fi
  7524. ;;
  7525. esac
  7526. if $GREP "^installed=no" $deplib > /dev/null; then
  7527. case $host in
  7528. *-*-darwin*)
  7529. depdepl=
  7530. eval deplibrary_names=`$SED -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
  7531. if test -n "$deplibrary_names"; then
  7532. for tmp in $deplibrary_names; do
  7533. depdepl=$tmp
  7534. done
  7535. if test -f "$absdir/$objdir/$depdepl"; then
  7536. depdepl=$absdir/$objdir/$depdepl
  7537. darwin_install_name=`$OTOOL -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
  7538. if test -z "$darwin_install_name"; then
  7539. darwin_install_name=`$OTOOL64 -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
  7540. fi
  7541. func_append compiler_flags " $wl-dylib_file $wl$darwin_install_name:$depdepl"
  7542. func_append linker_flags " -dylib_file $darwin_install_name:$depdepl"
  7543. path=
  7544. fi
  7545. fi
  7546. ;;
  7547. *)
  7548. path=-L$absdir/$objdir
  7549. ;;
  7550. esac
  7551. else
  7552. eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
  7553. test -z "$libdir" && \
  7554. func_fatal_error "'$deplib' is not a valid libtool archive"
  7555. test "$absdir" != "$libdir" && \
  7556. func_warning "'$deplib' seems to be moved"
  7557. path=-L$absdir
  7558. fi
  7559. ;;
  7560. esac
  7561. case " $deplibs " in
  7562. *" $path "*) ;;
  7563. *) deplibs="$path $deplibs" ;;
  7564. esac
  7565. done
  7566. fi # link_all_deplibs != no
  7567. fi # linkmode = lib
  7568. done # for deplib in $libs
  7569. if test link = "$pass"; then
  7570. if test prog = "$linkmode"; then
  7571. compile_deplibs="$new_inherited_linker_flags $compile_deplibs"
  7572. finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs"
  7573. else
  7574. compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
  7575. fi
  7576. fi
  7577. dependency_libs=$newdependency_libs
  7578. if test dlpreopen = "$pass"; then
  7579. # Link the dlpreopened libraries before other libraries
  7580. for deplib in $save_deplibs; do
  7581. deplibs="$deplib $deplibs"
  7582. done
  7583. fi
  7584. if test dlopen != "$pass"; then
  7585. test conv = "$pass" || {
  7586. # Make sure lib_search_path contains only unique directories.
  7587. lib_search_path=
  7588. for dir in $newlib_search_path; do
  7589. case "$lib_search_path " in
  7590. *" $dir "*) ;;
  7591. *) func_append lib_search_path " $dir" ;;
  7592. esac
  7593. done
  7594. newlib_search_path=
  7595. }
  7596. if test prog,link = "$linkmode,$pass"; then
  7597. vars="compile_deplibs finalize_deplibs"
  7598. else
  7599. vars=deplibs
  7600. fi
  7601. for var in $vars dependency_libs; do
  7602. # Add libraries to $var in reverse order
  7603. eval tmp_libs=\"\$$var\"
  7604. new_libs=
  7605. for deplib in $tmp_libs; do
  7606. # FIXME: Pedantically, this is the right thing to do, so
  7607. # that some nasty dependency loop isn't accidentally
  7608. # broken:
  7609. #new_libs="$deplib $new_libs"
  7610. # Pragmatically, this seems to cause very few problems in
  7611. # practice:
  7612. case $deplib in
  7613. -L*) new_libs="$deplib $new_libs" ;;
  7614. -R*) ;;
  7615. *)
  7616. # And here is the reason: when a library appears more
  7617. # than once as an explicit dependence of a library, or
  7618. # is implicitly linked in more than once by the
  7619. # compiler, it is considered special, and multiple
  7620. # occurrences thereof are not removed. Compare this
  7621. # with having the same library being listed as a
  7622. # dependency of multiple other libraries: in this case,
  7623. # we know (pedantically, we assume) the library does not
  7624. # need to be listed more than once, so we keep only the
  7625. # last copy. This is not always right, but it is rare
  7626. # enough that we require users that really mean to play
  7627. # such unportable linking tricks to link the library
  7628. # using -Wl,-lname, so that libtool does not consider it
  7629. # for duplicate removal.
  7630. case " $specialdeplibs " in
  7631. *" $deplib "*) new_libs="$deplib $new_libs" ;;
  7632. *)
  7633. case " $new_libs " in
  7634. *" $deplib "*) ;;
  7635. *) new_libs="$deplib $new_libs" ;;
  7636. esac
  7637. ;;
  7638. esac
  7639. ;;
  7640. esac
  7641. done
  7642. tmp_libs=
  7643. for deplib in $new_libs; do
  7644. case $deplib in
  7645. -L*)
  7646. case " $tmp_libs " in
  7647. *" $deplib "*) ;;
  7648. *) func_append tmp_libs " $deplib" ;;
  7649. esac
  7650. ;;
  7651. *) func_append tmp_libs " $deplib" ;;
  7652. esac
  7653. done
  7654. eval $var=\"$tmp_libs\"
  7655. done # for var
  7656. fi
  7657. # Add Sun CC postdeps if required:
  7658. test CXX = "$tagname" && {
  7659. case $host_os in
  7660. linux*)
  7661. case `$CC -V 2>&1 | sed 5q` in
  7662. *Sun\ C*) # Sun C++ 5.9
  7663. func_suncc_cstd_abi
  7664. if test no != "$suncc_use_cstd_abi"; then
  7665. func_append postdeps ' -library=Cstd -library=Crun'
  7666. fi
  7667. ;;
  7668. esac
  7669. ;;
  7670. solaris*)
  7671. func_cc_basename "$CC"
  7672. case $func_cc_basename_result in
  7673. CC* | sunCC*)
  7674. func_suncc_cstd_abi
  7675. if test no != "$suncc_use_cstd_abi"; then
  7676. func_append postdeps ' -library=Cstd -library=Crun'
  7677. fi
  7678. ;;
  7679. esac
  7680. ;;
  7681. esac
  7682. }
  7683. # Last step: remove runtime libs from dependency_libs
  7684. # (they stay in deplibs)
  7685. tmp_libs=
  7686. for i in $dependency_libs; do
  7687. case " $predeps $postdeps $compiler_lib_search_path " in
  7688. *" $i "*)
  7689. i=
  7690. ;;
  7691. esac
  7692. if test -n "$i"; then
  7693. func_append tmp_libs " $i"
  7694. fi
  7695. done
  7696. dependency_libs=$tmp_libs
  7697. done # for pass
  7698. if test prog = "$linkmode"; then
  7699. dlfiles=$newdlfiles
  7700. fi
  7701. if test prog = "$linkmode" || test lib = "$linkmode"; then
  7702. dlprefiles=$newdlprefiles
  7703. fi
  7704. case $linkmode in
  7705. oldlib)
  7706. if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then
  7707. func_warning "'-dlopen' is ignored for archives"
  7708. fi
  7709. case " $deplibs" in
  7710. *\ -l* | *\ -L*)
  7711. func_warning "'-l' and '-L' are ignored for archives" ;;
  7712. esac
  7713. test -n "$rpath" && \
  7714. func_warning "'-rpath' is ignored for archives"
  7715. test -n "$xrpath" && \
  7716. func_warning "'-R' is ignored for archives"
  7717. test -n "$vinfo" && \
  7718. func_warning "'-version-info/-version-number' is ignored for archives"
  7719. test -n "$release" && \
  7720. func_warning "'-release' is ignored for archives"
  7721. test -n "$export_symbols$export_symbols_regex" && \
  7722. func_warning "'-export-symbols' is ignored for archives"
  7723. # Now set the variables for building old libraries.
  7724. build_libtool_libs=no
  7725. oldlibs=$output
  7726. func_append objs "$old_deplibs"
  7727. ;;
  7728. lib)
  7729. # Make sure we only generate libraries of the form 'libNAME.la'.
  7730. case $outputname in
  7731. lib*)
  7732. func_stripname 'lib' '.la' "$outputname"
  7733. name=$func_stripname_result
  7734. eval shared_ext=\"$shrext_cmds\"
  7735. eval libname=\"$libname_spec\"
  7736. ;;
  7737. *)
  7738. test no = "$module" \
  7739. && func_fatal_help "libtool library '$output' must begin with 'lib'"
  7740. if test no != "$need_lib_prefix"; then
  7741. # Add the "lib" prefix for modules if required
  7742. func_stripname '' '.la' "$outputname"
  7743. name=$func_stripname_result
  7744. eval shared_ext=\"$shrext_cmds\"
  7745. eval libname=\"$libname_spec\"
  7746. else
  7747. func_stripname '' '.la' "$outputname"
  7748. libname=$func_stripname_result
  7749. fi
  7750. ;;
  7751. esac
  7752. if test -n "$objs"; then
  7753. if test pass_all != "$deplibs_check_method"; then
  7754. func_fatal_error "cannot build libtool library '$output' from non-libtool objects on this host:$objs"
  7755. else
  7756. echo
  7757. $ECHO "*** Warning: Linking the shared library $output against the non-libtool"
  7758. $ECHO "*** objects $objs is not portable!"
  7759. func_append libobjs " $objs"
  7760. fi
  7761. fi
  7762. test no = "$dlself" \
  7763. || func_warning "'-dlopen self' is ignored for libtool libraries"
  7764. set dummy $rpath
  7765. shift
  7766. test 1 -lt "$#" \
  7767. && func_warning "ignoring multiple '-rpath's for a libtool library"
  7768. install_libdir=$1
  7769. oldlibs=
  7770. if test -z "$rpath"; then
  7771. if test yes = "$build_libtool_libs"; then
  7772. # Building a libtool convenience library.
  7773. # Some compilers have problems with a '.al' extension so
  7774. # convenience libraries should have the same extension an
  7775. # archive normally would.
  7776. oldlibs="$output_objdir/$libname.$libext $oldlibs"
  7777. build_libtool_libs=convenience
  7778. build_old_libs=yes
  7779. fi
  7780. test -n "$vinfo" && \
  7781. func_warning "'-version-info/-version-number' is ignored for convenience libraries"
  7782. test -n "$release" && \
  7783. func_warning "'-release' is ignored for convenience libraries"
  7784. else
  7785. # Parse the version information argument.
  7786. save_ifs=$IFS; IFS=:
  7787. set dummy $vinfo 0 0 0
  7788. shift
  7789. IFS=$save_ifs
  7790. test -n "$7" && \
  7791. func_fatal_help "too many parameters to '-version-info'"
  7792. # convert absolute version numbers to libtool ages
  7793. # this retains compatibility with .la files and attempts
  7794. # to make the code below a bit more comprehensible
  7795. case $vinfo_number in
  7796. yes)
  7797. number_major=$1
  7798. number_minor=$2
  7799. number_revision=$3
  7800. #
  7801. # There are really only two kinds -- those that
  7802. # use the current revision as the major version
  7803. # and those that subtract age and use age as
  7804. # a minor version. But, then there is irix
  7805. # that has an extra 1 added just for fun
  7806. #
  7807. case $version_type in
  7808. # correct linux to gnu/linux during the next big refactor
  7809. darwin|freebsd-elf|linux|osf|windows|none)
  7810. func_arith $number_major + $number_minor
  7811. current=$func_arith_result
  7812. age=$number_minor
  7813. revision=$number_revision
  7814. ;;
  7815. freebsd-aout|qnx|sunos)
  7816. current=$number_major
  7817. revision=$number_minor
  7818. age=0
  7819. ;;
  7820. irix|nonstopux)
  7821. func_arith $number_major + $number_minor
  7822. current=$func_arith_result
  7823. age=$number_minor
  7824. revision=$number_minor
  7825. lt_irix_increment=no
  7826. ;;
  7827. *)
  7828. func_fatal_configuration "$modename: unknown library version type '$version_type'"
  7829. ;;
  7830. esac
  7831. ;;
  7832. no)
  7833. current=$1
  7834. revision=$2
  7835. age=$3
  7836. ;;
  7837. esac
  7838. # Check that each of the things are valid numbers.
  7839. case $current in
  7840. 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]) ;;
  7841. *)
  7842. func_error "CURRENT '$current' must be a nonnegative integer"
  7843. func_fatal_error "'$vinfo' is not valid version information"
  7844. ;;
  7845. esac
  7846. case $revision in
  7847. 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]) ;;
  7848. *)
  7849. func_error "REVISION '$revision' must be a nonnegative integer"
  7850. func_fatal_error "'$vinfo' is not valid version information"
  7851. ;;
  7852. esac
  7853. case $age in
  7854. 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]) ;;
  7855. *)
  7856. func_error "AGE '$age' must be a nonnegative integer"
  7857. func_fatal_error "'$vinfo' is not valid version information"
  7858. ;;
  7859. esac
  7860. if test "$age" -gt "$current"; then
  7861. func_error "AGE '$age' is greater than the current interface number '$current'"
  7862. func_fatal_error "'$vinfo' is not valid version information"
  7863. fi
  7864. # Calculate the version variables.
  7865. major=
  7866. versuffix=
  7867. verstring=
  7868. case $version_type in
  7869. none) ;;
  7870. darwin)
  7871. # Like Linux, but with the current version available in
  7872. # verstring for coding it into the library header
  7873. func_arith $current - $age
  7874. major=.$func_arith_result
  7875. versuffix=$major.$age.$revision
  7876. # Darwin ld doesn't like 0 for these options...
  7877. func_arith $current + 1
  7878. minor_current=$func_arith_result
  7879. xlcverstring="$wl-compatibility_version $wl$minor_current $wl-current_version $wl$minor_current.$revision"
  7880. verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
  7881. # On Darwin other compilers
  7882. case $CC in
  7883. nagfor*)
  7884. verstring="$wl-compatibility_version $wl$minor_current $wl-current_version $wl$minor_current.$revision"
  7885. ;;
  7886. *)
  7887. verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
  7888. ;;
  7889. esac
  7890. ;;
  7891. freebsd-aout)
  7892. major=.$current
  7893. versuffix=.$current.$revision
  7894. ;;
  7895. freebsd-elf)
  7896. func_arith $current - $age
  7897. major=.$func_arith_result
  7898. versuffix=$major.$age.$revision
  7899. ;;
  7900. irix | nonstopux)
  7901. if test no = "$lt_irix_increment"; then
  7902. func_arith $current - $age
  7903. else
  7904. func_arith $current - $age + 1
  7905. fi
  7906. major=$func_arith_result
  7907. case $version_type in
  7908. nonstopux) verstring_prefix=nonstopux ;;
  7909. *) verstring_prefix=sgi ;;
  7910. esac
  7911. verstring=$verstring_prefix$major.$revision
  7912. # Add in all the interfaces that we are compatible with.
  7913. loop=$revision
  7914. while test 0 -ne "$loop"; do
  7915. func_arith $revision - $loop
  7916. iface=$func_arith_result
  7917. func_arith $loop - 1
  7918. loop=$func_arith_result
  7919. verstring=$verstring_prefix$major.$iface:$verstring
  7920. done
  7921. # Before this point, $major must not contain '.'.
  7922. major=.$major
  7923. versuffix=$major.$revision
  7924. ;;
  7925. linux) # correct to gnu/linux during the next big refactor
  7926. func_arith $current - $age
  7927. major=.$func_arith_result
  7928. versuffix=$major.$age.$revision
  7929. ;;
  7930. osf)
  7931. func_arith $current - $age
  7932. major=.$func_arith_result
  7933. versuffix=.$current.$age.$revision
  7934. verstring=$current.$age.$revision
  7935. # Add in all the interfaces that we are compatible with.
  7936. loop=$age
  7937. while test 0 -ne "$loop"; do
  7938. func_arith $current - $loop
  7939. iface=$func_arith_result
  7940. func_arith $loop - 1
  7941. loop=$func_arith_result
  7942. verstring=$verstring:$iface.0
  7943. done
  7944. # Make executables depend on our current version.
  7945. func_append verstring ":$current.0"
  7946. ;;
  7947. qnx)
  7948. major=.$current
  7949. versuffix=.$current
  7950. ;;
  7951. sco)
  7952. major=.$current
  7953. versuffix=.$current
  7954. ;;
  7955. sunos)
  7956. major=.$current
  7957. versuffix=.$current.$revision
  7958. ;;
  7959. windows)
  7960. # Use '-' rather than '.', since we only want one
  7961. # extension on DOS 8.3 file systems.
  7962. func_arith $current - $age
  7963. major=$func_arith_result
  7964. versuffix=-$major
  7965. ;;
  7966. *)
  7967. func_fatal_configuration "unknown library version type '$version_type'"
  7968. ;;
  7969. esac
  7970. # Clear the version info if we defaulted, and they specified a release.
  7971. if test -z "$vinfo" && test -n "$release"; then
  7972. major=
  7973. case $version_type in
  7974. darwin)
  7975. # we can't check for "0.0" in archive_cmds due to quoting
  7976. # problems, so we reset it completely
  7977. verstring=
  7978. ;;
  7979. *)
  7980. verstring=0.0
  7981. ;;
  7982. esac
  7983. if test no = "$need_version"; then
  7984. versuffix=
  7985. else
  7986. versuffix=.0.0
  7987. fi
  7988. fi
  7989. # Remove version info from name if versioning should be avoided
  7990. if test yes,no = "$avoid_version,$need_version"; then
  7991. major=
  7992. versuffix=
  7993. verstring=
  7994. fi
  7995. # Check to see if the archive will have undefined symbols.
  7996. if test yes = "$allow_undefined"; then
  7997. if test unsupported = "$allow_undefined_flag"; then
  7998. if test yes = "$build_old_libs"; then
  7999. func_warning "undefined symbols not allowed in $host shared libraries; building static only"
  8000. build_libtool_libs=no
  8001. else
  8002. func_fatal_error "can't build $host shared library unless -no-undefined is specified"
  8003. fi
  8004. fi
  8005. else
  8006. # Don't allow undefined symbols.
  8007. allow_undefined_flag=$no_undefined_flag
  8008. fi
  8009. fi
  8010. func_generate_dlsyms "$libname" "$libname" :
  8011. func_append libobjs " $symfileobj"
  8012. test " " = "$libobjs" && libobjs=
  8013. if test relink != "$opt_mode"; then
  8014. # Remove our outputs, but don't remove object files since they
  8015. # may have been created when compiling PIC objects.
  8016. removelist=
  8017. tempremovelist=`$ECHO "$output_objdir/*"`
  8018. for p in $tempremovelist; do
  8019. case $p in
  8020. *.$objext | *.gcno)
  8021. ;;
  8022. $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/$libname$release.*)
  8023. if test -n "$precious_files_regex"; then
  8024. if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
  8025. then
  8026. continue
  8027. fi
  8028. fi
  8029. func_append removelist " $p"
  8030. ;;
  8031. *) ;;
  8032. esac
  8033. done
  8034. test -n "$removelist" && \
  8035. func_show_eval "${RM}r \$removelist"
  8036. fi
  8037. # Now set the variables for building old libraries.
  8038. if test yes = "$build_old_libs" && test convenience != "$build_libtool_libs"; then
  8039. func_append oldlibs " $output_objdir/$libname.$libext"
  8040. # Transform .lo files to .o files.
  8041. oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.$libext$/d; $lo2o" | $NL2SP`
  8042. fi
  8043. # Eliminate all temporary directories.
  8044. #for path in $notinst_path; do
  8045. # lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"`
  8046. # deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"`
  8047. # dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"`
  8048. #done
  8049. if test -n "$xrpath"; then
  8050. # If the user specified any rpath flags, then add them.
  8051. temp_xrpath=
  8052. for libdir in $xrpath; do
  8053. func_replace_sysroot "$libdir"
  8054. func_append temp_xrpath " -R$func_replace_sysroot_result"
  8055. case "$finalize_rpath " in
  8056. *" $libdir "*) ;;
  8057. *) func_append finalize_rpath " $libdir" ;;
  8058. esac
  8059. done
  8060. if test yes != "$hardcode_into_libs" || test yes = "$build_old_libs"; then
  8061. dependency_libs="$temp_xrpath $dependency_libs"
  8062. fi
  8063. fi
  8064. # Make sure dlfiles contains only unique files that won't be dlpreopened
  8065. old_dlfiles=$dlfiles
  8066. dlfiles=
  8067. for lib in $old_dlfiles; do
  8068. case " $dlprefiles $dlfiles " in
  8069. *" $lib "*) ;;
  8070. *) func_append dlfiles " $lib" ;;
  8071. esac
  8072. done
  8073. # Make sure dlprefiles contains only unique files
  8074. old_dlprefiles=$dlprefiles
  8075. dlprefiles=
  8076. for lib in $old_dlprefiles; do
  8077. case "$dlprefiles " in
  8078. *" $lib "*) ;;
  8079. *) func_append dlprefiles " $lib" ;;
  8080. esac
  8081. done
  8082. if test yes = "$build_libtool_libs"; then
  8083. if test -n "$rpath"; then
  8084. case $host in
  8085. *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*)
  8086. # these systems don't actually have a c library (as such)!
  8087. ;;
  8088. *-*-rhapsody* | *-*-darwin1.[012])
  8089. # Rhapsody C library is in the System framework
  8090. func_append deplibs " System.ltframework"
  8091. ;;
  8092. *-*-netbsd*)
  8093. # Don't link with libc until the a.out ld.so is fixed.
  8094. ;;
  8095. *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
  8096. # Do not include libc due to us having libc/libc_r.
  8097. ;;
  8098. *-*-sco3.2v5* | *-*-sco5v6*)
  8099. # Causes problems with __ctype
  8100. ;;
  8101. *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
  8102. # Compiler inserts libc in the correct place for threads to work
  8103. ;;
  8104. *)
  8105. # Add libc to deplibs on all other systems if necessary.
  8106. if test yes = "$build_libtool_need_lc"; then
  8107. func_append deplibs " -lc"
  8108. fi
  8109. ;;
  8110. esac
  8111. fi
  8112. # Transform deplibs into only deplibs that can be linked in shared.
  8113. name_save=$name
  8114. libname_save=$libname
  8115. release_save=$release
  8116. versuffix_save=$versuffix
  8117. major_save=$major
  8118. # I'm not sure if I'm treating the release correctly. I think
  8119. # release should show up in the -l (ie -lgmp5) so we don't want to
  8120. # add it in twice. Is that correct?
  8121. release=
  8122. versuffix=
  8123. major=
  8124. newdeplibs=
  8125. droppeddeps=no
  8126. case $deplibs_check_method in
  8127. pass_all)
  8128. # Don't check for shared/static. Everything works.
  8129. # This might be a little naive. We might want to check
  8130. # whether the library exists or not. But this is on
  8131. # osf3 & osf4 and I'm not really sure... Just
  8132. # implementing what was already the behavior.
  8133. newdeplibs=$deplibs
  8134. ;;
  8135. test_compile)
  8136. # This code stresses the "libraries are programs" paradigm to its
  8137. # limits. Maybe even breaks it. We compile a program, linking it
  8138. # against the deplibs as a proxy for the library. Then we can check
  8139. # whether they linked in statically or dynamically with ldd.
  8140. $opt_dry_run || $RM conftest.c
  8141. cat > conftest.c <<EOF
  8142. int main() { return 0; }
  8143. EOF
  8144. $opt_dry_run || $RM conftest
  8145. if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then
  8146. ldd_output=`ldd conftest`
  8147. for i in $deplibs; do
  8148. case $i in
  8149. -l*)
  8150. func_stripname -l '' "$i"
  8151. name=$func_stripname_result
  8152. if test yes = "$allow_libtool_libs_with_static_runtimes"; then
  8153. case " $predeps $postdeps " in
  8154. *" $i "*)
  8155. func_append newdeplibs " $i"
  8156. i=
  8157. ;;
  8158. esac
  8159. fi
  8160. if test -n "$i"; then
  8161. libname=`eval "\\$ECHO \"$libname_spec\""`
  8162. deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
  8163. set dummy $deplib_matches; shift
  8164. deplib_match=$1
  8165. if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0; then
  8166. func_append newdeplibs " $i"
  8167. else
  8168. droppeddeps=yes
  8169. echo
  8170. $ECHO "*** Warning: dynamic linker does not accept needed library $i."
  8171. echo "*** I have the capability to make that library automatically link in when"
  8172. echo "*** you link to this library. But I can only do this if you have a"
  8173. echo "*** shared version of the library, which I believe you do not have"
  8174. echo "*** because a test_compile did reveal that the linker did not use it for"
  8175. echo "*** its dynamic dependency list that programs get resolved with at runtime."
  8176. fi
  8177. fi
  8178. ;;
  8179. *)
  8180. func_append newdeplibs " $i"
  8181. ;;
  8182. esac
  8183. done
  8184. else
  8185. # Error occurred in the first compile. Let's try to salvage
  8186. # the situation: Compile a separate program for each library.
  8187. for i in $deplibs; do
  8188. case $i in
  8189. -l*)
  8190. func_stripname -l '' "$i"
  8191. name=$func_stripname_result
  8192. $opt_dry_run || $RM conftest
  8193. if $LTCC $LTCFLAGS -o conftest conftest.c $i; then
  8194. ldd_output=`ldd conftest`
  8195. if test yes = "$allow_libtool_libs_with_static_runtimes"; then
  8196. case " $predeps $postdeps " in
  8197. *" $i "*)
  8198. func_append newdeplibs " $i"
  8199. i=
  8200. ;;
  8201. esac
  8202. fi
  8203. if test -n "$i"; then
  8204. libname=`eval "\\$ECHO \"$libname_spec\""`
  8205. deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
  8206. set dummy $deplib_matches; shift
  8207. deplib_match=$1
  8208. if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0; then
  8209. func_append newdeplibs " $i"
  8210. else
  8211. droppeddeps=yes
  8212. echo
  8213. $ECHO "*** Warning: dynamic linker does not accept needed library $i."
  8214. echo "*** I have the capability to make that library automatically link in when"
  8215. echo "*** you link to this library. But I can only do this if you have a"
  8216. echo "*** shared version of the library, which you do not appear to have"
  8217. echo "*** because a test_compile did reveal that the linker did not use this one"
  8218. echo "*** as a dynamic dependency that programs can get resolved with at runtime."
  8219. fi
  8220. fi
  8221. else
  8222. droppeddeps=yes
  8223. echo
  8224. $ECHO "*** Warning! Library $i is needed by this library but I was not able to"
  8225. echo "*** make it link in! You will probably need to install it or some"
  8226. echo "*** library that it depends on before this library will be fully"
  8227. echo "*** functional. Installing it before continuing would be even better."
  8228. fi
  8229. ;;
  8230. *)
  8231. func_append newdeplibs " $i"
  8232. ;;
  8233. esac
  8234. done
  8235. fi
  8236. ;;
  8237. file_magic*)
  8238. set dummy $deplibs_check_method; shift
  8239. file_magic_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
  8240. for a_deplib in $deplibs; do
  8241. case $a_deplib in
  8242. -l*)
  8243. func_stripname -l '' "$a_deplib"
  8244. name=$func_stripname_result
  8245. if test yes = "$allow_libtool_libs_with_static_runtimes"; then
  8246. case " $predeps $postdeps " in
  8247. *" $a_deplib "*)
  8248. func_append newdeplibs " $a_deplib"
  8249. a_deplib=
  8250. ;;
  8251. esac
  8252. fi
  8253. if test -n "$a_deplib"; then
  8254. libname=`eval "\\$ECHO \"$libname_spec\""`
  8255. if test -n "$file_magic_glob"; then
  8256. libnameglob=`func_echo_all "$libname" | $SED -e $file_magic_glob`
  8257. else
  8258. libnameglob=$libname
  8259. fi
  8260. test yes = "$want_nocaseglob" && nocaseglob=`shopt -p nocaseglob`
  8261. for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
  8262. if test yes = "$want_nocaseglob"; then
  8263. shopt -s nocaseglob
  8264. potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`
  8265. $nocaseglob
  8266. else
  8267. potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`
  8268. fi
  8269. for potent_lib in $potential_libs; do
  8270. # Follow soft links.
  8271. if ls -lLd "$potent_lib" 2>/dev/null |
  8272. $GREP " -> " >/dev/null; then
  8273. continue
  8274. fi
  8275. # The statement above tries to avoid entering an
  8276. # endless loop below, in case of cyclic links.
  8277. # We might still enter an endless loop, since a link
  8278. # loop can be closed while we follow links,
  8279. # but so what?
  8280. potlib=$potent_lib
  8281. while test -h "$potlib" 2>/dev/null; do
  8282. potliblink=`ls -ld $potlib | $SED 's/.* -> //'`
  8283. case $potliblink in
  8284. [\\/]* | [A-Za-z]:[\\/]*) potlib=$potliblink;;
  8285. *) potlib=`$ECHO "$potlib" | $SED 's|[^/]*$||'`"$potliblink";;
  8286. esac
  8287. done
  8288. if eval $file_magic_cmd \"\$potlib\" 2>/dev/null |
  8289. $SED -e 10q |
  8290. $EGREP "$file_magic_regex" > /dev/null; then
  8291. func_append newdeplibs " $a_deplib"
  8292. a_deplib=
  8293. break 2
  8294. fi
  8295. done
  8296. done
  8297. fi
  8298. if test -n "$a_deplib"; then
  8299. droppeddeps=yes
  8300. echo
  8301. $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
  8302. echo "*** I have the capability to make that library automatically link in when"
  8303. echo "*** you link to this library. But I can only do this if you have a"
  8304. echo "*** shared version of the library, which you do not appear to have"
  8305. echo "*** because I did check the linker path looking for a file starting"
  8306. if test -z "$potlib"; then
  8307. $ECHO "*** with $libname but no candidates were found. (...for file magic test)"
  8308. else
  8309. $ECHO "*** with $libname and none of the candidates passed a file format test"
  8310. $ECHO "*** using a file magic. Last file checked: $potlib"
  8311. fi
  8312. fi
  8313. ;;
  8314. *)
  8315. # Add a -L argument.
  8316. func_append newdeplibs " $a_deplib"
  8317. ;;
  8318. esac
  8319. done # Gone through all deplibs.
  8320. ;;
  8321. match_pattern*)
  8322. set dummy $deplibs_check_method; shift
  8323. match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
  8324. for a_deplib in $deplibs; do
  8325. case $a_deplib in
  8326. -l*)
  8327. func_stripname -l '' "$a_deplib"
  8328. name=$func_stripname_result
  8329. if test yes = "$allow_libtool_libs_with_static_runtimes"; then
  8330. case " $predeps $postdeps " in
  8331. *" $a_deplib "*)
  8332. func_append newdeplibs " $a_deplib"
  8333. a_deplib=
  8334. ;;
  8335. esac
  8336. fi
  8337. if test -n "$a_deplib"; then
  8338. libname=`eval "\\$ECHO \"$libname_spec\""`
  8339. for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
  8340. potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
  8341. for potent_lib in $potential_libs; do
  8342. potlib=$potent_lib # see symlink-check above in file_magic test
  8343. if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \
  8344. $EGREP "$match_pattern_regex" > /dev/null; then
  8345. func_append newdeplibs " $a_deplib"
  8346. a_deplib=
  8347. break 2
  8348. fi
  8349. done
  8350. done
  8351. fi
  8352. if test -n "$a_deplib"; then
  8353. droppeddeps=yes
  8354. echo
  8355. $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
  8356. echo "*** I have the capability to make that library automatically link in when"
  8357. echo "*** you link to this library. But I can only do this if you have a"
  8358. echo "*** shared version of the library, which you do not appear to have"
  8359. echo "*** because I did check the linker path looking for a file starting"
  8360. if test -z "$potlib"; then
  8361. $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)"
  8362. else
  8363. $ECHO "*** with $libname and none of the candidates passed a file format test"
  8364. $ECHO "*** using a regex pattern. Last file checked: $potlib"
  8365. fi
  8366. fi
  8367. ;;
  8368. *)
  8369. # Add a -L argument.
  8370. func_append newdeplibs " $a_deplib"
  8371. ;;
  8372. esac
  8373. done # Gone through all deplibs.
  8374. ;;
  8375. none | unknown | *)
  8376. newdeplibs=
  8377. tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'`
  8378. if test yes = "$allow_libtool_libs_with_static_runtimes"; then
  8379. for i in $predeps $postdeps; do
  8380. # can't use Xsed below, because $i might contain '/'
  8381. tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s|$i||"`
  8382. done
  8383. fi
  8384. case $tmp_deplibs in
  8385. *[!\ \ ]*)
  8386. echo
  8387. if test none = "$deplibs_check_method"; then
  8388. echo "*** Warning: inter-library dependencies are not supported in this platform."
  8389. else
  8390. echo "*** Warning: inter-library dependencies are not known to be supported."
  8391. fi
  8392. echo "*** All declared inter-library dependencies are being dropped."
  8393. droppeddeps=yes
  8394. ;;
  8395. esac
  8396. ;;
  8397. esac
  8398. versuffix=$versuffix_save
  8399. major=$major_save
  8400. release=$release_save
  8401. libname=$libname_save
  8402. name=$name_save
  8403. case $host in
  8404. *-*-rhapsody* | *-*-darwin1.[012])
  8405. # On Rhapsody replace the C library with the System framework
  8406. newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'`
  8407. ;;
  8408. esac
  8409. if test yes = "$droppeddeps"; then
  8410. if test yes = "$module"; then
  8411. echo
  8412. echo "*** Warning: libtool could not satisfy all declared inter-library"
  8413. $ECHO "*** dependencies of module $libname. Therefore, libtool will create"
  8414. echo "*** a static module, that should work as long as the dlopening"
  8415. echo "*** application is linked with the -dlopen flag."
  8416. if test -z "$global_symbol_pipe"; then
  8417. echo
  8418. echo "*** However, this would only work if libtool was able to extract symbol"
  8419. echo "*** lists from a program, using 'nm' or equivalent, but libtool could"
  8420. echo "*** not find such a program. So, this module is probably useless."
  8421. echo "*** 'nm' from GNU binutils and a full rebuild may help."
  8422. fi
  8423. if test no = "$build_old_libs"; then
  8424. oldlibs=$output_objdir/$libname.$libext
  8425. build_libtool_libs=module
  8426. build_old_libs=yes
  8427. else
  8428. build_libtool_libs=no
  8429. fi
  8430. else
  8431. echo "*** The inter-library dependencies that have been dropped here will be"
  8432. echo "*** automatically added whenever a program is linked with this library"
  8433. echo "*** or is declared to -dlopen it."
  8434. if test no = "$allow_undefined"; then
  8435. echo
  8436. echo "*** Since this library must not contain undefined symbols,"
  8437. echo "*** because either the platform does not support them or"
  8438. echo "*** it was explicitly requested with -no-undefined,"
  8439. echo "*** libtool will only create a static version of it."
  8440. if test no = "$build_old_libs"; then
  8441. oldlibs=$output_objdir/$libname.$libext
  8442. build_libtool_libs=module
  8443. build_old_libs=yes
  8444. else
  8445. build_libtool_libs=no
  8446. fi
  8447. fi
  8448. fi
  8449. fi
  8450. # Done checking deplibs!
  8451. deplibs=$newdeplibs
  8452. fi
  8453. # Time to change all our "foo.ltframework" stuff back to "-framework foo"
  8454. case $host in
  8455. *-*-darwin*)
  8456. newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
  8457. new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
  8458. deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
  8459. ;;
  8460. esac
  8461. # move library search paths that coincide with paths to not yet
  8462. # installed libraries to the beginning of the library search list
  8463. new_libs=
  8464. for path in $notinst_path; do
  8465. case " $new_libs " in
  8466. *" -L$path/$objdir "*) ;;
  8467. *)
  8468. case " $deplibs " in
  8469. *" -L$path/$objdir "*)
  8470. func_append new_libs " -L$path/$objdir" ;;
  8471. esac
  8472. ;;
  8473. esac
  8474. done
  8475. for deplib in $deplibs; do
  8476. case $deplib in
  8477. -L*)
  8478. case " $new_libs " in
  8479. *" $deplib "*) ;;
  8480. *) func_append new_libs " $deplib" ;;
  8481. esac
  8482. ;;
  8483. *) func_append new_libs " $deplib" ;;
  8484. esac
  8485. done
  8486. deplibs=$new_libs
  8487. # All the library-specific variables (install_libdir is set above).
  8488. library_names=
  8489. old_library=
  8490. dlname=
  8491. # Test again, we may have decided not to build it any more
  8492. if test yes = "$build_libtool_libs"; then
  8493. # Remove $wl instances when linking with ld.
  8494. # FIXME: should test the right _cmds variable.
  8495. case $archive_cmds in
  8496. *\$LD\ *) wl= ;;
  8497. esac
  8498. if test yes = "$hardcode_into_libs"; then
  8499. # Hardcode the library paths
  8500. hardcode_libdirs=
  8501. dep_rpath=
  8502. rpath=$finalize_rpath
  8503. test relink = "$opt_mode" || rpath=$compile_rpath$rpath
  8504. for libdir in $rpath; do
  8505. if test -n "$hardcode_libdir_flag_spec"; then
  8506. if test -n "$hardcode_libdir_separator"; then
  8507. func_replace_sysroot "$libdir"
  8508. libdir=$func_replace_sysroot_result
  8509. if test -z "$hardcode_libdirs"; then
  8510. hardcode_libdirs=$libdir
  8511. else
  8512. # Just accumulate the unique libdirs.
  8513. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
  8514. *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
  8515. ;;
  8516. *)
  8517. func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
  8518. ;;
  8519. esac
  8520. fi
  8521. else
  8522. eval flag=\"$hardcode_libdir_flag_spec\"
  8523. func_append dep_rpath " $flag"
  8524. fi
  8525. elif test -n "$runpath_var"; then
  8526. case "$perm_rpath " in
  8527. *" $libdir "*) ;;
  8528. *) func_append perm_rpath " $libdir" ;;
  8529. esac
  8530. fi
  8531. done
  8532. # Substitute the hardcoded libdirs into the rpath.
  8533. if test -n "$hardcode_libdir_separator" &&
  8534. test -n "$hardcode_libdirs"; then
  8535. libdir=$hardcode_libdirs
  8536. eval "dep_rpath=\"$hardcode_libdir_flag_spec\""
  8537. fi
  8538. if test -n "$runpath_var" && test -n "$perm_rpath"; then
  8539. # We should set the runpath_var.
  8540. rpath=
  8541. for dir in $perm_rpath; do
  8542. func_append rpath "$dir:"
  8543. done
  8544. eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
  8545. fi
  8546. test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
  8547. fi
  8548. shlibpath=$finalize_shlibpath
  8549. test relink = "$opt_mode" || shlibpath=$compile_shlibpath$shlibpath
  8550. if test -n "$shlibpath"; then
  8551. eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
  8552. fi
  8553. # Get the real and link names of the library.
  8554. eval shared_ext=\"$shrext_cmds\"
  8555. eval library_names=\"$library_names_spec\"
  8556. set dummy $library_names
  8557. shift
  8558. realname=$1
  8559. shift
  8560. if test -n "$soname_spec"; then
  8561. eval soname=\"$soname_spec\"
  8562. else
  8563. soname=$realname
  8564. fi
  8565. if test -z "$dlname"; then
  8566. dlname=$soname
  8567. fi
  8568. lib=$output_objdir/$realname
  8569. linknames=
  8570. for link
  8571. do
  8572. func_append linknames " $link"
  8573. done
  8574. # Use standard objects if they are pic
  8575. test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP`
  8576. test "X$libobjs" = "X " && libobjs=
  8577. delfiles=
  8578. if test -n "$export_symbols" && test -n "$include_expsyms"; then
  8579. $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp"
  8580. export_symbols=$output_objdir/$libname.uexp
  8581. func_append delfiles " $export_symbols"
  8582. fi
  8583. orig_export_symbols=
  8584. case $host_os in
  8585. cygwin* | mingw* | cegcc*)
  8586. if test -n "$export_symbols" && test -z "$export_symbols_regex"; then
  8587. # exporting using user supplied symfile
  8588. func_dll_def_p "$export_symbols" || {
  8589. # and it's NOT already a .def file. Must figure out
  8590. # which of the given symbols are data symbols and tag
  8591. # them as such. So, trigger use of export_symbols_cmds.
  8592. # export_symbols gets reassigned inside the "prepare
  8593. # the list of exported symbols" if statement, so the
  8594. # include_expsyms logic still works.
  8595. orig_export_symbols=$export_symbols
  8596. export_symbols=
  8597. always_export_symbols=yes
  8598. }
  8599. fi
  8600. ;;
  8601. esac
  8602. # Prepare the list of exported symbols
  8603. if test -z "$export_symbols"; then
  8604. if test yes = "$always_export_symbols" || test -n "$export_symbols_regex"; then
  8605. func_verbose "generating symbol list for '$libname.la'"
  8606. export_symbols=$output_objdir/$libname.exp
  8607. $opt_dry_run || $RM $export_symbols
  8608. cmds=$export_symbols_cmds
  8609. save_ifs=$IFS; IFS='~'
  8610. for cmd1 in $cmds; do
  8611. IFS=$save_ifs
  8612. # Take the normal branch if the nm_file_list_spec branch
  8613. # doesn't work or if tool conversion is not needed.
  8614. case $nm_file_list_spec~$to_tool_file_cmd in
  8615. *~func_convert_file_noop | *~func_convert_file_msys_to_w32 | ~*)
  8616. try_normal_branch=yes
  8617. eval cmd=\"$cmd1\"
  8618. func_len " $cmd"
  8619. len=$func_len_result
  8620. ;;
  8621. *)
  8622. try_normal_branch=no
  8623. ;;
  8624. esac
  8625. if test yes = "$try_normal_branch" \
  8626. && { test "$len" -lt "$max_cmd_len" \
  8627. || test "$max_cmd_len" -le -1; }
  8628. then
  8629. func_show_eval "$cmd" 'exit $?'
  8630. skipped_export=false
  8631. elif test -n "$nm_file_list_spec"; then
  8632. func_basename "$output"
  8633. output_la=$func_basename_result
  8634. save_libobjs=$libobjs
  8635. save_output=$output
  8636. output=$output_objdir/$output_la.nm
  8637. func_to_tool_file "$output"
  8638. libobjs=$nm_file_list_spec$func_to_tool_file_result
  8639. func_append delfiles " $output"
  8640. func_verbose "creating $NM input file list: $output"
  8641. for obj in $save_libobjs; do
  8642. func_to_tool_file "$obj"
  8643. $ECHO "$func_to_tool_file_result"
  8644. done > "$output"
  8645. eval cmd=\"$cmd1\"
  8646. func_show_eval "$cmd" 'exit $?'
  8647. output=$save_output
  8648. libobjs=$save_libobjs
  8649. skipped_export=false
  8650. else
  8651. # The command line is too long to execute in one step.
  8652. func_verbose "using reloadable object file for export list..."
  8653. skipped_export=:
  8654. # Break out early, otherwise skipped_export may be
  8655. # set to false by a later but shorter cmd.
  8656. break
  8657. fi
  8658. done
  8659. IFS=$save_ifs
  8660. if test -n "$export_symbols_regex" && test : != "$skipped_export"; then
  8661. func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
  8662. func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
  8663. fi
  8664. fi
  8665. fi
  8666. if test -n "$export_symbols" && test -n "$include_expsyms"; then
  8667. tmp_export_symbols=$export_symbols
  8668. test -n "$orig_export_symbols" && tmp_export_symbols=$orig_export_symbols
  8669. $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
  8670. fi
  8671. if test : != "$skipped_export" && test -n "$orig_export_symbols"; then
  8672. # The given exports_symbols file has to be filtered, so filter it.
  8673. func_verbose "filter symbol list for '$libname.la' to tag DATA exports"
  8674. # FIXME: $output_objdir/$libname.filter potentially contains lots of
  8675. # 's' commands, which not all seds can handle. GNU sed should be fine
  8676. # though. Also, the filter scales superlinearly with the number of
  8677. # global variables. join(1) would be nice here, but unfortunately
  8678. # isn't a blessed tool.
  8679. $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
  8680. func_append delfiles " $export_symbols $output_objdir/$libname.filter"
  8681. export_symbols=$output_objdir/$libname.def
  8682. $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
  8683. fi
  8684. tmp_deplibs=
  8685. for test_deplib in $deplibs; do
  8686. case " $convenience " in
  8687. *" $test_deplib "*) ;;
  8688. *)
  8689. func_append tmp_deplibs " $test_deplib"
  8690. ;;
  8691. esac
  8692. done
  8693. deplibs=$tmp_deplibs
  8694. if test -n "$convenience"; then
  8695. if test -n "$whole_archive_flag_spec" &&
  8696. test yes = "$compiler_needs_object" &&
  8697. test -z "$libobjs"; then
  8698. # extract the archives, so we have objects to list.
  8699. # TODO: could optimize this to just extract one archive.
  8700. whole_archive_flag_spec=
  8701. fi
  8702. if test -n "$whole_archive_flag_spec"; then
  8703. save_libobjs=$libobjs
  8704. eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
  8705. test "X$libobjs" = "X " && libobjs=
  8706. else
  8707. gentop=$output_objdir/${outputname}x
  8708. func_append generated " $gentop"
  8709. func_extract_archives $gentop $convenience
  8710. func_append libobjs " $func_extract_archives_result"
  8711. test "X$libobjs" = "X " && libobjs=
  8712. fi
  8713. fi
  8714. if test yes = "$thread_safe" && test -n "$thread_safe_flag_spec"; then
  8715. eval flag=\"$thread_safe_flag_spec\"
  8716. func_append linker_flags " $flag"
  8717. fi
  8718. # Make a backup of the uninstalled library when relinking
  8719. if test relink = "$opt_mode"; then
  8720. $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $?
  8721. fi
  8722. # Do each of the archive commands.
  8723. if test yes = "$module" && test -n "$module_cmds"; then
  8724. if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
  8725. eval test_cmds=\"$module_expsym_cmds\"
  8726. cmds=$module_expsym_cmds
  8727. else
  8728. eval test_cmds=\"$module_cmds\"
  8729. cmds=$module_cmds
  8730. fi
  8731. else
  8732. if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
  8733. eval test_cmds=\"$archive_expsym_cmds\"
  8734. cmds=$archive_expsym_cmds
  8735. else
  8736. eval test_cmds=\"$archive_cmds\"
  8737. cmds=$archive_cmds
  8738. fi
  8739. fi
  8740. if test : != "$skipped_export" &&
  8741. func_len " $test_cmds" &&
  8742. len=$func_len_result &&
  8743. test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
  8744. :
  8745. else
  8746. # The command line is too long to link in one step, link piecewise
  8747. # or, if using GNU ld and skipped_export is not :, use a linker
  8748. # script.
  8749. # Save the value of $output and $libobjs because we want to
  8750. # use them later. If we have whole_archive_flag_spec, we
  8751. # want to use save_libobjs as it was before
  8752. # whole_archive_flag_spec was expanded, because we can't
  8753. # assume the linker understands whole_archive_flag_spec.
  8754. # This may have to be revisited, in case too many
  8755. # convenience libraries get linked in and end up exceeding
  8756. # the spec.
  8757. if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
  8758. save_libobjs=$libobjs
  8759. fi
  8760. save_output=$output
  8761. func_basename "$output"
  8762. output_la=$func_basename_result
  8763. # Clear the reloadable object creation command queue and
  8764. # initialize k to one.
  8765. test_cmds=
  8766. concat_cmds=
  8767. objlist=
  8768. last_robj=
  8769. k=1
  8770. if test -n "$save_libobjs" && test : != "$skipped_export" && test yes = "$with_gnu_ld"; then
  8771. output=$output_objdir/$output_la.lnkscript
  8772. func_verbose "creating GNU ld script: $output"
  8773. echo 'INPUT (' > $output
  8774. for obj in $save_libobjs
  8775. do
  8776. func_to_tool_file "$obj"
  8777. $ECHO "$func_to_tool_file_result" >> $output
  8778. done
  8779. echo ')' >> $output
  8780. func_append delfiles " $output"
  8781. func_to_tool_file "$output"
  8782. output=$func_to_tool_file_result
  8783. elif test -n "$save_libobjs" && test : != "$skipped_export" && test -n "$file_list_spec"; then
  8784. output=$output_objdir/$output_la.lnk
  8785. func_verbose "creating linker input file list: $output"
  8786. : > $output
  8787. set x $save_libobjs
  8788. shift
  8789. firstobj=
  8790. if test yes = "$compiler_needs_object"; then
  8791. firstobj="$1 "
  8792. shift
  8793. fi
  8794. for obj
  8795. do
  8796. func_to_tool_file "$obj"
  8797. $ECHO "$func_to_tool_file_result" >> $output
  8798. done
  8799. func_append delfiles " $output"
  8800. func_to_tool_file "$output"
  8801. output=$firstobj\"$file_list_spec$func_to_tool_file_result\"
  8802. else
  8803. if test -n "$save_libobjs"; then
  8804. func_verbose "creating reloadable object files..."
  8805. output=$output_objdir/$output_la-$k.$objext
  8806. eval test_cmds=\"$reload_cmds\"
  8807. func_len " $test_cmds"
  8808. len0=$func_len_result
  8809. len=$len0
  8810. # Loop over the list of objects to be linked.
  8811. for obj in $save_libobjs
  8812. do
  8813. func_len " $obj"
  8814. func_arith $len + $func_len_result
  8815. len=$func_arith_result
  8816. if test -z "$objlist" ||
  8817. test "$len" -lt "$max_cmd_len"; then
  8818. func_append objlist " $obj"
  8819. else
  8820. # The command $test_cmds is almost too long, add a
  8821. # command to the queue.
  8822. if test 1 -eq "$k"; then
  8823. # The first file doesn't have a previous command to add.
  8824. reload_objs=$objlist
  8825. eval concat_cmds=\"$reload_cmds\"
  8826. else
  8827. # All subsequent reloadable object files will link in
  8828. # the last one created.
  8829. reload_objs="$objlist $last_robj"
  8830. eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\"
  8831. fi
  8832. last_robj=$output_objdir/$output_la-$k.$objext
  8833. func_arith $k + 1
  8834. k=$func_arith_result
  8835. output=$output_objdir/$output_la-$k.$objext
  8836. objlist=" $obj"
  8837. func_len " $last_robj"
  8838. func_arith $len0 + $func_len_result
  8839. len=$func_arith_result
  8840. fi
  8841. done
  8842. # Handle the remaining objects by creating one last
  8843. # reloadable object file. All subsequent reloadable object
  8844. # files will link in the last one created.
  8845. test -z "$concat_cmds" || concat_cmds=$concat_cmds~
  8846. reload_objs="$objlist $last_robj"
  8847. eval concat_cmds=\"\$concat_cmds$reload_cmds\"
  8848. if test -n "$last_robj"; then
  8849. eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\"
  8850. fi
  8851. func_append delfiles " $output"
  8852. else
  8853. output=
  8854. fi
  8855. ${skipped_export-false} && {
  8856. func_verbose "generating symbol list for '$libname.la'"
  8857. export_symbols=$output_objdir/$libname.exp
  8858. $opt_dry_run || $RM $export_symbols
  8859. libobjs=$output
  8860. # Append the command to create the export file.
  8861. test -z "$concat_cmds" || concat_cmds=$concat_cmds~
  8862. eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\"
  8863. if test -n "$last_robj"; then
  8864. eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\"
  8865. fi
  8866. }
  8867. test -n "$save_libobjs" &&
  8868. func_verbose "creating a temporary reloadable object file: $output"
  8869. # Loop through the commands generated above and execute them.
  8870. save_ifs=$IFS; IFS='~'
  8871. for cmd in $concat_cmds; do
  8872. IFS=$save_ifs
  8873. $opt_quiet || {
  8874. func_quote_for_expand "$cmd"
  8875. eval "func_echo $func_quote_for_expand_result"
  8876. }
  8877. $opt_dry_run || eval "$cmd" || {
  8878. lt_exit=$?
  8879. # Restore the uninstalled library and exit
  8880. if test relink = "$opt_mode"; then
  8881. ( cd "$output_objdir" && \
  8882. $RM "${realname}T" && \
  8883. $MV "${realname}U" "$realname" )
  8884. fi
  8885. exit $lt_exit
  8886. }
  8887. done
  8888. IFS=$save_ifs
  8889. if test -n "$export_symbols_regex" && ${skipped_export-false}; then
  8890. func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
  8891. func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
  8892. fi
  8893. fi
  8894. ${skipped_export-false} && {
  8895. if test -n "$export_symbols" && test -n "$include_expsyms"; then
  8896. tmp_export_symbols=$export_symbols
  8897. test -n "$orig_export_symbols" && tmp_export_symbols=$orig_export_symbols
  8898. $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
  8899. fi
  8900. if test -n "$orig_export_symbols"; then
  8901. # The given exports_symbols file has to be filtered, so filter it.
  8902. func_verbose "filter symbol list for '$libname.la' to tag DATA exports"
  8903. # FIXME: $output_objdir/$libname.filter potentially contains lots of
  8904. # 's' commands, which not all seds can handle. GNU sed should be fine
  8905. # though. Also, the filter scales superlinearly with the number of
  8906. # global variables. join(1) would be nice here, but unfortunately
  8907. # isn't a blessed tool.
  8908. $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
  8909. func_append delfiles " $export_symbols $output_objdir/$libname.filter"
  8910. export_symbols=$output_objdir/$libname.def
  8911. $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
  8912. fi
  8913. }
  8914. libobjs=$output
  8915. # Restore the value of output.
  8916. output=$save_output
  8917. if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
  8918. eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
  8919. test "X$libobjs" = "X " && libobjs=
  8920. fi
  8921. # Expand the library linking commands again to reset the
  8922. # value of $libobjs for piecewise linking.
  8923. # Do each of the archive commands.
  8924. if test yes = "$module" && test -n "$module_cmds"; then
  8925. if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
  8926. cmds=$module_expsym_cmds
  8927. else
  8928. cmds=$module_cmds
  8929. fi
  8930. else
  8931. if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
  8932. cmds=$archive_expsym_cmds
  8933. else
  8934. cmds=$archive_cmds
  8935. fi
  8936. fi
  8937. fi
  8938. if test -n "$delfiles"; then
  8939. # Append the command to remove temporary files to $cmds.
  8940. eval cmds=\"\$cmds~\$RM $delfiles\"
  8941. fi
  8942. # Add any objects from preloaded convenience libraries
  8943. if test -n "$dlprefiles"; then
  8944. gentop=$output_objdir/${outputname}x
  8945. func_append generated " $gentop"
  8946. func_extract_archives $gentop $dlprefiles
  8947. func_append libobjs " $func_extract_archives_result"
  8948. test "X$libobjs" = "X " && libobjs=
  8949. fi
  8950. save_ifs=$IFS; IFS='~'
  8951. for cmd in $cmds; do
  8952. IFS=$sp$nl
  8953. eval cmd=\"$cmd\"
  8954. IFS=$save_ifs
  8955. $opt_quiet || {
  8956. func_quote_for_expand "$cmd"
  8957. eval "func_echo $func_quote_for_expand_result"
  8958. }
  8959. $opt_dry_run || eval "$cmd" || {
  8960. lt_exit=$?
  8961. # Restore the uninstalled library and exit
  8962. if test relink = "$opt_mode"; then
  8963. ( cd "$output_objdir" && \
  8964. $RM "${realname}T" && \
  8965. $MV "${realname}U" "$realname" )
  8966. fi
  8967. exit $lt_exit
  8968. }
  8969. done
  8970. IFS=$save_ifs
  8971. # Restore the uninstalled library and exit
  8972. if test relink = "$opt_mode"; then
  8973. $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $?
  8974. if test -n "$convenience"; then
  8975. if test -z "$whole_archive_flag_spec"; then
  8976. func_show_eval '${RM}r "$gentop"'
  8977. fi
  8978. fi
  8979. exit $EXIT_SUCCESS
  8980. fi
  8981. # Create links to the real library.
  8982. for linkname in $linknames; do
  8983. if test "$realname" != "$linkname"; then
  8984. func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?'
  8985. fi
  8986. done
  8987. # If -module or -export-dynamic was specified, set the dlname.
  8988. if test yes = "$module" || test yes = "$export_dynamic"; then
  8989. # On all known operating systems, these are identical.
  8990. dlname=$soname
  8991. fi
  8992. fi
  8993. ;;
  8994. obj)
  8995. if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then
  8996. func_warning "'-dlopen' is ignored for objects"
  8997. fi
  8998. case " $deplibs" in
  8999. *\ -l* | *\ -L*)
  9000. func_warning "'-l' and '-L' are ignored for objects" ;;
  9001. esac
  9002. test -n "$rpath" && \
  9003. func_warning "'-rpath' is ignored for objects"
  9004. test -n "$xrpath" && \
  9005. func_warning "'-R' is ignored for objects"
  9006. test -n "$vinfo" && \
  9007. func_warning "'-version-info' is ignored for objects"
  9008. test -n "$release" && \
  9009. func_warning "'-release' is ignored for objects"
  9010. case $output in
  9011. *.lo)
  9012. test -n "$objs$old_deplibs" && \
  9013. func_fatal_error "cannot build library object '$output' from non-libtool objects"
  9014. libobj=$output
  9015. func_lo2o "$libobj"
  9016. obj=$func_lo2o_result
  9017. ;;
  9018. *)
  9019. libobj=
  9020. obj=$output
  9021. ;;
  9022. esac
  9023. # Delete the old objects.
  9024. $opt_dry_run || $RM $obj $libobj
  9025. # Objects from convenience libraries. This assumes
  9026. # single-version convenience libraries. Whenever we create
  9027. # different ones for PIC/non-PIC, this we'll have to duplicate
  9028. # the extraction.
  9029. reload_conv_objs=
  9030. gentop=
  9031. # if reload_cmds runs $LD directly, get rid of -Wl from
  9032. # whole_archive_flag_spec and hope we can get by with turning comma
  9033. # into space.
  9034. case $reload_cmds in
  9035. *\$LD[\ \$]*) wl= ;;
  9036. esac
  9037. if test -n "$convenience"; then
  9038. if test -n "$whole_archive_flag_spec"; then
  9039. eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
  9040. test -n "$wl" || tmp_whole_archive_flags=`$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'`
  9041. reload_conv_objs=$reload_objs\ $tmp_whole_archive_flags
  9042. else
  9043. gentop=$output_objdir/${obj}x
  9044. func_append generated " $gentop"
  9045. func_extract_archives $gentop $convenience
  9046. reload_conv_objs="$reload_objs $func_extract_archives_result"
  9047. fi
  9048. fi
  9049. # If we're not building shared, we need to use non_pic_objs
  9050. test yes = "$build_libtool_libs" || libobjs=$non_pic_objects
  9051. # Create the old-style object.
  9052. reload_objs=$objs$old_deplibs' '`$ECHO "$libobjs" | $SP2NL | $SED "/\.$libext$/d; /\.lib$/d; $lo2o" | $NL2SP`' '$reload_conv_objs
  9053. output=$obj
  9054. func_execute_cmds "$reload_cmds" 'exit $?'
  9055. # Exit if we aren't doing a library object file.
  9056. if test -z "$libobj"; then
  9057. if test -n "$gentop"; then
  9058. func_show_eval '${RM}r "$gentop"'
  9059. fi
  9060. exit $EXIT_SUCCESS
  9061. fi
  9062. test yes = "$build_libtool_libs" || {
  9063. if test -n "$gentop"; then
  9064. func_show_eval '${RM}r "$gentop"'
  9065. fi
  9066. # Create an invalid libtool object if no PIC, so that we don't
  9067. # accidentally link it into a program.
  9068. # $show "echo timestamp > $libobj"
  9069. # $opt_dry_run || eval "echo timestamp > $libobj" || exit $?
  9070. exit $EXIT_SUCCESS
  9071. }
  9072. if test -n "$pic_flag" || test default != "$pic_mode"; then
  9073. # Only do commands if we really have different PIC objects.
  9074. reload_objs="$libobjs $reload_conv_objs"
  9075. output=$libobj
  9076. func_execute_cmds "$reload_cmds" 'exit $?'
  9077. fi
  9078. if test -n "$gentop"; then
  9079. func_show_eval '${RM}r "$gentop"'
  9080. fi
  9081. exit $EXIT_SUCCESS
  9082. ;;
  9083. prog)
  9084. case $host in
  9085. *cygwin*) func_stripname '' '.exe' "$output"
  9086. output=$func_stripname_result.exe;;
  9087. esac
  9088. test -n "$vinfo" && \
  9089. func_warning "'-version-info' is ignored for programs"
  9090. test -n "$release" && \
  9091. func_warning "'-release' is ignored for programs"
  9092. $preload \
  9093. && test unknown,unknown,unknown = "$dlopen_support,$dlopen_self,$dlopen_self_static" \
  9094. && func_warning "'LT_INIT([dlopen])' not used. Assuming no dlopen support."
  9095. case $host in
  9096. *-*-rhapsody* | *-*-darwin1.[012])
  9097. # On Rhapsody replace the C library is the System framework
  9098. compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'`
  9099. finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'`
  9100. ;;
  9101. esac
  9102. case $host in
  9103. *-*-darwin*)
  9104. # Don't allow lazy linking, it breaks C++ global constructors
  9105. # But is supposedly fixed on 10.4 or later (yay!).
  9106. if test CXX = "$tagname"; then
  9107. case ${MACOSX_DEPLOYMENT_TARGET-10.0} in
  9108. 10.[0123])
  9109. func_append compile_command " $wl-bind_at_load"
  9110. func_append finalize_command " $wl-bind_at_load"
  9111. ;;
  9112. esac
  9113. fi
  9114. # Time to change all our "foo.ltframework" stuff back to "-framework foo"
  9115. compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
  9116. finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
  9117. ;;
  9118. esac
  9119. # move library search paths that coincide with paths to not yet
  9120. # installed libraries to the beginning of the library search list
  9121. new_libs=
  9122. for path in $notinst_path; do
  9123. case " $new_libs " in
  9124. *" -L$path/$objdir "*) ;;
  9125. *)
  9126. case " $compile_deplibs " in
  9127. *" -L$path/$objdir "*)
  9128. func_append new_libs " -L$path/$objdir" ;;
  9129. esac
  9130. ;;
  9131. esac
  9132. done
  9133. for deplib in $compile_deplibs; do
  9134. case $deplib in
  9135. -L*)
  9136. case " $new_libs " in
  9137. *" $deplib "*) ;;
  9138. *) func_append new_libs " $deplib" ;;
  9139. esac
  9140. ;;
  9141. *) func_append new_libs " $deplib" ;;
  9142. esac
  9143. done
  9144. compile_deplibs=$new_libs
  9145. func_append compile_command " $compile_deplibs"
  9146. func_append finalize_command " $finalize_deplibs"
  9147. if test -n "$rpath$xrpath"; then
  9148. # If the user specified any rpath flags, then add them.
  9149. for libdir in $rpath $xrpath; do
  9150. # This is the magic to use -rpath.
  9151. case "$finalize_rpath " in
  9152. *" $libdir "*) ;;
  9153. *) func_append finalize_rpath " $libdir" ;;
  9154. esac
  9155. done
  9156. fi
  9157. # Now hardcode the library paths
  9158. rpath=
  9159. hardcode_libdirs=
  9160. for libdir in $compile_rpath $finalize_rpath; do
  9161. if test -n "$hardcode_libdir_flag_spec"; then
  9162. if test -n "$hardcode_libdir_separator"; then
  9163. if test -z "$hardcode_libdirs"; then
  9164. hardcode_libdirs=$libdir
  9165. else
  9166. # Just accumulate the unique libdirs.
  9167. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
  9168. *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
  9169. ;;
  9170. *)
  9171. func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
  9172. ;;
  9173. esac
  9174. fi
  9175. else
  9176. eval flag=\"$hardcode_libdir_flag_spec\"
  9177. func_append rpath " $flag"
  9178. fi
  9179. elif test -n "$runpath_var"; then
  9180. case "$perm_rpath " in
  9181. *" $libdir "*) ;;
  9182. *) func_append perm_rpath " $libdir" ;;
  9183. esac
  9184. fi
  9185. case $host in
  9186. *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
  9187. testbindir=`$ECHO "$libdir" | $SED -e 's*/lib$*/bin*'`
  9188. case :$dllsearchpath: in
  9189. *":$libdir:"*) ;;
  9190. ::) dllsearchpath=$libdir;;
  9191. *) func_append dllsearchpath ":$libdir";;
  9192. esac
  9193. case :$dllsearchpath: in
  9194. *":$testbindir:"*) ;;
  9195. ::) dllsearchpath=$testbindir;;
  9196. *) func_append dllsearchpath ":$testbindir";;
  9197. esac
  9198. ;;
  9199. esac
  9200. done
  9201. # Substitute the hardcoded libdirs into the rpath.
  9202. if test -n "$hardcode_libdir_separator" &&
  9203. test -n "$hardcode_libdirs"; then
  9204. libdir=$hardcode_libdirs
  9205. eval rpath=\" $hardcode_libdir_flag_spec\"
  9206. fi
  9207. compile_rpath=$rpath
  9208. rpath=
  9209. hardcode_libdirs=
  9210. for libdir in $finalize_rpath; do
  9211. if test -n "$hardcode_libdir_flag_spec"; then
  9212. if test -n "$hardcode_libdir_separator"; then
  9213. if test -z "$hardcode_libdirs"; then
  9214. hardcode_libdirs=$libdir
  9215. else
  9216. # Just accumulate the unique libdirs.
  9217. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
  9218. *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
  9219. ;;
  9220. *)
  9221. func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
  9222. ;;
  9223. esac
  9224. fi
  9225. else
  9226. eval flag=\"$hardcode_libdir_flag_spec\"
  9227. func_append rpath " $flag"
  9228. fi
  9229. elif test -n "$runpath_var"; then
  9230. case "$finalize_perm_rpath " in
  9231. *" $libdir "*) ;;
  9232. *) func_append finalize_perm_rpath " $libdir" ;;
  9233. esac
  9234. fi
  9235. done
  9236. # Substitute the hardcoded libdirs into the rpath.
  9237. if test -n "$hardcode_libdir_separator" &&
  9238. test -n "$hardcode_libdirs"; then
  9239. libdir=$hardcode_libdirs
  9240. eval rpath=\" $hardcode_libdir_flag_spec\"
  9241. fi
  9242. finalize_rpath=$rpath
  9243. if test -n "$libobjs" && test yes = "$build_old_libs"; then
  9244. # Transform all the library objects into standard objects.
  9245. compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
  9246. finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
  9247. fi
  9248. func_generate_dlsyms "$outputname" "@PROGRAM@" false
  9249. # template prelinking step
  9250. if test -n "$prelink_cmds"; then
  9251. func_execute_cmds "$prelink_cmds" 'exit $?'
  9252. fi
  9253. wrappers_required=:
  9254. case $host in
  9255. *cegcc* | *mingw32ce*)
  9256. # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway.
  9257. wrappers_required=false
  9258. ;;
  9259. *cygwin* | *mingw* )
  9260. test yes = "$build_libtool_libs" || wrappers_required=false
  9261. ;;
  9262. *)
  9263. if test no = "$need_relink" || test yes != "$build_libtool_libs"; then
  9264. wrappers_required=false
  9265. fi
  9266. ;;
  9267. esac
  9268. $wrappers_required || {
  9269. # Replace the output file specification.
  9270. compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
  9271. link_command=$compile_command$compile_rpath
  9272. # We have no uninstalled library dependencies, so finalize right now.
  9273. exit_status=0
  9274. func_show_eval "$link_command" 'exit_status=$?'
  9275. if test -n "$postlink_cmds"; then
  9276. func_to_tool_file "$output"
  9277. postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
  9278. func_execute_cmds "$postlink_cmds" 'exit $?'
  9279. fi
  9280. # Delete the generated files.
  9281. if test -f "$output_objdir/${outputname}S.$objext"; then
  9282. func_show_eval '$RM "$output_objdir/${outputname}S.$objext"'
  9283. fi
  9284. exit $exit_status
  9285. }
  9286. if test -n "$compile_shlibpath$finalize_shlibpath"; then
  9287. compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
  9288. fi
  9289. if test -n "$finalize_shlibpath"; then
  9290. finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
  9291. fi
  9292. compile_var=
  9293. finalize_var=
  9294. if test -n "$runpath_var"; then
  9295. if test -n "$perm_rpath"; then
  9296. # We should set the runpath_var.
  9297. rpath=
  9298. for dir in $perm_rpath; do
  9299. func_append rpath "$dir:"
  9300. done
  9301. compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
  9302. fi
  9303. if test -n "$finalize_perm_rpath"; then
  9304. # We should set the runpath_var.
  9305. rpath=
  9306. for dir in $finalize_perm_rpath; do
  9307. func_append rpath "$dir:"
  9308. done
  9309. finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
  9310. fi
  9311. fi
  9312. if test yes = "$no_install"; then
  9313. # We don't need to create a wrapper script.
  9314. link_command=$compile_var$compile_command$compile_rpath
  9315. # Replace the output file specification.
  9316. link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
  9317. # Delete the old output file.
  9318. $opt_dry_run || $RM $output
  9319. # Link the executable and exit
  9320. func_show_eval "$link_command" 'exit $?'
  9321. if test -n "$postlink_cmds"; then
  9322. func_to_tool_file "$output"
  9323. postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
  9324. func_execute_cmds "$postlink_cmds" 'exit $?'
  9325. fi
  9326. exit $EXIT_SUCCESS
  9327. fi
  9328. case $hardcode_action,$fast_install in
  9329. relink,*)
  9330. # Fast installation is not supported
  9331. link_command=$compile_var$compile_command$compile_rpath
  9332. relink_command=$finalize_var$finalize_command$finalize_rpath
  9333. func_warning "this platform does not like uninstalled shared libraries"
  9334. func_warning "'$output' will be relinked during installation"
  9335. ;;
  9336. *,yes)
  9337. link_command=$finalize_var$compile_command$finalize_rpath
  9338. relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'`
  9339. ;;
  9340. *,no)
  9341. link_command=$compile_var$compile_command$compile_rpath
  9342. relink_command=$finalize_var$finalize_command$finalize_rpath
  9343. ;;
  9344. *,needless)
  9345. link_command=$finalize_var$compile_command$finalize_rpath
  9346. relink_command=
  9347. ;;
  9348. esac
  9349. # Replace the output file specification.
  9350. link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
  9351. # Delete the old output files.
  9352. $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname
  9353. func_show_eval "$link_command" 'exit $?'
  9354. if test -n "$postlink_cmds"; then
  9355. func_to_tool_file "$output_objdir/$outputname"
  9356. 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'`
  9357. func_execute_cmds "$postlink_cmds" 'exit $?'
  9358. fi
  9359. # Now create the wrapper script.
  9360. func_verbose "creating $output"
  9361. # Quote the relink command for shipping.
  9362. if test -n "$relink_command"; then
  9363. # Preserve any variables that may affect compiler behavior
  9364. for var in $variables_saved_for_relink; do
  9365. if eval test -z \"\${$var+set}\"; then
  9366. relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
  9367. elif eval var_value=\$$var; test -z "$var_value"; then
  9368. relink_command="$var=; export $var; $relink_command"
  9369. else
  9370. func_quote_for_eval "$var_value"
  9371. relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
  9372. fi
  9373. done
  9374. relink_command="(cd `pwd`; $relink_command)"
  9375. relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
  9376. fi
  9377. # Only actually do things if not in dry run mode.
  9378. $opt_dry_run || {
  9379. # win32 will think the script is a binary if it has
  9380. # a .exe suffix, so we strip it off here.
  9381. case $output in
  9382. *.exe) func_stripname '' '.exe' "$output"
  9383. output=$func_stripname_result ;;
  9384. esac
  9385. # test for cygwin because mv fails w/o .exe extensions
  9386. case $host in
  9387. *cygwin*)
  9388. exeext=.exe
  9389. func_stripname '' '.exe' "$outputname"
  9390. outputname=$func_stripname_result ;;
  9391. *) exeext= ;;
  9392. esac
  9393. case $host in
  9394. *cygwin* | *mingw* )
  9395. func_dirname_and_basename "$output" "" "."
  9396. output_name=$func_basename_result
  9397. output_path=$func_dirname_result
  9398. cwrappersource=$output_path/$objdir/lt-$output_name.c
  9399. cwrapper=$output_path/$output_name.exe
  9400. $RM $cwrappersource $cwrapper
  9401. trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
  9402. func_emit_cwrapperexe_src > $cwrappersource
  9403. # The wrapper executable is built using the $host compiler,
  9404. # because it contains $host paths and files. If cross-
  9405. # compiling, it, like the target executable, must be
  9406. # executed on the $host or under an emulation environment.
  9407. $opt_dry_run || {
  9408. $LTCC $LTCFLAGS -o $cwrapper $cwrappersource
  9409. $STRIP $cwrapper
  9410. }
  9411. # Now, create the wrapper script for func_source use:
  9412. func_ltwrapper_scriptname $cwrapper
  9413. $RM $func_ltwrapper_scriptname_result
  9414. trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15
  9415. $opt_dry_run || {
  9416. # note: this script will not be executed, so do not chmod.
  9417. if test "x$build" = "x$host"; then
  9418. $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result
  9419. else
  9420. func_emit_wrapper no > $func_ltwrapper_scriptname_result
  9421. fi
  9422. }
  9423. ;;
  9424. * )
  9425. $RM $output
  9426. trap "$RM $output; exit $EXIT_FAILURE" 1 2 15
  9427. func_emit_wrapper no > $output
  9428. chmod +x $output
  9429. ;;
  9430. esac
  9431. }
  9432. exit $EXIT_SUCCESS
  9433. ;;
  9434. esac
  9435. # See if we need to build an old-fashioned archive.
  9436. for oldlib in $oldlibs; do
  9437. case $build_libtool_libs in
  9438. convenience)
  9439. oldobjs="$libobjs_save $symfileobj"
  9440. addlibs=$convenience
  9441. build_libtool_libs=no
  9442. ;;
  9443. module)
  9444. oldobjs=$libobjs_save
  9445. addlibs=$old_convenience
  9446. build_libtool_libs=no
  9447. ;;
  9448. *)
  9449. oldobjs="$old_deplibs $non_pic_objects"
  9450. $preload && test -f "$symfileobj" \
  9451. && func_append oldobjs " $symfileobj"
  9452. addlibs=$old_convenience
  9453. ;;
  9454. esac
  9455. if test -n "$addlibs"; then
  9456. gentop=$output_objdir/${outputname}x
  9457. func_append generated " $gentop"
  9458. func_extract_archives $gentop $addlibs
  9459. func_append oldobjs " $func_extract_archives_result"
  9460. fi
  9461. # Do each command in the archive commands.
  9462. if test -n "$old_archive_from_new_cmds" && test yes = "$build_libtool_libs"; then
  9463. cmds=$old_archive_from_new_cmds
  9464. else
  9465. # Add any objects from preloaded convenience libraries
  9466. if test -n "$dlprefiles"; then
  9467. gentop=$output_objdir/${outputname}x
  9468. func_append generated " $gentop"
  9469. func_extract_archives $gentop $dlprefiles
  9470. func_append oldobjs " $func_extract_archives_result"
  9471. fi
  9472. # POSIX demands no paths to be encoded in archives. We have
  9473. # to avoid creating archives with duplicate basenames if we
  9474. # might have to extract them afterwards, e.g., when creating a
  9475. # static archive out of a convenience library, or when linking
  9476. # the entirety of a libtool archive into another (currently
  9477. # not supported by libtool).
  9478. if (for obj in $oldobjs
  9479. do
  9480. func_basename "$obj"
  9481. $ECHO "$func_basename_result"
  9482. done | sort | sort -uc >/dev/null 2>&1); then
  9483. :
  9484. else
  9485. echo "copying selected object files to avoid basename conflicts..."
  9486. gentop=$output_objdir/${outputname}x
  9487. func_append generated " $gentop"
  9488. func_mkdir_p "$gentop"
  9489. save_oldobjs=$oldobjs
  9490. oldobjs=
  9491. counter=1
  9492. for obj in $save_oldobjs
  9493. do
  9494. func_basename "$obj"
  9495. objbase=$func_basename_result
  9496. case " $oldobjs " in
  9497. " ") oldobjs=$obj ;;
  9498. *[\ /]"$objbase "*)
  9499. while :; do
  9500. # Make sure we don't pick an alternate name that also
  9501. # overlaps.
  9502. newobj=lt$counter-$objbase
  9503. func_arith $counter + 1
  9504. counter=$func_arith_result
  9505. case " $oldobjs " in
  9506. *[\ /]"$newobj "*) ;;
  9507. *) if test ! -f "$gentop/$newobj"; then break; fi ;;
  9508. esac
  9509. done
  9510. func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
  9511. func_append oldobjs " $gentop/$newobj"
  9512. ;;
  9513. *) func_append oldobjs " $obj" ;;
  9514. esac
  9515. done
  9516. fi
  9517. func_to_tool_file "$oldlib" func_convert_file_msys_to_w32
  9518. tool_oldlib=$func_to_tool_file_result
  9519. eval cmds=\"$old_archive_cmds\"
  9520. func_len " $cmds"
  9521. len=$func_len_result
  9522. if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
  9523. cmds=$old_archive_cmds
  9524. elif test -n "$archiver_list_spec"; then
  9525. func_verbose "using command file archive linking..."
  9526. for obj in $oldobjs
  9527. do
  9528. func_to_tool_file "$obj"
  9529. $ECHO "$func_to_tool_file_result"
  9530. done > $output_objdir/$libname.libcmd
  9531. func_to_tool_file "$output_objdir/$libname.libcmd"
  9532. oldobjs=" $archiver_list_spec$func_to_tool_file_result"
  9533. cmds=$old_archive_cmds
  9534. else
  9535. # the command line is too long to link in one step, link in parts
  9536. func_verbose "using piecewise archive linking..."
  9537. save_RANLIB=$RANLIB
  9538. RANLIB=:
  9539. objlist=
  9540. concat_cmds=
  9541. save_oldobjs=$oldobjs
  9542. oldobjs=
  9543. # Is there a better way of finding the last object in the list?
  9544. for obj in $save_oldobjs
  9545. do
  9546. last_oldobj=$obj
  9547. done
  9548. eval test_cmds=\"$old_archive_cmds\"
  9549. func_len " $test_cmds"
  9550. len0=$func_len_result
  9551. len=$len0
  9552. for obj in $save_oldobjs
  9553. do
  9554. func_len " $obj"
  9555. func_arith $len + $func_len_result
  9556. len=$func_arith_result
  9557. func_append objlist " $obj"
  9558. if test "$len" -lt "$max_cmd_len"; then
  9559. :
  9560. else
  9561. # the above command should be used before it gets too long
  9562. oldobjs=$objlist
  9563. if test "$obj" = "$last_oldobj"; then
  9564. RANLIB=$save_RANLIB
  9565. fi
  9566. test -z "$concat_cmds" || concat_cmds=$concat_cmds~
  9567. eval concat_cmds=\"\$concat_cmds$old_archive_cmds\"
  9568. objlist=
  9569. len=$len0
  9570. fi
  9571. done
  9572. RANLIB=$save_RANLIB
  9573. oldobjs=$objlist
  9574. if test -z "$oldobjs"; then
  9575. eval cmds=\"\$concat_cmds\"
  9576. else
  9577. eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
  9578. fi
  9579. fi
  9580. fi
  9581. func_execute_cmds "$cmds" 'exit $?'
  9582. done
  9583. test -n "$generated" && \
  9584. func_show_eval "${RM}r$generated"
  9585. # Now create the libtool archive.
  9586. case $output in
  9587. *.la)
  9588. old_library=
  9589. test yes = "$build_old_libs" && old_library=$libname.$libext
  9590. func_verbose "creating $output"
  9591. # Preserve any variables that may affect compiler behavior
  9592. for var in $variables_saved_for_relink; do
  9593. if eval test -z \"\${$var+set}\"; then
  9594. relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
  9595. elif eval var_value=\$$var; test -z "$var_value"; then
  9596. relink_command="$var=; export $var; $relink_command"
  9597. else
  9598. func_quote_for_eval "$var_value"
  9599. relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
  9600. fi
  9601. done
  9602. # Quote the link command for shipping.
  9603. relink_command="(cd `pwd`; $SHELL \"$progpath\" $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
  9604. relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
  9605. if test yes = "$hardcode_automatic"; then
  9606. relink_command=
  9607. fi
  9608. # Only create the output if not a dry run.
  9609. $opt_dry_run || {
  9610. for installed in no yes; do
  9611. if test yes = "$installed"; then
  9612. if test -z "$install_libdir"; then
  9613. break
  9614. fi
  9615. output=$output_objdir/${outputname}i
  9616. # Replace all uninstalled libtool libraries with the installed ones
  9617. newdependency_libs=
  9618. for deplib in $dependency_libs; do
  9619. case $deplib in
  9620. *.la)
  9621. func_basename "$deplib"
  9622. name=$func_basename_result
  9623. func_resolve_sysroot "$deplib"
  9624. eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $func_resolve_sysroot_result`
  9625. test -z "$libdir" && \
  9626. func_fatal_error "'$deplib' is not a valid libtool archive"
  9627. func_append newdependency_libs " ${lt_sysroot:+=}$libdir/$name"
  9628. ;;
  9629. -L*)
  9630. func_stripname -L '' "$deplib"
  9631. func_replace_sysroot "$func_stripname_result"
  9632. func_append newdependency_libs " -L$func_replace_sysroot_result"
  9633. ;;
  9634. -R*)
  9635. func_stripname -R '' "$deplib"
  9636. func_replace_sysroot "$func_stripname_result"
  9637. func_append newdependency_libs " -R$func_replace_sysroot_result"
  9638. ;;
  9639. *) func_append newdependency_libs " $deplib" ;;
  9640. esac
  9641. done
  9642. dependency_libs=$newdependency_libs
  9643. newdlfiles=
  9644. for lib in $dlfiles; do
  9645. case $lib in
  9646. *.la)
  9647. func_basename "$lib"
  9648. name=$func_basename_result
  9649. eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
  9650. test -z "$libdir" && \
  9651. func_fatal_error "'$lib' is not a valid libtool archive"
  9652. func_append newdlfiles " ${lt_sysroot:+=}$libdir/$name"
  9653. ;;
  9654. *) func_append newdlfiles " $lib" ;;
  9655. esac
  9656. done
  9657. dlfiles=$newdlfiles
  9658. newdlprefiles=
  9659. for lib in $dlprefiles; do
  9660. case $lib in
  9661. *.la)
  9662. # Only pass preopened files to the pseudo-archive (for
  9663. # eventual linking with the app. that links it) if we
  9664. # didn't already link the preopened objects directly into
  9665. # the library:
  9666. func_basename "$lib"
  9667. name=$func_basename_result
  9668. eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
  9669. test -z "$libdir" && \
  9670. func_fatal_error "'$lib' is not a valid libtool archive"
  9671. func_append newdlprefiles " ${lt_sysroot:+=}$libdir/$name"
  9672. ;;
  9673. esac
  9674. done
  9675. dlprefiles=$newdlprefiles
  9676. else
  9677. newdlfiles=
  9678. for lib in $dlfiles; do
  9679. case $lib in
  9680. [\\/]* | [A-Za-z]:[\\/]*) abs=$lib ;;
  9681. *) abs=`pwd`"/$lib" ;;
  9682. esac
  9683. func_append newdlfiles " $abs"
  9684. done
  9685. dlfiles=$newdlfiles
  9686. newdlprefiles=
  9687. for lib in $dlprefiles; do
  9688. case $lib in
  9689. [\\/]* | [A-Za-z]:[\\/]*) abs=$lib ;;
  9690. *) abs=`pwd`"/$lib" ;;
  9691. esac
  9692. func_append newdlprefiles " $abs"
  9693. done
  9694. dlprefiles=$newdlprefiles
  9695. fi
  9696. $RM $output
  9697. # place dlname in correct position for cygwin
  9698. # In fact, it would be nice if we could use this code for all target
  9699. # systems that can't hard-code library paths into their executables
  9700. # and that have no shared library path variable independent of PATH,
  9701. # but it turns out we can't easily determine that from inspecting
  9702. # libtool variables, so we have to hard-code the OSs to which it
  9703. # applies here; at the moment, that means platforms that use the PE
  9704. # object format with DLL files. See the long comment at the top of
  9705. # tests/bindir.at for full details.
  9706. tdlname=$dlname
  9707. case $host,$output,$installed,$module,$dlname in
  9708. *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll)
  9709. # If a -bindir argument was supplied, place the dll there.
  9710. if test -n "$bindir"; then
  9711. func_relative_path "$install_libdir" "$bindir"
  9712. tdlname=$func_relative_path_result/$dlname
  9713. else
  9714. # Otherwise fall back on heuristic.
  9715. tdlname=../bin/$dlname
  9716. fi
  9717. ;;
  9718. esac
  9719. $ECHO > $output "\
  9720. # $outputname - a libtool library file
  9721. # Generated by $PROGRAM (GNU $PACKAGE) $VERSION
  9722. #
  9723. # Please DO NOT delete this file!
  9724. # It is necessary for linking the library.
  9725. # The name that we can dlopen(3).
  9726. dlname='$tdlname'
  9727. # Names of this library.
  9728. library_names='$library_names'
  9729. # The name of the static archive.
  9730. old_library='$old_library'
  9731. # Linker flags that cannot go in dependency_libs.
  9732. inherited_linker_flags='$new_inherited_linker_flags'
  9733. # Libraries that this one depends upon.
  9734. dependency_libs='$dependency_libs'
  9735. # Names of additional weak libraries provided by this library
  9736. weak_library_names='$weak_libs'
  9737. # Version information for $libname.
  9738. current=$current
  9739. age=$age
  9740. revision=$revision
  9741. # Is this an already installed library?
  9742. installed=$installed
  9743. # Should we warn about portability when linking against -modules?
  9744. shouldnotlink=$module
  9745. # Files to dlopen/dlpreopen
  9746. dlopen='$dlfiles'
  9747. dlpreopen='$dlprefiles'
  9748. # Directory that this library needs to be installed in:
  9749. libdir='$install_libdir'"
  9750. if test no,yes = "$installed,$need_relink"; then
  9751. $ECHO >> $output "\
  9752. relink_command=\"$relink_command\""
  9753. fi
  9754. done
  9755. }
  9756. # Do a symbolic link so that the libtool archive can be found in
  9757. # LD_LIBRARY_PATH before the program is installed.
  9758. func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?'
  9759. ;;
  9760. esac
  9761. exit $EXIT_SUCCESS
  9762. }
  9763. if test link = "$opt_mode" || test relink = "$opt_mode"; then
  9764. func_mode_link ${1+"$@"}
  9765. fi
  9766. # func_mode_uninstall arg...
  9767. func_mode_uninstall ()
  9768. {
  9769. $debug_cmd
  9770. RM=$nonopt
  9771. files=
  9772. rmforce=false
  9773. exit_status=0
  9774. # This variable tells wrapper scripts just to set variables rather
  9775. # than running their programs.
  9776. libtool_install_magic=$magic
  9777. for arg
  9778. do
  9779. case $arg in
  9780. -f) func_append RM " $arg"; rmforce=: ;;
  9781. -*) func_append RM " $arg" ;;
  9782. *) func_append files " $arg" ;;
  9783. esac
  9784. done
  9785. test -z "$RM" && \
  9786. func_fatal_help "you must specify an RM program"
  9787. rmdirs=
  9788. for file in $files; do
  9789. func_dirname "$file" "" "."
  9790. dir=$func_dirname_result
  9791. if test . = "$dir"; then
  9792. odir=$objdir
  9793. else
  9794. odir=$dir/$objdir
  9795. fi
  9796. func_basename "$file"
  9797. name=$func_basename_result
  9798. test uninstall = "$opt_mode" && odir=$dir
  9799. # Remember odir for removal later, being careful to avoid duplicates
  9800. if test clean = "$opt_mode"; then
  9801. case " $rmdirs " in
  9802. *" $odir "*) ;;
  9803. *) func_append rmdirs " $odir" ;;
  9804. esac
  9805. fi
  9806. # Don't error if the file doesn't exist and rm -f was used.
  9807. if { test -L "$file"; } >/dev/null 2>&1 ||
  9808. { test -h "$file"; } >/dev/null 2>&1 ||
  9809. test -f "$file"; then
  9810. :
  9811. elif test -d "$file"; then
  9812. exit_status=1
  9813. continue
  9814. elif $rmforce; then
  9815. continue
  9816. fi
  9817. rmfiles=$file
  9818. case $name in
  9819. *.la)
  9820. # Possibly a libtool archive, so verify it.
  9821. if func_lalib_p "$file"; then
  9822. func_source $dir/$name
  9823. # Delete the libtool libraries and symlinks.
  9824. for n in $library_names; do
  9825. func_append rmfiles " $odir/$n"
  9826. done
  9827. test -n "$old_library" && func_append rmfiles " $odir/$old_library"
  9828. case $opt_mode in
  9829. clean)
  9830. case " $library_names " in
  9831. *" $dlname "*) ;;
  9832. *) test -n "$dlname" && func_append rmfiles " $odir/$dlname" ;;
  9833. esac
  9834. test -n "$libdir" && func_append rmfiles " $odir/$name $odir/${name}i"
  9835. ;;
  9836. uninstall)
  9837. if test -n "$library_names"; then
  9838. # Do each command in the postuninstall commands.
  9839. func_execute_cmds "$postuninstall_cmds" '$rmforce || exit_status=1'
  9840. fi
  9841. if test -n "$old_library"; then
  9842. # Do each command in the old_postuninstall commands.
  9843. func_execute_cmds "$old_postuninstall_cmds" '$rmforce || exit_status=1'
  9844. fi
  9845. # FIXME: should reinstall the best remaining shared library.
  9846. ;;
  9847. esac
  9848. fi
  9849. ;;
  9850. *.lo)
  9851. # Possibly a libtool object, so verify it.
  9852. if func_lalib_p "$file"; then
  9853. # Read the .lo file
  9854. func_source $dir/$name
  9855. # Add PIC object to the list of files to remove.
  9856. if test -n "$pic_object" && test none != "$pic_object"; then
  9857. func_append rmfiles " $dir/$pic_object"
  9858. fi
  9859. # Add non-PIC object to the list of files to remove.
  9860. if test -n "$non_pic_object" && test none != "$non_pic_object"; then
  9861. func_append rmfiles " $dir/$non_pic_object"
  9862. fi
  9863. fi
  9864. ;;
  9865. *)
  9866. if test clean = "$opt_mode"; then
  9867. noexename=$name
  9868. case $file in
  9869. *.exe)
  9870. func_stripname '' '.exe' "$file"
  9871. file=$func_stripname_result
  9872. func_stripname '' '.exe' "$name"
  9873. noexename=$func_stripname_result
  9874. # $file with .exe has already been added to rmfiles,
  9875. # add $file without .exe
  9876. func_append rmfiles " $file"
  9877. ;;
  9878. esac
  9879. # Do a test to see if this is a libtool program.
  9880. if func_ltwrapper_p "$file"; then
  9881. if func_ltwrapper_executable_p "$file"; then
  9882. func_ltwrapper_scriptname "$file"
  9883. relink_command=
  9884. func_source $func_ltwrapper_scriptname_result
  9885. func_append rmfiles " $func_ltwrapper_scriptname_result"
  9886. else
  9887. relink_command=
  9888. func_source $dir/$noexename
  9889. fi
  9890. # note $name still contains .exe if it was in $file originally
  9891. # as does the version of $file that was added into $rmfiles
  9892. func_append rmfiles " $odir/$name $odir/${name}S.$objext"
  9893. if test yes = "$fast_install" && test -n "$relink_command"; then
  9894. func_append rmfiles " $odir/lt-$name"
  9895. fi
  9896. if test "X$noexename" != "X$name"; then
  9897. func_append rmfiles " $odir/lt-$noexename.c"
  9898. fi
  9899. fi
  9900. fi
  9901. ;;
  9902. esac
  9903. func_show_eval "$RM $rmfiles" 'exit_status=1'
  9904. done
  9905. # Try to remove the $objdir's in the directories where we deleted files
  9906. for dir in $rmdirs; do
  9907. if test -d "$dir"; then
  9908. func_show_eval "rmdir $dir >/dev/null 2>&1"
  9909. fi
  9910. done
  9911. exit $exit_status
  9912. }
  9913. if test uninstall = "$opt_mode" || test clean = "$opt_mode"; then
  9914. func_mode_uninstall ${1+"$@"}
  9915. fi
  9916. test -z "$opt_mode" && {
  9917. help=$generic_help
  9918. func_fatal_help "you must specify a MODE"
  9919. }
  9920. test -z "$exec_cmd" && \
  9921. func_fatal_help "invalid operation mode '$opt_mode'"
  9922. if test -n "$exec_cmd"; then
  9923. eval exec "$exec_cmd"
  9924. exit $EXIT_FAILURE
  9925. fi
  9926. exit $exit_status
  9927. # The TAGs below are defined such that we never get into a situation
  9928. # where we disable both kinds of libraries. Given conflicting
  9929. # choices, we go for a static library, that is the most portable,
  9930. # since we can't tell whether shared libraries were disabled because
  9931. # the user asked for that or because the platform doesn't support
  9932. # them. This is particularly important on AIX, because we don't
  9933. # support having both static and shared libraries enabled at the same
  9934. # time on that platform, so we default to a shared-only configuration.
  9935. # If a disable-shared tag is given, we'll fallback to a static-only
  9936. # configuration. But we'll never go from static-only to shared-only.
  9937. # ### BEGIN LIBTOOL TAG CONFIG: disable-shared
  9938. build_libtool_libs=no
  9939. build_old_libs=yes
  9940. # ### END LIBTOOL TAG CONFIG: disable-shared
  9941. # ### BEGIN LIBTOOL TAG CONFIG: disable-static
  9942. build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
  9943. # ### END LIBTOOL TAG CONFIG: disable-static
  9944. # Local Variables:
  9945. # mode:shell-script
  9946. # sh-indentation:2
  9947. # End: