ltmain.sh 317 KB

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