ltmain.sh 320 KB

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