ltmain.sh 325 KB

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