ltmain.sh 195 KB

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