ltmain.sh 324 KB

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