ltmain.sh 248 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765
  1. # Generated from ltmain.m4sh.
  2. # libtool (GNU libtool) 2.2.10
  3. # Written by Gordon Matzigkeit <[email protected]>, 1996
  4. # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006,
  5. # 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
  6. # This is free software; see the source for copying conditions. There is NO
  7. # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  8. # GNU Libtool is free software; you can redistribute it and/or modify
  9. # it under the terms of the GNU General Public License as published by
  10. # the Free Software Foundation; either version 2 of the License, or
  11. # (at your option) any later version.
  12. #
  13. # As a special exception to the GNU General Public License,
  14. # if you distribute this file as part of a program or library that
  15. # is built using GNU Libtool, you may include this file under the
  16. # same distribution terms that you use for the rest of that program.
  17. #
  18. # GNU Libtool is distributed in the hope that it will be useful, but
  19. # WITHOUT ANY WARRANTY; without even the implied warranty of
  20. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  21. # General Public License for more details.
  22. #
  23. # You should have received a copy of the GNU General Public License
  24. # along with GNU Libtool; see the file COPYING. If not, a copy
  25. # can be downloaded from http://www.gnu.org/licenses/gpl.html,
  26. # or obtained by writing to the Free Software Foundation, Inc.,
  27. # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  28. # Usage: $progname [OPTION]... [MODE-ARG]...
  29. #
  30. # Provide generalized library-building support services.
  31. #
  32. # --config show all configuration variables
  33. # --debug enable verbose shell tracing
  34. # -n, --dry-run display commands without modifying any files
  35. # --features display basic configuration information and exit
  36. # --mode=MODE use operation mode MODE
  37. # --preserve-dup-deps don't remove duplicate dependency libraries
  38. # --quiet, --silent don't print informational messages
  39. # --no-quiet, --no-silent
  40. # print informational messages (default)
  41. # --tag=TAG use configuration variables from tag TAG
  42. # -v, --verbose print more informational messages than default
  43. # --no-verbose don't print the extra informational messages
  44. # --version print version information
  45. # -h, --help, --help-all print short, long, or detailed help message
  46. #
  47. # MODE must be one of the following:
  48. #
  49. # clean remove files from the build directory
  50. # compile compile a source file into a libtool object
  51. # execute automatically set library path, then run a program
  52. # finish complete the installation of libtool libraries
  53. # install install libraries or executables
  54. # link create a library or an executable
  55. # uninstall remove libraries from an installed directory
  56. #
  57. # MODE-ARGS vary depending on the MODE. When passed as first option,
  58. # `--mode=MODE' may be abbreviated as `MODE' or a unique abbreviation of that.
  59. # Try `$progname --help --mode=MODE' for a more detailed description of MODE.
  60. #
  61. # When reporting a bug, please describe a test case to reproduce it and
  62. # include the following information:
  63. #
  64. # host-triplet: $host
  65. # shell: $SHELL
  66. # compiler: $LTCC
  67. # compiler flags: $LTCFLAGS
  68. # linker: $LD (gnu? $with_gnu_ld)
  69. # $progname: (GNU libtool) 2.2.10
  70. # automake: $automake_version
  71. # autoconf: $autoconf_version
  72. #
  73. # Report bugs to <[email protected]>.
  74. PROGRAM=libtool
  75. PACKAGE=libtool
  76. VERSION=2.2.10
  77. TIMESTAMP=""
  78. package_revision=1.3175
  79. # define SED for historic ltconfig's generated by Libtool 1.3
  80. test -z "$SED" && SED=sed
  81. # Be Bourne compatible
  82. if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
  83. emulate sh
  84. NULLCMD=:
  85. # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
  86. # is contrary to our usage. Disable this feature.
  87. alias -g '${1+"$@"}'='"$@"'
  88. setopt NO_GLOB_SUBST
  89. else
  90. case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
  91. fi
  92. BIN_SH=xpg4; export BIN_SH # for Tru64
  93. DUALCASE=1; export DUALCASE # for MKS sh
  94. # A function that is used when there is no print builtin or printf.
  95. func_fallback_echo ()
  96. {
  97. eval 'cat <<_LTECHO_EOF
  98. $1
  99. _LTECHO_EOF'
  100. }
  101. # NLS nuisances: We save the old values to restore during execute mode.
  102. lt_user_locale=
  103. lt_safe_locale=
  104. for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
  105. do
  106. eval "if test \"\${$lt_var+set}\" = set; then
  107. save_$lt_var=\$$lt_var
  108. $lt_var=C
  109. export $lt_var
  110. lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\"
  111. lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\"
  112. fi"
  113. done
  114. LC_ALL=C
  115. LANGUAGE=C
  116. export LANGUAGE LC_ALL
  117. $lt_unset CDPATH
  118. # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
  119. # is ksh but when the shell is invoked as "sh" and the current value of
  120. # the _XPG environment variable is not equal to 1 (one), the special
  121. # positional parameter $0, within a function call, is the name of the
  122. # function.
  123. progpath="$0"
  124. : ${CP="cp -f"}
  125. test "${ECHO+set}" = set || ECHO=${as_echo-'printf %s\n'}
  126. : ${EGREP="/bin/grep -E"}
  127. : ${FGREP="/bin/grep -F"}
  128. : ${GREP="/bin/grep"}
  129. : ${LN_S="ln -s"}
  130. : ${MAKE="make"}
  131. : ${MKDIR="mkdir"}
  132. : ${MV="mv -f"}
  133. : ${RM="rm -f"}
  134. : ${SED="/bin/sed"}
  135. : ${SHELL="${CONFIG_SHELL-/bin/sh}"}
  136. : ${Xsed="$SED -e 1s/^X//"}
  137. # Global variables:
  138. EXIT_SUCCESS=0
  139. EXIT_FAILURE=1
  140. EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing.
  141. EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake.
  142. exit_status=$EXIT_SUCCESS
  143. # Make sure IFS has a sensible default
  144. lt_nl='
  145. '
  146. IFS=" $lt_nl"
  147. dirname="s,/[^/]*$,,"
  148. basename="s,^.*/,,"
  149. # func_dirname_and_basename file append nondir_replacement
  150. # perform func_basename and func_dirname in a single function
  151. # call:
  152. # dirname: Compute the dirname of FILE. If nonempty,
  153. # add APPEND to the result, otherwise set result
  154. # to NONDIR_REPLACEMENT.
  155. # value returned in "$func_dirname_result"
  156. # basename: Compute filename of FILE.
  157. # value retuned in "$func_basename_result"
  158. # Implementation must be kept synchronized with func_dirname
  159. # and func_basename. For efficiency, we do not delegate to
  160. # those functions but instead duplicate the functionality here.
  161. func_dirname_and_basename ()
  162. {
  163. # Extract subdirectory from the argument.
  164. func_dirname_result=`$ECHO "${1}" | $SED -e "$dirname"`
  165. if test "X$func_dirname_result" = "X${1}"; then
  166. func_dirname_result="${3}"
  167. else
  168. func_dirname_result="$func_dirname_result${2}"
  169. fi
  170. func_basename_result=`$ECHO "${1}" | $SED -e "$basename"`
  171. }
  172. # Generated shell functions inserted here.
  173. # These SED scripts presuppose an absolute path with a trailing slash.
  174. pathcar='s,^/\([^/]*\).*$,\1,'
  175. pathcdr='s,^/[^/]*,,'
  176. removedotparts=':dotsl
  177. s@/\./@/@g
  178. t dotsl
  179. s,/\.$,/,'
  180. collapseslashes='s@/\{1,\}@/@g'
  181. finalslash='s,/*$,/,'
  182. # func_normal_abspath PATH
  183. # Remove doubled-up and trailing slashes, "." path components,
  184. # and cancel out any ".." path components in PATH after making
  185. # it an absolute path.
  186. # value returned in "$func_normal_abspath_result"
  187. func_normal_abspath ()
  188. {
  189. # Start from root dir and reassemble the path.
  190. func_normal_abspath_result=
  191. func_normal_abspath_tpath=$1
  192. func_normal_abspath_altnamespace=
  193. case $func_normal_abspath_tpath in
  194. "")
  195. # Empty path, that just means $cwd.
  196. func_stripname '' '/' "`pwd`"
  197. func_normal_abspath_result=$func_stripname_result
  198. return
  199. ;;
  200. # The next three entries are used to spot a run of precisely
  201. # two leading slashes without using negated character classes;
  202. # we take advantage of case's first-match behaviour.
  203. ///*)
  204. # Unusual form of absolute path, do nothing.
  205. ;;
  206. //*)
  207. # Not necessarily an ordinary path; POSIX reserves leading '//'
  208. # and for example Cygwin uses it to access remote file shares
  209. # over CIFS/SMB, so we conserve a leading double slash if found.
  210. func_normal_abspath_altnamespace=/
  211. ;;
  212. /*)
  213. # Absolute path, do nothing.
  214. ;;
  215. *)
  216. # Relative path, prepend $cwd.
  217. func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath
  218. ;;
  219. esac
  220. # Cancel out all the simple stuff to save iterations. We also want
  221. # the path to end with a slash for ease of parsing, so make sure
  222. # there is one (and only one) here.
  223. func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
  224. -e "$removedotparts" -e "$collapseslashes" -e "$finalslash"`
  225. while :; do
  226. # Processed it all yet?
  227. if test "$func_normal_abspath_tpath" = / ; then
  228. # If we ascended to the root using ".." the result may be empty now.
  229. if test -z "$func_normal_abspath_result" ; then
  230. func_normal_abspath_result=/
  231. fi
  232. break
  233. fi
  234. func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \
  235. -e "$pathcar"`
  236. func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
  237. -e "$pathcdr"`
  238. # Figure out what to do with it
  239. case $func_normal_abspath_tcomponent in
  240. "")
  241. # Trailing empty path component, ignore it.
  242. ;;
  243. ..)
  244. # Parent dir; strip last assembled component from result.
  245. func_dirname "$func_normal_abspath_result"
  246. func_normal_abspath_result=$func_dirname_result
  247. ;;
  248. *)
  249. # Actual path component, append it.
  250. func_normal_abspath_result=$func_normal_abspath_result/$func_normal_abspath_tcomponent
  251. ;;
  252. esac
  253. done
  254. # Restore leading double-slash if one was found on entry.
  255. func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result
  256. }
  257. # func_relative_path SRCDIR DSTDIR
  258. # generates a relative path from SRCDIR to DSTDIR, with a trailing
  259. # slash if non-empty, suitable for immediately appending a filename
  260. # without needing to append a separator.
  261. # value returned in "$func_relative_path_result"
  262. func_relative_path ()
  263. {
  264. func_relative_path_result=
  265. func_normal_abspath "$1"
  266. func_relative_path_tlibdir=$func_normal_abspath_result
  267. func_normal_abspath "$2"
  268. func_relative_path_tbindir=$func_normal_abspath_result
  269. # Ascend the tree starting from libdir
  270. while :; do
  271. # check if we have found a prefix of bindir
  272. case $func_relative_path_tbindir in
  273. $func_relative_path_tlibdir)
  274. # found an exact match
  275. func_relative_path_tcancelled=
  276. break
  277. ;;
  278. $func_relative_path_tlibdir*)
  279. # found a matching prefix
  280. func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir"
  281. func_relative_path_tcancelled=$func_stripname_result
  282. if test -z "$func_relative_path_result"; then
  283. func_relative_path_result=.
  284. fi
  285. break
  286. ;;
  287. *)
  288. func_dirname $func_relative_path_tlibdir
  289. func_relative_path_tlibdir=${func_dirname_result}
  290. if test "x$func_relative_path_tlibdir" = x ; then
  291. # Have to descend all the way to the root!
  292. func_relative_path_result=../$func_relative_path_result
  293. func_relative_path_tcancelled=$func_relative_path_tbindir
  294. break
  295. fi
  296. func_relative_path_result=../$func_relative_path_result
  297. ;;
  298. esac
  299. done
  300. # Now calculate path; take care to avoid doubling-up slashes.
  301. func_stripname '' '/' "$func_relative_path_result"
  302. func_relative_path_result=$func_stripname_result
  303. func_stripname '/' '/' "$func_relative_path_tcancelled"
  304. if test "x$func_stripname_result" != x ; then
  305. func_relative_path_result=${func_relative_path_result}/${func_stripname_result}
  306. fi
  307. # Normalisation. If bindir is libdir, return empty string,
  308. # else relative path ending with a slash; either way, target
  309. # file name can be directly appended.
  310. if test ! -z "$func_relative_path_result"; then
  311. func_stripname './' '' "$func_relative_path_result/"
  312. func_relative_path_result=$func_stripname_result
  313. fi
  314. }
  315. # The name of this program:
  316. func_dirname_and_basename "$progpath"
  317. progname=$func_basename_result
  318. # Make sure we have an absolute path for reexecution:
  319. case $progpath in
  320. [\\/]*|[A-Za-z]:\\*) ;;
  321. *[\\/]*)
  322. progdir=$func_dirname_result
  323. progdir=`cd "$progdir" && pwd`
  324. progpath="$progdir/$progname"
  325. ;;
  326. *)
  327. save_IFS="$IFS"
  328. IFS=:
  329. for progdir in $PATH; do
  330. IFS="$save_IFS"
  331. test -x "$progdir/$progname" && break
  332. done
  333. IFS="$save_IFS"
  334. test -n "$progdir" || progdir=`pwd`
  335. progpath="$progdir/$progname"
  336. ;;
  337. esac
  338. # Sed substitution that helps us do robust quoting. It backslashifies
  339. # metacharacters that are still active within double-quoted strings.
  340. Xsed="${SED}"' -e 1s/^X//'
  341. sed_quote_subst='s/\([`"$\\]\)/\\\1/g'
  342. # Same as above, but do not quote variable references.
  343. double_quote_subst='s/\(["`\\]\)/\\\1/g'
  344. # Re-`\' parameter expansions in output of double_quote_subst that were
  345. # `\'-ed in input to the same. If an odd number of `\' preceded a '$'
  346. # in input to double_quote_subst, that '$' was protected from expansion.
  347. # Since each input `\' is now two `\'s, look for any number of runs of
  348. # four `\'s followed by two `\'s and then a '$'. `\' that '$'.
  349. bs='\\'
  350. bs2='\\\\'
  351. bs4='\\\\\\\\'
  352. dollar='\$'
  353. sed_double_backslash="\
  354. s/$bs4/&\\
  355. /g
  356. s/^$bs2$dollar/$bs&/
  357. s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g
  358. s/\n//g"
  359. # Standard options:
  360. opt_dry_run=false
  361. opt_help=false
  362. opt_quiet=false
  363. opt_verbose=false
  364. opt_warning=:
  365. # func_echo arg...
  366. # Echo program name prefixed message, along with the current mode
  367. # name if it has been set yet.
  368. func_echo ()
  369. {
  370. $ECHO "$progname${mode+: }$mode: $*"
  371. }
  372. # func_verbose arg...
  373. # Echo program name prefixed message in verbose mode only.
  374. func_verbose ()
  375. {
  376. $opt_verbose && func_echo ${1+"$@"}
  377. # A bug in bash halts the script if the last line of a function
  378. # fails when set -e is in force, so we need another command to
  379. # work around that:
  380. :
  381. }
  382. # func_echo_all arg...
  383. # Invoke $ECHO with all args, space-separated.
  384. func_echo_all ()
  385. {
  386. $ECHO "$*"
  387. }
  388. # func_error arg...
  389. # Echo program name prefixed message to standard error.
  390. func_error ()
  391. {
  392. $ECHO "$progname${mode+: }$mode: "${1+"$@"} 1>&2
  393. }
  394. # func_warning arg...
  395. # Echo program name prefixed warning message to standard error.
  396. func_warning ()
  397. {
  398. $opt_warning && $ECHO "$progname${mode+: }$mode: warning: "${1+"$@"} 1>&2
  399. # bash bug again:
  400. :
  401. }
  402. # func_fatal_error arg...
  403. # Echo program name prefixed message to standard error, and exit.
  404. func_fatal_error ()
  405. {
  406. func_error ${1+"$@"}
  407. exit $EXIT_FAILURE
  408. }
  409. # func_fatal_help arg...
  410. # Echo program name prefixed message to standard error, followed by
  411. # a help hint, and exit.
  412. func_fatal_help ()
  413. {
  414. func_error ${1+"$@"}
  415. func_fatal_error "$help"
  416. }
  417. help="Try \`$progname --help' for more information." ## default
  418. # func_grep expression filename
  419. # Check whether EXPRESSION matches any line of FILENAME, without output.
  420. func_grep ()
  421. {
  422. $GREP "$1" "$2" >/dev/null 2>&1
  423. }
  424. # func_mkdir_p directory-path
  425. # Make sure the entire path to DIRECTORY-PATH is available.
  426. func_mkdir_p ()
  427. {
  428. my_directory_path="$1"
  429. my_dir_list=
  430. if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then
  431. # Protect directory names starting with `-'
  432. case $my_directory_path in
  433. -*) my_directory_path="./$my_directory_path" ;;
  434. esac
  435. # While some portion of DIR does not yet exist...
  436. while test ! -d "$my_directory_path"; do
  437. # ...make a list in topmost first order. Use a colon delimited
  438. # list incase some portion of path contains whitespace.
  439. my_dir_list="$my_directory_path:$my_dir_list"
  440. # If the last portion added has no slash in it, the list is done
  441. case $my_directory_path in */*) ;; *) break ;; esac
  442. # ...otherwise throw away the child directory and loop
  443. my_directory_path=`$ECHO "$my_directory_path" | $SED -e "$dirname"`
  444. done
  445. my_dir_list=`$ECHO "$my_dir_list" | $SED 's,:*$,,'`
  446. save_mkdir_p_IFS="$IFS"; IFS=':'
  447. for my_dir in $my_dir_list; do
  448. IFS="$save_mkdir_p_IFS"
  449. # mkdir can fail with a `File exist' error if two processes
  450. # try to create one of the directories concurrently. Don't
  451. # stop in that case!
  452. $MKDIR "$my_dir" 2>/dev/null || :
  453. done
  454. IFS="$save_mkdir_p_IFS"
  455. # Bail out if we (or some other process) failed to create a directory.
  456. test -d "$my_directory_path" || \
  457. func_fatal_error "Failed to create \`$1'"
  458. fi
  459. }
  460. # func_mktempdir [string]
  461. # Make a temporary directory that won't clash with other running
  462. # libtool processes, and avoids race conditions if possible. If
  463. # given, STRING is the basename for that directory.
  464. func_mktempdir ()
  465. {
  466. my_template="${TMPDIR-/tmp}/${1-$progname}"
  467. if test "$opt_dry_run" = ":"; then
  468. # Return a directory name, but don't create it in dry-run mode
  469. my_tmpdir="${my_template}-$$"
  470. else
  471. # If mktemp works, use that first and foremost
  472. my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
  473. if test ! -d "$my_tmpdir"; then
  474. # Failing that, at least try and use $RANDOM to avoid a race
  475. my_tmpdir="${my_template}-${RANDOM-0}$$"
  476. save_mktempdir_umask=`umask`
  477. umask 0077
  478. $MKDIR "$my_tmpdir"
  479. umask $save_mktempdir_umask
  480. fi
  481. # If we're not in dry-run mode, bomb out on failure
  482. test -d "$my_tmpdir" || \
  483. func_fatal_error "cannot create temporary directory \`$my_tmpdir'"
  484. fi
  485. $ECHO "$my_tmpdir"
  486. }
  487. # func_quote_for_eval arg
  488. # Aesthetically quote ARG to be evaled later.
  489. # This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT
  490. # is double-quoted, suitable for a subsequent eval, whereas
  491. # FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters
  492. # which are still active within double quotes backslashified.
  493. func_quote_for_eval ()
  494. {
  495. case $1 in
  496. *[\\\`\"\$]*)
  497. func_quote_for_eval_unquoted_result=`$ECHO "$1" | $SED "$sed_quote_subst"` ;;
  498. *)
  499. func_quote_for_eval_unquoted_result="$1" ;;
  500. esac
  501. case $func_quote_for_eval_unquoted_result in
  502. # Double-quote args containing shell metacharacters to delay
  503. # word splitting, command substitution and and variable
  504. # expansion for a subsequent eval.
  505. # Many Bourne shells cannot handle close brackets correctly
  506. # in scan sets, so we specify it separately.
  507. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
  508. func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\""
  509. ;;
  510. *)
  511. func_quote_for_eval_result="$func_quote_for_eval_unquoted_result"
  512. esac
  513. }
  514. # func_quote_for_expand arg
  515. # Aesthetically quote ARG to be evaled later; same as above,
  516. # but do not quote variable references.
  517. func_quote_for_expand ()
  518. {
  519. case $1 in
  520. *[\\\`\"]*)
  521. my_arg=`$ECHO "$1" | $SED \
  522. -e "$double_quote_subst" -e "$sed_double_backslash"` ;;
  523. *)
  524. my_arg="$1" ;;
  525. esac
  526. case $my_arg in
  527. # Double-quote args containing shell metacharacters to delay
  528. # word splitting and command substitution for a subsequent eval.
  529. # Many Bourne shells cannot handle close brackets correctly
  530. # in scan sets, so we specify it separately.
  531. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
  532. my_arg="\"$my_arg\""
  533. ;;
  534. esac
  535. func_quote_for_expand_result="$my_arg"
  536. }
  537. # func_show_eval cmd [fail_exp]
  538. # Unless opt_silent is true, then output CMD. Then, if opt_dryrun is
  539. # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
  540. # is given, then evaluate it.
  541. func_show_eval ()
  542. {
  543. my_cmd="$1"
  544. my_fail_exp="${2-:}"
  545. ${opt_silent-false} || {
  546. func_quote_for_expand "$my_cmd"
  547. eval "func_echo $func_quote_for_expand_result"
  548. }
  549. if ${opt_dry_run-false}; then :; else
  550. eval "$my_cmd"
  551. my_status=$?
  552. if test "$my_status" -eq 0; then :; else
  553. eval "(exit $my_status); $my_fail_exp"
  554. fi
  555. fi
  556. }
  557. # func_show_eval_locale cmd [fail_exp]
  558. # Unless opt_silent is true, then output CMD. Then, if opt_dryrun is
  559. # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
  560. # is given, then evaluate it. Use the saved locale for evaluation.
  561. func_show_eval_locale ()
  562. {
  563. my_cmd="$1"
  564. my_fail_exp="${2-:}"
  565. ${opt_silent-false} || {
  566. func_quote_for_expand "$my_cmd"
  567. eval "func_echo $func_quote_for_expand_result"
  568. }
  569. if ${opt_dry_run-false}; then :; else
  570. eval "$lt_user_locale
  571. $my_cmd"
  572. my_status=$?
  573. eval "$lt_safe_locale"
  574. if test "$my_status" -eq 0; then :; else
  575. eval "(exit $my_status); $my_fail_exp"
  576. fi
  577. fi
  578. }
  579. # func_version
  580. # Echo version message to standard output and exit.
  581. func_version ()
  582. {
  583. $SED -n '/(C)/!b go
  584. :more
  585. /\./!{
  586. N
  587. s/\n# / /
  588. b more
  589. }
  590. :go
  591. /^# '$PROGRAM' (GNU /,/# warranty; / {
  592. s/^# //
  593. s/^# *$//
  594. s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/
  595. p
  596. }' < "$progpath"
  597. exit $?
  598. }
  599. # func_usage
  600. # Echo short help message to standard output and exit.
  601. func_usage ()
  602. {
  603. $SED -n '/^# Usage:/,/^# *.*--help/ {
  604. s/^# //
  605. s/^# *$//
  606. s/\$progname/'$progname'/
  607. p
  608. }' < "$progpath"
  609. echo
  610. $ECHO "run \`$progname --help | more' for full usage"
  611. exit $?
  612. }
  613. # func_help [NOEXIT]
  614. # Echo long help message to standard output and exit,
  615. # unless 'noexit' is passed as argument.
  616. func_help ()
  617. {
  618. $SED -n '/^# Usage:/,/# Report bugs to/ {
  619. s/^# //
  620. s/^# *$//
  621. s*\$progname*'$progname'*
  622. s*\$host*'"$host"'*
  623. s*\$SHELL*'"$SHELL"'*
  624. s*\$LTCC*'"$LTCC"'*
  625. s*\$LTCFLAGS*'"$LTCFLAGS"'*
  626. s*\$LD*'"$LD"'*
  627. s/\$with_gnu_ld/'"$with_gnu_ld"'/
  628. s/\$automake_version/'"`(automake --version) 2>/dev/null |$SED 1q`"'/
  629. s/\$autoconf_version/'"`(autoconf --version) 2>/dev/null |$SED 1q`"'/
  630. p
  631. }' < "$progpath"
  632. ret=$?
  633. if test -z "$1"; then
  634. exit $ret
  635. fi
  636. }
  637. # func_missing_arg argname
  638. # Echo program name prefixed message to standard error and set global
  639. # exit_cmd.
  640. func_missing_arg ()
  641. {
  642. func_error "missing argument for $1."
  643. exit_cmd=exit
  644. }
  645. exit_cmd=:
  646. magic="%%%MAGIC variable%%%"
  647. magic_exe="%%%MAGIC EXE variable%%%"
  648. # Global variables.
  649. # $mode is unset
  650. nonopt=
  651. execute_dlfiles=
  652. preserve_args=
  653. lo2o="s/\\.lo\$/.${objext}/"
  654. o2lo="s/\\.${objext}\$/.lo/"
  655. extracted_archives=
  656. extracted_serial=0
  657. opt_dry_run=false
  658. opt_duplicate_deps=false
  659. opt_silent=false
  660. opt_debug=:
  661. # If this variable is set in any of the actions, the command in it
  662. # will be execed at the end. This prevents here-documents from being
  663. # left over by shells.
  664. exec_cmd=
  665. # func_fatal_configuration arg...
  666. # Echo program name prefixed message to standard error, followed by
  667. # a configuration failure hint, and exit.
  668. func_fatal_configuration ()
  669. {
  670. func_error ${1+"$@"}
  671. func_error "See the $PACKAGE documentation for more information."
  672. func_fatal_error "Fatal configuration error."
  673. }
  674. # func_config
  675. # Display the configuration for all the tags in this script.
  676. func_config ()
  677. {
  678. re_begincf='^# ### BEGIN LIBTOOL'
  679. re_endcf='^# ### END LIBTOOL'
  680. # Default configuration.
  681. $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath"
  682. # Now print the configurations for the tags.
  683. for tagname in $taglist; do
  684. $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath"
  685. done
  686. exit $?
  687. }
  688. # func_features
  689. # Display the features supported by this script.
  690. func_features ()
  691. {
  692. echo "host: $host"
  693. if test "$build_libtool_libs" = yes; then
  694. echo "enable shared libraries"
  695. else
  696. echo "disable shared libraries"
  697. fi
  698. if test "$build_old_libs" = yes; then
  699. echo "enable static libraries"
  700. else
  701. echo "disable static libraries"
  702. fi
  703. exit $?
  704. }
  705. # func_enable_tag tagname
  706. # Verify that TAGNAME is valid, and either flag an error and exit, or
  707. # enable the TAGNAME tag. We also add TAGNAME to the global $taglist
  708. # variable here.
  709. func_enable_tag ()
  710. {
  711. # Global variable:
  712. tagname="$1"
  713. re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$"
  714. re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$"
  715. sed_extractcf="/$re_begincf/,/$re_endcf/p"
  716. # Validate tagname.
  717. case $tagname in
  718. *[!-_A-Za-z0-9,/]*)
  719. func_fatal_error "invalid tag name: $tagname"
  720. ;;
  721. esac
  722. # Don't test for the "default" C tag, as we know it's
  723. # there but not specially marked.
  724. case $tagname in
  725. CC) ;;
  726. *)
  727. if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then
  728. taglist="$taglist $tagname"
  729. # Evaluate the configuration. Be careful to quote the path
  730. # and the sed script, to avoid splitting on whitespace, but
  731. # also don't use non-portable quotes within backquotes within
  732. # quotes we have to do it in 2 steps:
  733. extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"`
  734. eval "$extractedcf"
  735. else
  736. func_error "ignoring unknown tag $tagname"
  737. fi
  738. ;;
  739. esac
  740. }
  741. # Parse options once, thoroughly. This comes as soon as possible in
  742. # the script to make things like `libtool --version' happen quickly.
  743. {
  744. # Shorthand for --mode=foo, only valid as the first argument
  745. case $1 in
  746. clean|clea|cle|cl)
  747. shift; set dummy --mode clean ${1+"$@"}; shift
  748. ;;
  749. compile|compil|compi|comp|com|co|c)
  750. shift; set dummy --mode compile ${1+"$@"}; shift
  751. ;;
  752. execute|execut|execu|exec|exe|ex|e)
  753. shift; set dummy --mode execute ${1+"$@"}; shift
  754. ;;
  755. finish|finis|fini|fin|fi|f)
  756. shift; set dummy --mode finish ${1+"$@"}; shift
  757. ;;
  758. install|instal|insta|inst|ins|in|i)
  759. shift; set dummy --mode install ${1+"$@"}; shift
  760. ;;
  761. link|lin|li|l)
  762. shift; set dummy --mode link ${1+"$@"}; shift
  763. ;;
  764. uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u)
  765. shift; set dummy --mode uninstall ${1+"$@"}; shift
  766. ;;
  767. esac
  768. # Parse non-mode specific arguments:
  769. while test "$#" -gt 0; do
  770. opt="$1"
  771. shift
  772. case $opt in
  773. --config) func_config ;;
  774. --debug) preserve_args="$preserve_args $opt"
  775. func_echo "enabling shell trace mode"
  776. opt_debug='set -x'
  777. $opt_debug
  778. ;;
  779. -dlopen) test "$#" -eq 0 && func_missing_arg "$opt" && break
  780. execute_dlfiles="$execute_dlfiles $1"
  781. shift
  782. ;;
  783. --dry-run | -n) opt_dry_run=: ;;
  784. --features) func_features ;;
  785. --finish) mode="finish" ;;
  786. --mode) test "$#" -eq 0 && func_missing_arg "$opt" && break
  787. case $1 in
  788. # Valid mode arguments:
  789. clean) ;;
  790. compile) ;;
  791. execute) ;;
  792. finish) ;;
  793. install) ;;
  794. link) ;;
  795. relink) ;;
  796. uninstall) ;;
  797. # Catch anything else as an error
  798. *) func_error "invalid argument for $opt"
  799. exit_cmd=exit
  800. break
  801. ;;
  802. esac
  803. mode="$1"
  804. shift
  805. ;;
  806. --preserve-dup-deps)
  807. opt_duplicate_deps=: ;;
  808. --quiet|--silent) preserve_args="$preserve_args $opt"
  809. opt_silent=:
  810. opt_verbose=false
  811. ;;
  812. --no-quiet|--no-silent)
  813. preserve_args="$preserve_args $opt"
  814. opt_silent=false
  815. ;;
  816. --verbose| -v) preserve_args="$preserve_args $opt"
  817. opt_silent=false
  818. opt_verbose=:
  819. ;;
  820. --no-verbose) preserve_args="$preserve_args $opt"
  821. opt_verbose=false
  822. ;;
  823. --tag) test "$#" -eq 0 && func_missing_arg "$opt" && break
  824. preserve_args="$preserve_args $opt $1"
  825. func_enable_tag "$1" # tagname is set here
  826. shift
  827. ;;
  828. # Separate optargs to long options:
  829. -dlopen=*|--mode=*|--tag=*)
  830. func_opt_split "$opt"
  831. set dummy "$func_opt_split_opt" "$func_opt_split_arg" ${1+"$@"}
  832. shift
  833. ;;
  834. -\?|-h) func_usage ;;
  835. --help) opt_help=: ;;
  836. --help-all) opt_help=': help-all' ;;
  837. --version) func_version ;;
  838. -*) func_fatal_help "unrecognized option \`$opt'" ;;
  839. *) nonopt="$opt"
  840. break
  841. ;;
  842. esac
  843. done
  844. case $host in
  845. *cygwin* | *mingw* | *pw32* | *cegcc*)
  846. # don't eliminate duplications in $postdeps and $predeps
  847. opt_duplicate_compiler_generated_deps=:
  848. ;;
  849. *)
  850. opt_duplicate_compiler_generated_deps=$opt_duplicate_deps
  851. ;;
  852. esac
  853. # Having warned about all mis-specified options, bail out if
  854. # anything was wrong.
  855. $exit_cmd $EXIT_FAILURE
  856. }
  857. # func_check_version_match
  858. # Ensure that we are using m4 macros, and libtool script from the same
  859. # release of libtool.
  860. func_check_version_match ()
  861. {
  862. if test "$package_revision" != "$macro_revision"; then
  863. if test "$VERSION" != "$macro_version"; then
  864. if test -z "$macro_version"; then
  865. cat >&2 <<_LT_EOF
  866. $progname: Version mismatch error. This is $PACKAGE $VERSION, but the
  867. $progname: definition of this LT_INIT comes from an older release.
  868. $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
  869. $progname: and run autoconf again.
  870. _LT_EOF
  871. else
  872. cat >&2 <<_LT_EOF
  873. $progname: Version mismatch error. This is $PACKAGE $VERSION, but the
  874. $progname: definition of this LT_INIT comes from $PACKAGE $macro_version.
  875. $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
  876. $progname: and run autoconf again.
  877. _LT_EOF
  878. fi
  879. else
  880. cat >&2 <<_LT_EOF
  881. $progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision,
  882. $progname: but the definition of this LT_INIT comes from revision $macro_revision.
  883. $progname: You should recreate aclocal.m4 with macros from revision $package_revision
  884. $progname: of $PACKAGE $VERSION and run autoconf again.
  885. _LT_EOF
  886. fi
  887. exit $EXIT_MISMATCH
  888. fi
  889. }
  890. ## ----------- ##
  891. ## Main. ##
  892. ## ----------- ##
  893. $opt_help || {
  894. # Sanity checks first:
  895. func_check_version_match
  896. if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
  897. func_fatal_configuration "not configured to build any kind of library"
  898. fi
  899. test -z "$mode" && func_fatal_error "error: you must specify a MODE."
  900. # Darwin sucks
  901. eval std_shrext=\"$shrext_cmds\"
  902. # Only execute mode is allowed to have -dlopen flags.
  903. if test -n "$execute_dlfiles" && test "$mode" != execute; then
  904. func_error "unrecognized option \`-dlopen'"
  905. $ECHO "$help" 1>&2
  906. exit $EXIT_FAILURE
  907. fi
  908. # Change the help message to a mode-specific one.
  909. generic_help="$help"
  910. help="Try \`$progname --help --mode=$mode' for more information."
  911. }
  912. # func_lalib_p file
  913. # True iff FILE is a libtool `.la' library or `.lo' object file.
  914. # This function is only a basic sanity check; it will hardly flush out
  915. # determined imposters.
  916. func_lalib_p ()
  917. {
  918. test -f "$1" &&
  919. $SED -e 4q "$1" 2>/dev/null \
  920. | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1
  921. }
  922. # func_lalib_unsafe_p file
  923. # True iff FILE is a libtool `.la' library or `.lo' object file.
  924. # This function implements the same check as func_lalib_p without
  925. # resorting to external programs. To this end, it redirects stdin and
  926. # closes it afterwards, without saving the original file descriptor.
  927. # As a safety measure, use it only where a negative result would be
  928. # fatal anyway. Works if `file' does not exist.
  929. func_lalib_unsafe_p ()
  930. {
  931. lalib_p=no
  932. if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then
  933. for lalib_p_l in 1 2 3 4
  934. do
  935. read lalib_p_line
  936. case "$lalib_p_line" in
  937. \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;;
  938. esac
  939. done
  940. exec 0<&5 5<&-
  941. fi
  942. test "$lalib_p" = yes
  943. }
  944. # func_ltwrapper_script_p file
  945. # True iff FILE is a libtool wrapper script
  946. # This function is only a basic sanity check; it will hardly flush out
  947. # determined imposters.
  948. func_ltwrapper_script_p ()
  949. {
  950. func_lalib_p "$1"
  951. }
  952. # func_ltwrapper_executable_p file
  953. # True iff FILE is a libtool wrapper executable
  954. # This function is only a basic sanity check; it will hardly flush out
  955. # determined imposters.
  956. func_ltwrapper_executable_p ()
  957. {
  958. func_ltwrapper_exec_suffix=
  959. case $1 in
  960. *.exe) ;;
  961. *) func_ltwrapper_exec_suffix=.exe ;;
  962. esac
  963. $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1
  964. }
  965. # func_ltwrapper_scriptname file
  966. # Assumes file is an ltwrapper_executable
  967. # uses $file to determine the appropriate filename for a
  968. # temporary ltwrapper_script.
  969. func_ltwrapper_scriptname ()
  970. {
  971. func_ltwrapper_scriptname_result=""
  972. if func_ltwrapper_executable_p "$1"; then
  973. func_dirname_and_basename "$1" "" "."
  974. func_stripname '' '.exe' "$func_basename_result"
  975. func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper"
  976. fi
  977. }
  978. # func_ltwrapper_p file
  979. # True iff FILE is a libtool wrapper script or wrapper executable
  980. # This function is only a basic sanity check; it will hardly flush out
  981. # determined imposters.
  982. func_ltwrapper_p ()
  983. {
  984. func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1"
  985. }
  986. # func_execute_cmds commands fail_cmd
  987. # Execute tilde-delimited COMMANDS.
  988. # If FAIL_CMD is given, eval that upon failure.
  989. # FAIL_CMD may read-access the current command in variable CMD!
  990. func_execute_cmds ()
  991. {
  992. $opt_debug
  993. save_ifs=$IFS; IFS='~'
  994. for cmd in $1; do
  995. IFS=$save_ifs
  996. eval cmd=\"$cmd\"
  997. func_show_eval "$cmd" "${2-:}"
  998. done
  999. IFS=$save_ifs
  1000. }
  1001. # func_source file
  1002. # Source FILE, adding directory component if necessary.
  1003. # Note that it is not necessary on cygwin/mingw to append a dot to
  1004. # FILE even if both FILE and FILE.exe exist: automatic-append-.exe
  1005. # behavior happens only for exec(3), not for open(2)! Also, sourcing
  1006. # `FILE.' does not work on cygwin managed mounts.
  1007. func_source ()
  1008. {
  1009. $opt_debug
  1010. case $1 in
  1011. */* | *\\*) . "$1" ;;
  1012. *) . "./$1" ;;
  1013. esac
  1014. }
  1015. # func_infer_tag arg
  1016. # Infer tagged configuration to use if any are available and
  1017. # if one wasn't chosen via the "--tag" command line option.
  1018. # Only attempt this if the compiler in the base compile
  1019. # command doesn't match the default compiler.
  1020. # arg is usually of the form 'gcc ...'
  1021. func_infer_tag ()
  1022. {
  1023. $opt_debug
  1024. if test -n "$available_tags" && test -z "$tagname"; then
  1025. CC_quoted=
  1026. for arg in $CC; do
  1027. func_quote_for_eval "$arg"
  1028. CC_quoted="$CC_quoted $func_quote_for_eval_result"
  1029. done
  1030. CC_expanded=`func_echo_all $CC`
  1031. CC_quoted_expanded=`func_echo_all $CC_quoted`
  1032. case $@ in
  1033. # Blanks in the command may have been stripped by the calling shell,
  1034. # but not from the CC environment variable when configure was run.
  1035. " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
  1036. " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;;
  1037. # Blanks at the start of $base_compile will cause this to fail
  1038. # if we don't check for them as well.
  1039. *)
  1040. for z in $available_tags; do
  1041. if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
  1042. # Evaluate the configuration.
  1043. eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
  1044. CC_quoted=
  1045. for arg in $CC; do
  1046. # Double-quote args containing other shell metacharacters.
  1047. func_quote_for_eval "$arg"
  1048. CC_quoted="$CC_quoted $func_quote_for_eval_result"
  1049. done
  1050. CC_expanded=`func_echo_all $CC`
  1051. CC_quoted_expanded=`func_echo_all $CC_quoted`
  1052. case "$@ " in
  1053. " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
  1054. " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*)
  1055. # The compiler in the base compile command matches
  1056. # the one in the tagged configuration.
  1057. # Assume this is the tagged configuration we want.
  1058. tagname=$z
  1059. break
  1060. ;;
  1061. esac
  1062. fi
  1063. done
  1064. # If $tagname still isn't set, then no tagged configuration
  1065. # was found and let the user know that the "--tag" command
  1066. # line option must be used.
  1067. if test -z "$tagname"; then
  1068. func_echo "unable to infer tagged configuration"
  1069. func_fatal_error "specify a tag with \`--tag'"
  1070. # else
  1071. # func_verbose "using $tagname tagged configuration"
  1072. fi
  1073. ;;
  1074. esac
  1075. fi
  1076. }
  1077. # func_write_libtool_object output_name pic_name nonpic_name
  1078. # Create a libtool object file (analogous to a ".la" file),
  1079. # but don't create it if we're doing a dry run.
  1080. func_write_libtool_object ()
  1081. {
  1082. write_libobj=${1}
  1083. if test "$build_libtool_libs" = yes; then
  1084. write_lobj=\'${2}\'
  1085. else
  1086. write_lobj=none
  1087. fi
  1088. if test "$build_old_libs" = yes; then
  1089. write_oldobj=\'${3}\'
  1090. else
  1091. write_oldobj=none
  1092. fi
  1093. $opt_dry_run || {
  1094. cat >${write_libobj}T <<EOF
  1095. # $write_libobj - a libtool object file
  1096. # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
  1097. #
  1098. # Please DO NOT delete this file!
  1099. # It is necessary for linking the library.
  1100. # Name of the PIC object.
  1101. pic_object=$write_lobj
  1102. # Name of the non-PIC object
  1103. non_pic_object=$write_oldobj
  1104. EOF
  1105. $MV "${write_libobj}T" "${write_libobj}"
  1106. }
  1107. }
  1108. # func_mode_compile arg...
  1109. func_mode_compile ()
  1110. {
  1111. $opt_debug
  1112. # Get the compilation command and the source file.
  1113. base_compile=
  1114. srcfile="$nonopt" # always keep a non-empty value in "srcfile"
  1115. suppress_opt=yes
  1116. suppress_output=
  1117. arg_mode=normal
  1118. libobj=
  1119. later=
  1120. pie_flag=
  1121. for arg
  1122. do
  1123. case $arg_mode in
  1124. arg )
  1125. # do not "continue". Instead, add this to base_compile
  1126. lastarg="$arg"
  1127. arg_mode=normal
  1128. ;;
  1129. target )
  1130. libobj="$arg"
  1131. arg_mode=normal
  1132. continue
  1133. ;;
  1134. normal )
  1135. # Accept any command-line options.
  1136. case $arg in
  1137. -o)
  1138. test -n "$libobj" && \
  1139. func_fatal_error "you cannot specify \`-o' more than once"
  1140. arg_mode=target
  1141. continue
  1142. ;;
  1143. -pie | -fpie | -fPIE)
  1144. pie_flag="$pie_flag $arg"
  1145. continue
  1146. ;;
  1147. -shared | -static | -prefer-pic | -prefer-non-pic)
  1148. later="$later $arg"
  1149. continue
  1150. ;;
  1151. -no-suppress)
  1152. suppress_opt=no
  1153. continue
  1154. ;;
  1155. -Xcompiler)
  1156. arg_mode=arg # the next one goes into the "base_compile" arg list
  1157. continue # The current "srcfile" will either be retained or
  1158. ;; # replaced later. I would guess that would be a bug.
  1159. -Wc,*)
  1160. func_stripname '-Wc,' '' "$arg"
  1161. args=$func_stripname_result
  1162. lastarg=
  1163. save_ifs="$IFS"; IFS=','
  1164. for arg in $args; do
  1165. IFS="$save_ifs"
  1166. func_quote_for_eval "$arg"
  1167. lastarg="$lastarg $func_quote_for_eval_result"
  1168. done
  1169. IFS="$save_ifs"
  1170. func_stripname ' ' '' "$lastarg"
  1171. lastarg=$func_stripname_result
  1172. # Add the arguments to base_compile.
  1173. base_compile="$base_compile $lastarg"
  1174. continue
  1175. ;;
  1176. *)
  1177. # Accept the current argument as the source file.
  1178. # The previous "srcfile" becomes the current argument.
  1179. #
  1180. lastarg="$srcfile"
  1181. srcfile="$arg"
  1182. ;;
  1183. esac # case $arg
  1184. ;;
  1185. esac # case $arg_mode
  1186. # Aesthetically quote the previous argument.
  1187. func_quote_for_eval "$lastarg"
  1188. base_compile="$base_compile $func_quote_for_eval_result"
  1189. done # for arg
  1190. case $arg_mode in
  1191. arg)
  1192. func_fatal_error "you must specify an argument for -Xcompile"
  1193. ;;
  1194. target)
  1195. func_fatal_error "you must specify a target with \`-o'"
  1196. ;;
  1197. *)
  1198. # Get the name of the library object.
  1199. test -z "$libobj" && {
  1200. func_basename "$srcfile"
  1201. libobj="$func_basename_result"
  1202. }
  1203. ;;
  1204. esac
  1205. # Recognize several different file suffixes.
  1206. # If the user specifies -o file.o, it is replaced with file.lo
  1207. case $libobj in
  1208. *.[cCFSifmso] | \
  1209. *.ada | *.adb | *.ads | *.asm | \
  1210. *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \
  1211. *.[fF][09]? | *.for | *.java | *.obj | *.sx | *.cu | *.cup)
  1212. func_xform "$libobj"
  1213. libobj=$func_xform_result
  1214. ;;
  1215. esac
  1216. case $libobj in
  1217. *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;;
  1218. *)
  1219. func_fatal_error "cannot determine name of library object from \`$libobj'"
  1220. ;;
  1221. esac
  1222. func_infer_tag $base_compile
  1223. for arg in $later; do
  1224. case $arg in
  1225. -shared)
  1226. test "$build_libtool_libs" != yes && \
  1227. func_fatal_configuration "can not build a shared library"
  1228. build_old_libs=no
  1229. continue
  1230. ;;
  1231. -static)
  1232. build_libtool_libs=no
  1233. build_old_libs=yes
  1234. continue
  1235. ;;
  1236. -prefer-pic)
  1237. pic_mode=yes
  1238. continue
  1239. ;;
  1240. -prefer-non-pic)
  1241. pic_mode=no
  1242. continue
  1243. ;;
  1244. esac
  1245. done
  1246. func_quote_for_eval "$libobj"
  1247. test "X$libobj" != "X$func_quote_for_eval_result" \
  1248. && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \
  1249. && func_warning "libobj name \`$libobj' may not contain shell special characters."
  1250. func_dirname_and_basename "$obj" "/" ""
  1251. objname="$func_basename_result"
  1252. xdir="$func_dirname_result"
  1253. lobj=${xdir}$objdir/$objname
  1254. test -z "$base_compile" && \
  1255. func_fatal_help "you must specify a compilation command"
  1256. # Delete any leftover library objects.
  1257. if test "$build_old_libs" = yes; then
  1258. removelist="$obj $lobj $libobj ${libobj}T"
  1259. else
  1260. removelist="$lobj $libobj ${libobj}T"
  1261. fi
  1262. # On Cygwin there's no "real" PIC flag so we must build both object types
  1263. case $host_os in
  1264. cygwin* | mingw* | pw32* | os2* | cegcc*)
  1265. pic_mode=default
  1266. ;;
  1267. esac
  1268. if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
  1269. # non-PIC code in shared libraries is not supported
  1270. pic_mode=default
  1271. fi
  1272. # Calculate the filename of the output object if compiler does
  1273. # not support -o with -c
  1274. if test "$compiler_c_o" = no; then
  1275. output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.${objext}
  1276. lockfile="$output_obj.lock"
  1277. else
  1278. output_obj=
  1279. need_locks=no
  1280. lockfile=
  1281. fi
  1282. # Lock this critical section if it is needed
  1283. # We use this script file to make the link, it avoids creating a new file
  1284. if test "$need_locks" = yes; then
  1285. until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
  1286. func_echo "Waiting for $lockfile to be removed"
  1287. sleep 2
  1288. done
  1289. elif test "$need_locks" = warn; then
  1290. if test -f "$lockfile"; then
  1291. $ECHO "\
  1292. *** ERROR, $lockfile exists and contains:
  1293. `cat $lockfile 2>/dev/null`
  1294. This indicates that another process is trying to use the same
  1295. temporary object file, and libtool could not work around it because
  1296. your compiler does not support \`-c' and \`-o' together. If you
  1297. repeat this compilation, it may succeed, by chance, but you had better
  1298. avoid parallel builds (make -j) in this platform, or get a better
  1299. compiler."
  1300. $opt_dry_run || $RM $removelist
  1301. exit $EXIT_FAILURE
  1302. fi
  1303. removelist="$removelist $output_obj"
  1304. $ECHO "$srcfile" > "$lockfile"
  1305. fi
  1306. $opt_dry_run || $RM $removelist
  1307. removelist="$removelist $lockfile"
  1308. trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15
  1309. if test -n "$fix_srcfile_path"; then
  1310. eval srcfile=\"$fix_srcfile_path\"
  1311. fi
  1312. func_quote_for_eval "$srcfile"
  1313. qsrcfile=$func_quote_for_eval_result
  1314. # Only build a PIC object if we are building libtool libraries.
  1315. if test "$build_libtool_libs" = yes; then
  1316. # Without this assignment, base_compile gets emptied.
  1317. fbsd_hideous_sh_bug=$base_compile
  1318. if test "$pic_mode" != no; then
  1319. command="$base_compile $qsrcfile $pic_flag"
  1320. else
  1321. # Don't build PIC code
  1322. command="$base_compile $qsrcfile"
  1323. fi
  1324. func_mkdir_p "$xdir$objdir"
  1325. if test -z "$output_obj"; then
  1326. # Place PIC objects in $objdir
  1327. command="$command -o $lobj"
  1328. fi
  1329. func_show_eval_locale "$command" \
  1330. 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE'
  1331. if test "$need_locks" = warn &&
  1332. test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
  1333. $ECHO "\
  1334. *** ERROR, $lockfile contains:
  1335. `cat $lockfile 2>/dev/null`
  1336. but it should contain:
  1337. $srcfile
  1338. This indicates that another process is trying to use the same
  1339. temporary object file, and libtool could not work around it because
  1340. your compiler does not support \`-c' and \`-o' together. If you
  1341. repeat this compilation, it may succeed, by chance, but you had better
  1342. avoid parallel builds (make -j) in this platform, or get a better
  1343. compiler."
  1344. $opt_dry_run || $RM $removelist
  1345. exit $EXIT_FAILURE
  1346. fi
  1347. # Just move the object if needed, then go on to compile the next one
  1348. if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
  1349. func_show_eval '$MV "$output_obj" "$lobj"' \
  1350. 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
  1351. fi
  1352. # Allow error messages only from the first compilation.
  1353. if test "$suppress_opt" = yes; then
  1354. suppress_output=' >/dev/null 2>&1'
  1355. fi
  1356. fi
  1357. # Only build a position-dependent object if we build old libraries.
  1358. if test "$build_old_libs" = yes; then
  1359. if test "$pic_mode" != yes; then
  1360. # Don't build PIC code
  1361. command="$base_compile $qsrcfile$pie_flag"
  1362. else
  1363. command="$base_compile $qsrcfile $pic_flag"
  1364. fi
  1365. if test "$compiler_c_o" = yes; then
  1366. command="$command -o $obj"
  1367. fi
  1368. # Suppress compiler output if we already did a PIC compilation.
  1369. command="$command$suppress_output"
  1370. func_show_eval_locale "$command" \
  1371. '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE'
  1372. if test "$need_locks" = warn &&
  1373. test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
  1374. $ECHO "\
  1375. *** ERROR, $lockfile contains:
  1376. `cat $lockfile 2>/dev/null`
  1377. but it should contain:
  1378. $srcfile
  1379. This indicates that another process is trying to use the same
  1380. temporary object file, and libtool could not work around it because
  1381. your compiler does not support \`-c' and \`-o' together. If you
  1382. repeat this compilation, it may succeed, by chance, but you had better
  1383. avoid parallel builds (make -j) in this platform, or get a better
  1384. compiler."
  1385. $opt_dry_run || $RM $removelist
  1386. exit $EXIT_FAILURE
  1387. fi
  1388. # Just move the object if needed
  1389. if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
  1390. func_show_eval '$MV "$output_obj" "$obj"' \
  1391. 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
  1392. fi
  1393. fi
  1394. $opt_dry_run || {
  1395. func_write_libtool_object "$libobj" "$objdir/$objname" "$objname"
  1396. # Unlock the critical section if it was locked
  1397. if test "$need_locks" != no; then
  1398. removelist=$lockfile
  1399. $RM "$lockfile"
  1400. fi
  1401. }
  1402. exit $EXIT_SUCCESS
  1403. }
  1404. $opt_help || {
  1405. test "$mode" = compile && func_mode_compile ${1+"$@"}
  1406. }
  1407. func_mode_help ()
  1408. {
  1409. # We need to display help for each of the modes.
  1410. case $mode in
  1411. "")
  1412. # Generic help is extracted from the usage comments
  1413. # at the start of this file.
  1414. func_help
  1415. ;;
  1416. clean)
  1417. $ECHO \
  1418. "Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
  1419. Remove files from the build directory.
  1420. RM is the name of the program to use to delete files associated with each FILE
  1421. (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
  1422. to RM.
  1423. If FILE is a libtool library, object or program, all the files associated
  1424. with it are deleted. Otherwise, only FILE itself is deleted using RM."
  1425. ;;
  1426. compile)
  1427. $ECHO \
  1428. "Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
  1429. Compile a source file into a libtool library object.
  1430. This mode accepts the following additional options:
  1431. -o OUTPUT-FILE set the output file name to OUTPUT-FILE
  1432. -no-suppress do not suppress compiler output for multiple passes
  1433. -prefer-pic try to build PIC objects only
  1434. -prefer-non-pic try to build non-PIC objects only
  1435. -shared do not build a \`.o' file suitable for static linking
  1436. -static only build a \`.o' file suitable for static linking
  1437. -Wc,FLAG pass FLAG directly to the compiler
  1438. COMPILE-COMMAND is a command to be used in creating a \`standard' object file
  1439. from the given SOURCEFILE.
  1440. The output file name is determined by removing the directory component from
  1441. SOURCEFILE, then substituting the C source code suffix \`.c' with the
  1442. library object suffix, \`.lo'."
  1443. ;;
  1444. execute)
  1445. $ECHO \
  1446. "Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]...
  1447. Automatically set library path, then run a program.
  1448. This mode accepts the following additional options:
  1449. -dlopen FILE add the directory containing FILE to the library path
  1450. This mode sets the library path environment variable according to \`-dlopen'
  1451. flags.
  1452. If any of the ARGS are libtool executable wrappers, then they are translated
  1453. into their corresponding uninstalled binary, and any of their required library
  1454. directories are added to the library path.
  1455. Then, COMMAND is executed, with ARGS as arguments."
  1456. ;;
  1457. finish)
  1458. $ECHO \
  1459. "Usage: $progname [OPTION]... --mode=finish [LIBDIR]...
  1460. Complete the installation of libtool libraries.
  1461. Each LIBDIR is a directory that contains libtool libraries.
  1462. The commands that this mode executes may require superuser privileges. Use
  1463. the \`--dry-run' option if you just want to see what would be executed."
  1464. ;;
  1465. install)
  1466. $ECHO \
  1467. "Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND...
  1468. Install executables or libraries.
  1469. INSTALL-COMMAND is the installation command. The first component should be
  1470. either the \`install' or \`cp' program.
  1471. The following components of INSTALL-COMMAND are treated specially:
  1472. -inst-prefix-dir PREFIX-DIR Use PREFIX-DIR as a staging area for installation
  1473. The rest of the components are interpreted as arguments to that command (only
  1474. BSD-compatible install options are recognized)."
  1475. ;;
  1476. link)
  1477. $ECHO \
  1478. "Usage: $progname [OPTION]... --mode=link LINK-COMMAND...
  1479. Link object files or libraries together to form another library, or to
  1480. create an executable program.
  1481. LINK-COMMAND is a command using the C compiler that you would use to create
  1482. a program from several object files.
  1483. The following components of LINK-COMMAND are treated specially:
  1484. -all-static do not do any dynamic linking at all
  1485. -avoid-version do not add a version suffix if possible
  1486. -bindir BINDIR specify path to binaries directory (for systems where
  1487. libraries must be found in the PATH setting at runtime)
  1488. -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
  1489. -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
  1490. -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
  1491. -export-symbols SYMFILE
  1492. try to export only the symbols listed in SYMFILE
  1493. -export-symbols-regex REGEX
  1494. try to export only the symbols matching REGEX
  1495. -LLIBDIR search LIBDIR for required installed libraries
  1496. -lNAME OUTPUT-FILE requires the installed library libNAME
  1497. -module build a library that can dlopened
  1498. -no-fast-install disable the fast-install mode
  1499. -no-install link a not-installable executable
  1500. -no-undefined declare that a library does not refer to external symbols
  1501. -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
  1502. -objectlist FILE Use a list of object files found in FILE to specify objects
  1503. -precious-files-regex REGEX
  1504. don't remove output files matching REGEX
  1505. -release RELEASE specify package release information
  1506. -rpath LIBDIR the created library will eventually be installed in LIBDIR
  1507. -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
  1508. -shared only do dynamic linking of libtool libraries
  1509. -shrext SUFFIX override the standard shared library file extension
  1510. -static do not do any dynamic linking of uninstalled libtool libraries
  1511. -static-libtool-libs
  1512. do not do any dynamic linking of libtool libraries
  1513. -version-info CURRENT[:REVISION[:AGE]]
  1514. specify library version info [each variable defaults to 0]
  1515. -weak LIBNAME declare that the target provides the LIBNAME interface
  1516. -Wc,FLAG
  1517. -Xcompiler FLAG pass linker-specific FLAG directly to the compiler
  1518. -Wl,FLAG
  1519. -Xlinker FLAG pass linker-specific FLAG directly to the linker
  1520. -XCClinker FLAG pass link-specific FLAG to the compiler driver (CC)
  1521. All other options (arguments beginning with \`-') are ignored.
  1522. Every other argument is treated as a filename. Files ending in \`.la' are
  1523. treated as uninstalled libtool libraries, other files are standard or library
  1524. object files.
  1525. If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
  1526. only library objects (\`.lo' files) may be specified, and \`-rpath' is
  1527. required, except when creating a convenience library.
  1528. If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
  1529. using \`ar' and \`ranlib', or on Windows using \`lib'.
  1530. If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
  1531. is created, otherwise an executable program is created."
  1532. ;;
  1533. uninstall)
  1534. $ECHO \
  1535. "Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
  1536. Remove libraries from an installation directory.
  1537. RM is the name of the program to use to delete files associated with each FILE
  1538. (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
  1539. to RM.
  1540. If FILE is a libtool library, all the files associated with it are deleted.
  1541. Otherwise, only FILE itself is deleted using RM."
  1542. ;;
  1543. *)
  1544. func_fatal_help "invalid operation mode \`$mode'"
  1545. ;;
  1546. esac
  1547. echo
  1548. $ECHO "Try \`$progname --help' for more information about other modes."
  1549. }
  1550. # Now that we've collected a possible --mode arg, show help if necessary
  1551. if $opt_help; then
  1552. if test "$opt_help" = :; then
  1553. func_mode_help
  1554. else
  1555. {
  1556. func_help noexit
  1557. for mode in compile link execute install finish uninstall clean; do
  1558. func_mode_help
  1559. done
  1560. } | sed -n '1p; 2,$s/^Usage:/ or: /p'
  1561. {
  1562. func_help noexit
  1563. for mode in compile link execute install finish uninstall clean; do
  1564. echo
  1565. func_mode_help
  1566. done
  1567. } |
  1568. sed '1d
  1569. /^When reporting/,/^Report/{
  1570. H
  1571. d
  1572. }
  1573. $x
  1574. /information about other modes/d
  1575. /more detailed .*MODE/d
  1576. s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/'
  1577. fi
  1578. exit $?
  1579. fi
  1580. # func_mode_execute arg...
  1581. func_mode_execute ()
  1582. {
  1583. $opt_debug
  1584. # The first argument is the command name.
  1585. cmd="$nonopt"
  1586. test -z "$cmd" && \
  1587. func_fatal_help "you must specify a COMMAND"
  1588. # Handle -dlopen flags immediately.
  1589. for file in $execute_dlfiles; do
  1590. test -f "$file" \
  1591. || func_fatal_help "\`$file' is not a file"
  1592. dir=
  1593. case $file in
  1594. *.la)
  1595. # Check to see that this really is a libtool archive.
  1596. func_lalib_unsafe_p "$file" \
  1597. || func_fatal_help "\`$lib' is not a valid libtool archive"
  1598. # Read the libtool library.
  1599. dlname=
  1600. library_names=
  1601. func_source "$file"
  1602. # Skip this library if it cannot be dlopened.
  1603. if test -z "$dlname"; then
  1604. # Warn if it was a shared library.
  1605. test -n "$library_names" && \
  1606. func_warning "\`$file' was not linked with \`-export-dynamic'"
  1607. continue
  1608. fi
  1609. func_dirname "$file" "" "."
  1610. dir="$func_dirname_result"
  1611. if test -f "$dir/$objdir/$dlname"; then
  1612. dir="$dir/$objdir"
  1613. else
  1614. if test ! -f "$dir/$dlname"; then
  1615. func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'"
  1616. fi
  1617. fi
  1618. ;;
  1619. *.lo)
  1620. # Just add the directory containing the .lo file.
  1621. func_dirname "$file" "" "."
  1622. dir="$func_dirname_result"
  1623. ;;
  1624. *)
  1625. func_warning "\`-dlopen' is ignored for non-libtool libraries and objects"
  1626. continue
  1627. ;;
  1628. esac
  1629. # Get the absolute pathname.
  1630. absdir=`cd "$dir" && pwd`
  1631. test -n "$absdir" && dir="$absdir"
  1632. # Now add the directory to shlibpath_var.
  1633. if eval "test -z \"\$$shlibpath_var\""; then
  1634. eval "$shlibpath_var=\"\$dir\""
  1635. else
  1636. eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
  1637. fi
  1638. done
  1639. # This variable tells wrapper scripts just to set shlibpath_var
  1640. # rather than running their programs.
  1641. libtool_execute_magic="$magic"
  1642. # Check if any of the arguments is a wrapper script.
  1643. args=
  1644. for file
  1645. do
  1646. case $file in
  1647. -* | *.la | *.lo ) ;;
  1648. *)
  1649. # Do a test to see if this is really a libtool program.
  1650. if func_ltwrapper_script_p "$file"; then
  1651. func_source "$file"
  1652. # Transform arg to wrapped name.
  1653. file="$progdir/$program"
  1654. elif func_ltwrapper_executable_p "$file"; then
  1655. func_ltwrapper_scriptname "$file"
  1656. func_source "$func_ltwrapper_scriptname_result"
  1657. # Transform arg to wrapped name.
  1658. file="$progdir/$program"
  1659. fi
  1660. ;;
  1661. esac
  1662. # Quote arguments (to preserve shell metacharacters).
  1663. func_quote_for_eval "$file"
  1664. args="$args $func_quote_for_eval_result"
  1665. done
  1666. if test "X$opt_dry_run" = Xfalse; then
  1667. if test -n "$shlibpath_var"; then
  1668. # Export the shlibpath_var.
  1669. eval "export $shlibpath_var"
  1670. fi
  1671. # Restore saved environment variables
  1672. for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
  1673. do
  1674. eval "if test \"\${save_$lt_var+set}\" = set; then
  1675. $lt_var=\$save_$lt_var; export $lt_var
  1676. else
  1677. $lt_unset $lt_var
  1678. fi"
  1679. done
  1680. # Now prepare to actually exec the command.
  1681. exec_cmd="\$cmd$args"
  1682. else
  1683. # Display what would be done.
  1684. if test -n "$shlibpath_var"; then
  1685. eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\""
  1686. echo "export $shlibpath_var"
  1687. fi
  1688. $ECHO "$cmd$args"
  1689. exit $EXIT_SUCCESS
  1690. fi
  1691. }
  1692. test "$mode" = execute && func_mode_execute ${1+"$@"}
  1693. # func_mode_finish arg...
  1694. func_mode_finish ()
  1695. {
  1696. $opt_debug
  1697. libdirs="$nonopt"
  1698. admincmds=
  1699. if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
  1700. for dir
  1701. do
  1702. libdirs="$libdirs $dir"
  1703. done
  1704. for libdir in $libdirs; do
  1705. if test -n "$finish_cmds"; then
  1706. # Do each command in the finish commands.
  1707. func_execute_cmds "$finish_cmds" 'admincmds="$admincmds
  1708. '"$cmd"'"'
  1709. fi
  1710. if test -n "$finish_eval"; then
  1711. # Do the single finish_eval.
  1712. eval cmds=\"$finish_eval\"
  1713. $opt_dry_run || eval "$cmds" || admincmds="$admincmds
  1714. $cmds"
  1715. fi
  1716. done
  1717. fi
  1718. # Exit here if they wanted silent mode.
  1719. $opt_silent && exit $EXIT_SUCCESS
  1720. echo "----------------------------------------------------------------------"
  1721. echo "Libraries have been installed in:"
  1722. for libdir in $libdirs; do
  1723. $ECHO " $libdir"
  1724. done
  1725. echo
  1726. echo "If you ever happen to want to link against installed libraries"
  1727. echo "in a given directory, LIBDIR, you must either use libtool, and"
  1728. echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
  1729. echo "flag during linking and do at least one of the following:"
  1730. if test -n "$shlibpath_var"; then
  1731. echo " - add LIBDIR to the \`$shlibpath_var' environment variable"
  1732. echo " during execution"
  1733. fi
  1734. if test -n "$runpath_var"; then
  1735. echo " - add LIBDIR to the \`$runpath_var' environment variable"
  1736. echo " during linking"
  1737. fi
  1738. if test -n "$hardcode_libdir_flag_spec"; then
  1739. libdir=LIBDIR
  1740. eval flag=\"$hardcode_libdir_flag_spec\"
  1741. $ECHO " - use the \`$flag' linker flag"
  1742. fi
  1743. if test -n "$admincmds"; then
  1744. $ECHO " - have your system administrator run these commands:$admincmds"
  1745. fi
  1746. if test -f /etc/ld.so.conf; then
  1747. echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
  1748. fi
  1749. echo
  1750. echo "See any operating system documentation about shared libraries for"
  1751. case $host in
  1752. solaris2.[6789]|solaris2.1[0-9])
  1753. echo "more information, such as the ld(1), crle(1) and ld.so(8) manual"
  1754. echo "pages."
  1755. ;;
  1756. *)
  1757. echo "more information, such as the ld(1) and ld.so(8) manual pages."
  1758. ;;
  1759. esac
  1760. echo "----------------------------------------------------------------------"
  1761. exit $EXIT_SUCCESS
  1762. }
  1763. test "$mode" = finish && func_mode_finish ${1+"$@"}
  1764. # func_mode_install arg...
  1765. func_mode_install ()
  1766. {
  1767. $opt_debug
  1768. # There may be an optional sh(1) argument at the beginning of
  1769. # install_prog (especially on Windows NT).
  1770. if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
  1771. # Allow the use of GNU shtool's install command.
  1772. case $nonopt in *shtool*) :;; *) false;; esac; then
  1773. # Aesthetically quote it.
  1774. func_quote_for_eval "$nonopt"
  1775. install_prog="$func_quote_for_eval_result "
  1776. arg=$1
  1777. shift
  1778. else
  1779. install_prog=
  1780. arg=$nonopt
  1781. fi
  1782. # The real first argument should be the name of the installation program.
  1783. # Aesthetically quote it.
  1784. func_quote_for_eval "$arg"
  1785. install_prog="$install_prog$func_quote_for_eval_result"
  1786. install_shared_prog=$install_prog
  1787. case " $install_prog " in
  1788. *[\\\ /]cp\ *) install_cp=: ;;
  1789. *) install_cp=false ;;
  1790. esac
  1791. # We need to accept at least all the BSD install flags.
  1792. dest=
  1793. files=
  1794. opts=
  1795. prev=
  1796. install_type=
  1797. isdir=no
  1798. stripme=
  1799. no_mode=:
  1800. for arg
  1801. do
  1802. arg2=
  1803. if test -n "$dest"; then
  1804. files="$files $dest"
  1805. dest=$arg
  1806. continue
  1807. fi
  1808. case $arg in
  1809. -d) isdir=yes ;;
  1810. -f)
  1811. if $install_cp; then :; else
  1812. prev=$arg
  1813. fi
  1814. ;;
  1815. -g | -m | -o)
  1816. prev=$arg
  1817. ;;
  1818. -s)
  1819. stripme=" -s"
  1820. continue
  1821. ;;
  1822. -*)
  1823. ;;
  1824. *)
  1825. # If the previous option needed an argument, then skip it.
  1826. if test -n "$prev"; then
  1827. if test "x$prev" = x-m && test -n "$install_override_mode"; then
  1828. arg2=$install_override_mode
  1829. no_mode=false
  1830. fi
  1831. prev=
  1832. else
  1833. dest=$arg
  1834. continue
  1835. fi
  1836. ;;
  1837. esac
  1838. # Aesthetically quote the argument.
  1839. func_quote_for_eval "$arg"
  1840. install_prog="$install_prog $func_quote_for_eval_result"
  1841. if test -n "$arg2"; then
  1842. func_quote_for_eval "$arg2"
  1843. fi
  1844. install_shared_prog="$install_shared_prog $func_quote_for_eval_result"
  1845. done
  1846. test -z "$install_prog" && \
  1847. func_fatal_help "you must specify an install program"
  1848. test -n "$prev" && \
  1849. func_fatal_help "the \`$prev' option requires an argument"
  1850. if test -n "$install_override_mode" && $no_mode; then
  1851. if $install_cp; then :; else
  1852. func_quote_for_eval "$install_override_mode"
  1853. install_shared_prog="$install_shared_prog -m $func_quote_for_eval_result"
  1854. fi
  1855. fi
  1856. if test -z "$files"; then
  1857. if test -z "$dest"; then
  1858. func_fatal_help "no file or destination specified"
  1859. else
  1860. func_fatal_help "you must specify a destination"
  1861. fi
  1862. fi
  1863. # Strip any trailing slash from the destination.
  1864. func_stripname '' '/' "$dest"
  1865. dest=$func_stripname_result
  1866. # Check to see that the destination is a directory.
  1867. test -d "$dest" && isdir=yes
  1868. if test "$isdir" = yes; then
  1869. destdir="$dest"
  1870. destname=
  1871. else
  1872. func_dirname_and_basename "$dest" "" "."
  1873. destdir="$func_dirname_result"
  1874. destname="$func_basename_result"
  1875. # Not a directory, so check to see that there is only one file specified.
  1876. set dummy $files; shift
  1877. test "$#" -gt 1 && \
  1878. func_fatal_help "\`$dest' is not a directory"
  1879. fi
  1880. case $destdir in
  1881. [\\/]* | [A-Za-z]:[\\/]*) ;;
  1882. *)
  1883. for file in $files; do
  1884. case $file in
  1885. *.lo) ;;
  1886. *)
  1887. func_fatal_help "\`$destdir' must be an absolute directory name"
  1888. ;;
  1889. esac
  1890. done
  1891. ;;
  1892. esac
  1893. # This variable tells wrapper scripts just to set variables rather
  1894. # than running their programs.
  1895. libtool_install_magic="$magic"
  1896. staticlibs=
  1897. future_libdirs=
  1898. current_libdirs=
  1899. for file in $files; do
  1900. # Do each installation.
  1901. case $file in
  1902. *.$libext)
  1903. # Do the static libraries later.
  1904. staticlibs="$staticlibs $file"
  1905. ;;
  1906. *.la)
  1907. # Check to see that this really is a libtool archive.
  1908. func_lalib_unsafe_p "$file" \
  1909. || func_fatal_help "\`$file' is not a valid libtool archive"
  1910. library_names=
  1911. old_library=
  1912. relink_command=
  1913. func_source "$file"
  1914. # Add the libdir to current_libdirs if it is the destination.
  1915. if test "X$destdir" = "X$libdir"; then
  1916. case "$current_libdirs " in
  1917. *" $libdir "*) ;;
  1918. *) current_libdirs="$current_libdirs $libdir" ;;
  1919. esac
  1920. else
  1921. # Note the libdir as a future libdir.
  1922. case "$future_libdirs " in
  1923. *" $libdir "*) ;;
  1924. *) future_libdirs="$future_libdirs $libdir" ;;
  1925. esac
  1926. fi
  1927. func_dirname "$file" "/" ""
  1928. dir="$func_dirname_result"
  1929. dir="$dir$objdir"
  1930. if test -n "$relink_command"; then
  1931. # Determine the prefix the user has applied to our future dir.
  1932. inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"`
  1933. # Don't allow the user to place us outside of our expected
  1934. # location b/c this prevents finding dependent libraries that
  1935. # are installed to the same prefix.
  1936. # At present, this check doesn't affect windows .dll's that
  1937. # are installed into $libdir/../bin (currently, that works fine)
  1938. # but it's something to keep an eye on.
  1939. test "$inst_prefix_dir" = "$destdir" && \
  1940. func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir"
  1941. if test -n "$inst_prefix_dir"; then
  1942. # Stick the inst_prefix_dir data into the link command.
  1943. relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
  1944. else
  1945. relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"`
  1946. fi
  1947. func_warning "relinking \`$file'"
  1948. func_show_eval "$relink_command" \
  1949. 'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"'
  1950. fi
  1951. # See the names of the shared library.
  1952. set dummy $library_names; shift
  1953. if test -n "$1"; then
  1954. realname="$1"
  1955. shift
  1956. srcname="$realname"
  1957. test -n "$relink_command" && srcname="$realname"T
  1958. # Install the shared library and build the symlinks.
  1959. func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \
  1960. 'exit $?'
  1961. tstripme="$stripme"
  1962. case $host_os in
  1963. cygwin* | mingw* | pw32* | cegcc*)
  1964. case $realname in
  1965. *.dll.a)
  1966. tstripme=""
  1967. ;;
  1968. esac
  1969. ;;
  1970. esac
  1971. if test -n "$tstripme" && test -n "$striplib"; then
  1972. func_show_eval "$striplib $destdir/$realname" 'exit $?'
  1973. fi
  1974. if test "$#" -gt 0; then
  1975. # Delete the old symlinks, and create new ones.
  1976. # Try `ln -sf' first, because the `ln' binary might depend on
  1977. # the symlink we replace! Solaris /bin/ln does not understand -f,
  1978. # so we also need to try rm && ln -s.
  1979. for linkname
  1980. do
  1981. test "$linkname" != "$realname" \
  1982. && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })"
  1983. done
  1984. fi
  1985. # Do each command in the postinstall commands.
  1986. lib="$destdir/$realname"
  1987. func_execute_cmds "$postinstall_cmds" 'exit $?'
  1988. fi
  1989. # Install the pseudo-library for information purposes.
  1990. func_basename "$file"
  1991. name="$func_basename_result"
  1992. instname="$dir/$name"i
  1993. func_show_eval "$install_prog $instname $destdir/$name" 'exit $?'
  1994. # Maybe install the static library, too.
  1995. test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
  1996. ;;
  1997. *.lo)
  1998. # Install (i.e. copy) a libtool object.
  1999. # Figure out destination file name, if it wasn't already specified.
  2000. if test -n "$destname"; then
  2001. destfile="$destdir/$destname"
  2002. else
  2003. func_basename "$file"
  2004. destfile="$func_basename_result"
  2005. destfile="$destdir/$destfile"
  2006. fi
  2007. # Deduce the name of the destination old-style object file.
  2008. case $destfile in
  2009. *.lo)
  2010. func_lo2o "$destfile"
  2011. staticdest=$func_lo2o_result
  2012. ;;
  2013. *.$objext)
  2014. staticdest="$destfile"
  2015. destfile=
  2016. ;;
  2017. *)
  2018. func_fatal_help "cannot copy a libtool object to \`$destfile'"
  2019. ;;
  2020. esac
  2021. # Install the libtool object if requested.
  2022. test -n "$destfile" && \
  2023. func_show_eval "$install_prog $file $destfile" 'exit $?'
  2024. # Install the old object if enabled.
  2025. if test "$build_old_libs" = yes; then
  2026. # Deduce the name of the old-style object file.
  2027. func_lo2o "$file"
  2028. staticobj=$func_lo2o_result
  2029. func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?'
  2030. fi
  2031. exit $EXIT_SUCCESS
  2032. ;;
  2033. *)
  2034. # Figure out destination file name, if it wasn't already specified.
  2035. if test -n "$destname"; then
  2036. destfile="$destdir/$destname"
  2037. else
  2038. func_basename "$file"
  2039. destfile="$func_basename_result"
  2040. destfile="$destdir/$destfile"
  2041. fi
  2042. # If the file is missing, and there is a .exe on the end, strip it
  2043. # because it is most likely a libtool script we actually want to
  2044. # install
  2045. stripped_ext=""
  2046. case $file in
  2047. *.exe)
  2048. if test ! -f "$file"; then
  2049. func_stripname '' '.exe' "$file"
  2050. file=$func_stripname_result
  2051. stripped_ext=".exe"
  2052. fi
  2053. ;;
  2054. esac
  2055. # Do a test to see if this is really a libtool program.
  2056. case $host in
  2057. *cygwin* | *mingw*)
  2058. if func_ltwrapper_executable_p "$file"; then
  2059. func_ltwrapper_scriptname "$file"
  2060. wrapper=$func_ltwrapper_scriptname_result
  2061. else
  2062. func_stripname '' '.exe' "$file"
  2063. wrapper=$func_stripname_result
  2064. fi
  2065. ;;
  2066. *)
  2067. wrapper=$file
  2068. ;;
  2069. esac
  2070. if func_ltwrapper_script_p "$wrapper"; then
  2071. notinst_deplibs=
  2072. relink_command=
  2073. func_source "$wrapper"
  2074. # Check the variables that should have been set.
  2075. test -z "$generated_by_libtool_version" && \
  2076. func_fatal_error "invalid libtool wrapper script \`$wrapper'"
  2077. finalize=yes
  2078. for lib in $notinst_deplibs; do
  2079. # Check to see that each library is installed.
  2080. libdir=
  2081. if test -f "$lib"; then
  2082. func_source "$lib"
  2083. fi
  2084. libfile="$libdir/"`$ECHO "$lib" | $SED 's%^.*/%%g'` ### testsuite: skip nested quoting test
  2085. if test -n "$libdir" && test ! -f "$libfile"; then
  2086. func_warning "\`$lib' has not been installed in \`$libdir'"
  2087. finalize=no
  2088. fi
  2089. done
  2090. relink_command=
  2091. func_source "$wrapper"
  2092. outputname=
  2093. if test "$fast_install" = no && test -n "$relink_command"; then
  2094. $opt_dry_run || {
  2095. if test "$finalize" = yes; then
  2096. tmpdir=`func_mktempdir`
  2097. func_basename "$file$stripped_ext"
  2098. file="$func_basename_result"
  2099. outputname="$tmpdir/$file"
  2100. # Replace the output file specification.
  2101. relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'`
  2102. $opt_silent || {
  2103. func_quote_for_expand "$relink_command"
  2104. eval "func_echo $func_quote_for_expand_result"
  2105. }
  2106. if eval "$relink_command"; then :
  2107. else
  2108. func_error "error: relink \`$file' with the above command before installing it"
  2109. $opt_dry_run || ${RM}r "$tmpdir"
  2110. continue
  2111. fi
  2112. file="$outputname"
  2113. else
  2114. func_warning "cannot relink \`$file'"
  2115. fi
  2116. }
  2117. else
  2118. # Install the binary that we compiled earlier.
  2119. file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"`
  2120. fi
  2121. fi
  2122. # remove .exe since cygwin /usr/bin/install will append another
  2123. # one anyway
  2124. case $install_prog,$host in
  2125. */usr/bin/install*,*cygwin*)
  2126. case $file:$destfile in
  2127. *.exe:*.exe)
  2128. # this is ok
  2129. ;;
  2130. *.exe:*)
  2131. destfile=$destfile.exe
  2132. ;;
  2133. *:*.exe)
  2134. func_stripname '' '.exe' "$destfile"
  2135. destfile=$func_stripname_result
  2136. ;;
  2137. esac
  2138. ;;
  2139. esac
  2140. func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?'
  2141. $opt_dry_run || if test -n "$outputname"; then
  2142. ${RM}r "$tmpdir"
  2143. fi
  2144. ;;
  2145. esac
  2146. done
  2147. for file in $staticlibs; do
  2148. func_basename "$file"
  2149. name="$func_basename_result"
  2150. # Set up the ranlib parameters.
  2151. oldlib="$destdir/$name"
  2152. func_show_eval "$install_prog \$file \$oldlib" 'exit $?'
  2153. if test -n "$stripme" && test -n "$old_striplib"; then
  2154. func_show_eval "$old_striplib $oldlib" 'exit $?'
  2155. fi
  2156. # Do each command in the postinstall commands.
  2157. func_execute_cmds "$old_postinstall_cmds" 'exit $?'
  2158. done
  2159. test -n "$future_libdirs" && \
  2160. func_warning "remember to run \`$progname --finish$future_libdirs'"
  2161. if test -n "$current_libdirs"; then
  2162. # Maybe just do a dry run.
  2163. $opt_dry_run && current_libdirs=" -n$current_libdirs"
  2164. exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
  2165. else
  2166. exit $EXIT_SUCCESS
  2167. fi
  2168. }
  2169. test "$mode" = install && func_mode_install ${1+"$@"}
  2170. # func_generate_dlsyms outputname originator pic_p
  2171. # Extract symbols from dlprefiles and create ${outputname}S.o with
  2172. # a dlpreopen symbol table.
  2173. func_generate_dlsyms ()
  2174. {
  2175. $opt_debug
  2176. my_outputname="$1"
  2177. my_originator="$2"
  2178. my_pic_p="${3-no}"
  2179. my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'`
  2180. my_dlsyms=
  2181. if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
  2182. if test -n "$NM" && test -n "$global_symbol_pipe"; then
  2183. my_dlsyms="${my_outputname}S.c"
  2184. else
  2185. func_error "not configured to extract global symbols from dlpreopened files"
  2186. fi
  2187. fi
  2188. if test -n "$my_dlsyms"; then
  2189. case $my_dlsyms in
  2190. "") ;;
  2191. *.c)
  2192. # Discover the nlist of each of the dlfiles.
  2193. nlist="$output_objdir/${my_outputname}.nm"
  2194. func_show_eval "$RM $nlist ${nlist}S ${nlist}T"
  2195. # Parse the name list into a source file.
  2196. func_verbose "creating $output_objdir/$my_dlsyms"
  2197. $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\
  2198. /* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */
  2199. /* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */
  2200. #ifdef __cplusplus
  2201. extern \"C\" {
  2202. #endif
  2203. #if defined(__GNUC__) && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4))
  2204. #pragma GCC diagnostic ignored \"-Wstrict-prototypes\"
  2205. #endif
  2206. /* External symbol declarations for the compiler. */\
  2207. "
  2208. if test "$dlself" = yes; then
  2209. func_verbose "generating symbol list for \`$output'"
  2210. $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist"
  2211. # Add our own program objects to the symbol list.
  2212. progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP`
  2213. for progfile in $progfiles; do
  2214. func_verbose "extracting global C symbols from \`$progfile'"
  2215. $opt_dry_run || eval "$NM $progfile | $global_symbol_pipe >> '$nlist'"
  2216. done
  2217. if test -n "$exclude_expsyms"; then
  2218. $opt_dry_run || {
  2219. eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
  2220. eval '$MV "$nlist"T "$nlist"'
  2221. }
  2222. fi
  2223. if test -n "$export_symbols_regex"; then
  2224. $opt_dry_run || {
  2225. eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
  2226. eval '$MV "$nlist"T "$nlist"'
  2227. }
  2228. fi
  2229. # Prepare the list of exported symbols
  2230. if test -z "$export_symbols"; then
  2231. export_symbols="$output_objdir/$outputname.exp"
  2232. $opt_dry_run || {
  2233. $RM $export_symbols
  2234. eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
  2235. case $host in
  2236. *cygwin* | *mingw* | *cegcc* )
  2237. eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
  2238. eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
  2239. ;;
  2240. esac
  2241. }
  2242. else
  2243. $opt_dry_run || {
  2244. eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
  2245. eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
  2246. eval '$MV "$nlist"T "$nlist"'
  2247. case $host in
  2248. *cygwin* | *mingw* | *cegcc* )
  2249. eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
  2250. eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
  2251. ;;
  2252. esac
  2253. }
  2254. fi
  2255. fi
  2256. for dlprefile in $dlprefiles; do
  2257. func_verbose "extracting global C symbols from \`$dlprefile'"
  2258. func_basename "$dlprefile"
  2259. name="$func_basename_result"
  2260. $opt_dry_run || {
  2261. eval '$ECHO ": $name " >> "$nlist"'
  2262. eval "$NM $dlprefile 2>/dev/null | $global_symbol_pipe >> '$nlist'"
  2263. }
  2264. done
  2265. $opt_dry_run || {
  2266. # Make sure we have at least an empty file.
  2267. test -f "$nlist" || : > "$nlist"
  2268. if test -n "$exclude_expsyms"; then
  2269. $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
  2270. $MV "$nlist"T "$nlist"
  2271. fi
  2272. # Try sorting and uniquifying the output.
  2273. if $GREP -v "^: " < "$nlist" |
  2274. if sort -k 3 </dev/null >/dev/null 2>&1; then
  2275. sort -k 3
  2276. else
  2277. sort +2
  2278. fi |
  2279. uniq > "$nlist"S; then
  2280. :
  2281. else
  2282. $GREP -v "^: " < "$nlist" > "$nlist"S
  2283. fi
  2284. if test -f "$nlist"S; then
  2285. eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"'
  2286. else
  2287. echo '/* NONE */' >> "$output_objdir/$my_dlsyms"
  2288. fi
  2289. echo >> "$output_objdir/$my_dlsyms" "\
  2290. /* The mapping between symbol names and symbols. */
  2291. typedef struct {
  2292. const char *name;
  2293. void *address;
  2294. } lt_dlsymlist;
  2295. "
  2296. case $host in
  2297. *cygwin* | *mingw* | *cegcc* )
  2298. echo >> "$output_objdir/$my_dlsyms" "\
  2299. /* DATA imports from DLLs on WIN32 con't be const, because
  2300. runtime relocations are performed -- see ld's documentation
  2301. on pseudo-relocs. */"
  2302. lt_dlsym_const= ;;
  2303. *osf5*)
  2304. echo >> "$output_objdir/$my_dlsyms" "\
  2305. /* This system does not cope well with relocations in const data */"
  2306. lt_dlsym_const= ;;
  2307. *)
  2308. lt_dlsym_const=const ;;
  2309. esac
  2310. echo >> "$output_objdir/$my_dlsyms" "\
  2311. extern $lt_dlsym_const lt_dlsymlist
  2312. lt_${my_prefix}_LTX_preloaded_symbols[];
  2313. $lt_dlsym_const lt_dlsymlist
  2314. lt_${my_prefix}_LTX_preloaded_symbols[] =
  2315. {\
  2316. { \"$my_originator\", (void *) 0 },"
  2317. case $need_lib_prefix in
  2318. no)
  2319. eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms"
  2320. ;;
  2321. *)
  2322. eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms"
  2323. ;;
  2324. esac
  2325. echo >> "$output_objdir/$my_dlsyms" "\
  2326. {0, (void *) 0}
  2327. };
  2328. /* This works around a problem in FreeBSD linker */
  2329. #ifdef FREEBSD_WORKAROUND
  2330. static const void *lt_preloaded_setup() {
  2331. return lt_${my_prefix}_LTX_preloaded_symbols;
  2332. }
  2333. #endif
  2334. #ifdef __cplusplus
  2335. }
  2336. #endif\
  2337. "
  2338. } # !$opt_dry_run
  2339. pic_flag_for_symtable=
  2340. case "$compile_command " in
  2341. *" -static "*) ;;
  2342. *)
  2343. case $host in
  2344. # compiling the symbol table file with pic_flag works around
  2345. # a FreeBSD bug that causes programs to crash when -lm is
  2346. # linked before any other PIC object. But we must not use
  2347. # pic_flag when linking with -static. The problem exists in
  2348. # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
  2349. *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
  2350. pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;;
  2351. *-*-hpux*)
  2352. pic_flag_for_symtable=" $pic_flag" ;;
  2353. *)
  2354. if test "X$my_pic_p" != Xno; then
  2355. pic_flag_for_symtable=" $pic_flag"
  2356. fi
  2357. ;;
  2358. esac
  2359. ;;
  2360. esac
  2361. symtab_cflags=
  2362. for arg in $LTCFLAGS; do
  2363. case $arg in
  2364. -pie | -fpie | -fPIE) ;;
  2365. *) symtab_cflags="$symtab_cflags $arg" ;;
  2366. esac
  2367. done
  2368. # Now compile the dynamic symbol file.
  2369. func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?'
  2370. # Clean up the generated files.
  2371. func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"'
  2372. # Transform the symbol file into the correct name.
  2373. symfileobj="$output_objdir/${my_outputname}S.$objext"
  2374. case $host in
  2375. *cygwin* | *mingw* | *cegcc* )
  2376. if test -f "$output_objdir/$my_outputname.def"; then
  2377. compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
  2378. finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
  2379. else
  2380. compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
  2381. finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
  2382. fi
  2383. ;;
  2384. *)
  2385. compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
  2386. finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
  2387. ;;
  2388. esac
  2389. ;;
  2390. *)
  2391. func_fatal_error "unknown suffix for \`$my_dlsyms'"
  2392. ;;
  2393. esac
  2394. else
  2395. # We keep going just in case the user didn't refer to
  2396. # lt_preloaded_symbols. The linker will fail if global_symbol_pipe
  2397. # really was required.
  2398. # Nullify the symbol file.
  2399. compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"`
  2400. finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"`
  2401. fi
  2402. }
  2403. # func_win32_libid arg
  2404. # return the library type of file 'arg'
  2405. #
  2406. # Need a lot of goo to handle *both* DLLs and import libs
  2407. # Has to be a shell function in order to 'eat' the argument
  2408. # that is supplied when $file_magic_command is called.
  2409. # Despite the name, also deal with 64 bit binaries.
  2410. func_win32_libid ()
  2411. {
  2412. $opt_debug
  2413. win32_libid_type="unknown"
  2414. win32_fileres=`file -L $1 2>/dev/null`
  2415. case $win32_fileres in
  2416. *ar\ archive\ import\ library*) # definitely import
  2417. win32_libid_type="x86 archive import"
  2418. ;;
  2419. *ar\ archive*) # could be an import, or static
  2420. # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD.
  2421. if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null |
  2422. $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then
  2423. win32_nmres=`eval $NM -f posix -A $1 |
  2424. $SED -n -e '
  2425. 1,100{
  2426. / I /{
  2427. s,.*,import,
  2428. p
  2429. q
  2430. }
  2431. }'`
  2432. case $win32_nmres in
  2433. import*) win32_libid_type="x86 archive import";;
  2434. *) win32_libid_type="x86 archive static";;
  2435. esac
  2436. fi
  2437. ;;
  2438. *DLL*)
  2439. win32_libid_type="x86 DLL"
  2440. ;;
  2441. *executable*) # but shell scripts are "executable" too...
  2442. case $win32_fileres in
  2443. *MS\ Windows\ PE\ Intel*)
  2444. win32_libid_type="x86 DLL"
  2445. ;;
  2446. esac
  2447. ;;
  2448. esac
  2449. $ECHO "$win32_libid_type"
  2450. }
  2451. # func_extract_an_archive dir oldlib
  2452. func_extract_an_archive ()
  2453. {
  2454. $opt_debug
  2455. f_ex_an_ar_dir="$1"; shift
  2456. f_ex_an_ar_oldlib="$1"
  2457. if test "$lock_old_archive_extraction" = yes; then
  2458. lockfile=$f_ex_an_ar_oldlib.lock
  2459. until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
  2460. func_echo "Waiting for $lockfile to be removed"
  2461. sleep 2
  2462. done
  2463. fi
  2464. func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \
  2465. 'stat=$?; rm -f "$lockfile"; exit $stat'
  2466. if test "$lock_old_archive_extraction" = yes; then
  2467. $opt_dry_run || rm -f "$lockfile"
  2468. fi
  2469. if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
  2470. :
  2471. else
  2472. func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib"
  2473. fi
  2474. }
  2475. # func_extract_archives gentop oldlib ...
  2476. func_extract_archives ()
  2477. {
  2478. $opt_debug
  2479. my_gentop="$1"; shift
  2480. my_oldlibs=${1+"$@"}
  2481. my_oldobjs=""
  2482. my_xlib=""
  2483. my_xabs=""
  2484. my_xdir=""
  2485. for my_xlib in $my_oldlibs; do
  2486. # Extract the objects.
  2487. case $my_xlib in
  2488. [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
  2489. *) my_xabs=`pwd`"/$my_xlib" ;;
  2490. esac
  2491. func_basename "$my_xlib"
  2492. my_xlib="$func_basename_result"
  2493. my_xlib_u=$my_xlib
  2494. while :; do
  2495. case " $extracted_archives " in
  2496. *" $my_xlib_u "*)
  2497. func_arith $extracted_serial + 1
  2498. extracted_serial=$func_arith_result
  2499. my_xlib_u=lt$extracted_serial-$my_xlib ;;
  2500. *) break ;;
  2501. esac
  2502. done
  2503. extracted_archives="$extracted_archives $my_xlib_u"
  2504. my_xdir="$my_gentop/$my_xlib_u"
  2505. func_mkdir_p "$my_xdir"
  2506. case $host in
  2507. *-darwin*)
  2508. func_verbose "Extracting $my_xabs"
  2509. # Do not bother doing anything if just a dry run
  2510. $opt_dry_run || {
  2511. darwin_orig_dir=`pwd`
  2512. cd $my_xdir || exit $?
  2513. darwin_archive=$my_xabs
  2514. darwin_curdir=`pwd`
  2515. darwin_base_archive=`basename "$darwin_archive"`
  2516. darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true`
  2517. if test -n "$darwin_arches"; then
  2518. darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'`
  2519. darwin_arch=
  2520. func_verbose "$darwin_base_archive has multiple architectures $darwin_arches"
  2521. for darwin_arch in $darwin_arches ; do
  2522. func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
  2523. $LIPO -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
  2524. cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
  2525. func_extract_an_archive "`pwd`" "${darwin_base_archive}"
  2526. cd "$darwin_curdir"
  2527. $RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
  2528. done # $darwin_arches
  2529. ## Okay now we've a bunch of thin objects, gotta fatten them up :)
  2530. darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u`
  2531. darwin_file=
  2532. darwin_files=
  2533. for darwin_file in $darwin_filelist; do
  2534. darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP`
  2535. $LIPO -create -output "$darwin_file" $darwin_files
  2536. done # $darwin_filelist
  2537. $RM -rf unfat-$$
  2538. cd "$darwin_orig_dir"
  2539. else
  2540. cd $darwin_orig_dir
  2541. func_extract_an_archive "$my_xdir" "$my_xabs"
  2542. fi # $darwin_arches
  2543. } # !$opt_dry_run
  2544. ;;
  2545. *)
  2546. func_extract_an_archive "$my_xdir" "$my_xabs"
  2547. ;;
  2548. esac
  2549. my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP`
  2550. done
  2551. func_extract_archives_result="$my_oldobjs"
  2552. }
  2553. # func_emit_wrapper [arg=no]
  2554. #
  2555. # Emit a libtool wrapper script on stdout.
  2556. # Don't directly open a file because we may want to
  2557. # incorporate the script contents within a cygwin/mingw
  2558. # wrapper executable. Must ONLY be called from within
  2559. # func_mode_link because it depends on a number of variables
  2560. # set therein.
  2561. #
  2562. # ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR
  2563. # variable will take. If 'yes', then the emitted script
  2564. # will assume that the directory in which it is stored is
  2565. # the $objdir directory. This is a cygwin/mingw-specific
  2566. # behavior.
  2567. func_emit_wrapper ()
  2568. {
  2569. func_emit_wrapper_arg1=${1-no}
  2570. $ECHO "\
  2571. #! $SHELL
  2572. # $output - temporary wrapper script for $objdir/$outputname
  2573. # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
  2574. #
  2575. # The $output program cannot be directly executed until all the libtool
  2576. # libraries that it depends on are installed.
  2577. #
  2578. # This wrapper script should never be moved out of the build directory.
  2579. # If it is, it will not operate correctly.
  2580. # Sed substitution that helps us do robust quoting. It backslashifies
  2581. # metacharacters that are still active within double-quoted strings.
  2582. sed_quote_subst='$sed_quote_subst'
  2583. # Be Bourne compatible
  2584. if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
  2585. emulate sh
  2586. NULLCMD=:
  2587. # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
  2588. # is contrary to our usage. Disable this feature.
  2589. alias -g '\${1+\"\$@\"}'='\"\$@\"'
  2590. setopt NO_GLOB_SUBST
  2591. else
  2592. case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
  2593. fi
  2594. BIN_SH=xpg4; export BIN_SH # for Tru64
  2595. DUALCASE=1; export DUALCASE # for MKS sh
  2596. # The HP-UX ksh and POSIX shell print the target directory to stdout
  2597. # if CDPATH is set.
  2598. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
  2599. relink_command=\"$relink_command\"
  2600. # This environment variable determines our operation mode.
  2601. if test \"\$libtool_install_magic\" = \"$magic\"; then
  2602. # install mode needs the following variables:
  2603. generated_by_libtool_version='$macro_version'
  2604. notinst_deplibs='$notinst_deplibs'
  2605. else
  2606. # When we are sourced in execute mode, \$file and \$ECHO are already set.
  2607. if test \"\$libtool_execute_magic\" != \"$magic\"; then
  2608. file=\"\$0\""
  2609. qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"`
  2610. $ECHO "\
  2611. # A function that is used when there is no print builtin or printf.
  2612. func_fallback_echo ()
  2613. {
  2614. eval 'cat <<_LTECHO_EOF
  2615. \$1
  2616. _LTECHO_EOF'
  2617. }
  2618. ECHO=\"$qECHO\"
  2619. fi
  2620. # Very basic option parsing. These options are (a) specific to
  2621. # the libtool wrapper, (b) are identical between the wrapper
  2622. # /script/ and the wrapper /executable/ which is used only on
  2623. # windows platforms, and (c) all begin with the string "--lt-"
  2624. # (application programs are unlikely to have options which match
  2625. # this pattern).
  2626. #
  2627. # There are only two supported options: --lt-debug and
  2628. # --lt-dump-script. There is, deliberately, no --lt-help.
  2629. #
  2630. # The first argument to this parsing function should be the
  2631. # script's $0 value, followed by "$@".
  2632. lt_option_debug=
  2633. func_parse_lt_options ()
  2634. {
  2635. lt_script_arg0=\$0
  2636. shift
  2637. for lt_opt
  2638. do
  2639. case \"\$lt_opt\" in
  2640. --lt-debug) lt_option_debug=1 ;;
  2641. --lt-dump-script)
  2642. lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\`
  2643. test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=.
  2644. lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\`
  2645. cat \"\$lt_dump_D/\$lt_dump_F\"
  2646. exit 0
  2647. ;;
  2648. --lt-*)
  2649. \$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2
  2650. exit 1
  2651. ;;
  2652. esac
  2653. done
  2654. # Print the debug banner immediately:
  2655. if test -n \"\$lt_option_debug\"; then
  2656. echo \"${outputname}:${output}:\${LINENO}: libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\" 1>&2
  2657. fi
  2658. }
  2659. # Used when --lt-debug. Prints its arguments to stdout
  2660. # (redirection is the responsibility of the caller)
  2661. func_lt_dump_args ()
  2662. {
  2663. lt_dump_args_N=1;
  2664. for lt_arg
  2665. do
  2666. \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[\$lt_dump_args_N]: \$lt_arg\"
  2667. lt_dump_args_N=\`expr \$lt_dump_args_N + 1\`
  2668. done
  2669. }
  2670. # Core function for launching the target application
  2671. func_exec_program_core ()
  2672. {
  2673. "
  2674. case $host in
  2675. # Backslashes separate directories on plain windows
  2676. *-*-mingw | *-*-os2* | *-cegcc*)
  2677. $ECHO "\
  2678. if test -n \"\$lt_option_debug\"; then
  2679. \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir\\\\\$program\" 1>&2
  2680. func_lt_dump_args \${1+\"\$@\"} 1>&2
  2681. fi
  2682. exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
  2683. "
  2684. ;;
  2685. *)
  2686. $ECHO "\
  2687. if test -n \"\$lt_option_debug\"; then
  2688. \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir/\$program\" 1>&2
  2689. func_lt_dump_args \${1+\"\$@\"} 1>&2
  2690. fi
  2691. exec \"\$progdir/\$program\" \${1+\"\$@\"}
  2692. "
  2693. ;;
  2694. esac
  2695. $ECHO "\
  2696. \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2
  2697. exit 1
  2698. }
  2699. # A function to encapsulate launching the target application
  2700. # Strips options in the --lt-* namespace from \$@ and
  2701. # launches target application with the remaining arguments.
  2702. func_exec_program ()
  2703. {
  2704. for lt_wr_arg
  2705. do
  2706. case \$lt_wr_arg in
  2707. --lt-*) ;;
  2708. *) set x \"\$@\" \"\$lt_wr_arg\"; shift;;
  2709. esac
  2710. shift
  2711. done
  2712. func_exec_program_core \${1+\"\$@\"}
  2713. }
  2714. # Parse options
  2715. func_parse_lt_options \"\$0\" \${1+\"\$@\"}
  2716. # Find the directory that this script lives in.
  2717. thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\`
  2718. test \"x\$thisdir\" = \"x\$file\" && thisdir=.
  2719. # Follow symbolic links until we get to the real thisdir.
  2720. file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\`
  2721. while test -n \"\$file\"; do
  2722. destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\`
  2723. # If there was a directory component, then change thisdir.
  2724. if test \"x\$destdir\" != \"x\$file\"; then
  2725. case \"\$destdir\" in
  2726. [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
  2727. *) thisdir=\"\$thisdir/\$destdir\" ;;
  2728. esac
  2729. fi
  2730. file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\`
  2731. file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\`
  2732. done
  2733. # Usually 'no', except on cygwin/mingw when embedded into
  2734. # the cwrapper.
  2735. WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1
  2736. if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then
  2737. # special case for '.'
  2738. if test \"\$thisdir\" = \".\"; then
  2739. thisdir=\`pwd\`
  2740. fi
  2741. # remove .libs from thisdir
  2742. case \"\$thisdir\" in
  2743. *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;;
  2744. $objdir ) thisdir=. ;;
  2745. esac
  2746. fi
  2747. # Try to get the absolute directory name.
  2748. absdir=\`cd \"\$thisdir\" && pwd\`
  2749. test -n \"\$absdir\" && thisdir=\"\$absdir\"
  2750. "
  2751. if test "$fast_install" = yes; then
  2752. $ECHO "\
  2753. program=lt-'$outputname'$exeext
  2754. progdir=\"\$thisdir/$objdir\"
  2755. if test ! -f \"\$progdir/\$program\" ||
  2756. { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
  2757. test \"X\$file\" != \"X\$progdir/\$program\"; }; then
  2758. file=\"\$\$-\$program\"
  2759. if test ! -d \"\$progdir\"; then
  2760. $MKDIR \"\$progdir\"
  2761. else
  2762. $RM \"\$progdir/\$file\"
  2763. fi"
  2764. $ECHO "\
  2765. # relink executable if necessary
  2766. if test -n \"\$relink_command\"; then
  2767. if relink_command_output=\`eval \$relink_command 2>&1\`; then :
  2768. else
  2769. $ECHO \"\$relink_command_output\" >&2
  2770. $RM \"\$progdir/\$file\"
  2771. exit 1
  2772. fi
  2773. fi
  2774. $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
  2775. { $RM \"\$progdir/\$program\";
  2776. $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; }
  2777. $RM \"\$progdir/\$file\"
  2778. fi"
  2779. else
  2780. $ECHO "\
  2781. program='$outputname'
  2782. progdir=\"\$thisdir/$objdir\"
  2783. "
  2784. fi
  2785. $ECHO "\
  2786. if test -f \"\$progdir/\$program\"; then"
  2787. # Export our shlibpath_var if we have one.
  2788. if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
  2789. $ECHO "\
  2790. # Add our own library path to $shlibpath_var
  2791. $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
  2792. # Some systems cannot cope with colon-terminated $shlibpath_var
  2793. # The second colon is a workaround for a bug in BeOS R4 sed
  2794. $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\`
  2795. export $shlibpath_var
  2796. "
  2797. fi
  2798. # fixup the dll searchpath if we need to.
  2799. if test -n "$dllsearchpath"; then
  2800. $ECHO "\
  2801. # Add the dll search path components to the executable PATH
  2802. PATH=$dllsearchpath:\$PATH
  2803. "
  2804. fi
  2805. $ECHO "\
  2806. if test \"\$libtool_execute_magic\" != \"$magic\"; then
  2807. # Run the actual program with our arguments.
  2808. func_exec_program \${1+\"\$@\"}
  2809. fi
  2810. else
  2811. # The program doesn't exist.
  2812. \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
  2813. \$ECHO \"This script is just a wrapper for \$program.\" 1>&2
  2814. \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2
  2815. exit 1
  2816. fi
  2817. fi\
  2818. "
  2819. }
  2820. # func_to_host_path arg
  2821. #
  2822. # Convert paths to host format when used with build tools.
  2823. # Intended for use with "native" mingw (where libtool itself
  2824. # is running under the msys shell), or in the following cross-
  2825. # build environments:
  2826. # $build $host
  2827. # mingw (msys) mingw [e.g. native]
  2828. # cygwin mingw
  2829. # *nix + wine mingw
  2830. # where wine is equipped with the `winepath' executable.
  2831. # In the native mingw case, the (msys) shell automatically
  2832. # converts paths for any non-msys applications it launches,
  2833. # but that facility isn't available from inside the cwrapper.
  2834. # Similar accommodations are necessary for $host mingw and
  2835. # $build cygwin. Calling this function does no harm for other
  2836. # $host/$build combinations not listed above.
  2837. #
  2838. # ARG is the path (on $build) that should be converted to
  2839. # the proper representation for $host. The result is stored
  2840. # in $func_to_host_path_result.
  2841. func_to_host_path ()
  2842. {
  2843. func_to_host_path_result="$1"
  2844. if test -n "$1"; then
  2845. case $host in
  2846. *mingw* )
  2847. lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
  2848. case $build in
  2849. *mingw* ) # actually, msys
  2850. # awkward: cmd appends spaces to result
  2851. func_to_host_path_result=`( cmd //c echo "$1" ) 2>/dev/null |
  2852. $SED -e 's/[ ]*$//' -e "$lt_sed_naive_backslashify"`
  2853. ;;
  2854. *cygwin* )
  2855. func_to_host_path_result=`cygpath -w "$1" |
  2856. $SED -e "$lt_sed_naive_backslashify"`
  2857. ;;
  2858. * )
  2859. # Unfortunately, winepath does not exit with a non-zero
  2860. # error code, so we are forced to check the contents of
  2861. # stdout. On the other hand, if the command is not
  2862. # found, the shell will set an exit code of 127 and print
  2863. # *an error message* to stdout. So we must check for both
  2864. # error code of zero AND non-empty stdout, which explains
  2865. # the odd construction:
  2866. func_to_host_path_tmp1=`winepath -w "$1" 2>/dev/null`
  2867. if test "$?" -eq 0 && test -n "${func_to_host_path_tmp1}"; then
  2868. func_to_host_path_result=`$ECHO "$func_to_host_path_tmp1" |
  2869. $SED -e "$lt_sed_naive_backslashify"`
  2870. else
  2871. # Allow warning below.
  2872. func_to_host_path_result=
  2873. fi
  2874. ;;
  2875. esac
  2876. if test -z "$func_to_host_path_result" ; then
  2877. func_error "Could not determine host path corresponding to"
  2878. func_error " \`$1'"
  2879. func_error "Continuing, but uninstalled executables may not work."
  2880. # Fallback:
  2881. func_to_host_path_result="$1"
  2882. fi
  2883. ;;
  2884. esac
  2885. fi
  2886. }
  2887. # end: func_to_host_path
  2888. # func_to_host_pathlist arg
  2889. #
  2890. # Convert pathlists to host format when used with build tools.
  2891. # See func_to_host_path(), above. This function supports the
  2892. # following $build/$host combinations (but does no harm for
  2893. # combinations not listed here):
  2894. # $build $host
  2895. # mingw (msys) mingw [e.g. native]
  2896. # cygwin mingw
  2897. # *nix + wine mingw
  2898. #
  2899. # Path separators are also converted from $build format to
  2900. # $host format. If ARG begins or ends with a path separator
  2901. # character, it is preserved (but converted to $host format)
  2902. # on output.
  2903. #
  2904. # ARG is a pathlist (on $build) that should be converted to
  2905. # the proper representation on $host. The result is stored
  2906. # in $func_to_host_pathlist_result.
  2907. func_to_host_pathlist ()
  2908. {
  2909. func_to_host_pathlist_result="$1"
  2910. if test -n "$1"; then
  2911. case $host in
  2912. *mingw* )
  2913. lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
  2914. # Remove leading and trailing path separator characters from
  2915. # ARG. msys behavior is inconsistent here, cygpath turns them
  2916. # into '.;' and ';.', and winepath ignores them completely.
  2917. func_stripname : : "$1"
  2918. func_to_host_pathlist_tmp1=$func_stripname_result
  2919. case $build in
  2920. *mingw* ) # Actually, msys.
  2921. # Awkward: cmd appends spaces to result.
  2922. func_to_host_pathlist_result=`
  2923. ( cmd //c echo "$func_to_host_pathlist_tmp1" ) 2>/dev/null |
  2924. $SED -e 's/[ ]*$//' -e "$lt_sed_naive_backslashify"`
  2925. ;;
  2926. *cygwin* )
  2927. func_to_host_pathlist_result=`cygpath -w -p "$func_to_host_pathlist_tmp1" |
  2928. $SED -e "$lt_sed_naive_backslashify"`
  2929. ;;
  2930. * )
  2931. # unfortunately, winepath doesn't convert pathlists
  2932. func_to_host_pathlist_result=""
  2933. func_to_host_pathlist_oldIFS=$IFS
  2934. IFS=:
  2935. for func_to_host_pathlist_f in $func_to_host_pathlist_tmp1 ; do
  2936. IFS=$func_to_host_pathlist_oldIFS
  2937. if test -n "$func_to_host_pathlist_f" ; then
  2938. func_to_host_path "$func_to_host_pathlist_f"
  2939. if test -n "$func_to_host_path_result" ; then
  2940. if test -z "$func_to_host_pathlist_result" ; then
  2941. func_to_host_pathlist_result="$func_to_host_path_result"
  2942. else
  2943. func_append func_to_host_pathlist_result ";$func_to_host_path_result"
  2944. fi
  2945. fi
  2946. fi
  2947. done
  2948. IFS=$func_to_host_pathlist_oldIFS
  2949. ;;
  2950. esac
  2951. if test -z "$func_to_host_pathlist_result"; then
  2952. func_error "Could not determine the host path(s) corresponding to"
  2953. func_error " \`$1'"
  2954. func_error "Continuing, but uninstalled executables may not work."
  2955. # Fallback. This may break if $1 contains DOS-style drive
  2956. # specifications. The fix is not to complicate the expression
  2957. # below, but for the user to provide a working wine installation
  2958. # with winepath so that path translation in the cross-to-mingw
  2959. # case works properly.
  2960. lt_replace_pathsep_nix_to_dos="s|:|;|g"
  2961. func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp1" |\
  2962. $SED -e "$lt_replace_pathsep_nix_to_dos"`
  2963. fi
  2964. # Now, add the leading and trailing path separators back
  2965. case "$1" in
  2966. :* ) func_to_host_pathlist_result=";$func_to_host_pathlist_result"
  2967. ;;
  2968. esac
  2969. case "$1" in
  2970. *: ) func_append func_to_host_pathlist_result ";"
  2971. ;;
  2972. esac
  2973. ;;
  2974. esac
  2975. fi
  2976. }
  2977. # end: func_to_host_pathlist
  2978. # func_emit_cwrapperexe_src
  2979. # emit the source code for a wrapper executable on stdout
  2980. # Must ONLY be called from within func_mode_link because
  2981. # it depends on a number of variable set therein.
  2982. func_emit_cwrapperexe_src ()
  2983. {
  2984. cat <<EOF
  2985. /* $cwrappersource - temporary wrapper executable for $objdir/$outputname
  2986. Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
  2987. The $output program cannot be directly executed until all the libtool
  2988. libraries that it depends on are installed.
  2989. This wrapper executable should never be moved out of the build directory.
  2990. If it is, it will not operate correctly.
  2991. */
  2992. EOF
  2993. cat <<"EOF"
  2994. #ifdef _MSC_VER
  2995. # define _CRT_SECURE_NO_DEPRECATE 1
  2996. #endif
  2997. #include <stdio.h>
  2998. #include <stdlib.h>
  2999. #ifdef _MSC_VER
  3000. # include <direct.h>
  3001. # include <process.h>
  3002. # include <io.h>
  3003. #else
  3004. # include <unistd.h>
  3005. # include <stdint.h>
  3006. # ifdef __CYGWIN__
  3007. # include <io.h>
  3008. # endif
  3009. #endif
  3010. #include <malloc.h>
  3011. #include <stdarg.h>
  3012. #include <assert.h>
  3013. #include <string.h>
  3014. #include <ctype.h>
  3015. #include <errno.h>
  3016. #include <fcntl.h>
  3017. #include <sys/stat.h>
  3018. /* declarations of non-ANSI functions */
  3019. #if defined(__MINGW32__)
  3020. # ifdef __STRICT_ANSI__
  3021. int _putenv (const char *);
  3022. # endif
  3023. #elif defined(__CYGWIN__)
  3024. # ifdef __STRICT_ANSI__
  3025. char *realpath (const char *, char *);
  3026. int putenv (char *);
  3027. int setenv (const char *, const char *, int);
  3028. # endif
  3029. /* #elif defined (other platforms) ... */
  3030. #endif
  3031. /* portability defines, excluding path handling macros */
  3032. #if defined(_MSC_VER)
  3033. # define setmode _setmode
  3034. # define stat _stat
  3035. # define chmod _chmod
  3036. # define getcwd _getcwd
  3037. # define putenv _putenv
  3038. # define S_IXUSR _S_IEXEC
  3039. # ifndef _INTPTR_T_DEFINED
  3040. # define _INTPTR_T_DEFINED
  3041. # define intptr_t int
  3042. # endif
  3043. #elif defined(__MINGW32__)
  3044. # define setmode _setmode
  3045. # define stat _stat
  3046. # define chmod _chmod
  3047. # define getcwd _getcwd
  3048. # define putenv _putenv
  3049. #elif defined(__CYGWIN__)
  3050. # define HAVE_SETENV
  3051. # define FOPEN_WB "wb"
  3052. /* #elif defined (other platforms) ... */
  3053. #endif
  3054. #if defined(PATH_MAX)
  3055. # define LT_PATHMAX PATH_MAX
  3056. #elif defined(MAXPATHLEN)
  3057. # define LT_PATHMAX MAXPATHLEN
  3058. #else
  3059. # define LT_PATHMAX 1024
  3060. #endif
  3061. #ifndef S_IXOTH
  3062. # define S_IXOTH 0
  3063. #endif
  3064. #ifndef S_IXGRP
  3065. # define S_IXGRP 0
  3066. #endif
  3067. /* path handling portability macros */
  3068. #ifndef DIR_SEPARATOR
  3069. # define DIR_SEPARATOR '/'
  3070. # define PATH_SEPARATOR ':'
  3071. #endif
  3072. #if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
  3073. defined (__OS2__)
  3074. # define HAVE_DOS_BASED_FILE_SYSTEM
  3075. # define FOPEN_WB "wb"
  3076. # ifndef DIR_SEPARATOR_2
  3077. # define DIR_SEPARATOR_2 '\\'
  3078. # endif
  3079. # ifndef PATH_SEPARATOR_2
  3080. # define PATH_SEPARATOR_2 ';'
  3081. # endif
  3082. #endif
  3083. #ifndef DIR_SEPARATOR_2
  3084. # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
  3085. #else /* DIR_SEPARATOR_2 */
  3086. # define IS_DIR_SEPARATOR(ch) \
  3087. (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
  3088. #endif /* DIR_SEPARATOR_2 */
  3089. #ifndef PATH_SEPARATOR_2
  3090. # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
  3091. #else /* PATH_SEPARATOR_2 */
  3092. # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
  3093. #endif /* PATH_SEPARATOR_2 */
  3094. #ifndef FOPEN_WB
  3095. # define FOPEN_WB "w"
  3096. #endif
  3097. #ifndef _O_BINARY
  3098. # define _O_BINARY 0
  3099. #endif
  3100. #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type)))
  3101. #define XFREE(stale) do { \
  3102. if (stale) { free ((void *) stale); stale = 0; } \
  3103. } while (0)
  3104. #if defined(LT_DEBUGWRAPPER)
  3105. static int lt_debug = 1;
  3106. #else
  3107. static int lt_debug = 0;
  3108. #endif
  3109. const char *program_name = "libtool-wrapper"; /* in case xstrdup fails */
  3110. void *xmalloc (size_t num);
  3111. char *xstrdup (const char *string);
  3112. const char *base_name (const char *name);
  3113. char *find_executable (const char *wrapper);
  3114. char *chase_symlinks (const char *pathspec);
  3115. int make_executable (const char *path);
  3116. int check_executable (const char *path);
  3117. char *strendzap (char *str, const char *pat);
  3118. void lt_debugprintf (const char *file, int line, const char *fmt, ...);
  3119. void lt_fatal (const char *file, int line, const char *message, ...);
  3120. static const char *nonnull (const char *s);
  3121. static const char *nonempty (const char *s);
  3122. void lt_setenv (const char *name, const char *value);
  3123. char *lt_extend_str (const char *orig_value, const char *add, int to_end);
  3124. void lt_update_exe_path (const char *name, const char *value);
  3125. void lt_update_lib_path (const char *name, const char *value);
  3126. char **prepare_spawn (char **argv);
  3127. void lt_dump_script (FILE *f);
  3128. EOF
  3129. cat <<EOF
  3130. const char * MAGIC_EXE = "$magic_exe";
  3131. const char * LIB_PATH_VARNAME = "$shlibpath_var";
  3132. EOF
  3133. if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
  3134. func_to_host_pathlist "$temp_rpath"
  3135. cat <<EOF
  3136. const char * LIB_PATH_VALUE = "$func_to_host_pathlist_result";
  3137. EOF
  3138. else
  3139. cat <<"EOF"
  3140. const char * LIB_PATH_VALUE = "";
  3141. EOF
  3142. fi
  3143. if test -n "$dllsearchpath"; then
  3144. func_to_host_pathlist "$dllsearchpath:"
  3145. cat <<EOF
  3146. const char * EXE_PATH_VARNAME = "PATH";
  3147. const char * EXE_PATH_VALUE = "$func_to_host_pathlist_result";
  3148. EOF
  3149. else
  3150. cat <<"EOF"
  3151. const char * EXE_PATH_VARNAME = "";
  3152. const char * EXE_PATH_VALUE = "";
  3153. EOF
  3154. fi
  3155. if test "$fast_install" = yes; then
  3156. cat <<EOF
  3157. const char * TARGET_PROGRAM_NAME = "lt-$outputname"; /* hopefully, no .exe */
  3158. EOF
  3159. else
  3160. cat <<EOF
  3161. const char * TARGET_PROGRAM_NAME = "$outputname"; /* hopefully, no .exe */
  3162. EOF
  3163. fi
  3164. cat <<"EOF"
  3165. #define LTWRAPPER_OPTION_PREFIX "--lt-"
  3166. static const char *ltwrapper_option_prefix = LTWRAPPER_OPTION_PREFIX;
  3167. static const char *dumpscript_opt = LTWRAPPER_OPTION_PREFIX "dump-script";
  3168. static const char *debug_opt = LTWRAPPER_OPTION_PREFIX "debug";
  3169. int
  3170. main (int argc, char *argv[])
  3171. {
  3172. char **newargz;
  3173. int newargc;
  3174. char *tmp_pathspec;
  3175. char *actual_cwrapper_path;
  3176. char *actual_cwrapper_name;
  3177. char *target_name;
  3178. char *lt_argv_zero;
  3179. intptr_t rval = 127;
  3180. int i;
  3181. program_name = (char *) xstrdup (base_name (argv[0]));
  3182. newargz = XMALLOC (char *, argc + 1);
  3183. /* very simple arg parsing; don't want to rely on getopt
  3184. * also, copy all non cwrapper options to newargz, except
  3185. * argz[0], which is handled differently
  3186. */
  3187. newargc=0;
  3188. for (i = 1; i < argc; i++)
  3189. {
  3190. if (strcmp (argv[i], dumpscript_opt) == 0)
  3191. {
  3192. EOF
  3193. case "$host" in
  3194. *mingw* | *cygwin* )
  3195. # make stdout use "unix" line endings
  3196. echo " setmode(1,_O_BINARY);"
  3197. ;;
  3198. esac
  3199. cat <<"EOF"
  3200. lt_dump_script (stdout);
  3201. return 0;
  3202. }
  3203. if (strcmp (argv[i], debug_opt) == 0)
  3204. {
  3205. lt_debug = 1;
  3206. continue;
  3207. }
  3208. if (strcmp (argv[i], ltwrapper_option_prefix) == 0)
  3209. {
  3210. /* however, if there is an option in the LTWRAPPER_OPTION_PREFIX
  3211. namespace, but it is not one of the ones we know about and
  3212. have already dealt with, above (inluding dump-script), then
  3213. report an error. Otherwise, targets might begin to believe
  3214. they are allowed to use options in the LTWRAPPER_OPTION_PREFIX
  3215. namespace. The first time any user complains about this, we'll
  3216. need to make LTWRAPPER_OPTION_PREFIX a configure-time option
  3217. or a configure.ac-settable value.
  3218. */
  3219. lt_fatal (__FILE__, __LINE__,
  3220. "unrecognized %s option: '%s'",
  3221. ltwrapper_option_prefix, argv[i]);
  3222. }
  3223. /* otherwise ... */
  3224. newargz[++newargc] = xstrdup (argv[i]);
  3225. }
  3226. newargz[++newargc] = NULL;
  3227. EOF
  3228. cat <<EOF
  3229. /* The GNU banner must be the first non-error debug message */
  3230. lt_debugprintf (__FILE__, __LINE__, "libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\n");
  3231. EOF
  3232. cat <<"EOF"
  3233. lt_debugprintf (__FILE__, __LINE__, "(main) argv[0]: %s\n", argv[0]);
  3234. lt_debugprintf (__FILE__, __LINE__, "(main) program_name: %s\n", program_name);
  3235. tmp_pathspec = find_executable (argv[0]);
  3236. if (tmp_pathspec == NULL)
  3237. lt_fatal (__FILE__, __LINE__, "couldn't find %s", argv[0]);
  3238. lt_debugprintf (__FILE__, __LINE__,
  3239. "(main) found exe (before symlink chase) at: %s\n",
  3240. tmp_pathspec);
  3241. actual_cwrapper_path = chase_symlinks (tmp_pathspec);
  3242. lt_debugprintf (__FILE__, __LINE__,
  3243. "(main) found exe (after symlink chase) at: %s\n",
  3244. actual_cwrapper_path);
  3245. XFREE (tmp_pathspec);
  3246. actual_cwrapper_name = xstrdup (base_name (actual_cwrapper_path));
  3247. strendzap (actual_cwrapper_path, actual_cwrapper_name);
  3248. /* wrapper name transforms */
  3249. strendzap (actual_cwrapper_name, ".exe");
  3250. tmp_pathspec = lt_extend_str (actual_cwrapper_name, ".exe", 1);
  3251. XFREE (actual_cwrapper_name);
  3252. actual_cwrapper_name = tmp_pathspec;
  3253. tmp_pathspec = 0;
  3254. /* target_name transforms -- use actual target program name; might have lt- prefix */
  3255. target_name = xstrdup (base_name (TARGET_PROGRAM_NAME));
  3256. strendzap (target_name, ".exe");
  3257. tmp_pathspec = lt_extend_str (target_name, ".exe", 1);
  3258. XFREE (target_name);
  3259. target_name = tmp_pathspec;
  3260. tmp_pathspec = 0;
  3261. lt_debugprintf (__FILE__, __LINE__,
  3262. "(main) libtool target name: %s\n",
  3263. target_name);
  3264. EOF
  3265. cat <<EOF
  3266. newargz[0] =
  3267. XMALLOC (char, (strlen (actual_cwrapper_path) +
  3268. strlen ("$objdir") + 1 + strlen (actual_cwrapper_name) + 1));
  3269. strcpy (newargz[0], actual_cwrapper_path);
  3270. strcat (newargz[0], "$objdir");
  3271. strcat (newargz[0], "/");
  3272. EOF
  3273. cat <<"EOF"
  3274. /* stop here, and copy so we don't have to do this twice */
  3275. tmp_pathspec = xstrdup (newargz[0]);
  3276. /* do NOT want the lt- prefix here, so use actual_cwrapper_name */
  3277. strcat (newargz[0], actual_cwrapper_name);
  3278. /* DO want the lt- prefix here if it exists, so use target_name */
  3279. lt_argv_zero = lt_extend_str (tmp_pathspec, target_name, 1);
  3280. XFREE (tmp_pathspec);
  3281. tmp_pathspec = NULL;
  3282. EOF
  3283. case $host_os in
  3284. mingw*)
  3285. cat <<"EOF"
  3286. {
  3287. char* p;
  3288. while ((p = strchr (newargz[0], '\\')) != NULL)
  3289. {
  3290. *p = '/';
  3291. }
  3292. while ((p = strchr (lt_argv_zero, '\\')) != NULL)
  3293. {
  3294. *p = '/';
  3295. }
  3296. }
  3297. EOF
  3298. ;;
  3299. esac
  3300. cat <<"EOF"
  3301. XFREE (target_name);
  3302. XFREE (actual_cwrapper_path);
  3303. XFREE (actual_cwrapper_name);
  3304. lt_setenv ("BIN_SH", "xpg4"); /* for Tru64 */
  3305. lt_setenv ("DUALCASE", "1"); /* for MSK sh */
  3306. lt_update_lib_path (LIB_PATH_VARNAME, LIB_PATH_VALUE);
  3307. lt_update_exe_path (EXE_PATH_VARNAME, EXE_PATH_VALUE);
  3308. lt_debugprintf (__FILE__, __LINE__, "(main) lt_argv_zero: %s\n",
  3309. nonnull (lt_argv_zero));
  3310. for (i = 0; i < newargc; i++)
  3311. {
  3312. lt_debugprintf (__FILE__, __LINE__, "(main) newargz[%d]: %s\n",
  3313. i, nonnull (newargz[i]));
  3314. }
  3315. EOF
  3316. case $host_os in
  3317. mingw*)
  3318. cat <<"EOF"
  3319. /* execv doesn't actually work on mingw as expected on unix */
  3320. newargz = prepare_spawn (newargz);
  3321. rval = _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz);
  3322. if (rval == -1)
  3323. {
  3324. /* failed to start process */
  3325. lt_debugprintf (__FILE__, __LINE__,
  3326. "(main) failed to launch target \"%s\": %s\n",
  3327. lt_argv_zero, nonnull (strerror (errno)));
  3328. return 127;
  3329. }
  3330. return rval;
  3331. EOF
  3332. ;;
  3333. *)
  3334. cat <<"EOF"
  3335. execv (lt_argv_zero, newargz);
  3336. return rval; /* =127, but avoids unused variable warning */
  3337. EOF
  3338. ;;
  3339. esac
  3340. cat <<"EOF"
  3341. }
  3342. void *
  3343. xmalloc (size_t num)
  3344. {
  3345. void *p = (void *) malloc (num);
  3346. if (!p)
  3347. lt_fatal (__FILE__, __LINE__, "memory exhausted");
  3348. return p;
  3349. }
  3350. char *
  3351. xstrdup (const char *string)
  3352. {
  3353. return string ? strcpy ((char *) xmalloc (strlen (string) + 1),
  3354. string) : NULL;
  3355. }
  3356. const char *
  3357. base_name (const char *name)
  3358. {
  3359. const char *base;
  3360. #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
  3361. /* Skip over the disk name in MSDOS pathnames. */
  3362. if (isalpha ((unsigned char) name[0]) && name[1] == ':')
  3363. name += 2;
  3364. #endif
  3365. for (base = name; *name; name++)
  3366. if (IS_DIR_SEPARATOR (*name))
  3367. base = name + 1;
  3368. return base;
  3369. }
  3370. int
  3371. check_executable (const char *path)
  3372. {
  3373. struct stat st;
  3374. lt_debugprintf (__FILE__, __LINE__, "(check_executable): %s\n",
  3375. nonempty (path));
  3376. if ((!path) || (!*path))
  3377. return 0;
  3378. if ((stat (path, &st) >= 0)
  3379. && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)))
  3380. return 1;
  3381. else
  3382. return 0;
  3383. }
  3384. int
  3385. make_executable (const char *path)
  3386. {
  3387. int rval = 0;
  3388. struct stat st;
  3389. lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n",
  3390. nonempty (path));
  3391. if ((!path) || (!*path))
  3392. return 0;
  3393. if (stat (path, &st) >= 0)
  3394. {
  3395. rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR);
  3396. }
  3397. return rval;
  3398. }
  3399. /* Searches for the full path of the wrapper. Returns
  3400. newly allocated full path name if found, NULL otherwise
  3401. Does not chase symlinks, even on platforms that support them.
  3402. */
  3403. char *
  3404. find_executable (const char *wrapper)
  3405. {
  3406. int has_slash = 0;
  3407. const char *p;
  3408. const char *p_next;
  3409. /* static buffer for getcwd */
  3410. char tmp[LT_PATHMAX + 1];
  3411. int tmp_len;
  3412. char *concat_name;
  3413. lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n",
  3414. nonempty (wrapper));
  3415. if ((wrapper == NULL) || (*wrapper == '\0'))
  3416. return NULL;
  3417. /* Absolute path? */
  3418. #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
  3419. if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':')
  3420. {
  3421. concat_name = xstrdup (wrapper);
  3422. if (check_executable (concat_name))
  3423. return concat_name;
  3424. XFREE (concat_name);
  3425. }
  3426. else
  3427. {
  3428. #endif
  3429. if (IS_DIR_SEPARATOR (wrapper[0]))
  3430. {
  3431. concat_name = xstrdup (wrapper);
  3432. if (check_executable (concat_name))
  3433. return concat_name;
  3434. XFREE (concat_name);
  3435. }
  3436. #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
  3437. }
  3438. #endif
  3439. for (p = wrapper; *p; p++)
  3440. if (*p == '/')
  3441. {
  3442. has_slash = 1;
  3443. break;
  3444. }
  3445. if (!has_slash)
  3446. {
  3447. /* no slashes; search PATH */
  3448. const char *path = getenv ("PATH");
  3449. if (path != NULL)
  3450. {
  3451. for (p = path; *p; p = p_next)
  3452. {
  3453. const char *q;
  3454. size_t p_len;
  3455. for (q = p; *q; q++)
  3456. if (IS_PATH_SEPARATOR (*q))
  3457. break;
  3458. p_len = q - p;
  3459. p_next = (*q == '\0' ? q : q + 1);
  3460. if (p_len == 0)
  3461. {
  3462. /* empty path: current directory */
  3463. if (getcwd (tmp, LT_PATHMAX) == NULL)
  3464. lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
  3465. nonnull (strerror (errno)));
  3466. tmp_len = strlen (tmp);
  3467. concat_name =
  3468. XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
  3469. memcpy (concat_name, tmp, tmp_len);
  3470. concat_name[tmp_len] = '/';
  3471. strcpy (concat_name + tmp_len + 1, wrapper);
  3472. }
  3473. else
  3474. {
  3475. concat_name =
  3476. XMALLOC (char, p_len + 1 + strlen (wrapper) + 1);
  3477. memcpy (concat_name, p, p_len);
  3478. concat_name[p_len] = '/';
  3479. strcpy (concat_name + p_len + 1, wrapper);
  3480. }
  3481. if (check_executable (concat_name))
  3482. return concat_name;
  3483. XFREE (concat_name);
  3484. }
  3485. }
  3486. /* not found in PATH; assume curdir */
  3487. }
  3488. /* Relative path | not found in path: prepend cwd */
  3489. if (getcwd (tmp, LT_PATHMAX) == NULL)
  3490. lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
  3491. nonnull (strerror (errno)));
  3492. tmp_len = strlen (tmp);
  3493. concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
  3494. memcpy (concat_name, tmp, tmp_len);
  3495. concat_name[tmp_len] = '/';
  3496. strcpy (concat_name + tmp_len + 1, wrapper);
  3497. if (check_executable (concat_name))
  3498. return concat_name;
  3499. XFREE (concat_name);
  3500. return NULL;
  3501. }
  3502. char *
  3503. chase_symlinks (const char *pathspec)
  3504. {
  3505. #ifndef S_ISLNK
  3506. return xstrdup (pathspec);
  3507. #else
  3508. char buf[LT_PATHMAX];
  3509. struct stat s;
  3510. char *tmp_pathspec = xstrdup (pathspec);
  3511. char *p;
  3512. int has_symlinks = 0;
  3513. while (strlen (tmp_pathspec) && !has_symlinks)
  3514. {
  3515. lt_debugprintf (__FILE__, __LINE__,
  3516. "checking path component for symlinks: %s\n",
  3517. tmp_pathspec);
  3518. if (lstat (tmp_pathspec, &s) == 0)
  3519. {
  3520. if (S_ISLNK (s.st_mode) != 0)
  3521. {
  3522. has_symlinks = 1;
  3523. break;
  3524. }
  3525. /* search backwards for last DIR_SEPARATOR */
  3526. p = tmp_pathspec + strlen (tmp_pathspec) - 1;
  3527. while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
  3528. p--;
  3529. if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
  3530. {
  3531. /* no more DIR_SEPARATORS left */
  3532. break;
  3533. }
  3534. *p = '\0';
  3535. }
  3536. else
  3537. {
  3538. lt_fatal (__FILE__, __LINE__,
  3539. "error accessing file \"%s\": %s",
  3540. tmp_pathspec, nonnull (strerror (errno)));
  3541. }
  3542. }
  3543. XFREE (tmp_pathspec);
  3544. if (!has_symlinks)
  3545. {
  3546. return xstrdup (pathspec);
  3547. }
  3548. tmp_pathspec = realpath (pathspec, buf);
  3549. if (tmp_pathspec == 0)
  3550. {
  3551. lt_fatal (__FILE__, __LINE__,
  3552. "could not follow symlinks for %s", pathspec);
  3553. }
  3554. return xstrdup (tmp_pathspec);
  3555. #endif
  3556. }
  3557. char *
  3558. strendzap (char *str, const char *pat)
  3559. {
  3560. size_t len, patlen;
  3561. assert (str != NULL);
  3562. assert (pat != NULL);
  3563. len = strlen (str);
  3564. patlen = strlen (pat);
  3565. if (patlen <= len)
  3566. {
  3567. str += len - patlen;
  3568. if (strcmp (str, pat) == 0)
  3569. *str = '\0';
  3570. }
  3571. return str;
  3572. }
  3573. void
  3574. lt_debugprintf (const char *file, int line, const char *fmt, ...)
  3575. {
  3576. va_list args;
  3577. if (lt_debug)
  3578. {
  3579. (void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line);
  3580. va_start (args, fmt);
  3581. (void) vfprintf (stderr, fmt, args);
  3582. va_end (args);
  3583. }
  3584. }
  3585. static void
  3586. lt_error_core (int exit_status, const char *file,
  3587. int line, const char *mode,
  3588. const char *message, va_list ap)
  3589. {
  3590. fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode);
  3591. vfprintf (stderr, message, ap);
  3592. fprintf (stderr, ".\n");
  3593. if (exit_status >= 0)
  3594. exit (exit_status);
  3595. }
  3596. void
  3597. lt_fatal (const char *file, int line, const char *message, ...)
  3598. {
  3599. va_list ap;
  3600. va_start (ap, message);
  3601. lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap);
  3602. va_end (ap);
  3603. }
  3604. static const char *
  3605. nonnull (const char *s)
  3606. {
  3607. return s ? s : "(null)";
  3608. }
  3609. static const char *
  3610. nonempty (const char *s)
  3611. {
  3612. return (s && !*s) ? "(empty)" : nonnull (s);
  3613. }
  3614. void
  3615. lt_setenv (const char *name, const char *value)
  3616. {
  3617. lt_debugprintf (__FILE__, __LINE__,
  3618. "(lt_setenv) setting '%s' to '%s'\n",
  3619. nonnull (name), nonnull (value));
  3620. {
  3621. #ifdef HAVE_SETENV
  3622. /* always make a copy, for consistency with !HAVE_SETENV */
  3623. char *str = xstrdup (value);
  3624. setenv (name, str, 1);
  3625. #else
  3626. int len = strlen (name) + 1 + strlen (value) + 1;
  3627. char *str = XMALLOC (char, len);
  3628. sprintf (str, "%s=%s", name, value);
  3629. if (putenv (str) != EXIT_SUCCESS)
  3630. {
  3631. XFREE (str);
  3632. }
  3633. #endif
  3634. }
  3635. }
  3636. char *
  3637. lt_extend_str (const char *orig_value, const char *add, int to_end)
  3638. {
  3639. char *new_value;
  3640. if (orig_value && *orig_value)
  3641. {
  3642. int orig_value_len = strlen (orig_value);
  3643. int add_len = strlen (add);
  3644. new_value = XMALLOC (char, add_len + orig_value_len + 1);
  3645. if (to_end)
  3646. {
  3647. strcpy (new_value, orig_value);
  3648. strcpy (new_value + orig_value_len, add);
  3649. }
  3650. else
  3651. {
  3652. strcpy (new_value, add);
  3653. strcpy (new_value + add_len, orig_value);
  3654. }
  3655. }
  3656. else
  3657. {
  3658. new_value = xstrdup (add);
  3659. }
  3660. return new_value;
  3661. }
  3662. void
  3663. lt_update_exe_path (const char *name, const char *value)
  3664. {
  3665. lt_debugprintf (__FILE__, __LINE__,
  3666. "(lt_update_exe_path) modifying '%s' by prepending '%s'\n",
  3667. nonnull (name), nonnull (value));
  3668. if (name && *name && value && *value)
  3669. {
  3670. char *new_value = lt_extend_str (getenv (name), value, 0);
  3671. /* some systems can't cope with a ':'-terminated path #' */
  3672. int len = strlen (new_value);
  3673. while (((len = strlen (new_value)) > 0) && IS_PATH_SEPARATOR (new_value[len-1]))
  3674. {
  3675. new_value[len-1] = '\0';
  3676. }
  3677. lt_setenv (name, new_value);
  3678. XFREE (new_value);
  3679. }
  3680. }
  3681. void
  3682. lt_update_lib_path (const char *name, const char *value)
  3683. {
  3684. lt_debugprintf (__FILE__, __LINE__,
  3685. "(lt_update_lib_path) modifying '%s' by prepending '%s'\n",
  3686. nonnull (name), nonnull (value));
  3687. if (name && *name && value && *value)
  3688. {
  3689. char *new_value = lt_extend_str (getenv (name), value, 0);
  3690. lt_setenv (name, new_value);
  3691. XFREE (new_value);
  3692. }
  3693. }
  3694. EOF
  3695. case $host_os in
  3696. mingw*)
  3697. cat <<"EOF"
  3698. /* Prepares an argument vector before calling spawn().
  3699. Note that spawn() does not by itself call the command interpreter
  3700. (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") :
  3701. ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
  3702. GetVersionEx(&v);
  3703. v.dwPlatformId == VER_PLATFORM_WIN32_NT;
  3704. }) ? "cmd.exe" : "command.com").
  3705. Instead it simply concatenates the arguments, separated by ' ', and calls
  3706. CreateProcess(). We must quote the arguments since Win32 CreateProcess()
  3707. interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a
  3708. special way:
  3709. - Space and tab are interpreted as delimiters. They are not treated as
  3710. delimiters if they are surrounded by double quotes: "...".
  3711. - Unescaped double quotes are removed from the input. Their only effect is
  3712. that within double quotes, space and tab are treated like normal
  3713. characters.
  3714. - Backslashes not followed by double quotes are not special.
  3715. - But 2*n+1 backslashes followed by a double quote become
  3716. n backslashes followed by a double quote (n >= 0):
  3717. \" -> "
  3718. \\\" -> \"
  3719. \\\\\" -> \\"
  3720. */
  3721. #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"
  3722. #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"
  3723. char **
  3724. prepare_spawn (char **argv)
  3725. {
  3726. size_t argc;
  3727. char **new_argv;
  3728. size_t i;
  3729. /* Count number of arguments. */
  3730. for (argc = 0; argv[argc] != NULL; argc++)
  3731. ;
  3732. /* Allocate new argument vector. */
  3733. new_argv = XMALLOC (char *, argc + 1);
  3734. /* Put quoted arguments into the new argument vector. */
  3735. for (i = 0; i < argc; i++)
  3736. {
  3737. const char *string = argv[i];
  3738. if (string[0] == '\0')
  3739. new_argv[i] = xstrdup ("\"\"");
  3740. else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL)
  3741. {
  3742. int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL);
  3743. size_t length;
  3744. unsigned int backslashes;
  3745. const char *s;
  3746. char *quoted_string;
  3747. char *p;
  3748. length = 0;
  3749. backslashes = 0;
  3750. if (quote_around)
  3751. length++;
  3752. for (s = string; *s != '\0'; s++)
  3753. {
  3754. char c = *s;
  3755. if (c == '"')
  3756. length += backslashes + 1;
  3757. length++;
  3758. if (c == '\\')
  3759. backslashes++;
  3760. else
  3761. backslashes = 0;
  3762. }
  3763. if (quote_around)
  3764. length += backslashes + 1;
  3765. quoted_string = XMALLOC (char, length + 1);
  3766. p = quoted_string;
  3767. backslashes = 0;
  3768. if (quote_around)
  3769. *p++ = '"';
  3770. for (s = string; *s != '\0'; s++)
  3771. {
  3772. char c = *s;
  3773. if (c == '"')
  3774. {
  3775. unsigned int j;
  3776. for (j = backslashes + 1; j > 0; j--)
  3777. *p++ = '\\';
  3778. }
  3779. *p++ = c;
  3780. if (c == '\\')
  3781. backslashes++;
  3782. else
  3783. backslashes = 0;
  3784. }
  3785. if (quote_around)
  3786. {
  3787. unsigned int j;
  3788. for (j = backslashes; j > 0; j--)
  3789. *p++ = '\\';
  3790. *p++ = '"';
  3791. }
  3792. *p = '\0';
  3793. new_argv[i] = quoted_string;
  3794. }
  3795. else
  3796. new_argv[i] = (char *) string;
  3797. }
  3798. new_argv[argc] = NULL;
  3799. return new_argv;
  3800. }
  3801. EOF
  3802. ;;
  3803. esac
  3804. cat <<"EOF"
  3805. void lt_dump_script (FILE* f)
  3806. {
  3807. EOF
  3808. func_emit_wrapper yes |
  3809. $SED -e 's/\([\\"]\)/\\\1/g' \
  3810. -e 's/^/ fputs ("/' -e 's/$/\\n", f);/'
  3811. cat <<"EOF"
  3812. }
  3813. EOF
  3814. }
  3815. # end: func_emit_cwrapperexe_src
  3816. # func_win32_import_lib_p ARG
  3817. # True if ARG is an import lib, as indicated by $file_magic_cmd
  3818. func_win32_import_lib_p ()
  3819. {
  3820. $opt_debug
  3821. case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in
  3822. *import*) : ;;
  3823. *) false ;;
  3824. esac
  3825. }
  3826. # func_mode_link arg...
  3827. func_mode_link ()
  3828. {
  3829. $opt_debug
  3830. case $host in
  3831. *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
  3832. # It is impossible to link a dll without this setting, and
  3833. # we shouldn't force the makefile maintainer to figure out
  3834. # which system we are compiling for in order to pass an extra
  3835. # flag for every libtool invocation.
  3836. # allow_undefined=no
  3837. # FIXME: Unfortunately, there are problems with the above when trying
  3838. # to make a dll which has undefined symbols, in which case not
  3839. # even a static library is built. For now, we need to specify
  3840. # -no-undefined on the libtool link line when we can be certain
  3841. # that all symbols are satisfied, otherwise we get a static library.
  3842. allow_undefined=yes
  3843. ;;
  3844. *)
  3845. allow_undefined=yes
  3846. ;;
  3847. esac
  3848. libtool_args=$nonopt
  3849. base_compile="$nonopt $@"
  3850. compile_command=$nonopt
  3851. finalize_command=$nonopt
  3852. compile_rpath=
  3853. finalize_rpath=
  3854. compile_shlibpath=
  3855. finalize_shlibpath=
  3856. convenience=
  3857. old_convenience=
  3858. deplibs=
  3859. old_deplibs=
  3860. compiler_flags=
  3861. linker_flags=
  3862. dllsearchpath=
  3863. lib_search_path=`pwd`
  3864. inst_prefix_dir=
  3865. new_inherited_linker_flags=
  3866. avoid_version=no
  3867. bindir=
  3868. dlfiles=
  3869. dlprefiles=
  3870. dlself=no
  3871. export_dynamic=no
  3872. export_symbols=
  3873. export_symbols_regex=
  3874. generated=
  3875. libobjs=
  3876. ltlibs=
  3877. module=no
  3878. no_install=no
  3879. objs=
  3880. non_pic_objects=
  3881. precious_files_regex=
  3882. prefer_static_libs=no
  3883. preload=no
  3884. prev=
  3885. prevarg=
  3886. release=
  3887. rpath=
  3888. xrpath=
  3889. perm_rpath=
  3890. temp_rpath=
  3891. thread_safe=no
  3892. vinfo=
  3893. vinfo_number=no
  3894. weak_libs=
  3895. single_module="${wl}-single_module"
  3896. func_infer_tag $base_compile
  3897. # We need to know -static, to get the right output filenames.
  3898. for arg
  3899. do
  3900. case $arg in
  3901. -shared)
  3902. test "$build_libtool_libs" != yes && \
  3903. func_fatal_configuration "can not build a shared library"
  3904. build_old_libs=no
  3905. break
  3906. ;;
  3907. -all-static | -static | -static-libtool-libs)
  3908. case $arg in
  3909. -all-static)
  3910. if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
  3911. func_warning "complete static linking is impossible in this configuration"
  3912. fi
  3913. if test -n "$link_static_flag"; then
  3914. dlopen_self=$dlopen_self_static
  3915. fi
  3916. prefer_static_libs=yes
  3917. ;;
  3918. -static)
  3919. if test -z "$pic_flag" && test -n "$link_static_flag"; then
  3920. dlopen_self=$dlopen_self_static
  3921. fi
  3922. prefer_static_libs=built
  3923. ;;
  3924. -static-libtool-libs)
  3925. if test -z "$pic_flag" && test -n "$link_static_flag"; then
  3926. dlopen_self=$dlopen_self_static
  3927. fi
  3928. prefer_static_libs=yes
  3929. ;;
  3930. esac
  3931. build_libtool_libs=no
  3932. build_old_libs=yes
  3933. break
  3934. ;;
  3935. esac
  3936. done
  3937. # See if our shared archives depend on static archives.
  3938. test -n "$old_archive_from_new_cmds" && build_old_libs=yes
  3939. # Go through the arguments, transforming them on the way.
  3940. while test "$#" -gt 0; do
  3941. arg="$1"
  3942. shift
  3943. func_quote_for_eval "$arg"
  3944. qarg=$func_quote_for_eval_unquoted_result
  3945. func_append libtool_args " $func_quote_for_eval_result"
  3946. # If the previous option needs an argument, assign it.
  3947. if test -n "$prev"; then
  3948. case $prev in
  3949. output)
  3950. func_append compile_command " @OUTPUT@"
  3951. func_append finalize_command " @OUTPUT@"
  3952. ;;
  3953. esac
  3954. case $prev in
  3955. bindir)
  3956. bindir="$arg"
  3957. prev=
  3958. continue
  3959. ;;
  3960. dlfiles|dlprefiles)
  3961. if test "$preload" = no; then
  3962. # Add the symbol object into the linking commands.
  3963. func_append compile_command " @SYMFILE@"
  3964. func_append finalize_command " @SYMFILE@"
  3965. preload=yes
  3966. fi
  3967. case $arg in
  3968. *.la | *.lo) ;; # We handle these cases below.
  3969. force)
  3970. if test "$dlself" = no; then
  3971. dlself=needless
  3972. export_dynamic=yes
  3973. fi
  3974. prev=
  3975. continue
  3976. ;;
  3977. self)
  3978. if test "$prev" = dlprefiles; then
  3979. dlself=yes
  3980. elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
  3981. dlself=yes
  3982. else
  3983. dlself=needless
  3984. export_dynamic=yes
  3985. fi
  3986. prev=
  3987. continue
  3988. ;;
  3989. *)
  3990. if test "$prev" = dlfiles; then
  3991. dlfiles="$dlfiles $arg"
  3992. else
  3993. dlprefiles="$dlprefiles $arg"
  3994. fi
  3995. prev=
  3996. continue
  3997. ;;
  3998. esac
  3999. ;;
  4000. expsyms)
  4001. export_symbols="$arg"
  4002. test -f "$arg" \
  4003. || func_fatal_error "symbol file \`$arg' does not exist"
  4004. prev=
  4005. continue
  4006. ;;
  4007. expsyms_regex)
  4008. export_symbols_regex="$arg"
  4009. prev=
  4010. continue
  4011. ;;
  4012. framework)
  4013. case $host in
  4014. *-*-darwin*)
  4015. case "$deplibs " in
  4016. *" $qarg.ltframework "*) ;;
  4017. *) deplibs="$deplibs $qarg.ltframework" # this is fixed later
  4018. ;;
  4019. esac
  4020. ;;
  4021. esac
  4022. prev=
  4023. continue
  4024. ;;
  4025. inst_prefix)
  4026. inst_prefix_dir="$arg"
  4027. prev=
  4028. continue
  4029. ;;
  4030. objectlist)
  4031. if test -f "$arg"; then
  4032. save_arg=$arg
  4033. moreargs=
  4034. for fil in `cat "$save_arg"`
  4035. do
  4036. # moreargs="$moreargs $fil"
  4037. arg=$fil
  4038. # A libtool-controlled object.
  4039. # Check to see that this really is a libtool object.
  4040. if func_lalib_unsafe_p "$arg"; then
  4041. pic_object=
  4042. non_pic_object=
  4043. # Read the .lo file
  4044. func_source "$arg"
  4045. if test -z "$pic_object" ||
  4046. test -z "$non_pic_object" ||
  4047. test "$pic_object" = none &&
  4048. test "$non_pic_object" = none; then
  4049. func_fatal_error "cannot find name of object for \`$arg'"
  4050. fi
  4051. # Extract subdirectory from the argument.
  4052. func_dirname "$arg" "/" ""
  4053. xdir="$func_dirname_result"
  4054. if test "$pic_object" != none; then
  4055. # Prepend the subdirectory the object is found in.
  4056. pic_object="$xdir$pic_object"
  4057. if test "$prev" = dlfiles; then
  4058. if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
  4059. dlfiles="$dlfiles $pic_object"
  4060. prev=
  4061. continue
  4062. else
  4063. # If libtool objects are unsupported, then we need to preload.
  4064. prev=dlprefiles
  4065. fi
  4066. fi
  4067. # CHECK ME: I think I busted this. -Ossama
  4068. if test "$prev" = dlprefiles; then
  4069. # Preload the old-style object.
  4070. dlprefiles="$dlprefiles $pic_object"
  4071. prev=
  4072. fi
  4073. # A PIC object.
  4074. func_append libobjs " $pic_object"
  4075. arg="$pic_object"
  4076. fi
  4077. # Non-PIC object.
  4078. if test "$non_pic_object" != none; then
  4079. # Prepend the subdirectory the object is found in.
  4080. non_pic_object="$xdir$non_pic_object"
  4081. # A standard non-PIC object
  4082. func_append non_pic_objects " $non_pic_object"
  4083. if test -z "$pic_object" || test "$pic_object" = none ; then
  4084. arg="$non_pic_object"
  4085. fi
  4086. else
  4087. # If the PIC object exists, use it instead.
  4088. # $xdir was prepended to $pic_object above.
  4089. non_pic_object="$pic_object"
  4090. func_append non_pic_objects " $non_pic_object"
  4091. fi
  4092. else
  4093. # Only an error if not doing a dry-run.
  4094. if $opt_dry_run; then
  4095. # Extract subdirectory from the argument.
  4096. func_dirname "$arg" "/" ""
  4097. xdir="$func_dirname_result"
  4098. func_lo2o "$arg"
  4099. pic_object=$xdir$objdir/$func_lo2o_result
  4100. non_pic_object=$xdir$func_lo2o_result
  4101. func_append libobjs " $pic_object"
  4102. func_append non_pic_objects " $non_pic_object"
  4103. else
  4104. func_fatal_error "\`$arg' is not a valid libtool object"
  4105. fi
  4106. fi
  4107. done
  4108. else
  4109. func_fatal_error "link input file \`$arg' does not exist"
  4110. fi
  4111. arg=$save_arg
  4112. prev=
  4113. continue
  4114. ;;
  4115. precious_regex)
  4116. precious_files_regex="$arg"
  4117. prev=
  4118. continue
  4119. ;;
  4120. release)
  4121. release="-$arg"
  4122. prev=
  4123. continue
  4124. ;;
  4125. rpath | xrpath)
  4126. # We need an absolute path.
  4127. case $arg in
  4128. [\\/]* | [A-Za-z]:[\\/]*) ;;
  4129. *)
  4130. func_fatal_error "only absolute run-paths are allowed"
  4131. ;;
  4132. esac
  4133. if test "$prev" = rpath; then
  4134. case "$rpath " in
  4135. *" $arg "*) ;;
  4136. *) rpath="$rpath $arg" ;;
  4137. esac
  4138. else
  4139. case "$xrpath " in
  4140. *" $arg "*) ;;
  4141. *) xrpath="$xrpath $arg" ;;
  4142. esac
  4143. fi
  4144. prev=
  4145. continue
  4146. ;;
  4147. shrext)
  4148. shrext_cmds="$arg"
  4149. prev=
  4150. continue
  4151. ;;
  4152. weak)
  4153. weak_libs="$weak_libs $arg"
  4154. prev=
  4155. continue
  4156. ;;
  4157. xcclinker)
  4158. linker_flags="$linker_flags $qarg"
  4159. compiler_flags="$compiler_flags $qarg"
  4160. prev=
  4161. func_append compile_command " $qarg"
  4162. func_append finalize_command " $qarg"
  4163. continue
  4164. ;;
  4165. xcompiler)
  4166. compiler_flags="$compiler_flags $qarg"
  4167. prev=
  4168. func_append compile_command " $qarg"
  4169. func_append finalize_command " $qarg"
  4170. continue
  4171. ;;
  4172. xlinker)
  4173. linker_flags="$linker_flags $qarg"
  4174. compiler_flags="$compiler_flags $wl$qarg"
  4175. prev=
  4176. func_append compile_command " $wl$qarg"
  4177. func_append finalize_command " $wl$qarg"
  4178. continue
  4179. ;;
  4180. *)
  4181. eval "$prev=\"\$arg\""
  4182. prev=
  4183. continue
  4184. ;;
  4185. esac
  4186. fi # test -n "$prev"
  4187. prevarg="$arg"
  4188. case $arg in
  4189. -all-static)
  4190. if test -n "$link_static_flag"; then
  4191. # See comment for -static flag below, for more details.
  4192. func_append compile_command " $link_static_flag"
  4193. func_append finalize_command " $link_static_flag"
  4194. fi
  4195. continue
  4196. ;;
  4197. -allow-undefined)
  4198. # FIXME: remove this flag sometime in the future.
  4199. func_fatal_error "\`-allow-undefined' must not be used because it is the default"
  4200. ;;
  4201. -avoid-version)
  4202. avoid_version=yes
  4203. continue
  4204. ;;
  4205. -bindir)
  4206. prev=bindir
  4207. continue
  4208. ;;
  4209. -dlopen)
  4210. prev=dlfiles
  4211. continue
  4212. ;;
  4213. -dlpreopen)
  4214. prev=dlprefiles
  4215. continue
  4216. ;;
  4217. -export-dynamic)
  4218. export_dynamic=yes
  4219. continue
  4220. ;;
  4221. -export-symbols | -export-symbols-regex)
  4222. if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
  4223. func_fatal_error "more than one -exported-symbols argument is not allowed"
  4224. fi
  4225. if test "X$arg" = "X-export-symbols"; then
  4226. prev=expsyms
  4227. else
  4228. prev=expsyms_regex
  4229. fi
  4230. continue
  4231. ;;
  4232. -framework)
  4233. prev=framework
  4234. continue
  4235. ;;
  4236. -inst-prefix-dir)
  4237. prev=inst_prefix
  4238. continue
  4239. ;;
  4240. # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
  4241. # so, if we see these flags be careful not to treat them like -L
  4242. -L[A-Z][A-Z]*:*)
  4243. case $with_gcc/$host in
  4244. no/*-*-irix* | /*-*-irix*)
  4245. func_append compile_command " $arg"
  4246. func_append finalize_command " $arg"
  4247. ;;
  4248. esac
  4249. continue
  4250. ;;
  4251. -L*)
  4252. func_stripname '-L' '' "$arg"
  4253. dir=$func_stripname_result
  4254. if test -z "$dir"; then
  4255. if test "$#" -gt 0; then
  4256. func_fatal_error "require no space between \`-L' and \`$1'"
  4257. else
  4258. func_fatal_error "need path for \`-L' option"
  4259. fi
  4260. fi
  4261. # We need an absolute path.
  4262. case $dir in
  4263. [\\/]* | [A-Za-z]:[\\/]*) ;;
  4264. *)
  4265. absdir=`cd "$dir" && pwd`
  4266. test -z "$absdir" && \
  4267. func_fatal_error "cannot determine absolute directory name of \`$dir'"
  4268. dir="$absdir"
  4269. ;;
  4270. esac
  4271. case "$deplibs " in
  4272. *" -L$dir "*) ;;
  4273. *)
  4274. deplibs="$deplibs -L$dir"
  4275. lib_search_path="$lib_search_path $dir"
  4276. ;;
  4277. esac
  4278. case $host in
  4279. *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
  4280. testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'`
  4281. case :$dllsearchpath: in
  4282. *":$dir:"*) ;;
  4283. ::) dllsearchpath=$dir;;
  4284. *) dllsearchpath="$dllsearchpath:$dir";;
  4285. esac
  4286. case :$dllsearchpath: in
  4287. *":$testbindir:"*) ;;
  4288. ::) dllsearchpath=$testbindir;;
  4289. *) dllsearchpath="$dllsearchpath:$testbindir";;
  4290. esac
  4291. ;;
  4292. esac
  4293. continue
  4294. ;;
  4295. -l*)
  4296. if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
  4297. case $host in
  4298. *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*)
  4299. # These systems don't actually have a C or math library (as such)
  4300. continue
  4301. ;;
  4302. *-*-os2*)
  4303. # These systems don't actually have a C library (as such)
  4304. test "X$arg" = "X-lc" && continue
  4305. ;;
  4306. *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
  4307. # Do not include libc due to us having libc/libc_r.
  4308. test "X$arg" = "X-lc" && continue
  4309. ;;
  4310. *-*-rhapsody* | *-*-darwin1.[012])
  4311. # Rhapsody C and math libraries are in the System framework
  4312. deplibs="$deplibs System.ltframework"
  4313. continue
  4314. ;;
  4315. *-*-sco3.2v5* | *-*-sco5v6*)
  4316. # Causes problems with __ctype
  4317. test "X$arg" = "X-lc" && continue
  4318. ;;
  4319. *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
  4320. # Compiler inserts libc in the correct place for threads to work
  4321. test "X$arg" = "X-lc" && continue
  4322. ;;
  4323. esac
  4324. elif test "X$arg" = "X-lc_r"; then
  4325. case $host in
  4326. *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
  4327. # Do not include libc_r directly, use -pthread flag.
  4328. continue
  4329. ;;
  4330. esac
  4331. fi
  4332. deplibs="$deplibs $arg"
  4333. continue
  4334. ;;
  4335. -module)
  4336. module=yes
  4337. continue
  4338. ;;
  4339. # Tru64 UNIX uses -model [arg] to determine the layout of C++
  4340. # classes, name mangling, and exception handling.
  4341. # Darwin uses the -arch flag to determine output architecture.
  4342. -model|-arch|-isysroot)
  4343. compiler_flags="$compiler_flags $arg"
  4344. func_append compile_command " $arg"
  4345. func_append finalize_command " $arg"
  4346. prev=xcompiler
  4347. continue
  4348. ;;
  4349. -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
  4350. compiler_flags="$compiler_flags $arg"
  4351. func_append compile_command " $arg"
  4352. func_append finalize_command " $arg"
  4353. case "$new_inherited_linker_flags " in
  4354. *" $arg "*) ;;
  4355. * ) new_inherited_linker_flags="$new_inherited_linker_flags $arg" ;;
  4356. esac
  4357. continue
  4358. ;;
  4359. -multi_module)
  4360. single_module="${wl}-multi_module"
  4361. continue
  4362. ;;
  4363. -no-fast-install)
  4364. fast_install=no
  4365. continue
  4366. ;;
  4367. -no-install)
  4368. case $host in
  4369. *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*)
  4370. # The PATH hackery in wrapper scripts is required on Windows
  4371. # and Darwin in order for the loader to find any dlls it needs.
  4372. func_warning "\`-no-install' is ignored for $host"
  4373. func_warning "assuming \`-no-fast-install' instead"
  4374. fast_install=no
  4375. ;;
  4376. *) no_install=yes ;;
  4377. esac
  4378. continue
  4379. ;;
  4380. -no-undefined)
  4381. allow_undefined=no
  4382. continue
  4383. ;;
  4384. -objectlist)
  4385. prev=objectlist
  4386. continue
  4387. ;;
  4388. -o) prev=output ;;
  4389. -precious-files-regex)
  4390. prev=precious_regex
  4391. continue
  4392. ;;
  4393. -release)
  4394. prev=release
  4395. continue
  4396. ;;
  4397. -rpath)
  4398. prev=rpath
  4399. continue
  4400. ;;
  4401. -R)
  4402. prev=xrpath
  4403. continue
  4404. ;;
  4405. -R*)
  4406. func_stripname '-R' '' "$arg"
  4407. dir=$func_stripname_result
  4408. # We need an absolute path.
  4409. case $dir in
  4410. [\\/]* | [A-Za-z]:[\\/]*) ;;
  4411. *)
  4412. func_fatal_error "only absolute run-paths are allowed"
  4413. ;;
  4414. esac
  4415. case "$xrpath " in
  4416. *" $dir "*) ;;
  4417. *) xrpath="$xrpath $dir" ;;
  4418. esac
  4419. continue
  4420. ;;
  4421. -shared)
  4422. # The effects of -shared are defined in a previous loop.
  4423. continue
  4424. ;;
  4425. -shrext)
  4426. prev=shrext
  4427. continue
  4428. ;;
  4429. -static | -static-libtool-libs)
  4430. # The effects of -static are defined in a previous loop.
  4431. # We used to do the same as -all-static on platforms that
  4432. # didn't have a PIC flag, but the assumption that the effects
  4433. # would be equivalent was wrong. It would break on at least
  4434. # Digital Unix and AIX.
  4435. continue
  4436. ;;
  4437. -thread-safe)
  4438. thread_safe=yes
  4439. continue
  4440. ;;
  4441. -version-info)
  4442. prev=vinfo
  4443. continue
  4444. ;;
  4445. -version-number)
  4446. prev=vinfo
  4447. vinfo_number=yes
  4448. continue
  4449. ;;
  4450. -weak)
  4451. prev=weak
  4452. continue
  4453. ;;
  4454. -Wc,*)
  4455. func_stripname '-Wc,' '' "$arg"
  4456. args=$func_stripname_result
  4457. arg=
  4458. save_ifs="$IFS"; IFS=','
  4459. for flag in $args; do
  4460. IFS="$save_ifs"
  4461. func_quote_for_eval "$flag"
  4462. arg="$arg $func_quote_for_eval_result"
  4463. compiler_flags="$compiler_flags $func_quote_for_eval_result"
  4464. done
  4465. IFS="$save_ifs"
  4466. func_stripname ' ' '' "$arg"
  4467. arg=$func_stripname_result
  4468. ;;
  4469. -Wl,*)
  4470. func_stripname '-Wl,' '' "$arg"
  4471. args=$func_stripname_result
  4472. arg=
  4473. save_ifs="$IFS"; IFS=','
  4474. for flag in $args; do
  4475. IFS="$save_ifs"
  4476. func_quote_for_eval "$flag"
  4477. arg="$arg $wl$func_quote_for_eval_result"
  4478. compiler_flags="$compiler_flags $wl$func_quote_for_eval_result"
  4479. linker_flags="$linker_flags $func_quote_for_eval_result"
  4480. done
  4481. IFS="$save_ifs"
  4482. func_stripname ' ' '' "$arg"
  4483. arg=$func_stripname_result
  4484. ;;
  4485. -Xcompiler)
  4486. prev=xcompiler
  4487. continue
  4488. ;;
  4489. -Xlinker)
  4490. prev=xlinker
  4491. continue
  4492. ;;
  4493. -XCClinker)
  4494. prev=xcclinker
  4495. continue
  4496. ;;
  4497. # -msg_* for osf cc
  4498. -msg_*)
  4499. func_quote_for_eval "$arg"
  4500. arg="$func_quote_for_eval_result"
  4501. ;;
  4502. # Flags to be passed through unchanged, with rationale:
  4503. # -64, -mips[0-9] enable 64-bit mode for the SGI compiler
  4504. # -r[0-9][0-9]* specify processor for the SGI compiler
  4505. # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler
  4506. # +DA*, +DD* enable 64-bit mode for the HP compiler
  4507. # -q* compiler args for the IBM compiler
  4508. # -m*, -t[45]*, -txscale* architecture-specific flags for GCC
  4509. # -F/path path to uninstalled frameworks, gcc on darwin
  4510. # -p, -pg, --coverage, -fprofile-* profiling flags for GCC
  4511. # @file GCC response files
  4512. # -tp=* Portland pgcc target processor selection
  4513. -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
  4514. -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*)
  4515. func_quote_for_eval "$arg"
  4516. arg="$func_quote_for_eval_result"
  4517. func_append compile_command " $arg"
  4518. func_append finalize_command " $arg"
  4519. compiler_flags="$compiler_flags $arg"
  4520. continue
  4521. ;;
  4522. # Some other compiler flag.
  4523. -* | +*)
  4524. func_quote_for_eval "$arg"
  4525. arg="$func_quote_for_eval_result"
  4526. ;;
  4527. *.$objext)
  4528. # A standard object.
  4529. objs="$objs $arg"
  4530. ;;
  4531. *.lo)
  4532. # A libtool-controlled object.
  4533. # Check to see that this really is a libtool object.
  4534. if func_lalib_unsafe_p "$arg"; then
  4535. pic_object=
  4536. non_pic_object=
  4537. # Read the .lo file
  4538. func_source "$arg"
  4539. if test -z "$pic_object" ||
  4540. test -z "$non_pic_object" ||
  4541. test "$pic_object" = none &&
  4542. test "$non_pic_object" = none; then
  4543. func_fatal_error "cannot find name of object for \`$arg'"
  4544. fi
  4545. # Extract subdirectory from the argument.
  4546. func_dirname "$arg" "/" ""
  4547. xdir="$func_dirname_result"
  4548. if test "$pic_object" != none; then
  4549. # Prepend the subdirectory the object is found in.
  4550. pic_object="$xdir$pic_object"
  4551. if test "$prev" = dlfiles; then
  4552. if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
  4553. dlfiles="$dlfiles $pic_object"
  4554. prev=
  4555. continue
  4556. else
  4557. # If libtool objects are unsupported, then we need to preload.
  4558. prev=dlprefiles
  4559. fi
  4560. fi
  4561. # CHECK ME: I think I busted this. -Ossama
  4562. if test "$prev" = dlprefiles; then
  4563. # Preload the old-style object.
  4564. dlprefiles="$dlprefiles $pic_object"
  4565. prev=
  4566. fi
  4567. # A PIC object.
  4568. func_append libobjs " $pic_object"
  4569. arg="$pic_object"
  4570. fi
  4571. # Non-PIC object.
  4572. if test "$non_pic_object" != none; then
  4573. # Prepend the subdirectory the object is found in.
  4574. non_pic_object="$xdir$non_pic_object"
  4575. # A standard non-PIC object
  4576. func_append non_pic_objects " $non_pic_object"
  4577. if test -z "$pic_object" || test "$pic_object" = none ; then
  4578. arg="$non_pic_object"
  4579. fi
  4580. else
  4581. # If the PIC object exists, use it instead.
  4582. # $xdir was prepended to $pic_object above.
  4583. non_pic_object="$pic_object"
  4584. func_append non_pic_objects " $non_pic_object"
  4585. fi
  4586. else
  4587. # Only an error if not doing a dry-run.
  4588. if $opt_dry_run; then
  4589. # Extract subdirectory from the argument.
  4590. func_dirname "$arg" "/" ""
  4591. xdir="$func_dirname_result"
  4592. func_lo2o "$arg"
  4593. pic_object=$xdir$objdir/$func_lo2o_result
  4594. non_pic_object=$xdir$func_lo2o_result
  4595. func_append libobjs " $pic_object"
  4596. func_append non_pic_objects " $non_pic_object"
  4597. else
  4598. func_fatal_error "\`$arg' is not a valid libtool object"
  4599. fi
  4600. fi
  4601. ;;
  4602. *.$libext)
  4603. # An archive.
  4604. deplibs="$deplibs $arg"
  4605. old_deplibs="$old_deplibs $arg"
  4606. continue
  4607. ;;
  4608. *.la)
  4609. # A libtool-controlled library.
  4610. if test "$prev" = dlfiles; then
  4611. # This library was specified with -dlopen.
  4612. dlfiles="$dlfiles $arg"
  4613. prev=
  4614. elif test "$prev" = dlprefiles; then
  4615. # The library was specified with -dlpreopen.
  4616. dlprefiles="$dlprefiles $arg"
  4617. prev=
  4618. else
  4619. deplibs="$deplibs $arg"
  4620. fi
  4621. continue
  4622. ;;
  4623. # Some other compiler argument.
  4624. *)
  4625. # Unknown arguments in both finalize_command and compile_command need
  4626. # to be aesthetically quoted because they are evaled later.
  4627. func_quote_for_eval "$arg"
  4628. arg="$func_quote_for_eval_result"
  4629. ;;
  4630. esac # arg
  4631. # Now actually substitute the argument into the commands.
  4632. if test -n "$arg"; then
  4633. func_append compile_command " $arg"
  4634. func_append finalize_command " $arg"
  4635. fi
  4636. done # argument parsing loop
  4637. if test "$module" = yes ; then
  4638. # [Mandriva] dropping ld option "--no-undefined" which is wrong for plugins
  4639. linker_flags=`$ECHO "X $linker_flags" | $Xsed -e 's/ --no-undefined//'`
  4640. compiler_flags=`$ECHO "X $compiler_flags" | $Xsed -e 's/ -Wl,--no-undefined//'`
  4641. fi
  4642. test -n "$prev" && \
  4643. func_fatal_help "the \`$prevarg' option requires an argument"
  4644. if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
  4645. eval arg=\"$export_dynamic_flag_spec\"
  4646. func_append compile_command " $arg"
  4647. func_append finalize_command " $arg"
  4648. fi
  4649. oldlibs=
  4650. # calculate the name of the file, without its directory
  4651. func_basename "$output"
  4652. outputname="$func_basename_result"
  4653. libobjs_save="$libobjs"
  4654. if test -n "$shlibpath_var"; then
  4655. # get the directories listed in $shlibpath_var
  4656. eval shlib_search_path=\`\$ECHO \"\${$shlibpath_var}\" \| \$SED \'s/:/ /g\'\`
  4657. else
  4658. shlib_search_path=
  4659. fi
  4660. eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
  4661. eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
  4662. func_dirname "$output" "/" ""
  4663. output_objdir="$func_dirname_result$objdir"
  4664. # Create the object directory.
  4665. func_mkdir_p "$output_objdir"
  4666. # Determine the type of output
  4667. case $output in
  4668. "")
  4669. func_fatal_help "you must specify an output file"
  4670. ;;
  4671. *.$libext) linkmode=oldlib ;;
  4672. *.lo | *.$objext) linkmode=obj ;;
  4673. *.la) linkmode=lib ;;
  4674. *) linkmode=prog ;; # Anything else should be a program.
  4675. esac
  4676. specialdeplibs=
  4677. libs=
  4678. # Find all interdependent deplibs by searching for libraries
  4679. # that are linked more than once (e.g. -la -lb -la)
  4680. for deplib in $deplibs; do
  4681. if $opt_duplicate_deps ; then
  4682. case "$libs " in
  4683. *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
  4684. esac
  4685. fi
  4686. libs="$libs $deplib"
  4687. done
  4688. if test "$linkmode" = lib; then
  4689. libs="$predeps $libs $compiler_lib_search_path $postdeps"
  4690. # Compute libraries that are listed more than once in $predeps
  4691. # $postdeps and mark them as special (i.e., whose duplicates are
  4692. # not to be eliminated).
  4693. pre_post_deps=
  4694. if $opt_duplicate_compiler_generated_deps; then
  4695. for pre_post_dep in $predeps $postdeps; do
  4696. case "$pre_post_deps " in
  4697. *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
  4698. esac
  4699. pre_post_deps="$pre_post_deps $pre_post_dep"
  4700. done
  4701. fi
  4702. pre_post_deps=
  4703. fi
  4704. deplibs=
  4705. newdependency_libs=
  4706. newlib_search_path=
  4707. need_relink=no # whether we're linking any uninstalled libtool libraries
  4708. notinst_deplibs= # not-installed libtool libraries
  4709. notinst_path= # paths that contain not-installed libtool libraries
  4710. case $linkmode in
  4711. lib)
  4712. passes="conv dlpreopen link"
  4713. for file in $dlfiles $dlprefiles; do
  4714. case $file in
  4715. *.la) ;;
  4716. *)
  4717. func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file"
  4718. ;;
  4719. esac
  4720. done
  4721. ;;
  4722. prog)
  4723. compile_deplibs=
  4724. finalize_deplibs=
  4725. alldeplibs=no
  4726. newdlfiles=
  4727. newdlprefiles=
  4728. passes="conv scan dlopen dlpreopen link"
  4729. ;;
  4730. *) passes="conv"
  4731. ;;
  4732. esac
  4733. for pass in $passes; do
  4734. # The preopen pass in lib mode reverses $deplibs; put it back here
  4735. # so that -L comes before libs that need it for instance...
  4736. if test "$linkmode,$pass" = "lib,link"; then
  4737. ## FIXME: Find the place where the list is rebuilt in the wrong
  4738. ## order, and fix it there properly
  4739. tmp_deplibs=
  4740. for deplib in $deplibs; do
  4741. tmp_deplibs="$deplib $tmp_deplibs"
  4742. done
  4743. deplibs="$tmp_deplibs"
  4744. fi
  4745. if test "$linkmode,$pass" = "lib,link" ||
  4746. test "$linkmode,$pass" = "prog,scan"; then
  4747. libs="$deplibs"
  4748. deplibs=
  4749. fi
  4750. if test "$linkmode" = prog; then
  4751. case $pass in
  4752. dlopen) libs="$dlfiles" ;;
  4753. dlpreopen) libs="$dlprefiles" ;;
  4754. link)
  4755. libs="$deplibs %DEPLIBS%"
  4756. test "X$link_all_deplibs" != Xno && libs="$libs $dependency_libs"
  4757. ;;
  4758. esac
  4759. fi
  4760. if test "$linkmode,$pass" = "lib,dlpreopen"; then
  4761. # Collect and forward deplibs of preopened libtool libs
  4762. for lib in $dlprefiles; do
  4763. # Ignore non-libtool-libs
  4764. dependency_libs=
  4765. case $lib in
  4766. *.la) func_source "$lib" ;;
  4767. esac
  4768. # Collect preopened libtool deplibs, except any this library
  4769. # has declared as weak libs
  4770. for deplib in $dependency_libs; do
  4771. func_basename "$deplib"
  4772. deplib_base=$func_basename_result
  4773. case " $weak_libs " in
  4774. *" $deplib_base "*) ;;
  4775. *) deplibs="$deplibs $deplib" ;;
  4776. esac
  4777. done
  4778. done
  4779. libs="$dlprefiles"
  4780. fi
  4781. if test "$pass" = dlopen; then
  4782. # Collect dlpreopened libraries
  4783. save_deplibs="$deplibs"
  4784. deplibs=
  4785. fi
  4786. for deplib in $libs; do
  4787. lib=
  4788. found=no
  4789. case $deplib in
  4790. -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
  4791. if test "$linkmode,$pass" = "prog,link"; then
  4792. compile_deplibs="$deplib $compile_deplibs"
  4793. finalize_deplibs="$deplib $finalize_deplibs"
  4794. else
  4795. compiler_flags="$compiler_flags $deplib"
  4796. if test "$linkmode" = lib ; then
  4797. case "$new_inherited_linker_flags " in
  4798. *" $deplib "*) ;;
  4799. * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;;
  4800. esac
  4801. fi
  4802. fi
  4803. continue
  4804. ;;
  4805. -l*)
  4806. if test "$linkmode" != lib && test "$linkmode" != prog; then
  4807. func_warning "\`-l' is ignored for archives/objects"
  4808. continue
  4809. fi
  4810. func_stripname '-l' '' "$deplib"
  4811. name=$func_stripname_result
  4812. if test "$linkmode" = lib; then
  4813. searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path"
  4814. else
  4815. searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path"
  4816. fi
  4817. for searchdir in $searchdirs; do
  4818. for search_ext in .la $std_shrext .so .a; do
  4819. # Search the libtool library
  4820. lib="$searchdir/lib${name}${search_ext}"
  4821. if test -f "$lib"; then
  4822. if test "$search_ext" = ".la"; then
  4823. found=yes
  4824. else
  4825. found=no
  4826. fi
  4827. break 2
  4828. fi
  4829. done
  4830. done
  4831. if test "$found" != yes; then
  4832. # deplib doesn't seem to be a libtool library
  4833. if test "$linkmode,$pass" = "prog,link"; then
  4834. compile_deplibs="$deplib $compile_deplibs"
  4835. finalize_deplibs="$deplib $finalize_deplibs"
  4836. else
  4837. deplibs="$deplib $deplibs"
  4838. test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
  4839. fi
  4840. continue
  4841. else # deplib is a libtool library
  4842. # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
  4843. # We need to do some special things here, and not later.
  4844. if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
  4845. case " $predeps $postdeps " in
  4846. *" $deplib "*)
  4847. if func_lalib_p "$lib"; then
  4848. library_names=
  4849. old_library=
  4850. func_source "$lib"
  4851. for l in $old_library $library_names; do
  4852. ll="$l"
  4853. done
  4854. if test "X$ll" = "X$old_library" ; then # only static version available
  4855. found=no
  4856. func_dirname "$lib" "" "."
  4857. ladir="$func_dirname_result"
  4858. lib=$ladir/$old_library
  4859. if test "$linkmode,$pass" = "prog,link"; then
  4860. compile_deplibs="$deplib $compile_deplibs"
  4861. finalize_deplibs="$deplib $finalize_deplibs"
  4862. else
  4863. deplibs="$deplib $deplibs"
  4864. test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
  4865. fi
  4866. continue
  4867. fi
  4868. fi
  4869. ;;
  4870. *) ;;
  4871. esac
  4872. fi
  4873. fi
  4874. ;; # -l
  4875. *.ltframework)
  4876. if test "$linkmode,$pass" = "prog,link"; then
  4877. compile_deplibs="$deplib $compile_deplibs"
  4878. finalize_deplibs="$deplib $finalize_deplibs"
  4879. else
  4880. deplibs="$deplib $deplibs"
  4881. if test "$linkmode" = lib ; then
  4882. case "$new_inherited_linker_flags " in
  4883. *" $deplib "*) ;;
  4884. * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;;
  4885. esac
  4886. fi
  4887. fi
  4888. continue
  4889. ;;
  4890. -L*)
  4891. case $linkmode in
  4892. lib)
  4893. deplibs="$deplib $deplibs"
  4894. test "$pass" = conv && continue
  4895. newdependency_libs="$deplib $newdependency_libs"
  4896. func_stripname '-L' '' "$deplib"
  4897. newlib_search_path="$newlib_search_path $func_stripname_result"
  4898. ;;
  4899. prog)
  4900. if test "$pass" = conv; then
  4901. deplibs="$deplib $deplibs"
  4902. continue
  4903. fi
  4904. if test "$pass" = scan; then
  4905. deplibs="$deplib $deplibs"
  4906. else
  4907. compile_deplibs="$deplib $compile_deplibs"
  4908. finalize_deplibs="$deplib $finalize_deplibs"
  4909. fi
  4910. func_stripname '-L' '' "$deplib"
  4911. newlib_search_path="$newlib_search_path $func_stripname_result"
  4912. ;;
  4913. *)
  4914. func_warning "\`-L' is ignored for archives/objects"
  4915. ;;
  4916. esac # linkmode
  4917. continue
  4918. ;; # -L
  4919. -R*)
  4920. if test "$pass" = link; then
  4921. func_stripname '-R' '' "$deplib"
  4922. dir=$func_stripname_result
  4923. # Make sure the xrpath contains only unique directories.
  4924. case "$xrpath " in
  4925. *" $dir "*) ;;
  4926. *) xrpath="$xrpath $dir" ;;
  4927. esac
  4928. fi
  4929. deplibs="$deplib $deplibs"
  4930. continue
  4931. ;;
  4932. *.la) lib="$deplib" ;;
  4933. *.$libext)
  4934. if test "$pass" = conv; then
  4935. deplibs="$deplib $deplibs"
  4936. continue
  4937. fi
  4938. case $linkmode in
  4939. lib)
  4940. # Linking convenience modules into shared libraries is allowed,
  4941. # but linking other static libraries is non-portable.
  4942. case " $dlpreconveniencelibs " in
  4943. *" $deplib "*) ;;
  4944. *)
  4945. valid_a_lib=no
  4946. case $deplibs_check_method in
  4947. match_pattern*)
  4948. set dummy $deplibs_check_method; shift
  4949. match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
  4950. if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \
  4951. | $EGREP "$match_pattern_regex" > /dev/null; then
  4952. valid_a_lib=yes
  4953. fi
  4954. ;;
  4955. pass_all)
  4956. valid_a_lib=yes
  4957. ;;
  4958. esac
  4959. if test "$valid_a_lib" != yes; then
  4960. echo
  4961. $ECHO "*** Warning: Trying to link with static lib archive $deplib."
  4962. echo "*** I have the capability to make that library automatically link in when"
  4963. echo "*** you link to this library. But I can only do this if you have a"
  4964. echo "*** shared version of the library, which you do not appear to have"
  4965. echo "*** because the file extensions .$libext of this argument makes me believe"
  4966. echo "*** that it is just a static archive that I should not use here."
  4967. else
  4968. echo
  4969. $ECHO "*** Warning: Linking the shared library $output against the"
  4970. $ECHO "*** static library $deplib is not portable!"
  4971. deplibs="$deplib $deplibs"
  4972. fi
  4973. ;;
  4974. esac
  4975. continue
  4976. ;;
  4977. prog)
  4978. if test "$pass" != link; then
  4979. deplibs="$deplib $deplibs"
  4980. else
  4981. compile_deplibs="$deplib $compile_deplibs"
  4982. finalize_deplibs="$deplib $finalize_deplibs"
  4983. fi
  4984. continue
  4985. ;;
  4986. esac # linkmode
  4987. ;; # *.$libext
  4988. *.lo | *.$objext)
  4989. if test "$pass" = conv; then
  4990. deplibs="$deplib $deplibs"
  4991. elif test "$linkmode" = prog; then
  4992. if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
  4993. # If there is no dlopen support or we're linking statically,
  4994. # we need to preload.
  4995. newdlprefiles="$newdlprefiles $deplib"
  4996. compile_deplibs="$deplib $compile_deplibs"
  4997. finalize_deplibs="$deplib $finalize_deplibs"
  4998. else
  4999. newdlfiles="$newdlfiles $deplib"
  5000. fi
  5001. fi
  5002. continue
  5003. ;;
  5004. %DEPLIBS%)
  5005. alldeplibs=yes
  5006. continue
  5007. ;;
  5008. esac # case $deplib
  5009. if test "$found" = yes || test -f "$lib"; then :
  5010. else
  5011. func_fatal_error "cannot find the library \`$lib' or unhandled argument \`$deplib'"
  5012. fi
  5013. # Check to see that this really is a libtool archive.
  5014. func_lalib_unsafe_p "$lib" \
  5015. || func_fatal_error "\`$lib' is not a valid libtool archive"
  5016. func_dirname "$lib" "" "."
  5017. ladir="$func_dirname_result"
  5018. dlname=
  5019. dlopen=
  5020. dlpreopen=
  5021. libdir=
  5022. library_names=
  5023. old_library=
  5024. inherited_linker_flags=
  5025. # If the library was installed with an old release of libtool,
  5026. # it will not redefine variables installed, or shouldnotlink
  5027. installed=yes
  5028. shouldnotlink=no
  5029. avoidtemprpath=
  5030. # Read the .la file
  5031. func_source "$lib"
  5032. # Convert "-framework foo" to "foo.ltframework"
  5033. if test -n "$inherited_linker_flags"; then
  5034. tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'`
  5035. for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do
  5036. case " $new_inherited_linker_flags " in
  5037. *" $tmp_inherited_linker_flag "*) ;;
  5038. *) new_inherited_linker_flags="$new_inherited_linker_flags $tmp_inherited_linker_flag";;
  5039. esac
  5040. done
  5041. fi
  5042. dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
  5043. if test "$linkmode,$pass" = "lib,link" ||
  5044. test "$linkmode,$pass" = "prog,scan" ||
  5045. { test "$linkmode" != prog && test "$linkmode" != lib; }; then
  5046. test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
  5047. test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
  5048. fi
  5049. if test "$pass" = conv; then
  5050. # Only check for convenience libraries
  5051. deplibs="$lib $deplibs"
  5052. if test -z "$libdir"; then
  5053. if test -z "$old_library"; then
  5054. func_fatal_error "cannot find name of link library for \`$lib'"
  5055. fi
  5056. # It is a libtool convenience library, so add in its objects.
  5057. convenience="$convenience $ladir/$objdir/$old_library"
  5058. old_convenience="$old_convenience $ladir/$objdir/$old_library"
  5059. elif test "$linkmode" != prog && test "$linkmode" != lib; then
  5060. func_fatal_error "\`$lib' is not a convenience library"
  5061. fi
  5062. tmp_libs=
  5063. for deplib in $dependency_libs; do
  5064. deplibs="$deplib $deplibs"
  5065. if $opt_duplicate_deps ; then
  5066. case "$tmp_libs " in
  5067. *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
  5068. esac
  5069. fi
  5070. tmp_libs="$tmp_libs $deplib"
  5071. done
  5072. continue
  5073. fi # $pass = conv
  5074. # Get the name of the library we link against.
  5075. linklib=
  5076. for l in $old_library $library_names; do
  5077. linklib="$l"
  5078. done
  5079. if test -z "$linklib"; then
  5080. func_fatal_error "cannot find name of link library for \`$lib'"
  5081. fi
  5082. # This library was specified with -dlopen.
  5083. if test "$pass" = dlopen; then
  5084. if test -z "$libdir"; then
  5085. func_fatal_error "cannot -dlopen a convenience library: \`$lib'"
  5086. fi
  5087. if test -z "$dlname" ||
  5088. test "$dlopen_support" != yes ||
  5089. test "$build_libtool_libs" = no; then
  5090. # If there is no dlname, no dlopen support or we're linking
  5091. # statically, we need to preload. We also need to preload any
  5092. # dependent libraries so libltdl's deplib preloader doesn't
  5093. # bomb out in the load deplibs phase.
  5094. dlprefiles="$dlprefiles $lib $dependency_libs"
  5095. else
  5096. newdlfiles="$newdlfiles $lib"
  5097. fi
  5098. continue
  5099. fi # $pass = dlopen
  5100. # We need an absolute path.
  5101. case $ladir in
  5102. [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
  5103. *)
  5104. abs_ladir=`cd "$ladir" && pwd`
  5105. if test -z "$abs_ladir"; then
  5106. func_warning "cannot determine absolute directory name of \`$ladir'"
  5107. func_warning "passing it literally to the linker, although it might fail"
  5108. abs_ladir="$ladir"
  5109. fi
  5110. ;;
  5111. esac
  5112. func_basename "$lib"
  5113. laname="$func_basename_result"
  5114. # Find the relevant object directory and library name.
  5115. if test "X$installed" = Xyes; then
  5116. if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
  5117. func_warning "library \`$lib' was moved."
  5118. dir="$ladir"
  5119. absdir="$abs_ladir"
  5120. libdir="$abs_ladir"
  5121. else
  5122. dir="$libdir"
  5123. absdir="$libdir"
  5124. fi
  5125. test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
  5126. else
  5127. if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
  5128. dir="$ladir"
  5129. absdir="$abs_ladir"
  5130. # Remove this search path later
  5131. notinst_path="$notinst_path $abs_ladir"
  5132. else
  5133. dir="$ladir/$objdir"
  5134. absdir="$abs_ladir/$objdir"
  5135. # Remove this search path later
  5136. notinst_path="$notinst_path $abs_ladir"
  5137. fi
  5138. fi # $installed = yes
  5139. func_stripname 'lib' '.la' "$laname"
  5140. name=$func_stripname_result
  5141. # This library was specified with -dlpreopen.
  5142. if test "$pass" = dlpreopen; then
  5143. if test -z "$libdir" && test "$linkmode" = prog; then
  5144. func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'"
  5145. fi
  5146. # Prefer using a static library (so that no silly _DYNAMIC symbols
  5147. # are required to link).
  5148. if test -n "$old_library"; then
  5149. newdlprefiles="$newdlprefiles $dir/$old_library"
  5150. # Keep a list of preopened convenience libraries to check
  5151. # that they are being used correctly in the link pass.
  5152. test -z "$libdir" && \
  5153. dlpreconveniencelibs="$dlpreconveniencelibs $dir/$old_library"
  5154. # Otherwise, use the dlname, so that lt_dlopen finds it.
  5155. elif test -n "$dlname"; then
  5156. newdlprefiles="$newdlprefiles $dir/$dlname"
  5157. else
  5158. newdlprefiles="$newdlprefiles $dir/$linklib"
  5159. fi
  5160. fi # $pass = dlpreopen
  5161. if test -z "$libdir"; then
  5162. # Link the convenience library
  5163. if test "$linkmode" = lib; then
  5164. deplibs="$dir/$old_library $deplibs"
  5165. elif test "$linkmode,$pass" = "prog,link"; then
  5166. compile_deplibs="$dir/$old_library $compile_deplibs"
  5167. finalize_deplibs="$dir/$old_library $finalize_deplibs"
  5168. else
  5169. deplibs="$lib $deplibs" # used for prog,scan pass
  5170. fi
  5171. continue
  5172. fi
  5173. if test "$linkmode" = prog && test "$pass" != link; then
  5174. newlib_search_path="$newlib_search_path $ladir"
  5175. deplibs="$lib $deplibs"
  5176. linkalldeplibs=no
  5177. if test "$link_all_deplibs" != no || test -z "$library_names" ||
  5178. test "$build_libtool_libs" = no; then
  5179. linkalldeplibs=yes
  5180. fi
  5181. tmp_libs=
  5182. for deplib in $dependency_libs; do
  5183. case $deplib in
  5184. -L*) func_stripname '-L' '' "$deplib"
  5185. newlib_search_path="$newlib_search_path $func_stripname_result"
  5186. ;;
  5187. esac
  5188. # Need to link against all dependency_libs?
  5189. if test "$linkalldeplibs" = yes; then
  5190. deplibs="$deplib $deplibs"
  5191. else
  5192. # Need to hardcode shared library paths
  5193. # or/and link against static libraries
  5194. newdependency_libs="$deplib $newdependency_libs"
  5195. fi
  5196. if $opt_duplicate_deps ; then
  5197. case "$tmp_libs " in
  5198. *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
  5199. esac
  5200. fi
  5201. tmp_libs="$tmp_libs $deplib"
  5202. done # for deplib
  5203. continue
  5204. fi # $linkmode = prog...
  5205. if test "$linkmode,$pass" = "prog,link"; then
  5206. if test -n "$library_names" &&
  5207. { { test "$prefer_static_libs" = no ||
  5208. test "$prefer_static_libs,$installed" = "built,yes"; } ||
  5209. test -z "$old_library"; }; then
  5210. # We need to hardcode the library path
  5211. if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
  5212. # Make sure the rpath contains only unique directories.
  5213. case "$temp_rpath:" in
  5214. *"$absdir:"*) ;;
  5215. *) temp_rpath="$temp_rpath$absdir:" ;;
  5216. esac
  5217. fi
  5218. # Hardcode the library path.
  5219. # Skip directories that are in the system default run-time
  5220. # search path.
  5221. case " $sys_lib_dlsearch_path " in
  5222. *" $absdir "*) ;;
  5223. *)
  5224. case "$compile_rpath " in
  5225. *" $absdir "*) ;;
  5226. *) compile_rpath="$compile_rpath $absdir"
  5227. esac
  5228. ;;
  5229. esac
  5230. case " $sys_lib_dlsearch_path " in
  5231. *" $libdir "*) ;;
  5232. *)
  5233. case "$finalize_rpath " in
  5234. *" $libdir "*) ;;
  5235. *) finalize_rpath="$finalize_rpath $libdir"
  5236. esac
  5237. ;;
  5238. esac
  5239. fi # $linkmode,$pass = prog,link...
  5240. if test "$alldeplibs" = yes &&
  5241. { test "$deplibs_check_method" = pass_all ||
  5242. { test "$build_libtool_libs" = yes &&
  5243. test -n "$library_names"; }; }; then
  5244. # We only need to search for static libraries
  5245. continue
  5246. fi
  5247. fi
  5248. link_static=no # Whether the deplib will be linked statically
  5249. use_static_libs=$prefer_static_libs
  5250. if test "$use_static_libs" = built && test "$installed" = yes; then
  5251. use_static_libs=no
  5252. fi
  5253. if test -n "$library_names" &&
  5254. { test "$use_static_libs" = no || test -z "$old_library"; }; then
  5255. case $host in
  5256. *cygwin* | *mingw* | *cegcc*)
  5257. # No point in relinking DLLs because paths are not encoded
  5258. notinst_deplibs="$notinst_deplibs $lib"
  5259. need_relink=no
  5260. ;;
  5261. *)
  5262. if test "$installed" = no; then
  5263. notinst_deplibs="$notinst_deplibs $lib"
  5264. need_relink=yes
  5265. fi
  5266. ;;
  5267. esac
  5268. # This is a shared library
  5269. # Warn about portability, can't link against -module's on some
  5270. # systems (darwin). Don't bleat about dlopened modules though!
  5271. dlopenmodule=""
  5272. for dlpremoduletest in $dlprefiles; do
  5273. if test "X$dlpremoduletest" = "X$lib"; then
  5274. dlopenmodule="$dlpremoduletest"
  5275. break
  5276. fi
  5277. done
  5278. if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then
  5279. echo
  5280. if test "$linkmode" = prog; then
  5281. $ECHO "*** Warning: Linking the executable $output against the loadable module"
  5282. else
  5283. $ECHO "*** Warning: Linking the shared library $output against the loadable module"
  5284. fi
  5285. $ECHO "*** $linklib is not portable!"
  5286. fi
  5287. if test "$linkmode" = lib &&
  5288. test "$hardcode_into_libs" = yes; then
  5289. # Hardcode the library path.
  5290. # Skip directories that are in the system default run-time
  5291. # search path.
  5292. case " $sys_lib_dlsearch_path " in
  5293. *" $absdir "*) ;;
  5294. *)
  5295. case "$compile_rpath " in
  5296. *" $absdir "*) ;;
  5297. *) compile_rpath="$compile_rpath $absdir"
  5298. esac
  5299. ;;
  5300. esac
  5301. case " $sys_lib_dlsearch_path " in
  5302. *" $libdir "*) ;;
  5303. *)
  5304. case "$finalize_rpath " in
  5305. *" $libdir "*) ;;
  5306. *) finalize_rpath="$finalize_rpath $libdir"
  5307. esac
  5308. ;;
  5309. esac
  5310. fi
  5311. if test -n "$old_archive_from_expsyms_cmds"; then
  5312. # figure out the soname
  5313. set dummy $library_names
  5314. shift
  5315. realname="$1"
  5316. shift
  5317. libname=`eval "\\$ECHO \"$libname_spec\""`
  5318. # use dlname if we got it. it's perfectly good, no?
  5319. if test -n "$dlname"; then
  5320. soname="$dlname"
  5321. elif test -n "$soname_spec"; then
  5322. # bleh windows
  5323. case $host in
  5324. *cygwin* | mingw* | *cegcc*)
  5325. func_arith $current - $age
  5326. major=$func_arith_result
  5327. versuffix="-$major"
  5328. ;;
  5329. esac
  5330. eval soname=\"$soname_spec\"
  5331. else
  5332. soname="$realname"
  5333. fi
  5334. # Make a new name for the extract_expsyms_cmds to use
  5335. soroot="$soname"
  5336. func_basename "$soroot"
  5337. soname="$func_basename_result"
  5338. func_stripname 'lib' '.dll' "$soname"
  5339. newlib=libimp-$func_stripname_result.a
  5340. # If the library has no export list, then create one now
  5341. if test -f "$output_objdir/$soname-def"; then :
  5342. else
  5343. func_verbose "extracting exported symbol list from \`$soname'"
  5344. func_execute_cmds "$extract_expsyms_cmds" 'exit $?'
  5345. fi
  5346. # Create $newlib
  5347. if test -f "$output_objdir/$newlib"; then :; else
  5348. func_verbose "generating import library for \`$soname'"
  5349. func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?'
  5350. fi
  5351. # make sure the library variables are pointing to the new library
  5352. dir=$output_objdir
  5353. linklib=$newlib
  5354. fi # test -n "$old_archive_from_expsyms_cmds"
  5355. if test "$linkmode" = prog || test "$mode" != relink; then
  5356. add_shlibpath=
  5357. add_dir=
  5358. add=
  5359. lib_linked=yes
  5360. case $hardcode_action in
  5361. immediate | unsupported)
  5362. if test "$hardcode_direct" = no; then
  5363. add="$dir/$linklib"
  5364. case $host in
  5365. *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;;
  5366. *-*-sysv4*uw2*) add_dir="-L$dir" ;;
  5367. *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
  5368. *-*-unixware7*) add_dir="-L$dir" ;;
  5369. *-*-darwin* )
  5370. # if the lib is a (non-dlopened) module then we can not
  5371. # link against it, someone is ignoring the earlier warnings
  5372. if /usr/bin/file -L $add 2> /dev/null |
  5373. $GREP ": [^:]* bundle" >/dev/null ; then
  5374. if test "X$dlopenmodule" != "X$lib"; then
  5375. $ECHO "*** Warning: lib $linklib is a module, not a shared library"
  5376. if test -z "$old_library" ; then
  5377. echo
  5378. echo "*** And there doesn't seem to be a static archive available"
  5379. echo "*** The link will probably fail, sorry"
  5380. else
  5381. add="$dir/$old_library"
  5382. fi
  5383. elif test -n "$old_library"; then
  5384. add="$dir/$old_library"
  5385. fi
  5386. fi
  5387. esac
  5388. elif test "$hardcode_minus_L" = no; then
  5389. case $host in
  5390. *-*-sunos*) add_shlibpath="$dir" ;;
  5391. esac
  5392. add_dir="-L$dir"
  5393. add="-l$name"
  5394. elif test "$hardcode_shlibpath_var" = no; then
  5395. add_shlibpath="$dir"
  5396. add="-l$name"
  5397. else
  5398. lib_linked=no
  5399. fi
  5400. ;;
  5401. relink)
  5402. if test "$hardcode_direct" = yes &&
  5403. test "$hardcode_direct_absolute" = no; then
  5404. add="$dir/$linklib"
  5405. elif test "$hardcode_minus_L" = yes; then
  5406. add_dir="-L$dir"
  5407. # Try looking first in the location we're being installed to.
  5408. if test -n "$inst_prefix_dir"; then
  5409. case $libdir in
  5410. [\\/]*)
  5411. add_dir="$add_dir -L$inst_prefix_dir$libdir"
  5412. ;;
  5413. esac
  5414. fi
  5415. add="-l$name"
  5416. elif test "$hardcode_shlibpath_var" = yes; then
  5417. add_shlibpath="$dir"
  5418. add="-l$name"
  5419. else
  5420. lib_linked=no
  5421. fi
  5422. ;;
  5423. *) lib_linked=no ;;
  5424. esac
  5425. if test "$lib_linked" != yes; then
  5426. func_fatal_configuration "unsupported hardcode properties"
  5427. fi
  5428. if test -n "$add_shlibpath"; then
  5429. case :$compile_shlibpath: in
  5430. *":$add_shlibpath:"*) ;;
  5431. *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
  5432. esac
  5433. fi
  5434. if test "$linkmode" = prog; then
  5435. test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
  5436. test -n "$add" && compile_deplibs="$add $compile_deplibs"
  5437. else
  5438. test -n "$add_dir" && deplibs="$add_dir $deplibs"
  5439. test -n "$add" && deplibs="$add $deplibs"
  5440. if test "$hardcode_direct" != yes &&
  5441. test "$hardcode_minus_L" != yes &&
  5442. test "$hardcode_shlibpath_var" = yes; then
  5443. case :$finalize_shlibpath: in
  5444. *":$libdir:"*) ;;
  5445. *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
  5446. esac
  5447. fi
  5448. fi
  5449. fi
  5450. if test "$linkmode" = prog || test "$mode" = relink; then
  5451. add_shlibpath=
  5452. add_dir=
  5453. add=
  5454. # Finalize command for both is simple: just hardcode it.
  5455. if test "$hardcode_direct" = yes &&
  5456. test "$hardcode_direct_absolute" = no; then
  5457. add="$libdir/$linklib"
  5458. elif test "$hardcode_minus_L" = yes; then
  5459. add_dir="-L$libdir"
  5460. add="-l$name"
  5461. elif test "$hardcode_shlibpath_var" = yes; then
  5462. case :$finalize_shlibpath: in
  5463. *":$libdir:"*) ;;
  5464. *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
  5465. esac
  5466. add="-l$name"
  5467. elif test "$hardcode_automatic" = yes; then
  5468. if test -n "$inst_prefix_dir" &&
  5469. test -f "$inst_prefix_dir$libdir/$linklib" ; then
  5470. add="$inst_prefix_dir$libdir/$linklib"
  5471. else
  5472. add="$libdir/$linklib"
  5473. fi
  5474. else
  5475. # We cannot seem to hardcode it, guess we'll fake it.
  5476. add_dir="-L$libdir"
  5477. # Try looking first in the location we're being installed to.
  5478. if test -n "$inst_prefix_dir"; then
  5479. case $libdir in
  5480. [\\/]*)
  5481. add_dir="$add_dir -L$inst_prefix_dir$libdir"
  5482. ;;
  5483. esac
  5484. fi
  5485. add="-l$name"
  5486. fi
  5487. if test "$linkmode" = prog; then
  5488. test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
  5489. test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
  5490. else
  5491. test -n "$add_dir" && deplibs="$add_dir $deplibs"
  5492. test -n "$add" && deplibs="$add $deplibs"
  5493. fi
  5494. fi
  5495. elif test "$linkmode" = prog; then
  5496. # Here we assume that one of hardcode_direct or hardcode_minus_L
  5497. # is not unsupported. This is valid on all known static and
  5498. # shared platforms.
  5499. if test "$hardcode_direct" != unsupported; then
  5500. test -n "$old_library" && linklib="$old_library"
  5501. compile_deplibs="$dir/$linklib $compile_deplibs"
  5502. finalize_deplibs="$dir/$linklib $finalize_deplibs"
  5503. else
  5504. compile_deplibs="-l$name -L$dir $compile_deplibs"
  5505. finalize_deplibs="-l$name -L$dir $finalize_deplibs"
  5506. fi
  5507. elif test "$build_libtool_libs" = yes; then
  5508. # Not a shared library
  5509. if test "$deplibs_check_method" != pass_all; then
  5510. # We're trying link a shared library against a static one
  5511. # but the system doesn't support it.
  5512. # Just print a warning and add the library to dependency_libs so
  5513. # that the program can be linked against the static library.
  5514. echo
  5515. $ECHO "*** Warning: This system can not link to static lib archive $lib."
  5516. echo "*** I have the capability to make that library automatically link in when"
  5517. echo "*** you link to this library. But I can only do this if you have a"
  5518. echo "*** shared version of the library, which you do not appear to have."
  5519. if test "$module" = yes; then
  5520. echo "*** But as you try to build a module library, libtool will still create "
  5521. echo "*** a static module, that should work as long as the dlopening application"
  5522. echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
  5523. if test -z "$global_symbol_pipe"; then
  5524. echo
  5525. echo "*** However, this would only work if libtool was able to extract symbol"
  5526. echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
  5527. echo "*** not find such a program. So, this module is probably useless."
  5528. echo "*** \`nm' from GNU binutils and a full rebuild may help."
  5529. fi
  5530. if test "$build_old_libs" = no; then
  5531. build_libtool_libs=module
  5532. build_old_libs=yes
  5533. else
  5534. build_libtool_libs=no
  5535. fi
  5536. fi
  5537. else
  5538. deplibs="$dir/$old_library $deplibs"
  5539. link_static=yes
  5540. fi
  5541. fi # link shared/static library?
  5542. if test "$linkmode" = lib; then
  5543. if test -n "$dependency_libs" &&
  5544. { test "$hardcode_into_libs" != yes ||
  5545. test "$build_old_libs" = yes ||
  5546. test "$link_static" = yes; }; then
  5547. # Extract -R from dependency_libs
  5548. temp_deplibs=
  5549. for libdir in $dependency_libs; do
  5550. case $libdir in
  5551. -R*) func_stripname '-R' '' "$libdir"
  5552. temp_xrpath=$func_stripname_result
  5553. case " $xrpath " in
  5554. *" $temp_xrpath "*) ;;
  5555. *) xrpath="$xrpath $temp_xrpath";;
  5556. esac;;
  5557. *) temp_deplibs="$temp_deplibs $libdir";;
  5558. esac
  5559. done
  5560. dependency_libs="$temp_deplibs"
  5561. fi
  5562. newlib_search_path="$newlib_search_path $absdir"
  5563. # Link against this library
  5564. test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
  5565. # ... and its dependency_libs
  5566. tmp_libs=
  5567. for deplib in $dependency_libs; do
  5568. newdependency_libs="$deplib $newdependency_libs"
  5569. if $opt_duplicate_deps ; then
  5570. case "$tmp_libs " in
  5571. *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
  5572. esac
  5573. fi
  5574. tmp_libs="$tmp_libs $deplib"
  5575. done
  5576. if test "$link_all_deplibs" != no; then
  5577. # Add the search paths of all dependency libraries
  5578. for deplib in $dependency_libs; do
  5579. path=
  5580. case $deplib in
  5581. -L*) path="$deplib" ;;
  5582. *.la)
  5583. func_dirname "$deplib" "" "."
  5584. dir="$func_dirname_result"
  5585. # We need an absolute path.
  5586. case $dir in
  5587. [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
  5588. *)
  5589. absdir=`cd "$dir" && pwd`
  5590. if test -z "$absdir"; then
  5591. func_warning "cannot determine absolute directory name of \`$dir'"
  5592. absdir="$dir"
  5593. fi
  5594. ;;
  5595. esac
  5596. if $GREP "^installed=no" $deplib > /dev/null; then
  5597. case $host in
  5598. *-*-darwin*)
  5599. depdepl=
  5600. eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
  5601. if test -n "$deplibrary_names" ; then
  5602. for tmp in $deplibrary_names ; do
  5603. depdepl=$tmp
  5604. done
  5605. if test -f "$absdir/$objdir/$depdepl" ; then
  5606. depdepl="$absdir/$objdir/$depdepl"
  5607. darwin_install_name=`${OTOOL} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
  5608. if test -z "$darwin_install_name"; then
  5609. darwin_install_name=`${OTOOL64} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
  5610. fi
  5611. compiler_flags="$compiler_flags ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}"
  5612. linker_flags="$linker_flags -dylib_file ${darwin_install_name}:${depdepl}"
  5613. path=
  5614. fi
  5615. fi
  5616. ;;
  5617. *)
  5618. path="-L$absdir/$objdir"
  5619. ;;
  5620. esac
  5621. else
  5622. eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
  5623. test -z "$libdir" && \
  5624. func_fatal_error "\`$deplib' is not a valid libtool archive"
  5625. test "$absdir" != "$libdir" && \
  5626. func_warning "\`$deplib' seems to be moved"
  5627. path="-L$absdir"
  5628. fi
  5629. ;;
  5630. esac
  5631. case " $deplibs " in
  5632. *" $path "*) ;;
  5633. *) deplibs="$path $deplibs" ;;
  5634. esac
  5635. done
  5636. fi # link_all_deplibs != no
  5637. fi # linkmode = lib
  5638. done # for deplib in $libs
  5639. if test "$pass" = link; then
  5640. if test "$linkmode" = "prog"; then
  5641. compile_deplibs="$new_inherited_linker_flags $compile_deplibs"
  5642. finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs"
  5643. else
  5644. compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
  5645. fi
  5646. fi
  5647. dependency_libs="$newdependency_libs"
  5648. if test "$pass" = dlpreopen; then
  5649. # Link the dlpreopened libraries before other libraries
  5650. for deplib in $save_deplibs; do
  5651. deplibs="$deplib $deplibs"
  5652. done
  5653. fi
  5654. if test "$pass" != dlopen; then
  5655. if test "$pass" != conv; then
  5656. # Make sure lib_search_path contains only unique directories.
  5657. lib_search_path=
  5658. for dir in $newlib_search_path; do
  5659. case "$lib_search_path " in
  5660. *" $dir "*) ;;
  5661. *) lib_search_path="$lib_search_path $dir" ;;
  5662. esac
  5663. done
  5664. newlib_search_path=
  5665. fi
  5666. if test "$linkmode,$pass" != "prog,link"; then
  5667. vars="deplibs"
  5668. else
  5669. vars="compile_deplibs finalize_deplibs"
  5670. fi
  5671. for var in $vars dependency_libs; do
  5672. # Add libraries to $var in reverse order
  5673. eval tmp_libs=\"\$$var\"
  5674. new_libs=
  5675. for deplib in $tmp_libs; do
  5676. # FIXME: Pedantically, this is the right thing to do, so
  5677. # that some nasty dependency loop isn't accidentally
  5678. # broken:
  5679. #new_libs="$deplib $new_libs"
  5680. # Pragmatically, this seems to cause very few problems in
  5681. # practice:
  5682. case $deplib in
  5683. -L*) new_libs="$deplib $new_libs" ;;
  5684. -R*) ;;
  5685. *)
  5686. # And here is the reason: when a library appears more
  5687. # than once as an explicit dependence of a library, or
  5688. # is implicitly linked in more than once by the
  5689. # compiler, it is considered special, and multiple
  5690. # occurrences thereof are not removed. Compare this
  5691. # with having the same library being listed as a
  5692. # dependency of multiple other libraries: in this case,
  5693. # we know (pedantically, we assume) the library does not
  5694. # need to be listed more than once, so we keep only the
  5695. # last copy. This is not always right, but it is rare
  5696. # enough that we require users that really mean to play
  5697. # such unportable linking tricks to link the library
  5698. # using -Wl,-lname, so that libtool does not consider it
  5699. # for duplicate removal.
  5700. case " $specialdeplibs " in
  5701. *" $deplib "*) new_libs="$deplib $new_libs" ;;
  5702. *)
  5703. case " $new_libs " in
  5704. *" $deplib "*) ;;
  5705. *) new_libs="$deplib $new_libs" ;;
  5706. esac
  5707. ;;
  5708. esac
  5709. ;;
  5710. esac
  5711. done
  5712. tmp_libs=
  5713. for deplib in $new_libs; do
  5714. case $deplib in
  5715. -L*)
  5716. case " $tmp_libs " in
  5717. *" $deplib "*) ;;
  5718. *) tmp_libs="$tmp_libs $deplib" ;;
  5719. esac
  5720. ;;
  5721. *) tmp_libs="$tmp_libs $deplib" ;;
  5722. esac
  5723. done
  5724. eval $var=\"$tmp_libs\"
  5725. done # for var
  5726. fi
  5727. # Last step: remove runtime libs from dependency_libs
  5728. # (they stay in deplibs)
  5729. tmp_libs=
  5730. for i in $dependency_libs ; do
  5731. case " $predeps $postdeps $compiler_lib_search_path " in
  5732. *" $i "*)
  5733. i=""
  5734. ;;
  5735. esac
  5736. if test -n "$i" ; then
  5737. tmp_libs="$tmp_libs $i"
  5738. fi
  5739. done
  5740. dependency_libs=$tmp_libs
  5741. done # for pass
  5742. if test "$linkmode" = prog; then
  5743. dlfiles="$newdlfiles"
  5744. fi
  5745. if test "$linkmode" = prog || test "$linkmode" = lib; then
  5746. dlprefiles="$newdlprefiles"
  5747. fi
  5748. case $linkmode in
  5749. oldlib)
  5750. if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
  5751. func_warning "\`-dlopen' is ignored for archives"
  5752. fi
  5753. case " $deplibs" in
  5754. *\ -l* | *\ -L*)
  5755. func_warning "\`-l' and \`-L' are ignored for archives" ;;
  5756. esac
  5757. test -n "$rpath" && \
  5758. func_warning "\`-rpath' is ignored for archives"
  5759. test -n "$xrpath" && \
  5760. func_warning "\`-R' is ignored for archives"
  5761. test -n "$vinfo" && \
  5762. func_warning "\`-version-info/-version-number' is ignored for archives"
  5763. test -n "$release" && \
  5764. func_warning "\`-release' is ignored for archives"
  5765. test -n "$export_symbols$export_symbols_regex" && \
  5766. func_warning "\`-export-symbols' is ignored for archives"
  5767. # Now set the variables for building old libraries.
  5768. build_libtool_libs=no
  5769. oldlibs="$output"
  5770. objs="$objs$old_deplibs"
  5771. ;;
  5772. lib)
  5773. # Make sure we only generate libraries of the form `libNAME.la'.
  5774. case $outputname in
  5775. lib*)
  5776. func_stripname 'lib' '.la' "$outputname"
  5777. name=$func_stripname_result
  5778. eval shared_ext=\"$shrext_cmds\"
  5779. eval libname=\"$libname_spec\"
  5780. ;;
  5781. *)
  5782. test "$module" = no && \
  5783. func_fatal_help "libtool library \`$output' must begin with \`lib'"
  5784. if test "$need_lib_prefix" != no; then
  5785. # Add the "lib" prefix for modules if required
  5786. func_stripname '' '.la' "$outputname"
  5787. name=$func_stripname_result
  5788. eval shared_ext=\"$shrext_cmds\"
  5789. eval libname=\"$libname_spec\"
  5790. else
  5791. func_stripname '' '.la' "$outputname"
  5792. libname=$func_stripname_result
  5793. fi
  5794. ;;
  5795. esac
  5796. if test -n "$objs"; then
  5797. if test "$deplibs_check_method" != pass_all; then
  5798. func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs"
  5799. else
  5800. echo
  5801. $ECHO "*** Warning: Linking the shared library $output against the non-libtool"
  5802. $ECHO "*** objects $objs is not portable!"
  5803. libobjs="$libobjs $objs"
  5804. fi
  5805. fi
  5806. test "$dlself" != no && \
  5807. func_warning "\`-dlopen self' is ignored for libtool libraries"
  5808. set dummy $rpath
  5809. shift
  5810. test "$#" -gt 1 && \
  5811. func_warning "ignoring multiple \`-rpath's for a libtool library"
  5812. install_libdir="$1"
  5813. oldlibs=
  5814. if test -z "$rpath"; then
  5815. if test "$build_libtool_libs" = yes; then
  5816. # Building a libtool convenience library.
  5817. # Some compilers have problems with a `.al' extension so
  5818. # convenience libraries should have the same extension an
  5819. # archive normally would.
  5820. oldlibs="$output_objdir/$libname.$libext $oldlibs"
  5821. build_libtool_libs=convenience
  5822. build_old_libs=yes
  5823. fi
  5824. test -n "$vinfo" && \
  5825. func_warning "\`-version-info/-version-number' is ignored for convenience libraries"
  5826. test -n "$release" && \
  5827. func_warning "\`-release' is ignored for convenience libraries"
  5828. else
  5829. # Parse the version information argument.
  5830. save_ifs="$IFS"; IFS=':'
  5831. set dummy $vinfo 0 0 0
  5832. shift
  5833. IFS="$save_ifs"
  5834. test -n "$7" && \
  5835. func_fatal_help "too many parameters to \`-version-info'"
  5836. # convert absolute version numbers to libtool ages
  5837. # this retains compatibility with .la files and attempts
  5838. # to make the code below a bit more comprehensible
  5839. case $vinfo_number in
  5840. yes)
  5841. number_major="$1"
  5842. number_minor="$2"
  5843. number_revision="$3"
  5844. #
  5845. # There are really only two kinds -- those that
  5846. # use the current revision as the major version
  5847. # and those that subtract age and use age as
  5848. # a minor version. But, then there is irix
  5849. # which has an extra 1 added just for fun
  5850. #
  5851. case $version_type in
  5852. darwin|linux|osf|windows|none)
  5853. func_arith $number_major + $number_minor
  5854. current=$func_arith_result
  5855. age="$number_minor"
  5856. revision="$number_revision"
  5857. ;;
  5858. freebsd-aout|freebsd-elf|qnx|sunos)
  5859. current="$number_major"
  5860. revision="$number_minor"
  5861. age="0"
  5862. ;;
  5863. irix|nonstopux)
  5864. func_arith $number_major + $number_minor
  5865. current=$func_arith_result
  5866. age="$number_minor"
  5867. revision="$number_minor"
  5868. lt_irix_increment=no
  5869. ;;
  5870. esac
  5871. ;;
  5872. no)
  5873. current="$1"
  5874. revision="$2"
  5875. age="$3"
  5876. ;;
  5877. esac
  5878. # Check that each of the things are valid numbers.
  5879. case $current in
  5880. 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]) ;;
  5881. *)
  5882. func_error "CURRENT \`$current' must be a nonnegative integer"
  5883. func_fatal_error "\`$vinfo' is not valid version information"
  5884. ;;
  5885. esac
  5886. case $revision in
  5887. 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]) ;;
  5888. *)
  5889. func_error "REVISION \`$revision' must be a nonnegative integer"
  5890. func_fatal_error "\`$vinfo' is not valid version information"
  5891. ;;
  5892. esac
  5893. case $age in
  5894. 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]) ;;
  5895. *)
  5896. func_error "AGE \`$age' must be a nonnegative integer"
  5897. func_fatal_error "\`$vinfo' is not valid version information"
  5898. ;;
  5899. esac
  5900. if test "$age" -gt "$current"; then
  5901. func_error "AGE \`$age' is greater than the current interface number \`$current'"
  5902. func_fatal_error "\`$vinfo' is not valid version information"
  5903. fi
  5904. # Calculate the version variables.
  5905. major=
  5906. versuffix=
  5907. verstring=
  5908. case $version_type in
  5909. none) ;;
  5910. darwin)
  5911. # Like Linux, but with the current version available in
  5912. # verstring for coding it into the library header
  5913. func_arith $current - $age
  5914. major=.$func_arith_result
  5915. versuffix="$major.$age.$revision"
  5916. # Darwin ld doesn't like 0 for these options...
  5917. func_arith $current + 1
  5918. minor_current=$func_arith_result
  5919. xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
  5920. verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
  5921. ;;
  5922. freebsd-aout)
  5923. major=".$current"
  5924. versuffix=".$current.$revision";
  5925. ;;
  5926. freebsd-elf)
  5927. major=".$current"
  5928. versuffix=".$current"
  5929. ;;
  5930. irix | nonstopux)
  5931. if test "X$lt_irix_increment" = "Xno"; then
  5932. func_arith $current - $age
  5933. else
  5934. func_arith $current - $age + 1
  5935. fi
  5936. major=$func_arith_result
  5937. case $version_type in
  5938. nonstopux) verstring_prefix=nonstopux ;;
  5939. *) verstring_prefix=sgi ;;
  5940. esac
  5941. verstring="$verstring_prefix$major.$revision"
  5942. # Add in all the interfaces that we are compatible with.
  5943. loop=$revision
  5944. while test "$loop" -ne 0; do
  5945. func_arith $revision - $loop
  5946. iface=$func_arith_result
  5947. func_arith $loop - 1
  5948. loop=$func_arith_result
  5949. verstring="$verstring_prefix$major.$iface:$verstring"
  5950. done
  5951. # Before this point, $major must not contain `.'.
  5952. major=.$major
  5953. versuffix="$major.$revision"
  5954. ;;
  5955. linux)
  5956. func_arith $current - $age
  5957. major=.$func_arith_result
  5958. versuffix="$major.$age.$revision"
  5959. ;;
  5960. osf)
  5961. func_arith $current - $age
  5962. major=.$func_arith_result
  5963. versuffix=".$current.$age.$revision"
  5964. verstring="$current.$age.$revision"
  5965. # Add in all the interfaces that we are compatible with.
  5966. loop=$age
  5967. while test "$loop" -ne 0; do
  5968. func_arith $current - $loop
  5969. iface=$func_arith_result
  5970. func_arith $loop - 1
  5971. loop=$func_arith_result
  5972. verstring="$verstring:${iface}.0"
  5973. done
  5974. # Make executables depend on our current version.
  5975. verstring="$verstring:${current}.0"
  5976. ;;
  5977. qnx)
  5978. major=".$current"
  5979. versuffix=".$current"
  5980. ;;
  5981. sunos)
  5982. major=".$current"
  5983. versuffix=".$current.$revision"
  5984. ;;
  5985. windows)
  5986. # Use '-' rather than '.', since we only want one
  5987. # extension on DOS 8.3 filesystems.
  5988. func_arith $current - $age
  5989. major=$func_arith_result
  5990. versuffix="-$major"
  5991. ;;
  5992. *)
  5993. func_fatal_configuration "unknown library version type \`$version_type'"
  5994. ;;
  5995. esac
  5996. # Clear the version info if we defaulted, and they specified a release.
  5997. if test -z "$vinfo" && test -n "$release"; then
  5998. major=
  5999. case $version_type in
  6000. darwin)
  6001. # we can't check for "0.0" in archive_cmds due to quoting
  6002. # problems, so we reset it completely
  6003. verstring=
  6004. ;;
  6005. *)
  6006. verstring="0.0"
  6007. ;;
  6008. esac
  6009. if test "$need_version" = no; then
  6010. versuffix=
  6011. else
  6012. versuffix=".0.0"
  6013. fi
  6014. fi
  6015. # Remove version info from name if versioning should be avoided
  6016. if test "$avoid_version" = yes && test "$need_version" = no; then
  6017. major=
  6018. versuffix=
  6019. verstring=""
  6020. fi
  6021. # Check to see if the archive will have undefined symbols.
  6022. if test "$allow_undefined" = yes; then
  6023. if test "$allow_undefined_flag" = unsupported; then
  6024. func_warning "undefined symbols not allowed in $host shared libraries"
  6025. build_libtool_libs=no
  6026. build_old_libs=yes
  6027. fi
  6028. else
  6029. # Don't allow undefined symbols.
  6030. allow_undefined_flag="$no_undefined_flag"
  6031. fi
  6032. fi
  6033. func_generate_dlsyms "$libname" "$libname" "yes"
  6034. libobjs="$libobjs $symfileobj"
  6035. test "X$libobjs" = "X " && libobjs=
  6036. if test "$mode" != relink; then
  6037. # Remove our outputs, but don't remove object files since they
  6038. # may have been created when compiling PIC objects.
  6039. removelist=
  6040. tempremovelist=`$ECHO "$output_objdir/*"`
  6041. for p in $tempremovelist; do
  6042. case $p in
  6043. *.$objext | *.gcno)
  6044. ;;
  6045. $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
  6046. if test "X$precious_files_regex" != "X"; then
  6047. if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
  6048. then
  6049. continue
  6050. fi
  6051. fi
  6052. removelist="$removelist $p"
  6053. ;;
  6054. *) ;;
  6055. esac
  6056. done
  6057. test -n "$removelist" && \
  6058. func_show_eval "${RM}r \$removelist"
  6059. fi
  6060. # Now set the variables for building old libraries.
  6061. if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
  6062. oldlibs="$oldlibs $output_objdir/$libname.$libext"
  6063. # Transform .lo files to .o files.
  6064. oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; $lo2o" | $NL2SP`
  6065. fi
  6066. # Eliminate all temporary directories.
  6067. #for path in $notinst_path; do
  6068. # lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"`
  6069. # deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"`
  6070. # dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"`
  6071. #done
  6072. if test -n "$xrpath"; then
  6073. # If the user specified any rpath flags, then add them.
  6074. temp_xrpath=
  6075. for libdir in $xrpath; do
  6076. temp_xrpath="$temp_xrpath -R$libdir"
  6077. case "$finalize_rpath " in
  6078. *" $libdir "*) ;;
  6079. *) finalize_rpath="$finalize_rpath $libdir" ;;
  6080. esac
  6081. done
  6082. if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
  6083. dependency_libs="$temp_xrpath $dependency_libs"
  6084. fi
  6085. fi
  6086. # Make sure dlfiles contains only unique files that won't be dlpreopened
  6087. old_dlfiles="$dlfiles"
  6088. dlfiles=
  6089. for lib in $old_dlfiles; do
  6090. case " $dlprefiles $dlfiles " in
  6091. *" $lib "*) ;;
  6092. *) dlfiles="$dlfiles $lib" ;;
  6093. esac
  6094. done
  6095. # Make sure dlprefiles contains only unique files
  6096. old_dlprefiles="$dlprefiles"
  6097. dlprefiles=
  6098. for lib in $old_dlprefiles; do
  6099. case "$dlprefiles " in
  6100. *" $lib "*) ;;
  6101. *) dlprefiles="$dlprefiles $lib" ;;
  6102. esac
  6103. done
  6104. if test "$build_libtool_libs" = yes; then
  6105. if test -n "$rpath"; then
  6106. case $host in
  6107. *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*)
  6108. # these systems don't actually have a c library (as such)!
  6109. ;;
  6110. *-*-rhapsody* | *-*-darwin1.[012])
  6111. # Rhapsody C library is in the System framework
  6112. deplibs="$deplibs System.ltframework"
  6113. ;;
  6114. *-*-netbsd*)
  6115. # Don't link with libc until the a.out ld.so is fixed.
  6116. ;;
  6117. *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
  6118. # Do not include libc due to us having libc/libc_r.
  6119. ;;
  6120. *-*-sco3.2v5* | *-*-sco5v6*)
  6121. # Causes problems with __ctype
  6122. ;;
  6123. *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
  6124. # Compiler inserts libc in the correct place for threads to work
  6125. ;;
  6126. *)
  6127. # Add libc to deplibs on all other systems if necessary.
  6128. if test "$build_libtool_need_lc" = "yes"; then
  6129. deplibs="$deplibs -lc"
  6130. fi
  6131. ;;
  6132. esac
  6133. fi
  6134. # Transform deplibs into only deplibs that can be linked in shared.
  6135. name_save=$name
  6136. libname_save=$libname
  6137. release_save=$release
  6138. versuffix_save=$versuffix
  6139. major_save=$major
  6140. # I'm not sure if I'm treating the release correctly. I think
  6141. # release should show up in the -l (ie -lgmp5) so we don't want to
  6142. # add it in twice. Is that correct?
  6143. release=""
  6144. versuffix=""
  6145. major=""
  6146. newdeplibs=
  6147. droppeddeps=no
  6148. case $deplibs_check_method in
  6149. pass_all)
  6150. # Don't check for shared/static. Everything works.
  6151. # This might be a little naive. We might want to check
  6152. # whether the library exists or not. But this is on
  6153. # osf3 & osf4 and I'm not really sure... Just
  6154. # implementing what was already the behavior.
  6155. newdeplibs=$deplibs
  6156. ;;
  6157. test_compile)
  6158. # This code stresses the "libraries are programs" paradigm to its
  6159. # limits. Maybe even breaks it. We compile a program, linking it
  6160. # against the deplibs as a proxy for the library. Then we can check
  6161. # whether they linked in statically or dynamically with ldd.
  6162. $opt_dry_run || $RM conftest.c
  6163. cat > conftest.c <<EOF
  6164. int main() { return 0; }
  6165. EOF
  6166. $opt_dry_run || $RM conftest
  6167. if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then
  6168. ldd_output=`ldd conftest`
  6169. for i in $deplibs; do
  6170. case $i in
  6171. -l*)
  6172. func_stripname -l '' "$i"
  6173. name=$func_stripname_result
  6174. if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
  6175. case " $predeps $postdeps " in
  6176. *" $i "*)
  6177. newdeplibs="$newdeplibs $i"
  6178. i=""
  6179. ;;
  6180. esac
  6181. fi
  6182. if test -n "$i" ; then
  6183. libname=`eval "\\$ECHO \"$libname_spec\""`
  6184. deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
  6185. set dummy $deplib_matches; shift
  6186. deplib_match=$1
  6187. if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
  6188. newdeplibs="$newdeplibs $i"
  6189. else
  6190. droppeddeps=yes
  6191. echo
  6192. $ECHO "*** Warning: dynamic linker does not accept needed library $i."
  6193. echo "*** I have the capability to make that library automatically link in when"
  6194. echo "*** you link to this library. But I can only do this if you have a"
  6195. echo "*** shared version of the library, which I believe you do not have"
  6196. echo "*** because a test_compile did reveal that the linker did not use it for"
  6197. echo "*** its dynamic dependency list that programs get resolved with at runtime."
  6198. fi
  6199. fi
  6200. ;;
  6201. *)
  6202. newdeplibs="$newdeplibs $i"
  6203. ;;
  6204. esac
  6205. done
  6206. else
  6207. # Error occurred in the first compile. Let's try to salvage
  6208. # the situation: Compile a separate program for each library.
  6209. for i in $deplibs; do
  6210. case $i in
  6211. -l*)
  6212. func_stripname -l '' "$i"
  6213. name=$func_stripname_result
  6214. $opt_dry_run || $RM conftest
  6215. if $LTCC $LTCFLAGS -o conftest conftest.c $i; then
  6216. ldd_output=`ldd conftest`
  6217. if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
  6218. case " $predeps $postdeps " in
  6219. *" $i "*)
  6220. newdeplibs="$newdeplibs $i"
  6221. i=""
  6222. ;;
  6223. esac
  6224. fi
  6225. if test -n "$i" ; then
  6226. libname=`eval "\\$ECHO \"$libname_spec\""`
  6227. deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
  6228. set dummy $deplib_matches; shift
  6229. deplib_match=$1
  6230. if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
  6231. newdeplibs="$newdeplibs $i"
  6232. else
  6233. droppeddeps=yes
  6234. echo
  6235. $ECHO "*** Warning: dynamic linker does not accept needed library $i."
  6236. echo "*** I have the capability to make that library automatically link in when"
  6237. echo "*** you link to this library. But I can only do this if you have a"
  6238. echo "*** shared version of the library, which you do not appear to have"
  6239. echo "*** because a test_compile did reveal that the linker did not use this one"
  6240. echo "*** as a dynamic dependency that programs can get resolved with at runtime."
  6241. fi
  6242. fi
  6243. else
  6244. droppeddeps=yes
  6245. echo
  6246. $ECHO "*** Warning! Library $i is needed by this library but I was not able to"
  6247. echo "*** make it link in! You will probably need to install it or some"
  6248. echo "*** library that it depends on before this library will be fully"
  6249. echo "*** functional. Installing it before continuing would be even better."
  6250. fi
  6251. ;;
  6252. *)
  6253. newdeplibs="$newdeplibs $i"
  6254. ;;
  6255. esac
  6256. done
  6257. fi
  6258. ;;
  6259. file_magic*)
  6260. set dummy $deplibs_check_method; shift
  6261. file_magic_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
  6262. for a_deplib in $deplibs; do
  6263. case $a_deplib in
  6264. -l*)
  6265. func_stripname -l '' "$a_deplib"
  6266. name=$func_stripname_result
  6267. if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
  6268. case " $predeps $postdeps " in
  6269. *" $a_deplib "*)
  6270. newdeplibs="$newdeplibs $a_deplib"
  6271. a_deplib=""
  6272. ;;
  6273. esac
  6274. fi
  6275. if test -n "$a_deplib" ; then
  6276. libname=`eval "\\$ECHO \"$libname_spec\""`
  6277. for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
  6278. potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
  6279. for potent_lib in $potential_libs; do
  6280. # Follow soft links.
  6281. if ls -lLd "$potent_lib" 2>/dev/null |
  6282. $GREP " -> " >/dev/null; then
  6283. continue
  6284. fi
  6285. # The statement above tries to avoid entering an
  6286. # endless loop below, in case of cyclic links.
  6287. # We might still enter an endless loop, since a link
  6288. # loop can be closed while we follow links,
  6289. # but so what?
  6290. potlib="$potent_lib"
  6291. while test -h "$potlib" 2>/dev/null; do
  6292. potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
  6293. case $potliblink in
  6294. [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
  6295. *) potlib=`$ECHO "$potlib" | $SED 's,[^/]*$,,'`"$potliblink";;
  6296. esac
  6297. done
  6298. if eval $file_magic_cmd \"\$potlib\" 2>/dev/null |
  6299. $SED -e 10q |
  6300. $EGREP "$file_magic_regex" > /dev/null; then
  6301. newdeplibs="$newdeplibs $a_deplib"
  6302. a_deplib=""
  6303. break 2
  6304. fi
  6305. done
  6306. done
  6307. fi
  6308. if test -n "$a_deplib" ; then
  6309. droppeddeps=yes
  6310. echo
  6311. $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
  6312. echo "*** I have the capability to make that library automatically link in when"
  6313. echo "*** you link to this library. But I can only do this if you have a"
  6314. echo "*** shared version of the library, which you do not appear to have"
  6315. echo "*** because I did check the linker path looking for a file starting"
  6316. if test -z "$potlib" ; then
  6317. $ECHO "*** with $libname but no candidates were found. (...for file magic test)"
  6318. else
  6319. $ECHO "*** with $libname and none of the candidates passed a file format test"
  6320. $ECHO "*** using a file magic. Last file checked: $potlib"
  6321. fi
  6322. fi
  6323. ;;
  6324. *)
  6325. # Add a -L argument.
  6326. newdeplibs="$newdeplibs $a_deplib"
  6327. ;;
  6328. esac
  6329. done # Gone through all deplibs.
  6330. ;;
  6331. match_pattern*)
  6332. set dummy $deplibs_check_method; shift
  6333. match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
  6334. for a_deplib in $deplibs; do
  6335. case $a_deplib in
  6336. -l*)
  6337. func_stripname -l '' "$a_deplib"
  6338. name=$func_stripname_result
  6339. if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
  6340. case " $predeps $postdeps " in
  6341. *" $a_deplib "*)
  6342. newdeplibs="$newdeplibs $a_deplib"
  6343. a_deplib=""
  6344. ;;
  6345. esac
  6346. fi
  6347. if test -n "$a_deplib" ; then
  6348. libname=`eval "\\$ECHO \"$libname_spec\""`
  6349. for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
  6350. potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
  6351. for potent_lib in $potential_libs; do
  6352. potlib="$potent_lib" # see symlink-check above in file_magic test
  6353. if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \
  6354. $EGREP "$match_pattern_regex" > /dev/null; then
  6355. newdeplibs="$newdeplibs $a_deplib"
  6356. a_deplib=""
  6357. break 2
  6358. fi
  6359. done
  6360. done
  6361. fi
  6362. if test -n "$a_deplib" ; then
  6363. droppeddeps=yes
  6364. echo
  6365. $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
  6366. echo "*** I have the capability to make that library automatically link in when"
  6367. echo "*** you link to this library. But I can only do this if you have a"
  6368. echo "*** shared version of the library, which you do not appear to have"
  6369. echo "*** because I did check the linker path looking for a file starting"
  6370. if test -z "$potlib" ; then
  6371. $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)"
  6372. else
  6373. $ECHO "*** with $libname and none of the candidates passed a file format test"
  6374. $ECHO "*** using a regex pattern. Last file checked: $potlib"
  6375. fi
  6376. fi
  6377. ;;
  6378. *)
  6379. # Add a -L argument.
  6380. newdeplibs="$newdeplibs $a_deplib"
  6381. ;;
  6382. esac
  6383. done # Gone through all deplibs.
  6384. ;;
  6385. none | unknown | *)
  6386. newdeplibs=""
  6387. tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'`
  6388. if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
  6389. for i in $predeps $postdeps ; do
  6390. # can't use Xsed below, because $i might contain '/'
  6391. tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s,$i,,"`
  6392. done
  6393. fi
  6394. case $tmp_deplibs in
  6395. *[!\ \ ]*)
  6396. echo
  6397. if test "X$deplibs_check_method" = "Xnone"; then
  6398. echo "*** Warning: inter-library dependencies are not supported in this platform."
  6399. else
  6400. echo "*** Warning: inter-library dependencies are not known to be supported."
  6401. fi
  6402. echo "*** All declared inter-library dependencies are being dropped."
  6403. droppeddeps=yes
  6404. ;;
  6405. esac
  6406. ;;
  6407. esac
  6408. versuffix=$versuffix_save
  6409. major=$major_save
  6410. release=$release_save
  6411. libname=$libname_save
  6412. name=$name_save
  6413. case $host in
  6414. *-*-rhapsody* | *-*-darwin1.[012])
  6415. # On Rhapsody replace the C library with the System framework
  6416. newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'`
  6417. ;;
  6418. esac
  6419. if test "$droppeddeps" = yes; then
  6420. if test "$module" = yes; then
  6421. echo
  6422. echo "*** Warning: libtool could not satisfy all declared inter-library"
  6423. $ECHO "*** dependencies of module $libname. Therefore, libtool will create"
  6424. echo "*** a static module, that should work as long as the dlopening"
  6425. echo "*** application is linked with the -dlopen flag."
  6426. if test -z "$global_symbol_pipe"; then
  6427. echo
  6428. echo "*** However, this would only work if libtool was able to extract symbol"
  6429. echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
  6430. echo "*** not find such a program. So, this module is probably useless."
  6431. echo "*** \`nm' from GNU binutils and a full rebuild may help."
  6432. fi
  6433. if test "$build_old_libs" = no; then
  6434. oldlibs="$output_objdir/$libname.$libext"
  6435. build_libtool_libs=module
  6436. build_old_libs=yes
  6437. else
  6438. build_libtool_libs=no
  6439. fi
  6440. else
  6441. echo "*** The inter-library dependencies that have been dropped here will be"
  6442. echo "*** automatically added whenever a program is linked with this library"
  6443. echo "*** or is declared to -dlopen it."
  6444. if test "$allow_undefined" = no; then
  6445. echo
  6446. echo "*** Since this library must not contain undefined symbols,"
  6447. echo "*** because either the platform does not support them or"
  6448. echo "*** it was explicitly requested with -no-undefined,"
  6449. echo "*** libtool will only create a static version of it."
  6450. if test "$build_old_libs" = no; then
  6451. oldlibs="$output_objdir/$libname.$libext"
  6452. build_libtool_libs=module
  6453. build_old_libs=yes
  6454. else
  6455. build_libtool_libs=no
  6456. fi
  6457. fi
  6458. fi
  6459. fi
  6460. # Done checking deplibs!
  6461. deplibs=$newdeplibs
  6462. fi
  6463. # Time to change all our "foo.ltframework" stuff back to "-framework foo"
  6464. case $host in
  6465. *-*-darwin*)
  6466. newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
  6467. new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
  6468. deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
  6469. ;;
  6470. esac
  6471. # move library search paths that coincide with paths to not yet
  6472. # installed libraries to the beginning of the library search list
  6473. new_libs=
  6474. for path in $notinst_path; do
  6475. case " $new_libs " in
  6476. *" -L$path/$objdir "*) ;;
  6477. *)
  6478. case " $deplibs " in
  6479. *" -L$path/$objdir "*)
  6480. new_libs="$new_libs -L$path/$objdir" ;;
  6481. esac
  6482. ;;
  6483. esac
  6484. done
  6485. for deplib in $deplibs; do
  6486. case $deplib in
  6487. -L*)
  6488. case " $new_libs " in
  6489. *" $deplib "*) ;;
  6490. *) new_libs="$new_libs $deplib" ;;
  6491. esac
  6492. ;;
  6493. *) new_libs="$new_libs $deplib" ;;
  6494. esac
  6495. done
  6496. deplibs="$new_libs"
  6497. # All the library-specific variables (install_libdir is set above).
  6498. library_names=
  6499. old_library=
  6500. dlname=
  6501. # Test again, we may have decided not to build it any more
  6502. if test "$build_libtool_libs" = yes; then
  6503. if test "$hardcode_into_libs" = yes; then
  6504. # Hardcode the library paths
  6505. hardcode_libdirs=
  6506. dep_rpath=
  6507. rpath="$finalize_rpath"
  6508. test "$mode" != relink && rpath="$compile_rpath$rpath"
  6509. for libdir in $rpath; do
  6510. if test -n "$hardcode_libdir_flag_spec"; then
  6511. if test -n "$hardcode_libdir_separator"; then
  6512. if test -z "$hardcode_libdirs"; then
  6513. hardcode_libdirs="$libdir"
  6514. else
  6515. # Just accumulate the unique libdirs.
  6516. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
  6517. *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
  6518. ;;
  6519. *)
  6520. hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
  6521. ;;
  6522. esac
  6523. fi
  6524. else
  6525. eval flag=\"$hardcode_libdir_flag_spec\"
  6526. dep_rpath="$dep_rpath $flag"
  6527. fi
  6528. elif test -n "$runpath_var"; then
  6529. case "$perm_rpath " in
  6530. *" $libdir "*) ;;
  6531. *) perm_rpath="$perm_rpath $libdir" ;;
  6532. esac
  6533. fi
  6534. done
  6535. # Substitute the hardcoded libdirs into the rpath.
  6536. if test -n "$hardcode_libdir_separator" &&
  6537. test -n "$hardcode_libdirs"; then
  6538. libdir="$hardcode_libdirs"
  6539. if test -n "$hardcode_libdir_flag_spec_ld"; then
  6540. eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\"
  6541. else
  6542. eval dep_rpath=\"$hardcode_libdir_flag_spec\"
  6543. fi
  6544. fi
  6545. if test -n "$runpath_var" && test -n "$perm_rpath"; then
  6546. # We should set the runpath_var.
  6547. rpath=
  6548. for dir in $perm_rpath; do
  6549. rpath="$rpath$dir:"
  6550. done
  6551. eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
  6552. fi
  6553. test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
  6554. fi
  6555. shlibpath="$finalize_shlibpath"
  6556. test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
  6557. if test -n "$shlibpath"; then
  6558. eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
  6559. fi
  6560. # Get the real and link names of the library.
  6561. eval shared_ext=\"$shrext_cmds\"
  6562. eval library_names=\"$library_names_spec\"
  6563. set dummy $library_names
  6564. shift
  6565. realname="$1"
  6566. shift
  6567. if test -n "$soname_spec"; then
  6568. eval soname=\"$soname_spec\"
  6569. else
  6570. soname="$realname"
  6571. fi
  6572. if test -z "$dlname"; then
  6573. dlname=$soname
  6574. fi
  6575. lib="$output_objdir/$realname"
  6576. linknames=
  6577. for link
  6578. do
  6579. linknames="$linknames $link"
  6580. done
  6581. # Use standard objects if they are pic
  6582. test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP`
  6583. test "X$libobjs" = "X " && libobjs=
  6584. delfiles=
  6585. if test -n "$export_symbols" && test -n "$include_expsyms"; then
  6586. $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp"
  6587. export_symbols="$output_objdir/$libname.uexp"
  6588. delfiles="$delfiles $export_symbols"
  6589. fi
  6590. orig_export_symbols=
  6591. case $host_os in
  6592. cygwin* | mingw* | cegcc*)
  6593. if test -n "$export_symbols" && test -z "$export_symbols_regex"; then
  6594. # exporting using user supplied symfile
  6595. if test "x`$SED 1q $export_symbols`" != xEXPORTS; then
  6596. # and it's NOT already a .def file. Must figure out
  6597. # which of the given symbols are data symbols and tag
  6598. # them as such. So, trigger use of export_symbols_cmds.
  6599. # export_symbols gets reassigned inside the "prepare
  6600. # the list of exported symbols" if statement, so the
  6601. # include_expsyms logic still works.
  6602. orig_export_symbols="$export_symbols"
  6603. export_symbols=
  6604. always_export_symbols=yes
  6605. fi
  6606. fi
  6607. ;;
  6608. esac
  6609. # Prepare the list of exported symbols
  6610. if test -z "$export_symbols"; then
  6611. if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
  6612. func_verbose "generating symbol list for \`$libname.la'"
  6613. export_symbols="$output_objdir/$libname.exp"
  6614. $opt_dry_run || $RM $export_symbols
  6615. cmds=$export_symbols_cmds
  6616. save_ifs="$IFS"; IFS='~'
  6617. for cmd in $cmds; do
  6618. IFS="$save_ifs"
  6619. eval cmd=\"$cmd\"
  6620. func_len " $cmd"
  6621. len=$func_len_result
  6622. if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
  6623. func_show_eval "$cmd" 'exit $?'
  6624. skipped_export=false
  6625. else
  6626. # The command line is too long to execute in one step.
  6627. func_verbose "using reloadable object file for export list..."
  6628. skipped_export=:
  6629. # Break out early, otherwise skipped_export may be
  6630. # set to false by a later but shorter cmd.
  6631. break
  6632. fi
  6633. done
  6634. IFS="$save_ifs"
  6635. if test -n "$export_symbols_regex" && test "X$skipped_export" != "X:"; then
  6636. func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
  6637. func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
  6638. fi
  6639. fi
  6640. fi
  6641. if test -n "$export_symbols" && test -n "$include_expsyms"; then
  6642. tmp_export_symbols="$export_symbols"
  6643. test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
  6644. $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
  6645. fi
  6646. if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then
  6647. # The given exports_symbols file has to be filtered, so filter it.
  6648. func_verbose "filter symbol list for \`$libname.la' to tag DATA exports"
  6649. # FIXME: $output_objdir/$libname.filter potentially contains lots of
  6650. # 's' commands which not all seds can handle. GNU sed should be fine
  6651. # though. Also, the filter scales superlinearly with the number of
  6652. # global variables. join(1) would be nice here, but unfortunately
  6653. # isn't a blessed tool.
  6654. $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
  6655. delfiles="$delfiles $export_symbols $output_objdir/$libname.filter"
  6656. export_symbols=$output_objdir/$libname.def
  6657. $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
  6658. fi
  6659. tmp_deplibs=
  6660. inst_prefix_arg=
  6661. for test_deplib in $deplibs; do
  6662. case " $convenience " in
  6663. *" $test_deplib "*) ;;
  6664. *)
  6665. if test -n "$inst_prefix_dir" && test "$inst_prefix_dir" != "/" && (echo "$test_deplib" | grep -- "$inst_prefix_dir" >/dev/null); then
  6666. inst_prefix_arg="$inst_prefix_arg $test_deplib"
  6667. else
  6668. tmp_deplibs="$tmp_deplibs $test_deplib"
  6669. fi
  6670. ;;
  6671. esac
  6672. done
  6673. deplibs="$tmp_deplibs"
  6674. if test -n "$inst_prefix_arg"; then
  6675. deplibs="$inst_prefix_arg $deplibs"
  6676. fi
  6677. if test -n "$convenience"; then
  6678. if test -n "$whole_archive_flag_spec" &&
  6679. test "$compiler_needs_object" = yes &&
  6680. test -z "$libobjs"; then
  6681. # extract the archives, so we have objects to list.
  6682. # TODO: could optimize this to just extract one archive.
  6683. whole_archive_flag_spec=
  6684. fi
  6685. if test -n "$whole_archive_flag_spec"; then
  6686. save_libobjs=$libobjs
  6687. eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
  6688. test "X$libobjs" = "X " && libobjs=
  6689. else
  6690. gentop="$output_objdir/${outputname}x"
  6691. generated="$generated $gentop"
  6692. func_extract_archives $gentop $convenience
  6693. libobjs="$libobjs $func_extract_archives_result"
  6694. test "X$libobjs" = "X " && libobjs=
  6695. fi
  6696. fi
  6697. if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
  6698. eval flag=\"$thread_safe_flag_spec\"
  6699. linker_flags="$linker_flags $flag"
  6700. fi
  6701. # Make a backup of the uninstalled library when relinking
  6702. if test "$mode" = relink; then
  6703. $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $?
  6704. fi
  6705. # Do each of the archive commands.
  6706. if test "$module" = yes && test -n "$module_cmds" ; then
  6707. if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
  6708. eval test_cmds=\"$module_expsym_cmds\"
  6709. cmds=$module_expsym_cmds
  6710. else
  6711. eval test_cmds=\"$module_cmds\"
  6712. cmds=$module_cmds
  6713. fi
  6714. else
  6715. if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
  6716. eval test_cmds=\"$archive_expsym_cmds\"
  6717. cmds=$archive_expsym_cmds
  6718. else
  6719. eval test_cmds=\"$archive_cmds\"
  6720. cmds=$archive_cmds
  6721. fi
  6722. fi
  6723. if test "X$skipped_export" != "X:" &&
  6724. func_len " $test_cmds" &&
  6725. len=$func_len_result &&
  6726. test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
  6727. :
  6728. else
  6729. # The command line is too long to link in one step, link piecewise
  6730. # or, if using GNU ld and skipped_export is not :, use a linker
  6731. # script.
  6732. # Save the value of $output and $libobjs because we want to
  6733. # use them later. If we have whole_archive_flag_spec, we
  6734. # want to use save_libobjs as it was before
  6735. # whole_archive_flag_spec was expanded, because we can't
  6736. # assume the linker understands whole_archive_flag_spec.
  6737. # This may have to be revisited, in case too many
  6738. # convenience libraries get linked in and end up exceeding
  6739. # the spec.
  6740. if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
  6741. save_libobjs=$libobjs
  6742. fi
  6743. save_output=$output
  6744. func_basename "$output"
  6745. output_la=$func_basename_result
  6746. # Clear the reloadable object creation command queue and
  6747. # initialize k to one.
  6748. test_cmds=
  6749. concat_cmds=
  6750. objlist=
  6751. last_robj=
  6752. k=1
  6753. if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then
  6754. output=${output_objdir}/${output_la}.lnkscript
  6755. func_verbose "creating GNU ld script: $output"
  6756. echo 'INPUT (' > $output
  6757. for obj in $save_libobjs
  6758. do
  6759. $ECHO "$obj" >> $output
  6760. done
  6761. echo ')' >> $output
  6762. delfiles="$delfiles $output"
  6763. elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then
  6764. output=${output_objdir}/${output_la}.lnk
  6765. func_verbose "creating linker input file list: $output"
  6766. : > $output
  6767. set x $save_libobjs
  6768. shift
  6769. firstobj=
  6770. if test "$compiler_needs_object" = yes; then
  6771. firstobj="$1 "
  6772. shift
  6773. fi
  6774. for obj
  6775. do
  6776. $ECHO "$obj" >> $output
  6777. done
  6778. delfiles="$delfiles $output"
  6779. output=$firstobj\"$file_list_spec$output\"
  6780. else
  6781. if test -n "$save_libobjs"; then
  6782. func_verbose "creating reloadable object files..."
  6783. output=$output_objdir/$output_la-${k}.$objext
  6784. eval test_cmds=\"$reload_cmds\"
  6785. func_len " $test_cmds"
  6786. len0=$func_len_result
  6787. len=$len0
  6788. # Loop over the list of objects to be linked.
  6789. for obj in $save_libobjs
  6790. do
  6791. func_len " $obj"
  6792. func_arith $len + $func_len_result
  6793. len=$func_arith_result
  6794. if test "X$objlist" = X ||
  6795. test "$len" -lt "$max_cmd_len"; then
  6796. func_append objlist " $obj"
  6797. else
  6798. # The command $test_cmds is almost too long, add a
  6799. # command to the queue.
  6800. if test "$k" -eq 1 ; then
  6801. # The first file doesn't have a previous command to add.
  6802. reload_objs=$objlist
  6803. eval concat_cmds=\"$reload_cmds\"
  6804. else
  6805. # All subsequent reloadable object files will link in
  6806. # the last one created.
  6807. reload_objs="$objlist $last_robj"
  6808. eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\"
  6809. fi
  6810. last_robj=$output_objdir/$output_la-${k}.$objext
  6811. func_arith $k + 1
  6812. k=$func_arith_result
  6813. output=$output_objdir/$output_la-${k}.$objext
  6814. objlist=" $obj"
  6815. func_len " $last_robj"
  6816. func_arith $len0 + $func_len_result
  6817. len=$func_arith_result
  6818. fi
  6819. done
  6820. # Handle the remaining objects by creating one last
  6821. # reloadable object file. All subsequent reloadable object
  6822. # files will link in the last one created.
  6823. test -z "$concat_cmds" || concat_cmds=$concat_cmds~
  6824. reload_objs="$objlist $last_robj"
  6825. eval concat_cmds=\"\${concat_cmds}$reload_cmds\"
  6826. if test -n "$last_robj"; then
  6827. eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\"
  6828. fi
  6829. delfiles="$delfiles $output"
  6830. else
  6831. output=
  6832. fi
  6833. if ${skipped_export-false}; then
  6834. func_verbose "generating symbol list for \`$libname.la'"
  6835. export_symbols="$output_objdir/$libname.exp"
  6836. $opt_dry_run || $RM $export_symbols
  6837. libobjs=$output
  6838. # Append the command to create the export file.
  6839. test -z "$concat_cmds" || concat_cmds=$concat_cmds~
  6840. eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\"
  6841. if test -n "$last_robj"; then
  6842. eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\"
  6843. fi
  6844. fi
  6845. test -n "$save_libobjs" &&
  6846. func_verbose "creating a temporary reloadable object file: $output"
  6847. # Loop through the commands generated above and execute them.
  6848. save_ifs="$IFS"; IFS='~'
  6849. for cmd in $concat_cmds; do
  6850. IFS="$save_ifs"
  6851. $opt_silent || {
  6852. func_quote_for_expand "$cmd"
  6853. eval "func_echo $func_quote_for_expand_result"
  6854. }
  6855. $opt_dry_run || eval "$cmd" || {
  6856. lt_exit=$?
  6857. # Restore the uninstalled library and exit
  6858. if test "$mode" = relink; then
  6859. ( cd "$output_objdir" && \
  6860. $RM "${realname}T" && \
  6861. $MV "${realname}U" "$realname" )
  6862. fi
  6863. exit $lt_exit
  6864. }
  6865. done
  6866. IFS="$save_ifs"
  6867. if test -n "$export_symbols_regex" && ${skipped_export-false}; then
  6868. func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
  6869. func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
  6870. fi
  6871. fi
  6872. if ${skipped_export-false}; then
  6873. if test -n "$export_symbols" && test -n "$include_expsyms"; then
  6874. tmp_export_symbols="$export_symbols"
  6875. test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
  6876. $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
  6877. fi
  6878. if test -n "$orig_export_symbols"; then
  6879. # The given exports_symbols file has to be filtered, so filter it.
  6880. func_verbose "filter symbol list for \`$libname.la' to tag DATA exports"
  6881. # FIXME: $output_objdir/$libname.filter potentially contains lots of
  6882. # 's' commands which not all seds can handle. GNU sed should be fine
  6883. # though. Also, the filter scales superlinearly with the number of
  6884. # global variables. join(1) would be nice here, but unfortunately
  6885. # isn't a blessed tool.
  6886. $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
  6887. delfiles="$delfiles $export_symbols $output_objdir/$libname.filter"
  6888. export_symbols=$output_objdir/$libname.def
  6889. $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
  6890. fi
  6891. fi
  6892. libobjs=$output
  6893. # Restore the value of output.
  6894. output=$save_output
  6895. if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
  6896. eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
  6897. test "X$libobjs" = "X " && libobjs=
  6898. fi
  6899. # Expand the library linking commands again to reset the
  6900. # value of $libobjs for piecewise linking.
  6901. # Do each of the archive commands.
  6902. if test "$module" = yes && test -n "$module_cmds" ; then
  6903. if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
  6904. cmds=$module_expsym_cmds
  6905. else
  6906. cmds=$module_cmds
  6907. fi
  6908. else
  6909. if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
  6910. cmds=$archive_expsym_cmds
  6911. else
  6912. cmds=$archive_cmds
  6913. fi
  6914. fi
  6915. fi
  6916. if test -n "$delfiles"; then
  6917. # Append the command to remove temporary files to $cmds.
  6918. eval cmds=\"\$cmds~\$RM $delfiles\"
  6919. fi
  6920. # Add any objects from preloaded convenience libraries
  6921. if test -n "$dlprefiles"; then
  6922. gentop="$output_objdir/${outputname}x"
  6923. generated="$generated $gentop"
  6924. func_extract_archives $gentop $dlprefiles
  6925. libobjs="$libobjs $func_extract_archives_result"
  6926. test "X$libobjs" = "X " && libobjs=
  6927. fi
  6928. save_ifs="$IFS"; IFS='~'
  6929. for cmd in $cmds; do
  6930. IFS="$save_ifs"
  6931. eval cmd=\"$cmd\"
  6932. $opt_silent || {
  6933. func_quote_for_expand "$cmd"
  6934. eval "func_echo $func_quote_for_expand_result"
  6935. }
  6936. $opt_dry_run || eval "$cmd" || {
  6937. lt_exit=$?
  6938. # Restore the uninstalled library and exit
  6939. if test "$mode" = relink; then
  6940. ( cd "$output_objdir" && \
  6941. $RM "${realname}T" && \
  6942. $MV "${realname}U" "$realname" )
  6943. fi
  6944. exit $lt_exit
  6945. }
  6946. done
  6947. IFS="$save_ifs"
  6948. # Restore the uninstalled library and exit
  6949. if test "$mode" = relink; then
  6950. $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $?
  6951. if test -n "$convenience"; then
  6952. if test -z "$whole_archive_flag_spec"; then
  6953. func_show_eval '${RM}r "$gentop"'
  6954. fi
  6955. fi
  6956. exit $EXIT_SUCCESS
  6957. fi
  6958. # Create links to the real library.
  6959. for linkname in $linknames; do
  6960. if test "$realname" != "$linkname"; then
  6961. func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?'
  6962. fi
  6963. done
  6964. # If -module or -export-dynamic was specified, set the dlname.
  6965. if test "$module" = yes || test "$export_dynamic" = yes; then
  6966. # On all known operating systems, these are identical.
  6967. dlname="$soname"
  6968. fi
  6969. fi
  6970. ;;
  6971. obj)
  6972. if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
  6973. func_warning "\`-dlopen' is ignored for objects"
  6974. fi
  6975. case " $deplibs" in
  6976. *\ -l* | *\ -L*)
  6977. func_warning "\`-l' and \`-L' are ignored for objects" ;;
  6978. esac
  6979. test -n "$rpath" && \
  6980. func_warning "\`-rpath' is ignored for objects"
  6981. test -n "$xrpath" && \
  6982. func_warning "\`-R' is ignored for objects"
  6983. test -n "$vinfo" && \
  6984. func_warning "\`-version-info' is ignored for objects"
  6985. test -n "$release" && \
  6986. func_warning "\`-release' is ignored for objects"
  6987. case $output in
  6988. *.lo)
  6989. test -n "$objs$old_deplibs" && \
  6990. func_fatal_error "cannot build library object \`$output' from non-libtool objects"
  6991. libobj=$output
  6992. func_lo2o "$libobj"
  6993. obj=$func_lo2o_result
  6994. ;;
  6995. *)
  6996. libobj=
  6997. obj="$output"
  6998. ;;
  6999. esac
  7000. # Delete the old objects.
  7001. $opt_dry_run || $RM $obj $libobj
  7002. # Objects from convenience libraries. This assumes
  7003. # single-version convenience libraries. Whenever we create
  7004. # different ones for PIC/non-PIC, this we'll have to duplicate
  7005. # the extraction.
  7006. reload_conv_objs=
  7007. gentop=
  7008. # reload_cmds runs $LD directly, so let us get rid of
  7009. # -Wl from whole_archive_flag_spec and hope we can get by with
  7010. # turning comma into space..
  7011. wl=
  7012. if test -n "$convenience"; then
  7013. if test -n "$whole_archive_flag_spec"; then
  7014. eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
  7015. reload_conv_objs=$reload_objs\ `$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'`
  7016. else
  7017. gentop="$output_objdir/${obj}x"
  7018. generated="$generated $gentop"
  7019. func_extract_archives $gentop $convenience
  7020. reload_conv_objs="$reload_objs $func_extract_archives_result"
  7021. fi
  7022. fi
  7023. # Create the old-style object.
  7024. reload_objs="$objs$old_deplibs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; /\.lib$/d; $lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test
  7025. output="$obj"
  7026. func_execute_cmds "$reload_cmds" 'exit $?'
  7027. # Exit if we aren't doing a library object file.
  7028. if test -z "$libobj"; then
  7029. if test -n "$gentop"; then
  7030. func_show_eval '${RM}r "$gentop"'
  7031. fi
  7032. exit $EXIT_SUCCESS
  7033. fi
  7034. if test "$build_libtool_libs" != yes; then
  7035. if test -n "$gentop"; then
  7036. func_show_eval '${RM}r "$gentop"'
  7037. fi
  7038. # Create an invalid libtool object if no PIC, so that we don't
  7039. # accidentally link it into a program.
  7040. # $show "echo timestamp > $libobj"
  7041. # $opt_dry_run || eval "echo timestamp > $libobj" || exit $?
  7042. exit $EXIT_SUCCESS
  7043. fi
  7044. if test -n "$pic_flag" || test "$pic_mode" != default; then
  7045. # Only do commands if we really have different PIC objects.
  7046. reload_objs="$libobjs $reload_conv_objs"
  7047. output="$libobj"
  7048. func_execute_cmds "$reload_cmds" 'exit $?'
  7049. fi
  7050. if test -n "$gentop"; then
  7051. func_show_eval '${RM}r "$gentop"'
  7052. fi
  7053. exit $EXIT_SUCCESS
  7054. ;;
  7055. prog)
  7056. case $host in
  7057. *cygwin*) func_stripname '' '.exe' "$output"
  7058. output=$func_stripname_result.exe;;
  7059. esac
  7060. test -n "$vinfo" && \
  7061. func_warning "\`-version-info' is ignored for programs"
  7062. test -n "$release" && \
  7063. func_warning "\`-release' is ignored for programs"
  7064. test "$preload" = yes \
  7065. && test "$dlopen_support" = unknown \
  7066. && test "$dlopen_self" = unknown \
  7067. && test "$dlopen_self_static" = unknown && \
  7068. func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support."
  7069. case $host in
  7070. *-*-rhapsody* | *-*-darwin1.[012])
  7071. # On Rhapsody replace the C library is the System framework
  7072. compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'`
  7073. finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'`
  7074. ;;
  7075. esac
  7076. case $host in
  7077. *-*-darwin*)
  7078. # Don't allow lazy linking, it breaks C++ global constructors
  7079. # But is supposedly fixed on 10.4 or later (yay!).
  7080. if test "$tagname" = CXX ; then
  7081. case ${MACOSX_DEPLOYMENT_TARGET-10.0} in
  7082. 10.[0123])
  7083. compile_command="$compile_command ${wl}-bind_at_load"
  7084. finalize_command="$finalize_command ${wl}-bind_at_load"
  7085. ;;
  7086. esac
  7087. fi
  7088. # Time to change all our "foo.ltframework" stuff back to "-framework foo"
  7089. compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
  7090. finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
  7091. ;;
  7092. esac
  7093. # move library search paths that coincide with paths to not yet
  7094. # installed libraries to the beginning of the library search list
  7095. new_libs=
  7096. for path in $notinst_path; do
  7097. case " $new_libs " in
  7098. *" -L$path/$objdir "*) ;;
  7099. *)
  7100. case " $compile_deplibs " in
  7101. *" -L$path/$objdir "*)
  7102. new_libs="$new_libs -L$path/$objdir" ;;
  7103. esac
  7104. ;;
  7105. esac
  7106. done
  7107. for deplib in $compile_deplibs; do
  7108. case $deplib in
  7109. -L*)
  7110. case " $new_libs " in
  7111. *" $deplib "*) ;;
  7112. *) new_libs="$new_libs $deplib" ;;
  7113. esac
  7114. ;;
  7115. *) new_libs="$new_libs $deplib" ;;
  7116. esac
  7117. done
  7118. compile_deplibs="$new_libs"
  7119. compile_command="$compile_command $compile_deplibs"
  7120. finalize_command="$finalize_command $finalize_deplibs"
  7121. if test -n "$rpath$xrpath"; then
  7122. # If the user specified any rpath flags, then add them.
  7123. for libdir in $rpath $xrpath; do
  7124. # This is the magic to use -rpath.
  7125. case "$finalize_rpath " in
  7126. *" $libdir "*) ;;
  7127. *) finalize_rpath="$finalize_rpath $libdir" ;;
  7128. esac
  7129. done
  7130. fi
  7131. # Now hardcode the library paths
  7132. rpath=
  7133. hardcode_libdirs=
  7134. for libdir in $compile_rpath $finalize_rpath; do
  7135. if test -n "$hardcode_libdir_flag_spec"; then
  7136. if test -n "$hardcode_libdir_separator"; then
  7137. if test -z "$hardcode_libdirs"; then
  7138. hardcode_libdirs="$libdir"
  7139. else
  7140. # Just accumulate the unique libdirs.
  7141. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
  7142. *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
  7143. ;;
  7144. *)
  7145. hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
  7146. ;;
  7147. esac
  7148. fi
  7149. else
  7150. eval flag=\"$hardcode_libdir_flag_spec\"
  7151. rpath="$rpath $flag"
  7152. fi
  7153. elif test -n "$runpath_var"; then
  7154. case "$perm_rpath " in
  7155. *" $libdir "*) ;;
  7156. *) perm_rpath="$perm_rpath $libdir" ;;
  7157. esac
  7158. fi
  7159. case $host in
  7160. *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
  7161. testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'`
  7162. case :$dllsearchpath: in
  7163. *":$libdir:"*) ;;
  7164. ::) dllsearchpath=$libdir;;
  7165. *) dllsearchpath="$dllsearchpath:$libdir";;
  7166. esac
  7167. case :$dllsearchpath: in
  7168. *":$testbindir:"*) ;;
  7169. ::) dllsearchpath=$testbindir;;
  7170. *) dllsearchpath="$dllsearchpath:$testbindir";;
  7171. esac
  7172. ;;
  7173. esac
  7174. done
  7175. # Substitute the hardcoded libdirs into the rpath.
  7176. if test -n "$hardcode_libdir_separator" &&
  7177. test -n "$hardcode_libdirs"; then
  7178. libdir="$hardcode_libdirs"
  7179. eval rpath=\" $hardcode_libdir_flag_spec\"
  7180. fi
  7181. compile_rpath="$rpath"
  7182. rpath=
  7183. hardcode_libdirs=
  7184. for libdir in $finalize_rpath; do
  7185. if test -n "$hardcode_libdir_flag_spec"; then
  7186. if test -n "$hardcode_libdir_separator"; then
  7187. if test -z "$hardcode_libdirs"; then
  7188. hardcode_libdirs="$libdir"
  7189. else
  7190. # Just accumulate the unique libdirs.
  7191. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
  7192. *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
  7193. ;;
  7194. *)
  7195. hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
  7196. ;;
  7197. esac
  7198. fi
  7199. else
  7200. eval flag=\"$hardcode_libdir_flag_spec\"
  7201. rpath="$rpath $flag"
  7202. fi
  7203. elif test -n "$runpath_var"; then
  7204. case "$finalize_perm_rpath " in
  7205. *" $libdir "*) ;;
  7206. *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
  7207. esac
  7208. fi
  7209. done
  7210. # Substitute the hardcoded libdirs into the rpath.
  7211. if test -n "$hardcode_libdir_separator" &&
  7212. test -n "$hardcode_libdirs"; then
  7213. libdir="$hardcode_libdirs"
  7214. eval rpath=\" $hardcode_libdir_flag_spec\"
  7215. fi
  7216. finalize_rpath="$rpath"
  7217. if test -n "$libobjs" && test "$build_old_libs" = yes; then
  7218. # Transform all the library objects into standard objects.
  7219. compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
  7220. finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
  7221. fi
  7222. func_generate_dlsyms "$outputname" "@PROGRAM@" "no"
  7223. # template prelinking step
  7224. if test -n "$prelink_cmds"; then
  7225. func_execute_cmds "$prelink_cmds" 'exit $?'
  7226. fi
  7227. wrappers_required=yes
  7228. case $host in
  7229. *cegcc* | *mingw32ce*)
  7230. # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway.
  7231. wrappers_required=no
  7232. ;;
  7233. *cygwin* | *mingw* )
  7234. if test "$build_libtool_libs" != yes; then
  7235. wrappers_required=no
  7236. fi
  7237. ;;
  7238. *)
  7239. if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
  7240. wrappers_required=no
  7241. fi
  7242. ;;
  7243. esac
  7244. if test "$wrappers_required" = no; then
  7245. # Replace the output file specification.
  7246. compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
  7247. link_command="$compile_command$compile_rpath"
  7248. # We have no uninstalled library dependencies, so finalize right now.
  7249. exit_status=0
  7250. func_show_eval "$link_command" 'exit_status=$?'
  7251. # Delete the generated files.
  7252. if test -f "$output_objdir/${outputname}S.${objext}"; then
  7253. func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"'
  7254. fi
  7255. exit $exit_status
  7256. fi
  7257. if test -n "$compile_shlibpath$finalize_shlibpath"; then
  7258. compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
  7259. fi
  7260. if test -n "$finalize_shlibpath"; then
  7261. finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
  7262. fi
  7263. compile_var=
  7264. finalize_var=
  7265. if test -n "$runpath_var"; then
  7266. if test -n "$perm_rpath"; then
  7267. # We should set the runpath_var.
  7268. rpath=
  7269. for dir in $perm_rpath; do
  7270. rpath="$rpath$dir:"
  7271. done
  7272. compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
  7273. fi
  7274. if test -n "$finalize_perm_rpath"; then
  7275. # We should set the runpath_var.
  7276. rpath=
  7277. for dir in $finalize_perm_rpath; do
  7278. rpath="$rpath$dir:"
  7279. done
  7280. finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
  7281. fi
  7282. fi
  7283. if test "$no_install" = yes; then
  7284. # We don't need to create a wrapper script.
  7285. link_command="$compile_var$compile_command$compile_rpath"
  7286. # Replace the output file specification.
  7287. link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
  7288. # Delete the old output file.
  7289. $opt_dry_run || $RM $output
  7290. # Link the executable and exit
  7291. func_show_eval "$link_command" 'exit $?'
  7292. exit $EXIT_SUCCESS
  7293. fi
  7294. if test "$hardcode_action" = relink; then
  7295. # Fast installation is not supported
  7296. link_command="$compile_var$compile_command$compile_rpath"
  7297. relink_command="$finalize_var$finalize_command$finalize_rpath"
  7298. func_warning "this platform does not like uninstalled shared libraries"
  7299. func_warning "\`$output' will be relinked during installation"
  7300. else
  7301. if test "$fast_install" != no; then
  7302. link_command="$finalize_var$compile_command$finalize_rpath"
  7303. if test "$fast_install" = yes; then
  7304. relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'`
  7305. else
  7306. # fast_install is set to needless
  7307. relink_command=
  7308. fi
  7309. else
  7310. link_command="$compile_var$compile_command$compile_rpath"
  7311. relink_command="$finalize_var$finalize_command$finalize_rpath"
  7312. fi
  7313. fi
  7314. # Replace the output file specification.
  7315. link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
  7316. # Delete the old output files.
  7317. $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname
  7318. func_show_eval "$link_command" 'exit $?'
  7319. # Now create the wrapper script.
  7320. func_verbose "creating $output"
  7321. # Quote the relink command for shipping.
  7322. if test -n "$relink_command"; then
  7323. # Preserve any variables that may affect compiler behavior
  7324. for var in $variables_saved_for_relink; do
  7325. if eval test -z \"\${$var+set}\"; then
  7326. relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
  7327. elif eval var_value=\$$var; test -z "$var_value"; then
  7328. relink_command="$var=; export $var; $relink_command"
  7329. else
  7330. func_quote_for_eval "$var_value"
  7331. relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
  7332. fi
  7333. done
  7334. relink_command="(cd `pwd`; $relink_command)"
  7335. relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
  7336. fi
  7337. # Only actually do things if not in dry run mode.
  7338. $opt_dry_run || {
  7339. # win32 will think the script is a binary if it has
  7340. # a .exe suffix, so we strip it off here.
  7341. case $output in
  7342. *.exe) func_stripname '' '.exe' "$output"
  7343. output=$func_stripname_result ;;
  7344. esac
  7345. # test for cygwin because mv fails w/o .exe extensions
  7346. case $host in
  7347. *cygwin*)
  7348. exeext=.exe
  7349. func_stripname '' '.exe' "$outputname"
  7350. outputname=$func_stripname_result ;;
  7351. *) exeext= ;;
  7352. esac
  7353. case $host in
  7354. *cygwin* | *mingw* )
  7355. func_dirname_and_basename "$output" "" "."
  7356. output_name=$func_basename_result
  7357. output_path=$func_dirname_result
  7358. cwrappersource="$output_path/$objdir/lt-$output_name.c"
  7359. cwrapper="$output_path/$output_name.exe"
  7360. $RM $cwrappersource $cwrapper
  7361. trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
  7362. func_emit_cwrapperexe_src > $cwrappersource
  7363. # The wrapper executable is built using the $host compiler,
  7364. # because it contains $host paths and files. If cross-
  7365. # compiling, it, like the target executable, must be
  7366. # executed on the $host or under an emulation environment.
  7367. $opt_dry_run || {
  7368. $LTCC $LTCFLAGS -o $cwrapper $cwrappersource
  7369. $STRIP $cwrapper
  7370. }
  7371. # Now, create the wrapper script for func_source use:
  7372. func_ltwrapper_scriptname $cwrapper
  7373. $RM $func_ltwrapper_scriptname_result
  7374. trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15
  7375. $opt_dry_run || {
  7376. # note: this script will not be executed, so do not chmod.
  7377. if test "x$build" = "x$host" ; then
  7378. $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result
  7379. else
  7380. func_emit_wrapper no > $func_ltwrapper_scriptname_result
  7381. fi
  7382. }
  7383. ;;
  7384. * )
  7385. $RM $output
  7386. trap "$RM $output; exit $EXIT_FAILURE" 1 2 15
  7387. func_emit_wrapper no > $output
  7388. chmod +x $output
  7389. ;;
  7390. esac
  7391. }
  7392. exit $EXIT_SUCCESS
  7393. ;;
  7394. esac
  7395. # See if we need to build an old-fashioned archive.
  7396. for oldlib in $oldlibs; do
  7397. if test "$build_libtool_libs" = convenience; then
  7398. oldobjs="$libobjs_save $symfileobj"
  7399. addlibs="$convenience"
  7400. build_libtool_libs=no
  7401. else
  7402. if test "$build_libtool_libs" = module; then
  7403. oldobjs="$libobjs_save"
  7404. build_libtool_libs=no
  7405. else
  7406. oldobjs="$old_deplibs $non_pic_objects"
  7407. if test "$preload" = yes && test -f "$symfileobj"; then
  7408. oldobjs="$oldobjs $symfileobj"
  7409. fi
  7410. fi
  7411. addlibs="$old_convenience"
  7412. fi
  7413. if test -n "$addlibs"; then
  7414. gentop="$output_objdir/${outputname}x"
  7415. generated="$generated $gentop"
  7416. func_extract_archives $gentop $addlibs
  7417. oldobjs="$oldobjs $func_extract_archives_result"
  7418. fi
  7419. # Do each command in the archive commands.
  7420. if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
  7421. cmds=$old_archive_from_new_cmds
  7422. else
  7423. # Add any objects from preloaded convenience libraries
  7424. if test -n "$dlprefiles"; then
  7425. gentop="$output_objdir/${outputname}x"
  7426. generated="$generated $gentop"
  7427. func_extract_archives $gentop $dlprefiles
  7428. oldobjs="$oldobjs $func_extract_archives_result"
  7429. fi
  7430. # POSIX demands no paths to be encoded in archives. We have
  7431. # to avoid creating archives with duplicate basenames if we
  7432. # might have to extract them afterwards, e.g., when creating a
  7433. # static archive out of a convenience library, or when linking
  7434. # the entirety of a libtool archive into another (currently
  7435. # not supported by libtool).
  7436. if (for obj in $oldobjs
  7437. do
  7438. func_basename "$obj"
  7439. $ECHO "$func_basename_result"
  7440. done | sort | sort -uc >/dev/null 2>&1); then
  7441. :
  7442. else
  7443. echo "copying selected object files to avoid basename conflicts..."
  7444. gentop="$output_objdir/${outputname}x"
  7445. generated="$generated $gentop"
  7446. func_mkdir_p "$gentop"
  7447. save_oldobjs=$oldobjs
  7448. oldobjs=
  7449. counter=1
  7450. for obj in $save_oldobjs
  7451. do
  7452. func_basename "$obj"
  7453. objbase="$func_basename_result"
  7454. case " $oldobjs " in
  7455. " ") oldobjs=$obj ;;
  7456. *[\ /]"$objbase "*)
  7457. while :; do
  7458. # Make sure we don't pick an alternate name that also
  7459. # overlaps.
  7460. newobj=lt$counter-$objbase
  7461. func_arith $counter + 1
  7462. counter=$func_arith_result
  7463. case " $oldobjs " in
  7464. *[\ /]"$newobj "*) ;;
  7465. *) if test ! -f "$gentop/$newobj"; then break; fi ;;
  7466. esac
  7467. done
  7468. func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
  7469. oldobjs="$oldobjs $gentop/$newobj"
  7470. ;;
  7471. *) oldobjs="$oldobjs $obj" ;;
  7472. esac
  7473. done
  7474. fi
  7475. eval cmds=\"$old_archive_cmds\"
  7476. func_len " $cmds"
  7477. len=$func_len_result
  7478. if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
  7479. cmds=$old_archive_cmds
  7480. else
  7481. # the command line is too long to link in one step, link in parts
  7482. func_verbose "using piecewise archive linking..."
  7483. save_RANLIB=$RANLIB
  7484. RANLIB=:
  7485. objlist=
  7486. concat_cmds=
  7487. save_oldobjs=$oldobjs
  7488. oldobjs=
  7489. # Is there a better way of finding the last object in the list?
  7490. for obj in $save_oldobjs
  7491. do
  7492. last_oldobj=$obj
  7493. done
  7494. eval test_cmds=\"$old_archive_cmds\"
  7495. func_len " $test_cmds"
  7496. len0=$func_len_result
  7497. len=$len0
  7498. for obj in $save_oldobjs
  7499. do
  7500. func_len " $obj"
  7501. func_arith $len + $func_len_result
  7502. len=$func_arith_result
  7503. func_append objlist " $obj"
  7504. if test "$len" -lt "$max_cmd_len"; then
  7505. :
  7506. else
  7507. # the above command should be used before it gets too long
  7508. oldobjs=$objlist
  7509. if test "$obj" = "$last_oldobj" ; then
  7510. RANLIB=$save_RANLIB
  7511. fi
  7512. test -z "$concat_cmds" || concat_cmds=$concat_cmds~
  7513. eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
  7514. objlist=
  7515. len=$len0
  7516. fi
  7517. done
  7518. RANLIB=$save_RANLIB
  7519. oldobjs=$objlist
  7520. if test "X$oldobjs" = "X" ; then
  7521. eval cmds=\"\$concat_cmds\"
  7522. else
  7523. eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
  7524. fi
  7525. fi
  7526. fi
  7527. func_execute_cmds "$cmds" 'exit $?'
  7528. done
  7529. test -n "$generated" && \
  7530. func_show_eval "${RM}r$generated"
  7531. # Now create the libtool archive.
  7532. case $output in
  7533. *.la)
  7534. old_library=
  7535. test "$build_old_libs" = yes && old_library="$libname.$libext"
  7536. func_verbose "creating $output"
  7537. # Preserve any variables that may affect compiler behavior
  7538. for var in $variables_saved_for_relink; do
  7539. if eval test -z \"\${$var+set}\"; then
  7540. relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
  7541. elif eval var_value=\$$var; test -z "$var_value"; then
  7542. relink_command="$var=; export $var; $relink_command"
  7543. else
  7544. func_quote_for_eval "$var_value"
  7545. relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
  7546. fi
  7547. done
  7548. # Quote the link command for shipping.
  7549. relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
  7550. relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
  7551. if test "$hardcode_automatic" = yes ; then
  7552. relink_command=
  7553. fi
  7554. # Only create the output if not a dry run.
  7555. $opt_dry_run || {
  7556. for installed in no yes; do
  7557. if test "$installed" = yes; then
  7558. if test -z "$install_libdir"; then
  7559. break
  7560. fi
  7561. output="$output_objdir/$outputname"i
  7562. # Replace all uninstalled libtool libraries with the installed ones
  7563. newdependency_libs=
  7564. for deplib in $dependency_libs; do
  7565. case $deplib in
  7566. *.la)
  7567. func_basename "$deplib"
  7568. name="$func_basename_result"
  7569. eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
  7570. test -z "$libdir" && \
  7571. func_fatal_error "\`$deplib' is not a valid libtool archive"
  7572. newdependency_libs="$newdependency_libs $libdir/$name"
  7573. ;;
  7574. *) newdependency_libs="$newdependency_libs $deplib" ;;
  7575. esac
  7576. done
  7577. dependency_libs="$newdependency_libs"
  7578. newdlfiles=
  7579. for lib in $dlfiles; do
  7580. case $lib in
  7581. *.la)
  7582. func_basename "$lib"
  7583. name="$func_basename_result"
  7584. eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
  7585. test -z "$libdir" && \
  7586. func_fatal_error "\`$lib' is not a valid libtool archive"
  7587. newdlfiles="$newdlfiles $libdir/$name"
  7588. ;;
  7589. *) newdlfiles="$newdlfiles $lib" ;;
  7590. esac
  7591. done
  7592. dlfiles="$newdlfiles"
  7593. newdlprefiles=
  7594. for lib in $dlprefiles; do
  7595. case $lib in
  7596. *.la)
  7597. # Only pass preopened files to the pseudo-archive (for
  7598. # eventual linking with the app. that links it) if we
  7599. # didn't already link the preopened objects directly into
  7600. # the library:
  7601. func_basename "$lib"
  7602. name="$func_basename_result"
  7603. eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
  7604. test -z "$libdir" && \
  7605. func_fatal_error "\`$lib' is not a valid libtool archive"
  7606. newdlprefiles="$newdlprefiles $libdir/$name"
  7607. ;;
  7608. esac
  7609. done
  7610. dlprefiles="$newdlprefiles"
  7611. else
  7612. newdlfiles=
  7613. for lib in $dlfiles; do
  7614. case $lib in
  7615. [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
  7616. *) abs=`pwd`"/$lib" ;;
  7617. esac
  7618. newdlfiles="$newdlfiles $abs"
  7619. done
  7620. dlfiles="$newdlfiles"
  7621. newdlprefiles=
  7622. for lib in $dlprefiles; do
  7623. case $lib in
  7624. [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
  7625. *) abs=`pwd`"/$lib" ;;
  7626. esac
  7627. newdlprefiles="$newdlprefiles $abs"
  7628. done
  7629. dlprefiles="$newdlprefiles"
  7630. fi
  7631. $RM $output
  7632. # place dlname in correct position for cygwin
  7633. # In fact, it would be nice if we could use this code for all target
  7634. # systems that can't hard-code library paths into their executables
  7635. # and that have no shared library path variable independent of PATH,
  7636. # but it turns out we can't easily determine that from inspecting
  7637. # libtool variables, so we have to hard-code the OSs to which it
  7638. # applies here; at the moment, that means platforms that use the PE
  7639. # object format with DLL files. See the long comment at the top of
  7640. # tests/bindir.at for full details.
  7641. tdlname=$dlname
  7642. case $host,$output,$installed,$module,$dlname in
  7643. *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll)
  7644. # If a -bindir argument was supplied, place the dll there.
  7645. if test "x$bindir" != x ;
  7646. then
  7647. func_relative_path "$install_libdir" "$bindir"
  7648. tdlname=$func_relative_path_result$dlname
  7649. else
  7650. # Otherwise fall back on heuristic.
  7651. tdlname=../bin/$dlname
  7652. fi
  7653. ;;
  7654. esac
  7655. $ECHO > $output "\
  7656. # $outputname - a libtool library file
  7657. # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
  7658. #
  7659. # Please DO NOT delete this file!
  7660. # It is necessary for linking the library.
  7661. # The name that we can dlopen(3).
  7662. dlname='$tdlname'
  7663. # Names of this library.
  7664. library_names='$library_names'
  7665. # The name of the static archive.
  7666. old_library='$old_library'
  7667. # Linker flags that can not go in dependency_libs.
  7668. inherited_linker_flags='$new_inherited_linker_flags'
  7669. # Libraries that this one depends upon.
  7670. dependency_libs='$dependency_libs'
  7671. # Names of additional weak libraries provided by this library
  7672. weak_library_names='$weak_libs'
  7673. # Version information for $libname.
  7674. current=$current
  7675. age=$age
  7676. revision=$revision
  7677. # Is this an already installed library?
  7678. installed=$installed
  7679. # Should we warn about portability when linking against -modules?
  7680. shouldnotlink=$module
  7681. # Files to dlopen/dlpreopen
  7682. dlopen='$dlfiles'
  7683. dlpreopen='$dlprefiles'
  7684. # Directory that this library needs to be installed in:
  7685. libdir='$install_libdir'"
  7686. if test "$installed" = no && test "$need_relink" = yes; then
  7687. $ECHO >> $output "\
  7688. relink_command=\"$relink_command\""
  7689. fi
  7690. done
  7691. }
  7692. # Do a symbolic link so that the libtool archive can be found in
  7693. # LD_LIBRARY_PATH before the program is installed.
  7694. func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?'
  7695. ;;
  7696. esac
  7697. exit $EXIT_SUCCESS
  7698. }
  7699. { test "$mode" = link || test "$mode" = relink; } &&
  7700. func_mode_link ${1+"$@"}
  7701. # func_mode_uninstall arg...
  7702. func_mode_uninstall ()
  7703. {
  7704. $opt_debug
  7705. RM="$nonopt"
  7706. files=
  7707. rmforce=
  7708. exit_status=0
  7709. # This variable tells wrapper scripts just to set variables rather
  7710. # than running their programs.
  7711. libtool_install_magic="$magic"
  7712. for arg
  7713. do
  7714. case $arg in
  7715. -f) RM="$RM $arg"; rmforce=yes ;;
  7716. -*) RM="$RM $arg" ;;
  7717. *) files="$files $arg" ;;
  7718. esac
  7719. done
  7720. test -z "$RM" && \
  7721. func_fatal_help "you must specify an RM program"
  7722. rmdirs=
  7723. origobjdir="$objdir"
  7724. for file in $files; do
  7725. func_dirname "$file" "" "."
  7726. dir="$func_dirname_result"
  7727. if test "X$dir" = X.; then
  7728. objdir="$origobjdir"
  7729. else
  7730. objdir="$dir/$origobjdir"
  7731. fi
  7732. func_basename "$file"
  7733. name="$func_basename_result"
  7734. test "$mode" = uninstall && objdir="$dir"
  7735. # Remember objdir for removal later, being careful to avoid duplicates
  7736. if test "$mode" = clean; then
  7737. case " $rmdirs " in
  7738. *" $objdir "*) ;;
  7739. *) rmdirs="$rmdirs $objdir" ;;
  7740. esac
  7741. fi
  7742. # Don't error if the file doesn't exist and rm -f was used.
  7743. if { test -L "$file"; } >/dev/null 2>&1 ||
  7744. { test -h "$file"; } >/dev/null 2>&1 ||
  7745. test -f "$file"; then
  7746. :
  7747. elif test -d "$file"; then
  7748. exit_status=1
  7749. continue
  7750. elif test "$rmforce" = yes; then
  7751. continue
  7752. fi
  7753. rmfiles="$file"
  7754. case $name in
  7755. *.la)
  7756. # Possibly a libtool archive, so verify it.
  7757. if func_lalib_p "$file"; then
  7758. func_source $dir/$name
  7759. # Delete the libtool libraries and symlinks.
  7760. for n in $library_names; do
  7761. rmfiles="$rmfiles $objdir/$n"
  7762. done
  7763. test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
  7764. case "$mode" in
  7765. clean)
  7766. case " $library_names " in
  7767. # " " in the beginning catches empty $dlname
  7768. *" $dlname "*) ;;
  7769. *) rmfiles="$rmfiles $objdir/$dlname" ;;
  7770. esac
  7771. test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
  7772. ;;
  7773. uninstall)
  7774. if test -n "$library_names"; then
  7775. # Do each command in the postuninstall commands.
  7776. func_execute_cmds "$postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
  7777. fi
  7778. if test -n "$old_library"; then
  7779. # Do each command in the old_postuninstall commands.
  7780. func_execute_cmds "$old_postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
  7781. fi
  7782. # FIXME: should reinstall the best remaining shared library.
  7783. ;;
  7784. esac
  7785. fi
  7786. ;;
  7787. *.lo)
  7788. # Possibly a libtool object, so verify it.
  7789. if func_lalib_p "$file"; then
  7790. # Read the .lo file
  7791. func_source $dir/$name
  7792. # Add PIC object to the list of files to remove.
  7793. if test -n "$pic_object" &&
  7794. test "$pic_object" != none; then
  7795. rmfiles="$rmfiles $dir/$pic_object"
  7796. fi
  7797. # Add non-PIC object to the list of files to remove.
  7798. if test -n "$non_pic_object" &&
  7799. test "$non_pic_object" != none; then
  7800. rmfiles="$rmfiles $dir/$non_pic_object"
  7801. fi
  7802. fi
  7803. ;;
  7804. *)
  7805. if test "$mode" = clean ; then
  7806. noexename=$name
  7807. case $file in
  7808. *.exe)
  7809. func_stripname '' '.exe' "$file"
  7810. file=$func_stripname_result
  7811. func_stripname '' '.exe' "$name"
  7812. noexename=$func_stripname_result
  7813. # $file with .exe has already been added to rmfiles,
  7814. # add $file without .exe
  7815. rmfiles="$rmfiles $file"
  7816. ;;
  7817. esac
  7818. # Do a test to see if this is a libtool program.
  7819. if func_ltwrapper_p "$file"; then
  7820. if func_ltwrapper_executable_p "$file"; then
  7821. func_ltwrapper_scriptname "$file"
  7822. relink_command=
  7823. func_source $func_ltwrapper_scriptname_result
  7824. rmfiles="$rmfiles $func_ltwrapper_scriptname_result"
  7825. else
  7826. relink_command=
  7827. func_source $dir/$noexename
  7828. fi
  7829. # note $name still contains .exe if it was in $file originally
  7830. # as does the version of $file that was added into $rmfiles
  7831. rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
  7832. if test "$fast_install" = yes && test -n "$relink_command"; then
  7833. rmfiles="$rmfiles $objdir/lt-$name"
  7834. fi
  7835. if test "X$noexename" != "X$name" ; then
  7836. rmfiles="$rmfiles $objdir/lt-${noexename}.c"
  7837. fi
  7838. fi
  7839. fi
  7840. ;;
  7841. esac
  7842. func_show_eval "$RM $rmfiles" 'exit_status=1'
  7843. done
  7844. objdir="$origobjdir"
  7845. # Try to remove the ${objdir}s in the directories where we deleted files
  7846. for dir in $rmdirs; do
  7847. if test -d "$dir"; then
  7848. func_show_eval "rmdir $dir >/dev/null 2>&1"
  7849. fi
  7850. done
  7851. exit $exit_status
  7852. }
  7853. { test "$mode" = uninstall || test "$mode" = clean; } &&
  7854. func_mode_uninstall ${1+"$@"}
  7855. test -z "$mode" && {
  7856. help="$generic_help"
  7857. func_fatal_help "you must specify a MODE"
  7858. }
  7859. test -z "$exec_cmd" && \
  7860. func_fatal_help "invalid operation mode \`$mode'"
  7861. if test -n "$exec_cmd"; then
  7862. eval exec "$exec_cmd"
  7863. exit $EXIT_FAILURE
  7864. fi
  7865. exit $exit_status
  7866. # The TAGs below are defined such that we never get into a situation
  7867. # in which we disable both kinds of libraries. Given conflicting
  7868. # choices, we go for a static library, that is the most portable,
  7869. # since we can't tell whether shared libraries were disabled because
  7870. # the user asked for that or because the platform doesn't support
  7871. # them. This is particularly important on AIX, because we don't
  7872. # support having both static and shared libraries enabled at the same
  7873. # time on that platform, so we default to a shared-only configuration.
  7874. # If a disable-shared tag is given, we'll fallback to a static-only
  7875. # configuration. But we'll never go from static-only to shared-only.
  7876. # ### BEGIN LIBTOOL TAG CONFIG: disable-shared
  7877. build_libtool_libs=no
  7878. build_old_libs=yes
  7879. # ### END LIBTOOL TAG CONFIG: disable-shared
  7880. # ### BEGIN LIBTOOL TAG CONFIG: disable-static
  7881. build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
  7882. # ### END LIBTOOL TAG CONFIG: disable-static
  7883. # Local Variables:
  7884. # mode:shell-script
  7885. # sh-indentation:2
  7886. # End:
  7887. # vi:sw=2