ltmain.sh 184 KB

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