libtool 332 KB

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