ltmain.sh 276 KB

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