ltmain.sh 247 KB

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