ltmain.sh 194 KB

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