ltmain.sh 192 KB

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