ltmain.sh 325 KB

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