ltmain.sh 319 KB

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