ltmain.sh 318 KB

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