ltmain.sh 238 KB

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