libtool 339 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846
  1. #! /bin/bash
  2. # Generated automatically by config.status (curl) -
  3. # NOTE: Changes made to this file will be lost: look at ltmain.sh.
  4. # Provide generalized library-building support services.
  5. # Written by Gordon Matzigkeit, 1996
  6. # Copyright (C) 2014 Free Software Foundation, Inc.
  7. # This is free software; see the source for copying conditions. There is NO
  8. # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  9. # GNU Libtool is free software; you can redistribute it and/or modify
  10. # it under the terms of the GNU General Public License as published by
  11. # the Free Software Foundation; either version 2 of of the License, or
  12. # (at your option) any later version.
  13. #
  14. # As a special exception to the GNU General Public License, if you
  15. # distribute this file as part of a program or library that is built
  16. # using GNU Libtool, you may include this file under the same
  17. # distribution terms that you use for the rest of that program.
  18. #
  19. # GNU Libtool is distributed in the hope that it will be useful, but
  20. # WITHOUT ANY WARRANTY; without even the implied warranty of
  21. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  22. # GNU General Public License for more details.
  23. #
  24. # You should have received a copy of the GNU General Public License
  25. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  26. # The names of the tagged configurations supported by this script.
  27. available_tags=''
  28. # Configured defaults for sys_lib_dlsearch_path munging.
  29. : ${LT_SYS_LIBRARY_PATH=""}
  30. # ### BEGIN LIBTOOL CONFIG
  31. # Which release of libtool.m4 was used?
  32. macro_version=2.4.6
  33. macro_revision=2.4.6
  34. # Assembler program.
  35. AS="as"
  36. # DLL creation program.
  37. DLLTOOL="false"
  38. # Object dumper program.
  39. OBJDUMP="objdump"
  40. # Whether or not to build shared libraries.
  41. build_libtool_libs=yes
  42. # Whether or not to build static libraries.
  43. build_old_libs=yes
  44. # What type of objects to build.
  45. pic_mode=default
  46. # Whether or not to optimize for fast installation.
  47. fast_install=yes
  48. # Shared archive member basename,for filename based shared library versioning on AIX.
  49. shared_archive_member_spec=
  50. # Shell to use when invoking shell scripts.
  51. SHELL="/bin/bash"
  52. # An echo program that protects backslashes.
  53. ECHO="printf %s\\n"
  54. # The PATH separator for the build system.
  55. PATH_SEPARATOR=":"
  56. # The host system.
  57. host_alias=arm-linux-gnueabihf
  58. host=arm-unknown-linux-gnueabihf
  59. host_os=linux-gnueabihf
  60. # The build system.
  61. build_alias=
  62. build=x86_64-pc-linux-gnu
  63. build_os=linux-gnu
  64. # A sed program that does not truncate output.
  65. SED="/bin/sed"
  66. # Sed that helps us avoid accidentally triggering echo(1) options like -n.
  67. Xsed="$SED -e 1s/^X//"
  68. # A grep program that handles long lines.
  69. GREP="/bin/grep"
  70. # An ERE matcher.
  71. EGREP="/bin/grep -E"
  72. # A literal string matcher.
  73. FGREP="/bin/grep -F"
  74. # A BSD- or MS-compatible name lister.
  75. NM="nm"
  76. # Whether we need soft or hard links.
  77. LN_S="ln -s"
  78. # What is the maximum length of a command?
  79. max_cmd_len=1572864
  80. # Object file suffix (normally "o").
  81. objext=o
  82. # Executable file suffix (normally "").
  83. exeext=
  84. # whether the shell understands "unset".
  85. lt_unset=unset
  86. # turn spaces into newlines.
  87. SP2NL="tr \\040 \\012"
  88. # turn newlines into spaces.
  89. NL2SP="tr \\015\\012 \\040\\040"
  90. # convert $build file names to $host format.
  91. to_host_file_cmd=func_convert_file_noop
  92. # convert $build files to toolchain format.
  93. to_tool_file_cmd=func_convert_file_noop
  94. # Method to check whether dependent libraries are shared objects.
  95. deplibs_check_method="pass_all"
  96. # Command to use when deplibs_check_method = "file_magic".
  97. file_magic_cmd="\$MAGIC_CMD"
  98. # How to find potential files when deplibs_check_method = "file_magic".
  99. file_magic_glob=""
  100. # Find potential files using nocaseglob when deplibs_check_method = "file_magic".
  101. want_nocaseglob="no"
  102. # Command to associate shared and link libraries.
  103. sharedlib_from_linklib_cmd="printf %s\\n"
  104. # The archiver.
  105. AR="/opt/ti-processor-sdk-linux-am335x-evm-04.02.00.09/linux-devkit/sysroots/x86_64-arago-linux/usr/bin/arm-linux-gnueabihf-ar"
  106. # Flags to create an archive.
  107. AR_FLAGS="cr"
  108. # How to feed a file listing to the archiver.
  109. archiver_list_spec="@"
  110. # A symbol stripping program.
  111. STRIP="/opt/ti-processor-sdk-linux-am335x-evm-04.02.00.09/linux-devkit/sysroots/x86_64-arago-linux/usr/bin/arm-linux-gnueabihf-strip"
  112. # Commands used to install an old-style archive.
  113. RANLIB="/opt/ti-processor-sdk-linux-am335x-evm-04.02.00.09/linux-devkit/sysroots/x86_64-arago-linux/usr/bin/arm-linux-gnueabihf-ranlib"
  114. old_postinstall_cmds="chmod 644 \$oldlib~\$RANLIB \$tool_oldlib"
  115. old_postuninstall_cmds=""
  116. # Whether to use a lock for old archive extraction.
  117. lock_old_archive_extraction=no
  118. # A C compiler.
  119. LTCC="/opt/ti-processor-sdk-linux-am335x-evm-04.02.00.09/linux-devkit/sysroots/x86_64-arago-linux/usr/bin/arm-linux-gnueabihf-gcc"
  120. # LTCC compiler flags.
  121. LTCFLAGS="-Werror-implicit-function-declaration -O2 -Wno-system-headers -pthread"
  122. # Take the output of nm and produce a listing of raw symbols and C names.
  123. global_symbol_pipe="sed -n -e 's/^.*[ ]\\([ABCDGIRSTW][ABCDGIRSTW]*\\)[ ][ ]*\\([_A-Za-z][_A-Za-z0-9]*\\)\$/\\1 \\2 \\2/p' | sed '/ __gnu_lto/d'"
  124. # Transform the output of nm in a proper C declaration.
  125. global_symbol_to_cdecl="sed -n -e 's/^T .* \\(.*\\)\$/extern int \\1();/p' -e 's/^[ABCDGIRSTW][ABCDGIRSTW]* .* \\(.*\\)\$/extern char \\1;/p'"
  126. # Transform the output of nm into a list of symbols to manually relocate.
  127. global_symbol_to_import=""
  128. # Transform the output of nm in a C name address pair.
  129. global_symbol_to_c_name_address="sed -n -e 's/^: \\(.*\\) .*\$/ {\"\\1\", (void *) 0},/p' -e 's/^[ABCDGIRSTW][ABCDGIRSTW]* .* \\(.*\\)\$/ {\"\\1\", (void *) \\&\\1},/p'"
  130. # Transform the output of nm in a C name address pair when lib prefix is needed.
  131. global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \\(.*\\) .*\$/ {\"\\1\", (void *) 0},/p' -e 's/^[ABCDGIRSTW][ABCDGIRSTW]* .* \\(lib.*\\)\$/ {\"\\1\", (void *) \\&\\1},/p' -e 's/^[ABCDGIRSTW][ABCDGIRSTW]* .* \\(.*\\)\$/ {\"lib\\1\", (void *) \\&\\1},/p'"
  132. # The name lister interface.
  133. nm_interface="BSD nm"
  134. # Specify filename containing input files for $NM.
  135. nm_file_list_spec="@"
  136. # The root where to search for dependent libraries,and where our libraries should be installed.
  137. lt_sysroot=
  138. # Command to truncate a binary pipe.
  139. lt_truncate_bin="/bin/dd bs=4096 count=1"
  140. # The name of the directory that contains temporary libtool files.
  141. objdir=.libs
  142. # Used to examine libraries when file_magic_cmd begins with "file".
  143. MAGIC_CMD=file
  144. # Must we lock files when doing compilation?
  145. need_locks="no"
  146. # Manifest tool.
  147. MANIFEST_TOOL=":"
  148. # Tool to manipulate archived DWARF debug symbol files on Mac OS X.
  149. DSYMUTIL=""
  150. # Tool to change global to local symbols on Mac OS X.
  151. NMEDIT=""
  152. # Tool to manipulate fat objects and archives on Mac OS X.
  153. LIPO=""
  154. # ldd/readelf like tool for Mach-O binaries on Mac OS X.
  155. OTOOL=""
  156. # ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4.
  157. OTOOL64=""
  158. # Old archive suffix (normally "a").
  159. libext=a
  160. # Shared library suffix (normally ".so").
  161. shrext_cmds=".so"
  162. # The commands to extract the exported symbol list from a shared archive.
  163. extract_expsyms_cmds=""
  164. # Variables whose values should be saved in libtool wrapper scripts and
  165. # restored at link time.
  166. variables_saved_for_relink="PATH LD_LIBRARY_PATH LD_RUN_PATH GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
  167. # Do we need the "lib" prefix for modules?
  168. need_lib_prefix=no
  169. # Do we need a version for libraries?
  170. need_version=no
  171. # Library versioning type.
  172. version_type=linux
  173. # Shared library runtime path variable.
  174. runpath_var=LD_RUN_PATH
  175. # Shared library path variable.
  176. shlibpath_var=LD_LIBRARY_PATH
  177. # Is shlibpath searched before the hard-coded library search path?
  178. shlibpath_overrides_runpath=no
  179. # Format of library name prefix.
  180. libname_spec="lib\$name"
  181. # List of archive names. First name is the real one, the rest are links.
  182. # The last name is the one that the linker finds with -lNAME
  183. library_names_spec="\$libname\$release\$shared_ext\$versuffix \$libname\$release\$shared_ext\$major \$libname\$shared_ext"
  184. # The coded name of the library, if different from the real name.
  185. soname_spec="\$libname\$release\$shared_ext\$major"
  186. # Permission mode override for installation of shared libraries.
  187. install_override_mode=""
  188. # Command to use after installation of a shared archive.
  189. postinstall_cmds=""
  190. # Command to use after uninstallation of a shared archive.
  191. postuninstall_cmds=""
  192. # Commands used to finish a libtool library installation in a directory.
  193. finish_cmds="PATH=\\\"\\\$PATH:/sbin\\\" ldconfig -n \$libdir"
  194. # As "finish_cmds", except a single script fragment to be evaled but
  195. # not shown.
  196. finish_eval=""
  197. # Whether we should hardcode library paths into libraries.
  198. hardcode_into_libs=yes
  199. # Compile-time system search path for libraries.
  200. sys_lib_search_path_spec="/opt/ti-processor-sdk-linux-am335x-evm-04.02.00.09/linux-devkit/sysroots/x86_64-arago-linux/usr/lib/gcc/arm-linux-gnueabihf/6.2.1 /opt/ti-processor-sdk-linux-am335x-evm-04.02.00.09/linux-devkit/sysroots/x86_64-arago-linux/usr/lib/gcc/arm-linux-gnueabihf /opt/ti-processor-sdk-linux-am335x-evm-04.02.00.09/linux-devkit/sysroots/x86_64-arago-linux/usr/lib/gcc /opt/ti-processor-sdk-linux-am335x-evm-04.02.00.09/linux-devkit/sysroots/x86_64-arago-linux/usr/arm-linux-gnueabihf/lib /opt/ti-processor-sdk-linux-am335x-evm-04.02.00.09/linux-devkit/sysroots/x86_64-arago-linux/usr/arm-linux-gnueabihf/libc/lib/arm-linux-gnueabihf/6.2.1 /opt/ti-processor-sdk-linux-am335x-evm-04.02.00.09/linux-devkit/sysroots/x86_64-arago-linux/usr/arm-linux-gnueabihf/libc/lib/arm-linux-gnueabihf /opt/ti-processor-sdk-linux-am335x-evm-04.02.00.09/linux-devkit/sysroots/x86_64-arago-linux/usr/arm-linux-gnueabihf/libc/lib /opt/ti-processor-sdk-linux-am335x-evm-04.02.00.09/linux-devkit/sysroots/x86_64-arago-linux/usr/arm-linux-gnueabihf/libc/usr/lib/arm-linux-gnueabihf/6.2.1 /opt/ti-processor-sdk-linux-am335x-evm-04.02.00.09/linux-devkit/sysroots/x86_64-arago-linux/usr/arm-linux-gnueabihf/libc/usr/lib/arm-linux-gnueabihf /opt/ti-processor-sdk-linux-am335x-evm-04.02.00.09/linux-devkit/sysroots/x86_64-arago-linux/usr/arm-linux-gnueabihf/libc/usr/lib "
  201. # Detected run-time system search path for libraries.
  202. sys_lib_dlsearch_path_spec="/lib /usr/lib /usr/lib/x86_64-linux-gnu/libfakeroot /usr/local/lib/i386-linux-gnu /lib/i386-linux-gnu /usr/lib/i386-linux-gnu /usr/local/lib/i686-linux-gnu /lib/i686-linux-gnu /usr/lib/i686-linux-gnu /usr/local/lib /usr/local/lib/x86_64-linux-gnu /lib/x86_64-linux-gnu /usr/lib/x86_64-linux-gnu /lib32 /usr/lib32 "
  203. # Explicit LT_SYS_LIBRARY_PATH set during ./configure time.
  204. configure_time_lt_sys_library_path=""
  205. # Whether dlopen is supported.
  206. dlopen_support=unknown
  207. # Whether dlopen of programs is supported.
  208. dlopen_self=unknown
  209. # Whether dlopen of statically linked programs is supported.
  210. dlopen_self_static=unknown
  211. # Commands to strip libraries.
  212. old_striplib="/opt/ti-processor-sdk-linux-am335x-evm-04.02.00.09/linux-devkit/sysroots/x86_64-arago-linux/usr/bin/arm-linux-gnueabihf-strip --strip-debug"
  213. striplib="/opt/ti-processor-sdk-linux-am335x-evm-04.02.00.09/linux-devkit/sysroots/x86_64-arago-linux/usr/bin/arm-linux-gnueabihf-strip --strip-unneeded"
  214. # The linker used to build libraries.
  215. LD="/opt/ti-processor-sdk-linux-am335x-evm-04.02.00.09/linux-devkit/sysroots/x86_64-arago-linux/usr/arm-linux-gnueabihf/bin/ld"
  216. # How to create reloadable object files.
  217. reload_flag=" -r"
  218. reload_cmds="\$LD\$reload_flag -o \$output\$reload_objs"
  219. # Commands used to build an old-style archive.
  220. old_archive_cmds="\$AR \$AR_FLAGS \$oldlib\$oldobjs~\$RANLIB \$tool_oldlib"
  221. # A language specific compiler.
  222. CC="/opt/ti-processor-sdk-linux-am335x-evm-04.02.00.09/linux-devkit/sysroots/x86_64-arago-linux/usr/bin/arm-linux-gnueabihf-gcc"
  223. # Is the compiler the GNU compiler?
  224. with_gcc=yes
  225. # Compiler flag to turn off builtin functions.
  226. no_builtin_flag=" -fno-builtin"
  227. # Additional compiler flags for building library objects.
  228. pic_flag=" -fPIC -DPIC"
  229. # How to pass a linker flag through the compiler.
  230. wl="-Wl,"
  231. # Compiler flag to prevent dynamic linking.
  232. link_static_flag="-static"
  233. # Does compiler simultaneously support -c and -o options?
  234. compiler_c_o="yes"
  235. # Whether or not to add -lc for building shared libraries.
  236. build_libtool_need_lc=no
  237. # Whether or not to disallow shared libs when runtime libs are static.
  238. allow_libtool_libs_with_static_runtimes=no
  239. # Compiler flag to allow reflexive dlopens.
  240. export_dynamic_flag_spec="\$wl--export-dynamic"
  241. # Compiler flag to generate shared objects directly from archives.
  242. whole_archive_flag_spec="\$wl--whole-archive\$convenience \$wl--no-whole-archive"
  243. # Whether the compiler copes with passing no objects directly.
  244. compiler_needs_object="no"
  245. # Create an old-style archive from a shared archive.
  246. old_archive_from_new_cmds=""
  247. # Create a temporary old-style archive to link instead of a shared archive.
  248. old_archive_from_expsyms_cmds=""
  249. # Commands used to build a shared archive.
  250. archive_cmds="\$CC -shared \$pic_flag \$libobjs \$deplibs \$compiler_flags \$wl-soname \$wl\$soname -o \$lib"
  251. archive_expsym_cmds="echo \\\"{ global:\\\" > \$output_objdir/\$libname.ver~
  252. cat \$export_symbols | sed -e \\\"s/\\\\(.*\\\\)/\\\\1;/\\\" >> \$output_objdir/\$libname.ver~
  253. echo \\\"local: *; };\\\" >> \$output_objdir/\$libname.ver~
  254. \$CC -shared \$pic_flag \$libobjs \$deplibs \$compiler_flags \$wl-soname \$wl\$soname \$wl-version-script \$wl\$output_objdir/\$libname.ver -o \$lib"
  255. # Commands used to build a loadable module if different from building
  256. # a shared archive.
  257. module_cmds=""
  258. module_expsym_cmds=""
  259. # Whether we are building with GNU ld or not.
  260. with_gnu_ld="yes"
  261. # Flag that allows shared libraries with undefined symbols to be built.
  262. allow_undefined_flag=""
  263. # Flag that enforces no undefined symbols.
  264. no_undefined_flag=""
  265. # Flag to hardcode $libdir into a binary during linking.
  266. # This must work even if $libdir does not exist
  267. hardcode_libdir_flag_spec="\$wl-rpath \$wl\$libdir"
  268. # Whether we need a single "-rpath" flag with a separated argument.
  269. hardcode_libdir_separator=""
  270. # Set to "yes" if using DIR/libNAME$shared_ext during linking hardcodes
  271. # DIR into the resulting binary.
  272. hardcode_direct=no
  273. # Set to "yes" if using DIR/libNAME$shared_ext during linking hardcodes
  274. # DIR into the resulting binary and the resulting library dependency is
  275. # "absolute",i.e impossible to change by setting $shlibpath_var if the
  276. # library is relocated.
  277. hardcode_direct_absolute=no
  278. # Set to "yes" if using the -LDIR flag during linking hardcodes DIR
  279. # into the resulting binary.
  280. hardcode_minus_L=no
  281. # Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR
  282. # into the resulting binary.
  283. hardcode_shlibpath_var=unsupported
  284. # Set to "yes" if building a shared library automatically hardcodes DIR
  285. # into the library and all subsequent libraries and executables linked
  286. # against it.
  287. hardcode_automatic=no
  288. # Set to yes if linker adds runtime paths of dependent libraries
  289. # to runtime path list.
  290. inherit_rpath=no
  291. # Whether libtool must link a program against all its dependency libraries.
  292. link_all_deplibs=no
  293. # Set to "yes" if exported symbols are required.
  294. always_export_symbols=no
  295. # The commands to list exported symbols.
  296. export_symbols_cmds="\$NM \$libobjs \$convenience | \$global_symbol_pipe | \$SED 's/.* //' | sort | uniq > \$export_symbols"
  297. # Symbols that should not be listed in the preloaded symbols.
  298. exclude_expsyms="_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*"
  299. # Symbols that must always be exported.
  300. include_expsyms=""
  301. # Commands necessary for linking programs (against libraries) with templates.
  302. prelink_cmds=""
  303. # Commands necessary for finishing linking programs.
  304. postlink_cmds=""
  305. # Specify filename containing input files.
  306. file_list_spec=""
  307. # How to hardcode a shared library path into an executable.
  308. hardcode_action=immediate
  309. # ### END LIBTOOL CONFIG
  310. # ### BEGIN FUNCTIONS SHARED WITH CONFIGURE
  311. # func_munge_path_list VARIABLE PATH
  312. # -----------------------------------
  313. # VARIABLE is name of variable containing _space_ separated list of
  314. # directories to be munged by the contents of PATH, which is string
  315. # having a format:
  316. # "DIR[:DIR]:"
  317. # string "DIR[ DIR]" will be prepended to VARIABLE
  318. # ":DIR[:DIR]"
  319. # string "DIR[ DIR]" will be appended to VARIABLE
  320. # "DIRP[:DIRP]::[DIRA:]DIRA"
  321. # string "DIRP[ DIRP]" will be prepended to VARIABLE and string
  322. # "DIRA[ DIRA]" will be appended to VARIABLE
  323. # "DIR[:DIR]"
  324. # VARIABLE will be replaced by "DIR[ DIR]"
  325. func_munge_path_list ()
  326. {
  327. case x$2 in
  328. x)
  329. ;;
  330. *:)
  331. eval $1=\"`$ECHO $2 | $SED 's/:/ /g'` \$$1\"
  332. ;;
  333. x:*)
  334. eval $1=\"\$$1 `$ECHO $2 | $SED 's/:/ /g'`\"
  335. ;;
  336. *::*)
  337. eval $1=\"\$$1\ `$ECHO $2 | $SED -e 's/.*:://' -e 's/:/ /g'`\"
  338. eval $1=\"`$ECHO $2 | $SED -e 's/::.*//' -e 's/:/ /g'`\ \$$1\"
  339. ;;
  340. *)
  341. eval $1=\"`$ECHO $2 | $SED 's/:/ /g'`\"
  342. ;;
  343. esac
  344. }
  345. # Calculate cc_basename. Skip known compiler wrappers and cross-prefix.
  346. func_cc_basename ()
  347. {
  348. for cc_temp in $*""; do
  349. case $cc_temp in
  350. compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
  351. distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
  352. \-*) ;;
  353. *) break;;
  354. esac
  355. done
  356. func_cc_basename_result=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"`
  357. }
  358. # ### END FUNCTIONS SHARED WITH CONFIGURE
  359. #! /bin/sh
  360. ## DO NOT EDIT - This file generated from ./build-aux/ltmain.in
  361. ## by inline-source v2014-01-03.01
  362. # libtool (GNU libtool) 2.4.6
  363. # Provide generalized library-building support services.
  364. # Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
  365. # Copyright (C) 1996-2015 Free Software Foundation, Inc.
  366. # This is free software; see the source for copying conditions. There is NO
  367. # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  368. # GNU Libtool is free software; you can redistribute it and/or modify
  369. # it under the terms of the GNU General Public License as published by
  370. # the Free Software Foundation; either version 2 of the License, or
  371. # (at your option) any later version.
  372. #
  373. # As a special exception to the GNU General Public License,
  374. # if you distribute this file as part of a program or library that
  375. # is built using GNU Libtool, you may include this file under the
  376. # same distribution terms that you use for the rest of that program.
  377. #
  378. # GNU Libtool is distributed in the hope that it will be useful, but
  379. # WITHOUT ANY WARRANTY; without even the implied warranty of
  380. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  381. # General Public License for more details.
  382. #
  383. # You should have received a copy of the GNU General Public License
  384. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  385. PROGRAM=libtool
  386. PACKAGE=libtool
  387. VERSION="2.4.6 Debian-2.4.6-2.1"
  388. package_revision=2.4.6
  389. ## ------ ##
  390. ## Usage. ##
  391. ## ------ ##
  392. # Run './libtool --help' for help with using this script from the
  393. # command line.
  394. ## ------------------------------- ##
  395. ## User overridable command paths. ##
  396. ## ------------------------------- ##
  397. # After configure completes, it has a better idea of some of the
  398. # shell tools we need than the defaults used by the functions shared
  399. # with bootstrap, so set those here where they can still be over-
  400. # ridden by the user, but otherwise take precedence.
  401. : ${AUTOCONF="autoconf"}
  402. : ${AUTOMAKE="automake"}
  403. ## -------------------------- ##
  404. ## Source external libraries. ##
  405. ## -------------------------- ##
  406. # Much of our low-level functionality needs to be sourced from external
  407. # libraries, which are installed to $pkgauxdir.
  408. # Set a version string for this script.
  409. scriptversion=2015-10-12.13; # UTC
  410. # General shell script boiler plate, and helper functions.
  411. # Written by Gary V. Vaughan, 2004
  412. # Copyright (C) 2004-2015 Free Software Foundation, Inc.
  413. # This is free software; see the source for copying conditions. There is NO
  414. # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  415. # This program is free software; you can redistribute it and/or modify
  416. # it under the terms of the GNU General Public License as published by
  417. # the Free Software Foundation; either version 3 of the License, or
  418. # (at your option) any later version.
  419. # As a special exception to the GNU General Public License, if you distribute
  420. # this file as part of a program or library that is built using GNU Libtool,
  421. # you may include this file under the same distribution terms that you use
  422. # for the rest of that program.
  423. # This program is distributed in the hope that it will be useful,
  424. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  425. # MERCHANTABILITY or FITNES FOR A PARTICULAR PURPOSE. See the GNU
  426. # General Public License for more details.
  427. # You should have received a copy of the GNU General Public License
  428. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  429. # Please report bugs or propose patches to gary@gnu.org.
  430. ## ------ ##
  431. ## Usage. ##
  432. ## ------ ##
  433. # Evaluate this file near the top of your script to gain access to
  434. # the functions and variables defined here:
  435. #
  436. # . `echo "$0" | ${SED-sed} 's|[^/]*$||'`/build-aux/funclib.sh
  437. #
  438. # If you need to override any of the default environment variable
  439. # settings, do that before evaluating this file.
  440. ## -------------------- ##
  441. ## Shell normalisation. ##
  442. ## -------------------- ##
  443. # Some shells need a little help to be as Bourne compatible as possible.
  444. # Before doing anything else, make sure all that help has been provided!
  445. DUALCASE=1; export DUALCASE # for MKS sh
  446. if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then :
  447. emulate sh
  448. NULLCMD=:
  449. # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
  450. # is contrary to our usage. Disable this feature.
  451. alias -g '${1+"$@"}'='"$@"'
  452. setopt NO_GLOB_SUBST
  453. else
  454. case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac
  455. fi
  456. # NLS nuisances: We save the old values in case they are required later.
  457. _G_user_locale=
  458. _G_safe_locale=
  459. for _G_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
  460. do
  461. eval "if test set = \"\${$_G_var+set}\"; then
  462. save_$_G_var=\$$_G_var
  463. $_G_var=C
  464. export $_G_var
  465. _G_user_locale=\"$_G_var=\\\$save_\$_G_var; \$_G_user_locale\"
  466. _G_safe_locale=\"$_G_var=C; \$_G_safe_locale\"
  467. fi"
  468. done
  469. # CDPATH.
  470. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
  471. # Make sure IFS has a sensible default
  472. sp=' '
  473. nl='
  474. '
  475. IFS="$sp $nl"
  476. # There are apparently some retarded systems that use ';' as a PATH separator!
  477. if test "${PATH_SEPARATOR+set}" != set; then
  478. PATH_SEPARATOR=:
  479. (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
  480. (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
  481. PATH_SEPARATOR=';'
  482. }
  483. fi
  484. ## ------------------------- ##
  485. ## Locate command utilities. ##
  486. ## ------------------------- ##
  487. # func_executable_p FILE
  488. # ----------------------
  489. # Check that FILE is an executable regular file.
  490. func_executable_p ()
  491. {
  492. test -f "$1" && test -x "$1"
  493. }
  494. # func_path_progs PROGS_LIST CHECK_FUNC [PATH]
  495. # --------------------------------------------
  496. # Search for either a program that responds to --version with output
  497. # containing "GNU", or else returned by CHECK_FUNC otherwise, by
  498. # trying all the directories in PATH with each of the elements of
  499. # PROGS_LIST.
  500. #
  501. # CHECK_FUNC should accept the path to a candidate program, and
  502. # set $func_check_prog_result if it truncates its output less than
  503. # $_G_path_prog_max characters.
  504. func_path_progs ()
  505. {
  506. _G_progs_list=$1
  507. _G_check_func=$2
  508. _G_PATH=${3-"$PATH"}
  509. _G_path_prog_max=0
  510. _G_path_prog_found=false
  511. _G_save_IFS=$IFS; IFS=${PATH_SEPARATOR-:}
  512. for _G_dir in $_G_PATH; do
  513. IFS=$_G_save_IFS
  514. test -z "$_G_dir" && _G_dir=.
  515. for _G_prog_name in $_G_progs_list; do
  516. for _exeext in '' .EXE; do
  517. _G_path_prog=$_G_dir/$_G_prog_name$_exeext
  518. func_executable_p "$_G_path_prog" || continue
  519. case `"$_G_path_prog" --version 2>&1` in
  520. *GNU*) func_path_progs_result=$_G_path_prog _G_path_prog_found=: ;;
  521. *) $_G_check_func $_G_path_prog
  522. func_path_progs_result=$func_check_prog_result
  523. ;;
  524. esac
  525. $_G_path_prog_found && break 3
  526. done
  527. done
  528. done
  529. IFS=$_G_save_IFS
  530. test -z "$func_path_progs_result" && {
  531. echo "no acceptable sed could be found in \$PATH" >&2
  532. exit 1
  533. }
  534. }
  535. # We want to be able to use the functions in this file before configure
  536. # has figured out where the best binaries are kept, which means we have
  537. # to search for them ourselves - except when the results are already set
  538. # where we skip the searches.
  539. # Unless the user overrides by setting SED, search the path for either GNU
  540. # sed, or the sed that truncates its output the least.
  541. test -z "$SED" && {
  542. _G_sed_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/
  543. for _G_i in 1 2 3 4 5 6 7; do
  544. _G_sed_script=$_G_sed_script$nl$_G_sed_script
  545. done
  546. echo "$_G_sed_script" 2>/dev/null | sed 99q >conftest.sed
  547. _G_sed_script=
  548. func_check_prog_sed ()
  549. {
  550. _G_path_prog=$1
  551. _G_count=0
  552. printf 0123456789 >conftest.in
  553. while :
  554. do
  555. cat conftest.in conftest.in >conftest.tmp
  556. mv conftest.tmp conftest.in
  557. cp conftest.in conftest.nl
  558. echo '' >> conftest.nl
  559. "$_G_path_prog" -f conftest.sed <conftest.nl >conftest.out 2>/dev/null || break
  560. diff conftest.out conftest.nl >/dev/null 2>&1 || break
  561. _G_count=`expr $_G_count + 1`
  562. if test "$_G_count" -gt "$_G_path_prog_max"; then
  563. # Best one so far, save it but keep looking for a better one
  564. func_check_prog_result=$_G_path_prog
  565. _G_path_prog_max=$_G_count
  566. fi
  567. # 10*(2^10) chars as input seems more than enough
  568. test 10 -lt "$_G_count" && break
  569. done
  570. rm -f conftest.in conftest.tmp conftest.nl conftest.out
  571. }
  572. func_path_progs "sed gsed" func_check_prog_sed $PATH:/usr/xpg4/bin
  573. rm -f conftest.sed
  574. SED=$func_path_progs_result
  575. }
  576. # Unless the user overrides by setting GREP, search the path for either GNU
  577. # grep, or the grep that truncates its output the least.
  578. test -z "$GREP" && {
  579. func_check_prog_grep ()
  580. {
  581. _G_path_prog=$1
  582. _G_count=0
  583. _G_path_prog_max=0
  584. printf 0123456789 >conftest.in
  585. while :
  586. do
  587. cat conftest.in conftest.in >conftest.tmp
  588. mv conftest.tmp conftest.in
  589. cp conftest.in conftest.nl
  590. echo 'GREP' >> conftest.nl
  591. "$_G_path_prog" -e 'GREP$' -e '-(cannot match)-' <conftest.nl >conftest.out 2>/dev/null || break
  592. diff conftest.out conftest.nl >/dev/null 2>&1 || break
  593. _G_count=`expr $_G_count + 1`
  594. if test "$_G_count" -gt "$_G_path_prog_max"; then
  595. # Best one so far, save it but keep looking for a better one
  596. func_check_prog_result=$_G_path_prog
  597. _G_path_prog_max=$_G_count
  598. fi
  599. # 10*(2^10) chars as input seems more than enough
  600. test 10 -lt "$_G_count" && break
  601. done
  602. rm -f conftest.in conftest.tmp conftest.nl conftest.out
  603. }
  604. func_path_progs "grep ggrep" func_check_prog_grep $PATH:/usr/xpg4/bin
  605. GREP=$func_path_progs_result
  606. }
  607. ## ------------------------------- ##
  608. ## User overridable command paths. ##
  609. ## ------------------------------- ##
  610. # All uppercase variable names are used for environment variables. These
  611. # variables can be overridden by the user before calling a script that
  612. # uses them if a suitable command of that name is not already available
  613. # in the command search PATH.
  614. : ${CP="cp -f"}
  615. : ${ECHO="printf %s\n"}
  616. : ${EGREP="$GREP -E"}
  617. : ${FGREP="$GREP -F"}
  618. : ${LN_S="ln -s"}
  619. : ${MAKE="make"}
  620. : ${MKDIR="mkdir"}
  621. : ${MV="mv -f"}
  622. : ${RM="rm -f"}
  623. : ${SHELL="${CONFIG_SHELL-/bin/sh}"}
  624. ## -------------------- ##
  625. ## Useful sed snippets. ##
  626. ## -------------------- ##
  627. sed_dirname='s|/[^/]*$||'
  628. sed_basename='s|^.*/||'
  629. # Sed substitution that helps us do robust quoting. It backslashifies
  630. # metacharacters that are still active within double-quoted strings.
  631. sed_quote_subst='s|\([`"$\\]\)|\\\1|g'
  632. # Same as above, but do not quote variable references.
  633. sed_double_quote_subst='s/\(["`\\]\)/\\\1/g'
  634. # Sed substitution that turns a string into a regex matching for the
  635. # string literally.
  636. sed_make_literal_regex='s|[].[^$\\*\/]|\\&|g'
  637. # Sed substitution that converts a w32 file name or path
  638. # that contains forward slashes, into one that contains
  639. # (escaped) backslashes. A very naive implementation.
  640. sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
  641. # Re-'\' parameter expansions in output of sed_double_quote_subst that
  642. # were '\'-ed in input to the same. If an odd number of '\' preceded a
  643. # '$' in input to sed_double_quote_subst, that '$' was protected from
  644. # expansion. Since each input '\' is now two '\'s, look for any number
  645. # of runs of four '\'s followed by two '\'s and then a '$'. '\' that '$'.
  646. _G_bs='\\'
  647. _G_bs2='\\\\'
  648. _G_bs4='\\\\\\\\'
  649. _G_dollar='\$'
  650. sed_double_backslash="\
  651. s/$_G_bs4/&\\
  652. /g
  653. s/^$_G_bs2$_G_dollar/$_G_bs&/
  654. s/\\([^$_G_bs]\\)$_G_bs2$_G_dollar/\\1$_G_bs2$_G_bs$_G_dollar/g
  655. s/\n//g"
  656. ## ----------------- ##
  657. ## Global variables. ##
  658. ## ----------------- ##
  659. # Except for the global variables explicitly listed below, the following
  660. # functions in the '^func_' namespace, and the '^require_' namespace
  661. # variables initialised in the 'Resource management' section, sourcing
  662. # this file will not pollute your global namespace with anything
  663. # else. There's no portable way to scope variables in Bourne shell
  664. # though, so actually running these functions will sometimes place
  665. # results into a variable named after the function, and often use
  666. # temporary variables in the '^_G_' namespace. If you are careful to
  667. # avoid using those namespaces casually in your sourcing script, things
  668. # should continue to work as you expect. And, of course, you can freely
  669. # overwrite any of the functions or variables defined here before
  670. # calling anything to customize them.
  671. EXIT_SUCCESS=0
  672. EXIT_FAILURE=1
  673. EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing.
  674. EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake.
  675. # Allow overriding, eg assuming that you follow the convention of
  676. # putting '$debug_cmd' at the start of all your functions, you can get
  677. # bash to show function call trace with:
  678. #
  679. # debug_cmd='eval echo "${FUNCNAME[0]} $*" >&2' bash your-script-name
  680. debug_cmd=${debug_cmd-":"}
  681. exit_cmd=:
  682. # By convention, finish your script with:
  683. #
  684. # exit $exit_status
  685. #
  686. # so that you can set exit_status to non-zero if you want to indicate
  687. # something went wrong during execution without actually bailing out at
  688. # the point of failure.
  689. exit_status=$EXIT_SUCCESS
  690. # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
  691. # is ksh but when the shell is invoked as "sh" and the current value of
  692. # the _XPG environment variable is not equal to 1 (one), the special
  693. # positional parameter $0, within a function call, is the name of the
  694. # function.
  695. progpath=$0
  696. # The name of this program.
  697. progname=`$ECHO "$progpath" |$SED "$sed_basename"`
  698. # Make sure we have an absolute progpath for reexecution:
  699. case $progpath in
  700. [\\/]*|[A-Za-z]:\\*) ;;
  701. *[\\/]*)
  702. progdir=`$ECHO "$progpath" |$SED "$sed_dirname"`
  703. progdir=`cd "$progdir" && pwd`
  704. progpath=$progdir/$progname
  705. ;;
  706. *)
  707. _G_IFS=$IFS
  708. IFS=${PATH_SEPARATOR-:}
  709. for progdir in $PATH; do
  710. IFS=$_G_IFS
  711. test -x "$progdir/$progname" && break
  712. done
  713. IFS=$_G_IFS
  714. test -n "$progdir" || progdir=`pwd`
  715. progpath=$progdir/$progname
  716. ;;
  717. esac
  718. ## ----------------- ##
  719. ## Standard options. ##
  720. ## ----------------- ##
  721. # The following options affect the operation of the functions defined
  722. # below, and should be set appropriately depending on run-time para-
  723. # meters passed on the command line.
  724. opt_dry_run=false
  725. opt_quiet=false
  726. opt_verbose=false
  727. # Categories 'all' and 'none' are always available. Append any others
  728. # you will pass as the first argument to func_warning from your own
  729. # code.
  730. warning_categories=
  731. # By default, display warnings according to 'opt_warning_types'. Set
  732. # 'warning_func' to ':' to elide all warnings, or func_fatal_error to
  733. # treat the next displayed warning as a fatal error.
  734. warning_func=func_warn_and_continue
  735. # Set to 'all' to display all warnings, 'none' to suppress all
  736. # warnings, or a space delimited list of some subset of
  737. # 'warning_categories' to display only the listed warnings.
  738. opt_warning_types=all
  739. ## -------------------- ##
  740. ## Resource management. ##
  741. ## -------------------- ##
  742. # This section contains definitions for functions that each ensure a
  743. # particular resource (a file, or a non-empty configuration variable for
  744. # example) is available, and if appropriate to extract default values
  745. # from pertinent package files. Call them using their associated
  746. # 'require_*' variable to ensure that they are executed, at most, once.
  747. #
  748. # It's entirely deliberate that calling these functions can set
  749. # variables that don't obey the namespace limitations obeyed by the rest
  750. # of this file, in order that that they be as useful as possible to
  751. # callers.
  752. # require_term_colors
  753. # -------------------
  754. # Allow display of bold text on terminals that support it.
  755. require_term_colors=func_require_term_colors
  756. func_require_term_colors ()
  757. {
  758. $debug_cmd
  759. test -t 1 && {
  760. # COLORTERM and USE_ANSI_COLORS environment variables take
  761. # precedence, because most terminfo databases neglect to describe
  762. # whether color sequences are supported.
  763. test -n "${COLORTERM+set}" && : ${USE_ANSI_COLORS="1"}
  764. if test 1 = "$USE_ANSI_COLORS"; then
  765. # Standard ANSI escape sequences
  766. tc_reset=''
  767. tc_bold=''; tc_standout=''
  768. tc_red=''; tc_green=''
  769. tc_blue=''; tc_cyan=''
  770. else
  771. # Otherwise trust the terminfo database after all.
  772. test -n "`tput sgr0 2>/dev/null`" && {
  773. tc_reset=`tput sgr0`
  774. test -n "`tput bold 2>/dev/null`" && tc_bold=`tput bold`
  775. tc_standout=$tc_bold
  776. test -n "`tput smso 2>/dev/null`" && tc_standout=`tput smso`
  777. test -n "`tput setaf 1 2>/dev/null`" && tc_red=`tput setaf 1`
  778. test -n "`tput setaf 2 2>/dev/null`" && tc_green=`tput setaf 2`
  779. test -n "`tput setaf 4 2>/dev/null`" && tc_blue=`tput setaf 4`
  780. test -n "`tput setaf 5 2>/dev/null`" && tc_cyan=`tput setaf 5`
  781. }
  782. fi
  783. }
  784. require_term_colors=:
  785. }
  786. ## ----------------- ##
  787. ## Function library. ##
  788. ## ----------------- ##
  789. # This section contains a variety of useful functions to call in your
  790. # scripts. Take note of the portable wrappers for features provided by
  791. # some modern shells, which will fall back to slower equivalents on
  792. # less featureful shells.
  793. # func_append VAR VALUE
  794. # ---------------------
  795. # Append VALUE onto the existing contents of VAR.
  796. # We should try to minimise forks, especially on Windows where they are
  797. # unreasonably slow, so skip the feature probes when bash or zsh are
  798. # being used:
  799. if test set = "${BASH_VERSION+set}${ZSH_VERSION+set}"; then
  800. : ${_G_HAVE_ARITH_OP="yes"}
  801. : ${_G_HAVE_XSI_OPS="yes"}
  802. # The += operator was introduced in bash 3.1
  803. case $BASH_VERSION in
  804. [12].* | 3.0 | 3.0*) ;;
  805. *)
  806. : ${_G_HAVE_PLUSEQ_OP="yes"}
  807. ;;
  808. esac
  809. fi
  810. # _G_HAVE_PLUSEQ_OP
  811. # Can be empty, in which case the shell is probed, "yes" if += is
  812. # useable or anything else if it does not work.
  813. test -z "$_G_HAVE_PLUSEQ_OP" \
  814. && (eval 'x=a; x+=" b"; test "a b" = "$x"') 2>/dev/null \
  815. && _G_HAVE_PLUSEQ_OP=yes
  816. if test yes = "$_G_HAVE_PLUSEQ_OP"
  817. then
  818. # This is an XSI compatible shell, allowing a faster implementation...
  819. eval 'func_append ()
  820. {
  821. $debug_cmd
  822. eval "$1+=\$2"
  823. }'
  824. else
  825. # ...otherwise fall back to using expr, which is often a shell builtin.
  826. func_append ()
  827. {
  828. $debug_cmd
  829. eval "$1=\$$1\$2"
  830. }
  831. fi
  832. # func_append_quoted VAR VALUE
  833. # ----------------------------
  834. # Quote VALUE and append to the end of shell variable VAR, separated
  835. # by a space.
  836. if test yes = "$_G_HAVE_PLUSEQ_OP"; then
  837. eval 'func_append_quoted ()
  838. {
  839. $debug_cmd
  840. func_quote_arg pretty "$2"
  841. eval "$1+=\\ \$func_quote_arg_result"
  842. }'
  843. else
  844. func_append_quoted ()
  845. {
  846. $debug_cmd
  847. func_quote_arg pretty "$2"
  848. eval "$1=\$$1\\ \$func_quote_arg_result"
  849. }
  850. fi
  851. # func_append_uniq VAR VALUE
  852. # --------------------------
  853. # Append unique VALUE onto the existing contents of VAR, assuming
  854. # entries are delimited by the first character of VALUE. For example:
  855. #
  856. # func_append_uniq options " --another-option option-argument"
  857. #
  858. # will only append to $options if " --another-option option-argument "
  859. # is not already present somewhere in $options already (note spaces at
  860. # each end implied by leading space in second argument).
  861. func_append_uniq ()
  862. {
  863. $debug_cmd
  864. eval _G_current_value='`$ECHO $'$1'`'
  865. _G_delim=`expr "$2" : '\(.\)'`
  866. case $_G_delim$_G_current_value$_G_delim in
  867. *"$2$_G_delim"*) ;;
  868. *) func_append "$@" ;;
  869. esac
  870. }
  871. # func_arith TERM...
  872. # ------------------
  873. # Set func_arith_result to the result of evaluating TERMs.
  874. test -z "$_G_HAVE_ARITH_OP" \
  875. && (eval 'test 2 = $(( 1 + 1 ))') 2>/dev/null \
  876. && _G_HAVE_ARITH_OP=yes
  877. if test yes = "$_G_HAVE_ARITH_OP"; then
  878. eval 'func_arith ()
  879. {
  880. $debug_cmd
  881. func_arith_result=$(( $* ))
  882. }'
  883. else
  884. func_arith ()
  885. {
  886. $debug_cmd
  887. func_arith_result=`expr "$@"`
  888. }
  889. fi
  890. # func_basename FILE
  891. # ------------------
  892. # Set func_basename_result to FILE with everything up to and including
  893. # the last / stripped.
  894. if test yes = "$_G_HAVE_XSI_OPS"; then
  895. # If this shell supports suffix pattern removal, then use it to avoid
  896. # forking. Hide the definitions single quotes in case the shell chokes
  897. # on unsupported syntax...
  898. _b='func_basename_result=${1##*/}'
  899. _d='case $1 in
  900. */*) func_dirname_result=${1%/*}$2 ;;
  901. * ) func_dirname_result=$3 ;;
  902. esac'
  903. else
  904. # ...otherwise fall back to using sed.
  905. _b='func_basename_result=`$ECHO "$1" |$SED "$sed_basename"`'
  906. _d='func_dirname_result=`$ECHO "$1" |$SED "$sed_dirname"`
  907. if test "X$func_dirname_result" = "X$1"; then
  908. func_dirname_result=$3
  909. else
  910. func_append func_dirname_result "$2"
  911. fi'
  912. fi
  913. eval 'func_basename ()
  914. {
  915. $debug_cmd
  916. '"$_b"'
  917. }'
  918. # func_dirname FILE APPEND NONDIR_REPLACEMENT
  919. # -------------------------------------------
  920. # Compute the dirname of FILE. If nonempty, add APPEND to the result,
  921. # otherwise set result to NONDIR_REPLACEMENT.
  922. eval 'func_dirname ()
  923. {
  924. $debug_cmd
  925. '"$_d"'
  926. }'
  927. # func_dirname_and_basename FILE APPEND NONDIR_REPLACEMENT
  928. # --------------------------------------------------------
  929. # Perform func_basename and func_dirname in a single function
  930. # call:
  931. # dirname: Compute the dirname of FILE. If nonempty,
  932. # add APPEND to the result, otherwise set result
  933. # to NONDIR_REPLACEMENT.
  934. # value returned in "$func_dirname_result"
  935. # basename: Compute filename of FILE.
  936. # value retuned in "$func_basename_result"
  937. # For efficiency, we do not delegate to the functions above but instead
  938. # duplicate the functionality here.
  939. eval 'func_dirname_and_basename ()
  940. {
  941. $debug_cmd
  942. '"$_b"'
  943. '"$_d"'
  944. }'
  945. # func_echo ARG...
  946. # ----------------
  947. # Echo program name prefixed message.
  948. func_echo ()
  949. {
  950. $debug_cmd
  951. _G_message=$*
  952. func_echo_IFS=$IFS
  953. IFS=$nl
  954. for _G_line in $_G_message; do
  955. IFS=$func_echo_IFS
  956. $ECHO "$progname: $_G_line"
  957. done
  958. IFS=$func_echo_IFS
  959. }
  960. # func_echo_all ARG...
  961. # --------------------
  962. # Invoke $ECHO with all args, space-separated.
  963. func_echo_all ()
  964. {
  965. $ECHO "$*"
  966. }
  967. # func_echo_infix_1 INFIX ARG...
  968. # ------------------------------
  969. # Echo program name, followed by INFIX on the first line, with any
  970. # additional lines not showing INFIX.
  971. func_echo_infix_1 ()
  972. {
  973. $debug_cmd
  974. $require_term_colors
  975. _G_infix=$1; shift
  976. _G_indent=$_G_infix
  977. _G_prefix="$progname: $_G_infix: "
  978. _G_message=$*
  979. # Strip color escape sequences before counting printable length
  980. for _G_tc in "$tc_reset" "$tc_bold" "$tc_standout" "$tc_red" "$tc_green" "$tc_blue" "$tc_cyan"
  981. do
  982. test -n "$_G_tc" && {
  983. _G_esc_tc=`$ECHO "$_G_tc" | $SED "$sed_make_literal_regex"`
  984. _G_indent=`$ECHO "$_G_indent" | $SED "s|$_G_esc_tc||g"`
  985. }
  986. done
  987. _G_indent="$progname: "`echo "$_G_indent" | $SED 's|.| |g'`" " ## exclude from sc_prohibit_nested_quotes
  988. func_echo_infix_1_IFS=$IFS
  989. IFS=$nl
  990. for _G_line in $_G_message; do
  991. IFS=$func_echo_infix_1_IFS
  992. $ECHO "$_G_prefix$tc_bold$_G_line$tc_reset" >&2
  993. _G_prefix=$_G_indent
  994. done
  995. IFS=$func_echo_infix_1_IFS
  996. }
  997. # func_error ARG...
  998. # -----------------
  999. # Echo program name prefixed message to standard error.
  1000. func_error ()
  1001. {
  1002. $debug_cmd
  1003. $require_term_colors
  1004. func_echo_infix_1 " $tc_standout${tc_red}error$tc_reset" "$*" >&2
  1005. }
  1006. # func_fatal_error ARG...
  1007. # -----------------------
  1008. # Echo program name prefixed message to standard error, and exit.
  1009. func_fatal_error ()
  1010. {
  1011. $debug_cmd
  1012. func_error "$*"
  1013. exit $EXIT_FAILURE
  1014. }
  1015. # func_grep EXPRESSION FILENAME
  1016. # -----------------------------
  1017. # Check whether EXPRESSION matches any line of FILENAME, without output.
  1018. func_grep ()
  1019. {
  1020. $debug_cmd
  1021. $GREP "$1" "$2" >/dev/null 2>&1
  1022. }
  1023. # func_len STRING
  1024. # ---------------
  1025. # Set func_len_result to the length of STRING. STRING may not
  1026. # start with a hyphen.
  1027. test -z "$_G_HAVE_XSI_OPS" \
  1028. && (eval 'x=a/b/c;
  1029. test 5aa/bb/cc = "${#x}${x%%/*}${x%/*}${x#*/}${x##*/}"') 2>/dev/null \
  1030. && _G_HAVE_XSI_OPS=yes
  1031. if test yes = "$_G_HAVE_XSI_OPS"; then
  1032. eval 'func_len ()
  1033. {
  1034. $debug_cmd
  1035. func_len_result=${#1}
  1036. }'
  1037. else
  1038. func_len ()
  1039. {
  1040. $debug_cmd
  1041. func_len_result=`expr "$1" : ".*" 2>/dev/null || echo $max_cmd_len`
  1042. }
  1043. fi
  1044. # func_mkdir_p DIRECTORY-PATH
  1045. # ---------------------------
  1046. # Make sure the entire path to DIRECTORY-PATH is available.
  1047. func_mkdir_p ()
  1048. {
  1049. $debug_cmd
  1050. _G_directory_path=$1
  1051. _G_dir_list=
  1052. if test -n "$_G_directory_path" && test : != "$opt_dry_run"; then
  1053. # Protect directory names starting with '-'
  1054. case $_G_directory_path in
  1055. -*) _G_directory_path=./$_G_directory_path ;;
  1056. esac
  1057. # While some portion of DIR does not yet exist...
  1058. while test ! -d "$_G_directory_path"; do
  1059. # ...make a list in topmost first order. Use a colon delimited
  1060. # list incase some portion of path contains whitespace.
  1061. _G_dir_list=$_G_directory_path:$_G_dir_list
  1062. # If the last portion added has no slash in it, the list is done
  1063. case $_G_directory_path in */*) ;; *) break ;; esac
  1064. # ...otherwise throw away the child directory and loop
  1065. _G_directory_path=`$ECHO "$_G_directory_path" | $SED -e "$sed_dirname"`
  1066. done
  1067. _G_dir_list=`$ECHO "$_G_dir_list" | $SED 's|:*$||'`
  1068. func_mkdir_p_IFS=$IFS; IFS=:
  1069. for _G_dir in $_G_dir_list; do
  1070. IFS=$func_mkdir_p_IFS
  1071. # mkdir can fail with a 'File exist' error if two processes
  1072. # try to create one of the directories concurrently. Don't
  1073. # stop in that case!
  1074. $MKDIR "$_G_dir" 2>/dev/null || :
  1075. done
  1076. IFS=$func_mkdir_p_IFS
  1077. # Bail out if we (or some other process) failed to create a directory.
  1078. test -d "$_G_directory_path" || \
  1079. func_fatal_error "Failed to create '$1'"
  1080. fi
  1081. }
  1082. # func_mktempdir [BASENAME]
  1083. # -------------------------
  1084. # Make a temporary directory that won't clash with other running
  1085. # libtool processes, and avoids race conditions if possible. If
  1086. # given, BASENAME is the basename for that directory.
  1087. func_mktempdir ()
  1088. {
  1089. $debug_cmd
  1090. _G_template=${TMPDIR-/tmp}/${1-$progname}
  1091. if test : = "$opt_dry_run"; then
  1092. # Return a directory name, but don't create it in dry-run mode
  1093. _G_tmpdir=$_G_template-$$
  1094. else
  1095. # If mktemp works, use that first and foremost
  1096. _G_tmpdir=`mktemp -d "$_G_template-XXXXXXXX" 2>/dev/null`
  1097. if test ! -d "$_G_tmpdir"; then
  1098. # Failing that, at least try and use $RANDOM to avoid a race
  1099. _G_tmpdir=$_G_template-${RANDOM-0}$$
  1100. func_mktempdir_umask=`umask`
  1101. umask 0077
  1102. $MKDIR "$_G_tmpdir"
  1103. umask $func_mktempdir_umask
  1104. fi
  1105. # If we're not in dry-run mode, bomb out on failure
  1106. test -d "$_G_tmpdir" || \
  1107. func_fatal_error "cannot create temporary directory '$_G_tmpdir'"
  1108. fi
  1109. $ECHO "$_G_tmpdir"
  1110. }
  1111. # func_normal_abspath PATH
  1112. # ------------------------
  1113. # Remove doubled-up and trailing slashes, "." path components,
  1114. # and cancel out any ".." path components in PATH after making
  1115. # it an absolute path.
  1116. func_normal_abspath ()
  1117. {
  1118. $debug_cmd
  1119. # These SED scripts presuppose an absolute path with a trailing slash.
  1120. _G_pathcar='s|^/\([^/]*\).*$|\1|'
  1121. _G_pathcdr='s|^/[^/]*||'
  1122. _G_removedotparts=':dotsl
  1123. s|/\./|/|g
  1124. t dotsl
  1125. s|/\.$|/|'
  1126. _G_collapseslashes='s|/\{1,\}|/|g'
  1127. _G_finalslash='s|/*$|/|'
  1128. # Start from root dir and reassemble the path.
  1129. func_normal_abspath_result=
  1130. func_normal_abspath_tpath=$1
  1131. func_normal_abspath_altnamespace=
  1132. case $func_normal_abspath_tpath in
  1133. "")
  1134. # Empty path, that just means $cwd.
  1135. func_stripname '' '/' "`pwd`"
  1136. func_normal_abspath_result=$func_stripname_result
  1137. return
  1138. ;;
  1139. # The next three entries are used to spot a run of precisely
  1140. # two leading slashes without using negated character classes;
  1141. # we take advantage of case's first-match behaviour.
  1142. ///*)
  1143. # Unusual form of absolute path, do nothing.
  1144. ;;
  1145. //*)
  1146. # Not necessarily an ordinary path; POSIX reserves leading '//'
  1147. # and for example Cygwin uses it to access remote file shares
  1148. # over CIFS/SMB, so we conserve a leading double slash if found.
  1149. func_normal_abspath_altnamespace=/
  1150. ;;
  1151. /*)
  1152. # Absolute path, do nothing.
  1153. ;;
  1154. *)
  1155. # Relative path, prepend $cwd.
  1156. func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath
  1157. ;;
  1158. esac
  1159. # Cancel out all the simple stuff to save iterations. We also want
  1160. # the path to end with a slash for ease of parsing, so make sure
  1161. # there is one (and only one) here.
  1162. func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
  1163. -e "$_G_removedotparts" -e "$_G_collapseslashes" -e "$_G_finalslash"`
  1164. while :; do
  1165. # Processed it all yet?
  1166. if test / = "$func_normal_abspath_tpath"; then
  1167. # If we ascended to the root using ".." the result may be empty now.
  1168. if test -z "$func_normal_abspath_result"; then
  1169. func_normal_abspath_result=/
  1170. fi
  1171. break
  1172. fi
  1173. func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \
  1174. -e "$_G_pathcar"`
  1175. func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
  1176. -e "$_G_pathcdr"`
  1177. # Figure out what to do with it
  1178. case $func_normal_abspath_tcomponent in
  1179. "")
  1180. # Trailing empty path component, ignore it.
  1181. ;;
  1182. ..)
  1183. # Parent dir; strip last assembled component from result.
  1184. func_dirname "$func_normal_abspath_result"
  1185. func_normal_abspath_result=$func_dirname_result
  1186. ;;
  1187. *)
  1188. # Actual path component, append it.
  1189. func_append func_normal_abspath_result "/$func_normal_abspath_tcomponent"
  1190. ;;
  1191. esac
  1192. done
  1193. # Restore leading double-slash if one was found on entry.
  1194. func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result
  1195. }
  1196. # func_notquiet ARG...
  1197. # --------------------
  1198. # Echo program name prefixed message only when not in quiet mode.
  1199. func_notquiet ()
  1200. {
  1201. $debug_cmd
  1202. $opt_quiet || func_echo ${1+"$@"}
  1203. # A bug in bash halts the script if the last line of a function
  1204. # fails when set -e is in force, so we need another command to
  1205. # work around that:
  1206. :
  1207. }
  1208. # func_relative_path SRCDIR DSTDIR
  1209. # --------------------------------
  1210. # Set func_relative_path_result to the relative path from SRCDIR to DSTDIR.
  1211. func_relative_path ()
  1212. {
  1213. $debug_cmd
  1214. func_relative_path_result=
  1215. func_normal_abspath "$1"
  1216. func_relative_path_tlibdir=$func_normal_abspath_result
  1217. func_normal_abspath "$2"
  1218. func_relative_path_tbindir=$func_normal_abspath_result
  1219. # Ascend the tree starting from libdir
  1220. while :; do
  1221. # check if we have found a prefix of bindir
  1222. case $func_relative_path_tbindir in
  1223. $func_relative_path_tlibdir)
  1224. # found an exact match
  1225. func_relative_path_tcancelled=
  1226. break
  1227. ;;
  1228. $func_relative_path_tlibdir*)
  1229. # found a matching prefix
  1230. func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir"
  1231. func_relative_path_tcancelled=$func_stripname_result
  1232. if test -z "$func_relative_path_result"; then
  1233. func_relative_path_result=.
  1234. fi
  1235. break
  1236. ;;
  1237. *)
  1238. func_dirname $func_relative_path_tlibdir
  1239. func_relative_path_tlibdir=$func_dirname_result
  1240. if test -z "$func_relative_path_tlibdir"; then
  1241. # Have to descend all the way to the root!
  1242. func_relative_path_result=../$func_relative_path_result
  1243. func_relative_path_tcancelled=$func_relative_path_tbindir
  1244. break
  1245. fi
  1246. func_relative_path_result=../$func_relative_path_result
  1247. ;;
  1248. esac
  1249. done
  1250. # Now calculate path; take care to avoid doubling-up slashes.
  1251. func_stripname '' '/' "$func_relative_path_result"
  1252. func_relative_path_result=$func_stripname_result
  1253. func_stripname '/' '/' "$func_relative_path_tcancelled"
  1254. if test -n "$func_stripname_result"; then
  1255. func_append func_relative_path_result "/$func_stripname_result"
  1256. fi
  1257. # Normalisation. If bindir is libdir, return '.' else relative path.
  1258. if test -n "$func_relative_path_result"; then
  1259. func_stripname './' '' "$func_relative_path_result"
  1260. func_relative_path_result=$func_stripname_result
  1261. fi
  1262. test -n "$func_relative_path_result" || func_relative_path_result=.
  1263. :
  1264. }
  1265. # func_quote_portable EVAL ARG
  1266. # ----------------------------
  1267. # Internal function to portably implement func_quote_arg. Note that we still
  1268. # keep attention to performance here so we as much as possible try to avoid
  1269. # calling sed binary (so far O(N) complexity as long as func_append is O(1)).
  1270. func_quote_portable ()
  1271. {
  1272. $debug_cmd
  1273. func_quote_portable_result=$2
  1274. # one-time-loop (easy break)
  1275. while true
  1276. do
  1277. if $1; then
  1278. func_quote_portable_result=`$ECHO "$2" | $SED \
  1279. -e "$sed_double_quote_subst" -e "$sed_double_backslash"`
  1280. break
  1281. fi
  1282. # Quote for eval.
  1283. case $func_quote_portable_result in
  1284. *[\\\`\"\$]*)
  1285. case $func_quote_portable_result in
  1286. *[\[\*\?]*)
  1287. func_quote_portable_result=`$ECHO "$func_quote_portable_result" | $SED "$sed_quote_subst"`
  1288. break
  1289. ;;
  1290. esac
  1291. func_quote_portable_old_IFS=$IFS
  1292. for _G_char in '\' '`' '"' '$'
  1293. do
  1294. # STATE($1) PREV($2) SEPARATOR($3)
  1295. set start "" ""
  1296. func_quote_portable_result=dummy"$_G_char$func_quote_portable_result$_G_char"dummy
  1297. IFS=$_G_char
  1298. for _G_part in $func_quote_portable_result
  1299. do
  1300. case $1 in
  1301. quote)
  1302. func_append func_quote_portable_result "$3$2"
  1303. set quote "$_G_part" "\\$_G_char"
  1304. ;;
  1305. start)
  1306. set first "" ""
  1307. func_quote_portable_result=
  1308. ;;
  1309. first)
  1310. set quote "$_G_part" ""
  1311. ;;
  1312. esac
  1313. done
  1314. done
  1315. IFS=$func_quote_portable_old_IFS
  1316. ;;
  1317. *) ;;
  1318. esac
  1319. break
  1320. done
  1321. func_quote_portable_unquoted_result=$func_quote_portable_result
  1322. case $func_quote_portable_result in
  1323. # double-quote args containing shell metacharacters to delay
  1324. # word splitting, command substitution and variable expansion
  1325. # for a subsequent eval.
  1326. # many bourne shells cannot handle close brackets correctly
  1327. # in scan sets, so we specify it separately.
  1328. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
  1329. func_quote_portable_result=\"$func_quote_portable_result\"
  1330. ;;
  1331. esac
  1332. }
  1333. # func_quotefast_eval ARG
  1334. # -----------------------
  1335. # Quote one ARG (internal). This is equivalent to 'func_quote_arg eval ARG',
  1336. # but optimized for speed. Result is stored in $func_quotefast_eval.
  1337. if test xyes = `(x=; printf -v x %q yes; echo x"$x") 2>/dev/null`; then
  1338. func_quotefast_eval ()
  1339. {
  1340. printf -v func_quotefast_eval_result %q "$1"
  1341. }
  1342. else
  1343. func_quotefast_eval ()
  1344. {
  1345. func_quote_portable false "$1"
  1346. func_quotefast_eval_result=$func_quote_portable_result
  1347. }
  1348. fi
  1349. # func_quote_arg MODEs ARG
  1350. # ------------------------
  1351. # Quote one ARG to be evaled later. MODEs argument may contain zero ore more
  1352. # specifiers listed below separated by ',' character. This function returns two
  1353. # values:
  1354. # i) func_quote_arg_result
  1355. # double-quoted (when needed), suitable for a subsequent eval
  1356. # ii) func_quote_arg_unquoted_result
  1357. # has all characters that are still active within double
  1358. # quotes backslashified. Available only if 'unquoted' is specified.
  1359. #
  1360. # Available modes:
  1361. # ----------------
  1362. # 'eval' (default)
  1363. # - escape shell special characters
  1364. # 'expand'
  1365. # - the same as 'eval'; but do not quote variable references
  1366. # 'pretty'
  1367. # - request aesthetic output, i.e. '"a b"' instead of 'a\ b'. This might
  1368. # later used in func_quote to get output like: 'echo "a b"' instead of
  1369. # 'echo a\ b'. This is slower than default on some shells.
  1370. # 'unquoted'
  1371. # - produce also $func_quote_arg_unquoted_result which does not contain
  1372. # wrapping double-quotes.
  1373. #
  1374. # Examples for 'func_quote_arg pretty,unquoted string':
  1375. #
  1376. # string | *_result | *_unquoted_result
  1377. # ------------+-----------------------+-------------------
  1378. # " | \" | \"
  1379. # a b | "a b" | a b
  1380. # "a b" | "\"a b\"" | \"a b\"
  1381. # * | "*" | *
  1382. # z="${x-$y}" | "z=\"\${x-\$y}\"" | z=\"\${x-\$y}\"
  1383. #
  1384. # Examples for 'func_quote_arg pretty,unquoted,expand string':
  1385. #
  1386. # string | *_result | *_unquoted_result
  1387. # --------------+---------------------+--------------------
  1388. # z="${x-$y}" | "z=\"${x-$y}\"" | z=\"${x-$y}\"
  1389. func_quote_arg ()
  1390. {
  1391. _G_quote_expand=false
  1392. case ,$1, in
  1393. *,expand,*)
  1394. _G_quote_expand=:
  1395. ;;
  1396. esac
  1397. case ,$1, in
  1398. *,pretty,*|*,expand,*|*,unquoted,*)
  1399. func_quote_portable $_G_quote_expand "$2"
  1400. func_quote_arg_result=$func_quote_portable_result
  1401. func_quote_arg_unquoted_result=$func_quote_portable_unquoted_result
  1402. ;;
  1403. *)
  1404. # Faster quote-for-eval for some shells.
  1405. func_quotefast_eval "$2"
  1406. func_quote_arg_result=$func_quotefast_eval_result
  1407. ;;
  1408. esac
  1409. }
  1410. # func_quote MODEs ARGs...
  1411. # ------------------------
  1412. # Quote all ARGs to be evaled later and join them into single command. See
  1413. # func_quote_arg's description for more info.
  1414. func_quote ()
  1415. {
  1416. $debug_cmd
  1417. _G_func_quote_mode=$1 ; shift
  1418. func_quote_result=
  1419. while test 0 -lt $#; do
  1420. func_quote_arg "$_G_func_quote_mode" "$1"
  1421. if test -n "$func_quote_result"; then
  1422. func_append func_quote_result " $func_quote_arg_result"
  1423. else
  1424. func_append func_quote_result "$func_quote_arg_result"
  1425. fi
  1426. shift
  1427. done
  1428. }
  1429. # func_stripname PREFIX SUFFIX NAME
  1430. # ---------------------------------
  1431. # strip PREFIX and SUFFIX from NAME, and store in func_stripname_result.
  1432. # PREFIX and SUFFIX must not contain globbing or regex special
  1433. # characters, hashes, percent signs, but SUFFIX may contain a leading
  1434. # dot (in which case that matches only a dot).
  1435. if test yes = "$_G_HAVE_XSI_OPS"; then
  1436. eval 'func_stripname ()
  1437. {
  1438. $debug_cmd
  1439. # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are
  1440. # positional parameters, so assign one to ordinary variable first.
  1441. func_stripname_result=$3
  1442. func_stripname_result=${func_stripname_result#"$1"}
  1443. func_stripname_result=${func_stripname_result%"$2"}
  1444. }'
  1445. else
  1446. func_stripname ()
  1447. {
  1448. $debug_cmd
  1449. case $2 in
  1450. .*) func_stripname_result=`$ECHO "$3" | $SED -e "s%^$1%%" -e "s%\\\\$2\$%%"`;;
  1451. *) func_stripname_result=`$ECHO "$3" | $SED -e "s%^$1%%" -e "s%$2\$%%"`;;
  1452. esac
  1453. }
  1454. fi
  1455. # func_show_eval CMD [FAIL_EXP]
  1456. # -----------------------------
  1457. # Unless opt_quiet is true, then output CMD. Then, if opt_dryrun is
  1458. # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
  1459. # is given, then evaluate it.
  1460. func_show_eval ()
  1461. {
  1462. $debug_cmd
  1463. _G_cmd=$1
  1464. _G_fail_exp=${2-':'}
  1465. func_quote_arg pretty,expand "$_G_cmd"
  1466. eval "func_notquiet $func_quote_arg_result"
  1467. $opt_dry_run || {
  1468. eval "$_G_cmd"
  1469. _G_status=$?
  1470. if test 0 -ne "$_G_status"; then
  1471. eval "(exit $_G_status); $_G_fail_exp"
  1472. fi
  1473. }
  1474. }
  1475. # func_show_eval_locale CMD [FAIL_EXP]
  1476. # ------------------------------------
  1477. # Unless opt_quiet is true, then output CMD. Then, if opt_dryrun is
  1478. # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
  1479. # is given, then evaluate it. Use the saved locale for evaluation.
  1480. func_show_eval_locale ()
  1481. {
  1482. $debug_cmd
  1483. _G_cmd=$1
  1484. _G_fail_exp=${2-':'}
  1485. $opt_quiet || {
  1486. func_quote_arg expand,pretty "$_G_cmd"
  1487. eval "func_echo $func_quote_arg_result"
  1488. }
  1489. $opt_dry_run || {
  1490. eval "$_G_user_locale
  1491. $_G_cmd"
  1492. _G_status=$?
  1493. eval "$_G_safe_locale"
  1494. if test 0 -ne "$_G_status"; then
  1495. eval "(exit $_G_status); $_G_fail_exp"
  1496. fi
  1497. }
  1498. }
  1499. # func_tr_sh
  1500. # ----------
  1501. # Turn $1 into a string suitable for a shell variable name.
  1502. # Result is stored in $func_tr_sh_result. All characters
  1503. # not in the set a-zA-Z0-9_ are replaced with '_'. Further,
  1504. # if $1 begins with a digit, a '_' is prepended as well.
  1505. func_tr_sh ()
  1506. {
  1507. $debug_cmd
  1508. case $1 in
  1509. [0-9]* | *[!a-zA-Z0-9_]*)
  1510. func_tr_sh_result=`$ECHO "$1" | $SED -e 's/^\([0-9]\)/_\1/' -e 's/[^a-zA-Z0-9_]/_/g'`
  1511. ;;
  1512. * )
  1513. func_tr_sh_result=$1
  1514. ;;
  1515. esac
  1516. }
  1517. # func_verbose ARG...
  1518. # -------------------
  1519. # Echo program name prefixed message in verbose mode only.
  1520. func_verbose ()
  1521. {
  1522. $debug_cmd
  1523. $opt_verbose && func_echo "$*"
  1524. :
  1525. }
  1526. # func_warn_and_continue ARG...
  1527. # -----------------------------
  1528. # Echo program name prefixed warning message to standard error.
  1529. func_warn_and_continue ()
  1530. {
  1531. $debug_cmd
  1532. $require_term_colors
  1533. func_echo_infix_1 "${tc_red}warning$tc_reset" "$*" >&2
  1534. }
  1535. # func_warning CATEGORY ARG...
  1536. # ----------------------------
  1537. # Echo program name prefixed warning message to standard error. Warning
  1538. # messages can be filtered according to CATEGORY, where this function
  1539. # elides messages where CATEGORY is not listed in the global variable
  1540. # 'opt_warning_types'.
  1541. func_warning ()
  1542. {
  1543. $debug_cmd
  1544. # CATEGORY must be in the warning_categories list!
  1545. case " $warning_categories " in
  1546. *" $1 "*) ;;
  1547. *) func_internal_error "invalid warning category '$1'" ;;
  1548. esac
  1549. _G_category=$1
  1550. shift
  1551. case " $opt_warning_types " in
  1552. *" $_G_category "*) $warning_func ${1+"$@"} ;;
  1553. esac
  1554. }
  1555. # func_sort_ver VER1 VER2
  1556. # -----------------------
  1557. # 'sort -V' is not generally available.
  1558. # Note this deviates from the version comparison in automake
  1559. # in that it treats 1.5 < 1.5.0, and treats 1.4.4a < 1.4-p3a
  1560. # but this should suffice as we won't be specifying old
  1561. # version formats or redundant trailing .0 in bootstrap.conf.
  1562. # If we did want full compatibility then we should probably
  1563. # use m4_version_compare from autoconf.
  1564. func_sort_ver ()
  1565. {
  1566. $debug_cmd
  1567. printf '%s\n%s\n' "$1" "$2" \
  1568. | sort -t. -k 1,1n -k 2,2n -k 3,3n -k 4,4n -k 5,5n -k 6,6n -k 7,7n -k 8,8n -k 9,9n
  1569. }
  1570. # func_lt_ver PREV CURR
  1571. # ---------------------
  1572. # Return true if PREV and CURR are in the correct order according to
  1573. # func_sort_ver, otherwise false. Use it like this:
  1574. #
  1575. # func_lt_ver "$prev_ver" "$proposed_ver" || func_fatal_error "..."
  1576. func_lt_ver ()
  1577. {
  1578. $debug_cmd
  1579. test "x$1" = x`func_sort_ver "$1" "$2" | $SED 1q`
  1580. }
  1581. # Local variables:
  1582. # mode: shell-script
  1583. # sh-indentation: 2
  1584. # eval: (add-hook 'before-save-hook 'time-stamp)
  1585. # time-stamp-pattern: "10/scriptversion=%:y-%02m-%02d.%02H; # UTC"
  1586. # time-stamp-time-zone: "UTC"
  1587. # End:
  1588. #! /bin/sh
  1589. # Set a version string for this script.
  1590. scriptversion=2015-10-12.13; # UTC
  1591. # A portable, pluggable option parser for Bourne shell.
  1592. # Written by Gary V. Vaughan, 2010
  1593. # Copyright (C) 2010-2015 Free Software Foundation, Inc.
  1594. # This is free software; see the source for copying conditions. There is NO
  1595. # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  1596. # This program is free software: you can redistribute it and/or modify
  1597. # it under the terms of the GNU General Public License as published by
  1598. # the Free Software Foundation, either version 3 of the License, or
  1599. # (at your option) any later version.
  1600. # This program is distributed in the hope that it will be useful,
  1601. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  1602. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  1603. # GNU General Public License for more details.
  1604. # You should have received a copy of the GNU General Public License
  1605. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  1606. # Please report bugs or propose patches to gary@gnu.org.
  1607. ## ------ ##
  1608. ## Usage. ##
  1609. ## ------ ##
  1610. # This file is a library for parsing options in your shell scripts along
  1611. # with assorted other useful supporting features that you can make use
  1612. # of too.
  1613. #
  1614. # For the simplest scripts you might need only:
  1615. #
  1616. # #!/bin/sh
  1617. # . relative/path/to/funclib.sh
  1618. # . relative/path/to/options-parser
  1619. # scriptversion=1.0
  1620. # func_options ${1+"$@"}
  1621. # eval set dummy "$func_options_result"; shift
  1622. # ...rest of your script...
  1623. #
  1624. # In order for the '--version' option to work, you will need to have a
  1625. # suitably formatted comment like the one at the top of this file
  1626. # starting with '# Written by ' and ending with '# warranty; '.
  1627. #
  1628. # For '-h' and '--help' to work, you will also need a one line
  1629. # description of your script's purpose in a comment directly above the
  1630. # '# Written by ' line, like the one at the top of this file.
  1631. #
  1632. # The default options also support '--debug', which will turn on shell
  1633. # execution tracing (see the comment above debug_cmd below for another
  1634. # use), and '--verbose' and the func_verbose function to allow your script
  1635. # to display verbose messages only when your user has specified
  1636. # '--verbose'.
  1637. #
  1638. # After sourcing this file, you can plug processing for additional
  1639. # options by amending the variables from the 'Configuration' section
  1640. # below, and following the instructions in the 'Option parsing'
  1641. # section further down.
  1642. ## -------------- ##
  1643. ## Configuration. ##
  1644. ## -------------- ##
  1645. # You should override these variables in your script after sourcing this
  1646. # file so that they reflect the customisations you have added to the
  1647. # option parser.
  1648. # The usage line for option parsing errors and the start of '-h' and
  1649. # '--help' output messages. You can embed shell variables for delayed
  1650. # expansion at the time the message is displayed, but you will need to
  1651. # quote other shell meta-characters carefully to prevent them being
  1652. # expanded when the contents are evaled.
  1653. usage='$progpath [OPTION]...'
  1654. # Short help message in response to '-h' and '--help'. Add to this or
  1655. # override it after sourcing this library to reflect the full set of
  1656. # options your script accepts.
  1657. usage_message="\
  1658. --debug enable verbose shell tracing
  1659. -W, --warnings=CATEGORY
  1660. report the warnings falling in CATEGORY [all]
  1661. -v, --verbose verbosely report processing
  1662. --version print version information and exit
  1663. -h, --help print short or long help message and exit
  1664. "
  1665. # Additional text appended to 'usage_message' in response to '--help'.
  1666. long_help_message="
  1667. Warning categories include:
  1668. 'all' show all warnings
  1669. 'none' turn off all the warnings
  1670. 'error' warnings are treated as fatal errors"
  1671. # Help message printed before fatal option parsing errors.
  1672. fatal_help="Try '\$progname --help' for more information."
  1673. ## ------------------------- ##
  1674. ## Hook function management. ##
  1675. ## ------------------------- ##
  1676. # This section contains functions for adding, removing, and running hooks
  1677. # to the main code. A hook is just a named list of of function, that can
  1678. # be run in order later on.
  1679. # func_hookable FUNC_NAME
  1680. # -----------------------
  1681. # Declare that FUNC_NAME will run hooks added with
  1682. # 'func_add_hook FUNC_NAME ...'.
  1683. func_hookable ()
  1684. {
  1685. $debug_cmd
  1686. func_append hookable_fns " $1"
  1687. }
  1688. # func_add_hook FUNC_NAME HOOK_FUNC
  1689. # ---------------------------------
  1690. # Request that FUNC_NAME call HOOK_FUNC before it returns. FUNC_NAME must
  1691. # first have been declared "hookable" by a call to 'func_hookable'.
  1692. func_add_hook ()
  1693. {
  1694. $debug_cmd
  1695. case " $hookable_fns " in
  1696. *" $1 "*) ;;
  1697. *) func_fatal_error "'$1' does not accept hook functions." ;;
  1698. esac
  1699. eval func_append ${1}_hooks '" $2"'
  1700. }
  1701. # func_remove_hook FUNC_NAME HOOK_FUNC
  1702. # ------------------------------------
  1703. # Remove HOOK_FUNC from the list of functions called by FUNC_NAME.
  1704. func_remove_hook ()
  1705. {
  1706. $debug_cmd
  1707. eval ${1}_hooks='`$ECHO "\$'$1'_hooks" |$SED "s| '$2'||"`'
  1708. }
  1709. # func_run_hooks FUNC_NAME [ARG]...
  1710. # ---------------------------------
  1711. # Run all hook functions registered to FUNC_NAME.
  1712. # It is assumed that the list of hook functions contains nothing more
  1713. # than a whitespace-delimited list of legal shell function names, and
  1714. # no effort is wasted trying to catch shell meta-characters or preserve
  1715. # whitespace.
  1716. func_run_hooks ()
  1717. {
  1718. $debug_cmd
  1719. _G_rc_run_hooks=false
  1720. case " $hookable_fns " in
  1721. *" $1 "*) ;;
  1722. *) func_fatal_error "'$1' does not support hook funcions.n" ;;
  1723. esac
  1724. eval _G_hook_fns=\$$1_hooks; shift
  1725. for _G_hook in $_G_hook_fns; do
  1726. if eval $_G_hook '"$@"'; then
  1727. # store returned options list back into positional
  1728. # parameters for next 'cmd' execution.
  1729. eval _G_hook_result=\$${_G_hook}_result
  1730. eval set dummy "$_G_hook_result"; shift
  1731. _G_rc_run_hooks=:
  1732. fi
  1733. done
  1734. $_G_rc_run_hooks && func_run_hooks_result=$_G_hook_result
  1735. }
  1736. ## --------------- ##
  1737. ## Option parsing. ##
  1738. ## --------------- ##
  1739. # In order to add your own option parsing hooks, you must accept the
  1740. # full positional parameter list in your hook function, you may remove/edit
  1741. # any options that you action, and then pass back the remaining unprocessed
  1742. # options in '<hooked_function_name>_result', escaped suitably for
  1743. # 'eval'. In this case you also must return $EXIT_SUCCESS to let the
  1744. # hook's caller know that it should pay attention to
  1745. # '<hooked_function_name>_result'. Returning $EXIT_FAILURE signalizes that
  1746. # arguments are left untouched by the hook and therefore caller will ignore the
  1747. # result variable.
  1748. #
  1749. # Like this:
  1750. #
  1751. # my_options_prep ()
  1752. # {
  1753. # $debug_cmd
  1754. #
  1755. # # Extend the existing usage message.
  1756. # usage_message=$usage_message'
  1757. # -s, --silent don'\''t print informational messages
  1758. # '
  1759. # # No change in '$@' (ignored completely by this hook). There is
  1760. # # no need to do the equivalent (but slower) action:
  1761. # # func_quote eval ${1+"$@"}
  1762. # # my_options_prep_result=$func_quote_result
  1763. # false
  1764. # }
  1765. # func_add_hook func_options_prep my_options_prep
  1766. #
  1767. #
  1768. # my_silent_option ()
  1769. # {
  1770. # $debug_cmd
  1771. #
  1772. # args_changed=false
  1773. #
  1774. # # Note that for efficiency, we parse as many options as we can
  1775. # # recognise in a loop before passing the remainder back to the
  1776. # # caller on the first unrecognised argument we encounter.
  1777. # while test $# -gt 0; do
  1778. # opt=$1; shift
  1779. # case $opt in
  1780. # --silent|-s) opt_silent=:
  1781. # args_changed=:
  1782. # ;;
  1783. # # Separate non-argument short options:
  1784. # -s*) func_split_short_opt "$_G_opt"
  1785. # set dummy "$func_split_short_opt_name" \
  1786. # "-$func_split_short_opt_arg" ${1+"$@"}
  1787. # shift
  1788. # args_changed=:
  1789. # ;;
  1790. # *) # Make sure the first unrecognised option "$_G_opt"
  1791. # # is added back to "$@", we could need that later
  1792. # # if $args_changed is true.
  1793. # set dummy "$_G_opt" ${1+"$@"}; shift; break ;;
  1794. # esac
  1795. # done
  1796. #
  1797. # if $args_changed; then
  1798. # func_quote eval ${1+"$@"}
  1799. # my_silent_option_result=$func_quote_result
  1800. # fi
  1801. #
  1802. # $args_changed
  1803. # }
  1804. # func_add_hook func_parse_options my_silent_option
  1805. #
  1806. #
  1807. # my_option_validation ()
  1808. # {
  1809. # $debug_cmd
  1810. #
  1811. # $opt_silent && $opt_verbose && func_fatal_help "\
  1812. # '--silent' and '--verbose' options are mutually exclusive."
  1813. #
  1814. # false
  1815. # }
  1816. # func_add_hook func_validate_options my_option_validation
  1817. #
  1818. # You'll also need to manually amend $usage_message to reflect the extra
  1819. # options you parse. It's preferable to append if you can, so that
  1820. # multiple option parsing hooks can be added safely.
  1821. # func_options_finish [ARG]...
  1822. # ----------------------------
  1823. # Finishing the option parse loop (call 'func_options' hooks ATM).
  1824. func_options_finish ()
  1825. {
  1826. $debug_cmd
  1827. _G_func_options_finish_exit=false
  1828. if func_run_hooks func_options ${1+"$@"}; then
  1829. func_options_finish_result=$func_run_hooks_result
  1830. _G_func_options_finish_exit=:
  1831. fi
  1832. $_G_func_options_finish_exit
  1833. }
  1834. # func_options [ARG]...
  1835. # ---------------------
  1836. # All the functions called inside func_options are hookable. See the
  1837. # individual implementations for details.
  1838. func_hookable func_options
  1839. func_options ()
  1840. {
  1841. $debug_cmd
  1842. _G_rc_options=false
  1843. for my_func in options_prep parse_options validate_options options_finish
  1844. do
  1845. if eval func_$my_func '${1+"$@"}'; then
  1846. eval _G_res_var='$'"func_${my_func}_result"
  1847. eval set dummy "$_G_res_var" ; shift
  1848. _G_rc_options=:
  1849. fi
  1850. done
  1851. # Save modified positional parameters for caller. As a top-level
  1852. # options-parser function we always need to set the 'func_options_result'
  1853. # variable (regardless the $_G_rc_options value).
  1854. if $_G_rc_options; then
  1855. func_options_result=$_G_res_var
  1856. else
  1857. func_quote eval ${1+"$@"}
  1858. func_options_result=$func_quote_result
  1859. fi
  1860. $_G_rc_options
  1861. }
  1862. # func_options_prep [ARG]...
  1863. # --------------------------
  1864. # All initialisations required before starting the option parse loop.
  1865. # Note that when calling hook functions, we pass through the list of
  1866. # positional parameters. If a hook function modifies that list, and
  1867. # needs to propagate that back to rest of this script, then the complete
  1868. # modified list must be put in 'func_run_hooks_result' before
  1869. # returning $EXIT_SUCCESS (otherwise $EXIT_FAILURE is returned).
  1870. func_hookable func_options_prep
  1871. func_options_prep ()
  1872. {
  1873. $debug_cmd
  1874. # Option defaults:
  1875. opt_verbose=false
  1876. opt_warning_types=
  1877. _G_rc_options_prep=false
  1878. if func_run_hooks func_options_prep ${1+"$@"}; then
  1879. _G_rc_options_prep=:
  1880. # save modified positional parameters for caller
  1881. func_options_prep_result=$func_run_hooks_result
  1882. fi
  1883. $_G_rc_options_prep
  1884. }
  1885. # func_parse_options [ARG]...
  1886. # ---------------------------
  1887. # The main option parsing loop.
  1888. func_hookable func_parse_options
  1889. func_parse_options ()
  1890. {
  1891. $debug_cmd
  1892. func_parse_options_result=
  1893. _G_rc_parse_options=false
  1894. # this just eases exit handling
  1895. while test $# -gt 0; do
  1896. # Defer to hook functions for initial option parsing, so they
  1897. # get priority in the event of reusing an option name.
  1898. if func_run_hooks func_parse_options ${1+"$@"}; then
  1899. eval set dummy "$func_run_hooks_result"; shift
  1900. _G_rc_parse_options=:
  1901. fi
  1902. # Break out of the loop if we already parsed every option.
  1903. test $# -gt 0 || break
  1904. _G_match_parse_options=:
  1905. _G_opt=$1
  1906. shift
  1907. case $_G_opt in
  1908. --debug|-x) debug_cmd='set -x'
  1909. func_echo "enabling shell trace mode"
  1910. $debug_cmd
  1911. ;;
  1912. --no-warnings|--no-warning|--no-warn)
  1913. set dummy --warnings none ${1+"$@"}
  1914. shift
  1915. ;;
  1916. --warnings|--warning|-W)
  1917. if test $# = 0 && func_missing_arg $_G_opt; then
  1918. _G_rc_parse_options=:
  1919. break
  1920. fi
  1921. case " $warning_categories $1" in
  1922. *" $1 "*)
  1923. # trailing space prevents matching last $1 above
  1924. func_append_uniq opt_warning_types " $1"
  1925. ;;
  1926. *all)
  1927. opt_warning_types=$warning_categories
  1928. ;;
  1929. *none)
  1930. opt_warning_types=none
  1931. warning_func=:
  1932. ;;
  1933. *error)
  1934. opt_warning_types=$warning_categories
  1935. warning_func=func_fatal_error
  1936. ;;
  1937. *)
  1938. func_fatal_error \
  1939. "unsupported warning category: '$1'"
  1940. ;;
  1941. esac
  1942. shift
  1943. ;;
  1944. --verbose|-v) opt_verbose=: ;;
  1945. --version) func_version ;;
  1946. -\?|-h) func_usage ;;
  1947. --help) func_help ;;
  1948. # Separate optargs to long options (plugins may need this):
  1949. --*=*) func_split_equals "$_G_opt"
  1950. set dummy "$func_split_equals_lhs" \
  1951. "$func_split_equals_rhs" ${1+"$@"}
  1952. shift
  1953. ;;
  1954. # Separate optargs to short options:
  1955. -W*)
  1956. func_split_short_opt "$_G_opt"
  1957. set dummy "$func_split_short_opt_name" \
  1958. "$func_split_short_opt_arg" ${1+"$@"}
  1959. shift
  1960. ;;
  1961. # Separate non-argument short options:
  1962. -\?*|-h*|-v*|-x*)
  1963. func_split_short_opt "$_G_opt"
  1964. set dummy "$func_split_short_opt_name" \
  1965. "-$func_split_short_opt_arg" ${1+"$@"}
  1966. shift
  1967. ;;
  1968. --) _G_rc_parse_options=: ; break ;;
  1969. -*) func_fatal_help "unrecognised option: '$_G_opt'" ;;
  1970. *) set dummy "$_G_opt" ${1+"$@"}; shift
  1971. _G_match_parse_options=false
  1972. break
  1973. ;;
  1974. esac
  1975. $_G_match_parse_options && _G_rc_parse_options=:
  1976. done
  1977. if $_G_rc_parse_options; then
  1978. # save modified positional parameters for caller
  1979. func_quote eval ${1+"$@"}
  1980. func_parse_options_result=$func_quote_result
  1981. fi
  1982. $_G_rc_parse_options
  1983. }
  1984. # func_validate_options [ARG]...
  1985. # ------------------------------
  1986. # Perform any sanity checks on option settings and/or unconsumed
  1987. # arguments.
  1988. func_hookable func_validate_options
  1989. func_validate_options ()
  1990. {
  1991. $debug_cmd
  1992. _G_rc_validate_options=false
  1993. # Display all warnings if -W was not given.
  1994. test -n "$opt_warning_types" || opt_warning_types=" $warning_categories"
  1995. if func_run_hooks func_validate_options ${1+"$@"}; then
  1996. # save modified positional parameters for caller
  1997. func_validate_options_result=$func_run_hooks_result
  1998. _G_rc_validate_options=:
  1999. fi
  2000. # Bail if the options were screwed!
  2001. $exit_cmd $EXIT_FAILURE
  2002. $_G_rc_validate_options
  2003. }
  2004. ## ----------------- ##
  2005. ## Helper functions. ##
  2006. ## ----------------- ##
  2007. # This section contains the helper functions used by the rest of the
  2008. # hookable option parser framework in ascii-betical order.
  2009. # func_fatal_help ARG...
  2010. # ----------------------
  2011. # Echo program name prefixed message to standard error, followed by
  2012. # a help hint, and exit.
  2013. func_fatal_help ()
  2014. {
  2015. $debug_cmd
  2016. eval \$ECHO \""Usage: $usage"\"
  2017. eval \$ECHO \""$fatal_help"\"
  2018. func_error ${1+"$@"}
  2019. exit $EXIT_FAILURE
  2020. }
  2021. # func_help
  2022. # ---------
  2023. # Echo long help message to standard output and exit.
  2024. func_help ()
  2025. {
  2026. $debug_cmd
  2027. func_usage_message
  2028. $ECHO "$long_help_message"
  2029. exit 0
  2030. }
  2031. # func_missing_arg ARGNAME
  2032. # ------------------------
  2033. # Echo program name prefixed message to standard error and set global
  2034. # exit_cmd.
  2035. func_missing_arg ()
  2036. {
  2037. $debug_cmd
  2038. func_error "Missing argument for '$1'."
  2039. exit_cmd=exit
  2040. }
  2041. # func_split_equals STRING
  2042. # ------------------------
  2043. # Set func_split_equals_lhs and func_split_equals_rhs shell variables after
  2044. # splitting STRING at the '=' sign.
  2045. test -z "$_G_HAVE_XSI_OPS" \
  2046. && (eval 'x=a/b/c;
  2047. test 5aa/bb/cc = "${#x}${x%%/*}${x%/*}${x#*/}${x##*/}"') 2>/dev/null \
  2048. && _G_HAVE_XSI_OPS=yes
  2049. if test yes = "$_G_HAVE_XSI_OPS"
  2050. then
  2051. # This is an XSI compatible shell, allowing a faster implementation...
  2052. eval 'func_split_equals ()
  2053. {
  2054. $debug_cmd
  2055. func_split_equals_lhs=${1%%=*}
  2056. func_split_equals_rhs=${1#*=}
  2057. test "x$func_split_equals_lhs" = "x$1" \
  2058. && func_split_equals_rhs=
  2059. }'
  2060. else
  2061. # ...otherwise fall back to using expr, which is often a shell builtin.
  2062. func_split_equals ()
  2063. {
  2064. $debug_cmd
  2065. func_split_equals_lhs=`expr "x$1" : 'x\([^=]*\)'`
  2066. func_split_equals_rhs=
  2067. test "x$func_split_equals_lhs" = "x$1" \
  2068. || func_split_equals_rhs=`expr "x$1" : 'x[^=]*=\(.*\)$'`
  2069. }
  2070. fi #func_split_equals
  2071. # func_split_short_opt SHORTOPT
  2072. # -----------------------------
  2073. # Set func_split_short_opt_name and func_split_short_opt_arg shell
  2074. # variables after splitting SHORTOPT after the 2nd character.
  2075. if test yes = "$_G_HAVE_XSI_OPS"
  2076. then
  2077. # This is an XSI compatible shell, allowing a faster implementation...
  2078. eval 'func_split_short_opt ()
  2079. {
  2080. $debug_cmd
  2081. func_split_short_opt_arg=${1#??}
  2082. func_split_short_opt_name=${1%"$func_split_short_opt_arg"}
  2083. }'
  2084. else
  2085. # ...otherwise fall back to using expr, which is often a shell builtin.
  2086. func_split_short_opt ()
  2087. {
  2088. $debug_cmd
  2089. func_split_short_opt_name=`expr "x$1" : 'x-\(.\)'`
  2090. func_split_short_opt_arg=`expr "x$1" : 'x-.\(.*\)$'`
  2091. }
  2092. fi #func_split_short_opt
  2093. # func_usage
  2094. # ----------
  2095. # Echo short help message to standard output and exit.
  2096. func_usage ()
  2097. {
  2098. $debug_cmd
  2099. func_usage_message
  2100. $ECHO "Run '$progname --help |${PAGER-more}' for full usage"
  2101. exit 0
  2102. }
  2103. # func_usage_message
  2104. # ------------------
  2105. # Echo short help message to standard output.
  2106. func_usage_message ()
  2107. {
  2108. $debug_cmd
  2109. eval \$ECHO \""Usage: $usage"\"
  2110. echo
  2111. $SED -n 's|^# ||
  2112. /^Written by/{
  2113. x;p;x
  2114. }
  2115. h
  2116. /^Written by/q' < "$progpath"
  2117. echo
  2118. eval \$ECHO \""$usage_message"\"
  2119. }
  2120. # func_version
  2121. # ------------
  2122. # Echo version message to standard output and exit.
  2123. func_version ()
  2124. {
  2125. $debug_cmd
  2126. printf '%s\n' "$progname $scriptversion"
  2127. $SED -n '
  2128. /(C)/!b go
  2129. :more
  2130. /\./!{
  2131. N
  2132. s|\n# | |
  2133. b more
  2134. }
  2135. :go
  2136. /^# Written by /,/# warranty; / {
  2137. s|^# ||
  2138. s|^# *$||
  2139. s|\((C)\)[ 0-9,-]*[ ,-]\([1-9][0-9]* \)|\1 \2|
  2140. p
  2141. }
  2142. /^# Written by / {
  2143. s|^# ||
  2144. p
  2145. }
  2146. /^warranty; /q' < "$progpath"
  2147. exit $?
  2148. }
  2149. # Local variables:
  2150. # mode: shell-script
  2151. # sh-indentation: 2
  2152. # eval: (add-hook 'before-save-hook 'time-stamp)
  2153. # time-stamp-pattern: "10/scriptversion=%:y-%02m-%02d.%02H; # UTC"
  2154. # time-stamp-time-zone: "UTC"
  2155. # End:
  2156. # Set a version string.
  2157. scriptversion='(GNU libtool) 2.4.6'
  2158. # func_echo ARG...
  2159. # ----------------
  2160. # Libtool also displays the current mode in messages, so override
  2161. # funclib.sh func_echo with this custom definition.
  2162. func_echo ()
  2163. {
  2164. $debug_cmd
  2165. _G_message=$*
  2166. func_echo_IFS=$IFS
  2167. IFS=$nl
  2168. for _G_line in $_G_message; do
  2169. IFS=$func_echo_IFS
  2170. $ECHO "$progname${opt_mode+: $opt_mode}: $_G_line"
  2171. done
  2172. IFS=$func_echo_IFS
  2173. }
  2174. # func_warning ARG...
  2175. # -------------------
  2176. # Libtool warnings are not categorized, so override funclib.sh
  2177. # func_warning with this simpler definition.
  2178. func_warning ()
  2179. {
  2180. $debug_cmd
  2181. $warning_func ${1+"$@"}
  2182. }
  2183. ## ---------------- ##
  2184. ## Options parsing. ##
  2185. ## ---------------- ##
  2186. # Hook in the functions to make sure our own options are parsed during
  2187. # the option parsing loop.
  2188. usage='$progpath [OPTION]... [MODE-ARG]...'
  2189. # Short help message in response to '-h'.
  2190. usage_message="Options:
  2191. --config show all configuration variables
  2192. --debug enable verbose shell tracing
  2193. -n, --dry-run display commands without modifying any files
  2194. --features display basic configuration information and exit
  2195. --mode=MODE use operation mode MODE
  2196. --no-warnings equivalent to '-Wnone'
  2197. --preserve-dup-deps don't remove duplicate dependency libraries
  2198. --quiet, --silent don't print informational messages
  2199. --tag=TAG use configuration variables from tag TAG
  2200. -v, --verbose print more informational messages than default
  2201. --version print version information
  2202. -W, --warnings=CATEGORY report the warnings falling in CATEGORY [all]
  2203. -h, --help, --help-all print short, long, or detailed help message
  2204. "
  2205. # Additional text appended to 'usage_message' in response to '--help'.
  2206. func_help ()
  2207. {
  2208. $debug_cmd
  2209. func_usage_message
  2210. $ECHO "$long_help_message
  2211. MODE must be one of the following:
  2212. clean remove files from the build directory
  2213. compile compile a source file into a libtool object
  2214. execute automatically set library path, then run a program
  2215. finish complete the installation of libtool libraries
  2216. install install libraries or executables
  2217. link create a library or an executable
  2218. uninstall remove libraries from an installed directory
  2219. MODE-ARGS vary depending on the MODE. When passed as first option,
  2220. '--mode=MODE' may be abbreviated as 'MODE' or a unique abbreviation of that.
  2221. Try '$progname --help --mode=MODE' for a more detailed description of MODE.
  2222. When reporting a bug, please describe a test case to reproduce it and
  2223. include the following information:
  2224. host-triplet: $host
  2225. shell: $SHELL
  2226. compiler: $LTCC
  2227. compiler flags: $LTCFLAGS
  2228. linker: $LD (gnu? $with_gnu_ld)
  2229. version: $progname $scriptversion Debian-2.4.6-2.1
  2230. automake: `($AUTOMAKE --version) 2>/dev/null |$SED 1q`
  2231. autoconf: `($AUTOCONF --version) 2>/dev/null |$SED 1q`
  2232. Report bugs to <bug-libtool@gnu.org>.
  2233. GNU libtool home page: <http://www.gnu.org/s/libtool/>.
  2234. General help using GNU software: <http://www.gnu.org/gethelp/>."
  2235. exit 0
  2236. }
  2237. # func_lo2o OBJECT-NAME
  2238. # ---------------------
  2239. # Transform OBJECT-NAME from a '.lo' suffix to the platform specific
  2240. # object suffix.
  2241. lo2o=s/\\.lo\$/.$objext/
  2242. o2lo=s/\\.$objext\$/.lo/
  2243. if test yes = "$_G_HAVE_XSI_OPS"; then
  2244. eval 'func_lo2o ()
  2245. {
  2246. case $1 in
  2247. *.lo) func_lo2o_result=${1%.lo}.$objext ;;
  2248. * ) func_lo2o_result=$1 ;;
  2249. esac
  2250. }'
  2251. # func_xform LIBOBJ-OR-SOURCE
  2252. # ---------------------------
  2253. # Transform LIBOBJ-OR-SOURCE from a '.o' or '.c' (or otherwise)
  2254. # suffix to a '.lo' libtool-object suffix.
  2255. eval 'func_xform ()
  2256. {
  2257. func_xform_result=${1%.*}.lo
  2258. }'
  2259. else
  2260. # ...otherwise fall back to using sed.
  2261. func_lo2o ()
  2262. {
  2263. func_lo2o_result=`$ECHO "$1" | $SED "$lo2o"`
  2264. }
  2265. func_xform ()
  2266. {
  2267. func_xform_result=`$ECHO "$1" | $SED 's|\.[^.]*$|.lo|'`
  2268. }
  2269. fi
  2270. # func_fatal_configuration ARG...
  2271. # -------------------------------
  2272. # Echo program name prefixed message to standard error, followed by
  2273. # a configuration failure hint, and exit.
  2274. func_fatal_configuration ()
  2275. {
  2276. func__fatal_error ${1+"$@"} \
  2277. "See the $PACKAGE documentation for more information." \
  2278. "Fatal configuration error."
  2279. }
  2280. # func_config
  2281. # -----------
  2282. # Display the configuration for all the tags in this script.
  2283. func_config ()
  2284. {
  2285. re_begincf='^# ### BEGIN LIBTOOL'
  2286. re_endcf='^# ### END LIBTOOL'
  2287. # Default configuration.
  2288. $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath"
  2289. # Now print the configurations for the tags.
  2290. for tagname in $taglist; do
  2291. $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath"
  2292. done
  2293. exit $?
  2294. }
  2295. # func_features
  2296. # -------------
  2297. # Display the features supported by this script.
  2298. func_features ()
  2299. {
  2300. echo "host: $host"
  2301. if test yes = "$build_libtool_libs"; then
  2302. echo "enable shared libraries"
  2303. else
  2304. echo "disable shared libraries"
  2305. fi
  2306. if test yes = "$build_old_libs"; then
  2307. echo "enable static libraries"
  2308. else
  2309. echo "disable static libraries"
  2310. fi
  2311. exit $?
  2312. }
  2313. # func_enable_tag TAGNAME
  2314. # -----------------------
  2315. # Verify that TAGNAME is valid, and either flag an error and exit, or
  2316. # enable the TAGNAME tag. We also add TAGNAME to the global $taglist
  2317. # variable here.
  2318. func_enable_tag ()
  2319. {
  2320. # Global variable:
  2321. tagname=$1
  2322. re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$"
  2323. re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$"
  2324. sed_extractcf=/$re_begincf/,/$re_endcf/p
  2325. # Validate tagname.
  2326. case $tagname in
  2327. *[!-_A-Za-z0-9,/]*)
  2328. func_fatal_error "invalid tag name: $tagname"
  2329. ;;
  2330. esac
  2331. # Don't test for the "default" C tag, as we know it's
  2332. # there but not specially marked.
  2333. case $tagname in
  2334. CC) ;;
  2335. *)
  2336. if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then
  2337. taglist="$taglist $tagname"
  2338. # Evaluate the configuration. Be careful to quote the path
  2339. # and the sed script, to avoid splitting on whitespace, but
  2340. # also don't use non-portable quotes within backquotes within
  2341. # quotes we have to do it in 2 steps:
  2342. extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"`
  2343. eval "$extractedcf"
  2344. else
  2345. func_error "ignoring unknown tag $tagname"
  2346. fi
  2347. ;;
  2348. esac
  2349. }
  2350. # func_check_version_match
  2351. # ------------------------
  2352. # Ensure that we are using m4 macros, and libtool script from the same
  2353. # release of libtool.
  2354. func_check_version_match ()
  2355. {
  2356. if test "$package_revision" != "$macro_revision"; then
  2357. if test "$VERSION" != "$macro_version"; then
  2358. if test -z "$macro_version"; then
  2359. cat >&2 <<_LT_EOF
  2360. $progname: Version mismatch error. This is $PACKAGE $VERSION, but the
  2361. $progname: definition of this LT_INIT comes from an older release.
  2362. $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
  2363. $progname: and run autoconf again.
  2364. _LT_EOF
  2365. else
  2366. cat >&2 <<_LT_EOF
  2367. $progname: Version mismatch error. This is $PACKAGE $VERSION, but the
  2368. $progname: definition of this LT_INIT comes from $PACKAGE $macro_version.
  2369. $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
  2370. $progname: and run autoconf again.
  2371. _LT_EOF
  2372. fi
  2373. else
  2374. cat >&2 <<_LT_EOF
  2375. $progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision,
  2376. $progname: but the definition of this LT_INIT comes from revision $macro_revision.
  2377. $progname: You should recreate aclocal.m4 with macros from revision $package_revision
  2378. $progname: of $PACKAGE $VERSION and run autoconf again.
  2379. _LT_EOF
  2380. fi
  2381. exit $EXIT_MISMATCH
  2382. fi
  2383. }
  2384. # libtool_options_prep [ARG]...
  2385. # -----------------------------
  2386. # Preparation for options parsed by libtool.
  2387. libtool_options_prep ()
  2388. {
  2389. $debug_mode
  2390. # Option defaults:
  2391. opt_config=false
  2392. opt_dlopen=
  2393. opt_dry_run=false
  2394. opt_help=false
  2395. opt_mode=
  2396. opt_preserve_dup_deps=false
  2397. opt_quiet=false
  2398. nonopt=
  2399. preserve_args=
  2400. _G_rc_lt_options_prep=:
  2401. # Shorthand for --mode=foo, only valid as the first argument
  2402. case $1 in
  2403. clean|clea|cle|cl)
  2404. shift; set dummy --mode clean ${1+"$@"}; shift
  2405. ;;
  2406. compile|compil|compi|comp|com|co|c)
  2407. shift; set dummy --mode compile ${1+"$@"}; shift
  2408. ;;
  2409. execute|execut|execu|exec|exe|ex|e)
  2410. shift; set dummy --mode execute ${1+"$@"}; shift
  2411. ;;
  2412. finish|finis|fini|fin|fi|f)
  2413. shift; set dummy --mode finish ${1+"$@"}; shift
  2414. ;;
  2415. install|instal|insta|inst|ins|in|i)
  2416. shift; set dummy --mode install ${1+"$@"}; shift
  2417. ;;
  2418. link|lin|li|l)
  2419. shift; set dummy --mode link ${1+"$@"}; shift
  2420. ;;
  2421. uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u)
  2422. shift; set dummy --mode uninstall ${1+"$@"}; shift
  2423. ;;
  2424. *)
  2425. _G_rc_lt_options_prep=false
  2426. ;;
  2427. esac
  2428. if $_G_rc_lt_options_prep; then
  2429. # Pass back the list of options.
  2430. func_quote eval ${1+"$@"}
  2431. libtool_options_prep_result=$func_quote_result
  2432. fi
  2433. $_G_rc_lt_options_prep
  2434. }
  2435. func_add_hook func_options_prep libtool_options_prep
  2436. # libtool_parse_options [ARG]...
  2437. # ---------------------------------
  2438. # Provide handling for libtool specific options.
  2439. libtool_parse_options ()
  2440. {
  2441. $debug_cmd
  2442. _G_rc_lt_parse_options=false
  2443. # Perform our own loop to consume as many options as possible in
  2444. # each iteration.
  2445. while test $# -gt 0; do
  2446. _G_match_lt_parse_options=:
  2447. _G_opt=$1
  2448. shift
  2449. case $_G_opt in
  2450. --dry-run|--dryrun|-n)
  2451. opt_dry_run=:
  2452. ;;
  2453. --config) func_config ;;
  2454. --dlopen|-dlopen)
  2455. opt_dlopen="${opt_dlopen+$opt_dlopen
  2456. }$1"
  2457. shift
  2458. ;;
  2459. --preserve-dup-deps)
  2460. opt_preserve_dup_deps=: ;;
  2461. --features) func_features ;;
  2462. --finish) set dummy --mode finish ${1+"$@"}; shift ;;
  2463. --help) opt_help=: ;;
  2464. --help-all) opt_help=': help-all' ;;
  2465. --mode) test $# = 0 && func_missing_arg $_G_opt && break
  2466. opt_mode=$1
  2467. case $1 in
  2468. # Valid mode arguments:
  2469. clean|compile|execute|finish|install|link|relink|uninstall) ;;
  2470. # Catch anything else as an error
  2471. *) func_error "invalid argument for $_G_opt"
  2472. exit_cmd=exit
  2473. break
  2474. ;;
  2475. esac
  2476. shift
  2477. ;;
  2478. --no-silent|--no-quiet)
  2479. opt_quiet=false
  2480. func_append preserve_args " $_G_opt"
  2481. ;;
  2482. --no-warnings|--no-warning|--no-warn)
  2483. opt_warning=false
  2484. func_append preserve_args " $_G_opt"
  2485. ;;
  2486. --no-verbose)
  2487. opt_verbose=false
  2488. func_append preserve_args " $_G_opt"
  2489. ;;
  2490. --silent|--quiet)
  2491. opt_quiet=:
  2492. opt_verbose=false
  2493. func_append preserve_args " $_G_opt"
  2494. ;;
  2495. --tag) test $# = 0 && func_missing_arg $_G_opt && break
  2496. opt_tag=$1
  2497. func_append preserve_args " $_G_opt $1"
  2498. func_enable_tag "$1"
  2499. shift
  2500. ;;
  2501. --verbose|-v) opt_quiet=false
  2502. opt_verbose=:
  2503. func_append preserve_args " $_G_opt"
  2504. ;;
  2505. # An option not handled by this hook function:
  2506. *) set dummy "$_G_opt" ${1+"$@"} ; shift
  2507. _G_match_lt_parse_options=false
  2508. break
  2509. ;;
  2510. esac
  2511. $_G_match_lt_parse_options && _G_rc_lt_parse_options=:
  2512. done
  2513. if $_G_rc_lt_parse_options; then
  2514. # save modified positional parameters for caller
  2515. func_quote eval ${1+"$@"}
  2516. libtool_parse_options_result=$func_quote_result
  2517. fi
  2518. $_G_rc_lt_parse_options
  2519. }
  2520. func_add_hook func_parse_options libtool_parse_options
  2521. # libtool_validate_options [ARG]...
  2522. # ---------------------------------
  2523. # Perform any sanity checks on option settings and/or unconsumed
  2524. # arguments.
  2525. libtool_validate_options ()
  2526. {
  2527. # save first non-option argument
  2528. if test 0 -lt $#; then
  2529. nonopt=$1
  2530. shift
  2531. fi
  2532. # preserve --debug
  2533. test : = "$debug_cmd" || func_append preserve_args " --debug"
  2534. case $host in
  2535. # Solaris2 added to fix http://debbugs.gnu.org/cgi/bugreport.cgi?bug=16452
  2536. # see also: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59788
  2537. *cygwin* | *mingw* | *pw32* | *cegcc* | *solaris2* | *os2*)
  2538. # don't eliminate duplications in $postdeps and $predeps
  2539. opt_duplicate_compiler_generated_deps=:
  2540. ;;
  2541. *)
  2542. opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps
  2543. ;;
  2544. esac
  2545. $opt_help || {
  2546. # Sanity checks first:
  2547. func_check_version_match
  2548. test yes != "$build_libtool_libs" \
  2549. && test yes != "$build_old_libs" \
  2550. && func_fatal_configuration "not configured to build any kind of library"
  2551. # Darwin sucks
  2552. eval std_shrext=\"$shrext_cmds\"
  2553. # Only execute mode is allowed to have -dlopen flags.
  2554. if test -n "$opt_dlopen" && test execute != "$opt_mode"; then
  2555. func_error "unrecognized option '-dlopen'"
  2556. $ECHO "$help" 1>&2
  2557. exit $EXIT_FAILURE
  2558. fi
  2559. # Change the help message to a mode-specific one.
  2560. generic_help=$help
  2561. help="Try '$progname --help --mode=$opt_mode' for more information."
  2562. }
  2563. # Pass back the unparsed argument list
  2564. func_quote eval ${1+"$@"}
  2565. libtool_validate_options_result=$func_quote_result
  2566. }
  2567. func_add_hook func_validate_options libtool_validate_options
  2568. # Process options as early as possible so that --help and --version
  2569. # can return quickly.
  2570. func_options ${1+"$@"}
  2571. eval set dummy "$func_options_result"; shift
  2572. ## ----------- ##
  2573. ## Main. ##
  2574. ## ----------- ##
  2575. magic='%%%MAGIC variable%%%'
  2576. magic_exe='%%%MAGIC EXE variable%%%'
  2577. # Global variables.
  2578. extracted_archives=
  2579. extracted_serial=0
  2580. # If this variable is set in any of the actions, the command in it
  2581. # will be execed at the end. This prevents here-documents from being
  2582. # left over by shells.
  2583. exec_cmd=
  2584. # A function that is used when there is no print builtin or printf.
  2585. func_fallback_echo ()
  2586. {
  2587. eval 'cat <<_LTECHO_EOF
  2588. $1
  2589. _LTECHO_EOF'
  2590. }
  2591. # func_generated_by_libtool
  2592. # True iff stdin has been generated by Libtool. This function is only
  2593. # a basic sanity check; it will hardly flush out determined imposters.
  2594. func_generated_by_libtool_p ()
  2595. {
  2596. $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1
  2597. }
  2598. # func_lalib_p file
  2599. # True iff FILE is a libtool '.la' library or '.lo' object file.
  2600. # This function is only a basic sanity check; it will hardly flush out
  2601. # determined imposters.
  2602. func_lalib_p ()
  2603. {
  2604. test -f "$1" &&
  2605. $SED -e 4q "$1" 2>/dev/null | func_generated_by_libtool_p
  2606. }
  2607. # func_lalib_unsafe_p file
  2608. # True iff FILE is a libtool '.la' library or '.lo' object file.
  2609. # This function implements the same check as func_lalib_p without
  2610. # resorting to external programs. To this end, it redirects stdin and
  2611. # closes it afterwards, without saving the original file descriptor.
  2612. # As a safety measure, use it only where a negative result would be
  2613. # fatal anyway. Works if 'file' does not exist.
  2614. func_lalib_unsafe_p ()
  2615. {
  2616. lalib_p=no
  2617. if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then
  2618. for lalib_p_l in 1 2 3 4
  2619. do
  2620. read lalib_p_line
  2621. case $lalib_p_line in
  2622. \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;;
  2623. esac
  2624. done
  2625. exec 0<&5 5<&-
  2626. fi
  2627. test yes = "$lalib_p"
  2628. }
  2629. # func_ltwrapper_script_p file
  2630. # True iff FILE is a libtool wrapper script
  2631. # This function is only a basic sanity check; it will hardly flush out
  2632. # determined imposters.
  2633. func_ltwrapper_script_p ()
  2634. {
  2635. test -f "$1" &&
  2636. $lt_truncate_bin < "$1" 2>/dev/null | func_generated_by_libtool_p
  2637. }
  2638. # func_ltwrapper_executable_p file
  2639. # True iff FILE is a libtool wrapper executable
  2640. # This function is only a basic sanity check; it will hardly flush out
  2641. # determined imposters.
  2642. func_ltwrapper_executable_p ()
  2643. {
  2644. func_ltwrapper_exec_suffix=
  2645. case $1 in
  2646. *.exe) ;;
  2647. *) func_ltwrapper_exec_suffix=.exe ;;
  2648. esac
  2649. $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1
  2650. }
  2651. # func_ltwrapper_scriptname file
  2652. # Assumes file is an ltwrapper_executable
  2653. # uses $file to determine the appropriate filename for a
  2654. # temporary ltwrapper_script.
  2655. func_ltwrapper_scriptname ()
  2656. {
  2657. func_dirname_and_basename "$1" "" "."
  2658. func_stripname '' '.exe' "$func_basename_result"
  2659. func_ltwrapper_scriptname_result=$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper
  2660. }
  2661. # func_ltwrapper_p file
  2662. # True iff FILE is a libtool wrapper script or wrapper executable
  2663. # This function is only a basic sanity check; it will hardly flush out
  2664. # determined imposters.
  2665. func_ltwrapper_p ()
  2666. {
  2667. func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1"
  2668. }
  2669. # func_execute_cmds commands fail_cmd
  2670. # Execute tilde-delimited COMMANDS.
  2671. # If FAIL_CMD is given, eval that upon failure.
  2672. # FAIL_CMD may read-access the current command in variable CMD!
  2673. func_execute_cmds ()
  2674. {
  2675. $debug_cmd
  2676. save_ifs=$IFS; IFS='~'
  2677. for cmd in $1; do
  2678. IFS=$sp$nl
  2679. eval cmd=\"$cmd\"
  2680. IFS=$save_ifs
  2681. func_show_eval "$cmd" "${2-:}"
  2682. done
  2683. IFS=$save_ifs
  2684. }
  2685. # func_source file
  2686. # Source FILE, adding directory component if necessary.
  2687. # Note that it is not necessary on cygwin/mingw to append a dot to
  2688. # FILE even if both FILE and FILE.exe exist: automatic-append-.exe
  2689. # behavior happens only for exec(3), not for open(2)! Also, sourcing
  2690. # 'FILE.' does not work on cygwin managed mounts.
  2691. func_source ()
  2692. {
  2693. $debug_cmd
  2694. case $1 in
  2695. */* | *\\*) . "$1" ;;
  2696. *) . "./$1" ;;
  2697. esac
  2698. }
  2699. # func_resolve_sysroot PATH
  2700. # Replace a leading = in PATH with a sysroot. Store the result into
  2701. # func_resolve_sysroot_result
  2702. func_resolve_sysroot ()
  2703. {
  2704. func_resolve_sysroot_result=$1
  2705. case $func_resolve_sysroot_result in
  2706. =*)
  2707. func_stripname '=' '' "$func_resolve_sysroot_result"
  2708. func_resolve_sysroot_result=$lt_sysroot$func_stripname_result
  2709. ;;
  2710. esac
  2711. }
  2712. # func_replace_sysroot PATH
  2713. # If PATH begins with the sysroot, replace it with = and
  2714. # store the result into func_replace_sysroot_result.
  2715. func_replace_sysroot ()
  2716. {
  2717. case $lt_sysroot:$1 in
  2718. ?*:"$lt_sysroot"*)
  2719. func_stripname "$lt_sysroot" '' "$1"
  2720. func_replace_sysroot_result='='$func_stripname_result
  2721. ;;
  2722. *)
  2723. # Including no sysroot.
  2724. func_replace_sysroot_result=$1
  2725. ;;
  2726. esac
  2727. }
  2728. # func_infer_tag arg
  2729. # Infer tagged configuration to use if any are available and
  2730. # if one wasn't chosen via the "--tag" command line option.
  2731. # Only attempt this if the compiler in the base compile
  2732. # command doesn't match the default compiler.
  2733. # arg is usually of the form 'gcc ...'
  2734. func_infer_tag ()
  2735. {
  2736. $debug_cmd
  2737. if test -n "$available_tags" && test -z "$tagname"; then
  2738. CC_quoted=
  2739. for arg in $CC; do
  2740. func_append_quoted CC_quoted "$arg"
  2741. done
  2742. CC_expanded=`func_echo_all $CC`
  2743. CC_quoted_expanded=`func_echo_all $CC_quoted`
  2744. case $@ in
  2745. # Blanks in the command may have been stripped by the calling shell,
  2746. # but not from the CC environment variable when configure was run.
  2747. " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
  2748. " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;;
  2749. # Blanks at the start of $base_compile will cause this to fail
  2750. # if we don't check for them as well.
  2751. *)
  2752. for z in $available_tags; do
  2753. if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
  2754. # Evaluate the configuration.
  2755. eval "`$SED -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
  2756. CC_quoted=
  2757. for arg in $CC; do
  2758. # Double-quote args containing other shell metacharacters.
  2759. func_append_quoted CC_quoted "$arg"
  2760. done
  2761. CC_expanded=`func_echo_all $CC`
  2762. CC_quoted_expanded=`func_echo_all $CC_quoted`
  2763. case "$@ " in
  2764. " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
  2765. " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*)
  2766. # The compiler in the base compile command matches
  2767. # the one in the tagged configuration.
  2768. # Assume this is the tagged configuration we want.
  2769. tagname=$z
  2770. break
  2771. ;;
  2772. esac
  2773. fi
  2774. done
  2775. # If $tagname still isn't set, then no tagged configuration
  2776. # was found and let the user know that the "--tag" command
  2777. # line option must be used.
  2778. if test -z "$tagname"; then
  2779. func_echo "unable to infer tagged configuration"
  2780. func_fatal_error "specify a tag with '--tag'"
  2781. # else
  2782. # func_verbose "using $tagname tagged configuration"
  2783. fi
  2784. ;;
  2785. esac
  2786. fi
  2787. }
  2788. # func_write_libtool_object output_name pic_name nonpic_name
  2789. # Create a libtool object file (analogous to a ".la" file),
  2790. # but don't create it if we're doing a dry run.
  2791. func_write_libtool_object ()
  2792. {
  2793. write_libobj=$1
  2794. if test yes = "$build_libtool_libs"; then
  2795. write_lobj=\'$2\'
  2796. else
  2797. write_lobj=none
  2798. fi
  2799. if test yes = "$build_old_libs"; then
  2800. write_oldobj=\'$3\'
  2801. else
  2802. write_oldobj=none
  2803. fi
  2804. $opt_dry_run || {
  2805. cat >${write_libobj}T <<EOF
  2806. # $write_libobj - a libtool object file
  2807. # Generated by $PROGRAM (GNU $PACKAGE) $VERSION
  2808. #
  2809. # Please DO NOT delete this file!
  2810. # It is necessary for linking the library.
  2811. # Name of the PIC object.
  2812. pic_object=$write_lobj
  2813. # Name of the non-PIC object
  2814. non_pic_object=$write_oldobj
  2815. EOF
  2816. $MV "${write_libobj}T" "$write_libobj"
  2817. }
  2818. }
  2819. ##################################################
  2820. # FILE NAME AND PATH CONVERSION HELPER FUNCTIONS #
  2821. ##################################################
  2822. # func_convert_core_file_wine_to_w32 ARG
  2823. # Helper function used by file name conversion functions when $build is *nix,
  2824. # and $host is mingw, cygwin, or some other w32 environment. Relies on a
  2825. # correctly configured wine environment available, with the winepath program
  2826. # in $build's $PATH.
  2827. #
  2828. # ARG is the $build file name to be converted to w32 format.
  2829. # Result is available in $func_convert_core_file_wine_to_w32_result, and will
  2830. # be empty on error (or when ARG is empty)
  2831. func_convert_core_file_wine_to_w32 ()
  2832. {
  2833. $debug_cmd
  2834. func_convert_core_file_wine_to_w32_result=$1
  2835. if test -n "$1"; then
  2836. # Unfortunately, winepath does not exit with a non-zero error code, so we
  2837. # are forced to check the contents of stdout. On the other hand, if the
  2838. # command is not found, the shell will set an exit code of 127 and print
  2839. # *an error message* to stdout. So we must check for both error code of
  2840. # zero AND non-empty stdout, which explains the odd construction:
  2841. func_convert_core_file_wine_to_w32_tmp=`winepath -w "$1" 2>/dev/null`
  2842. if test "$?" -eq 0 && test -n "$func_convert_core_file_wine_to_w32_tmp"; then
  2843. func_convert_core_file_wine_to_w32_result=`$ECHO "$func_convert_core_file_wine_to_w32_tmp" |
  2844. $SED -e "$sed_naive_backslashify"`
  2845. else
  2846. func_convert_core_file_wine_to_w32_result=
  2847. fi
  2848. fi
  2849. }
  2850. # end: func_convert_core_file_wine_to_w32
  2851. # func_convert_core_path_wine_to_w32 ARG
  2852. # Helper function used by path conversion functions when $build is *nix, and
  2853. # $host is mingw, cygwin, or some other w32 environment. Relies on a correctly
  2854. # configured wine environment available, with the winepath program in $build's
  2855. # $PATH. Assumes ARG has no leading or trailing path separator characters.
  2856. #
  2857. # ARG is path to be converted from $build format to win32.
  2858. # Result is available in $func_convert_core_path_wine_to_w32_result.
  2859. # Unconvertible file (directory) names in ARG are skipped; if no directory names
  2860. # are convertible, then the result may be empty.
  2861. func_convert_core_path_wine_to_w32 ()
  2862. {
  2863. $debug_cmd
  2864. # unfortunately, winepath doesn't convert paths, only file names
  2865. func_convert_core_path_wine_to_w32_result=
  2866. if test -n "$1"; then
  2867. oldIFS=$IFS
  2868. IFS=:
  2869. for func_convert_core_path_wine_to_w32_f in $1; do
  2870. IFS=$oldIFS
  2871. func_convert_core_file_wine_to_w32 "$func_convert_core_path_wine_to_w32_f"
  2872. if test -n "$func_convert_core_file_wine_to_w32_result"; then
  2873. if test -z "$func_convert_core_path_wine_to_w32_result"; then
  2874. func_convert_core_path_wine_to_w32_result=$func_convert_core_file_wine_to_w32_result
  2875. else
  2876. func_append func_convert_core_path_wine_to_w32_result ";$func_convert_core_file_wine_to_w32_result"
  2877. fi
  2878. fi
  2879. done
  2880. IFS=$oldIFS
  2881. fi
  2882. }
  2883. # end: func_convert_core_path_wine_to_w32
  2884. # func_cygpath ARGS...
  2885. # Wrapper around calling the cygpath program via LT_CYGPATH. This is used when
  2886. # when (1) $build is *nix and Cygwin is hosted via a wine environment; or (2)
  2887. # $build is MSYS and $host is Cygwin, or (3) $build is Cygwin. In case (1) or
  2888. # (2), returns the Cygwin file name or path in func_cygpath_result (input
  2889. # file name or path is assumed to be in w32 format, as previously converted
  2890. # from $build's *nix or MSYS format). In case (3), returns the w32 file name
  2891. # or path in func_cygpath_result (input file name or path is assumed to be in
  2892. # Cygwin format). Returns an empty string on error.
  2893. #
  2894. # ARGS are passed to cygpath, with the last one being the file name or path to
  2895. # be converted.
  2896. #
  2897. # Specify the absolute *nix (or w32) name to cygpath in the LT_CYGPATH
  2898. # environment variable; do not put it in $PATH.
  2899. func_cygpath ()
  2900. {
  2901. $debug_cmd
  2902. if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then
  2903. func_cygpath_result=`$LT_CYGPATH "$@" 2>/dev/null`
  2904. if test "$?" -ne 0; then
  2905. # on failure, ensure result is empty
  2906. func_cygpath_result=
  2907. fi
  2908. else
  2909. func_cygpath_result=
  2910. func_error "LT_CYGPATH is empty or specifies non-existent file: '$LT_CYGPATH'"
  2911. fi
  2912. }
  2913. #end: func_cygpath
  2914. # func_convert_core_msys_to_w32 ARG
  2915. # Convert file name or path ARG from MSYS format to w32 format. Return
  2916. # result in func_convert_core_msys_to_w32_result.
  2917. func_convert_core_msys_to_w32 ()
  2918. {
  2919. $debug_cmd
  2920. # awkward: cmd appends spaces to result
  2921. func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null |
  2922. $SED -e 's/[ ]*$//' -e "$sed_naive_backslashify"`
  2923. }
  2924. #end: func_convert_core_msys_to_w32
  2925. # func_convert_file_check ARG1 ARG2
  2926. # Verify that ARG1 (a file name in $build format) was converted to $host
  2927. # format in ARG2. Otherwise, emit an error message, but continue (resetting
  2928. # func_to_host_file_result to ARG1).
  2929. func_convert_file_check ()
  2930. {
  2931. $debug_cmd
  2932. if test -z "$2" && test -n "$1"; then
  2933. func_error "Could not determine host file name corresponding to"
  2934. func_error " '$1'"
  2935. func_error "Continuing, but uninstalled executables may not work."
  2936. # Fallback:
  2937. func_to_host_file_result=$1
  2938. fi
  2939. }
  2940. # end func_convert_file_check
  2941. # func_convert_path_check FROM_PATHSEP TO_PATHSEP FROM_PATH TO_PATH
  2942. # Verify that FROM_PATH (a path in $build format) was converted to $host
  2943. # format in TO_PATH. Otherwise, emit an error message, but continue, resetting
  2944. # func_to_host_file_result to a simplistic fallback value (see below).
  2945. func_convert_path_check ()
  2946. {
  2947. $debug_cmd
  2948. if test -z "$4" && test -n "$3"; then
  2949. func_error "Could not determine the host path corresponding to"
  2950. func_error " '$3'"
  2951. func_error "Continuing, but uninstalled executables may not work."
  2952. # Fallback. This is a deliberately simplistic "conversion" and
  2953. # should not be "improved". See libtool.info.
  2954. if test "x$1" != "x$2"; then
  2955. lt_replace_pathsep_chars="s|$1|$2|g"
  2956. func_to_host_path_result=`echo "$3" |
  2957. $SED -e "$lt_replace_pathsep_chars"`
  2958. else
  2959. func_to_host_path_result=$3
  2960. fi
  2961. fi
  2962. }
  2963. # end func_convert_path_check
  2964. # func_convert_path_front_back_pathsep FRONTPAT BACKPAT REPL ORIG
  2965. # Modifies func_to_host_path_result by prepending REPL if ORIG matches FRONTPAT
  2966. # and appending REPL if ORIG matches BACKPAT.
  2967. func_convert_path_front_back_pathsep ()
  2968. {
  2969. $debug_cmd
  2970. case $4 in
  2971. $1 ) func_to_host_path_result=$3$func_to_host_path_result
  2972. ;;
  2973. esac
  2974. case $4 in
  2975. $2 ) func_append func_to_host_path_result "$3"
  2976. ;;
  2977. esac
  2978. }
  2979. # end func_convert_path_front_back_pathsep
  2980. ##################################################
  2981. # $build to $host FILE NAME CONVERSION FUNCTIONS #
  2982. ##################################################
  2983. # invoked via '$to_host_file_cmd ARG'
  2984. #
  2985. # In each case, ARG is the path to be converted from $build to $host format.
  2986. # Result will be available in $func_to_host_file_result.
  2987. # func_to_host_file ARG
  2988. # Converts the file name ARG from $build format to $host format. Return result
  2989. # in func_to_host_file_result.
  2990. func_to_host_file ()
  2991. {
  2992. $debug_cmd
  2993. $to_host_file_cmd "$1"
  2994. }
  2995. # end func_to_host_file
  2996. # func_to_tool_file ARG LAZY
  2997. # converts the file name ARG from $build format to toolchain format. Return
  2998. # result in func_to_tool_file_result. If the conversion in use is listed
  2999. # in (the comma separated) LAZY, no conversion takes place.
  3000. func_to_tool_file ()
  3001. {
  3002. $debug_cmd
  3003. case ,$2, in
  3004. *,"$to_tool_file_cmd",*)
  3005. func_to_tool_file_result=$1
  3006. ;;
  3007. *)
  3008. $to_tool_file_cmd "$1"
  3009. func_to_tool_file_result=$func_to_host_file_result
  3010. ;;
  3011. esac
  3012. }
  3013. # end func_to_tool_file
  3014. # func_convert_file_noop ARG
  3015. # Copy ARG to func_to_host_file_result.
  3016. func_convert_file_noop ()
  3017. {
  3018. func_to_host_file_result=$1
  3019. }
  3020. # end func_convert_file_noop
  3021. # func_convert_file_msys_to_w32 ARG
  3022. # Convert file name ARG from (mingw) MSYS to (mingw) w32 format; automatic
  3023. # conversion to w32 is not available inside the cwrapper. Returns result in
  3024. # func_to_host_file_result.
  3025. func_convert_file_msys_to_w32 ()
  3026. {
  3027. $debug_cmd
  3028. func_to_host_file_result=$1
  3029. if test -n "$1"; then
  3030. func_convert_core_msys_to_w32 "$1"
  3031. func_to_host_file_result=$func_convert_core_msys_to_w32_result
  3032. fi
  3033. func_convert_file_check "$1" "$func_to_host_file_result"
  3034. }
  3035. # end func_convert_file_msys_to_w32
  3036. # func_convert_file_cygwin_to_w32 ARG
  3037. # Convert file name ARG from Cygwin to w32 format. Returns result in
  3038. # func_to_host_file_result.
  3039. func_convert_file_cygwin_to_w32 ()
  3040. {
  3041. $debug_cmd
  3042. func_to_host_file_result=$1
  3043. if test -n "$1"; then
  3044. # because $build is cygwin, we call "the" cygpath in $PATH; no need to use
  3045. # LT_CYGPATH in this case.
  3046. func_to_host_file_result=`cygpath -m "$1"`
  3047. fi
  3048. func_convert_file_check "$1" "$func_to_host_file_result"
  3049. }
  3050. # end func_convert_file_cygwin_to_w32
  3051. # func_convert_file_nix_to_w32 ARG
  3052. # Convert file name ARG from *nix to w32 format. Requires a wine environment
  3053. # and a working winepath. Returns result in func_to_host_file_result.
  3054. func_convert_file_nix_to_w32 ()
  3055. {
  3056. $debug_cmd
  3057. func_to_host_file_result=$1
  3058. if test -n "$1"; then
  3059. func_convert_core_file_wine_to_w32 "$1"
  3060. func_to_host_file_result=$func_convert_core_file_wine_to_w32_result
  3061. fi
  3062. func_convert_file_check "$1" "$func_to_host_file_result"
  3063. }
  3064. # end func_convert_file_nix_to_w32
  3065. # func_convert_file_msys_to_cygwin ARG
  3066. # Convert file name ARG from MSYS to Cygwin format. Requires LT_CYGPATH set.
  3067. # Returns result in func_to_host_file_result.
  3068. func_convert_file_msys_to_cygwin ()
  3069. {
  3070. $debug_cmd
  3071. func_to_host_file_result=$1
  3072. if test -n "$1"; then
  3073. func_convert_core_msys_to_w32 "$1"
  3074. func_cygpath -u "$func_convert_core_msys_to_w32_result"
  3075. func_to_host_file_result=$func_cygpath_result
  3076. fi
  3077. func_convert_file_check "$1" "$func_to_host_file_result"
  3078. }
  3079. # end func_convert_file_msys_to_cygwin
  3080. # func_convert_file_nix_to_cygwin ARG
  3081. # Convert file name ARG from *nix to Cygwin format. Requires Cygwin installed
  3082. # in a wine environment, working winepath, and LT_CYGPATH set. Returns result
  3083. # in func_to_host_file_result.
  3084. func_convert_file_nix_to_cygwin ()
  3085. {
  3086. $debug_cmd
  3087. func_to_host_file_result=$1
  3088. if test -n "$1"; then
  3089. # convert from *nix to w32, then use cygpath to convert from w32 to cygwin.
  3090. func_convert_core_file_wine_to_w32 "$1"
  3091. func_cygpath -u "$func_convert_core_file_wine_to_w32_result"
  3092. func_to_host_file_result=$func_cygpath_result
  3093. fi
  3094. func_convert_file_check "$1" "$func_to_host_file_result"
  3095. }
  3096. # end func_convert_file_nix_to_cygwin
  3097. #############################################
  3098. # $build to $host PATH CONVERSION FUNCTIONS #
  3099. #############################################
  3100. # invoked via '$to_host_path_cmd ARG'
  3101. #
  3102. # In each case, ARG is the path to be converted from $build to $host format.
  3103. # The result will be available in $func_to_host_path_result.
  3104. #
  3105. # Path separators are also converted from $build format to $host format. If
  3106. # ARG begins or ends with a path separator character, it is preserved (but
  3107. # converted to $host format) on output.
  3108. #
  3109. # All path conversion functions are named using the following convention:
  3110. # file name conversion function : func_convert_file_X_to_Y ()
  3111. # path conversion function : func_convert_path_X_to_Y ()
  3112. # where, for any given $build/$host combination the 'X_to_Y' value is the
  3113. # same. If conversion functions are added for new $build/$host combinations,
  3114. # the two new functions must follow this pattern, or func_init_to_host_path_cmd
  3115. # will break.
  3116. # func_init_to_host_path_cmd
  3117. # Ensures that function "pointer" variable $to_host_path_cmd is set to the
  3118. # appropriate value, based on the value of $to_host_file_cmd.
  3119. to_host_path_cmd=
  3120. func_init_to_host_path_cmd ()
  3121. {
  3122. $debug_cmd
  3123. if test -z "$to_host_path_cmd"; then
  3124. func_stripname 'func_convert_file_' '' "$to_host_file_cmd"
  3125. to_host_path_cmd=func_convert_path_$func_stripname_result
  3126. fi
  3127. }
  3128. # func_to_host_path ARG
  3129. # Converts the path ARG from $build format to $host format. Return result
  3130. # in func_to_host_path_result.
  3131. func_to_host_path ()
  3132. {
  3133. $debug_cmd
  3134. func_init_to_host_path_cmd
  3135. $to_host_path_cmd "$1"
  3136. }
  3137. # end func_to_host_path
  3138. # func_convert_path_noop ARG
  3139. # Copy ARG to func_to_host_path_result.
  3140. func_convert_path_noop ()
  3141. {
  3142. func_to_host_path_result=$1
  3143. }
  3144. # end func_convert_path_noop
  3145. # func_convert_path_msys_to_w32 ARG
  3146. # Convert path ARG from (mingw) MSYS to (mingw) w32 format; automatic
  3147. # conversion to w32 is not available inside the cwrapper. Returns result in
  3148. # func_to_host_path_result.
  3149. func_convert_path_msys_to_w32 ()
  3150. {
  3151. $debug_cmd
  3152. func_to_host_path_result=$1
  3153. if test -n "$1"; then
  3154. # Remove leading and trailing path separator characters from ARG. MSYS
  3155. # behavior is inconsistent here; cygpath turns them into '.;' and ';.';
  3156. # and winepath ignores them completely.
  3157. func_stripname : : "$1"
  3158. func_to_host_path_tmp1=$func_stripname_result
  3159. func_convert_core_msys_to_w32 "$func_to_host_path_tmp1"
  3160. func_to_host_path_result=$func_convert_core_msys_to_w32_result
  3161. func_convert_path_check : ";" \
  3162. "$func_to_host_path_tmp1" "$func_to_host_path_result"
  3163. func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
  3164. fi
  3165. }
  3166. # end func_convert_path_msys_to_w32
  3167. # func_convert_path_cygwin_to_w32 ARG
  3168. # Convert path ARG from Cygwin to w32 format. Returns result in
  3169. # func_to_host_file_result.
  3170. func_convert_path_cygwin_to_w32 ()
  3171. {
  3172. $debug_cmd
  3173. func_to_host_path_result=$1
  3174. if test -n "$1"; then
  3175. # See func_convert_path_msys_to_w32:
  3176. func_stripname : : "$1"
  3177. func_to_host_path_tmp1=$func_stripname_result
  3178. func_to_host_path_result=`cygpath -m -p "$func_to_host_path_tmp1"`
  3179. func_convert_path_check : ";" \
  3180. "$func_to_host_path_tmp1" "$func_to_host_path_result"
  3181. func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
  3182. fi
  3183. }
  3184. # end func_convert_path_cygwin_to_w32
  3185. # func_convert_path_nix_to_w32 ARG
  3186. # Convert path ARG from *nix to w32 format. Requires a wine environment and
  3187. # a working winepath. Returns result in func_to_host_file_result.
  3188. func_convert_path_nix_to_w32 ()
  3189. {
  3190. $debug_cmd
  3191. func_to_host_path_result=$1
  3192. if test -n "$1"; then
  3193. # See func_convert_path_msys_to_w32:
  3194. func_stripname : : "$1"
  3195. func_to_host_path_tmp1=$func_stripname_result
  3196. func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1"
  3197. func_to_host_path_result=$func_convert_core_path_wine_to_w32_result
  3198. func_convert_path_check : ";" \
  3199. "$func_to_host_path_tmp1" "$func_to_host_path_result"
  3200. func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
  3201. fi
  3202. }
  3203. # end func_convert_path_nix_to_w32
  3204. # func_convert_path_msys_to_cygwin ARG
  3205. # Convert path ARG from MSYS to Cygwin format. Requires LT_CYGPATH set.
  3206. # Returns result in func_to_host_file_result.
  3207. func_convert_path_msys_to_cygwin ()
  3208. {
  3209. $debug_cmd
  3210. func_to_host_path_result=$1
  3211. if test -n "$1"; then
  3212. # See func_convert_path_msys_to_w32:
  3213. func_stripname : : "$1"
  3214. func_to_host_path_tmp1=$func_stripname_result
  3215. func_convert_core_msys_to_w32 "$func_to_host_path_tmp1"
  3216. func_cygpath -u -p "$func_convert_core_msys_to_w32_result"
  3217. func_to_host_path_result=$func_cygpath_result
  3218. func_convert_path_check : : \
  3219. "$func_to_host_path_tmp1" "$func_to_host_path_result"
  3220. func_convert_path_front_back_pathsep ":*" "*:" : "$1"
  3221. fi
  3222. }
  3223. # end func_convert_path_msys_to_cygwin
  3224. # func_convert_path_nix_to_cygwin ARG
  3225. # Convert path ARG from *nix to Cygwin format. Requires Cygwin installed in a
  3226. # a wine environment, working winepath, and LT_CYGPATH set. Returns result in
  3227. # func_to_host_file_result.
  3228. func_convert_path_nix_to_cygwin ()
  3229. {
  3230. $debug_cmd
  3231. func_to_host_path_result=$1
  3232. if test -n "$1"; then
  3233. # Remove leading and trailing path separator characters from
  3234. # ARG. msys behavior is inconsistent here, cygpath turns them
  3235. # into '.;' and ';.', and winepath ignores them completely.
  3236. func_stripname : : "$1"
  3237. func_to_host_path_tmp1=$func_stripname_result
  3238. func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1"
  3239. func_cygpath -u -p "$func_convert_core_path_wine_to_w32_result"
  3240. func_to_host_path_result=$func_cygpath_result
  3241. func_convert_path_check : : \
  3242. "$func_to_host_path_tmp1" "$func_to_host_path_result"
  3243. func_convert_path_front_back_pathsep ":*" "*:" : "$1"
  3244. fi
  3245. }
  3246. # end func_convert_path_nix_to_cygwin
  3247. # func_dll_def_p FILE
  3248. # True iff FILE is a Windows DLL '.def' file.
  3249. # Keep in sync with _LT_DLL_DEF_P in libtool.m4
  3250. func_dll_def_p ()
  3251. {
  3252. $debug_cmd
  3253. func_dll_def_p_tmp=`$SED -n \
  3254. -e 's/^[ ]*//' \
  3255. -e '/^\(;.*\)*$/d' \
  3256. -e 's/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p' \
  3257. -e q \
  3258. "$1"`
  3259. test DEF = "$func_dll_def_p_tmp"
  3260. }
  3261. # func_mode_compile arg...
  3262. func_mode_compile ()
  3263. {
  3264. $debug_cmd
  3265. # Get the compilation command and the source file.
  3266. base_compile=
  3267. srcfile=$nonopt # always keep a non-empty value in "srcfile"
  3268. suppress_opt=yes
  3269. suppress_output=
  3270. arg_mode=normal
  3271. libobj=
  3272. later=
  3273. pie_flag=
  3274. for arg
  3275. do
  3276. case $arg_mode in
  3277. arg )
  3278. # do not "continue". Instead, add this to base_compile
  3279. lastarg=$arg
  3280. arg_mode=normal
  3281. ;;
  3282. target )
  3283. libobj=$arg
  3284. arg_mode=normal
  3285. continue
  3286. ;;
  3287. normal )
  3288. # Accept any command-line options.
  3289. case $arg in
  3290. -o)
  3291. test -n "$libobj" && \
  3292. func_fatal_error "you cannot specify '-o' more than once"
  3293. arg_mode=target
  3294. continue
  3295. ;;
  3296. -pie | -fpie | -fPIE)
  3297. func_append pie_flag " $arg"
  3298. continue
  3299. ;;
  3300. -shared | -static | -prefer-pic | -prefer-non-pic)
  3301. func_append later " $arg"
  3302. continue
  3303. ;;
  3304. -no-suppress)
  3305. suppress_opt=no
  3306. continue
  3307. ;;
  3308. -Xcompiler)
  3309. arg_mode=arg # the next one goes into the "base_compile" arg list
  3310. continue # The current "srcfile" will either be retained or
  3311. ;; # replaced later. I would guess that would be a bug.
  3312. -Wc,*)
  3313. func_stripname '-Wc,' '' "$arg"
  3314. args=$func_stripname_result
  3315. lastarg=
  3316. save_ifs=$IFS; IFS=,
  3317. for arg in $args; do
  3318. IFS=$save_ifs
  3319. func_append_quoted lastarg "$arg"
  3320. done
  3321. IFS=$save_ifs
  3322. func_stripname ' ' '' "$lastarg"
  3323. lastarg=$func_stripname_result
  3324. # Add the arguments to base_compile.
  3325. func_append base_compile " $lastarg"
  3326. continue
  3327. ;;
  3328. *)
  3329. # Accept the current argument as the source file.
  3330. # The previous "srcfile" becomes the current argument.
  3331. #
  3332. lastarg=$srcfile
  3333. srcfile=$arg
  3334. ;;
  3335. esac # case $arg
  3336. ;;
  3337. esac # case $arg_mode
  3338. # Aesthetically quote the previous argument.
  3339. func_append_quoted base_compile "$lastarg"
  3340. done # for arg
  3341. case $arg_mode in
  3342. arg)
  3343. func_fatal_error "you must specify an argument for -Xcompile"
  3344. ;;
  3345. target)
  3346. func_fatal_error "you must specify a target with '-o'"
  3347. ;;
  3348. *)
  3349. # Get the name of the library object.
  3350. test -z "$libobj" && {
  3351. func_basename "$srcfile"
  3352. libobj=$func_basename_result
  3353. }
  3354. ;;
  3355. esac
  3356. # Recognize several different file suffixes.
  3357. # If the user specifies -o file.o, it is replaced with file.lo
  3358. case $libobj in
  3359. *.[cCFSifmso] | \
  3360. *.ada | *.adb | *.ads | *.asm | \
  3361. *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \
  3362. *.[fF][09]? | *.for | *.java | *.go | *.obj | *.sx | *.cu | *.cup)
  3363. func_xform "$libobj"
  3364. libobj=$func_xform_result
  3365. ;;
  3366. esac
  3367. case $libobj in
  3368. *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;;
  3369. *)
  3370. func_fatal_error "cannot determine name of library object from '$libobj'"
  3371. ;;
  3372. esac
  3373. func_infer_tag $base_compile
  3374. for arg in $later; do
  3375. case $arg in
  3376. -shared)
  3377. test yes = "$build_libtool_libs" \
  3378. || func_fatal_configuration "cannot build a shared library"
  3379. build_old_libs=no
  3380. continue
  3381. ;;
  3382. -static)
  3383. build_libtool_libs=no
  3384. build_old_libs=yes
  3385. continue
  3386. ;;
  3387. -prefer-pic)
  3388. pic_mode=yes
  3389. continue
  3390. ;;
  3391. -prefer-non-pic)
  3392. pic_mode=no
  3393. continue
  3394. ;;
  3395. esac
  3396. done
  3397. func_quote_arg pretty "$libobj"
  3398. test "X$libobj" != "X$func_quote_arg_result" \
  3399. && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \
  3400. && func_warning "libobj name '$libobj' may not contain shell special characters."
  3401. func_dirname_and_basename "$obj" "/" ""
  3402. objname=$func_basename_result
  3403. xdir=$func_dirname_result
  3404. lobj=$xdir$objdir/$objname
  3405. test -z "$base_compile" && \
  3406. func_fatal_help "you must specify a compilation command"
  3407. # Delete any leftover library objects.
  3408. if test yes = "$build_old_libs"; then
  3409. removelist="$obj $lobj $libobj ${libobj}T"
  3410. else
  3411. removelist="$lobj $libobj ${libobj}T"
  3412. fi
  3413. # On Cygwin there's no "real" PIC flag so we must build both object types
  3414. case $host_os in
  3415. cygwin* | mingw* | pw32* | os2* | cegcc*)
  3416. pic_mode=default
  3417. ;;
  3418. esac
  3419. if test no = "$pic_mode" && test pass_all != "$deplibs_check_method"; then
  3420. # non-PIC code in shared libraries is not supported
  3421. pic_mode=default
  3422. fi
  3423. # Calculate the filename of the output object if compiler does
  3424. # not support -o with -c
  3425. if test no = "$compiler_c_o"; then
  3426. output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.$objext
  3427. lockfile=$output_obj.lock
  3428. else
  3429. output_obj=
  3430. need_locks=no
  3431. lockfile=
  3432. fi
  3433. # Lock this critical section if it is needed
  3434. # We use this script file to make the link, it avoids creating a new file
  3435. if test yes = "$need_locks"; then
  3436. until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
  3437. func_echo "Waiting for $lockfile to be removed"
  3438. sleep 2
  3439. done
  3440. elif test warn = "$need_locks"; then
  3441. if test -f "$lockfile"; then
  3442. $ECHO "\
  3443. *** ERROR, $lockfile exists and contains:
  3444. `cat $lockfile 2>/dev/null`
  3445. This indicates that another process is trying to use the same
  3446. temporary object file, and libtool could not work around it because
  3447. your compiler does not support '-c' and '-o' together. If you
  3448. repeat this compilation, it may succeed, by chance, but you had better
  3449. avoid parallel builds (make -j) in this platform, or get a better
  3450. compiler."
  3451. $opt_dry_run || $RM $removelist
  3452. exit $EXIT_FAILURE
  3453. fi
  3454. func_append removelist " $output_obj"
  3455. $ECHO "$srcfile" > "$lockfile"
  3456. fi
  3457. $opt_dry_run || $RM $removelist
  3458. func_append removelist " $lockfile"
  3459. trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15
  3460. func_to_tool_file "$srcfile" func_convert_file_msys_to_w32
  3461. srcfile=$func_to_tool_file_result
  3462. func_quote_arg pretty "$srcfile"
  3463. qsrcfile=$func_quote_arg_result
  3464. # Only build a PIC object if we are building libtool libraries.
  3465. if test yes = "$build_libtool_libs"; then
  3466. # Without this assignment, base_compile gets emptied.
  3467. fbsd_hideous_sh_bug=$base_compile
  3468. if test no != "$pic_mode"; then
  3469. command="$base_compile $qsrcfile $pic_flag"
  3470. else
  3471. # Don't build PIC code
  3472. command="$base_compile $qsrcfile"
  3473. fi
  3474. func_mkdir_p "$xdir$objdir"
  3475. if test -z "$output_obj"; then
  3476. # Place PIC objects in $objdir
  3477. func_append command " -o $lobj"
  3478. fi
  3479. func_show_eval_locale "$command" \
  3480. 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE'
  3481. if test warn = "$need_locks" &&
  3482. test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
  3483. $ECHO "\
  3484. *** ERROR, $lockfile contains:
  3485. `cat $lockfile 2>/dev/null`
  3486. but it should contain:
  3487. $srcfile
  3488. This indicates that another process is trying to use the same
  3489. temporary object file, and libtool could not work around it because
  3490. your compiler does not support '-c' and '-o' together. If you
  3491. repeat this compilation, it may succeed, by chance, but you had better
  3492. avoid parallel builds (make -j) in this platform, or get a better
  3493. compiler."
  3494. $opt_dry_run || $RM $removelist
  3495. exit $EXIT_FAILURE
  3496. fi
  3497. # Just move the object if needed, then go on to compile the next one
  3498. if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
  3499. func_show_eval '$MV "$output_obj" "$lobj"' \
  3500. 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
  3501. fi
  3502. # Allow error messages only from the first compilation.
  3503. if test yes = "$suppress_opt"; then
  3504. suppress_output=' >/dev/null 2>&1'
  3505. fi
  3506. fi
  3507. # Only build a position-dependent object if we build old libraries.
  3508. if test yes = "$build_old_libs"; then
  3509. if test yes != "$pic_mode"; then
  3510. # Don't build PIC code
  3511. command="$base_compile $qsrcfile$pie_flag"
  3512. else
  3513. command="$base_compile $qsrcfile $pic_flag"
  3514. fi
  3515. if test yes = "$compiler_c_o"; then
  3516. func_append command " -o $obj"
  3517. fi
  3518. # Suppress compiler output if we already did a PIC compilation.
  3519. func_append command "$suppress_output"
  3520. func_show_eval_locale "$command" \
  3521. '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE'
  3522. if test warn = "$need_locks" &&
  3523. test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
  3524. $ECHO "\
  3525. *** ERROR, $lockfile contains:
  3526. `cat $lockfile 2>/dev/null`
  3527. but it should contain:
  3528. $srcfile
  3529. This indicates that another process is trying to use the same
  3530. temporary object file, and libtool could not work around it because
  3531. your compiler does not support '-c' and '-o' together. If you
  3532. repeat this compilation, it may succeed, by chance, but you had better
  3533. avoid parallel builds (make -j) in this platform, or get a better
  3534. compiler."
  3535. $opt_dry_run || $RM $removelist
  3536. exit $EXIT_FAILURE
  3537. fi
  3538. # Just move the object if needed
  3539. if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
  3540. func_show_eval '$MV "$output_obj" "$obj"' \
  3541. 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
  3542. fi
  3543. fi
  3544. $opt_dry_run || {
  3545. func_write_libtool_object "$libobj" "$objdir/$objname" "$objname"
  3546. # Unlock the critical section if it was locked
  3547. if test no != "$need_locks"; then
  3548. removelist=$lockfile
  3549. $RM "$lockfile"
  3550. fi
  3551. }
  3552. exit $EXIT_SUCCESS
  3553. }
  3554. $opt_help || {
  3555. test compile = "$opt_mode" && func_mode_compile ${1+"$@"}
  3556. }
  3557. func_mode_help ()
  3558. {
  3559. # We need to display help for each of the modes.
  3560. case $opt_mode in
  3561. "")
  3562. # Generic help is extracted from the usage comments
  3563. # at the start of this file.
  3564. func_help
  3565. ;;
  3566. clean)
  3567. $ECHO \
  3568. "Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
  3569. Remove files from the build directory.
  3570. RM is the name of the program to use to delete files associated with each FILE
  3571. (typically '/bin/rm'). RM-OPTIONS are options (such as '-f') to be passed
  3572. to RM.
  3573. If FILE is a libtool library, object or program, all the files associated
  3574. with it are deleted. Otherwise, only FILE itself is deleted using RM."
  3575. ;;
  3576. compile)
  3577. $ECHO \
  3578. "Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
  3579. Compile a source file into a libtool library object.
  3580. This mode accepts the following additional options:
  3581. -o OUTPUT-FILE set the output file name to OUTPUT-FILE
  3582. -no-suppress do not suppress compiler output for multiple passes
  3583. -prefer-pic try to build PIC objects only
  3584. -prefer-non-pic try to build non-PIC objects only
  3585. -shared do not build a '.o' file suitable for static linking
  3586. -static only build a '.o' file suitable for static linking
  3587. -Wc,FLAG pass FLAG directly to the compiler
  3588. COMPILE-COMMAND is a command to be used in creating a 'standard' object file
  3589. from the given SOURCEFILE.
  3590. The output file name is determined by removing the directory component from
  3591. SOURCEFILE, then substituting the C source code suffix '.c' with the
  3592. library object suffix, '.lo'."
  3593. ;;
  3594. execute)
  3595. $ECHO \
  3596. "Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]...
  3597. Automatically set library path, then run a program.
  3598. This mode accepts the following additional options:
  3599. -dlopen FILE add the directory containing FILE to the library path
  3600. This mode sets the library path environment variable according to '-dlopen'
  3601. flags.
  3602. If any of the ARGS are libtool executable wrappers, then they are translated
  3603. into their corresponding uninstalled binary, and any of their required library
  3604. directories are added to the library path.
  3605. Then, COMMAND is executed, with ARGS as arguments."
  3606. ;;
  3607. finish)
  3608. $ECHO \
  3609. "Usage: $progname [OPTION]... --mode=finish [LIBDIR]...
  3610. Complete the installation of libtool libraries.
  3611. Each LIBDIR is a directory that contains libtool libraries.
  3612. The commands that this mode executes may require superuser privileges. Use
  3613. the '--dry-run' option if you just want to see what would be executed."
  3614. ;;
  3615. install)
  3616. $ECHO \
  3617. "Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND...
  3618. Install executables or libraries.
  3619. INSTALL-COMMAND is the installation command. The first component should be
  3620. either the 'install' or 'cp' program.
  3621. The following components of INSTALL-COMMAND are treated specially:
  3622. -inst-prefix-dir PREFIX-DIR Use PREFIX-DIR as a staging area for installation
  3623. The rest of the components are interpreted as arguments to that command (only
  3624. BSD-compatible install options are recognized)."
  3625. ;;
  3626. link)
  3627. $ECHO \
  3628. "Usage: $progname [OPTION]... --mode=link LINK-COMMAND...
  3629. Link object files or libraries together to form another library, or to
  3630. create an executable program.
  3631. LINK-COMMAND is a command using the C compiler that you would use to create
  3632. a program from several object files.
  3633. The following components of LINK-COMMAND are treated specially:
  3634. -all-static do not do any dynamic linking at all
  3635. -avoid-version do not add a version suffix if possible
  3636. -bindir BINDIR specify path to binaries directory (for systems where
  3637. libraries must be found in the PATH setting at runtime)
  3638. -dlopen FILE '-dlpreopen' FILE if it cannot be dlopened at runtime
  3639. -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
  3640. -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
  3641. -export-symbols SYMFILE
  3642. try to export only the symbols listed in SYMFILE
  3643. -export-symbols-regex REGEX
  3644. try to export only the symbols matching REGEX
  3645. -LLIBDIR search LIBDIR for required installed libraries
  3646. -lNAME OUTPUT-FILE requires the installed library libNAME
  3647. -module build a library that can dlopened
  3648. -no-fast-install disable the fast-install mode
  3649. -no-install link a not-installable executable
  3650. -no-undefined declare that a library does not refer to external symbols
  3651. -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
  3652. -objectlist FILE use a list of object files found in FILE to specify objects
  3653. -os2dllname NAME force a short DLL name on OS/2 (no effect on other OSes)
  3654. -precious-files-regex REGEX
  3655. don't remove output files matching REGEX
  3656. -release RELEASE specify package release information
  3657. -rpath LIBDIR the created library will eventually be installed in LIBDIR
  3658. -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
  3659. -shared only do dynamic linking of libtool libraries
  3660. -shrext SUFFIX override the standard shared library file extension
  3661. -static do not do any dynamic linking of uninstalled libtool libraries
  3662. -static-libtool-libs
  3663. do not do any dynamic linking of libtool libraries
  3664. -version-info CURRENT[:REVISION[:AGE]]
  3665. specify library version info [each variable defaults to 0]
  3666. -weak LIBNAME declare that the target provides the LIBNAME interface
  3667. -Wc,FLAG
  3668. -Xcompiler FLAG pass linker-specific FLAG directly to the compiler
  3669. -Wl,FLAG
  3670. -Xlinker FLAG pass linker-specific FLAG directly to the linker
  3671. -XCClinker FLAG pass link-specific FLAG to the compiler driver (CC)
  3672. All other options (arguments beginning with '-') are ignored.
  3673. Every other argument is treated as a filename. Files ending in '.la' are
  3674. treated as uninstalled libtool libraries, other files are standard or library
  3675. object files.
  3676. If the OUTPUT-FILE ends in '.la', then a libtool library is created,
  3677. only library objects ('.lo' files) may be specified, and '-rpath' is
  3678. required, except when creating a convenience library.
  3679. If OUTPUT-FILE ends in '.a' or '.lib', then a standard library is created
  3680. using 'ar' and 'ranlib', or on Windows using 'lib'.
  3681. If OUTPUT-FILE ends in '.lo' or '.$objext', then a reloadable object file
  3682. is created, otherwise an executable program is created."
  3683. ;;
  3684. uninstall)
  3685. $ECHO \
  3686. "Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
  3687. Remove libraries from an installation directory.
  3688. RM is the name of the program to use to delete files associated with each FILE
  3689. (typically '/bin/rm'). RM-OPTIONS are options (such as '-f') to be passed
  3690. to RM.
  3691. If FILE is a libtool library, all the files associated with it are deleted.
  3692. Otherwise, only FILE itself is deleted using RM."
  3693. ;;
  3694. *)
  3695. func_fatal_help "invalid operation mode '$opt_mode'"
  3696. ;;
  3697. esac
  3698. echo
  3699. $ECHO "Try '$progname --help' for more information about other modes."
  3700. }
  3701. # Now that we've collected a possible --mode arg, show help if necessary
  3702. if $opt_help; then
  3703. if test : = "$opt_help"; then
  3704. func_mode_help
  3705. else
  3706. {
  3707. func_help noexit
  3708. for opt_mode in compile link execute install finish uninstall clean; do
  3709. func_mode_help
  3710. done
  3711. } | $SED -n '1p; 2,$s/^Usage:/ or: /p'
  3712. {
  3713. func_help noexit
  3714. for opt_mode in compile link execute install finish uninstall clean; do
  3715. echo
  3716. func_mode_help
  3717. done
  3718. } |
  3719. $SED '1d
  3720. /^When reporting/,/^Report/{
  3721. H
  3722. d
  3723. }
  3724. $x
  3725. /information about other modes/d
  3726. /more detailed .*MODE/d
  3727. s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/'
  3728. fi
  3729. exit $?
  3730. fi
  3731. # func_mode_execute arg...
  3732. func_mode_execute ()
  3733. {
  3734. $debug_cmd
  3735. # The first argument is the command name.
  3736. cmd=$nonopt
  3737. test -z "$cmd" && \
  3738. func_fatal_help "you must specify a COMMAND"
  3739. # Handle -dlopen flags immediately.
  3740. for file in $opt_dlopen; do
  3741. test -f "$file" \
  3742. || func_fatal_help "'$file' is not a file"
  3743. dir=
  3744. case $file in
  3745. *.la)
  3746. func_resolve_sysroot "$file"
  3747. file=$func_resolve_sysroot_result
  3748. # Check to see that this really is a libtool archive.
  3749. func_lalib_unsafe_p "$file" \
  3750. || func_fatal_help "'$lib' is not a valid libtool archive"
  3751. # Read the libtool library.
  3752. dlname=
  3753. library_names=
  3754. func_source "$file"
  3755. # Skip this library if it cannot be dlopened.
  3756. if test -z "$dlname"; then
  3757. # Warn if it was a shared library.
  3758. test -n "$library_names" && \
  3759. func_warning "'$file' was not linked with '-export-dynamic'"
  3760. continue
  3761. fi
  3762. func_dirname "$file" "" "."
  3763. dir=$func_dirname_result
  3764. if test -f "$dir/$objdir/$dlname"; then
  3765. func_append dir "/$objdir"
  3766. else
  3767. if test ! -f "$dir/$dlname"; then
  3768. func_fatal_error "cannot find '$dlname' in '$dir' or '$dir/$objdir'"
  3769. fi
  3770. fi
  3771. ;;
  3772. *.lo)
  3773. # Just add the directory containing the .lo file.
  3774. func_dirname "$file" "" "."
  3775. dir=$func_dirname_result
  3776. ;;
  3777. *)
  3778. func_warning "'-dlopen' is ignored for non-libtool libraries and objects"
  3779. continue
  3780. ;;
  3781. esac
  3782. # Get the absolute pathname.
  3783. absdir=`cd "$dir" && pwd`
  3784. test -n "$absdir" && dir=$absdir
  3785. # Now add the directory to shlibpath_var.
  3786. if eval "test -z \"\$$shlibpath_var\""; then
  3787. eval "$shlibpath_var=\"\$dir\""
  3788. else
  3789. eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
  3790. fi
  3791. done
  3792. # This variable tells wrapper scripts just to set shlibpath_var
  3793. # rather than running their programs.
  3794. libtool_execute_magic=$magic
  3795. # Check if any of the arguments is a wrapper script.
  3796. args=
  3797. for file
  3798. do
  3799. case $file in
  3800. -* | *.la | *.lo ) ;;
  3801. *)
  3802. # Do a test to see if this is really a libtool program.
  3803. if func_ltwrapper_script_p "$file"; then
  3804. func_source "$file"
  3805. # Transform arg to wrapped name.
  3806. file=$progdir/$program
  3807. elif func_ltwrapper_executable_p "$file"; then
  3808. func_ltwrapper_scriptname "$file"
  3809. func_source "$func_ltwrapper_scriptname_result"
  3810. # Transform arg to wrapped name.
  3811. file=$progdir/$program
  3812. fi
  3813. ;;
  3814. esac
  3815. # Quote arguments (to preserve shell metacharacters).
  3816. func_append_quoted args "$file"
  3817. done
  3818. if $opt_dry_run; then
  3819. # Display what would be done.
  3820. if test -n "$shlibpath_var"; then
  3821. eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\""
  3822. echo "export $shlibpath_var"
  3823. fi
  3824. $ECHO "$cmd$args"
  3825. exit $EXIT_SUCCESS
  3826. else
  3827. if test -n "$shlibpath_var"; then
  3828. # Export the shlibpath_var.
  3829. eval "export $shlibpath_var"
  3830. fi
  3831. # Restore saved environment variables
  3832. for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
  3833. do
  3834. eval "if test \"\${save_$lt_var+set}\" = set; then
  3835. $lt_var=\$save_$lt_var; export $lt_var
  3836. else
  3837. $lt_unset $lt_var
  3838. fi"
  3839. done
  3840. # Now prepare to actually exec the command.
  3841. exec_cmd=\$cmd$args
  3842. fi
  3843. }
  3844. test execute = "$opt_mode" && func_mode_execute ${1+"$@"}
  3845. # func_mode_finish arg...
  3846. func_mode_finish ()
  3847. {
  3848. $debug_cmd
  3849. libs=
  3850. libdirs=
  3851. admincmds=
  3852. for opt in "$nonopt" ${1+"$@"}
  3853. do
  3854. if test -d "$opt"; then
  3855. func_append libdirs " $opt"
  3856. elif test -f "$opt"; then
  3857. if func_lalib_unsafe_p "$opt"; then
  3858. func_append libs " $opt"
  3859. else
  3860. func_warning "'$opt' is not a valid libtool archive"
  3861. fi
  3862. else
  3863. func_fatal_error "invalid argument '$opt'"
  3864. fi
  3865. done
  3866. if test -n "$libs"; then
  3867. if test -n "$lt_sysroot"; then
  3868. sysroot_regex=`$ECHO "$lt_sysroot" | $SED "$sed_make_literal_regex"`
  3869. sysroot_cmd="s/\([ ']\)$sysroot_regex/\1/g;"
  3870. else
  3871. sysroot_cmd=
  3872. fi
  3873. # Remove sysroot references
  3874. if $opt_dry_run; then
  3875. for lib in $libs; do
  3876. echo "removing references to $lt_sysroot and '=' prefixes from $lib"
  3877. done
  3878. else
  3879. tmpdir=`func_mktempdir`
  3880. for lib in $libs; do
  3881. $SED -e "$sysroot_cmd s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \
  3882. > $tmpdir/tmp-la
  3883. mv -f $tmpdir/tmp-la $lib
  3884. done
  3885. ${RM}r "$tmpdir"
  3886. fi
  3887. fi
  3888. if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
  3889. for libdir in $libdirs; do
  3890. if test -n "$finish_cmds"; then
  3891. # Do each command in the finish commands.
  3892. func_execute_cmds "$finish_cmds" 'admincmds="$admincmds
  3893. '"$cmd"'"'
  3894. fi
  3895. if test -n "$finish_eval"; then
  3896. # Do the single finish_eval.
  3897. eval cmds=\"$finish_eval\"
  3898. $opt_dry_run || eval "$cmds" || func_append admincmds "
  3899. $cmds"
  3900. fi
  3901. done
  3902. fi
  3903. # Exit here if they wanted silent mode.
  3904. $opt_quiet && exit $EXIT_SUCCESS
  3905. if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
  3906. echo "----------------------------------------------------------------------"
  3907. echo "Libraries have been installed in:"
  3908. for libdir in $libdirs; do
  3909. $ECHO " $libdir"
  3910. done
  3911. echo
  3912. echo "If you ever happen to want to link against installed libraries"
  3913. echo "in a given directory, LIBDIR, you must either use libtool, and"
  3914. echo "specify the full pathname of the library, or use the '-LLIBDIR'"
  3915. echo "flag during linking and do at least one of the following:"
  3916. if test -n "$shlibpath_var"; then
  3917. echo " - add LIBDIR to the '$shlibpath_var' environment variable"
  3918. echo " during execution"
  3919. fi
  3920. if test -n "$runpath_var"; then
  3921. echo " - add LIBDIR to the '$runpath_var' environment variable"
  3922. echo " during linking"
  3923. fi
  3924. if test -n "$hardcode_libdir_flag_spec"; then
  3925. libdir=LIBDIR
  3926. eval flag=\"$hardcode_libdir_flag_spec\"
  3927. $ECHO " - use the '$flag' linker flag"
  3928. fi
  3929. if test -n "$admincmds"; then
  3930. $ECHO " - have your system administrator run these commands:$admincmds"
  3931. fi
  3932. if test -f /etc/ld.so.conf; then
  3933. echo " - have your system administrator add LIBDIR to '/etc/ld.so.conf'"
  3934. fi
  3935. echo
  3936. echo "See any operating system documentation about shared libraries for"
  3937. case $host in
  3938. solaris2.[6789]|solaris2.1[0-9])
  3939. echo "more information, such as the ld(1), crle(1) and ld.so(8) manual"
  3940. echo "pages."
  3941. ;;
  3942. *)
  3943. echo "more information, such as the ld(1) and ld.so(8) manual pages."
  3944. ;;
  3945. esac
  3946. echo "----------------------------------------------------------------------"
  3947. fi
  3948. exit $EXIT_SUCCESS
  3949. }
  3950. test finish = "$opt_mode" && func_mode_finish ${1+"$@"}
  3951. # func_mode_install arg...
  3952. func_mode_install ()
  3953. {
  3954. $debug_cmd
  3955. # There may be an optional sh(1) argument at the beginning of
  3956. # install_prog (especially on Windows NT).
  3957. if test "$SHELL" = "$nonopt" || test /bin/sh = "$nonopt" ||
  3958. # Allow the use of GNU shtool's install command.
  3959. case $nonopt in *shtool*) :;; *) false;; esac
  3960. then
  3961. # Aesthetically quote it.
  3962. func_quote_arg pretty "$nonopt"
  3963. install_prog="$func_quote_arg_result "
  3964. arg=$1
  3965. shift
  3966. else
  3967. install_prog=
  3968. arg=$nonopt
  3969. fi
  3970. # The real first argument should be the name of the installation program.
  3971. # Aesthetically quote it.
  3972. func_quote_arg pretty "$arg"
  3973. func_append install_prog "$func_quote_arg_result"
  3974. install_shared_prog=$install_prog
  3975. case " $install_prog " in
  3976. *[\\\ /]cp\ *) install_cp=: ;;
  3977. *) install_cp=false ;;
  3978. esac
  3979. # We need to accept at least all the BSD install flags.
  3980. dest=
  3981. files=
  3982. opts=
  3983. prev=
  3984. install_type=
  3985. isdir=false
  3986. stripme=
  3987. no_mode=:
  3988. for arg
  3989. do
  3990. arg2=
  3991. if test -n "$dest"; then
  3992. func_append files " $dest"
  3993. dest=$arg
  3994. continue
  3995. fi
  3996. case $arg in
  3997. -d) isdir=: ;;
  3998. -f)
  3999. if $install_cp; then :; else
  4000. prev=$arg
  4001. fi
  4002. ;;
  4003. -g | -m | -o)
  4004. prev=$arg
  4005. ;;
  4006. -s)
  4007. stripme=" -s"
  4008. continue
  4009. ;;
  4010. -*)
  4011. ;;
  4012. *)
  4013. # If the previous option needed an argument, then skip it.
  4014. if test -n "$prev"; then
  4015. if test X-m = "X$prev" && test -n "$install_override_mode"; then
  4016. arg2=$install_override_mode
  4017. no_mode=false
  4018. fi
  4019. prev=
  4020. else
  4021. dest=$arg
  4022. continue
  4023. fi
  4024. ;;
  4025. esac
  4026. # Aesthetically quote the argument.
  4027. func_quote_arg pretty "$arg"
  4028. func_append install_prog " $func_quote_arg_result"
  4029. if test -n "$arg2"; then
  4030. func_quote_arg pretty "$arg2"
  4031. fi
  4032. func_append install_shared_prog " $func_quote_arg_result"
  4033. done
  4034. test -z "$install_prog" && \
  4035. func_fatal_help "you must specify an install program"
  4036. test -n "$prev" && \
  4037. func_fatal_help "the '$prev' option requires an argument"
  4038. if test -n "$install_override_mode" && $no_mode; then
  4039. if $install_cp; then :; else
  4040. func_quote_arg pretty "$install_override_mode"
  4041. func_append install_shared_prog " -m $func_quote_arg_result"
  4042. fi
  4043. fi
  4044. if test -z "$files"; then
  4045. if test -z "$dest"; then
  4046. func_fatal_help "no file or destination specified"
  4047. else
  4048. func_fatal_help "you must specify a destination"
  4049. fi
  4050. fi
  4051. # Strip any trailing slash from the destination.
  4052. func_stripname '' '/' "$dest"
  4053. dest=$func_stripname_result
  4054. # Check to see that the destination is a directory.
  4055. test -d "$dest" && isdir=:
  4056. if $isdir; then
  4057. destdir=$dest
  4058. destname=
  4059. else
  4060. func_dirname_and_basename "$dest" "" "."
  4061. destdir=$func_dirname_result
  4062. destname=$func_basename_result
  4063. # Not a directory, so check to see that there is only one file specified.
  4064. set dummy $files; shift
  4065. test "$#" -gt 1 && \
  4066. func_fatal_help "'$dest' is not a directory"
  4067. fi
  4068. case $destdir in
  4069. [\\/]* | [A-Za-z]:[\\/]*) ;;
  4070. *)
  4071. for file in $files; do
  4072. case $file in
  4073. *.lo) ;;
  4074. *)
  4075. func_fatal_help "'$destdir' must be an absolute directory name"
  4076. ;;
  4077. esac
  4078. done
  4079. ;;
  4080. esac
  4081. # This variable tells wrapper scripts just to set variables rather
  4082. # than running their programs.
  4083. libtool_install_magic=$magic
  4084. staticlibs=
  4085. future_libdirs=
  4086. current_libdirs=
  4087. for file in $files; do
  4088. # Do each installation.
  4089. case $file in
  4090. *.$libext)
  4091. # Do the static libraries later.
  4092. func_append staticlibs " $file"
  4093. ;;
  4094. *.la)
  4095. func_resolve_sysroot "$file"
  4096. file=$func_resolve_sysroot_result
  4097. # Check to see that this really is a libtool archive.
  4098. func_lalib_unsafe_p "$file" \
  4099. || func_fatal_help "'$file' is not a valid libtool archive"
  4100. library_names=
  4101. old_library=
  4102. relink_command=
  4103. func_source "$file"
  4104. # Add the libdir to current_libdirs if it is the destination.
  4105. if test "X$destdir" = "X$libdir"; then
  4106. case "$current_libdirs " in
  4107. *" $libdir "*) ;;
  4108. *) func_append current_libdirs " $libdir" ;;
  4109. esac
  4110. else
  4111. # Note the libdir as a future libdir.
  4112. case "$future_libdirs " in
  4113. *" $libdir "*) ;;
  4114. *) func_append future_libdirs " $libdir" ;;
  4115. esac
  4116. fi
  4117. func_dirname "$file" "/" ""
  4118. dir=$func_dirname_result
  4119. func_append dir "$objdir"
  4120. if test -n "$relink_command"; then
  4121. # Determine the prefix the user has applied to our future dir.
  4122. inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"`
  4123. # Don't allow the user to place us outside of our expected
  4124. # location b/c this prevents finding dependent libraries that
  4125. # are installed to the same prefix.
  4126. # At present, this check doesn't affect windows .dll's that
  4127. # are installed into $libdir/../bin (currently, that works fine)
  4128. # but it's something to keep an eye on.
  4129. test "$inst_prefix_dir" = "$destdir" && \
  4130. func_fatal_error "error: cannot install '$file' to a directory not ending in $libdir"
  4131. if test -n "$inst_prefix_dir"; then
  4132. # Stick the inst_prefix_dir data into the link command.
  4133. relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
  4134. else
  4135. relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"`
  4136. fi
  4137. func_warning "relinking '$file'"
  4138. func_show_eval "$relink_command" \
  4139. 'func_fatal_error "error: relink '\''$file'\'' with the above command before installing it"'
  4140. fi
  4141. # See the names of the shared library.
  4142. set dummy $library_names; shift
  4143. if test -n "$1"; then
  4144. realname=$1
  4145. shift
  4146. srcname=$realname
  4147. test -n "$relink_command" && srcname=${realname}T
  4148. # Install the shared library and build the symlinks.
  4149. func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \
  4150. 'exit $?'
  4151. tstripme=$stripme
  4152. case $host_os in
  4153. cygwin* | mingw* | pw32* | cegcc*)
  4154. case $realname in
  4155. *.dll.a)
  4156. tstripme=
  4157. ;;
  4158. esac
  4159. ;;
  4160. os2*)
  4161. case $realname in
  4162. *_dll.a)
  4163. tstripme=
  4164. ;;
  4165. esac
  4166. ;;
  4167. esac
  4168. if test -n "$tstripme" && test -n "$striplib"; then
  4169. func_show_eval "$striplib $destdir/$realname" 'exit $?'
  4170. fi
  4171. if test "$#" -gt 0; then
  4172. # Delete the old symlinks, and create new ones.
  4173. # Try 'ln -sf' first, because the 'ln' binary might depend on
  4174. # the symlink we replace! Solaris /bin/ln does not understand -f,
  4175. # so we also need to try rm && ln -s.
  4176. for linkname
  4177. do
  4178. test "$linkname" != "$realname" \
  4179. && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })"
  4180. done
  4181. fi
  4182. # Do each command in the postinstall commands.
  4183. lib=$destdir/$realname
  4184. func_execute_cmds "$postinstall_cmds" 'exit $?'
  4185. fi
  4186. # Install the pseudo-library for information purposes.
  4187. func_basename "$file"
  4188. name=$func_basename_result
  4189. instname=$dir/${name}i
  4190. func_show_eval "$install_prog $instname $destdir/$name" 'exit $?'
  4191. # Maybe install the static library, too.
  4192. test -n "$old_library" && func_append staticlibs " $dir/$old_library"
  4193. ;;
  4194. *.lo)
  4195. # Install (i.e. copy) a libtool object.
  4196. # Figure out destination file name, if it wasn't already specified.
  4197. if test -n "$destname"; then
  4198. destfile=$destdir/$destname
  4199. else
  4200. func_basename "$file"
  4201. destfile=$func_basename_result
  4202. destfile=$destdir/$destfile
  4203. fi
  4204. # Deduce the name of the destination old-style object file.
  4205. case $destfile in
  4206. *.lo)
  4207. func_lo2o "$destfile"
  4208. staticdest=$func_lo2o_result
  4209. ;;
  4210. *.$objext)
  4211. staticdest=$destfile
  4212. destfile=
  4213. ;;
  4214. *)
  4215. func_fatal_help "cannot copy a libtool object to '$destfile'"
  4216. ;;
  4217. esac
  4218. # Install the libtool object if requested.
  4219. test -n "$destfile" && \
  4220. func_show_eval "$install_prog $file $destfile" 'exit $?'
  4221. # Install the old object if enabled.
  4222. if test yes = "$build_old_libs"; then
  4223. # Deduce the name of the old-style object file.
  4224. func_lo2o "$file"
  4225. staticobj=$func_lo2o_result
  4226. func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?'
  4227. fi
  4228. exit $EXIT_SUCCESS
  4229. ;;
  4230. *)
  4231. # Figure out destination file name, if it wasn't already specified.
  4232. if test -n "$destname"; then
  4233. destfile=$destdir/$destname
  4234. else
  4235. func_basename "$file"
  4236. destfile=$func_basename_result
  4237. destfile=$destdir/$destfile
  4238. fi
  4239. # If the file is missing, and there is a .exe on the end, strip it
  4240. # because it is most likely a libtool script we actually want to
  4241. # install
  4242. stripped_ext=
  4243. case $file in
  4244. *.exe)
  4245. if test ! -f "$file"; then
  4246. func_stripname '' '.exe' "$file"
  4247. file=$func_stripname_result
  4248. stripped_ext=.exe
  4249. fi
  4250. ;;
  4251. esac
  4252. # Do a test to see if this is really a libtool program.
  4253. case $host in
  4254. *cygwin* | *mingw*)
  4255. if func_ltwrapper_executable_p "$file"; then
  4256. func_ltwrapper_scriptname "$file"
  4257. wrapper=$func_ltwrapper_scriptname_result
  4258. else
  4259. func_stripname '' '.exe' "$file"
  4260. wrapper=$func_stripname_result
  4261. fi
  4262. ;;
  4263. *)
  4264. wrapper=$file
  4265. ;;
  4266. esac
  4267. if func_ltwrapper_script_p "$wrapper"; then
  4268. notinst_deplibs=
  4269. relink_command=
  4270. func_source "$wrapper"
  4271. # Check the variables that should have been set.
  4272. test -z "$generated_by_libtool_version" && \
  4273. func_fatal_error "invalid libtool wrapper script '$wrapper'"
  4274. finalize=:
  4275. for lib in $notinst_deplibs; do
  4276. # Check to see that each library is installed.
  4277. libdir=
  4278. if test -f "$lib"; then
  4279. func_source "$lib"
  4280. fi
  4281. libfile=$libdir/`$ECHO "$lib" | $SED 's%^.*/%%g'`
  4282. if test -n "$libdir" && test ! -f "$libfile"; then
  4283. func_warning "'$lib' has not been installed in '$libdir'"
  4284. finalize=false
  4285. fi
  4286. done
  4287. relink_command=
  4288. func_source "$wrapper"
  4289. outputname=
  4290. if test no = "$fast_install" && test -n "$relink_command"; then
  4291. $opt_dry_run || {
  4292. if $finalize; then
  4293. tmpdir=`func_mktempdir`
  4294. func_basename "$file$stripped_ext"
  4295. file=$func_basename_result
  4296. outputname=$tmpdir/$file
  4297. # Replace the output file specification.
  4298. relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'`
  4299. $opt_quiet || {
  4300. func_quote_arg expand,pretty "$relink_command"
  4301. eval "func_echo $func_quote_arg_result"
  4302. }
  4303. if eval "$relink_command"; then :
  4304. else
  4305. func_error "error: relink '$file' with the above command before installing it"
  4306. $opt_dry_run || ${RM}r "$tmpdir"
  4307. continue
  4308. fi
  4309. file=$outputname
  4310. else
  4311. func_warning "cannot relink '$file'"
  4312. fi
  4313. }
  4314. else
  4315. # Install the binary that we compiled earlier.
  4316. file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"`
  4317. fi
  4318. fi
  4319. # remove .exe since cygwin /usr/bin/install will append another
  4320. # one anyway
  4321. case $install_prog,$host in
  4322. */usr/bin/install*,*cygwin*)
  4323. case $file:$destfile in
  4324. *.exe:*.exe)
  4325. # this is ok
  4326. ;;
  4327. *.exe:*)
  4328. destfile=$destfile.exe
  4329. ;;
  4330. *:*.exe)
  4331. func_stripname '' '.exe' "$destfile"
  4332. destfile=$func_stripname_result
  4333. ;;
  4334. esac
  4335. ;;
  4336. esac
  4337. func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?'
  4338. $opt_dry_run || if test -n "$outputname"; then
  4339. ${RM}r "$tmpdir"
  4340. fi
  4341. ;;
  4342. esac
  4343. done
  4344. for file in $staticlibs; do
  4345. func_basename "$file"
  4346. name=$func_basename_result
  4347. # Set up the ranlib parameters.
  4348. oldlib=$destdir/$name
  4349. func_to_tool_file "$oldlib" func_convert_file_msys_to_w32
  4350. tool_oldlib=$func_to_tool_file_result
  4351. func_show_eval "$install_prog \$file \$oldlib" 'exit $?'
  4352. if test -n "$stripme" && test -n "$old_striplib"; then
  4353. func_show_eval "$old_striplib $tool_oldlib" 'exit $?'
  4354. fi
  4355. # Do each command in the postinstall commands.
  4356. func_execute_cmds "$old_postinstall_cmds" 'exit $?'
  4357. done
  4358. test -n "$future_libdirs" && \
  4359. func_warning "remember to run '$progname --finish$future_libdirs'"
  4360. if test -n "$current_libdirs"; then
  4361. # Maybe just do a dry run.
  4362. $opt_dry_run && current_libdirs=" -n$current_libdirs"
  4363. exec_cmd='$SHELL "$progpath" $preserve_args --finish$current_libdirs'
  4364. else
  4365. exit $EXIT_SUCCESS
  4366. fi
  4367. }
  4368. test install = "$opt_mode" && func_mode_install ${1+"$@"}
  4369. # func_generate_dlsyms outputname originator pic_p
  4370. # Extract symbols from dlprefiles and create ${outputname}S.o with
  4371. # a dlpreopen symbol table.
  4372. func_generate_dlsyms ()
  4373. {
  4374. $debug_cmd
  4375. my_outputname=$1
  4376. my_originator=$2
  4377. my_pic_p=${3-false}
  4378. my_prefix=`$ECHO "$my_originator" | $SED 's%[^a-zA-Z0-9]%_%g'`
  4379. my_dlsyms=
  4380. if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then
  4381. if test -n "$NM" && test -n "$global_symbol_pipe"; then
  4382. my_dlsyms=${my_outputname}S.c
  4383. else
  4384. func_error "not configured to extract global symbols from dlpreopened files"
  4385. fi
  4386. fi
  4387. if test -n "$my_dlsyms"; then
  4388. case $my_dlsyms in
  4389. "") ;;
  4390. *.c)
  4391. # Discover the nlist of each of the dlfiles.
  4392. nlist=$output_objdir/$my_outputname.nm
  4393. func_show_eval "$RM $nlist ${nlist}S ${nlist}T"
  4394. # Parse the name list into a source file.
  4395. func_verbose "creating $output_objdir/$my_dlsyms"
  4396. $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\
  4397. /* $my_dlsyms - symbol resolution table for '$my_outputname' dlsym emulation. */
  4398. /* Generated by $PROGRAM (GNU $PACKAGE) $VERSION */
  4399. #ifdef __cplusplus
  4400. extern \"C\" {
  4401. #endif
  4402. #if defined __GNUC__ && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4))
  4403. #pragma GCC diagnostic ignored \"-Wstrict-prototypes\"
  4404. #endif
  4405. /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */
  4406. #if defined _WIN32 || defined __CYGWIN__ || defined _WIN32_WCE
  4407. /* DATA imports from DLLs on WIN32 can't be const, because runtime
  4408. relocations are performed -- see ld's documentation on pseudo-relocs. */
  4409. # define LT_DLSYM_CONST
  4410. #elif defined __osf__
  4411. /* This system does not cope well with relocations in const data. */
  4412. # define LT_DLSYM_CONST
  4413. #else
  4414. # define LT_DLSYM_CONST const
  4415. #endif
  4416. #define STREQ(s1, s2) (strcmp ((s1), (s2)) == 0)
  4417. /* External symbol declarations for the compiler. */\
  4418. "
  4419. if test yes = "$dlself"; then
  4420. func_verbose "generating symbol list for '$output'"
  4421. $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist"
  4422. # Add our own program objects to the symbol list.
  4423. progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP`
  4424. for progfile in $progfiles; do
  4425. func_to_tool_file "$progfile" func_convert_file_msys_to_w32
  4426. func_verbose "extracting global C symbols from '$func_to_tool_file_result'"
  4427. $opt_dry_run || eval "$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'"
  4428. done
  4429. if test -n "$exclude_expsyms"; then
  4430. $opt_dry_run || {
  4431. eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
  4432. eval '$MV "$nlist"T "$nlist"'
  4433. }
  4434. fi
  4435. if test -n "$export_symbols_regex"; then
  4436. $opt_dry_run || {
  4437. eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
  4438. eval '$MV "$nlist"T "$nlist"'
  4439. }
  4440. fi
  4441. # Prepare the list of exported symbols
  4442. if test -z "$export_symbols"; then
  4443. export_symbols=$output_objdir/$outputname.exp
  4444. $opt_dry_run || {
  4445. $RM $export_symbols
  4446. eval "$SED -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
  4447. case $host in
  4448. *cygwin* | *mingw* | *cegcc* )
  4449. eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
  4450. eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
  4451. ;;
  4452. esac
  4453. }
  4454. else
  4455. $opt_dry_run || {
  4456. eval "$SED -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
  4457. eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
  4458. eval '$MV "$nlist"T "$nlist"'
  4459. case $host in
  4460. *cygwin* | *mingw* | *cegcc* )
  4461. eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
  4462. eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
  4463. ;;
  4464. esac
  4465. }
  4466. fi
  4467. fi
  4468. for dlprefile in $dlprefiles; do
  4469. func_verbose "extracting global C symbols from '$dlprefile'"
  4470. func_basename "$dlprefile"
  4471. name=$func_basename_result
  4472. case $host in
  4473. *cygwin* | *mingw* | *cegcc* )
  4474. # if an import library, we need to obtain dlname
  4475. if func_win32_import_lib_p "$dlprefile"; then
  4476. func_tr_sh "$dlprefile"
  4477. eval "curr_lafile=\$libfile_$func_tr_sh_result"
  4478. dlprefile_dlbasename=
  4479. if test -n "$curr_lafile" && func_lalib_p "$curr_lafile"; then
  4480. # Use subshell, to avoid clobbering current variable values
  4481. dlprefile_dlname=`source "$curr_lafile" && echo "$dlname"`
  4482. if test -n "$dlprefile_dlname"; then
  4483. func_basename "$dlprefile_dlname"
  4484. dlprefile_dlbasename=$func_basename_result
  4485. else
  4486. # no lafile. user explicitly requested -dlpreopen <import library>.
  4487. $sharedlib_from_linklib_cmd "$dlprefile"
  4488. dlprefile_dlbasename=$sharedlib_from_linklib_result
  4489. fi
  4490. fi
  4491. $opt_dry_run || {
  4492. if test -n "$dlprefile_dlbasename"; then
  4493. eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"'
  4494. else
  4495. func_warning "Could not compute DLL name from $name"
  4496. eval '$ECHO ": $name " >> "$nlist"'
  4497. fi
  4498. func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
  4499. eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe |
  4500. $SED -e '/I __imp/d' -e 's/I __nm_/D /;s/_nm__//' >> '$nlist'"
  4501. }
  4502. else # not an import lib
  4503. $opt_dry_run || {
  4504. eval '$ECHO ": $name " >> "$nlist"'
  4505. func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
  4506. eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'"
  4507. }
  4508. fi
  4509. ;;
  4510. *)
  4511. $opt_dry_run || {
  4512. eval '$ECHO ": $name " >> "$nlist"'
  4513. func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
  4514. eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'"
  4515. }
  4516. ;;
  4517. esac
  4518. done
  4519. $opt_dry_run || {
  4520. # Make sure we have at least an empty file.
  4521. test -f "$nlist" || : > "$nlist"
  4522. if test -n "$exclude_expsyms"; then
  4523. $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
  4524. $MV "$nlist"T "$nlist"
  4525. fi
  4526. # Try sorting and uniquifying the output.
  4527. if $GREP -v "^: " < "$nlist" |
  4528. if sort -k 3 </dev/null >/dev/null 2>&1; then
  4529. sort -k 3
  4530. else
  4531. sort +2
  4532. fi |
  4533. uniq > "$nlist"S; then
  4534. :
  4535. else
  4536. $GREP -v "^: " < "$nlist" > "$nlist"S
  4537. fi
  4538. if test -f "$nlist"S; then
  4539. eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"'
  4540. else
  4541. echo '/* NONE */' >> "$output_objdir/$my_dlsyms"
  4542. fi
  4543. func_show_eval '$RM "${nlist}I"'
  4544. if test -n "$global_symbol_to_import"; then
  4545. eval "$global_symbol_to_import"' < "$nlist"S > "$nlist"I'
  4546. fi
  4547. echo >> "$output_objdir/$my_dlsyms" "\
  4548. /* The mapping between symbol names and symbols. */
  4549. typedef struct {
  4550. const char *name;
  4551. void *address;
  4552. } lt_dlsymlist;
  4553. extern LT_DLSYM_CONST lt_dlsymlist
  4554. lt_${my_prefix}_LTX_preloaded_symbols[];\
  4555. "
  4556. if test -s "$nlist"I; then
  4557. echo >> "$output_objdir/$my_dlsyms" "\
  4558. static void lt_syminit(void)
  4559. {
  4560. LT_DLSYM_CONST lt_dlsymlist *symbol = lt_${my_prefix}_LTX_preloaded_symbols;
  4561. for (; symbol->name; ++symbol)
  4562. {"
  4563. $SED 's/.*/ if (STREQ (symbol->name, \"&\")) symbol->address = (void *) \&&;/' < "$nlist"I >> "$output_objdir/$my_dlsyms"
  4564. echo >> "$output_objdir/$my_dlsyms" "\
  4565. }
  4566. }"
  4567. fi
  4568. echo >> "$output_objdir/$my_dlsyms" "\
  4569. LT_DLSYM_CONST lt_dlsymlist
  4570. lt_${my_prefix}_LTX_preloaded_symbols[] =
  4571. { {\"$my_originator\", (void *) 0},"
  4572. if test -s "$nlist"I; then
  4573. echo >> "$output_objdir/$my_dlsyms" "\
  4574. {\"@INIT@\", (void *) &lt_syminit},"
  4575. fi
  4576. case $need_lib_prefix in
  4577. no)
  4578. eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms"
  4579. ;;
  4580. *)
  4581. eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms"
  4582. ;;
  4583. esac
  4584. echo >> "$output_objdir/$my_dlsyms" "\
  4585. {0, (void *) 0}
  4586. };
  4587. /* This works around a problem in FreeBSD linker */
  4588. #ifdef FREEBSD_WORKAROUND
  4589. static const void *lt_preloaded_setup() {
  4590. return lt_${my_prefix}_LTX_preloaded_symbols;
  4591. }
  4592. #endif
  4593. #ifdef __cplusplus
  4594. }
  4595. #endif\
  4596. "
  4597. } # !$opt_dry_run
  4598. pic_flag_for_symtable=
  4599. case "$compile_command " in
  4600. *" -static "*) ;;
  4601. *)
  4602. case $host in
  4603. # compiling the symbol table file with pic_flag works around
  4604. # a FreeBSD bug that causes programs to crash when -lm is
  4605. # linked before any other PIC object. But we must not use
  4606. # pic_flag when linking with -static. The problem exists in
  4607. # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
  4608. *-*-freebsd2.*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
  4609. pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;;
  4610. *-*-hpux*)
  4611. pic_flag_for_symtable=" $pic_flag" ;;
  4612. *)
  4613. $my_pic_p && pic_flag_for_symtable=" $pic_flag"
  4614. ;;
  4615. esac
  4616. ;;
  4617. esac
  4618. symtab_cflags=
  4619. for arg in $LTCFLAGS; do
  4620. case $arg in
  4621. -pie | -fpie | -fPIE) ;;
  4622. *) func_append symtab_cflags " $arg" ;;
  4623. esac
  4624. done
  4625. # Now compile the dynamic symbol file.
  4626. func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?'
  4627. # Clean up the generated files.
  4628. func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T" "${nlist}I"'
  4629. # Transform the symbol file into the correct name.
  4630. symfileobj=$output_objdir/${my_outputname}S.$objext
  4631. case $host in
  4632. *cygwin* | *mingw* | *cegcc* )
  4633. if test -f "$output_objdir/$my_outputname.def"; then
  4634. compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
  4635. finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
  4636. else
  4637. compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
  4638. finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
  4639. fi
  4640. ;;
  4641. *)
  4642. compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
  4643. finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
  4644. ;;
  4645. esac
  4646. ;;
  4647. *)
  4648. func_fatal_error "unknown suffix for '$my_dlsyms'"
  4649. ;;
  4650. esac
  4651. else
  4652. # We keep going just in case the user didn't refer to
  4653. # lt_preloaded_symbols. The linker will fail if global_symbol_pipe
  4654. # really was required.
  4655. # Nullify the symbol file.
  4656. compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"`
  4657. finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"`
  4658. fi
  4659. }
  4660. # func_cygming_gnu_implib_p ARG
  4661. # This predicate returns with zero status (TRUE) if
  4662. # ARG is a GNU/binutils-style import library. Returns
  4663. # with nonzero status (FALSE) otherwise.
  4664. func_cygming_gnu_implib_p ()
  4665. {
  4666. $debug_cmd
  4667. func_to_tool_file "$1" func_convert_file_msys_to_w32
  4668. 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)$'`
  4669. test -n "$func_cygming_gnu_implib_tmp"
  4670. }
  4671. # func_cygming_ms_implib_p ARG
  4672. # This predicate returns with zero status (TRUE) if
  4673. # ARG is an MS-style import library. Returns
  4674. # with nonzero status (FALSE) otherwise.
  4675. func_cygming_ms_implib_p ()
  4676. {
  4677. $debug_cmd
  4678. func_to_tool_file "$1" func_convert_file_msys_to_w32
  4679. func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'`
  4680. test -n "$func_cygming_ms_implib_tmp"
  4681. }
  4682. # func_win32_libid arg
  4683. # return the library type of file 'arg'
  4684. #
  4685. # Need a lot of goo to handle *both* DLLs and import libs
  4686. # Has to be a shell function in order to 'eat' the argument
  4687. # that is supplied when $file_magic_command is called.
  4688. # Despite the name, also deal with 64 bit binaries.
  4689. func_win32_libid ()
  4690. {
  4691. $debug_cmd
  4692. win32_libid_type=unknown
  4693. win32_fileres=`file -L $1 2>/dev/null`
  4694. case $win32_fileres in
  4695. *ar\ archive\ import\ library*) # definitely import
  4696. win32_libid_type="x86 archive import"
  4697. ;;
  4698. *ar\ archive*) # could be an import, or static
  4699. # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD.
  4700. if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null |
  4701. $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then
  4702. case $nm_interface in
  4703. "MS dumpbin")
  4704. if func_cygming_ms_implib_p "$1" ||
  4705. func_cygming_gnu_implib_p "$1"
  4706. then
  4707. win32_nmres=import
  4708. else
  4709. win32_nmres=
  4710. fi
  4711. ;;
  4712. *)
  4713. func_to_tool_file "$1" func_convert_file_msys_to_w32
  4714. win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" |
  4715. $SED -n -e '
  4716. 1,100{
  4717. / I /{
  4718. s|.*|import|
  4719. p
  4720. q
  4721. }
  4722. }'`
  4723. ;;
  4724. esac
  4725. case $win32_nmres in
  4726. import*) win32_libid_type="x86 archive import";;
  4727. *) win32_libid_type="x86 archive static";;
  4728. esac
  4729. fi
  4730. ;;
  4731. *DLL*)
  4732. win32_libid_type="x86 DLL"
  4733. ;;
  4734. *executable*) # but shell scripts are "executable" too...
  4735. case $win32_fileres in
  4736. *MS\ Windows\ PE\ Intel*)
  4737. win32_libid_type="x86 DLL"
  4738. ;;
  4739. esac
  4740. ;;
  4741. esac
  4742. $ECHO "$win32_libid_type"
  4743. }
  4744. # func_cygming_dll_for_implib ARG
  4745. #
  4746. # Platform-specific function to extract the
  4747. # name of the DLL associated with the specified
  4748. # import library ARG.
  4749. # Invoked by eval'ing the libtool variable
  4750. # $sharedlib_from_linklib_cmd
  4751. # Result is available in the variable
  4752. # $sharedlib_from_linklib_result
  4753. func_cygming_dll_for_implib ()
  4754. {
  4755. $debug_cmd
  4756. sharedlib_from_linklib_result=`$DLLTOOL --identify-strict --identify "$1"`
  4757. }
  4758. # func_cygming_dll_for_implib_fallback_core SECTION_NAME LIBNAMEs
  4759. #
  4760. # The is the core of a fallback implementation of a
  4761. # platform-specific function to extract the name of the
  4762. # DLL associated with the specified import library LIBNAME.
  4763. #
  4764. # SECTION_NAME is either .idata$6 or .idata$7, depending
  4765. # on the platform and compiler that created the implib.
  4766. #
  4767. # Echos the name of the DLL associated with the
  4768. # specified import library.
  4769. func_cygming_dll_for_implib_fallback_core ()
  4770. {
  4771. $debug_cmd
  4772. match_literal=`$ECHO "$1" | $SED "$sed_make_literal_regex"`
  4773. $OBJDUMP -s --section "$1" "$2" 2>/dev/null |
  4774. $SED '/^Contents of section '"$match_literal"':/{
  4775. # Place marker at beginning of archive member dllname section
  4776. s/.*/====MARK====/
  4777. p
  4778. d
  4779. }
  4780. # These lines can sometimes be longer than 43 characters, but
  4781. # are always uninteresting
  4782. /:[ ]*file format pe[i]\{,1\}-/d
  4783. /^In archive [^:]*:/d
  4784. # Ensure marker is printed
  4785. /^====MARK====/p
  4786. # Remove all lines with less than 43 characters
  4787. /^.\{43\}/!d
  4788. # From remaining lines, remove first 43 characters
  4789. s/^.\{43\}//' |
  4790. $SED -n '
  4791. # Join marker and all lines until next marker into a single line
  4792. /^====MARK====/ b para
  4793. H
  4794. $ b para
  4795. b
  4796. :para
  4797. x
  4798. s/\n//g
  4799. # Remove the marker
  4800. s/^====MARK====//
  4801. # Remove trailing dots and whitespace
  4802. s/[\. \t]*$//
  4803. # Print
  4804. /./p' |
  4805. # we now have a list, one entry per line, of the stringified
  4806. # contents of the appropriate section of all members of the
  4807. # archive that possess that section. Heuristic: eliminate
  4808. # all those that have a first or second character that is
  4809. # a '.' (that is, objdump's representation of an unprintable
  4810. # character.) This should work for all archives with less than
  4811. # 0x302f exports -- but will fail for DLLs whose name actually
  4812. # begins with a literal '.' or a single character followed by
  4813. # a '.'.
  4814. #
  4815. # Of those that remain, print the first one.
  4816. $SED -e '/^\./d;/^.\./d;q'
  4817. }
  4818. # func_cygming_dll_for_implib_fallback ARG
  4819. # Platform-specific function to extract the
  4820. # name of the DLL associated with the specified
  4821. # import library ARG.
  4822. #
  4823. # This fallback implementation is for use when $DLLTOOL
  4824. # does not support the --identify-strict option.
  4825. # Invoked by eval'ing the libtool variable
  4826. # $sharedlib_from_linklib_cmd
  4827. # Result is available in the variable
  4828. # $sharedlib_from_linklib_result
  4829. func_cygming_dll_for_implib_fallback ()
  4830. {
  4831. $debug_cmd
  4832. if func_cygming_gnu_implib_p "$1"; then
  4833. # binutils import library
  4834. sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$7' "$1"`
  4835. elif func_cygming_ms_implib_p "$1"; then
  4836. # ms-generated import library
  4837. sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$6' "$1"`
  4838. else
  4839. # unknown
  4840. sharedlib_from_linklib_result=
  4841. fi
  4842. }
  4843. # func_extract_an_archive dir oldlib
  4844. func_extract_an_archive ()
  4845. {
  4846. $debug_cmd
  4847. f_ex_an_ar_dir=$1; shift
  4848. f_ex_an_ar_oldlib=$1
  4849. if test yes = "$lock_old_archive_extraction"; then
  4850. lockfile=$f_ex_an_ar_oldlib.lock
  4851. until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
  4852. func_echo "Waiting for $lockfile to be removed"
  4853. sleep 2
  4854. done
  4855. fi
  4856. func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \
  4857. 'stat=$?; rm -f "$lockfile"; exit $stat'
  4858. if test yes = "$lock_old_archive_extraction"; then
  4859. $opt_dry_run || rm -f "$lockfile"
  4860. fi
  4861. if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
  4862. :
  4863. else
  4864. func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib"
  4865. fi
  4866. }
  4867. # func_extract_archives gentop oldlib ...
  4868. func_extract_archives ()
  4869. {
  4870. $debug_cmd
  4871. my_gentop=$1; shift
  4872. my_oldlibs=${1+"$@"}
  4873. my_oldobjs=
  4874. my_xlib=
  4875. my_xabs=
  4876. my_xdir=
  4877. for my_xlib in $my_oldlibs; do
  4878. # Extract the objects.
  4879. case $my_xlib in
  4880. [\\/]* | [A-Za-z]:[\\/]*) my_xabs=$my_xlib ;;
  4881. *) my_xabs=`pwd`"/$my_xlib" ;;
  4882. esac
  4883. func_basename "$my_xlib"
  4884. my_xlib=$func_basename_result
  4885. my_xlib_u=$my_xlib
  4886. while :; do
  4887. case " $extracted_archives " in
  4888. *" $my_xlib_u "*)
  4889. func_arith $extracted_serial + 1
  4890. extracted_serial=$func_arith_result
  4891. my_xlib_u=lt$extracted_serial-$my_xlib ;;
  4892. *) break ;;
  4893. esac
  4894. done
  4895. extracted_archives="$extracted_archives $my_xlib_u"
  4896. my_xdir=$my_gentop/$my_xlib_u
  4897. func_mkdir_p "$my_xdir"
  4898. case $host in
  4899. *-darwin*)
  4900. func_verbose "Extracting $my_xabs"
  4901. # Do not bother doing anything if just a dry run
  4902. $opt_dry_run || {
  4903. darwin_orig_dir=`pwd`
  4904. cd $my_xdir || exit $?
  4905. darwin_archive=$my_xabs
  4906. darwin_curdir=`pwd`
  4907. func_basename "$darwin_archive"
  4908. darwin_base_archive=$func_basename_result
  4909. darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true`
  4910. if test -n "$darwin_arches"; then
  4911. darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'`
  4912. darwin_arch=
  4913. func_verbose "$darwin_base_archive has multiple architectures $darwin_arches"
  4914. for darwin_arch in $darwin_arches; do
  4915. func_mkdir_p "unfat-$$/$darwin_base_archive-$darwin_arch"
  4916. $LIPO -thin $darwin_arch -output "unfat-$$/$darwin_base_archive-$darwin_arch/$darwin_base_archive" "$darwin_archive"
  4917. cd "unfat-$$/$darwin_base_archive-$darwin_arch"
  4918. func_extract_an_archive "`pwd`" "$darwin_base_archive"
  4919. cd "$darwin_curdir"
  4920. $RM "unfat-$$/$darwin_base_archive-$darwin_arch/$darwin_base_archive"
  4921. done # $darwin_arches
  4922. ## Okay now we've a bunch of thin objects, gotta fatten them up :)
  4923. darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$sed_basename" | sort -u`
  4924. darwin_file=
  4925. darwin_files=
  4926. for darwin_file in $darwin_filelist; do
  4927. darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP`
  4928. $LIPO -create -output "$darwin_file" $darwin_files
  4929. done # $darwin_filelist
  4930. $RM -rf unfat-$$
  4931. cd "$darwin_orig_dir"
  4932. else
  4933. cd $darwin_orig_dir
  4934. func_extract_an_archive "$my_xdir" "$my_xabs"
  4935. fi # $darwin_arches
  4936. } # !$opt_dry_run
  4937. ;;
  4938. *)
  4939. func_extract_an_archive "$my_xdir" "$my_xabs"
  4940. ;;
  4941. esac
  4942. my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP`
  4943. done
  4944. func_extract_archives_result=$my_oldobjs
  4945. }
  4946. # func_emit_wrapper [arg=no]
  4947. #
  4948. # Emit a libtool wrapper script on stdout.
  4949. # Don't directly open a file because we may want to
  4950. # incorporate the script contents within a cygwin/mingw
  4951. # wrapper executable. Must ONLY be called from within
  4952. # func_mode_link because it depends on a number of variables
  4953. # set therein.
  4954. #
  4955. # ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR
  4956. # variable will take. If 'yes', then the emitted script
  4957. # will assume that the directory where it is stored is
  4958. # the $objdir directory. This is a cygwin/mingw-specific
  4959. # behavior.
  4960. func_emit_wrapper ()
  4961. {
  4962. func_emit_wrapper_arg1=${1-no}
  4963. $ECHO "\
  4964. #! $SHELL
  4965. # $output - temporary wrapper script for $objdir/$outputname
  4966. # Generated by $PROGRAM (GNU $PACKAGE) $VERSION
  4967. #
  4968. # The $output program cannot be directly executed until all the libtool
  4969. # libraries that it depends on are installed.
  4970. #
  4971. # This wrapper script should never be moved out of the build directory.
  4972. # If it is, it will not operate correctly.
  4973. # Sed substitution that helps us do robust quoting. It backslashifies
  4974. # metacharacters that are still active within double-quoted strings.
  4975. sed_quote_subst='$sed_quote_subst'
  4976. # Be Bourne compatible
  4977. if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
  4978. emulate sh
  4979. NULLCMD=:
  4980. # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
  4981. # is contrary to our usage. Disable this feature.
  4982. alias -g '\${1+\"\$@\"}'='\"\$@\"'
  4983. setopt NO_GLOB_SUBST
  4984. else
  4985. case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
  4986. fi
  4987. BIN_SH=xpg4; export BIN_SH # for Tru64
  4988. DUALCASE=1; export DUALCASE # for MKS sh
  4989. # The HP-UX ksh and POSIX shell print the target directory to stdout
  4990. # if CDPATH is set.
  4991. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
  4992. relink_command=\"$relink_command\"
  4993. # This environment variable determines our operation mode.
  4994. if test \"\$libtool_install_magic\" = \"$magic\"; then
  4995. # install mode needs the following variables:
  4996. generated_by_libtool_version='$macro_version'
  4997. notinst_deplibs='$notinst_deplibs'
  4998. else
  4999. # When we are sourced in execute mode, \$file and \$ECHO are already set.
  5000. if test \"\$libtool_execute_magic\" != \"$magic\"; then
  5001. file=\"\$0\""
  5002. func_quote_arg pretty "$ECHO"
  5003. qECHO=$func_quote_arg_result
  5004. $ECHO "\
  5005. # A function that is used when there is no print builtin or printf.
  5006. func_fallback_echo ()
  5007. {
  5008. eval 'cat <<_LTECHO_EOF
  5009. \$1
  5010. _LTECHO_EOF'
  5011. }
  5012. ECHO=$qECHO
  5013. fi
  5014. # Very basic option parsing. These options are (a) specific to
  5015. # the libtool wrapper, (b) are identical between the wrapper
  5016. # /script/ and the wrapper /executable/ that is used only on
  5017. # windows platforms, and (c) all begin with the string "--lt-"
  5018. # (application programs are unlikely to have options that match
  5019. # this pattern).
  5020. #
  5021. # There are only two supported options: --lt-debug and
  5022. # --lt-dump-script. There is, deliberately, no --lt-help.
  5023. #
  5024. # The first argument to this parsing function should be the
  5025. # script's $0 value, followed by "$@".
  5026. lt_option_debug=
  5027. func_parse_lt_options ()
  5028. {
  5029. lt_script_arg0=\$0
  5030. shift
  5031. for lt_opt
  5032. do
  5033. case \"\$lt_opt\" in
  5034. --lt-debug) lt_option_debug=1 ;;
  5035. --lt-dump-script)
  5036. lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\`
  5037. test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=.
  5038. lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\`
  5039. cat \"\$lt_dump_D/\$lt_dump_F\"
  5040. exit 0
  5041. ;;
  5042. --lt-*)
  5043. \$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2
  5044. exit 1
  5045. ;;
  5046. esac
  5047. done
  5048. # Print the debug banner immediately:
  5049. if test -n \"\$lt_option_debug\"; then
  5050. echo \"$outputname:$output:\$LINENO: libtool wrapper (GNU $PACKAGE) $VERSION\" 1>&2
  5051. fi
  5052. }
  5053. # Used when --lt-debug. Prints its arguments to stdout
  5054. # (redirection is the responsibility of the caller)
  5055. func_lt_dump_args ()
  5056. {
  5057. lt_dump_args_N=1;
  5058. for lt_arg
  5059. do
  5060. \$ECHO \"$outputname:$output:\$LINENO: newargv[\$lt_dump_args_N]: \$lt_arg\"
  5061. lt_dump_args_N=\`expr \$lt_dump_args_N + 1\`
  5062. done
  5063. }
  5064. # Core function for launching the target application
  5065. func_exec_program_core ()
  5066. {
  5067. "
  5068. case $host in
  5069. # Backslashes separate directories on plain windows
  5070. *-*-mingw | *-*-os2* | *-cegcc*)
  5071. $ECHO "\
  5072. if test -n \"\$lt_option_debug\"; then
  5073. \$ECHO \"$outputname:$output:\$LINENO: newargv[0]: \$progdir\\\\\$program\" 1>&2
  5074. func_lt_dump_args \${1+\"\$@\"} 1>&2
  5075. fi
  5076. exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
  5077. "
  5078. ;;
  5079. *)
  5080. $ECHO "\
  5081. if test -n \"\$lt_option_debug\"; then
  5082. \$ECHO \"$outputname:$output:\$LINENO: newargv[0]: \$progdir/\$program\" 1>&2
  5083. func_lt_dump_args \${1+\"\$@\"} 1>&2
  5084. fi
  5085. exec \"\$progdir/\$program\" \${1+\"\$@\"}
  5086. "
  5087. ;;
  5088. esac
  5089. $ECHO "\
  5090. \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2
  5091. exit 1
  5092. }
  5093. # A function to encapsulate launching the target application
  5094. # Strips options in the --lt-* namespace from \$@ and
  5095. # launches target application with the remaining arguments.
  5096. func_exec_program ()
  5097. {
  5098. case \" \$* \" in
  5099. *\\ --lt-*)
  5100. for lt_wr_arg
  5101. do
  5102. case \$lt_wr_arg in
  5103. --lt-*) ;;
  5104. *) set x \"\$@\" \"\$lt_wr_arg\"; shift;;
  5105. esac
  5106. shift
  5107. done ;;
  5108. esac
  5109. func_exec_program_core \${1+\"\$@\"}
  5110. }
  5111. # Parse options
  5112. func_parse_lt_options \"\$0\" \${1+\"\$@\"}
  5113. # Find the directory that this script lives in.
  5114. thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\`
  5115. test \"x\$thisdir\" = \"x\$file\" && thisdir=.
  5116. # Follow symbolic links until we get to the real thisdir.
  5117. file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\`
  5118. while test -n \"\$file\"; do
  5119. destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\`
  5120. # If there was a directory component, then change thisdir.
  5121. if test \"x\$destdir\" != \"x\$file\"; then
  5122. case \"\$destdir\" in
  5123. [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
  5124. *) thisdir=\"\$thisdir/\$destdir\" ;;
  5125. esac
  5126. fi
  5127. file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\`
  5128. file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\`
  5129. done
  5130. # Usually 'no', except on cygwin/mingw when embedded into
  5131. # the cwrapper.
  5132. WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1
  5133. if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then
  5134. # special case for '.'
  5135. if test \"\$thisdir\" = \".\"; then
  5136. thisdir=\`pwd\`
  5137. fi
  5138. # remove .libs from thisdir
  5139. case \"\$thisdir\" in
  5140. *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;;
  5141. $objdir ) thisdir=. ;;
  5142. esac
  5143. fi
  5144. # Try to get the absolute directory name.
  5145. absdir=\`cd \"\$thisdir\" && pwd\`
  5146. test -n \"\$absdir\" && thisdir=\"\$absdir\"
  5147. "
  5148. if test yes = "$fast_install"; then
  5149. $ECHO "\
  5150. program=lt-'$outputname'$exeext
  5151. progdir=\"\$thisdir/$objdir\"
  5152. if test ! -f \"\$progdir/\$program\" ||
  5153. { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | $SED 1q\`; \\
  5154. test \"X\$file\" != \"X\$progdir/\$program\"; }; then
  5155. file=\"\$\$-\$program\"
  5156. if test ! -d \"\$progdir\"; then
  5157. $MKDIR \"\$progdir\"
  5158. else
  5159. $RM \"\$progdir/\$file\"
  5160. fi"
  5161. $ECHO "\
  5162. # relink executable if necessary
  5163. if test -n \"\$relink_command\"; then
  5164. if relink_command_output=\`eval \$relink_command 2>&1\`; then :
  5165. else
  5166. \$ECHO \"\$relink_command_output\" >&2
  5167. $RM \"\$progdir/\$file\"
  5168. exit 1
  5169. fi
  5170. fi
  5171. $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
  5172. { $RM \"\$progdir/\$program\";
  5173. $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; }
  5174. $RM \"\$progdir/\$file\"
  5175. fi"
  5176. else
  5177. $ECHO "\
  5178. program='$outputname'
  5179. progdir=\"\$thisdir/$objdir\"
  5180. "
  5181. fi
  5182. $ECHO "\
  5183. if test -f \"\$progdir/\$program\"; then"
  5184. # fixup the dll searchpath if we need to.
  5185. #
  5186. # Fix the DLL searchpath if we need to. Do this before prepending
  5187. # to shlibpath, because on Windows, both are PATH and uninstalled
  5188. # libraries must come first.
  5189. if test -n "$dllsearchpath"; then
  5190. $ECHO "\
  5191. # Add the dll search path components to the executable PATH
  5192. PATH=$dllsearchpath:\$PATH
  5193. "
  5194. fi
  5195. # Export our shlibpath_var if we have one.
  5196. if test yes = "$shlibpath_overrides_runpath" && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
  5197. $ECHO "\
  5198. # Add our own library path to $shlibpath_var
  5199. $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
  5200. # Some systems cannot cope with colon-terminated $shlibpath_var
  5201. # The second colon is a workaround for a bug in BeOS R4 sed
  5202. $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\`
  5203. export $shlibpath_var
  5204. "
  5205. fi
  5206. $ECHO "\
  5207. if test \"\$libtool_execute_magic\" != \"$magic\"; then
  5208. # Run the actual program with our arguments.
  5209. func_exec_program \${1+\"\$@\"}
  5210. fi
  5211. else
  5212. # The program doesn't exist.
  5213. \$ECHO \"\$0: error: '\$progdir/\$program' does not exist\" 1>&2
  5214. \$ECHO \"This script is just a wrapper for \$program.\" 1>&2
  5215. \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2
  5216. exit 1
  5217. fi
  5218. fi\
  5219. "
  5220. }
  5221. # func_emit_cwrapperexe_src
  5222. # emit the source code for a wrapper executable on stdout
  5223. # Must ONLY be called from within func_mode_link because
  5224. # it depends on a number of variable set therein.
  5225. func_emit_cwrapperexe_src ()
  5226. {
  5227. cat <<EOF
  5228. /* $cwrappersource - temporary wrapper executable for $objdir/$outputname
  5229. Generated by $PROGRAM (GNU $PACKAGE) $VERSION
  5230. The $output program cannot be directly executed until all the libtool
  5231. libraries that it depends on are installed.
  5232. This wrapper executable should never be moved out of the build directory.
  5233. If it is, it will not operate correctly.
  5234. */
  5235. EOF
  5236. cat <<"EOF"
  5237. #ifdef _MSC_VER
  5238. # define _CRT_SECURE_NO_DEPRECATE 1
  5239. #endif
  5240. #include <stdio.h>
  5241. #include <stdlib.h>
  5242. #ifdef _MSC_VER
  5243. # include <direct.h>
  5244. # include <process.h>
  5245. # include <io.h>
  5246. #else
  5247. # include <unistd.h>
  5248. # include <stdint.h>
  5249. # ifdef __CYGWIN__
  5250. # include <io.h>
  5251. # endif
  5252. #endif
  5253. #include <malloc.h>
  5254. #include <stdarg.h>
  5255. #include <assert.h>
  5256. #include <string.h>
  5257. #include <ctype.h>
  5258. #include <errno.h>
  5259. #include <fcntl.h>
  5260. #include <sys/stat.h>
  5261. #define STREQ(s1, s2) (strcmp ((s1), (s2)) == 0)
  5262. /* declarations of non-ANSI functions */
  5263. #if defined __MINGW32__
  5264. # ifdef __STRICT_ANSI__
  5265. int _putenv (const char *);
  5266. # endif
  5267. #elif defined __CYGWIN__
  5268. # ifdef __STRICT_ANSI__
  5269. char *realpath (const char *, char *);
  5270. int putenv (char *);
  5271. int setenv (const char *, const char *, int);
  5272. # endif
  5273. /* #elif defined other_platform || defined ... */
  5274. #endif
  5275. /* portability defines, excluding path handling macros */
  5276. #if defined _MSC_VER
  5277. # define setmode _setmode
  5278. # define stat _stat
  5279. # define chmod _chmod
  5280. # define getcwd _getcwd
  5281. # define putenv _putenv
  5282. # define S_IXUSR _S_IEXEC
  5283. #elif defined __MINGW32__
  5284. # define setmode _setmode
  5285. # define stat _stat
  5286. # define chmod _chmod
  5287. # define getcwd _getcwd
  5288. # define putenv _putenv
  5289. #elif defined __CYGWIN__
  5290. # define HAVE_SETENV
  5291. # define FOPEN_WB "wb"
  5292. /* #elif defined other platforms ... */
  5293. #endif
  5294. #if defined PATH_MAX
  5295. # define LT_PATHMAX PATH_MAX
  5296. #elif defined MAXPATHLEN
  5297. # define LT_PATHMAX MAXPATHLEN
  5298. #else
  5299. # define LT_PATHMAX 1024
  5300. #endif
  5301. #ifndef S_IXOTH
  5302. # define S_IXOTH 0
  5303. #endif
  5304. #ifndef S_IXGRP
  5305. # define S_IXGRP 0
  5306. #endif
  5307. /* path handling portability macros */
  5308. #ifndef DIR_SEPARATOR
  5309. # define DIR_SEPARATOR '/'
  5310. # define PATH_SEPARATOR ':'
  5311. #endif
  5312. #if defined _WIN32 || defined __MSDOS__ || defined __DJGPP__ || \
  5313. defined __OS2__
  5314. # define HAVE_DOS_BASED_FILE_SYSTEM
  5315. # define FOPEN_WB "wb"
  5316. # ifndef DIR_SEPARATOR_2
  5317. # define DIR_SEPARATOR_2 '\\'
  5318. # endif
  5319. # ifndef PATH_SEPARATOR_2
  5320. # define PATH_SEPARATOR_2 ';'
  5321. # endif
  5322. #endif
  5323. #ifndef DIR_SEPARATOR_2
  5324. # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
  5325. #else /* DIR_SEPARATOR_2 */
  5326. # define IS_DIR_SEPARATOR(ch) \
  5327. (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
  5328. #endif /* DIR_SEPARATOR_2 */
  5329. #ifndef PATH_SEPARATOR_2
  5330. # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
  5331. #else /* PATH_SEPARATOR_2 */
  5332. # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
  5333. #endif /* PATH_SEPARATOR_2 */
  5334. #ifndef FOPEN_WB
  5335. # define FOPEN_WB "w"
  5336. #endif
  5337. #ifndef _O_BINARY
  5338. # define _O_BINARY 0
  5339. #endif
  5340. #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type)))
  5341. #define XFREE(stale) do { \
  5342. if (stale) { free (stale); stale = 0; } \
  5343. } while (0)
  5344. #if defined LT_DEBUGWRAPPER
  5345. static int lt_debug = 1;
  5346. #else
  5347. static int lt_debug = 0;
  5348. #endif
  5349. const char *program_name = "libtool-wrapper"; /* in case xstrdup fails */
  5350. void *xmalloc (size_t num);
  5351. char *xstrdup (const char *string);
  5352. const char *base_name (const char *name);
  5353. char *find_executable (const char *wrapper);
  5354. char *chase_symlinks (const char *pathspec);
  5355. int make_executable (const char *path);
  5356. int check_executable (const char *path);
  5357. char *strendzap (char *str, const char *pat);
  5358. void lt_debugprintf (const char *file, int line, const char *fmt, ...);
  5359. void lt_fatal (const char *file, int line, const char *message, ...);
  5360. static const char *nonnull (const char *s);
  5361. static const char *nonempty (const char *s);
  5362. void lt_setenv (const char *name, const char *value);
  5363. char *lt_extend_str (const char *orig_value, const char *add, int to_end);
  5364. void lt_update_exe_path (const char *name, const char *value);
  5365. void lt_update_lib_path (const char *name, const char *value);
  5366. char **prepare_spawn (char **argv);
  5367. void lt_dump_script (FILE *f);
  5368. EOF
  5369. cat <<EOF
  5370. #if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 5)
  5371. # define externally_visible volatile
  5372. #else
  5373. # define externally_visible __attribute__((externally_visible)) volatile
  5374. #endif
  5375. externally_visible const char * MAGIC_EXE = "$magic_exe";
  5376. const char * LIB_PATH_VARNAME = "$shlibpath_var";
  5377. EOF
  5378. if test yes = "$shlibpath_overrides_runpath" && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
  5379. func_to_host_path "$temp_rpath"
  5380. cat <<EOF
  5381. const char * LIB_PATH_VALUE = "$func_to_host_path_result";
  5382. EOF
  5383. else
  5384. cat <<"EOF"
  5385. const char * LIB_PATH_VALUE = "";
  5386. EOF
  5387. fi
  5388. if test -n "$dllsearchpath"; then
  5389. func_to_host_path "$dllsearchpath:"
  5390. cat <<EOF
  5391. const char * EXE_PATH_VARNAME = "PATH";
  5392. const char * EXE_PATH_VALUE = "$func_to_host_path_result";
  5393. EOF
  5394. else
  5395. cat <<"EOF"
  5396. const char * EXE_PATH_VARNAME = "";
  5397. const char * EXE_PATH_VALUE = "";
  5398. EOF
  5399. fi
  5400. if test yes = "$fast_install"; then
  5401. cat <<EOF
  5402. const char * TARGET_PROGRAM_NAME = "lt-$outputname"; /* hopefully, no .exe */
  5403. EOF
  5404. else
  5405. cat <<EOF
  5406. const char * TARGET_PROGRAM_NAME = "$outputname"; /* hopefully, no .exe */
  5407. EOF
  5408. fi
  5409. cat <<"EOF"
  5410. #define LTWRAPPER_OPTION_PREFIX "--lt-"
  5411. static const char *ltwrapper_option_prefix = LTWRAPPER_OPTION_PREFIX;
  5412. static const char *dumpscript_opt = LTWRAPPER_OPTION_PREFIX "dump-script";
  5413. static const char *debug_opt = LTWRAPPER_OPTION_PREFIX "debug";
  5414. int
  5415. main (int argc, char *argv[])
  5416. {
  5417. char **newargz;
  5418. int newargc;
  5419. char *tmp_pathspec;
  5420. char *actual_cwrapper_path;
  5421. char *actual_cwrapper_name;
  5422. char *target_name;
  5423. char *lt_argv_zero;
  5424. int rval = 127;
  5425. int i;
  5426. program_name = (char *) xstrdup (base_name (argv[0]));
  5427. newargz = XMALLOC (char *, (size_t) argc + 1);
  5428. /* very simple arg parsing; don't want to rely on getopt
  5429. * also, copy all non cwrapper options to newargz, except
  5430. * argz[0], which is handled differently
  5431. */
  5432. newargc=0;
  5433. for (i = 1; i < argc; i++)
  5434. {
  5435. if (STREQ (argv[i], dumpscript_opt))
  5436. {
  5437. EOF
  5438. case $host in
  5439. *mingw* | *cygwin* )
  5440. # make stdout use "unix" line endings
  5441. echo " setmode(1,_O_BINARY);"
  5442. ;;
  5443. esac
  5444. cat <<"EOF"
  5445. lt_dump_script (stdout);
  5446. return 0;
  5447. }
  5448. if (STREQ (argv[i], debug_opt))
  5449. {
  5450. lt_debug = 1;
  5451. continue;
  5452. }
  5453. if (STREQ (argv[i], ltwrapper_option_prefix))
  5454. {
  5455. /* however, if there is an option in the LTWRAPPER_OPTION_PREFIX
  5456. namespace, but it is not one of the ones we know about and
  5457. have already dealt with, above (inluding dump-script), then
  5458. report an error. Otherwise, targets might begin to believe
  5459. they are allowed to use options in the LTWRAPPER_OPTION_PREFIX
  5460. namespace. The first time any user complains about this, we'll
  5461. need to make LTWRAPPER_OPTION_PREFIX a configure-time option
  5462. or a configure.ac-settable value.
  5463. */
  5464. lt_fatal (__FILE__, __LINE__,
  5465. "unrecognized %s option: '%s'",
  5466. ltwrapper_option_prefix, argv[i]);
  5467. }
  5468. /* otherwise ... */
  5469. newargz[++newargc] = xstrdup (argv[i]);
  5470. }
  5471. newargz[++newargc] = NULL;
  5472. EOF
  5473. cat <<EOF
  5474. /* The GNU banner must be the first non-error debug message */
  5475. lt_debugprintf (__FILE__, __LINE__, "libtool wrapper (GNU $PACKAGE) $VERSION\n");
  5476. EOF
  5477. cat <<"EOF"
  5478. lt_debugprintf (__FILE__, __LINE__, "(main) argv[0]: %s\n", argv[0]);
  5479. lt_debugprintf (__FILE__, __LINE__, "(main) program_name: %s\n", program_name);
  5480. tmp_pathspec = find_executable (argv[0]);
  5481. if (tmp_pathspec == NULL)
  5482. lt_fatal (__FILE__, __LINE__, "couldn't find %s", argv[0]);
  5483. lt_debugprintf (__FILE__, __LINE__,
  5484. "(main) found exe (before symlink chase) at: %s\n",
  5485. tmp_pathspec);
  5486. actual_cwrapper_path = chase_symlinks (tmp_pathspec);
  5487. lt_debugprintf (__FILE__, __LINE__,
  5488. "(main) found exe (after symlink chase) at: %s\n",
  5489. actual_cwrapper_path);
  5490. XFREE (tmp_pathspec);
  5491. actual_cwrapper_name = xstrdup (base_name (actual_cwrapper_path));
  5492. strendzap (actual_cwrapper_path, actual_cwrapper_name);
  5493. /* wrapper name transforms */
  5494. strendzap (actual_cwrapper_name, ".exe");
  5495. tmp_pathspec = lt_extend_str (actual_cwrapper_name, ".exe", 1);
  5496. XFREE (actual_cwrapper_name);
  5497. actual_cwrapper_name = tmp_pathspec;
  5498. tmp_pathspec = 0;
  5499. /* target_name transforms -- use actual target program name; might have lt- prefix */
  5500. target_name = xstrdup (base_name (TARGET_PROGRAM_NAME));
  5501. strendzap (target_name, ".exe");
  5502. tmp_pathspec = lt_extend_str (target_name, ".exe", 1);
  5503. XFREE (target_name);
  5504. target_name = tmp_pathspec;
  5505. tmp_pathspec = 0;
  5506. lt_debugprintf (__FILE__, __LINE__,
  5507. "(main) libtool target name: %s\n",
  5508. target_name);
  5509. EOF
  5510. cat <<EOF
  5511. newargz[0] =
  5512. XMALLOC (char, (strlen (actual_cwrapper_path) +
  5513. strlen ("$objdir") + 1 + strlen (actual_cwrapper_name) + 1));
  5514. strcpy (newargz[0], actual_cwrapper_path);
  5515. strcat (newargz[0], "$objdir");
  5516. strcat (newargz[0], "/");
  5517. EOF
  5518. cat <<"EOF"
  5519. /* stop here, and copy so we don't have to do this twice */
  5520. tmp_pathspec = xstrdup (newargz[0]);
  5521. /* do NOT want the lt- prefix here, so use actual_cwrapper_name */
  5522. strcat (newargz[0], actual_cwrapper_name);
  5523. /* DO want the lt- prefix here if it exists, so use target_name */
  5524. lt_argv_zero = lt_extend_str (tmp_pathspec, target_name, 1);
  5525. XFREE (tmp_pathspec);
  5526. tmp_pathspec = NULL;
  5527. EOF
  5528. case $host_os in
  5529. mingw*)
  5530. cat <<"EOF"
  5531. {
  5532. char* p;
  5533. while ((p = strchr (newargz[0], '\\')) != NULL)
  5534. {
  5535. *p = '/';
  5536. }
  5537. while ((p = strchr (lt_argv_zero, '\\')) != NULL)
  5538. {
  5539. *p = '/';
  5540. }
  5541. }
  5542. EOF
  5543. ;;
  5544. esac
  5545. cat <<"EOF"
  5546. XFREE (target_name);
  5547. XFREE (actual_cwrapper_path);
  5548. XFREE (actual_cwrapper_name);
  5549. lt_setenv ("BIN_SH", "xpg4"); /* for Tru64 */
  5550. lt_setenv ("DUALCASE", "1"); /* for MSK sh */
  5551. /* Update the DLL searchpath. EXE_PATH_VALUE ($dllsearchpath) must
  5552. be prepended before (that is, appear after) LIB_PATH_VALUE ($temp_rpath)
  5553. because on Windows, both *_VARNAMEs are PATH but uninstalled
  5554. libraries must come first. */
  5555. lt_update_exe_path (EXE_PATH_VARNAME, EXE_PATH_VALUE);
  5556. lt_update_lib_path (LIB_PATH_VARNAME, LIB_PATH_VALUE);
  5557. lt_debugprintf (__FILE__, __LINE__, "(main) lt_argv_zero: %s\n",
  5558. nonnull (lt_argv_zero));
  5559. for (i = 0; i < newargc; i++)
  5560. {
  5561. lt_debugprintf (__FILE__, __LINE__, "(main) newargz[%d]: %s\n",
  5562. i, nonnull (newargz[i]));
  5563. }
  5564. EOF
  5565. case $host_os in
  5566. mingw*)
  5567. cat <<"EOF"
  5568. /* execv doesn't actually work on mingw as expected on unix */
  5569. newargz = prepare_spawn (newargz);
  5570. rval = (int) _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz);
  5571. if (rval == -1)
  5572. {
  5573. /* failed to start process */
  5574. lt_debugprintf (__FILE__, __LINE__,
  5575. "(main) failed to launch target \"%s\": %s\n",
  5576. lt_argv_zero, nonnull (strerror (errno)));
  5577. return 127;
  5578. }
  5579. return rval;
  5580. EOF
  5581. ;;
  5582. *)
  5583. cat <<"EOF"
  5584. execv (lt_argv_zero, newargz);
  5585. return rval; /* =127, but avoids unused variable warning */
  5586. EOF
  5587. ;;
  5588. esac
  5589. cat <<"EOF"
  5590. }
  5591. void *
  5592. xmalloc (size_t num)
  5593. {
  5594. void *p = (void *) malloc (num);
  5595. if (!p)
  5596. lt_fatal (__FILE__, __LINE__, "memory exhausted");
  5597. return p;
  5598. }
  5599. char *
  5600. xstrdup (const char *string)
  5601. {
  5602. return string ? strcpy ((char *) xmalloc (strlen (string) + 1),
  5603. string) : NULL;
  5604. }
  5605. const char *
  5606. base_name (const char *name)
  5607. {
  5608. const char *base;
  5609. #if defined HAVE_DOS_BASED_FILE_SYSTEM
  5610. /* Skip over the disk name in MSDOS pathnames. */
  5611. if (isalpha ((unsigned char) name[0]) && name[1] == ':')
  5612. name += 2;
  5613. #endif
  5614. for (base = name; *name; name++)
  5615. if (IS_DIR_SEPARATOR (*name))
  5616. base = name + 1;
  5617. return base;
  5618. }
  5619. int
  5620. check_executable (const char *path)
  5621. {
  5622. struct stat st;
  5623. lt_debugprintf (__FILE__, __LINE__, "(check_executable): %s\n",
  5624. nonempty (path));
  5625. if ((!path) || (!*path))
  5626. return 0;
  5627. if ((stat (path, &st) >= 0)
  5628. && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)))
  5629. return 1;
  5630. else
  5631. return 0;
  5632. }
  5633. int
  5634. make_executable (const char *path)
  5635. {
  5636. int rval = 0;
  5637. struct stat st;
  5638. lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n",
  5639. nonempty (path));
  5640. if ((!path) || (!*path))
  5641. return 0;
  5642. if (stat (path, &st) >= 0)
  5643. {
  5644. rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR);
  5645. }
  5646. return rval;
  5647. }
  5648. /* Searches for the full path of the wrapper. Returns
  5649. newly allocated full path name if found, NULL otherwise
  5650. Does not chase symlinks, even on platforms that support them.
  5651. */
  5652. char *
  5653. find_executable (const char *wrapper)
  5654. {
  5655. int has_slash = 0;
  5656. const char *p;
  5657. const char *p_next;
  5658. /* static buffer for getcwd */
  5659. char tmp[LT_PATHMAX + 1];
  5660. size_t tmp_len;
  5661. char *concat_name;
  5662. lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n",
  5663. nonempty (wrapper));
  5664. if ((wrapper == NULL) || (*wrapper == '\0'))
  5665. return NULL;
  5666. /* Absolute path? */
  5667. #if defined HAVE_DOS_BASED_FILE_SYSTEM
  5668. if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':')
  5669. {
  5670. concat_name = xstrdup (wrapper);
  5671. if (check_executable (concat_name))
  5672. return concat_name;
  5673. XFREE (concat_name);
  5674. }
  5675. else
  5676. {
  5677. #endif
  5678. if (IS_DIR_SEPARATOR (wrapper[0]))
  5679. {
  5680. concat_name = xstrdup (wrapper);
  5681. if (check_executable (concat_name))
  5682. return concat_name;
  5683. XFREE (concat_name);
  5684. }
  5685. #if defined HAVE_DOS_BASED_FILE_SYSTEM
  5686. }
  5687. #endif
  5688. for (p = wrapper; *p; p++)
  5689. if (*p == '/')
  5690. {
  5691. has_slash = 1;
  5692. break;
  5693. }
  5694. if (!has_slash)
  5695. {
  5696. /* no slashes; search PATH */
  5697. const char *path = getenv ("PATH");
  5698. if (path != NULL)
  5699. {
  5700. for (p = path; *p; p = p_next)
  5701. {
  5702. const char *q;
  5703. size_t p_len;
  5704. for (q = p; *q; q++)
  5705. if (IS_PATH_SEPARATOR (*q))
  5706. break;
  5707. p_len = (size_t) (q - p);
  5708. p_next = (*q == '\0' ? q : q + 1);
  5709. if (p_len == 0)
  5710. {
  5711. /* empty path: current directory */
  5712. if (getcwd (tmp, LT_PATHMAX) == NULL)
  5713. lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
  5714. nonnull (strerror (errno)));
  5715. tmp_len = strlen (tmp);
  5716. concat_name =
  5717. XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
  5718. memcpy (concat_name, tmp, tmp_len);
  5719. concat_name[tmp_len] = '/';
  5720. strcpy (concat_name + tmp_len + 1, wrapper);
  5721. }
  5722. else
  5723. {
  5724. concat_name =
  5725. XMALLOC (char, p_len + 1 + strlen (wrapper) + 1);
  5726. memcpy (concat_name, p, p_len);
  5727. concat_name[p_len] = '/';
  5728. strcpy (concat_name + p_len + 1, wrapper);
  5729. }
  5730. if (check_executable (concat_name))
  5731. return concat_name;
  5732. XFREE (concat_name);
  5733. }
  5734. }
  5735. /* not found in PATH; assume curdir */
  5736. }
  5737. /* Relative path | not found in path: prepend cwd */
  5738. if (getcwd (tmp, LT_PATHMAX) == NULL)
  5739. lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
  5740. nonnull (strerror (errno)));
  5741. tmp_len = strlen (tmp);
  5742. concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
  5743. memcpy (concat_name, tmp, tmp_len);
  5744. concat_name[tmp_len] = '/';
  5745. strcpy (concat_name + tmp_len + 1, wrapper);
  5746. if (check_executable (concat_name))
  5747. return concat_name;
  5748. XFREE (concat_name);
  5749. return NULL;
  5750. }
  5751. char *
  5752. chase_symlinks (const char *pathspec)
  5753. {
  5754. #ifndef S_ISLNK
  5755. return xstrdup (pathspec);
  5756. #else
  5757. char buf[LT_PATHMAX];
  5758. struct stat s;
  5759. char *tmp_pathspec = xstrdup (pathspec);
  5760. char *p;
  5761. int has_symlinks = 0;
  5762. while (strlen (tmp_pathspec) && !has_symlinks)
  5763. {
  5764. lt_debugprintf (__FILE__, __LINE__,
  5765. "checking path component for symlinks: %s\n",
  5766. tmp_pathspec);
  5767. if (lstat (tmp_pathspec, &s) == 0)
  5768. {
  5769. if (S_ISLNK (s.st_mode) != 0)
  5770. {
  5771. has_symlinks = 1;
  5772. break;
  5773. }
  5774. /* search backwards for last DIR_SEPARATOR */
  5775. p = tmp_pathspec + strlen (tmp_pathspec) - 1;
  5776. while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
  5777. p--;
  5778. if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
  5779. {
  5780. /* no more DIR_SEPARATORS left */
  5781. break;
  5782. }
  5783. *p = '\0';
  5784. }
  5785. else
  5786. {
  5787. lt_fatal (__FILE__, __LINE__,
  5788. "error accessing file \"%s\": %s",
  5789. tmp_pathspec, nonnull (strerror (errno)));
  5790. }
  5791. }
  5792. XFREE (tmp_pathspec);
  5793. if (!has_symlinks)
  5794. {
  5795. return xstrdup (pathspec);
  5796. }
  5797. tmp_pathspec = realpath (pathspec, buf);
  5798. if (tmp_pathspec == 0)
  5799. {
  5800. lt_fatal (__FILE__, __LINE__,
  5801. "could not follow symlinks for %s", pathspec);
  5802. }
  5803. return xstrdup (tmp_pathspec);
  5804. #endif
  5805. }
  5806. char *
  5807. strendzap (char *str, const char *pat)
  5808. {
  5809. size_t len, patlen;
  5810. assert (str != NULL);
  5811. assert (pat != NULL);
  5812. len = strlen (str);
  5813. patlen = strlen (pat);
  5814. if (patlen <= len)
  5815. {
  5816. str += len - patlen;
  5817. if (STREQ (str, pat))
  5818. *str = '\0';
  5819. }
  5820. return str;
  5821. }
  5822. void
  5823. lt_debugprintf (const char *file, int line, const char *fmt, ...)
  5824. {
  5825. va_list args;
  5826. if (lt_debug)
  5827. {
  5828. (void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line);
  5829. va_start (args, fmt);
  5830. (void) vfprintf (stderr, fmt, args);
  5831. va_end (args);
  5832. }
  5833. }
  5834. static void
  5835. lt_error_core (int exit_status, const char *file,
  5836. int line, const char *mode,
  5837. const char *message, va_list ap)
  5838. {
  5839. fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode);
  5840. vfprintf (stderr, message, ap);
  5841. fprintf (stderr, ".\n");
  5842. if (exit_status >= 0)
  5843. exit (exit_status);
  5844. }
  5845. void
  5846. lt_fatal (const char *file, int line, const char *message, ...)
  5847. {
  5848. va_list ap;
  5849. va_start (ap, message);
  5850. lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap);
  5851. va_end (ap);
  5852. }
  5853. static const char *
  5854. nonnull (const char *s)
  5855. {
  5856. return s ? s : "(null)";
  5857. }
  5858. static const char *
  5859. nonempty (const char *s)
  5860. {
  5861. return (s && !*s) ? "(empty)" : nonnull (s);
  5862. }
  5863. void
  5864. lt_setenv (const char *name, const char *value)
  5865. {
  5866. lt_debugprintf (__FILE__, __LINE__,
  5867. "(lt_setenv) setting '%s' to '%s'\n",
  5868. nonnull (name), nonnull (value));
  5869. {
  5870. #ifdef HAVE_SETENV
  5871. /* always make a copy, for consistency with !HAVE_SETENV */
  5872. char *str = xstrdup (value);
  5873. setenv (name, str, 1);
  5874. #else
  5875. size_t len = strlen (name) + 1 + strlen (value) + 1;
  5876. char *str = XMALLOC (char, len);
  5877. sprintf (str, "%s=%s", name, value);
  5878. if (putenv (str) != EXIT_SUCCESS)
  5879. {
  5880. XFREE (str);
  5881. }
  5882. #endif
  5883. }
  5884. }
  5885. char *
  5886. lt_extend_str (const char *orig_value, const char *add, int to_end)
  5887. {
  5888. char *new_value;
  5889. if (orig_value && *orig_value)
  5890. {
  5891. size_t orig_value_len = strlen (orig_value);
  5892. size_t add_len = strlen (add);
  5893. new_value = XMALLOC (char, add_len + orig_value_len + 1);
  5894. if (to_end)
  5895. {
  5896. strcpy (new_value, orig_value);
  5897. strcpy (new_value + orig_value_len, add);
  5898. }
  5899. else
  5900. {
  5901. strcpy (new_value, add);
  5902. strcpy (new_value + add_len, orig_value);
  5903. }
  5904. }
  5905. else
  5906. {
  5907. new_value = xstrdup (add);
  5908. }
  5909. return new_value;
  5910. }
  5911. void
  5912. lt_update_exe_path (const char *name, const char *value)
  5913. {
  5914. lt_debugprintf (__FILE__, __LINE__,
  5915. "(lt_update_exe_path) modifying '%s' by prepending '%s'\n",
  5916. nonnull (name), nonnull (value));
  5917. if (name && *name && value && *value)
  5918. {
  5919. char *new_value = lt_extend_str (getenv (name), value, 0);
  5920. /* some systems can't cope with a ':'-terminated path #' */
  5921. size_t len = strlen (new_value);
  5922. while ((len > 0) && IS_PATH_SEPARATOR (new_value[len-1]))
  5923. {
  5924. new_value[--len] = '\0';
  5925. }
  5926. lt_setenv (name, new_value);
  5927. XFREE (new_value);
  5928. }
  5929. }
  5930. void
  5931. lt_update_lib_path (const char *name, const char *value)
  5932. {
  5933. lt_debugprintf (__FILE__, __LINE__,
  5934. "(lt_update_lib_path) modifying '%s' by prepending '%s'\n",
  5935. nonnull (name), nonnull (value));
  5936. if (name && *name && value && *value)
  5937. {
  5938. char *new_value = lt_extend_str (getenv (name), value, 0);
  5939. lt_setenv (name, new_value);
  5940. XFREE (new_value);
  5941. }
  5942. }
  5943. EOF
  5944. case $host_os in
  5945. mingw*)
  5946. cat <<"EOF"
  5947. /* Prepares an argument vector before calling spawn().
  5948. Note that spawn() does not by itself call the command interpreter
  5949. (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") :
  5950. ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
  5951. GetVersionEx(&v);
  5952. v.dwPlatformId == VER_PLATFORM_WIN32_NT;
  5953. }) ? "cmd.exe" : "command.com").
  5954. Instead it simply concatenates the arguments, separated by ' ', and calls
  5955. CreateProcess(). We must quote the arguments since Win32 CreateProcess()
  5956. interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a
  5957. special way:
  5958. - Space and tab are interpreted as delimiters. They are not treated as
  5959. delimiters if they are surrounded by double quotes: "...".
  5960. - Unescaped double quotes are removed from the input. Their only effect is
  5961. that within double quotes, space and tab are treated like normal
  5962. characters.
  5963. - Backslashes not followed by double quotes are not special.
  5964. - But 2*n+1 backslashes followed by a double quote become
  5965. n backslashes followed by a double quote (n >= 0):
  5966. \" -> "
  5967. \\\" -> \"
  5968. \\\\\" -> \\"
  5969. */
  5970. #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"
  5971. #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"
  5972. char **
  5973. prepare_spawn (char **argv)
  5974. {
  5975. size_t argc;
  5976. char **new_argv;
  5977. size_t i;
  5978. /* Count number of arguments. */
  5979. for (argc = 0; argv[argc] != NULL; argc++)
  5980. ;
  5981. /* Allocate new argument vector. */
  5982. new_argv = XMALLOC (char *, argc + 1);
  5983. /* Put quoted arguments into the new argument vector. */
  5984. for (i = 0; i < argc; i++)
  5985. {
  5986. const char *string = argv[i];
  5987. if (string[0] == '\0')
  5988. new_argv[i] = xstrdup ("\"\"");
  5989. else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL)
  5990. {
  5991. int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL);
  5992. size_t length;
  5993. unsigned int backslashes;
  5994. const char *s;
  5995. char *quoted_string;
  5996. char *p;
  5997. length = 0;
  5998. backslashes = 0;
  5999. if (quote_around)
  6000. length++;
  6001. for (s = string; *s != '\0'; s++)
  6002. {
  6003. char c = *s;
  6004. if (c == '"')
  6005. length += backslashes + 1;
  6006. length++;
  6007. if (c == '\\')
  6008. backslashes++;
  6009. else
  6010. backslashes = 0;
  6011. }
  6012. if (quote_around)
  6013. length += backslashes + 1;
  6014. quoted_string = XMALLOC (char, length + 1);
  6015. p = quoted_string;
  6016. backslashes = 0;
  6017. if (quote_around)
  6018. *p++ = '"';
  6019. for (s = string; *s != '\0'; s++)
  6020. {
  6021. char c = *s;
  6022. if (c == '"')
  6023. {
  6024. unsigned int j;
  6025. for (j = backslashes + 1; j > 0; j--)
  6026. *p++ = '\\';
  6027. }
  6028. *p++ = c;
  6029. if (c == '\\')
  6030. backslashes++;
  6031. else
  6032. backslashes = 0;
  6033. }
  6034. if (quote_around)
  6035. {
  6036. unsigned int j;
  6037. for (j = backslashes; j > 0; j--)
  6038. *p++ = '\\';
  6039. *p++ = '"';
  6040. }
  6041. *p = '\0';
  6042. new_argv[i] = quoted_string;
  6043. }
  6044. else
  6045. new_argv[i] = (char *) string;
  6046. }
  6047. new_argv[argc] = NULL;
  6048. return new_argv;
  6049. }
  6050. EOF
  6051. ;;
  6052. esac
  6053. cat <<"EOF"
  6054. void lt_dump_script (FILE* f)
  6055. {
  6056. EOF
  6057. func_emit_wrapper yes |
  6058. $SED -n -e '
  6059. s/^\(.\{79\}\)\(..*\)/\1\
  6060. \2/
  6061. h
  6062. s/\([\\"]\)/\\\1/g
  6063. s/$/\\n/
  6064. s/\([^\n]*\).*/ fputs ("\1", f);/p
  6065. g
  6066. D'
  6067. cat <<"EOF"
  6068. }
  6069. EOF
  6070. }
  6071. # end: func_emit_cwrapperexe_src
  6072. # func_win32_import_lib_p ARG
  6073. # True if ARG is an import lib, as indicated by $file_magic_cmd
  6074. func_win32_import_lib_p ()
  6075. {
  6076. $debug_cmd
  6077. case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in
  6078. *import*) : ;;
  6079. *) false ;;
  6080. esac
  6081. }
  6082. # func_suncc_cstd_abi
  6083. # !!ONLY CALL THIS FOR SUN CC AFTER $compile_command IS FULLY EXPANDED!!
  6084. # Several compiler flags select an ABI that is incompatible with the
  6085. # Cstd library. Avoid specifying it if any are in CXXFLAGS.
  6086. func_suncc_cstd_abi ()
  6087. {
  6088. $debug_cmd
  6089. case " $compile_command " in
  6090. *" -compat=g "*|*\ -std=c++[0-9][0-9]\ *|*" -library=stdcxx4 "*|*" -library=stlport4 "*)
  6091. suncc_use_cstd_abi=no
  6092. ;;
  6093. *)
  6094. suncc_use_cstd_abi=yes
  6095. ;;
  6096. esac
  6097. }
  6098. # func_mode_link arg...
  6099. func_mode_link ()
  6100. {
  6101. $debug_cmd
  6102. case $host in
  6103. *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
  6104. # It is impossible to link a dll without this setting, and
  6105. # we shouldn't force the makefile maintainer to figure out
  6106. # what system we are compiling for in order to pass an extra
  6107. # flag for every libtool invocation.
  6108. # allow_undefined=no
  6109. # FIXME: Unfortunately, there are problems with the above when trying
  6110. # to make a dll that has undefined symbols, in which case not
  6111. # even a static library is built. For now, we need to specify
  6112. # -no-undefined on the libtool link line when we can be certain
  6113. # that all symbols are satisfied, otherwise we get a static library.
  6114. allow_undefined=yes
  6115. ;;
  6116. *)
  6117. allow_undefined=yes
  6118. ;;
  6119. esac
  6120. libtool_args=$nonopt
  6121. base_compile="$nonopt $@"
  6122. compile_command=$nonopt
  6123. finalize_command=$nonopt
  6124. compile_rpath=
  6125. finalize_rpath=
  6126. compile_shlibpath=
  6127. finalize_shlibpath=
  6128. convenience=
  6129. old_convenience=
  6130. deplibs=
  6131. old_deplibs=
  6132. compiler_flags=
  6133. linker_flags=
  6134. dllsearchpath=
  6135. lib_search_path=`pwd`
  6136. inst_prefix_dir=
  6137. new_inherited_linker_flags=
  6138. avoid_version=no
  6139. bindir=
  6140. dlfiles=
  6141. dlprefiles=
  6142. dlself=no
  6143. export_dynamic=no
  6144. export_symbols=
  6145. export_symbols_regex=
  6146. generated=
  6147. libobjs=
  6148. ltlibs=
  6149. module=no
  6150. no_install=no
  6151. objs=
  6152. os2dllname=
  6153. non_pic_objects=
  6154. precious_files_regex=
  6155. prefer_static_libs=no
  6156. preload=false
  6157. prev=
  6158. prevarg=
  6159. release=
  6160. rpath=
  6161. xrpath=
  6162. perm_rpath=
  6163. temp_rpath=
  6164. thread_safe=no
  6165. vinfo=
  6166. vinfo_number=no
  6167. weak_libs=
  6168. single_module=$wl-single_module
  6169. func_infer_tag $base_compile
  6170. # We need to know -static, to get the right output filenames.
  6171. for arg
  6172. do
  6173. case $arg in
  6174. -shared)
  6175. test yes != "$build_libtool_libs" \
  6176. && func_fatal_configuration "cannot build a shared library"
  6177. build_old_libs=no
  6178. break
  6179. ;;
  6180. -all-static | -static | -static-libtool-libs)
  6181. case $arg in
  6182. -all-static)
  6183. if test yes = "$build_libtool_libs" && test -z "$link_static_flag"; then
  6184. func_warning "complete static linking is impossible in this configuration"
  6185. fi
  6186. if test -n "$link_static_flag"; then
  6187. dlopen_self=$dlopen_self_static
  6188. fi
  6189. prefer_static_libs=yes
  6190. ;;
  6191. -static)
  6192. if test -z "$pic_flag" && test -n "$link_static_flag"; then
  6193. dlopen_self=$dlopen_self_static
  6194. fi
  6195. prefer_static_libs=built
  6196. ;;
  6197. -static-libtool-libs)
  6198. if test -z "$pic_flag" && test -n "$link_static_flag"; then
  6199. dlopen_self=$dlopen_self_static
  6200. fi
  6201. prefer_static_libs=yes
  6202. ;;
  6203. esac
  6204. build_libtool_libs=no
  6205. build_old_libs=yes
  6206. break
  6207. ;;
  6208. esac
  6209. done
  6210. # See if our shared archives depend on static archives.
  6211. test -n "$old_archive_from_new_cmds" && build_old_libs=yes
  6212. # Go through the arguments, transforming them on the way.
  6213. while test "$#" -gt 0; do
  6214. arg=$1
  6215. shift
  6216. func_quote_arg pretty,unquoted "$arg"
  6217. qarg=$func_quote_arg_unquoted_result
  6218. func_append libtool_args " $func_quote_arg_result"
  6219. # If the previous option needs an argument, assign it.
  6220. if test -n "$prev"; then
  6221. case $prev in
  6222. output)
  6223. func_append compile_command " @OUTPUT@"
  6224. func_append finalize_command " @OUTPUT@"
  6225. ;;
  6226. esac
  6227. case $prev in
  6228. bindir)
  6229. bindir=$arg
  6230. prev=
  6231. continue
  6232. ;;
  6233. dlfiles|dlprefiles)
  6234. $preload || {
  6235. # Add the symbol object into the linking commands.
  6236. func_append compile_command " @SYMFILE@"
  6237. func_append finalize_command " @SYMFILE@"
  6238. preload=:
  6239. }
  6240. case $arg in
  6241. *.la | *.lo) ;; # We handle these cases below.
  6242. force)
  6243. if test no = "$dlself"; then
  6244. dlself=needless
  6245. export_dynamic=yes
  6246. fi
  6247. prev=
  6248. continue
  6249. ;;
  6250. self)
  6251. if test dlprefiles = "$prev"; then
  6252. dlself=yes
  6253. elif test dlfiles = "$prev" && test yes != "$dlopen_self"; then
  6254. dlself=yes
  6255. else
  6256. dlself=needless
  6257. export_dynamic=yes
  6258. fi
  6259. prev=
  6260. continue
  6261. ;;
  6262. *)
  6263. if test dlfiles = "$prev"; then
  6264. func_append dlfiles " $arg"
  6265. else
  6266. func_append dlprefiles " $arg"
  6267. fi
  6268. prev=
  6269. continue
  6270. ;;
  6271. esac
  6272. ;;
  6273. expsyms)
  6274. export_symbols=$arg
  6275. test -f "$arg" \
  6276. || func_fatal_error "symbol file '$arg' does not exist"
  6277. prev=
  6278. continue
  6279. ;;
  6280. expsyms_regex)
  6281. export_symbols_regex=$arg
  6282. prev=
  6283. continue
  6284. ;;
  6285. framework)
  6286. case $host in
  6287. *-*-darwin*)
  6288. case "$deplibs " in
  6289. *" $qarg.ltframework "*) ;;
  6290. *) func_append deplibs " $qarg.ltframework" # this is fixed later
  6291. ;;
  6292. esac
  6293. ;;
  6294. esac
  6295. prev=
  6296. continue
  6297. ;;
  6298. inst_prefix)
  6299. inst_prefix_dir=$arg
  6300. prev=
  6301. continue
  6302. ;;
  6303. mllvm)
  6304. # Clang does not use LLVM to link, so we can simply discard any
  6305. # '-mllvm $arg' options when doing the link step.
  6306. prev=
  6307. continue
  6308. ;;
  6309. objectlist)
  6310. if test -f "$arg"; then
  6311. save_arg=$arg
  6312. moreargs=
  6313. for fil in `cat "$save_arg"`
  6314. do
  6315. # func_append moreargs " $fil"
  6316. arg=$fil
  6317. # A libtool-controlled object.
  6318. # Check to see that this really is a libtool object.
  6319. if func_lalib_unsafe_p "$arg"; then
  6320. pic_object=
  6321. non_pic_object=
  6322. # Read the .lo file
  6323. func_source "$arg"
  6324. if test -z "$pic_object" ||
  6325. test -z "$non_pic_object" ||
  6326. test none = "$pic_object" &&
  6327. test none = "$non_pic_object"; then
  6328. func_fatal_error "cannot find name of object for '$arg'"
  6329. fi
  6330. # Extract subdirectory from the argument.
  6331. func_dirname "$arg" "/" ""
  6332. xdir=$func_dirname_result
  6333. if test none != "$pic_object"; then
  6334. # Prepend the subdirectory the object is found in.
  6335. pic_object=$xdir$pic_object
  6336. if test dlfiles = "$prev"; then
  6337. if test yes = "$build_libtool_libs" && test yes = "$dlopen_support"; then
  6338. func_append dlfiles " $pic_object"
  6339. prev=
  6340. continue
  6341. else
  6342. # If libtool objects are unsupported, then we need to preload.
  6343. prev=dlprefiles
  6344. fi
  6345. fi
  6346. # CHECK ME: I think I busted this. -Ossama
  6347. if test dlprefiles = "$prev"; then
  6348. # Preload the old-style object.
  6349. func_append dlprefiles " $pic_object"
  6350. prev=
  6351. fi
  6352. # A PIC object.
  6353. func_append libobjs " $pic_object"
  6354. arg=$pic_object
  6355. fi
  6356. # Non-PIC object.
  6357. if test none != "$non_pic_object"; then
  6358. # Prepend the subdirectory the object is found in.
  6359. non_pic_object=$xdir$non_pic_object
  6360. # A standard non-PIC object
  6361. func_append non_pic_objects " $non_pic_object"
  6362. if test -z "$pic_object" || test none = "$pic_object"; then
  6363. arg=$non_pic_object
  6364. fi
  6365. else
  6366. # If the PIC object exists, use it instead.
  6367. # $xdir was prepended to $pic_object above.
  6368. non_pic_object=$pic_object
  6369. func_append non_pic_objects " $non_pic_object"
  6370. fi
  6371. else
  6372. # Only an error if not doing a dry-run.
  6373. if $opt_dry_run; then
  6374. # Extract subdirectory from the argument.
  6375. func_dirname "$arg" "/" ""
  6376. xdir=$func_dirname_result
  6377. func_lo2o "$arg"
  6378. pic_object=$xdir$objdir/$func_lo2o_result
  6379. non_pic_object=$xdir$func_lo2o_result
  6380. func_append libobjs " $pic_object"
  6381. func_append non_pic_objects " $non_pic_object"
  6382. else
  6383. func_fatal_error "'$arg' is not a valid libtool object"
  6384. fi
  6385. fi
  6386. done
  6387. else
  6388. func_fatal_error "link input file '$arg' does not exist"
  6389. fi
  6390. arg=$save_arg
  6391. prev=
  6392. continue
  6393. ;;
  6394. os2dllname)
  6395. os2dllname=$arg
  6396. prev=
  6397. continue
  6398. ;;
  6399. precious_regex)
  6400. precious_files_regex=$arg
  6401. prev=
  6402. continue
  6403. ;;
  6404. release)
  6405. release=-$arg
  6406. prev=
  6407. continue
  6408. ;;
  6409. rpath | xrpath)
  6410. # We need an absolute path.
  6411. case $arg in
  6412. [\\/]* | [A-Za-z]:[\\/]*) ;;
  6413. *)
  6414. func_fatal_error "only absolute run-paths are allowed"
  6415. ;;
  6416. esac
  6417. if test rpath = "$prev"; then
  6418. case "$rpath " in
  6419. *" $arg "*) ;;
  6420. *) func_append rpath " $arg" ;;
  6421. esac
  6422. else
  6423. case "$xrpath " in
  6424. *" $arg "*) ;;
  6425. *) func_append xrpath " $arg" ;;
  6426. esac
  6427. fi
  6428. prev=
  6429. continue
  6430. ;;
  6431. shrext)
  6432. shrext_cmds=$arg
  6433. prev=
  6434. continue
  6435. ;;
  6436. weak)
  6437. func_append weak_libs " $arg"
  6438. prev=
  6439. continue
  6440. ;;
  6441. xcclinker)
  6442. func_append linker_flags " $qarg"
  6443. func_append compiler_flags " $qarg"
  6444. prev=
  6445. func_append compile_command " $qarg"
  6446. func_append finalize_command " $qarg"
  6447. continue
  6448. ;;
  6449. xcompiler)
  6450. func_append compiler_flags " $qarg"
  6451. prev=
  6452. func_append compile_command " $qarg"
  6453. func_append finalize_command " $qarg"
  6454. continue
  6455. ;;
  6456. xlinker)
  6457. func_append linker_flags " $qarg"
  6458. func_append compiler_flags " $wl$qarg"
  6459. prev=
  6460. func_append compile_command " $wl$qarg"
  6461. func_append finalize_command " $wl$qarg"
  6462. continue
  6463. ;;
  6464. *)
  6465. eval "$prev=\"\$arg\""
  6466. prev=
  6467. continue
  6468. ;;
  6469. esac
  6470. fi # test -n "$prev"
  6471. prevarg=$arg
  6472. case $arg in
  6473. -all-static)
  6474. if test -n "$link_static_flag"; then
  6475. # See comment for -static flag below, for more details.
  6476. func_append compile_command " $link_static_flag"
  6477. func_append finalize_command " $link_static_flag"
  6478. fi
  6479. continue
  6480. ;;
  6481. -allow-undefined)
  6482. # FIXME: remove this flag sometime in the future.
  6483. func_fatal_error "'-allow-undefined' must not be used because it is the default"
  6484. ;;
  6485. -avoid-version)
  6486. avoid_version=yes
  6487. continue
  6488. ;;
  6489. -bindir)
  6490. prev=bindir
  6491. continue
  6492. ;;
  6493. -dlopen)
  6494. prev=dlfiles
  6495. continue
  6496. ;;
  6497. -dlpreopen)
  6498. prev=dlprefiles
  6499. continue
  6500. ;;
  6501. -export-dynamic)
  6502. export_dynamic=yes
  6503. continue
  6504. ;;
  6505. -export-symbols | -export-symbols-regex)
  6506. if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
  6507. func_fatal_error "more than one -exported-symbols argument is not allowed"
  6508. fi
  6509. if test X-export-symbols = "X$arg"; then
  6510. prev=expsyms
  6511. else
  6512. prev=expsyms_regex
  6513. fi
  6514. continue
  6515. ;;
  6516. -framework)
  6517. prev=framework
  6518. continue
  6519. ;;
  6520. -inst-prefix-dir)
  6521. prev=inst_prefix
  6522. continue
  6523. ;;
  6524. # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
  6525. # so, if we see these flags be careful not to treat them like -L
  6526. -L[A-Z][A-Z]*:*)
  6527. case $with_gcc/$host in
  6528. no/*-*-irix* | /*-*-irix*)
  6529. func_append compile_command " $arg"
  6530. func_append finalize_command " $arg"
  6531. ;;
  6532. esac
  6533. continue
  6534. ;;
  6535. -L*)
  6536. func_stripname "-L" '' "$arg"
  6537. if test -z "$func_stripname_result"; then
  6538. if test "$#" -gt 0; then
  6539. func_fatal_error "require no space between '-L' and '$1'"
  6540. else
  6541. func_fatal_error "need path for '-L' option"
  6542. fi
  6543. fi
  6544. func_resolve_sysroot "$func_stripname_result"
  6545. dir=$func_resolve_sysroot_result
  6546. # We need an absolute path.
  6547. case $dir in
  6548. [\\/]* | [A-Za-z]:[\\/]*) ;;
  6549. *)
  6550. absdir=`cd "$dir" && pwd`
  6551. test -z "$absdir" && \
  6552. func_fatal_error "cannot determine absolute directory name of '$dir'"
  6553. dir=$absdir
  6554. ;;
  6555. esac
  6556. case "$deplibs " in
  6557. *" -L$dir "* | *" $arg "*)
  6558. # Will only happen for absolute or sysroot arguments
  6559. ;;
  6560. *)
  6561. # Preserve sysroot, but never include relative directories
  6562. case $dir in
  6563. [\\/]* | [A-Za-z]:[\\/]* | =*) func_append deplibs " $arg" ;;
  6564. *) func_append deplibs " -L$dir" ;;
  6565. esac
  6566. func_append lib_search_path " $dir"
  6567. ;;
  6568. esac
  6569. case $host in
  6570. *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
  6571. testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'`
  6572. case :$dllsearchpath: in
  6573. *":$dir:"*) ;;
  6574. ::) dllsearchpath=$dir;;
  6575. *) func_append dllsearchpath ":$dir";;
  6576. esac
  6577. case :$dllsearchpath: in
  6578. *":$testbindir:"*) ;;
  6579. ::) dllsearchpath=$testbindir;;
  6580. *) func_append dllsearchpath ":$testbindir";;
  6581. esac
  6582. ;;
  6583. esac
  6584. continue
  6585. ;;
  6586. -l*)
  6587. if test X-lc = "X$arg" || test X-lm = "X$arg"; then
  6588. case $host in
  6589. *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*)
  6590. # These systems don't actually have a C or math library (as such)
  6591. continue
  6592. ;;
  6593. *-*-os2*)
  6594. # These systems don't actually have a C library (as such)
  6595. test X-lc = "X$arg" && continue
  6596. ;;
  6597. *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig*)
  6598. # Do not include libc due to us having libc/libc_r.
  6599. test X-lc = "X$arg" && continue
  6600. ;;
  6601. *-*-rhapsody* | *-*-darwin1.[012])
  6602. # Rhapsody C and math libraries are in the System framework
  6603. func_append deplibs " System.ltframework"
  6604. continue
  6605. ;;
  6606. *-*-sco3.2v5* | *-*-sco5v6*)
  6607. # Causes problems with __ctype
  6608. test X-lc = "X$arg" && continue
  6609. ;;
  6610. *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
  6611. # Compiler inserts libc in the correct place for threads to work
  6612. test X-lc = "X$arg" && continue
  6613. ;;
  6614. esac
  6615. elif test X-lc_r = "X$arg"; then
  6616. case $host in
  6617. *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig*)
  6618. # Do not include libc_r directly, use -pthread flag.
  6619. continue
  6620. ;;
  6621. esac
  6622. fi
  6623. func_append deplibs " $arg"
  6624. continue
  6625. ;;
  6626. -mllvm)
  6627. prev=mllvm
  6628. continue
  6629. ;;
  6630. -module)
  6631. module=yes
  6632. continue
  6633. ;;
  6634. # Tru64 UNIX uses -model [arg] to determine the layout of C++
  6635. # classes, name mangling, and exception handling.
  6636. # Darwin uses the -arch flag to determine output architecture.
  6637. -model|-arch|-isysroot|--sysroot)
  6638. func_append compiler_flags " $arg"
  6639. func_append compile_command " $arg"
  6640. func_append finalize_command " $arg"
  6641. prev=xcompiler
  6642. continue
  6643. ;;
  6644. -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
  6645. |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
  6646. func_append compiler_flags " $arg"
  6647. func_append compile_command " $arg"
  6648. func_append finalize_command " $arg"
  6649. case "$new_inherited_linker_flags " in
  6650. *" $arg "*) ;;
  6651. * ) func_append new_inherited_linker_flags " $arg" ;;
  6652. esac
  6653. continue
  6654. ;;
  6655. -multi_module)
  6656. single_module=$wl-multi_module
  6657. continue
  6658. ;;
  6659. -no-fast-install)
  6660. fast_install=no
  6661. continue
  6662. ;;
  6663. -no-install)
  6664. case $host in
  6665. *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*)
  6666. # The PATH hackery in wrapper scripts is required on Windows
  6667. # and Darwin in order for the loader to find any dlls it needs.
  6668. func_warning "'-no-install' is ignored for $host"
  6669. func_warning "assuming '-no-fast-install' instead"
  6670. fast_install=no
  6671. ;;
  6672. *) no_install=yes ;;
  6673. esac
  6674. continue
  6675. ;;
  6676. -no-undefined)
  6677. allow_undefined=no
  6678. continue
  6679. ;;
  6680. -objectlist)
  6681. prev=objectlist
  6682. continue
  6683. ;;
  6684. -os2dllname)
  6685. prev=os2dllname
  6686. continue
  6687. ;;
  6688. -o) prev=output ;;
  6689. -precious-files-regex)
  6690. prev=precious_regex
  6691. continue
  6692. ;;
  6693. -release)
  6694. prev=release
  6695. continue
  6696. ;;
  6697. -rpath)
  6698. prev=rpath
  6699. continue
  6700. ;;
  6701. -R)
  6702. prev=xrpath
  6703. continue
  6704. ;;
  6705. -R*)
  6706. func_stripname '-R' '' "$arg"
  6707. dir=$func_stripname_result
  6708. # We need an absolute path.
  6709. case $dir in
  6710. [\\/]* | [A-Za-z]:[\\/]*) ;;
  6711. =*)
  6712. func_stripname '=' '' "$dir"
  6713. dir=$lt_sysroot$func_stripname_result
  6714. ;;
  6715. *)
  6716. func_fatal_error "only absolute run-paths are allowed"
  6717. ;;
  6718. esac
  6719. case "$xrpath " in
  6720. *" $dir "*) ;;
  6721. *) func_append xrpath " $dir" ;;
  6722. esac
  6723. continue
  6724. ;;
  6725. -shared)
  6726. # The effects of -shared are defined in a previous loop.
  6727. continue
  6728. ;;
  6729. -shrext)
  6730. prev=shrext
  6731. continue
  6732. ;;
  6733. -static | -static-libtool-libs)
  6734. # The effects of -static are defined in a previous loop.
  6735. # We used to do the same as -all-static on platforms that
  6736. # didn't have a PIC flag, but the assumption that the effects
  6737. # would be equivalent was wrong. It would break on at least
  6738. # Digital Unix and AIX.
  6739. continue
  6740. ;;
  6741. -thread-safe)
  6742. thread_safe=yes
  6743. continue
  6744. ;;
  6745. -version-info)
  6746. prev=vinfo
  6747. continue
  6748. ;;
  6749. -version-number)
  6750. prev=vinfo
  6751. vinfo_number=yes
  6752. continue
  6753. ;;
  6754. -weak)
  6755. prev=weak
  6756. continue
  6757. ;;
  6758. -Wc,*)
  6759. func_stripname '-Wc,' '' "$arg"
  6760. args=$func_stripname_result
  6761. arg=
  6762. save_ifs=$IFS; IFS=,
  6763. for flag in $args; do
  6764. IFS=$save_ifs
  6765. func_quote_arg pretty "$flag"
  6766. func_append arg " $func_quote_arg_result"
  6767. func_append compiler_flags " $func_quote_arg_result"
  6768. done
  6769. IFS=$save_ifs
  6770. func_stripname ' ' '' "$arg"
  6771. arg=$func_stripname_result
  6772. ;;
  6773. -Wl,*)
  6774. func_stripname '-Wl,' '' "$arg"
  6775. args=$func_stripname_result
  6776. arg=
  6777. save_ifs=$IFS; IFS=,
  6778. for flag in $args; do
  6779. IFS=$save_ifs
  6780. func_quote_arg pretty "$flag"
  6781. func_append arg " $wl$func_quote_arg_result"
  6782. func_append compiler_flags " $wl$func_quote_arg_result"
  6783. func_append linker_flags " $func_quote_arg_result"
  6784. done
  6785. IFS=$save_ifs
  6786. func_stripname ' ' '' "$arg"
  6787. arg=$func_stripname_result
  6788. ;;
  6789. -Xcompiler)
  6790. prev=xcompiler
  6791. continue
  6792. ;;
  6793. -Xlinker)
  6794. prev=xlinker
  6795. continue
  6796. ;;
  6797. -XCClinker)
  6798. prev=xcclinker
  6799. continue
  6800. ;;
  6801. # -msg_* for osf cc
  6802. -msg_*)
  6803. func_quote_arg pretty "$arg"
  6804. arg=$func_quote_arg_result
  6805. ;;
  6806. # Flags to be passed through unchanged, with rationale:
  6807. # -64, -mips[0-9] enable 64-bit mode for the SGI compiler
  6808. # -r[0-9][0-9]* specify processor for the SGI compiler
  6809. # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler
  6810. # +DA*, +DD* enable 64-bit mode for the HP compiler
  6811. # -q* compiler args for the IBM compiler
  6812. # -m*, -t[45]*, -txscale* architecture-specific flags for GCC
  6813. # -F/path path to uninstalled frameworks, gcc on darwin
  6814. # -p, -pg, --coverage, -fprofile-* profiling flags for GCC
  6815. # -fstack-protector* stack protector flags for GCC
  6816. # @file GCC response files
  6817. # -tp=* Portland pgcc target processor selection
  6818. # --sysroot=* for sysroot support
  6819. # -O*, -g*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization
  6820. # -specs=* GCC specs files
  6821. # -stdlib=* select c++ std lib with clang
  6822. # -fsanitize=* Clang/GCC memory and address sanitizer
  6823. -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
  6824. -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \
  6825. -O*|-g*|-flto*|-fwhopr*|-fuse-linker-plugin|-fstack-protector*|-stdlib=*| \
  6826. -specs=*|-fsanitize=*)
  6827. func_quote_arg pretty "$arg"
  6828. arg=$func_quote_arg_result
  6829. func_append compile_command " $arg"
  6830. func_append finalize_command " $arg"
  6831. func_append compiler_flags " $arg"
  6832. continue
  6833. ;;
  6834. -Z*)
  6835. if test os2 = "`expr $host : '.*\(os2\)'`"; then
  6836. # OS/2 uses -Zxxx to specify OS/2-specific options
  6837. compiler_flags="$compiler_flags $arg"
  6838. func_append compile_command " $arg"
  6839. func_append finalize_command " $arg"
  6840. case $arg in
  6841. -Zlinker | -Zstack)
  6842. prev=xcompiler
  6843. ;;
  6844. esac
  6845. continue
  6846. else
  6847. # Otherwise treat like 'Some other compiler flag' below
  6848. func_quote_arg pretty "$arg"
  6849. arg=$func_quote_arg_result
  6850. fi
  6851. ;;
  6852. # Some other compiler flag.
  6853. -* | +*)
  6854. func_quote_arg pretty "$arg"
  6855. arg=$func_quote_arg_result
  6856. ;;
  6857. *.$objext)
  6858. # A standard object.
  6859. func_append objs " $arg"
  6860. ;;
  6861. *.lo)
  6862. # A libtool-controlled object.
  6863. # Check to see that this really is a libtool object.
  6864. if func_lalib_unsafe_p "$arg"; then
  6865. pic_object=
  6866. non_pic_object=
  6867. # Read the .lo file
  6868. func_source "$arg"
  6869. if test -z "$pic_object" ||
  6870. test -z "$non_pic_object" ||
  6871. test none = "$pic_object" &&
  6872. test none = "$non_pic_object"; then
  6873. func_fatal_error "cannot find name of object for '$arg'"
  6874. fi
  6875. # Extract subdirectory from the argument.
  6876. func_dirname "$arg" "/" ""
  6877. xdir=$func_dirname_result
  6878. test none = "$pic_object" || {
  6879. # Prepend the subdirectory the object is found in.
  6880. pic_object=$xdir$pic_object
  6881. if test dlfiles = "$prev"; then
  6882. if test yes = "$build_libtool_libs" && test yes = "$dlopen_support"; then
  6883. func_append dlfiles " $pic_object"
  6884. prev=
  6885. continue
  6886. else
  6887. # If libtool objects are unsupported, then we need to preload.
  6888. prev=dlprefiles
  6889. fi
  6890. fi
  6891. # CHECK ME: I think I busted this. -Ossama
  6892. if test dlprefiles = "$prev"; then
  6893. # Preload the old-style object.
  6894. func_append dlprefiles " $pic_object"
  6895. prev=
  6896. fi
  6897. # A PIC object.
  6898. func_append libobjs " $pic_object"
  6899. arg=$pic_object
  6900. }
  6901. # Non-PIC object.
  6902. if test none != "$non_pic_object"; then
  6903. # Prepend the subdirectory the object is found in.
  6904. non_pic_object=$xdir$non_pic_object
  6905. # A standard non-PIC object
  6906. func_append non_pic_objects " $non_pic_object"
  6907. if test -z "$pic_object" || test none = "$pic_object"; then
  6908. arg=$non_pic_object
  6909. fi
  6910. else
  6911. # If the PIC object exists, use it instead.
  6912. # $xdir was prepended to $pic_object above.
  6913. non_pic_object=$pic_object
  6914. func_append non_pic_objects " $non_pic_object"
  6915. fi
  6916. else
  6917. # Only an error if not doing a dry-run.
  6918. if $opt_dry_run; then
  6919. # Extract subdirectory from the argument.
  6920. func_dirname "$arg" "/" ""
  6921. xdir=$func_dirname_result
  6922. func_lo2o "$arg"
  6923. pic_object=$xdir$objdir/$func_lo2o_result
  6924. non_pic_object=$xdir$func_lo2o_result
  6925. func_append libobjs " $pic_object"
  6926. func_append non_pic_objects " $non_pic_object"
  6927. else
  6928. func_fatal_error "'$arg' is not a valid libtool object"
  6929. fi
  6930. fi
  6931. ;;
  6932. *.$libext)
  6933. # An archive.
  6934. func_append deplibs " $arg"
  6935. func_append old_deplibs " $arg"
  6936. continue
  6937. ;;
  6938. *.la)
  6939. # A libtool-controlled library.
  6940. func_resolve_sysroot "$arg"
  6941. if test dlfiles = "$prev"; then
  6942. # This library was specified with -dlopen.
  6943. func_append dlfiles " $func_resolve_sysroot_result"
  6944. prev=
  6945. elif test dlprefiles = "$prev"; then
  6946. # The library was specified with -dlpreopen.
  6947. func_append dlprefiles " $func_resolve_sysroot_result"
  6948. prev=
  6949. else
  6950. func_append deplibs " $func_resolve_sysroot_result"
  6951. fi
  6952. continue
  6953. ;;
  6954. # Some other compiler argument.
  6955. *)
  6956. # Unknown arguments in both finalize_command and compile_command need
  6957. # to be aesthetically quoted because they are evaled later.
  6958. func_quote_arg pretty "$arg"
  6959. arg=$func_quote_arg_result
  6960. ;;
  6961. esac # arg
  6962. # Now actually substitute the argument into the commands.
  6963. if test -n "$arg"; then
  6964. func_append compile_command " $arg"
  6965. func_append finalize_command " $arg"
  6966. fi
  6967. done # argument parsing loop
  6968. test -n "$prev" && \
  6969. func_fatal_help "the '$prevarg' option requires an argument"
  6970. if test yes = "$export_dynamic" && test -n "$export_dynamic_flag_spec"; then
  6971. eval arg=\"$export_dynamic_flag_spec\"
  6972. func_append compile_command " $arg"
  6973. func_append finalize_command " $arg"
  6974. fi
  6975. oldlibs=
  6976. # calculate the name of the file, without its directory
  6977. func_basename "$output"
  6978. outputname=$func_basename_result
  6979. libobjs_save=$libobjs
  6980. if test -n "$shlibpath_var"; then
  6981. # get the directories listed in $shlibpath_var
  6982. eval shlib_search_path=\`\$ECHO \"\$$shlibpath_var\" \| \$SED \'s/:/ /g\'\`
  6983. else
  6984. shlib_search_path=
  6985. fi
  6986. eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
  6987. eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
  6988. # Definition is injected by LT_CONFIG during libtool generation.
  6989. func_munge_path_list sys_lib_dlsearch_path "$LT_SYS_LIBRARY_PATH"
  6990. func_dirname "$output" "/" ""
  6991. output_objdir=$func_dirname_result$objdir
  6992. func_to_tool_file "$output_objdir/"
  6993. tool_output_objdir=$func_to_tool_file_result
  6994. # Create the object directory.
  6995. func_mkdir_p "$output_objdir"
  6996. # Determine the type of output
  6997. case $output in
  6998. "")
  6999. func_fatal_help "you must specify an output file"
  7000. ;;
  7001. *.$libext) linkmode=oldlib ;;
  7002. *.lo | *.$objext) linkmode=obj ;;
  7003. *.la) linkmode=lib ;;
  7004. *) linkmode=prog ;; # Anything else should be a program.
  7005. esac
  7006. specialdeplibs=
  7007. libs=
  7008. # Find all interdependent deplibs by searching for libraries
  7009. # that are linked more than once (e.g. -la -lb -la)
  7010. for deplib in $deplibs; do
  7011. if $opt_preserve_dup_deps; then
  7012. case "$libs " in
  7013. *" $deplib "*) func_append specialdeplibs " $deplib" ;;
  7014. esac
  7015. fi
  7016. func_append libs " $deplib"
  7017. done
  7018. if test lib = "$linkmode"; then
  7019. libs="$predeps $libs $compiler_lib_search_path $postdeps"
  7020. # Compute libraries that are listed more than once in $predeps
  7021. # $postdeps and mark them as special (i.e., whose duplicates are
  7022. # not to be eliminated).
  7023. pre_post_deps=
  7024. if $opt_duplicate_compiler_generated_deps; then
  7025. for pre_post_dep in $predeps $postdeps; do
  7026. case "$pre_post_deps " in
  7027. *" $pre_post_dep "*) func_append specialdeplibs " $pre_post_deps" ;;
  7028. esac
  7029. func_append pre_post_deps " $pre_post_dep"
  7030. done
  7031. fi
  7032. pre_post_deps=
  7033. fi
  7034. deplibs=
  7035. newdependency_libs=
  7036. newlib_search_path=
  7037. need_relink=no # whether we're linking any uninstalled libtool libraries
  7038. notinst_deplibs= # not-installed libtool libraries
  7039. notinst_path= # paths that contain not-installed libtool libraries
  7040. case $linkmode in
  7041. lib)
  7042. passes="conv dlpreopen link"
  7043. for file in $dlfiles $dlprefiles; do
  7044. case $file in
  7045. *.la) ;;
  7046. *)
  7047. func_fatal_help "libraries can '-dlopen' only libtool libraries: $file"
  7048. ;;
  7049. esac
  7050. done
  7051. ;;
  7052. prog)
  7053. compile_deplibs=
  7054. finalize_deplibs=
  7055. alldeplibs=false
  7056. newdlfiles=
  7057. newdlprefiles=
  7058. passes="conv scan dlopen dlpreopen link"
  7059. ;;
  7060. *) passes="conv"
  7061. ;;
  7062. esac
  7063. for pass in $passes; do
  7064. # The preopen pass in lib mode reverses $deplibs; put it back here
  7065. # so that -L comes before libs that need it for instance...
  7066. if test lib,link = "$linkmode,$pass"; then
  7067. ## FIXME: Find the place where the list is rebuilt in the wrong
  7068. ## order, and fix it there properly
  7069. tmp_deplibs=
  7070. for deplib in $deplibs; do
  7071. tmp_deplibs="$deplib $tmp_deplibs"
  7072. done
  7073. deplibs=$tmp_deplibs
  7074. fi
  7075. if test lib,link = "$linkmode,$pass" ||
  7076. test prog,scan = "$linkmode,$pass"; then
  7077. libs=$deplibs
  7078. deplibs=
  7079. fi
  7080. if test prog = "$linkmode"; then
  7081. case $pass in
  7082. dlopen) libs=$dlfiles ;;
  7083. dlpreopen) libs=$dlprefiles ;;
  7084. link)
  7085. libs="$deplibs %DEPLIBS%"
  7086. test "X$link_all_deplibs" != Xno && libs="$libs $dependency_libs"
  7087. ;;
  7088. esac
  7089. fi
  7090. if test lib,dlpreopen = "$linkmode,$pass"; then
  7091. # Collect and forward deplibs of preopened libtool libs
  7092. for lib in $dlprefiles; do
  7093. # Ignore non-libtool-libs
  7094. dependency_libs=
  7095. func_resolve_sysroot "$lib"
  7096. case $lib in
  7097. *.la) func_source "$func_resolve_sysroot_result" ;;
  7098. esac
  7099. # Collect preopened libtool deplibs, except any this library
  7100. # has declared as weak libs
  7101. for deplib in $dependency_libs; do
  7102. func_basename "$deplib"
  7103. deplib_base=$func_basename_result
  7104. case " $weak_libs " in
  7105. *" $deplib_base "*) ;;
  7106. *) func_append deplibs " $deplib" ;;
  7107. esac
  7108. done
  7109. done
  7110. libs=$dlprefiles
  7111. fi
  7112. if test dlopen = "$pass"; then
  7113. # Collect dlpreopened libraries
  7114. save_deplibs=$deplibs
  7115. deplibs=
  7116. fi
  7117. for deplib in $libs; do
  7118. lib=
  7119. found=false
  7120. case $deplib in
  7121. -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
  7122. |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
  7123. if test prog,link = "$linkmode,$pass"; then
  7124. compile_deplibs="$deplib $compile_deplibs"
  7125. finalize_deplibs="$deplib $finalize_deplibs"
  7126. else
  7127. func_append compiler_flags " $deplib"
  7128. if test lib = "$linkmode"; then
  7129. case "$new_inherited_linker_flags " in
  7130. *" $deplib "*) ;;
  7131. * ) func_append new_inherited_linker_flags " $deplib" ;;
  7132. esac
  7133. fi
  7134. fi
  7135. continue
  7136. ;;
  7137. -l*)
  7138. if test lib != "$linkmode" && test prog != "$linkmode"; then
  7139. func_warning "'-l' is ignored for archives/objects"
  7140. continue
  7141. fi
  7142. func_stripname '-l' '' "$deplib"
  7143. name=$func_stripname_result
  7144. if test lib = "$linkmode"; then
  7145. searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path"
  7146. else
  7147. searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path"
  7148. fi
  7149. for searchdir in $searchdirs; do
  7150. for search_ext in .la $std_shrext .so .a; do
  7151. # Search the libtool library
  7152. lib=$searchdir/lib$name$search_ext
  7153. if test -f "$lib"; then
  7154. if test .la = "$search_ext"; then
  7155. found=:
  7156. else
  7157. found=false
  7158. fi
  7159. break 2
  7160. fi
  7161. done
  7162. done
  7163. if $found; then
  7164. # deplib is a libtool library
  7165. # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
  7166. # We need to do some special things here, and not later.
  7167. if test yes = "$allow_libtool_libs_with_static_runtimes"; then
  7168. case " $predeps $postdeps " in
  7169. *" $deplib "*)
  7170. if func_lalib_p "$lib"; then
  7171. library_names=
  7172. old_library=
  7173. func_source "$lib"
  7174. for l in $old_library $library_names; do
  7175. ll=$l
  7176. done
  7177. if test "X$ll" = "X$old_library"; then # only static version available
  7178. found=false
  7179. func_dirname "$lib" "" "."
  7180. ladir=$func_dirname_result
  7181. lib=$ladir/$old_library
  7182. if test prog,link = "$linkmode,$pass"; then
  7183. compile_deplibs="$deplib $compile_deplibs"
  7184. finalize_deplibs="$deplib $finalize_deplibs"
  7185. else
  7186. deplibs="$deplib $deplibs"
  7187. test lib = "$linkmode" && newdependency_libs="$deplib $newdependency_libs"
  7188. fi
  7189. continue
  7190. fi
  7191. fi
  7192. ;;
  7193. *) ;;
  7194. esac
  7195. fi
  7196. else
  7197. # deplib doesn't seem to be a libtool library
  7198. if test prog,link = "$linkmode,$pass"; then
  7199. compile_deplibs="$deplib $compile_deplibs"
  7200. finalize_deplibs="$deplib $finalize_deplibs"
  7201. else
  7202. deplibs="$deplib $deplibs"
  7203. test lib = "$linkmode" && newdependency_libs="$deplib $newdependency_libs"
  7204. fi
  7205. continue
  7206. fi
  7207. ;; # -l
  7208. *.ltframework)
  7209. if test prog,link = "$linkmode,$pass"; then
  7210. compile_deplibs="$deplib $compile_deplibs"
  7211. finalize_deplibs="$deplib $finalize_deplibs"
  7212. else
  7213. deplibs="$deplib $deplibs"
  7214. if test lib = "$linkmode"; then
  7215. case "$new_inherited_linker_flags " in
  7216. *" $deplib "*) ;;
  7217. * ) func_append new_inherited_linker_flags " $deplib" ;;
  7218. esac
  7219. fi
  7220. fi
  7221. continue
  7222. ;;
  7223. -L*)
  7224. case $linkmode in
  7225. lib)
  7226. deplibs="$deplib $deplibs"
  7227. test conv = "$pass" && continue
  7228. newdependency_libs="$deplib $newdependency_libs"
  7229. func_stripname '-L' '' "$deplib"
  7230. func_resolve_sysroot "$func_stripname_result"
  7231. func_append newlib_search_path " $func_resolve_sysroot_result"
  7232. ;;
  7233. prog)
  7234. if test conv = "$pass"; then
  7235. deplibs="$deplib $deplibs"
  7236. continue
  7237. fi
  7238. if test scan = "$pass"; then
  7239. deplibs="$deplib $deplibs"
  7240. else
  7241. compile_deplibs="$deplib $compile_deplibs"
  7242. finalize_deplibs="$deplib $finalize_deplibs"
  7243. fi
  7244. func_stripname '-L' '' "$deplib"
  7245. func_resolve_sysroot "$func_stripname_result"
  7246. func_append newlib_search_path " $func_resolve_sysroot_result"
  7247. ;;
  7248. *)
  7249. func_warning "'-L' is ignored for archives/objects"
  7250. ;;
  7251. esac # linkmode
  7252. continue
  7253. ;; # -L
  7254. -R*)
  7255. if test link = "$pass"; then
  7256. func_stripname '-R' '' "$deplib"
  7257. func_resolve_sysroot "$func_stripname_result"
  7258. dir=$func_resolve_sysroot_result
  7259. # Make sure the xrpath contains only unique directories.
  7260. case "$xrpath " in
  7261. *" $dir "*) ;;
  7262. *) func_append xrpath " $dir" ;;
  7263. esac
  7264. fi
  7265. deplibs="$deplib $deplibs"
  7266. continue
  7267. ;;
  7268. *.la)
  7269. func_resolve_sysroot "$deplib"
  7270. lib=$func_resolve_sysroot_result
  7271. ;;
  7272. *.$libext)
  7273. if test conv = "$pass"; then
  7274. deplibs="$deplib $deplibs"
  7275. continue
  7276. fi
  7277. case $linkmode in
  7278. lib)
  7279. # Linking convenience modules into shared libraries is allowed,
  7280. # but linking other static libraries is non-portable.
  7281. case " $dlpreconveniencelibs " in
  7282. *" $deplib "*) ;;
  7283. *)
  7284. valid_a_lib=false
  7285. case $deplibs_check_method in
  7286. match_pattern*)
  7287. set dummy $deplibs_check_method; shift
  7288. match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
  7289. if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \
  7290. | $EGREP "$match_pattern_regex" > /dev/null; then
  7291. valid_a_lib=:
  7292. fi
  7293. ;;
  7294. pass_all)
  7295. valid_a_lib=:
  7296. ;;
  7297. esac
  7298. if $valid_a_lib; then
  7299. echo
  7300. $ECHO "*** Warning: Linking the shared library $output against the"
  7301. $ECHO "*** static library $deplib is not portable!"
  7302. deplibs="$deplib $deplibs"
  7303. else
  7304. echo
  7305. $ECHO "*** Warning: Trying to link with static lib archive $deplib."
  7306. echo "*** I have the capability to make that library automatically link in when"
  7307. echo "*** you link to this library. But I can only do this if you have a"
  7308. echo "*** shared version of the library, which you do not appear to have"
  7309. echo "*** because the file extensions .$libext of this argument makes me believe"
  7310. echo "*** that it is just a static archive that I should not use here."
  7311. fi
  7312. ;;
  7313. esac
  7314. continue
  7315. ;;
  7316. prog)
  7317. if test link != "$pass"; then
  7318. deplibs="$deplib $deplibs"
  7319. else
  7320. compile_deplibs="$deplib $compile_deplibs"
  7321. finalize_deplibs="$deplib $finalize_deplibs"
  7322. fi
  7323. continue
  7324. ;;
  7325. esac # linkmode
  7326. ;; # *.$libext
  7327. *.lo | *.$objext)
  7328. if test conv = "$pass"; then
  7329. deplibs="$deplib $deplibs"
  7330. elif test prog = "$linkmode"; then
  7331. if test dlpreopen = "$pass" || test yes != "$dlopen_support" || test no = "$build_libtool_libs"; then
  7332. # If there is no dlopen support or we're linking statically,
  7333. # we need to preload.
  7334. func_append newdlprefiles " $deplib"
  7335. compile_deplibs="$deplib $compile_deplibs"
  7336. finalize_deplibs="$deplib $finalize_deplibs"
  7337. else
  7338. func_append newdlfiles " $deplib"
  7339. fi
  7340. fi
  7341. continue
  7342. ;;
  7343. %DEPLIBS%)
  7344. alldeplibs=:
  7345. continue
  7346. ;;
  7347. esac # case $deplib
  7348. $found || test -f "$lib" \
  7349. || func_fatal_error "cannot find the library '$lib' or unhandled argument '$deplib'"
  7350. # Check to see that this really is a libtool archive.
  7351. func_lalib_unsafe_p "$lib" \
  7352. || func_fatal_error "'$lib' is not a valid libtool archive"
  7353. func_dirname "$lib" "" "."
  7354. ladir=$func_dirname_result
  7355. dlname=
  7356. dlopen=
  7357. dlpreopen=
  7358. libdir=
  7359. library_names=
  7360. old_library=
  7361. inherited_linker_flags=
  7362. # If the library was installed with an old release of libtool,
  7363. # it will not redefine variables installed, or shouldnotlink
  7364. installed=yes
  7365. shouldnotlink=no
  7366. avoidtemprpath=
  7367. # Read the .la file
  7368. func_source "$lib"
  7369. # Convert "-framework foo" to "foo.ltframework"
  7370. if test -n "$inherited_linker_flags"; then
  7371. tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'`
  7372. for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do
  7373. case " $new_inherited_linker_flags " in
  7374. *" $tmp_inherited_linker_flag "*) ;;
  7375. *) func_append new_inherited_linker_flags " $tmp_inherited_linker_flag";;
  7376. esac
  7377. done
  7378. fi
  7379. dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
  7380. if test lib,link = "$linkmode,$pass" ||
  7381. test prog,scan = "$linkmode,$pass" ||
  7382. { test prog != "$linkmode" && test lib != "$linkmode"; }; then
  7383. test -n "$dlopen" && func_append dlfiles " $dlopen"
  7384. test -n "$dlpreopen" && func_append dlprefiles " $dlpreopen"
  7385. fi
  7386. if test conv = "$pass"; then
  7387. # Only check for convenience libraries
  7388. deplibs="$lib $deplibs"
  7389. if test -z "$libdir"; then
  7390. if test -z "$old_library"; then
  7391. func_fatal_error "cannot find name of link library for '$lib'"
  7392. fi
  7393. # It is a libtool convenience library, so add in its objects.
  7394. func_append convenience " $ladir/$objdir/$old_library"
  7395. func_append old_convenience " $ladir/$objdir/$old_library"
  7396. tmp_libs=
  7397. for deplib in $dependency_libs; do
  7398. deplibs="$deplib $deplibs"
  7399. if $opt_preserve_dup_deps; then
  7400. case "$tmp_libs " in
  7401. *" $deplib "*) func_append specialdeplibs " $deplib" ;;
  7402. esac
  7403. fi
  7404. func_append tmp_libs " $deplib"
  7405. done
  7406. elif test prog != "$linkmode" && test lib != "$linkmode"; then
  7407. func_fatal_error "'$lib' is not a convenience library"
  7408. fi
  7409. continue
  7410. fi # $pass = conv
  7411. # Get the name of the library we link against.
  7412. linklib=
  7413. if test -n "$old_library" &&
  7414. { test yes = "$prefer_static_libs" ||
  7415. test built,no = "$prefer_static_libs,$installed"; }; then
  7416. linklib=$old_library
  7417. else
  7418. for l in $old_library $library_names; do
  7419. linklib=$l
  7420. done
  7421. fi
  7422. if test -z "$linklib"; then
  7423. func_fatal_error "cannot find name of link library for '$lib'"
  7424. fi
  7425. # This library was specified with -dlopen.
  7426. if test dlopen = "$pass"; then
  7427. test -z "$libdir" \
  7428. && func_fatal_error "cannot -dlopen a convenience library: '$lib'"
  7429. if test -z "$dlname" ||
  7430. test yes != "$dlopen_support" ||
  7431. test no = "$build_libtool_libs"
  7432. then
  7433. # If there is no dlname, no dlopen support or we're linking
  7434. # statically, we need to preload. We also need to preload any
  7435. # dependent libraries so libltdl's deplib preloader doesn't
  7436. # bomb out in the load deplibs phase.
  7437. func_append dlprefiles " $lib $dependency_libs"
  7438. else
  7439. func_append newdlfiles " $lib"
  7440. fi
  7441. continue
  7442. fi # $pass = dlopen
  7443. # We need an absolute path.
  7444. case $ladir in
  7445. [\\/]* | [A-Za-z]:[\\/]*) abs_ladir=$ladir ;;
  7446. *)
  7447. abs_ladir=`cd "$ladir" && pwd`
  7448. if test -z "$abs_ladir"; then
  7449. func_warning "cannot determine absolute directory name of '$ladir'"
  7450. func_warning "passing it literally to the linker, although it might fail"
  7451. abs_ladir=$ladir
  7452. fi
  7453. ;;
  7454. esac
  7455. func_basename "$lib"
  7456. laname=$func_basename_result
  7457. # Find the relevant object directory and library name.
  7458. if test yes = "$installed"; then
  7459. if test ! -f "$lt_sysroot$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
  7460. func_warning "library '$lib' was moved."
  7461. dir=$ladir
  7462. absdir=$abs_ladir
  7463. libdir=$abs_ladir
  7464. else
  7465. dir=$lt_sysroot$libdir
  7466. absdir=$lt_sysroot$libdir
  7467. fi
  7468. test yes = "$hardcode_automatic" && avoidtemprpath=yes
  7469. else
  7470. if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
  7471. dir=$ladir
  7472. absdir=$abs_ladir
  7473. # Remove this search path later
  7474. func_append notinst_path " $abs_ladir"
  7475. else
  7476. dir=$ladir/$objdir
  7477. absdir=$abs_ladir/$objdir
  7478. # Remove this search path later
  7479. func_append notinst_path " $abs_ladir"
  7480. fi
  7481. fi # $installed = yes
  7482. func_stripname 'lib' '.la' "$laname"
  7483. name=$func_stripname_result
  7484. # This library was specified with -dlpreopen.
  7485. if test dlpreopen = "$pass"; then
  7486. if test -z "$libdir" && test prog = "$linkmode"; then
  7487. func_fatal_error "only libraries may -dlpreopen a convenience library: '$lib'"
  7488. fi
  7489. case $host in
  7490. # special handling for platforms with PE-DLLs.
  7491. *cygwin* | *mingw* | *cegcc* )
  7492. # Linker will automatically link against shared library if both
  7493. # static and shared are present. Therefore, ensure we extract
  7494. # symbols from the import library if a shared library is present
  7495. # (otherwise, the dlopen module name will be incorrect). We do
  7496. # this by putting the import library name into $newdlprefiles.
  7497. # We recover the dlopen module name by 'saving' the la file
  7498. # name in a special purpose variable, and (later) extracting the
  7499. # dlname from the la file.
  7500. if test -n "$dlname"; then
  7501. func_tr_sh "$dir/$linklib"
  7502. eval "libfile_$func_tr_sh_result=\$abs_ladir/\$laname"
  7503. func_append newdlprefiles " $dir/$linklib"
  7504. else
  7505. func_append newdlprefiles " $dir/$old_library"
  7506. # Keep a list of preopened convenience libraries to check
  7507. # that they are being used correctly in the link pass.
  7508. test -z "$libdir" && \
  7509. func_append dlpreconveniencelibs " $dir/$old_library"
  7510. fi
  7511. ;;
  7512. * )
  7513. # Prefer using a static library (so that no silly _DYNAMIC symbols
  7514. # are required to link).
  7515. if test -n "$old_library"; then
  7516. func_append newdlprefiles " $dir/$old_library"
  7517. # Keep a list of preopened convenience libraries to check
  7518. # that they are being used correctly in the link pass.
  7519. test -z "$libdir" && \
  7520. func_append dlpreconveniencelibs " $dir/$old_library"
  7521. # Otherwise, use the dlname, so that lt_dlopen finds it.
  7522. elif test -n "$dlname"; then
  7523. func_append newdlprefiles " $dir/$dlname"
  7524. else
  7525. func_append newdlprefiles " $dir/$linklib"
  7526. fi
  7527. ;;
  7528. esac
  7529. fi # $pass = dlpreopen
  7530. if test -z "$libdir"; then
  7531. # Link the convenience library
  7532. if test lib = "$linkmode"; then
  7533. deplibs="$dir/$old_library $deplibs"
  7534. elif test prog,link = "$linkmode,$pass"; then
  7535. compile_deplibs="$dir/$old_library $compile_deplibs"
  7536. finalize_deplibs="$dir/$old_library $finalize_deplibs"
  7537. else
  7538. deplibs="$lib $deplibs" # used for prog,scan pass
  7539. fi
  7540. continue
  7541. fi
  7542. if test prog = "$linkmode" && test link != "$pass"; then
  7543. func_append newlib_search_path " $ladir"
  7544. deplibs="$lib $deplibs"
  7545. linkalldeplibs=false
  7546. if test no != "$link_all_deplibs" || test -z "$library_names" ||
  7547. test no = "$build_libtool_libs"; then
  7548. linkalldeplibs=:
  7549. fi
  7550. tmp_libs=
  7551. for deplib in $dependency_libs; do
  7552. case $deplib in
  7553. -L*) func_stripname '-L' '' "$deplib"
  7554. func_resolve_sysroot "$func_stripname_result"
  7555. func_append newlib_search_path " $func_resolve_sysroot_result"
  7556. ;;
  7557. esac
  7558. # Need to link against all dependency_libs?
  7559. if $linkalldeplibs; then
  7560. deplibs="$deplib $deplibs"
  7561. else
  7562. # Need to hardcode shared library paths
  7563. # or/and link against static libraries
  7564. newdependency_libs="$deplib $newdependency_libs"
  7565. fi
  7566. if $opt_preserve_dup_deps; then
  7567. case "$tmp_libs " in
  7568. *" $deplib "*) func_append specialdeplibs " $deplib" ;;
  7569. esac
  7570. fi
  7571. func_append tmp_libs " $deplib"
  7572. done # for deplib
  7573. continue
  7574. fi # $linkmode = prog...
  7575. if test prog,link = "$linkmode,$pass"; then
  7576. if test -n "$library_names" &&
  7577. { { test no = "$prefer_static_libs" ||
  7578. test built,yes = "$prefer_static_libs,$installed"; } ||
  7579. test -z "$old_library"; }; then
  7580. # We need to hardcode the library path
  7581. if test -n "$shlibpath_var" && test -z "$avoidtemprpath"; then
  7582. # Make sure the rpath contains only unique directories.
  7583. case $temp_rpath: in
  7584. *"$absdir:"*) ;;
  7585. *) func_append temp_rpath "$absdir:" ;;
  7586. esac
  7587. fi
  7588. # Hardcode the library path.
  7589. # Skip directories that are in the system default run-time
  7590. # search path.
  7591. case " $sys_lib_dlsearch_path " in
  7592. *" $absdir "*) ;;
  7593. *)
  7594. case "$compile_rpath " in
  7595. *" $absdir "*) ;;
  7596. *) func_append compile_rpath " $absdir" ;;
  7597. esac
  7598. ;;
  7599. esac
  7600. case " $sys_lib_dlsearch_path " in
  7601. *" $libdir "*) ;;
  7602. *)
  7603. case "$finalize_rpath " in
  7604. *" $libdir "*) ;;
  7605. *) func_append finalize_rpath " $libdir" ;;
  7606. esac
  7607. ;;
  7608. esac
  7609. fi # $linkmode,$pass = prog,link...
  7610. if $alldeplibs &&
  7611. { test pass_all = "$deplibs_check_method" ||
  7612. { test yes = "$build_libtool_libs" &&
  7613. test -n "$library_names"; }; }; then
  7614. # We only need to search for static libraries
  7615. continue
  7616. fi
  7617. fi
  7618. link_static=no # Whether the deplib will be linked statically
  7619. use_static_libs=$prefer_static_libs
  7620. if test built = "$use_static_libs" && test yes = "$installed"; then
  7621. use_static_libs=no
  7622. fi
  7623. if test -n "$library_names" &&
  7624. { test no = "$use_static_libs" || test -z "$old_library"; }; then
  7625. case $host in
  7626. *cygwin* | *mingw* | *cegcc* | *os2*)
  7627. # No point in relinking DLLs because paths are not encoded
  7628. func_append notinst_deplibs " $lib"
  7629. need_relink=no
  7630. ;;
  7631. *)
  7632. if test no = "$installed"; then
  7633. func_append notinst_deplibs " $lib"
  7634. need_relink=yes
  7635. fi
  7636. ;;
  7637. esac
  7638. # This is a shared library
  7639. # Warn about portability, can't link against -module's on some
  7640. # systems (darwin). Don't bleat about dlopened modules though!
  7641. dlopenmodule=
  7642. for dlpremoduletest in $dlprefiles; do
  7643. if test "X$dlpremoduletest" = "X$lib"; then
  7644. dlopenmodule=$dlpremoduletest
  7645. break
  7646. fi
  7647. done
  7648. if test -z "$dlopenmodule" && test yes = "$shouldnotlink" && test link = "$pass"; then
  7649. echo
  7650. if test prog = "$linkmode"; then
  7651. $ECHO "*** Warning: Linking the executable $output against the loadable module"
  7652. else
  7653. $ECHO "*** Warning: Linking the shared library $output against the loadable module"
  7654. fi
  7655. $ECHO "*** $linklib is not portable!"
  7656. fi
  7657. if test lib = "$linkmode" &&
  7658. test yes = "$hardcode_into_libs"; then
  7659. # Hardcode the library path.
  7660. # Skip directories that are in the system default run-time
  7661. # search path.
  7662. case " $sys_lib_dlsearch_path " in
  7663. *" $absdir "*) ;;
  7664. *)
  7665. case "$compile_rpath " in
  7666. *" $absdir "*) ;;
  7667. *) func_append compile_rpath " $absdir" ;;
  7668. esac
  7669. ;;
  7670. esac
  7671. case " $sys_lib_dlsearch_path " in
  7672. *" $libdir "*) ;;
  7673. *)
  7674. case "$finalize_rpath " in
  7675. *" $libdir "*) ;;
  7676. *) func_append finalize_rpath " $libdir" ;;
  7677. esac
  7678. ;;
  7679. esac
  7680. fi
  7681. if test -n "$old_archive_from_expsyms_cmds"; then
  7682. # figure out the soname
  7683. set dummy $library_names
  7684. shift
  7685. realname=$1
  7686. shift
  7687. libname=`eval "\\$ECHO \"$libname_spec\""`
  7688. # use dlname if we got it. it's perfectly good, no?
  7689. if test -n "$dlname"; then
  7690. soname=$dlname
  7691. elif test -n "$soname_spec"; then
  7692. # bleh windows
  7693. case $host in
  7694. *cygwin* | mingw* | *cegcc* | *os2*)
  7695. func_arith $current - $age
  7696. major=$func_arith_result
  7697. versuffix=-$major
  7698. ;;
  7699. esac
  7700. eval soname=\"$soname_spec\"
  7701. else
  7702. soname=$realname
  7703. fi
  7704. # Make a new name for the extract_expsyms_cmds to use
  7705. soroot=$soname
  7706. func_basename "$soroot"
  7707. soname=$func_basename_result
  7708. func_stripname 'lib' '.dll' "$soname"
  7709. newlib=libimp-$func_stripname_result.a
  7710. # If the library has no export list, then create one now
  7711. if test -f "$output_objdir/$soname-def"; then :
  7712. else
  7713. func_verbose "extracting exported symbol list from '$soname'"
  7714. func_execute_cmds "$extract_expsyms_cmds" 'exit $?'
  7715. fi
  7716. # Create $newlib
  7717. if test -f "$output_objdir/$newlib"; then :; else
  7718. func_verbose "generating import library for '$soname'"
  7719. func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?'
  7720. fi
  7721. # make sure the library variables are pointing to the new library
  7722. dir=$output_objdir
  7723. linklib=$newlib
  7724. fi # test -n "$old_archive_from_expsyms_cmds"
  7725. if test prog = "$linkmode" || test relink != "$opt_mode"; then
  7726. add_shlibpath=
  7727. add_dir=
  7728. add=
  7729. lib_linked=yes
  7730. case $hardcode_action in
  7731. immediate | unsupported)
  7732. if test no = "$hardcode_direct"; then
  7733. add=$dir/$linklib
  7734. case $host in
  7735. *-*-sco3.2v5.0.[024]*) add_dir=-L$dir ;;
  7736. *-*-sysv4*uw2*) add_dir=-L$dir ;;
  7737. *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
  7738. *-*-unixware7*) add_dir=-L$dir ;;
  7739. *-*-darwin* )
  7740. # if the lib is a (non-dlopened) module then we cannot
  7741. # link against it, someone is ignoring the earlier warnings
  7742. if /usr/bin/file -L $add 2> /dev/null |
  7743. $GREP ": [^:]* bundle" >/dev/null; then
  7744. if test "X$dlopenmodule" != "X$lib"; then
  7745. $ECHO "*** Warning: lib $linklib is a module, not a shared library"
  7746. if test -z "$old_library"; then
  7747. echo
  7748. echo "*** And there doesn't seem to be a static archive available"
  7749. echo "*** The link will probably fail, sorry"
  7750. else
  7751. add=$dir/$old_library
  7752. fi
  7753. elif test -n "$old_library"; then
  7754. add=$dir/$old_library
  7755. fi
  7756. fi
  7757. esac
  7758. elif test no = "$hardcode_minus_L"; then
  7759. case $host in
  7760. *-*-sunos*) add_shlibpath=$dir ;;
  7761. esac
  7762. add_dir=-L$dir
  7763. add=-l$name
  7764. elif test no = "$hardcode_shlibpath_var"; then
  7765. add_shlibpath=$dir
  7766. add=-l$name
  7767. else
  7768. lib_linked=no
  7769. fi
  7770. ;;
  7771. relink)
  7772. if test yes = "$hardcode_direct" &&
  7773. test no = "$hardcode_direct_absolute"; then
  7774. add=$dir/$linklib
  7775. elif test yes = "$hardcode_minus_L"; then
  7776. add_dir=-L$absdir
  7777. # Try looking first in the location we're being installed to.
  7778. if test -n "$inst_prefix_dir"; then
  7779. case $libdir in
  7780. [\\/]*)
  7781. func_append add_dir " -L$inst_prefix_dir$libdir"
  7782. ;;
  7783. esac
  7784. fi
  7785. add=-l$name
  7786. elif test yes = "$hardcode_shlibpath_var"; then
  7787. add_shlibpath=$dir
  7788. add=-l$name
  7789. else
  7790. lib_linked=no
  7791. fi
  7792. ;;
  7793. *) lib_linked=no ;;
  7794. esac
  7795. if test yes != "$lib_linked"; then
  7796. func_fatal_configuration "unsupported hardcode properties"
  7797. fi
  7798. if test -n "$add_shlibpath"; then
  7799. case :$compile_shlibpath: in
  7800. *":$add_shlibpath:"*) ;;
  7801. *) func_append compile_shlibpath "$add_shlibpath:" ;;
  7802. esac
  7803. fi
  7804. if test prog = "$linkmode"; then
  7805. test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
  7806. test -n "$add" && compile_deplibs="$add $compile_deplibs"
  7807. else
  7808. test -n "$add_dir" && deplibs="$add_dir $deplibs"
  7809. test -n "$add" && deplibs="$add $deplibs"
  7810. if test yes != "$hardcode_direct" &&
  7811. test yes != "$hardcode_minus_L" &&
  7812. test yes = "$hardcode_shlibpath_var"; then
  7813. case :$finalize_shlibpath: in
  7814. *":$libdir:"*) ;;
  7815. *) func_append finalize_shlibpath "$libdir:" ;;
  7816. esac
  7817. fi
  7818. fi
  7819. fi
  7820. if test prog = "$linkmode" || test relink = "$opt_mode"; then
  7821. add_shlibpath=
  7822. add_dir=
  7823. add=
  7824. # Finalize command for both is simple: just hardcode it.
  7825. if test yes = "$hardcode_direct" &&
  7826. test no = "$hardcode_direct_absolute"; then
  7827. add=$libdir/$linklib
  7828. elif test yes = "$hardcode_minus_L"; then
  7829. add_dir=-L$libdir
  7830. add=-l$name
  7831. elif test yes = "$hardcode_shlibpath_var"; then
  7832. case :$finalize_shlibpath: in
  7833. *":$libdir:"*) ;;
  7834. *) func_append finalize_shlibpath "$libdir:" ;;
  7835. esac
  7836. add=-l$name
  7837. elif test yes = "$hardcode_automatic"; then
  7838. if test -n "$inst_prefix_dir" &&
  7839. test -f "$inst_prefix_dir$libdir/$linklib"; then
  7840. add=$inst_prefix_dir$libdir/$linklib
  7841. else
  7842. add=$libdir/$linklib
  7843. fi
  7844. else
  7845. # We cannot seem to hardcode it, guess we'll fake it.
  7846. add_dir=-L$libdir
  7847. # Try looking first in the location we're being installed to.
  7848. if test -n "$inst_prefix_dir"; then
  7849. case $libdir in
  7850. [\\/]*)
  7851. func_append add_dir " -L$inst_prefix_dir$libdir"
  7852. ;;
  7853. esac
  7854. fi
  7855. add=-l$name
  7856. fi
  7857. if test prog = "$linkmode"; then
  7858. test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
  7859. test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
  7860. else
  7861. test -n "$add_dir" && deplibs="$add_dir $deplibs"
  7862. test -n "$add" && deplibs="$add $deplibs"
  7863. fi
  7864. fi
  7865. elif test prog = "$linkmode"; then
  7866. # Here we assume that one of hardcode_direct or hardcode_minus_L
  7867. # is not unsupported. This is valid on all known static and
  7868. # shared platforms.
  7869. if test unsupported != "$hardcode_direct"; then
  7870. test -n "$old_library" && linklib=$old_library
  7871. compile_deplibs="$dir/$linklib $compile_deplibs"
  7872. finalize_deplibs="$dir/$linklib $finalize_deplibs"
  7873. else
  7874. compile_deplibs="-l$name -L$dir $compile_deplibs"
  7875. finalize_deplibs="-l$name -L$dir $finalize_deplibs"
  7876. fi
  7877. elif test yes = "$build_libtool_libs"; then
  7878. # Not a shared library
  7879. if test pass_all != "$deplibs_check_method"; then
  7880. # We're trying link a shared library against a static one
  7881. # but the system doesn't support it.
  7882. # Just print a warning and add the library to dependency_libs so
  7883. # that the program can be linked against the static library.
  7884. echo
  7885. $ECHO "*** Warning: This system cannot link to static lib archive $lib."
  7886. echo "*** I have the capability to make that library automatically link in when"
  7887. echo "*** you link to this library. But I can only do this if you have a"
  7888. echo "*** shared version of the library, which you do not appear to have."
  7889. if test yes = "$module"; then
  7890. echo "*** But as you try to build a module library, libtool will still create "
  7891. echo "*** a static module, that should work as long as the dlopening application"
  7892. echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
  7893. if test -z "$global_symbol_pipe"; then
  7894. echo
  7895. echo "*** However, this would only work if libtool was able to extract symbol"
  7896. echo "*** lists from a program, using 'nm' or equivalent, but libtool could"
  7897. echo "*** not find such a program. So, this module is probably useless."
  7898. echo "*** 'nm' from GNU binutils and a full rebuild may help."
  7899. fi
  7900. if test no = "$build_old_libs"; then
  7901. build_libtool_libs=module
  7902. build_old_libs=yes
  7903. else
  7904. build_libtool_libs=no
  7905. fi
  7906. fi
  7907. else
  7908. deplibs="$dir/$old_library $deplibs"
  7909. link_static=yes
  7910. fi
  7911. fi # link shared/static library?
  7912. if test lib = "$linkmode"; then
  7913. if test -n "$dependency_libs" &&
  7914. { test yes != "$hardcode_into_libs" ||
  7915. test yes = "$build_old_libs" ||
  7916. test yes = "$link_static"; }; then
  7917. # Extract -R from dependency_libs
  7918. temp_deplibs=
  7919. for libdir in $dependency_libs; do
  7920. case $libdir in
  7921. -R*) func_stripname '-R' '' "$libdir"
  7922. temp_xrpath=$func_stripname_result
  7923. case " $xrpath " in
  7924. *" $temp_xrpath "*) ;;
  7925. *) func_append xrpath " $temp_xrpath";;
  7926. esac;;
  7927. *) func_append temp_deplibs " $libdir";;
  7928. esac
  7929. done
  7930. dependency_libs=$temp_deplibs
  7931. fi
  7932. func_append newlib_search_path " $absdir"
  7933. # Link against this library
  7934. test no = "$link_static" && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
  7935. # ... and its dependency_libs
  7936. tmp_libs=
  7937. for deplib in $dependency_libs; do
  7938. newdependency_libs="$deplib $newdependency_libs"
  7939. case $deplib in
  7940. -L*) func_stripname '-L' '' "$deplib"
  7941. func_resolve_sysroot "$func_stripname_result";;
  7942. *) func_resolve_sysroot "$deplib" ;;
  7943. esac
  7944. if $opt_preserve_dup_deps; then
  7945. case "$tmp_libs " in
  7946. *" $func_resolve_sysroot_result "*)
  7947. func_append specialdeplibs " $func_resolve_sysroot_result" ;;
  7948. esac
  7949. fi
  7950. func_append tmp_libs " $func_resolve_sysroot_result"
  7951. done
  7952. if test no != "$link_all_deplibs"; then
  7953. # Add the search paths of all dependency libraries
  7954. for deplib in $dependency_libs; do
  7955. path=
  7956. case $deplib in
  7957. -L*) path=$deplib ;;
  7958. *.la)
  7959. func_resolve_sysroot "$deplib"
  7960. deplib=$func_resolve_sysroot_result
  7961. func_dirname "$deplib" "" "."
  7962. dir=$func_dirname_result
  7963. # We need an absolute path.
  7964. case $dir in
  7965. [\\/]* | [A-Za-z]:[\\/]*) absdir=$dir ;;
  7966. *)
  7967. absdir=`cd "$dir" && pwd`
  7968. if test -z "$absdir"; then
  7969. func_warning "cannot determine absolute directory name of '$dir'"
  7970. absdir=$dir
  7971. fi
  7972. ;;
  7973. esac
  7974. if $GREP "^installed=no" $deplib > /dev/null; then
  7975. case $host in
  7976. *-*-darwin*)
  7977. depdepl=
  7978. eval deplibrary_names=`$SED -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
  7979. if test -n "$deplibrary_names"; then
  7980. for tmp in $deplibrary_names; do
  7981. depdepl=$tmp
  7982. done
  7983. if test -f "$absdir/$objdir/$depdepl"; then
  7984. depdepl=$absdir/$objdir/$depdepl
  7985. darwin_install_name=`$OTOOL -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
  7986. if test -z "$darwin_install_name"; then
  7987. darwin_install_name=`$OTOOL64 -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
  7988. fi
  7989. func_append compiler_flags " $wl-dylib_file $wl$darwin_install_name:$depdepl"
  7990. func_append linker_flags " -dylib_file $darwin_install_name:$depdepl"
  7991. path=
  7992. fi
  7993. fi
  7994. ;;
  7995. *)
  7996. path=-L$absdir/$objdir
  7997. ;;
  7998. esac
  7999. else
  8000. eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
  8001. test -z "$libdir" && \
  8002. func_fatal_error "'$deplib' is not a valid libtool archive"
  8003. test "$absdir" != "$libdir" && \
  8004. func_warning "'$deplib' seems to be moved"
  8005. path=-L$absdir
  8006. fi
  8007. ;;
  8008. esac
  8009. case " $deplibs " in
  8010. *" $path "*) ;;
  8011. *) deplibs="$path $deplibs" ;;
  8012. esac
  8013. done
  8014. fi # link_all_deplibs != no
  8015. fi # linkmode = lib
  8016. done # for deplib in $libs
  8017. if test link = "$pass"; then
  8018. if test prog = "$linkmode"; then
  8019. compile_deplibs="$new_inherited_linker_flags $compile_deplibs"
  8020. finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs"
  8021. else
  8022. compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
  8023. fi
  8024. fi
  8025. dependency_libs=$newdependency_libs
  8026. if test dlpreopen = "$pass"; then
  8027. # Link the dlpreopened libraries before other libraries
  8028. for deplib in $save_deplibs; do
  8029. deplibs="$deplib $deplibs"
  8030. done
  8031. fi
  8032. if test dlopen != "$pass"; then
  8033. test conv = "$pass" || {
  8034. # Make sure lib_search_path contains only unique directories.
  8035. lib_search_path=
  8036. for dir in $newlib_search_path; do
  8037. case "$lib_search_path " in
  8038. *" $dir "*) ;;
  8039. *) func_append lib_search_path " $dir" ;;
  8040. esac
  8041. done
  8042. newlib_search_path=
  8043. }
  8044. if test prog,link = "$linkmode,$pass"; then
  8045. vars="compile_deplibs finalize_deplibs"
  8046. else
  8047. vars=deplibs
  8048. fi
  8049. for var in $vars dependency_libs; do
  8050. # Add libraries to $var in reverse order
  8051. eval tmp_libs=\"\$$var\"
  8052. new_libs=
  8053. for deplib in $tmp_libs; do
  8054. # FIXME: Pedantically, this is the right thing to do, so
  8055. # that some nasty dependency loop isn't accidentally
  8056. # broken:
  8057. #new_libs="$deplib $new_libs"
  8058. # Pragmatically, this seems to cause very few problems in
  8059. # practice:
  8060. case $deplib in
  8061. -L*) new_libs="$deplib $new_libs" ;;
  8062. -R*) ;;
  8063. *)
  8064. # And here is the reason: when a library appears more
  8065. # than once as an explicit dependence of a library, or
  8066. # is implicitly linked in more than once by the
  8067. # compiler, it is considered special, and multiple
  8068. # occurrences thereof are not removed. Compare this
  8069. # with having the same library being listed as a
  8070. # dependency of multiple other libraries: in this case,
  8071. # we know (pedantically, we assume) the library does not
  8072. # need to be listed more than once, so we keep only the
  8073. # last copy. This is not always right, but it is rare
  8074. # enough that we require users that really mean to play
  8075. # such unportable linking tricks to link the library
  8076. # using -Wl,-lname, so that libtool does not consider it
  8077. # for duplicate removal.
  8078. case " $specialdeplibs " in
  8079. *" $deplib "*) new_libs="$deplib $new_libs" ;;
  8080. *)
  8081. case " $new_libs " in
  8082. *" $deplib "*) ;;
  8083. *) new_libs="$deplib $new_libs" ;;
  8084. esac
  8085. ;;
  8086. esac
  8087. ;;
  8088. esac
  8089. done
  8090. tmp_libs=
  8091. for deplib in $new_libs; do
  8092. case $deplib in
  8093. -L*)
  8094. case " $tmp_libs " in
  8095. *" $deplib "*) ;;
  8096. *) func_append tmp_libs " $deplib" ;;
  8097. esac
  8098. ;;
  8099. *) func_append tmp_libs " $deplib" ;;
  8100. esac
  8101. done
  8102. eval $var=\"$tmp_libs\"
  8103. done # for var
  8104. fi
  8105. # Add Sun CC postdeps if required:
  8106. test CXX = "$tagname" && {
  8107. case $host_os in
  8108. linux*)
  8109. case `$CC -V 2>&1 | sed 5q` in
  8110. *Sun\ C*) # Sun C++ 5.9
  8111. func_suncc_cstd_abi
  8112. if test no != "$suncc_use_cstd_abi"; then
  8113. func_append postdeps ' -library=Cstd -library=Crun'
  8114. fi
  8115. ;;
  8116. esac
  8117. ;;
  8118. solaris*)
  8119. func_cc_basename "$CC"
  8120. case $func_cc_basename_result in
  8121. CC* | sunCC*)
  8122. func_suncc_cstd_abi
  8123. if test no != "$suncc_use_cstd_abi"; then
  8124. func_append postdeps ' -library=Cstd -library=Crun'
  8125. fi
  8126. ;;
  8127. esac
  8128. ;;
  8129. esac
  8130. }
  8131. # Last step: remove runtime libs from dependency_libs
  8132. # (they stay in deplibs)
  8133. tmp_libs=
  8134. for i in $dependency_libs; do
  8135. case " $predeps $postdeps $compiler_lib_search_path " in
  8136. *" $i "*)
  8137. i=
  8138. ;;
  8139. esac
  8140. if test -n "$i"; then
  8141. func_append tmp_libs " $i"
  8142. fi
  8143. done
  8144. dependency_libs=$tmp_libs
  8145. done # for pass
  8146. if test prog = "$linkmode"; then
  8147. dlfiles=$newdlfiles
  8148. fi
  8149. if test prog = "$linkmode" || test lib = "$linkmode"; then
  8150. dlprefiles=$newdlprefiles
  8151. fi
  8152. case $linkmode in
  8153. oldlib)
  8154. if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then
  8155. func_warning "'-dlopen' is ignored for archives"
  8156. fi
  8157. case " $deplibs" in
  8158. *\ -l* | *\ -L*)
  8159. func_warning "'-l' and '-L' are ignored for archives" ;;
  8160. esac
  8161. test -n "$rpath" && \
  8162. func_warning "'-rpath' is ignored for archives"
  8163. test -n "$xrpath" && \
  8164. func_warning "'-R' is ignored for archives"
  8165. test -n "$vinfo" && \
  8166. func_warning "'-version-info/-version-number' is ignored for archives"
  8167. test -n "$release" && \
  8168. func_warning "'-release' is ignored for archives"
  8169. test -n "$export_symbols$export_symbols_regex" && \
  8170. func_warning "'-export-symbols' is ignored for archives"
  8171. # Now set the variables for building old libraries.
  8172. build_libtool_libs=no
  8173. oldlibs=$output
  8174. func_append objs "$old_deplibs"
  8175. ;;
  8176. lib)
  8177. # Make sure we only generate libraries of the form 'libNAME.la'.
  8178. case $outputname in
  8179. lib*)
  8180. func_stripname 'lib' '.la' "$outputname"
  8181. name=$func_stripname_result
  8182. eval shared_ext=\"$shrext_cmds\"
  8183. eval libname=\"$libname_spec\"
  8184. ;;
  8185. *)
  8186. test no = "$module" \
  8187. && func_fatal_help "libtool library '$output' must begin with 'lib'"
  8188. if test no != "$need_lib_prefix"; then
  8189. # Add the "lib" prefix for modules if required
  8190. func_stripname '' '.la' "$outputname"
  8191. name=$func_stripname_result
  8192. eval shared_ext=\"$shrext_cmds\"
  8193. eval libname=\"$libname_spec\"
  8194. else
  8195. func_stripname '' '.la' "$outputname"
  8196. libname=$func_stripname_result
  8197. fi
  8198. ;;
  8199. esac
  8200. if test -n "$objs"; then
  8201. if test pass_all != "$deplibs_check_method"; then
  8202. func_fatal_error "cannot build libtool library '$output' from non-libtool objects on this host:$objs"
  8203. else
  8204. echo
  8205. $ECHO "*** Warning: Linking the shared library $output against the non-libtool"
  8206. $ECHO "*** objects $objs is not portable!"
  8207. func_append libobjs " $objs"
  8208. fi
  8209. fi
  8210. test no = "$dlself" \
  8211. || func_warning "'-dlopen self' is ignored for libtool libraries"
  8212. set dummy $rpath
  8213. shift
  8214. test 1 -lt "$#" \
  8215. && func_warning "ignoring multiple '-rpath's for a libtool library"
  8216. install_libdir=$1
  8217. oldlibs=
  8218. if test -z "$rpath"; then
  8219. if test yes = "$build_libtool_libs"; then
  8220. # Building a libtool convenience library.
  8221. # Some compilers have problems with a '.al' extension so
  8222. # convenience libraries should have the same extension an
  8223. # archive normally would.
  8224. oldlibs="$output_objdir/$libname.$libext $oldlibs"
  8225. build_libtool_libs=convenience
  8226. build_old_libs=yes
  8227. fi
  8228. test -n "$vinfo" && \
  8229. func_warning "'-version-info/-version-number' is ignored for convenience libraries"
  8230. test -n "$release" && \
  8231. func_warning "'-release' is ignored for convenience libraries"
  8232. else
  8233. # Parse the version information argument.
  8234. save_ifs=$IFS; IFS=:
  8235. set dummy $vinfo 0 0 0
  8236. shift
  8237. IFS=$save_ifs
  8238. test -n "$7" && \
  8239. func_fatal_help "too many parameters to '-version-info'"
  8240. # convert absolute version numbers to libtool ages
  8241. # this retains compatibility with .la files and attempts
  8242. # to make the code below a bit more comprehensible
  8243. case $vinfo_number in
  8244. yes)
  8245. number_major=$1
  8246. number_minor=$2
  8247. number_revision=$3
  8248. #
  8249. # There are really only two kinds -- those that
  8250. # use the current revision as the major version
  8251. # and those that subtract age and use age as
  8252. # a minor version. But, then there is irix
  8253. # that has an extra 1 added just for fun
  8254. #
  8255. case $version_type in
  8256. # correct linux to gnu/linux during the next big refactor
  8257. darwin|freebsd-elf|linux|osf|windows|none)
  8258. func_arith $number_major + $number_minor
  8259. current=$func_arith_result
  8260. age=$number_minor
  8261. revision=$number_revision
  8262. ;;
  8263. freebsd-aout|qnx|sunos)
  8264. current=$number_major
  8265. revision=$number_minor
  8266. age=0
  8267. ;;
  8268. irix|nonstopux)
  8269. func_arith $number_major + $number_minor
  8270. current=$func_arith_result
  8271. age=$number_minor
  8272. revision=$number_minor
  8273. lt_irix_increment=no
  8274. ;;
  8275. *)
  8276. func_fatal_configuration "$modename: unknown library version type '$version_type'"
  8277. ;;
  8278. esac
  8279. ;;
  8280. no)
  8281. current=$1
  8282. revision=$2
  8283. age=$3
  8284. ;;
  8285. esac
  8286. # Check that each of the things are valid numbers.
  8287. case $current in
  8288. 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]) ;;
  8289. *)
  8290. func_error "CURRENT '$current' must be a nonnegative integer"
  8291. func_fatal_error "'$vinfo' is not valid version information"
  8292. ;;
  8293. esac
  8294. case $revision in
  8295. 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]) ;;
  8296. *)
  8297. func_error "REVISION '$revision' must be a nonnegative integer"
  8298. func_fatal_error "'$vinfo' is not valid version information"
  8299. ;;
  8300. esac
  8301. case $age in
  8302. 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]) ;;
  8303. *)
  8304. func_error "AGE '$age' must be a nonnegative integer"
  8305. func_fatal_error "'$vinfo' is not valid version information"
  8306. ;;
  8307. esac
  8308. if test "$age" -gt "$current"; then
  8309. func_error "AGE '$age' is greater than the current interface number '$current'"
  8310. func_fatal_error "'$vinfo' is not valid version information"
  8311. fi
  8312. # Calculate the version variables.
  8313. major=
  8314. versuffix=
  8315. verstring=
  8316. case $version_type in
  8317. none) ;;
  8318. darwin)
  8319. # Like Linux, but with the current version available in
  8320. # verstring for coding it into the library header
  8321. func_arith $current - $age
  8322. major=.$func_arith_result
  8323. versuffix=$major.$age.$revision
  8324. # Darwin ld doesn't like 0 for these options...
  8325. func_arith $current + 1
  8326. minor_current=$func_arith_result
  8327. xlcverstring="$wl-compatibility_version $wl$minor_current $wl-current_version $wl$minor_current.$revision"
  8328. verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
  8329. # On Darwin other compilers
  8330. case $CC in
  8331. nagfor*)
  8332. verstring="$wl-compatibility_version $wl$minor_current $wl-current_version $wl$minor_current.$revision"
  8333. ;;
  8334. *)
  8335. verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
  8336. ;;
  8337. esac
  8338. ;;
  8339. freebsd-aout)
  8340. major=.$current
  8341. versuffix=.$current.$revision
  8342. ;;
  8343. freebsd-elf)
  8344. func_arith $current - $age
  8345. major=.$func_arith_result
  8346. versuffix=$major.$age.$revision
  8347. ;;
  8348. irix | nonstopux)
  8349. if test no = "$lt_irix_increment"; then
  8350. func_arith $current - $age
  8351. else
  8352. func_arith $current - $age + 1
  8353. fi
  8354. major=$func_arith_result
  8355. case $version_type in
  8356. nonstopux) verstring_prefix=nonstopux ;;
  8357. *) verstring_prefix=sgi ;;
  8358. esac
  8359. verstring=$verstring_prefix$major.$revision
  8360. # Add in all the interfaces that we are compatible with.
  8361. loop=$revision
  8362. while test 0 -ne "$loop"; do
  8363. func_arith $revision - $loop
  8364. iface=$func_arith_result
  8365. func_arith $loop - 1
  8366. loop=$func_arith_result
  8367. verstring=$verstring_prefix$major.$iface:$verstring
  8368. done
  8369. # Before this point, $major must not contain '.'.
  8370. major=.$major
  8371. versuffix=$major.$revision
  8372. ;;
  8373. linux) # correct to gnu/linux during the next big refactor
  8374. func_arith $current - $age
  8375. major=.$func_arith_result
  8376. versuffix=$major.$age.$revision
  8377. ;;
  8378. osf)
  8379. func_arith $current - $age
  8380. major=.$func_arith_result
  8381. versuffix=.$current.$age.$revision
  8382. verstring=$current.$age.$revision
  8383. # Add in all the interfaces that we are compatible with.
  8384. loop=$age
  8385. while test 0 -ne "$loop"; do
  8386. func_arith $current - $loop
  8387. iface=$func_arith_result
  8388. func_arith $loop - 1
  8389. loop=$func_arith_result
  8390. verstring=$verstring:$iface.0
  8391. done
  8392. # Make executables depend on our current version.
  8393. func_append verstring ":$current.0"
  8394. ;;
  8395. qnx)
  8396. major=.$current
  8397. versuffix=.$current
  8398. ;;
  8399. sco)
  8400. major=.$current
  8401. versuffix=.$current
  8402. ;;
  8403. sunos)
  8404. major=.$current
  8405. versuffix=.$current.$revision
  8406. ;;
  8407. windows)
  8408. # Use '-' rather than '.', since we only want one
  8409. # extension on DOS 8.3 file systems.
  8410. func_arith $current - $age
  8411. major=$func_arith_result
  8412. versuffix=-$major
  8413. ;;
  8414. *)
  8415. func_fatal_configuration "unknown library version type '$version_type'"
  8416. ;;
  8417. esac
  8418. # Clear the version info if we defaulted, and they specified a release.
  8419. if test -z "$vinfo" && test -n "$release"; then
  8420. major=
  8421. case $version_type in
  8422. darwin)
  8423. # we can't check for "0.0" in archive_cmds due to quoting
  8424. # problems, so we reset it completely
  8425. verstring=
  8426. ;;
  8427. *)
  8428. verstring=0.0
  8429. ;;
  8430. esac
  8431. if test no = "$need_version"; then
  8432. versuffix=
  8433. else
  8434. versuffix=.0.0
  8435. fi
  8436. fi
  8437. # Remove version info from name if versioning should be avoided
  8438. if test yes,no = "$avoid_version,$need_version"; then
  8439. major=
  8440. versuffix=
  8441. verstring=
  8442. fi
  8443. # Check to see if the archive will have undefined symbols.
  8444. if test yes = "$allow_undefined"; then
  8445. if test unsupported = "$allow_undefined_flag"; then
  8446. if test yes = "$build_old_libs"; then
  8447. func_warning "undefined symbols not allowed in $host shared libraries; building static only"
  8448. build_libtool_libs=no
  8449. else
  8450. func_fatal_error "can't build $host shared library unless -no-undefined is specified"
  8451. fi
  8452. fi
  8453. else
  8454. # Don't allow undefined symbols.
  8455. allow_undefined_flag=$no_undefined_flag
  8456. fi
  8457. fi
  8458. func_generate_dlsyms "$libname" "$libname" :
  8459. func_append libobjs " $symfileobj"
  8460. test " " = "$libobjs" && libobjs=
  8461. if test relink != "$opt_mode"; then
  8462. # Remove our outputs, but don't remove object files since they
  8463. # may have been created when compiling PIC objects.
  8464. removelist=
  8465. tempremovelist=`$ECHO "$output_objdir/*"`
  8466. for p in $tempremovelist; do
  8467. case $p in
  8468. *.$objext | *.gcno)
  8469. ;;
  8470. $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/$libname$release.*)
  8471. if test -n "$precious_files_regex"; then
  8472. if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
  8473. then
  8474. continue
  8475. fi
  8476. fi
  8477. func_append removelist " $p"
  8478. ;;
  8479. *) ;;
  8480. esac
  8481. done
  8482. test -n "$removelist" && \
  8483. func_show_eval "${RM}r \$removelist"
  8484. fi
  8485. # Now set the variables for building old libraries.
  8486. if test yes = "$build_old_libs" && test convenience != "$build_libtool_libs"; then
  8487. func_append oldlibs " $output_objdir/$libname.$libext"
  8488. # Transform .lo files to .o files.
  8489. oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.$libext$/d; $lo2o" | $NL2SP`
  8490. fi
  8491. # Eliminate all temporary directories.
  8492. #for path in $notinst_path; do
  8493. # lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"`
  8494. # deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"`
  8495. # dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"`
  8496. #done
  8497. if test -n "$xrpath"; then
  8498. # If the user specified any rpath flags, then add them.
  8499. temp_xrpath=
  8500. for libdir in $xrpath; do
  8501. func_replace_sysroot "$libdir"
  8502. func_append temp_xrpath " -R$func_replace_sysroot_result"
  8503. case "$finalize_rpath " in
  8504. *" $libdir "*) ;;
  8505. *) func_append finalize_rpath " $libdir" ;;
  8506. esac
  8507. done
  8508. if test yes != "$hardcode_into_libs" || test yes = "$build_old_libs"; then
  8509. dependency_libs="$temp_xrpath $dependency_libs"
  8510. fi
  8511. fi
  8512. # Make sure dlfiles contains only unique files that won't be dlpreopened
  8513. old_dlfiles=$dlfiles
  8514. dlfiles=
  8515. for lib in $old_dlfiles; do
  8516. case " $dlprefiles $dlfiles " in
  8517. *" $lib "*) ;;
  8518. *) func_append dlfiles " $lib" ;;
  8519. esac
  8520. done
  8521. # Make sure dlprefiles contains only unique files
  8522. old_dlprefiles=$dlprefiles
  8523. dlprefiles=
  8524. for lib in $old_dlprefiles; do
  8525. case "$dlprefiles " in
  8526. *" $lib "*) ;;
  8527. *) func_append dlprefiles " $lib" ;;
  8528. esac
  8529. done
  8530. if test yes = "$build_libtool_libs"; then
  8531. if test -n "$rpath"; then
  8532. case $host in
  8533. *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*)
  8534. # these systems don't actually have a c library (as such)!
  8535. ;;
  8536. *-*-rhapsody* | *-*-darwin1.[012])
  8537. # Rhapsody C library is in the System framework
  8538. func_append deplibs " System.ltframework"
  8539. ;;
  8540. *-*-netbsd*)
  8541. # Don't link with libc until the a.out ld.so is fixed.
  8542. ;;
  8543. *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
  8544. # Do not include libc due to us having libc/libc_r.
  8545. ;;
  8546. *-*-sco3.2v5* | *-*-sco5v6*)
  8547. # Causes problems with __ctype
  8548. ;;
  8549. *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
  8550. # Compiler inserts libc in the correct place for threads to work
  8551. ;;
  8552. *)
  8553. # Add libc to deplibs on all other systems if necessary.
  8554. if test yes = "$build_libtool_need_lc"; then
  8555. func_append deplibs " -lc"
  8556. fi
  8557. ;;
  8558. esac
  8559. fi
  8560. # Transform deplibs into only deplibs that can be linked in shared.
  8561. name_save=$name
  8562. libname_save=$libname
  8563. release_save=$release
  8564. versuffix_save=$versuffix
  8565. major_save=$major
  8566. # I'm not sure if I'm treating the release correctly. I think
  8567. # release should show up in the -l (ie -lgmp5) so we don't want to
  8568. # add it in twice. Is that correct?
  8569. release=
  8570. versuffix=
  8571. major=
  8572. newdeplibs=
  8573. droppeddeps=no
  8574. case $deplibs_check_method in
  8575. pass_all)
  8576. # Don't check for shared/static. Everything works.
  8577. # This might be a little naive. We might want to check
  8578. # whether the library exists or not. But this is on
  8579. # osf3 & osf4 and I'm not really sure... Just
  8580. # implementing what was already the behavior.
  8581. newdeplibs=$deplibs
  8582. ;;
  8583. test_compile)
  8584. # This code stresses the "libraries are programs" paradigm to its
  8585. # limits. Maybe even breaks it. We compile a program, linking it
  8586. # against the deplibs as a proxy for the library. Then we can check
  8587. # whether they linked in statically or dynamically with ldd.
  8588. $opt_dry_run || $RM conftest.c
  8589. cat > conftest.c <<EOF
  8590. int main() { return 0; }
  8591. EOF
  8592. $opt_dry_run || $RM conftest
  8593. if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then
  8594. ldd_output=`ldd conftest`
  8595. for i in $deplibs; do
  8596. case $i in
  8597. -l*)
  8598. func_stripname -l '' "$i"
  8599. name=$func_stripname_result
  8600. if test yes = "$allow_libtool_libs_with_static_runtimes"; then
  8601. case " $predeps $postdeps " in
  8602. *" $i "*)
  8603. func_append newdeplibs " $i"
  8604. i=
  8605. ;;
  8606. esac
  8607. fi
  8608. if test -n "$i"; then
  8609. libname=`eval "\\$ECHO \"$libname_spec\""`
  8610. deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
  8611. set dummy $deplib_matches; shift
  8612. deplib_match=$1
  8613. if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0; then
  8614. func_append newdeplibs " $i"
  8615. else
  8616. droppeddeps=yes
  8617. echo
  8618. $ECHO "*** Warning: dynamic linker does not accept needed library $i."
  8619. echo "*** I have the capability to make that library automatically link in when"
  8620. echo "*** you link to this library. But I can only do this if you have a"
  8621. echo "*** shared version of the library, which I believe you do not have"
  8622. echo "*** because a test_compile did reveal that the linker did not use it for"
  8623. echo "*** its dynamic dependency list that programs get resolved with at runtime."
  8624. fi
  8625. fi
  8626. ;;
  8627. *)
  8628. func_append newdeplibs " $i"
  8629. ;;
  8630. esac
  8631. done
  8632. else
  8633. # Error occurred in the first compile. Let's try to salvage
  8634. # the situation: Compile a separate program for each library.
  8635. for i in $deplibs; do
  8636. case $i in
  8637. -l*)
  8638. func_stripname -l '' "$i"
  8639. name=$func_stripname_result
  8640. $opt_dry_run || $RM conftest
  8641. if $LTCC $LTCFLAGS -o conftest conftest.c $i; then
  8642. ldd_output=`ldd conftest`
  8643. if test yes = "$allow_libtool_libs_with_static_runtimes"; then
  8644. case " $predeps $postdeps " in
  8645. *" $i "*)
  8646. func_append newdeplibs " $i"
  8647. i=
  8648. ;;
  8649. esac
  8650. fi
  8651. if test -n "$i"; then
  8652. libname=`eval "\\$ECHO \"$libname_spec\""`
  8653. deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
  8654. set dummy $deplib_matches; shift
  8655. deplib_match=$1
  8656. if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0; then
  8657. func_append newdeplibs " $i"
  8658. else
  8659. droppeddeps=yes
  8660. echo
  8661. $ECHO "*** Warning: dynamic linker does not accept needed library $i."
  8662. echo "*** I have the capability to make that library automatically link in when"
  8663. echo "*** you link to this library. But I can only do this if you have a"
  8664. echo "*** shared version of the library, which you do not appear to have"
  8665. echo "*** because a test_compile did reveal that the linker did not use this one"
  8666. echo "*** as a dynamic dependency that programs can get resolved with at runtime."
  8667. fi
  8668. fi
  8669. else
  8670. droppeddeps=yes
  8671. echo
  8672. $ECHO "*** Warning! Library $i is needed by this library but I was not able to"
  8673. echo "*** make it link in! You will probably need to install it or some"
  8674. echo "*** library that it depends on before this library will be fully"
  8675. echo "*** functional. Installing it before continuing would be even better."
  8676. fi
  8677. ;;
  8678. *)
  8679. func_append newdeplibs " $i"
  8680. ;;
  8681. esac
  8682. done
  8683. fi
  8684. ;;
  8685. file_magic*)
  8686. set dummy $deplibs_check_method; shift
  8687. file_magic_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
  8688. for a_deplib in $deplibs; do
  8689. case $a_deplib in
  8690. -l*)
  8691. func_stripname -l '' "$a_deplib"
  8692. name=$func_stripname_result
  8693. if test yes = "$allow_libtool_libs_with_static_runtimes"; then
  8694. case " $predeps $postdeps " in
  8695. *" $a_deplib "*)
  8696. func_append newdeplibs " $a_deplib"
  8697. a_deplib=
  8698. ;;
  8699. esac
  8700. fi
  8701. if test -n "$a_deplib"; then
  8702. libname=`eval "\\$ECHO \"$libname_spec\""`
  8703. if test -n "$file_magic_glob"; then
  8704. libnameglob=`func_echo_all "$libname" | $SED -e $file_magic_glob`
  8705. else
  8706. libnameglob=$libname
  8707. fi
  8708. test yes = "$want_nocaseglob" && nocaseglob=`shopt -p nocaseglob`
  8709. for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
  8710. if test yes = "$want_nocaseglob"; then
  8711. shopt -s nocaseglob
  8712. potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`
  8713. $nocaseglob
  8714. else
  8715. potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`
  8716. fi
  8717. for potent_lib in $potential_libs; do
  8718. # Follow soft links.
  8719. if ls -lLd "$potent_lib" 2>/dev/null |
  8720. $GREP " -> " >/dev/null; then
  8721. continue
  8722. fi
  8723. # The statement above tries to avoid entering an
  8724. # endless loop below, in case of cyclic links.
  8725. # We might still enter an endless loop, since a link
  8726. # loop can be closed while we follow links,
  8727. # but so what?
  8728. potlib=$potent_lib
  8729. while test -h "$potlib" 2>/dev/null; do
  8730. potliblink=`ls -ld $potlib | $SED 's/.* -> //'`
  8731. case $potliblink in
  8732. [\\/]* | [A-Za-z]:[\\/]*) potlib=$potliblink;;
  8733. *) potlib=`$ECHO "$potlib" | $SED 's|[^/]*$||'`"$potliblink";;
  8734. esac
  8735. done
  8736. if eval $file_magic_cmd \"\$potlib\" 2>/dev/null |
  8737. $SED -e 10q |
  8738. $EGREP "$file_magic_regex" > /dev/null; then
  8739. func_append newdeplibs " $a_deplib"
  8740. a_deplib=
  8741. break 2
  8742. fi
  8743. done
  8744. done
  8745. fi
  8746. if test -n "$a_deplib"; then
  8747. droppeddeps=yes
  8748. echo
  8749. $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
  8750. echo "*** I have the capability to make that library automatically link in when"
  8751. echo "*** you link to this library. But I can only do this if you have a"
  8752. echo "*** shared version of the library, which you do not appear to have"
  8753. echo "*** because I did check the linker path looking for a file starting"
  8754. if test -z "$potlib"; then
  8755. $ECHO "*** with $libname but no candidates were found. (...for file magic test)"
  8756. else
  8757. $ECHO "*** with $libname and none of the candidates passed a file format test"
  8758. $ECHO "*** using a file magic. Last file checked: $potlib"
  8759. fi
  8760. fi
  8761. ;;
  8762. *)
  8763. # Add a -L argument.
  8764. func_append newdeplibs " $a_deplib"
  8765. ;;
  8766. esac
  8767. done # Gone through all deplibs.
  8768. ;;
  8769. match_pattern*)
  8770. set dummy $deplibs_check_method; shift
  8771. match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
  8772. for a_deplib in $deplibs; do
  8773. case $a_deplib in
  8774. -l*)
  8775. func_stripname -l '' "$a_deplib"
  8776. name=$func_stripname_result
  8777. if test yes = "$allow_libtool_libs_with_static_runtimes"; then
  8778. case " $predeps $postdeps " in
  8779. *" $a_deplib "*)
  8780. func_append newdeplibs " $a_deplib"
  8781. a_deplib=
  8782. ;;
  8783. esac
  8784. fi
  8785. if test -n "$a_deplib"; then
  8786. libname=`eval "\\$ECHO \"$libname_spec\""`
  8787. for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
  8788. potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
  8789. for potent_lib in $potential_libs; do
  8790. potlib=$potent_lib # see symlink-check above in file_magic test
  8791. if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \
  8792. $EGREP "$match_pattern_regex" > /dev/null; then
  8793. func_append newdeplibs " $a_deplib"
  8794. a_deplib=
  8795. break 2
  8796. fi
  8797. done
  8798. done
  8799. fi
  8800. if test -n "$a_deplib"; then
  8801. droppeddeps=yes
  8802. echo
  8803. $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
  8804. echo "*** I have the capability to make that library automatically link in when"
  8805. echo "*** you link to this library. But I can only do this if you have a"
  8806. echo "*** shared version of the library, which you do not appear to have"
  8807. echo "*** because I did check the linker path looking for a file starting"
  8808. if test -z "$potlib"; then
  8809. $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)"
  8810. else
  8811. $ECHO "*** with $libname and none of the candidates passed a file format test"
  8812. $ECHO "*** using a regex pattern. Last file checked: $potlib"
  8813. fi
  8814. fi
  8815. ;;
  8816. *)
  8817. # Add a -L argument.
  8818. func_append newdeplibs " $a_deplib"
  8819. ;;
  8820. esac
  8821. done # Gone through all deplibs.
  8822. ;;
  8823. none | unknown | *)
  8824. newdeplibs=
  8825. tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'`
  8826. if test yes = "$allow_libtool_libs_with_static_runtimes"; then
  8827. for i in $predeps $postdeps; do
  8828. # can't use Xsed below, because $i might contain '/'
  8829. tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s|$i||"`
  8830. done
  8831. fi
  8832. case $tmp_deplibs in
  8833. *[!\ \ ]*)
  8834. echo
  8835. if test none = "$deplibs_check_method"; then
  8836. echo "*** Warning: inter-library dependencies are not supported in this platform."
  8837. else
  8838. echo "*** Warning: inter-library dependencies are not known to be supported."
  8839. fi
  8840. echo "*** All declared inter-library dependencies are being dropped."
  8841. droppeddeps=yes
  8842. ;;
  8843. esac
  8844. ;;
  8845. esac
  8846. versuffix=$versuffix_save
  8847. major=$major_save
  8848. release=$release_save
  8849. libname=$libname_save
  8850. name=$name_save
  8851. case $host in
  8852. *-*-rhapsody* | *-*-darwin1.[012])
  8853. # On Rhapsody replace the C library with the System framework
  8854. newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'`
  8855. ;;
  8856. esac
  8857. if test yes = "$droppeddeps"; then
  8858. if test yes = "$module"; then
  8859. echo
  8860. echo "*** Warning: libtool could not satisfy all declared inter-library"
  8861. $ECHO "*** dependencies of module $libname. Therefore, libtool will create"
  8862. echo "*** a static module, that should work as long as the dlopening"
  8863. echo "*** application is linked with the -dlopen flag."
  8864. if test -z "$global_symbol_pipe"; then
  8865. echo
  8866. echo "*** However, this would only work if libtool was able to extract symbol"
  8867. echo "*** lists from a program, using 'nm' or equivalent, but libtool could"
  8868. echo "*** not find such a program. So, this module is probably useless."
  8869. echo "*** 'nm' from GNU binutils and a full rebuild may help."
  8870. fi
  8871. if test no = "$build_old_libs"; then
  8872. oldlibs=$output_objdir/$libname.$libext
  8873. build_libtool_libs=module
  8874. build_old_libs=yes
  8875. else
  8876. build_libtool_libs=no
  8877. fi
  8878. else
  8879. echo "*** The inter-library dependencies that have been dropped here will be"
  8880. echo "*** automatically added whenever a program is linked with this library"
  8881. echo "*** or is declared to -dlopen it."
  8882. if test no = "$allow_undefined"; then
  8883. echo
  8884. echo "*** Since this library must not contain undefined symbols,"
  8885. echo "*** because either the platform does not support them or"
  8886. echo "*** it was explicitly requested with -no-undefined,"
  8887. echo "*** libtool will only create a static version of it."
  8888. if test no = "$build_old_libs"; then
  8889. oldlibs=$output_objdir/$libname.$libext
  8890. build_libtool_libs=module
  8891. build_old_libs=yes
  8892. else
  8893. build_libtool_libs=no
  8894. fi
  8895. fi
  8896. fi
  8897. fi
  8898. # Done checking deplibs!
  8899. deplibs=$newdeplibs
  8900. fi
  8901. # Time to change all our "foo.ltframework" stuff back to "-framework foo"
  8902. case $host in
  8903. *-*-darwin*)
  8904. newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
  8905. new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
  8906. deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
  8907. ;;
  8908. esac
  8909. # move library search paths that coincide with paths to not yet
  8910. # installed libraries to the beginning of the library search list
  8911. new_libs=
  8912. for path in $notinst_path; do
  8913. case " $new_libs " in
  8914. *" -L$path/$objdir "*) ;;
  8915. *)
  8916. case " $deplibs " in
  8917. *" -L$path/$objdir "*)
  8918. func_append new_libs " -L$path/$objdir" ;;
  8919. esac
  8920. ;;
  8921. esac
  8922. done
  8923. for deplib in $deplibs; do
  8924. case $deplib in
  8925. -L*)
  8926. case " $new_libs " in
  8927. *" $deplib "*) ;;
  8928. *) func_append new_libs " $deplib" ;;
  8929. esac
  8930. ;;
  8931. *) func_append new_libs " $deplib" ;;
  8932. esac
  8933. done
  8934. deplibs=$new_libs
  8935. # All the library-specific variables (install_libdir is set above).
  8936. library_names=
  8937. old_library=
  8938. dlname=
  8939. # Test again, we may have decided not to build it any more
  8940. if test yes = "$build_libtool_libs"; then
  8941. # Remove $wl instances when linking with ld.
  8942. # FIXME: should test the right _cmds variable.
  8943. case $archive_cmds in
  8944. *\$LD\ *) wl= ;;
  8945. esac
  8946. if test yes = "$hardcode_into_libs"; then
  8947. # Hardcode the library paths
  8948. hardcode_libdirs=
  8949. dep_rpath=
  8950. rpath=$finalize_rpath
  8951. test relink = "$opt_mode" || rpath=$compile_rpath$rpath
  8952. for libdir in $rpath; do
  8953. if test -n "$hardcode_libdir_flag_spec"; then
  8954. if test -n "$hardcode_libdir_separator"; then
  8955. func_replace_sysroot "$libdir"
  8956. libdir=$func_replace_sysroot_result
  8957. if test -z "$hardcode_libdirs"; then
  8958. hardcode_libdirs=$libdir
  8959. else
  8960. # Just accumulate the unique libdirs.
  8961. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
  8962. *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
  8963. ;;
  8964. *)
  8965. func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
  8966. ;;
  8967. esac
  8968. fi
  8969. else
  8970. eval flag=\"$hardcode_libdir_flag_spec\"
  8971. func_append dep_rpath " $flag"
  8972. fi
  8973. elif test -n "$runpath_var"; then
  8974. case "$perm_rpath " in
  8975. *" $libdir "*) ;;
  8976. *) func_append perm_rpath " $libdir" ;;
  8977. esac
  8978. fi
  8979. done
  8980. # Substitute the hardcoded libdirs into the rpath.
  8981. if test -n "$hardcode_libdir_separator" &&
  8982. test -n "$hardcode_libdirs"; then
  8983. libdir=$hardcode_libdirs
  8984. eval "dep_rpath=\"$hardcode_libdir_flag_spec\""
  8985. fi
  8986. if test -n "$runpath_var" && test -n "$perm_rpath"; then
  8987. # We should set the runpath_var.
  8988. rpath=
  8989. for dir in $perm_rpath; do
  8990. func_append rpath "$dir:"
  8991. done
  8992. eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
  8993. fi
  8994. test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
  8995. fi
  8996. shlibpath=$finalize_shlibpath
  8997. test relink = "$opt_mode" || shlibpath=$compile_shlibpath$shlibpath
  8998. if test -n "$shlibpath"; then
  8999. eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
  9000. fi
  9001. # Get the real and link names of the library.
  9002. eval shared_ext=\"$shrext_cmds\"
  9003. eval library_names=\"$library_names_spec\"
  9004. set dummy $library_names
  9005. shift
  9006. realname=$1
  9007. shift
  9008. if test -n "$soname_spec"; then
  9009. eval soname=\"$soname_spec\"
  9010. else
  9011. soname=$realname
  9012. fi
  9013. if test -z "$dlname"; then
  9014. dlname=$soname
  9015. fi
  9016. lib=$output_objdir/$realname
  9017. linknames=
  9018. for link
  9019. do
  9020. func_append linknames " $link"
  9021. done
  9022. # Use standard objects if they are pic
  9023. test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP`
  9024. test "X$libobjs" = "X " && libobjs=
  9025. delfiles=
  9026. if test -n "$export_symbols" && test -n "$include_expsyms"; then
  9027. $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp"
  9028. export_symbols=$output_objdir/$libname.uexp
  9029. func_append delfiles " $export_symbols"
  9030. fi
  9031. orig_export_symbols=
  9032. case $host_os in
  9033. cygwin* | mingw* | cegcc*)
  9034. if test -n "$export_symbols" && test -z "$export_symbols_regex"; then
  9035. # exporting using user supplied symfile
  9036. func_dll_def_p "$export_symbols" || {
  9037. # and it's NOT already a .def file. Must figure out
  9038. # which of the given symbols are data symbols and tag
  9039. # them as such. So, trigger use of export_symbols_cmds.
  9040. # export_symbols gets reassigned inside the "prepare
  9041. # the list of exported symbols" if statement, so the
  9042. # include_expsyms logic still works.
  9043. orig_export_symbols=$export_symbols
  9044. export_symbols=
  9045. always_export_symbols=yes
  9046. }
  9047. fi
  9048. ;;
  9049. esac
  9050. # Prepare the list of exported symbols
  9051. if test -z "$export_symbols"; then
  9052. if test yes = "$always_export_symbols" || test -n "$export_symbols_regex"; then
  9053. func_verbose "generating symbol list for '$libname.la'"
  9054. export_symbols=$output_objdir/$libname.exp
  9055. $opt_dry_run || $RM $export_symbols
  9056. cmds=$export_symbols_cmds
  9057. save_ifs=$IFS; IFS='~'
  9058. for cmd1 in $cmds; do
  9059. IFS=$save_ifs
  9060. # Take the normal branch if the nm_file_list_spec branch
  9061. # doesn't work or if tool conversion is not needed.
  9062. case $nm_file_list_spec~$to_tool_file_cmd in
  9063. *~func_convert_file_noop | *~func_convert_file_msys_to_w32 | ~*)
  9064. try_normal_branch=yes
  9065. eval cmd=\"$cmd1\"
  9066. func_len " $cmd"
  9067. len=$func_len_result
  9068. ;;
  9069. *)
  9070. try_normal_branch=no
  9071. ;;
  9072. esac
  9073. if test yes = "$try_normal_branch" \
  9074. && { test "$len" -lt "$max_cmd_len" \
  9075. || test "$max_cmd_len" -le -1; }
  9076. then
  9077. func_show_eval "$cmd" 'exit $?'
  9078. skipped_export=false
  9079. elif test -n "$nm_file_list_spec"; then
  9080. func_basename "$output"
  9081. output_la=$func_basename_result
  9082. save_libobjs=$libobjs
  9083. save_output=$output
  9084. output=$output_objdir/$output_la.nm
  9085. func_to_tool_file "$output"
  9086. libobjs=$nm_file_list_spec$func_to_tool_file_result
  9087. func_append delfiles " $output"
  9088. func_verbose "creating $NM input file list: $output"
  9089. for obj in $save_libobjs; do
  9090. func_to_tool_file "$obj"
  9091. $ECHO "$func_to_tool_file_result"
  9092. done > "$output"
  9093. eval cmd=\"$cmd1\"
  9094. func_show_eval "$cmd" 'exit $?'
  9095. output=$save_output
  9096. libobjs=$save_libobjs
  9097. skipped_export=false
  9098. else
  9099. # The command line is too long to execute in one step.
  9100. func_verbose "using reloadable object file for export list..."
  9101. skipped_export=:
  9102. # Break out early, otherwise skipped_export may be
  9103. # set to false by a later but shorter cmd.
  9104. break
  9105. fi
  9106. done
  9107. IFS=$save_ifs
  9108. if test -n "$export_symbols_regex" && test : != "$skipped_export"; then
  9109. func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
  9110. func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
  9111. fi
  9112. fi
  9113. fi
  9114. if test -n "$export_symbols" && test -n "$include_expsyms"; then
  9115. tmp_export_symbols=$export_symbols
  9116. test -n "$orig_export_symbols" && tmp_export_symbols=$orig_export_symbols
  9117. $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
  9118. fi
  9119. if test : != "$skipped_export" && test -n "$orig_export_symbols"; then
  9120. # The given exports_symbols file has to be filtered, so filter it.
  9121. func_verbose "filter symbol list for '$libname.la' to tag DATA exports"
  9122. # FIXME: $output_objdir/$libname.filter potentially contains lots of
  9123. # 's' commands, which not all seds can handle. GNU sed should be fine
  9124. # though. Also, the filter scales superlinearly with the number of
  9125. # global variables. join(1) would be nice here, but unfortunately
  9126. # isn't a blessed tool.
  9127. $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
  9128. func_append delfiles " $export_symbols $output_objdir/$libname.filter"
  9129. export_symbols=$output_objdir/$libname.def
  9130. $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
  9131. fi
  9132. tmp_deplibs=
  9133. for test_deplib in $deplibs; do
  9134. case " $convenience " in
  9135. *" $test_deplib "*) ;;
  9136. *)
  9137. func_append tmp_deplibs " $test_deplib"
  9138. ;;
  9139. esac
  9140. done
  9141. deplibs=$tmp_deplibs
  9142. if test -n "$convenience"; then
  9143. if test -n "$whole_archive_flag_spec" &&
  9144. test yes = "$compiler_needs_object" &&
  9145. test -z "$libobjs"; then
  9146. # extract the archives, so we have objects to list.
  9147. # TODO: could optimize this to just extract one archive.
  9148. whole_archive_flag_spec=
  9149. fi
  9150. if test -n "$whole_archive_flag_spec"; then
  9151. save_libobjs=$libobjs
  9152. eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
  9153. test "X$libobjs" = "X " && libobjs=
  9154. else
  9155. gentop=$output_objdir/${outputname}x
  9156. func_append generated " $gentop"
  9157. func_extract_archives $gentop $convenience
  9158. func_append libobjs " $func_extract_archives_result"
  9159. test "X$libobjs" = "X " && libobjs=
  9160. fi
  9161. fi
  9162. if test yes = "$thread_safe" && test -n "$thread_safe_flag_spec"; then
  9163. eval flag=\"$thread_safe_flag_spec\"
  9164. func_append linker_flags " $flag"
  9165. fi
  9166. # Make a backup of the uninstalled library when relinking
  9167. if test relink = "$opt_mode"; then
  9168. $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $?
  9169. fi
  9170. # Do each of the archive commands.
  9171. if test yes = "$module" && test -n "$module_cmds"; then
  9172. if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
  9173. eval test_cmds=\"$module_expsym_cmds\"
  9174. cmds=$module_expsym_cmds
  9175. else
  9176. eval test_cmds=\"$module_cmds\"
  9177. cmds=$module_cmds
  9178. fi
  9179. else
  9180. if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
  9181. eval test_cmds=\"$archive_expsym_cmds\"
  9182. cmds=$archive_expsym_cmds
  9183. else
  9184. eval test_cmds=\"$archive_cmds\"
  9185. cmds=$archive_cmds
  9186. fi
  9187. fi
  9188. if test : != "$skipped_export" &&
  9189. func_len " $test_cmds" &&
  9190. len=$func_len_result &&
  9191. test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
  9192. :
  9193. else
  9194. # The command line is too long to link in one step, link piecewise
  9195. # or, if using GNU ld and skipped_export is not :, use a linker
  9196. # script.
  9197. # Save the value of $output and $libobjs because we want to
  9198. # use them later. If we have whole_archive_flag_spec, we
  9199. # want to use save_libobjs as it was before
  9200. # whole_archive_flag_spec was expanded, because we can't
  9201. # assume the linker understands whole_archive_flag_spec.
  9202. # This may have to be revisited, in case too many
  9203. # convenience libraries get linked in and end up exceeding
  9204. # the spec.
  9205. if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
  9206. save_libobjs=$libobjs
  9207. fi
  9208. save_output=$output
  9209. func_basename "$output"
  9210. output_la=$func_basename_result
  9211. # Clear the reloadable object creation command queue and
  9212. # initialize k to one.
  9213. test_cmds=
  9214. concat_cmds=
  9215. objlist=
  9216. last_robj=
  9217. k=1
  9218. if test -n "$save_libobjs" && test : != "$skipped_export" && test yes = "$with_gnu_ld"; then
  9219. output=$output_objdir/$output_la.lnkscript
  9220. func_verbose "creating GNU ld script: $output"
  9221. echo 'INPUT (' > $output
  9222. for obj in $save_libobjs
  9223. do
  9224. func_to_tool_file "$obj"
  9225. $ECHO "$func_to_tool_file_result" >> $output
  9226. done
  9227. echo ')' >> $output
  9228. func_append delfiles " $output"
  9229. func_to_tool_file "$output"
  9230. output=$func_to_tool_file_result
  9231. elif test -n "$save_libobjs" && test : != "$skipped_export" && test -n "$file_list_spec"; then
  9232. output=$output_objdir/$output_la.lnk
  9233. func_verbose "creating linker input file list: $output"
  9234. : > $output
  9235. set x $save_libobjs
  9236. shift
  9237. firstobj=
  9238. if test yes = "$compiler_needs_object"; then
  9239. firstobj="$1 "
  9240. shift
  9241. fi
  9242. for obj
  9243. do
  9244. func_to_tool_file "$obj"
  9245. $ECHO "$func_to_tool_file_result" >> $output
  9246. done
  9247. func_append delfiles " $output"
  9248. func_to_tool_file "$output"
  9249. output=$firstobj\"$file_list_spec$func_to_tool_file_result\"
  9250. else
  9251. if test -n "$save_libobjs"; then
  9252. func_verbose "creating reloadable object files..."
  9253. output=$output_objdir/$output_la-$k.$objext
  9254. eval test_cmds=\"$reload_cmds\"
  9255. func_len " $test_cmds"
  9256. len0=$func_len_result
  9257. len=$len0
  9258. # Loop over the list of objects to be linked.
  9259. for obj in $save_libobjs
  9260. do
  9261. func_len " $obj"
  9262. func_arith $len + $func_len_result
  9263. len=$func_arith_result
  9264. if test -z "$objlist" ||
  9265. test "$len" -lt "$max_cmd_len"; then
  9266. func_append objlist " $obj"
  9267. else
  9268. # The command $test_cmds is almost too long, add a
  9269. # command to the queue.
  9270. if test 1 -eq "$k"; then
  9271. # The first file doesn't have a previous command to add.
  9272. reload_objs=$objlist
  9273. eval concat_cmds=\"$reload_cmds\"
  9274. else
  9275. # All subsequent reloadable object files will link in
  9276. # the last one created.
  9277. reload_objs="$objlist $last_robj"
  9278. eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\"
  9279. fi
  9280. last_robj=$output_objdir/$output_la-$k.$objext
  9281. func_arith $k + 1
  9282. k=$func_arith_result
  9283. output=$output_objdir/$output_la-$k.$objext
  9284. objlist=" $obj"
  9285. func_len " $last_robj"
  9286. func_arith $len0 + $func_len_result
  9287. len=$func_arith_result
  9288. fi
  9289. done
  9290. # Handle the remaining objects by creating one last
  9291. # reloadable object file. All subsequent reloadable object
  9292. # files will link in the last one created.
  9293. test -z "$concat_cmds" || concat_cmds=$concat_cmds~
  9294. reload_objs="$objlist $last_robj"
  9295. eval concat_cmds=\"\$concat_cmds$reload_cmds\"
  9296. if test -n "$last_robj"; then
  9297. eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\"
  9298. fi
  9299. func_append delfiles " $output"
  9300. else
  9301. output=
  9302. fi
  9303. ${skipped_export-false} && {
  9304. func_verbose "generating symbol list for '$libname.la'"
  9305. export_symbols=$output_objdir/$libname.exp
  9306. $opt_dry_run || $RM $export_symbols
  9307. libobjs=$output
  9308. # Append the command to create the export file.
  9309. test -z "$concat_cmds" || concat_cmds=$concat_cmds~
  9310. eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\"
  9311. if test -n "$last_robj"; then
  9312. eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\"
  9313. fi
  9314. }
  9315. test -n "$save_libobjs" &&
  9316. func_verbose "creating a temporary reloadable object file: $output"
  9317. # Loop through the commands generated above and execute them.
  9318. save_ifs=$IFS; IFS='~'
  9319. for cmd in $concat_cmds; do
  9320. IFS=$save_ifs
  9321. $opt_quiet || {
  9322. func_quote_arg expand,pretty "$cmd"
  9323. eval "func_echo $func_quote_arg_result"
  9324. }
  9325. $opt_dry_run || eval "$cmd" || {
  9326. lt_exit=$?
  9327. # Restore the uninstalled library and exit
  9328. if test relink = "$opt_mode"; then
  9329. ( cd "$output_objdir" && \
  9330. $RM "${realname}T" && \
  9331. $MV "${realname}U" "$realname" )
  9332. fi
  9333. exit $lt_exit
  9334. }
  9335. done
  9336. IFS=$save_ifs
  9337. if test -n "$export_symbols_regex" && ${skipped_export-false}; then
  9338. func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
  9339. func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
  9340. fi
  9341. fi
  9342. ${skipped_export-false} && {
  9343. if test -n "$export_symbols" && test -n "$include_expsyms"; then
  9344. tmp_export_symbols=$export_symbols
  9345. test -n "$orig_export_symbols" && tmp_export_symbols=$orig_export_symbols
  9346. $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
  9347. fi
  9348. if test -n "$orig_export_symbols"; then
  9349. # The given exports_symbols file has to be filtered, so filter it.
  9350. func_verbose "filter symbol list for '$libname.la' to tag DATA exports"
  9351. # FIXME: $output_objdir/$libname.filter potentially contains lots of
  9352. # 's' commands, which not all seds can handle. GNU sed should be fine
  9353. # though. Also, the filter scales superlinearly with the number of
  9354. # global variables. join(1) would be nice here, but unfortunately
  9355. # isn't a blessed tool.
  9356. $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
  9357. func_append delfiles " $export_symbols $output_objdir/$libname.filter"
  9358. export_symbols=$output_objdir/$libname.def
  9359. $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
  9360. fi
  9361. }
  9362. libobjs=$output
  9363. # Restore the value of output.
  9364. output=$save_output
  9365. if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
  9366. eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
  9367. test "X$libobjs" = "X " && libobjs=
  9368. fi
  9369. # Expand the library linking commands again to reset the
  9370. # value of $libobjs for piecewise linking.
  9371. # Do each of the archive commands.
  9372. if test yes = "$module" && test -n "$module_cmds"; then
  9373. if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
  9374. cmds=$module_expsym_cmds
  9375. else
  9376. cmds=$module_cmds
  9377. fi
  9378. else
  9379. if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
  9380. cmds=$archive_expsym_cmds
  9381. else
  9382. cmds=$archive_cmds
  9383. fi
  9384. fi
  9385. fi
  9386. if test -n "$delfiles"; then
  9387. # Append the command to remove temporary files to $cmds.
  9388. eval cmds=\"\$cmds~\$RM $delfiles\"
  9389. fi
  9390. # Add any objects from preloaded convenience libraries
  9391. if test -n "$dlprefiles"; then
  9392. gentop=$output_objdir/${outputname}x
  9393. func_append generated " $gentop"
  9394. func_extract_archives $gentop $dlprefiles
  9395. func_append libobjs " $func_extract_archives_result"
  9396. test "X$libobjs" = "X " && libobjs=
  9397. fi
  9398. save_ifs=$IFS; IFS='~'
  9399. for cmd in $cmds; do
  9400. IFS=$sp$nl
  9401. eval cmd=\"$cmd\"
  9402. IFS=$save_ifs
  9403. $opt_quiet || {
  9404. func_quote_arg expand,pretty "$cmd"
  9405. eval "func_echo $func_quote_arg_result"
  9406. }
  9407. $opt_dry_run || eval "$cmd" || {
  9408. lt_exit=$?
  9409. # Restore the uninstalled library and exit
  9410. if test relink = "$opt_mode"; then
  9411. ( cd "$output_objdir" && \
  9412. $RM "${realname}T" && \
  9413. $MV "${realname}U" "$realname" )
  9414. fi
  9415. exit $lt_exit
  9416. }
  9417. done
  9418. IFS=$save_ifs
  9419. # Restore the uninstalled library and exit
  9420. if test relink = "$opt_mode"; then
  9421. $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $?
  9422. if test -n "$convenience"; then
  9423. if test -z "$whole_archive_flag_spec"; then
  9424. func_show_eval '${RM}r "$gentop"'
  9425. fi
  9426. fi
  9427. exit $EXIT_SUCCESS
  9428. fi
  9429. # Create links to the real library.
  9430. for linkname in $linknames; do
  9431. if test "$realname" != "$linkname"; then
  9432. func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?'
  9433. fi
  9434. done
  9435. # If -module or -export-dynamic was specified, set the dlname.
  9436. if test yes = "$module" || test yes = "$export_dynamic"; then
  9437. # On all known operating systems, these are identical.
  9438. dlname=$soname
  9439. fi
  9440. fi
  9441. ;;
  9442. obj)
  9443. if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then
  9444. func_warning "'-dlopen' is ignored for objects"
  9445. fi
  9446. case " $deplibs" in
  9447. *\ -l* | *\ -L*)
  9448. func_warning "'-l' and '-L' are ignored for objects" ;;
  9449. esac
  9450. test -n "$rpath" && \
  9451. func_warning "'-rpath' is ignored for objects"
  9452. test -n "$xrpath" && \
  9453. func_warning "'-R' is ignored for objects"
  9454. test -n "$vinfo" && \
  9455. func_warning "'-version-info' is ignored for objects"
  9456. test -n "$release" && \
  9457. func_warning "'-release' is ignored for objects"
  9458. case $output in
  9459. *.lo)
  9460. test -n "$objs$old_deplibs" && \
  9461. func_fatal_error "cannot build library object '$output' from non-libtool objects"
  9462. libobj=$output
  9463. func_lo2o "$libobj"
  9464. obj=$func_lo2o_result
  9465. ;;
  9466. *)
  9467. libobj=
  9468. obj=$output
  9469. ;;
  9470. esac
  9471. # Delete the old objects.
  9472. $opt_dry_run || $RM $obj $libobj
  9473. # Objects from convenience libraries. This assumes
  9474. # single-version convenience libraries. Whenever we create
  9475. # different ones for PIC/non-PIC, this we'll have to duplicate
  9476. # the extraction.
  9477. reload_conv_objs=
  9478. gentop=
  9479. # if reload_cmds runs $LD directly, get rid of -Wl from
  9480. # whole_archive_flag_spec and hope we can get by with turning comma
  9481. # into space.
  9482. case $reload_cmds in
  9483. *\$LD[\ \$]*) wl= ;;
  9484. esac
  9485. if test -n "$convenience"; then
  9486. if test -n "$whole_archive_flag_spec"; then
  9487. eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
  9488. test -n "$wl" || tmp_whole_archive_flags=`$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'`
  9489. reload_conv_objs=$reload_objs\ $tmp_whole_archive_flags
  9490. else
  9491. gentop=$output_objdir/${obj}x
  9492. func_append generated " $gentop"
  9493. func_extract_archives $gentop $convenience
  9494. reload_conv_objs="$reload_objs $func_extract_archives_result"
  9495. fi
  9496. fi
  9497. # If we're not building shared, we need to use non_pic_objs
  9498. test yes = "$build_libtool_libs" || libobjs=$non_pic_objects
  9499. # Create the old-style object.
  9500. reload_objs=$objs$old_deplibs' '`$ECHO "$libobjs" | $SP2NL | $SED "/\.$libext$/d; /\.lib$/d; $lo2o" | $NL2SP`' '$reload_conv_objs
  9501. output=$obj
  9502. func_execute_cmds "$reload_cmds" 'exit $?'
  9503. # Exit if we aren't doing a library object file.
  9504. if test -z "$libobj"; then
  9505. if test -n "$gentop"; then
  9506. func_show_eval '${RM}r "$gentop"'
  9507. fi
  9508. exit $EXIT_SUCCESS
  9509. fi
  9510. test yes = "$build_libtool_libs" || {
  9511. if test -n "$gentop"; then
  9512. func_show_eval '${RM}r "$gentop"'
  9513. fi
  9514. # Create an invalid libtool object if no PIC, so that we don't
  9515. # accidentally link it into a program.
  9516. # $show "echo timestamp > $libobj"
  9517. # $opt_dry_run || eval "echo timestamp > $libobj" || exit $?
  9518. exit $EXIT_SUCCESS
  9519. }
  9520. if test -n "$pic_flag" || test default != "$pic_mode"; then
  9521. # Only do commands if we really have different PIC objects.
  9522. reload_objs="$libobjs $reload_conv_objs"
  9523. output=$libobj
  9524. func_execute_cmds "$reload_cmds" 'exit $?'
  9525. fi
  9526. if test -n "$gentop"; then
  9527. func_show_eval '${RM}r "$gentop"'
  9528. fi
  9529. exit $EXIT_SUCCESS
  9530. ;;
  9531. prog)
  9532. case $host in
  9533. *cygwin*) func_stripname '' '.exe' "$output"
  9534. output=$func_stripname_result.exe;;
  9535. esac
  9536. test -n "$vinfo" && \
  9537. func_warning "'-version-info' is ignored for programs"
  9538. test -n "$release" && \
  9539. func_warning "'-release' is ignored for programs"
  9540. $preload \
  9541. && test unknown,unknown,unknown = "$dlopen_support,$dlopen_self,$dlopen_self_static" \
  9542. && func_warning "'LT_INIT([dlopen])' not used. Assuming no dlopen support."
  9543. case $host in
  9544. *-*-rhapsody* | *-*-darwin1.[012])
  9545. # On Rhapsody replace the C library is the System framework
  9546. compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'`
  9547. finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'`
  9548. ;;
  9549. esac
  9550. case $host in
  9551. *-*-darwin*)
  9552. # Don't allow lazy linking, it breaks C++ global constructors
  9553. # But is supposedly fixed on 10.4 or later (yay!).
  9554. if test CXX = "$tagname"; then
  9555. case ${MACOSX_DEPLOYMENT_TARGET-10.0} in
  9556. 10.[0123])
  9557. func_append compile_command " $wl-bind_at_load"
  9558. func_append finalize_command " $wl-bind_at_load"
  9559. ;;
  9560. esac
  9561. fi
  9562. # Time to change all our "foo.ltframework" stuff back to "-framework foo"
  9563. compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
  9564. finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
  9565. ;;
  9566. esac
  9567. # move library search paths that coincide with paths to not yet
  9568. # installed libraries to the beginning of the library search list
  9569. new_libs=
  9570. for path in $notinst_path; do
  9571. case " $new_libs " in
  9572. *" -L$path/$objdir "*) ;;
  9573. *)
  9574. case " $compile_deplibs " in
  9575. *" -L$path/$objdir "*)
  9576. func_append new_libs " -L$path/$objdir" ;;
  9577. esac
  9578. ;;
  9579. esac
  9580. done
  9581. for deplib in $compile_deplibs; do
  9582. case $deplib in
  9583. -L*)
  9584. case " $new_libs " in
  9585. *" $deplib "*) ;;
  9586. *) func_append new_libs " $deplib" ;;
  9587. esac
  9588. ;;
  9589. *) func_append new_libs " $deplib" ;;
  9590. esac
  9591. done
  9592. compile_deplibs=$new_libs
  9593. func_append compile_command " $compile_deplibs"
  9594. func_append finalize_command " $finalize_deplibs"
  9595. if test -n "$rpath$xrpath"; then
  9596. # If the user specified any rpath flags, then add them.
  9597. for libdir in $rpath $xrpath; do
  9598. # This is the magic to use -rpath.
  9599. case "$finalize_rpath " in
  9600. *" $libdir "*) ;;
  9601. *) func_append finalize_rpath " $libdir" ;;
  9602. esac
  9603. done
  9604. fi
  9605. # Now hardcode the library paths
  9606. rpath=
  9607. hardcode_libdirs=
  9608. for libdir in $compile_rpath $finalize_rpath; do
  9609. if test -n "$hardcode_libdir_flag_spec"; then
  9610. if test -n "$hardcode_libdir_separator"; then
  9611. if test -z "$hardcode_libdirs"; then
  9612. hardcode_libdirs=$libdir
  9613. else
  9614. # Just accumulate the unique libdirs.
  9615. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
  9616. *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
  9617. ;;
  9618. *)
  9619. func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
  9620. ;;
  9621. esac
  9622. fi
  9623. else
  9624. eval flag=\"$hardcode_libdir_flag_spec\"
  9625. func_append rpath " $flag"
  9626. fi
  9627. elif test -n "$runpath_var"; then
  9628. case "$perm_rpath " in
  9629. *" $libdir "*) ;;
  9630. *) func_append perm_rpath " $libdir" ;;
  9631. esac
  9632. fi
  9633. case $host in
  9634. *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
  9635. testbindir=`$ECHO "$libdir" | $SED -e 's*/lib$*/bin*'`
  9636. case :$dllsearchpath: in
  9637. *":$libdir:"*) ;;
  9638. ::) dllsearchpath=$libdir;;
  9639. *) func_append dllsearchpath ":$libdir";;
  9640. esac
  9641. case :$dllsearchpath: in
  9642. *":$testbindir:"*) ;;
  9643. ::) dllsearchpath=$testbindir;;
  9644. *) func_append dllsearchpath ":$testbindir";;
  9645. esac
  9646. ;;
  9647. esac
  9648. done
  9649. # Substitute the hardcoded libdirs into the rpath.
  9650. if test -n "$hardcode_libdir_separator" &&
  9651. test -n "$hardcode_libdirs"; then
  9652. libdir=$hardcode_libdirs
  9653. eval rpath=\" $hardcode_libdir_flag_spec\"
  9654. fi
  9655. compile_rpath=$rpath
  9656. rpath=
  9657. hardcode_libdirs=
  9658. for libdir in $finalize_rpath; do
  9659. if test -n "$hardcode_libdir_flag_spec"; then
  9660. if test -n "$hardcode_libdir_separator"; then
  9661. if test -z "$hardcode_libdirs"; then
  9662. hardcode_libdirs=$libdir
  9663. else
  9664. # Just accumulate the unique libdirs.
  9665. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
  9666. *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
  9667. ;;
  9668. *)
  9669. func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
  9670. ;;
  9671. esac
  9672. fi
  9673. else
  9674. eval flag=\"$hardcode_libdir_flag_spec\"
  9675. func_append rpath " $flag"
  9676. fi
  9677. elif test -n "$runpath_var"; then
  9678. case "$finalize_perm_rpath " in
  9679. *" $libdir "*) ;;
  9680. *) func_append finalize_perm_rpath " $libdir" ;;
  9681. esac
  9682. fi
  9683. done
  9684. # Substitute the hardcoded libdirs into the rpath.
  9685. if test -n "$hardcode_libdir_separator" &&
  9686. test -n "$hardcode_libdirs"; then
  9687. libdir=$hardcode_libdirs
  9688. eval rpath=\" $hardcode_libdir_flag_spec\"
  9689. fi
  9690. finalize_rpath=$rpath
  9691. if test -n "$libobjs" && test yes = "$build_old_libs"; then
  9692. # Transform all the library objects into standard objects.
  9693. compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
  9694. finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
  9695. fi
  9696. func_generate_dlsyms "$outputname" "@PROGRAM@" false
  9697. # template prelinking step
  9698. if test -n "$prelink_cmds"; then
  9699. func_execute_cmds "$prelink_cmds" 'exit $?'
  9700. fi
  9701. wrappers_required=:
  9702. case $host in
  9703. *cegcc* | *mingw32ce*)
  9704. # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway.
  9705. wrappers_required=false
  9706. ;;
  9707. *cygwin* | *mingw* )
  9708. test yes = "$build_libtool_libs" || wrappers_required=false
  9709. ;;
  9710. *)
  9711. if test no = "$need_relink" || test yes != "$build_libtool_libs"; then
  9712. wrappers_required=false
  9713. fi
  9714. ;;
  9715. esac
  9716. $wrappers_required || {
  9717. # Replace the output file specification.
  9718. compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
  9719. link_command=$compile_command$compile_rpath
  9720. # We have no uninstalled library dependencies, so finalize right now.
  9721. exit_status=0
  9722. func_show_eval "$link_command" 'exit_status=$?'
  9723. if test -n "$postlink_cmds"; then
  9724. func_to_tool_file "$output"
  9725. postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
  9726. func_execute_cmds "$postlink_cmds" 'exit $?'
  9727. fi
  9728. # Delete the generated files.
  9729. if test -f "$output_objdir/${outputname}S.$objext"; then
  9730. func_show_eval '$RM "$output_objdir/${outputname}S.$objext"'
  9731. fi
  9732. exit $exit_status
  9733. }
  9734. if test -n "$compile_shlibpath$finalize_shlibpath"; then
  9735. compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
  9736. fi
  9737. if test -n "$finalize_shlibpath"; then
  9738. finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
  9739. fi
  9740. compile_var=
  9741. finalize_var=
  9742. if test -n "$runpath_var"; then
  9743. if test -n "$perm_rpath"; then
  9744. # We should set the runpath_var.
  9745. rpath=
  9746. for dir in $perm_rpath; do
  9747. func_append rpath "$dir:"
  9748. done
  9749. compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
  9750. fi
  9751. if test -n "$finalize_perm_rpath"; then
  9752. # We should set the runpath_var.
  9753. rpath=
  9754. for dir in $finalize_perm_rpath; do
  9755. func_append rpath "$dir:"
  9756. done
  9757. finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
  9758. fi
  9759. fi
  9760. if test yes = "$no_install"; then
  9761. # We don't need to create a wrapper script.
  9762. link_command=$compile_var$compile_command$compile_rpath
  9763. # Replace the output file specification.
  9764. link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
  9765. # Delete the old output file.
  9766. $opt_dry_run || $RM $output
  9767. # Link the executable and exit
  9768. func_show_eval "$link_command" 'exit $?'
  9769. if test -n "$postlink_cmds"; then
  9770. func_to_tool_file "$output"
  9771. postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
  9772. func_execute_cmds "$postlink_cmds" 'exit $?'
  9773. fi
  9774. exit $EXIT_SUCCESS
  9775. fi
  9776. case $hardcode_action,$fast_install in
  9777. relink,*)
  9778. # Fast installation is not supported
  9779. link_command=$compile_var$compile_command$compile_rpath
  9780. relink_command=$finalize_var$finalize_command$finalize_rpath
  9781. func_warning "this platform does not like uninstalled shared libraries"
  9782. func_warning "'$output' will be relinked during installation"
  9783. ;;
  9784. *,yes)
  9785. link_command=$finalize_var$compile_command$finalize_rpath
  9786. relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'`
  9787. ;;
  9788. *,no)
  9789. link_command=$compile_var$compile_command$compile_rpath
  9790. relink_command=$finalize_var$finalize_command$finalize_rpath
  9791. ;;
  9792. *,needless)
  9793. link_command=$finalize_var$compile_command$finalize_rpath
  9794. relink_command=
  9795. ;;
  9796. esac
  9797. # Replace the output file specification.
  9798. link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
  9799. # Delete the old output files.
  9800. $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname
  9801. func_show_eval "$link_command" 'exit $?'
  9802. if test -n "$postlink_cmds"; then
  9803. func_to_tool_file "$output_objdir/$outputname"
  9804. 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'`
  9805. func_execute_cmds "$postlink_cmds" 'exit $?'
  9806. fi
  9807. # Now create the wrapper script.
  9808. func_verbose "creating $output"
  9809. # Quote the relink command for shipping.
  9810. if test -n "$relink_command"; then
  9811. # Preserve any variables that may affect compiler behavior
  9812. for var in $variables_saved_for_relink; do
  9813. if eval test -z \"\${$var+set}\"; then
  9814. relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
  9815. elif eval var_value=\$$var; test -z "$var_value"; then
  9816. relink_command="$var=; export $var; $relink_command"
  9817. else
  9818. func_quote_arg pretty "$var_value"
  9819. relink_command="$var=$func_quote_arg_result; export $var; $relink_command"
  9820. fi
  9821. done
  9822. func_quote_arg pretty,unquoted "(cd `pwd`; $relink_command)"
  9823. relink_command=$func_quote_arg_unquoted_result
  9824. fi
  9825. # Only actually do things if not in dry run mode.
  9826. $opt_dry_run || {
  9827. # win32 will think the script is a binary if it has
  9828. # a .exe suffix, so we strip it off here.
  9829. case $output in
  9830. *.exe) func_stripname '' '.exe' "$output"
  9831. output=$func_stripname_result ;;
  9832. esac
  9833. # test for cygwin because mv fails w/o .exe extensions
  9834. case $host in
  9835. *cygwin*)
  9836. exeext=.exe
  9837. func_stripname '' '.exe' "$outputname"
  9838. outputname=$func_stripname_result ;;
  9839. *) exeext= ;;
  9840. esac
  9841. case $host in
  9842. *cygwin* | *mingw* )
  9843. func_dirname_and_basename "$output" "" "."
  9844. output_name=$func_basename_result
  9845. output_path=$func_dirname_result
  9846. cwrappersource=$output_path/$objdir/lt-$output_name.c
  9847. cwrapper=$output_path/$output_name.exe
  9848. $RM $cwrappersource $cwrapper
  9849. trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
  9850. func_emit_cwrapperexe_src > $cwrappersource
  9851. # The wrapper executable is built using the $host compiler,
  9852. # because it contains $host paths and files. If cross-
  9853. # compiling, it, like the target executable, must be
  9854. # executed on the $host or under an emulation environment.
  9855. $opt_dry_run || {
  9856. $LTCC $LTCFLAGS -o $cwrapper $cwrappersource
  9857. $STRIP $cwrapper
  9858. }
  9859. # Now, create the wrapper script for func_source use:
  9860. func_ltwrapper_scriptname $cwrapper
  9861. $RM $func_ltwrapper_scriptname_result
  9862. trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15
  9863. $opt_dry_run || {
  9864. # note: this script will not be executed, so do not chmod.
  9865. if test "x$build" = "x$host"; then
  9866. $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result
  9867. else
  9868. func_emit_wrapper no > $func_ltwrapper_scriptname_result
  9869. fi
  9870. }
  9871. ;;
  9872. * )
  9873. $RM $output
  9874. trap "$RM $output; exit $EXIT_FAILURE" 1 2 15
  9875. func_emit_wrapper no > $output
  9876. chmod +x $output
  9877. ;;
  9878. esac
  9879. }
  9880. exit $EXIT_SUCCESS
  9881. ;;
  9882. esac
  9883. # See if we need to build an old-fashioned archive.
  9884. for oldlib in $oldlibs; do
  9885. case $build_libtool_libs in
  9886. convenience)
  9887. oldobjs="$libobjs_save $symfileobj"
  9888. addlibs=$convenience
  9889. build_libtool_libs=no
  9890. ;;
  9891. module)
  9892. oldobjs=$libobjs_save
  9893. addlibs=$old_convenience
  9894. build_libtool_libs=no
  9895. ;;
  9896. *)
  9897. oldobjs="$old_deplibs $non_pic_objects"
  9898. $preload && test -f "$symfileobj" \
  9899. && func_append oldobjs " $symfileobj"
  9900. addlibs=$old_convenience
  9901. ;;
  9902. esac
  9903. if test -n "$addlibs"; then
  9904. gentop=$output_objdir/${outputname}x
  9905. func_append generated " $gentop"
  9906. func_extract_archives $gentop $addlibs
  9907. func_append oldobjs " $func_extract_archives_result"
  9908. fi
  9909. # Do each command in the archive commands.
  9910. if test -n "$old_archive_from_new_cmds" && test yes = "$build_libtool_libs"; then
  9911. cmds=$old_archive_from_new_cmds
  9912. else
  9913. # Add any objects from preloaded convenience libraries
  9914. if test -n "$dlprefiles"; then
  9915. gentop=$output_objdir/${outputname}x
  9916. func_append generated " $gentop"
  9917. func_extract_archives $gentop $dlprefiles
  9918. func_append oldobjs " $func_extract_archives_result"
  9919. fi
  9920. # POSIX demands no paths to be encoded in archives. We have
  9921. # to avoid creating archives with duplicate basenames if we
  9922. # might have to extract them afterwards, e.g., when creating a
  9923. # static archive out of a convenience library, or when linking
  9924. # the entirety of a libtool archive into another (currently
  9925. # not supported by libtool).
  9926. if (for obj in $oldobjs
  9927. do
  9928. func_basename "$obj"
  9929. $ECHO "$func_basename_result"
  9930. done | sort | sort -uc >/dev/null 2>&1); then
  9931. :
  9932. else
  9933. echo "copying selected object files to avoid basename conflicts..."
  9934. gentop=$output_objdir/${outputname}x
  9935. func_append generated " $gentop"
  9936. func_mkdir_p "$gentop"
  9937. save_oldobjs=$oldobjs
  9938. oldobjs=
  9939. counter=1
  9940. for obj in $save_oldobjs
  9941. do
  9942. func_basename "$obj"
  9943. objbase=$func_basename_result
  9944. case " $oldobjs " in
  9945. " ") oldobjs=$obj ;;
  9946. *[\ /]"$objbase "*)
  9947. while :; do
  9948. # Make sure we don't pick an alternate name that also
  9949. # overlaps.
  9950. newobj=lt$counter-$objbase
  9951. func_arith $counter + 1
  9952. counter=$func_arith_result
  9953. case " $oldobjs " in
  9954. *[\ /]"$newobj "*) ;;
  9955. *) if test ! -f "$gentop/$newobj"; then break; fi ;;
  9956. esac
  9957. done
  9958. func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
  9959. func_append oldobjs " $gentop/$newobj"
  9960. ;;
  9961. *) func_append oldobjs " $obj" ;;
  9962. esac
  9963. done
  9964. fi
  9965. func_to_tool_file "$oldlib" func_convert_file_msys_to_w32
  9966. tool_oldlib=$func_to_tool_file_result
  9967. eval cmds=\"$old_archive_cmds\"
  9968. func_len " $cmds"
  9969. len=$func_len_result
  9970. if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
  9971. cmds=$old_archive_cmds
  9972. elif test -n "$archiver_list_spec"; then
  9973. func_verbose "using command file archive linking..."
  9974. for obj in $oldobjs
  9975. do
  9976. func_to_tool_file "$obj"
  9977. $ECHO "$func_to_tool_file_result"
  9978. done > $output_objdir/$libname.libcmd
  9979. func_to_tool_file "$output_objdir/$libname.libcmd"
  9980. oldobjs=" $archiver_list_spec$func_to_tool_file_result"
  9981. cmds=$old_archive_cmds
  9982. else
  9983. # the command line is too long to link in one step, link in parts
  9984. func_verbose "using piecewise archive linking..."
  9985. save_RANLIB=$RANLIB
  9986. RANLIB=:
  9987. objlist=
  9988. concat_cmds=
  9989. save_oldobjs=$oldobjs
  9990. oldobjs=
  9991. # Is there a better way of finding the last object in the list?
  9992. for obj in $save_oldobjs
  9993. do
  9994. last_oldobj=$obj
  9995. done
  9996. eval test_cmds=\"$old_archive_cmds\"
  9997. func_len " $test_cmds"
  9998. len0=$func_len_result
  9999. len=$len0
  10000. for obj in $save_oldobjs
  10001. do
  10002. func_len " $obj"
  10003. func_arith $len + $func_len_result
  10004. len=$func_arith_result
  10005. func_append objlist " $obj"
  10006. if test "$len" -lt "$max_cmd_len"; then
  10007. :
  10008. else
  10009. # the above command should be used before it gets too long
  10010. oldobjs=$objlist
  10011. if test "$obj" = "$last_oldobj"; then
  10012. RANLIB=$save_RANLIB
  10013. fi
  10014. test -z "$concat_cmds" || concat_cmds=$concat_cmds~
  10015. eval concat_cmds=\"\$concat_cmds$old_archive_cmds\"
  10016. objlist=
  10017. len=$len0
  10018. fi
  10019. done
  10020. RANLIB=$save_RANLIB
  10021. oldobjs=$objlist
  10022. if test -z "$oldobjs"; then
  10023. eval cmds=\"\$concat_cmds\"
  10024. else
  10025. eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
  10026. fi
  10027. fi
  10028. fi
  10029. func_execute_cmds "$cmds" 'exit $?'
  10030. done
  10031. test -n "$generated" && \
  10032. func_show_eval "${RM}r$generated"
  10033. # Now create the libtool archive.
  10034. case $output in
  10035. *.la)
  10036. old_library=
  10037. test yes = "$build_old_libs" && old_library=$libname.$libext
  10038. func_verbose "creating $output"
  10039. # Preserve any variables that may affect compiler behavior
  10040. for var in $variables_saved_for_relink; do
  10041. if eval test -z \"\${$var+set}\"; then
  10042. relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
  10043. elif eval var_value=\$$var; test -z "$var_value"; then
  10044. relink_command="$var=; export $var; $relink_command"
  10045. else
  10046. func_quote_arg pretty,unquoted "$var_value"
  10047. relink_command="$var=$func_quote_arg_unquoted_result; export $var; $relink_command"
  10048. fi
  10049. done
  10050. # Quote the link command for shipping.
  10051. relink_command="(cd `pwd`; $SHELL \"$progpath\" $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
  10052. func_quote_arg pretty,unquoted "$relink_command"
  10053. relink_command=$func_quote_arg_unquoted_result
  10054. if test yes = "$hardcode_automatic"; then
  10055. relink_command=
  10056. fi
  10057. # Only create the output if not a dry run.
  10058. $opt_dry_run || {
  10059. for installed in no yes; do
  10060. if test yes = "$installed"; then
  10061. if test -z "$install_libdir"; then
  10062. break
  10063. fi
  10064. output=$output_objdir/${outputname}i
  10065. # Replace all uninstalled libtool libraries with the installed ones
  10066. newdependency_libs=
  10067. for deplib in $dependency_libs; do
  10068. case $deplib in
  10069. *.la)
  10070. func_basename "$deplib"
  10071. name=$func_basename_result
  10072. func_resolve_sysroot "$deplib"
  10073. eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $func_resolve_sysroot_result`
  10074. test -z "$libdir" && \
  10075. func_fatal_error "'$deplib' is not a valid libtool archive"
  10076. func_append newdependency_libs " ${lt_sysroot:+=}$libdir/$name"
  10077. ;;
  10078. -L*)
  10079. func_stripname -L '' "$deplib"
  10080. func_replace_sysroot "$func_stripname_result"
  10081. func_append newdependency_libs " -L$func_replace_sysroot_result"
  10082. ;;
  10083. -R*)
  10084. func_stripname -R '' "$deplib"
  10085. func_replace_sysroot "$func_stripname_result"
  10086. func_append newdependency_libs " -R$func_replace_sysroot_result"
  10087. ;;
  10088. *) func_append newdependency_libs " $deplib" ;;
  10089. esac
  10090. done
  10091. dependency_libs=$newdependency_libs
  10092. newdlfiles=
  10093. for lib in $dlfiles; do
  10094. case $lib in
  10095. *.la)
  10096. func_basename "$lib"
  10097. name=$func_basename_result
  10098. eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
  10099. test -z "$libdir" && \
  10100. func_fatal_error "'$lib' is not a valid libtool archive"
  10101. func_append newdlfiles " ${lt_sysroot:+=}$libdir/$name"
  10102. ;;
  10103. *) func_append newdlfiles " $lib" ;;
  10104. esac
  10105. done
  10106. dlfiles=$newdlfiles
  10107. newdlprefiles=
  10108. for lib in $dlprefiles; do
  10109. case $lib in
  10110. *.la)
  10111. # Only pass preopened files to the pseudo-archive (for
  10112. # eventual linking with the app. that links it) if we
  10113. # didn't already link the preopened objects directly into
  10114. # the library:
  10115. func_basename "$lib"
  10116. name=$func_basename_result
  10117. eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
  10118. test -z "$libdir" && \
  10119. func_fatal_error "'$lib' is not a valid libtool archive"
  10120. func_append newdlprefiles " ${lt_sysroot:+=}$libdir/$name"
  10121. ;;
  10122. esac
  10123. done
  10124. dlprefiles=$newdlprefiles
  10125. else
  10126. newdlfiles=
  10127. for lib in $dlfiles; do
  10128. case $lib in
  10129. [\\/]* | [A-Za-z]:[\\/]*) abs=$lib ;;
  10130. *) abs=`pwd`"/$lib" ;;
  10131. esac
  10132. func_append newdlfiles " $abs"
  10133. done
  10134. dlfiles=$newdlfiles
  10135. newdlprefiles=
  10136. for lib in $dlprefiles; do
  10137. case $lib in
  10138. [\\/]* | [A-Za-z]:[\\/]*) abs=$lib ;;
  10139. *) abs=`pwd`"/$lib" ;;
  10140. esac
  10141. func_append newdlprefiles " $abs"
  10142. done
  10143. dlprefiles=$newdlprefiles
  10144. fi
  10145. $RM $output
  10146. # place dlname in correct position for cygwin
  10147. # In fact, it would be nice if we could use this code for all target
  10148. # systems that can't hard-code library paths into their executables
  10149. # and that have no shared library path variable independent of PATH,
  10150. # but it turns out we can't easily determine that from inspecting
  10151. # libtool variables, so we have to hard-code the OSs to which it
  10152. # applies here; at the moment, that means platforms that use the PE
  10153. # object format with DLL files. See the long comment at the top of
  10154. # tests/bindir.at for full details.
  10155. tdlname=$dlname
  10156. case $host,$output,$installed,$module,$dlname in
  10157. *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll)
  10158. # If a -bindir argument was supplied, place the dll there.
  10159. if test -n "$bindir"; then
  10160. func_relative_path "$install_libdir" "$bindir"
  10161. tdlname=$func_relative_path_result/$dlname
  10162. else
  10163. # Otherwise fall back on heuristic.
  10164. tdlname=../bin/$dlname
  10165. fi
  10166. ;;
  10167. esac
  10168. $ECHO > $output "\
  10169. # $outputname - a libtool library file
  10170. # Generated by $PROGRAM (GNU $PACKAGE) $VERSION
  10171. #
  10172. # Please DO NOT delete this file!
  10173. # It is necessary for linking the library.
  10174. # The name that we can dlopen(3).
  10175. dlname='$tdlname'
  10176. # Names of this library.
  10177. library_names='$library_names'
  10178. # The name of the static archive.
  10179. old_library='$old_library'
  10180. # Linker flags that cannot go in dependency_libs.
  10181. inherited_linker_flags='$new_inherited_linker_flags'
  10182. # Libraries that this one depends upon.
  10183. dependency_libs='$dependency_libs'
  10184. # Names of additional weak libraries provided by this library
  10185. weak_library_names='$weak_libs'
  10186. # Version information for $libname.
  10187. current=$current
  10188. age=$age
  10189. revision=$revision
  10190. # Is this an already installed library?
  10191. installed=$installed
  10192. # Should we warn about portability when linking against -modules?
  10193. shouldnotlink=$module
  10194. # Files to dlopen/dlpreopen
  10195. dlopen='$dlfiles'
  10196. dlpreopen='$dlprefiles'
  10197. # Directory that this library needs to be installed in:
  10198. libdir='$install_libdir'"
  10199. if test no,yes = "$installed,$need_relink"; then
  10200. $ECHO >> $output "\
  10201. relink_command=\"$relink_command\""
  10202. fi
  10203. done
  10204. }
  10205. # Do a symbolic link so that the libtool archive can be found in
  10206. # LD_LIBRARY_PATH before the program is installed.
  10207. func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?'
  10208. ;;
  10209. esac
  10210. exit $EXIT_SUCCESS
  10211. }
  10212. if test link = "$opt_mode" || test relink = "$opt_mode"; then
  10213. func_mode_link ${1+"$@"}
  10214. fi
  10215. # func_mode_uninstall arg...
  10216. func_mode_uninstall ()
  10217. {
  10218. $debug_cmd
  10219. RM=$nonopt
  10220. files=
  10221. rmforce=false
  10222. exit_status=0
  10223. # This variable tells wrapper scripts just to set variables rather
  10224. # than running their programs.
  10225. libtool_install_magic=$magic
  10226. for arg
  10227. do
  10228. case $arg in
  10229. -f) func_append RM " $arg"; rmforce=: ;;
  10230. -*) func_append RM " $arg" ;;
  10231. *) func_append files " $arg" ;;
  10232. esac
  10233. done
  10234. test -z "$RM" && \
  10235. func_fatal_help "you must specify an RM program"
  10236. rmdirs=
  10237. for file in $files; do
  10238. func_dirname "$file" "" "."
  10239. dir=$func_dirname_result
  10240. if test . = "$dir"; then
  10241. odir=$objdir
  10242. else
  10243. odir=$dir/$objdir
  10244. fi
  10245. func_basename "$file"
  10246. name=$func_basename_result
  10247. test uninstall = "$opt_mode" && odir=$dir
  10248. # Remember odir for removal later, being careful to avoid duplicates
  10249. if test clean = "$opt_mode"; then
  10250. case " $rmdirs " in
  10251. *" $odir "*) ;;
  10252. *) func_append rmdirs " $odir" ;;
  10253. esac
  10254. fi
  10255. # Don't error if the file doesn't exist and rm -f was used.
  10256. if { test -L "$file"; } >/dev/null 2>&1 ||
  10257. { test -h "$file"; } >/dev/null 2>&1 ||
  10258. test -f "$file"; then
  10259. :
  10260. elif test -d "$file"; then
  10261. exit_status=1
  10262. continue
  10263. elif $rmforce; then
  10264. continue
  10265. fi
  10266. rmfiles=$file
  10267. case $name in
  10268. *.la)
  10269. # Possibly a libtool archive, so verify it.
  10270. if func_lalib_p "$file"; then
  10271. func_source $dir/$name
  10272. # Delete the libtool libraries and symlinks.
  10273. for n in $library_names; do
  10274. func_append rmfiles " $odir/$n"
  10275. done
  10276. test -n "$old_library" && func_append rmfiles " $odir/$old_library"
  10277. case $opt_mode in
  10278. clean)
  10279. case " $library_names " in
  10280. *" $dlname "*) ;;
  10281. *) test -n "$dlname" && func_append rmfiles " $odir/$dlname" ;;
  10282. esac
  10283. test -n "$libdir" && func_append rmfiles " $odir/$name $odir/${name}i"
  10284. ;;
  10285. uninstall)
  10286. if test -n "$library_names"; then
  10287. # Do each command in the postuninstall commands.
  10288. func_execute_cmds "$postuninstall_cmds" '$rmforce || exit_status=1'
  10289. fi
  10290. if test -n "$old_library"; then
  10291. # Do each command in the old_postuninstall commands.
  10292. func_execute_cmds "$old_postuninstall_cmds" '$rmforce || exit_status=1'
  10293. fi
  10294. # FIXME: should reinstall the best remaining shared library.
  10295. ;;
  10296. esac
  10297. fi
  10298. ;;
  10299. *.lo)
  10300. # Possibly a libtool object, so verify it.
  10301. if func_lalib_p "$file"; then
  10302. # Read the .lo file
  10303. func_source $dir/$name
  10304. # Add PIC object to the list of files to remove.
  10305. if test -n "$pic_object" && test none != "$pic_object"; then
  10306. func_append rmfiles " $dir/$pic_object"
  10307. fi
  10308. # Add non-PIC object to the list of files to remove.
  10309. if test -n "$non_pic_object" && test none != "$non_pic_object"; then
  10310. func_append rmfiles " $dir/$non_pic_object"
  10311. fi
  10312. fi
  10313. ;;
  10314. *)
  10315. if test clean = "$opt_mode"; then
  10316. noexename=$name
  10317. case $file in
  10318. *.exe)
  10319. func_stripname '' '.exe' "$file"
  10320. file=$func_stripname_result
  10321. func_stripname '' '.exe' "$name"
  10322. noexename=$func_stripname_result
  10323. # $file with .exe has already been added to rmfiles,
  10324. # add $file without .exe
  10325. func_append rmfiles " $file"
  10326. ;;
  10327. esac
  10328. # Do a test to see if this is a libtool program.
  10329. if func_ltwrapper_p "$file"; then
  10330. if func_ltwrapper_executable_p "$file"; then
  10331. func_ltwrapper_scriptname "$file"
  10332. relink_command=
  10333. func_source $func_ltwrapper_scriptname_result
  10334. func_append rmfiles " $func_ltwrapper_scriptname_result"
  10335. else
  10336. relink_command=
  10337. func_source $dir/$noexename
  10338. fi
  10339. # note $name still contains .exe if it was in $file originally
  10340. # as does the version of $file that was added into $rmfiles
  10341. func_append rmfiles " $odir/$name $odir/${name}S.$objext"
  10342. if test yes = "$fast_install" && test -n "$relink_command"; then
  10343. func_append rmfiles " $odir/lt-$name"
  10344. fi
  10345. if test "X$noexename" != "X$name"; then
  10346. func_append rmfiles " $odir/lt-$noexename.c"
  10347. fi
  10348. fi
  10349. fi
  10350. ;;
  10351. esac
  10352. func_show_eval "$RM $rmfiles" 'exit_status=1'
  10353. done
  10354. # Try to remove the $objdir's in the directories where we deleted files
  10355. for dir in $rmdirs; do
  10356. if test -d "$dir"; then
  10357. func_show_eval "rmdir $dir >/dev/null 2>&1"
  10358. fi
  10359. done
  10360. exit $exit_status
  10361. }
  10362. if test uninstall = "$opt_mode" || test clean = "$opt_mode"; then
  10363. func_mode_uninstall ${1+"$@"}
  10364. fi
  10365. test -z "$opt_mode" && {
  10366. help=$generic_help
  10367. func_fatal_help "you must specify a MODE"
  10368. }
  10369. test -z "$exec_cmd" && \
  10370. func_fatal_help "invalid operation mode '$opt_mode'"
  10371. if test -n "$exec_cmd"; then
  10372. eval exec "$exec_cmd"
  10373. exit $EXIT_FAILURE
  10374. fi
  10375. exit $exit_status
  10376. # The TAGs below are defined such that we never get into a situation
  10377. # where we disable both kinds of libraries. Given conflicting
  10378. # choices, we go for a static library, that is the most portable,
  10379. # since we can't tell whether shared libraries were disabled because
  10380. # the user asked for that or because the platform doesn't support
  10381. # them. This is particularly important on AIX, because we don't
  10382. # support having both static and shared libraries enabled at the same
  10383. # time on that platform, so we default to a shared-only configuration.
  10384. # If a disable-shared tag is given, we'll fallback to a static-only
  10385. # configuration. But we'll never go from static-only to shared-only.
  10386. # ### BEGIN LIBTOOL TAG CONFIG: disable-shared
  10387. build_libtool_libs=no
  10388. build_old_libs=yes
  10389. # ### END LIBTOOL TAG CONFIG: disable-shared
  10390. # ### BEGIN LIBTOOL TAG CONFIG: disable-static
  10391. build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
  10392. # ### END LIBTOOL TAG CONFIG: disable-static
  10393. # Local Variables:
  10394. # mode:shell-script
  10395. # sh-indentation:2
  10396. # End: