ltmain.sh 326 KB

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