libtool 332 KB

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