ltmain.sh 180 KB

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