ltmain.sh 179 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419
  1. # ltmain.sh - Provide generalized library-building support services.
  2. # NOTE: Changing this file will not affect anything until you rerun configure.
  3. #
  4. # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004
  5. # Free Software Foundation, Inc.
  6. # Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
  7. #
  8. # This program 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. # This program is distributed in the hope that it will be useful, but
  14. # WITHOUT ANY WARRANTY; without even the implied warranty of
  15. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  16. # General Public License for more details.
  17. #
  18. # You should have received a copy of the GNU General Public License
  19. # along with this program; if not, write to the Free Software
  20. # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  21. #
  22. # As a special exception to the GNU General Public License, if you
  23. # distribute this file as part of a program that contains a
  24. # configuration script generated by Autoconf, you may include it under
  25. # the same distribution terms that you use for the rest of that program.
  26. basename="s,^.*/,,g"
  27. # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
  28. # is ksh but when the shell is invoked as "sh" and the current value of
  29. # the _XPG environment variable is not equal to 1 (one), the special
  30. # positional parameter $0, within a function call, is the name of the
  31. # function.
  32. progpath="$0"
  33. # The name of this program:
  34. progname=`echo "$progpath" | $SED $basename`
  35. modename="$progname"
  36. # Global variables:
  37. EXIT_SUCCESS=0
  38. EXIT_FAILURE=1
  39. PROGRAM=ltmain.sh
  40. PACKAGE=libtool
  41. VERSION=1.5.10
  42. TIMESTAMP=" (1.1220.2.130 2004/09/19 12:13:49)"
  43. # See if we are running on zsh, and set the options which allow our
  44. # commands through without removal of \ escapes.
  45. if test -n "${ZSH_VERSION+set}" ; then
  46. setopt NO_GLOB_SUBST
  47. fi
  48. # Check that we have a working $echo.
  49. if test "X$1" = X--no-reexec; then
  50. # Discard the --no-reexec flag, and continue.
  51. shift
  52. elif test "X$1" = X--fallback-echo; then
  53. # Avoid inline document here, it may be left over
  54. :
  55. elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
  56. # Yippee, $echo works!
  57. :
  58. else
  59. # Restart under the correct shell, and then maybe $echo will work.
  60. exec $SHELL "$progpath" --no-reexec ${1+"$@"}
  61. fi
  62. if test "X$1" = X--fallback-echo; then
  63. # used as fallback echo
  64. shift
  65. cat <<EOF
  66. $*
  67. EOF
  68. exit $EXIT_SUCCESS
  69. fi
  70. default_mode=
  71. help="Try \`$progname --help' for more information."
  72. magic="%%%MAGIC variable%%%"
  73. mkdir="mkdir"
  74. mv="mv -f"
  75. rm="rm -f"
  76. # Sed substitution that helps us do robust quoting. It backslashifies
  77. # metacharacters that are still active within double-quoted strings.
  78. Xsed="${SED}"' -e 1s/^X//'
  79. sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
  80. # test EBCDIC or ASCII
  81. case `echo A|tr A '\301'` in
  82. A) # EBCDIC based system
  83. SP2NL="tr '\100' '\n'"
  84. NL2SP="tr '\r\n' '\100\100'"
  85. ;;
  86. *) # Assume ASCII based system
  87. SP2NL="tr '\040' '\012'"
  88. NL2SP="tr '\015\012' '\040\040'"
  89. ;;
  90. esac
  91. # NLS nuisances.
  92. # Only set LANG and LC_ALL to C if already set.
  93. # These must not be set unconditionally because not all systems understand
  94. # e.g. LANG=C (notably SCO).
  95. # We save the old values to restore during execute mode.
  96. if test "${LC_ALL+set}" = set; then
  97. save_LC_ALL="$LC_ALL"; LC_ALL=C; export LC_ALL
  98. fi
  99. if test "${LANG+set}" = set; then
  100. save_LANG="$LANG"; LANG=C; export LANG
  101. fi
  102. # Make sure IFS has a sensible default
  103. : ${IFS="
  104. "}
  105. if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
  106. $echo "$modename: not configured to build any kind of library" 1>&2
  107. $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
  108. exit $EXIT_FAILURE
  109. fi
  110. # Global variables.
  111. mode=$default_mode
  112. nonopt=
  113. prev=
  114. prevopt=
  115. run=
  116. show="$echo"
  117. show_help=
  118. execute_dlfiles=
  119. lo2o="s/\\.lo\$/.${objext}/"
  120. o2lo="s/\\.${objext}\$/.lo/"
  121. #####################################
  122. # Shell function definitions:
  123. # This seems to be the best place for them
  124. # func_win32_libid arg
  125. # return the library type of file 'arg'
  126. #
  127. # Need a lot of goo to handle *both* DLLs and import libs
  128. # Has to be a shell function in order to 'eat' the argument
  129. # that is supplied when $file_magic_command is called.
  130. func_win32_libid () {
  131. win32_libid_type="unknown"
  132. win32_fileres=`file -L $1 2>/dev/null`
  133. case $win32_fileres in
  134. *ar\ archive\ import\ library*) # definitely import
  135. win32_libid_type="x86 archive import"
  136. ;;
  137. *ar\ archive*) # could be an import, or static
  138. if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \
  139. $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
  140. win32_nmres=`eval $NM -f posix -A $1 | \
  141. sed -n -e '1,100{/ I /{x;/import/!{s/^/import/;h;p;};x;};}'`
  142. if test "X$win32_nmres" = "Ximport" ; then
  143. win32_libid_type="x86 archive import"
  144. else
  145. win32_libid_type="x86 archive static"
  146. fi
  147. fi
  148. ;;
  149. *DLL*)
  150. win32_libid_type="x86 DLL"
  151. ;;
  152. *executable*) # but shell scripts are "executable" too...
  153. case $win32_fileres in
  154. *MS\ Windows\ PE\ Intel*)
  155. win32_libid_type="x86 DLL"
  156. ;;
  157. esac
  158. ;;
  159. esac
  160. $echo $win32_libid_type
  161. }
  162. # func_infer_tag arg
  163. # Infer tagged configuration to use if any are available and
  164. # if one wasn't chosen via the "--tag" command line option.
  165. # Only attempt this if the compiler in the base compile
  166. # command doesn't match the default compiler.
  167. # arg is usually of the form 'gcc ...'
  168. func_infer_tag () {
  169. if test -n "$available_tags" && test -z "$tagname"; then
  170. CC_quoted=
  171. for arg in $CC; do
  172. case $arg in
  173. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
  174. arg="\"$arg\""
  175. ;;
  176. esac
  177. CC_quoted="$CC_quoted $arg"
  178. done
  179. case $@ in
  180. # Blanks in the command may have been stripped by the calling shell,
  181. # but not from the CC environment variable when configure was run.
  182. " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;;
  183. # Blanks at the start of $base_compile will cause this to fail
  184. # if we don't check for them as well.
  185. *)
  186. for z in $available_tags; do
  187. if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
  188. # Evaluate the configuration.
  189. eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
  190. CC_quoted=
  191. for arg in $CC; do
  192. # Double-quote args containing other shell metacharacters.
  193. case $arg in
  194. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
  195. arg="\"$arg\""
  196. ;;
  197. esac
  198. CC_quoted="$CC_quoted $arg"
  199. done
  200. case "$@ " in
  201. " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*)
  202. # The compiler in the base compile command matches
  203. # the one in the tagged configuration.
  204. # Assume this is the tagged configuration we want.
  205. tagname=$z
  206. break
  207. ;;
  208. esac
  209. fi
  210. done
  211. # If $tagname still isn't set, then no tagged configuration
  212. # was found and let the user know that the "--tag" command
  213. # line option must be used.
  214. if test -z "$tagname"; then
  215. $echo "$modename: unable to infer tagged configuration"
  216. $echo "$modename: specify a tag with \`--tag'" 1>&2
  217. exit $EXIT_FAILURE
  218. # else
  219. # $echo "$modename: using $tagname tagged configuration"
  220. fi
  221. ;;
  222. esac
  223. fi
  224. }
  225. # func_extract_archives gentop oldlib ...
  226. func_extract_archives () {
  227. my_gentop="$1"; shift
  228. my_oldlibs=${1+"$@"}
  229. my_oldobjs=""
  230. my_xlib=""
  231. my_xabs=""
  232. my_xdir=""
  233. my_status=""
  234. $show "${rm}r $my_gentop"
  235. $run ${rm}r "$my_gentop"
  236. $show "$mkdir $my_gentop"
  237. $run $mkdir "$my_gentop"
  238. my_status=$?
  239. if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then
  240. exit $my_status
  241. fi
  242. for my_xlib in $my_oldlibs; do
  243. # Extract the objects.
  244. case $my_xlib in
  245. [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
  246. *) my_xabs=`pwd`"/$my_xlib" ;;
  247. esac
  248. my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'`
  249. my_xdir="$my_gentop/$my_xlib"
  250. $show "${rm}r $my_xdir"
  251. $run ${rm}r "$my_xdir"
  252. $show "$mkdir $my_xdir"
  253. $run $mkdir "$my_xdir"
  254. status=$?
  255. if test "$status" -ne 0 && test ! -d "$my_xdir"; then
  256. exit $status
  257. fi
  258. case $host in
  259. *-darwin*)
  260. $show "Extracting $my_xabs"
  261. # Do not bother doing anything if just a dry run
  262. if test -z "$run"; then
  263. darwin_orig_dir=`pwd`
  264. cd $my_xdir || exit $?
  265. darwin_archive=$my_xabs
  266. darwin_curdir=`pwd`
  267. darwin_base_archive=`basename $darwin_archive`
  268. darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null`
  269. if test -n "$darwin_arches"; then
  270. darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'`
  271. darwin_arch=
  272. $show "$darwin_base_archive has multiple architectures $darwin_arches"
  273. for darwin_arch in $darwin_arches ; do
  274. mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
  275. lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
  276. # Remove the table of contents from the thin files.
  277. $AR -d "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" __.SYMDEF 2>/dev/null || true
  278. $AR -d "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" __.SYMDEF\ SORTED 2>/dev/null || true
  279. cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
  280. $AR -xo "${darwin_base_archive}"
  281. rm "${darwin_base_archive}"
  282. cd "$darwin_curdir"
  283. done # $darwin_arches
  284. ## Okay now we have a bunch of thin objects, gotta fatten them up :)
  285. darwin_filelist=`find unfat-$$ -type f | xargs basename | sort -u | $NL2SP`
  286. darwin_file=
  287. darwin_files=
  288. for darwin_file in $darwin_filelist; do
  289. darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP`
  290. lipo -create -output "$darwin_file" $darwin_files
  291. done # $darwin_filelist
  292. rm -rf unfat-$$
  293. cd "$darwin_orig_dir"
  294. else
  295. cd $darwin_orig_dir
  296. (cd $my_xdir && $AR x $my_xabs) || exit $?
  297. fi # $darwin_arches
  298. fi # $run
  299. ;;
  300. *)
  301. # We will extract separately just the conflicting names and we will
  302. # no longer touch any unique names. It is faster to leave these
  303. # extract automatically by $AR in one run.
  304. $show "(cd $my_xdir && $AR x $my_xabs)"
  305. $run eval "(cd \$my_xdir && $AR x \$my_xabs)" || exit $?
  306. if ($AR t "$my_xabs" | sort | sort -uc >/dev/null 2>&1); then
  307. :
  308. else
  309. $echo "$modename: warning: object name conflicts; renaming object files" 1>&2
  310. $echo "$modename: warning: to ensure that they will not overwrite" 1>&2
  311. $AR t "$my_xabs" | sort | uniq -cd | while read -r count name
  312. do
  313. i=1
  314. while test "$i" -le "$count"
  315. do
  316. # Put our $i before any first dot (extension)
  317. # Never overwrite any file
  318. name_to="$name"
  319. while test "X$name_to" = "X$name" || test -f "$my_xdir/$name_to"
  320. do
  321. name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"`
  322. done
  323. $show "(cd $my_xdir && $AR xN $i $my_xabs '$name' && $mv '$name' '$name_to')"
  324. $run eval "(cd \$my_xdir && $AR xN $i \$my_xabs '$name' && $mv '$name' '$name_to')" || exit $?
  325. i=`expr $i + 1`
  326. done
  327. done
  328. fi
  329. ;;
  330. esac
  331. my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
  332. done
  333. func_extract_archives_result="$my_oldobjs"
  334. }
  335. # End of Shell function definitions
  336. #####################################
  337. # Darwin sucks
  338. eval std_shrext=\"$shrext_cmds\"
  339. # Parse our command line options once, thoroughly.
  340. while test "$#" -gt 0
  341. do
  342. arg="$1"
  343. shift
  344. case $arg in
  345. -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
  346. *) optarg= ;;
  347. esac
  348. # If the previous option needs an argument, assign it.
  349. if test -n "$prev"; then
  350. case $prev in
  351. execute_dlfiles)
  352. execute_dlfiles="$execute_dlfiles $arg"
  353. ;;
  354. tag)
  355. tagname="$arg"
  356. preserve_args="${preserve_args}=$arg"
  357. # Check whether tagname contains only valid characters
  358. case $tagname in
  359. *[!-_A-Za-z0-9,/]*)
  360. $echo "$progname: invalid tag name: $tagname" 1>&2
  361. exit $EXIT_FAILURE
  362. ;;
  363. esac
  364. case $tagname in
  365. CC)
  366. # Don't test for the "default" C tag, as we know, it's there, but
  367. # not specially marked.
  368. ;;
  369. *)
  370. if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev/null; then
  371. taglist="$taglist $tagname"
  372. # Evaluate the configuration.
  373. eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`"
  374. else
  375. $echo "$progname: ignoring unknown tag $tagname" 1>&2
  376. fi
  377. ;;
  378. esac
  379. ;;
  380. *)
  381. eval "$prev=\$arg"
  382. ;;
  383. esac
  384. prev=
  385. prevopt=
  386. continue
  387. fi
  388. # Have we seen a non-optional argument yet?
  389. case $arg in
  390. --help)
  391. show_help=yes
  392. ;;
  393. --version)
  394. $echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
  395. $echo
  396. $echo "Copyright (C) 2003 Free Software Foundation, Inc."
  397. $echo "This is free software; see the source for copying conditions. There is NO"
  398. $echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
  399. exit $EXIT_SUCCESS
  400. ;;
  401. --config)
  402. ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath
  403. # Now print the configurations for the tags.
  404. for tagname in $taglist; do
  405. ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath"
  406. done
  407. exit $EXIT_SUCCESS
  408. ;;
  409. --debug)
  410. $echo "$progname: enabling shell trace mode"
  411. set -x
  412. preserve_args="$preserve_args $arg"
  413. ;;
  414. --dry-run | -n)
  415. run=:
  416. ;;
  417. --features)
  418. $echo "host: $host"
  419. if test "$build_libtool_libs" = yes; then
  420. $echo "enable shared libraries"
  421. else
  422. $echo "disable shared libraries"
  423. fi
  424. if test "$build_old_libs" = yes; then
  425. $echo "enable static libraries"
  426. else
  427. $echo "disable static libraries"
  428. fi
  429. exit $EXIT_SUCCESS
  430. ;;
  431. --finish) mode="finish" ;;
  432. --mode) prevopt="--mode" prev=mode ;;
  433. --mode=*) mode="$optarg" ;;
  434. --preserve-dup-deps) duplicate_deps="yes" ;;
  435. --quiet | --silent)
  436. show=:
  437. preserve_args="$preserve_args $arg"
  438. ;;
  439. --tag) prevopt="--tag" prev=tag ;;
  440. --tag=*)
  441. set tag "$optarg" ${1+"$@"}
  442. shift
  443. prev=tag
  444. preserve_args="$preserve_args --tag"
  445. ;;
  446. -dlopen)
  447. prevopt="-dlopen"
  448. prev=execute_dlfiles
  449. ;;
  450. -*)
  451. $echo "$modename: unrecognized option \`$arg'" 1>&2
  452. $echo "$help" 1>&2
  453. exit $EXIT_FAILURE
  454. ;;
  455. *)
  456. nonopt="$arg"
  457. break
  458. ;;
  459. esac
  460. done
  461. if test -n "$prevopt"; then
  462. $echo "$modename: option \`$prevopt' requires an argument" 1>&2
  463. $echo "$help" 1>&2
  464. exit $EXIT_FAILURE
  465. fi
  466. # If this variable is set in any of the actions, the command in it
  467. # will be execed at the end. This prevents here-documents from being
  468. # left over by shells.
  469. exec_cmd=
  470. if test -z "$show_help"; then
  471. # Infer the operation mode.
  472. if test -z "$mode"; then
  473. $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2
  474. $echo "*** Future versions of Libtool will require -mode=MODE be specified." 1>&2
  475. case $nonopt in
  476. *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*)
  477. mode=link
  478. for arg
  479. do
  480. case $arg in
  481. -c)
  482. mode=compile
  483. break
  484. ;;
  485. esac
  486. done
  487. ;;
  488. *db | *dbx | *strace | *truss)
  489. mode=execute
  490. ;;
  491. *install*|cp|mv)
  492. mode=install
  493. ;;
  494. *rm)
  495. mode=uninstall
  496. ;;
  497. *)
  498. # If we have no mode, but dlfiles were specified, then do execute mode.
  499. test -n "$execute_dlfiles" && mode=execute
  500. # Just use the default operation mode.
  501. if test -z "$mode"; then
  502. if test -n "$nonopt"; then
  503. $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2
  504. else
  505. $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
  506. fi
  507. fi
  508. ;;
  509. esac
  510. fi
  511. # Only execute mode is allowed to have -dlopen flags.
  512. if test -n "$execute_dlfiles" && test "$mode" != execute; then
  513. $echo "$modename: unrecognized option \`-dlopen'" 1>&2
  514. $echo "$help" 1>&2
  515. exit $EXIT_FAILURE
  516. fi
  517. # Change the help message to a mode-specific one.
  518. generic_help="$help"
  519. help="Try \`$modename --help --mode=$mode' for more information."
  520. # These modes are in order of execution frequency so that they run quickly.
  521. case $mode in
  522. # libtool compile mode
  523. compile)
  524. modename="$modename: compile"
  525. # Get the compilation command and the source file.
  526. base_compile=
  527. srcfile="$nonopt" # always keep a non-empty value in "srcfile"
  528. suppress_opt=yes
  529. suppress_output=
  530. arg_mode=normal
  531. libobj=
  532. later=
  533. for arg
  534. do
  535. case "$arg_mode" in
  536. arg )
  537. # do not "continue". Instead, add this to base_compile
  538. lastarg="$arg"
  539. arg_mode=normal
  540. ;;
  541. target )
  542. libobj="$arg"
  543. arg_mode=normal
  544. continue
  545. ;;
  546. normal )
  547. # Accept any command-line options.
  548. case $arg in
  549. -o)
  550. if test -n "$libobj" ; then
  551. $echo "$modename: you cannot specify \`-o' more than once" 1>&2
  552. exit $EXIT_FAILURE
  553. fi
  554. arg_mode=target
  555. continue
  556. ;;
  557. -static | -prefer-pic | -prefer-non-pic)
  558. later="$later $arg"
  559. continue
  560. ;;
  561. -no-suppress)
  562. suppress_opt=no
  563. continue
  564. ;;
  565. -Xcompiler)
  566. arg_mode=arg # the next one goes into the "base_compile" arg list
  567. continue # The current "srcfile" will either be retained or
  568. ;; # replaced later. I would guess that would be a bug.
  569. -Wc,*)
  570. args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
  571. lastarg=
  572. save_ifs="$IFS"; IFS=','
  573. for arg in $args; do
  574. IFS="$save_ifs"
  575. # Double-quote args containing other shell metacharacters.
  576. # Many Bourne shells cannot handle close brackets correctly
  577. # in scan sets, so we specify it separately.
  578. case $arg in
  579. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
  580. arg="\"$arg\""
  581. ;;
  582. esac
  583. lastarg="$lastarg $arg"
  584. done
  585. IFS="$save_ifs"
  586. lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"`
  587. # Add the arguments to base_compile.
  588. base_compile="$base_compile $lastarg"
  589. continue
  590. ;;
  591. * )
  592. # Accept the current argument as the source file.
  593. # The previous "srcfile" becomes the current argument.
  594. #
  595. lastarg="$srcfile"
  596. srcfile="$arg"
  597. ;;
  598. esac # case $arg
  599. ;;
  600. esac # case $arg_mode
  601. # Aesthetically quote the previous argument.
  602. lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
  603. case $lastarg in
  604. # Double-quote args containing other shell metacharacters.
  605. # Many Bourne shells cannot handle close brackets correctly
  606. # in scan sets, so we specify it separately.
  607. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
  608. lastarg="\"$lastarg\""
  609. ;;
  610. esac
  611. base_compile="$base_compile $lastarg"
  612. done # for arg
  613. case $arg_mode in
  614. arg)
  615. $echo "$modename: you must specify an argument for -Xcompile"
  616. exit $EXIT_FAILURE
  617. ;;
  618. target)
  619. $echo "$modename: you must specify a target with \`-o'" 1>&2
  620. exit $EXIT_FAILURE
  621. ;;
  622. *)
  623. # Get the name of the library object.
  624. [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
  625. ;;
  626. esac
  627. # Recognize several different file suffixes.
  628. # If the user specifies -o file.o, it is replaced with file.lo
  629. xform='[cCFSifmso]'
  630. case $libobj in
  631. *.ada) xform=ada ;;
  632. *.adb) xform=adb ;;
  633. *.ads) xform=ads ;;
  634. *.asm) xform=asm ;;
  635. *.c++) xform=c++ ;;
  636. *.cc) xform=cc ;;
  637. *.ii) xform=ii ;;
  638. *.class) xform=class ;;
  639. *.cpp) xform=cpp ;;
  640. *.cxx) xform=cxx ;;
  641. *.f90) xform=f90 ;;
  642. *.for) xform=for ;;
  643. *.java) xform=java ;;
  644. esac
  645. libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
  646. case $libobj in
  647. *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
  648. *)
  649. $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
  650. exit $EXIT_FAILURE
  651. ;;
  652. esac
  653. func_infer_tag $base_compile
  654. for arg in $later; do
  655. case $arg in
  656. -static)
  657. build_old_libs=yes
  658. continue
  659. ;;
  660. -prefer-pic)
  661. pic_mode=yes
  662. continue
  663. ;;
  664. -prefer-non-pic)
  665. pic_mode=no
  666. continue
  667. ;;
  668. esac
  669. done
  670. objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
  671. xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
  672. if test "X$xdir" = "X$obj"; then
  673. xdir=
  674. else
  675. xdir=$xdir/
  676. fi
  677. lobj=${xdir}$objdir/$objname
  678. if test -z "$base_compile"; then
  679. $echo "$modename: you must specify a compilation command" 1>&2
  680. $echo "$help" 1>&2
  681. exit $EXIT_FAILURE
  682. fi
  683. # Delete any leftover library objects.
  684. if test "$build_old_libs" = yes; then
  685. removelist="$obj $lobj $libobj ${libobj}T"
  686. else
  687. removelist="$lobj $libobj ${libobj}T"
  688. fi
  689. $run $rm $removelist
  690. trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
  691. # On Cygwin there's no "real" PIC flag so we must build both object types
  692. case $host_os in
  693. cygwin* | mingw* | pw32* | os2*)
  694. pic_mode=default
  695. ;;
  696. esac
  697. if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
  698. # non-PIC code in shared libraries is not supported
  699. pic_mode=default
  700. fi
  701. # Calculate the filename of the output object if compiler does
  702. # not support -o with -c
  703. if test "$compiler_c_o" = no; then
  704. output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
  705. lockfile="$output_obj.lock"
  706. removelist="$removelist $output_obj $lockfile"
  707. trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
  708. else
  709. output_obj=
  710. need_locks=no
  711. lockfile=
  712. fi
  713. # Lock this critical section if it is needed
  714. # We use this script file to make the link, it avoids creating a new file
  715. if test "$need_locks" = yes; then
  716. until $run ln "$progpath" "$lockfile" 2>/dev/null; do
  717. $show "Waiting for $lockfile to be removed"
  718. sleep 2
  719. done
  720. elif test "$need_locks" = warn; then
  721. if test -f "$lockfile"; then
  722. $echo "\
  723. *** ERROR, $lockfile exists and contains:
  724. `cat $lockfile 2>/dev/null`
  725. This indicates that another process is trying to use the same
  726. temporary object file, and libtool could not work around it because
  727. your compiler does not support \`-c' and \`-o' together. If you
  728. repeat this compilation, it may succeed, by chance, but you had better
  729. avoid parallel builds (make -j) in this platform, or get a better
  730. compiler."
  731. $run $rm $removelist
  732. exit $EXIT_FAILURE
  733. fi
  734. $echo $srcfile > "$lockfile"
  735. fi
  736. if test -n "$fix_srcfile_path"; then
  737. eval srcfile=\"$fix_srcfile_path\"
  738. fi
  739. $run $rm "$libobj" "${libobj}T"
  740. # Create a libtool object file (analogous to a ".la" file),
  741. # but don't create it if we're doing a dry run.
  742. test -z "$run" && cat > ${libobj}T <<EOF
  743. # $libobj - a libtool object file
  744. # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
  745. #
  746. # Please DO NOT delete this file!
  747. # It is necessary for linking the library.
  748. # Name of the PIC object.
  749. EOF
  750. # Only build a PIC object if we are building libtool libraries.
  751. if test "$build_libtool_libs" = yes; then
  752. # Without this assignment, base_compile gets emptied.
  753. fbsd_hideous_sh_bug=$base_compile
  754. if test "$pic_mode" != no; then
  755. command="$base_compile $srcfile $pic_flag"
  756. else
  757. # Don't build PIC code
  758. command="$base_compile $srcfile"
  759. fi
  760. if test ! -d "${xdir}$objdir"; then
  761. $show "$mkdir ${xdir}$objdir"
  762. $run $mkdir ${xdir}$objdir
  763. status=$?
  764. if test "$status" -ne 0 && test ! -d "${xdir}$objdir"; then
  765. exit $status
  766. fi
  767. fi
  768. if test -z "$output_obj"; then
  769. # Place PIC objects in $objdir
  770. command="$command -o $lobj"
  771. fi
  772. $run $rm "$lobj" "$output_obj"
  773. $show "$command"
  774. if $run eval "$command"; then :
  775. else
  776. test -n "$output_obj" && $run $rm $removelist
  777. exit $EXIT_FAILURE
  778. fi
  779. if test "$need_locks" = warn &&
  780. test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
  781. $echo "\
  782. *** ERROR, $lockfile contains:
  783. `cat $lockfile 2>/dev/null`
  784. but it should contain:
  785. $srcfile
  786. This indicates that another process is trying to use the same
  787. temporary object file, and libtool could not work around it because
  788. your compiler does not support \`-c' and \`-o' together. If you
  789. repeat this compilation, it may succeed, by chance, but you had better
  790. avoid parallel builds (make -j) in this platform, or get a better
  791. compiler."
  792. $run $rm $removelist
  793. exit $EXIT_FAILURE
  794. fi
  795. # Just move the object if needed, then go on to compile the next one
  796. if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
  797. $show "$mv $output_obj $lobj"
  798. if $run $mv $output_obj $lobj; then :
  799. else
  800. error=$?
  801. $run $rm $removelist
  802. exit $error
  803. fi
  804. fi
  805. # Append the name of the PIC object to the libtool object file.
  806. test -z "$run" && cat >> ${libobj}T <<EOF
  807. pic_object='$objdir/$objname'
  808. EOF
  809. # Allow error messages only from the first compilation.
  810. if test "$suppress_opt" = yes; then
  811. suppress_output=' >/dev/null 2>&1'
  812. fi
  813. else
  814. # No PIC object so indicate it doesn't exist in the libtool
  815. # object file.
  816. test -z "$run" && cat >> ${libobj}T <<EOF
  817. pic_object=none
  818. EOF
  819. fi
  820. # Only build a position-dependent object if we build old libraries.
  821. if test "$build_old_libs" = yes; then
  822. if test "$pic_mode" != yes; then
  823. # Don't build PIC code
  824. command="$base_compile $srcfile"
  825. else
  826. command="$base_compile $srcfile $pic_flag"
  827. fi
  828. if test "$compiler_c_o" = yes; then
  829. command="$command -o $obj"
  830. fi
  831. # Suppress compiler output if we already did a PIC compilation.
  832. command="$command$suppress_output"
  833. $run $rm "$obj" "$output_obj"
  834. $show "$command"
  835. if $run eval "$command"; then :
  836. else
  837. $run $rm $removelist
  838. exit $EXIT_FAILURE
  839. fi
  840. if test "$need_locks" = warn &&
  841. test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
  842. $echo "\
  843. *** ERROR, $lockfile contains:
  844. `cat $lockfile 2>/dev/null`
  845. but it should contain:
  846. $srcfile
  847. This indicates that another process is trying to use the same
  848. temporary object file, and libtool could not work around it because
  849. your compiler does not support \`-c' and \`-o' together. If you
  850. repeat this compilation, it may succeed, by chance, but you had better
  851. avoid parallel builds (make -j) in this platform, or get a better
  852. compiler."
  853. $run $rm $removelist
  854. exit $EXIT_FAILURE
  855. fi
  856. # Just move the object if needed
  857. if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
  858. $show "$mv $output_obj $obj"
  859. if $run $mv $output_obj $obj; then :
  860. else
  861. error=$?
  862. $run $rm $removelist
  863. exit $error
  864. fi
  865. fi
  866. # Append the name of the non-PIC object the libtool object file.
  867. # Only append if the libtool object file exists.
  868. test -z "$run" && cat >> ${libobj}T <<EOF
  869. # Name of the non-PIC object.
  870. non_pic_object='$objname'
  871. EOF
  872. else
  873. # Append the name of the non-PIC object the libtool object file.
  874. # Only append if the libtool object file exists.
  875. test -z "$run" && cat >> ${libobj}T <<EOF
  876. # Name of the non-PIC object.
  877. non_pic_object=none
  878. EOF
  879. fi
  880. $run $mv "${libobj}T" "${libobj}"
  881. # Unlock the critical section if it was locked
  882. if test "$need_locks" != no; then
  883. $run $rm "$lockfile"
  884. fi
  885. exit $EXIT_SUCCESS
  886. ;;
  887. # libtool link mode
  888. link | relink)
  889. modename="$modename: link"
  890. case $host in
  891. *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
  892. # It is impossible to link a dll without this setting, and
  893. # we shouldn't force the makefile maintainer to figure out
  894. # which system we are compiling for in order to pass an extra
  895. # flag for every libtool invocation.
  896. # allow_undefined=no
  897. # FIXME: Unfortunately, there are problems with the above when trying
  898. # to make a dll which has undefined symbols, in which case not
  899. # even a static library is built. For now, we need to specify
  900. # -no-undefined on the libtool link line when we can be certain
  901. # that all symbols are satisfied, otherwise we get a static library.
  902. allow_undefined=yes
  903. ;;
  904. *)
  905. allow_undefined=yes
  906. ;;
  907. esac
  908. libtool_args="$nonopt"
  909. base_compile="$nonopt $@"
  910. compile_command="$nonopt"
  911. finalize_command="$nonopt"
  912. compile_rpath=
  913. finalize_rpath=
  914. compile_shlibpath=
  915. finalize_shlibpath=
  916. convenience=
  917. old_convenience=
  918. deplibs=
  919. old_deplibs=
  920. compiler_flags=
  921. linker_flags=
  922. dllsearchpath=
  923. lib_search_path=`pwd`
  924. inst_prefix_dir=
  925. avoid_version=no
  926. dlfiles=
  927. dlprefiles=
  928. dlself=no
  929. export_dynamic=no
  930. export_symbols=
  931. export_symbols_regex=
  932. generated=
  933. libobjs=
  934. ltlibs=
  935. module=no
  936. no_install=no
  937. objs=
  938. non_pic_objects=
  939. precious_files_regex=
  940. prefer_static_libs=no
  941. preload=no
  942. prev=
  943. prevarg=
  944. release=
  945. rpath=
  946. xrpath=
  947. perm_rpath=
  948. temp_rpath=
  949. thread_safe=no
  950. vinfo=
  951. vinfo_number=no
  952. func_infer_tag $base_compile
  953. # We need to know -static, to get the right output filenames.
  954. for arg
  955. do
  956. case $arg in
  957. -all-static | -static)
  958. if test "X$arg" = "X-all-static"; then
  959. if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
  960. $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
  961. fi
  962. if test -n "$link_static_flag"; then
  963. dlopen_self=$dlopen_self_static
  964. fi
  965. else
  966. if test -z "$pic_flag" && test -n "$link_static_flag"; then
  967. dlopen_self=$dlopen_self_static
  968. fi
  969. fi
  970. build_libtool_libs=no
  971. build_old_libs=yes
  972. prefer_static_libs=yes
  973. break
  974. ;;
  975. esac
  976. done
  977. # See if our shared archives depend on static archives.
  978. test -n "$old_archive_from_new_cmds" && build_old_libs=yes
  979. # Go through the arguments, transforming them on the way.
  980. while test "$#" -gt 0; do
  981. arg="$1"
  982. shift
  983. case $arg in
  984. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
  985. qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test
  986. ;;
  987. *) qarg=$arg ;;
  988. esac
  989. libtool_args="$libtool_args $qarg"
  990. # If the previous option needs an argument, assign it.
  991. if test -n "$prev"; then
  992. case $prev in
  993. output)
  994. compile_command="$compile_command @OUTPUT@"
  995. finalize_command="$finalize_command @OUTPUT@"
  996. ;;
  997. esac
  998. case $prev in
  999. dlfiles|dlprefiles)
  1000. if test "$preload" = no; then
  1001. # Add the symbol object into the linking commands.
  1002. compile_command="$compile_command @SYMFILE@"
  1003. finalize_command="$finalize_command @SYMFILE@"
  1004. preload=yes
  1005. fi
  1006. case $arg in
  1007. *.la | *.lo) ;; # We handle these cases below.
  1008. force)
  1009. if test "$dlself" = no; then
  1010. dlself=needless
  1011. export_dynamic=yes
  1012. fi
  1013. prev=
  1014. continue
  1015. ;;
  1016. self)
  1017. if test "$prev" = dlprefiles; then
  1018. dlself=yes
  1019. elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
  1020. dlself=yes
  1021. else
  1022. dlself=needless
  1023. export_dynamic=yes
  1024. fi
  1025. prev=
  1026. continue
  1027. ;;
  1028. *)
  1029. if test "$prev" = dlfiles; then
  1030. dlfiles="$dlfiles $arg"
  1031. else
  1032. dlprefiles="$dlprefiles $arg"
  1033. fi
  1034. prev=
  1035. continue
  1036. ;;
  1037. esac
  1038. ;;
  1039. expsyms)
  1040. export_symbols="$arg"
  1041. if test ! -f "$arg"; then
  1042. $echo "$modename: symbol file \`$arg' does not exist"
  1043. exit $EXIT_FAILURE
  1044. fi
  1045. prev=
  1046. continue
  1047. ;;
  1048. expsyms_regex)
  1049. export_symbols_regex="$arg"
  1050. prev=
  1051. continue
  1052. ;;
  1053. inst_prefix)
  1054. inst_prefix_dir="$arg"
  1055. prev=
  1056. continue
  1057. ;;
  1058. precious_regex)
  1059. precious_files_regex="$arg"
  1060. prev=
  1061. continue
  1062. ;;
  1063. release)
  1064. release="-$arg"
  1065. prev=
  1066. continue
  1067. ;;
  1068. objectlist)
  1069. if test -f "$arg"; then
  1070. save_arg=$arg
  1071. moreargs=
  1072. for fil in `cat $save_arg`
  1073. do
  1074. # moreargs="$moreargs $fil"
  1075. arg=$fil
  1076. # A libtool-controlled object.
  1077. # Check to see that this really is a libtool object.
  1078. if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
  1079. pic_object=
  1080. non_pic_object=
  1081. # Read the .lo file
  1082. # If there is no directory component, then add one.
  1083. case $arg in
  1084. */* | *\\*) . $arg ;;
  1085. *) . ./$arg ;;
  1086. esac
  1087. if test -z "$pic_object" || \
  1088. test -z "$non_pic_object" ||
  1089. test "$pic_object" = none && \
  1090. test "$non_pic_object" = none; then
  1091. $echo "$modename: cannot find name of object for \`$arg'" 1>&2
  1092. exit $EXIT_FAILURE
  1093. fi
  1094. # Extract subdirectory from the argument.
  1095. xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
  1096. if test "X$xdir" = "X$arg"; then
  1097. xdir=
  1098. else
  1099. xdir="$xdir/"
  1100. fi
  1101. if test "$pic_object" != none; then
  1102. # Prepend the subdirectory the object is found in.
  1103. pic_object="$xdir$pic_object"
  1104. if test "$prev" = dlfiles; then
  1105. if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
  1106. dlfiles="$dlfiles $pic_object"
  1107. prev=
  1108. continue
  1109. else
  1110. # If libtool objects are unsupported, then we need to preload.
  1111. prev=dlprefiles
  1112. fi
  1113. fi
  1114. # CHECK ME: I think I busted this. -Ossama
  1115. if test "$prev" = dlprefiles; then
  1116. # Preload the old-style object.
  1117. dlprefiles="$dlprefiles $pic_object"
  1118. prev=
  1119. fi
  1120. # A PIC object.
  1121. libobjs="$libobjs $pic_object"
  1122. arg="$pic_object"
  1123. fi
  1124. # Non-PIC object.
  1125. if test "$non_pic_object" != none; then
  1126. # Prepend the subdirectory the object is found in.
  1127. non_pic_object="$xdir$non_pic_object"
  1128. # A standard non-PIC object
  1129. non_pic_objects="$non_pic_objects $non_pic_object"
  1130. if test -z "$pic_object" || test "$pic_object" = none ; then
  1131. arg="$non_pic_object"
  1132. fi
  1133. fi
  1134. else
  1135. # Only an error if not doing a dry-run.
  1136. if test -z "$run"; then
  1137. $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
  1138. exit $EXIT_FAILURE
  1139. else
  1140. # Dry-run case.
  1141. # Extract subdirectory from the argument.
  1142. xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
  1143. if test "X$xdir" = "X$arg"; then
  1144. xdir=
  1145. else
  1146. xdir="$xdir/"
  1147. fi
  1148. pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
  1149. non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
  1150. libobjs="$libobjs $pic_object"
  1151. non_pic_objects="$non_pic_objects $non_pic_object"
  1152. fi
  1153. fi
  1154. done
  1155. else
  1156. $echo "$modename: link input file \`$save_arg' does not exist"
  1157. exit $EXIT_FAILURE
  1158. fi
  1159. arg=$save_arg
  1160. prev=
  1161. continue
  1162. ;;
  1163. rpath | xrpath)
  1164. # We need an absolute path.
  1165. case $arg in
  1166. [\\/]* | [A-Za-z]:[\\/]*) ;;
  1167. *)
  1168. $echo "$modename: only absolute run-paths are allowed" 1>&2
  1169. exit $EXIT_FAILURE
  1170. ;;
  1171. esac
  1172. if test "$prev" = rpath; then
  1173. case "$rpath " in
  1174. *" $arg "*) ;;
  1175. *) rpath="$rpath $arg" ;;
  1176. esac
  1177. else
  1178. case "$xrpath " in
  1179. *" $arg "*) ;;
  1180. *) xrpath="$xrpath $arg" ;;
  1181. esac
  1182. fi
  1183. prev=
  1184. continue
  1185. ;;
  1186. xcompiler)
  1187. compiler_flags="$compiler_flags $qarg"
  1188. prev=
  1189. compile_command="$compile_command $qarg"
  1190. finalize_command="$finalize_command $qarg"
  1191. continue
  1192. ;;
  1193. xlinker)
  1194. linker_flags="$linker_flags $qarg"
  1195. compiler_flags="$compiler_flags $wl$qarg"
  1196. prev=
  1197. compile_command="$compile_command $wl$qarg"
  1198. finalize_command="$finalize_command $wl$qarg"
  1199. continue
  1200. ;;
  1201. xcclinker)
  1202. linker_flags="$linker_flags $qarg"
  1203. compiler_flags="$compiler_flags $qarg"
  1204. prev=
  1205. compile_command="$compile_command $qarg"
  1206. finalize_command="$finalize_command $qarg"
  1207. continue
  1208. ;;
  1209. shrext)
  1210. shrext_cmds="$arg"
  1211. prev=
  1212. continue
  1213. ;;
  1214. *)
  1215. eval "$prev=\"\$arg\""
  1216. prev=
  1217. continue
  1218. ;;
  1219. esac
  1220. fi # test -n "$prev"
  1221. prevarg="$arg"
  1222. case $arg in
  1223. -all-static)
  1224. if test -n "$link_static_flag"; then
  1225. compile_command="$compile_command $link_static_flag"
  1226. finalize_command="$finalize_command $link_static_flag"
  1227. fi
  1228. continue
  1229. ;;
  1230. -allow-undefined)
  1231. # FIXME: remove this flag sometime in the future.
  1232. $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
  1233. continue
  1234. ;;
  1235. -avoid-version)
  1236. avoid_version=yes
  1237. continue
  1238. ;;
  1239. -dlopen)
  1240. prev=dlfiles
  1241. continue
  1242. ;;
  1243. -dlpreopen)
  1244. prev=dlprefiles
  1245. continue
  1246. ;;
  1247. -export-dynamic)
  1248. export_dynamic=yes
  1249. continue
  1250. ;;
  1251. -export-symbols | -export-symbols-regex)
  1252. if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
  1253. $echo "$modename: more than one -exported-symbols argument is not allowed"
  1254. exit $EXIT_FAILURE
  1255. fi
  1256. if test "X$arg" = "X-export-symbols"; then
  1257. prev=expsyms
  1258. else
  1259. prev=expsyms_regex
  1260. fi
  1261. continue
  1262. ;;
  1263. -inst-prefix-dir)
  1264. prev=inst_prefix
  1265. continue
  1266. ;;
  1267. # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
  1268. # so, if we see these flags be careful not to treat them like -L
  1269. -L[A-Z][A-Z]*:*)
  1270. case $with_gcc/$host in
  1271. no/*-*-irix* | /*-*-irix*)
  1272. compile_command="$compile_command $arg"
  1273. finalize_command="$finalize_command $arg"
  1274. ;;
  1275. esac
  1276. continue
  1277. ;;
  1278. -L*)
  1279. dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
  1280. # We need an absolute path.
  1281. case $dir in
  1282. [\\/]* | [A-Za-z]:[\\/]*) ;;
  1283. *)
  1284. absdir=`cd "$dir" && pwd`
  1285. if test -z "$absdir"; then
  1286. $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
  1287. exit $EXIT_FAILURE
  1288. fi
  1289. dir="$absdir"
  1290. ;;
  1291. esac
  1292. case "$deplibs " in
  1293. *" -L$dir "*) ;;
  1294. *)
  1295. deplibs="$deplibs -L$dir"
  1296. lib_search_path="$lib_search_path $dir"
  1297. ;;
  1298. esac
  1299. case $host in
  1300. *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
  1301. case :$dllsearchpath: in
  1302. *":$dir:"*) ;;
  1303. *) dllsearchpath="$dllsearchpath:$dir";;
  1304. esac
  1305. ;;
  1306. esac
  1307. continue
  1308. ;;
  1309. -l*)
  1310. if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
  1311. case $host in
  1312. *-*-cygwin* | *-*-pw32* | *-*-beos*)
  1313. # These systems don't actually have a C or math library (as such)
  1314. continue
  1315. ;;
  1316. *-*-mingw* | *-*-os2*)
  1317. # These systems don't actually have a C library (as such)
  1318. test "X$arg" = "X-lc" && continue
  1319. ;;
  1320. *-*-openbsd* | *-*-freebsd*)
  1321. # Do not include libc due to us having libc/libc_r.
  1322. test "X$arg" = "X-lc" && continue
  1323. ;;
  1324. *-*-rhapsody* | *-*-darwin1.[012])
  1325. # Rhapsody C and math libraries are in the System framework
  1326. deplibs="$deplibs -framework System"
  1327. continue
  1328. esac
  1329. elif test "X$arg" = "X-lc_r"; then
  1330. case $host in
  1331. *-*-openbsd* | *-*-freebsd4*)
  1332. # Do not include libc_r directly, use -pthread flag.
  1333. continue
  1334. ;;
  1335. esac
  1336. fi
  1337. deplibs="$deplibs $arg"
  1338. continue
  1339. ;;
  1340. -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
  1341. deplibs="$deplibs $arg"
  1342. continue
  1343. ;;
  1344. -module)
  1345. module=yes
  1346. case $host in
  1347. *-*-freebsd*)
  1348. # Do not build the useless static library
  1349. build_old_libs=no
  1350. ;;
  1351. esac
  1352. continue
  1353. ;;
  1354. # gcc -m* arguments should be passed to the linker via $compiler_flags
  1355. # in order to pass architecture information to the linker
  1356. # (e.g. 32 vs 64-bit). This may also be accomplished via -Wl,-mfoo
  1357. # but this is not reliable with gcc because gcc may use -mfoo to
  1358. # select a different linker, different libraries, etc, while
  1359. # -Wl,-mfoo simply passes -mfoo to the linker.
  1360. -m*)
  1361. # Unknown arguments in both finalize_command and compile_command need
  1362. # to be aesthetically quoted because they are evaled later.
  1363. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
  1364. case $arg in
  1365. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
  1366. arg="\"$arg\""
  1367. ;;
  1368. esac
  1369. compile_command="$compile_command $arg"
  1370. finalize_command="$finalize_command $arg"
  1371. if test "$with_gcc" = "yes" ; then
  1372. compiler_flags="$compiler_flags $arg"
  1373. fi
  1374. continue
  1375. ;;
  1376. -shrext)
  1377. prev=shrext
  1378. continue
  1379. ;;
  1380. -no-fast-install)
  1381. fast_install=no
  1382. continue
  1383. ;;
  1384. -no-install)
  1385. case $host in
  1386. *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
  1387. # The PATH hackery in wrapper scripts is required on Windows
  1388. # in order for the loader to find any dlls it needs.
  1389. $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2
  1390. $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2
  1391. fast_install=no
  1392. ;;
  1393. *) no_install=yes ;;
  1394. esac
  1395. continue
  1396. ;;
  1397. -no-undefined)
  1398. allow_undefined=no
  1399. continue
  1400. ;;
  1401. -objectlist)
  1402. prev=objectlist
  1403. continue
  1404. ;;
  1405. -o) prev=output ;;
  1406. -precious-files-regex)
  1407. prev=precious_regex
  1408. continue
  1409. ;;
  1410. -release)
  1411. prev=release
  1412. continue
  1413. ;;
  1414. -rpath)
  1415. prev=rpath
  1416. continue
  1417. ;;
  1418. -R)
  1419. prev=xrpath
  1420. continue
  1421. ;;
  1422. -R*)
  1423. dir=`$echo "X$arg" | $Xsed -e 's/^-R//'`
  1424. # We need an absolute path.
  1425. case $dir in
  1426. [\\/]* | [A-Za-z]:[\\/]*) ;;
  1427. *)
  1428. $echo "$modename: only absolute run-paths are allowed" 1>&2
  1429. exit $EXIT_FAILURE
  1430. ;;
  1431. esac
  1432. case "$xrpath " in
  1433. *" $dir "*) ;;
  1434. *) xrpath="$xrpath $dir" ;;
  1435. esac
  1436. continue
  1437. ;;
  1438. -static)
  1439. # The effects of -static are defined in a previous loop.
  1440. # We used to do the same as -all-static on platforms that
  1441. # didn't have a PIC flag, but the assumption that the effects
  1442. # would be equivalent was wrong. It would break on at least
  1443. # Digital Unix and AIX.
  1444. continue
  1445. ;;
  1446. -thread-safe)
  1447. thread_safe=yes
  1448. continue
  1449. ;;
  1450. -version-info)
  1451. prev=vinfo
  1452. continue
  1453. ;;
  1454. -version-number)
  1455. prev=vinfo
  1456. vinfo_number=yes
  1457. continue
  1458. ;;
  1459. -Wc,*)
  1460. args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'`
  1461. arg=
  1462. save_ifs="$IFS"; IFS=','
  1463. for flag in $args; do
  1464. IFS="$save_ifs"
  1465. case $flag in
  1466. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
  1467. flag="\"$flag\""
  1468. ;;
  1469. esac
  1470. arg="$arg $wl$flag"
  1471. compiler_flags="$compiler_flags $flag"
  1472. done
  1473. IFS="$save_ifs"
  1474. arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
  1475. ;;
  1476. -Wl,*)
  1477. args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'`
  1478. arg=
  1479. save_ifs="$IFS"; IFS=','
  1480. for flag in $args; do
  1481. IFS="$save_ifs"
  1482. case $flag in
  1483. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
  1484. flag="\"$flag\""
  1485. ;;
  1486. esac
  1487. arg="$arg $wl$flag"
  1488. compiler_flags="$compiler_flags $wl$flag"
  1489. linker_flags="$linker_flags $flag"
  1490. done
  1491. IFS="$save_ifs"
  1492. arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
  1493. ;;
  1494. -Xcompiler)
  1495. prev=xcompiler
  1496. continue
  1497. ;;
  1498. -Xlinker)
  1499. prev=xlinker
  1500. continue
  1501. ;;
  1502. -XCClinker)
  1503. prev=xcclinker
  1504. continue
  1505. ;;
  1506. # Some other compiler flag.
  1507. -* | +*)
  1508. # Unknown arguments in both finalize_command and compile_command need
  1509. # to be aesthetically quoted because they are evaled later.
  1510. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
  1511. case $arg in
  1512. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
  1513. arg="\"$arg\""
  1514. ;;
  1515. esac
  1516. ;;
  1517. *.$objext)
  1518. # A standard object.
  1519. objs="$objs $arg"
  1520. ;;
  1521. *.lo)
  1522. # A libtool-controlled object.
  1523. # Check to see that this really is a libtool object.
  1524. if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
  1525. pic_object=
  1526. non_pic_object=
  1527. # Read the .lo file
  1528. # If there is no directory component, then add one.
  1529. case $arg in
  1530. */* | *\\*) . $arg ;;
  1531. *) . ./$arg ;;
  1532. esac
  1533. if test -z "$pic_object" || \
  1534. test -z "$non_pic_object" ||
  1535. test "$pic_object" = none && \
  1536. test "$non_pic_object" = none; then
  1537. $echo "$modename: cannot find name of object for \`$arg'" 1>&2
  1538. exit $EXIT_FAILURE
  1539. fi
  1540. # Extract subdirectory from the argument.
  1541. xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
  1542. if test "X$xdir" = "X$arg"; then
  1543. xdir=
  1544. else
  1545. xdir="$xdir/"
  1546. fi
  1547. if test "$pic_object" != none; then
  1548. # Prepend the subdirectory the object is found in.
  1549. pic_object="$xdir$pic_object"
  1550. if test "$prev" = dlfiles; then
  1551. if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
  1552. dlfiles="$dlfiles $pic_object"
  1553. prev=
  1554. continue
  1555. else
  1556. # If libtool objects are unsupported, then we need to preload.
  1557. prev=dlprefiles
  1558. fi
  1559. fi
  1560. # CHECK ME: I think I busted this. -Ossama
  1561. if test "$prev" = dlprefiles; then
  1562. # Preload the old-style object.
  1563. dlprefiles="$dlprefiles $pic_object"
  1564. prev=
  1565. fi
  1566. # A PIC object.
  1567. libobjs="$libobjs $pic_object"
  1568. arg="$pic_object"
  1569. fi
  1570. # Non-PIC object.
  1571. if test "$non_pic_object" != none; then
  1572. # Prepend the subdirectory the object is found in.
  1573. non_pic_object="$xdir$non_pic_object"
  1574. # A standard non-PIC object
  1575. non_pic_objects="$non_pic_objects $non_pic_object"
  1576. if test -z "$pic_object" || test "$pic_object" = none ; then
  1577. arg="$non_pic_object"
  1578. fi
  1579. fi
  1580. else
  1581. # Only an error if not doing a dry-run.
  1582. if test -z "$run"; then
  1583. $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
  1584. exit $EXIT_FAILURE
  1585. else
  1586. # Dry-run case.
  1587. # Extract subdirectory from the argument.
  1588. xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
  1589. if test "X$xdir" = "X$arg"; then
  1590. xdir=
  1591. else
  1592. xdir="$xdir/"
  1593. fi
  1594. pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
  1595. non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
  1596. libobjs="$libobjs $pic_object"
  1597. non_pic_objects="$non_pic_objects $non_pic_object"
  1598. fi
  1599. fi
  1600. ;;
  1601. *.$libext)
  1602. # An archive.
  1603. deplibs="$deplibs $arg"
  1604. old_deplibs="$old_deplibs $arg"
  1605. continue
  1606. ;;
  1607. *.la)
  1608. # A libtool-controlled library.
  1609. if test "$prev" = dlfiles; then
  1610. # This library was specified with -dlopen.
  1611. dlfiles="$dlfiles $arg"
  1612. prev=
  1613. elif test "$prev" = dlprefiles; then
  1614. # The library was specified with -dlpreopen.
  1615. dlprefiles="$dlprefiles $arg"
  1616. prev=
  1617. else
  1618. deplibs="$deplibs $arg"
  1619. fi
  1620. continue
  1621. ;;
  1622. # Some other compiler argument.
  1623. *)
  1624. # Unknown arguments in both finalize_command and compile_command need
  1625. # to be aesthetically quoted because they are evaled later.
  1626. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
  1627. case $arg in
  1628. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
  1629. arg="\"$arg\""
  1630. ;;
  1631. esac
  1632. ;;
  1633. esac # arg
  1634. # Now actually substitute the argument into the commands.
  1635. if test -n "$arg"; then
  1636. compile_command="$compile_command $arg"
  1637. finalize_command="$finalize_command $arg"
  1638. fi
  1639. done # argument parsing loop
  1640. if test -n "$prev"; then
  1641. $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
  1642. $echo "$help" 1>&2
  1643. exit $EXIT_FAILURE
  1644. fi
  1645. if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
  1646. eval arg=\"$export_dynamic_flag_spec\"
  1647. compile_command="$compile_command $arg"
  1648. finalize_command="$finalize_command $arg"
  1649. fi
  1650. oldlibs=
  1651. # calculate the name of the file, without its directory
  1652. outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
  1653. libobjs_save="$libobjs"
  1654. if test -n "$shlibpath_var"; then
  1655. # get the directories listed in $shlibpath_var
  1656. eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
  1657. else
  1658. shlib_search_path=
  1659. fi
  1660. eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
  1661. eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
  1662. output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
  1663. if test "X$output_objdir" = "X$output"; then
  1664. output_objdir="$objdir"
  1665. else
  1666. output_objdir="$output_objdir/$objdir"
  1667. fi
  1668. # Create the object directory.
  1669. if test ! -d "$output_objdir"; then
  1670. $show "$mkdir $output_objdir"
  1671. $run $mkdir $output_objdir
  1672. status=$?
  1673. if test "$status" -ne 0 && test ! -d "$output_objdir"; then
  1674. exit $status
  1675. fi
  1676. fi
  1677. # Determine the type of output
  1678. case $output in
  1679. "")
  1680. $echo "$modename: you must specify an output file" 1>&2
  1681. $echo "$help" 1>&2
  1682. exit $EXIT_FAILURE
  1683. ;;
  1684. *.$libext) linkmode=oldlib ;;
  1685. *.lo | *.$objext) linkmode=obj ;;
  1686. *.la) linkmode=lib ;;
  1687. *) linkmode=prog ;; # Anything else should be a program.
  1688. esac
  1689. case $host in
  1690. *cygwin* | *mingw* | *pw32*)
  1691. # don't eliminate duplications in $postdeps and $predeps
  1692. duplicate_compiler_generated_deps=yes
  1693. ;;
  1694. *)
  1695. duplicate_compiler_generated_deps=$duplicate_deps
  1696. ;;
  1697. esac
  1698. specialdeplibs=
  1699. libs=
  1700. # Find all interdependent deplibs by searching for libraries
  1701. # that are linked more than once (e.g. -la -lb -la)
  1702. for deplib in $deplibs; do
  1703. if test "X$duplicate_deps" = "Xyes" ; then
  1704. case "$libs " in
  1705. *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
  1706. esac
  1707. fi
  1708. libs="$libs $deplib"
  1709. done
  1710. if test "$linkmode" = lib; then
  1711. libs="$predeps $libs $compiler_lib_search_path $postdeps"
  1712. # Compute libraries that are listed more than once in $predeps
  1713. # $postdeps and mark them as special (i.e., whose duplicates are
  1714. # not to be eliminated).
  1715. pre_post_deps=
  1716. if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then
  1717. for pre_post_dep in $predeps $postdeps; do
  1718. case "$pre_post_deps " in
  1719. *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
  1720. esac
  1721. pre_post_deps="$pre_post_deps $pre_post_dep"
  1722. done
  1723. fi
  1724. pre_post_deps=
  1725. fi
  1726. deplibs=
  1727. newdependency_libs=
  1728. newlib_search_path=
  1729. need_relink=no # whether we're linking any uninstalled libtool libraries
  1730. notinst_deplibs= # not-installed libtool libraries
  1731. notinst_path= # paths that contain not-installed libtool libraries
  1732. case $linkmode in
  1733. lib)
  1734. passes="conv link"
  1735. for file in $dlfiles $dlprefiles; do
  1736. case $file in
  1737. *.la) ;;
  1738. *)
  1739. $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2
  1740. exit $EXIT_FAILURE
  1741. ;;
  1742. esac
  1743. done
  1744. ;;
  1745. prog)
  1746. compile_deplibs=
  1747. finalize_deplibs=
  1748. alldeplibs=no
  1749. newdlfiles=
  1750. newdlprefiles=
  1751. passes="conv scan dlopen dlpreopen link"
  1752. ;;
  1753. *) passes="conv"
  1754. ;;
  1755. esac
  1756. for pass in $passes; do
  1757. if test "$linkmode,$pass" = "lib,link" ||
  1758. test "$linkmode,$pass" = "prog,scan"; then
  1759. libs="$deplibs"
  1760. deplibs=
  1761. fi
  1762. if test "$linkmode" = prog; then
  1763. case $pass in
  1764. dlopen) libs="$dlfiles" ;;
  1765. dlpreopen) libs="$dlprefiles" ;;
  1766. link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
  1767. esac
  1768. fi
  1769. if test "$pass" = dlopen; then
  1770. # Collect dlpreopened libraries
  1771. save_deplibs="$deplibs"
  1772. deplibs=
  1773. fi
  1774. for deplib in $libs; do
  1775. lib=
  1776. found=no
  1777. case $deplib in
  1778. -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
  1779. if test "$linkmode,$pass" = "prog,link"; then
  1780. compile_deplibs="$deplib $compile_deplibs"
  1781. finalize_deplibs="$deplib $finalize_deplibs"
  1782. else
  1783. deplibs="$deplib $deplibs"
  1784. test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
  1785. fi
  1786. continue
  1787. ;;
  1788. -l*)
  1789. if test "$linkmode" != lib && test "$linkmode" != prog; then
  1790. $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2
  1791. continue
  1792. fi
  1793. if test "$pass" = conv; then
  1794. deplibs="$deplib $deplibs"
  1795. continue
  1796. fi
  1797. name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
  1798. for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do
  1799. for search_ext in .la $std_shrext .so .a; do
  1800. # Search the libtool library
  1801. lib="$searchdir/lib${name}${search_ext}"
  1802. if test -f "$lib"; then
  1803. if test "$search_ext" = ".la"; then
  1804. found=yes
  1805. else
  1806. found=no
  1807. fi
  1808. break 2
  1809. fi
  1810. done
  1811. done
  1812. if test "$found" != yes; then
  1813. # deplib doesn't seem to be a libtool library
  1814. if test "$linkmode,$pass" = "prog,link"; then
  1815. compile_deplibs="$deplib $compile_deplibs"
  1816. finalize_deplibs="$deplib $finalize_deplibs"
  1817. else
  1818. deplibs="$deplib $deplibs"
  1819. test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
  1820. fi
  1821. continue
  1822. else # deplib is a libtool library
  1823. # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
  1824. # We need to do some special things here, and not later.
  1825. if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
  1826. case " $predeps $postdeps " in
  1827. *" $deplib "*)
  1828. if (${SED} -e '2q' $lib |
  1829. grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
  1830. library_names=
  1831. old_library=
  1832. case $lib in
  1833. */* | *\\*) . $lib ;;
  1834. *) . ./$lib ;;
  1835. esac
  1836. for l in $old_library $library_names; do
  1837. ll="$l"
  1838. done
  1839. if test "X$ll" = "X$old_library" ; then # only static version available
  1840. found=no
  1841. ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
  1842. test "X$ladir" = "X$lib" && ladir="."
  1843. lib=$ladir/$old_library
  1844. if test "$linkmode,$pass" = "prog,link"; then
  1845. compile_deplibs="$deplib $compile_deplibs"
  1846. finalize_deplibs="$deplib $finalize_deplibs"
  1847. else
  1848. deplibs="$deplib $deplibs"
  1849. test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
  1850. fi
  1851. continue
  1852. fi
  1853. fi
  1854. ;;
  1855. *) ;;
  1856. esac
  1857. fi
  1858. fi
  1859. ;; # -l
  1860. -L*)
  1861. case $linkmode in
  1862. lib)
  1863. deplibs="$deplib $deplibs"
  1864. test "$pass" = conv && continue
  1865. newdependency_libs="$deplib $newdependency_libs"
  1866. newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
  1867. ;;
  1868. prog)
  1869. if test "$pass" = conv; then
  1870. deplibs="$deplib $deplibs"
  1871. continue
  1872. fi
  1873. if test "$pass" = scan; then
  1874. deplibs="$deplib $deplibs"
  1875. else
  1876. compile_deplibs="$deplib $compile_deplibs"
  1877. finalize_deplibs="$deplib $finalize_deplibs"
  1878. fi
  1879. newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
  1880. ;;
  1881. *)
  1882. $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2
  1883. ;;
  1884. esac # linkmode
  1885. continue
  1886. ;; # -L
  1887. -R*)
  1888. if test "$pass" = link; then
  1889. dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
  1890. # Make sure the xrpath contains only unique directories.
  1891. case "$xrpath " in
  1892. *" $dir "*) ;;
  1893. *) xrpath="$xrpath $dir" ;;
  1894. esac
  1895. fi
  1896. deplibs="$deplib $deplibs"
  1897. continue
  1898. ;;
  1899. *.la) lib="$deplib" ;;
  1900. *.$libext)
  1901. if test "$pass" = conv; then
  1902. deplibs="$deplib $deplibs"
  1903. continue
  1904. fi
  1905. case $linkmode in
  1906. lib)
  1907. valid_a_lib=no
  1908. case $deplibs_check_method in
  1909. match_pattern*)
  1910. set dummy $deplibs_check_method
  1911. match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
  1912. if eval $echo \"$deplib\" 2>/dev/null \
  1913. | $SED 10q \
  1914. | $EGREP "$match_pattern_regex" > /dev/null; then
  1915. valid_a_lib=yes
  1916. fi
  1917. ;;
  1918. pass_all)
  1919. valid_a_lib=yes
  1920. ;;
  1921. esac
  1922. if test "$valid_a_lib" != yes; then
  1923. $echo
  1924. $echo "*** Warning: Trying to link with static lib archive $deplib."
  1925. $echo "*** I have the capability to make that library automatically link in when"
  1926. $echo "*** you link to this library. But I can only do this if you have a"
  1927. $echo "*** shared version of the library, which you do not appear to have"
  1928. $echo "*** because the file extensions .$libext of this argument makes me believe"
  1929. $echo "*** that it is just a static archive that I should not used here."
  1930. else
  1931. $echo
  1932. $echo "*** Warning: Linking the shared library $output against the"
  1933. $echo "*** static library $deplib is not portable!"
  1934. deplibs="$deplib $deplibs"
  1935. fi
  1936. continue
  1937. ;;
  1938. prog)
  1939. if test "$pass" != link; then
  1940. deplibs="$deplib $deplibs"
  1941. else
  1942. compile_deplibs="$deplib $compile_deplibs"
  1943. finalize_deplibs="$deplib $finalize_deplibs"
  1944. fi
  1945. continue
  1946. ;;
  1947. esac # linkmode
  1948. ;; # *.$libext
  1949. *.lo | *.$objext)
  1950. if test "$pass" = conv; then
  1951. deplibs="$deplib $deplibs"
  1952. elif test "$linkmode" = prog; then
  1953. if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
  1954. # If there is no dlopen support or we're linking statically,
  1955. # we need to preload.
  1956. newdlprefiles="$newdlprefiles $deplib"
  1957. compile_deplibs="$deplib $compile_deplibs"
  1958. finalize_deplibs="$deplib $finalize_deplibs"
  1959. else
  1960. newdlfiles="$newdlfiles $deplib"
  1961. fi
  1962. fi
  1963. continue
  1964. ;;
  1965. %DEPLIBS%)
  1966. alldeplibs=yes
  1967. continue
  1968. ;;
  1969. esac # case $deplib
  1970. if test "$found" = yes || test -f "$lib"; then :
  1971. else
  1972. $echo "$modename: cannot find the library \`$lib'" 1>&2
  1973. exit $EXIT_FAILURE
  1974. fi
  1975. # Check to see that this really is a libtool archive.
  1976. if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
  1977. else
  1978. $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
  1979. exit $EXIT_FAILURE
  1980. fi
  1981. ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
  1982. test "X$ladir" = "X$lib" && ladir="."
  1983. dlname=
  1984. dlopen=
  1985. dlpreopen=
  1986. libdir=
  1987. library_names=
  1988. old_library=
  1989. # If the library was installed with an old release of libtool,
  1990. # it will not redefine variables installed, or shouldnotlink
  1991. installed=yes
  1992. shouldnotlink=no
  1993. # Read the .la file
  1994. case $lib in
  1995. */* | *\\*) . $lib ;;
  1996. *) . ./$lib ;;
  1997. esac
  1998. if test "$linkmode,$pass" = "lib,link" ||
  1999. test "$linkmode,$pass" = "prog,scan" ||
  2000. { test "$linkmode" != prog && test "$linkmode" != lib; }; then
  2001. test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
  2002. test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
  2003. fi
  2004. if test "$pass" = conv; then
  2005. # Only check for convenience libraries
  2006. deplibs="$lib $deplibs"
  2007. if test -z "$libdir"; then
  2008. if test -z "$old_library"; then
  2009. $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
  2010. exit $EXIT_FAILURE
  2011. fi
  2012. # It is a libtool convenience library, so add in its objects.
  2013. convenience="$convenience $ladir/$objdir/$old_library"
  2014. old_convenience="$old_convenience $ladir/$objdir/$old_library"
  2015. tmp_libs=
  2016. for deplib in $dependency_libs; do
  2017. deplibs="$deplib $deplibs"
  2018. if test "X$duplicate_deps" = "Xyes" ; then
  2019. case "$tmp_libs " in
  2020. *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
  2021. esac
  2022. fi
  2023. tmp_libs="$tmp_libs $deplib"
  2024. done
  2025. elif test "$linkmode" != prog && test "$linkmode" != lib; then
  2026. $echo "$modename: \`$lib' is not a convenience library" 1>&2
  2027. exit $EXIT_FAILURE
  2028. fi
  2029. continue
  2030. fi # $pass = conv
  2031. # Get the name of the library we link against.
  2032. linklib=
  2033. for l in $old_library $library_names; do
  2034. linklib="$l"
  2035. done
  2036. if test -z "$linklib"; then
  2037. $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
  2038. exit $EXIT_FAILURE
  2039. fi
  2040. # This library was specified with -dlopen.
  2041. if test "$pass" = dlopen; then
  2042. if test -z "$libdir"; then
  2043. $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
  2044. exit $EXIT_FAILURE
  2045. fi
  2046. if test -z "$dlname" ||
  2047. test "$dlopen_support" != yes ||
  2048. test "$build_libtool_libs" = no; then
  2049. # If there is no dlname, no dlopen support or we're linking
  2050. # statically, we need to preload. We also need to preload any
  2051. # dependent libraries so libltdl's deplib preloader doesn't
  2052. # bomb out in the load deplibs phase.
  2053. dlprefiles="$dlprefiles $lib $dependency_libs"
  2054. else
  2055. newdlfiles="$newdlfiles $lib"
  2056. fi
  2057. continue
  2058. fi # $pass = dlopen
  2059. # We need an absolute path.
  2060. case $ladir in
  2061. [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
  2062. *)
  2063. abs_ladir=`cd "$ladir" && pwd`
  2064. if test -z "$abs_ladir"; then
  2065. $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2
  2066. $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
  2067. abs_ladir="$ladir"
  2068. fi
  2069. ;;
  2070. esac
  2071. laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
  2072. # Find the relevant object directory and library name.
  2073. if test "X$installed" = Xyes; then
  2074. if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
  2075. $echo "$modename: warning: library \`$lib' was moved." 1>&2
  2076. dir="$ladir"
  2077. absdir="$abs_ladir"
  2078. libdir="$abs_ladir"
  2079. else
  2080. dir="$libdir"
  2081. absdir="$libdir"
  2082. fi
  2083. else
  2084. if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
  2085. dir="$ladir"
  2086. absdir="$abs_ladir"
  2087. # Remove this search path later
  2088. notinst_path="$notinst_path $abs_ladir"
  2089. else
  2090. dir="$ladir/$objdir"
  2091. absdir="$abs_ladir/$objdir"
  2092. # Remove this search path later
  2093. notinst_path="$notinst_path $abs_ladir"
  2094. fi
  2095. fi # $installed = yes
  2096. name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
  2097. # This library was specified with -dlpreopen.
  2098. if test "$pass" = dlpreopen; then
  2099. if test -z "$libdir"; then
  2100. $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
  2101. exit $EXIT_FAILURE
  2102. fi
  2103. # Prefer using a static library (so that no silly _DYNAMIC symbols
  2104. # are required to link).
  2105. if test -n "$old_library"; then
  2106. newdlprefiles="$newdlprefiles $dir/$old_library"
  2107. # Otherwise, use the dlname, so that lt_dlopen finds it.
  2108. elif test -n "$dlname"; then
  2109. newdlprefiles="$newdlprefiles $dir/$dlname"
  2110. else
  2111. newdlprefiles="$newdlprefiles $dir/$linklib"
  2112. fi
  2113. fi # $pass = dlpreopen
  2114. if test -z "$libdir"; then
  2115. # Link the convenience library
  2116. if test "$linkmode" = lib; then
  2117. deplibs="$dir/$old_library $deplibs"
  2118. elif test "$linkmode,$pass" = "prog,link"; then
  2119. compile_deplibs="$dir/$old_library $compile_deplibs"
  2120. finalize_deplibs="$dir/$old_library $finalize_deplibs"
  2121. else
  2122. deplibs="$lib $deplibs" # used for prog,scan pass
  2123. fi
  2124. continue
  2125. fi
  2126. if test "$linkmode" = prog && test "$pass" != link; then
  2127. newlib_search_path="$newlib_search_path $ladir"
  2128. deplibs="$lib $deplibs"
  2129. linkalldeplibs=no
  2130. if test "$link_all_deplibs" != no || test -z "$library_names" ||
  2131. test "$build_libtool_libs" = no; then
  2132. linkalldeplibs=yes
  2133. fi
  2134. tmp_libs=
  2135. for deplib in $dependency_libs; do
  2136. case $deplib in
  2137. -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
  2138. esac
  2139. # Need to link against all dependency_libs?
  2140. if test "$linkalldeplibs" = yes; then
  2141. deplibs="$deplib $deplibs"
  2142. else
  2143. # Need to hardcode shared library paths
  2144. # or/and link against static libraries
  2145. newdependency_libs="$deplib $newdependency_libs"
  2146. fi
  2147. if test "X$duplicate_deps" = "Xyes" ; then
  2148. case "$tmp_libs " in
  2149. *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
  2150. esac
  2151. fi
  2152. tmp_libs="$tmp_libs $deplib"
  2153. done # for deplib
  2154. continue
  2155. fi # $linkmode = prog...
  2156. if test "$linkmode,$pass" = "prog,link"; then
  2157. if test -n "$library_names" &&
  2158. { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
  2159. # We need to hardcode the library path
  2160. if test -n "$shlibpath_var"; then
  2161. # Make sure the rpath contains only unique directories.
  2162. case "$temp_rpath " in
  2163. *" $dir "*) ;;
  2164. *" $absdir "*) ;;
  2165. *) temp_rpath="$temp_rpath $dir" ;;
  2166. esac
  2167. fi
  2168. # Hardcode the library path.
  2169. # Skip directories that are in the system default run-time
  2170. # search path.
  2171. case " $sys_lib_dlsearch_path " in
  2172. *" $absdir "*) ;;
  2173. *)
  2174. case "$compile_rpath " in
  2175. *" $absdir "*) ;;
  2176. *) compile_rpath="$compile_rpath $absdir"
  2177. esac
  2178. ;;
  2179. esac
  2180. case " $sys_lib_dlsearch_path " in
  2181. *" $libdir "*) ;;
  2182. *)
  2183. case "$finalize_rpath " in
  2184. *" $libdir "*) ;;
  2185. *) finalize_rpath="$finalize_rpath $libdir"
  2186. esac
  2187. ;;
  2188. esac
  2189. fi # $linkmode,$pass = prog,link...
  2190. if test "$alldeplibs" = yes &&
  2191. { test "$deplibs_check_method" = pass_all ||
  2192. { test "$build_libtool_libs" = yes &&
  2193. test -n "$library_names"; }; }; then
  2194. # We only need to search for static libraries
  2195. continue
  2196. fi
  2197. fi
  2198. link_static=no # Whether the deplib will be linked statically
  2199. if test -n "$library_names" &&
  2200. { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
  2201. if test "$installed" = no; then
  2202. notinst_deplibs="$notinst_deplibs $lib"
  2203. need_relink=yes
  2204. fi
  2205. # This is a shared library
  2206. # Warn about portability, can't link against -module's on
  2207. # some systems (darwin)
  2208. if test "$shouldnotlink" = yes && test "$pass" = link ; then
  2209. $echo
  2210. if test "$linkmode" = prog; then
  2211. $echo "*** Warning: Linking the executable $output against the loadable module"
  2212. else
  2213. $echo "*** Warning: Linking the shared library $output against the loadable module"
  2214. fi
  2215. $echo "*** $linklib is not portable!"
  2216. fi
  2217. if test "$linkmode" = lib &&
  2218. test "$hardcode_into_libs" = yes; then
  2219. # Hardcode the library path.
  2220. # Skip directories that are in the system default run-time
  2221. # search path.
  2222. case " $sys_lib_dlsearch_path " in
  2223. *" $absdir "*) ;;
  2224. *)
  2225. case "$compile_rpath " in
  2226. *" $absdir "*) ;;
  2227. *) compile_rpath="$compile_rpath $absdir"
  2228. esac
  2229. ;;
  2230. esac
  2231. case " $sys_lib_dlsearch_path " in
  2232. *" $libdir "*) ;;
  2233. *)
  2234. case "$finalize_rpath " in
  2235. *" $libdir "*) ;;
  2236. *) finalize_rpath="$finalize_rpath $libdir"
  2237. esac
  2238. ;;
  2239. esac
  2240. fi
  2241. if test -n "$old_archive_from_expsyms_cmds"; then
  2242. # figure out the soname
  2243. set dummy $library_names
  2244. realname="$2"
  2245. shift; shift
  2246. libname=`eval \\$echo \"$libname_spec\"`
  2247. # use dlname if we got it. it's perfectly good, no?
  2248. if test -n "$dlname"; then
  2249. soname="$dlname"
  2250. elif test -n "$soname_spec"; then
  2251. # bleh windows
  2252. case $host in
  2253. *cygwin* | mingw*)
  2254. major=`expr $current - $age`
  2255. versuffix="-$major"
  2256. ;;
  2257. esac
  2258. eval soname=\"$soname_spec\"
  2259. else
  2260. soname="$realname"
  2261. fi
  2262. # Make a new name for the extract_expsyms_cmds to use
  2263. soroot="$soname"
  2264. soname=`$echo $soroot | ${SED} -e 's/^.*\///'`
  2265. newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a"
  2266. # If the library has no export list, then create one now
  2267. if test -f "$output_objdir/$soname-def"; then :
  2268. else
  2269. $show "extracting exported symbol list from \`$soname'"
  2270. save_ifs="$IFS"; IFS='~'
  2271. cmds=$extract_expsyms_cmds
  2272. for cmd in $cmds; do
  2273. IFS="$save_ifs"
  2274. eval cmd=\"$cmd\"
  2275. $show "$cmd"
  2276. $run eval "$cmd" || exit $?
  2277. done
  2278. IFS="$save_ifs"
  2279. fi
  2280. # Create $newlib
  2281. if test -f "$output_objdir/$newlib"; then :; else
  2282. $show "generating import library for \`$soname'"
  2283. save_ifs="$IFS"; IFS='~'
  2284. cmds=$old_archive_from_expsyms_cmds
  2285. for cmd in $cmds; do
  2286. IFS="$save_ifs"
  2287. eval cmd=\"$cmd\"
  2288. $show "$cmd"
  2289. $run eval "$cmd" || exit $?
  2290. done
  2291. IFS="$save_ifs"
  2292. fi
  2293. # make sure the library variables are pointing to the new library
  2294. dir=$output_objdir
  2295. linklib=$newlib
  2296. fi # test -n "$old_archive_from_expsyms_cmds"
  2297. if test "$linkmode" = prog || test "$mode" != relink; then
  2298. add_shlibpath=
  2299. add_dir=
  2300. add=
  2301. lib_linked=yes
  2302. case $hardcode_action in
  2303. immediate | unsupported)
  2304. if test "$hardcode_direct" = no; then
  2305. add="$dir/$linklib"
  2306. case $host in
  2307. *-*-sco3.2v5* ) add_dir="-L$dir" ;;
  2308. *-*-darwin* )
  2309. # if the lib is a module then we can not link against
  2310. # it, someone is ignoring the new warnings I added
  2311. if /usr/bin/file -L $add 2> /dev/null | $EGREP "bundle" >/dev/null ; then
  2312. $echo "** Warning, lib $linklib is a module, not a shared library"
  2313. if test -z "$old_library" ; then
  2314. $echo
  2315. $echo "** And there doesn't seem to be a static archive available"
  2316. $echo "** The link will probably fail, sorry"
  2317. else
  2318. add="$dir/$old_library"
  2319. fi
  2320. fi
  2321. esac
  2322. elif test "$hardcode_minus_L" = no; then
  2323. case $host in
  2324. *-*-sunos*) add_shlibpath="$dir" ;;
  2325. esac
  2326. add_dir="-L$dir"
  2327. add="-l$name"
  2328. elif test "$hardcode_shlibpath_var" = no; then
  2329. add_shlibpath="$dir"
  2330. add="-l$name"
  2331. else
  2332. lib_linked=no
  2333. fi
  2334. ;;
  2335. relink)
  2336. if test "$hardcode_direct" = yes; then
  2337. add="$dir/$linklib"
  2338. elif test "$hardcode_minus_L" = yes; then
  2339. add_dir="-L$dir"
  2340. # Try looking first in the location we're being installed to.
  2341. if test -n "$inst_prefix_dir"; then
  2342. case "$libdir" in
  2343. [\\/]*)
  2344. add_dir="$add_dir -L$inst_prefix_dir$libdir"
  2345. ;;
  2346. esac
  2347. fi
  2348. add="-l$name"
  2349. elif test "$hardcode_shlibpath_var" = yes; then
  2350. add_shlibpath="$dir"
  2351. add="-l$name"
  2352. else
  2353. lib_linked=no
  2354. fi
  2355. ;;
  2356. *) lib_linked=no ;;
  2357. esac
  2358. if test "$lib_linked" != yes; then
  2359. $echo "$modename: configuration error: unsupported hardcode properties"
  2360. exit $EXIT_FAILURE
  2361. fi
  2362. if test -n "$add_shlibpath"; then
  2363. case :$compile_shlibpath: in
  2364. *":$add_shlibpath:"*) ;;
  2365. *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
  2366. esac
  2367. fi
  2368. if test "$linkmode" = prog; then
  2369. test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
  2370. test -n "$add" && compile_deplibs="$add $compile_deplibs"
  2371. else
  2372. test -n "$add_dir" && deplibs="$add_dir $deplibs"
  2373. test -n "$add" && deplibs="$add $deplibs"
  2374. if test "$hardcode_direct" != yes && \
  2375. test "$hardcode_minus_L" != yes && \
  2376. test "$hardcode_shlibpath_var" = yes; then
  2377. case :$finalize_shlibpath: in
  2378. *":$libdir:"*) ;;
  2379. *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
  2380. esac
  2381. fi
  2382. fi
  2383. fi
  2384. if test "$linkmode" = prog || test "$mode" = relink; then
  2385. add_shlibpath=
  2386. add_dir=
  2387. add=
  2388. # Finalize command for both is simple: just hardcode it.
  2389. if test "$hardcode_direct" = yes; then
  2390. add="$libdir/$linklib"
  2391. elif test "$hardcode_minus_L" = yes; then
  2392. add_dir="-L$libdir"
  2393. add="-l$name"
  2394. elif test "$hardcode_shlibpath_var" = yes; then
  2395. case :$finalize_shlibpath: in
  2396. *":$libdir:"*) ;;
  2397. *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
  2398. esac
  2399. add="-l$name"
  2400. elif test "$hardcode_automatic" = yes; then
  2401. if test -n "$inst_prefix_dir" &&
  2402. test -f "$inst_prefix_dir$libdir/$linklib" ; then
  2403. add="$inst_prefix_dir$libdir/$linklib"
  2404. else
  2405. add="$libdir/$linklib"
  2406. fi
  2407. else
  2408. # We cannot seem to hardcode it, guess we'll fake it.
  2409. add_dir="-L$libdir"
  2410. # Try looking first in the location we're being installed to.
  2411. if test -n "$inst_prefix_dir"; then
  2412. case "$libdir" in
  2413. [\\/]*)
  2414. add_dir="$add_dir -L$inst_prefix_dir$libdir"
  2415. ;;
  2416. esac
  2417. fi
  2418. add="-l$name"
  2419. fi
  2420. if test "$linkmode" = prog; then
  2421. test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
  2422. test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
  2423. else
  2424. test -n "$add_dir" && deplibs="$add_dir $deplibs"
  2425. test -n "$add" && deplibs="$add $deplibs"
  2426. fi
  2427. fi
  2428. elif test "$linkmode" = prog; then
  2429. # Here we assume that one of hardcode_direct or hardcode_minus_L
  2430. # is not unsupported. This is valid on all known static and
  2431. # shared platforms.
  2432. if test "$hardcode_direct" != unsupported; then
  2433. test -n "$old_library" && linklib="$old_library"
  2434. compile_deplibs="$dir/$linklib $compile_deplibs"
  2435. finalize_deplibs="$dir/$linklib $finalize_deplibs"
  2436. else
  2437. compile_deplibs="-l$name -L$dir $compile_deplibs"
  2438. finalize_deplibs="-l$name -L$dir $finalize_deplibs"
  2439. fi
  2440. elif test "$build_libtool_libs" = yes; then
  2441. # Not a shared library
  2442. if test "$deplibs_check_method" != pass_all; then
  2443. # We're trying link a shared library against a static one
  2444. # but the system doesn't support it.
  2445. # Just print a warning and add the library to dependency_libs so
  2446. # that the program can be linked against the static library.
  2447. $echo
  2448. $echo "*** Warning: This system can not link to static lib archive $lib."
  2449. $echo "*** I have the capability to make that library automatically link in when"
  2450. $echo "*** you link to this library. But I can only do this if you have a"
  2451. $echo "*** shared version of the library, which you do not appear to have."
  2452. if test "$module" = yes; then
  2453. $echo "*** But as you try to build a module library, libtool will still create "
  2454. $echo "*** a static module, that should work as long as the dlopening application"
  2455. $echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
  2456. if test -z "$global_symbol_pipe"; then
  2457. $echo
  2458. $echo "*** However, this would only work if libtool was able to extract symbol"
  2459. $echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
  2460. $echo "*** not find such a program. So, this module is probably useless."
  2461. $echo "*** \`nm' from GNU binutils and a full rebuild may help."
  2462. fi
  2463. if test "$build_old_libs" = no; then
  2464. build_libtool_libs=module
  2465. build_old_libs=yes
  2466. else
  2467. build_libtool_libs=no
  2468. fi
  2469. fi
  2470. else
  2471. convenience="$convenience $dir/$old_library"
  2472. old_convenience="$old_convenience $dir/$old_library"
  2473. deplibs="$dir/$old_library $deplibs"
  2474. link_static=yes
  2475. fi
  2476. fi # link shared/static library?
  2477. if test "$linkmode" = lib; then
  2478. if test -n "$dependency_libs" &&
  2479. { test "$hardcode_into_libs" != yes ||
  2480. test "$build_old_libs" = yes ||
  2481. test "$link_static" = yes; }; then
  2482. # Extract -R from dependency_libs
  2483. temp_deplibs=
  2484. for libdir in $dependency_libs; do
  2485. case $libdir in
  2486. -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'`
  2487. case " $xrpath " in
  2488. *" $temp_xrpath "*) ;;
  2489. *) xrpath="$xrpath $temp_xrpath";;
  2490. esac;;
  2491. *) temp_deplibs="$temp_deplibs $libdir";;
  2492. esac
  2493. done
  2494. dependency_libs="$temp_deplibs"
  2495. fi
  2496. newlib_search_path="$newlib_search_path $absdir"
  2497. # Link against this library
  2498. test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
  2499. # ... and its dependency_libs
  2500. tmp_libs=
  2501. for deplib in $dependency_libs; do
  2502. newdependency_libs="$deplib $newdependency_libs"
  2503. if test "X$duplicate_deps" = "Xyes" ; then
  2504. case "$tmp_libs " in
  2505. *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
  2506. esac
  2507. fi
  2508. tmp_libs="$tmp_libs $deplib"
  2509. done
  2510. if test "$link_all_deplibs" != no; then
  2511. # Add the search paths of all dependency libraries
  2512. for deplib in $dependency_libs; do
  2513. case $deplib in
  2514. -L*) path="$deplib" ;;
  2515. *.la)
  2516. dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'`
  2517. test "X$dir" = "X$deplib" && dir="."
  2518. # We need an absolute path.
  2519. case $dir in
  2520. [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
  2521. *)
  2522. absdir=`cd "$dir" && pwd`
  2523. if test -z "$absdir"; then
  2524. $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
  2525. absdir="$dir"
  2526. fi
  2527. ;;
  2528. esac
  2529. if grep "^installed=no" $deplib > /dev/null; then
  2530. path="$absdir/$objdir"
  2531. else
  2532. eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
  2533. if test -z "$libdir"; then
  2534. $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
  2535. exit $EXIT_FAILURE
  2536. fi
  2537. if test "$absdir" != "$libdir"; then
  2538. $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2
  2539. fi
  2540. path="$absdir"
  2541. fi
  2542. depdepl=
  2543. case $host in
  2544. *-*-darwin*)
  2545. # we do not want to link against static libs,
  2546. # but need to link against shared
  2547. eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
  2548. if test -n "$deplibrary_names" ; then
  2549. for tmp in $deplibrary_names ; do
  2550. depdepl=$tmp
  2551. done
  2552. if test -f "$path/$depdepl" ; then
  2553. depdepl="$path/$depdepl"
  2554. fi
  2555. # do not add paths which are already there
  2556. case " $newlib_search_path " in
  2557. *" $path "*) ;;
  2558. *) newlib_search_path="$newlib_search_path $path";;
  2559. esac
  2560. fi
  2561. path=""
  2562. ;;
  2563. *)
  2564. path="-L$path"
  2565. ;;
  2566. esac
  2567. ;;
  2568. -l*)
  2569. case $host in
  2570. *-*-darwin*)
  2571. # Again, we only want to link against shared libraries
  2572. eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"`
  2573. for tmp in $newlib_search_path ; do
  2574. if test -f "$tmp/lib$tmp_libs.dylib" ; then
  2575. eval depdepl="$tmp/lib$tmp_libs.dylib"
  2576. break
  2577. fi
  2578. done
  2579. path=""
  2580. ;;
  2581. *) continue ;;
  2582. esac
  2583. ;;
  2584. *) continue ;;
  2585. esac
  2586. case " $deplibs " in
  2587. *" $depdepl "*) ;;
  2588. *) deplibs="$depdepl $deplibs" ;;
  2589. esac
  2590. case " $deplibs " in
  2591. *" $path "*) ;;
  2592. *) deplibs="$deplibs $path" ;;
  2593. esac
  2594. done
  2595. fi # link_all_deplibs != no
  2596. fi # linkmode = lib
  2597. done # for deplib in $libs
  2598. dependency_libs="$newdependency_libs"
  2599. if test "$pass" = dlpreopen; then
  2600. # Link the dlpreopened libraries before other libraries
  2601. for deplib in $save_deplibs; do
  2602. deplibs="$deplib $deplibs"
  2603. done
  2604. fi
  2605. if test "$pass" != dlopen; then
  2606. if test "$pass" != conv; then
  2607. # Make sure lib_search_path contains only unique directories.
  2608. lib_search_path=
  2609. for dir in $newlib_search_path; do
  2610. case "$lib_search_path " in
  2611. *" $dir "*) ;;
  2612. *) lib_search_path="$lib_search_path $dir" ;;
  2613. esac
  2614. done
  2615. newlib_search_path=
  2616. fi
  2617. if test "$linkmode,$pass" != "prog,link"; then
  2618. vars="deplibs"
  2619. else
  2620. vars="compile_deplibs finalize_deplibs"
  2621. fi
  2622. for var in $vars dependency_libs; do
  2623. # Add libraries to $var in reverse order
  2624. eval tmp_libs=\"\$$var\"
  2625. new_libs=
  2626. for deplib in $tmp_libs; do
  2627. # FIXME: Pedantically, this is the right thing to do, so
  2628. # that some nasty dependency loop isn't accidentally
  2629. # broken:
  2630. #new_libs="$deplib $new_libs"
  2631. # Pragmatically, this seems to cause very few problems in
  2632. # practice:
  2633. case $deplib in
  2634. -L*) new_libs="$deplib $new_libs" ;;
  2635. -R*) ;;
  2636. *)
  2637. # And here is the reason: when a library appears more
  2638. # than once as an explicit dependence of a library, or
  2639. # is implicitly linked in more than once by the
  2640. # compiler, it is considered special, and multiple
  2641. # occurrences thereof are not removed. Compare this
  2642. # with having the same library being listed as a
  2643. # dependency of multiple other libraries: in this case,
  2644. # we know (pedantically, we assume) the library does not
  2645. # need to be listed more than once, so we keep only the
  2646. # last copy. This is not always right, but it is rare
  2647. # enough that we require users that really mean to play
  2648. # such unportable linking tricks to link the library
  2649. # using -Wl,-lname, so that libtool does not consider it
  2650. # for duplicate removal.
  2651. case " $specialdeplibs " in
  2652. *" $deplib "*) new_libs="$deplib $new_libs" ;;
  2653. *)
  2654. case " $new_libs " in
  2655. *" $deplib "*) ;;
  2656. *) new_libs="$deplib $new_libs" ;;
  2657. esac
  2658. ;;
  2659. esac
  2660. ;;
  2661. esac
  2662. done
  2663. tmp_libs=
  2664. for deplib in $new_libs; do
  2665. case $deplib in
  2666. -L*)
  2667. case " $tmp_libs " in
  2668. *" $deplib "*) ;;
  2669. *) tmp_libs="$tmp_libs $deplib" ;;
  2670. esac
  2671. ;;
  2672. *) tmp_libs="$tmp_libs $deplib" ;;
  2673. esac
  2674. done
  2675. eval $var=\"$tmp_libs\"
  2676. done # for var
  2677. fi
  2678. # Last step: remove runtime libs from dependency_libs
  2679. # (they stay in deplibs)
  2680. tmp_libs=
  2681. for i in $dependency_libs ; do
  2682. case " $predeps $postdeps $compiler_lib_search_path " in
  2683. *" $i "*)
  2684. i=""
  2685. ;;
  2686. esac
  2687. if test -n "$i" ; then
  2688. tmp_libs="$tmp_libs $i"
  2689. fi
  2690. done
  2691. dependency_libs=$tmp_libs
  2692. done # for pass
  2693. if test "$linkmode" = prog; then
  2694. dlfiles="$newdlfiles"
  2695. dlprefiles="$newdlprefiles"
  2696. fi
  2697. case $linkmode in
  2698. oldlib)
  2699. if test -n "$deplibs"; then
  2700. $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2
  2701. fi
  2702. if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
  2703. $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
  2704. fi
  2705. if test -n "$rpath"; then
  2706. $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2
  2707. fi
  2708. if test -n "$xrpath"; then
  2709. $echo "$modename: warning: \`-R' is ignored for archives" 1>&2
  2710. fi
  2711. if test -n "$vinfo"; then
  2712. $echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2
  2713. fi
  2714. if test -n "$release"; then
  2715. $echo "$modename: warning: \`-release' is ignored for archives" 1>&2
  2716. fi
  2717. if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
  2718. $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2
  2719. fi
  2720. # Now set the variables for building old libraries.
  2721. build_libtool_libs=no
  2722. oldlibs="$output"
  2723. objs="$objs$old_deplibs"
  2724. ;;
  2725. lib)
  2726. # Make sure we only generate libraries of the form `libNAME.la'.
  2727. case $outputname in
  2728. lib*)
  2729. name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
  2730. eval shared_ext=\"$shrext_cmds\"
  2731. eval libname=\"$libname_spec\"
  2732. ;;
  2733. *)
  2734. if test "$module" = no; then
  2735. $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
  2736. $echo "$help" 1>&2
  2737. exit $EXIT_FAILURE
  2738. fi
  2739. if test "$need_lib_prefix" != no; then
  2740. # Add the "lib" prefix for modules if required
  2741. name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
  2742. eval shared_ext=\"$shrext_cmds\"
  2743. eval libname=\"$libname_spec\"
  2744. else
  2745. libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
  2746. fi
  2747. ;;
  2748. esac
  2749. if test -n "$objs"; then
  2750. if test "$deplibs_check_method" != pass_all; then
  2751. $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1
  2752. exit $EXIT_FAILURE
  2753. else
  2754. $echo
  2755. $echo "*** Warning: Linking the shared library $output against the non-libtool"
  2756. $echo "*** objects $objs is not portable!"
  2757. libobjs="$libobjs $objs"
  2758. fi
  2759. fi
  2760. if test "$dlself" != no; then
  2761. $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2
  2762. fi
  2763. set dummy $rpath
  2764. if test "$#" -gt 2; then
  2765. $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
  2766. fi
  2767. install_libdir="$2"
  2768. oldlibs=
  2769. if test -z "$rpath"; then
  2770. if test "$build_libtool_libs" = yes; then
  2771. # Building a libtool convenience library.
  2772. # Some compilers have problems with a `.al' extension so
  2773. # convenience libraries should have the same extension an
  2774. # archive normally would.
  2775. oldlibs="$output_objdir/$libname.$libext $oldlibs"
  2776. build_libtool_libs=convenience
  2777. build_old_libs=yes
  2778. fi
  2779. if test -n "$vinfo"; then
  2780. $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2
  2781. fi
  2782. if test -n "$release"; then
  2783. $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2
  2784. fi
  2785. else
  2786. # Parse the version information argument.
  2787. save_ifs="$IFS"; IFS=':'
  2788. set dummy $vinfo 0 0 0
  2789. IFS="$save_ifs"
  2790. if test -n "$8"; then
  2791. $echo "$modename: too many parameters to \`-version-info'" 1>&2
  2792. $echo "$help" 1>&2
  2793. exit $EXIT_FAILURE
  2794. fi
  2795. # convert absolute version numbers to libtool ages
  2796. # this retains compatibility with .la files and attempts
  2797. # to make the code below a bit more comprehensible
  2798. case $vinfo_number in
  2799. yes)
  2800. number_major="$2"
  2801. number_minor="$3"
  2802. number_revision="$4"
  2803. #
  2804. # There are really only two kinds -- those that
  2805. # use the current revision as the major version
  2806. # and those that subtract age and use age as
  2807. # a minor version. But, then there is irix
  2808. # which has an extra 1 added just for fun
  2809. #
  2810. case $version_type in
  2811. darwin|linux|osf|windows)
  2812. current=`expr $number_major + $number_minor`
  2813. age="$number_minor"
  2814. revision="$number_revision"
  2815. ;;
  2816. freebsd-aout|freebsd-elf|sunos)
  2817. current="$number_major"
  2818. revision="$number_minor"
  2819. age="0"
  2820. ;;
  2821. irix|nonstopux)
  2822. current=`expr $number_major + $number_minor - 1`
  2823. age="$number_minor"
  2824. revision="$number_minor"
  2825. ;;
  2826. esac
  2827. ;;
  2828. no)
  2829. current="$2"
  2830. revision="$3"
  2831. age="$4"
  2832. ;;
  2833. esac
  2834. # Check that each of the things are valid numbers.
  2835. case $current in
  2836. 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
  2837. *)
  2838. $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2
  2839. $echo "$modename: \`$vinfo' is not valid version information" 1>&2
  2840. exit $EXIT_FAILURE
  2841. ;;
  2842. esac
  2843. case $revision in
  2844. 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
  2845. *)
  2846. $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2
  2847. $echo "$modename: \`$vinfo' is not valid version information" 1>&2
  2848. exit $EXIT_FAILURE
  2849. ;;
  2850. esac
  2851. case $age in
  2852. 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
  2853. *)
  2854. $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2
  2855. $echo "$modename: \`$vinfo' is not valid version information" 1>&2
  2856. exit $EXIT_FAILURE
  2857. ;;
  2858. esac
  2859. if test "$age" -gt "$current"; then
  2860. $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
  2861. $echo "$modename: \`$vinfo' is not valid version information" 1>&2
  2862. exit $EXIT_FAILURE
  2863. fi
  2864. # Calculate the version variables.
  2865. major=
  2866. versuffix=
  2867. verstring=
  2868. case $version_type in
  2869. none) ;;
  2870. darwin)
  2871. # Like Linux, but with the current version available in
  2872. # verstring for coding it into the library header
  2873. major=.`expr $current - $age`
  2874. versuffix="$major.$age.$revision"
  2875. # Darwin ld doesn't like 0 for these options...
  2876. minor_current=`expr $current + 1`
  2877. verstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
  2878. ;;
  2879. freebsd-aout)
  2880. major=".$current"
  2881. versuffix=".$current.$revision";
  2882. ;;
  2883. freebsd-elf)
  2884. major=".$current"
  2885. versuffix=".$current";
  2886. ;;
  2887. irix | nonstopux)
  2888. major=`expr $current - $age + 1`
  2889. case $version_type in
  2890. nonstopux) verstring_prefix=nonstopux ;;
  2891. *) verstring_prefix=sgi ;;
  2892. esac
  2893. verstring="$verstring_prefix$major.$revision"
  2894. # Add in all the interfaces that we are compatible with.
  2895. loop=$revision
  2896. while test "$loop" -ne 0; do
  2897. iface=`expr $revision - $loop`
  2898. loop=`expr $loop - 1`
  2899. verstring="$verstring_prefix$major.$iface:$verstring"
  2900. done
  2901. # Before this point, $major must not contain `.'.
  2902. major=.$major
  2903. versuffix="$major.$revision"
  2904. ;;
  2905. linux)
  2906. major=.`expr $current - $age`
  2907. versuffix="$major.$age.$revision"
  2908. ;;
  2909. osf)
  2910. major=.`expr $current - $age`
  2911. versuffix=".$current.$age.$revision"
  2912. verstring="$current.$age.$revision"
  2913. # Add in all the interfaces that we are compatible with.
  2914. loop=$age
  2915. while test "$loop" -ne 0; do
  2916. iface=`expr $current - $loop`
  2917. loop=`expr $loop - 1`
  2918. verstring="$verstring:${iface}.0"
  2919. done
  2920. # Make executables depend on our current version.
  2921. verstring="$verstring:${current}.0"
  2922. ;;
  2923. sunos)
  2924. major=".$current"
  2925. versuffix=".$current.$revision"
  2926. ;;
  2927. windows)
  2928. # Use '-' rather than '.', since we only want one
  2929. # extension on DOS 8.3 filesystems.
  2930. major=`expr $current - $age`
  2931. versuffix="-$major"
  2932. ;;
  2933. *)
  2934. $echo "$modename: unknown library version type \`$version_type'" 1>&2
  2935. $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
  2936. exit $EXIT_FAILURE
  2937. ;;
  2938. esac
  2939. # Clear the version info if we defaulted, and they specified a release.
  2940. if test -z "$vinfo" && test -n "$release"; then
  2941. major=
  2942. case $version_type in
  2943. darwin)
  2944. # we can't check for "0.0" in archive_cmds due to quoting
  2945. # problems, so we reset it completely
  2946. verstring=
  2947. ;;
  2948. *)
  2949. verstring="0.0"
  2950. ;;
  2951. esac
  2952. if test "$need_version" = no; then
  2953. versuffix=
  2954. else
  2955. versuffix=".0.0"
  2956. fi
  2957. fi
  2958. # Remove version info from name if versioning should be avoided
  2959. if test "$avoid_version" = yes && test "$need_version" = no; then
  2960. major=
  2961. versuffix=
  2962. verstring=""
  2963. fi
  2964. # Check to see if the archive will have undefined symbols.
  2965. if test "$allow_undefined" = yes; then
  2966. if test "$allow_undefined_flag" = unsupported; then
  2967. $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
  2968. build_libtool_libs=no
  2969. build_old_libs=yes
  2970. fi
  2971. else
  2972. # Don't allow undefined symbols.
  2973. allow_undefined_flag="$no_undefined_flag"
  2974. fi
  2975. fi
  2976. if test "$mode" != relink; then
  2977. # Remove our outputs, but don't remove object files since they
  2978. # may have been created when compiling PIC objects.
  2979. removelist=
  2980. tempremovelist=`$echo "$output_objdir/*"`
  2981. for p in $tempremovelist; do
  2982. case $p in
  2983. *.$objext)
  2984. ;;
  2985. $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
  2986. if test "X$precious_files_regex" != "X"; then
  2987. if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
  2988. then
  2989. continue
  2990. fi
  2991. fi
  2992. removelist="$removelist $p"
  2993. ;;
  2994. *) ;;
  2995. esac
  2996. done
  2997. if test -n "$removelist"; then
  2998. $show "${rm}r $removelist"
  2999. $run ${rm}r $removelist
  3000. fi
  3001. fi
  3002. # Now set the variables for building old libraries.
  3003. if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
  3004. oldlibs="$oldlibs $output_objdir/$libname.$libext"
  3005. # Transform .lo files to .o files.
  3006. oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
  3007. fi
  3008. # Eliminate all temporary directories.
  3009. for path in $notinst_path; do
  3010. lib_search_path=`$echo "$lib_search_path " | ${SED} -e 's% $path % %g'`
  3011. deplibs=`$echo "$deplibs " | ${SED} -e 's% -L$path % %g'`
  3012. dependency_libs=`$echo "$dependency_libs " | ${SED} -e 's% -L$path % %g'`
  3013. done
  3014. if test -n "$xrpath"; then
  3015. # If the user specified any rpath flags, then add them.
  3016. temp_xrpath=
  3017. for libdir in $xrpath; do
  3018. temp_xrpath="$temp_xrpath -R$libdir"
  3019. case "$finalize_rpath " in
  3020. *" $libdir "*) ;;
  3021. *) finalize_rpath="$finalize_rpath $libdir" ;;
  3022. esac
  3023. done
  3024. if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
  3025. dependency_libs="$temp_xrpath $dependency_libs"
  3026. fi
  3027. fi
  3028. # Make sure dlfiles contains only unique files that won't be dlpreopened
  3029. old_dlfiles="$dlfiles"
  3030. dlfiles=
  3031. for lib in $old_dlfiles; do
  3032. case " $dlprefiles $dlfiles " in
  3033. *" $lib "*) ;;
  3034. *) dlfiles="$dlfiles $lib" ;;
  3035. esac
  3036. done
  3037. # Make sure dlprefiles contains only unique files
  3038. old_dlprefiles="$dlprefiles"
  3039. dlprefiles=
  3040. for lib in $old_dlprefiles; do
  3041. case "$dlprefiles " in
  3042. *" $lib "*) ;;
  3043. *) dlprefiles="$dlprefiles $lib" ;;
  3044. esac
  3045. done
  3046. if test "$build_libtool_libs" = yes; then
  3047. if test -n "$rpath"; then
  3048. case $host in
  3049. *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*)
  3050. # these systems don't actually have a c library (as such)!
  3051. ;;
  3052. *-*-rhapsody* | *-*-darwin1.[012])
  3053. # Rhapsody C library is in the System framework
  3054. deplibs="$deplibs -framework System"
  3055. ;;
  3056. *-*-netbsd*)
  3057. # Don't link with libc until the a.out ld.so is fixed.
  3058. ;;
  3059. *-*-openbsd* | *-*-freebsd*)
  3060. # Do not include libc due to us having libc/libc_r.
  3061. test "X$arg" = "X-lc" && continue
  3062. ;;
  3063. *)
  3064. # Add libc to deplibs on all other systems if necessary.
  3065. if test "$build_libtool_need_lc" = "yes"; then
  3066. deplibs="$deplibs -lc"
  3067. fi
  3068. ;;
  3069. esac
  3070. fi
  3071. # Transform deplibs into only deplibs that can be linked in shared.
  3072. name_save=$name
  3073. libname_save=$libname
  3074. release_save=$release
  3075. versuffix_save=$versuffix
  3076. major_save=$major
  3077. # I'm not sure if I'm treating the release correctly. I think
  3078. # release should show up in the -l (ie -lgmp5) so we don't want to
  3079. # add it in twice. Is that correct?
  3080. release=""
  3081. versuffix=""
  3082. major=""
  3083. newdeplibs=
  3084. droppeddeps=no
  3085. case $deplibs_check_method in
  3086. pass_all)
  3087. # Don't check for shared/static. Everything works.
  3088. # This might be a little naive. We might want to check
  3089. # whether the library exists or not. But this is on
  3090. # osf3 & osf4 and I'm not really sure... Just
  3091. # implementing what was already the behavior.
  3092. newdeplibs=$deplibs
  3093. ;;
  3094. test_compile)
  3095. # This code stresses the "libraries are programs" paradigm to its
  3096. # limits. Maybe even breaks it. We compile a program, linking it
  3097. # against the deplibs as a proxy for the library. Then we can check
  3098. # whether they linked in statically or dynamically with ldd.
  3099. $rm conftest.c
  3100. cat > conftest.c <<EOF
  3101. int main() { return 0; }
  3102. EOF
  3103. $rm conftest
  3104. $LTCC -o conftest conftest.c $deplibs
  3105. if test "$?" -eq 0 ; then
  3106. ldd_output=`ldd conftest`
  3107. for i in $deplibs; do
  3108. name="`expr $i : '-l\(.*\)'`"
  3109. # If $name is empty we are operating on a -L argument.
  3110. if test "$name" != "" && test "$name" -ne "0"; then
  3111. if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
  3112. case " $predeps $postdeps " in
  3113. *" $i "*)
  3114. newdeplibs="$newdeplibs $i"
  3115. i=""
  3116. ;;
  3117. esac
  3118. fi
  3119. if test -n "$i" ; then
  3120. libname=`eval \\$echo \"$libname_spec\"`
  3121. deplib_matches=`eval \\$echo \"$library_names_spec\"`
  3122. set dummy $deplib_matches
  3123. deplib_match=$2
  3124. if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
  3125. newdeplibs="$newdeplibs $i"
  3126. else
  3127. droppeddeps=yes
  3128. $echo
  3129. $echo "*** Warning: dynamic linker does not accept needed library $i."
  3130. $echo "*** I have the capability to make that library automatically link in when"
  3131. $echo "*** you link to this library. But I can only do this if you have a"
  3132. $echo "*** shared version of the library, which I believe you do not have"
  3133. $echo "*** because a test_compile did reveal that the linker did not use it for"
  3134. $echo "*** its dynamic dependency list that programs get resolved with at runtime."
  3135. fi
  3136. fi
  3137. else
  3138. newdeplibs="$newdeplibs $i"
  3139. fi
  3140. done
  3141. else
  3142. # Error occurred in the first compile. Let's try to salvage
  3143. # the situation: Compile a separate program for each library.
  3144. for i in $deplibs; do
  3145. name="`expr $i : '-l\(.*\)'`"
  3146. # If $name is empty we are operating on a -L argument.
  3147. if test "$name" != "" && test "$name" != "0"; then
  3148. $rm conftest
  3149. $LTCC -o conftest conftest.c $i
  3150. # Did it work?
  3151. if test "$?" -eq 0 ; then
  3152. ldd_output=`ldd conftest`
  3153. if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
  3154. case " $predeps $postdeps " in
  3155. *" $i "*)
  3156. newdeplibs="$newdeplibs $i"
  3157. i=""
  3158. ;;
  3159. esac
  3160. fi
  3161. if test -n "$i" ; then
  3162. libname=`eval \\$echo \"$libname_spec\"`
  3163. deplib_matches=`eval \\$echo \"$library_names_spec\"`
  3164. set dummy $deplib_matches
  3165. deplib_match=$2
  3166. if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
  3167. newdeplibs="$newdeplibs $i"
  3168. else
  3169. droppeddeps=yes
  3170. $echo
  3171. $echo "*** Warning: dynamic linker does not accept needed library $i."
  3172. $echo "*** I have the capability to make that library automatically link in when"
  3173. $echo "*** you link to this library. But I can only do this if you have a"
  3174. $echo "*** shared version of the library, which you do not appear to have"
  3175. $echo "*** because a test_compile did reveal that the linker did not use this one"
  3176. $echo "*** as a dynamic dependency that programs can get resolved with at runtime."
  3177. fi
  3178. fi
  3179. else
  3180. droppeddeps=yes
  3181. $echo
  3182. $echo "*** Warning! Library $i is needed by this library but I was not able to"
  3183. $echo "*** make it link in! You will probably need to install it or some"
  3184. $echo "*** library that it depends on before this library will be fully"
  3185. $echo "*** functional. Installing it before continuing would be even better."
  3186. fi
  3187. else
  3188. newdeplibs="$newdeplibs $i"
  3189. fi
  3190. done
  3191. fi
  3192. ;;
  3193. file_magic*)
  3194. set dummy $deplibs_check_method
  3195. file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
  3196. for a_deplib in $deplibs; do
  3197. name="`expr $a_deplib : '-l\(.*\)'`"
  3198. # If $name is empty we are operating on a -L argument.
  3199. if test "$name" != "" && test "$name" != "0"; then
  3200. if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
  3201. case " $predeps $postdeps " in
  3202. *" $a_deplib "*)
  3203. newdeplibs="$newdeplibs $a_deplib"
  3204. a_deplib=""
  3205. ;;
  3206. esac
  3207. fi
  3208. if test -n "$a_deplib" ; then
  3209. libname=`eval \\$echo \"$libname_spec\"`
  3210. for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
  3211. potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
  3212. for potent_lib in $potential_libs; do
  3213. # Follow soft links.
  3214. if ls -lLd "$potent_lib" 2>/dev/null \
  3215. | grep " -> " >/dev/null; then
  3216. continue
  3217. fi
  3218. # The statement above tries to avoid entering an
  3219. # endless loop below, in case of cyclic links.
  3220. # We might still enter an endless loop, since a link
  3221. # loop can be closed while we follow links,
  3222. # but so what?
  3223. potlib="$potent_lib"
  3224. while test -h "$potlib" 2>/dev/null; do
  3225. potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
  3226. case $potliblink in
  3227. [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
  3228. *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
  3229. esac
  3230. done
  3231. if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
  3232. | ${SED} 10q \
  3233. | $EGREP "$file_magic_regex" > /dev/null; then
  3234. newdeplibs="$newdeplibs $a_deplib"
  3235. a_deplib=""
  3236. break 2
  3237. fi
  3238. done
  3239. done
  3240. fi
  3241. if test -n "$a_deplib" ; then
  3242. droppeddeps=yes
  3243. $echo
  3244. $echo "*** Warning: linker path does not have real file for library $a_deplib."
  3245. $echo "*** I have the capability to make that library automatically link in when"
  3246. $echo "*** you link to this library. But I can only do this if you have a"
  3247. $echo "*** shared version of the library, which you do not appear to have"
  3248. $echo "*** because I did check the linker path looking for a file starting"
  3249. if test -z "$potlib" ; then
  3250. $echo "*** with $libname but no candidates were found. (...for file magic test)"
  3251. else
  3252. $echo "*** with $libname and none of the candidates passed a file format test"
  3253. $echo "*** using a file magic. Last file checked: $potlib"
  3254. fi
  3255. fi
  3256. else
  3257. # Add a -L argument.
  3258. newdeplibs="$newdeplibs $a_deplib"
  3259. fi
  3260. done # Gone through all deplibs.
  3261. ;;
  3262. match_pattern*)
  3263. set dummy $deplibs_check_method
  3264. match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
  3265. for a_deplib in $deplibs; do
  3266. name="`expr $a_deplib : '-l\(.*\)'`"
  3267. # If $name is empty we are operating on a -L argument.
  3268. if test -n "$name" && test "$name" != "0"; then
  3269. if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
  3270. case " $predeps $postdeps " in
  3271. *" $a_deplib "*)
  3272. newdeplibs="$newdeplibs $a_deplib"
  3273. a_deplib=""
  3274. ;;
  3275. esac
  3276. fi
  3277. if test -n "$a_deplib" ; then
  3278. libname=`eval \\$echo \"$libname_spec\"`
  3279. for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
  3280. potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
  3281. for potent_lib in $potential_libs; do
  3282. potlib="$potent_lib" # see symlink-check above in file_magic test
  3283. if eval $echo \"$potent_lib\" 2>/dev/null \
  3284. | ${SED} 10q \
  3285. | $EGREP "$match_pattern_regex" > /dev/null; then
  3286. newdeplibs="$newdeplibs $a_deplib"
  3287. a_deplib=""
  3288. break 2
  3289. fi
  3290. done
  3291. done
  3292. fi
  3293. if test -n "$a_deplib" ; then
  3294. droppeddeps=yes
  3295. $echo
  3296. $echo "*** Warning: linker path does not have real file for library $a_deplib."
  3297. $echo "*** I have the capability to make that library automatically link in when"
  3298. $echo "*** you link to this library. But I can only do this if you have a"
  3299. $echo "*** shared version of the library, which you do not appear to have"
  3300. $echo "*** because I did check the linker path looking for a file starting"
  3301. if test -z "$potlib" ; then
  3302. $echo "*** with $libname but no candidates were found. (...for regex pattern test)"
  3303. else
  3304. $echo "*** with $libname and none of the candidates passed a file format test"
  3305. $echo "*** using a regex pattern. Last file checked: $potlib"
  3306. fi
  3307. fi
  3308. else
  3309. # Add a -L argument.
  3310. newdeplibs="$newdeplibs $a_deplib"
  3311. fi
  3312. done # Gone through all deplibs.
  3313. ;;
  3314. none | unknown | *)
  3315. newdeplibs=""
  3316. tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
  3317. -e 's/ -[LR][^ ]*//g'`
  3318. if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
  3319. for i in $predeps $postdeps ; do
  3320. # can't use Xsed below, because $i might contain '/'
  3321. tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"`
  3322. done
  3323. fi
  3324. if $echo "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' \
  3325. | grep . >/dev/null; then
  3326. $echo
  3327. if test "X$deplibs_check_method" = "Xnone"; then
  3328. $echo "*** Warning: inter-library dependencies are not supported in this platform."
  3329. else
  3330. $echo "*** Warning: inter-library dependencies are not known to be supported."
  3331. fi
  3332. $echo "*** All declared inter-library dependencies are being dropped."
  3333. droppeddeps=yes
  3334. fi
  3335. ;;
  3336. esac
  3337. versuffix=$versuffix_save
  3338. major=$major_save
  3339. release=$release_save
  3340. libname=$libname_save
  3341. name=$name_save
  3342. case $host in
  3343. *-*-rhapsody* | *-*-darwin1.[012])
  3344. # On Rhapsody replace the C library is the System framework
  3345. newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'`
  3346. ;;
  3347. esac
  3348. if test "$droppeddeps" = yes; then
  3349. if test "$module" = yes; then
  3350. $echo
  3351. $echo "*** Warning: libtool could not satisfy all declared inter-library"
  3352. $echo "*** dependencies of module $libname. Therefore, libtool will create"
  3353. $echo "*** a static module, that should work as long as the dlopening"
  3354. $echo "*** application is linked with the -dlopen flag."
  3355. if test -z "$global_symbol_pipe"; then
  3356. $echo
  3357. $echo "*** However, this would only work if libtool was able to extract symbol"
  3358. $echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
  3359. $echo "*** not find such a program. So, this module is probably useless."
  3360. $echo "*** \`nm' from GNU binutils and a full rebuild may help."
  3361. fi
  3362. if test "$build_old_libs" = no; then
  3363. oldlibs="$output_objdir/$libname.$libext"
  3364. build_libtool_libs=module
  3365. build_old_libs=yes
  3366. else
  3367. build_libtool_libs=no
  3368. fi
  3369. else
  3370. $echo "*** The inter-library dependencies that have been dropped here will be"
  3371. $echo "*** automatically added whenever a program is linked with this library"
  3372. $echo "*** or is declared to -dlopen it."
  3373. if test "$allow_undefined" = no; then
  3374. $echo
  3375. $echo "*** Since this library must not contain undefined symbols,"
  3376. $echo "*** because either the platform does not support them or"
  3377. $echo "*** it was explicitly requested with -no-undefined,"
  3378. $echo "*** libtool will only create a static version of it."
  3379. if test "$build_old_libs" = no; then
  3380. oldlibs="$output_objdir/$libname.$libext"
  3381. build_libtool_libs=module
  3382. build_old_libs=yes
  3383. else
  3384. build_libtool_libs=no
  3385. fi
  3386. fi
  3387. fi
  3388. fi
  3389. # Done checking deplibs!
  3390. deplibs=$newdeplibs
  3391. fi
  3392. # All the library-specific variables (install_libdir is set above).
  3393. library_names=
  3394. old_library=
  3395. dlname=
  3396. # Test again, we may have decided not to build it any more
  3397. if test "$build_libtool_libs" = yes; then
  3398. if test "$hardcode_into_libs" = yes; then
  3399. # Hardcode the library paths
  3400. hardcode_libdirs=
  3401. dep_rpath=
  3402. rpath="$finalize_rpath"
  3403. test "$mode" != relink && rpath="$compile_rpath$rpath"
  3404. for libdir in $rpath; do
  3405. if test -n "$hardcode_libdir_flag_spec"; then
  3406. if test -n "$hardcode_libdir_separator"; then
  3407. if test -z "$hardcode_libdirs"; then
  3408. hardcode_libdirs="$libdir"
  3409. else
  3410. # Just accumulate the unique libdirs.
  3411. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
  3412. *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
  3413. ;;
  3414. *)
  3415. hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
  3416. ;;
  3417. esac
  3418. fi
  3419. else
  3420. eval flag=\"$hardcode_libdir_flag_spec\"
  3421. dep_rpath="$dep_rpath $flag"
  3422. fi
  3423. elif test -n "$runpath_var"; then
  3424. case "$perm_rpath " in
  3425. *" $libdir "*) ;;
  3426. *) perm_rpath="$perm_rpath $libdir" ;;
  3427. esac
  3428. fi
  3429. done
  3430. # Substitute the hardcoded libdirs into the rpath.
  3431. if test -n "$hardcode_libdir_separator" &&
  3432. test -n "$hardcode_libdirs"; then
  3433. libdir="$hardcode_libdirs"
  3434. if test -n "$hardcode_libdir_flag_spec_ld"; then
  3435. eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\"
  3436. else
  3437. eval dep_rpath=\"$hardcode_libdir_flag_spec\"
  3438. fi
  3439. fi
  3440. if test -n "$runpath_var" && test -n "$perm_rpath"; then
  3441. # We should set the runpath_var.
  3442. rpath=
  3443. for dir in $perm_rpath; do
  3444. rpath="$rpath$dir:"
  3445. done
  3446. eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
  3447. fi
  3448. test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
  3449. fi
  3450. shlibpath="$finalize_shlibpath"
  3451. test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
  3452. if test -n "$shlibpath"; then
  3453. eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
  3454. fi
  3455. # Get the real and link names of the library.
  3456. eval shared_ext=\"$shrext_cmds\"
  3457. eval library_names=\"$library_names_spec\"
  3458. set dummy $library_names
  3459. realname="$2"
  3460. shift; shift
  3461. if test -n "$soname_spec"; then
  3462. eval soname=\"$soname_spec\"
  3463. else
  3464. soname="$realname"
  3465. fi
  3466. if test -z "$dlname"; then
  3467. dlname=$soname
  3468. fi
  3469. lib="$output_objdir/$realname"
  3470. for link
  3471. do
  3472. linknames="$linknames $link"
  3473. done
  3474. # Use standard objects if they are pic
  3475. test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
  3476. # Prepare the list of exported symbols
  3477. if test -z "$export_symbols"; then
  3478. if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
  3479. $show "generating symbol list for \`$libname.la'"
  3480. export_symbols="$output_objdir/$libname.exp"
  3481. $run $rm $export_symbols
  3482. cmds=$export_symbols_cmds
  3483. save_ifs="$IFS"; IFS='~'
  3484. for cmd in $cmds; do
  3485. IFS="$save_ifs"
  3486. eval cmd=\"$cmd\"
  3487. if len=`expr "X$cmd" : ".*"` &&
  3488. test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
  3489. $show "$cmd"
  3490. $run eval "$cmd" || exit $?
  3491. skipped_export=false
  3492. else
  3493. # The command line is too long to execute in one step.
  3494. $show "using reloadable object file for export list..."
  3495. skipped_export=:
  3496. fi
  3497. done
  3498. IFS="$save_ifs"
  3499. if test -n "$export_symbols_regex"; then
  3500. $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
  3501. $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
  3502. $show "$mv \"${export_symbols}T\" \"$export_symbols\""
  3503. $run eval '$mv "${export_symbols}T" "$export_symbols"'
  3504. fi
  3505. fi
  3506. fi
  3507. if test -n "$export_symbols" && test -n "$include_expsyms"; then
  3508. $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
  3509. fi
  3510. tmp_deplibs=
  3511. for test_deplib in $deplibs; do
  3512. case " $convenience " in
  3513. *" $test_deplib "*) ;;
  3514. *)
  3515. tmp_deplibs="$tmp_deplibs $test_deplib"
  3516. ;;
  3517. esac
  3518. done
  3519. deplibs="$tmp_deplibs"
  3520. if test -n "$convenience"; then
  3521. if test -n "$whole_archive_flag_spec"; then
  3522. save_libobjs=$libobjs
  3523. eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
  3524. else
  3525. gentop="$output_objdir/${outputname}x"
  3526. generated="$generated $gentop"
  3527. func_extract_archives $gentop $convenience
  3528. libobjs="$libobjs $func_extract_archives_result"
  3529. fi
  3530. fi
  3531. if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
  3532. eval flag=\"$thread_safe_flag_spec\"
  3533. linker_flags="$linker_flags $flag"
  3534. fi
  3535. # Make a backup of the uninstalled library when relinking
  3536. if test "$mode" = relink; then
  3537. $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $?
  3538. fi
  3539. # Do each of the archive commands.
  3540. if test "$module" = yes && test -n "$module_cmds" ; then
  3541. if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
  3542. eval test_cmds=\"$module_expsym_cmds\"
  3543. cmds=$module_expsym_cmds
  3544. else
  3545. eval test_cmds=\"$module_cmds\"
  3546. cmds=$module_cmds
  3547. fi
  3548. else
  3549. if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
  3550. eval test_cmds=\"$archive_expsym_cmds\"
  3551. cmds=$archive_expsym_cmds
  3552. else
  3553. eval test_cmds=\"$archive_cmds\"
  3554. cmds=$archive_cmds
  3555. fi
  3556. fi
  3557. if test "X$skipped_export" != "X:" && len=`expr "X$test_cmds" : ".*"` &&
  3558. test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
  3559. :
  3560. else
  3561. # The command line is too long to link in one step, link piecewise.
  3562. $echo "creating reloadable object files..."
  3563. # Save the value of $output and $libobjs because we want to
  3564. # use them later. If we have whole_archive_flag_spec, we
  3565. # want to use save_libobjs as it was before
  3566. # whole_archive_flag_spec was expanded, because we can't
  3567. # assume the linker understands whole_archive_flag_spec.
  3568. # This may have to be revisited, in case too many
  3569. # convenience libraries get linked in and end up exceeding
  3570. # the spec.
  3571. if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
  3572. save_libobjs=$libobjs
  3573. fi
  3574. save_output=$output
  3575. # Clear the reloadable object creation command queue and
  3576. # initialize k to one.
  3577. test_cmds=
  3578. concat_cmds=
  3579. objlist=
  3580. delfiles=
  3581. last_robj=
  3582. k=1
  3583. output=$output_objdir/$save_output-${k}.$objext
  3584. # Loop over the list of objects to be linked.
  3585. for obj in $save_libobjs
  3586. do
  3587. eval test_cmds=\"$reload_cmds $objlist $last_robj\"
  3588. if test "X$objlist" = X ||
  3589. { len=`expr "X$test_cmds" : ".*"` &&
  3590. test "$len" -le "$max_cmd_len"; }; then
  3591. objlist="$objlist $obj"
  3592. else
  3593. # The command $test_cmds is almost too long, add a
  3594. # command to the queue.
  3595. if test "$k" -eq 1 ; then
  3596. # The first file doesn't have a previous command to add.
  3597. eval concat_cmds=\"$reload_cmds $objlist $last_robj\"
  3598. else
  3599. # All subsequent reloadable object files will link in
  3600. # the last one created.
  3601. eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\"
  3602. fi
  3603. last_robj=$output_objdir/$save_output-${k}.$objext
  3604. k=`expr $k + 1`
  3605. output=$output_objdir/$save_output-${k}.$objext
  3606. objlist=$obj
  3607. len=1
  3608. fi
  3609. done
  3610. # Handle the remaining objects by creating one last
  3611. # reloadable object file. All subsequent reloadable object
  3612. # files will link in the last one created.
  3613. test -z "$concat_cmds" || concat_cmds=$concat_cmds~
  3614. eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\"
  3615. if ${skipped_export-false}; then
  3616. $show "generating symbol list for \`$libname.la'"
  3617. export_symbols="$output_objdir/$libname.exp"
  3618. $run $rm $export_symbols
  3619. libobjs=$output
  3620. # Append the command to create the export file.
  3621. eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\"
  3622. fi
  3623. # Set up a command to remove the reloadale object files
  3624. # after they are used.
  3625. i=0
  3626. while test "$i" -lt "$k"
  3627. do
  3628. i=`expr $i + 1`
  3629. delfiles="$delfiles $output_objdir/$save_output-${i}.$objext"
  3630. done
  3631. $echo "creating a temporary reloadable object file: $output"
  3632. # Loop through the commands generated above and execute them.
  3633. save_ifs="$IFS"; IFS='~'
  3634. for cmd in $concat_cmds; do
  3635. IFS="$save_ifs"
  3636. $show "$cmd"
  3637. $run eval "$cmd" || exit $?
  3638. done
  3639. IFS="$save_ifs"
  3640. libobjs=$output
  3641. # Restore the value of output.
  3642. output=$save_output
  3643. if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
  3644. eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
  3645. fi
  3646. # Expand the library linking commands again to reset the
  3647. # value of $libobjs for piecewise linking.
  3648. # Do each of the archive commands.
  3649. if test "$module" = yes && test -n "$module_cmds" ; then
  3650. if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
  3651. cmds=$module_expsym_cmds
  3652. else
  3653. cmds=$module_cmds
  3654. fi
  3655. else
  3656. if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
  3657. cmds=$archive_expsym_cmds
  3658. else
  3659. cmds=$archive_cmds
  3660. fi
  3661. fi
  3662. # Append the command to remove the reloadable object files
  3663. # to the just-reset $cmds.
  3664. eval cmds=\"\$cmds~\$rm $delfiles\"
  3665. fi
  3666. save_ifs="$IFS"; IFS='~'
  3667. for cmd in $cmds; do
  3668. IFS="$save_ifs"
  3669. eval cmd=\"$cmd\"
  3670. $show "$cmd"
  3671. $run eval "$cmd" || exit $?
  3672. done
  3673. IFS="$save_ifs"
  3674. # Restore the uninstalled library and exit
  3675. if test "$mode" = relink; then
  3676. $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $?
  3677. exit $EXIT_SUCCESS
  3678. fi
  3679. # Create links to the real library.
  3680. for linkname in $linknames; do
  3681. if test "$realname" != "$linkname"; then
  3682. $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)"
  3683. $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $?
  3684. fi
  3685. done
  3686. # If -module or -export-dynamic was specified, set the dlname.
  3687. if test "$module" = yes || test "$export_dynamic" = yes; then
  3688. # On all known operating systems, these are identical.
  3689. dlname="$soname"
  3690. fi
  3691. fi
  3692. ;;
  3693. obj)
  3694. if test -n "$deplibs"; then
  3695. $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2
  3696. fi
  3697. if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
  3698. $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2
  3699. fi
  3700. if test -n "$rpath"; then
  3701. $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2
  3702. fi
  3703. if test -n "$xrpath"; then
  3704. $echo "$modename: warning: \`-R' is ignored for objects" 1>&2
  3705. fi
  3706. if test -n "$vinfo"; then
  3707. $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2
  3708. fi
  3709. if test -n "$release"; then
  3710. $echo "$modename: warning: \`-release' is ignored for objects" 1>&2
  3711. fi
  3712. case $output in
  3713. *.lo)
  3714. if test -n "$objs$old_deplibs"; then
  3715. $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
  3716. exit $EXIT_FAILURE
  3717. fi
  3718. libobj="$output"
  3719. obj=`$echo "X$output" | $Xsed -e "$lo2o"`
  3720. ;;
  3721. *)
  3722. libobj=
  3723. obj="$output"
  3724. ;;
  3725. esac
  3726. # Delete the old objects.
  3727. $run $rm $obj $libobj
  3728. # Objects from convenience libraries. This assumes
  3729. # single-version convenience libraries. Whenever we create
  3730. # different ones for PIC/non-PIC, this we'll have to duplicate
  3731. # the extraction.
  3732. reload_conv_objs=
  3733. gentop=
  3734. # reload_cmds runs $LD directly, so let us get rid of
  3735. # -Wl from whole_archive_flag_spec
  3736. wl=
  3737. if test -n "$convenience"; then
  3738. if test -n "$whole_archive_flag_spec"; then
  3739. eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\"
  3740. else
  3741. gentop="$output_objdir/${obj}x"
  3742. generated="$generated $gentop"
  3743. func_extract_archives $gentop $convenience
  3744. reload_conv_objs="$reload_objs $func_extract_archives_result"
  3745. fi
  3746. fi
  3747. # Create the old-style object.
  3748. reload_objs="$objs$old_deplibs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test
  3749. output="$obj"
  3750. cmds=$reload_cmds
  3751. save_ifs="$IFS"; IFS='~'
  3752. for cmd in $cmds; do
  3753. IFS="$save_ifs"
  3754. eval cmd=\"$cmd\"
  3755. $show "$cmd"
  3756. $run eval "$cmd" || exit $?
  3757. done
  3758. IFS="$save_ifs"
  3759. # Exit if we aren't doing a library object file.
  3760. if test -z "$libobj"; then
  3761. if test -n "$gentop"; then
  3762. $show "${rm}r $gentop"
  3763. $run ${rm}r $gentop
  3764. fi
  3765. exit $EXIT_SUCCESS
  3766. fi
  3767. if test "$build_libtool_libs" != yes; then
  3768. if test -n "$gentop"; then
  3769. $show "${rm}r $gentop"
  3770. $run ${rm}r $gentop
  3771. fi
  3772. # Create an invalid libtool object if no PIC, so that we don't
  3773. # accidentally link it into a program.
  3774. # $show "echo timestamp > $libobj"
  3775. # $run eval "echo timestamp > $libobj" || exit $?
  3776. exit $EXIT_SUCCESS
  3777. fi
  3778. if test -n "$pic_flag" || test "$pic_mode" != default; then
  3779. # Only do commands if we really have different PIC objects.
  3780. reload_objs="$libobjs $reload_conv_objs"
  3781. output="$libobj"
  3782. cmds=$reload_cmds
  3783. save_ifs="$IFS"; IFS='~'
  3784. for cmd in $cmds; do
  3785. IFS="$save_ifs"
  3786. eval cmd=\"$cmd\"
  3787. $show "$cmd"
  3788. $run eval "$cmd" || exit $?
  3789. done
  3790. IFS="$save_ifs"
  3791. fi
  3792. if test -n "$gentop"; then
  3793. $show "${rm}r $gentop"
  3794. $run ${rm}r $gentop
  3795. fi
  3796. exit $EXIT_SUCCESS
  3797. ;;
  3798. prog)
  3799. case $host in
  3800. *cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;;
  3801. esac
  3802. if test -n "$vinfo"; then
  3803. $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
  3804. fi
  3805. if test -n "$release"; then
  3806. $echo "$modename: warning: \`-release' is ignored for programs" 1>&2
  3807. fi
  3808. if test "$preload" = yes; then
  3809. if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown &&
  3810. test "$dlopen_self_static" = unknown; then
  3811. $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support."
  3812. fi
  3813. fi
  3814. case $host in
  3815. *-*-rhapsody* | *-*-darwin1.[012])
  3816. # On Rhapsody replace the C library is the System framework
  3817. compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
  3818. finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
  3819. ;;
  3820. esac
  3821. case $host in
  3822. *darwin*)
  3823. # Don't allow lazy linking, it breaks C++ global constructors
  3824. if test "$tagname" = CXX ; then
  3825. compile_command="$compile_command ${wl}-bind_at_load"
  3826. finalize_command="$finalize_command ${wl}-bind_at_load"
  3827. fi
  3828. ;;
  3829. esac
  3830. compile_command="$compile_command $compile_deplibs"
  3831. finalize_command="$finalize_command $finalize_deplibs"
  3832. if test -n "$rpath$xrpath"; then
  3833. # If the user specified any rpath flags, then add them.
  3834. for libdir in $rpath $xrpath; do
  3835. # This is the magic to use -rpath.
  3836. case "$finalize_rpath " in
  3837. *" $libdir "*) ;;
  3838. *) finalize_rpath="$finalize_rpath $libdir" ;;
  3839. esac
  3840. done
  3841. fi
  3842. # Now hardcode the library paths
  3843. rpath=
  3844. hardcode_libdirs=
  3845. for libdir in $compile_rpath $finalize_rpath; do
  3846. if test -n "$hardcode_libdir_flag_spec"; then
  3847. if test -n "$hardcode_libdir_separator"; then
  3848. if test -z "$hardcode_libdirs"; then
  3849. hardcode_libdirs="$libdir"
  3850. else
  3851. # Just accumulate the unique libdirs.
  3852. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
  3853. *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
  3854. ;;
  3855. *)
  3856. hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
  3857. ;;
  3858. esac
  3859. fi
  3860. else
  3861. eval flag=\"$hardcode_libdir_flag_spec\"
  3862. rpath="$rpath $flag"
  3863. fi
  3864. elif test -n "$runpath_var"; then
  3865. case "$perm_rpath " in
  3866. *" $libdir "*) ;;
  3867. *) perm_rpath="$perm_rpath $libdir" ;;
  3868. esac
  3869. fi
  3870. case $host in
  3871. *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
  3872. case :$dllsearchpath: in
  3873. *":$libdir:"*) ;;
  3874. *) dllsearchpath="$dllsearchpath:$libdir";;
  3875. esac
  3876. ;;
  3877. esac
  3878. done
  3879. # Substitute the hardcoded libdirs into the rpath.
  3880. if test -n "$hardcode_libdir_separator" &&
  3881. test -n "$hardcode_libdirs"; then
  3882. libdir="$hardcode_libdirs"
  3883. eval rpath=\" $hardcode_libdir_flag_spec\"
  3884. fi
  3885. compile_rpath="$rpath"
  3886. rpath=
  3887. hardcode_libdirs=
  3888. for libdir in $finalize_rpath; do
  3889. if test -n "$hardcode_libdir_flag_spec"; then
  3890. if test -n "$hardcode_libdir_separator"; then
  3891. if test -z "$hardcode_libdirs"; then
  3892. hardcode_libdirs="$libdir"
  3893. else
  3894. # Just accumulate the unique libdirs.
  3895. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
  3896. *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
  3897. ;;
  3898. *)
  3899. hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
  3900. ;;
  3901. esac
  3902. fi
  3903. else
  3904. eval flag=\"$hardcode_libdir_flag_spec\"
  3905. rpath="$rpath $flag"
  3906. fi
  3907. elif test -n "$runpath_var"; then
  3908. case "$finalize_perm_rpath " in
  3909. *" $libdir "*) ;;
  3910. *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
  3911. esac
  3912. fi
  3913. done
  3914. # Substitute the hardcoded libdirs into the rpath.
  3915. if test -n "$hardcode_libdir_separator" &&
  3916. test -n "$hardcode_libdirs"; then
  3917. libdir="$hardcode_libdirs"
  3918. eval rpath=\" $hardcode_libdir_flag_spec\"
  3919. fi
  3920. finalize_rpath="$rpath"
  3921. if test -n "$libobjs" && test "$build_old_libs" = yes; then
  3922. # Transform all the library objects into standard objects.
  3923. compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
  3924. finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
  3925. fi
  3926. dlsyms=
  3927. if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
  3928. if test -n "$NM" && test -n "$global_symbol_pipe"; then
  3929. dlsyms="${outputname}S.c"
  3930. else
  3931. $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2
  3932. fi
  3933. fi
  3934. if test -n "$dlsyms"; then
  3935. case $dlsyms in
  3936. "") ;;
  3937. *.c)
  3938. # Discover the nlist of each of the dlfiles.
  3939. nlist="$output_objdir/${outputname}.nm"
  3940. $show "$rm $nlist ${nlist}S ${nlist}T"
  3941. $run $rm "$nlist" "${nlist}S" "${nlist}T"
  3942. # Parse the name list into a source file.
  3943. $show "creating $output_objdir/$dlsyms"
  3944. test -z "$run" && $echo > "$output_objdir/$dlsyms" "\
  3945. /* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */
  3946. /* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */
  3947. #ifdef __cplusplus
  3948. extern \"C\" {
  3949. #endif
  3950. /* Prevent the only kind of declaration conflicts we can make. */
  3951. #define lt_preloaded_symbols some_other_symbol
  3952. /* External symbol declarations for the compiler. */\
  3953. "
  3954. if test "$dlself" = yes; then
  3955. $show "generating symbol list for \`$output'"
  3956. test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist"
  3957. # Add our own program objects to the symbol list.
  3958. progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
  3959. for arg in $progfiles; do
  3960. $show "extracting global C symbols from \`$arg'"
  3961. $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
  3962. done
  3963. if test -n "$exclude_expsyms"; then
  3964. $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
  3965. $run eval '$mv "$nlist"T "$nlist"'
  3966. fi
  3967. if test -n "$export_symbols_regex"; then
  3968. $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
  3969. $run eval '$mv "$nlist"T "$nlist"'
  3970. fi
  3971. # Prepare the list of exported symbols
  3972. if test -z "$export_symbols"; then
  3973. export_symbols="$output_objdir/$output.exp"
  3974. $run $rm $export_symbols
  3975. $run eval "${SED} -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
  3976. else
  3977. $run eval "${SED} -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"'
  3978. $run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T'
  3979. $run eval 'mv "$nlist"T "$nlist"'
  3980. fi
  3981. fi
  3982. for arg in $dlprefiles; do
  3983. $show "extracting global C symbols from \`$arg'"
  3984. name=`$echo "$arg" | ${SED} -e 's%^.*/%%'`
  3985. $run eval '$echo ": $name " >> "$nlist"'
  3986. $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
  3987. done
  3988. if test -z "$run"; then
  3989. # Make sure we have at least an empty file.
  3990. test -f "$nlist" || : > "$nlist"
  3991. if test -n "$exclude_expsyms"; then
  3992. $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
  3993. $mv "$nlist"T "$nlist"
  3994. fi
  3995. # Try sorting and uniquifying the output.
  3996. if grep -v "^: " < "$nlist" |
  3997. if sort -k 3 </dev/null >/dev/null 2>&1; then
  3998. sort -k 3
  3999. else
  4000. sort +2
  4001. fi |
  4002. uniq > "$nlist"S; then
  4003. :
  4004. else
  4005. grep -v "^: " < "$nlist" > "$nlist"S
  4006. fi
  4007. if test -f "$nlist"S; then
  4008. eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"'
  4009. else
  4010. $echo '/* NONE */' >> "$output_objdir/$dlsyms"
  4011. fi
  4012. $echo >> "$output_objdir/$dlsyms" "\
  4013. #undef lt_preloaded_symbols
  4014. #if defined (__STDC__) && __STDC__
  4015. # define lt_ptr void *
  4016. #else
  4017. # define lt_ptr char *
  4018. # define const
  4019. #endif
  4020. /* The mapping between symbol names and symbols. */
  4021. const struct {
  4022. const char *name;
  4023. lt_ptr address;
  4024. }
  4025. lt_preloaded_symbols[] =
  4026. {\
  4027. "
  4028. eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms"
  4029. $echo >> "$output_objdir/$dlsyms" "\
  4030. {0, (lt_ptr) 0}
  4031. };
  4032. /* This works around a problem in FreeBSD linker */
  4033. #ifdef FREEBSD_WORKAROUND
  4034. static const void *lt_preloaded_setup() {
  4035. return lt_preloaded_symbols;
  4036. }
  4037. #endif
  4038. #ifdef __cplusplus
  4039. }
  4040. #endif\
  4041. "
  4042. fi
  4043. pic_flag_for_symtable=
  4044. case $host in
  4045. # compiling the symbol table file with pic_flag works around
  4046. # a FreeBSD bug that causes programs to crash when -lm is
  4047. # linked before any other PIC object. But we must not use
  4048. # pic_flag when linking with -static. The problem exists in
  4049. # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
  4050. *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
  4051. case "$compile_command " in
  4052. *" -static "*) ;;
  4053. *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";;
  4054. esac;;
  4055. *-*-hpux*)
  4056. case "$compile_command " in
  4057. *" -static "*) ;;
  4058. *) pic_flag_for_symtable=" $pic_flag";;
  4059. esac
  4060. esac
  4061. # Now compile the dynamic symbol file.
  4062. $show "(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
  4063. $run eval '(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
  4064. # Clean up the generated files.
  4065. $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
  4066. $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
  4067. # Transform the symbol file into the correct name.
  4068. compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
  4069. finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
  4070. ;;
  4071. *-*-freebsd*)
  4072. # FreeBSD doesn't need this...
  4073. ;;
  4074. *)
  4075. $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
  4076. exit $EXIT_FAILURE
  4077. ;;
  4078. esac
  4079. else
  4080. # We keep going just in case the user didn't refer to
  4081. # lt_preloaded_symbols. The linker will fail if global_symbol_pipe
  4082. # really was required.
  4083. # Nullify the symbol file.
  4084. compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
  4085. finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
  4086. fi
  4087. if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
  4088. # Replace the output file specification.
  4089. compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
  4090. link_command="$compile_command$compile_rpath"
  4091. # We have no uninstalled library dependencies, so finalize right now.
  4092. $show "$link_command"
  4093. $run eval "$link_command"
  4094. status=$?
  4095. # Delete the generated files.
  4096. if test -n "$dlsyms"; then
  4097. $show "$rm $output_objdir/${outputname}S.${objext}"
  4098. $run $rm "$output_objdir/${outputname}S.${objext}"
  4099. fi
  4100. exit $status
  4101. fi
  4102. if test -n "$shlibpath_var"; then
  4103. # We should set the shlibpath_var
  4104. rpath=
  4105. for dir in $temp_rpath; do
  4106. case $dir in
  4107. [\\/]* | [A-Za-z]:[\\/]*)
  4108. # Absolute path.
  4109. rpath="$rpath$dir:"
  4110. ;;
  4111. *)
  4112. # Relative path: add a thisdir entry.
  4113. rpath="$rpath\$thisdir/$dir:"
  4114. ;;
  4115. esac
  4116. done
  4117. temp_rpath="$rpath"
  4118. fi
  4119. if test -n "$compile_shlibpath$finalize_shlibpath"; then
  4120. compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
  4121. fi
  4122. if test -n "$finalize_shlibpath"; then
  4123. finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
  4124. fi
  4125. compile_var=
  4126. finalize_var=
  4127. if test -n "$runpath_var"; then
  4128. if test -n "$perm_rpath"; then
  4129. # We should set the runpath_var.
  4130. rpath=
  4131. for dir in $perm_rpath; do
  4132. rpath="$rpath$dir:"
  4133. done
  4134. compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
  4135. fi
  4136. if test -n "$finalize_perm_rpath"; then
  4137. # We should set the runpath_var.
  4138. rpath=
  4139. for dir in $finalize_perm_rpath; do
  4140. rpath="$rpath$dir:"
  4141. done
  4142. finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
  4143. fi
  4144. fi
  4145. if test "$no_install" = yes; then
  4146. # We don't need to create a wrapper script.
  4147. link_command="$compile_var$compile_command$compile_rpath"
  4148. # Replace the output file specification.
  4149. link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
  4150. # Delete the old output file.
  4151. $run $rm $output
  4152. # Link the executable and exit
  4153. $show "$link_command"
  4154. $run eval "$link_command" || exit $?
  4155. exit $EXIT_SUCCESS
  4156. fi
  4157. if test "$hardcode_action" = relink; then
  4158. # Fast installation is not supported
  4159. link_command="$compile_var$compile_command$compile_rpath"
  4160. relink_command="$finalize_var$finalize_command$finalize_rpath"
  4161. $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2
  4162. $echo "$modename: \`$output' will be relinked during installation" 1>&2
  4163. else
  4164. if test "$fast_install" != no; then
  4165. link_command="$finalize_var$compile_command$finalize_rpath"
  4166. if test "$fast_install" = yes; then
  4167. relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'`
  4168. else
  4169. # fast_install is set to needless
  4170. relink_command=
  4171. fi
  4172. else
  4173. link_command="$compile_var$compile_command$compile_rpath"
  4174. relink_command="$finalize_var$finalize_command$finalize_rpath"
  4175. fi
  4176. fi
  4177. # Replace the output file specification.
  4178. link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
  4179. # Delete the old output files.
  4180. $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname
  4181. $show "$link_command"
  4182. $run eval "$link_command" || exit $?
  4183. # Now create the wrapper script.
  4184. $show "creating $output"
  4185. # Quote the relink command for shipping.
  4186. if test -n "$relink_command"; then
  4187. # Preserve any variables that may affect compiler behavior
  4188. for var in $variables_saved_for_relink; do
  4189. if eval test -z \"\${$var+set}\"; then
  4190. relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
  4191. elif eval var_value=\$$var; test -z "$var_value"; then
  4192. relink_command="$var=; export $var; $relink_command"
  4193. else
  4194. var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
  4195. relink_command="$var=\"$var_value\"; export $var; $relink_command"
  4196. fi
  4197. done
  4198. relink_command="(cd `pwd`; $relink_command)"
  4199. relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
  4200. fi
  4201. # Quote $echo for shipping.
  4202. if test "X$echo" = "X$SHELL $progpath --fallback-echo"; then
  4203. case $progpath in
  4204. [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";;
  4205. *) qecho="$SHELL `pwd`/$progpath --fallback-echo";;
  4206. esac
  4207. qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
  4208. else
  4209. qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"`
  4210. fi
  4211. # Only actually do things if our run command is non-null.
  4212. if test -z "$run"; then
  4213. # win32 will think the script is a binary if it has
  4214. # a .exe suffix, so we strip it off here.
  4215. case $output in
  4216. *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;;
  4217. esac
  4218. # test for cygwin because mv fails w/o .exe extensions
  4219. case $host in
  4220. *cygwin*)
  4221. exeext=.exe
  4222. outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;;
  4223. *) exeext= ;;
  4224. esac
  4225. case $host in
  4226. *cygwin* | *mingw* )
  4227. cwrappersource=`$echo ${objdir}/lt-${output}.c`
  4228. cwrapper=`$echo ${output}.exe`
  4229. $rm $cwrappersource $cwrapper
  4230. trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
  4231. cat > $cwrappersource <<EOF
  4232. /* $cwrappersource - temporary wrapper executable for $objdir/$outputname
  4233. Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
  4234. The $output program cannot be directly executed until all the libtool
  4235. libraries that it depends on are installed.
  4236. This wrapper executable should never be moved out of the build directory.
  4237. If it is, it will not operate correctly.
  4238. Currently, it simply execs the wrapper *script* "/bin/sh $output",
  4239. but could eventually absorb all of the scripts functionality and
  4240. exec $objdir/$outputname directly.
  4241. */
  4242. EOF
  4243. cat >> $cwrappersource<<"EOF"
  4244. #include <stdio.h>
  4245. #include <stdlib.h>
  4246. #include <unistd.h>
  4247. #include <malloc.h>
  4248. #include <stdarg.h>
  4249. #include <assert.h>
  4250. #if defined(PATH_MAX)
  4251. # define LT_PATHMAX PATH_MAX
  4252. #elif defined(MAXPATHLEN)
  4253. # define LT_PATHMAX MAXPATHLEN
  4254. #else
  4255. # define LT_PATHMAX 1024
  4256. #endif
  4257. #ifndef DIR_SEPARATOR
  4258. #define DIR_SEPARATOR '/'
  4259. #endif
  4260. #if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
  4261. defined (__OS2__)
  4262. #define HAVE_DOS_BASED_FILE_SYSTEM
  4263. #ifndef DIR_SEPARATOR_2
  4264. #define DIR_SEPARATOR_2 '\\'
  4265. #endif
  4266. #endif
  4267. #ifndef DIR_SEPARATOR_2
  4268. # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
  4269. #else /* DIR_SEPARATOR_2 */
  4270. # define IS_DIR_SEPARATOR(ch) \
  4271. (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
  4272. #endif /* DIR_SEPARATOR_2 */
  4273. #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type)))
  4274. #define XFREE(stale) do { \
  4275. if (stale) { free ((void *) stale); stale = 0; } \
  4276. } while (0)
  4277. const char *program_name = NULL;
  4278. void * xmalloc (size_t num);
  4279. char * xstrdup (const char *string);
  4280. char * basename (const char *name);
  4281. char * fnqualify(const char *path);
  4282. char * strendzap(char *str, const char *pat);
  4283. void lt_fatal (const char *message, ...);
  4284. int
  4285. main (int argc, char *argv[])
  4286. {
  4287. char **newargz;
  4288. int i;
  4289. program_name = (char *) xstrdup ((char *) basename (argv[0]));
  4290. newargz = XMALLOC(char *, argc+2);
  4291. EOF
  4292. cat >> $cwrappersource <<EOF
  4293. newargz[0] = "$SHELL";
  4294. EOF
  4295. cat >> $cwrappersource <<"EOF"
  4296. newargz[1] = fnqualify(argv[0]);
  4297. /* we know the script has the same name, without the .exe */
  4298. /* so make sure newargz[1] doesn't end in .exe */
  4299. strendzap(newargz[1],".exe");
  4300. for (i = 1; i < argc; i++)
  4301. newargz[i+1] = xstrdup(argv[i]);
  4302. newargz[argc+1] = NULL;
  4303. EOF
  4304. cat >> $cwrappersource <<EOF
  4305. execv("$SHELL",newargz);
  4306. EOF
  4307. cat >> $cwrappersource <<"EOF"
  4308. }
  4309. void *
  4310. xmalloc (size_t num)
  4311. {
  4312. void * p = (void *) malloc (num);
  4313. if (!p)
  4314. lt_fatal ("Memory exhausted");
  4315. return p;
  4316. }
  4317. char *
  4318. xstrdup (const char *string)
  4319. {
  4320. return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL
  4321. ;
  4322. }
  4323. char *
  4324. basename (const char *name)
  4325. {
  4326. const char *base;
  4327. #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
  4328. /* Skip over the disk name in MSDOS pathnames. */
  4329. if (isalpha (name[0]) && name[1] == ':')
  4330. name += 2;
  4331. #endif
  4332. for (base = name; *name; name++)
  4333. if (IS_DIR_SEPARATOR (*name))
  4334. base = name + 1;
  4335. return (char *) base;
  4336. }
  4337. char *
  4338. fnqualify(const char *path)
  4339. {
  4340. size_t size;
  4341. char *p;
  4342. char tmp[LT_PATHMAX + 1];
  4343. assert(path != NULL);
  4344. /* Is it qualified already? */
  4345. #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
  4346. if (isalpha (path[0]) && path[1] == ':')
  4347. return xstrdup (path);
  4348. #endif
  4349. if (IS_DIR_SEPARATOR (path[0]))
  4350. return xstrdup (path);
  4351. /* prepend the current directory */
  4352. /* doesn't handle '~' */
  4353. if (getcwd (tmp, LT_PATHMAX) == NULL)
  4354. lt_fatal ("getcwd failed");
  4355. size = strlen(tmp) + 1 + strlen(path) + 1; /* +2 for '/' and '\0' */
  4356. p = XMALLOC(char, size);
  4357. sprintf(p, "%s%c%s", tmp, DIR_SEPARATOR, path);
  4358. return p;
  4359. }
  4360. char *
  4361. strendzap(char *str, const char *pat)
  4362. {
  4363. size_t len, patlen;
  4364. assert(str != NULL);
  4365. assert(pat != NULL);
  4366. len = strlen(str);
  4367. patlen = strlen(pat);
  4368. if (patlen <= len)
  4369. {
  4370. str += len - patlen;
  4371. if (strcmp(str, pat) == 0)
  4372. *str = '\0';
  4373. }
  4374. return str;
  4375. }
  4376. static void
  4377. lt_error_core (int exit_status, const char * mode,
  4378. const char * message, va_list ap)
  4379. {
  4380. fprintf (stderr, "%s: %s: ", program_name, mode);
  4381. vfprintf (stderr, message, ap);
  4382. fprintf (stderr, ".\n");
  4383. if (exit_status >= 0)
  4384. exit (exit_status);
  4385. }
  4386. void
  4387. lt_fatal (const char *message, ...)
  4388. {
  4389. va_list ap;
  4390. va_start (ap, message);
  4391. lt_error_core (EXIT_FAILURE, "FATAL", message, ap);
  4392. va_end (ap);
  4393. }
  4394. EOF
  4395. # we should really use a build-platform specific compiler
  4396. # here, but OTOH, the wrappers (shell script and this C one)
  4397. # are only useful if you want to execute the "real" binary.
  4398. # Since the "real" binary is built for $host, then this
  4399. # wrapper might as well be built for $host, too.
  4400. $run $LTCC -s -o $cwrapper $cwrappersource
  4401. ;;
  4402. esac
  4403. $rm $output
  4404. trap "$rm $output; exit $EXIT_FAILURE" 1 2 15
  4405. $echo > $output "\
  4406. #! $SHELL
  4407. # $output - temporary wrapper script for $objdir/$outputname
  4408. # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
  4409. #
  4410. # The $output program cannot be directly executed until all the libtool
  4411. # libraries that it depends on are installed.
  4412. #
  4413. # This wrapper script should never be moved out of the build directory.
  4414. # If it is, it will not operate correctly.
  4415. # Sed substitution that helps us do robust quoting. It backslashifies
  4416. # metacharacters that are still active within double-quoted strings.
  4417. Xsed='${SED} -e 1s/^X//'
  4418. sed_quote_subst='$sed_quote_subst'
  4419. # The HP-UX ksh and POSIX shell print the target directory to stdout
  4420. # if CDPATH is set.
  4421. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
  4422. relink_command=\"$relink_command\"
  4423. # This environment variable determines our operation mode.
  4424. if test \"\$libtool_install_magic\" = \"$magic\"; then
  4425. # install mode needs the following variable:
  4426. notinst_deplibs='$notinst_deplibs'
  4427. else
  4428. # When we are sourced in execute mode, \$file and \$echo are already set.
  4429. if test \"\$libtool_execute_magic\" != \"$magic\"; then
  4430. echo=\"$qecho\"
  4431. file=\"\$0\"
  4432. # Make sure echo works.
  4433. if test \"X\$1\" = X--no-reexec; then
  4434. # Discard the --no-reexec flag, and continue.
  4435. shift
  4436. elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then
  4437. # Yippee, \$echo works!
  4438. :
  4439. else
  4440. # Restart under the correct shell, and then maybe \$echo will work.
  4441. exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
  4442. fi
  4443. fi\
  4444. "
  4445. $echo >> $output "\
  4446. # Find the directory that this script lives in.
  4447. thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
  4448. test \"x\$thisdir\" = \"x\$file\" && thisdir=.
  4449. # Follow symbolic links until we get to the real thisdir.
  4450. file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\`
  4451. while test -n \"\$file\"; do
  4452. destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
  4453. # If there was a directory component, then change thisdir.
  4454. if test \"x\$destdir\" != \"x\$file\"; then
  4455. case \"\$destdir\" in
  4456. [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
  4457. *) thisdir=\"\$thisdir/\$destdir\" ;;
  4458. esac
  4459. fi
  4460. file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
  4461. file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\`
  4462. done
  4463. # Try to get the absolute directory name.
  4464. absdir=\`cd \"\$thisdir\" && pwd\`
  4465. test -n \"\$absdir\" && thisdir=\"\$absdir\"
  4466. "
  4467. if test "$fast_install" = yes; then
  4468. $echo >> $output "\
  4469. program=lt-'$outputname'$exeext
  4470. progdir=\"\$thisdir/$objdir\"
  4471. if test ! -f \"\$progdir/\$program\" || \\
  4472. { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
  4473. test \"X\$file\" != \"X\$progdir/\$program\"; }; then
  4474. file=\"\$\$-\$program\"
  4475. if test ! -d \"\$progdir\"; then
  4476. $mkdir \"\$progdir\"
  4477. else
  4478. $rm \"\$progdir/\$file\"
  4479. fi"
  4480. $echo >> $output "\
  4481. # relink executable if necessary
  4482. if test -n \"\$relink_command\"; then
  4483. if relink_command_output=\`eval \$relink_command 2>&1\`; then :
  4484. else
  4485. $echo \"\$relink_command_output\" >&2
  4486. $rm \"\$progdir/\$file\"
  4487. exit $EXIT_FAILURE
  4488. fi
  4489. fi
  4490. $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
  4491. { $rm \"\$progdir/\$program\";
  4492. $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; }
  4493. $rm \"\$progdir/\$file\"
  4494. fi"
  4495. else
  4496. $echo >> $output "\
  4497. program='$outputname'
  4498. progdir=\"\$thisdir/$objdir\"
  4499. "
  4500. fi
  4501. $echo >> $output "\
  4502. if test -f \"\$progdir/\$program\"; then"
  4503. # Export our shlibpath_var if we have one.
  4504. if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
  4505. $echo >> $output "\
  4506. # Add our own library path to $shlibpath_var
  4507. $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
  4508. # Some systems cannot cope with colon-terminated $shlibpath_var
  4509. # The second colon is a workaround for a bug in BeOS R4 sed
  4510. $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
  4511. export $shlibpath_var
  4512. "
  4513. fi
  4514. # fixup the dll searchpath if we need to.
  4515. if test -n "$dllsearchpath"; then
  4516. $echo >> $output "\
  4517. # Add the dll search path components to the executable PATH
  4518. PATH=$dllsearchpath:\$PATH
  4519. "
  4520. fi
  4521. $echo >> $output "\
  4522. if test \"\$libtool_execute_magic\" != \"$magic\"; then
  4523. # Run the actual program with our arguments.
  4524. "
  4525. case $host in
  4526. # Backslashes separate directories on plain windows
  4527. *-*-mingw | *-*-os2*)
  4528. $echo >> $output "\
  4529. exec \$progdir\\\\\$program \${1+\"\$@\"}
  4530. "
  4531. ;;
  4532. *)
  4533. $echo >> $output "\
  4534. exec \$progdir/\$program \${1+\"\$@\"}
  4535. "
  4536. ;;
  4537. esac
  4538. $echo >> $output "\
  4539. \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\"
  4540. exit $EXIT_FAILURE
  4541. fi
  4542. else
  4543. # The program doesn't exist.
  4544. \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2
  4545. \$echo \"This script is just a wrapper for \$program.\" 1>&2
  4546. $echo \"See the $PACKAGE documentation for more information.\" 1>&2
  4547. exit $EXIT_FAILURE
  4548. fi
  4549. fi\
  4550. "
  4551. chmod +x $output
  4552. fi
  4553. exit $EXIT_SUCCESS
  4554. ;;
  4555. esac
  4556. # See if we need to build an old-fashioned archive.
  4557. for oldlib in $oldlibs; do
  4558. if test "$build_libtool_libs" = convenience; then
  4559. oldobjs="$libobjs_save"
  4560. addlibs="$convenience"
  4561. build_libtool_libs=no
  4562. else
  4563. if test "$build_libtool_libs" = module; then
  4564. oldobjs="$libobjs_save"
  4565. build_libtool_libs=no
  4566. else
  4567. oldobjs="$old_deplibs $non_pic_objects"
  4568. fi
  4569. addlibs="$old_convenience"
  4570. fi
  4571. if test -n "$addlibs"; then
  4572. gentop="$output_objdir/${outputname}x"
  4573. generated="$generated $gentop"
  4574. func_extract_archives $gentop $addlibs
  4575. oldobjs="$oldobjs $func_extract_archives_result"
  4576. fi
  4577. # Do each command in the archive commands.
  4578. if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
  4579. cmds=$old_archive_from_new_cmds
  4580. else
  4581. eval cmds=\"$old_archive_cmds\"
  4582. if len=`expr "X$cmds" : ".*"` &&
  4583. test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
  4584. cmds=$old_archive_cmds
  4585. else
  4586. # the command line is too long to link in one step, link in parts
  4587. $echo "using piecewise archive linking..."
  4588. save_RANLIB=$RANLIB
  4589. RANLIB=:
  4590. objlist=
  4591. concat_cmds=
  4592. save_oldobjs=$oldobjs
  4593. # GNU ar 2.10+ was changed to match POSIX; thus no paths are
  4594. # encoded into archives. This makes 'ar r' malfunction in
  4595. # this piecewise linking case whenever conflicting object
  4596. # names appear in distinct ar calls; check, warn and compensate.
  4597. if (for obj in $save_oldobjs
  4598. do
  4599. $echo "X$obj" | $Xsed -e 's%^.*/%%'
  4600. done | sort | sort -uc >/dev/null 2>&1); then
  4601. :
  4602. else
  4603. $echo "$modename: warning: object name conflicts; overriding AR_FLAGS to 'cq'" 1>&2
  4604. $echo "$modename: warning: to ensure that POSIX-compatible ar will work" 1>&2
  4605. AR_FLAGS=cq
  4606. fi
  4607. # Is there a better way of finding the last object in the list?
  4608. for obj in $save_oldobjs
  4609. do
  4610. last_oldobj=$obj
  4611. done
  4612. for obj in $save_oldobjs
  4613. do
  4614. oldobjs="$objlist $obj"
  4615. objlist="$objlist $obj"
  4616. eval test_cmds=\"$old_archive_cmds\"
  4617. if len=`expr "X$test_cmds" : ".*"` &&
  4618. test "$len" -le "$max_cmd_len"; then
  4619. :
  4620. else
  4621. # the above command should be used before it gets too long
  4622. oldobjs=$objlist
  4623. if test "$obj" = "$last_oldobj" ; then
  4624. RANLIB=$save_RANLIB
  4625. fi
  4626. test -z "$concat_cmds" || concat_cmds=$concat_cmds~
  4627. eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
  4628. objlist=
  4629. fi
  4630. done
  4631. RANLIB=$save_RANLIB
  4632. oldobjs=$objlist
  4633. if test "X$oldobjs" = "X" ; then
  4634. eval cmds=\"\$concat_cmds\"
  4635. else
  4636. eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
  4637. fi
  4638. fi
  4639. fi
  4640. save_ifs="$IFS"; IFS='~'
  4641. for cmd in $cmds; do
  4642. eval cmd=\"$cmd\"
  4643. IFS="$save_ifs"
  4644. $show "$cmd"
  4645. $run eval "$cmd" || exit $?
  4646. done
  4647. IFS="$save_ifs"
  4648. done
  4649. if test -n "$generated"; then
  4650. $show "${rm}r$generated"
  4651. $run ${rm}r$generated
  4652. fi
  4653. # Now create the libtool archive.
  4654. case $output in
  4655. *.la)
  4656. old_library=
  4657. test "$build_old_libs" = yes && old_library="$libname.$libext"
  4658. $show "creating $output"
  4659. # Preserve any variables that may affect compiler behavior
  4660. for var in $variables_saved_for_relink; do
  4661. if eval test -z \"\${$var+set}\"; then
  4662. relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
  4663. elif eval var_value=\$$var; test -z "$var_value"; then
  4664. relink_command="$var=; export $var; $relink_command"
  4665. else
  4666. var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
  4667. relink_command="$var=\"$var_value\"; export $var; $relink_command"
  4668. fi
  4669. done
  4670. # Quote the link command for shipping.
  4671. relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
  4672. relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
  4673. if test "$hardcode_automatic" = yes ; then
  4674. relink_command=
  4675. fi
  4676. # Only create the output if not a dry run.
  4677. if test -z "$run"; then
  4678. for installed in no yes; do
  4679. if test "$installed" = yes; then
  4680. if test -z "$install_libdir"; then
  4681. break
  4682. fi
  4683. output="$output_objdir/$outputname"i
  4684. # Replace all uninstalled libtool libraries with the installed ones
  4685. newdependency_libs=
  4686. for deplib in $dependency_libs; do
  4687. case $deplib in
  4688. *.la)
  4689. name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'`
  4690. eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
  4691. if test -z "$libdir"; then
  4692. $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
  4693. exit $EXIT_FAILURE
  4694. fi
  4695. newdependency_libs="$newdependency_libs $libdir/$name"
  4696. ;;
  4697. *) newdependency_libs="$newdependency_libs $deplib" ;;
  4698. esac
  4699. done
  4700. dependency_libs="$newdependency_libs"
  4701. newdlfiles=
  4702. for lib in $dlfiles; do
  4703. name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
  4704. eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
  4705. if test -z "$libdir"; then
  4706. $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
  4707. exit $EXIT_FAILURE
  4708. fi
  4709. newdlfiles="$newdlfiles $libdir/$name"
  4710. done
  4711. dlfiles="$newdlfiles"
  4712. newdlprefiles=
  4713. for lib in $dlprefiles; do
  4714. name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
  4715. eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
  4716. if test -z "$libdir"; then
  4717. $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
  4718. exit $EXIT_FAILURE
  4719. fi
  4720. newdlprefiles="$newdlprefiles $libdir/$name"
  4721. done
  4722. dlprefiles="$newdlprefiles"
  4723. else
  4724. newdlfiles=
  4725. for lib in $dlfiles; do
  4726. case $lib in
  4727. [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
  4728. *) abs=`pwd`"/$lib" ;;
  4729. esac
  4730. newdlfiles="$newdlfiles $abs"
  4731. done
  4732. dlfiles="$newdlfiles"
  4733. newdlprefiles=
  4734. for lib in $dlprefiles; do
  4735. case $lib in
  4736. [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
  4737. *) abs=`pwd`"/$lib" ;;
  4738. esac
  4739. newdlprefiles="$newdlprefiles $abs"
  4740. done
  4741. dlprefiles="$newdlprefiles"
  4742. fi
  4743. $rm $output
  4744. # place dlname in correct position for cygwin
  4745. tdlname=$dlname
  4746. case $host,$output,$installed,$module,$dlname in
  4747. *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
  4748. esac
  4749. $echo > $output "\
  4750. # $outputname - a libtool library file
  4751. # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
  4752. #
  4753. # Please DO NOT delete this file!
  4754. # It is necessary for linking the library.
  4755. # The name that we can dlopen(3).
  4756. dlname='$tdlname'
  4757. # Names of this library.
  4758. library_names='$library_names'
  4759. # The name of the static archive.
  4760. old_library='$old_library'
  4761. # Libraries that this one depends upon.
  4762. dependency_libs='$dependency_libs'
  4763. # Version information for $libname.
  4764. current=$current
  4765. age=$age
  4766. revision=$revision
  4767. # Is this an already installed library?
  4768. installed=$installed
  4769. # Should we warn about portability when linking against -modules?
  4770. shouldnotlink=$module
  4771. # Files to dlopen/dlpreopen
  4772. dlopen='$dlfiles'
  4773. dlpreopen='$dlprefiles'
  4774. # Directory that this library needs to be installed in:
  4775. libdir='$install_libdir'"
  4776. if test "$installed" = no && test "$need_relink" = yes; then
  4777. $echo >> $output "\
  4778. relink_command=\"$relink_command\""
  4779. fi
  4780. done
  4781. fi
  4782. # Do a symbolic link so that the libtool archive can be found in
  4783. # LD_LIBRARY_PATH before the program is installed.
  4784. $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)"
  4785. $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $?
  4786. ;;
  4787. esac
  4788. exit $EXIT_SUCCESS
  4789. ;;
  4790. # libtool install mode
  4791. install)
  4792. modename="$modename: install"
  4793. # There may be an optional sh(1) argument at the beginning of
  4794. # install_prog (especially on Windows NT).
  4795. if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
  4796. # Allow the use of GNU shtool's install command.
  4797. $echo "X$nonopt" | $Xsed | grep shtool > /dev/null; then
  4798. # Aesthetically quote it.
  4799. arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
  4800. case $arg in
  4801. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
  4802. arg="\"$arg\""
  4803. ;;
  4804. esac
  4805. install_prog="$arg "
  4806. arg="$1"
  4807. shift
  4808. else
  4809. install_prog=
  4810. arg="$nonopt"
  4811. fi
  4812. # The real first argument should be the name of the installation program.
  4813. # Aesthetically quote it.
  4814. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
  4815. case $arg in
  4816. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
  4817. arg="\"$arg\""
  4818. ;;
  4819. esac
  4820. install_prog="$install_prog$arg"
  4821. # We need to accept at least all the BSD install flags.
  4822. dest=
  4823. files=
  4824. opts=
  4825. prev=
  4826. install_type=
  4827. isdir=no
  4828. stripme=
  4829. for arg
  4830. do
  4831. if test -n "$dest"; then
  4832. files="$files $dest"
  4833. dest="$arg"
  4834. continue
  4835. fi
  4836. case $arg in
  4837. -d) isdir=yes ;;
  4838. -f) prev="-f" ;;
  4839. -g) prev="-g" ;;
  4840. -m) prev="-m" ;;
  4841. -o) prev="-o" ;;
  4842. -s)
  4843. stripme=" -s"
  4844. continue
  4845. ;;
  4846. -*) ;;
  4847. *)
  4848. # If the previous option needed an argument, then skip it.
  4849. if test -n "$prev"; then
  4850. prev=
  4851. else
  4852. dest="$arg"
  4853. continue
  4854. fi
  4855. ;;
  4856. esac
  4857. # Aesthetically quote the argument.
  4858. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
  4859. case $arg in
  4860. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
  4861. arg="\"$arg\""
  4862. ;;
  4863. esac
  4864. install_prog="$install_prog $arg"
  4865. done
  4866. if test -z "$install_prog"; then
  4867. $echo "$modename: you must specify an install program" 1>&2
  4868. $echo "$help" 1>&2
  4869. exit $EXIT_FAILURE
  4870. fi
  4871. if test -n "$prev"; then
  4872. $echo "$modename: the \`$prev' option requires an argument" 1>&2
  4873. $echo "$help" 1>&2
  4874. exit $EXIT_FAILURE
  4875. fi
  4876. if test -z "$files"; then
  4877. if test -z "$dest"; then
  4878. $echo "$modename: no file or destination specified" 1>&2
  4879. else
  4880. $echo "$modename: you must specify a destination" 1>&2
  4881. fi
  4882. $echo "$help" 1>&2
  4883. exit $EXIT_FAILURE
  4884. fi
  4885. # Strip any trailing slash from the destination.
  4886. dest=`$echo "X$dest" | $Xsed -e 's%/$%%'`
  4887. # Check to see that the destination is a directory.
  4888. test -d "$dest" && isdir=yes
  4889. if test "$isdir" = yes; then
  4890. destdir="$dest"
  4891. destname=
  4892. else
  4893. destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'`
  4894. test "X$destdir" = "X$dest" && destdir=.
  4895. destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'`
  4896. # Not a directory, so check to see that there is only one file specified.
  4897. set dummy $files
  4898. if test "$#" -gt 2; then
  4899. $echo "$modename: \`$dest' is not a directory" 1>&2
  4900. $echo "$help" 1>&2
  4901. exit $EXIT_FAILURE
  4902. fi
  4903. fi
  4904. case $destdir in
  4905. [\\/]* | [A-Za-z]:[\\/]*) ;;
  4906. *)
  4907. for file in $files; do
  4908. case $file in
  4909. *.lo) ;;
  4910. *)
  4911. $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
  4912. $echo "$help" 1>&2
  4913. exit $EXIT_FAILURE
  4914. ;;
  4915. esac
  4916. done
  4917. ;;
  4918. esac
  4919. # This variable tells wrapper scripts just to set variables rather
  4920. # than running their programs.
  4921. libtool_install_magic="$magic"
  4922. staticlibs=
  4923. future_libdirs=
  4924. current_libdirs=
  4925. for file in $files; do
  4926. # Do each installation.
  4927. case $file in
  4928. *.$libext)
  4929. # Do the static libraries later.
  4930. staticlibs="$staticlibs $file"
  4931. ;;
  4932. *.la)
  4933. # Check to see that this really is a libtool archive.
  4934. if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
  4935. else
  4936. $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
  4937. $echo "$help" 1>&2
  4938. exit $EXIT_FAILURE
  4939. fi
  4940. library_names=
  4941. old_library=
  4942. relink_command=
  4943. # If there is no directory component, then add one.
  4944. case $file in
  4945. */* | *\\*) . $file ;;
  4946. *) . ./$file ;;
  4947. esac
  4948. # Add the libdir to current_libdirs if it is the destination.
  4949. if test "X$destdir" = "X$libdir"; then
  4950. case "$current_libdirs " in
  4951. *" $libdir "*) ;;
  4952. *) current_libdirs="$current_libdirs $libdir" ;;
  4953. esac
  4954. else
  4955. # Note the libdir as a future libdir.
  4956. case "$future_libdirs " in
  4957. *" $libdir "*) ;;
  4958. *) future_libdirs="$future_libdirs $libdir" ;;
  4959. esac
  4960. fi
  4961. dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/
  4962. test "X$dir" = "X$file/" && dir=
  4963. dir="$dir$objdir"
  4964. if test -n "$relink_command"; then
  4965. # Determine the prefix the user has applied to our future dir.
  4966. inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"`
  4967. # Don't allow the user to place us outside of our expected
  4968. # location b/c this prevents finding dependent libraries that
  4969. # are installed to the same prefix.
  4970. # At present, this check doesn't affect windows .dll's that
  4971. # are installed into $libdir/../bin (currently, that works fine)
  4972. # but it's something to keep an eye on.
  4973. if test "$inst_prefix_dir" = "$destdir"; then
  4974. $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2
  4975. exit $EXIT_FAILURE
  4976. fi
  4977. if test -n "$inst_prefix_dir"; then
  4978. # Stick the inst_prefix_dir data into the link command.
  4979. relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
  4980. else
  4981. relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%%"`
  4982. fi
  4983. $echo "$modename: warning: relinking \`$file'" 1>&2
  4984. $show "$relink_command"
  4985. if $run eval "$relink_command"; then :
  4986. else
  4987. $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
  4988. exit $EXIT_FAILURE
  4989. fi
  4990. fi
  4991. # See the names of the shared library.
  4992. set dummy $library_names
  4993. if test -n "$2"; then
  4994. realname="$2"
  4995. shift
  4996. shift
  4997. srcname="$realname"
  4998. test -n "$relink_command" && srcname="$realname"T
  4999. # Install the shared library and build the symlinks.
  5000. $show "$install_prog $dir/$srcname $destdir/$realname"
  5001. $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $?
  5002. if test -n "$stripme" && test -n "$striplib"; then
  5003. $show "$striplib $destdir/$realname"
  5004. $run eval "$striplib $destdir/$realname" || exit $?
  5005. fi
  5006. if test "$#" -gt 0; then
  5007. # Delete the old symlinks, and create new ones.
  5008. for linkname
  5009. do
  5010. if test "$linkname" != "$realname"; then
  5011. $show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
  5012. $run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
  5013. fi
  5014. done
  5015. fi
  5016. # Do each command in the postinstall commands.
  5017. lib="$destdir/$realname"
  5018. cmds=$postinstall_cmds
  5019. save_ifs="$IFS"; IFS='~'
  5020. for cmd in $cmds; do
  5021. IFS="$save_ifs"
  5022. eval cmd=\"$cmd\"
  5023. $show "$cmd"
  5024. $run eval "$cmd" || exit $?
  5025. done
  5026. IFS="$save_ifs"
  5027. fi
  5028. # Install the pseudo-library for information purposes.
  5029. case $host in
  5030. *-*-freebsd*)
  5031. # Do not install the useless pseudo-library
  5032. ;;
  5033. *)
  5034. name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
  5035. instname="$dir/$name"i
  5036. $show "$install_prog $instname $destdir/$name"
  5037. $run eval "$install_prog $instname $destdir/$name" || exit $?
  5038. ;;
  5039. esac
  5040. # Maybe install the static library, too.
  5041. test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
  5042. ;;
  5043. *.lo)
  5044. # Install (i.e. copy) a libtool object.
  5045. # Figure out destination file name, if it wasn't already specified.
  5046. if test -n "$destname"; then
  5047. destfile="$destdir/$destname"
  5048. else
  5049. destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
  5050. destfile="$destdir/$destfile"
  5051. fi
  5052. # Deduce the name of the destination old-style object file.
  5053. case $destfile in
  5054. *.lo)
  5055. staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"`
  5056. ;;
  5057. *.$objext)
  5058. staticdest="$destfile"
  5059. destfile=
  5060. ;;
  5061. *)
  5062. $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
  5063. $echo "$help" 1>&2
  5064. exit $EXIT_FAILURE
  5065. ;;
  5066. esac
  5067. # Install the libtool object if requested.
  5068. if test -n "$destfile"; then
  5069. $show "$install_prog $file $destfile"
  5070. $run eval "$install_prog $file $destfile" || exit $?
  5071. fi
  5072. # Install the old object if enabled.
  5073. if test "$build_old_libs" = yes; then
  5074. # Deduce the name of the old-style object file.
  5075. staticobj=`$echo "X$file" | $Xsed -e "$lo2o"`
  5076. $show "$install_prog $staticobj $staticdest"
  5077. $run eval "$install_prog \$staticobj \$staticdest" || exit $?
  5078. fi
  5079. exit $EXIT_SUCCESS
  5080. ;;
  5081. *)
  5082. # Figure out destination file name, if it wasn't already specified.
  5083. if test -n "$destname"; then
  5084. destfile="$destdir/$destname"
  5085. else
  5086. destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
  5087. destfile="$destdir/$destfile"
  5088. fi
  5089. # If the file is missing, and there is a .exe on the end, strip it
  5090. # because it is most likely a libtool script we actually want to
  5091. # install
  5092. stripped_ext=""
  5093. case $file in
  5094. *.exe)
  5095. if test ! -f "$file"; then
  5096. file=`$echo $file|${SED} 's,.exe$,,'`
  5097. stripped_ext=".exe"
  5098. fi
  5099. ;;
  5100. esac
  5101. # Do a test to see if this is really a libtool program.
  5102. case $host in
  5103. *cygwin*|*mingw*)
  5104. wrapper=`$echo $file | ${SED} -e 's,.exe$,,'`
  5105. ;;
  5106. *)
  5107. wrapper=$file
  5108. ;;
  5109. esac
  5110. if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then
  5111. notinst_deplibs=
  5112. relink_command=
  5113. # To insure that "foo" is sourced, and not "foo.exe",
  5114. # finese the cygwin/MSYS system by explicitly sourcing "foo."
  5115. # which disallows the automatic-append-.exe behavior.
  5116. case $build in
  5117. *cygwin* | *mingw*) wrapperdot=${wrapper}. ;;
  5118. *) wrapperdot=${wrapper} ;;
  5119. esac
  5120. # If there is no directory component, then add one.
  5121. case $file in
  5122. */* | *\\*) . ${wrapperdot} ;;
  5123. *) . ./${wrapperdot} ;;
  5124. esac
  5125. # Check the variables that should have been set.
  5126. if test -z "$notinst_deplibs"; then
  5127. $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2
  5128. exit $EXIT_FAILURE
  5129. fi
  5130. finalize=yes
  5131. for lib in $notinst_deplibs; do
  5132. # Check to see that each library is installed.
  5133. libdir=
  5134. if test -f "$lib"; then
  5135. # If there is no directory component, then add one.
  5136. case $lib in
  5137. */* | *\\*) . $lib ;;
  5138. *) . ./$lib ;;
  5139. esac
  5140. fi
  5141. libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
  5142. if test -n "$libdir" && test ! -f "$libfile"; then
  5143. $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
  5144. finalize=no
  5145. fi
  5146. done
  5147. relink_command=
  5148. # To insure that "foo" is sourced, and not "foo.exe",
  5149. # finese the cygwin/MSYS system by explicitly sourcing "foo."
  5150. # which disallows the automatic-append-.exe behavior.
  5151. case $build in
  5152. *cygwin* | *mingw*) wrapperdot=${wrapper}. ;;
  5153. *) wrapperdot=${wrapper} ;;
  5154. esac
  5155. # If there is no directory component, then add one.
  5156. case $file in
  5157. */* | *\\*) . ${wrapperdot} ;;
  5158. *) . ./${wrapperdot} ;;
  5159. esac
  5160. outputname=
  5161. if test "$fast_install" = no && test -n "$relink_command"; then
  5162. if test "$finalize" = yes && test -z "$run"; then
  5163. tmpdir="/tmp"
  5164. test -n "$TMPDIR" && tmpdir="$TMPDIR"
  5165. tmpdir="$tmpdir/libtool-$$"
  5166. save_umask=`umask`
  5167. umask 0077
  5168. if $mkdir "$tmpdir"; then
  5169. umask $save_umask
  5170. else
  5171. umask $save_umask
  5172. $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2
  5173. continue
  5174. fi
  5175. file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'`
  5176. outputname="$tmpdir/$file"
  5177. # Replace the output file specification.
  5178. relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
  5179. $show "$relink_command"
  5180. if $run eval "$relink_command"; then :
  5181. else
  5182. $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
  5183. ${rm}r "$tmpdir"
  5184. continue
  5185. fi
  5186. file="$outputname"
  5187. else
  5188. $echo "$modename: warning: cannot relink \`$file'" 1>&2
  5189. fi
  5190. else
  5191. # Install the binary that we compiled earlier.
  5192. file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
  5193. fi
  5194. fi
  5195. # remove .exe since cygwin /usr/bin/install will append another
  5196. # one anyways
  5197. case $install_prog,$host in
  5198. */usr/bin/install*,*cygwin*)
  5199. case $file:$destfile in
  5200. *.exe:*.exe)
  5201. # this is ok
  5202. ;;
  5203. *.exe:*)
  5204. destfile=$destfile.exe
  5205. ;;
  5206. *:*.exe)
  5207. destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'`
  5208. ;;
  5209. esac
  5210. ;;
  5211. esac
  5212. $show "$install_prog$stripme $file $destfile"
  5213. $run eval "$install_prog\$stripme \$file \$destfile" || exit $?
  5214. test -n "$outputname" && ${rm}r "$tmpdir"
  5215. ;;
  5216. esac
  5217. done
  5218. for file in $staticlibs; do
  5219. name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
  5220. # Set up the ranlib parameters.
  5221. oldlib="$destdir/$name"
  5222. $show "$install_prog $file $oldlib"
  5223. $run eval "$install_prog \$file \$oldlib" || exit $?
  5224. if test -n "$stripme" && test -n "$old_striplib"; then
  5225. $show "$old_striplib $oldlib"
  5226. $run eval "$old_striplib $oldlib" || exit $?
  5227. fi
  5228. # Do each command in the postinstall commands.
  5229. cmds=$old_postinstall_cmds
  5230. save_ifs="$IFS"; IFS='~'
  5231. for cmd in $cmds; do
  5232. IFS="$save_ifs"
  5233. eval cmd=\"$cmd\"
  5234. $show "$cmd"
  5235. $run eval "$cmd" || exit $?
  5236. done
  5237. IFS="$save_ifs"
  5238. done
  5239. if test -n "$future_libdirs"; then
  5240. $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
  5241. fi
  5242. if test -n "$current_libdirs"; then
  5243. # Maybe just do a dry run.
  5244. test -n "$run" && current_libdirs=" -n$current_libdirs"
  5245. exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
  5246. else
  5247. exit $EXIT_SUCCESS
  5248. fi
  5249. ;;
  5250. # libtool finish mode
  5251. finish)
  5252. modename="$modename: finish"
  5253. libdirs="$nonopt"
  5254. admincmds=
  5255. if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
  5256. for dir
  5257. do
  5258. libdirs="$libdirs $dir"
  5259. done
  5260. for libdir in $libdirs; do
  5261. if test -n "$finish_cmds"; then
  5262. # Do each command in the finish commands.
  5263. cmds=$finish_cmds
  5264. save_ifs="$IFS"; IFS='~'
  5265. for cmd in $cmds; do
  5266. IFS="$save_ifs"
  5267. eval cmd=\"$cmd\"
  5268. $show "$cmd"
  5269. $run eval "$cmd" || admincmds="$admincmds
  5270. $cmd"
  5271. done
  5272. IFS="$save_ifs"
  5273. fi
  5274. if test -n "$finish_eval"; then
  5275. # Do the single finish_eval.
  5276. eval cmds=\"$finish_eval\"
  5277. $run eval "$cmds" || admincmds="$admincmds
  5278. $cmds"
  5279. fi
  5280. done
  5281. fi
  5282. # Exit here if they wanted silent mode.
  5283. test "$show" = : && exit $EXIT_SUCCESS
  5284. $echo "----------------------------------------------------------------------"
  5285. $echo "Libraries have been installed in:"
  5286. for libdir in $libdirs; do
  5287. $echo " $libdir"
  5288. done
  5289. $echo
  5290. $echo "If you ever happen to want to link against installed libraries"
  5291. $echo "in a given directory, LIBDIR, you must either use libtool, and"
  5292. $echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
  5293. $echo "flag during linking and do at least one of the following:"
  5294. if test -n "$shlibpath_var"; then
  5295. $echo " - add LIBDIR to the \`$shlibpath_var' environment variable"
  5296. $echo " during execution"
  5297. fi
  5298. if test -n "$runpath_var"; then
  5299. $echo " - add LIBDIR to the \`$runpath_var' environment variable"
  5300. $echo " during linking"
  5301. fi
  5302. if test -n "$hardcode_libdir_flag_spec"; then
  5303. libdir=LIBDIR
  5304. eval flag=\"$hardcode_libdir_flag_spec\"
  5305. $echo " - use the \`$flag' linker flag"
  5306. fi
  5307. if test -n "$admincmds"; then
  5308. $echo " - have your system administrator run these commands:$admincmds"
  5309. fi
  5310. if test -f /etc/ld.so.conf; then
  5311. $echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
  5312. fi
  5313. $echo
  5314. $echo "See any operating system documentation about shared libraries for"
  5315. $echo "more information, such as the ld(1) and ld.so(8) manual pages."
  5316. $echo "----------------------------------------------------------------------"
  5317. exit $EXIT_SUCCESS
  5318. ;;
  5319. # libtool execute mode
  5320. execute)
  5321. modename="$modename: execute"
  5322. # The first argument is the command name.
  5323. cmd="$nonopt"
  5324. if test -z "$cmd"; then
  5325. $echo "$modename: you must specify a COMMAND" 1>&2
  5326. $echo "$help"
  5327. exit $EXIT_FAILURE
  5328. fi
  5329. # Handle -dlopen flags immediately.
  5330. for file in $execute_dlfiles; do
  5331. if test ! -f "$file"; then
  5332. $echo "$modename: \`$file' is not a file" 1>&2
  5333. $echo "$help" 1>&2
  5334. exit $EXIT_FAILURE
  5335. fi
  5336. dir=
  5337. case $file in
  5338. *.la)
  5339. # Check to see that this really is a libtool archive.
  5340. if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
  5341. else
  5342. $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
  5343. $echo "$help" 1>&2
  5344. exit $EXIT_FAILURE
  5345. fi
  5346. # Read the libtool library.
  5347. dlname=
  5348. library_names=
  5349. # If there is no directory component, then add one.
  5350. case $file in
  5351. */* | *\\*) . $file ;;
  5352. *) . ./$file ;;
  5353. esac
  5354. # Skip this library if it cannot be dlopened.
  5355. if test -z "$dlname"; then
  5356. # Warn if it was a shared library.
  5357. test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'"
  5358. continue
  5359. fi
  5360. dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
  5361. test "X$dir" = "X$file" && dir=.
  5362. if test -f "$dir/$objdir/$dlname"; then
  5363. dir="$dir/$objdir"
  5364. else
  5365. $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
  5366. exit $EXIT_FAILURE
  5367. fi
  5368. ;;
  5369. *.lo)
  5370. # Just add the directory containing the .lo file.
  5371. dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
  5372. test "X$dir" = "X$file" && dir=.
  5373. ;;
  5374. *)
  5375. $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2
  5376. continue
  5377. ;;
  5378. esac
  5379. # Get the absolute pathname.
  5380. absdir=`cd "$dir" && pwd`
  5381. test -n "$absdir" && dir="$absdir"
  5382. # Now add the directory to shlibpath_var.
  5383. if eval "test -z \"\$$shlibpath_var\""; then
  5384. eval "$shlibpath_var=\"\$dir\""
  5385. else
  5386. eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
  5387. fi
  5388. done
  5389. # This variable tells wrapper scripts just to set shlibpath_var
  5390. # rather than running their programs.
  5391. libtool_execute_magic="$magic"
  5392. # Check if any of the arguments is a wrapper script.
  5393. args=
  5394. for file
  5395. do
  5396. case $file in
  5397. -*) ;;
  5398. *)
  5399. # Do a test to see if this is really a libtool program.
  5400. if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
  5401. # If there is no directory component, then add one.
  5402. case $file in
  5403. */* | *\\*) . $file ;;
  5404. *) . ./$file ;;
  5405. esac
  5406. # Transform arg to wrapped name.
  5407. file="$progdir/$program"
  5408. fi
  5409. ;;
  5410. esac
  5411. # Quote arguments (to preserve shell metacharacters).
  5412. file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"`
  5413. args="$args \"$file\""
  5414. done
  5415. if test -z "$run"; then
  5416. if test -n "$shlibpath_var"; then
  5417. # Export the shlibpath_var.
  5418. eval "export $shlibpath_var"
  5419. fi
  5420. # Restore saved environment variables
  5421. if test "${save_LC_ALL+set}" = set; then
  5422. LC_ALL="$save_LC_ALL"; export LC_ALL
  5423. fi
  5424. if test "${save_LANG+set}" = set; then
  5425. LANG="$save_LANG"; export LANG
  5426. fi
  5427. # Now prepare to actually exec the command.
  5428. exec_cmd="\$cmd$args"
  5429. else
  5430. # Display what would be done.
  5431. if test -n "$shlibpath_var"; then
  5432. eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
  5433. $echo "export $shlibpath_var"
  5434. fi
  5435. $echo "$cmd$args"
  5436. exit $EXIT_SUCCESS
  5437. fi
  5438. ;;
  5439. # libtool clean and uninstall mode
  5440. clean | uninstall)
  5441. modename="$modename: $mode"
  5442. rm="$nonopt"
  5443. files=
  5444. rmforce=
  5445. exit_status=0
  5446. # This variable tells wrapper scripts just to set variables rather
  5447. # than running their programs.
  5448. libtool_install_magic="$magic"
  5449. for arg
  5450. do
  5451. case $arg in
  5452. -f) rm="$rm $arg"; rmforce=yes ;;
  5453. -*) rm="$rm $arg" ;;
  5454. *) files="$files $arg" ;;
  5455. esac
  5456. done
  5457. if test -z "$rm"; then
  5458. $echo "$modename: you must specify an RM program" 1>&2
  5459. $echo "$help" 1>&2
  5460. exit $EXIT_FAILURE
  5461. fi
  5462. rmdirs=
  5463. origobjdir="$objdir"
  5464. for file in $files; do
  5465. dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
  5466. if test "X$dir" = "X$file"; then
  5467. dir=.
  5468. objdir="$origobjdir"
  5469. else
  5470. objdir="$dir/$origobjdir"
  5471. fi
  5472. name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
  5473. test "$mode" = uninstall && objdir="$dir"
  5474. # Remember objdir for removal later, being careful to avoid duplicates
  5475. if test "$mode" = clean; then
  5476. case " $rmdirs " in
  5477. *" $objdir "*) ;;
  5478. *) rmdirs="$rmdirs $objdir" ;;
  5479. esac
  5480. fi
  5481. # Don't error if the file doesn't exist and rm -f was used.
  5482. if (test -L "$file") >/dev/null 2>&1 \
  5483. || (test -h "$file") >/dev/null 2>&1 \
  5484. || test -f "$file"; then
  5485. :
  5486. elif test -d "$file"; then
  5487. exit_status=1
  5488. continue
  5489. elif test "$rmforce" = yes; then
  5490. continue
  5491. fi
  5492. rmfiles="$file"
  5493. case $name in
  5494. *.la)
  5495. # Possibly a libtool archive, so verify it.
  5496. if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
  5497. . $dir/$name
  5498. # Delete the libtool libraries and symlinks.
  5499. for n in $library_names; do
  5500. rmfiles="$rmfiles $objdir/$n"
  5501. done
  5502. test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
  5503. test "$mode" = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
  5504. if test "$mode" = uninstall; then
  5505. if test -n "$library_names"; then
  5506. # Do each command in the postuninstall commands.
  5507. cmds=$postuninstall_cmds
  5508. save_ifs="$IFS"; IFS='~'
  5509. for cmd in $cmds; do
  5510. IFS="$save_ifs"
  5511. eval cmd=\"$cmd\"
  5512. $show "$cmd"
  5513. $run eval "$cmd"
  5514. if test "$?" -ne 0 && test "$rmforce" != yes; then
  5515. exit_status=1
  5516. fi
  5517. done
  5518. IFS="$save_ifs"
  5519. fi
  5520. if test -n "$old_library"; then
  5521. # Do each command in the old_postuninstall commands.
  5522. cmds=$old_postuninstall_cmds
  5523. save_ifs="$IFS"; IFS='~'
  5524. for cmd in $cmds; do
  5525. IFS="$save_ifs"
  5526. eval cmd=\"$cmd\"
  5527. $show "$cmd"
  5528. $run eval "$cmd"
  5529. if test "$?" -ne 0 && test "$rmforce" != yes; then
  5530. exit_status=1
  5531. fi
  5532. done
  5533. IFS="$save_ifs"
  5534. fi
  5535. # FIXME: should reinstall the best remaining shared library.
  5536. fi
  5537. fi
  5538. ;;
  5539. *.lo)
  5540. # Possibly a libtool object, so verify it.
  5541. if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
  5542. # Read the .lo file
  5543. . $dir/$name
  5544. # Add PIC object to the list of files to remove.
  5545. if test -n "$pic_object" \
  5546. && test "$pic_object" != none; then
  5547. rmfiles="$rmfiles $dir/$pic_object"
  5548. fi
  5549. # Add non-PIC object to the list of files to remove.
  5550. if test -n "$non_pic_object" \
  5551. && test "$non_pic_object" != none; then
  5552. rmfiles="$rmfiles $dir/$non_pic_object"
  5553. fi
  5554. fi
  5555. ;;
  5556. *)
  5557. if test "$mode" = clean ; then
  5558. noexename=$name
  5559. case $file in
  5560. *.exe)
  5561. file=`$echo $file|${SED} 's,.exe$,,'`
  5562. noexename=`$echo $name|${SED} 's,.exe$,,'`
  5563. # $file with .exe has already been added to rmfiles,
  5564. # add $file without .exe
  5565. rmfiles="$rmfiles $file"
  5566. ;;
  5567. esac
  5568. # Do a test to see if this is a libtool program.
  5569. if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
  5570. relink_command=
  5571. . $dir/$noexename
  5572. # note $name still contains .exe if it was in $file originally
  5573. # as does the version of $file that was added into $rmfiles
  5574. rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
  5575. if test "$fast_install" = yes && test -n "$relink_command"; then
  5576. rmfiles="$rmfiles $objdir/lt-$name"
  5577. fi
  5578. if test "X$noexename" != "X$name" ; then
  5579. rmfiles="$rmfiles $objdir/lt-${noexename}.c"
  5580. fi
  5581. fi
  5582. fi
  5583. ;;
  5584. esac
  5585. $show "$rm $rmfiles"
  5586. $run $rm $rmfiles || exit_status=1
  5587. done
  5588. objdir="$origobjdir"
  5589. # Try to remove the ${objdir}s in the directories where we deleted files
  5590. for dir in $rmdirs; do
  5591. if test -d "$dir"; then
  5592. $show "rmdir $dir"
  5593. $run rmdir $dir >/dev/null 2>&1
  5594. fi
  5595. done
  5596. exit $exit_status
  5597. ;;
  5598. "")
  5599. $echo "$modename: you must specify a MODE" 1>&2
  5600. $echo "$generic_help" 1>&2
  5601. exit $EXIT_FAILURE
  5602. ;;
  5603. esac
  5604. if test -z "$exec_cmd"; then
  5605. $echo "$modename: invalid operation mode \`$mode'" 1>&2
  5606. $echo "$generic_help" 1>&2
  5607. exit $EXIT_FAILURE
  5608. fi
  5609. fi # test -z "$show_help"
  5610. if test -n "$exec_cmd"; then
  5611. eval exec $exec_cmd
  5612. exit $EXIT_FAILURE
  5613. fi
  5614. # We need to display help for each of the modes.
  5615. case $mode in
  5616. "") $echo \
  5617. "Usage: $modename [OPTION]... [MODE-ARG]...
  5618. Provide generalized library-building support services.
  5619. --config show all configuration variables
  5620. --debug enable verbose shell tracing
  5621. -n, --dry-run display commands without modifying any files
  5622. --features display basic configuration information and exit
  5623. --finish same as \`--mode=finish'
  5624. --help display this help message and exit
  5625. --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS]
  5626. --quiet same as \`--silent'
  5627. --silent don't print informational messages
  5628. --tag=TAG use configuration variables from tag TAG
  5629. --version print version information
  5630. MODE must be one of the following:
  5631. clean remove files from the build directory
  5632. compile compile a source file into a libtool object
  5633. execute automatically set library path, then run a program
  5634. finish complete the installation of libtool libraries
  5635. install install libraries or executables
  5636. link create a library or an executable
  5637. uninstall remove libraries from an installed directory
  5638. MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for
  5639. a more detailed description of MODE.
  5640. Report bugs to <bug-libtool@gnu.org>."
  5641. exit $EXIT_SUCCESS
  5642. ;;
  5643. clean)
  5644. $echo \
  5645. "Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
  5646. Remove files from the build directory.
  5647. RM is the name of the program to use to delete files associated with each FILE
  5648. (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
  5649. to RM.
  5650. If FILE is a libtool library, object or program, all the files associated
  5651. with it are deleted. Otherwise, only FILE itself is deleted using RM."
  5652. ;;
  5653. compile)
  5654. $echo \
  5655. "Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
  5656. Compile a source file into a libtool library object.
  5657. This mode accepts the following additional options:
  5658. -o OUTPUT-FILE set the output file name to OUTPUT-FILE
  5659. -prefer-pic try to building PIC objects only
  5660. -prefer-non-pic try to building non-PIC objects only
  5661. -static always build a \`.o' file suitable for static linking
  5662. COMPILE-COMMAND is a command to be used in creating a \`standard' object file
  5663. from the given SOURCEFILE.
  5664. The output file name is determined by removing the directory component from
  5665. SOURCEFILE, then substituting the C source code suffix \`.c' with the
  5666. library object suffix, \`.lo'."
  5667. ;;
  5668. execute)
  5669. $echo \
  5670. "Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]...
  5671. Automatically set library path, then run a program.
  5672. This mode accepts the following additional options:
  5673. -dlopen FILE add the directory containing FILE to the library path
  5674. This mode sets the library path environment variable according to \`-dlopen'
  5675. flags.
  5676. If any of the ARGS are libtool executable wrappers, then they are translated
  5677. into their corresponding uninstalled binary, and any of their required library
  5678. directories are added to the library path.
  5679. Then, COMMAND is executed, with ARGS as arguments."
  5680. ;;
  5681. finish)
  5682. $echo \
  5683. "Usage: $modename [OPTION]... --mode=finish [LIBDIR]...
  5684. Complete the installation of libtool libraries.
  5685. Each LIBDIR is a directory that contains libtool libraries.
  5686. The commands that this mode executes may require superuser privileges. Use
  5687. the \`--dry-run' option if you just want to see what would be executed."
  5688. ;;
  5689. install)
  5690. $echo \
  5691. "Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND...
  5692. Install executables or libraries.
  5693. INSTALL-COMMAND is the installation command. The first component should be
  5694. either the \`install' or \`cp' program.
  5695. The rest of the components are interpreted as arguments to that command (only
  5696. BSD-compatible install options are recognized)."
  5697. ;;
  5698. link)
  5699. $echo \
  5700. "Usage: $modename [OPTION]... --mode=link LINK-COMMAND...
  5701. Link object files or libraries together to form another library, or to
  5702. create an executable program.
  5703. LINK-COMMAND is a command using the C compiler that you would use to create
  5704. a program from several object files.
  5705. The following components of LINK-COMMAND are treated specially:
  5706. -all-static do not do any dynamic linking at all
  5707. -avoid-version do not add a version suffix if possible
  5708. -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
  5709. -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
  5710. -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
  5711. -export-symbols SYMFILE
  5712. try to export only the symbols listed in SYMFILE
  5713. -export-symbols-regex REGEX
  5714. try to export only the symbols matching REGEX
  5715. -LLIBDIR search LIBDIR for required installed libraries
  5716. -lNAME OUTPUT-FILE requires the installed library libNAME
  5717. -module build a library that can dlopened
  5718. -no-fast-install disable the fast-install mode
  5719. -no-install link a not-installable executable
  5720. -no-undefined declare that a library does not refer to external symbols
  5721. -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
  5722. -objectlist FILE Use a list of object files found in FILE to specify objects
  5723. -precious-files-regex REGEX
  5724. don't remove output files matching REGEX
  5725. -release RELEASE specify package release information
  5726. -rpath LIBDIR the created library will eventually be installed in LIBDIR
  5727. -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
  5728. -static do not do any dynamic linking of libtool libraries
  5729. -version-info CURRENT[:REVISION[:AGE]]
  5730. specify library version info [each variable defaults to 0]
  5731. All other options (arguments beginning with \`-') are ignored.
  5732. Every other argument is treated as a filename. Files ending in \`.la' are
  5733. treated as uninstalled libtool libraries, other files are standard or library
  5734. object files.
  5735. If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
  5736. only library objects (\`.lo' files) may be specified, and \`-rpath' is
  5737. required, except when creating a convenience library.
  5738. If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
  5739. using \`ar' and \`ranlib', or on Windows using \`lib'.
  5740. If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
  5741. is created, otherwise an executable program is created."
  5742. ;;
  5743. uninstall)
  5744. $echo \
  5745. "Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
  5746. Remove libraries from an installation directory.
  5747. RM is the name of the program to use to delete files associated with each FILE
  5748. (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
  5749. to RM.
  5750. If FILE is a libtool library, all the files associated with it are deleted.
  5751. Otherwise, only FILE itself is deleted using RM."
  5752. ;;
  5753. *)
  5754. $echo "$modename: invalid operation mode \`$mode'" 1>&2
  5755. $echo "$help" 1>&2
  5756. exit $EXIT_FAILURE
  5757. ;;
  5758. esac
  5759. $echo
  5760. $echo "Try \`$modename --help' for more information about other modes."
  5761. exit $EXIT_SUCCESS
  5762. # The TAGs below are defined such that we never get into a situation
  5763. # in which we disable both kinds of libraries. Given conflicting
  5764. # choices, we go for a static library, that is the most portable,
  5765. # since we can't tell whether shared libraries were disabled because
  5766. # the user asked for that or because the platform doesn't support
  5767. # them. This is particularly important on AIX, because we don't
  5768. # support having both static and shared libraries enabled at the same
  5769. # time on that platform, so we default to a shared-only configuration.
  5770. # If a disable-shared tag is given, we'll fallback to a static-only
  5771. # configuration. But we'll never go from static-only to shared-only.
  5772. # ### BEGIN LIBTOOL TAG CONFIG: disable-shared
  5773. build_libtool_libs=no
  5774. build_old_libs=yes
  5775. # ### END LIBTOOL TAG CONFIG: disable-shared
  5776. # ### BEGIN LIBTOOL TAG CONFIG: disable-static
  5777. build_old_libs=`case $build_libtool_libs in yes) $echo no;; *) $echo yes;; esac`
  5778. # ### END LIBTOOL TAG CONFIG: disable-static
  5779. # Local Variables:
  5780. # mode:shell-script
  5781. # sh-indentation:2
  5782. # End: