ltmain.sh 325 KB

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