ltmain.sh 323 KB

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