libtool 340 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912
  1. #! /bin/bash
  2. # Generated automatically by config.status (lostirc) 0.4.7pre
  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='CXX '
  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. # Whether or not to build shared libraries.
  35. build_libtool_libs=yes
  36. # Whether or not to build static libraries.
  37. build_old_libs=yes
  38. # What type of objects to build.
  39. pic_mode=default
  40. # Whether or not to optimize for fast installation.
  41. fast_install=needless
  42. # Shared archive member basename,for filename based shared library versioning on AIX.
  43. shared_archive_member_spec=
  44. # Shell to use when invoking shell scripts.
  45. SHELL="/bin/bash"
  46. # An echo program that protects backslashes.
  47. ECHO="printf %s\\n"
  48. # The PATH separator for the build system.
  49. PATH_SEPARATOR=":"
  50. # The host system.
  51. host_alias=
  52. host=x86_64-pc-linux-gnu
  53. host_os=linux-gnu
  54. # The build system.
  55. build_alias=
  56. build=x86_64-pc-linux-gnu
  57. build_os=linux-gnu
  58. # A sed program that does not truncate output.
  59. SED="/bin/sed"
  60. # Sed that helps us avoid accidentally triggering echo(1) options like -n.
  61. Xsed="$SED -e 1s/^X//"
  62. # A grep program that handles long lines.
  63. GREP="/bin/grep"
  64. # An ERE matcher.
  65. EGREP="/bin/grep -E"
  66. # A literal string matcher.
  67. FGREP="/bin/grep -F"
  68. # A BSD- or MS-compatible name lister.
  69. NM="/usr/bin/nm -B"
  70. # Whether we need soft or hard links.
  71. LN_S="ln -s"
  72. # What is the maximum length of a command?
  73. max_cmd_len=1572864
  74. # Object file suffix (normally "o").
  75. objext=o
  76. # Executable file suffix (normally "").
  77. exeext=
  78. # whether the shell understands "unset".
  79. lt_unset=unset
  80. # turn spaces into newlines.
  81. SP2NL="tr \\040 \\012"
  82. # turn newlines into spaces.
  83. NL2SP="tr \\015\\012 \\040\\040"
  84. # convert $build file names to $host format.
  85. to_host_file_cmd=func_convert_file_noop
  86. # convert $build files to toolchain format.
  87. to_tool_file_cmd=func_convert_file_noop
  88. # An object symbol dumper.
  89. OBJDUMP="objdump"
  90. # Method to check whether dependent libraries are shared objects.
  91. deplibs_check_method="pass_all"
  92. # Command to use when deplibs_check_method = "file_magic".
  93. file_magic_cmd="\$MAGIC_CMD"
  94. # How to find potential files when deplibs_check_method = "file_magic".
  95. file_magic_glob=""
  96. # Find potential files using nocaseglob when deplibs_check_method = "file_magic".
  97. want_nocaseglob="no"
  98. # DLL creation program.
  99. DLLTOOL="false"
  100. # Command to associate shared and link libraries.
  101. sharedlib_from_linklib_cmd="printf %s\\n"
  102. # The archiver.
  103. AR="ar"
  104. # Flags to create an archive.
  105. AR_FLAGS="cr"
  106. # How to feed a file listing to the archiver.
  107. archiver_list_spec="@"
  108. # A symbol stripping program.
  109. STRIP="strip"
  110. # Commands used to install an old-style archive.
  111. RANLIB="ranlib"
  112. old_postinstall_cmds="chmod 644 \$oldlib~\$RANLIB \$tool_oldlib"
  113. old_postuninstall_cmds=""
  114. # Whether to use a lock for old archive extraction.
  115. lock_old_archive_extraction=no
  116. # A C compiler.
  117. LTCC="gcc"
  118. # LTCC compiler flags.
  119. LTCFLAGS="-g -O2"
  120. # Take the output of nm and produce a listing of raw symbols and C names.
  121. global_symbol_pipe="sed -n -e 's/^.*[ ]\\([ABCDGIRSTW][ABCDGIRSTW]*\\)[ ][ ]*\\([_A-Za-z][_A-Za-z0-9]*\\)\$/\\1 \\2 \\2/p' | sed '/ __gnu_lto/d'"
  122. # Transform the output of nm in a proper C declaration.
  123. global_symbol_to_cdecl="sed -n -e 's/^T .* \\(.*\\)\$/extern int \\1();/p' -e 's/^[ABCDGIRSTW][ABCDGIRSTW]* .* \\(.*\\)\$/extern char \\1;/p'"
  124. # Transform the output of nm into a list of symbols to manually relocate.
  125. global_symbol_to_import=""
  126. # Transform the output of nm in a C name address pair.
  127. global_symbol_to_c_name_address="sed -n -e 's/^: \\(.*\\) .*\$/ {\"\\1\", (void *) 0},/p' -e 's/^[ABCDGIRSTW][ABCDGIRSTW]* .* \\(.*\\)\$/ {\"\\1\", (void *) \\&\\1},/p'"
  128. # Transform the output of nm in a C name address pair when lib prefix is needed.
  129. 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'"
  130. # The name lister interface.
  131. nm_interface="BSD nm"
  132. # Specify filename containing input files for $NM.
  133. nm_file_list_spec="@"
  134. # The root where to search for dependent libraries,and where our libraries should be installed.
  135. lt_sysroot=
  136. # Command to truncate a binary pipe.
  137. lt_truncate_bin="/bin/dd bs=4096 count=1"
  138. # The name of the directory that contains temporary libtool files.
  139. objdir=.libs
  140. # Used to examine libraries when file_magic_cmd begins with "file".
  141. MAGIC_CMD=file
  142. # Must we lock files when doing compilation?
  143. need_locks="no"
  144. # Manifest tool.
  145. MANIFEST_TOOL=":"
  146. # Tool to manipulate archived DWARF debug symbol files on Mac OS X.
  147. DSYMUTIL=""
  148. # Tool to change global to local symbols on Mac OS X.
  149. NMEDIT=""
  150. # Tool to manipulate fat objects and archives on Mac OS X.
  151. LIPO=""
  152. # ldd/readelf like tool for Mach-O binaries on Mac OS X.
  153. OTOOL=""
  154. # ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4.
  155. OTOOL64=""
  156. # Old archive suffix (normally "a").
  157. libext=a
  158. # Shared library suffix (normally ".so").
  159. shrext_cmds=".so"
  160. # The commands to extract the exported symbol list from a shared archive.
  161. extract_expsyms_cmds=""
  162. # Variables whose values should be saved in libtool wrapper scripts and
  163. # restored at link time.
  164. variables_saved_for_relink="PATH LD_LIBRARY_PATH LD_RUN_PATH GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
  165. # Do we need the "lib" prefix for modules?
  166. need_lib_prefix=no
  167. # Do we need a version for libraries?
  168. need_version=no
  169. # Library versioning type.
  170. version_type=linux
  171. # Shared library runtime path variable.
  172. runpath_var=LD_RUN_PATH
  173. # Shared library path variable.
  174. shlibpath_var=LD_LIBRARY_PATH
  175. # Is shlibpath searched before the hard-coded library search path?
  176. shlibpath_overrides_runpath=yes
  177. # Format of library name prefix.
  178. libname_spec="lib\$name"
  179. # List of archive names. First name is the real one, the rest are links.
  180. # The last name is the one that the linker finds with -lNAME
  181. library_names_spec="\$libname\$release\$shared_ext\$versuffix \$libname\$release\$shared_ext\$major \$libname\$shared_ext"
  182. # The coded name of the library, if different from the real name.
  183. soname_spec="\$libname\$release\$shared_ext\$major"
  184. # Permission mode override for installation of shared libraries.
  185. install_override_mode=""
  186. # Command to use after installation of a shared archive.
  187. postinstall_cmds=""
  188. # Command to use after uninstallation of a shared archive.
  189. postuninstall_cmds=""
  190. # Commands used to finish a libtool library installation in a directory.
  191. finish_cmds="PATH=\\\"\\\$PATH:/sbin\\\" ldconfig -n \$libdir"
  192. # As "finish_cmds", except a single script fragment to be evaled but
  193. # not shown.
  194. finish_eval=""
  195. # Whether we should hardcode library paths into libraries.
  196. hardcode_into_libs=yes
  197. # Compile-time system search path for libraries.
  198. sys_lib_search_path_spec="/usr/lib/gcc/x86_64-linux-gnu/8 /usr/lib/x86_64-linux-gnu /usr/lib /lib/x86_64-linux-gnu /lib "
  199. # Detected run-time system search path for libraries.
  200. sys_lib_dlsearch_path_spec="/lib /usr/lib /usr/lib/x86_64-linux-gnu/libfakeroot /usr/local/lib /usr/local/lib/x86_64-linux-gnu /lib/x86_64-linux-gnu /usr/lib/x86_64-linux-gnu /lib32 /usr/lib32 /libx32 /usr/libx32 "
  201. # Explicit LT_SYS_LIBRARY_PATH set during ./configure time.
  202. configure_time_lt_sys_library_path=""
  203. # Whether dlopen is supported.
  204. dlopen_support=unknown
  205. # Whether dlopen of programs is supported.
  206. dlopen_self=unknown
  207. # Whether dlopen of statically linked programs is supported.
  208. dlopen_self_static=unknown
  209. # Commands to strip libraries.
  210. old_striplib="strip --strip-debug"
  211. striplib="strip --strip-unneeded"
  212. # The linker used to build libraries.
  213. LD="/usr/bin/ld -m elf_x86_64"
  214. # How to create reloadable object files.
  215. reload_flag=" -r"
  216. reload_cmds="\$LD\$reload_flag -o \$output\$reload_objs"
  217. # Commands used to build an old-style archive.
  218. old_archive_cmds="\$AR \$AR_FLAGS \$oldlib\$oldobjs~\$RANLIB \$tool_oldlib"
  219. # A language specific compiler.
  220. CC="gcc"
  221. # Is the compiler the GNU compiler?
  222. with_gcc=yes
  223. # Compiler flag to turn off builtin functions.
  224. no_builtin_flag=" -fno-builtin"
  225. # Additional compiler flags for building library objects.
  226. pic_flag=" -fPIC -DPIC"
  227. # How to pass a linker flag through the compiler.
  228. wl="-Wl,"
  229. # Compiler flag to prevent dynamic linking.
  230. link_static_flag="-static"
  231. # Does compiler simultaneously support -c and -o options?
  232. compiler_c_o="yes"
  233. # Whether or not to add -lc for building shared libraries.
  234. build_libtool_need_lc=no
  235. # Whether or not to disallow shared libs when runtime libs are static.
  236. allow_libtool_libs_with_static_runtimes=no
  237. # Compiler flag to allow reflexive dlopens.
  238. export_dynamic_flag_spec="\$wl--export-dynamic"
  239. # Compiler flag to generate shared objects directly from archives.
  240. whole_archive_flag_spec="\$wl--whole-archive\$convenience \$wl--no-whole-archive"
  241. # Whether the compiler copes with passing no objects directly.
  242. compiler_needs_object="no"
  243. # Create an old-style archive from a shared archive.
  244. old_archive_from_new_cmds=""
  245. # Create a temporary old-style archive to link instead of a shared archive.
  246. old_archive_from_expsyms_cmds=""
  247. # Commands used to build a shared archive.
  248. archive_cmds="\$CC -shared \$pic_flag \$libobjs \$deplibs \$compiler_flags \$wl-soname \$wl\$soname -o \$lib"
  249. archive_expsym_cmds="echo \\\"{ global:\\\" > \$output_objdir/\$libname.ver~
  250. cat \$export_symbols | sed -e \\\"s/\\\\(.*\\\\)/\\\\1;/\\\" >> \$output_objdir/\$libname.ver~
  251. echo \\\"local: *; };\\\" >> \$output_objdir/\$libname.ver~
  252. \$CC -shared \$pic_flag \$libobjs \$deplibs \$compiler_flags \$wl-soname \$wl\$soname \$wl-version-script \$wl\$output_objdir/\$libname.ver -o \$lib"
  253. # Commands used to build a loadable module if different from building
  254. # a shared archive.
  255. module_cmds=""
  256. module_expsym_cmds=""
  257. # Whether we are building with GNU ld or not.
  258. with_gnu_ld="yes"
  259. # Flag that allows shared libraries with undefined symbols to be built.
  260. allow_undefined_flag=""
  261. # Flag that enforces no undefined symbols.
  262. no_undefined_flag=""
  263. # Flag to hardcode $libdir into a binary during linking.
  264. # This must work even if $libdir does not exist
  265. hardcode_libdir_flag_spec="\${wl}-rpath \${wl}\$libdir"
  266. # Whether we need a single "-rpath" flag with a separated argument.
  267. hardcode_libdir_separator=""
  268. # Set to "yes" if using DIR/libNAME$shared_ext during linking hardcodes
  269. # DIR into the resulting binary.
  270. hardcode_direct=no
  271. # Set to "yes" if using DIR/libNAME$shared_ext during linking hardcodes
  272. # DIR into the resulting binary and the resulting library dependency is
  273. # "absolute",i.e impossible to change by setting $shlibpath_var if the
  274. # library is relocated.
  275. hardcode_direct_absolute=no
  276. # Set to "yes" if using the -LDIR flag during linking hardcodes DIR
  277. # into the resulting binary.
  278. hardcode_minus_L=no
  279. # Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR
  280. # into the resulting binary.
  281. hardcode_shlibpath_var=unsupported
  282. # Set to "yes" if building a shared library automatically hardcodes DIR
  283. # into the library and all subsequent libraries and executables linked
  284. # against it.
  285. hardcode_automatic=no
  286. # Set to yes if linker adds runtime paths of dependent libraries
  287. # to runtime path list.
  288. inherit_rpath=no
  289. # Whether libtool must link a program against all its dependency libraries.
  290. link_all_deplibs=no
  291. # Set to "yes" if exported symbols are required.
  292. always_export_symbols=no
  293. # The commands to list exported symbols.
  294. export_symbols_cmds="\$NM \$libobjs \$convenience | \$global_symbol_pipe | \$SED 's/.* //' | sort | uniq > \$export_symbols"
  295. # Symbols that should not be listed in the preloaded symbols.
  296. exclude_expsyms="_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*"
  297. # Symbols that must always be exported.
  298. include_expsyms=""
  299. # Commands necessary for linking programs (against libraries) with templates.
  300. prelink_cmds=""
  301. # Commands necessary for finishing linking programs.
  302. postlink_cmds=""
  303. # Specify filename containing input files.
  304. file_list_spec=""
  305. # How to hardcode a shared library path into an executable.
  306. hardcode_action=immediate
  307. # The directories searched by this compiler when creating a shared library.
  308. compiler_lib_search_dirs=""
  309. # Dependencies to place before and after the objects being linked to
  310. # create a shared library.
  311. predep_objects=""
  312. postdep_objects=""
  313. predeps=""
  314. postdeps=""
  315. # The library search path used internally by the compiler when linking
  316. # a shared library.
  317. compiler_lib_search_path=""
  318. # ### END LIBTOOL CONFIG
  319. # ### BEGIN FUNCTIONS SHARED WITH CONFIGURE
  320. # func_munge_path_list VARIABLE PATH
  321. # -----------------------------------
  322. # VARIABLE is name of variable containing _space_ separated list of
  323. # directories to be munged by the contents of PATH, which is string
  324. # having a format:
  325. # "DIR[:DIR]:"
  326. # string "DIR[ DIR]" will be prepended to VARIABLE
  327. # ":DIR[:DIR]"
  328. # string "DIR[ DIR]" will be appended to VARIABLE
  329. # "DIRP[:DIRP]::[DIRA:]DIRA"
  330. # string "DIRP[ DIRP]" will be prepended to VARIABLE and string
  331. # "DIRA[ DIRA]" will be appended to VARIABLE
  332. # "DIR[:DIR]"
  333. # VARIABLE will be replaced by "DIR[ DIR]"
  334. func_munge_path_list ()
  335. {
  336. case x$2 in
  337. x)
  338. ;;
  339. *:)
  340. eval $1=\"`$ECHO $2 | $SED 's/:/ /g'` \$$1\"
  341. ;;
  342. x:*)
  343. eval $1=\"\$$1 `$ECHO $2 | $SED 's/:/ /g'`\"
  344. ;;
  345. *::*)
  346. eval $1=\"\$$1\ `$ECHO $2 | $SED -e 's/.*:://' -e 's/:/ /g'`\"
  347. eval $1=\"`$ECHO $2 | $SED -e 's/::.*//' -e 's/:/ /g'`\ \$$1\"
  348. ;;
  349. *)
  350. eval $1=\"`$ECHO $2 | $SED 's/:/ /g'`\"
  351. ;;
  352. esac
  353. }
  354. # Calculate cc_basename. Skip known compiler wrappers and cross-prefix.
  355. func_cc_basename ()
  356. {
  357. for cc_temp in $*""; do
  358. case $cc_temp in
  359. compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
  360. distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
  361. \-*) ;;
  362. *) break;;
  363. esac
  364. done
  365. func_cc_basename_result=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"`
  366. }
  367. # ### END FUNCTIONS SHARED WITH CONFIGURE
  368. #! /bin/sh
  369. ## DO NOT EDIT - This file generated from ./build-aux/ltmain.in
  370. ## by inline-source v2014-01-03.01
  371. # libtool (GNU libtool) 2.4.6
  372. # Provide generalized library-building support services.
  373. # Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
  374. # Copyright (C) 1996-2015 Free Software Foundation, Inc.
  375. # This is free software; see the source for copying conditions. There is NO
  376. # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  377. # GNU Libtool is free software; you can redistribute it and/or modify
  378. # it under the terms of the GNU General Public License as published by
  379. # the Free Software Foundation; either version 2 of the License, or
  380. # (at your option) any later version.
  381. #
  382. # As a special exception to the GNU General Public License,
  383. # if you distribute this file as part of a program or library that
  384. # is built using GNU Libtool, you may include this file under the
  385. # same distribution terms that you use for the rest of that program.
  386. #
  387. # GNU Libtool is distributed in the hope that it will be useful, but
  388. # WITHOUT ANY WARRANTY; without even the implied warranty of
  389. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  390. # General Public License for more details.
  391. #
  392. # You should have received a copy of the GNU General Public License
  393. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  394. PROGRAM=libtool
  395. PACKAGE=libtool
  396. VERSION="2.4.6 Debian-2.4.6-14"
  397. package_revision=2.4.6
  398. ## ------ ##
  399. ## Usage. ##
  400. ## ------ ##
  401. # Run './libtool --help' for help with using this script from the
  402. # command line.
  403. ## ------------------------------- ##
  404. ## User overridable command paths. ##
  405. ## ------------------------------- ##
  406. # After configure completes, it has a better idea of some of the
  407. # shell tools we need than the defaults used by the functions shared
  408. # with bootstrap, so set those here where they can still be over-
  409. # ridden by the user, but otherwise take precedence.
  410. : ${AUTOCONF="autoconf"}
  411. : ${AUTOMAKE="automake"}
  412. ## -------------------------- ##
  413. ## Source external libraries. ##
  414. ## -------------------------- ##
  415. # Much of our low-level functionality needs to be sourced from external
  416. # libraries, which are installed to $pkgauxdir.
  417. # Set a version string for this script.
  418. scriptversion=2015-01-20.17; # UTC
  419. # General shell script boiler plate, and helper functions.
  420. # Written by Gary V. Vaughan, 2004
  421. # Copyright (C) 2004-2015 Free Software Foundation, Inc.
  422. # This is free software; see the source for copying conditions. There is NO
  423. # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  424. # This program is free software; you can redistribute it and/or modify
  425. # it under the terms of the GNU General Public License as published by
  426. # the Free Software Foundation; either version 3 of the License, or
  427. # (at your option) any later version.
  428. # As a special exception to the GNU General Public License, if you distribute
  429. # this file as part of a program or library that is built using GNU Libtool,
  430. # you may include this file under the same distribution terms that you use
  431. # for the rest of that program.
  432. # This program is distributed in the hope that it will be useful,
  433. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  434. # MERCHANTABILITY or FITNES FOR A PARTICULAR PURPOSE. See the GNU
  435. # General Public License for more details.
  436. # You should have received a copy of the GNU General Public License
  437. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  438. # Please report bugs or propose patches to gary@gnu.org.
  439. ## ------ ##
  440. ## Usage. ##
  441. ## ------ ##
  442. # Evaluate this file near the top of your script to gain access to
  443. # the functions and variables defined here:
  444. #
  445. # . `echo "$0" | ${SED-sed} 's|[^/]*$||'`/build-aux/funclib.sh
  446. #
  447. # If you need to override any of the default environment variable
  448. # settings, do that before evaluating this file.
  449. ## -------------------- ##
  450. ## Shell normalisation. ##
  451. ## -------------------- ##
  452. # Some shells need a little help to be as Bourne compatible as possible.
  453. # Before doing anything else, make sure all that help has been provided!
  454. DUALCASE=1; export DUALCASE # for MKS sh
  455. if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then :
  456. emulate sh
  457. NULLCMD=:
  458. # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
  459. # is contrary to our usage. Disable this feature.
  460. alias -g '${1+"$@"}'='"$@"'
  461. setopt NO_GLOB_SUBST
  462. else
  463. case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac
  464. fi
  465. # NLS nuisances: We save the old values in case they are required later.
  466. _G_user_locale=
  467. _G_safe_locale=
  468. for _G_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
  469. do
  470. eval "if test set = \"\${$_G_var+set}\"; then
  471. save_$_G_var=\$$_G_var
  472. $_G_var=C
  473. export $_G_var
  474. _G_user_locale=\"$_G_var=\\\$save_\$_G_var; \$_G_user_locale\"
  475. _G_safe_locale=\"$_G_var=C; \$_G_safe_locale\"
  476. fi"
  477. done
  478. # CDPATH.
  479. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
  480. # Make sure IFS has a sensible default
  481. sp=' '
  482. nl='
  483. '
  484. IFS="$sp $nl"
  485. # There are apparently some retarded systems that use ';' as a PATH separator!
  486. if test "${PATH_SEPARATOR+set}" != set; then
  487. PATH_SEPARATOR=:
  488. (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
  489. (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
  490. PATH_SEPARATOR=';'
  491. }
  492. fi
  493. ## ------------------------- ##
  494. ## Locate command utilities. ##
  495. ## ------------------------- ##
  496. # func_executable_p FILE
  497. # ----------------------
  498. # Check that FILE is an executable regular file.
  499. func_executable_p ()
  500. {
  501. test -f "$1" && test -x "$1"
  502. }
  503. # func_path_progs PROGS_LIST CHECK_FUNC [PATH]
  504. # --------------------------------------------
  505. # Search for either a program that responds to --version with output
  506. # containing "GNU", or else returned by CHECK_FUNC otherwise, by
  507. # trying all the directories in PATH with each of the elements of
  508. # PROGS_LIST.
  509. #
  510. # CHECK_FUNC should accept the path to a candidate program, and
  511. # set $func_check_prog_result if it truncates its output less than
  512. # $_G_path_prog_max characters.
  513. func_path_progs ()
  514. {
  515. _G_progs_list=$1
  516. _G_check_func=$2
  517. _G_PATH=${3-"$PATH"}
  518. _G_path_prog_max=0
  519. _G_path_prog_found=false
  520. _G_save_IFS=$IFS; IFS=${PATH_SEPARATOR-:}
  521. for _G_dir in $_G_PATH; do
  522. IFS=$_G_save_IFS
  523. test -z "$_G_dir" && _G_dir=.
  524. for _G_prog_name in $_G_progs_list; do
  525. for _exeext in '' .EXE; do
  526. _G_path_prog=$_G_dir/$_G_prog_name$_exeext
  527. func_executable_p "$_G_path_prog" || continue
  528. case `"$_G_path_prog" --version 2>&1` in
  529. *GNU*) func_path_progs_result=$_G_path_prog _G_path_prog_found=: ;;
  530. *) $_G_check_func $_G_path_prog
  531. func_path_progs_result=$func_check_prog_result
  532. ;;
  533. esac
  534. $_G_path_prog_found && break 3
  535. done
  536. done
  537. done
  538. IFS=$_G_save_IFS
  539. test -z "$func_path_progs_result" && {
  540. echo "no acceptable sed could be found in \$PATH" >&2
  541. exit 1
  542. }
  543. }
  544. # We want to be able to use the functions in this file before configure
  545. # has figured out where the best binaries are kept, which means we have
  546. # to search for them ourselves - except when the results are already set
  547. # where we skip the searches.
  548. # Unless the user overrides by setting SED, search the path for either GNU
  549. # sed, or the sed that truncates its output the least.
  550. test -z "$SED" && {
  551. _G_sed_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/
  552. for _G_i in 1 2 3 4 5 6 7; do
  553. _G_sed_script=$_G_sed_script$nl$_G_sed_script
  554. done
  555. echo "$_G_sed_script" 2>/dev/null | sed 99q >conftest.sed
  556. _G_sed_script=
  557. func_check_prog_sed ()
  558. {
  559. _G_path_prog=$1
  560. _G_count=0
  561. printf 0123456789 >conftest.in
  562. while :
  563. do
  564. cat conftest.in conftest.in >conftest.tmp
  565. mv conftest.tmp conftest.in
  566. cp conftest.in conftest.nl
  567. echo '' >> conftest.nl
  568. "$_G_path_prog" -f conftest.sed <conftest.nl >conftest.out 2>/dev/null || break
  569. diff conftest.out conftest.nl >/dev/null 2>&1 || break
  570. _G_count=`expr $_G_count + 1`
  571. if test "$_G_count" -gt "$_G_path_prog_max"; then
  572. # Best one so far, save it but keep looking for a better one
  573. func_check_prog_result=$_G_path_prog
  574. _G_path_prog_max=$_G_count
  575. fi
  576. # 10*(2^10) chars as input seems more than enough
  577. test 10 -lt "$_G_count" && break
  578. done
  579. rm -f conftest.in conftest.tmp conftest.nl conftest.out
  580. }
  581. func_path_progs "sed gsed" func_check_prog_sed $PATH:/usr/xpg4/bin
  582. rm -f conftest.sed
  583. SED=$func_path_progs_result
  584. }
  585. # Unless the user overrides by setting GREP, search the path for either GNU
  586. # grep, or the grep that truncates its output the least.
  587. test -z "$GREP" && {
  588. func_check_prog_grep ()
  589. {
  590. _G_path_prog=$1
  591. _G_count=0
  592. _G_path_prog_max=0
  593. printf 0123456789 >conftest.in
  594. while :
  595. do
  596. cat conftest.in conftest.in >conftest.tmp
  597. mv conftest.tmp conftest.in
  598. cp conftest.in conftest.nl
  599. echo 'GREP' >> conftest.nl
  600. "$_G_path_prog" -e 'GREP$' -e '-(cannot match)-' <conftest.nl >conftest.out 2>/dev/null || break
  601. diff conftest.out conftest.nl >/dev/null 2>&1 || break
  602. _G_count=`expr $_G_count + 1`
  603. if test "$_G_count" -gt "$_G_path_prog_max"; then
  604. # Best one so far, save it but keep looking for a better one
  605. func_check_prog_result=$_G_path_prog
  606. _G_path_prog_max=$_G_count
  607. fi
  608. # 10*(2^10) chars as input seems more than enough
  609. test 10 -lt "$_G_count" && break
  610. done
  611. rm -f conftest.in conftest.tmp conftest.nl conftest.out
  612. }
  613. func_path_progs "grep ggrep" func_check_prog_grep $PATH:/usr/xpg4/bin
  614. GREP=$func_path_progs_result
  615. }
  616. ## ------------------------------- ##
  617. ## User overridable command paths. ##
  618. ## ------------------------------- ##
  619. # All uppercase variable names are used for environment variables. These
  620. # variables can be overridden by the user before calling a script that
  621. # uses them if a suitable command of that name is not already available
  622. # in the command search PATH.
  623. : ${CP="cp -f"}
  624. : ${ECHO="printf %s\n"}
  625. : ${EGREP="$GREP -E"}
  626. : ${FGREP="$GREP -F"}
  627. : ${LN_S="ln -s"}
  628. : ${MAKE="make"}
  629. : ${MKDIR="mkdir"}
  630. : ${MV="mv -f"}
  631. : ${RM="rm -f"}
  632. : ${SHELL="${CONFIG_SHELL-/bin/sh}"}
  633. ## -------------------- ##
  634. ## Useful sed snippets. ##
  635. ## -------------------- ##
  636. sed_dirname='s|/[^/]*$||'
  637. sed_basename='s|^.*/||'
  638. # Sed substitution that helps us do robust quoting. It backslashifies
  639. # metacharacters that are still active within double-quoted strings.
  640. sed_quote_subst='s|\([`"$\\]\)|\\\1|g'
  641. # Same as above, but do not quote variable references.
  642. sed_double_quote_subst='s/\(["`\\]\)/\\\1/g'
  643. # Sed substitution that turns a string into a regex matching for the
  644. # string literally.
  645. sed_make_literal_regex='s|[].[^$\\*\/]|\\&|g'
  646. # Sed substitution that converts a w32 file name or path
  647. # that contains forward slashes, into one that contains
  648. # (escaped) backslashes. A very naive implementation.
  649. sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
  650. # Re-'\' parameter expansions in output of sed_double_quote_subst that
  651. # were '\'-ed in input to the same. If an odd number of '\' preceded a
  652. # '$' in input to sed_double_quote_subst, that '$' was protected from
  653. # expansion. Since each input '\' is now two '\'s, look for any number
  654. # of runs of four '\'s followed by two '\'s and then a '$'. '\' that '$'.
  655. _G_bs='\\'
  656. _G_bs2='\\\\'
  657. _G_bs4='\\\\\\\\'
  658. _G_dollar='\$'
  659. sed_double_backslash="\
  660. s/$_G_bs4/&\\
  661. /g
  662. s/^$_G_bs2$_G_dollar/$_G_bs&/
  663. s/\\([^$_G_bs]\\)$_G_bs2$_G_dollar/\\1$_G_bs2$_G_bs$_G_dollar/g
  664. s/\n//g"
  665. ## ----------------- ##
  666. ## Global variables. ##
  667. ## ----------------- ##
  668. # Except for the global variables explicitly listed below, the following
  669. # functions in the '^func_' namespace, and the '^require_' namespace
  670. # variables initialised in the 'Resource management' section, sourcing
  671. # this file will not pollute your global namespace with anything
  672. # else. There's no portable way to scope variables in Bourne shell
  673. # though, so actually running these functions will sometimes place
  674. # results into a variable named after the function, and often use
  675. # temporary variables in the '^_G_' namespace. If you are careful to
  676. # avoid using those namespaces casually in your sourcing script, things
  677. # should continue to work as you expect. And, of course, you can freely
  678. # overwrite any of the functions or variables defined here before
  679. # calling anything to customize them.
  680. EXIT_SUCCESS=0
  681. EXIT_FAILURE=1
  682. EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing.
  683. EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake.
  684. # Allow overriding, eg assuming that you follow the convention of
  685. # putting '$debug_cmd' at the start of all your functions, you can get
  686. # bash to show function call trace with:
  687. #
  688. # debug_cmd='echo "${FUNCNAME[0]} $*" >&2' bash your-script-name
  689. debug_cmd=${debug_cmd-":"}
  690. exit_cmd=:
  691. # By convention, finish your script with:
  692. #
  693. # exit $exit_status
  694. #
  695. # so that you can set exit_status to non-zero if you want to indicate
  696. # something went wrong during execution without actually bailing out at
  697. # the point of failure.
  698. exit_status=$EXIT_SUCCESS
  699. # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
  700. # is ksh but when the shell is invoked as "sh" and the current value of
  701. # the _XPG environment variable is not equal to 1 (one), the special
  702. # positional parameter $0, within a function call, is the name of the
  703. # function.
  704. progpath=$0
  705. # The name of this program.
  706. progname=`$ECHO "$progpath" |$SED "$sed_basename"`
  707. # Make sure we have an absolute progpath for reexecution:
  708. case $progpath in
  709. [\\/]*|[A-Za-z]:\\*) ;;
  710. *[\\/]*)
  711. progdir=`$ECHO "$progpath" |$SED "$sed_dirname"`
  712. progdir=`cd "$progdir" && pwd`
  713. progpath=$progdir/$progname
  714. ;;
  715. *)
  716. _G_IFS=$IFS
  717. IFS=${PATH_SEPARATOR-:}
  718. for progdir in $PATH; do
  719. IFS=$_G_IFS
  720. test -x "$progdir/$progname" && break
  721. done
  722. IFS=$_G_IFS
  723. test -n "$progdir" || progdir=`pwd`
  724. progpath=$progdir/$progname
  725. ;;
  726. esac
  727. ## ----------------- ##
  728. ## Standard options. ##
  729. ## ----------------- ##
  730. # The following options affect the operation of the functions defined
  731. # below, and should be set appropriately depending on run-time para-
  732. # meters passed on the command line.
  733. opt_dry_run=false
  734. opt_quiet=false
  735. opt_verbose=false
  736. # Categories 'all' and 'none' are always available. Append any others
  737. # you will pass as the first argument to func_warning from your own
  738. # code.
  739. warning_categories=
  740. # By default, display warnings according to 'opt_warning_types'. Set
  741. # 'warning_func' to ':' to elide all warnings, or func_fatal_error to
  742. # treat the next displayed warning as a fatal error.
  743. warning_func=func_warn_and_continue
  744. # Set to 'all' to display all warnings, 'none' to suppress all
  745. # warnings, or a space delimited list of some subset of
  746. # 'warning_categories' to display only the listed warnings.
  747. opt_warning_types=all
  748. ## -------------------- ##
  749. ## Resource management. ##
  750. ## -------------------- ##
  751. # This section contains definitions for functions that each ensure a
  752. # particular resource (a file, or a non-empty configuration variable for
  753. # example) is available, and if appropriate to extract default values
  754. # from pertinent package files. Call them using their associated
  755. # 'require_*' variable to ensure that they are executed, at most, once.
  756. #
  757. # It's entirely deliberate that calling these functions can set
  758. # variables that don't obey the namespace limitations obeyed by the rest
  759. # of this file, in order that that they be as useful as possible to
  760. # callers.
  761. # require_term_colors
  762. # -------------------
  763. # Allow display of bold text on terminals that support it.
  764. require_term_colors=func_require_term_colors
  765. func_require_term_colors ()
  766. {
  767. $debug_cmd
  768. test -t 1 && {
  769. # COLORTERM and USE_ANSI_COLORS environment variables take
  770. # precedence, because most terminfo databases neglect to describe
  771. # whether color sequences are supported.
  772. test -n "${COLORTERM+set}" && : ${USE_ANSI_COLORS="1"}
  773. if test 1 = "$USE_ANSI_COLORS"; then
  774. # Standard ANSI escape sequences
  775. tc_reset=''
  776. tc_bold=''; tc_standout=''
  777. tc_red=''; tc_green=''
  778. tc_blue=''; tc_cyan=''
  779. else
  780. # Otherwise trust the terminfo database after all.
  781. test -n "`tput sgr0 2>/dev/null`" && {
  782. tc_reset=`tput sgr0`
  783. test -n "`tput bold 2>/dev/null`" && tc_bold=`tput bold`
  784. tc_standout=$tc_bold
  785. test -n "`tput smso 2>/dev/null`" && tc_standout=`tput smso`
  786. test -n "`tput setaf 1 2>/dev/null`" && tc_red=`tput setaf 1`
  787. test -n "`tput setaf 2 2>/dev/null`" && tc_green=`tput setaf 2`
  788. test -n "`tput setaf 4 2>/dev/null`" && tc_blue=`tput setaf 4`
  789. test -n "`tput setaf 5 2>/dev/null`" && tc_cyan=`tput setaf 5`
  790. }
  791. fi
  792. }
  793. require_term_colors=:
  794. }
  795. ## ----------------- ##
  796. ## Function library. ##
  797. ## ----------------- ##
  798. # This section contains a variety of useful functions to call in your
  799. # scripts. Take note of the portable wrappers for features provided by
  800. # some modern shells, which will fall back to slower equivalents on
  801. # less featureful shells.
  802. # func_append VAR VALUE
  803. # ---------------------
  804. # Append VALUE onto the existing contents of VAR.
  805. # We should try to minimise forks, especially on Windows where they are
  806. # unreasonably slow, so skip the feature probes when bash or zsh are
  807. # being used:
  808. if test set = "${BASH_VERSION+set}${ZSH_VERSION+set}"; then
  809. : ${_G_HAVE_ARITH_OP="yes"}
  810. : ${_G_HAVE_XSI_OPS="yes"}
  811. # The += operator was introduced in bash 3.1
  812. case $BASH_VERSION in
  813. [12].* | 3.0 | 3.0*) ;;
  814. *)
  815. : ${_G_HAVE_PLUSEQ_OP="yes"}
  816. ;;
  817. esac
  818. fi
  819. # _G_HAVE_PLUSEQ_OP
  820. # Can be empty, in which case the shell is probed, "yes" if += is
  821. # useable or anything else if it does not work.
  822. test -z "$_G_HAVE_PLUSEQ_OP" \
  823. && (eval 'x=a; x+=" b"; test "a b" = "$x"') 2>/dev/null \
  824. && _G_HAVE_PLUSEQ_OP=yes
  825. if test yes = "$_G_HAVE_PLUSEQ_OP"
  826. then
  827. # This is an XSI compatible shell, allowing a faster implementation...
  828. eval 'func_append ()
  829. {
  830. $debug_cmd
  831. eval "$1+=\$2"
  832. }'
  833. else
  834. # ...otherwise fall back to using expr, which is often a shell builtin.
  835. func_append ()
  836. {
  837. $debug_cmd
  838. eval "$1=\$$1\$2"
  839. }
  840. fi
  841. # func_append_quoted VAR VALUE
  842. # ----------------------------
  843. # Quote VALUE and append to the end of shell variable VAR, separated
  844. # by a space.
  845. if test yes = "$_G_HAVE_PLUSEQ_OP"; then
  846. eval 'func_append_quoted ()
  847. {
  848. $debug_cmd
  849. func_quote_for_eval "$2"
  850. eval "$1+=\\ \$func_quote_for_eval_result"
  851. }'
  852. else
  853. func_append_quoted ()
  854. {
  855. $debug_cmd
  856. func_quote_for_eval "$2"
  857. eval "$1=\$$1\\ \$func_quote_for_eval_result"
  858. }
  859. fi
  860. # func_append_uniq VAR VALUE
  861. # --------------------------
  862. # Append unique VALUE onto the existing contents of VAR, assuming
  863. # entries are delimited by the first character of VALUE. For example:
  864. #
  865. # func_append_uniq options " --another-option option-argument"
  866. #
  867. # will only append to $options if " --another-option option-argument "
  868. # is not already present somewhere in $options already (note spaces at
  869. # each end implied by leading space in second argument).
  870. func_append_uniq ()
  871. {
  872. $debug_cmd
  873. eval _G_current_value='`$ECHO $'$1'`'
  874. _G_delim=`expr "$2" : '\(.\)'`
  875. case $_G_delim$_G_current_value$_G_delim in
  876. *"$2$_G_delim"*) ;;
  877. *) func_append "$@" ;;
  878. esac
  879. }
  880. # func_arith TERM...
  881. # ------------------
  882. # Set func_arith_result to the result of evaluating TERMs.
  883. test -z "$_G_HAVE_ARITH_OP" \
  884. && (eval 'test 2 = $(( 1 + 1 ))') 2>/dev/null \
  885. && _G_HAVE_ARITH_OP=yes
  886. if test yes = "$_G_HAVE_ARITH_OP"; then
  887. eval 'func_arith ()
  888. {
  889. $debug_cmd
  890. func_arith_result=$(( $* ))
  891. }'
  892. else
  893. func_arith ()
  894. {
  895. $debug_cmd
  896. func_arith_result=`expr "$@"`
  897. }
  898. fi
  899. # func_basename FILE
  900. # ------------------
  901. # Set func_basename_result to FILE with everything up to and including
  902. # the last / stripped.
  903. if test yes = "$_G_HAVE_XSI_OPS"; then
  904. # If this shell supports suffix pattern removal, then use it to avoid
  905. # forking. Hide the definitions single quotes in case the shell chokes
  906. # on unsupported syntax...
  907. _b='func_basename_result=${1##*/}'
  908. _d='case $1 in
  909. */*) func_dirname_result=${1%/*}$2 ;;
  910. * ) func_dirname_result=$3 ;;
  911. esac'
  912. else
  913. # ...otherwise fall back to using sed.
  914. _b='func_basename_result=`$ECHO "$1" |$SED "$sed_basename"`'
  915. _d='func_dirname_result=`$ECHO "$1" |$SED "$sed_dirname"`
  916. if test "X$func_dirname_result" = "X$1"; then
  917. func_dirname_result=$3
  918. else
  919. func_append func_dirname_result "$2"
  920. fi'
  921. fi
  922. eval 'func_basename ()
  923. {
  924. $debug_cmd
  925. '"$_b"'
  926. }'
  927. # func_dirname FILE APPEND NONDIR_REPLACEMENT
  928. # -------------------------------------------
  929. # Compute the dirname of FILE. If nonempty, add APPEND to the result,
  930. # otherwise set result to NONDIR_REPLACEMENT.
  931. eval 'func_dirname ()
  932. {
  933. $debug_cmd
  934. '"$_d"'
  935. }'
  936. # func_dirname_and_basename FILE APPEND NONDIR_REPLACEMENT
  937. # --------------------------------------------------------
  938. # Perform func_basename and func_dirname in a single function
  939. # call:
  940. # dirname: Compute the dirname of FILE. If nonempty,
  941. # add APPEND to the result, otherwise set result
  942. # to NONDIR_REPLACEMENT.
  943. # value returned in "$func_dirname_result"
  944. # basename: Compute filename of FILE.
  945. # value retuned in "$func_basename_result"
  946. # For efficiency, we do not delegate to the functions above but instead
  947. # duplicate the functionality here.
  948. eval 'func_dirname_and_basename ()
  949. {
  950. $debug_cmd
  951. '"$_b"'
  952. '"$_d"'
  953. }'
  954. # func_echo ARG...
  955. # ----------------
  956. # Echo program name prefixed message.
  957. func_echo ()
  958. {
  959. $debug_cmd
  960. _G_message=$*
  961. func_echo_IFS=$IFS
  962. IFS=$nl
  963. for _G_line in $_G_message; do
  964. IFS=$func_echo_IFS
  965. $ECHO "$progname: $_G_line"
  966. done
  967. IFS=$func_echo_IFS
  968. }
  969. # func_echo_all ARG...
  970. # --------------------
  971. # Invoke $ECHO with all args, space-separated.
  972. func_echo_all ()
  973. {
  974. $ECHO "$*"
  975. }
  976. # func_echo_infix_1 INFIX ARG...
  977. # ------------------------------
  978. # Echo program name, followed by INFIX on the first line, with any
  979. # additional lines not showing INFIX.
  980. func_echo_infix_1 ()
  981. {
  982. $debug_cmd
  983. $require_term_colors
  984. _G_infix=$1; shift
  985. _G_indent=$_G_infix
  986. _G_prefix="$progname: $_G_infix: "
  987. _G_message=$*
  988. # Strip color escape sequences before counting printable length
  989. for _G_tc in "$tc_reset" "$tc_bold" "$tc_standout" "$tc_red" "$tc_green" "$tc_blue" "$tc_cyan"
  990. do
  991. test -n "$_G_tc" && {
  992. _G_esc_tc=`$ECHO "$_G_tc" | $SED "$sed_make_literal_regex"`
  993. _G_indent=`$ECHO "$_G_indent" | $SED "s|$_G_esc_tc||g"`
  994. }
  995. done
  996. _G_indent="$progname: "`echo "$_G_indent" | $SED 's|.| |g'`" " ## exclude from sc_prohibit_nested_quotes
  997. func_echo_infix_1_IFS=$IFS
  998. IFS=$nl
  999. for _G_line in $_G_message; do
  1000. IFS=$func_echo_infix_1_IFS
  1001. $ECHO "$_G_prefix$tc_bold$_G_line$tc_reset" >&2
  1002. _G_prefix=$_G_indent
  1003. done
  1004. IFS=$func_echo_infix_1_IFS
  1005. }
  1006. # func_error ARG...
  1007. # -----------------
  1008. # Echo program name prefixed message to standard error.
  1009. func_error ()
  1010. {
  1011. $debug_cmd
  1012. $require_term_colors
  1013. func_echo_infix_1 " $tc_standout${tc_red}error$tc_reset" "$*" >&2
  1014. }
  1015. # func_fatal_error ARG...
  1016. # -----------------------
  1017. # Echo program name prefixed message to standard error, and exit.
  1018. func_fatal_error ()
  1019. {
  1020. $debug_cmd
  1021. func_error "$*"
  1022. exit $EXIT_FAILURE
  1023. }
  1024. # func_grep EXPRESSION FILENAME
  1025. # -----------------------------
  1026. # Check whether EXPRESSION matches any line of FILENAME, without output.
  1027. func_grep ()
  1028. {
  1029. $debug_cmd
  1030. $GREP "$1" "$2" >/dev/null 2>&1
  1031. }
  1032. # func_len STRING
  1033. # ---------------
  1034. # Set func_len_result to the length of STRING. STRING may not
  1035. # start with a hyphen.
  1036. test -z "$_G_HAVE_XSI_OPS" \
  1037. && (eval 'x=a/b/c;
  1038. test 5aa/bb/cc = "${#x}${x%%/*}${x%/*}${x#*/}${x##*/}"') 2>/dev/null \
  1039. && _G_HAVE_XSI_OPS=yes
  1040. if test yes = "$_G_HAVE_XSI_OPS"; then
  1041. eval 'func_len ()
  1042. {
  1043. $debug_cmd
  1044. func_len_result=${#1}
  1045. }'
  1046. else
  1047. func_len ()
  1048. {
  1049. $debug_cmd
  1050. func_len_result=`expr "$1" : ".*" 2>/dev/null || echo $max_cmd_len`
  1051. }
  1052. fi
  1053. # func_mkdir_p DIRECTORY-PATH
  1054. # ---------------------------
  1055. # Make sure the entire path to DIRECTORY-PATH is available.
  1056. func_mkdir_p ()
  1057. {
  1058. $debug_cmd
  1059. _G_directory_path=$1
  1060. _G_dir_list=
  1061. if test -n "$_G_directory_path" && test : != "$opt_dry_run"; then
  1062. # Protect directory names starting with '-'
  1063. case $_G_directory_path in
  1064. -*) _G_directory_path=./$_G_directory_path ;;
  1065. esac
  1066. # While some portion of DIR does not yet exist...
  1067. while test ! -d "$_G_directory_path"; do
  1068. # ...make a list in topmost first order. Use a colon delimited
  1069. # list incase some portion of path contains whitespace.
  1070. _G_dir_list=$_G_directory_path:$_G_dir_list
  1071. # If the last portion added has no slash in it, the list is done
  1072. case $_G_directory_path in */*) ;; *) break ;; esac
  1073. # ...otherwise throw away the child directory and loop
  1074. _G_directory_path=`$ECHO "$_G_directory_path" | $SED -e "$sed_dirname"`
  1075. done
  1076. _G_dir_list=`$ECHO "$_G_dir_list" | $SED 's|:*$||'`
  1077. func_mkdir_p_IFS=$IFS; IFS=:
  1078. for _G_dir in $_G_dir_list; do
  1079. IFS=$func_mkdir_p_IFS
  1080. # mkdir can fail with a 'File exist' error if two processes
  1081. # try to create one of the directories concurrently. Don't
  1082. # stop in that case!
  1083. $MKDIR "$_G_dir" 2>/dev/null || :
  1084. done
  1085. IFS=$func_mkdir_p_IFS
  1086. # Bail out if we (or some other process) failed to create a directory.
  1087. test -d "$_G_directory_path" || \
  1088. func_fatal_error "Failed to create '$1'"
  1089. fi
  1090. }
  1091. # func_mktempdir [BASENAME]
  1092. # -------------------------
  1093. # Make a temporary directory that won't clash with other running
  1094. # libtool processes, and avoids race conditions if possible. If
  1095. # given, BASENAME is the basename for that directory.
  1096. func_mktempdir ()
  1097. {
  1098. $debug_cmd
  1099. _G_template=${TMPDIR-/tmp}/${1-$progname}
  1100. if test : = "$opt_dry_run"; then
  1101. # Return a directory name, but don't create it in dry-run mode
  1102. _G_tmpdir=$_G_template-$$
  1103. else
  1104. # If mktemp works, use that first and foremost
  1105. _G_tmpdir=`mktemp -d "$_G_template-XXXXXXXX" 2>/dev/null`
  1106. if test ! -d "$_G_tmpdir"; then
  1107. # Failing that, at least try and use $RANDOM to avoid a race
  1108. _G_tmpdir=$_G_template-${RANDOM-0}$$
  1109. func_mktempdir_umask=`umask`
  1110. umask 0077
  1111. $MKDIR "$_G_tmpdir"
  1112. umask $func_mktempdir_umask
  1113. fi
  1114. # If we're not in dry-run mode, bomb out on failure
  1115. test -d "$_G_tmpdir" || \
  1116. func_fatal_error "cannot create temporary directory '$_G_tmpdir'"
  1117. fi
  1118. $ECHO "$_G_tmpdir"
  1119. }
  1120. # func_normal_abspath PATH
  1121. # ------------------------
  1122. # Remove doubled-up and trailing slashes, "." path components,
  1123. # and cancel out any ".." path components in PATH after making
  1124. # it an absolute path.
  1125. func_normal_abspath ()
  1126. {
  1127. $debug_cmd
  1128. # These SED scripts presuppose an absolute path with a trailing slash.
  1129. _G_pathcar='s|^/\([^/]*\).*$|\1|'
  1130. _G_pathcdr='s|^/[^/]*||'
  1131. _G_removedotparts=':dotsl
  1132. s|/\./|/|g
  1133. t dotsl
  1134. s|/\.$|/|'
  1135. _G_collapseslashes='s|/\{1,\}|/|g'
  1136. _G_finalslash='s|/*$|/|'
  1137. # Start from root dir and reassemble the path.
  1138. func_normal_abspath_result=
  1139. func_normal_abspath_tpath=$1
  1140. func_normal_abspath_altnamespace=
  1141. case $func_normal_abspath_tpath in
  1142. "")
  1143. # Empty path, that just means $cwd.
  1144. func_stripname '' '/' "`pwd`"
  1145. func_normal_abspath_result=$func_stripname_result
  1146. return
  1147. ;;
  1148. # The next three entries are used to spot a run of precisely
  1149. # two leading slashes without using negated character classes;
  1150. # we take advantage of case's first-match behaviour.
  1151. ///*)
  1152. # Unusual form of absolute path, do nothing.
  1153. ;;
  1154. //*)
  1155. # Not necessarily an ordinary path; POSIX reserves leading '//'
  1156. # and for example Cygwin uses it to access remote file shares
  1157. # over CIFS/SMB, so we conserve a leading double slash if found.
  1158. func_normal_abspath_altnamespace=/
  1159. ;;
  1160. /*)
  1161. # Absolute path, do nothing.
  1162. ;;
  1163. *)
  1164. # Relative path, prepend $cwd.
  1165. func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath
  1166. ;;
  1167. esac
  1168. # Cancel out all the simple stuff to save iterations. We also want
  1169. # the path to end with a slash for ease of parsing, so make sure
  1170. # there is one (and only one) here.
  1171. func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
  1172. -e "$_G_removedotparts" -e "$_G_collapseslashes" -e "$_G_finalslash"`
  1173. while :; do
  1174. # Processed it all yet?
  1175. if test / = "$func_normal_abspath_tpath"; then
  1176. # If we ascended to the root using ".." the result may be empty now.
  1177. if test -z "$func_normal_abspath_result"; then
  1178. func_normal_abspath_result=/
  1179. fi
  1180. break
  1181. fi
  1182. func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \
  1183. -e "$_G_pathcar"`
  1184. func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
  1185. -e "$_G_pathcdr"`
  1186. # Figure out what to do with it
  1187. case $func_normal_abspath_tcomponent in
  1188. "")
  1189. # Trailing empty path component, ignore it.
  1190. ;;
  1191. ..)
  1192. # Parent dir; strip last assembled component from result.
  1193. func_dirname "$func_normal_abspath_result"
  1194. func_normal_abspath_result=$func_dirname_result
  1195. ;;
  1196. *)
  1197. # Actual path component, append it.
  1198. func_append func_normal_abspath_result "/$func_normal_abspath_tcomponent"
  1199. ;;
  1200. esac
  1201. done
  1202. # Restore leading double-slash if one was found on entry.
  1203. func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result
  1204. }
  1205. # func_notquiet ARG...
  1206. # --------------------
  1207. # Echo program name prefixed message only when not in quiet mode.
  1208. func_notquiet ()
  1209. {
  1210. $debug_cmd
  1211. $opt_quiet || func_echo ${1+"$@"}
  1212. # A bug in bash halts the script if the last line of a function
  1213. # fails when set -e is in force, so we need another command to
  1214. # work around that:
  1215. :
  1216. }
  1217. # func_relative_path SRCDIR DSTDIR
  1218. # --------------------------------
  1219. # Set func_relative_path_result to the relative path from SRCDIR to DSTDIR.
  1220. func_relative_path ()
  1221. {
  1222. $debug_cmd
  1223. func_relative_path_result=
  1224. func_normal_abspath "$1"
  1225. func_relative_path_tlibdir=$func_normal_abspath_result
  1226. func_normal_abspath "$2"
  1227. func_relative_path_tbindir=$func_normal_abspath_result
  1228. # Ascend the tree starting from libdir
  1229. while :; do
  1230. # check if we have found a prefix of bindir
  1231. case $func_relative_path_tbindir in
  1232. $func_relative_path_tlibdir)
  1233. # found an exact match
  1234. func_relative_path_tcancelled=
  1235. break
  1236. ;;
  1237. $func_relative_path_tlibdir*)
  1238. # found a matching prefix
  1239. func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir"
  1240. func_relative_path_tcancelled=$func_stripname_result
  1241. if test -z "$func_relative_path_result"; then
  1242. func_relative_path_result=.
  1243. fi
  1244. break
  1245. ;;
  1246. *)
  1247. func_dirname $func_relative_path_tlibdir
  1248. func_relative_path_tlibdir=$func_dirname_result
  1249. if test -z "$func_relative_path_tlibdir"; then
  1250. # Have to descend all the way to the root!
  1251. func_relative_path_result=../$func_relative_path_result
  1252. func_relative_path_tcancelled=$func_relative_path_tbindir
  1253. break
  1254. fi
  1255. func_relative_path_result=../$func_relative_path_result
  1256. ;;
  1257. esac
  1258. done
  1259. # Now calculate path; take care to avoid doubling-up slashes.
  1260. func_stripname '' '/' "$func_relative_path_result"
  1261. func_relative_path_result=$func_stripname_result
  1262. func_stripname '/' '/' "$func_relative_path_tcancelled"
  1263. if test -n "$func_stripname_result"; then
  1264. func_append func_relative_path_result "/$func_stripname_result"
  1265. fi
  1266. # Normalisation. If bindir is libdir, return '.' else relative path.
  1267. if test -n "$func_relative_path_result"; then
  1268. func_stripname './' '' "$func_relative_path_result"
  1269. func_relative_path_result=$func_stripname_result
  1270. fi
  1271. test -n "$func_relative_path_result" || func_relative_path_result=.
  1272. :
  1273. }
  1274. # func_quote_for_eval ARG...
  1275. # --------------------------
  1276. # Aesthetically quote ARGs to be evaled later.
  1277. # This function returns two values:
  1278. # i) func_quote_for_eval_result
  1279. # double-quoted, suitable for a subsequent eval
  1280. # ii) func_quote_for_eval_unquoted_result
  1281. # has all characters that are still active within double
  1282. # quotes backslashified.
  1283. func_quote_for_eval ()
  1284. {
  1285. $debug_cmd
  1286. func_quote_for_eval_unquoted_result=
  1287. func_quote_for_eval_result=
  1288. while test 0 -lt $#; do
  1289. case $1 in
  1290. *[\\\`\"\$]*)
  1291. _G_unquoted_arg=`printf '%s\n' "$1" |$SED "$sed_quote_subst"` ;;
  1292. *)
  1293. _G_unquoted_arg=$1 ;;
  1294. esac
  1295. if test -n "$func_quote_for_eval_unquoted_result"; then
  1296. func_append func_quote_for_eval_unquoted_result " $_G_unquoted_arg"
  1297. else
  1298. func_append func_quote_for_eval_unquoted_result "$_G_unquoted_arg"
  1299. fi
  1300. case $_G_unquoted_arg in
  1301. # Double-quote args containing shell metacharacters to delay
  1302. # word splitting, command substitution and variable expansion
  1303. # for a subsequent eval.
  1304. # Many Bourne shells cannot handle close brackets correctly
  1305. # in scan sets, so we specify it separately.
  1306. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
  1307. _G_quoted_arg=\"$_G_unquoted_arg\"
  1308. ;;
  1309. *)
  1310. _G_quoted_arg=$_G_unquoted_arg
  1311. ;;
  1312. esac
  1313. if test -n "$func_quote_for_eval_result"; then
  1314. func_append func_quote_for_eval_result " $_G_quoted_arg"
  1315. else
  1316. func_append func_quote_for_eval_result "$_G_quoted_arg"
  1317. fi
  1318. shift
  1319. done
  1320. }
  1321. # func_quote_for_expand ARG
  1322. # -------------------------
  1323. # Aesthetically quote ARG to be evaled later; same as above,
  1324. # but do not quote variable references.
  1325. func_quote_for_expand ()
  1326. {
  1327. $debug_cmd
  1328. case $1 in
  1329. *[\\\`\"]*)
  1330. _G_arg=`$ECHO "$1" | $SED \
  1331. -e "$sed_double_quote_subst" -e "$sed_double_backslash"` ;;
  1332. *)
  1333. _G_arg=$1 ;;
  1334. esac
  1335. case $_G_arg in
  1336. # Double-quote args containing shell metacharacters to delay
  1337. # word splitting and command substitution for a subsequent eval.
  1338. # Many Bourne shells cannot handle close brackets correctly
  1339. # in scan sets, so we specify it separately.
  1340. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
  1341. _G_arg=\"$_G_arg\"
  1342. ;;
  1343. esac
  1344. func_quote_for_expand_result=$_G_arg
  1345. }
  1346. # func_stripname PREFIX SUFFIX NAME
  1347. # ---------------------------------
  1348. # strip PREFIX and SUFFIX from NAME, and store in func_stripname_result.
  1349. # PREFIX and SUFFIX must not contain globbing or regex special
  1350. # characters, hashes, percent signs, but SUFFIX may contain a leading
  1351. # dot (in which case that matches only a dot).
  1352. if test yes = "$_G_HAVE_XSI_OPS"; then
  1353. eval 'func_stripname ()
  1354. {
  1355. $debug_cmd
  1356. # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are
  1357. # positional parameters, so assign one to ordinary variable first.
  1358. func_stripname_result=$3
  1359. func_stripname_result=${func_stripname_result#"$1"}
  1360. func_stripname_result=${func_stripname_result%"$2"}
  1361. }'
  1362. else
  1363. func_stripname ()
  1364. {
  1365. $debug_cmd
  1366. case $2 in
  1367. .*) func_stripname_result=`$ECHO "$3" | $SED -e "s%^$1%%" -e "s%\\\\$2\$%%"`;;
  1368. *) func_stripname_result=`$ECHO "$3" | $SED -e "s%^$1%%" -e "s%$2\$%%"`;;
  1369. esac
  1370. }
  1371. fi
  1372. # func_show_eval CMD [FAIL_EXP]
  1373. # -----------------------------
  1374. # Unless opt_quiet is true, then output CMD. Then, if opt_dryrun is
  1375. # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
  1376. # is given, then evaluate it.
  1377. func_show_eval ()
  1378. {
  1379. $debug_cmd
  1380. _G_cmd=$1
  1381. _G_fail_exp=${2-':'}
  1382. func_quote_for_expand "$_G_cmd"
  1383. eval "func_notquiet $func_quote_for_expand_result"
  1384. $opt_dry_run || {
  1385. eval "$_G_cmd"
  1386. _G_status=$?
  1387. if test 0 -ne "$_G_status"; then
  1388. eval "(exit $_G_status); $_G_fail_exp"
  1389. fi
  1390. }
  1391. }
  1392. # func_show_eval_locale CMD [FAIL_EXP]
  1393. # ------------------------------------
  1394. # Unless opt_quiet is true, then output CMD. Then, if opt_dryrun is
  1395. # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
  1396. # is given, then evaluate it. Use the saved locale for evaluation.
  1397. func_show_eval_locale ()
  1398. {
  1399. $debug_cmd
  1400. _G_cmd=$1
  1401. _G_fail_exp=${2-':'}
  1402. $opt_quiet || {
  1403. func_quote_for_expand "$_G_cmd"
  1404. eval "func_echo $func_quote_for_expand_result"
  1405. }
  1406. $opt_dry_run || {
  1407. eval "$_G_user_locale
  1408. $_G_cmd"
  1409. _G_status=$?
  1410. eval "$_G_safe_locale"
  1411. if test 0 -ne "$_G_status"; then
  1412. eval "(exit $_G_status); $_G_fail_exp"
  1413. fi
  1414. }
  1415. }
  1416. # func_tr_sh
  1417. # ----------
  1418. # Turn $1 into a string suitable for a shell variable name.
  1419. # Result is stored in $func_tr_sh_result. All characters
  1420. # not in the set a-zA-Z0-9_ are replaced with '_'. Further,
  1421. # if $1 begins with a digit, a '_' is prepended as well.
  1422. func_tr_sh ()
  1423. {
  1424. $debug_cmd
  1425. case $1 in
  1426. [0-9]* | *[!a-zA-Z0-9_]*)
  1427. func_tr_sh_result=`$ECHO "$1" | $SED -e 's/^\([0-9]\)/_\1/' -e 's/[^a-zA-Z0-9_]/_/g'`
  1428. ;;
  1429. * )
  1430. func_tr_sh_result=$1
  1431. ;;
  1432. esac
  1433. }
  1434. # func_verbose ARG...
  1435. # -------------------
  1436. # Echo program name prefixed message in verbose mode only.
  1437. func_verbose ()
  1438. {
  1439. $debug_cmd
  1440. $opt_verbose && func_echo "$*"
  1441. :
  1442. }
  1443. # func_warn_and_continue ARG...
  1444. # -----------------------------
  1445. # Echo program name prefixed warning message to standard error.
  1446. func_warn_and_continue ()
  1447. {
  1448. $debug_cmd
  1449. $require_term_colors
  1450. func_echo_infix_1 "${tc_red}warning$tc_reset" "$*" >&2
  1451. }
  1452. # func_warning CATEGORY ARG...
  1453. # ----------------------------
  1454. # Echo program name prefixed warning message to standard error. Warning
  1455. # messages can be filtered according to CATEGORY, where this function
  1456. # elides messages where CATEGORY is not listed in the global variable
  1457. # 'opt_warning_types'.
  1458. func_warning ()
  1459. {
  1460. $debug_cmd
  1461. # CATEGORY must be in the warning_categories list!
  1462. case " $warning_categories " in
  1463. *" $1 "*) ;;
  1464. *) func_internal_error "invalid warning category '$1'" ;;
  1465. esac
  1466. _G_category=$1
  1467. shift
  1468. case " $opt_warning_types " in
  1469. *" $_G_category "*) $warning_func ${1+"$@"} ;;
  1470. esac
  1471. }
  1472. # func_sort_ver VER1 VER2
  1473. # -----------------------
  1474. # 'sort -V' is not generally available.
  1475. # Note this deviates from the version comparison in automake
  1476. # in that it treats 1.5 < 1.5.0, and treats 1.4.4a < 1.4-p3a
  1477. # but this should suffice as we won't be specifying old
  1478. # version formats or redundant trailing .0 in bootstrap.conf.
  1479. # If we did want full compatibility then we should probably
  1480. # use m4_version_compare from autoconf.
  1481. func_sort_ver ()
  1482. {
  1483. $debug_cmd
  1484. printf '%s\n%s\n' "$1" "$2" \
  1485. | 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
  1486. }
  1487. # func_lt_ver PREV CURR
  1488. # ---------------------
  1489. # Return true if PREV and CURR are in the correct order according to
  1490. # func_sort_ver, otherwise false. Use it like this:
  1491. #
  1492. # func_lt_ver "$prev_ver" "$proposed_ver" || func_fatal_error "..."
  1493. func_lt_ver ()
  1494. {
  1495. $debug_cmd
  1496. test "x$1" = x`func_sort_ver "$1" "$2" | $SED 1q`
  1497. }
  1498. # Local variables:
  1499. # mode: shell-script
  1500. # sh-indentation: 2
  1501. # eval: (add-hook 'before-save-hook 'time-stamp)
  1502. # time-stamp-pattern: "10/scriptversion=%:y-%02m-%02d.%02H; # UTC"
  1503. # time-stamp-time-zone: "UTC"
  1504. # End:
  1505. #! /bin/sh
  1506. # Set a version string for this script.
  1507. scriptversion=2015-10-07.11; # UTC
  1508. # A portable, pluggable option parser for Bourne shell.
  1509. # Written by Gary V. Vaughan, 2010
  1510. # Copyright (C) 2010-2015 Free Software Foundation, Inc.
  1511. # This is free software; see the source for copying conditions. There is NO
  1512. # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  1513. # This program is free software: you can redistribute it and/or modify
  1514. # it under the terms of the GNU General Public License as published by
  1515. # the Free Software Foundation, either version 3 of the License, or
  1516. # (at your option) any later version.
  1517. # This program is distributed in the hope that it will be useful,
  1518. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  1519. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  1520. # GNU General Public License for more details.
  1521. # You should have received a copy of the GNU General Public License
  1522. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  1523. # Please report bugs or propose patches to gary@gnu.org.
  1524. ## ------ ##
  1525. ## Usage. ##
  1526. ## ------ ##
  1527. # This file is a library for parsing options in your shell scripts along
  1528. # with assorted other useful supporting features that you can make use
  1529. # of too.
  1530. #
  1531. # For the simplest scripts you might need only:
  1532. #
  1533. # #!/bin/sh
  1534. # . relative/path/to/funclib.sh
  1535. # . relative/path/to/options-parser
  1536. # scriptversion=1.0
  1537. # func_options ${1+"$@"}
  1538. # eval set dummy "$func_options_result"; shift
  1539. # ...rest of your script...
  1540. #
  1541. # In order for the '--version' option to work, you will need to have a
  1542. # suitably formatted comment like the one at the top of this file
  1543. # starting with '# Written by ' and ending with '# warranty; '.
  1544. #
  1545. # For '-h' and '--help' to work, you will also need a one line
  1546. # description of your script's purpose in a comment directly above the
  1547. # '# Written by ' line, like the one at the top of this file.
  1548. #
  1549. # The default options also support '--debug', which will turn on shell
  1550. # execution tracing (see the comment above debug_cmd below for another
  1551. # use), and '--verbose' and the func_verbose function to allow your script
  1552. # to display verbose messages only when your user has specified
  1553. # '--verbose'.
  1554. #
  1555. # After sourcing this file, you can plug processing for additional
  1556. # options by amending the variables from the 'Configuration' section
  1557. # below, and following the instructions in the 'Option parsing'
  1558. # section further down.
  1559. ## -------------- ##
  1560. ## Configuration. ##
  1561. ## -------------- ##
  1562. # You should override these variables in your script after sourcing this
  1563. # file so that they reflect the customisations you have added to the
  1564. # option parser.
  1565. # The usage line for option parsing errors and the start of '-h' and
  1566. # '--help' output messages. You can embed shell variables for delayed
  1567. # expansion at the time the message is displayed, but you will need to
  1568. # quote other shell meta-characters carefully to prevent them being
  1569. # expanded when the contents are evaled.
  1570. usage='$progpath [OPTION]...'
  1571. # Short help message in response to '-h' and '--help'. Add to this or
  1572. # override it after sourcing this library to reflect the full set of
  1573. # options your script accepts.
  1574. usage_message="\
  1575. --debug enable verbose shell tracing
  1576. -W, --warnings=CATEGORY
  1577. report the warnings falling in CATEGORY [all]
  1578. -v, --verbose verbosely report processing
  1579. --version print version information and exit
  1580. -h, --help print short or long help message and exit
  1581. "
  1582. # Additional text appended to 'usage_message' in response to '--help'.
  1583. long_help_message="
  1584. Warning categories include:
  1585. 'all' show all warnings
  1586. 'none' turn off all the warnings
  1587. 'error' warnings are treated as fatal errors"
  1588. # Help message printed before fatal option parsing errors.
  1589. fatal_help="Try '\$progname --help' for more information."
  1590. ## ------------------------- ##
  1591. ## Hook function management. ##
  1592. ## ------------------------- ##
  1593. # This section contains functions for adding, removing, and running hooks
  1594. # to the main code. A hook is just a named list of of function, that can
  1595. # be run in order later on.
  1596. # func_hookable FUNC_NAME
  1597. # -----------------------
  1598. # Declare that FUNC_NAME will run hooks added with
  1599. # 'func_add_hook FUNC_NAME ...'.
  1600. func_hookable ()
  1601. {
  1602. $debug_cmd
  1603. func_append hookable_fns " $1"
  1604. }
  1605. # func_add_hook FUNC_NAME HOOK_FUNC
  1606. # ---------------------------------
  1607. # Request that FUNC_NAME call HOOK_FUNC before it returns. FUNC_NAME must
  1608. # first have been declared "hookable" by a call to 'func_hookable'.
  1609. func_add_hook ()
  1610. {
  1611. $debug_cmd
  1612. case " $hookable_fns " in
  1613. *" $1 "*) ;;
  1614. *) func_fatal_error "'$1' does not accept hook functions." ;;
  1615. esac
  1616. eval func_append ${1}_hooks '" $2"'
  1617. }
  1618. # func_remove_hook FUNC_NAME HOOK_FUNC
  1619. # ------------------------------------
  1620. # Remove HOOK_FUNC from the list of functions called by FUNC_NAME.
  1621. func_remove_hook ()
  1622. {
  1623. $debug_cmd
  1624. eval ${1}_hooks='`$ECHO "\$'$1'_hooks" |$SED "s| '$2'||"`'
  1625. }
  1626. # func_run_hooks FUNC_NAME [ARG]...
  1627. # ---------------------------------
  1628. # Run all hook functions registered to FUNC_NAME.
  1629. # It is assumed that the list of hook functions contains nothing more
  1630. # than a whitespace-delimited list of legal shell function names, and
  1631. # no effort is wasted trying to catch shell meta-characters or preserve
  1632. # whitespace.
  1633. func_run_hooks ()
  1634. {
  1635. $debug_cmd
  1636. _G_rc_run_hooks=false
  1637. case " $hookable_fns " in
  1638. *" $1 "*) ;;
  1639. *) func_fatal_error "'$1' does not support hook funcions.n" ;;
  1640. esac
  1641. eval _G_hook_fns=\$$1_hooks; shift
  1642. for _G_hook in $_G_hook_fns; do
  1643. if eval $_G_hook '"$@"'; then
  1644. # store returned options list back into positional
  1645. # parameters for next 'cmd' execution.
  1646. eval _G_hook_result=\$${_G_hook}_result
  1647. eval set dummy "$_G_hook_result"; shift
  1648. _G_rc_run_hooks=:
  1649. fi
  1650. done
  1651. $_G_rc_run_hooks && func_run_hooks_result=$_G_hook_result
  1652. }
  1653. ## --------------- ##
  1654. ## Option parsing. ##
  1655. ## --------------- ##
  1656. # In order to add your own option parsing hooks, you must accept the
  1657. # full positional parameter list in your hook function, you may remove/edit
  1658. # any options that you action, and then pass back the remaining unprocessed
  1659. # options in '<hooked_function_name>_result', escaped suitably for
  1660. # 'eval'. In this case you also must return $EXIT_SUCCESS to let the
  1661. # hook's caller know that it should pay attention to
  1662. # '<hooked_function_name>_result'. Returning $EXIT_FAILURE signalizes that
  1663. # arguments are left untouched by the hook and therefore caller will ignore the
  1664. # result variable.
  1665. #
  1666. # Like this:
  1667. #
  1668. # my_options_prep ()
  1669. # {
  1670. # $debug_cmd
  1671. #
  1672. # # Extend the existing usage message.
  1673. # usage_message=$usage_message'
  1674. # -s, --silent don'\''t print informational messages
  1675. # '
  1676. # # No change in '$@' (ignored completely by this hook). There is
  1677. # # no need to do the equivalent (but slower) action:
  1678. # # func_quote_for_eval ${1+"$@"}
  1679. # # my_options_prep_result=$func_quote_for_eval_result
  1680. # false
  1681. # }
  1682. # func_add_hook func_options_prep my_options_prep
  1683. #
  1684. #
  1685. # my_silent_option ()
  1686. # {
  1687. # $debug_cmd
  1688. #
  1689. # args_changed=false
  1690. #
  1691. # # Note that for efficiency, we parse as many options as we can
  1692. # # recognise in a loop before passing the remainder back to the
  1693. # # caller on the first unrecognised argument we encounter.
  1694. # while test $# -gt 0; do
  1695. # opt=$1; shift
  1696. # case $opt in
  1697. # --silent|-s) opt_silent=:
  1698. # args_changed=:
  1699. # ;;
  1700. # # Separate non-argument short options:
  1701. # -s*) func_split_short_opt "$_G_opt"
  1702. # set dummy "$func_split_short_opt_name" \
  1703. # "-$func_split_short_opt_arg" ${1+"$@"}
  1704. # shift
  1705. # args_changed=:
  1706. # ;;
  1707. # *) # Make sure the first unrecognised option "$_G_opt"
  1708. # # is added back to "$@", we could need that later
  1709. # # if $args_changed is true.
  1710. # set dummy "$_G_opt" ${1+"$@"}; shift; break ;;
  1711. # esac
  1712. # done
  1713. #
  1714. # if $args_changed; then
  1715. # func_quote_for_eval ${1+"$@"}
  1716. # my_silent_option_result=$func_quote_for_eval_result
  1717. # fi
  1718. #
  1719. # $args_changed
  1720. # }
  1721. # func_add_hook func_parse_options my_silent_option
  1722. #
  1723. #
  1724. # my_option_validation ()
  1725. # {
  1726. # $debug_cmd
  1727. #
  1728. # $opt_silent && $opt_verbose && func_fatal_help "\
  1729. # '--silent' and '--verbose' options are mutually exclusive."
  1730. #
  1731. # false
  1732. # }
  1733. # func_add_hook func_validate_options my_option_validation
  1734. #
  1735. # You'll also need to manually amend $usage_message to reflect the extra
  1736. # options you parse. It's preferable to append if you can, so that
  1737. # multiple option parsing hooks can be added safely.
  1738. # func_options_finish [ARG]...
  1739. # ----------------------------
  1740. # Finishing the option parse loop (call 'func_options' hooks ATM).
  1741. func_options_finish ()
  1742. {
  1743. $debug_cmd
  1744. _G_func_options_finish_exit=false
  1745. if func_run_hooks func_options ${1+"$@"}; then
  1746. func_options_finish_result=$func_run_hooks_result
  1747. _G_func_options_finish_exit=:
  1748. fi
  1749. $_G_func_options_finish_exit
  1750. }
  1751. # func_options [ARG]...
  1752. # ---------------------
  1753. # All the functions called inside func_options are hookable. See the
  1754. # individual implementations for details.
  1755. func_hookable func_options
  1756. func_options ()
  1757. {
  1758. $debug_cmd
  1759. _G_rc_options=false
  1760. for my_func in options_prep parse_options validate_options options_finish
  1761. do
  1762. if eval func_$my_func '${1+"$@"}'; then
  1763. eval _G_res_var='$'"func_${my_func}_result"
  1764. eval set dummy "$_G_res_var" ; shift
  1765. _G_rc_options=:
  1766. fi
  1767. done
  1768. # Save modified positional parameters for caller. As a top-level
  1769. # options-parser function we always need to set the 'func_options_result'
  1770. # variable (regardless the $_G_rc_options value).
  1771. if $_G_rc_options; then
  1772. func_options_result=$_G_res_var
  1773. else
  1774. func_quote_for_eval ${1+"$@"}
  1775. func_options_result=$func_quote_for_eval_result
  1776. fi
  1777. $_G_rc_options
  1778. }
  1779. # func_options_prep [ARG]...
  1780. # --------------------------
  1781. # All initialisations required before starting the option parse loop.
  1782. # Note that when calling hook functions, we pass through the list of
  1783. # positional parameters. If a hook function modifies that list, and
  1784. # needs to propagate that back to rest of this script, then the complete
  1785. # modified list must be put in 'func_run_hooks_result' before
  1786. # returning $EXIT_SUCCESS (otherwise $EXIT_FAILURE is returned).
  1787. func_hookable func_options_prep
  1788. func_options_prep ()
  1789. {
  1790. $debug_cmd
  1791. # Option defaults:
  1792. opt_verbose=false
  1793. opt_warning_types=
  1794. _G_rc_options_prep=false
  1795. if func_run_hooks func_options_prep ${1+"$@"}; then
  1796. _G_rc_options_prep=:
  1797. # save modified positional parameters for caller
  1798. func_options_prep_result=$func_run_hooks_result
  1799. fi
  1800. $_G_rc_options_prep
  1801. }
  1802. # func_parse_options [ARG]...
  1803. # ---------------------------
  1804. # The main option parsing loop.
  1805. func_hookable func_parse_options
  1806. func_parse_options ()
  1807. {
  1808. $debug_cmd
  1809. func_parse_options_result=
  1810. _G_rc_parse_options=false
  1811. # this just eases exit handling
  1812. while test $# -gt 0; do
  1813. # Defer to hook functions for initial option parsing, so they
  1814. # get priority in the event of reusing an option name.
  1815. if func_run_hooks func_parse_options ${1+"$@"}; then
  1816. eval set dummy "$func_run_hooks_result"; shift
  1817. _G_rc_parse_options=:
  1818. fi
  1819. # Break out of the loop if we already parsed every option.
  1820. test $# -gt 0 || break
  1821. _G_match_parse_options=:
  1822. _G_opt=$1
  1823. shift
  1824. case $_G_opt in
  1825. --debug|-x) debug_cmd='set -x'
  1826. func_echo "enabling shell trace mode"
  1827. $debug_cmd
  1828. ;;
  1829. --no-warnings|--no-warning|--no-warn)
  1830. set dummy --warnings none ${1+"$@"}
  1831. shift
  1832. ;;
  1833. --warnings|--warning|-W)
  1834. if test $# = 0 && func_missing_arg $_G_opt; then
  1835. _G_rc_parse_options=:
  1836. break
  1837. fi
  1838. case " $warning_categories $1" in
  1839. *" $1 "*)
  1840. # trailing space prevents matching last $1 above
  1841. func_append_uniq opt_warning_types " $1"
  1842. ;;
  1843. *all)
  1844. opt_warning_types=$warning_categories
  1845. ;;
  1846. *none)
  1847. opt_warning_types=none
  1848. warning_func=:
  1849. ;;
  1850. *error)
  1851. opt_warning_types=$warning_categories
  1852. warning_func=func_fatal_error
  1853. ;;
  1854. *)
  1855. func_fatal_error \
  1856. "unsupported warning category: '$1'"
  1857. ;;
  1858. esac
  1859. shift
  1860. ;;
  1861. --verbose|-v) opt_verbose=: ;;
  1862. --version) func_version ;;
  1863. -\?|-h) func_usage ;;
  1864. --help) func_help ;;
  1865. # Separate optargs to long options (plugins may need this):
  1866. --*=*) func_split_equals "$_G_opt"
  1867. set dummy "$func_split_equals_lhs" \
  1868. "$func_split_equals_rhs" ${1+"$@"}
  1869. shift
  1870. ;;
  1871. # Separate optargs to short options:
  1872. -W*)
  1873. func_split_short_opt "$_G_opt"
  1874. set dummy "$func_split_short_opt_name" \
  1875. "$func_split_short_opt_arg" ${1+"$@"}
  1876. shift
  1877. ;;
  1878. # Separate non-argument short options:
  1879. -\?*|-h*|-v*|-x*)
  1880. func_split_short_opt "$_G_opt"
  1881. set dummy "$func_split_short_opt_name" \
  1882. "-$func_split_short_opt_arg" ${1+"$@"}
  1883. shift
  1884. ;;
  1885. --) _G_rc_parse_options=: ; break ;;
  1886. -*) func_fatal_help "unrecognised option: '$_G_opt'" ;;
  1887. *) set dummy "$_G_opt" ${1+"$@"}; shift
  1888. _G_match_parse_options=false
  1889. break
  1890. ;;
  1891. esac
  1892. $_G_match_parse_options && _G_rc_parse_options=:
  1893. done
  1894. if $_G_rc_parse_options; then
  1895. # save modified positional parameters for caller
  1896. func_quote_for_eval ${1+"$@"}
  1897. func_parse_options_result=$func_quote_for_eval_result
  1898. fi
  1899. $_G_rc_parse_options
  1900. }
  1901. # func_validate_options [ARG]...
  1902. # ------------------------------
  1903. # Perform any sanity checks on option settings and/or unconsumed
  1904. # arguments.
  1905. func_hookable func_validate_options
  1906. func_validate_options ()
  1907. {
  1908. $debug_cmd
  1909. _G_rc_validate_options=false
  1910. # Display all warnings if -W was not given.
  1911. test -n "$opt_warning_types" || opt_warning_types=" $warning_categories"
  1912. if func_run_hooks func_validate_options ${1+"$@"}; then
  1913. # save modified positional parameters for caller
  1914. func_validate_options_result=$func_run_hooks_result
  1915. _G_rc_validate_options=:
  1916. fi
  1917. # Bail if the options were screwed!
  1918. $exit_cmd $EXIT_FAILURE
  1919. $_G_rc_validate_options
  1920. }
  1921. ## ----------------- ##
  1922. ## Helper functions. ##
  1923. ## ----------------- ##
  1924. # This section contains the helper functions used by the rest of the
  1925. # hookable option parser framework in ascii-betical order.
  1926. # func_fatal_help ARG...
  1927. # ----------------------
  1928. # Echo program name prefixed message to standard error, followed by
  1929. # a help hint, and exit.
  1930. func_fatal_help ()
  1931. {
  1932. $debug_cmd
  1933. eval \$ECHO \""Usage: $usage"\"
  1934. eval \$ECHO \""$fatal_help"\"
  1935. func_error ${1+"$@"}
  1936. exit $EXIT_FAILURE
  1937. }
  1938. # func_help
  1939. # ---------
  1940. # Echo long help message to standard output and exit.
  1941. func_help ()
  1942. {
  1943. $debug_cmd
  1944. func_usage_message
  1945. $ECHO "$long_help_message"
  1946. exit 0
  1947. }
  1948. # func_missing_arg ARGNAME
  1949. # ------------------------
  1950. # Echo program name prefixed message to standard error and set global
  1951. # exit_cmd.
  1952. func_missing_arg ()
  1953. {
  1954. $debug_cmd
  1955. func_error "Missing argument for '$1'."
  1956. exit_cmd=exit
  1957. }
  1958. # func_split_equals STRING
  1959. # ------------------------
  1960. # Set func_split_equals_lhs and func_split_equals_rhs shell variables after
  1961. # splitting STRING at the '=' sign.
  1962. test -z "$_G_HAVE_XSI_OPS" \
  1963. && (eval 'x=a/b/c;
  1964. test 5aa/bb/cc = "${#x}${x%%/*}${x%/*}${x#*/}${x##*/}"') 2>/dev/null \
  1965. && _G_HAVE_XSI_OPS=yes
  1966. if test yes = "$_G_HAVE_XSI_OPS"
  1967. then
  1968. # This is an XSI compatible shell, allowing a faster implementation...
  1969. eval 'func_split_equals ()
  1970. {
  1971. $debug_cmd
  1972. func_split_equals_lhs=${1%%=*}
  1973. func_split_equals_rhs=${1#*=}
  1974. test "x$func_split_equals_lhs" = "x$1" \
  1975. && func_split_equals_rhs=
  1976. }'
  1977. else
  1978. # ...otherwise fall back to using expr, which is often a shell builtin.
  1979. func_split_equals ()
  1980. {
  1981. $debug_cmd
  1982. func_split_equals_lhs=`expr "x$1" : 'x\([^=]*\)'`
  1983. func_split_equals_rhs=
  1984. test "x$func_split_equals_lhs" = "x$1" \
  1985. || func_split_equals_rhs=`expr "x$1" : 'x[^=]*=\(.*\)$'`
  1986. }
  1987. fi #func_split_equals
  1988. # func_split_short_opt SHORTOPT
  1989. # -----------------------------
  1990. # Set func_split_short_opt_name and func_split_short_opt_arg shell
  1991. # variables after splitting SHORTOPT after the 2nd character.
  1992. if test yes = "$_G_HAVE_XSI_OPS"
  1993. then
  1994. # This is an XSI compatible shell, allowing a faster implementation...
  1995. eval 'func_split_short_opt ()
  1996. {
  1997. $debug_cmd
  1998. func_split_short_opt_arg=${1#??}
  1999. func_split_short_opt_name=${1%"$func_split_short_opt_arg"}
  2000. }'
  2001. else
  2002. # ...otherwise fall back to using expr, which is often a shell builtin.
  2003. func_split_short_opt ()
  2004. {
  2005. $debug_cmd
  2006. func_split_short_opt_name=`expr "x$1" : 'x-\(.\)'`
  2007. func_split_short_opt_arg=`expr "x$1" : 'x-.\(.*\)$'`
  2008. }
  2009. fi #func_split_short_opt
  2010. # func_usage
  2011. # ----------
  2012. # Echo short help message to standard output and exit.
  2013. func_usage ()
  2014. {
  2015. $debug_cmd
  2016. func_usage_message
  2017. $ECHO "Run '$progname --help |${PAGER-more}' for full usage"
  2018. exit 0
  2019. }
  2020. # func_usage_message
  2021. # ------------------
  2022. # Echo short help message to standard output.
  2023. func_usage_message ()
  2024. {
  2025. $debug_cmd
  2026. eval \$ECHO \""Usage: $usage"\"
  2027. echo
  2028. $SED -n 's|^# ||
  2029. /^Written by/{
  2030. x;p;x
  2031. }
  2032. h
  2033. /^Written by/q' < "$progpath"
  2034. echo
  2035. eval \$ECHO \""$usage_message"\"
  2036. }
  2037. # func_version
  2038. # ------------
  2039. # Echo version message to standard output and exit.
  2040. func_version ()
  2041. {
  2042. $debug_cmd
  2043. printf '%s\n' "$progname $scriptversion"
  2044. $SED -n '
  2045. /(C)/!b go
  2046. :more
  2047. /\./!{
  2048. N
  2049. s|\n# | |
  2050. b more
  2051. }
  2052. :go
  2053. /^# Written by /,/# warranty; / {
  2054. s|^# ||
  2055. s|^# *$||
  2056. s|\((C)\)[ 0-9,-]*[ ,-]\([1-9][0-9]* \)|\1 \2|
  2057. p
  2058. }
  2059. /^# Written by / {
  2060. s|^# ||
  2061. p
  2062. }
  2063. /^warranty; /q' < "$progpath"
  2064. exit $?
  2065. }
  2066. # Local variables:
  2067. # mode: shell-script
  2068. # sh-indentation: 2
  2069. # eval: (add-hook 'before-save-hook 'time-stamp)
  2070. # time-stamp-pattern: "10/scriptversion=%:y-%02m-%02d.%02H; # UTC"
  2071. # time-stamp-time-zone: "UTC"
  2072. # End:
  2073. # Set a version string.
  2074. scriptversion='(GNU libtool) 2.4.6'
  2075. # func_echo ARG...
  2076. # ----------------
  2077. # Libtool also displays the current mode in messages, so override
  2078. # funclib.sh func_echo with this custom definition.
  2079. func_echo ()
  2080. {
  2081. $debug_cmd
  2082. _G_message=$*
  2083. func_echo_IFS=$IFS
  2084. IFS=$nl
  2085. for _G_line in $_G_message; do
  2086. IFS=$func_echo_IFS
  2087. $ECHO "$progname${opt_mode+: $opt_mode}: $_G_line"
  2088. done
  2089. IFS=$func_echo_IFS
  2090. }
  2091. # func_warning ARG...
  2092. # -------------------
  2093. # Libtool warnings are not categorized, so override funclib.sh
  2094. # func_warning with this simpler definition.
  2095. func_warning ()
  2096. {
  2097. $debug_cmd
  2098. $warning_func ${1+"$@"}
  2099. }
  2100. ## ---------------- ##
  2101. ## Options parsing. ##
  2102. ## ---------------- ##
  2103. # Hook in the functions to make sure our own options are parsed during
  2104. # the option parsing loop.
  2105. usage='$progpath [OPTION]... [MODE-ARG]...'
  2106. # Short help message in response to '-h'.
  2107. usage_message="Options:
  2108. --config show all configuration variables
  2109. --debug enable verbose shell tracing
  2110. -n, --dry-run display commands without modifying any files
  2111. --features display basic configuration information and exit
  2112. --mode=MODE use operation mode MODE
  2113. --no-warnings equivalent to '-Wnone'
  2114. --preserve-dup-deps don't remove duplicate dependency libraries
  2115. --quiet, --silent don't print informational messages
  2116. --tag=TAG use configuration variables from tag TAG
  2117. -v, --verbose print more informational messages than default
  2118. --version print version information
  2119. -W, --warnings=CATEGORY report the warnings falling in CATEGORY [all]
  2120. -h, --help, --help-all print short, long, or detailed help message
  2121. "
  2122. # Additional text appended to 'usage_message' in response to '--help'.
  2123. func_help ()
  2124. {
  2125. $debug_cmd
  2126. func_usage_message
  2127. $ECHO "$long_help_message
  2128. MODE must be one of the following:
  2129. clean remove files from the build directory
  2130. compile compile a source file into a libtool object
  2131. execute automatically set library path, then run a program
  2132. finish complete the installation of libtool libraries
  2133. install install libraries or executables
  2134. link create a library or an executable
  2135. uninstall remove libraries from an installed directory
  2136. MODE-ARGS vary depending on the MODE. When passed as first option,
  2137. '--mode=MODE' may be abbreviated as 'MODE' or a unique abbreviation of that.
  2138. Try '$progname --help --mode=MODE' for a more detailed description of MODE.
  2139. When reporting a bug, please describe a test case to reproduce it and
  2140. include the following information:
  2141. host-triplet: $host
  2142. shell: $SHELL
  2143. compiler: $LTCC
  2144. compiler flags: $LTCFLAGS
  2145. linker: $LD (gnu? $with_gnu_ld)
  2146. version: $progname $scriptversion Debian-2.4.6-14
  2147. automake: `($AUTOMAKE --version) 2>/dev/null |$SED 1q`
  2148. autoconf: `($AUTOCONF --version) 2>/dev/null |$SED 1q`
  2149. Report bugs to <bug-libtool@gnu.org>.
  2150. GNU libtool home page: <http://www.gnu.org/s/libtool/>.
  2151. General help using GNU software: <http://www.gnu.org/gethelp/>."
  2152. exit 0
  2153. }
  2154. # func_lo2o OBJECT-NAME
  2155. # ---------------------
  2156. # Transform OBJECT-NAME from a '.lo' suffix to the platform specific
  2157. # object suffix.
  2158. lo2o=s/\\.lo\$/.$objext/
  2159. o2lo=s/\\.$objext\$/.lo/
  2160. if test yes = "$_G_HAVE_XSI_OPS"; then
  2161. eval 'func_lo2o ()
  2162. {
  2163. case $1 in
  2164. *.lo) func_lo2o_result=${1%.lo}.$objext ;;
  2165. * ) func_lo2o_result=$1 ;;
  2166. esac
  2167. }'
  2168. # func_xform LIBOBJ-OR-SOURCE
  2169. # ---------------------------
  2170. # Transform LIBOBJ-OR-SOURCE from a '.o' or '.c' (or otherwise)
  2171. # suffix to a '.lo' libtool-object suffix.
  2172. eval 'func_xform ()
  2173. {
  2174. func_xform_result=${1%.*}.lo
  2175. }'
  2176. else
  2177. # ...otherwise fall back to using sed.
  2178. func_lo2o ()
  2179. {
  2180. func_lo2o_result=`$ECHO "$1" | $SED "$lo2o"`
  2181. }
  2182. func_xform ()
  2183. {
  2184. func_xform_result=`$ECHO "$1" | $SED 's|\.[^.]*$|.lo|'`
  2185. }
  2186. fi
  2187. # func_fatal_configuration ARG...
  2188. # -------------------------------
  2189. # Echo program name prefixed message to standard error, followed by
  2190. # a configuration failure hint, and exit.
  2191. func_fatal_configuration ()
  2192. {
  2193. func__fatal_error ${1+"$@"} \
  2194. "See the $PACKAGE documentation for more information." \
  2195. "Fatal configuration error."
  2196. }
  2197. # func_config
  2198. # -----------
  2199. # Display the configuration for all the tags in this script.
  2200. func_config ()
  2201. {
  2202. re_begincf='^# ### BEGIN LIBTOOL'
  2203. re_endcf='^# ### END LIBTOOL'
  2204. # Default configuration.
  2205. $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath"
  2206. # Now print the configurations for the tags.
  2207. for tagname in $taglist; do
  2208. $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath"
  2209. done
  2210. exit $?
  2211. }
  2212. # func_features
  2213. # -------------
  2214. # Display the features supported by this script.
  2215. func_features ()
  2216. {
  2217. echo "host: $host"
  2218. if test yes = "$build_libtool_libs"; then
  2219. echo "enable shared libraries"
  2220. else
  2221. echo "disable shared libraries"
  2222. fi
  2223. if test yes = "$build_old_libs"; then
  2224. echo "enable static libraries"
  2225. else
  2226. echo "disable static libraries"
  2227. fi
  2228. exit $?
  2229. }
  2230. # func_enable_tag TAGNAME
  2231. # -----------------------
  2232. # Verify that TAGNAME is valid, and either flag an error and exit, or
  2233. # enable the TAGNAME tag. We also add TAGNAME to the global $taglist
  2234. # variable here.
  2235. func_enable_tag ()
  2236. {
  2237. # Global variable:
  2238. tagname=$1
  2239. re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$"
  2240. re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$"
  2241. sed_extractcf=/$re_begincf/,/$re_endcf/p
  2242. # Validate tagname.
  2243. case $tagname in
  2244. *[!-_A-Za-z0-9,/]*)
  2245. func_fatal_error "invalid tag name: $tagname"
  2246. ;;
  2247. esac
  2248. # Don't test for the "default" C tag, as we know it's
  2249. # there but not specially marked.
  2250. case $tagname in
  2251. CC) ;;
  2252. *)
  2253. if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then
  2254. taglist="$taglist $tagname"
  2255. # Evaluate the configuration. Be careful to quote the path
  2256. # and the sed script, to avoid splitting on whitespace, but
  2257. # also don't use non-portable quotes within backquotes within
  2258. # quotes we have to do it in 2 steps:
  2259. extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"`
  2260. eval "$extractedcf"
  2261. else
  2262. func_error "ignoring unknown tag $tagname"
  2263. fi
  2264. ;;
  2265. esac
  2266. }
  2267. # func_check_version_match
  2268. # ------------------------
  2269. # Ensure that we are using m4 macros, and libtool script from the same
  2270. # release of libtool.
  2271. func_check_version_match ()
  2272. {
  2273. if test "$package_revision" != "$macro_revision"; then
  2274. if test "$VERSION" != "$macro_version"; then
  2275. if test -z "$macro_version"; then
  2276. cat >&2 <<_LT_EOF
  2277. $progname: Version mismatch error. This is $PACKAGE $VERSION, but the
  2278. $progname: definition of this LT_INIT comes from an older release.
  2279. $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
  2280. $progname: and run autoconf again.
  2281. _LT_EOF
  2282. else
  2283. cat >&2 <<_LT_EOF
  2284. $progname: Version mismatch error. This is $PACKAGE $VERSION, but the
  2285. $progname: definition of this LT_INIT comes from $PACKAGE $macro_version.
  2286. $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
  2287. $progname: and run autoconf again.
  2288. _LT_EOF
  2289. fi
  2290. else
  2291. cat >&2 <<_LT_EOF
  2292. $progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision,
  2293. $progname: but the definition of this LT_INIT comes from revision $macro_revision.
  2294. $progname: You should recreate aclocal.m4 with macros from revision $package_revision
  2295. $progname: of $PACKAGE $VERSION and run autoconf again.
  2296. _LT_EOF
  2297. fi
  2298. exit $EXIT_MISMATCH
  2299. fi
  2300. }
  2301. # libtool_options_prep [ARG]...
  2302. # -----------------------------
  2303. # Preparation for options parsed by libtool.
  2304. libtool_options_prep ()
  2305. {
  2306. $debug_mode
  2307. # Option defaults:
  2308. opt_config=false
  2309. opt_dlopen=
  2310. opt_dry_run=false
  2311. opt_help=false
  2312. opt_mode=
  2313. opt_preserve_dup_deps=false
  2314. opt_quiet=false
  2315. nonopt=
  2316. preserve_args=
  2317. _G_rc_lt_options_prep=:
  2318. # Shorthand for --mode=foo, only valid as the first argument
  2319. case $1 in
  2320. clean|clea|cle|cl)
  2321. shift; set dummy --mode clean ${1+"$@"}; shift
  2322. ;;
  2323. compile|compil|compi|comp|com|co|c)
  2324. shift; set dummy --mode compile ${1+"$@"}; shift
  2325. ;;
  2326. execute|execut|execu|exec|exe|ex|e)
  2327. shift; set dummy --mode execute ${1+"$@"}; shift
  2328. ;;
  2329. finish|finis|fini|fin|fi|f)
  2330. shift; set dummy --mode finish ${1+"$@"}; shift
  2331. ;;
  2332. install|instal|insta|inst|ins|in|i)
  2333. shift; set dummy --mode install ${1+"$@"}; shift
  2334. ;;
  2335. link|lin|li|l)
  2336. shift; set dummy --mode link ${1+"$@"}; shift
  2337. ;;
  2338. uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u)
  2339. shift; set dummy --mode uninstall ${1+"$@"}; shift
  2340. ;;
  2341. *)
  2342. _G_rc_lt_options_prep=false
  2343. ;;
  2344. esac
  2345. if $_G_rc_lt_options_prep; then
  2346. # Pass back the list of options.
  2347. func_quote_for_eval ${1+"$@"}
  2348. libtool_options_prep_result=$func_quote_for_eval_result
  2349. fi
  2350. $_G_rc_lt_options_prep
  2351. }
  2352. func_add_hook func_options_prep libtool_options_prep
  2353. # libtool_parse_options [ARG]...
  2354. # ---------------------------------
  2355. # Provide handling for libtool specific options.
  2356. libtool_parse_options ()
  2357. {
  2358. $debug_cmd
  2359. _G_rc_lt_parse_options=false
  2360. # Perform our own loop to consume as many options as possible in
  2361. # each iteration.
  2362. while test $# -gt 0; do
  2363. _G_match_lt_parse_options=:
  2364. _G_opt=$1
  2365. shift
  2366. case $_G_opt in
  2367. --dry-run|--dryrun|-n)
  2368. opt_dry_run=:
  2369. ;;
  2370. --config) func_config ;;
  2371. --dlopen|-dlopen)
  2372. opt_dlopen="${opt_dlopen+$opt_dlopen
  2373. }$1"
  2374. shift
  2375. ;;
  2376. --preserve-dup-deps)
  2377. opt_preserve_dup_deps=: ;;
  2378. --features) func_features ;;
  2379. --finish) set dummy --mode finish ${1+"$@"}; shift ;;
  2380. --help) opt_help=: ;;
  2381. --help-all) opt_help=': help-all' ;;
  2382. --mode) test $# = 0 && func_missing_arg $_G_opt && break
  2383. opt_mode=$1
  2384. case $1 in
  2385. # Valid mode arguments:
  2386. clean|compile|execute|finish|install|link|relink|uninstall) ;;
  2387. # Catch anything else as an error
  2388. *) func_error "invalid argument for $_G_opt"
  2389. exit_cmd=exit
  2390. break
  2391. ;;
  2392. esac
  2393. shift
  2394. ;;
  2395. --no-silent|--no-quiet)
  2396. opt_quiet=false
  2397. func_append preserve_args " $_G_opt"
  2398. ;;
  2399. --no-warnings|--no-warning|--no-warn)
  2400. opt_warning=false
  2401. func_append preserve_args " $_G_opt"
  2402. ;;
  2403. --no-verbose)
  2404. opt_verbose=false
  2405. func_append preserve_args " $_G_opt"
  2406. ;;
  2407. --silent|--quiet)
  2408. opt_quiet=:
  2409. opt_verbose=false
  2410. func_append preserve_args " $_G_opt"
  2411. ;;
  2412. --tag) test $# = 0 && func_missing_arg $_G_opt && break
  2413. opt_tag=$1
  2414. func_append preserve_args " $_G_opt $1"
  2415. func_enable_tag "$1"
  2416. shift
  2417. ;;
  2418. --verbose|-v) opt_quiet=false
  2419. opt_verbose=:
  2420. func_append preserve_args " $_G_opt"
  2421. ;;
  2422. # An option not handled by this hook function:
  2423. *) set dummy "$_G_opt" ${1+"$@"} ; shift
  2424. _G_match_lt_parse_options=false
  2425. break
  2426. ;;
  2427. esac
  2428. $_G_match_lt_parse_options && _G_rc_lt_parse_options=:
  2429. done
  2430. if $_G_rc_lt_parse_options; then
  2431. # save modified positional parameters for caller
  2432. func_quote_for_eval ${1+"$@"}
  2433. libtool_parse_options_result=$func_quote_for_eval_result
  2434. fi
  2435. $_G_rc_lt_parse_options
  2436. }
  2437. func_add_hook func_parse_options libtool_parse_options
  2438. # libtool_validate_options [ARG]...
  2439. # ---------------------------------
  2440. # Perform any sanity checks on option settings and/or unconsumed
  2441. # arguments.
  2442. libtool_validate_options ()
  2443. {
  2444. # save first non-option argument
  2445. if test 0 -lt $#; then
  2446. nonopt=$1
  2447. shift
  2448. fi
  2449. # preserve --debug
  2450. test : = "$debug_cmd" || func_append preserve_args " --debug"
  2451. case $host in
  2452. # Solaris2 added to fix http://debbugs.gnu.org/cgi/bugreport.cgi?bug=16452
  2453. # see also: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59788
  2454. *cygwin* | *mingw* | *pw32* | *cegcc* | *solaris2* | *os2*)
  2455. # don't eliminate duplications in $postdeps and $predeps
  2456. opt_duplicate_compiler_generated_deps=:
  2457. ;;
  2458. *)
  2459. opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps
  2460. ;;
  2461. esac
  2462. $opt_help || {
  2463. # Sanity checks first:
  2464. func_check_version_match
  2465. test yes != "$build_libtool_libs" \
  2466. && test yes != "$build_old_libs" \
  2467. && func_fatal_configuration "not configured to build any kind of library"
  2468. # Darwin sucks
  2469. eval std_shrext=\"$shrext_cmds\"
  2470. # Only execute mode is allowed to have -dlopen flags.
  2471. if test -n "$opt_dlopen" && test execute != "$opt_mode"; then
  2472. func_error "unrecognized option '-dlopen'"
  2473. $ECHO "$help" 1>&2
  2474. exit $EXIT_FAILURE
  2475. fi
  2476. # Change the help message to a mode-specific one.
  2477. generic_help=$help
  2478. help="Try '$progname --help --mode=$opt_mode' for more information."
  2479. }
  2480. # Pass back the unparsed argument list
  2481. func_quote_for_eval ${1+"$@"}
  2482. libtool_validate_options_result=$func_quote_for_eval_result
  2483. }
  2484. func_add_hook func_validate_options libtool_validate_options
  2485. # Process options as early as possible so that --help and --version
  2486. # can return quickly.
  2487. func_options ${1+"$@"}
  2488. eval set dummy "$func_options_result"; shift
  2489. ## ----------- ##
  2490. ## Main. ##
  2491. ## ----------- ##
  2492. magic='%%%MAGIC variable%%%'
  2493. magic_exe='%%%MAGIC EXE variable%%%'
  2494. # Global variables.
  2495. extracted_archives=
  2496. extracted_serial=0
  2497. # If this variable is set in any of the actions, the command in it
  2498. # will be execed at the end. This prevents here-documents from being
  2499. # left over by shells.
  2500. exec_cmd=
  2501. # A function that is used when there is no print builtin or printf.
  2502. func_fallback_echo ()
  2503. {
  2504. eval 'cat <<_LTECHO_EOF
  2505. $1
  2506. _LTECHO_EOF'
  2507. }
  2508. # func_generated_by_libtool
  2509. # True iff stdin has been generated by Libtool. This function is only
  2510. # a basic sanity check; it will hardly flush out determined imposters.
  2511. func_generated_by_libtool_p ()
  2512. {
  2513. $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1
  2514. }
  2515. # func_lalib_p file
  2516. # True iff FILE is a libtool '.la' library or '.lo' object file.
  2517. # This function is only a basic sanity check; it will hardly flush out
  2518. # determined imposters.
  2519. func_lalib_p ()
  2520. {
  2521. test -f "$1" &&
  2522. $SED -e 4q "$1" 2>/dev/null | func_generated_by_libtool_p
  2523. }
  2524. # func_lalib_unsafe_p file
  2525. # True iff FILE is a libtool '.la' library or '.lo' object file.
  2526. # This function implements the same check as func_lalib_p without
  2527. # resorting to external programs. To this end, it redirects stdin and
  2528. # closes it afterwards, without saving the original file descriptor.
  2529. # As a safety measure, use it only where a negative result would be
  2530. # fatal anyway. Works if 'file' does not exist.
  2531. func_lalib_unsafe_p ()
  2532. {
  2533. lalib_p=no
  2534. if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then
  2535. for lalib_p_l in 1 2 3 4
  2536. do
  2537. read lalib_p_line
  2538. case $lalib_p_line in
  2539. \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;;
  2540. esac
  2541. done
  2542. exec 0<&5 5<&-
  2543. fi
  2544. test yes = "$lalib_p"
  2545. }
  2546. # func_ltwrapper_script_p file
  2547. # True iff FILE is a libtool wrapper script
  2548. # This function is only a basic sanity check; it will hardly flush out
  2549. # determined imposters.
  2550. func_ltwrapper_script_p ()
  2551. {
  2552. test -f "$1" &&
  2553. $lt_truncate_bin < "$1" 2>/dev/null | func_generated_by_libtool_p
  2554. }
  2555. # func_ltwrapper_executable_p file
  2556. # True iff FILE is a libtool wrapper executable
  2557. # This function is only a basic sanity check; it will hardly flush out
  2558. # determined imposters.
  2559. func_ltwrapper_executable_p ()
  2560. {
  2561. func_ltwrapper_exec_suffix=
  2562. case $1 in
  2563. *.exe) ;;
  2564. *) func_ltwrapper_exec_suffix=.exe ;;
  2565. esac
  2566. $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1
  2567. }
  2568. # func_ltwrapper_scriptname file
  2569. # Assumes file is an ltwrapper_executable
  2570. # uses $file to determine the appropriate filename for a
  2571. # temporary ltwrapper_script.
  2572. func_ltwrapper_scriptname ()
  2573. {
  2574. func_dirname_and_basename "$1" "" "."
  2575. func_stripname '' '.exe' "$func_basename_result"
  2576. func_ltwrapper_scriptname_result=$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper
  2577. }
  2578. # func_ltwrapper_p file
  2579. # True iff FILE is a libtool wrapper script or wrapper executable
  2580. # This function is only a basic sanity check; it will hardly flush out
  2581. # determined imposters.
  2582. func_ltwrapper_p ()
  2583. {
  2584. func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1"
  2585. }
  2586. # func_execute_cmds commands fail_cmd
  2587. # Execute tilde-delimited COMMANDS.
  2588. # If FAIL_CMD is given, eval that upon failure.
  2589. # FAIL_CMD may read-access the current command in variable CMD!
  2590. func_execute_cmds ()
  2591. {
  2592. $debug_cmd
  2593. save_ifs=$IFS; IFS='~'
  2594. for cmd in $1; do
  2595. IFS=$sp$nl
  2596. eval cmd=\"$cmd\"
  2597. IFS=$save_ifs
  2598. func_show_eval "$cmd" "${2-:}"
  2599. done
  2600. IFS=$save_ifs
  2601. }
  2602. # func_source file
  2603. # Source FILE, adding directory component if necessary.
  2604. # Note that it is not necessary on cygwin/mingw to append a dot to
  2605. # FILE even if both FILE and FILE.exe exist: automatic-append-.exe
  2606. # behavior happens only for exec(3), not for open(2)! Also, sourcing
  2607. # 'FILE.' does not work on cygwin managed mounts.
  2608. func_source ()
  2609. {
  2610. $debug_cmd
  2611. case $1 in
  2612. */* | *\\*) . "$1" ;;
  2613. *) . "./$1" ;;
  2614. esac
  2615. }
  2616. # func_resolve_sysroot PATH
  2617. # Replace a leading = in PATH with a sysroot. Store the result into
  2618. # func_resolve_sysroot_result
  2619. func_resolve_sysroot ()
  2620. {
  2621. func_resolve_sysroot_result=$1
  2622. case $func_resolve_sysroot_result in
  2623. =*)
  2624. func_stripname '=' '' "$func_resolve_sysroot_result"
  2625. func_resolve_sysroot_result=$lt_sysroot$func_stripname_result
  2626. ;;
  2627. esac
  2628. }
  2629. # func_replace_sysroot PATH
  2630. # If PATH begins with the sysroot, replace it with = and
  2631. # store the result into func_replace_sysroot_result.
  2632. func_replace_sysroot ()
  2633. {
  2634. case $lt_sysroot:$1 in
  2635. ?*:"$lt_sysroot"*)
  2636. func_stripname "$lt_sysroot" '' "$1"
  2637. func_replace_sysroot_result='='$func_stripname_result
  2638. ;;
  2639. *)
  2640. # Including no sysroot.
  2641. func_replace_sysroot_result=$1
  2642. ;;
  2643. esac
  2644. }
  2645. # func_infer_tag arg
  2646. # Infer tagged configuration to use if any are available and
  2647. # if one wasn't chosen via the "--tag" command line option.
  2648. # Only attempt this if the compiler in the base compile
  2649. # command doesn't match the default compiler.
  2650. # arg is usually of the form 'gcc ...'
  2651. func_infer_tag ()
  2652. {
  2653. $debug_cmd
  2654. if test -n "$available_tags" && test -z "$tagname"; then
  2655. CC_quoted=
  2656. for arg in $CC; do
  2657. func_append_quoted CC_quoted "$arg"
  2658. done
  2659. CC_expanded=`func_echo_all $CC`
  2660. CC_quoted_expanded=`func_echo_all $CC_quoted`
  2661. case $@ in
  2662. # Blanks in the command may have been stripped by the calling shell,
  2663. # but not from the CC environment variable when configure was run.
  2664. " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
  2665. " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;;
  2666. # Blanks at the start of $base_compile will cause this to fail
  2667. # if we don't check for them as well.
  2668. *)
  2669. for z in $available_tags; do
  2670. if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
  2671. # Evaluate the configuration.
  2672. eval "`$SED -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
  2673. CC_quoted=
  2674. for arg in $CC; do
  2675. # Double-quote args containing other shell metacharacters.
  2676. func_append_quoted CC_quoted "$arg"
  2677. done
  2678. CC_expanded=`func_echo_all $CC`
  2679. CC_quoted_expanded=`func_echo_all $CC_quoted`
  2680. case "$@ " in
  2681. " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
  2682. " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*)
  2683. # The compiler in the base compile command matches
  2684. # the one in the tagged configuration.
  2685. # Assume this is the tagged configuration we want.
  2686. tagname=$z
  2687. break
  2688. ;;
  2689. esac
  2690. fi
  2691. done
  2692. # If $tagname still isn't set, then no tagged configuration
  2693. # was found and let the user know that the "--tag" command
  2694. # line option must be used.
  2695. if test -z "$tagname"; then
  2696. func_echo "unable to infer tagged configuration"
  2697. func_fatal_error "specify a tag with '--tag'"
  2698. # else
  2699. # func_verbose "using $tagname tagged configuration"
  2700. fi
  2701. ;;
  2702. esac
  2703. fi
  2704. }
  2705. # func_write_libtool_object output_name pic_name nonpic_name
  2706. # Create a libtool object file (analogous to a ".la" file),
  2707. # but don't create it if we're doing a dry run.
  2708. func_write_libtool_object ()
  2709. {
  2710. write_libobj=$1
  2711. if test yes = "$build_libtool_libs"; then
  2712. write_lobj=\'$2\'
  2713. else
  2714. write_lobj=none
  2715. fi
  2716. if test yes = "$build_old_libs"; then
  2717. write_oldobj=\'$3\'
  2718. else
  2719. write_oldobj=none
  2720. fi
  2721. $opt_dry_run || {
  2722. cat >${write_libobj}T <<EOF
  2723. # $write_libobj - a libtool object file
  2724. # Generated by $PROGRAM (GNU $PACKAGE) $VERSION
  2725. #
  2726. # Please DO NOT delete this file!
  2727. # It is necessary for linking the library.
  2728. # Name of the PIC object.
  2729. pic_object=$write_lobj
  2730. # Name of the non-PIC object
  2731. non_pic_object=$write_oldobj
  2732. EOF
  2733. $MV "${write_libobj}T" "$write_libobj"
  2734. }
  2735. }
  2736. ##################################################
  2737. # FILE NAME AND PATH CONVERSION HELPER FUNCTIONS #
  2738. ##################################################
  2739. # func_convert_core_file_wine_to_w32 ARG
  2740. # Helper function used by file name conversion functions when $build is *nix,
  2741. # and $host is mingw, cygwin, or some other w32 environment. Relies on a
  2742. # correctly configured wine environment available, with the winepath program
  2743. # in $build's $PATH.
  2744. #
  2745. # ARG is the $build file name to be converted to w32 format.
  2746. # Result is available in $func_convert_core_file_wine_to_w32_result, and will
  2747. # be empty on error (or when ARG is empty)
  2748. func_convert_core_file_wine_to_w32 ()
  2749. {
  2750. $debug_cmd
  2751. func_convert_core_file_wine_to_w32_result=$1
  2752. if test -n "$1"; then
  2753. # Unfortunately, winepath does not exit with a non-zero error code, so we
  2754. # are forced to check the contents of stdout. On the other hand, if the
  2755. # command is not found, the shell will set an exit code of 127 and print
  2756. # *an error message* to stdout. So we must check for both error code of
  2757. # zero AND non-empty stdout, which explains the odd construction:
  2758. func_convert_core_file_wine_to_w32_tmp=`winepath -w "$1" 2>/dev/null`
  2759. if test "$?" -eq 0 && test -n "$func_convert_core_file_wine_to_w32_tmp"; then
  2760. func_convert_core_file_wine_to_w32_result=`$ECHO "$func_convert_core_file_wine_to_w32_tmp" |
  2761. $SED -e "$sed_naive_backslashify"`
  2762. else
  2763. func_convert_core_file_wine_to_w32_result=
  2764. fi
  2765. fi
  2766. }
  2767. # end: func_convert_core_file_wine_to_w32
  2768. # func_convert_core_path_wine_to_w32 ARG
  2769. # Helper function used by path conversion functions when $build is *nix, and
  2770. # $host is mingw, cygwin, or some other w32 environment. Relies on a correctly
  2771. # configured wine environment available, with the winepath program in $build's
  2772. # $PATH. Assumes ARG has no leading or trailing path separator characters.
  2773. #
  2774. # ARG is path to be converted from $build format to win32.
  2775. # Result is available in $func_convert_core_path_wine_to_w32_result.
  2776. # Unconvertible file (directory) names in ARG are skipped; if no directory names
  2777. # are convertible, then the result may be empty.
  2778. func_convert_core_path_wine_to_w32 ()
  2779. {
  2780. $debug_cmd
  2781. # unfortunately, winepath doesn't convert paths, only file names
  2782. func_convert_core_path_wine_to_w32_result=
  2783. if test -n "$1"; then
  2784. oldIFS=$IFS
  2785. IFS=:
  2786. for func_convert_core_path_wine_to_w32_f in $1; do
  2787. IFS=$oldIFS
  2788. func_convert_core_file_wine_to_w32 "$func_convert_core_path_wine_to_w32_f"
  2789. if test -n "$func_convert_core_file_wine_to_w32_result"; then
  2790. if test -z "$func_convert_core_path_wine_to_w32_result"; then
  2791. func_convert_core_path_wine_to_w32_result=$func_convert_core_file_wine_to_w32_result
  2792. else
  2793. func_append func_convert_core_path_wine_to_w32_result ";$func_convert_core_file_wine_to_w32_result"
  2794. fi
  2795. fi
  2796. done
  2797. IFS=$oldIFS
  2798. fi
  2799. }
  2800. # end: func_convert_core_path_wine_to_w32
  2801. # func_cygpath ARGS...
  2802. # Wrapper around calling the cygpath program via LT_CYGPATH. This is used when
  2803. # when (1) $build is *nix and Cygwin is hosted via a wine environment; or (2)
  2804. # $build is MSYS and $host is Cygwin, or (3) $build is Cygwin. In case (1) or
  2805. # (2), returns the Cygwin file name or path in func_cygpath_result (input
  2806. # file name or path is assumed to be in w32 format, as previously converted
  2807. # from $build's *nix or MSYS format). In case (3), returns the w32 file name
  2808. # or path in func_cygpath_result (input file name or path is assumed to be in
  2809. # Cygwin format). Returns an empty string on error.
  2810. #
  2811. # ARGS are passed to cygpath, with the last one being the file name or path to
  2812. # be converted.
  2813. #
  2814. # Specify the absolute *nix (or w32) name to cygpath in the LT_CYGPATH
  2815. # environment variable; do not put it in $PATH.
  2816. func_cygpath ()
  2817. {
  2818. $debug_cmd
  2819. if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then
  2820. func_cygpath_result=`$LT_CYGPATH "$@" 2>/dev/null`
  2821. if test "$?" -ne 0; then
  2822. # on failure, ensure result is empty
  2823. func_cygpath_result=
  2824. fi
  2825. else
  2826. func_cygpath_result=
  2827. func_error "LT_CYGPATH is empty or specifies non-existent file: '$LT_CYGPATH'"
  2828. fi
  2829. }
  2830. #end: func_cygpath
  2831. # func_convert_core_msys_to_w32 ARG
  2832. # Convert file name or path ARG from MSYS format to w32 format. Return
  2833. # result in func_convert_core_msys_to_w32_result.
  2834. func_convert_core_msys_to_w32 ()
  2835. {
  2836. $debug_cmd
  2837. # awkward: cmd appends spaces to result
  2838. func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null |
  2839. $SED -e 's/[ ]*$//' -e "$sed_naive_backslashify"`
  2840. }
  2841. #end: func_convert_core_msys_to_w32
  2842. # func_convert_file_check ARG1 ARG2
  2843. # Verify that ARG1 (a file name in $build format) was converted to $host
  2844. # format in ARG2. Otherwise, emit an error message, but continue (resetting
  2845. # func_to_host_file_result to ARG1).
  2846. func_convert_file_check ()
  2847. {
  2848. $debug_cmd
  2849. if test -z "$2" && test -n "$1"; then
  2850. func_error "Could not determine host file name corresponding to"
  2851. func_error " '$1'"
  2852. func_error "Continuing, but uninstalled executables may not work."
  2853. # Fallback:
  2854. func_to_host_file_result=$1
  2855. fi
  2856. }
  2857. # end func_convert_file_check
  2858. # func_convert_path_check FROM_PATHSEP TO_PATHSEP FROM_PATH TO_PATH
  2859. # Verify that FROM_PATH (a path in $build format) was converted to $host
  2860. # format in TO_PATH. Otherwise, emit an error message, but continue, resetting
  2861. # func_to_host_file_result to a simplistic fallback value (see below).
  2862. func_convert_path_check ()
  2863. {
  2864. $debug_cmd
  2865. if test -z "$4" && test -n "$3"; then
  2866. func_error "Could not determine the host path corresponding to"
  2867. func_error " '$3'"
  2868. func_error "Continuing, but uninstalled executables may not work."
  2869. # Fallback. This is a deliberately simplistic "conversion" and
  2870. # should not be "improved". See libtool.info.
  2871. if test "x$1" != "x$2"; then
  2872. lt_replace_pathsep_chars="s|$1|$2|g"
  2873. func_to_host_path_result=`echo "$3" |
  2874. $SED -e "$lt_replace_pathsep_chars"`
  2875. else
  2876. func_to_host_path_result=$3
  2877. fi
  2878. fi
  2879. }
  2880. # end func_convert_path_check
  2881. # func_convert_path_front_back_pathsep FRONTPAT BACKPAT REPL ORIG
  2882. # Modifies func_to_host_path_result by prepending REPL if ORIG matches FRONTPAT
  2883. # and appending REPL if ORIG matches BACKPAT.
  2884. func_convert_path_front_back_pathsep ()
  2885. {
  2886. $debug_cmd
  2887. case $4 in
  2888. $1 ) func_to_host_path_result=$3$func_to_host_path_result
  2889. ;;
  2890. esac
  2891. case $4 in
  2892. $2 ) func_append func_to_host_path_result "$3"
  2893. ;;
  2894. esac
  2895. }
  2896. # end func_convert_path_front_back_pathsep
  2897. ##################################################
  2898. # $build to $host FILE NAME CONVERSION FUNCTIONS #
  2899. ##################################################
  2900. # invoked via '$to_host_file_cmd ARG'
  2901. #
  2902. # In each case, ARG is the path to be converted from $build to $host format.
  2903. # Result will be available in $func_to_host_file_result.
  2904. # func_to_host_file ARG
  2905. # Converts the file name ARG from $build format to $host format. Return result
  2906. # in func_to_host_file_result.
  2907. func_to_host_file ()
  2908. {
  2909. $debug_cmd
  2910. $to_host_file_cmd "$1"
  2911. }
  2912. # end func_to_host_file
  2913. # func_to_tool_file ARG LAZY
  2914. # converts the file name ARG from $build format to toolchain format. Return
  2915. # result in func_to_tool_file_result. If the conversion in use is listed
  2916. # in (the comma separated) LAZY, no conversion takes place.
  2917. func_to_tool_file ()
  2918. {
  2919. $debug_cmd
  2920. case ,$2, in
  2921. *,"$to_tool_file_cmd",*)
  2922. func_to_tool_file_result=$1
  2923. ;;
  2924. *)
  2925. $to_tool_file_cmd "$1"
  2926. func_to_tool_file_result=$func_to_host_file_result
  2927. ;;
  2928. esac
  2929. }
  2930. # end func_to_tool_file
  2931. # func_convert_file_noop ARG
  2932. # Copy ARG to func_to_host_file_result.
  2933. func_convert_file_noop ()
  2934. {
  2935. func_to_host_file_result=$1
  2936. }
  2937. # end func_convert_file_noop
  2938. # func_convert_file_msys_to_w32 ARG
  2939. # Convert file name ARG from (mingw) MSYS to (mingw) w32 format; automatic
  2940. # conversion to w32 is not available inside the cwrapper. Returns result in
  2941. # func_to_host_file_result.
  2942. func_convert_file_msys_to_w32 ()
  2943. {
  2944. $debug_cmd
  2945. func_to_host_file_result=$1
  2946. if test -n "$1"; then
  2947. func_convert_core_msys_to_w32 "$1"
  2948. func_to_host_file_result=$func_convert_core_msys_to_w32_result
  2949. fi
  2950. func_convert_file_check "$1" "$func_to_host_file_result"
  2951. }
  2952. # end func_convert_file_msys_to_w32
  2953. # func_convert_file_cygwin_to_w32 ARG
  2954. # Convert file name ARG from Cygwin to w32 format. Returns result in
  2955. # func_to_host_file_result.
  2956. func_convert_file_cygwin_to_w32 ()
  2957. {
  2958. $debug_cmd
  2959. func_to_host_file_result=$1
  2960. if test -n "$1"; then
  2961. # because $build is cygwin, we call "the" cygpath in $PATH; no need to use
  2962. # LT_CYGPATH in this case.
  2963. func_to_host_file_result=`cygpath -m "$1"`
  2964. fi
  2965. func_convert_file_check "$1" "$func_to_host_file_result"
  2966. }
  2967. # end func_convert_file_cygwin_to_w32
  2968. # func_convert_file_nix_to_w32 ARG
  2969. # Convert file name ARG from *nix to w32 format. Requires a wine environment
  2970. # and a working winepath. Returns result in func_to_host_file_result.
  2971. func_convert_file_nix_to_w32 ()
  2972. {
  2973. $debug_cmd
  2974. func_to_host_file_result=$1
  2975. if test -n "$1"; then
  2976. func_convert_core_file_wine_to_w32 "$1"
  2977. func_to_host_file_result=$func_convert_core_file_wine_to_w32_result
  2978. fi
  2979. func_convert_file_check "$1" "$func_to_host_file_result"
  2980. }
  2981. # end func_convert_file_nix_to_w32
  2982. # func_convert_file_msys_to_cygwin ARG
  2983. # Convert file name ARG from MSYS to Cygwin format. Requires LT_CYGPATH set.
  2984. # Returns result in func_to_host_file_result.
  2985. func_convert_file_msys_to_cygwin ()
  2986. {
  2987. $debug_cmd
  2988. func_to_host_file_result=$1
  2989. if test -n "$1"; then
  2990. func_convert_core_msys_to_w32 "$1"
  2991. func_cygpath -u "$func_convert_core_msys_to_w32_result"
  2992. func_to_host_file_result=$func_cygpath_result
  2993. fi
  2994. func_convert_file_check "$1" "$func_to_host_file_result"
  2995. }
  2996. # end func_convert_file_msys_to_cygwin
  2997. # func_convert_file_nix_to_cygwin ARG
  2998. # Convert file name ARG from *nix to Cygwin format. Requires Cygwin installed
  2999. # in a wine environment, working winepath, and LT_CYGPATH set. Returns result
  3000. # in func_to_host_file_result.
  3001. func_convert_file_nix_to_cygwin ()
  3002. {
  3003. $debug_cmd
  3004. func_to_host_file_result=$1
  3005. if test -n "$1"; then
  3006. # convert from *nix to w32, then use cygpath to convert from w32 to cygwin.
  3007. func_convert_core_file_wine_to_w32 "$1"
  3008. func_cygpath -u "$func_convert_core_file_wine_to_w32_result"
  3009. func_to_host_file_result=$func_cygpath_result
  3010. fi
  3011. func_convert_file_check "$1" "$func_to_host_file_result"
  3012. }
  3013. # end func_convert_file_nix_to_cygwin
  3014. #############################################
  3015. # $build to $host PATH CONVERSION FUNCTIONS #
  3016. #############################################
  3017. # invoked via '$to_host_path_cmd ARG'
  3018. #
  3019. # In each case, ARG is the path to be converted from $build to $host format.
  3020. # The result will be available in $func_to_host_path_result.
  3021. #
  3022. # Path separators are also converted from $build format to $host format. If
  3023. # ARG begins or ends with a path separator character, it is preserved (but
  3024. # converted to $host format) on output.
  3025. #
  3026. # All path conversion functions are named using the following convention:
  3027. # file name conversion function : func_convert_file_X_to_Y ()
  3028. # path conversion function : func_convert_path_X_to_Y ()
  3029. # where, for any given $build/$host combination the 'X_to_Y' value is the
  3030. # same. If conversion functions are added for new $build/$host combinations,
  3031. # the two new functions must follow this pattern, or func_init_to_host_path_cmd
  3032. # will break.
  3033. # func_init_to_host_path_cmd
  3034. # Ensures that function "pointer" variable $to_host_path_cmd is set to the
  3035. # appropriate value, based on the value of $to_host_file_cmd.
  3036. to_host_path_cmd=
  3037. func_init_to_host_path_cmd ()
  3038. {
  3039. $debug_cmd
  3040. if test -z "$to_host_path_cmd"; then
  3041. func_stripname 'func_convert_file_' '' "$to_host_file_cmd"
  3042. to_host_path_cmd=func_convert_path_$func_stripname_result
  3043. fi
  3044. }
  3045. # func_to_host_path ARG
  3046. # Converts the path ARG from $build format to $host format. Return result
  3047. # in func_to_host_path_result.
  3048. func_to_host_path ()
  3049. {
  3050. $debug_cmd
  3051. func_init_to_host_path_cmd
  3052. $to_host_path_cmd "$1"
  3053. }
  3054. # end func_to_host_path
  3055. # func_convert_path_noop ARG
  3056. # Copy ARG to func_to_host_path_result.
  3057. func_convert_path_noop ()
  3058. {
  3059. func_to_host_path_result=$1
  3060. }
  3061. # end func_convert_path_noop
  3062. # func_convert_path_msys_to_w32 ARG
  3063. # Convert path ARG from (mingw) MSYS to (mingw) w32 format; automatic
  3064. # conversion to w32 is not available inside the cwrapper. Returns result in
  3065. # func_to_host_path_result.
  3066. func_convert_path_msys_to_w32 ()
  3067. {
  3068. $debug_cmd
  3069. func_to_host_path_result=$1
  3070. if test -n "$1"; then
  3071. # Remove leading and trailing path separator characters from ARG. MSYS
  3072. # behavior is inconsistent here; cygpath turns them into '.;' and ';.';
  3073. # and winepath ignores them completely.
  3074. func_stripname : : "$1"
  3075. func_to_host_path_tmp1=$func_stripname_result
  3076. func_convert_core_msys_to_w32 "$func_to_host_path_tmp1"
  3077. func_to_host_path_result=$func_convert_core_msys_to_w32_result
  3078. func_convert_path_check : ";" \
  3079. "$func_to_host_path_tmp1" "$func_to_host_path_result"
  3080. func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
  3081. fi
  3082. }
  3083. # end func_convert_path_msys_to_w32
  3084. # func_convert_path_cygwin_to_w32 ARG
  3085. # Convert path ARG from Cygwin to w32 format. Returns result in
  3086. # func_to_host_file_result.
  3087. func_convert_path_cygwin_to_w32 ()
  3088. {
  3089. $debug_cmd
  3090. func_to_host_path_result=$1
  3091. if test -n "$1"; then
  3092. # See func_convert_path_msys_to_w32:
  3093. func_stripname : : "$1"
  3094. func_to_host_path_tmp1=$func_stripname_result
  3095. func_to_host_path_result=`cygpath -m -p "$func_to_host_path_tmp1"`
  3096. func_convert_path_check : ";" \
  3097. "$func_to_host_path_tmp1" "$func_to_host_path_result"
  3098. func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
  3099. fi
  3100. }
  3101. # end func_convert_path_cygwin_to_w32
  3102. # func_convert_path_nix_to_w32 ARG
  3103. # Convert path ARG from *nix to w32 format. Requires a wine environment and
  3104. # a working winepath. Returns result in func_to_host_file_result.
  3105. func_convert_path_nix_to_w32 ()
  3106. {
  3107. $debug_cmd
  3108. func_to_host_path_result=$1
  3109. if test -n "$1"; then
  3110. # See func_convert_path_msys_to_w32:
  3111. func_stripname : : "$1"
  3112. func_to_host_path_tmp1=$func_stripname_result
  3113. func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1"
  3114. func_to_host_path_result=$func_convert_core_path_wine_to_w32_result
  3115. func_convert_path_check : ";" \
  3116. "$func_to_host_path_tmp1" "$func_to_host_path_result"
  3117. func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
  3118. fi
  3119. }
  3120. # end func_convert_path_nix_to_w32
  3121. # func_convert_path_msys_to_cygwin ARG
  3122. # Convert path ARG from MSYS to Cygwin format. Requires LT_CYGPATH set.
  3123. # Returns result in func_to_host_file_result.
  3124. func_convert_path_msys_to_cygwin ()
  3125. {
  3126. $debug_cmd
  3127. func_to_host_path_result=$1
  3128. if test -n "$1"; then
  3129. # See func_convert_path_msys_to_w32:
  3130. func_stripname : : "$1"
  3131. func_to_host_path_tmp1=$func_stripname_result
  3132. func_convert_core_msys_to_w32 "$func_to_host_path_tmp1"
  3133. func_cygpath -u -p "$func_convert_core_msys_to_w32_result"
  3134. func_to_host_path_result=$func_cygpath_result
  3135. func_convert_path_check : : \
  3136. "$func_to_host_path_tmp1" "$func_to_host_path_result"
  3137. func_convert_path_front_back_pathsep ":*" "*:" : "$1"
  3138. fi
  3139. }
  3140. # end func_convert_path_msys_to_cygwin
  3141. # func_convert_path_nix_to_cygwin ARG
  3142. # Convert path ARG from *nix to Cygwin format. Requires Cygwin installed in a
  3143. # a wine environment, working winepath, and LT_CYGPATH set. Returns result in
  3144. # func_to_host_file_result.
  3145. func_convert_path_nix_to_cygwin ()
  3146. {
  3147. $debug_cmd
  3148. func_to_host_path_result=$1
  3149. if test -n "$1"; then
  3150. # Remove leading and trailing path separator characters from
  3151. # ARG. msys behavior is inconsistent here, cygpath turns them
  3152. # into '.;' and ';.', and winepath ignores them completely.
  3153. func_stripname : : "$1"
  3154. func_to_host_path_tmp1=$func_stripname_result
  3155. func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1"
  3156. func_cygpath -u -p "$func_convert_core_path_wine_to_w32_result"
  3157. func_to_host_path_result=$func_cygpath_result
  3158. func_convert_path_check : : \
  3159. "$func_to_host_path_tmp1" "$func_to_host_path_result"
  3160. func_convert_path_front_back_pathsep ":*" "*:" : "$1"
  3161. fi
  3162. }
  3163. # end func_convert_path_nix_to_cygwin
  3164. # func_dll_def_p FILE
  3165. # True iff FILE is a Windows DLL '.def' file.
  3166. # Keep in sync with _LT_DLL_DEF_P in libtool.m4
  3167. func_dll_def_p ()
  3168. {
  3169. $debug_cmd
  3170. func_dll_def_p_tmp=`$SED -n \
  3171. -e 's/^[ ]*//' \
  3172. -e '/^\(;.*\)*$/d' \
  3173. -e 's/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p' \
  3174. -e q \
  3175. "$1"`
  3176. test DEF = "$func_dll_def_p_tmp"
  3177. }
  3178. # func_mode_compile arg...
  3179. func_mode_compile ()
  3180. {
  3181. $debug_cmd
  3182. # Get the compilation command and the source file.
  3183. base_compile=
  3184. srcfile=$nonopt # always keep a non-empty value in "srcfile"
  3185. suppress_opt=yes
  3186. suppress_output=
  3187. arg_mode=normal
  3188. libobj=
  3189. later=
  3190. pie_flag=
  3191. for arg
  3192. do
  3193. case $arg_mode in
  3194. arg )
  3195. # do not "continue". Instead, add this to base_compile
  3196. lastarg=$arg
  3197. arg_mode=normal
  3198. ;;
  3199. target )
  3200. libobj=$arg
  3201. arg_mode=normal
  3202. continue
  3203. ;;
  3204. normal )
  3205. # Accept any command-line options.
  3206. case $arg in
  3207. -o)
  3208. test -n "$libobj" && \
  3209. func_fatal_error "you cannot specify '-o' more than once"
  3210. arg_mode=target
  3211. continue
  3212. ;;
  3213. -pie | -fpie | -fPIE)
  3214. func_append pie_flag " $arg"
  3215. continue
  3216. ;;
  3217. -shared | -static | -prefer-pic | -prefer-non-pic)
  3218. func_append later " $arg"
  3219. continue
  3220. ;;
  3221. -no-suppress)
  3222. suppress_opt=no
  3223. continue
  3224. ;;
  3225. -Xcompiler)
  3226. arg_mode=arg # the next one goes into the "base_compile" arg list
  3227. continue # The current "srcfile" will either be retained or
  3228. ;; # replaced later. I would guess that would be a bug.
  3229. -Wc,*)
  3230. func_stripname '-Wc,' '' "$arg"
  3231. args=$func_stripname_result
  3232. lastarg=
  3233. save_ifs=$IFS; IFS=,
  3234. for arg in $args; do
  3235. IFS=$save_ifs
  3236. func_append_quoted lastarg "$arg"
  3237. done
  3238. IFS=$save_ifs
  3239. func_stripname ' ' '' "$lastarg"
  3240. lastarg=$func_stripname_result
  3241. # Add the arguments to base_compile.
  3242. func_append base_compile " $lastarg"
  3243. continue
  3244. ;;
  3245. *)
  3246. # Accept the current argument as the source file.
  3247. # The previous "srcfile" becomes the current argument.
  3248. #
  3249. lastarg=$srcfile
  3250. srcfile=$arg
  3251. ;;
  3252. esac # case $arg
  3253. ;;
  3254. esac # case $arg_mode
  3255. # Aesthetically quote the previous argument.
  3256. func_append_quoted base_compile "$lastarg"
  3257. done # for arg
  3258. case $arg_mode in
  3259. arg)
  3260. func_fatal_error "you must specify an argument for -Xcompile"
  3261. ;;
  3262. target)
  3263. func_fatal_error "you must specify a target with '-o'"
  3264. ;;
  3265. *)
  3266. # Get the name of the library object.
  3267. test -z "$libobj" && {
  3268. func_basename "$srcfile"
  3269. libobj=$func_basename_result
  3270. }
  3271. ;;
  3272. esac
  3273. # Recognize several different file suffixes.
  3274. # If the user specifies -o file.o, it is replaced with file.lo
  3275. case $libobj in
  3276. *.[cCFSifmso] | \
  3277. *.ada | *.adb | *.ads | *.asm | \
  3278. *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \
  3279. *.[fF][09]? | *.for | *.java | *.go | *.obj | *.sx | *.cu | *.cup)
  3280. func_xform "$libobj"
  3281. libobj=$func_xform_result
  3282. ;;
  3283. esac
  3284. case $libobj in
  3285. *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;;
  3286. *)
  3287. func_fatal_error "cannot determine name of library object from '$libobj'"
  3288. ;;
  3289. esac
  3290. func_infer_tag $base_compile
  3291. for arg in $later; do
  3292. case $arg in
  3293. -shared)
  3294. test yes = "$build_libtool_libs" \
  3295. || func_fatal_configuration "cannot build a shared library"
  3296. build_old_libs=no
  3297. continue
  3298. ;;
  3299. -static)
  3300. build_libtool_libs=no
  3301. build_old_libs=yes
  3302. continue
  3303. ;;
  3304. -prefer-pic)
  3305. pic_mode=yes
  3306. continue
  3307. ;;
  3308. -prefer-non-pic)
  3309. pic_mode=no
  3310. continue
  3311. ;;
  3312. esac
  3313. done
  3314. func_quote_for_eval "$libobj"
  3315. test "X$libobj" != "X$func_quote_for_eval_result" \
  3316. && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \
  3317. && func_warning "libobj name '$libobj' may not contain shell special characters."
  3318. func_dirname_and_basename "$obj" "/" ""
  3319. objname=$func_basename_result
  3320. xdir=$func_dirname_result
  3321. lobj=$xdir$objdir/$objname
  3322. test -z "$base_compile" && \
  3323. func_fatal_help "you must specify a compilation command"
  3324. # Delete any leftover library objects.
  3325. if test yes = "$build_old_libs"; then
  3326. removelist="$obj $lobj $libobj ${libobj}T"
  3327. else
  3328. removelist="$lobj $libobj ${libobj}T"
  3329. fi
  3330. # On Cygwin there's no "real" PIC flag so we must build both object types
  3331. case $host_os in
  3332. cygwin* | mingw* | pw32* | os2* | cegcc*)
  3333. pic_mode=default
  3334. ;;
  3335. esac
  3336. if test no = "$pic_mode" && test pass_all != "$deplibs_check_method"; then
  3337. # non-PIC code in shared libraries is not supported
  3338. pic_mode=default
  3339. fi
  3340. # Calculate the filename of the output object if compiler does
  3341. # not support -o with -c
  3342. if test no = "$compiler_c_o"; then
  3343. output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.$objext
  3344. lockfile=$output_obj.lock
  3345. else
  3346. output_obj=
  3347. need_locks=no
  3348. lockfile=
  3349. fi
  3350. # Lock this critical section if it is needed
  3351. # We use this script file to make the link, it avoids creating a new file
  3352. if test yes = "$need_locks"; then
  3353. until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
  3354. func_echo "Waiting for $lockfile to be removed"
  3355. sleep 2
  3356. done
  3357. elif test warn = "$need_locks"; then
  3358. if test -f "$lockfile"; then
  3359. $ECHO "\
  3360. *** ERROR, $lockfile exists and contains:
  3361. `cat $lockfile 2>/dev/null`
  3362. This indicates that another process is trying to use the same
  3363. temporary object file, and libtool could not work around it because
  3364. your compiler does not support '-c' and '-o' together. If you
  3365. repeat this compilation, it may succeed, by chance, but you had better
  3366. avoid parallel builds (make -j) in this platform, or get a better
  3367. compiler."
  3368. $opt_dry_run || $RM $removelist
  3369. exit $EXIT_FAILURE
  3370. fi
  3371. func_append removelist " $output_obj"
  3372. $ECHO "$srcfile" > "$lockfile"
  3373. fi
  3374. $opt_dry_run || $RM $removelist
  3375. func_append removelist " $lockfile"
  3376. trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15
  3377. func_to_tool_file "$srcfile" func_convert_file_msys_to_w32
  3378. srcfile=$func_to_tool_file_result
  3379. func_quote_for_eval "$srcfile"
  3380. qsrcfile=$func_quote_for_eval_result
  3381. # Only build a PIC object if we are building libtool libraries.
  3382. if test yes = "$build_libtool_libs"; then
  3383. # Without this assignment, base_compile gets emptied.
  3384. fbsd_hideous_sh_bug=$base_compile
  3385. if test no != "$pic_mode"; then
  3386. command="$base_compile $qsrcfile $pic_flag"
  3387. else
  3388. # Don't build PIC code
  3389. command="$base_compile $qsrcfile"
  3390. fi
  3391. func_mkdir_p "$xdir$objdir"
  3392. if test -z "$output_obj"; then
  3393. # Place PIC objects in $objdir
  3394. func_append command " -o $lobj"
  3395. fi
  3396. func_show_eval_locale "$command" \
  3397. 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE'
  3398. if test warn = "$need_locks" &&
  3399. test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
  3400. $ECHO "\
  3401. *** ERROR, $lockfile contains:
  3402. `cat $lockfile 2>/dev/null`
  3403. but it should contain:
  3404. $srcfile
  3405. This indicates that another process is trying to use the same
  3406. temporary object file, and libtool could not work around it because
  3407. your compiler does not support '-c' and '-o' together. If you
  3408. repeat this compilation, it may succeed, by chance, but you had better
  3409. avoid parallel builds (make -j) in this platform, or get a better
  3410. compiler."
  3411. $opt_dry_run || $RM $removelist
  3412. exit $EXIT_FAILURE
  3413. fi
  3414. # Just move the object if needed, then go on to compile the next one
  3415. if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
  3416. func_show_eval '$MV "$output_obj" "$lobj"' \
  3417. 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
  3418. fi
  3419. # Allow error messages only from the first compilation.
  3420. if test yes = "$suppress_opt"; then
  3421. suppress_output=' >/dev/null 2>&1'
  3422. fi
  3423. fi
  3424. # Only build a position-dependent object if we build old libraries.
  3425. if test yes = "$build_old_libs"; then
  3426. if test yes != "$pic_mode"; then
  3427. # Don't build PIC code
  3428. command="$base_compile $qsrcfile$pie_flag"
  3429. else
  3430. command="$base_compile $qsrcfile $pic_flag"
  3431. fi
  3432. if test yes = "$compiler_c_o"; then
  3433. func_append command " -o $obj"
  3434. fi
  3435. # Suppress compiler output if we already did a PIC compilation.
  3436. func_append command "$suppress_output"
  3437. func_show_eval_locale "$command" \
  3438. '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE'
  3439. if test warn = "$need_locks" &&
  3440. test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
  3441. $ECHO "\
  3442. *** ERROR, $lockfile contains:
  3443. `cat $lockfile 2>/dev/null`
  3444. but it should contain:
  3445. $srcfile
  3446. This indicates that another process is trying to use the same
  3447. temporary object file, and libtool could not work around it because
  3448. your compiler does not support '-c' and '-o' together. If you
  3449. repeat this compilation, it may succeed, by chance, but you had better
  3450. avoid parallel builds (make -j) in this platform, or get a better
  3451. compiler."
  3452. $opt_dry_run || $RM $removelist
  3453. exit $EXIT_FAILURE
  3454. fi
  3455. # Just move the object if needed
  3456. if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
  3457. func_show_eval '$MV "$output_obj" "$obj"' \
  3458. 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
  3459. fi
  3460. fi
  3461. $opt_dry_run || {
  3462. func_write_libtool_object "$libobj" "$objdir/$objname" "$objname"
  3463. # Unlock the critical section if it was locked
  3464. if test no != "$need_locks"; then
  3465. removelist=$lockfile
  3466. $RM "$lockfile"
  3467. fi
  3468. }
  3469. exit $EXIT_SUCCESS
  3470. }
  3471. $opt_help || {
  3472. test compile = "$opt_mode" && func_mode_compile ${1+"$@"}
  3473. }
  3474. func_mode_help ()
  3475. {
  3476. # We need to display help for each of the modes.
  3477. case $opt_mode in
  3478. "")
  3479. # Generic help is extracted from the usage comments
  3480. # at the start of this file.
  3481. func_help
  3482. ;;
  3483. clean)
  3484. $ECHO \
  3485. "Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
  3486. Remove files from the build directory.
  3487. RM is the name of the program to use to delete files associated with each FILE
  3488. (typically '/bin/rm'). RM-OPTIONS are options (such as '-f') to be passed
  3489. to RM.
  3490. If FILE is a libtool library, object or program, all the files associated
  3491. with it are deleted. Otherwise, only FILE itself is deleted using RM."
  3492. ;;
  3493. compile)
  3494. $ECHO \
  3495. "Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
  3496. Compile a source file into a libtool library object.
  3497. This mode accepts the following additional options:
  3498. -o OUTPUT-FILE set the output file name to OUTPUT-FILE
  3499. -no-suppress do not suppress compiler output for multiple passes
  3500. -prefer-pic try to build PIC objects only
  3501. -prefer-non-pic try to build non-PIC objects only
  3502. -shared do not build a '.o' file suitable for static linking
  3503. -static only build a '.o' file suitable for static linking
  3504. -Wc,FLAG pass FLAG directly to the compiler
  3505. COMPILE-COMMAND is a command to be used in creating a 'standard' object file
  3506. from the given SOURCEFILE.
  3507. The output file name is determined by removing the directory component from
  3508. SOURCEFILE, then substituting the C source code suffix '.c' with the
  3509. library object suffix, '.lo'."
  3510. ;;
  3511. execute)
  3512. $ECHO \
  3513. "Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]...
  3514. Automatically set library path, then run a program.
  3515. This mode accepts the following additional options:
  3516. -dlopen FILE add the directory containing FILE to the library path
  3517. This mode sets the library path environment variable according to '-dlopen'
  3518. flags.
  3519. If any of the ARGS are libtool executable wrappers, then they are translated
  3520. into their corresponding uninstalled binary, and any of their required library
  3521. directories are added to the library path.
  3522. Then, COMMAND is executed, with ARGS as arguments."
  3523. ;;
  3524. finish)
  3525. $ECHO \
  3526. "Usage: $progname [OPTION]... --mode=finish [LIBDIR]...
  3527. Complete the installation of libtool libraries.
  3528. Each LIBDIR is a directory that contains libtool libraries.
  3529. The commands that this mode executes may require superuser privileges. Use
  3530. the '--dry-run' option if you just want to see what would be executed."
  3531. ;;
  3532. install)
  3533. $ECHO \
  3534. "Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND...
  3535. Install executables or libraries.
  3536. INSTALL-COMMAND is the installation command. The first component should be
  3537. either the 'install' or 'cp' program.
  3538. The following components of INSTALL-COMMAND are treated specially:
  3539. -inst-prefix-dir PREFIX-DIR Use PREFIX-DIR as a staging area for installation
  3540. The rest of the components are interpreted as arguments to that command (only
  3541. BSD-compatible install options are recognized)."
  3542. ;;
  3543. link)
  3544. $ECHO \
  3545. "Usage: $progname [OPTION]... --mode=link LINK-COMMAND...
  3546. Link object files or libraries together to form another library, or to
  3547. create an executable program.
  3548. LINK-COMMAND is a command using the C compiler that you would use to create
  3549. a program from several object files.
  3550. The following components of LINK-COMMAND are treated specially:
  3551. -all-static do not do any dynamic linking at all
  3552. -avoid-version do not add a version suffix if possible
  3553. -bindir BINDIR specify path to binaries directory (for systems where
  3554. libraries must be found in the PATH setting at runtime)
  3555. -dlopen FILE '-dlpreopen' FILE if it cannot be dlopened at runtime
  3556. -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
  3557. -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
  3558. -export-symbols SYMFILE
  3559. try to export only the symbols listed in SYMFILE
  3560. -export-symbols-regex REGEX
  3561. try to export only the symbols matching REGEX
  3562. -LLIBDIR search LIBDIR for required installed libraries
  3563. -lNAME OUTPUT-FILE requires the installed library libNAME
  3564. -module build a library that can dlopened
  3565. -no-fast-install disable the fast-install mode
  3566. -no-install link a not-installable executable
  3567. -no-undefined declare that a library does not refer to external symbols
  3568. -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
  3569. -objectlist FILE use a list of object files found in FILE to specify objects
  3570. -os2dllname NAME force a short DLL name on OS/2 (no effect on other OSes)
  3571. -precious-files-regex REGEX
  3572. don't remove output files matching REGEX
  3573. -release RELEASE specify package release information
  3574. -rpath LIBDIR the created library will eventually be installed in LIBDIR
  3575. -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
  3576. -shared only do dynamic linking of libtool libraries
  3577. -shrext SUFFIX override the standard shared library file extension
  3578. -static do not do any dynamic linking of uninstalled libtool libraries
  3579. -static-libtool-libs
  3580. do not do any dynamic linking of libtool libraries
  3581. -version-info CURRENT[:REVISION[:AGE]]
  3582. specify library version info [each variable defaults to 0]
  3583. -weak LIBNAME declare that the target provides the LIBNAME interface
  3584. -Wc,FLAG
  3585. -Xcompiler FLAG pass linker-specific FLAG directly to the compiler
  3586. -Wl,FLAG
  3587. -Xlinker FLAG pass linker-specific FLAG directly to the linker
  3588. -XCClinker FLAG pass link-specific FLAG to the compiler driver (CC)
  3589. All other options (arguments beginning with '-') are ignored.
  3590. Every other argument is treated as a filename. Files ending in '.la' are
  3591. treated as uninstalled libtool libraries, other files are standard or library
  3592. object files.
  3593. If the OUTPUT-FILE ends in '.la', then a libtool library is created,
  3594. only library objects ('.lo' files) may be specified, and '-rpath' is
  3595. required, except when creating a convenience library.
  3596. If OUTPUT-FILE ends in '.a' or '.lib', then a standard library is created
  3597. using 'ar' and 'ranlib', or on Windows using 'lib'.
  3598. If OUTPUT-FILE ends in '.lo' or '.$objext', then a reloadable object file
  3599. is created, otherwise an executable program is created."
  3600. ;;
  3601. uninstall)
  3602. $ECHO \
  3603. "Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
  3604. Remove libraries from an installation directory.
  3605. RM is the name of the program to use to delete files associated with each FILE
  3606. (typically '/bin/rm'). RM-OPTIONS are options (such as '-f') to be passed
  3607. to RM.
  3608. If FILE is a libtool library, all the files associated with it are deleted.
  3609. Otherwise, only FILE itself is deleted using RM."
  3610. ;;
  3611. *)
  3612. func_fatal_help "invalid operation mode '$opt_mode'"
  3613. ;;
  3614. esac
  3615. echo
  3616. $ECHO "Try '$progname --help' for more information about other modes."
  3617. }
  3618. # Now that we've collected a possible --mode arg, show help if necessary
  3619. if $opt_help; then
  3620. if test : = "$opt_help"; then
  3621. func_mode_help
  3622. else
  3623. {
  3624. func_help noexit
  3625. for opt_mode in compile link execute install finish uninstall clean; do
  3626. func_mode_help
  3627. done
  3628. } | $SED -n '1p; 2,$s/^Usage:/ or: /p'
  3629. {
  3630. func_help noexit
  3631. for opt_mode in compile link execute install finish uninstall clean; do
  3632. echo
  3633. func_mode_help
  3634. done
  3635. } |
  3636. $SED '1d
  3637. /^When reporting/,/^Report/{
  3638. H
  3639. d
  3640. }
  3641. $x
  3642. /information about other modes/d
  3643. /more detailed .*MODE/d
  3644. s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/'
  3645. fi
  3646. exit $?
  3647. fi
  3648. # func_mode_execute arg...
  3649. func_mode_execute ()
  3650. {
  3651. $debug_cmd
  3652. # The first argument is the command name.
  3653. cmd=$nonopt
  3654. test -z "$cmd" && \
  3655. func_fatal_help "you must specify a COMMAND"
  3656. # Handle -dlopen flags immediately.
  3657. for file in $opt_dlopen; do
  3658. test -f "$file" \
  3659. || func_fatal_help "'$file' is not a file"
  3660. dir=
  3661. case $file in
  3662. *.la)
  3663. func_resolve_sysroot "$file"
  3664. file=$func_resolve_sysroot_result
  3665. # Check to see that this really is a libtool archive.
  3666. func_lalib_unsafe_p "$file" \
  3667. || func_fatal_help "'$lib' is not a valid libtool archive"
  3668. # Read the libtool library.
  3669. dlname=
  3670. library_names=
  3671. func_source "$file"
  3672. # Skip this library if it cannot be dlopened.
  3673. if test -z "$dlname"; then
  3674. # Warn if it was a shared library.
  3675. test -n "$library_names" && \
  3676. func_warning "'$file' was not linked with '-export-dynamic'"
  3677. continue
  3678. fi
  3679. func_dirname "$file" "" "."
  3680. dir=$func_dirname_result
  3681. if test -f "$dir/$objdir/$dlname"; then
  3682. func_append dir "/$objdir"
  3683. else
  3684. if test ! -f "$dir/$dlname"; then
  3685. func_fatal_error "cannot find '$dlname' in '$dir' or '$dir/$objdir'"
  3686. fi
  3687. fi
  3688. ;;
  3689. *.lo)
  3690. # Just add the directory containing the .lo file.
  3691. func_dirname "$file" "" "."
  3692. dir=$func_dirname_result
  3693. ;;
  3694. *)
  3695. func_warning "'-dlopen' is ignored for non-libtool libraries and objects"
  3696. continue
  3697. ;;
  3698. esac
  3699. # Get the absolute pathname.
  3700. absdir=`cd "$dir" && pwd`
  3701. test -n "$absdir" && dir=$absdir
  3702. # Now add the directory to shlibpath_var.
  3703. if eval "test -z \"\$$shlibpath_var\""; then
  3704. eval "$shlibpath_var=\"\$dir\""
  3705. else
  3706. eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
  3707. fi
  3708. done
  3709. # This variable tells wrapper scripts just to set shlibpath_var
  3710. # rather than running their programs.
  3711. libtool_execute_magic=$magic
  3712. # Check if any of the arguments is a wrapper script.
  3713. args=
  3714. for file
  3715. do
  3716. case $file in
  3717. -* | *.la | *.lo ) ;;
  3718. *)
  3719. # Do a test to see if this is really a libtool program.
  3720. if func_ltwrapper_script_p "$file"; then
  3721. func_source "$file"
  3722. # Transform arg to wrapped name.
  3723. file=$progdir/$program
  3724. elif func_ltwrapper_executable_p "$file"; then
  3725. func_ltwrapper_scriptname "$file"
  3726. func_source "$func_ltwrapper_scriptname_result"
  3727. # Transform arg to wrapped name.
  3728. file=$progdir/$program
  3729. fi
  3730. ;;
  3731. esac
  3732. # Quote arguments (to preserve shell metacharacters).
  3733. func_append_quoted args "$file"
  3734. done
  3735. if $opt_dry_run; then
  3736. # Display what would be done.
  3737. if test -n "$shlibpath_var"; then
  3738. eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\""
  3739. echo "export $shlibpath_var"
  3740. fi
  3741. $ECHO "$cmd$args"
  3742. exit $EXIT_SUCCESS
  3743. else
  3744. if test -n "$shlibpath_var"; then
  3745. # Export the shlibpath_var.
  3746. eval "export $shlibpath_var"
  3747. fi
  3748. # Restore saved environment variables
  3749. for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
  3750. do
  3751. eval "if test \"\${save_$lt_var+set}\" = set; then
  3752. $lt_var=\$save_$lt_var; export $lt_var
  3753. else
  3754. $lt_unset $lt_var
  3755. fi"
  3756. done
  3757. # Now prepare to actually exec the command.
  3758. exec_cmd=\$cmd$args
  3759. fi
  3760. }
  3761. test execute = "$opt_mode" && func_mode_execute ${1+"$@"}
  3762. # func_mode_finish arg...
  3763. func_mode_finish ()
  3764. {
  3765. $debug_cmd
  3766. libs=
  3767. libdirs=
  3768. admincmds=
  3769. for opt in "$nonopt" ${1+"$@"}
  3770. do
  3771. if test -d "$opt"; then
  3772. func_append libdirs " $opt"
  3773. elif test -f "$opt"; then
  3774. if func_lalib_unsafe_p "$opt"; then
  3775. func_append libs " $opt"
  3776. else
  3777. func_warning "'$opt' is not a valid libtool archive"
  3778. fi
  3779. else
  3780. func_fatal_error "invalid argument '$opt'"
  3781. fi
  3782. done
  3783. if test -n "$libs"; then
  3784. if test -n "$lt_sysroot"; then
  3785. sysroot_regex=`$ECHO "$lt_sysroot" | $SED "$sed_make_literal_regex"`
  3786. sysroot_cmd="s/\([ ']\)$sysroot_regex/\1/g;"
  3787. else
  3788. sysroot_cmd=
  3789. fi
  3790. # Remove sysroot references
  3791. if $opt_dry_run; then
  3792. for lib in $libs; do
  3793. echo "removing references to $lt_sysroot and '=' prefixes from $lib"
  3794. done
  3795. else
  3796. tmpdir=`func_mktempdir`
  3797. for lib in $libs; do
  3798. $SED -e "$sysroot_cmd s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \
  3799. > $tmpdir/tmp-la
  3800. mv -f $tmpdir/tmp-la $lib
  3801. done
  3802. ${RM}r "$tmpdir"
  3803. fi
  3804. fi
  3805. if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
  3806. for libdir in $libdirs; do
  3807. if test -n "$finish_cmds"; then
  3808. # Do each command in the finish commands.
  3809. func_execute_cmds "$finish_cmds" 'admincmds="$admincmds
  3810. '"$cmd"'"'
  3811. fi
  3812. if test -n "$finish_eval"; then
  3813. # Do the single finish_eval.
  3814. eval cmds=\"$finish_eval\"
  3815. $opt_dry_run || eval "$cmds" || func_append admincmds "
  3816. $cmds"
  3817. fi
  3818. done
  3819. fi
  3820. # Exit here if they wanted silent mode.
  3821. $opt_quiet && exit $EXIT_SUCCESS
  3822. if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
  3823. echo "----------------------------------------------------------------------"
  3824. echo "Libraries have been installed in:"
  3825. for libdir in $libdirs; do
  3826. $ECHO " $libdir"
  3827. done
  3828. echo
  3829. echo "If you ever happen to want to link against installed libraries"
  3830. echo "in a given directory, LIBDIR, you must either use libtool, and"
  3831. echo "specify the full pathname of the library, or use the '-LLIBDIR'"
  3832. echo "flag during linking and do at least one of the following:"
  3833. if test -n "$shlibpath_var"; then
  3834. echo " - add LIBDIR to the '$shlibpath_var' environment variable"
  3835. echo " during execution"
  3836. fi
  3837. if test -n "$runpath_var"; then
  3838. echo " - add LIBDIR to the '$runpath_var' environment variable"
  3839. echo " during linking"
  3840. fi
  3841. if test -n "$hardcode_libdir_flag_spec"; then
  3842. libdir=LIBDIR
  3843. eval flag=\"$hardcode_libdir_flag_spec\"
  3844. $ECHO " - use the '$flag' linker flag"
  3845. fi
  3846. if test -n "$admincmds"; then
  3847. $ECHO " - have your system administrator run these commands:$admincmds"
  3848. fi
  3849. if test -f /etc/ld.so.conf; then
  3850. echo " - have your system administrator add LIBDIR to '/etc/ld.so.conf'"
  3851. fi
  3852. echo
  3853. echo "See any operating system documentation about shared libraries for"
  3854. case $host in
  3855. solaris2.[6789]|solaris2.1[0-9])
  3856. echo "more information, such as the ld(1), crle(1) and ld.so(8) manual"
  3857. echo "pages."
  3858. ;;
  3859. *)
  3860. echo "more information, such as the ld(1) and ld.so(8) manual pages."
  3861. ;;
  3862. esac
  3863. echo "----------------------------------------------------------------------"
  3864. fi
  3865. exit $EXIT_SUCCESS
  3866. }
  3867. test finish = "$opt_mode" && func_mode_finish ${1+"$@"}
  3868. # func_mode_install arg...
  3869. func_mode_install ()
  3870. {
  3871. $debug_cmd
  3872. # There may be an optional sh(1) argument at the beginning of
  3873. # install_prog (especially on Windows NT).
  3874. if test "$SHELL" = "$nonopt" || test /bin/sh = "$nonopt" ||
  3875. # Allow the use of GNU shtool's install command.
  3876. case $nonopt in *shtool*) :;; *) false;; esac
  3877. then
  3878. # Aesthetically quote it.
  3879. func_quote_for_eval "$nonopt"
  3880. install_prog="$func_quote_for_eval_result "
  3881. arg=$1
  3882. shift
  3883. else
  3884. install_prog=
  3885. arg=$nonopt
  3886. fi
  3887. # The real first argument should be the name of the installation program.
  3888. # Aesthetically quote it.
  3889. func_quote_for_eval "$arg"
  3890. func_append install_prog "$func_quote_for_eval_result"
  3891. install_shared_prog=$install_prog
  3892. case " $install_prog " in
  3893. *[\\\ /]cp\ *) install_cp=: ;;
  3894. *) install_cp=false ;;
  3895. esac
  3896. # We need to accept at least all the BSD install flags.
  3897. dest=
  3898. files=
  3899. opts=
  3900. prev=
  3901. install_type=
  3902. isdir=false
  3903. stripme=
  3904. no_mode=:
  3905. for arg
  3906. do
  3907. arg2=
  3908. if test -n "$dest"; then
  3909. func_append files " $dest"
  3910. dest=$arg
  3911. continue
  3912. fi
  3913. case $arg in
  3914. -d) isdir=: ;;
  3915. -f)
  3916. if $install_cp; then :; else
  3917. prev=$arg
  3918. fi
  3919. ;;
  3920. -g | -m | -o)
  3921. prev=$arg
  3922. ;;
  3923. -s)
  3924. stripme=" -s"
  3925. continue
  3926. ;;
  3927. -*)
  3928. ;;
  3929. *)
  3930. # If the previous option needed an argument, then skip it.
  3931. if test -n "$prev"; then
  3932. if test X-m = "X$prev" && test -n "$install_override_mode"; then
  3933. arg2=$install_override_mode
  3934. no_mode=false
  3935. fi
  3936. prev=
  3937. else
  3938. dest=$arg
  3939. continue
  3940. fi
  3941. ;;
  3942. esac
  3943. # Aesthetically quote the argument.
  3944. func_quote_for_eval "$arg"
  3945. func_append install_prog " $func_quote_for_eval_result"
  3946. if test -n "$arg2"; then
  3947. func_quote_for_eval "$arg2"
  3948. fi
  3949. func_append install_shared_prog " $func_quote_for_eval_result"
  3950. done
  3951. test -z "$install_prog" && \
  3952. func_fatal_help "you must specify an install program"
  3953. test -n "$prev" && \
  3954. func_fatal_help "the '$prev' option requires an argument"
  3955. if test -n "$install_override_mode" && $no_mode; then
  3956. if $install_cp; then :; else
  3957. func_quote_for_eval "$install_override_mode"
  3958. func_append install_shared_prog " -m $func_quote_for_eval_result"
  3959. fi
  3960. fi
  3961. if test -z "$files"; then
  3962. if test -z "$dest"; then
  3963. func_fatal_help "no file or destination specified"
  3964. else
  3965. func_fatal_help "you must specify a destination"
  3966. fi
  3967. fi
  3968. # Strip any trailing slash from the destination.
  3969. func_stripname '' '/' "$dest"
  3970. dest=$func_stripname_result
  3971. # Check to see that the destination is a directory.
  3972. test -d "$dest" && isdir=:
  3973. if $isdir; then
  3974. destdir=$dest
  3975. destname=
  3976. else
  3977. func_dirname_and_basename "$dest" "" "."
  3978. destdir=$func_dirname_result
  3979. destname=$func_basename_result
  3980. # Not a directory, so check to see that there is only one file specified.
  3981. set dummy $files; shift
  3982. test "$#" -gt 1 && \
  3983. func_fatal_help "'$dest' is not a directory"
  3984. fi
  3985. case $destdir in
  3986. [\\/]* | [A-Za-z]:[\\/]*) ;;
  3987. *)
  3988. for file in $files; do
  3989. case $file in
  3990. *.lo) ;;
  3991. *)
  3992. func_fatal_help "'$destdir' must be an absolute directory name"
  3993. ;;
  3994. esac
  3995. done
  3996. ;;
  3997. esac
  3998. # This variable tells wrapper scripts just to set variables rather
  3999. # than running their programs.
  4000. libtool_install_magic=$magic
  4001. staticlibs=
  4002. future_libdirs=
  4003. current_libdirs=
  4004. for file in $files; do
  4005. # Do each installation.
  4006. case $file in
  4007. *.$libext)
  4008. # Do the static libraries later.
  4009. func_append staticlibs " $file"
  4010. ;;
  4011. *.la)
  4012. func_resolve_sysroot "$file"
  4013. file=$func_resolve_sysroot_result
  4014. # Check to see that this really is a libtool archive.
  4015. func_lalib_unsafe_p "$file" \
  4016. || func_fatal_help "'$file' is not a valid libtool archive"
  4017. library_names=
  4018. old_library=
  4019. relink_command=
  4020. func_source "$file"
  4021. # Add the libdir to current_libdirs if it is the destination.
  4022. if test "X$destdir" = "X$libdir"; then
  4023. case "$current_libdirs " in
  4024. *" $libdir "*) ;;
  4025. *) func_append current_libdirs " $libdir" ;;
  4026. esac
  4027. else
  4028. # Note the libdir as a future libdir.
  4029. case "$future_libdirs " in
  4030. *" $libdir "*) ;;
  4031. *) func_append future_libdirs " $libdir" ;;
  4032. esac
  4033. fi
  4034. func_dirname "$file" "/" ""
  4035. dir=$func_dirname_result
  4036. func_append dir "$objdir"
  4037. if test -n "$relink_command"; then
  4038. # Determine the prefix the user has applied to our future dir.
  4039. inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"`
  4040. # Don't allow the user to place us outside of our expected
  4041. # location b/c this prevents finding dependent libraries that
  4042. # are installed to the same prefix.
  4043. # At present, this check doesn't affect windows .dll's that
  4044. # are installed into $libdir/../bin (currently, that works fine)
  4045. # but it's something to keep an eye on.
  4046. test "$inst_prefix_dir" = "$destdir" && \
  4047. func_fatal_error "error: cannot install '$file' to a directory not ending in $libdir"
  4048. if test -n "$inst_prefix_dir"; then
  4049. # Stick the inst_prefix_dir data into the link command.
  4050. relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
  4051. else
  4052. relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"`
  4053. fi
  4054. func_warning "relinking '$file'"
  4055. func_show_eval "$relink_command" \
  4056. 'func_fatal_error "error: relink '\''$file'\'' with the above command before installing it"'
  4057. fi
  4058. # See the names of the shared library.
  4059. set dummy $library_names; shift
  4060. if test -n "$1"; then
  4061. realname=$1
  4062. shift
  4063. srcname=$realname
  4064. test -n "$relink_command" && srcname=${realname}T
  4065. # Install the shared library and build the symlinks.
  4066. func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \
  4067. 'exit $?'
  4068. tstripme=$stripme
  4069. case $host_os in
  4070. cygwin* | mingw* | pw32* | cegcc*)
  4071. case $realname in
  4072. *.dll.a)
  4073. tstripme=
  4074. ;;
  4075. esac
  4076. ;;
  4077. os2*)
  4078. case $realname in
  4079. *_dll.a)
  4080. tstripme=
  4081. ;;
  4082. esac
  4083. ;;
  4084. esac
  4085. if test -n "$tstripme" && test -n "$striplib"; then
  4086. func_show_eval "$striplib $destdir/$realname" 'exit $?'
  4087. fi
  4088. if test "$#" -gt 0; then
  4089. # Delete the old symlinks, and create new ones.
  4090. # Try 'ln -sf' first, because the 'ln' binary might depend on
  4091. # the symlink we replace! Solaris /bin/ln does not understand -f,
  4092. # so we also need to try rm && ln -s.
  4093. for linkname
  4094. do
  4095. test "$linkname" != "$realname" \
  4096. && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })"
  4097. done
  4098. fi
  4099. # Do each command in the postinstall commands.
  4100. lib=$destdir/$realname
  4101. func_execute_cmds "$postinstall_cmds" 'exit $?'
  4102. fi
  4103. # Install the pseudo-library for information purposes.
  4104. func_basename "$file"
  4105. name=$func_basename_result
  4106. instname=$dir/${name}i
  4107. func_show_eval "$install_prog $instname $destdir/$name" 'exit $?'
  4108. # Maybe install the static library, too.
  4109. test -n "$old_library" && func_append staticlibs " $dir/$old_library"
  4110. ;;
  4111. *.lo)
  4112. # Install (i.e. copy) a libtool object.
  4113. # Figure out destination file name, if it wasn't already specified.
  4114. if test -n "$destname"; then
  4115. destfile=$destdir/$destname
  4116. else
  4117. func_basename "$file"
  4118. destfile=$func_basename_result
  4119. destfile=$destdir/$destfile
  4120. fi
  4121. # Deduce the name of the destination old-style object file.
  4122. case $destfile in
  4123. *.lo)
  4124. func_lo2o "$destfile"
  4125. staticdest=$func_lo2o_result
  4126. ;;
  4127. *.$objext)
  4128. staticdest=$destfile
  4129. destfile=
  4130. ;;
  4131. *)
  4132. func_fatal_help "cannot copy a libtool object to '$destfile'"
  4133. ;;
  4134. esac
  4135. # Install the libtool object if requested.
  4136. test -n "$destfile" && \
  4137. func_show_eval "$install_prog $file $destfile" 'exit $?'
  4138. # Install the old object if enabled.
  4139. if test yes = "$build_old_libs"; then
  4140. # Deduce the name of the old-style object file.
  4141. func_lo2o "$file"
  4142. staticobj=$func_lo2o_result
  4143. func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?'
  4144. fi
  4145. exit $EXIT_SUCCESS
  4146. ;;
  4147. *)
  4148. # Figure out destination file name, if it wasn't already specified.
  4149. if test -n "$destname"; then
  4150. destfile=$destdir/$destname
  4151. else
  4152. func_basename "$file"
  4153. destfile=$func_basename_result
  4154. destfile=$destdir/$destfile
  4155. fi
  4156. # If the file is missing, and there is a .exe on the end, strip it
  4157. # because it is most likely a libtool script we actually want to
  4158. # install
  4159. stripped_ext=
  4160. case $file in
  4161. *.exe)
  4162. if test ! -f "$file"; then
  4163. func_stripname '' '.exe' "$file"
  4164. file=$func_stripname_result
  4165. stripped_ext=.exe
  4166. fi
  4167. ;;
  4168. esac
  4169. # Do a test to see if this is really a libtool program.
  4170. case $host in
  4171. *cygwin* | *mingw*)
  4172. if func_ltwrapper_executable_p "$file"; then
  4173. func_ltwrapper_scriptname "$file"
  4174. wrapper=$func_ltwrapper_scriptname_result
  4175. else
  4176. func_stripname '' '.exe' "$file"
  4177. wrapper=$func_stripname_result
  4178. fi
  4179. ;;
  4180. *)
  4181. wrapper=$file
  4182. ;;
  4183. esac
  4184. if func_ltwrapper_script_p "$wrapper"; then
  4185. notinst_deplibs=
  4186. relink_command=
  4187. func_source "$wrapper"
  4188. # Check the variables that should have been set.
  4189. test -z "$generated_by_libtool_version" && \
  4190. func_fatal_error "invalid libtool wrapper script '$wrapper'"
  4191. finalize=:
  4192. for lib in $notinst_deplibs; do
  4193. # Check to see that each library is installed.
  4194. libdir=
  4195. if test -f "$lib"; then
  4196. func_source "$lib"
  4197. fi
  4198. libfile=$libdir/`$ECHO "$lib" | $SED 's%^.*/%%g'`
  4199. if test -n "$libdir" && test ! -f "$libfile"; then
  4200. func_warning "'$lib' has not been installed in '$libdir'"
  4201. finalize=false
  4202. fi
  4203. done
  4204. relink_command=
  4205. func_source "$wrapper"
  4206. outputname=
  4207. if test no = "$fast_install" && test -n "$relink_command"; then
  4208. $opt_dry_run || {
  4209. if $finalize; then
  4210. tmpdir=`func_mktempdir`
  4211. func_basename "$file$stripped_ext"
  4212. file=$func_basename_result
  4213. outputname=$tmpdir/$file
  4214. # Replace the output file specification.
  4215. relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'`
  4216. $opt_quiet || {
  4217. func_quote_for_expand "$relink_command"
  4218. eval "func_echo $func_quote_for_expand_result"
  4219. }
  4220. if eval "$relink_command"; then :
  4221. else
  4222. func_error "error: relink '$file' with the above command before installing it"
  4223. $opt_dry_run || ${RM}r "$tmpdir"
  4224. continue
  4225. fi
  4226. file=$outputname
  4227. else
  4228. func_warning "cannot relink '$file'"
  4229. fi
  4230. }
  4231. else
  4232. # Install the binary that we compiled earlier.
  4233. file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"`
  4234. fi
  4235. fi
  4236. # remove .exe since cygwin /usr/bin/install will append another
  4237. # one anyway
  4238. case $install_prog,$host in
  4239. */usr/bin/install*,*cygwin*)
  4240. case $file:$destfile in
  4241. *.exe:*.exe)
  4242. # this is ok
  4243. ;;
  4244. *.exe:*)
  4245. destfile=$destfile.exe
  4246. ;;
  4247. *:*.exe)
  4248. func_stripname '' '.exe' "$destfile"
  4249. destfile=$func_stripname_result
  4250. ;;
  4251. esac
  4252. ;;
  4253. esac
  4254. func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?'
  4255. $opt_dry_run || if test -n "$outputname"; then
  4256. ${RM}r "$tmpdir"
  4257. fi
  4258. ;;
  4259. esac
  4260. done
  4261. for file in $staticlibs; do
  4262. func_basename "$file"
  4263. name=$func_basename_result
  4264. # Set up the ranlib parameters.
  4265. oldlib=$destdir/$name
  4266. func_to_tool_file "$oldlib" func_convert_file_msys_to_w32
  4267. tool_oldlib=$func_to_tool_file_result
  4268. func_show_eval "$install_prog \$file \$oldlib" 'exit $?'
  4269. if test -n "$stripme" && test -n "$old_striplib"; then
  4270. func_show_eval "$old_striplib $tool_oldlib" 'exit $?'
  4271. fi
  4272. # Do each command in the postinstall commands.
  4273. func_execute_cmds "$old_postinstall_cmds" 'exit $?'
  4274. done
  4275. test -n "$future_libdirs" && \
  4276. func_warning "remember to run '$progname --finish$future_libdirs'"
  4277. if test -n "$current_libdirs"; then
  4278. # Maybe just do a dry run.
  4279. $opt_dry_run && current_libdirs=" -n$current_libdirs"
  4280. exec_cmd='$SHELL "$progpath" $preserve_args --finish$current_libdirs'
  4281. else
  4282. exit $EXIT_SUCCESS
  4283. fi
  4284. }
  4285. test install = "$opt_mode" && func_mode_install ${1+"$@"}
  4286. # func_generate_dlsyms outputname originator pic_p
  4287. # Extract symbols from dlprefiles and create ${outputname}S.o with
  4288. # a dlpreopen symbol table.
  4289. func_generate_dlsyms ()
  4290. {
  4291. $debug_cmd
  4292. my_outputname=$1
  4293. my_originator=$2
  4294. my_pic_p=${3-false}
  4295. my_prefix=`$ECHO "$my_originator" | $SED 's%[^a-zA-Z0-9]%_%g'`
  4296. my_dlsyms=
  4297. if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then
  4298. if test -n "$NM" && test -n "$global_symbol_pipe"; then
  4299. my_dlsyms=${my_outputname}S.c
  4300. else
  4301. func_error "not configured to extract global symbols from dlpreopened files"
  4302. fi
  4303. fi
  4304. if test -n "$my_dlsyms"; then
  4305. case $my_dlsyms in
  4306. "") ;;
  4307. *.c)
  4308. # Discover the nlist of each of the dlfiles.
  4309. nlist=$output_objdir/$my_outputname.nm
  4310. func_show_eval "$RM $nlist ${nlist}S ${nlist}T"
  4311. # Parse the name list into a source file.
  4312. func_verbose "creating $output_objdir/$my_dlsyms"
  4313. $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\
  4314. /* $my_dlsyms - symbol resolution table for '$my_outputname' dlsym emulation. */
  4315. /* Generated by $PROGRAM (GNU $PACKAGE) $VERSION */
  4316. #ifdef __cplusplus
  4317. extern \"C\" {
  4318. #endif
  4319. #if defined __GNUC__ && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4))
  4320. #pragma GCC diagnostic ignored \"-Wstrict-prototypes\"
  4321. #endif
  4322. /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */
  4323. #if defined _WIN32 || defined __CYGWIN__ || defined _WIN32_WCE
  4324. /* DATA imports from DLLs on WIN32 can't be const, because runtime
  4325. relocations are performed -- see ld's documentation on pseudo-relocs. */
  4326. # define LT_DLSYM_CONST
  4327. #elif defined __osf__
  4328. /* This system does not cope well with relocations in const data. */
  4329. # define LT_DLSYM_CONST
  4330. #else
  4331. # define LT_DLSYM_CONST const
  4332. #endif
  4333. #define STREQ(s1, s2) (strcmp ((s1), (s2)) == 0)
  4334. /* External symbol declarations for the compiler. */\
  4335. "
  4336. if test yes = "$dlself"; then
  4337. func_verbose "generating symbol list for '$output'"
  4338. $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist"
  4339. # Add our own program objects to the symbol list.
  4340. progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP`
  4341. for progfile in $progfiles; do
  4342. func_to_tool_file "$progfile" func_convert_file_msys_to_w32
  4343. func_verbose "extracting global C symbols from '$func_to_tool_file_result'"
  4344. $opt_dry_run || eval "$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'"
  4345. done
  4346. if test -n "$exclude_expsyms"; then
  4347. $opt_dry_run || {
  4348. eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
  4349. eval '$MV "$nlist"T "$nlist"'
  4350. }
  4351. fi
  4352. if test -n "$export_symbols_regex"; then
  4353. $opt_dry_run || {
  4354. eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
  4355. eval '$MV "$nlist"T "$nlist"'
  4356. }
  4357. fi
  4358. # Prepare the list of exported symbols
  4359. if test -z "$export_symbols"; then
  4360. export_symbols=$output_objdir/$outputname.exp
  4361. $opt_dry_run || {
  4362. $RM $export_symbols
  4363. eval "$SED -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
  4364. case $host in
  4365. *cygwin* | *mingw* | *cegcc* )
  4366. eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
  4367. eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
  4368. ;;
  4369. esac
  4370. }
  4371. else
  4372. $opt_dry_run || {
  4373. eval "$SED -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
  4374. eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
  4375. eval '$MV "$nlist"T "$nlist"'
  4376. case $host in
  4377. *cygwin* | *mingw* | *cegcc* )
  4378. eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
  4379. eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
  4380. ;;
  4381. esac
  4382. }
  4383. fi
  4384. fi
  4385. for dlprefile in $dlprefiles; do
  4386. func_verbose "extracting global C symbols from '$dlprefile'"
  4387. func_basename "$dlprefile"
  4388. name=$func_basename_result
  4389. case $host in
  4390. *cygwin* | *mingw* | *cegcc* )
  4391. # if an import library, we need to obtain dlname
  4392. if func_win32_import_lib_p "$dlprefile"; then
  4393. func_tr_sh "$dlprefile"
  4394. eval "curr_lafile=\$libfile_$func_tr_sh_result"
  4395. dlprefile_dlbasename=
  4396. if test -n "$curr_lafile" && func_lalib_p "$curr_lafile"; then
  4397. # Use subshell, to avoid clobbering current variable values
  4398. dlprefile_dlname=`source "$curr_lafile" && echo "$dlname"`
  4399. if test -n "$dlprefile_dlname"; then
  4400. func_basename "$dlprefile_dlname"
  4401. dlprefile_dlbasename=$func_basename_result
  4402. else
  4403. # no lafile. user explicitly requested -dlpreopen <import library>.
  4404. $sharedlib_from_linklib_cmd "$dlprefile"
  4405. dlprefile_dlbasename=$sharedlib_from_linklib_result
  4406. fi
  4407. fi
  4408. $opt_dry_run || {
  4409. if test -n "$dlprefile_dlbasename"; then
  4410. eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"'
  4411. else
  4412. func_warning "Could not compute DLL name from $name"
  4413. eval '$ECHO ": $name " >> "$nlist"'
  4414. fi
  4415. func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
  4416. eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe |
  4417. $SED -e '/I __imp/d' -e 's/I __nm_/D /;s/_nm__//' >> '$nlist'"
  4418. }
  4419. else # not an import lib
  4420. $opt_dry_run || {
  4421. eval '$ECHO ": $name " >> "$nlist"'
  4422. func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
  4423. eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'"
  4424. }
  4425. fi
  4426. ;;
  4427. *)
  4428. $opt_dry_run || {
  4429. eval '$ECHO ": $name " >> "$nlist"'
  4430. func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
  4431. eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'"
  4432. }
  4433. ;;
  4434. esac
  4435. done
  4436. $opt_dry_run || {
  4437. # Make sure we have at least an empty file.
  4438. test -f "$nlist" || : > "$nlist"
  4439. if test -n "$exclude_expsyms"; then
  4440. $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
  4441. $MV "$nlist"T "$nlist"
  4442. fi
  4443. # Try sorting and uniquifying the output.
  4444. if $GREP -v "^: " < "$nlist" |
  4445. if sort -k 3 </dev/null >/dev/null 2>&1; then
  4446. sort -k 3
  4447. else
  4448. sort +2
  4449. fi |
  4450. uniq > "$nlist"S; then
  4451. :
  4452. else
  4453. $GREP -v "^: " < "$nlist" > "$nlist"S
  4454. fi
  4455. if test -f "$nlist"S; then
  4456. eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"'
  4457. else
  4458. echo '/* NONE */' >> "$output_objdir/$my_dlsyms"
  4459. fi
  4460. func_show_eval '$RM "${nlist}I"'
  4461. if test -n "$global_symbol_to_import"; then
  4462. eval "$global_symbol_to_import"' < "$nlist"S > "$nlist"I'
  4463. fi
  4464. echo >> "$output_objdir/$my_dlsyms" "\
  4465. /* The mapping between symbol names and symbols. */
  4466. typedef struct {
  4467. const char *name;
  4468. void *address;
  4469. } lt_dlsymlist;
  4470. extern LT_DLSYM_CONST lt_dlsymlist
  4471. lt_${my_prefix}_LTX_preloaded_symbols[];\
  4472. "
  4473. if test -s "$nlist"I; then
  4474. echo >> "$output_objdir/$my_dlsyms" "\
  4475. static void lt_syminit(void)
  4476. {
  4477. LT_DLSYM_CONST lt_dlsymlist *symbol = lt_${my_prefix}_LTX_preloaded_symbols;
  4478. for (; symbol->name; ++symbol)
  4479. {"
  4480. $SED 's/.*/ if (STREQ (symbol->name, \"&\")) symbol->address = (void *) \&&;/' < "$nlist"I >> "$output_objdir/$my_dlsyms"
  4481. echo >> "$output_objdir/$my_dlsyms" "\
  4482. }
  4483. }"
  4484. fi
  4485. echo >> "$output_objdir/$my_dlsyms" "\
  4486. LT_DLSYM_CONST lt_dlsymlist
  4487. lt_${my_prefix}_LTX_preloaded_symbols[] =
  4488. { {\"$my_originator\", (void *) 0},"
  4489. if test -s "$nlist"I; then
  4490. echo >> "$output_objdir/$my_dlsyms" "\
  4491. {\"@INIT@\", (void *) &lt_syminit},"
  4492. fi
  4493. case $need_lib_prefix in
  4494. no)
  4495. eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms"
  4496. ;;
  4497. *)
  4498. eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms"
  4499. ;;
  4500. esac
  4501. echo >> "$output_objdir/$my_dlsyms" "\
  4502. {0, (void *) 0}
  4503. };
  4504. /* This works around a problem in FreeBSD linker */
  4505. #ifdef FREEBSD_WORKAROUND
  4506. static const void *lt_preloaded_setup() {
  4507. return lt_${my_prefix}_LTX_preloaded_symbols;
  4508. }
  4509. #endif
  4510. #ifdef __cplusplus
  4511. }
  4512. #endif\
  4513. "
  4514. } # !$opt_dry_run
  4515. pic_flag_for_symtable=
  4516. case "$compile_command " in
  4517. *" -static "*) ;;
  4518. *)
  4519. case $host in
  4520. # compiling the symbol table file with pic_flag works around
  4521. # a FreeBSD bug that causes programs to crash when -lm is
  4522. # linked before any other PIC object. But we must not use
  4523. # pic_flag when linking with -static. The problem exists in
  4524. # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
  4525. *-*-freebsd2.*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
  4526. pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;;
  4527. *-*-hpux*)
  4528. pic_flag_for_symtable=" $pic_flag" ;;
  4529. *)
  4530. $my_pic_p && pic_flag_for_symtable=" $pic_flag"
  4531. ;;
  4532. esac
  4533. ;;
  4534. esac
  4535. symtab_cflags=
  4536. for arg in $LTCFLAGS; do
  4537. case $arg in
  4538. -pie | -fpie | -fPIE) ;;
  4539. *) func_append symtab_cflags " $arg" ;;
  4540. esac
  4541. done
  4542. # Now compile the dynamic symbol file.
  4543. func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?'
  4544. # Clean up the generated files.
  4545. func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T" "${nlist}I"'
  4546. # Transform the symbol file into the correct name.
  4547. symfileobj=$output_objdir/${my_outputname}S.$objext
  4548. case $host in
  4549. *cygwin* | *mingw* | *cegcc* )
  4550. if test -f "$output_objdir/$my_outputname.def"; then
  4551. compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
  4552. finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
  4553. else
  4554. compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
  4555. finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
  4556. fi
  4557. ;;
  4558. *)
  4559. compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
  4560. finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
  4561. ;;
  4562. esac
  4563. ;;
  4564. *)
  4565. func_fatal_error "unknown suffix for '$my_dlsyms'"
  4566. ;;
  4567. esac
  4568. else
  4569. # We keep going just in case the user didn't refer to
  4570. # lt_preloaded_symbols. The linker will fail if global_symbol_pipe
  4571. # really was required.
  4572. # Nullify the symbol file.
  4573. compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"`
  4574. finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"`
  4575. fi
  4576. }
  4577. # func_cygming_gnu_implib_p ARG
  4578. # This predicate returns with zero status (TRUE) if
  4579. # ARG is a GNU/binutils-style import library. Returns
  4580. # with nonzero status (FALSE) otherwise.
  4581. func_cygming_gnu_implib_p ()
  4582. {
  4583. $debug_cmd
  4584. func_to_tool_file "$1" func_convert_file_msys_to_w32
  4585. 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)$'`
  4586. test -n "$func_cygming_gnu_implib_tmp"
  4587. }
  4588. # func_cygming_ms_implib_p ARG
  4589. # This predicate returns with zero status (TRUE) if
  4590. # ARG is an MS-style import library. Returns
  4591. # with nonzero status (FALSE) otherwise.
  4592. func_cygming_ms_implib_p ()
  4593. {
  4594. $debug_cmd
  4595. func_to_tool_file "$1" func_convert_file_msys_to_w32
  4596. func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'`
  4597. test -n "$func_cygming_ms_implib_tmp"
  4598. }
  4599. # func_win32_libid arg
  4600. # return the library type of file 'arg'
  4601. #
  4602. # Need a lot of goo to handle *both* DLLs and import libs
  4603. # Has to be a shell function in order to 'eat' the argument
  4604. # that is supplied when $file_magic_command is called.
  4605. # Despite the name, also deal with 64 bit binaries.
  4606. func_win32_libid ()
  4607. {
  4608. $debug_cmd
  4609. win32_libid_type=unknown
  4610. win32_fileres=`file -L $1 2>/dev/null`
  4611. case $win32_fileres in
  4612. *ar\ archive\ import\ library*) # definitely import
  4613. win32_libid_type="x86 archive import"
  4614. ;;
  4615. *ar\ archive*) # could be an import, or static
  4616. # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD.
  4617. if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null |
  4618. $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then
  4619. case $nm_interface in
  4620. "MS dumpbin")
  4621. if func_cygming_ms_implib_p "$1" ||
  4622. func_cygming_gnu_implib_p "$1"
  4623. then
  4624. win32_nmres=import
  4625. else
  4626. win32_nmres=
  4627. fi
  4628. ;;
  4629. *)
  4630. func_to_tool_file "$1" func_convert_file_msys_to_w32
  4631. win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" |
  4632. $SED -n -e '
  4633. 1,100{
  4634. / I /{
  4635. s|.*|import|
  4636. p
  4637. q
  4638. }
  4639. }'`
  4640. ;;
  4641. esac
  4642. case $win32_nmres in
  4643. import*) win32_libid_type="x86 archive import";;
  4644. *) win32_libid_type="x86 archive static";;
  4645. esac
  4646. fi
  4647. ;;
  4648. *DLL*)
  4649. win32_libid_type="x86 DLL"
  4650. ;;
  4651. *executable*) # but shell scripts are "executable" too...
  4652. case $win32_fileres in
  4653. *MS\ Windows\ PE\ Intel*)
  4654. win32_libid_type="x86 DLL"
  4655. ;;
  4656. esac
  4657. ;;
  4658. esac
  4659. $ECHO "$win32_libid_type"
  4660. }
  4661. # func_cygming_dll_for_implib ARG
  4662. #
  4663. # Platform-specific function to extract the
  4664. # name of the DLL associated with the specified
  4665. # import library ARG.
  4666. # Invoked by eval'ing the libtool variable
  4667. # $sharedlib_from_linklib_cmd
  4668. # Result is available in the variable
  4669. # $sharedlib_from_linklib_result
  4670. func_cygming_dll_for_implib ()
  4671. {
  4672. $debug_cmd
  4673. sharedlib_from_linklib_result=`$DLLTOOL --identify-strict --identify "$1"`
  4674. }
  4675. # func_cygming_dll_for_implib_fallback_core SECTION_NAME LIBNAMEs
  4676. #
  4677. # The is the core of a fallback implementation of a
  4678. # platform-specific function to extract the name of the
  4679. # DLL associated with the specified import library LIBNAME.
  4680. #
  4681. # SECTION_NAME is either .idata$6 or .idata$7, depending
  4682. # on the platform and compiler that created the implib.
  4683. #
  4684. # Echos the name of the DLL associated with the
  4685. # specified import library.
  4686. func_cygming_dll_for_implib_fallback_core ()
  4687. {
  4688. $debug_cmd
  4689. match_literal=`$ECHO "$1" | $SED "$sed_make_literal_regex"`
  4690. $OBJDUMP -s --section "$1" "$2" 2>/dev/null |
  4691. $SED '/^Contents of section '"$match_literal"':/{
  4692. # Place marker at beginning of archive member dllname section
  4693. s/.*/====MARK====/
  4694. p
  4695. d
  4696. }
  4697. # These lines can sometimes be longer than 43 characters, but
  4698. # are always uninteresting
  4699. /:[ ]*file format pe[i]\{,1\}-/d
  4700. /^In archive [^:]*:/d
  4701. # Ensure marker is printed
  4702. /^====MARK====/p
  4703. # Remove all lines with less than 43 characters
  4704. /^.\{43\}/!d
  4705. # From remaining lines, remove first 43 characters
  4706. s/^.\{43\}//' |
  4707. $SED -n '
  4708. # Join marker and all lines until next marker into a single line
  4709. /^====MARK====/ b para
  4710. H
  4711. $ b para
  4712. b
  4713. :para
  4714. x
  4715. s/\n//g
  4716. # Remove the marker
  4717. s/^====MARK====//
  4718. # Remove trailing dots and whitespace
  4719. s/[\. \t]*$//
  4720. # Print
  4721. /./p' |
  4722. # we now have a list, one entry per line, of the stringified
  4723. # contents of the appropriate section of all members of the
  4724. # archive that possess that section. Heuristic: eliminate
  4725. # all those that have a first or second character that is
  4726. # a '.' (that is, objdump's representation of an unprintable
  4727. # character.) This should work for all archives with less than
  4728. # 0x302f exports -- but will fail for DLLs whose name actually
  4729. # begins with a literal '.' or a single character followed by
  4730. # a '.'.
  4731. #
  4732. # Of those that remain, print the first one.
  4733. $SED -e '/^\./d;/^.\./d;q'
  4734. }
  4735. # func_cygming_dll_for_implib_fallback ARG
  4736. # Platform-specific function to extract the
  4737. # name of the DLL associated with the specified
  4738. # import library ARG.
  4739. #
  4740. # This fallback implementation is for use when $DLLTOOL
  4741. # does not support the --identify-strict option.
  4742. # Invoked by eval'ing the libtool variable
  4743. # $sharedlib_from_linklib_cmd
  4744. # Result is available in the variable
  4745. # $sharedlib_from_linklib_result
  4746. func_cygming_dll_for_implib_fallback ()
  4747. {
  4748. $debug_cmd
  4749. if func_cygming_gnu_implib_p "$1"; then
  4750. # binutils import library
  4751. sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$7' "$1"`
  4752. elif func_cygming_ms_implib_p "$1"; then
  4753. # ms-generated import library
  4754. sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$6' "$1"`
  4755. else
  4756. # unknown
  4757. sharedlib_from_linklib_result=
  4758. fi
  4759. }
  4760. # func_extract_an_archive dir oldlib
  4761. func_extract_an_archive ()
  4762. {
  4763. $debug_cmd
  4764. f_ex_an_ar_dir=$1; shift
  4765. f_ex_an_ar_oldlib=$1
  4766. if test yes = "$lock_old_archive_extraction"; then
  4767. lockfile=$f_ex_an_ar_oldlib.lock
  4768. until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
  4769. func_echo "Waiting for $lockfile to be removed"
  4770. sleep 2
  4771. done
  4772. fi
  4773. func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \
  4774. 'stat=$?; rm -f "$lockfile"; exit $stat'
  4775. if test yes = "$lock_old_archive_extraction"; then
  4776. $opt_dry_run || rm -f "$lockfile"
  4777. fi
  4778. if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
  4779. :
  4780. else
  4781. func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib"
  4782. fi
  4783. }
  4784. # func_extract_archives gentop oldlib ...
  4785. func_extract_archives ()
  4786. {
  4787. $debug_cmd
  4788. my_gentop=$1; shift
  4789. my_oldlibs=${1+"$@"}
  4790. my_oldobjs=
  4791. my_xlib=
  4792. my_xabs=
  4793. my_xdir=
  4794. for my_xlib in $my_oldlibs; do
  4795. # Extract the objects.
  4796. case $my_xlib in
  4797. [\\/]* | [A-Za-z]:[\\/]*) my_xabs=$my_xlib ;;
  4798. *) my_xabs=`pwd`"/$my_xlib" ;;
  4799. esac
  4800. func_basename "$my_xlib"
  4801. my_xlib=$func_basename_result
  4802. my_xlib_u=$my_xlib
  4803. while :; do
  4804. case " $extracted_archives " in
  4805. *" $my_xlib_u "*)
  4806. func_arith $extracted_serial + 1
  4807. extracted_serial=$func_arith_result
  4808. my_xlib_u=lt$extracted_serial-$my_xlib ;;
  4809. *) break ;;
  4810. esac
  4811. done
  4812. extracted_archives="$extracted_archives $my_xlib_u"
  4813. my_xdir=$my_gentop/$my_xlib_u
  4814. func_mkdir_p "$my_xdir"
  4815. case $host in
  4816. *-darwin*)
  4817. func_verbose "Extracting $my_xabs"
  4818. # Do not bother doing anything if just a dry run
  4819. $opt_dry_run || {
  4820. darwin_orig_dir=`pwd`
  4821. cd $my_xdir || exit $?
  4822. darwin_archive=$my_xabs
  4823. darwin_curdir=`pwd`
  4824. func_basename "$darwin_archive"
  4825. darwin_base_archive=$func_basename_result
  4826. darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true`
  4827. if test -n "$darwin_arches"; then
  4828. darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'`
  4829. darwin_arch=
  4830. func_verbose "$darwin_base_archive has multiple architectures $darwin_arches"
  4831. for darwin_arch in $darwin_arches; do
  4832. func_mkdir_p "unfat-$$/$darwin_base_archive-$darwin_arch"
  4833. $LIPO -thin $darwin_arch -output "unfat-$$/$darwin_base_archive-$darwin_arch/$darwin_base_archive" "$darwin_archive"
  4834. cd "unfat-$$/$darwin_base_archive-$darwin_arch"
  4835. func_extract_an_archive "`pwd`" "$darwin_base_archive"
  4836. cd "$darwin_curdir"
  4837. $RM "unfat-$$/$darwin_base_archive-$darwin_arch/$darwin_base_archive"
  4838. done # $darwin_arches
  4839. ## Okay now we've a bunch of thin objects, gotta fatten them up :)
  4840. darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$sed_basename" | sort -u`
  4841. darwin_file=
  4842. darwin_files=
  4843. for darwin_file in $darwin_filelist; do
  4844. darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP`
  4845. $LIPO -create -output "$darwin_file" $darwin_files
  4846. done # $darwin_filelist
  4847. $RM -rf unfat-$$
  4848. cd "$darwin_orig_dir"
  4849. else
  4850. cd $darwin_orig_dir
  4851. func_extract_an_archive "$my_xdir" "$my_xabs"
  4852. fi # $darwin_arches
  4853. } # !$opt_dry_run
  4854. ;;
  4855. *)
  4856. func_extract_an_archive "$my_xdir" "$my_xabs"
  4857. ;;
  4858. esac
  4859. my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP`
  4860. done
  4861. func_extract_archives_result=$my_oldobjs
  4862. }
  4863. # func_emit_wrapper [arg=no]
  4864. #
  4865. # Emit a libtool wrapper script on stdout.
  4866. # Don't directly open a file because we may want to
  4867. # incorporate the script contents within a cygwin/mingw
  4868. # wrapper executable. Must ONLY be called from within
  4869. # func_mode_link because it depends on a number of variables
  4870. # set therein.
  4871. #
  4872. # ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR
  4873. # variable will take. If 'yes', then the emitted script
  4874. # will assume that the directory where it is stored is
  4875. # the $objdir directory. This is a cygwin/mingw-specific
  4876. # behavior.
  4877. func_emit_wrapper ()
  4878. {
  4879. func_emit_wrapper_arg1=${1-no}
  4880. $ECHO "\
  4881. #! $SHELL
  4882. # $output - temporary wrapper script for $objdir/$outputname
  4883. # Generated by $PROGRAM (GNU $PACKAGE) $VERSION
  4884. #
  4885. # The $output program cannot be directly executed until all the libtool
  4886. # libraries that it depends on are installed.
  4887. #
  4888. # This wrapper script should never be moved out of the build directory.
  4889. # If it is, it will not operate correctly.
  4890. # Sed substitution that helps us do robust quoting. It backslashifies
  4891. # metacharacters that are still active within double-quoted strings.
  4892. sed_quote_subst='$sed_quote_subst'
  4893. # Be Bourne compatible
  4894. if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
  4895. emulate sh
  4896. NULLCMD=:
  4897. # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
  4898. # is contrary to our usage. Disable this feature.
  4899. alias -g '\${1+\"\$@\"}'='\"\$@\"'
  4900. setopt NO_GLOB_SUBST
  4901. else
  4902. case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
  4903. fi
  4904. BIN_SH=xpg4; export BIN_SH # for Tru64
  4905. DUALCASE=1; export DUALCASE # for MKS sh
  4906. # The HP-UX ksh and POSIX shell print the target directory to stdout
  4907. # if CDPATH is set.
  4908. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
  4909. relink_command=\"$relink_command\"
  4910. # This environment variable determines our operation mode.
  4911. if test \"\$libtool_install_magic\" = \"$magic\"; then
  4912. # install mode needs the following variables:
  4913. generated_by_libtool_version='$macro_version'
  4914. notinst_deplibs='$notinst_deplibs'
  4915. else
  4916. # When we are sourced in execute mode, \$file and \$ECHO are already set.
  4917. if test \"\$libtool_execute_magic\" != \"$magic\"; then
  4918. file=\"\$0\""
  4919. qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"`
  4920. $ECHO "\
  4921. # A function that is used when there is no print builtin or printf.
  4922. func_fallback_echo ()
  4923. {
  4924. eval 'cat <<_LTECHO_EOF
  4925. \$1
  4926. _LTECHO_EOF'
  4927. }
  4928. ECHO=\"$qECHO\"
  4929. fi
  4930. # Very basic option parsing. These options are (a) specific to
  4931. # the libtool wrapper, (b) are identical between the wrapper
  4932. # /script/ and the wrapper /executable/ that is used only on
  4933. # windows platforms, and (c) all begin with the string "--lt-"
  4934. # (application programs are unlikely to have options that match
  4935. # this pattern).
  4936. #
  4937. # There are only two supported options: --lt-debug and
  4938. # --lt-dump-script. There is, deliberately, no --lt-help.
  4939. #
  4940. # The first argument to this parsing function should be the
  4941. # script's $0 value, followed by "$@".
  4942. lt_option_debug=
  4943. func_parse_lt_options ()
  4944. {
  4945. lt_script_arg0=\$0
  4946. shift
  4947. for lt_opt
  4948. do
  4949. case \"\$lt_opt\" in
  4950. --lt-debug) lt_option_debug=1 ;;
  4951. --lt-dump-script)
  4952. lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\`
  4953. test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=.
  4954. lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\`
  4955. cat \"\$lt_dump_D/\$lt_dump_F\"
  4956. exit 0
  4957. ;;
  4958. --lt-*)
  4959. \$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2
  4960. exit 1
  4961. ;;
  4962. esac
  4963. done
  4964. # Print the debug banner immediately:
  4965. if test -n \"\$lt_option_debug\"; then
  4966. echo \"$outputname:$output:\$LINENO: libtool wrapper (GNU $PACKAGE) $VERSION\" 1>&2
  4967. fi
  4968. }
  4969. # Used when --lt-debug. Prints its arguments to stdout
  4970. # (redirection is the responsibility of the caller)
  4971. func_lt_dump_args ()
  4972. {
  4973. lt_dump_args_N=1;
  4974. for lt_arg
  4975. do
  4976. \$ECHO \"$outputname:$output:\$LINENO: newargv[\$lt_dump_args_N]: \$lt_arg\"
  4977. lt_dump_args_N=\`expr \$lt_dump_args_N + 1\`
  4978. done
  4979. }
  4980. # Core function for launching the target application
  4981. func_exec_program_core ()
  4982. {
  4983. "
  4984. case $host in
  4985. # Backslashes separate directories on plain windows
  4986. *-*-mingw | *-*-os2* | *-cegcc*)
  4987. $ECHO "\
  4988. if test -n \"\$lt_option_debug\"; then
  4989. \$ECHO \"$outputname:$output:\$LINENO: newargv[0]: \$progdir\\\\\$program\" 1>&2
  4990. func_lt_dump_args \${1+\"\$@\"} 1>&2
  4991. fi
  4992. exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
  4993. "
  4994. ;;
  4995. *)
  4996. $ECHO "\
  4997. if test -n \"\$lt_option_debug\"; then
  4998. \$ECHO \"$outputname:$output:\$LINENO: newargv[0]: \$progdir/\$program\" 1>&2
  4999. func_lt_dump_args \${1+\"\$@\"} 1>&2
  5000. fi
  5001. exec \"\$progdir/\$program\" \${1+\"\$@\"}
  5002. "
  5003. ;;
  5004. esac
  5005. $ECHO "\
  5006. \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2
  5007. exit 1
  5008. }
  5009. # A function to encapsulate launching the target application
  5010. # Strips options in the --lt-* namespace from \$@ and
  5011. # launches target application with the remaining arguments.
  5012. func_exec_program ()
  5013. {
  5014. case \" \$* \" in
  5015. *\\ --lt-*)
  5016. for lt_wr_arg
  5017. do
  5018. case \$lt_wr_arg in
  5019. --lt-*) ;;
  5020. *) set x \"\$@\" \"\$lt_wr_arg\"; shift;;
  5021. esac
  5022. shift
  5023. done ;;
  5024. esac
  5025. func_exec_program_core \${1+\"\$@\"}
  5026. }
  5027. # Parse options
  5028. func_parse_lt_options \"\$0\" \${1+\"\$@\"}
  5029. # Find the directory that this script lives in.
  5030. thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\`
  5031. test \"x\$thisdir\" = \"x\$file\" && thisdir=.
  5032. # Follow symbolic links until we get to the real thisdir.
  5033. file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\`
  5034. while test -n \"\$file\"; do
  5035. destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\`
  5036. # If there was a directory component, then change thisdir.
  5037. if test \"x\$destdir\" != \"x\$file\"; then
  5038. case \"\$destdir\" in
  5039. [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
  5040. *) thisdir=\"\$thisdir/\$destdir\" ;;
  5041. esac
  5042. fi
  5043. file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\`
  5044. file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\`
  5045. done
  5046. # Usually 'no', except on cygwin/mingw when embedded into
  5047. # the cwrapper.
  5048. WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1
  5049. if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then
  5050. # special case for '.'
  5051. if test \"\$thisdir\" = \".\"; then
  5052. thisdir=\`pwd\`
  5053. fi
  5054. # remove .libs from thisdir
  5055. case \"\$thisdir\" in
  5056. *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;;
  5057. $objdir ) thisdir=. ;;
  5058. esac
  5059. fi
  5060. # Try to get the absolute directory name.
  5061. absdir=\`cd \"\$thisdir\" && pwd\`
  5062. test -n \"\$absdir\" && thisdir=\"\$absdir\"
  5063. "
  5064. if test yes = "$fast_install"; then
  5065. $ECHO "\
  5066. program=lt-'$outputname'$exeext
  5067. progdir=\"\$thisdir/$objdir\"
  5068. if test ! -f \"\$progdir/\$program\" ||
  5069. { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | $SED 1q\`; \\
  5070. test \"X\$file\" != \"X\$progdir/\$program\"; }; then
  5071. file=\"\$\$-\$program\"
  5072. if test ! -d \"\$progdir\"; then
  5073. $MKDIR \"\$progdir\"
  5074. else
  5075. $RM \"\$progdir/\$file\"
  5076. fi"
  5077. $ECHO "\
  5078. # relink executable if necessary
  5079. if test -n \"\$relink_command\"; then
  5080. if relink_command_output=\`eval \$relink_command 2>&1\`; then :
  5081. else
  5082. \$ECHO \"\$relink_command_output\" >&2
  5083. $RM \"\$progdir/\$file\"
  5084. exit 1
  5085. fi
  5086. fi
  5087. $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
  5088. { $RM \"\$progdir/\$program\";
  5089. $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; }
  5090. $RM \"\$progdir/\$file\"
  5091. fi"
  5092. else
  5093. $ECHO "\
  5094. program='$outputname'
  5095. progdir=\"\$thisdir/$objdir\"
  5096. "
  5097. fi
  5098. $ECHO "\
  5099. if test -f \"\$progdir/\$program\"; then"
  5100. # fixup the dll searchpath if we need to.
  5101. #
  5102. # Fix the DLL searchpath if we need to. Do this before prepending
  5103. # to shlibpath, because on Windows, both are PATH and uninstalled
  5104. # libraries must come first.
  5105. if test -n "$dllsearchpath"; then
  5106. $ECHO "\
  5107. # Add the dll search path components to the executable PATH
  5108. PATH=$dllsearchpath:\$PATH
  5109. "
  5110. fi
  5111. # Export our shlibpath_var if we have one.
  5112. if test yes = "$shlibpath_overrides_runpath" && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
  5113. $ECHO "\
  5114. # Add our own library path to $shlibpath_var
  5115. $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
  5116. # Some systems cannot cope with colon-terminated $shlibpath_var
  5117. # The second colon is a workaround for a bug in BeOS R4 sed
  5118. $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\`
  5119. export $shlibpath_var
  5120. "
  5121. fi
  5122. $ECHO "\
  5123. if test \"\$libtool_execute_magic\" != \"$magic\"; then
  5124. # Run the actual program with our arguments.
  5125. func_exec_program \${1+\"\$@\"}
  5126. fi
  5127. else
  5128. # The program doesn't exist.
  5129. \$ECHO \"\$0: error: '\$progdir/\$program' does not exist\" 1>&2
  5130. \$ECHO \"This script is just a wrapper for \$program.\" 1>&2
  5131. \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2
  5132. exit 1
  5133. fi
  5134. fi\
  5135. "
  5136. }
  5137. # func_emit_cwrapperexe_src
  5138. # emit the source code for a wrapper executable on stdout
  5139. # Must ONLY be called from within func_mode_link because
  5140. # it depends on a number of variable set therein.
  5141. func_emit_cwrapperexe_src ()
  5142. {
  5143. cat <<EOF
  5144. /* $cwrappersource - temporary wrapper executable for $objdir/$outputname
  5145. Generated by $PROGRAM (GNU $PACKAGE) $VERSION
  5146. The $output program cannot be directly executed until all the libtool
  5147. libraries that it depends on are installed.
  5148. This wrapper executable should never be moved out of the build directory.
  5149. If it is, it will not operate correctly.
  5150. */
  5151. EOF
  5152. cat <<"EOF"
  5153. #ifdef _MSC_VER
  5154. # define _CRT_SECURE_NO_DEPRECATE 1
  5155. #endif
  5156. #include <stdio.h>
  5157. #include <stdlib.h>
  5158. #ifdef _MSC_VER
  5159. # include <direct.h>
  5160. # include <process.h>
  5161. # include <io.h>
  5162. #else
  5163. # include <unistd.h>
  5164. # include <stdint.h>
  5165. # ifdef __CYGWIN__
  5166. # include <io.h>
  5167. # endif
  5168. #endif
  5169. #include <malloc.h>
  5170. #include <stdarg.h>
  5171. #include <assert.h>
  5172. #include <string.h>
  5173. #include <ctype.h>
  5174. #include <errno.h>
  5175. #include <fcntl.h>
  5176. #include <sys/stat.h>
  5177. #define STREQ(s1, s2) (strcmp ((s1), (s2)) == 0)
  5178. /* declarations of non-ANSI functions */
  5179. #if defined __MINGW32__
  5180. # ifdef __STRICT_ANSI__
  5181. int _putenv (const char *);
  5182. # endif
  5183. #elif defined __CYGWIN__
  5184. # ifdef __STRICT_ANSI__
  5185. char *realpath (const char *, char *);
  5186. int putenv (char *);
  5187. int setenv (const char *, const char *, int);
  5188. # endif
  5189. /* #elif defined other_platform || defined ... */
  5190. #endif
  5191. /* portability defines, excluding path handling macros */
  5192. #if defined _MSC_VER
  5193. # define setmode _setmode
  5194. # define stat _stat
  5195. # define chmod _chmod
  5196. # define getcwd _getcwd
  5197. # define putenv _putenv
  5198. # define S_IXUSR _S_IEXEC
  5199. #elif defined __MINGW32__
  5200. # define setmode _setmode
  5201. # define stat _stat
  5202. # define chmod _chmod
  5203. # define getcwd _getcwd
  5204. # define putenv _putenv
  5205. #elif defined __CYGWIN__
  5206. # define HAVE_SETENV
  5207. # define FOPEN_WB "wb"
  5208. /* #elif defined other platforms ... */
  5209. #endif
  5210. #if defined PATH_MAX
  5211. # define LT_PATHMAX PATH_MAX
  5212. #elif defined MAXPATHLEN
  5213. # define LT_PATHMAX MAXPATHLEN
  5214. #else
  5215. # define LT_PATHMAX 1024
  5216. #endif
  5217. #ifndef S_IXOTH
  5218. # define S_IXOTH 0
  5219. #endif
  5220. #ifndef S_IXGRP
  5221. # define S_IXGRP 0
  5222. #endif
  5223. /* path handling portability macros */
  5224. #ifndef DIR_SEPARATOR
  5225. # define DIR_SEPARATOR '/'
  5226. # define PATH_SEPARATOR ':'
  5227. #endif
  5228. #if defined _WIN32 || defined __MSDOS__ || defined __DJGPP__ || \
  5229. defined __OS2__
  5230. # define HAVE_DOS_BASED_FILE_SYSTEM
  5231. # define FOPEN_WB "wb"
  5232. # ifndef DIR_SEPARATOR_2
  5233. # define DIR_SEPARATOR_2 '\\'
  5234. # endif
  5235. # ifndef PATH_SEPARATOR_2
  5236. # define PATH_SEPARATOR_2 ';'
  5237. # endif
  5238. #endif
  5239. #ifndef DIR_SEPARATOR_2
  5240. # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
  5241. #else /* DIR_SEPARATOR_2 */
  5242. # define IS_DIR_SEPARATOR(ch) \
  5243. (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
  5244. #endif /* DIR_SEPARATOR_2 */
  5245. #ifndef PATH_SEPARATOR_2
  5246. # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
  5247. #else /* PATH_SEPARATOR_2 */
  5248. # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
  5249. #endif /* PATH_SEPARATOR_2 */
  5250. #ifndef FOPEN_WB
  5251. # define FOPEN_WB "w"
  5252. #endif
  5253. #ifndef _O_BINARY
  5254. # define _O_BINARY 0
  5255. #endif
  5256. #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type)))
  5257. #define XFREE(stale) do { \
  5258. if (stale) { free (stale); stale = 0; } \
  5259. } while (0)
  5260. #if defined LT_DEBUGWRAPPER
  5261. static int lt_debug = 1;
  5262. #else
  5263. static int lt_debug = 0;
  5264. #endif
  5265. const char *program_name = "libtool-wrapper"; /* in case xstrdup fails */
  5266. void *xmalloc (size_t num);
  5267. char *xstrdup (const char *string);
  5268. const char *base_name (const char *name);
  5269. char *find_executable (const char *wrapper);
  5270. char *chase_symlinks (const char *pathspec);
  5271. int make_executable (const char *path);
  5272. int check_executable (const char *path);
  5273. char *strendzap (char *str, const char *pat);
  5274. void lt_debugprintf (const char *file, int line, const char *fmt, ...);
  5275. void lt_fatal (const char *file, int line, const char *message, ...);
  5276. static const char *nonnull (const char *s);
  5277. static const char *nonempty (const char *s);
  5278. void lt_setenv (const char *name, const char *value);
  5279. char *lt_extend_str (const char *orig_value, const char *add, int to_end);
  5280. void lt_update_exe_path (const char *name, const char *value);
  5281. void lt_update_lib_path (const char *name, const char *value);
  5282. char **prepare_spawn (char **argv);
  5283. void lt_dump_script (FILE *f);
  5284. EOF
  5285. cat <<EOF
  5286. #if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 5)
  5287. # define externally_visible volatile
  5288. #else
  5289. # define externally_visible __attribute__((externally_visible)) volatile
  5290. #endif
  5291. externally_visible const char * MAGIC_EXE = "$magic_exe";
  5292. const char * LIB_PATH_VARNAME = "$shlibpath_var";
  5293. EOF
  5294. if test yes = "$shlibpath_overrides_runpath" && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
  5295. func_to_host_path "$temp_rpath"
  5296. cat <<EOF
  5297. const char * LIB_PATH_VALUE = "$func_to_host_path_result";
  5298. EOF
  5299. else
  5300. cat <<"EOF"
  5301. const char * LIB_PATH_VALUE = "";
  5302. EOF
  5303. fi
  5304. if test -n "$dllsearchpath"; then
  5305. func_to_host_path "$dllsearchpath:"
  5306. cat <<EOF
  5307. const char * EXE_PATH_VARNAME = "PATH";
  5308. const char * EXE_PATH_VALUE = "$func_to_host_path_result";
  5309. EOF
  5310. else
  5311. cat <<"EOF"
  5312. const char * EXE_PATH_VARNAME = "";
  5313. const char * EXE_PATH_VALUE = "";
  5314. EOF
  5315. fi
  5316. if test yes = "$fast_install"; then
  5317. cat <<EOF
  5318. const char * TARGET_PROGRAM_NAME = "lt-$outputname"; /* hopefully, no .exe */
  5319. EOF
  5320. else
  5321. cat <<EOF
  5322. const char * TARGET_PROGRAM_NAME = "$outputname"; /* hopefully, no .exe */
  5323. EOF
  5324. fi
  5325. cat <<"EOF"
  5326. #define LTWRAPPER_OPTION_PREFIX "--lt-"
  5327. static const char *ltwrapper_option_prefix = LTWRAPPER_OPTION_PREFIX;
  5328. static const char *dumpscript_opt = LTWRAPPER_OPTION_PREFIX "dump-script";
  5329. static const char *debug_opt = LTWRAPPER_OPTION_PREFIX "debug";
  5330. int
  5331. main (int argc, char *argv[])
  5332. {
  5333. char **newargz;
  5334. int newargc;
  5335. char *tmp_pathspec;
  5336. char *actual_cwrapper_path;
  5337. char *actual_cwrapper_name;
  5338. char *target_name;
  5339. char *lt_argv_zero;
  5340. int rval = 127;
  5341. int i;
  5342. program_name = (char *) xstrdup (base_name (argv[0]));
  5343. newargz = XMALLOC (char *, (size_t) argc + 1);
  5344. /* very simple arg parsing; don't want to rely on getopt
  5345. * also, copy all non cwrapper options to newargz, except
  5346. * argz[0], which is handled differently
  5347. */
  5348. newargc=0;
  5349. for (i = 1; i < argc; i++)
  5350. {
  5351. if (STREQ (argv[i], dumpscript_opt))
  5352. {
  5353. EOF
  5354. case $host in
  5355. *mingw* | *cygwin* )
  5356. # make stdout use "unix" line endings
  5357. echo " setmode(1,_O_BINARY);"
  5358. ;;
  5359. esac
  5360. cat <<"EOF"
  5361. lt_dump_script (stdout);
  5362. return 0;
  5363. }
  5364. if (STREQ (argv[i], debug_opt))
  5365. {
  5366. lt_debug = 1;
  5367. continue;
  5368. }
  5369. if (STREQ (argv[i], ltwrapper_option_prefix))
  5370. {
  5371. /* however, if there is an option in the LTWRAPPER_OPTION_PREFIX
  5372. namespace, but it is not one of the ones we know about and
  5373. have already dealt with, above (inluding dump-script), then
  5374. report an error. Otherwise, targets might begin to believe
  5375. they are allowed to use options in the LTWRAPPER_OPTION_PREFIX
  5376. namespace. The first time any user complains about this, we'll
  5377. need to make LTWRAPPER_OPTION_PREFIX a configure-time option
  5378. or a configure.ac-settable value.
  5379. */
  5380. lt_fatal (__FILE__, __LINE__,
  5381. "unrecognized %s option: '%s'",
  5382. ltwrapper_option_prefix, argv[i]);
  5383. }
  5384. /* otherwise ... */
  5385. newargz[++newargc] = xstrdup (argv[i]);
  5386. }
  5387. newargz[++newargc] = NULL;
  5388. EOF
  5389. cat <<EOF
  5390. /* The GNU banner must be the first non-error debug message */
  5391. lt_debugprintf (__FILE__, __LINE__, "libtool wrapper (GNU $PACKAGE) $VERSION\n");
  5392. EOF
  5393. cat <<"EOF"
  5394. lt_debugprintf (__FILE__, __LINE__, "(main) argv[0]: %s\n", argv[0]);
  5395. lt_debugprintf (__FILE__, __LINE__, "(main) program_name: %s\n", program_name);
  5396. tmp_pathspec = find_executable (argv[0]);
  5397. if (tmp_pathspec == NULL)
  5398. lt_fatal (__FILE__, __LINE__, "couldn't find %s", argv[0]);
  5399. lt_debugprintf (__FILE__, __LINE__,
  5400. "(main) found exe (before symlink chase) at: %s\n",
  5401. tmp_pathspec);
  5402. actual_cwrapper_path = chase_symlinks (tmp_pathspec);
  5403. lt_debugprintf (__FILE__, __LINE__,
  5404. "(main) found exe (after symlink chase) at: %s\n",
  5405. actual_cwrapper_path);
  5406. XFREE (tmp_pathspec);
  5407. actual_cwrapper_name = xstrdup (base_name (actual_cwrapper_path));
  5408. strendzap (actual_cwrapper_path, actual_cwrapper_name);
  5409. /* wrapper name transforms */
  5410. strendzap (actual_cwrapper_name, ".exe");
  5411. tmp_pathspec = lt_extend_str (actual_cwrapper_name, ".exe", 1);
  5412. XFREE (actual_cwrapper_name);
  5413. actual_cwrapper_name = tmp_pathspec;
  5414. tmp_pathspec = 0;
  5415. /* target_name transforms -- use actual target program name; might have lt- prefix */
  5416. target_name = xstrdup (base_name (TARGET_PROGRAM_NAME));
  5417. strendzap (target_name, ".exe");
  5418. tmp_pathspec = lt_extend_str (target_name, ".exe", 1);
  5419. XFREE (target_name);
  5420. target_name = tmp_pathspec;
  5421. tmp_pathspec = 0;
  5422. lt_debugprintf (__FILE__, __LINE__,
  5423. "(main) libtool target name: %s\n",
  5424. target_name);
  5425. EOF
  5426. cat <<EOF
  5427. newargz[0] =
  5428. XMALLOC (char, (strlen (actual_cwrapper_path) +
  5429. strlen ("$objdir") + 1 + strlen (actual_cwrapper_name) + 1));
  5430. strcpy (newargz[0], actual_cwrapper_path);
  5431. strcat (newargz[0], "$objdir");
  5432. strcat (newargz[0], "/");
  5433. EOF
  5434. cat <<"EOF"
  5435. /* stop here, and copy so we don't have to do this twice */
  5436. tmp_pathspec = xstrdup (newargz[0]);
  5437. /* do NOT want the lt- prefix here, so use actual_cwrapper_name */
  5438. strcat (newargz[0], actual_cwrapper_name);
  5439. /* DO want the lt- prefix here if it exists, so use target_name */
  5440. lt_argv_zero = lt_extend_str (tmp_pathspec, target_name, 1);
  5441. XFREE (tmp_pathspec);
  5442. tmp_pathspec = NULL;
  5443. EOF
  5444. case $host_os in
  5445. mingw*)
  5446. cat <<"EOF"
  5447. {
  5448. char* p;
  5449. while ((p = strchr (newargz[0], '\\')) != NULL)
  5450. {
  5451. *p = '/';
  5452. }
  5453. while ((p = strchr (lt_argv_zero, '\\')) != NULL)
  5454. {
  5455. *p = '/';
  5456. }
  5457. }
  5458. EOF
  5459. ;;
  5460. esac
  5461. cat <<"EOF"
  5462. XFREE (target_name);
  5463. XFREE (actual_cwrapper_path);
  5464. XFREE (actual_cwrapper_name);
  5465. lt_setenv ("BIN_SH", "xpg4"); /* for Tru64 */
  5466. lt_setenv ("DUALCASE", "1"); /* for MSK sh */
  5467. /* Update the DLL searchpath. EXE_PATH_VALUE ($dllsearchpath) must
  5468. be prepended before (that is, appear after) LIB_PATH_VALUE ($temp_rpath)
  5469. because on Windows, both *_VARNAMEs are PATH but uninstalled
  5470. libraries must come first. */
  5471. lt_update_exe_path (EXE_PATH_VARNAME, EXE_PATH_VALUE);
  5472. lt_update_lib_path (LIB_PATH_VARNAME, LIB_PATH_VALUE);
  5473. lt_debugprintf (__FILE__, __LINE__, "(main) lt_argv_zero: %s\n",
  5474. nonnull (lt_argv_zero));
  5475. for (i = 0; i < newargc; i++)
  5476. {
  5477. lt_debugprintf (__FILE__, __LINE__, "(main) newargz[%d]: %s\n",
  5478. i, nonnull (newargz[i]));
  5479. }
  5480. EOF
  5481. case $host_os in
  5482. mingw*)
  5483. cat <<"EOF"
  5484. /* execv doesn't actually work on mingw as expected on unix */
  5485. newargz = prepare_spawn (newargz);
  5486. rval = (int) _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz);
  5487. if (rval == -1)
  5488. {
  5489. /* failed to start process */
  5490. lt_debugprintf (__FILE__, __LINE__,
  5491. "(main) failed to launch target \"%s\": %s\n",
  5492. lt_argv_zero, nonnull (strerror (errno)));
  5493. return 127;
  5494. }
  5495. return rval;
  5496. EOF
  5497. ;;
  5498. *)
  5499. cat <<"EOF"
  5500. execv (lt_argv_zero, newargz);
  5501. return rval; /* =127, but avoids unused variable warning */
  5502. EOF
  5503. ;;
  5504. esac
  5505. cat <<"EOF"
  5506. }
  5507. void *
  5508. xmalloc (size_t num)
  5509. {
  5510. void *p = (void *) malloc (num);
  5511. if (!p)
  5512. lt_fatal (__FILE__, __LINE__, "memory exhausted");
  5513. return p;
  5514. }
  5515. char *
  5516. xstrdup (const char *string)
  5517. {
  5518. return string ? strcpy ((char *) xmalloc (strlen (string) + 1),
  5519. string) : NULL;
  5520. }
  5521. const char *
  5522. base_name (const char *name)
  5523. {
  5524. const char *base;
  5525. #if defined HAVE_DOS_BASED_FILE_SYSTEM
  5526. /* Skip over the disk name in MSDOS pathnames. */
  5527. if (isalpha ((unsigned char) name[0]) && name[1] == ':')
  5528. name += 2;
  5529. #endif
  5530. for (base = name; *name; name++)
  5531. if (IS_DIR_SEPARATOR (*name))
  5532. base = name + 1;
  5533. return base;
  5534. }
  5535. int
  5536. check_executable (const char *path)
  5537. {
  5538. struct stat st;
  5539. lt_debugprintf (__FILE__, __LINE__, "(check_executable): %s\n",
  5540. nonempty (path));
  5541. if ((!path) || (!*path))
  5542. return 0;
  5543. if ((stat (path, &st) >= 0)
  5544. && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)))
  5545. return 1;
  5546. else
  5547. return 0;
  5548. }
  5549. int
  5550. make_executable (const char *path)
  5551. {
  5552. int rval = 0;
  5553. struct stat st;
  5554. lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n",
  5555. nonempty (path));
  5556. if ((!path) || (!*path))
  5557. return 0;
  5558. if (stat (path, &st) >= 0)
  5559. {
  5560. rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR);
  5561. }
  5562. return rval;
  5563. }
  5564. /* Searches for the full path of the wrapper. Returns
  5565. newly allocated full path name if found, NULL otherwise
  5566. Does not chase symlinks, even on platforms that support them.
  5567. */
  5568. char *
  5569. find_executable (const char *wrapper)
  5570. {
  5571. int has_slash = 0;
  5572. const char *p;
  5573. const char *p_next;
  5574. /* static buffer for getcwd */
  5575. char tmp[LT_PATHMAX + 1];
  5576. size_t tmp_len;
  5577. char *concat_name;
  5578. lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n",
  5579. nonempty (wrapper));
  5580. if ((wrapper == NULL) || (*wrapper == '\0'))
  5581. return NULL;
  5582. /* Absolute path? */
  5583. #if defined HAVE_DOS_BASED_FILE_SYSTEM
  5584. if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':')
  5585. {
  5586. concat_name = xstrdup (wrapper);
  5587. if (check_executable (concat_name))
  5588. return concat_name;
  5589. XFREE (concat_name);
  5590. }
  5591. else
  5592. {
  5593. #endif
  5594. if (IS_DIR_SEPARATOR (wrapper[0]))
  5595. {
  5596. concat_name = xstrdup (wrapper);
  5597. if (check_executable (concat_name))
  5598. return concat_name;
  5599. XFREE (concat_name);
  5600. }
  5601. #if defined HAVE_DOS_BASED_FILE_SYSTEM
  5602. }
  5603. #endif
  5604. for (p = wrapper; *p; p++)
  5605. if (*p == '/')
  5606. {
  5607. has_slash = 1;
  5608. break;
  5609. }
  5610. if (!has_slash)
  5611. {
  5612. /* no slashes; search PATH */
  5613. const char *path = getenv ("PATH");
  5614. if (path != NULL)
  5615. {
  5616. for (p = path; *p; p = p_next)
  5617. {
  5618. const char *q;
  5619. size_t p_len;
  5620. for (q = p; *q; q++)
  5621. if (IS_PATH_SEPARATOR (*q))
  5622. break;
  5623. p_len = (size_t) (q - p);
  5624. p_next = (*q == '\0' ? q : q + 1);
  5625. if (p_len == 0)
  5626. {
  5627. /* empty path: current directory */
  5628. if (getcwd (tmp, LT_PATHMAX) == NULL)
  5629. lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
  5630. nonnull (strerror (errno)));
  5631. tmp_len = strlen (tmp);
  5632. concat_name =
  5633. XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
  5634. memcpy (concat_name, tmp, tmp_len);
  5635. concat_name[tmp_len] = '/';
  5636. strcpy (concat_name + tmp_len + 1, wrapper);
  5637. }
  5638. else
  5639. {
  5640. concat_name =
  5641. XMALLOC (char, p_len + 1 + strlen (wrapper) + 1);
  5642. memcpy (concat_name, p, p_len);
  5643. concat_name[p_len] = '/';
  5644. strcpy (concat_name + p_len + 1, wrapper);
  5645. }
  5646. if (check_executable (concat_name))
  5647. return concat_name;
  5648. XFREE (concat_name);
  5649. }
  5650. }
  5651. /* not found in PATH; assume curdir */
  5652. }
  5653. /* Relative path | not found in path: prepend cwd */
  5654. if (getcwd (tmp, LT_PATHMAX) == NULL)
  5655. lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
  5656. nonnull (strerror (errno)));
  5657. tmp_len = strlen (tmp);
  5658. concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
  5659. memcpy (concat_name, tmp, tmp_len);
  5660. concat_name[tmp_len] = '/';
  5661. strcpy (concat_name + tmp_len + 1, wrapper);
  5662. if (check_executable (concat_name))
  5663. return concat_name;
  5664. XFREE (concat_name);
  5665. return NULL;
  5666. }
  5667. char *
  5668. chase_symlinks (const char *pathspec)
  5669. {
  5670. #ifndef S_ISLNK
  5671. return xstrdup (pathspec);
  5672. #else
  5673. char buf[LT_PATHMAX];
  5674. struct stat s;
  5675. char *tmp_pathspec = xstrdup (pathspec);
  5676. char *p;
  5677. int has_symlinks = 0;
  5678. while (strlen (tmp_pathspec) && !has_symlinks)
  5679. {
  5680. lt_debugprintf (__FILE__, __LINE__,
  5681. "checking path component for symlinks: %s\n",
  5682. tmp_pathspec);
  5683. if (lstat (tmp_pathspec, &s) == 0)
  5684. {
  5685. if (S_ISLNK (s.st_mode) != 0)
  5686. {
  5687. has_symlinks = 1;
  5688. break;
  5689. }
  5690. /* search backwards for last DIR_SEPARATOR */
  5691. p = tmp_pathspec + strlen (tmp_pathspec) - 1;
  5692. while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
  5693. p--;
  5694. if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
  5695. {
  5696. /* no more DIR_SEPARATORS left */
  5697. break;
  5698. }
  5699. *p = '\0';
  5700. }
  5701. else
  5702. {
  5703. lt_fatal (__FILE__, __LINE__,
  5704. "error accessing file \"%s\": %s",
  5705. tmp_pathspec, nonnull (strerror (errno)));
  5706. }
  5707. }
  5708. XFREE (tmp_pathspec);
  5709. if (!has_symlinks)
  5710. {
  5711. return xstrdup (pathspec);
  5712. }
  5713. tmp_pathspec = realpath (pathspec, buf);
  5714. if (tmp_pathspec == 0)
  5715. {
  5716. lt_fatal (__FILE__, __LINE__,
  5717. "could not follow symlinks for %s", pathspec);
  5718. }
  5719. return xstrdup (tmp_pathspec);
  5720. #endif
  5721. }
  5722. char *
  5723. strendzap (char *str, const char *pat)
  5724. {
  5725. size_t len, patlen;
  5726. assert (str != NULL);
  5727. assert (pat != NULL);
  5728. len = strlen (str);
  5729. patlen = strlen (pat);
  5730. if (patlen <= len)
  5731. {
  5732. str += len - patlen;
  5733. if (STREQ (str, pat))
  5734. *str = '\0';
  5735. }
  5736. return str;
  5737. }
  5738. void
  5739. lt_debugprintf (const char *file, int line, const char *fmt, ...)
  5740. {
  5741. va_list args;
  5742. if (lt_debug)
  5743. {
  5744. (void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line);
  5745. va_start (args, fmt);
  5746. (void) vfprintf (stderr, fmt, args);
  5747. va_end (args);
  5748. }
  5749. }
  5750. static void
  5751. lt_error_core (int exit_status, const char *file,
  5752. int line, const char *mode,
  5753. const char *message, va_list ap)
  5754. {
  5755. fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode);
  5756. vfprintf (stderr, message, ap);
  5757. fprintf (stderr, ".\n");
  5758. if (exit_status >= 0)
  5759. exit (exit_status);
  5760. }
  5761. void
  5762. lt_fatal (const char *file, int line, const char *message, ...)
  5763. {
  5764. va_list ap;
  5765. va_start (ap, message);
  5766. lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap);
  5767. va_end (ap);
  5768. }
  5769. static const char *
  5770. nonnull (const char *s)
  5771. {
  5772. return s ? s : "(null)";
  5773. }
  5774. static const char *
  5775. nonempty (const char *s)
  5776. {
  5777. return (s && !*s) ? "(empty)" : nonnull (s);
  5778. }
  5779. void
  5780. lt_setenv (const char *name, const char *value)
  5781. {
  5782. lt_debugprintf (__FILE__, __LINE__,
  5783. "(lt_setenv) setting '%s' to '%s'\n",
  5784. nonnull (name), nonnull (value));
  5785. {
  5786. #ifdef HAVE_SETENV
  5787. /* always make a copy, for consistency with !HAVE_SETENV */
  5788. char *str = xstrdup (value);
  5789. setenv (name, str, 1);
  5790. #else
  5791. size_t len = strlen (name) + 1 + strlen (value) + 1;
  5792. char *str = XMALLOC (char, len);
  5793. sprintf (str, "%s=%s", name, value);
  5794. if (putenv (str) != EXIT_SUCCESS)
  5795. {
  5796. XFREE (str);
  5797. }
  5798. #endif
  5799. }
  5800. }
  5801. char *
  5802. lt_extend_str (const char *orig_value, const char *add, int to_end)
  5803. {
  5804. char *new_value;
  5805. if (orig_value && *orig_value)
  5806. {
  5807. size_t orig_value_len = strlen (orig_value);
  5808. size_t add_len = strlen (add);
  5809. new_value = XMALLOC (char, add_len + orig_value_len + 1);
  5810. if (to_end)
  5811. {
  5812. strcpy (new_value, orig_value);
  5813. strcpy (new_value + orig_value_len, add);
  5814. }
  5815. else
  5816. {
  5817. strcpy (new_value, add);
  5818. strcpy (new_value + add_len, orig_value);
  5819. }
  5820. }
  5821. else
  5822. {
  5823. new_value = xstrdup (add);
  5824. }
  5825. return new_value;
  5826. }
  5827. void
  5828. lt_update_exe_path (const char *name, const char *value)
  5829. {
  5830. lt_debugprintf (__FILE__, __LINE__,
  5831. "(lt_update_exe_path) modifying '%s' by prepending '%s'\n",
  5832. nonnull (name), nonnull (value));
  5833. if (name && *name && value && *value)
  5834. {
  5835. char *new_value = lt_extend_str (getenv (name), value, 0);
  5836. /* some systems can't cope with a ':'-terminated path #' */
  5837. size_t len = strlen (new_value);
  5838. while ((len > 0) && IS_PATH_SEPARATOR (new_value[len-1]))
  5839. {
  5840. new_value[--len] = '\0';
  5841. }
  5842. lt_setenv (name, new_value);
  5843. XFREE (new_value);
  5844. }
  5845. }
  5846. void
  5847. lt_update_lib_path (const char *name, const char *value)
  5848. {
  5849. lt_debugprintf (__FILE__, __LINE__,
  5850. "(lt_update_lib_path) modifying '%s' by prepending '%s'\n",
  5851. nonnull (name), nonnull (value));
  5852. if (name && *name && value && *value)
  5853. {
  5854. char *new_value = lt_extend_str (getenv (name), value, 0);
  5855. lt_setenv (name, new_value);
  5856. XFREE (new_value);
  5857. }
  5858. }
  5859. EOF
  5860. case $host_os in
  5861. mingw*)
  5862. cat <<"EOF"
  5863. /* Prepares an argument vector before calling spawn().
  5864. Note that spawn() does not by itself call the command interpreter
  5865. (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") :
  5866. ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
  5867. GetVersionEx(&v);
  5868. v.dwPlatformId == VER_PLATFORM_WIN32_NT;
  5869. }) ? "cmd.exe" : "command.com").
  5870. Instead it simply concatenates the arguments, separated by ' ', and calls
  5871. CreateProcess(). We must quote the arguments since Win32 CreateProcess()
  5872. interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a
  5873. special way:
  5874. - Space and tab are interpreted as delimiters. They are not treated as
  5875. delimiters if they are surrounded by double quotes: "...".
  5876. - Unescaped double quotes are removed from the input. Their only effect is
  5877. that within double quotes, space and tab are treated like normal
  5878. characters.
  5879. - Backslashes not followed by double quotes are not special.
  5880. - But 2*n+1 backslashes followed by a double quote become
  5881. n backslashes followed by a double quote (n >= 0):
  5882. \" -> "
  5883. \\\" -> \"
  5884. \\\\\" -> \\"
  5885. */
  5886. #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"
  5887. #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"
  5888. char **
  5889. prepare_spawn (char **argv)
  5890. {
  5891. size_t argc;
  5892. char **new_argv;
  5893. size_t i;
  5894. /* Count number of arguments. */
  5895. for (argc = 0; argv[argc] != NULL; argc++)
  5896. ;
  5897. /* Allocate new argument vector. */
  5898. new_argv = XMALLOC (char *, argc + 1);
  5899. /* Put quoted arguments into the new argument vector. */
  5900. for (i = 0; i < argc; i++)
  5901. {
  5902. const char *string = argv[i];
  5903. if (string[0] == '\0')
  5904. new_argv[i] = xstrdup ("\"\"");
  5905. else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL)
  5906. {
  5907. int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL);
  5908. size_t length;
  5909. unsigned int backslashes;
  5910. const char *s;
  5911. char *quoted_string;
  5912. char *p;
  5913. length = 0;
  5914. backslashes = 0;
  5915. if (quote_around)
  5916. length++;
  5917. for (s = string; *s != '\0'; s++)
  5918. {
  5919. char c = *s;
  5920. if (c == '"')
  5921. length += backslashes + 1;
  5922. length++;
  5923. if (c == '\\')
  5924. backslashes++;
  5925. else
  5926. backslashes = 0;
  5927. }
  5928. if (quote_around)
  5929. length += backslashes + 1;
  5930. quoted_string = XMALLOC (char, length + 1);
  5931. p = quoted_string;
  5932. backslashes = 0;
  5933. if (quote_around)
  5934. *p++ = '"';
  5935. for (s = string; *s != '\0'; s++)
  5936. {
  5937. char c = *s;
  5938. if (c == '"')
  5939. {
  5940. unsigned int j;
  5941. for (j = backslashes + 1; j > 0; j--)
  5942. *p++ = '\\';
  5943. }
  5944. *p++ = c;
  5945. if (c == '\\')
  5946. backslashes++;
  5947. else
  5948. backslashes = 0;
  5949. }
  5950. if (quote_around)
  5951. {
  5952. unsigned int j;
  5953. for (j = backslashes; j > 0; j--)
  5954. *p++ = '\\';
  5955. *p++ = '"';
  5956. }
  5957. *p = '\0';
  5958. new_argv[i] = quoted_string;
  5959. }
  5960. else
  5961. new_argv[i] = (char *) string;
  5962. }
  5963. new_argv[argc] = NULL;
  5964. return new_argv;
  5965. }
  5966. EOF
  5967. ;;
  5968. esac
  5969. cat <<"EOF"
  5970. void lt_dump_script (FILE* f)
  5971. {
  5972. EOF
  5973. func_emit_wrapper yes |
  5974. $SED -n -e '
  5975. s/^\(.\{79\}\)\(..*\)/\1\
  5976. \2/
  5977. h
  5978. s/\([\\"]\)/\\\1/g
  5979. s/$/\\n/
  5980. s/\([^\n]*\).*/ fputs ("\1", f);/p
  5981. g
  5982. D'
  5983. cat <<"EOF"
  5984. }
  5985. EOF
  5986. }
  5987. # end: func_emit_cwrapperexe_src
  5988. # func_win32_import_lib_p ARG
  5989. # True if ARG is an import lib, as indicated by $file_magic_cmd
  5990. func_win32_import_lib_p ()
  5991. {
  5992. $debug_cmd
  5993. case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in
  5994. *import*) : ;;
  5995. *) false ;;
  5996. esac
  5997. }
  5998. # func_suncc_cstd_abi
  5999. # !!ONLY CALL THIS FOR SUN CC AFTER $compile_command IS FULLY EXPANDED!!
  6000. # Several compiler flags select an ABI that is incompatible with the
  6001. # Cstd library. Avoid specifying it if any are in CXXFLAGS.
  6002. func_suncc_cstd_abi ()
  6003. {
  6004. $debug_cmd
  6005. case " $compile_command " in
  6006. *" -compat=g "*|*\ -std=c++[0-9][0-9]\ *|*" -library=stdcxx4 "*|*" -library=stlport4 "*)
  6007. suncc_use_cstd_abi=no
  6008. ;;
  6009. *)
  6010. suncc_use_cstd_abi=yes
  6011. ;;
  6012. esac
  6013. }
  6014. # func_mode_link arg...
  6015. func_mode_link ()
  6016. {
  6017. $debug_cmd
  6018. case $host in
  6019. *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
  6020. # It is impossible to link a dll without this setting, and
  6021. # we shouldn't force the makefile maintainer to figure out
  6022. # what system we are compiling for in order to pass an extra
  6023. # flag for every libtool invocation.
  6024. # allow_undefined=no
  6025. # FIXME: Unfortunately, there are problems with the above when trying
  6026. # to make a dll that has undefined symbols, in which case not
  6027. # even a static library is built. For now, we need to specify
  6028. # -no-undefined on the libtool link line when we can be certain
  6029. # that all symbols are satisfied, otherwise we get a static library.
  6030. allow_undefined=yes
  6031. ;;
  6032. *)
  6033. allow_undefined=yes
  6034. ;;
  6035. esac
  6036. libtool_args=$nonopt
  6037. base_compile="$nonopt $@"
  6038. compile_command=$nonopt
  6039. finalize_command=$nonopt
  6040. compile_rpath=
  6041. finalize_rpath=
  6042. compile_shlibpath=
  6043. finalize_shlibpath=
  6044. convenience=
  6045. old_convenience=
  6046. deplibs=
  6047. old_deplibs=
  6048. compiler_flags=
  6049. linker_flags=
  6050. dllsearchpath=
  6051. lib_search_path=`pwd`
  6052. inst_prefix_dir=
  6053. new_inherited_linker_flags=
  6054. avoid_version=no
  6055. bindir=
  6056. dlfiles=
  6057. dlprefiles=
  6058. dlself=no
  6059. export_dynamic=no
  6060. export_symbols=
  6061. export_symbols_regex=
  6062. generated=
  6063. libobjs=
  6064. ltlibs=
  6065. module=no
  6066. no_install=no
  6067. objs=
  6068. os2dllname=
  6069. non_pic_objects=
  6070. precious_files_regex=
  6071. prefer_static_libs=no
  6072. preload=false
  6073. prev=
  6074. prevarg=
  6075. release=
  6076. rpath=
  6077. xrpath=
  6078. perm_rpath=
  6079. temp_rpath=
  6080. thread_safe=no
  6081. vinfo=
  6082. vinfo_number=no
  6083. weak_libs=
  6084. single_module=$wl-single_module
  6085. func_infer_tag $base_compile
  6086. # We need to know -static, to get the right output filenames.
  6087. for arg
  6088. do
  6089. case $arg in
  6090. -shared)
  6091. test yes != "$build_libtool_libs" \
  6092. && func_fatal_configuration "cannot build a shared library"
  6093. build_old_libs=no
  6094. break
  6095. ;;
  6096. -all-static | -static | -static-libtool-libs)
  6097. case $arg in
  6098. -all-static)
  6099. if test yes = "$build_libtool_libs" && test -z "$link_static_flag"; then
  6100. func_warning "complete static linking is impossible in this configuration"
  6101. fi
  6102. if test -n "$link_static_flag"; then
  6103. dlopen_self=$dlopen_self_static
  6104. fi
  6105. prefer_static_libs=yes
  6106. ;;
  6107. -static)
  6108. if test -z "$pic_flag" && test -n "$link_static_flag"; then
  6109. dlopen_self=$dlopen_self_static
  6110. fi
  6111. prefer_static_libs=built
  6112. ;;
  6113. -static-libtool-libs)
  6114. if test -z "$pic_flag" && test -n "$link_static_flag"; then
  6115. dlopen_self=$dlopen_self_static
  6116. fi
  6117. prefer_static_libs=yes
  6118. ;;
  6119. esac
  6120. build_libtool_libs=no
  6121. build_old_libs=yes
  6122. break
  6123. ;;
  6124. esac
  6125. done
  6126. # See if our shared archives depend on static archives.
  6127. test -n "$old_archive_from_new_cmds" && build_old_libs=yes
  6128. # Go through the arguments, transforming them on the way.
  6129. while test "$#" -gt 0; do
  6130. arg=$1
  6131. shift
  6132. func_quote_for_eval "$arg"
  6133. qarg=$func_quote_for_eval_unquoted_result
  6134. func_append libtool_args " $func_quote_for_eval_result"
  6135. # If the previous option needs an argument, assign it.
  6136. if test -n "$prev"; then
  6137. case $prev in
  6138. output)
  6139. func_append compile_command " @OUTPUT@"
  6140. func_append finalize_command " @OUTPUT@"
  6141. ;;
  6142. esac
  6143. case $prev in
  6144. bindir)
  6145. bindir=$arg
  6146. prev=
  6147. continue
  6148. ;;
  6149. dlfiles|dlprefiles)
  6150. $preload || {
  6151. # Add the symbol object into the linking commands.
  6152. func_append compile_command " @SYMFILE@"
  6153. func_append finalize_command " @SYMFILE@"
  6154. preload=:
  6155. }
  6156. case $arg in
  6157. *.la | *.lo) ;; # We handle these cases below.
  6158. force)
  6159. if test no = "$dlself"; then
  6160. dlself=needless
  6161. export_dynamic=yes
  6162. fi
  6163. prev=
  6164. continue
  6165. ;;
  6166. self)
  6167. if test dlprefiles = "$prev"; then
  6168. dlself=yes
  6169. elif test dlfiles = "$prev" && test yes != "$dlopen_self"; then
  6170. dlself=yes
  6171. else
  6172. dlself=needless
  6173. export_dynamic=yes
  6174. fi
  6175. prev=
  6176. continue
  6177. ;;
  6178. *)
  6179. if test dlfiles = "$prev"; then
  6180. func_append dlfiles " $arg"
  6181. else
  6182. func_append dlprefiles " $arg"
  6183. fi
  6184. prev=
  6185. continue
  6186. ;;
  6187. esac
  6188. ;;
  6189. expsyms)
  6190. export_symbols=$arg
  6191. test -f "$arg" \
  6192. || func_fatal_error "symbol file '$arg' does not exist"
  6193. prev=
  6194. continue
  6195. ;;
  6196. expsyms_regex)
  6197. export_symbols_regex=$arg
  6198. prev=
  6199. continue
  6200. ;;
  6201. framework)
  6202. case $host in
  6203. *-*-darwin*)
  6204. case "$deplibs " in
  6205. *" $qarg.ltframework "*) ;;
  6206. *) func_append deplibs " $qarg.ltframework" # this is fixed later
  6207. ;;
  6208. esac
  6209. ;;
  6210. esac
  6211. prev=
  6212. continue
  6213. ;;
  6214. inst_prefix)
  6215. inst_prefix_dir=$arg
  6216. prev=
  6217. continue
  6218. ;;
  6219. mllvm)
  6220. # Clang does not use LLVM to link, so we can simply discard any
  6221. # '-mllvm $arg' options when doing the link step.
  6222. prev=
  6223. continue
  6224. ;;
  6225. objectlist)
  6226. if test -f "$arg"; then
  6227. save_arg=$arg
  6228. moreargs=
  6229. for fil in `cat "$save_arg"`
  6230. do
  6231. # func_append moreargs " $fil"
  6232. arg=$fil
  6233. # A libtool-controlled object.
  6234. # Check to see that this really is a libtool object.
  6235. if func_lalib_unsafe_p "$arg"; then
  6236. pic_object=
  6237. non_pic_object=
  6238. # Read the .lo file
  6239. func_source "$arg"
  6240. if test -z "$pic_object" ||
  6241. test -z "$non_pic_object" ||
  6242. test none = "$pic_object" &&
  6243. test none = "$non_pic_object"; then
  6244. func_fatal_error "cannot find name of object for '$arg'"
  6245. fi
  6246. # Extract subdirectory from the argument.
  6247. func_dirname "$arg" "/" ""
  6248. xdir=$func_dirname_result
  6249. if test none != "$pic_object"; then
  6250. # Prepend the subdirectory the object is found in.
  6251. pic_object=$xdir$pic_object
  6252. if test dlfiles = "$prev"; then
  6253. if test yes = "$build_libtool_libs" && test yes = "$dlopen_support"; then
  6254. func_append dlfiles " $pic_object"
  6255. prev=
  6256. continue
  6257. else
  6258. # If libtool objects are unsupported, then we need to preload.
  6259. prev=dlprefiles
  6260. fi
  6261. fi
  6262. # CHECK ME: I think I busted this. -Ossama
  6263. if test dlprefiles = "$prev"; then
  6264. # Preload the old-style object.
  6265. func_append dlprefiles " $pic_object"
  6266. prev=
  6267. fi
  6268. # A PIC object.
  6269. func_append libobjs " $pic_object"
  6270. arg=$pic_object
  6271. fi
  6272. # Non-PIC object.
  6273. if test none != "$non_pic_object"; then
  6274. # Prepend the subdirectory the object is found in.
  6275. non_pic_object=$xdir$non_pic_object
  6276. # A standard non-PIC object
  6277. func_append non_pic_objects " $non_pic_object"
  6278. if test -z "$pic_object" || test none = "$pic_object"; then
  6279. arg=$non_pic_object
  6280. fi
  6281. else
  6282. # If the PIC object exists, use it instead.
  6283. # $xdir was prepended to $pic_object above.
  6284. non_pic_object=$pic_object
  6285. func_append non_pic_objects " $non_pic_object"
  6286. fi
  6287. else
  6288. # Only an error if not doing a dry-run.
  6289. if $opt_dry_run; then
  6290. # Extract subdirectory from the argument.
  6291. func_dirname "$arg" "/" ""
  6292. xdir=$func_dirname_result
  6293. func_lo2o "$arg"
  6294. pic_object=$xdir$objdir/$func_lo2o_result
  6295. non_pic_object=$xdir$func_lo2o_result
  6296. func_append libobjs " $pic_object"
  6297. func_append non_pic_objects " $non_pic_object"
  6298. else
  6299. func_fatal_error "'$arg' is not a valid libtool object"
  6300. fi
  6301. fi
  6302. done
  6303. else
  6304. func_fatal_error "link input file '$arg' does not exist"
  6305. fi
  6306. arg=$save_arg
  6307. prev=
  6308. continue
  6309. ;;
  6310. os2dllname)
  6311. os2dllname=$arg
  6312. prev=
  6313. continue
  6314. ;;
  6315. precious_regex)
  6316. precious_files_regex=$arg
  6317. prev=
  6318. continue
  6319. ;;
  6320. release)
  6321. release=-$arg
  6322. prev=
  6323. continue
  6324. ;;
  6325. rpath | xrpath)
  6326. # We need an absolute path.
  6327. case $arg in
  6328. [\\/]* | [A-Za-z]:[\\/]*) ;;
  6329. *)
  6330. func_fatal_error "only absolute run-paths are allowed"
  6331. ;;
  6332. esac
  6333. if test rpath = "$prev"; then
  6334. case "$rpath " in
  6335. *" $arg "*) ;;
  6336. *) func_append rpath " $arg" ;;
  6337. esac
  6338. else
  6339. case "$xrpath " in
  6340. *" $arg "*) ;;
  6341. *) func_append xrpath " $arg" ;;
  6342. esac
  6343. fi
  6344. prev=
  6345. continue
  6346. ;;
  6347. shrext)
  6348. shrext_cmds=$arg
  6349. prev=
  6350. continue
  6351. ;;
  6352. weak)
  6353. func_append weak_libs " $arg"
  6354. prev=
  6355. continue
  6356. ;;
  6357. xcclinker)
  6358. func_append linker_flags " $qarg"
  6359. func_append compiler_flags " $qarg"
  6360. prev=
  6361. func_append compile_command " $qarg"
  6362. func_append finalize_command " $qarg"
  6363. continue
  6364. ;;
  6365. xcompiler)
  6366. func_append compiler_flags " $qarg"
  6367. prev=
  6368. func_append compile_command " $qarg"
  6369. func_append finalize_command " $qarg"
  6370. continue
  6371. ;;
  6372. xlinker)
  6373. func_append linker_flags " $qarg"
  6374. func_append compiler_flags " $wl$qarg"
  6375. prev=
  6376. func_append compile_command " $wl$qarg"
  6377. func_append finalize_command " $wl$qarg"
  6378. continue
  6379. ;;
  6380. *)
  6381. eval "$prev=\"\$arg\""
  6382. prev=
  6383. continue
  6384. ;;
  6385. esac
  6386. fi # test -n "$prev"
  6387. prevarg=$arg
  6388. case $arg in
  6389. -all-static)
  6390. if test -n "$link_static_flag"; then
  6391. # See comment for -static flag below, for more details.
  6392. func_append compile_command " $link_static_flag"
  6393. func_append finalize_command " $link_static_flag"
  6394. fi
  6395. continue
  6396. ;;
  6397. -allow-undefined)
  6398. # FIXME: remove this flag sometime in the future.
  6399. func_fatal_error "'-allow-undefined' must not be used because it is the default"
  6400. ;;
  6401. -avoid-version)
  6402. avoid_version=yes
  6403. continue
  6404. ;;
  6405. -bindir)
  6406. prev=bindir
  6407. continue
  6408. ;;
  6409. -dlopen)
  6410. prev=dlfiles
  6411. continue
  6412. ;;
  6413. -dlpreopen)
  6414. prev=dlprefiles
  6415. continue
  6416. ;;
  6417. -export-dynamic)
  6418. export_dynamic=yes
  6419. continue
  6420. ;;
  6421. -export-symbols | -export-symbols-regex)
  6422. if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
  6423. func_fatal_error "more than one -exported-symbols argument is not allowed"
  6424. fi
  6425. if test X-export-symbols = "X$arg"; then
  6426. prev=expsyms
  6427. else
  6428. prev=expsyms_regex
  6429. fi
  6430. continue
  6431. ;;
  6432. -framework)
  6433. prev=framework
  6434. continue
  6435. ;;
  6436. -inst-prefix-dir)
  6437. prev=inst_prefix
  6438. continue
  6439. ;;
  6440. # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
  6441. # so, if we see these flags be careful not to treat them like -L
  6442. -L[A-Z][A-Z]*:*)
  6443. case $with_gcc/$host in
  6444. no/*-*-irix* | /*-*-irix*)
  6445. func_append compile_command " $arg"
  6446. func_append finalize_command " $arg"
  6447. ;;
  6448. esac
  6449. continue
  6450. ;;
  6451. -L*)
  6452. func_stripname "-L" '' "$arg"
  6453. if test -z "$func_stripname_result"; then
  6454. if test "$#" -gt 0; then
  6455. func_fatal_error "require no space between '-L' and '$1'"
  6456. else
  6457. func_fatal_error "need path for '-L' option"
  6458. fi
  6459. fi
  6460. func_resolve_sysroot "$func_stripname_result"
  6461. dir=$func_resolve_sysroot_result
  6462. # We need an absolute path.
  6463. case $dir in
  6464. [\\/]* | [A-Za-z]:[\\/]*) ;;
  6465. *)
  6466. absdir=`cd "$dir" && pwd`
  6467. test -z "$absdir" && \
  6468. func_fatal_error "cannot determine absolute directory name of '$dir'"
  6469. dir=$absdir
  6470. ;;
  6471. esac
  6472. case "$deplibs " in
  6473. *" -L$dir "* | *" $arg "*)
  6474. # Will only happen for absolute or sysroot arguments
  6475. ;;
  6476. *)
  6477. # Preserve sysroot, but never include relative directories
  6478. case $dir in
  6479. [\\/]* | [A-Za-z]:[\\/]* | =*) func_append deplibs " $arg" ;;
  6480. *) func_append deplibs " -L$dir" ;;
  6481. esac
  6482. func_append lib_search_path " $dir"
  6483. ;;
  6484. esac
  6485. case $host in
  6486. *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
  6487. testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'`
  6488. case :$dllsearchpath: in
  6489. *":$dir:"*) ;;
  6490. ::) dllsearchpath=$dir;;
  6491. *) func_append dllsearchpath ":$dir";;
  6492. esac
  6493. case :$dllsearchpath: in
  6494. *":$testbindir:"*) ;;
  6495. ::) dllsearchpath=$testbindir;;
  6496. *) func_append dllsearchpath ":$testbindir";;
  6497. esac
  6498. ;;
  6499. esac
  6500. continue
  6501. ;;
  6502. -l*)
  6503. if test X-lc = "X$arg" || test X-lm = "X$arg"; then
  6504. case $host in
  6505. *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*)
  6506. # These systems don't actually have a C or math library (as such)
  6507. continue
  6508. ;;
  6509. *-*-os2*)
  6510. # These systems don't actually have a C library (as such)
  6511. test X-lc = "X$arg" && continue
  6512. ;;
  6513. *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig*)
  6514. # Do not include libc due to us having libc/libc_r.
  6515. test X-lc = "X$arg" && continue
  6516. ;;
  6517. *-*-rhapsody* | *-*-darwin1.[012])
  6518. # Rhapsody C and math libraries are in the System framework
  6519. func_append deplibs " System.ltframework"
  6520. continue
  6521. ;;
  6522. *-*-sco3.2v5* | *-*-sco5v6*)
  6523. # Causes problems with __ctype
  6524. test X-lc = "X$arg" && continue
  6525. ;;
  6526. *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
  6527. # Compiler inserts libc in the correct place for threads to work
  6528. test X-lc = "X$arg" && continue
  6529. ;;
  6530. esac
  6531. elif test X-lc_r = "X$arg"; then
  6532. case $host in
  6533. *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig*)
  6534. # Do not include libc_r directly, use -pthread flag.
  6535. continue
  6536. ;;
  6537. esac
  6538. fi
  6539. func_append deplibs " $arg"
  6540. continue
  6541. ;;
  6542. -mllvm)
  6543. prev=mllvm
  6544. continue
  6545. ;;
  6546. -module)
  6547. module=yes
  6548. continue
  6549. ;;
  6550. # Tru64 UNIX uses -model [arg] to determine the layout of C++
  6551. # classes, name mangling, and exception handling.
  6552. # Darwin uses the -arch flag to determine output architecture.
  6553. -model|-arch|-isysroot|--sysroot)
  6554. func_append compiler_flags " $arg"
  6555. func_append compile_command " $arg"
  6556. func_append finalize_command " $arg"
  6557. prev=xcompiler
  6558. continue
  6559. ;;
  6560. -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
  6561. |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
  6562. func_append compiler_flags " $arg"
  6563. func_append compile_command " $arg"
  6564. func_append finalize_command " $arg"
  6565. case "$new_inherited_linker_flags " in
  6566. *" $arg "*) ;;
  6567. * ) func_append new_inherited_linker_flags " $arg" ;;
  6568. esac
  6569. continue
  6570. ;;
  6571. -multi_module)
  6572. single_module=$wl-multi_module
  6573. continue
  6574. ;;
  6575. -no-fast-install)
  6576. fast_install=no
  6577. continue
  6578. ;;
  6579. -no-install)
  6580. case $host in
  6581. *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*)
  6582. # The PATH hackery in wrapper scripts is required on Windows
  6583. # and Darwin in order for the loader to find any dlls it needs.
  6584. func_warning "'-no-install' is ignored for $host"
  6585. func_warning "assuming '-no-fast-install' instead"
  6586. fast_install=no
  6587. ;;
  6588. *) no_install=yes ;;
  6589. esac
  6590. continue
  6591. ;;
  6592. -no-undefined)
  6593. allow_undefined=no
  6594. continue
  6595. ;;
  6596. -objectlist)
  6597. prev=objectlist
  6598. continue
  6599. ;;
  6600. -os2dllname)
  6601. prev=os2dllname
  6602. continue
  6603. ;;
  6604. -o) prev=output ;;
  6605. -precious-files-regex)
  6606. prev=precious_regex
  6607. continue
  6608. ;;
  6609. -release)
  6610. prev=release
  6611. continue
  6612. ;;
  6613. -rpath)
  6614. prev=rpath
  6615. continue
  6616. ;;
  6617. -R)
  6618. prev=xrpath
  6619. continue
  6620. ;;
  6621. -R*)
  6622. func_stripname '-R' '' "$arg"
  6623. dir=$func_stripname_result
  6624. # We need an absolute path.
  6625. case $dir in
  6626. [\\/]* | [A-Za-z]:[\\/]*) ;;
  6627. =*)
  6628. func_stripname '=' '' "$dir"
  6629. dir=$lt_sysroot$func_stripname_result
  6630. ;;
  6631. *)
  6632. func_fatal_error "only absolute run-paths are allowed"
  6633. ;;
  6634. esac
  6635. case "$xrpath " in
  6636. *" $dir "*) ;;
  6637. *) func_append xrpath " $dir" ;;
  6638. esac
  6639. continue
  6640. ;;
  6641. -shared)
  6642. # The effects of -shared are defined in a previous loop.
  6643. continue
  6644. ;;
  6645. -shrext)
  6646. prev=shrext
  6647. continue
  6648. ;;
  6649. -static | -static-libtool-libs)
  6650. # The effects of -static are defined in a previous loop.
  6651. # We used to do the same as -all-static on platforms that
  6652. # didn't have a PIC flag, but the assumption that the effects
  6653. # would be equivalent was wrong. It would break on at least
  6654. # Digital Unix and AIX.
  6655. continue
  6656. ;;
  6657. -thread-safe)
  6658. thread_safe=yes
  6659. continue
  6660. ;;
  6661. -version-info)
  6662. prev=vinfo
  6663. continue
  6664. ;;
  6665. -version-number)
  6666. prev=vinfo
  6667. vinfo_number=yes
  6668. continue
  6669. ;;
  6670. -weak)
  6671. prev=weak
  6672. continue
  6673. ;;
  6674. -Wc,*)
  6675. func_stripname '-Wc,' '' "$arg"
  6676. args=$func_stripname_result
  6677. arg=
  6678. save_ifs=$IFS; IFS=,
  6679. for flag in $args; do
  6680. IFS=$save_ifs
  6681. func_quote_for_eval "$flag"
  6682. func_append arg " $func_quote_for_eval_result"
  6683. func_append compiler_flags " $func_quote_for_eval_result"
  6684. done
  6685. IFS=$save_ifs
  6686. func_stripname ' ' '' "$arg"
  6687. arg=$func_stripname_result
  6688. ;;
  6689. -Wl,*)
  6690. func_stripname '-Wl,' '' "$arg"
  6691. args=$func_stripname_result
  6692. arg=
  6693. save_ifs=$IFS; IFS=,
  6694. for flag in $args; do
  6695. IFS=$save_ifs
  6696. func_quote_for_eval "$flag"
  6697. func_append arg " $wl$func_quote_for_eval_result"
  6698. func_append compiler_flags " $wl$func_quote_for_eval_result"
  6699. func_append linker_flags " $func_quote_for_eval_result"
  6700. done
  6701. IFS=$save_ifs
  6702. func_stripname ' ' '' "$arg"
  6703. arg=$func_stripname_result
  6704. ;;
  6705. -Xcompiler)
  6706. prev=xcompiler
  6707. continue
  6708. ;;
  6709. -Xlinker)
  6710. prev=xlinker
  6711. continue
  6712. ;;
  6713. -XCClinker)
  6714. prev=xcclinker
  6715. continue
  6716. ;;
  6717. # -msg_* for osf cc
  6718. -msg_*)
  6719. func_quote_for_eval "$arg"
  6720. arg=$func_quote_for_eval_result
  6721. ;;
  6722. # Flags to be passed through unchanged, with rationale:
  6723. # -64, -mips[0-9] enable 64-bit mode for the SGI compiler
  6724. # -r[0-9][0-9]* specify processor for the SGI compiler
  6725. # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler
  6726. # +DA*, +DD* enable 64-bit mode for the HP compiler
  6727. # -q* compiler args for the IBM compiler
  6728. # -m*, -t[45]*, -txscale* architecture-specific flags for GCC
  6729. # -F/path path to uninstalled frameworks, gcc on darwin
  6730. # -p, -pg, --coverage, -fprofile-* profiling flags for GCC
  6731. # -fstack-protector* stack protector flags for GCC
  6732. # @file GCC response files
  6733. # -tp=* Portland pgcc target processor selection
  6734. # --sysroot=* for sysroot support
  6735. # -O*, -g*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization
  6736. # -specs=* GCC specs files
  6737. # -stdlib=* select c++ std lib with clang
  6738. # -fsanitize=* Clang/GCC memory and address sanitizer
  6739. # -fuse-ld=* Linker select flags for GCC
  6740. # -static-* direct GCC to link specific libraries statically
  6741. # -fcilkplus Cilk Plus language extension features for C/C++
  6742. -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
  6743. -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \
  6744. -O*|-g*|-flto*|-fwhopr*|-fuse-linker-plugin|-fstack-protector*|-stdlib=*| \
  6745. -specs=*|-fsanitize=*|-fuse-ld=*|-static-*|-fcilkplus)
  6746. func_quote_for_eval "$arg"
  6747. arg=$func_quote_for_eval_result
  6748. func_append compile_command " $arg"
  6749. func_append finalize_command " $arg"
  6750. func_append compiler_flags " $arg"
  6751. continue
  6752. ;;
  6753. -Z*)
  6754. if test os2 = "`expr $host : '.*\(os2\)'`"; then
  6755. # OS/2 uses -Zxxx to specify OS/2-specific options
  6756. compiler_flags="$compiler_flags $arg"
  6757. func_append compile_command " $arg"
  6758. func_append finalize_command " $arg"
  6759. case $arg in
  6760. -Zlinker | -Zstack)
  6761. prev=xcompiler
  6762. ;;
  6763. esac
  6764. continue
  6765. else
  6766. # Otherwise treat like 'Some other compiler flag' below
  6767. func_quote_for_eval "$arg"
  6768. arg=$func_quote_for_eval_result
  6769. fi
  6770. ;;
  6771. # Some other compiler flag.
  6772. -* | +*)
  6773. func_quote_for_eval "$arg"
  6774. arg=$func_quote_for_eval_result
  6775. ;;
  6776. *.$objext)
  6777. # A standard object.
  6778. func_append objs " $arg"
  6779. ;;
  6780. *.lo)
  6781. # A libtool-controlled object.
  6782. # Check to see that this really is a libtool object.
  6783. if func_lalib_unsafe_p "$arg"; then
  6784. pic_object=
  6785. non_pic_object=
  6786. # Read the .lo file
  6787. func_source "$arg"
  6788. if test -z "$pic_object" ||
  6789. test -z "$non_pic_object" ||
  6790. test none = "$pic_object" &&
  6791. test none = "$non_pic_object"; then
  6792. func_fatal_error "cannot find name of object for '$arg'"
  6793. fi
  6794. # Extract subdirectory from the argument.
  6795. func_dirname "$arg" "/" ""
  6796. xdir=$func_dirname_result
  6797. test none = "$pic_object" || {
  6798. # Prepend the subdirectory the object is found in.
  6799. pic_object=$xdir$pic_object
  6800. if test dlfiles = "$prev"; then
  6801. if test yes = "$build_libtool_libs" && test yes = "$dlopen_support"; then
  6802. func_append dlfiles " $pic_object"
  6803. prev=
  6804. continue
  6805. else
  6806. # If libtool objects are unsupported, then we need to preload.
  6807. prev=dlprefiles
  6808. fi
  6809. fi
  6810. # CHECK ME: I think I busted this. -Ossama
  6811. if test dlprefiles = "$prev"; then
  6812. # Preload the old-style object.
  6813. func_append dlprefiles " $pic_object"
  6814. prev=
  6815. fi
  6816. # A PIC object.
  6817. func_append libobjs " $pic_object"
  6818. arg=$pic_object
  6819. }
  6820. # Non-PIC object.
  6821. if test none != "$non_pic_object"; then
  6822. # Prepend the subdirectory the object is found in.
  6823. non_pic_object=$xdir$non_pic_object
  6824. # A standard non-PIC object
  6825. func_append non_pic_objects " $non_pic_object"
  6826. if test -z "$pic_object" || test none = "$pic_object"; then
  6827. arg=$non_pic_object
  6828. fi
  6829. else
  6830. # If the PIC object exists, use it instead.
  6831. # $xdir was prepended to $pic_object above.
  6832. non_pic_object=$pic_object
  6833. func_append non_pic_objects " $non_pic_object"
  6834. fi
  6835. else
  6836. # Only an error if not doing a dry-run.
  6837. if $opt_dry_run; then
  6838. # Extract subdirectory from the argument.
  6839. func_dirname "$arg" "/" ""
  6840. xdir=$func_dirname_result
  6841. func_lo2o "$arg"
  6842. pic_object=$xdir$objdir/$func_lo2o_result
  6843. non_pic_object=$xdir$func_lo2o_result
  6844. func_append libobjs " $pic_object"
  6845. func_append non_pic_objects " $non_pic_object"
  6846. else
  6847. func_fatal_error "'$arg' is not a valid libtool object"
  6848. fi
  6849. fi
  6850. ;;
  6851. *.$libext)
  6852. # An archive.
  6853. func_append deplibs " $arg"
  6854. func_append old_deplibs " $arg"
  6855. continue
  6856. ;;
  6857. *.la)
  6858. # A libtool-controlled library.
  6859. func_resolve_sysroot "$arg"
  6860. if test dlfiles = "$prev"; then
  6861. # This library was specified with -dlopen.
  6862. func_append dlfiles " $func_resolve_sysroot_result"
  6863. prev=
  6864. elif test dlprefiles = "$prev"; then
  6865. # The library was specified with -dlpreopen.
  6866. func_append dlprefiles " $func_resolve_sysroot_result"
  6867. prev=
  6868. else
  6869. func_append deplibs " $func_resolve_sysroot_result"
  6870. fi
  6871. continue
  6872. ;;
  6873. # Some other compiler argument.
  6874. *)
  6875. # Unknown arguments in both finalize_command and compile_command need
  6876. # to be aesthetically quoted because they are evaled later.
  6877. func_quote_for_eval "$arg"
  6878. arg=$func_quote_for_eval_result
  6879. ;;
  6880. esac # arg
  6881. # Now actually substitute the argument into the commands.
  6882. if test -n "$arg"; then
  6883. func_append compile_command " $arg"
  6884. func_append finalize_command " $arg"
  6885. fi
  6886. done # argument parsing loop
  6887. test -n "$prev" && \
  6888. func_fatal_help "the '$prevarg' option requires an argument"
  6889. if test yes = "$export_dynamic" && test -n "$export_dynamic_flag_spec"; then
  6890. eval arg=\"$export_dynamic_flag_spec\"
  6891. func_append compile_command " $arg"
  6892. func_append finalize_command " $arg"
  6893. fi
  6894. oldlibs=
  6895. # calculate the name of the file, without its directory
  6896. func_basename "$output"
  6897. outputname=$func_basename_result
  6898. libobjs_save=$libobjs
  6899. if test -n "$shlibpath_var"; then
  6900. # get the directories listed in $shlibpath_var
  6901. eval shlib_search_path=\`\$ECHO \"\$$shlibpath_var\" \| \$SED \'s/:/ /g\'\`
  6902. else
  6903. shlib_search_path=
  6904. fi
  6905. eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
  6906. eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
  6907. # Definition is injected by LT_CONFIG during libtool generation.
  6908. func_munge_path_list sys_lib_dlsearch_path "$LT_SYS_LIBRARY_PATH"
  6909. func_dirname "$output" "/" ""
  6910. output_objdir=$func_dirname_result$objdir
  6911. func_to_tool_file "$output_objdir/"
  6912. tool_output_objdir=$func_to_tool_file_result
  6913. # Create the object directory.
  6914. func_mkdir_p "$output_objdir"
  6915. # Determine the type of output
  6916. case $output in
  6917. "")
  6918. func_fatal_help "you must specify an output file"
  6919. ;;
  6920. *.$libext) linkmode=oldlib ;;
  6921. *.lo | *.$objext) linkmode=obj ;;
  6922. *.la) linkmode=lib ;;
  6923. *) linkmode=prog ;; # Anything else should be a program.
  6924. esac
  6925. specialdeplibs=
  6926. libs=
  6927. # Find all interdependent deplibs by searching for libraries
  6928. # that are linked more than once (e.g. -la -lb -la)
  6929. for deplib in $deplibs; do
  6930. if $opt_preserve_dup_deps; then
  6931. case "$libs " in
  6932. *" $deplib "*) func_append specialdeplibs " $deplib" ;;
  6933. esac
  6934. fi
  6935. func_append libs " $deplib"
  6936. done
  6937. if test lib = "$linkmode"; then
  6938. libs="$predeps $libs $compiler_lib_search_path $postdeps"
  6939. # Compute libraries that are listed more than once in $predeps
  6940. # $postdeps and mark them as special (i.e., whose duplicates are
  6941. # not to be eliminated).
  6942. pre_post_deps=
  6943. if $opt_duplicate_compiler_generated_deps; then
  6944. for pre_post_dep in $predeps $postdeps; do
  6945. case "$pre_post_deps " in
  6946. *" $pre_post_dep "*) func_append specialdeplibs " $pre_post_deps" ;;
  6947. esac
  6948. func_append pre_post_deps " $pre_post_dep"
  6949. done
  6950. fi
  6951. pre_post_deps=
  6952. fi
  6953. deplibs=
  6954. newdependency_libs=
  6955. newlib_search_path=
  6956. need_relink=no # whether we're linking any uninstalled libtool libraries
  6957. notinst_deplibs= # not-installed libtool libraries
  6958. notinst_path= # paths that contain not-installed libtool libraries
  6959. case $linkmode in
  6960. lib)
  6961. passes="conv dlpreopen link"
  6962. for file in $dlfiles $dlprefiles; do
  6963. case $file in
  6964. *.la) ;;
  6965. *)
  6966. func_fatal_help "libraries can '-dlopen' only libtool libraries: $file"
  6967. ;;
  6968. esac
  6969. done
  6970. ;;
  6971. prog)
  6972. compile_deplibs=
  6973. finalize_deplibs=
  6974. alldeplibs=false
  6975. newdlfiles=
  6976. newdlprefiles=
  6977. passes="conv scan dlopen dlpreopen link"
  6978. ;;
  6979. *) passes="conv"
  6980. ;;
  6981. esac
  6982. for pass in $passes; do
  6983. # The preopen pass in lib mode reverses $deplibs; put it back here
  6984. # so that -L comes before libs that need it for instance...
  6985. if test lib,link = "$linkmode,$pass"; then
  6986. ## FIXME: Find the place where the list is rebuilt in the wrong
  6987. ## order, and fix it there properly
  6988. tmp_deplibs=
  6989. for deplib in $deplibs; do
  6990. tmp_deplibs="$deplib $tmp_deplibs"
  6991. done
  6992. deplibs=$tmp_deplibs
  6993. fi
  6994. if test lib,link = "$linkmode,$pass" ||
  6995. test prog,scan = "$linkmode,$pass"; then
  6996. libs=$deplibs
  6997. deplibs=
  6998. fi
  6999. if test prog = "$linkmode"; then
  7000. case $pass in
  7001. dlopen) libs=$dlfiles ;;
  7002. dlpreopen) libs=$dlprefiles ;;
  7003. link)
  7004. libs="$deplibs %DEPLIBS%"
  7005. test "X$link_all_deplibs" != Xno && libs="$libs $dependency_libs"
  7006. ;;
  7007. esac
  7008. fi
  7009. if test lib,dlpreopen = "$linkmode,$pass"; then
  7010. # Collect and forward deplibs of preopened libtool libs
  7011. for lib in $dlprefiles; do
  7012. # Ignore non-libtool-libs
  7013. dependency_libs=
  7014. func_resolve_sysroot "$lib"
  7015. case $lib in
  7016. *.la) func_source "$func_resolve_sysroot_result" ;;
  7017. esac
  7018. # Collect preopened libtool deplibs, except any this library
  7019. # has declared as weak libs
  7020. for deplib in $dependency_libs; do
  7021. func_basename "$deplib"
  7022. deplib_base=$func_basename_result
  7023. case " $weak_libs " in
  7024. *" $deplib_base "*) ;;
  7025. *) func_append deplibs " $deplib" ;;
  7026. esac
  7027. done
  7028. done
  7029. libs=$dlprefiles
  7030. fi
  7031. if test dlopen = "$pass"; then
  7032. # Collect dlpreopened libraries
  7033. save_deplibs=$deplibs
  7034. deplibs=
  7035. fi
  7036. for deplib in $libs; do
  7037. lib=
  7038. found=false
  7039. case $deplib in
  7040. -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
  7041. |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
  7042. if test prog,link = "$linkmode,$pass"; then
  7043. compile_deplibs="$deplib $compile_deplibs"
  7044. finalize_deplibs="$deplib $finalize_deplibs"
  7045. else
  7046. func_append compiler_flags " $deplib"
  7047. if test lib = "$linkmode"; then
  7048. case "$new_inherited_linker_flags " in
  7049. *" $deplib "*) ;;
  7050. * ) func_append new_inherited_linker_flags " $deplib" ;;
  7051. esac
  7052. fi
  7053. fi
  7054. continue
  7055. ;;
  7056. -l*)
  7057. if test lib != "$linkmode" && test prog != "$linkmode"; then
  7058. func_warning "'-l' is ignored for archives/objects"
  7059. continue
  7060. fi
  7061. func_stripname '-l' '' "$deplib"
  7062. name=$func_stripname_result
  7063. if test lib = "$linkmode"; then
  7064. searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path"
  7065. else
  7066. searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path"
  7067. fi
  7068. for searchdir in $searchdirs; do
  7069. for search_ext in .la $std_shrext .so .a; do
  7070. # Search the libtool library
  7071. lib=$searchdir/lib$name$search_ext
  7072. if test -f "$lib"; then
  7073. if test .la = "$search_ext"; then
  7074. found=:
  7075. else
  7076. found=false
  7077. fi
  7078. break 2
  7079. fi
  7080. done
  7081. done
  7082. if $found; then
  7083. # deplib is a libtool library
  7084. # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
  7085. # We need to do some special things here, and not later.
  7086. if test yes = "$allow_libtool_libs_with_static_runtimes"; then
  7087. case " $predeps $postdeps " in
  7088. *" $deplib "*)
  7089. if func_lalib_p "$lib"; then
  7090. library_names=
  7091. old_library=
  7092. func_source "$lib"
  7093. for l in $old_library $library_names; do
  7094. ll=$l
  7095. done
  7096. if test "X$ll" = "X$old_library"; then # only static version available
  7097. found=false
  7098. func_dirname "$lib" "" "."
  7099. ladir=$func_dirname_result
  7100. lib=$ladir/$old_library
  7101. if test prog,link = "$linkmode,$pass"; then
  7102. compile_deplibs="$deplib $compile_deplibs"
  7103. finalize_deplibs="$deplib $finalize_deplibs"
  7104. else
  7105. deplibs="$deplib $deplibs"
  7106. test lib = "$linkmode" && newdependency_libs="$deplib $newdependency_libs"
  7107. fi
  7108. continue
  7109. fi
  7110. fi
  7111. ;;
  7112. *) ;;
  7113. esac
  7114. fi
  7115. else
  7116. # deplib doesn't seem to be a libtool library
  7117. if test prog,link = "$linkmode,$pass"; then
  7118. compile_deplibs="$deplib $compile_deplibs"
  7119. finalize_deplibs="$deplib $finalize_deplibs"
  7120. else
  7121. deplibs="$deplib $deplibs"
  7122. test lib = "$linkmode" && newdependency_libs="$deplib $newdependency_libs"
  7123. fi
  7124. continue
  7125. fi
  7126. ;; # -l
  7127. *.ltframework)
  7128. if test prog,link = "$linkmode,$pass"; then
  7129. compile_deplibs="$deplib $compile_deplibs"
  7130. finalize_deplibs="$deplib $finalize_deplibs"
  7131. else
  7132. deplibs="$deplib $deplibs"
  7133. if test lib = "$linkmode"; then
  7134. case "$new_inherited_linker_flags " in
  7135. *" $deplib "*) ;;
  7136. * ) func_append new_inherited_linker_flags " $deplib" ;;
  7137. esac
  7138. fi
  7139. fi
  7140. continue
  7141. ;;
  7142. -L*)
  7143. case $linkmode in
  7144. lib)
  7145. deplibs="$deplib $deplibs"
  7146. test conv = "$pass" && continue
  7147. newdependency_libs="$deplib $newdependency_libs"
  7148. func_stripname '-L' '' "$deplib"
  7149. func_resolve_sysroot "$func_stripname_result"
  7150. func_append newlib_search_path " $func_resolve_sysroot_result"
  7151. ;;
  7152. prog)
  7153. if test conv = "$pass"; then
  7154. deplibs="$deplib $deplibs"
  7155. continue
  7156. fi
  7157. if test scan = "$pass"; then
  7158. deplibs="$deplib $deplibs"
  7159. else
  7160. compile_deplibs="$deplib $compile_deplibs"
  7161. finalize_deplibs="$deplib $finalize_deplibs"
  7162. fi
  7163. func_stripname '-L' '' "$deplib"
  7164. func_resolve_sysroot "$func_stripname_result"
  7165. func_append newlib_search_path " $func_resolve_sysroot_result"
  7166. ;;
  7167. *)
  7168. func_warning "'-L' is ignored for archives/objects"
  7169. ;;
  7170. esac # linkmode
  7171. continue
  7172. ;; # -L
  7173. -R*)
  7174. if test link = "$pass"; then
  7175. func_stripname '-R' '' "$deplib"
  7176. func_resolve_sysroot "$func_stripname_result"
  7177. dir=$func_resolve_sysroot_result
  7178. # Make sure the xrpath contains only unique directories.
  7179. case "$xrpath " in
  7180. *" $dir "*) ;;
  7181. *) func_append xrpath " $dir" ;;
  7182. esac
  7183. fi
  7184. deplibs="$deplib $deplibs"
  7185. continue
  7186. ;;
  7187. *.la)
  7188. func_resolve_sysroot "$deplib"
  7189. lib=$func_resolve_sysroot_result
  7190. ;;
  7191. *.$libext)
  7192. if test conv = "$pass"; then
  7193. deplibs="$deplib $deplibs"
  7194. continue
  7195. fi
  7196. case $linkmode in
  7197. lib)
  7198. # Linking convenience modules into shared libraries is allowed,
  7199. # but linking other static libraries is non-portable.
  7200. case " $dlpreconveniencelibs " in
  7201. *" $deplib "*) ;;
  7202. *)
  7203. valid_a_lib=false
  7204. case $deplibs_check_method in
  7205. match_pattern*)
  7206. set dummy $deplibs_check_method; shift
  7207. match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
  7208. if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \
  7209. | $EGREP "$match_pattern_regex" > /dev/null; then
  7210. valid_a_lib=:
  7211. fi
  7212. ;;
  7213. pass_all)
  7214. valid_a_lib=:
  7215. ;;
  7216. esac
  7217. if $valid_a_lib; then
  7218. echo
  7219. $ECHO "*** Warning: Linking the shared library $output against the"
  7220. $ECHO "*** static library $deplib is not portable!"
  7221. deplibs="$deplib $deplibs"
  7222. else
  7223. echo
  7224. $ECHO "*** Warning: Trying to link with static lib archive $deplib."
  7225. echo "*** I have the capability to make that library automatically link in when"
  7226. echo "*** you link to this library. But I can only do this if you have a"
  7227. echo "*** shared version of the library, which you do not appear to have"
  7228. echo "*** because the file extensions .$libext of this argument makes me believe"
  7229. echo "*** that it is just a static archive that I should not use here."
  7230. fi
  7231. ;;
  7232. esac
  7233. continue
  7234. ;;
  7235. prog)
  7236. if test link != "$pass"; then
  7237. deplibs="$deplib $deplibs"
  7238. else
  7239. compile_deplibs="$deplib $compile_deplibs"
  7240. finalize_deplibs="$deplib $finalize_deplibs"
  7241. fi
  7242. continue
  7243. ;;
  7244. esac # linkmode
  7245. ;; # *.$libext
  7246. *.lo | *.$objext)
  7247. if test conv = "$pass"; then
  7248. deplibs="$deplib $deplibs"
  7249. elif test prog = "$linkmode"; then
  7250. if test dlpreopen = "$pass" || test yes != "$dlopen_support" || test no = "$build_libtool_libs"; then
  7251. # If there is no dlopen support or we're linking statically,
  7252. # we need to preload.
  7253. func_append newdlprefiles " $deplib"
  7254. compile_deplibs="$deplib $compile_deplibs"
  7255. finalize_deplibs="$deplib $finalize_deplibs"
  7256. else
  7257. func_append newdlfiles " $deplib"
  7258. fi
  7259. fi
  7260. continue
  7261. ;;
  7262. %DEPLIBS%)
  7263. alldeplibs=:
  7264. continue
  7265. ;;
  7266. esac # case $deplib
  7267. $found || test -f "$lib" \
  7268. || func_fatal_error "cannot find the library '$lib' or unhandled argument '$deplib'"
  7269. # Check to see that this really is a libtool archive.
  7270. func_lalib_unsafe_p "$lib" \
  7271. || func_fatal_error "'$lib' is not a valid libtool archive"
  7272. func_dirname "$lib" "" "."
  7273. ladir=$func_dirname_result
  7274. dlname=
  7275. dlopen=
  7276. dlpreopen=
  7277. libdir=
  7278. library_names=
  7279. old_library=
  7280. inherited_linker_flags=
  7281. # If the library was installed with an old release of libtool,
  7282. # it will not redefine variables installed, or shouldnotlink
  7283. installed=yes
  7284. shouldnotlink=no
  7285. avoidtemprpath=
  7286. # Read the .la file
  7287. func_source "$lib"
  7288. # Convert "-framework foo" to "foo.ltframework"
  7289. if test -n "$inherited_linker_flags"; then
  7290. tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'`
  7291. for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do
  7292. case " $new_inherited_linker_flags " in
  7293. *" $tmp_inherited_linker_flag "*) ;;
  7294. *) func_append new_inherited_linker_flags " $tmp_inherited_linker_flag";;
  7295. esac
  7296. done
  7297. fi
  7298. dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
  7299. if test lib,link = "$linkmode,$pass" ||
  7300. test prog,scan = "$linkmode,$pass" ||
  7301. { test prog != "$linkmode" && test lib != "$linkmode"; }; then
  7302. test -n "$dlopen" && func_append dlfiles " $dlopen"
  7303. test -n "$dlpreopen" && func_append dlprefiles " $dlpreopen"
  7304. fi
  7305. if test conv = "$pass"; then
  7306. # Only check for convenience libraries
  7307. deplibs="$lib $deplibs"
  7308. if test -z "$libdir"; then
  7309. if test -z "$old_library"; then
  7310. func_fatal_error "cannot find name of link library for '$lib'"
  7311. fi
  7312. # It is a libtool convenience library, so add in its objects.
  7313. func_append convenience " $ladir/$objdir/$old_library"
  7314. func_append old_convenience " $ladir/$objdir/$old_library"
  7315. tmp_libs=
  7316. for deplib in $dependency_libs; do
  7317. deplibs="$deplib $deplibs"
  7318. if $opt_preserve_dup_deps; then
  7319. case "$tmp_libs " in
  7320. *" $deplib "*) func_append specialdeplibs " $deplib" ;;
  7321. esac
  7322. fi
  7323. func_append tmp_libs " $deplib"
  7324. done
  7325. elif test prog != "$linkmode" && test lib != "$linkmode"; then
  7326. func_fatal_error "'$lib' is not a convenience library"
  7327. fi
  7328. continue
  7329. fi # $pass = conv
  7330. # Get the name of the library we link against.
  7331. linklib=
  7332. if test -n "$old_library" &&
  7333. { test yes = "$prefer_static_libs" ||
  7334. test built,no = "$prefer_static_libs,$installed"; }; then
  7335. linklib=$old_library
  7336. else
  7337. for l in $old_library $library_names; do
  7338. linklib=$l
  7339. done
  7340. fi
  7341. if test -z "$linklib"; then
  7342. func_fatal_error "cannot find name of link library for '$lib'"
  7343. fi
  7344. # This library was specified with -dlopen.
  7345. if test dlopen = "$pass"; then
  7346. test -z "$libdir" \
  7347. && func_fatal_error "cannot -dlopen a convenience library: '$lib'"
  7348. if test -z "$dlname" ||
  7349. test yes != "$dlopen_support" ||
  7350. test no = "$build_libtool_libs"
  7351. then
  7352. # If there is no dlname, no dlopen support or we're linking
  7353. # statically, we need to preload. We also need to preload any
  7354. # dependent libraries so libltdl's deplib preloader doesn't
  7355. # bomb out in the load deplibs phase.
  7356. func_append dlprefiles " $lib $dependency_libs"
  7357. else
  7358. func_append newdlfiles " $lib"
  7359. fi
  7360. continue
  7361. fi # $pass = dlopen
  7362. # We need an absolute path.
  7363. case $ladir in
  7364. [\\/]* | [A-Za-z]:[\\/]*) abs_ladir=$ladir ;;
  7365. *)
  7366. abs_ladir=`cd "$ladir" && pwd`
  7367. if test -z "$abs_ladir"; then
  7368. func_warning "cannot determine absolute directory name of '$ladir'"
  7369. func_warning "passing it literally to the linker, although it might fail"
  7370. abs_ladir=$ladir
  7371. fi
  7372. ;;
  7373. esac
  7374. func_basename "$lib"
  7375. laname=$func_basename_result
  7376. # Find the relevant object directory and library name.
  7377. if test yes = "$installed"; then
  7378. if test ! -f "$lt_sysroot$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
  7379. func_warning "library '$lib' was moved."
  7380. dir=$ladir
  7381. absdir=$abs_ladir
  7382. libdir=$abs_ladir
  7383. else
  7384. dir=$lt_sysroot$libdir
  7385. absdir=$lt_sysroot$libdir
  7386. fi
  7387. test yes = "$hardcode_automatic" && avoidtemprpath=yes
  7388. else
  7389. if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
  7390. dir=$ladir
  7391. absdir=$abs_ladir
  7392. # Remove this search path later
  7393. func_append notinst_path " $abs_ladir"
  7394. else
  7395. dir=$ladir/$objdir
  7396. absdir=$abs_ladir/$objdir
  7397. # Remove this search path later
  7398. func_append notinst_path " $abs_ladir"
  7399. fi
  7400. fi # $installed = yes
  7401. func_stripname 'lib' '.la' "$laname"
  7402. name=$func_stripname_result
  7403. # This library was specified with -dlpreopen.
  7404. if test dlpreopen = "$pass"; then
  7405. if test -z "$libdir" && test prog = "$linkmode"; then
  7406. func_fatal_error "only libraries may -dlpreopen a convenience library: '$lib'"
  7407. fi
  7408. case $host in
  7409. # special handling for platforms with PE-DLLs.
  7410. *cygwin* | *mingw* | *cegcc* )
  7411. # Linker will automatically link against shared library if both
  7412. # static and shared are present. Therefore, ensure we extract
  7413. # symbols from the import library if a shared library is present
  7414. # (otherwise, the dlopen module name will be incorrect). We do
  7415. # this by putting the import library name into $newdlprefiles.
  7416. # We recover the dlopen module name by 'saving' the la file
  7417. # name in a special purpose variable, and (later) extracting the
  7418. # dlname from the la file.
  7419. if test -n "$dlname"; then
  7420. func_tr_sh "$dir/$linklib"
  7421. eval "libfile_$func_tr_sh_result=\$abs_ladir/\$laname"
  7422. func_append newdlprefiles " $dir/$linklib"
  7423. else
  7424. func_append newdlprefiles " $dir/$old_library"
  7425. # Keep a list of preopened convenience libraries to check
  7426. # that they are being used correctly in the link pass.
  7427. test -z "$libdir" && \
  7428. func_append dlpreconveniencelibs " $dir/$old_library"
  7429. fi
  7430. ;;
  7431. * )
  7432. # Prefer using a static library (so that no silly _DYNAMIC symbols
  7433. # are required to link).
  7434. if test -n "$old_library"; then
  7435. func_append newdlprefiles " $dir/$old_library"
  7436. # Keep a list of preopened convenience libraries to check
  7437. # that they are being used correctly in the link pass.
  7438. test -z "$libdir" && \
  7439. func_append dlpreconveniencelibs " $dir/$old_library"
  7440. # Otherwise, use the dlname, so that lt_dlopen finds it.
  7441. elif test -n "$dlname"; then
  7442. func_append newdlprefiles " $dir/$dlname"
  7443. else
  7444. func_append newdlprefiles " $dir/$linklib"
  7445. fi
  7446. ;;
  7447. esac
  7448. fi # $pass = dlpreopen
  7449. if test -z "$libdir"; then
  7450. # Link the convenience library
  7451. if test lib = "$linkmode"; then
  7452. deplibs="$dir/$old_library $deplibs"
  7453. elif test prog,link = "$linkmode,$pass"; then
  7454. compile_deplibs="$dir/$old_library $compile_deplibs"
  7455. finalize_deplibs="$dir/$old_library $finalize_deplibs"
  7456. else
  7457. deplibs="$lib $deplibs" # used for prog,scan pass
  7458. fi
  7459. continue
  7460. fi
  7461. if test prog = "$linkmode" && test link != "$pass"; then
  7462. func_append newlib_search_path " $ladir"
  7463. deplibs="$lib $deplibs"
  7464. linkalldeplibs=false
  7465. if test no != "$link_all_deplibs" || test -z "$library_names" ||
  7466. test no = "$build_libtool_libs"; then
  7467. linkalldeplibs=:
  7468. fi
  7469. tmp_libs=
  7470. for deplib in $dependency_libs; do
  7471. case $deplib in
  7472. -L*) func_stripname '-L' '' "$deplib"
  7473. func_resolve_sysroot "$func_stripname_result"
  7474. func_append newlib_search_path " $func_resolve_sysroot_result"
  7475. ;;
  7476. esac
  7477. # Need to link against all dependency_libs?
  7478. if $linkalldeplibs; then
  7479. deplibs="$deplib $deplibs"
  7480. else
  7481. # Need to hardcode shared library paths
  7482. # or/and link against static libraries
  7483. newdependency_libs="$deplib $newdependency_libs"
  7484. fi
  7485. if $opt_preserve_dup_deps; then
  7486. case "$tmp_libs " in
  7487. *" $deplib "*) func_append specialdeplibs " $deplib" ;;
  7488. esac
  7489. fi
  7490. func_append tmp_libs " $deplib"
  7491. done # for deplib
  7492. continue
  7493. fi # $linkmode = prog...
  7494. if test prog,link = "$linkmode,$pass"; then
  7495. if test -n "$library_names" &&
  7496. { { test no = "$prefer_static_libs" ||
  7497. test built,yes = "$prefer_static_libs,$installed"; } ||
  7498. test -z "$old_library"; }; then
  7499. # We need to hardcode the library path
  7500. if test -n "$shlibpath_var" && test -z "$avoidtemprpath"; then
  7501. # Make sure the rpath contains only unique directories.
  7502. case $temp_rpath: in
  7503. *"$absdir:"*) ;;
  7504. *) func_append temp_rpath "$absdir:" ;;
  7505. esac
  7506. fi
  7507. # Hardcode the library path.
  7508. # Skip directories that are in the system default run-time
  7509. # search path.
  7510. case " $sys_lib_dlsearch_path " in
  7511. *" $absdir "*) ;;
  7512. *)
  7513. case "$compile_rpath " in
  7514. *" $absdir "*) ;;
  7515. *) func_append compile_rpath " $absdir" ;;
  7516. esac
  7517. ;;
  7518. esac
  7519. case " $sys_lib_dlsearch_path " in
  7520. *" $libdir "*) ;;
  7521. *)
  7522. case "$finalize_rpath " in
  7523. *" $libdir "*) ;;
  7524. *) func_append finalize_rpath " $libdir" ;;
  7525. esac
  7526. ;;
  7527. esac
  7528. fi # $linkmode,$pass = prog,link...
  7529. if $alldeplibs &&
  7530. { test pass_all = "$deplibs_check_method" ||
  7531. { test yes = "$build_libtool_libs" &&
  7532. test -n "$library_names"; }; }; then
  7533. # We only need to search for static libraries
  7534. continue
  7535. fi
  7536. fi
  7537. link_static=no # Whether the deplib will be linked statically
  7538. use_static_libs=$prefer_static_libs
  7539. if test built = "$use_static_libs" && test yes = "$installed"; then
  7540. use_static_libs=no
  7541. fi
  7542. if test -n "$library_names" &&
  7543. { test no = "$use_static_libs" || test -z "$old_library"; }; then
  7544. case $host in
  7545. *cygwin* | *mingw* | *cegcc* | *os2*)
  7546. # No point in relinking DLLs because paths are not encoded
  7547. func_append notinst_deplibs " $lib"
  7548. need_relink=no
  7549. ;;
  7550. *)
  7551. if test no = "$installed"; then
  7552. func_append notinst_deplibs " $lib"
  7553. need_relink=yes
  7554. fi
  7555. ;;
  7556. esac
  7557. # This is a shared library
  7558. # Warn about portability, can't link against -module's on some
  7559. # systems (darwin). Don't bleat about dlopened modules though!
  7560. dlopenmodule=
  7561. for dlpremoduletest in $dlprefiles; do
  7562. if test "X$dlpremoduletest" = "X$lib"; then
  7563. dlopenmodule=$dlpremoduletest
  7564. break
  7565. fi
  7566. done
  7567. if test -z "$dlopenmodule" && test yes = "$shouldnotlink" && test link = "$pass"; then
  7568. echo
  7569. if test prog = "$linkmode"; then
  7570. $ECHO "*** Warning: Linking the executable $output against the loadable module"
  7571. else
  7572. $ECHO "*** Warning: Linking the shared library $output against the loadable module"
  7573. fi
  7574. $ECHO "*** $linklib is not portable!"
  7575. fi
  7576. if test lib = "$linkmode" &&
  7577. test yes = "$hardcode_into_libs"; then
  7578. # Hardcode the library path.
  7579. # Skip directories that are in the system default run-time
  7580. # search path.
  7581. case " $sys_lib_dlsearch_path " in
  7582. *" $absdir "*) ;;
  7583. *)
  7584. case "$compile_rpath " in
  7585. *" $absdir "*) ;;
  7586. *) func_append compile_rpath " $absdir" ;;
  7587. esac
  7588. ;;
  7589. esac
  7590. case " $sys_lib_dlsearch_path " in
  7591. *" $libdir "*) ;;
  7592. *)
  7593. case "$finalize_rpath " in
  7594. *" $libdir "*) ;;
  7595. *) func_append finalize_rpath " $libdir" ;;
  7596. esac
  7597. ;;
  7598. esac
  7599. fi
  7600. if test -n "$old_archive_from_expsyms_cmds"; then
  7601. # figure out the soname
  7602. set dummy $library_names
  7603. shift
  7604. realname=$1
  7605. shift
  7606. libname=`eval "\\$ECHO \"$libname_spec\""`
  7607. # use dlname if we got it. it's perfectly good, no?
  7608. if test -n "$dlname"; then
  7609. soname=$dlname
  7610. elif test -n "$soname_spec"; then
  7611. # bleh windows
  7612. case $host in
  7613. *cygwin* | mingw* | *cegcc* | *os2*)
  7614. func_arith $current - $age
  7615. major=$func_arith_result
  7616. versuffix=-$major
  7617. ;;
  7618. esac
  7619. eval soname=\"$soname_spec\"
  7620. else
  7621. soname=$realname
  7622. fi
  7623. # Make a new name for the extract_expsyms_cmds to use
  7624. soroot=$soname
  7625. func_basename "$soroot"
  7626. soname=$func_basename_result
  7627. func_stripname 'lib' '.dll' "$soname"
  7628. newlib=libimp-$func_stripname_result.a
  7629. # If the library has no export list, then create one now
  7630. if test -f "$output_objdir/$soname-def"; then :
  7631. else
  7632. func_verbose "extracting exported symbol list from '$soname'"
  7633. func_execute_cmds "$extract_expsyms_cmds" 'exit $?'
  7634. fi
  7635. # Create $newlib
  7636. if test -f "$output_objdir/$newlib"; then :; else
  7637. func_verbose "generating import library for '$soname'"
  7638. func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?'
  7639. fi
  7640. # make sure the library variables are pointing to the new library
  7641. dir=$output_objdir
  7642. linklib=$newlib
  7643. fi # test -n "$old_archive_from_expsyms_cmds"
  7644. if test prog = "$linkmode" || test relink != "$opt_mode"; then
  7645. add_shlibpath=
  7646. add_dir=
  7647. add=
  7648. lib_linked=yes
  7649. case $hardcode_action in
  7650. immediate | unsupported)
  7651. if test no = "$hardcode_direct"; then
  7652. add=$dir/$linklib
  7653. case $host in
  7654. *-*-sco3.2v5.0.[024]*) add_dir=-L$dir ;;
  7655. *-*-sysv4*uw2*) add_dir=-L$dir ;;
  7656. *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
  7657. *-*-unixware7*) add_dir=-L$dir ;;
  7658. *-*-darwin* )
  7659. # if the lib is a (non-dlopened) module then we cannot
  7660. # link against it, someone is ignoring the earlier warnings
  7661. if /usr/bin/file -L $add 2> /dev/null |
  7662. $GREP ": [^:]* bundle" >/dev/null; then
  7663. if test "X$dlopenmodule" != "X$lib"; then
  7664. $ECHO "*** Warning: lib $linklib is a module, not a shared library"
  7665. if test -z "$old_library"; then
  7666. echo
  7667. echo "*** And there doesn't seem to be a static archive available"
  7668. echo "*** The link will probably fail, sorry"
  7669. else
  7670. add=$dir/$old_library
  7671. fi
  7672. elif test -n "$old_library"; then
  7673. add=$dir/$old_library
  7674. fi
  7675. fi
  7676. esac
  7677. elif test no = "$hardcode_minus_L"; then
  7678. case $host in
  7679. *-*-sunos*) add_shlibpath=$dir ;;
  7680. esac
  7681. add_dir=-L$dir
  7682. add=-l$name
  7683. elif test no = "$hardcode_shlibpath_var"; then
  7684. add_shlibpath=$dir
  7685. add=-l$name
  7686. else
  7687. lib_linked=no
  7688. fi
  7689. ;;
  7690. relink)
  7691. if test yes = "$hardcode_direct" &&
  7692. test no = "$hardcode_direct_absolute"; then
  7693. add=$dir/$linklib
  7694. elif test yes = "$hardcode_minus_L"; then
  7695. add_dir=-L$absdir
  7696. # Try looking first in the location we're being installed to.
  7697. if test -n "$inst_prefix_dir"; then
  7698. case $libdir in
  7699. [\\/]*)
  7700. func_append add_dir " -L$inst_prefix_dir$libdir"
  7701. ;;
  7702. esac
  7703. fi
  7704. add=-l$name
  7705. elif test yes = "$hardcode_shlibpath_var"; then
  7706. add_shlibpath=$dir
  7707. add=-l$name
  7708. else
  7709. lib_linked=no
  7710. fi
  7711. ;;
  7712. *) lib_linked=no ;;
  7713. esac
  7714. if test yes != "$lib_linked"; then
  7715. func_fatal_configuration "unsupported hardcode properties"
  7716. fi
  7717. if test -n "$add_shlibpath"; then
  7718. case :$compile_shlibpath: in
  7719. *":$add_shlibpath:"*) ;;
  7720. *) func_append compile_shlibpath "$add_shlibpath:" ;;
  7721. esac
  7722. fi
  7723. if test prog = "$linkmode"; then
  7724. test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
  7725. test -n "$add" && compile_deplibs="$add $compile_deplibs"
  7726. else
  7727. test -n "$add_dir" && deplibs="$add_dir $deplibs"
  7728. test -n "$add" && deplibs="$add $deplibs"
  7729. if test yes != "$hardcode_direct" &&
  7730. test yes != "$hardcode_minus_L" &&
  7731. test yes = "$hardcode_shlibpath_var"; then
  7732. case :$finalize_shlibpath: in
  7733. *":$libdir:"*) ;;
  7734. *) func_append finalize_shlibpath "$libdir:" ;;
  7735. esac
  7736. fi
  7737. fi
  7738. fi
  7739. if test prog = "$linkmode" || test relink = "$opt_mode"; then
  7740. add_shlibpath=
  7741. add_dir=
  7742. add=
  7743. # Finalize command for both is simple: just hardcode it.
  7744. if test yes = "$hardcode_direct" &&
  7745. test no = "$hardcode_direct_absolute"; then
  7746. add=$libdir/$linklib
  7747. elif test yes = "$hardcode_minus_L"; then
  7748. add_dir=-L$libdir
  7749. add=-l$name
  7750. elif test yes = "$hardcode_shlibpath_var"; then
  7751. case :$finalize_shlibpath: in
  7752. *":$libdir:"*) ;;
  7753. *) func_append finalize_shlibpath "$libdir:" ;;
  7754. esac
  7755. add=-l$name
  7756. elif test yes = "$hardcode_automatic"; then
  7757. if test -n "$inst_prefix_dir" &&
  7758. test -f "$inst_prefix_dir$libdir/$linklib"; then
  7759. add=$inst_prefix_dir$libdir/$linklib
  7760. else
  7761. add=$libdir/$linklib
  7762. fi
  7763. else
  7764. # We cannot seem to hardcode it, guess we'll fake it.
  7765. add_dir=-L$libdir
  7766. # Try looking first in the location we're being installed to.
  7767. if test -n "$inst_prefix_dir"; then
  7768. case $libdir in
  7769. [\\/]*)
  7770. func_append add_dir " -L$inst_prefix_dir$libdir"
  7771. ;;
  7772. esac
  7773. fi
  7774. add=-l$name
  7775. fi
  7776. if test prog = "$linkmode"; then
  7777. test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
  7778. test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
  7779. else
  7780. test -n "$add_dir" && deplibs="$add_dir $deplibs"
  7781. test -n "$add" && deplibs="$add $deplibs"
  7782. fi
  7783. fi
  7784. elif test prog = "$linkmode"; then
  7785. # Here we assume that one of hardcode_direct or hardcode_minus_L
  7786. # is not unsupported. This is valid on all known static and
  7787. # shared platforms.
  7788. if test unsupported != "$hardcode_direct"; then
  7789. test -n "$old_library" && linklib=$old_library
  7790. compile_deplibs="$dir/$linklib $compile_deplibs"
  7791. finalize_deplibs="$dir/$linklib $finalize_deplibs"
  7792. else
  7793. compile_deplibs="-l$name -L$dir $compile_deplibs"
  7794. finalize_deplibs="-l$name -L$dir $finalize_deplibs"
  7795. fi
  7796. elif test yes = "$build_libtool_libs"; then
  7797. # Not a shared library
  7798. if test pass_all != "$deplibs_check_method"; then
  7799. # We're trying link a shared library against a static one
  7800. # but the system doesn't support it.
  7801. # Just print a warning and add the library to dependency_libs so
  7802. # that the program can be linked against the static library.
  7803. echo
  7804. $ECHO "*** Warning: This system cannot link to static lib archive $lib."
  7805. echo "*** I have the capability to make that library automatically link in when"
  7806. echo "*** you link to this library. But I can only do this if you have a"
  7807. echo "*** shared version of the library, which you do not appear to have."
  7808. if test yes = "$module"; then
  7809. echo "*** But as you try to build a module library, libtool will still create "
  7810. echo "*** a static module, that should work as long as the dlopening application"
  7811. echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
  7812. if test -z "$global_symbol_pipe"; then
  7813. echo
  7814. echo "*** However, this would only work if libtool was able to extract symbol"
  7815. echo "*** lists from a program, using 'nm' or equivalent, but libtool could"
  7816. echo "*** not find such a program. So, this module is probably useless."
  7817. echo "*** 'nm' from GNU binutils and a full rebuild may help."
  7818. fi
  7819. if test no = "$build_old_libs"; then
  7820. build_libtool_libs=module
  7821. build_old_libs=yes
  7822. else
  7823. build_libtool_libs=no
  7824. fi
  7825. fi
  7826. else
  7827. deplibs="$dir/$old_library $deplibs"
  7828. link_static=yes
  7829. fi
  7830. fi # link shared/static library?
  7831. if test lib = "$linkmode"; then
  7832. if test -n "$dependency_libs" &&
  7833. { test yes != "$hardcode_into_libs" ||
  7834. test yes = "$build_old_libs" ||
  7835. test yes = "$link_static"; }; then
  7836. # Extract -R from dependency_libs
  7837. temp_deplibs=
  7838. for libdir in $dependency_libs; do
  7839. case $libdir in
  7840. -R*) func_stripname '-R' '' "$libdir"
  7841. temp_xrpath=$func_stripname_result
  7842. case " $xrpath " in
  7843. *" $temp_xrpath "*) ;;
  7844. *) func_append xrpath " $temp_xrpath";;
  7845. esac;;
  7846. *) func_append temp_deplibs " $libdir";;
  7847. esac
  7848. done
  7849. dependency_libs=$temp_deplibs
  7850. fi
  7851. func_append newlib_search_path " $absdir"
  7852. # Link against this library
  7853. test no = "$link_static" && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
  7854. # ... and its dependency_libs
  7855. tmp_libs=
  7856. for deplib in $dependency_libs; do
  7857. newdependency_libs="$deplib $newdependency_libs"
  7858. case $deplib in
  7859. -L*) func_stripname '-L' '' "$deplib"
  7860. func_resolve_sysroot "$func_stripname_result";;
  7861. *) func_resolve_sysroot "$deplib" ;;
  7862. esac
  7863. if $opt_preserve_dup_deps; then
  7864. case "$tmp_libs " in
  7865. *" $func_resolve_sysroot_result "*)
  7866. func_append specialdeplibs " $func_resolve_sysroot_result" ;;
  7867. esac
  7868. fi
  7869. func_append tmp_libs " $func_resolve_sysroot_result"
  7870. done
  7871. if test no != "$link_all_deplibs"; then
  7872. # Add the search paths of all dependency libraries
  7873. for deplib in $dependency_libs; do
  7874. path=
  7875. case $deplib in
  7876. -L*) path=$deplib ;;
  7877. *.la)
  7878. func_resolve_sysroot "$deplib"
  7879. deplib=$func_resolve_sysroot_result
  7880. func_dirname "$deplib" "" "."
  7881. dir=$func_dirname_result
  7882. # We need an absolute path.
  7883. case $dir in
  7884. [\\/]* | [A-Za-z]:[\\/]*) absdir=$dir ;;
  7885. *)
  7886. absdir=`cd "$dir" && pwd`
  7887. if test -z "$absdir"; then
  7888. func_warning "cannot determine absolute directory name of '$dir'"
  7889. absdir=$dir
  7890. fi
  7891. ;;
  7892. esac
  7893. if $GREP "^installed=no" $deplib > /dev/null; then
  7894. case $host in
  7895. *-*-darwin*)
  7896. depdepl=
  7897. eval deplibrary_names=`$SED -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
  7898. if test -n "$deplibrary_names"; then
  7899. for tmp in $deplibrary_names; do
  7900. depdepl=$tmp
  7901. done
  7902. if test -f "$absdir/$objdir/$depdepl"; then
  7903. depdepl=$absdir/$objdir/$depdepl
  7904. darwin_install_name=`$OTOOL -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
  7905. if test -z "$darwin_install_name"; then
  7906. darwin_install_name=`$OTOOL64 -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
  7907. fi
  7908. func_append compiler_flags " $wl-dylib_file $wl$darwin_install_name:$depdepl"
  7909. func_append linker_flags " -dylib_file $darwin_install_name:$depdepl"
  7910. path=
  7911. fi
  7912. fi
  7913. ;;
  7914. *)
  7915. path=-L$absdir/$objdir
  7916. ;;
  7917. esac
  7918. else
  7919. eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
  7920. test -z "$libdir" && \
  7921. func_fatal_error "'$deplib' is not a valid libtool archive"
  7922. test "$absdir" != "$libdir" && \
  7923. func_warning "'$deplib' seems to be moved"
  7924. path=-L$absdir
  7925. fi
  7926. ;;
  7927. esac
  7928. case " $deplibs " in
  7929. *" $path "*) ;;
  7930. *) deplibs="$path $deplibs" ;;
  7931. esac
  7932. done
  7933. fi # link_all_deplibs != no
  7934. fi # linkmode = lib
  7935. done # for deplib in $libs
  7936. if test link = "$pass"; then
  7937. if test prog = "$linkmode"; then
  7938. compile_deplibs="$new_inherited_linker_flags $compile_deplibs"
  7939. finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs"
  7940. else
  7941. compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
  7942. fi
  7943. fi
  7944. dependency_libs=$newdependency_libs
  7945. if test dlpreopen = "$pass"; then
  7946. # Link the dlpreopened libraries before other libraries
  7947. for deplib in $save_deplibs; do
  7948. deplibs="$deplib $deplibs"
  7949. done
  7950. fi
  7951. if test dlopen != "$pass"; then
  7952. test conv = "$pass" || {
  7953. # Make sure lib_search_path contains only unique directories.
  7954. lib_search_path=
  7955. for dir in $newlib_search_path; do
  7956. case "$lib_search_path " in
  7957. *" $dir "*) ;;
  7958. *) func_append lib_search_path " $dir" ;;
  7959. esac
  7960. done
  7961. newlib_search_path=
  7962. }
  7963. if test prog,link = "$linkmode,$pass"; then
  7964. vars="compile_deplibs finalize_deplibs"
  7965. else
  7966. vars=deplibs
  7967. fi
  7968. for var in $vars dependency_libs; do
  7969. # Add libraries to $var in reverse order
  7970. eval tmp_libs=\"\$$var\"
  7971. new_libs=
  7972. for deplib in $tmp_libs; do
  7973. # FIXME: Pedantically, this is the right thing to do, so
  7974. # that some nasty dependency loop isn't accidentally
  7975. # broken:
  7976. #new_libs="$deplib $new_libs"
  7977. # Pragmatically, this seems to cause very few problems in
  7978. # practice:
  7979. case $deplib in
  7980. -L*) new_libs="$deplib $new_libs" ;;
  7981. -R*) ;;
  7982. *)
  7983. # And here is the reason: when a library appears more
  7984. # than once as an explicit dependence of a library, or
  7985. # is implicitly linked in more than once by the
  7986. # compiler, it is considered special, and multiple
  7987. # occurrences thereof are not removed. Compare this
  7988. # with having the same library being listed as a
  7989. # dependency of multiple other libraries: in this case,
  7990. # we know (pedantically, we assume) the library does not
  7991. # need to be listed more than once, so we keep only the
  7992. # last copy. This is not always right, but it is rare
  7993. # enough that we require users that really mean to play
  7994. # such unportable linking tricks to link the library
  7995. # using -Wl,-lname, so that libtool does not consider it
  7996. # for duplicate removal.
  7997. case " $specialdeplibs " in
  7998. *" $deplib "*) new_libs="$deplib $new_libs" ;;
  7999. *)
  8000. case " $new_libs " in
  8001. *" $deplib "*) ;;
  8002. *) new_libs="$deplib $new_libs" ;;
  8003. esac
  8004. ;;
  8005. esac
  8006. ;;
  8007. esac
  8008. done
  8009. tmp_libs=
  8010. for deplib in $new_libs; do
  8011. case $deplib in
  8012. -L*)
  8013. case " $tmp_libs " in
  8014. *" $deplib "*) ;;
  8015. *) func_append tmp_libs " $deplib" ;;
  8016. esac
  8017. ;;
  8018. *) func_append tmp_libs " $deplib" ;;
  8019. esac
  8020. done
  8021. eval $var=\"$tmp_libs\"
  8022. done # for var
  8023. fi
  8024. # Add Sun CC postdeps if required:
  8025. test CXX = "$tagname" && {
  8026. case $host_os in
  8027. linux*)
  8028. case `$CC -V 2>&1 | sed 5q` in
  8029. *Sun\ C*) # Sun C++ 5.9
  8030. func_suncc_cstd_abi
  8031. if test no != "$suncc_use_cstd_abi"; then
  8032. func_append postdeps ' -library=Cstd -library=Crun'
  8033. fi
  8034. ;;
  8035. esac
  8036. ;;
  8037. solaris*)
  8038. func_cc_basename "$CC"
  8039. case $func_cc_basename_result in
  8040. CC* | sunCC*)
  8041. func_suncc_cstd_abi
  8042. if test no != "$suncc_use_cstd_abi"; then
  8043. func_append postdeps ' -library=Cstd -library=Crun'
  8044. fi
  8045. ;;
  8046. esac
  8047. ;;
  8048. esac
  8049. }
  8050. # Last step: remove runtime libs from dependency_libs
  8051. # (they stay in deplibs)
  8052. tmp_libs=
  8053. for i in $dependency_libs; do
  8054. case " $predeps $postdeps $compiler_lib_search_path " in
  8055. *" $i "*)
  8056. i=
  8057. ;;
  8058. esac
  8059. if test -n "$i"; then
  8060. func_append tmp_libs " $i"
  8061. fi
  8062. done
  8063. dependency_libs=$tmp_libs
  8064. done # for pass
  8065. if test prog = "$linkmode"; then
  8066. dlfiles=$newdlfiles
  8067. fi
  8068. if test prog = "$linkmode" || test lib = "$linkmode"; then
  8069. dlprefiles=$newdlprefiles
  8070. fi
  8071. case $linkmode in
  8072. oldlib)
  8073. if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then
  8074. func_warning "'-dlopen' is ignored for archives"
  8075. fi
  8076. case " $deplibs" in
  8077. *\ -l* | *\ -L*)
  8078. func_warning "'-l' and '-L' are ignored for archives" ;;
  8079. esac
  8080. test -n "$rpath" && \
  8081. func_warning "'-rpath' is ignored for archives"
  8082. test -n "$xrpath" && \
  8083. func_warning "'-R' is ignored for archives"
  8084. test -n "$vinfo" && \
  8085. func_warning "'-version-info/-version-number' is ignored for archives"
  8086. test -n "$release" && \
  8087. func_warning "'-release' is ignored for archives"
  8088. test -n "$export_symbols$export_symbols_regex" && \
  8089. func_warning "'-export-symbols' is ignored for archives"
  8090. # Now set the variables for building old libraries.
  8091. build_libtool_libs=no
  8092. oldlibs=$output
  8093. func_append objs "$old_deplibs"
  8094. ;;
  8095. lib)
  8096. # Make sure we only generate libraries of the form 'libNAME.la'.
  8097. case $outputname in
  8098. lib*)
  8099. func_stripname 'lib' '.la' "$outputname"
  8100. name=$func_stripname_result
  8101. eval shared_ext=\"$shrext_cmds\"
  8102. eval libname=\"$libname_spec\"
  8103. ;;
  8104. *)
  8105. test no = "$module" \
  8106. && func_fatal_help "libtool library '$output' must begin with 'lib'"
  8107. if test no != "$need_lib_prefix"; then
  8108. # Add the "lib" prefix for modules if required
  8109. func_stripname '' '.la' "$outputname"
  8110. name=$func_stripname_result
  8111. eval shared_ext=\"$shrext_cmds\"
  8112. eval libname=\"$libname_spec\"
  8113. else
  8114. func_stripname '' '.la' "$outputname"
  8115. libname=$func_stripname_result
  8116. fi
  8117. ;;
  8118. esac
  8119. if test -n "$objs"; then
  8120. if test pass_all != "$deplibs_check_method"; then
  8121. func_fatal_error "cannot build libtool library '$output' from non-libtool objects on this host:$objs"
  8122. else
  8123. echo
  8124. $ECHO "*** Warning: Linking the shared library $output against the non-libtool"
  8125. $ECHO "*** objects $objs is not portable!"
  8126. func_append libobjs " $objs"
  8127. fi
  8128. fi
  8129. test no = "$dlself" \
  8130. || func_warning "'-dlopen self' is ignored for libtool libraries"
  8131. set dummy $rpath
  8132. shift
  8133. test 1 -lt "$#" \
  8134. && func_warning "ignoring multiple '-rpath's for a libtool library"
  8135. install_libdir=$1
  8136. oldlibs=
  8137. if test -z "$rpath"; then
  8138. if test yes = "$build_libtool_libs"; then
  8139. # Building a libtool convenience library.
  8140. # Some compilers have problems with a '.al' extension so
  8141. # convenience libraries should have the same extension an
  8142. # archive normally would.
  8143. oldlibs="$output_objdir/$libname.$libext $oldlibs"
  8144. build_libtool_libs=convenience
  8145. build_old_libs=yes
  8146. fi
  8147. test -n "$vinfo" && \
  8148. func_warning "'-version-info/-version-number' is ignored for convenience libraries"
  8149. test -n "$release" && \
  8150. func_warning "'-release' is ignored for convenience libraries"
  8151. else
  8152. # Parse the version information argument.
  8153. save_ifs=$IFS; IFS=:
  8154. set dummy $vinfo 0 0 0
  8155. shift
  8156. IFS=$save_ifs
  8157. test -n "$7" && \
  8158. func_fatal_help "too many parameters to '-version-info'"
  8159. # convert absolute version numbers to libtool ages
  8160. # this retains compatibility with .la files and attempts
  8161. # to make the code below a bit more comprehensible
  8162. case $vinfo_number in
  8163. yes)
  8164. number_major=$1
  8165. number_minor=$2
  8166. number_revision=$3
  8167. #
  8168. # There are really only two kinds -- those that
  8169. # use the current revision as the major version
  8170. # and those that subtract age and use age as
  8171. # a minor version. But, then there is irix
  8172. # that has an extra 1 added just for fun
  8173. #
  8174. case $version_type in
  8175. # correct linux to gnu/linux during the next big refactor
  8176. darwin|freebsd-elf|linux|osf|windows|none)
  8177. func_arith $number_major + $number_minor
  8178. current=$func_arith_result
  8179. age=$number_minor
  8180. revision=$number_revision
  8181. ;;
  8182. freebsd-aout|qnx|sunos)
  8183. current=$number_major
  8184. revision=$number_minor
  8185. age=0
  8186. ;;
  8187. irix|nonstopux)
  8188. func_arith $number_major + $number_minor
  8189. current=$func_arith_result
  8190. age=$number_minor
  8191. revision=$number_minor
  8192. lt_irix_increment=no
  8193. ;;
  8194. *)
  8195. func_fatal_configuration "$modename: unknown library version type '$version_type'"
  8196. ;;
  8197. esac
  8198. ;;
  8199. no)
  8200. current=$1
  8201. revision=$2
  8202. age=$3
  8203. ;;
  8204. esac
  8205. # Check that each of the things are valid numbers.
  8206. case $current in
  8207. 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]) ;;
  8208. *)
  8209. func_error "CURRENT '$current' must be a nonnegative integer"
  8210. func_fatal_error "'$vinfo' is not valid version information"
  8211. ;;
  8212. esac
  8213. case $revision in
  8214. 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]) ;;
  8215. *)
  8216. func_error "REVISION '$revision' must be a nonnegative integer"
  8217. func_fatal_error "'$vinfo' is not valid version information"
  8218. ;;
  8219. esac
  8220. case $age in
  8221. 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]) ;;
  8222. *)
  8223. func_error "AGE '$age' must be a nonnegative integer"
  8224. func_fatal_error "'$vinfo' is not valid version information"
  8225. ;;
  8226. esac
  8227. if test "$age" -gt "$current"; then
  8228. func_error "AGE '$age' is greater than the current interface number '$current'"
  8229. func_fatal_error "'$vinfo' is not valid version information"
  8230. fi
  8231. # Calculate the version variables.
  8232. major=
  8233. versuffix=
  8234. verstring=
  8235. case $version_type in
  8236. none) ;;
  8237. darwin)
  8238. # Like Linux, but with the current version available in
  8239. # verstring for coding it into the library header
  8240. func_arith $current - $age
  8241. major=.$func_arith_result
  8242. versuffix=$major.$age.$revision
  8243. # Darwin ld doesn't like 0 for these options...
  8244. func_arith $current + 1
  8245. minor_current=$func_arith_result
  8246. xlcverstring="$wl-compatibility_version $wl$minor_current $wl-current_version $wl$minor_current.$revision"
  8247. verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
  8248. # On Darwin other compilers
  8249. case $CC in
  8250. nagfor*)
  8251. verstring="$wl-compatibility_version $wl$minor_current $wl-current_version $wl$minor_current.$revision"
  8252. ;;
  8253. *)
  8254. verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
  8255. ;;
  8256. esac
  8257. ;;
  8258. freebsd-aout)
  8259. major=.$current
  8260. versuffix=.$current.$revision
  8261. ;;
  8262. freebsd-elf)
  8263. func_arith $current - $age
  8264. major=.$func_arith_result
  8265. versuffix=$major.$age.$revision
  8266. ;;
  8267. irix | nonstopux)
  8268. if test no = "$lt_irix_increment"; then
  8269. func_arith $current - $age
  8270. else
  8271. func_arith $current - $age + 1
  8272. fi
  8273. major=$func_arith_result
  8274. case $version_type in
  8275. nonstopux) verstring_prefix=nonstopux ;;
  8276. *) verstring_prefix=sgi ;;
  8277. esac
  8278. verstring=$verstring_prefix$major.$revision
  8279. # Add in all the interfaces that we are compatible with.
  8280. loop=$revision
  8281. while test 0 -ne "$loop"; do
  8282. func_arith $revision - $loop
  8283. iface=$func_arith_result
  8284. func_arith $loop - 1
  8285. loop=$func_arith_result
  8286. verstring=$verstring_prefix$major.$iface:$verstring
  8287. done
  8288. # Before this point, $major must not contain '.'.
  8289. major=.$major
  8290. versuffix=$major.$revision
  8291. ;;
  8292. linux) # correct to gnu/linux during the next big refactor
  8293. func_arith $current - $age
  8294. major=.$func_arith_result
  8295. versuffix=$major.$age.$revision
  8296. ;;
  8297. osf)
  8298. func_arith $current - $age
  8299. major=.$func_arith_result
  8300. versuffix=.$current.$age.$revision
  8301. verstring=$current.$age.$revision
  8302. # Add in all the interfaces that we are compatible with.
  8303. loop=$age
  8304. while test 0 -ne "$loop"; do
  8305. func_arith $current - $loop
  8306. iface=$func_arith_result
  8307. func_arith $loop - 1
  8308. loop=$func_arith_result
  8309. verstring=$verstring:$iface.0
  8310. done
  8311. # Make executables depend on our current version.
  8312. func_append verstring ":$current.0"
  8313. ;;
  8314. qnx)
  8315. major=.$current
  8316. versuffix=.$current
  8317. ;;
  8318. sco)
  8319. major=.$current
  8320. versuffix=.$current
  8321. ;;
  8322. sunos)
  8323. major=.$current
  8324. versuffix=.$current.$revision
  8325. ;;
  8326. windows)
  8327. # Use '-' rather than '.', since we only want one
  8328. # extension on DOS 8.3 file systems.
  8329. func_arith $current - $age
  8330. major=$func_arith_result
  8331. versuffix=-$major
  8332. ;;
  8333. *)
  8334. func_fatal_configuration "unknown library version type '$version_type'"
  8335. ;;
  8336. esac
  8337. # Clear the version info if we defaulted, and they specified a release.
  8338. if test -z "$vinfo" && test -n "$release"; then
  8339. major=
  8340. case $version_type in
  8341. darwin)
  8342. # we can't check for "0.0" in archive_cmds due to quoting
  8343. # problems, so we reset it completely
  8344. verstring=
  8345. ;;
  8346. *)
  8347. verstring=0.0
  8348. ;;
  8349. esac
  8350. if test no = "$need_version"; then
  8351. versuffix=
  8352. else
  8353. versuffix=.0.0
  8354. fi
  8355. fi
  8356. # Remove version info from name if versioning should be avoided
  8357. if test yes,no = "$avoid_version,$need_version"; then
  8358. major=
  8359. versuffix=
  8360. verstring=
  8361. fi
  8362. # Check to see if the archive will have undefined symbols.
  8363. if test yes = "$allow_undefined"; then
  8364. if test unsupported = "$allow_undefined_flag"; then
  8365. if test yes = "$build_old_libs"; then
  8366. func_warning "undefined symbols not allowed in $host shared libraries; building static only"
  8367. build_libtool_libs=no
  8368. else
  8369. func_fatal_error "can't build $host shared library unless -no-undefined is specified"
  8370. fi
  8371. fi
  8372. else
  8373. # Don't allow undefined symbols.
  8374. allow_undefined_flag=$no_undefined_flag
  8375. fi
  8376. fi
  8377. func_generate_dlsyms "$libname" "$libname" :
  8378. func_append libobjs " $symfileobj"
  8379. test " " = "$libobjs" && libobjs=
  8380. if test relink != "$opt_mode"; then
  8381. # Remove our outputs, but don't remove object files since they
  8382. # may have been created when compiling PIC objects.
  8383. removelist=
  8384. tempremovelist=`$ECHO "$output_objdir/*"`
  8385. for p in $tempremovelist; do
  8386. case $p in
  8387. *.$objext | *.gcno)
  8388. ;;
  8389. $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/$libname$release.*)
  8390. if test -n "$precious_files_regex"; then
  8391. if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
  8392. then
  8393. continue
  8394. fi
  8395. fi
  8396. func_append removelist " $p"
  8397. ;;
  8398. *) ;;
  8399. esac
  8400. done
  8401. test -n "$removelist" && \
  8402. func_show_eval "${RM}r \$removelist"
  8403. fi
  8404. # Now set the variables for building old libraries.
  8405. if test yes = "$build_old_libs" && test convenience != "$build_libtool_libs"; then
  8406. func_append oldlibs " $output_objdir/$libname.$libext"
  8407. # Transform .lo files to .o files.
  8408. oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.$libext$/d; $lo2o" | $NL2SP`
  8409. fi
  8410. # Eliminate all temporary directories.
  8411. #for path in $notinst_path; do
  8412. # lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"`
  8413. # deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"`
  8414. # dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"`
  8415. #done
  8416. if test -n "$xrpath"; then
  8417. # If the user specified any rpath flags, then add them.
  8418. temp_xrpath=
  8419. for libdir in $xrpath; do
  8420. func_replace_sysroot "$libdir"
  8421. func_append temp_xrpath " -R$func_replace_sysroot_result"
  8422. case "$finalize_rpath " in
  8423. *" $libdir "*) ;;
  8424. *) func_append finalize_rpath " $libdir" ;;
  8425. esac
  8426. done
  8427. if test yes != "$hardcode_into_libs" || test yes = "$build_old_libs"; then
  8428. dependency_libs="$temp_xrpath $dependency_libs"
  8429. fi
  8430. fi
  8431. # Make sure dlfiles contains only unique files that won't be dlpreopened
  8432. old_dlfiles=$dlfiles
  8433. dlfiles=
  8434. for lib in $old_dlfiles; do
  8435. case " $dlprefiles $dlfiles " in
  8436. *" $lib "*) ;;
  8437. *) func_append dlfiles " $lib" ;;
  8438. esac
  8439. done
  8440. # Make sure dlprefiles contains only unique files
  8441. old_dlprefiles=$dlprefiles
  8442. dlprefiles=
  8443. for lib in $old_dlprefiles; do
  8444. case "$dlprefiles " in
  8445. *" $lib "*) ;;
  8446. *) func_append dlprefiles " $lib" ;;
  8447. esac
  8448. done
  8449. if test yes = "$build_libtool_libs"; then
  8450. if test -n "$rpath"; then
  8451. case $host in
  8452. *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*)
  8453. # these systems don't actually have a c library (as such)!
  8454. ;;
  8455. *-*-rhapsody* | *-*-darwin1.[012])
  8456. # Rhapsody C library is in the System framework
  8457. func_append deplibs " System.ltframework"
  8458. ;;
  8459. *-*-netbsd*)
  8460. # Don't link with libc until the a.out ld.so is fixed.
  8461. ;;
  8462. *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
  8463. # Do not include libc due to us having libc/libc_r.
  8464. ;;
  8465. *-*-sco3.2v5* | *-*-sco5v6*)
  8466. # Causes problems with __ctype
  8467. ;;
  8468. *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
  8469. # Compiler inserts libc in the correct place for threads to work
  8470. ;;
  8471. *)
  8472. # Add libc to deplibs on all other systems if necessary.
  8473. if test yes = "$build_libtool_need_lc"; then
  8474. func_append deplibs " -lc"
  8475. fi
  8476. ;;
  8477. esac
  8478. fi
  8479. # Transform deplibs into only deplibs that can be linked in shared.
  8480. name_save=$name
  8481. libname_save=$libname
  8482. release_save=$release
  8483. versuffix_save=$versuffix
  8484. major_save=$major
  8485. # I'm not sure if I'm treating the release correctly. I think
  8486. # release should show up in the -l (ie -lgmp5) so we don't want to
  8487. # add it in twice. Is that correct?
  8488. release=
  8489. versuffix=
  8490. major=
  8491. newdeplibs=
  8492. droppeddeps=no
  8493. case $deplibs_check_method in
  8494. pass_all)
  8495. # Don't check for shared/static. Everything works.
  8496. # This might be a little naive. We might want to check
  8497. # whether the library exists or not. But this is on
  8498. # osf3 & osf4 and I'm not really sure... Just
  8499. # implementing what was already the behavior.
  8500. newdeplibs=$deplibs
  8501. ;;
  8502. test_compile)
  8503. # This code stresses the "libraries are programs" paradigm to its
  8504. # limits. Maybe even breaks it. We compile a program, linking it
  8505. # against the deplibs as a proxy for the library. Then we can check
  8506. # whether they linked in statically or dynamically with ldd.
  8507. $opt_dry_run || $RM conftest.c
  8508. cat > conftest.c <<EOF
  8509. int main() { return 0; }
  8510. EOF
  8511. $opt_dry_run || $RM conftest
  8512. if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then
  8513. ldd_output=`ldd conftest`
  8514. for i in $deplibs; do
  8515. case $i in
  8516. -l*)
  8517. func_stripname -l '' "$i"
  8518. name=$func_stripname_result
  8519. if test yes = "$allow_libtool_libs_with_static_runtimes"; then
  8520. case " $predeps $postdeps " in
  8521. *" $i "*)
  8522. func_append newdeplibs " $i"
  8523. i=
  8524. ;;
  8525. esac
  8526. fi
  8527. if test -n "$i"; then
  8528. libname=`eval "\\$ECHO \"$libname_spec\""`
  8529. deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
  8530. set dummy $deplib_matches; shift
  8531. deplib_match=$1
  8532. if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0; then
  8533. func_append newdeplibs " $i"
  8534. else
  8535. droppeddeps=yes
  8536. echo
  8537. $ECHO "*** Warning: dynamic linker does not accept needed library $i."
  8538. echo "*** I have the capability to make that library automatically link in when"
  8539. echo "*** you link to this library. But I can only do this if you have a"
  8540. echo "*** shared version of the library, which I believe you do not have"
  8541. echo "*** because a test_compile did reveal that the linker did not use it for"
  8542. echo "*** its dynamic dependency list that programs get resolved with at runtime."
  8543. fi
  8544. fi
  8545. ;;
  8546. *)
  8547. func_append newdeplibs " $i"
  8548. ;;
  8549. esac
  8550. done
  8551. else
  8552. # Error occurred in the first compile. Let's try to salvage
  8553. # the situation: Compile a separate program for each library.
  8554. for i in $deplibs; do
  8555. case $i in
  8556. -l*)
  8557. func_stripname -l '' "$i"
  8558. name=$func_stripname_result
  8559. $opt_dry_run || $RM conftest
  8560. if $LTCC $LTCFLAGS -o conftest conftest.c $i; then
  8561. ldd_output=`ldd conftest`
  8562. if test yes = "$allow_libtool_libs_with_static_runtimes"; then
  8563. case " $predeps $postdeps " in
  8564. *" $i "*)
  8565. func_append newdeplibs " $i"
  8566. i=
  8567. ;;
  8568. esac
  8569. fi
  8570. if test -n "$i"; then
  8571. libname=`eval "\\$ECHO \"$libname_spec\""`
  8572. deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
  8573. set dummy $deplib_matches; shift
  8574. deplib_match=$1
  8575. if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0; then
  8576. func_append newdeplibs " $i"
  8577. else
  8578. droppeddeps=yes
  8579. echo
  8580. $ECHO "*** Warning: dynamic linker does not accept needed library $i."
  8581. echo "*** I have the capability to make that library automatically link in when"
  8582. echo "*** you link to this library. But I can only do this if you have a"
  8583. echo "*** shared version of the library, which you do not appear to have"
  8584. echo "*** because a test_compile did reveal that the linker did not use this one"
  8585. echo "*** as a dynamic dependency that programs can get resolved with at runtime."
  8586. fi
  8587. fi
  8588. else
  8589. droppeddeps=yes
  8590. echo
  8591. $ECHO "*** Warning! Library $i is needed by this library but I was not able to"
  8592. echo "*** make it link in! You will probably need to install it or some"
  8593. echo "*** library that it depends on before this library will be fully"
  8594. echo "*** functional. Installing it before continuing would be even better."
  8595. fi
  8596. ;;
  8597. *)
  8598. func_append newdeplibs " $i"
  8599. ;;
  8600. esac
  8601. done
  8602. fi
  8603. ;;
  8604. file_magic*)
  8605. set dummy $deplibs_check_method; shift
  8606. file_magic_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
  8607. for a_deplib in $deplibs; do
  8608. case $a_deplib in
  8609. -l*)
  8610. func_stripname -l '' "$a_deplib"
  8611. name=$func_stripname_result
  8612. if test yes = "$allow_libtool_libs_with_static_runtimes"; then
  8613. case " $predeps $postdeps " in
  8614. *" $a_deplib "*)
  8615. func_append newdeplibs " $a_deplib"
  8616. a_deplib=
  8617. ;;
  8618. esac
  8619. fi
  8620. if test -n "$a_deplib"; then
  8621. libname=`eval "\\$ECHO \"$libname_spec\""`
  8622. if test -n "$file_magic_glob"; then
  8623. libnameglob=`func_echo_all "$libname" | $SED -e $file_magic_glob`
  8624. else
  8625. libnameglob=$libname
  8626. fi
  8627. test yes = "$want_nocaseglob" && nocaseglob=`shopt -p nocaseglob`
  8628. for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
  8629. if test yes = "$want_nocaseglob"; then
  8630. shopt -s nocaseglob
  8631. potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`
  8632. $nocaseglob
  8633. else
  8634. potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`
  8635. fi
  8636. for potent_lib in $potential_libs; do
  8637. # Follow soft links.
  8638. if ls -lLd "$potent_lib" 2>/dev/null |
  8639. $GREP " -> " >/dev/null; then
  8640. continue
  8641. fi
  8642. # The statement above tries to avoid entering an
  8643. # endless loop below, in case of cyclic links.
  8644. # We might still enter an endless loop, since a link
  8645. # loop can be closed while we follow links,
  8646. # but so what?
  8647. potlib=$potent_lib
  8648. while test -h "$potlib" 2>/dev/null; do
  8649. potliblink=`ls -ld $potlib | $SED 's/.* -> //'`
  8650. case $potliblink in
  8651. [\\/]* | [A-Za-z]:[\\/]*) potlib=$potliblink;;
  8652. *) potlib=`$ECHO "$potlib" | $SED 's|[^/]*$||'`"$potliblink";;
  8653. esac
  8654. done
  8655. if eval $file_magic_cmd \"\$potlib\" 2>/dev/null |
  8656. $SED -e 10q |
  8657. $EGREP "$file_magic_regex" > /dev/null; then
  8658. func_append newdeplibs " $a_deplib"
  8659. a_deplib=
  8660. break 2
  8661. fi
  8662. done
  8663. done
  8664. fi
  8665. if test -n "$a_deplib"; then
  8666. droppeddeps=yes
  8667. echo
  8668. $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
  8669. echo "*** I have the capability to make that library automatically link in when"
  8670. echo "*** you link to this library. But I can only do this if you have a"
  8671. echo "*** shared version of the library, which you do not appear to have"
  8672. echo "*** because I did check the linker path looking for a file starting"
  8673. if test -z "$potlib"; then
  8674. $ECHO "*** with $libname but no candidates were found. (...for file magic test)"
  8675. else
  8676. $ECHO "*** with $libname and none of the candidates passed a file format test"
  8677. $ECHO "*** using a file magic. Last file checked: $potlib"
  8678. fi
  8679. fi
  8680. ;;
  8681. *)
  8682. # Add a -L argument.
  8683. func_append newdeplibs " $a_deplib"
  8684. ;;
  8685. esac
  8686. done # Gone through all deplibs.
  8687. ;;
  8688. match_pattern*)
  8689. set dummy $deplibs_check_method; shift
  8690. match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
  8691. for a_deplib in $deplibs; do
  8692. case $a_deplib in
  8693. -l*)
  8694. func_stripname -l '' "$a_deplib"
  8695. name=$func_stripname_result
  8696. if test yes = "$allow_libtool_libs_with_static_runtimes"; then
  8697. case " $predeps $postdeps " in
  8698. *" $a_deplib "*)
  8699. func_append newdeplibs " $a_deplib"
  8700. a_deplib=
  8701. ;;
  8702. esac
  8703. fi
  8704. if test -n "$a_deplib"; then
  8705. libname=`eval "\\$ECHO \"$libname_spec\""`
  8706. for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
  8707. potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
  8708. for potent_lib in $potential_libs; do
  8709. potlib=$potent_lib # see symlink-check above in file_magic test
  8710. if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \
  8711. $EGREP "$match_pattern_regex" > /dev/null; then
  8712. func_append newdeplibs " $a_deplib"
  8713. a_deplib=
  8714. break 2
  8715. fi
  8716. done
  8717. done
  8718. fi
  8719. if test -n "$a_deplib"; then
  8720. droppeddeps=yes
  8721. echo
  8722. $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
  8723. echo "*** I have the capability to make that library automatically link in when"
  8724. echo "*** you link to this library. But I can only do this if you have a"
  8725. echo "*** shared version of the library, which you do not appear to have"
  8726. echo "*** because I did check the linker path looking for a file starting"
  8727. if test -z "$potlib"; then
  8728. $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)"
  8729. else
  8730. $ECHO "*** with $libname and none of the candidates passed a file format test"
  8731. $ECHO "*** using a regex pattern. Last file checked: $potlib"
  8732. fi
  8733. fi
  8734. ;;
  8735. *)
  8736. # Add a -L argument.
  8737. func_append newdeplibs " $a_deplib"
  8738. ;;
  8739. esac
  8740. done # Gone through all deplibs.
  8741. ;;
  8742. none | unknown | *)
  8743. newdeplibs=
  8744. tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'`
  8745. if test yes = "$allow_libtool_libs_with_static_runtimes"; then
  8746. for i in $predeps $postdeps; do
  8747. # can't use Xsed below, because $i might contain '/'
  8748. tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s|$i||"`
  8749. done
  8750. fi
  8751. case $tmp_deplibs in
  8752. *[!\ \ ]*)
  8753. echo
  8754. if test none = "$deplibs_check_method"; then
  8755. echo "*** Warning: inter-library dependencies are not supported in this platform."
  8756. else
  8757. echo "*** Warning: inter-library dependencies are not known to be supported."
  8758. fi
  8759. echo "*** All declared inter-library dependencies are being dropped."
  8760. droppeddeps=yes
  8761. ;;
  8762. esac
  8763. ;;
  8764. esac
  8765. versuffix=$versuffix_save
  8766. major=$major_save
  8767. release=$release_save
  8768. libname=$libname_save
  8769. name=$name_save
  8770. case $host in
  8771. *-*-rhapsody* | *-*-darwin1.[012])
  8772. # On Rhapsody replace the C library with the System framework
  8773. newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'`
  8774. ;;
  8775. esac
  8776. if test yes = "$droppeddeps"; then
  8777. if test yes = "$module"; then
  8778. echo
  8779. echo "*** Warning: libtool could not satisfy all declared inter-library"
  8780. $ECHO "*** dependencies of module $libname. Therefore, libtool will create"
  8781. echo "*** a static module, that should work as long as the dlopening"
  8782. echo "*** application is linked with the -dlopen flag."
  8783. if test -z "$global_symbol_pipe"; then
  8784. echo
  8785. echo "*** However, this would only work if libtool was able to extract symbol"
  8786. echo "*** lists from a program, using 'nm' or equivalent, but libtool could"
  8787. echo "*** not find such a program. So, this module is probably useless."
  8788. echo "*** 'nm' from GNU binutils and a full rebuild may help."
  8789. fi
  8790. if test no = "$build_old_libs"; then
  8791. oldlibs=$output_objdir/$libname.$libext
  8792. build_libtool_libs=module
  8793. build_old_libs=yes
  8794. else
  8795. build_libtool_libs=no
  8796. fi
  8797. else
  8798. echo "*** The inter-library dependencies that have been dropped here will be"
  8799. echo "*** automatically added whenever a program is linked with this library"
  8800. echo "*** or is declared to -dlopen it."
  8801. if test no = "$allow_undefined"; then
  8802. echo
  8803. echo "*** Since this library must not contain undefined symbols,"
  8804. echo "*** because either the platform does not support them or"
  8805. echo "*** it was explicitly requested with -no-undefined,"
  8806. echo "*** libtool will only create a static version of it."
  8807. if test no = "$build_old_libs"; then
  8808. oldlibs=$output_objdir/$libname.$libext
  8809. build_libtool_libs=module
  8810. build_old_libs=yes
  8811. else
  8812. build_libtool_libs=no
  8813. fi
  8814. fi
  8815. fi
  8816. fi
  8817. # Done checking deplibs!
  8818. deplibs=$newdeplibs
  8819. fi
  8820. # Time to change all our "foo.ltframework" stuff back to "-framework foo"
  8821. case $host in
  8822. *-*-darwin*)
  8823. newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
  8824. new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
  8825. deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
  8826. ;;
  8827. esac
  8828. # move library search paths that coincide with paths to not yet
  8829. # installed libraries to the beginning of the library search list
  8830. new_libs=
  8831. for path in $notinst_path; do
  8832. case " $new_libs " in
  8833. *" -L$path/$objdir "*) ;;
  8834. *)
  8835. case " $deplibs " in
  8836. *" -L$path/$objdir "*)
  8837. func_append new_libs " -L$path/$objdir" ;;
  8838. esac
  8839. ;;
  8840. esac
  8841. done
  8842. for deplib in $deplibs; do
  8843. case $deplib in
  8844. -L*)
  8845. case " $new_libs " in
  8846. *" $deplib "*) ;;
  8847. *) func_append new_libs " $deplib" ;;
  8848. esac
  8849. ;;
  8850. *) func_append new_libs " $deplib" ;;
  8851. esac
  8852. done
  8853. deplibs=$new_libs
  8854. # All the library-specific variables (install_libdir is set above).
  8855. library_names=
  8856. old_library=
  8857. dlname=
  8858. # Test again, we may have decided not to build it any more
  8859. if test yes = "$build_libtool_libs"; then
  8860. # Remove $wl instances when linking with ld.
  8861. # FIXME: should test the right _cmds variable.
  8862. case $archive_cmds in
  8863. *\$LD\ *) wl= ;;
  8864. esac
  8865. if test yes = "$hardcode_into_libs"; then
  8866. # Hardcode the library paths
  8867. hardcode_libdirs=
  8868. dep_rpath=
  8869. rpath=$finalize_rpath
  8870. test relink = "$opt_mode" || rpath=$compile_rpath$rpath
  8871. for libdir in $rpath; do
  8872. if test -n "$hardcode_libdir_flag_spec"; then
  8873. if test -n "$hardcode_libdir_separator"; then
  8874. func_replace_sysroot "$libdir"
  8875. libdir=$func_replace_sysroot_result
  8876. if test -z "$hardcode_libdirs"; then
  8877. hardcode_libdirs=$libdir
  8878. else
  8879. # Just accumulate the unique libdirs.
  8880. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
  8881. *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
  8882. ;;
  8883. *)
  8884. func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
  8885. ;;
  8886. esac
  8887. fi
  8888. else
  8889. eval flag=\"$hardcode_libdir_flag_spec\"
  8890. func_append dep_rpath " $flag"
  8891. fi
  8892. elif test -n "$runpath_var"; then
  8893. case "$perm_rpath " in
  8894. *" $libdir "*) ;;
  8895. *) func_append perm_rpath " $libdir" ;;
  8896. esac
  8897. fi
  8898. done
  8899. # Substitute the hardcoded libdirs into the rpath.
  8900. if test -n "$hardcode_libdir_separator" &&
  8901. test -n "$hardcode_libdirs"; then
  8902. libdir=$hardcode_libdirs
  8903. eval "dep_rpath=\"$hardcode_libdir_flag_spec\""
  8904. fi
  8905. if test -n "$runpath_var" && test -n "$perm_rpath"; then
  8906. # We should set the runpath_var.
  8907. rpath=
  8908. for dir in $perm_rpath; do
  8909. func_append rpath "$dir:"
  8910. done
  8911. eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
  8912. fi
  8913. test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
  8914. fi
  8915. shlibpath=$finalize_shlibpath
  8916. test relink = "$opt_mode" || shlibpath=$compile_shlibpath$shlibpath
  8917. if test -n "$shlibpath"; then
  8918. eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
  8919. fi
  8920. # Get the real and link names of the library.
  8921. eval shared_ext=\"$shrext_cmds\"
  8922. eval library_names=\"$library_names_spec\"
  8923. set dummy $library_names
  8924. shift
  8925. realname=$1
  8926. shift
  8927. if test -n "$soname_spec"; then
  8928. eval soname=\"$soname_spec\"
  8929. else
  8930. soname=$realname
  8931. fi
  8932. if test -z "$dlname"; then
  8933. dlname=$soname
  8934. fi
  8935. lib=$output_objdir/$realname
  8936. linknames=
  8937. for link
  8938. do
  8939. func_append linknames " $link"
  8940. done
  8941. # Use standard objects if they are pic
  8942. test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP`
  8943. test "X$libobjs" = "X " && libobjs=
  8944. delfiles=
  8945. if test -n "$export_symbols" && test -n "$include_expsyms"; then
  8946. $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp"
  8947. export_symbols=$output_objdir/$libname.uexp
  8948. func_append delfiles " $export_symbols"
  8949. fi
  8950. orig_export_symbols=
  8951. case $host_os in
  8952. cygwin* | mingw* | cegcc*)
  8953. if test -n "$export_symbols" && test -z "$export_symbols_regex"; then
  8954. # exporting using user supplied symfile
  8955. func_dll_def_p "$export_symbols" || {
  8956. # and it's NOT already a .def file. Must figure out
  8957. # which of the given symbols are data symbols and tag
  8958. # them as such. So, trigger use of export_symbols_cmds.
  8959. # export_symbols gets reassigned inside the "prepare
  8960. # the list of exported symbols" if statement, so the
  8961. # include_expsyms logic still works.
  8962. orig_export_symbols=$export_symbols
  8963. export_symbols=
  8964. always_export_symbols=yes
  8965. }
  8966. fi
  8967. ;;
  8968. esac
  8969. # Prepare the list of exported symbols
  8970. if test -z "$export_symbols"; then
  8971. if test yes = "$always_export_symbols" || test -n "$export_symbols_regex"; then
  8972. func_verbose "generating symbol list for '$libname.la'"
  8973. export_symbols=$output_objdir/$libname.exp
  8974. $opt_dry_run || $RM $export_symbols
  8975. cmds=$export_symbols_cmds
  8976. save_ifs=$IFS; IFS='~'
  8977. for cmd1 in $cmds; do
  8978. IFS=$save_ifs
  8979. # Take the normal branch if the nm_file_list_spec branch
  8980. # doesn't work or if tool conversion is not needed.
  8981. case $nm_file_list_spec~$to_tool_file_cmd in
  8982. *~func_convert_file_noop | *~func_convert_file_msys_to_w32 | ~*)
  8983. try_normal_branch=yes
  8984. eval cmd=\"$cmd1\"
  8985. func_len " $cmd"
  8986. len=$func_len_result
  8987. ;;
  8988. *)
  8989. try_normal_branch=no
  8990. ;;
  8991. esac
  8992. if test yes = "$try_normal_branch" \
  8993. && { test "$len" -lt "$max_cmd_len" \
  8994. || test "$max_cmd_len" -le -1; }
  8995. then
  8996. func_show_eval "$cmd" 'exit $?'
  8997. skipped_export=false
  8998. elif test -n "$nm_file_list_spec"; then
  8999. func_basename "$output"
  9000. output_la=$func_basename_result
  9001. save_libobjs=$libobjs
  9002. save_output=$output
  9003. output=$output_objdir/$output_la.nm
  9004. func_to_tool_file "$output"
  9005. libobjs=$nm_file_list_spec$func_to_tool_file_result
  9006. func_append delfiles " $output"
  9007. func_verbose "creating $NM input file list: $output"
  9008. for obj in $save_libobjs; do
  9009. func_to_tool_file "$obj"
  9010. $ECHO "$func_to_tool_file_result"
  9011. done > "$output"
  9012. eval cmd=\"$cmd1\"
  9013. func_show_eval "$cmd" 'exit $?'
  9014. output=$save_output
  9015. libobjs=$save_libobjs
  9016. skipped_export=false
  9017. else
  9018. # The command line is too long to execute in one step.
  9019. func_verbose "using reloadable object file for export list..."
  9020. skipped_export=:
  9021. # Break out early, otherwise skipped_export may be
  9022. # set to false by a later but shorter cmd.
  9023. break
  9024. fi
  9025. done
  9026. IFS=$save_ifs
  9027. if test -n "$export_symbols_regex" && test : != "$skipped_export"; then
  9028. func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
  9029. func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
  9030. fi
  9031. fi
  9032. fi
  9033. if test -n "$export_symbols" && test -n "$include_expsyms"; then
  9034. tmp_export_symbols=$export_symbols
  9035. test -n "$orig_export_symbols" && tmp_export_symbols=$orig_export_symbols
  9036. $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
  9037. fi
  9038. if test : != "$skipped_export" && test -n "$orig_export_symbols"; then
  9039. # The given exports_symbols file has to be filtered, so filter it.
  9040. func_verbose "filter symbol list for '$libname.la' to tag DATA exports"
  9041. # FIXME: $output_objdir/$libname.filter potentially contains lots of
  9042. # 's' commands, which not all seds can handle. GNU sed should be fine
  9043. # though. Also, the filter scales superlinearly with the number of
  9044. # global variables. join(1) would be nice here, but unfortunately
  9045. # isn't a blessed tool.
  9046. $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
  9047. func_append delfiles " $export_symbols $output_objdir/$libname.filter"
  9048. export_symbols=$output_objdir/$libname.def
  9049. $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
  9050. fi
  9051. tmp_deplibs=
  9052. for test_deplib in $deplibs; do
  9053. case " $convenience " in
  9054. *" $test_deplib "*) ;;
  9055. *)
  9056. func_append tmp_deplibs " $test_deplib"
  9057. ;;
  9058. esac
  9059. done
  9060. deplibs=$tmp_deplibs
  9061. if test -n "$convenience"; then
  9062. if test -n "$whole_archive_flag_spec" &&
  9063. test yes = "$compiler_needs_object" &&
  9064. test -z "$libobjs"; then
  9065. # extract the archives, so we have objects to list.
  9066. # TODO: could optimize this to just extract one archive.
  9067. whole_archive_flag_spec=
  9068. fi
  9069. if test -n "$whole_archive_flag_spec"; then
  9070. save_libobjs=$libobjs
  9071. eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
  9072. test "X$libobjs" = "X " && libobjs=
  9073. else
  9074. gentop=$output_objdir/${outputname}x
  9075. func_append generated " $gentop"
  9076. func_extract_archives $gentop $convenience
  9077. func_append libobjs " $func_extract_archives_result"
  9078. test "X$libobjs" = "X " && libobjs=
  9079. fi
  9080. fi
  9081. if test yes = "$thread_safe" && test -n "$thread_safe_flag_spec"; then
  9082. eval flag=\"$thread_safe_flag_spec\"
  9083. func_append linker_flags " $flag"
  9084. fi
  9085. # Make a backup of the uninstalled library when relinking
  9086. if test relink = "$opt_mode"; then
  9087. $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $?
  9088. fi
  9089. # Do each of the archive commands.
  9090. if test yes = "$module" && test -n "$module_cmds"; then
  9091. if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
  9092. eval test_cmds=\"$module_expsym_cmds\"
  9093. cmds=$module_expsym_cmds
  9094. else
  9095. eval test_cmds=\"$module_cmds\"
  9096. cmds=$module_cmds
  9097. fi
  9098. else
  9099. if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
  9100. eval test_cmds=\"$archive_expsym_cmds\"
  9101. cmds=$archive_expsym_cmds
  9102. else
  9103. eval test_cmds=\"$archive_cmds\"
  9104. cmds=$archive_cmds
  9105. fi
  9106. fi
  9107. if test : != "$skipped_export" &&
  9108. func_len " $test_cmds" &&
  9109. len=$func_len_result &&
  9110. test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
  9111. :
  9112. else
  9113. # The command line is too long to link in one step, link piecewise
  9114. # or, if using GNU ld and skipped_export is not :, use a linker
  9115. # script.
  9116. # Save the value of $output and $libobjs because we want to
  9117. # use them later. If we have whole_archive_flag_spec, we
  9118. # want to use save_libobjs as it was before
  9119. # whole_archive_flag_spec was expanded, because we can't
  9120. # assume the linker understands whole_archive_flag_spec.
  9121. # This may have to be revisited, in case too many
  9122. # convenience libraries get linked in and end up exceeding
  9123. # the spec.
  9124. if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
  9125. save_libobjs=$libobjs
  9126. fi
  9127. save_output=$output
  9128. func_basename "$output"
  9129. output_la=$func_basename_result
  9130. # Clear the reloadable object creation command queue and
  9131. # initialize k to one.
  9132. test_cmds=
  9133. concat_cmds=
  9134. objlist=
  9135. last_robj=
  9136. k=1
  9137. if test -n "$save_libobjs" && test : != "$skipped_export" && test yes = "$with_gnu_ld"; then
  9138. output=$output_objdir/$output_la.lnkscript
  9139. func_verbose "creating GNU ld script: $output"
  9140. echo 'INPUT (' > $output
  9141. for obj in $save_libobjs
  9142. do
  9143. func_to_tool_file "$obj"
  9144. $ECHO "$func_to_tool_file_result" >> $output
  9145. done
  9146. echo ')' >> $output
  9147. func_append delfiles " $output"
  9148. func_to_tool_file "$output"
  9149. output=$func_to_tool_file_result
  9150. elif test -n "$save_libobjs" && test : != "$skipped_export" && test -n "$file_list_spec"; then
  9151. output=$output_objdir/$output_la.lnk
  9152. func_verbose "creating linker input file list: $output"
  9153. : > $output
  9154. set x $save_libobjs
  9155. shift
  9156. firstobj=
  9157. if test yes = "$compiler_needs_object"; then
  9158. firstobj="$1 "
  9159. shift
  9160. fi
  9161. for obj
  9162. do
  9163. func_to_tool_file "$obj"
  9164. $ECHO "$func_to_tool_file_result" >> $output
  9165. done
  9166. func_append delfiles " $output"
  9167. func_to_tool_file "$output"
  9168. output=$firstobj\"$file_list_spec$func_to_tool_file_result\"
  9169. else
  9170. if test -n "$save_libobjs"; then
  9171. func_verbose "creating reloadable object files..."
  9172. output=$output_objdir/$output_la-$k.$objext
  9173. eval test_cmds=\"$reload_cmds\"
  9174. func_len " $test_cmds"
  9175. len0=$func_len_result
  9176. len=$len0
  9177. # Loop over the list of objects to be linked.
  9178. for obj in $save_libobjs
  9179. do
  9180. func_len " $obj"
  9181. func_arith $len + $func_len_result
  9182. len=$func_arith_result
  9183. if test -z "$objlist" ||
  9184. test "$len" -lt "$max_cmd_len"; then
  9185. func_append objlist " $obj"
  9186. else
  9187. # The command $test_cmds is almost too long, add a
  9188. # command to the queue.
  9189. if test 1 -eq "$k"; then
  9190. # The first file doesn't have a previous command to add.
  9191. reload_objs=$objlist
  9192. eval concat_cmds=\"$reload_cmds\"
  9193. else
  9194. # All subsequent reloadable object files will link in
  9195. # the last one created.
  9196. reload_objs="$objlist $last_robj"
  9197. eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\"
  9198. fi
  9199. last_robj=$output_objdir/$output_la-$k.$objext
  9200. func_arith $k + 1
  9201. k=$func_arith_result
  9202. output=$output_objdir/$output_la-$k.$objext
  9203. objlist=" $obj"
  9204. func_len " $last_robj"
  9205. func_arith $len0 + $func_len_result
  9206. len=$func_arith_result
  9207. fi
  9208. done
  9209. # Handle the remaining objects by creating one last
  9210. # reloadable object file. All subsequent reloadable object
  9211. # files will link in the last one created.
  9212. test -z "$concat_cmds" || concat_cmds=$concat_cmds~
  9213. reload_objs="$objlist $last_robj"
  9214. eval concat_cmds=\"\$concat_cmds$reload_cmds\"
  9215. if test -n "$last_robj"; then
  9216. eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\"
  9217. fi
  9218. func_append delfiles " $output"
  9219. else
  9220. output=
  9221. fi
  9222. ${skipped_export-false} && {
  9223. func_verbose "generating symbol list for '$libname.la'"
  9224. export_symbols=$output_objdir/$libname.exp
  9225. $opt_dry_run || $RM $export_symbols
  9226. libobjs=$output
  9227. # Append the command to create the export file.
  9228. test -z "$concat_cmds" || concat_cmds=$concat_cmds~
  9229. eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\"
  9230. if test -n "$last_robj"; then
  9231. eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\"
  9232. fi
  9233. }
  9234. test -n "$save_libobjs" &&
  9235. func_verbose "creating a temporary reloadable object file: $output"
  9236. # Loop through the commands generated above and execute them.
  9237. save_ifs=$IFS; IFS='~'
  9238. for cmd in $concat_cmds; do
  9239. IFS=$save_ifs
  9240. $opt_quiet || {
  9241. func_quote_for_expand "$cmd"
  9242. eval "func_echo $func_quote_for_expand_result"
  9243. }
  9244. $opt_dry_run || eval "$cmd" || {
  9245. lt_exit=$?
  9246. # Restore the uninstalled library and exit
  9247. if test relink = "$opt_mode"; then
  9248. ( cd "$output_objdir" && \
  9249. $RM "${realname}T" && \
  9250. $MV "${realname}U" "$realname" )
  9251. fi
  9252. exit $lt_exit
  9253. }
  9254. done
  9255. IFS=$save_ifs
  9256. if test -n "$export_symbols_regex" && ${skipped_export-false}; then
  9257. func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
  9258. func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
  9259. fi
  9260. fi
  9261. ${skipped_export-false} && {
  9262. if test -n "$export_symbols" && test -n "$include_expsyms"; then
  9263. tmp_export_symbols=$export_symbols
  9264. test -n "$orig_export_symbols" && tmp_export_symbols=$orig_export_symbols
  9265. $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
  9266. fi
  9267. if test -n "$orig_export_symbols"; then
  9268. # The given exports_symbols file has to be filtered, so filter it.
  9269. func_verbose "filter symbol list for '$libname.la' to tag DATA exports"
  9270. # FIXME: $output_objdir/$libname.filter potentially contains lots of
  9271. # 's' commands, which not all seds can handle. GNU sed should be fine
  9272. # though. Also, the filter scales superlinearly with the number of
  9273. # global variables. join(1) would be nice here, but unfortunately
  9274. # isn't a blessed tool.
  9275. $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
  9276. func_append delfiles " $export_symbols $output_objdir/$libname.filter"
  9277. export_symbols=$output_objdir/$libname.def
  9278. $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
  9279. fi
  9280. }
  9281. libobjs=$output
  9282. # Restore the value of output.
  9283. output=$save_output
  9284. if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
  9285. eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
  9286. test "X$libobjs" = "X " && libobjs=
  9287. fi
  9288. # Expand the library linking commands again to reset the
  9289. # value of $libobjs for piecewise linking.
  9290. # Do each of the archive commands.
  9291. if test yes = "$module" && test -n "$module_cmds"; then
  9292. if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
  9293. cmds=$module_expsym_cmds
  9294. else
  9295. cmds=$module_cmds
  9296. fi
  9297. else
  9298. if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
  9299. cmds=$archive_expsym_cmds
  9300. else
  9301. cmds=$archive_cmds
  9302. fi
  9303. fi
  9304. fi
  9305. if test -n "$delfiles"; then
  9306. # Append the command to remove temporary files to $cmds.
  9307. eval cmds=\"\$cmds~\$RM $delfiles\"
  9308. fi
  9309. # Add any objects from preloaded convenience libraries
  9310. if test -n "$dlprefiles"; then
  9311. gentop=$output_objdir/${outputname}x
  9312. func_append generated " $gentop"
  9313. func_extract_archives $gentop $dlprefiles
  9314. func_append libobjs " $func_extract_archives_result"
  9315. test "X$libobjs" = "X " && libobjs=
  9316. fi
  9317. save_ifs=$IFS; IFS='~'
  9318. for cmd in $cmds; do
  9319. IFS=$sp$nl
  9320. eval cmd=\"$cmd\"
  9321. IFS=$save_ifs
  9322. $opt_quiet || {
  9323. func_quote_for_expand "$cmd"
  9324. eval "func_echo $func_quote_for_expand_result"
  9325. }
  9326. $opt_dry_run || eval "$cmd" || {
  9327. lt_exit=$?
  9328. # Restore the uninstalled library and exit
  9329. if test relink = "$opt_mode"; then
  9330. ( cd "$output_objdir" && \
  9331. $RM "${realname}T" && \
  9332. $MV "${realname}U" "$realname" )
  9333. fi
  9334. exit $lt_exit
  9335. }
  9336. done
  9337. IFS=$save_ifs
  9338. # Restore the uninstalled library and exit
  9339. if test relink = "$opt_mode"; then
  9340. $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $?
  9341. if test -n "$convenience"; then
  9342. if test -z "$whole_archive_flag_spec"; then
  9343. func_show_eval '${RM}r "$gentop"'
  9344. fi
  9345. fi
  9346. exit $EXIT_SUCCESS
  9347. fi
  9348. # Create links to the real library.
  9349. for linkname in $linknames; do
  9350. if test "$realname" != "$linkname"; then
  9351. func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?'
  9352. fi
  9353. done
  9354. # If -module or -export-dynamic was specified, set the dlname.
  9355. if test yes = "$module" || test yes = "$export_dynamic"; then
  9356. # On all known operating systems, these are identical.
  9357. dlname=$soname
  9358. fi
  9359. fi
  9360. ;;
  9361. obj)
  9362. if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then
  9363. func_warning "'-dlopen' is ignored for objects"
  9364. fi
  9365. case " $deplibs" in
  9366. *\ -l* | *\ -L*)
  9367. func_warning "'-l' and '-L' are ignored for objects" ;;
  9368. esac
  9369. test -n "$rpath" && \
  9370. func_warning "'-rpath' is ignored for objects"
  9371. test -n "$xrpath" && \
  9372. func_warning "'-R' is ignored for objects"
  9373. test -n "$vinfo" && \
  9374. func_warning "'-version-info' is ignored for objects"
  9375. test -n "$release" && \
  9376. func_warning "'-release' is ignored for objects"
  9377. case $output in
  9378. *.lo)
  9379. test -n "$objs$old_deplibs" && \
  9380. func_fatal_error "cannot build library object '$output' from non-libtool objects"
  9381. libobj=$output
  9382. func_lo2o "$libobj"
  9383. obj=$func_lo2o_result
  9384. ;;
  9385. *)
  9386. libobj=
  9387. obj=$output
  9388. ;;
  9389. esac
  9390. # Delete the old objects.
  9391. $opt_dry_run || $RM $obj $libobj
  9392. # Objects from convenience libraries. This assumes
  9393. # single-version convenience libraries. Whenever we create
  9394. # different ones for PIC/non-PIC, this we'll have to duplicate
  9395. # the extraction.
  9396. reload_conv_objs=
  9397. gentop=
  9398. # if reload_cmds runs $LD directly, get rid of -Wl from
  9399. # whole_archive_flag_spec and hope we can get by with turning comma
  9400. # into space.
  9401. case $reload_cmds in
  9402. *\$LD[\ \$]*) wl= ;;
  9403. esac
  9404. if test -n "$convenience"; then
  9405. if test -n "$whole_archive_flag_spec"; then
  9406. eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
  9407. test -n "$wl" || tmp_whole_archive_flags=`$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'`
  9408. reload_conv_objs=$reload_objs\ $tmp_whole_archive_flags
  9409. else
  9410. gentop=$output_objdir/${obj}x
  9411. func_append generated " $gentop"
  9412. func_extract_archives $gentop $convenience
  9413. reload_conv_objs="$reload_objs $func_extract_archives_result"
  9414. fi
  9415. fi
  9416. # If we're not building shared, we need to use non_pic_objs
  9417. test yes = "$build_libtool_libs" || libobjs=$non_pic_objects
  9418. # Create the old-style object.
  9419. reload_objs=$objs$old_deplibs' '`$ECHO "$libobjs" | $SP2NL | $SED "/\.$libext$/d; /\.lib$/d; $lo2o" | $NL2SP`' '$reload_conv_objs
  9420. output=$obj
  9421. func_execute_cmds "$reload_cmds" 'exit $?'
  9422. # Exit if we aren't doing a library object file.
  9423. if test -z "$libobj"; then
  9424. if test -n "$gentop"; then
  9425. func_show_eval '${RM}r "$gentop"'
  9426. fi
  9427. exit $EXIT_SUCCESS
  9428. fi
  9429. test yes = "$build_libtool_libs" || {
  9430. if test -n "$gentop"; then
  9431. func_show_eval '${RM}r "$gentop"'
  9432. fi
  9433. # Create an invalid libtool object if no PIC, so that we don't
  9434. # accidentally link it into a program.
  9435. # $show "echo timestamp > $libobj"
  9436. # $opt_dry_run || eval "echo timestamp > $libobj" || exit $?
  9437. exit $EXIT_SUCCESS
  9438. }
  9439. if test -n "$pic_flag" || test default != "$pic_mode"; then
  9440. # Only do commands if we really have different PIC objects.
  9441. reload_objs="$libobjs $reload_conv_objs"
  9442. output=$libobj
  9443. func_execute_cmds "$reload_cmds" 'exit $?'
  9444. fi
  9445. if test -n "$gentop"; then
  9446. func_show_eval '${RM}r "$gentop"'
  9447. fi
  9448. exit $EXIT_SUCCESS
  9449. ;;
  9450. prog)
  9451. case $host in
  9452. *cygwin*) func_stripname '' '.exe' "$output"
  9453. output=$func_stripname_result.exe;;
  9454. esac
  9455. test -n "$vinfo" && \
  9456. func_warning "'-version-info' is ignored for programs"
  9457. test -n "$release" && \
  9458. func_warning "'-release' is ignored for programs"
  9459. $preload \
  9460. && test unknown,unknown,unknown = "$dlopen_support,$dlopen_self,$dlopen_self_static" \
  9461. && func_warning "'LT_INIT([dlopen])' not used. Assuming no dlopen support."
  9462. case $host in
  9463. *-*-rhapsody* | *-*-darwin1.[012])
  9464. # On Rhapsody replace the C library is the System framework
  9465. compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'`
  9466. finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'`
  9467. ;;
  9468. esac
  9469. case $host in
  9470. *-*-darwin*)
  9471. # Don't allow lazy linking, it breaks C++ global constructors
  9472. # But is supposedly fixed on 10.4 or later (yay!).
  9473. if test CXX = "$tagname"; then
  9474. case ${MACOSX_DEPLOYMENT_TARGET-10.0} in
  9475. 10.[0123])
  9476. func_append compile_command " $wl-bind_at_load"
  9477. func_append finalize_command " $wl-bind_at_load"
  9478. ;;
  9479. esac
  9480. fi
  9481. # Time to change all our "foo.ltframework" stuff back to "-framework foo"
  9482. compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
  9483. finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
  9484. ;;
  9485. esac
  9486. # move library search paths that coincide with paths to not yet
  9487. # installed libraries to the beginning of the library search list
  9488. new_libs=
  9489. for path in $notinst_path; do
  9490. case " $new_libs " in
  9491. *" -L$path/$objdir "*) ;;
  9492. *)
  9493. case " $compile_deplibs " in
  9494. *" -L$path/$objdir "*)
  9495. func_append new_libs " -L$path/$objdir" ;;
  9496. esac
  9497. ;;
  9498. esac
  9499. done
  9500. for deplib in $compile_deplibs; do
  9501. case $deplib in
  9502. -L*)
  9503. case " $new_libs " in
  9504. *" $deplib "*) ;;
  9505. *) func_append new_libs " $deplib" ;;
  9506. esac
  9507. ;;
  9508. *) func_append new_libs " $deplib" ;;
  9509. esac
  9510. done
  9511. compile_deplibs=$new_libs
  9512. func_append compile_command " $compile_deplibs"
  9513. func_append finalize_command " $finalize_deplibs"
  9514. if test -n "$rpath$xrpath"; then
  9515. # If the user specified any rpath flags, then add them.
  9516. for libdir in $rpath $xrpath; do
  9517. # This is the magic to use -rpath.
  9518. case "$finalize_rpath " in
  9519. *" $libdir "*) ;;
  9520. *) func_append finalize_rpath " $libdir" ;;
  9521. esac
  9522. done
  9523. fi
  9524. # Now hardcode the library paths
  9525. rpath=
  9526. hardcode_libdirs=
  9527. for libdir in $compile_rpath $finalize_rpath; do
  9528. if test -n "$hardcode_libdir_flag_spec"; then
  9529. if test -n "$hardcode_libdir_separator"; then
  9530. if test -z "$hardcode_libdirs"; then
  9531. hardcode_libdirs=$libdir
  9532. else
  9533. # Just accumulate the unique libdirs.
  9534. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
  9535. *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
  9536. ;;
  9537. *)
  9538. func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
  9539. ;;
  9540. esac
  9541. fi
  9542. else
  9543. eval flag=\"$hardcode_libdir_flag_spec\"
  9544. func_append rpath " $flag"
  9545. fi
  9546. elif test -n "$runpath_var"; then
  9547. case "$perm_rpath " in
  9548. *" $libdir "*) ;;
  9549. *) func_append perm_rpath " $libdir" ;;
  9550. esac
  9551. fi
  9552. case $host in
  9553. *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
  9554. testbindir=`$ECHO "$libdir" | $SED -e 's*/lib$*/bin*'`
  9555. case :$dllsearchpath: in
  9556. *":$libdir:"*) ;;
  9557. ::) dllsearchpath=$libdir;;
  9558. *) func_append dllsearchpath ":$libdir";;
  9559. esac
  9560. case :$dllsearchpath: in
  9561. *":$testbindir:"*) ;;
  9562. ::) dllsearchpath=$testbindir;;
  9563. *) func_append dllsearchpath ":$testbindir";;
  9564. esac
  9565. ;;
  9566. esac
  9567. done
  9568. # Substitute the hardcoded libdirs into the rpath.
  9569. if test -n "$hardcode_libdir_separator" &&
  9570. test -n "$hardcode_libdirs"; then
  9571. libdir=$hardcode_libdirs
  9572. eval rpath=\" $hardcode_libdir_flag_spec\"
  9573. fi
  9574. compile_rpath=$rpath
  9575. rpath=
  9576. hardcode_libdirs=
  9577. for libdir in $finalize_rpath; do
  9578. if test -n "$hardcode_libdir_flag_spec"; then
  9579. if test -n "$hardcode_libdir_separator"; then
  9580. if test -z "$hardcode_libdirs"; then
  9581. hardcode_libdirs=$libdir
  9582. else
  9583. # Just accumulate the unique libdirs.
  9584. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
  9585. *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
  9586. ;;
  9587. *)
  9588. func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
  9589. ;;
  9590. esac
  9591. fi
  9592. else
  9593. eval flag=\"$hardcode_libdir_flag_spec\"
  9594. func_append rpath " $flag"
  9595. fi
  9596. elif test -n "$runpath_var"; then
  9597. case "$finalize_perm_rpath " in
  9598. *" $libdir "*) ;;
  9599. *) func_append finalize_perm_rpath " $libdir" ;;
  9600. esac
  9601. fi
  9602. done
  9603. # Substitute the hardcoded libdirs into the rpath.
  9604. if test -n "$hardcode_libdir_separator" &&
  9605. test -n "$hardcode_libdirs"; then
  9606. libdir=$hardcode_libdirs
  9607. eval rpath=\" $hardcode_libdir_flag_spec\"
  9608. fi
  9609. finalize_rpath=$rpath
  9610. if test -n "$libobjs" && test yes = "$build_old_libs"; then
  9611. # Transform all the library objects into standard objects.
  9612. compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
  9613. finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
  9614. fi
  9615. func_generate_dlsyms "$outputname" "@PROGRAM@" false
  9616. # template prelinking step
  9617. if test -n "$prelink_cmds"; then
  9618. func_execute_cmds "$prelink_cmds" 'exit $?'
  9619. fi
  9620. wrappers_required=:
  9621. case $host in
  9622. *cegcc* | *mingw32ce*)
  9623. # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway.
  9624. wrappers_required=false
  9625. ;;
  9626. *cygwin* | *mingw* )
  9627. test yes = "$build_libtool_libs" || wrappers_required=false
  9628. ;;
  9629. *)
  9630. if test no = "$need_relink" || test yes != "$build_libtool_libs"; then
  9631. wrappers_required=false
  9632. fi
  9633. ;;
  9634. esac
  9635. $wrappers_required || {
  9636. # Replace the output file specification.
  9637. compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
  9638. link_command=$compile_command$compile_rpath
  9639. # We have no uninstalled library dependencies, so finalize right now.
  9640. exit_status=0
  9641. func_show_eval "$link_command" 'exit_status=$?'
  9642. if test -n "$postlink_cmds"; then
  9643. func_to_tool_file "$output"
  9644. postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
  9645. func_execute_cmds "$postlink_cmds" 'exit $?'
  9646. fi
  9647. # Delete the generated files.
  9648. if test -f "$output_objdir/${outputname}S.$objext"; then
  9649. func_show_eval '$RM "$output_objdir/${outputname}S.$objext"'
  9650. fi
  9651. exit $exit_status
  9652. }
  9653. if test -n "$compile_shlibpath$finalize_shlibpath"; then
  9654. compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
  9655. fi
  9656. if test -n "$finalize_shlibpath"; then
  9657. finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
  9658. fi
  9659. compile_var=
  9660. finalize_var=
  9661. if test -n "$runpath_var"; then
  9662. if test -n "$perm_rpath"; then
  9663. # We should set the runpath_var.
  9664. rpath=
  9665. for dir in $perm_rpath; do
  9666. func_append rpath "$dir:"
  9667. done
  9668. compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
  9669. fi
  9670. if test -n "$finalize_perm_rpath"; then
  9671. # We should set the runpath_var.
  9672. rpath=
  9673. for dir in $finalize_perm_rpath; do
  9674. func_append rpath "$dir:"
  9675. done
  9676. finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
  9677. fi
  9678. fi
  9679. if test yes = "$no_install"; then
  9680. # We don't need to create a wrapper script.
  9681. link_command=$compile_var$compile_command$compile_rpath
  9682. # Replace the output file specification.
  9683. link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
  9684. # Delete the old output file.
  9685. $opt_dry_run || $RM $output
  9686. # Link the executable and exit
  9687. func_show_eval "$link_command" 'exit $?'
  9688. if test -n "$postlink_cmds"; then
  9689. func_to_tool_file "$output"
  9690. postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
  9691. func_execute_cmds "$postlink_cmds" 'exit $?'
  9692. fi
  9693. exit $EXIT_SUCCESS
  9694. fi
  9695. case $hardcode_action,$fast_install in
  9696. relink,*)
  9697. # Fast installation is not supported
  9698. link_command=$compile_var$compile_command$compile_rpath
  9699. relink_command=$finalize_var$finalize_command$finalize_rpath
  9700. func_warning "this platform does not like uninstalled shared libraries"
  9701. func_warning "'$output' will be relinked during installation"
  9702. ;;
  9703. *,yes)
  9704. link_command=$finalize_var$compile_command$finalize_rpath
  9705. relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'`
  9706. ;;
  9707. *,no)
  9708. link_command=$compile_var$compile_command$compile_rpath
  9709. relink_command=$finalize_var$finalize_command$finalize_rpath
  9710. ;;
  9711. *,needless)
  9712. link_command=$finalize_var$compile_command$finalize_rpath
  9713. relink_command=
  9714. ;;
  9715. esac
  9716. # Replace the output file specification.
  9717. link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
  9718. # Delete the old output files.
  9719. $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname
  9720. func_show_eval "$link_command" 'exit $?'
  9721. if test -n "$postlink_cmds"; then
  9722. func_to_tool_file "$output_objdir/$outputname"
  9723. 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'`
  9724. func_execute_cmds "$postlink_cmds" 'exit $?'
  9725. fi
  9726. # Now create the wrapper script.
  9727. func_verbose "creating $output"
  9728. # Quote the relink command for shipping.
  9729. if test -n "$relink_command"; then
  9730. # Preserve any variables that may affect compiler behavior
  9731. for var in $variables_saved_for_relink; do
  9732. if eval test -z \"\${$var+set}\"; then
  9733. relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
  9734. elif eval var_value=\$$var; test -z "$var_value"; then
  9735. relink_command="$var=; export $var; $relink_command"
  9736. else
  9737. func_quote_for_eval "$var_value"
  9738. relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
  9739. fi
  9740. done
  9741. relink_command="(cd `pwd`; $relink_command)"
  9742. relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
  9743. fi
  9744. # Only actually do things if not in dry run mode.
  9745. $opt_dry_run || {
  9746. # win32 will think the script is a binary if it has
  9747. # a .exe suffix, so we strip it off here.
  9748. case $output in
  9749. *.exe) func_stripname '' '.exe' "$output"
  9750. output=$func_stripname_result ;;
  9751. esac
  9752. # test for cygwin because mv fails w/o .exe extensions
  9753. case $host in
  9754. *cygwin*)
  9755. exeext=.exe
  9756. func_stripname '' '.exe' "$outputname"
  9757. outputname=$func_stripname_result ;;
  9758. *) exeext= ;;
  9759. esac
  9760. case $host in
  9761. *cygwin* | *mingw* )
  9762. func_dirname_and_basename "$output" "" "."
  9763. output_name=$func_basename_result
  9764. output_path=$func_dirname_result
  9765. cwrappersource=$output_path/$objdir/lt-$output_name.c
  9766. cwrapper=$output_path/$output_name.exe
  9767. $RM $cwrappersource $cwrapper
  9768. trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
  9769. func_emit_cwrapperexe_src > $cwrappersource
  9770. # The wrapper executable is built using the $host compiler,
  9771. # because it contains $host paths and files. If cross-
  9772. # compiling, it, like the target executable, must be
  9773. # executed on the $host or under an emulation environment.
  9774. $opt_dry_run || {
  9775. $LTCC $LTCFLAGS -o $cwrapper $cwrappersource
  9776. $STRIP $cwrapper
  9777. }
  9778. # Now, create the wrapper script for func_source use:
  9779. func_ltwrapper_scriptname $cwrapper
  9780. $RM $func_ltwrapper_scriptname_result
  9781. trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15
  9782. $opt_dry_run || {
  9783. # note: this script will not be executed, so do not chmod.
  9784. if test "x$build" = "x$host"; then
  9785. $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result
  9786. else
  9787. func_emit_wrapper no > $func_ltwrapper_scriptname_result
  9788. fi
  9789. }
  9790. ;;
  9791. * )
  9792. $RM $output
  9793. trap "$RM $output; exit $EXIT_FAILURE" 1 2 15
  9794. func_emit_wrapper no > $output
  9795. chmod +x $output
  9796. ;;
  9797. esac
  9798. }
  9799. exit $EXIT_SUCCESS
  9800. ;;
  9801. esac
  9802. # See if we need to build an old-fashioned archive.
  9803. for oldlib in $oldlibs; do
  9804. case $build_libtool_libs in
  9805. convenience)
  9806. oldobjs="$libobjs_save $symfileobj"
  9807. addlibs=$convenience
  9808. build_libtool_libs=no
  9809. ;;
  9810. module)
  9811. oldobjs=$libobjs_save
  9812. addlibs=$old_convenience
  9813. build_libtool_libs=no
  9814. ;;
  9815. *)
  9816. oldobjs="$old_deplibs $non_pic_objects"
  9817. $preload && test -f "$symfileobj" \
  9818. && func_append oldobjs " $symfileobj"
  9819. addlibs=$old_convenience
  9820. ;;
  9821. esac
  9822. if test -n "$addlibs"; then
  9823. gentop=$output_objdir/${outputname}x
  9824. func_append generated " $gentop"
  9825. func_extract_archives $gentop $addlibs
  9826. func_append oldobjs " $func_extract_archives_result"
  9827. fi
  9828. # Do each command in the archive commands.
  9829. if test -n "$old_archive_from_new_cmds" && test yes = "$build_libtool_libs"; then
  9830. cmds=$old_archive_from_new_cmds
  9831. else
  9832. # Add any objects from preloaded convenience libraries
  9833. if test -n "$dlprefiles"; then
  9834. gentop=$output_objdir/${outputname}x
  9835. func_append generated " $gentop"
  9836. func_extract_archives $gentop $dlprefiles
  9837. func_append oldobjs " $func_extract_archives_result"
  9838. fi
  9839. # POSIX demands no paths to be encoded in archives. We have
  9840. # to avoid creating archives with duplicate basenames if we
  9841. # might have to extract them afterwards, e.g., when creating a
  9842. # static archive out of a convenience library, or when linking
  9843. # the entirety of a libtool archive into another (currently
  9844. # not supported by libtool).
  9845. if (for obj in $oldobjs
  9846. do
  9847. func_basename "$obj"
  9848. $ECHO "$func_basename_result"
  9849. done | sort | sort -uc >/dev/null 2>&1); then
  9850. :
  9851. else
  9852. echo "copying selected object files to avoid basename conflicts..."
  9853. gentop=$output_objdir/${outputname}x
  9854. func_append generated " $gentop"
  9855. func_mkdir_p "$gentop"
  9856. save_oldobjs=$oldobjs
  9857. oldobjs=
  9858. counter=1
  9859. for obj in $save_oldobjs
  9860. do
  9861. func_basename "$obj"
  9862. objbase=$func_basename_result
  9863. case " $oldobjs " in
  9864. " ") oldobjs=$obj ;;
  9865. *[\ /]"$objbase "*)
  9866. while :; do
  9867. # Make sure we don't pick an alternate name that also
  9868. # overlaps.
  9869. newobj=lt$counter-$objbase
  9870. func_arith $counter + 1
  9871. counter=$func_arith_result
  9872. case " $oldobjs " in
  9873. *[\ /]"$newobj "*) ;;
  9874. *) if test ! -f "$gentop/$newobj"; then break; fi ;;
  9875. esac
  9876. done
  9877. func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
  9878. func_append oldobjs " $gentop/$newobj"
  9879. ;;
  9880. *) func_append oldobjs " $obj" ;;
  9881. esac
  9882. done
  9883. fi
  9884. func_to_tool_file "$oldlib" func_convert_file_msys_to_w32
  9885. tool_oldlib=$func_to_tool_file_result
  9886. eval cmds=\"$old_archive_cmds\"
  9887. func_len " $cmds"
  9888. len=$func_len_result
  9889. if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
  9890. cmds=$old_archive_cmds
  9891. elif test -n "$archiver_list_spec"; then
  9892. func_verbose "using command file archive linking..."
  9893. for obj in $oldobjs
  9894. do
  9895. func_to_tool_file "$obj"
  9896. $ECHO "$func_to_tool_file_result"
  9897. done > $output_objdir/$libname.libcmd
  9898. func_to_tool_file "$output_objdir/$libname.libcmd"
  9899. oldobjs=" $archiver_list_spec$func_to_tool_file_result"
  9900. cmds=$old_archive_cmds
  9901. else
  9902. # the command line is too long to link in one step, link in parts
  9903. func_verbose "using piecewise archive linking..."
  9904. save_RANLIB=$RANLIB
  9905. RANLIB=:
  9906. objlist=
  9907. concat_cmds=
  9908. save_oldobjs=$oldobjs
  9909. oldobjs=
  9910. # Is there a better way of finding the last object in the list?
  9911. for obj in $save_oldobjs
  9912. do
  9913. last_oldobj=$obj
  9914. done
  9915. eval test_cmds=\"$old_archive_cmds\"
  9916. func_len " $test_cmds"
  9917. len0=$func_len_result
  9918. len=$len0
  9919. for obj in $save_oldobjs
  9920. do
  9921. func_len " $obj"
  9922. func_arith $len + $func_len_result
  9923. len=$func_arith_result
  9924. func_append objlist " $obj"
  9925. if test "$len" -lt "$max_cmd_len"; then
  9926. :
  9927. else
  9928. # the above command should be used before it gets too long
  9929. oldobjs=$objlist
  9930. if test "$obj" = "$last_oldobj"; then
  9931. RANLIB=$save_RANLIB
  9932. fi
  9933. test -z "$concat_cmds" || concat_cmds=$concat_cmds~
  9934. eval concat_cmds=\"\$concat_cmds$old_archive_cmds\"
  9935. objlist=
  9936. len=$len0
  9937. fi
  9938. done
  9939. RANLIB=$save_RANLIB
  9940. oldobjs=$objlist
  9941. if test -z "$oldobjs"; then
  9942. eval cmds=\"\$concat_cmds\"
  9943. else
  9944. eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
  9945. fi
  9946. fi
  9947. fi
  9948. func_execute_cmds "$cmds" 'exit $?'
  9949. done
  9950. test -n "$generated" && \
  9951. func_show_eval "${RM}r$generated"
  9952. # Now create the libtool archive.
  9953. case $output in
  9954. *.la)
  9955. old_library=
  9956. test yes = "$build_old_libs" && old_library=$libname.$libext
  9957. func_verbose "creating $output"
  9958. # Preserve any variables that may affect compiler behavior
  9959. for var in $variables_saved_for_relink; do
  9960. if eval test -z \"\${$var+set}\"; then
  9961. relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
  9962. elif eval var_value=\$$var; test -z "$var_value"; then
  9963. relink_command="$var=; export $var; $relink_command"
  9964. else
  9965. func_quote_for_eval "$var_value"
  9966. relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
  9967. fi
  9968. done
  9969. # Quote the link command for shipping.
  9970. relink_command="(cd `pwd`; $SHELL \"$progpath\" $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
  9971. relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
  9972. if test yes = "$hardcode_automatic"; then
  9973. relink_command=
  9974. fi
  9975. # Only create the output if not a dry run.
  9976. $opt_dry_run || {
  9977. for installed in no yes; do
  9978. if test yes = "$installed"; then
  9979. if test -z "$install_libdir"; then
  9980. break
  9981. fi
  9982. output=$output_objdir/${outputname}i
  9983. # Replace all uninstalled libtool libraries with the installed ones
  9984. newdependency_libs=
  9985. for deplib in $dependency_libs; do
  9986. case $deplib in
  9987. *.la)
  9988. func_basename "$deplib"
  9989. name=$func_basename_result
  9990. func_resolve_sysroot "$deplib"
  9991. eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $func_resolve_sysroot_result`
  9992. test -z "$libdir" && \
  9993. func_fatal_error "'$deplib' is not a valid libtool archive"
  9994. func_append newdependency_libs " ${lt_sysroot:+=}$libdir/$name"
  9995. ;;
  9996. -L*)
  9997. func_stripname -L '' "$deplib"
  9998. func_replace_sysroot "$func_stripname_result"
  9999. func_append newdependency_libs " -L$func_replace_sysroot_result"
  10000. ;;
  10001. -R*)
  10002. func_stripname -R '' "$deplib"
  10003. func_replace_sysroot "$func_stripname_result"
  10004. func_append newdependency_libs " -R$func_replace_sysroot_result"
  10005. ;;
  10006. *) func_append newdependency_libs " $deplib" ;;
  10007. esac
  10008. done
  10009. dependency_libs=$newdependency_libs
  10010. newdlfiles=
  10011. for lib in $dlfiles; do
  10012. case $lib in
  10013. *.la)
  10014. func_basename "$lib"
  10015. name=$func_basename_result
  10016. eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
  10017. test -z "$libdir" && \
  10018. func_fatal_error "'$lib' is not a valid libtool archive"
  10019. func_append newdlfiles " ${lt_sysroot:+=}$libdir/$name"
  10020. ;;
  10021. *) func_append newdlfiles " $lib" ;;
  10022. esac
  10023. done
  10024. dlfiles=$newdlfiles
  10025. newdlprefiles=
  10026. for lib in $dlprefiles; do
  10027. case $lib in
  10028. *.la)
  10029. # Only pass preopened files to the pseudo-archive (for
  10030. # eventual linking with the app. that links it) if we
  10031. # didn't already link the preopened objects directly into
  10032. # the library:
  10033. func_basename "$lib"
  10034. name=$func_basename_result
  10035. eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
  10036. test -z "$libdir" && \
  10037. func_fatal_error "'$lib' is not a valid libtool archive"
  10038. func_append newdlprefiles " ${lt_sysroot:+=}$libdir/$name"
  10039. ;;
  10040. esac
  10041. done
  10042. dlprefiles=$newdlprefiles
  10043. else
  10044. newdlfiles=
  10045. for lib in $dlfiles; do
  10046. case $lib in
  10047. [\\/]* | [A-Za-z]:[\\/]*) abs=$lib ;;
  10048. *) abs=`pwd`"/$lib" ;;
  10049. esac
  10050. func_append newdlfiles " $abs"
  10051. done
  10052. dlfiles=$newdlfiles
  10053. newdlprefiles=
  10054. for lib in $dlprefiles; do
  10055. case $lib in
  10056. [\\/]* | [A-Za-z]:[\\/]*) abs=$lib ;;
  10057. *) abs=`pwd`"/$lib" ;;
  10058. esac
  10059. func_append newdlprefiles " $abs"
  10060. done
  10061. dlprefiles=$newdlprefiles
  10062. fi
  10063. $RM $output
  10064. # place dlname in correct position for cygwin
  10065. # In fact, it would be nice if we could use this code for all target
  10066. # systems that can't hard-code library paths into their executables
  10067. # and that have no shared library path variable independent of PATH,
  10068. # but it turns out we can't easily determine that from inspecting
  10069. # libtool variables, so we have to hard-code the OSs to which it
  10070. # applies here; at the moment, that means platforms that use the PE
  10071. # object format with DLL files. See the long comment at the top of
  10072. # tests/bindir.at for full details.
  10073. tdlname=$dlname
  10074. case $host,$output,$installed,$module,$dlname in
  10075. *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll)
  10076. # If a -bindir argument was supplied, place the dll there.
  10077. if test -n "$bindir"; then
  10078. func_relative_path "$install_libdir" "$bindir"
  10079. tdlname=$func_relative_path_result/$dlname
  10080. else
  10081. # Otherwise fall back on heuristic.
  10082. tdlname=../bin/$dlname
  10083. fi
  10084. ;;
  10085. esac
  10086. $ECHO > $output "\
  10087. # $outputname - a libtool library file
  10088. # Generated by $PROGRAM (GNU $PACKAGE) $VERSION
  10089. #
  10090. # Please DO NOT delete this file!
  10091. # It is necessary for linking the library.
  10092. # The name that we can dlopen(3).
  10093. dlname='$tdlname'
  10094. # Names of this library.
  10095. library_names='$library_names'
  10096. # The name of the static archive.
  10097. old_library='$old_library'
  10098. # Linker flags that cannot go in dependency_libs.
  10099. inherited_linker_flags='$new_inherited_linker_flags'
  10100. # Libraries that this one depends upon.
  10101. dependency_libs='$dependency_libs'
  10102. # Names of additional weak libraries provided by this library
  10103. weak_library_names='$weak_libs'
  10104. # Version information for $libname.
  10105. current=$current
  10106. age=$age
  10107. revision=$revision
  10108. # Is this an already installed library?
  10109. installed=$installed
  10110. # Should we warn about portability when linking against -modules?
  10111. shouldnotlink=$module
  10112. # Files to dlopen/dlpreopen
  10113. dlopen='$dlfiles'
  10114. dlpreopen='$dlprefiles'
  10115. # Directory that this library needs to be installed in:
  10116. libdir='$install_libdir'"
  10117. if test no,yes = "$installed,$need_relink"; then
  10118. $ECHO >> $output "\
  10119. relink_command=\"$relink_command\""
  10120. fi
  10121. done
  10122. }
  10123. # Do a symbolic link so that the libtool archive can be found in
  10124. # LD_LIBRARY_PATH before the program is installed.
  10125. func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?'
  10126. ;;
  10127. esac
  10128. exit $EXIT_SUCCESS
  10129. }
  10130. if test link = "$opt_mode" || test relink = "$opt_mode"; then
  10131. func_mode_link ${1+"$@"}
  10132. fi
  10133. # func_mode_uninstall arg...
  10134. func_mode_uninstall ()
  10135. {
  10136. $debug_cmd
  10137. RM=$nonopt
  10138. files=
  10139. rmforce=false
  10140. exit_status=0
  10141. # This variable tells wrapper scripts just to set variables rather
  10142. # than running their programs.
  10143. libtool_install_magic=$magic
  10144. for arg
  10145. do
  10146. case $arg in
  10147. -f) func_append RM " $arg"; rmforce=: ;;
  10148. -*) func_append RM " $arg" ;;
  10149. *) func_append files " $arg" ;;
  10150. esac
  10151. done
  10152. test -z "$RM" && \
  10153. func_fatal_help "you must specify an RM program"
  10154. rmdirs=
  10155. for file in $files; do
  10156. func_dirname "$file" "" "."
  10157. dir=$func_dirname_result
  10158. if test . = "$dir"; then
  10159. odir=$objdir
  10160. else
  10161. odir=$dir/$objdir
  10162. fi
  10163. func_basename "$file"
  10164. name=$func_basename_result
  10165. test uninstall = "$opt_mode" && odir=$dir
  10166. # Remember odir for removal later, being careful to avoid duplicates
  10167. if test clean = "$opt_mode"; then
  10168. case " $rmdirs " in
  10169. *" $odir "*) ;;
  10170. *) func_append rmdirs " $odir" ;;
  10171. esac
  10172. fi
  10173. # Don't error if the file doesn't exist and rm -f was used.
  10174. if { test -L "$file"; } >/dev/null 2>&1 ||
  10175. { test -h "$file"; } >/dev/null 2>&1 ||
  10176. test -f "$file"; then
  10177. :
  10178. elif test -d "$file"; then
  10179. exit_status=1
  10180. continue
  10181. elif $rmforce; then
  10182. continue
  10183. fi
  10184. rmfiles=$file
  10185. case $name in
  10186. *.la)
  10187. # Possibly a libtool archive, so verify it.
  10188. if func_lalib_p "$file"; then
  10189. func_source $dir/$name
  10190. # Delete the libtool libraries and symlinks.
  10191. for n in $library_names; do
  10192. func_append rmfiles " $odir/$n"
  10193. done
  10194. test -n "$old_library" && func_append rmfiles " $odir/$old_library"
  10195. case $opt_mode in
  10196. clean)
  10197. case " $library_names " in
  10198. *" $dlname "*) ;;
  10199. *) test -n "$dlname" && func_append rmfiles " $odir/$dlname" ;;
  10200. esac
  10201. test -n "$libdir" && func_append rmfiles " $odir/$name $odir/${name}i"
  10202. ;;
  10203. uninstall)
  10204. if test -n "$library_names"; then
  10205. # Do each command in the postuninstall commands.
  10206. func_execute_cmds "$postuninstall_cmds" '$rmforce || exit_status=1'
  10207. fi
  10208. if test -n "$old_library"; then
  10209. # Do each command in the old_postuninstall commands.
  10210. func_execute_cmds "$old_postuninstall_cmds" '$rmforce || exit_status=1'
  10211. fi
  10212. # FIXME: should reinstall the best remaining shared library.
  10213. ;;
  10214. esac
  10215. fi
  10216. ;;
  10217. *.lo)
  10218. # Possibly a libtool object, so verify it.
  10219. if func_lalib_p "$file"; then
  10220. # Read the .lo file
  10221. func_source $dir/$name
  10222. # Add PIC object to the list of files to remove.
  10223. if test -n "$pic_object" && test none != "$pic_object"; then
  10224. func_append rmfiles " $dir/$pic_object"
  10225. fi
  10226. # Add non-PIC object to the list of files to remove.
  10227. if test -n "$non_pic_object" && test none != "$non_pic_object"; then
  10228. func_append rmfiles " $dir/$non_pic_object"
  10229. fi
  10230. fi
  10231. ;;
  10232. *)
  10233. if test clean = "$opt_mode"; then
  10234. noexename=$name
  10235. case $file in
  10236. *.exe)
  10237. func_stripname '' '.exe' "$file"
  10238. file=$func_stripname_result
  10239. func_stripname '' '.exe' "$name"
  10240. noexename=$func_stripname_result
  10241. # $file with .exe has already been added to rmfiles,
  10242. # add $file without .exe
  10243. func_append rmfiles " $file"
  10244. ;;
  10245. esac
  10246. # Do a test to see if this is a libtool program.
  10247. if func_ltwrapper_p "$file"; then
  10248. if func_ltwrapper_executable_p "$file"; then
  10249. func_ltwrapper_scriptname "$file"
  10250. relink_command=
  10251. func_source $func_ltwrapper_scriptname_result
  10252. func_append rmfiles " $func_ltwrapper_scriptname_result"
  10253. else
  10254. relink_command=
  10255. func_source $dir/$noexename
  10256. fi
  10257. # note $name still contains .exe if it was in $file originally
  10258. # as does the version of $file that was added into $rmfiles
  10259. func_append rmfiles " $odir/$name $odir/${name}S.$objext"
  10260. if test yes = "$fast_install" && test -n "$relink_command"; then
  10261. func_append rmfiles " $odir/lt-$name"
  10262. fi
  10263. if test "X$noexename" != "X$name"; then
  10264. func_append rmfiles " $odir/lt-$noexename.c"
  10265. fi
  10266. fi
  10267. fi
  10268. ;;
  10269. esac
  10270. func_show_eval "$RM $rmfiles" 'exit_status=1'
  10271. done
  10272. # Try to remove the $objdir's in the directories where we deleted files
  10273. for dir in $rmdirs; do
  10274. if test -d "$dir"; then
  10275. func_show_eval "rmdir $dir >/dev/null 2>&1"
  10276. fi
  10277. done
  10278. exit $exit_status
  10279. }
  10280. if test uninstall = "$opt_mode" || test clean = "$opt_mode"; then
  10281. func_mode_uninstall ${1+"$@"}
  10282. fi
  10283. test -z "$opt_mode" && {
  10284. help=$generic_help
  10285. func_fatal_help "you must specify a MODE"
  10286. }
  10287. test -z "$exec_cmd" && \
  10288. func_fatal_help "invalid operation mode '$opt_mode'"
  10289. if test -n "$exec_cmd"; then
  10290. eval exec "$exec_cmd"
  10291. exit $EXIT_FAILURE
  10292. fi
  10293. exit $exit_status
  10294. # The TAGs below are defined such that we never get into a situation
  10295. # where we disable both kinds of libraries. Given conflicting
  10296. # choices, we go for a static library, that is the most portable,
  10297. # since we can't tell whether shared libraries were disabled because
  10298. # the user asked for that or because the platform doesn't support
  10299. # them. This is particularly important on AIX, because we don't
  10300. # support having both static and shared libraries enabled at the same
  10301. # time on that platform, so we default to a shared-only configuration.
  10302. # If a disable-shared tag is given, we'll fallback to a static-only
  10303. # configuration. But we'll never go from static-only to shared-only.
  10304. # ### BEGIN LIBTOOL TAG CONFIG: disable-shared
  10305. build_libtool_libs=no
  10306. build_old_libs=yes
  10307. # ### END LIBTOOL TAG CONFIG: disable-shared
  10308. # ### BEGIN LIBTOOL TAG CONFIG: disable-static
  10309. build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
  10310. # ### END LIBTOOL TAG CONFIG: disable-static
  10311. # Local Variables:
  10312. # mode:shell-script
  10313. # sh-indentation:2
  10314. # End:
  10315. # ### BEGIN LIBTOOL TAG CONFIG: CXX
  10316. # The linker used to build libraries.
  10317. LD="/usr/bin/ld -m elf_x86_64"
  10318. # How to create reloadable object files.
  10319. reload_flag=" -r"
  10320. reload_cmds="\$LD\$reload_flag -o \$output\$reload_objs"
  10321. # Commands used to build an old-style archive.
  10322. old_archive_cmds="\$AR \$AR_FLAGS \$oldlib\$oldobjs~\$RANLIB \$tool_oldlib"
  10323. # A language specific compiler.
  10324. CC="g++"
  10325. # Is the compiler the GNU compiler?
  10326. with_gcc=yes
  10327. # Compiler flag to turn off builtin functions.
  10328. no_builtin_flag=" -fno-builtin"
  10329. # Additional compiler flags for building library objects.
  10330. pic_flag=" -fPIC -DPIC"
  10331. # How to pass a linker flag through the compiler.
  10332. wl="-Wl,"
  10333. # Compiler flag to prevent dynamic linking.
  10334. link_static_flag="-static"
  10335. # Does compiler simultaneously support -c and -o options?
  10336. compiler_c_o="yes"
  10337. # Whether or not to add -lc for building shared libraries.
  10338. build_libtool_need_lc=no
  10339. # Whether or not to disallow shared libs when runtime libs are static.
  10340. allow_libtool_libs_with_static_runtimes=no
  10341. # Compiler flag to allow reflexive dlopens.
  10342. export_dynamic_flag_spec="\$wl--export-dynamic"
  10343. # Compiler flag to generate shared objects directly from archives.
  10344. whole_archive_flag_spec="\$wl--whole-archive\$convenience \$wl--no-whole-archive"
  10345. # Whether the compiler copes with passing no objects directly.
  10346. compiler_needs_object="no"
  10347. # Create an old-style archive from a shared archive.
  10348. old_archive_from_new_cmds=""
  10349. # Create a temporary old-style archive to link instead of a shared archive.
  10350. old_archive_from_expsyms_cmds=""
  10351. # Commands used to build a shared archive.
  10352. archive_cmds="\$CC \$pic_flag -shared -nostdlib \$predep_objects \$libobjs \$deplibs \$postdep_objects \$compiler_flags \$wl-soname \$wl\$soname -o \$lib"
  10353. archive_expsym_cmds="\$CC \$pic_flag -shared -nostdlib \$predep_objects \$libobjs \$deplibs \$postdep_objects \$compiler_flags \$wl-soname \$wl\$soname \$wl-retain-symbols-file \$wl\$export_symbols -o \$lib"
  10354. # Commands used to build a loadable module if different from building
  10355. # a shared archive.
  10356. module_cmds=""
  10357. module_expsym_cmds=""
  10358. # Whether we are building with GNU ld or not.
  10359. with_gnu_ld="yes"
  10360. # Flag that allows shared libraries with undefined symbols to be built.
  10361. allow_undefined_flag=""
  10362. # Flag that enforces no undefined symbols.
  10363. no_undefined_flag=""
  10364. # Flag to hardcode $libdir into a binary during linking.
  10365. # This must work even if $libdir does not exist
  10366. hardcode_libdir_flag_spec="\$wl-rpath \$wl\$libdir"
  10367. # Whether we need a single "-rpath" flag with a separated argument.
  10368. hardcode_libdir_separator=""
  10369. # Set to "yes" if using DIR/libNAME$shared_ext during linking hardcodes
  10370. # DIR into the resulting binary.
  10371. hardcode_direct=no
  10372. # Set to "yes" if using DIR/libNAME$shared_ext during linking hardcodes
  10373. # DIR into the resulting binary and the resulting library dependency is
  10374. # "absolute",i.e impossible to change by setting $shlibpath_var if the
  10375. # library is relocated.
  10376. hardcode_direct_absolute=no
  10377. # Set to "yes" if using the -LDIR flag during linking hardcodes DIR
  10378. # into the resulting binary.
  10379. hardcode_minus_L=no
  10380. # Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR
  10381. # into the resulting binary.
  10382. hardcode_shlibpath_var=unsupported
  10383. # Set to "yes" if building a shared library automatically hardcodes DIR
  10384. # into the library and all subsequent libraries and executables linked
  10385. # against it.
  10386. hardcode_automatic=no
  10387. # Set to yes if linker adds runtime paths of dependent libraries
  10388. # to runtime path list.
  10389. inherit_rpath=no
  10390. # Whether libtool must link a program against all its dependency libraries.
  10391. link_all_deplibs=no
  10392. # Set to "yes" if exported symbols are required.
  10393. always_export_symbols=no
  10394. # The commands to list exported symbols.
  10395. export_symbols_cmds="\$NM \$libobjs \$convenience | \$global_symbol_pipe | \$SED 's/.* //' | sort | uniq > \$export_symbols"
  10396. # Symbols that should not be listed in the preloaded symbols.
  10397. exclude_expsyms="_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*"
  10398. # Symbols that must always be exported.
  10399. include_expsyms=""
  10400. # Commands necessary for linking programs (against libraries) with templates.
  10401. prelink_cmds=""
  10402. # Commands necessary for finishing linking programs.
  10403. postlink_cmds=""
  10404. # Specify filename containing input files.
  10405. file_list_spec=""
  10406. # How to hardcode a shared library path into an executable.
  10407. hardcode_action=immediate
  10408. # The directories searched by this compiler when creating a shared library.
  10409. compiler_lib_search_dirs="/usr/lib/gcc/x86_64-linux-gnu/8 /usr/lib/gcc/x86_64-linux-gnu/8/../../../x86_64-linux-gnu /usr/lib/gcc/x86_64-linux-gnu/8/../../../../lib /lib/x86_64-linux-gnu /lib/../lib /usr/lib/x86_64-linux-gnu /usr/lib/../lib /usr/lib/gcc/x86_64-linux-gnu/8/../../.."
  10410. # Dependencies to place before and after the objects being linked to
  10411. # create a shared library.
  10412. predep_objects="/usr/lib/gcc/x86_64-linux-gnu/8/../../../x86_64-linux-gnu/crti.o /usr/lib/gcc/x86_64-linux-gnu/8/crtbeginS.o"
  10413. postdep_objects="/usr/lib/gcc/x86_64-linux-gnu/8/crtendS.o /usr/lib/gcc/x86_64-linux-gnu/8/../../../x86_64-linux-gnu/crtn.o"
  10414. predeps=""
  10415. postdeps="-lstdc++ -lm -lgcc_s -lc -lgcc_s"
  10416. # The library search path used internally by the compiler when linking
  10417. # a shared library.
  10418. compiler_lib_search_path="-L/usr/lib/gcc/x86_64-linux-gnu/8 -L/usr/lib/gcc/x86_64-linux-gnu/8/../../../x86_64-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/8/../../../../lib -L/lib/x86_64-linux-gnu -L/lib/../lib -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/8/../../.."
  10419. # ### END LIBTOOL TAG CONFIG: CXX