ltmain.sh 277 KB

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