ltmain.sh 277 KB

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