libtool 332 KB

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