GCC with OpenMP stream-computing extension and BatchQueue algorithm
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ltmain.sh 244KB

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