ltmain.sh 108 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024
  1. # ltmain.sh - Provide generalized library-building support services.
  2. # NOTE: Changing this file will not affect anything until you rerun ltconfig.
  3. #
  4. # Copyright (C) 1996-1999 Free Software Foundation, Inc.
  5. # Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
  6. #
  7. # This program is free software; you can redistribute it and/or modify
  8. # it under the terms of the GNU General Public License as published by
  9. # the Free Software Foundation; either version 2 of the License, or
  10. # (at your option) any later version.
  11. #
  12. # This program is distributed in the hope that it will be useful, but
  13. # WITHOUT ANY WARRANTY; without even the implied warranty of
  14. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. # General Public License for more details.
  16. #
  17. # You should have received a copy of the GNU General Public License
  18. # along with this program; if not, write to the Free Software
  19. # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  20. #
  21. # As a special exception to the GNU General Public License, if you
  22. # distribute this file as part of a program that contains a
  23. # configuration script generated by Autoconf, you may include it under
  24. # the same distribution terms that you use for the rest of that program.
  25. # Check that we have a working $echo.
  26. if test "X$1" = X--no-reexec; then
  27. # Discard the --no-reexec flag, and continue.
  28. shift
  29. elif test "X$1" = X--fallback-echo; then
  30. # Avoid inline document here, it may be left over
  31. :
  32. elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
  33. # Yippee, $echo works!
  34. :
  35. else
  36. # Restart under the correct shell, and then maybe $echo will work.
  37. exec $SHELL "$0" --no-reexec ${1+"$@"}
  38. fi
  39. if test "X$1" = X--fallback-echo; then
  40. # used as fallback echo
  41. shift
  42. cat <<EOF
  43. $*
  44. EOF
  45. exit 0
  46. fi
  47. # The name of this program.
  48. progname=`$echo "$0" | sed 's%^.*/%%'`
  49. modename="$progname"
  50. # Constants.
  51. PROGRAM=ltmain.sh
  52. PACKAGE=libtool
  53. VERSION=1.3.5
  54. TIMESTAMP=" (1.385.2.206 2000/05/27 11:12:27)"
  55. default_mode=
  56. help="Try \`$progname --help' for more information."
  57. magic="%%%MAGIC variable%%%"
  58. mkdir="mkdir"
  59. mv="mv -f"
  60. rm="rm -f"
  61. # Sed substitution that helps us do robust quoting. It backslashifies
  62. # metacharacters that are still active within double-quoted strings.
  63. Xsed='sed -e 1s/^X//'
  64. sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
  65. SP2NL='tr \040 \012'
  66. NL2SP='tr \015\012 \040\040'
  67. # NLS nuisances.
  68. # Only set LANG and LC_ALL to C if already set.
  69. # These must not be set unconditionally because not all systems understand
  70. # e.g. LANG=C (notably SCO).
  71. # We save the old values to restore during execute mode.
  72. if test "${LC_ALL+set}" = set; then
  73. save_LC_ALL="$LC_ALL"; LC_ALL=C; export LC_ALL
  74. fi
  75. if test "${LANG+set}" = set; then
  76. save_LANG="$LANG"; LANG=C; export LANG
  77. fi
  78. if test "$LTCONFIG_VERSION" != "$VERSION"; then
  79. echo "$modename: ltconfig version \`$LTCONFIG_VERSION' does not match $PROGRAM version \`$VERSION'" 1>&2
  80. echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
  81. exit 1
  82. fi
  83. if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
  84. echo "$modename: not configured to build any kind of library" 1>&2
  85. echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
  86. exit 1
  87. fi
  88. # Global variables.
  89. mode=$default_mode
  90. nonopt=
  91. prev=
  92. prevopt=
  93. run=
  94. show="$echo"
  95. show_help=
  96. execute_dlfiles=
  97. lo2o="s/\\.lo\$/.${objext}/"
  98. o2lo="s/\\.${objext}\$/.lo/"
  99. # Parse our command line options once, thoroughly.
  100. while test $# -gt 0
  101. do
  102. arg="$1"
  103. shift
  104. case "$arg" in
  105. -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
  106. *) optarg= ;;
  107. esac
  108. # If the previous option needs an argument, assign it.
  109. if test -n "$prev"; then
  110. case "$prev" in
  111. execute_dlfiles)
  112. eval "$prev=\"\$$prev \$arg\""
  113. ;;
  114. *)
  115. eval "$prev=\$arg"
  116. ;;
  117. esac
  118. prev=
  119. prevopt=
  120. continue
  121. fi
  122. # Have we seen a non-optional argument yet?
  123. case "$arg" in
  124. --help)
  125. show_help=yes
  126. ;;
  127. --version)
  128. echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
  129. exit 0
  130. ;;
  131. --config)
  132. sed -e '1,/^### BEGIN LIBTOOL CONFIG/d' -e '/^### END LIBTOOL CONFIG/,$d' $0
  133. exit 0
  134. ;;
  135. --debug)
  136. echo "$progname: enabling shell trace mode"
  137. set -x
  138. ;;
  139. --dry-run | -n)
  140. run=:
  141. ;;
  142. --features)
  143. echo "host: $host"
  144. if test "$build_libtool_libs" = yes; then
  145. echo "enable shared libraries"
  146. else
  147. echo "disable shared libraries"
  148. fi
  149. if test "$build_old_libs" = yes; then
  150. echo "enable static libraries"
  151. else
  152. echo "disable static libraries"
  153. fi
  154. exit 0
  155. ;;
  156. --finish) mode="finish" ;;
  157. --mode) prevopt="--mode" prev=mode ;;
  158. --mode=*) mode="$optarg" ;;
  159. --quiet | --silent)
  160. show=:
  161. ;;
  162. -dlopen)
  163. prevopt="-dlopen"
  164. prev=execute_dlfiles
  165. ;;
  166. -*)
  167. $echo "$modename: unrecognized option \`$arg'" 1>&2
  168. $echo "$help" 1>&2
  169. exit 1
  170. ;;
  171. *)
  172. nonopt="$arg"
  173. break
  174. ;;
  175. esac
  176. done
  177. if test -n "$prevopt"; then
  178. $echo "$modename: option \`$prevopt' requires an argument" 1>&2
  179. $echo "$help" 1>&2
  180. exit 1
  181. fi
  182. if test -z "$show_help"; then
  183. # Infer the operation mode.
  184. if test -z "$mode"; then
  185. case "$nonopt" in
  186. *cc | *++ | gcc* | *-gcc*)
  187. mode=link
  188. for arg
  189. do
  190. case "$arg" in
  191. -c)
  192. mode=compile
  193. break
  194. ;;
  195. esac
  196. done
  197. ;;
  198. *db | *dbx | *strace | *truss)
  199. mode=execute
  200. ;;
  201. *install*|cp|mv)
  202. mode=install
  203. ;;
  204. *rm)
  205. mode=uninstall
  206. ;;
  207. *)
  208. # If we have no mode, but dlfiles were specified, then do execute mode.
  209. test -n "$execute_dlfiles" && mode=execute
  210. # Just use the default operation mode.
  211. if test -z "$mode"; then
  212. if test -n "$nonopt"; then
  213. $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2
  214. else
  215. $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
  216. fi
  217. fi
  218. ;;
  219. esac
  220. fi
  221. # Only execute mode is allowed to have -dlopen flags.
  222. if test -n "$execute_dlfiles" && test "$mode" != execute; then
  223. $echo "$modename: unrecognized option \`-dlopen'" 1>&2
  224. $echo "$help" 1>&2
  225. exit 1
  226. fi
  227. # Change the help message to a mode-specific one.
  228. generic_help="$help"
  229. help="Try \`$modename --help --mode=$mode' for more information."
  230. # These modes are in order of execution frequency so that they run quickly.
  231. case "$mode" in
  232. # libtool compile mode
  233. compile)
  234. modename="$modename: compile"
  235. # Get the compilation command and the source file.
  236. base_compile=
  237. lastarg=
  238. srcfile="$nonopt"
  239. suppress_output=
  240. user_target=no
  241. for arg
  242. do
  243. # Accept any command-line options.
  244. case "$arg" in
  245. -o)
  246. if test "$user_target" != "no"; then
  247. $echo "$modename: you cannot specify \`-o' more than once" 1>&2
  248. exit 1
  249. fi
  250. user_target=next
  251. ;;
  252. -static)
  253. build_old_libs=yes
  254. continue
  255. ;;
  256. esac
  257. case "$user_target" in
  258. next)
  259. # The next one is the -o target name
  260. user_target=yes
  261. continue
  262. ;;
  263. yes)
  264. # We got the output file
  265. user_target=set
  266. libobj="$arg"
  267. continue
  268. ;;
  269. esac
  270. # Accept the current argument as the source file.
  271. lastarg="$srcfile"
  272. srcfile="$arg"
  273. # Aesthetically quote the previous argument.
  274. # Backslashify any backslashes, double quotes, and dollar signs.
  275. # These are the only characters that are still specially
  276. # interpreted inside of double-quoted scrings.
  277. lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
  278. # Double-quote args containing other shell metacharacters.
  279. # Many Bourne shells cannot handle close brackets correctly in scan
  280. # sets, so we specify it separately.
  281. case "$lastarg" in
  282. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
  283. lastarg="\"$lastarg\""
  284. ;;
  285. esac
  286. # Add the previous argument to base_compile.
  287. if test -z "$base_compile"; then
  288. base_compile="$lastarg"
  289. else
  290. base_compile="$base_compile $lastarg"
  291. fi
  292. done
  293. case "$user_target" in
  294. set)
  295. ;;
  296. no)
  297. # Get the name of the library object.
  298. libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
  299. ;;
  300. *)
  301. $echo "$modename: you must specify a target with \`-o'" 1>&2
  302. exit 1
  303. ;;
  304. esac
  305. # Recognize several different file suffixes.
  306. # If the user specifies -o file.o, it is replaced with file.lo
  307. xform='[cCFSfmso]'
  308. case "$libobj" in
  309. *.ada) xform=ada ;;
  310. *.adb) xform=adb ;;
  311. *.ads) xform=ads ;;
  312. *.asm) xform=asm ;;
  313. *.c++) xform=c++ ;;
  314. *.cc) xform=cc ;;
  315. *.cpp) xform=cpp ;;
  316. *.cxx) xform=cxx ;;
  317. *.f90) xform=f90 ;;
  318. *.for) xform=for ;;
  319. esac
  320. libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
  321. case "$libobj" in
  322. *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
  323. *)
  324. $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
  325. exit 1
  326. ;;
  327. esac
  328. if test -z "$base_compile"; then
  329. $echo "$modename: you must specify a compilation command" 1>&2
  330. $echo "$help" 1>&2
  331. exit 1
  332. fi
  333. # Delete any leftover library objects.
  334. if test "$build_old_libs" = yes; then
  335. removelist="$obj $libobj"
  336. else
  337. removelist="$libobj"
  338. fi
  339. $run $rm $removelist
  340. trap "$run $rm $removelist; exit 1" 1 2 15
  341. # Calculate the filename of the output object if compiler does
  342. # not support -o with -c
  343. if test "$compiler_c_o" = no; then
  344. output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\..*$%%'`.${objext}
  345. lockfile="$output_obj.lock"
  346. removelist="$removelist $output_obj $lockfile"
  347. trap "$run $rm $removelist; exit 1" 1 2 15
  348. else
  349. need_locks=no
  350. lockfile=
  351. fi
  352. # Lock this critical section if it is needed
  353. # We use this script file to make the link, it avoids creating a new file
  354. if test "$need_locks" = yes; then
  355. until ln "$0" "$lockfile" 2>/dev/null; do
  356. $show "Waiting for $lockfile to be removed"
  357. sleep 2
  358. done
  359. elif test "$need_locks" = warn; then
  360. if test -f "$lockfile"; then
  361. echo "\
  362. *** ERROR, $lockfile exists and contains:
  363. `cat $lockfile 2>/dev/null`
  364. This indicates that another process is trying to use the same
  365. temporary object file, and libtool could not work around it because
  366. your compiler does not support \`-c' and \`-o' together. If you
  367. repeat this compilation, it may succeed, by chance, but you had better
  368. avoid parallel builds (make -j) in this platform, or get a better
  369. compiler."
  370. $run $rm $removelist
  371. exit 1
  372. fi
  373. echo $srcfile > "$lockfile"
  374. fi
  375. if test -n "$fix_srcfile_path"; then
  376. eval srcfile=\"$fix_srcfile_path\"
  377. fi
  378. # Only build a PIC object if we are building libtool libraries.
  379. if test "$build_libtool_libs" = yes; then
  380. # Without this assignment, base_compile gets emptied.
  381. fbsd_hideous_sh_bug=$base_compile
  382. # All platforms use -DPIC, to notify preprocessed assembler code.
  383. command="$base_compile $srcfile $pic_flag -DPIC"
  384. if test "$build_old_libs" = yes; then
  385. lo_libobj="$libobj"
  386. dir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'`
  387. if test "X$dir" = "X$libobj"; then
  388. dir="$objdir"
  389. else
  390. dir="$dir/$objdir"
  391. fi
  392. libobj="$dir/"`$echo "X$libobj" | $Xsed -e 's%^.*/%%'`
  393. if test -d "$dir"; then
  394. $show "$rm $libobj"
  395. $run $rm $libobj
  396. else
  397. $show "$mkdir $dir"
  398. $run $mkdir $dir
  399. status=$?
  400. if test $status -ne 0 && test ! -d $dir; then
  401. exit $status
  402. fi
  403. fi
  404. fi
  405. if test "$compiler_o_lo" = yes; then
  406. output_obj="$libobj"
  407. command="$command -o $output_obj"
  408. elif test "$compiler_c_o" = yes; then
  409. output_obj="$obj"
  410. command="$command -o $output_obj"
  411. fi
  412. $run $rm "$output_obj"
  413. $show "$command"
  414. if $run eval "$command"; then :
  415. else
  416. test -n "$output_obj" && $run $rm $removelist
  417. exit 1
  418. fi
  419. if test "$need_locks" = warn &&
  420. test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then
  421. echo "\
  422. *** ERROR, $lockfile contains:
  423. `cat $lockfile 2>/dev/null`
  424. but it should contain:
  425. $srcfile
  426. This indicates that another process is trying to use the same
  427. temporary object file, and libtool could not work around it because
  428. your compiler does not support \`-c' and \`-o' together. If you
  429. repeat this compilation, it may succeed, by chance, but you had better
  430. avoid parallel builds (make -j) in this platform, or get a better
  431. compiler."
  432. $run $rm $removelist
  433. exit 1
  434. fi
  435. # Just move the object if needed, then go on to compile the next one
  436. if test x"$output_obj" != x"$libobj"; then
  437. $show "$mv $output_obj $libobj"
  438. if $run $mv $output_obj $libobj; then :
  439. else
  440. error=$?
  441. $run $rm $removelist
  442. exit $error
  443. fi
  444. fi
  445. # If we have no pic_flag, then copy the object into place and finish.
  446. if test -z "$pic_flag" && test "$build_old_libs" = yes; then
  447. # Rename the .lo from within objdir to obj
  448. if test -f $obj; then
  449. $show $rm $obj
  450. $run $rm $obj
  451. fi
  452. $show "$mv $libobj $obj"
  453. if $run $mv $libobj $obj; then :
  454. else
  455. error=$?
  456. $run $rm $removelist
  457. exit $error
  458. fi
  459. xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
  460. if test "X$xdir" = "X$obj"; then
  461. xdir="."
  462. else
  463. xdir="$xdir"
  464. fi
  465. baseobj=`$echo "X$obj" | $Xsed -e "s%.*/%%"`
  466. libobj=`$echo "X$baseobj" | $Xsed -e "$o2lo"`
  467. # Now arrange that obj and lo_libobj become the same file
  468. $show "(cd $xdir && $LN_S $baseobj $libobj)"
  469. if $run eval '(cd $xdir && $LN_S $baseobj $libobj)'; then
  470. exit 0
  471. else
  472. error=$?
  473. $run $rm $removelist
  474. exit $error
  475. fi
  476. fi
  477. # Allow error messages only from the first compilation.
  478. suppress_output=' >/dev/null 2>&1'
  479. fi
  480. # Only build a position-dependent object if we build old libraries.
  481. if test "$build_old_libs" = yes; then
  482. command="$base_compile $srcfile"
  483. if test "$compiler_c_o" = yes; then
  484. command="$command -o $obj"
  485. output_obj="$obj"
  486. fi
  487. # Suppress compiler output if we already did a PIC compilation.
  488. command="$command$suppress_output"
  489. $run $rm "$output_obj"
  490. $show "$command"
  491. if $run eval "$command"; then :
  492. else
  493. $run $rm $removelist
  494. exit 1
  495. fi
  496. if test "$need_locks" = warn &&
  497. test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then
  498. echo "\
  499. *** ERROR, $lockfile contains:
  500. `cat $lockfile 2>/dev/null`
  501. but it should contain:
  502. $srcfile
  503. This indicates that another process is trying to use the same
  504. temporary object file, and libtool could not work around it because
  505. your compiler does not support \`-c' and \`-o' together. If you
  506. repeat this compilation, it may succeed, by chance, but you had better
  507. avoid parallel builds (make -j) in this platform, or get a better
  508. compiler."
  509. $run $rm $removelist
  510. exit 1
  511. fi
  512. # Just move the object if needed
  513. if test x"$output_obj" != x"$obj"; then
  514. $show "$mv $output_obj $obj"
  515. if $run $mv $output_obj $obj; then :
  516. else
  517. error=$?
  518. $run $rm $removelist
  519. exit $error
  520. fi
  521. fi
  522. # Create an invalid libtool object if no PIC, so that we do not
  523. # accidentally link it into a program.
  524. if test "$build_libtool_libs" != yes; then
  525. $show "echo timestamp > $libobj"
  526. $run eval "echo timestamp > \$libobj" || exit $?
  527. else
  528. # Move the .lo from within objdir
  529. $show "$mv $libobj $lo_libobj"
  530. if $run $mv $libobj $lo_libobj; then :
  531. else
  532. error=$?
  533. $run $rm $removelist
  534. exit $error
  535. fi
  536. fi
  537. fi
  538. # Unlock the critical section if it was locked
  539. if test "$need_locks" != no; then
  540. $rm "$lockfile"
  541. fi
  542. exit 0
  543. ;;
  544. # libtool link mode
  545. link)
  546. modename="$modename: link"
  547. case "$host" in
  548. *-*-cygwin* | *-*-mingw* | *-*-os2*)
  549. # It is impossible to link a dll without this setting, and
  550. # we shouldn't force the makefile maintainer to figure out
  551. # which system we are compiling for in order to pass an extra
  552. # flag for every libtool invokation.
  553. # allow_undefined=no
  554. # FIXME: Unfortunately, there are problems with the above when trying
  555. # to make a dll which has undefined symbols, in which case not
  556. # even a static library is built. For now, we need to specify
  557. # -no-undefined on the libtool link line when we can be certain
  558. # that all symbols are satisfied, otherwise we get a static library.
  559. allow_undefined=yes
  560. # This is a source program that is used to create dlls on Windows
  561. # Don't remove nor modify the starting and closing comments
  562. # /* ltdll.c starts here */
  563. # #define WIN32_LEAN_AND_MEAN
  564. # #include <windows.h>
  565. # #undef WIN32_LEAN_AND_MEAN
  566. # #include <stdio.h>
  567. #
  568. # #ifndef __CYGWIN__
  569. # # ifdef __CYGWIN32__
  570. # # define __CYGWIN__ __CYGWIN32__
  571. # # endif
  572. # #endif
  573. #
  574. # #ifdef __cplusplus
  575. # extern "C" {
  576. # #endif
  577. # BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved);
  578. # #ifdef __cplusplus
  579. # }
  580. # #endif
  581. #
  582. # #ifdef __CYGWIN__
  583. # #include <cygwin/cygwin_dll.h>
  584. # DECLARE_CYGWIN_DLL( DllMain );
  585. # #endif
  586. # HINSTANCE __hDllInstance_base;
  587. #
  588. # BOOL APIENTRY
  589. # DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved)
  590. # {
  591. # __hDllInstance_base = hInst;
  592. # return TRUE;
  593. # }
  594. # /* ltdll.c ends here */
  595. # This is a source program that is used to create import libraries
  596. # on Windows for dlls which lack them. Don't remove nor modify the
  597. # starting and closing comments
  598. # /* impgen.c starts here */
  599. # /* Copyright (C) 1999 Free Software Foundation, Inc.
  600. #
  601. # This file is part of GNU libtool.
  602. #
  603. # This program is free software; you can redistribute it and/or modify
  604. # it under the terms of the GNU General Public License as published by
  605. # the Free Software Foundation; either version 2 of the License, or
  606. # (at your option) any later version.
  607. #
  608. # This program is distributed in the hope that it will be useful,
  609. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  610. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  611. # GNU General Public License for more details.
  612. #
  613. # You should have received a copy of the GNU General Public License
  614. # along with this program; if not, write to the Free Software
  615. # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  616. # */
  617. #
  618. # #include <stdio.h> /* for printf() */
  619. # #include <unistd.h> /* for open(), lseek(), read() */
  620. # #include <fcntl.h> /* for O_RDONLY, O_BINARY */
  621. # #include <string.h> /* for strdup() */
  622. #
  623. # static unsigned int
  624. # pe_get16 (fd, offset)
  625. # int fd;
  626. # int offset;
  627. # {
  628. # unsigned char b[2];
  629. # lseek (fd, offset, SEEK_SET);
  630. # read (fd, b, 2);
  631. # return b[0] + (b[1]<<8);
  632. # }
  633. #
  634. # static unsigned int
  635. # pe_get32 (fd, offset)
  636. # int fd;
  637. # int offset;
  638. # {
  639. # unsigned char b[4];
  640. # lseek (fd, offset, SEEK_SET);
  641. # read (fd, b, 4);
  642. # return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24);
  643. # }
  644. #
  645. # static unsigned int
  646. # pe_as32 (ptr)
  647. # void *ptr;
  648. # {
  649. # unsigned char *b = ptr;
  650. # return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24);
  651. # }
  652. #
  653. # int
  654. # main (argc, argv)
  655. # int argc;
  656. # char *argv[];
  657. # {
  658. # int dll;
  659. # unsigned long pe_header_offset, opthdr_ofs, num_entries, i;
  660. # unsigned long export_rva, export_size, nsections, secptr, expptr;
  661. # unsigned long name_rvas, nexp;
  662. # unsigned char *expdata, *erva;
  663. # char *filename, *dll_name;
  664. #
  665. # filename = argv[1];
  666. #
  667. # dll = open(filename, O_RDONLY|O_BINARY);
  668. # if (!dll)
  669. # return 1;
  670. #
  671. # dll_name = filename;
  672. #
  673. # for (i=0; filename[i]; i++)
  674. # if (filename[i] == '/' || filename[i] == '\\' || filename[i] == ':')
  675. # dll_name = filename + i +1;
  676. #
  677. # pe_header_offset = pe_get32 (dll, 0x3c);
  678. # opthdr_ofs = pe_header_offset + 4 + 20;
  679. # num_entries = pe_get32 (dll, opthdr_ofs + 92);
  680. #
  681. # if (num_entries < 1) /* no exports */
  682. # return 1;
  683. #
  684. # export_rva = pe_get32 (dll, opthdr_ofs + 96);
  685. # export_size = pe_get32 (dll, opthdr_ofs + 100);
  686. # nsections = pe_get16 (dll, pe_header_offset + 4 +2);
  687. # secptr = (pe_header_offset + 4 + 20 +
  688. # pe_get16 (dll, pe_header_offset + 4 + 16));
  689. #
  690. # expptr = 0;
  691. # for (i = 0; i < nsections; i++)
  692. # {
  693. # char sname[8];
  694. # unsigned long secptr1 = secptr + 40 * i;
  695. # unsigned long vaddr = pe_get32 (dll, secptr1 + 12);
  696. # unsigned long vsize = pe_get32 (dll, secptr1 + 16);
  697. # unsigned long fptr = pe_get32 (dll, secptr1 + 20);
  698. # lseek(dll, secptr1, SEEK_SET);
  699. # read(dll, sname, 8);
  700. # if (vaddr <= export_rva && vaddr+vsize > export_rva)
  701. # {
  702. # expptr = fptr + (export_rva - vaddr);
  703. # if (export_rva + export_size > vaddr + vsize)
  704. # export_size = vsize - (export_rva - vaddr);
  705. # break;
  706. # }
  707. # }
  708. #
  709. # expdata = (unsigned char*)malloc(export_size);
  710. # lseek (dll, expptr, SEEK_SET);
  711. # read (dll, expdata, export_size);
  712. # erva = expdata - export_rva;
  713. #
  714. # nexp = pe_as32 (expdata+24);
  715. # name_rvas = pe_as32 (expdata+32);
  716. #
  717. # printf ("EXPORTS\n");
  718. # for (i = 0; i<nexp; i++)
  719. # {
  720. # unsigned long name_rva = pe_as32 (erva+name_rvas+i*4);
  721. # printf ("\t%s @ %ld ;\n", erva+name_rva, 1+ i);
  722. # }
  723. #
  724. # return 0;
  725. # }
  726. # /* impgen.c ends here */
  727. ;;
  728. *)
  729. allow_undefined=yes
  730. ;;
  731. esac
  732. compile_command="$nonopt"
  733. finalize_command="$nonopt"
  734. compile_rpath=
  735. finalize_rpath=
  736. compile_shlibpath=
  737. finalize_shlibpath=
  738. convenience=
  739. old_convenience=
  740. deplibs=
  741. linkopts=
  742. if test -n "$shlibpath_var"; then
  743. # get the directories listed in $shlibpath_var
  744. eval lib_search_path=\`\$echo \"X \${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
  745. else
  746. lib_search_path=
  747. fi
  748. # now prepend the system-specific ones
  749. eval lib_search_path=\"$sys_lib_search_path_spec\$lib_search_path\"
  750. eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
  751. avoid_version=no
  752. dlfiles=
  753. dlprefiles=
  754. dlself=no
  755. export_dynamic=no
  756. export_symbols=
  757. export_symbols_regex=
  758. generated=
  759. libobjs=
  760. link_against_libtool_libs=
  761. ltlibs=
  762. module=no
  763. objs=
  764. prefer_static_libs=no
  765. preload=no
  766. prev=
  767. prevarg=
  768. release=
  769. rpath=
  770. xrpath=
  771. perm_rpath=
  772. temp_rpath=
  773. thread_safe=no
  774. vinfo=
  775. # We need to know -static, to get the right output filenames.
  776. for arg
  777. do
  778. case "$arg" in
  779. -all-static | -static)
  780. if test "X$arg" = "X-all-static"; then
  781. if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
  782. $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
  783. fi
  784. if test -n "$link_static_flag"; then
  785. dlopen_self=$dlopen_self_static
  786. fi
  787. else
  788. if test -z "$pic_flag" && test -n "$link_static_flag"; then
  789. dlopen_self=$dlopen_self_static
  790. fi
  791. fi
  792. build_libtool_libs=no
  793. build_old_libs=yes
  794. prefer_static_libs=yes
  795. break
  796. ;;
  797. esac
  798. done
  799. # See if our shared archives depend on static archives.
  800. test -n "$old_archive_from_new_cmds" && build_old_libs=yes
  801. # Go through the arguments, transforming them on the way.
  802. while test $# -gt 0; do
  803. arg="$1"
  804. shift
  805. # If the previous option needs an argument, assign it.
  806. if test -n "$prev"; then
  807. case "$prev" in
  808. output)
  809. compile_command="$compile_command @OUTPUT@"
  810. finalize_command="$finalize_command @OUTPUT@"
  811. ;;
  812. esac
  813. case "$prev" in
  814. dlfiles|dlprefiles)
  815. if test "$preload" = no; then
  816. # Add the symbol object into the linking commands.
  817. compile_command="$compile_command @SYMFILE@"
  818. finalize_command="$finalize_command @SYMFILE@"
  819. preload=yes
  820. fi
  821. case "$arg" in
  822. *.la | *.lo) ;; # We handle these cases below.
  823. force)
  824. if test "$dlself" = no; then
  825. dlself=needless
  826. export_dynamic=yes
  827. fi
  828. prev=
  829. continue
  830. ;;
  831. self)
  832. if test "$prev" = dlprefiles; then
  833. dlself=yes
  834. elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
  835. dlself=yes
  836. else
  837. dlself=needless
  838. export_dynamic=yes
  839. fi
  840. prev=
  841. continue
  842. ;;
  843. *)
  844. if test "$prev" = dlfiles; then
  845. dlfiles="$dlfiles $arg"
  846. else
  847. dlprefiles="$dlprefiles $arg"
  848. fi
  849. prev=
  850. ;;
  851. esac
  852. ;;
  853. expsyms)
  854. export_symbols="$arg"
  855. if test ! -f "$arg"; then
  856. $echo "$modename: symbol file \`$arg' does not exist"
  857. exit 1
  858. fi
  859. prev=
  860. continue
  861. ;;
  862. expsyms_regex)
  863. export_symbols_regex="$arg"
  864. prev=
  865. continue
  866. ;;
  867. release)
  868. release="-$arg"
  869. prev=
  870. continue
  871. ;;
  872. rpath | xrpath)
  873. # We need an absolute path.
  874. case "$arg" in
  875. [\\/]* | [A-Za-z]:[\\/]*) ;;
  876. *)
  877. $echo "$modename: only absolute run-paths are allowed" 1>&2
  878. exit 1
  879. ;;
  880. esac
  881. if test "$prev" = rpath; then
  882. case "$rpath " in
  883. *" $arg "*) ;;
  884. *) rpath="$rpath $arg" ;;
  885. esac
  886. else
  887. case "$xrpath " in
  888. *" $arg "*) ;;
  889. *) xrpath="$xrpath $arg" ;;
  890. esac
  891. fi
  892. prev=
  893. continue
  894. ;;
  895. *)
  896. eval "$prev=\"\$arg\""
  897. prev=
  898. continue
  899. ;;
  900. esac
  901. fi
  902. prevarg="$arg"
  903. case "$arg" in
  904. -all-static)
  905. if test -n "$link_static_flag"; then
  906. compile_command="$compile_command $link_static_flag"
  907. finalize_command="$finalize_command $link_static_flag"
  908. fi
  909. continue
  910. ;;
  911. -allow-undefined)
  912. # FIXME: remove this flag sometime in the future.
  913. $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
  914. continue
  915. ;;
  916. -avoid-version)
  917. avoid_version=yes
  918. continue
  919. ;;
  920. -dlopen)
  921. prev=dlfiles
  922. continue
  923. ;;
  924. -dlpreopen)
  925. prev=dlprefiles
  926. continue
  927. ;;
  928. -export-dynamic)
  929. export_dynamic=yes
  930. continue
  931. ;;
  932. -export-symbols | -export-symbols-regex)
  933. if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
  934. $echo "$modename: not more than one -exported-symbols argument allowed"
  935. exit 1
  936. fi
  937. if test "X$arg" = "X-export-symbols"; then
  938. prev=expsyms
  939. else
  940. prev=expsyms_regex
  941. fi
  942. continue
  943. ;;
  944. -L*)
  945. dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
  946. # We need an absolute path.
  947. case "$dir" in
  948. [\\/]* | [A-Za-z]:[\\/]*) ;;
  949. *)
  950. absdir=`cd "$dir" && pwd`
  951. if test -z "$absdir"; then
  952. $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
  953. $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
  954. absdir="$dir"
  955. fi
  956. dir="$absdir"
  957. ;;
  958. esac
  959. case " $deplibs " in
  960. *" $arg "*) ;;
  961. *) deplibs="$deplibs $arg";;
  962. esac
  963. case " $lib_search_path " in
  964. *" $dir "*) ;;
  965. *) lib_search_path="$lib_search_path $dir";;
  966. esac
  967. case "$host" in
  968. *-*-cygwin* | *-*-mingw* | *-*-os2*)
  969. dllsearchdir=`cd "$dir" && pwd || echo "$dir"`
  970. case ":$dllsearchpath:" in
  971. ::) dllsearchpath="$dllsearchdir";;
  972. *":$dllsearchdir:"*) ;;
  973. *) dllsearchpath="$dllsearchpath:$dllsearchdir";;
  974. esac
  975. ;;
  976. esac
  977. ;;
  978. -l*)
  979. if test "$arg" = "-lc"; then
  980. case "$host" in
  981. *-*-cygwin* | *-*-mingw* | *-*-os2* | *-*-beos*)
  982. # These systems don't actually have c library (as such)
  983. continue
  984. ;;
  985. esac
  986. elif test "$arg" = "-lm"; then
  987. case "$host" in
  988. *-*-cygwin* | *-*-beos*)
  989. # These systems don't actually have math library (as such)
  990. continue
  991. ;;
  992. esac
  993. fi
  994. deplibs="$deplibs $arg"
  995. ;;
  996. -module)
  997. module=yes
  998. continue
  999. ;;
  1000. -no-undefined)
  1001. allow_undefined=no
  1002. continue
  1003. ;;
  1004. -o) prev=output ;;
  1005. -release)
  1006. prev=release
  1007. continue
  1008. ;;
  1009. -rpath)
  1010. prev=rpath
  1011. continue
  1012. ;;
  1013. -R)
  1014. prev=xrpath
  1015. continue
  1016. ;;
  1017. -R*)
  1018. dir=`$echo "X$arg" | $Xsed -e 's/^-R//'`
  1019. # We need an absolute path.
  1020. case "$dir" in
  1021. [\\/]* | [A-Za-z]:[\\/]*) ;;
  1022. *)
  1023. $echo "$modename: only absolute run-paths are allowed" 1>&2
  1024. exit 1
  1025. ;;
  1026. esac
  1027. case "$xrpath " in
  1028. *" $dir "*) ;;
  1029. *) xrpath="$xrpath $dir" ;;
  1030. esac
  1031. continue
  1032. ;;
  1033. -static)
  1034. # If we have no pic_flag, then this is the same as -all-static.
  1035. if test -z "$pic_flag" && test -n "$link_static_flag"; then
  1036. compile_command="$compile_command $link_static_flag"
  1037. finalize_command="$finalize_command $link_static_flag"
  1038. fi
  1039. continue
  1040. ;;
  1041. -thread-safe)
  1042. thread_safe=yes
  1043. continue
  1044. ;;
  1045. -version-info)
  1046. prev=vinfo
  1047. continue
  1048. ;;
  1049. # Some other compiler flag.
  1050. -* | +*)
  1051. # Unknown arguments in both finalize_command and compile_command need
  1052. # to be aesthetically quoted because they are evaled later.
  1053. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
  1054. case "$arg" in
  1055. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
  1056. arg="\"$arg\""
  1057. ;;
  1058. esac
  1059. ;;
  1060. *.o | *.obj | *.a | *.lib)
  1061. # A standard object.
  1062. objs="$objs $arg"
  1063. ;;
  1064. *.lo)
  1065. # A library object.
  1066. if test "$prev" = dlfiles; then
  1067. dlfiles="$dlfiles $arg"
  1068. if test "$build_libtool_libs" = yes && test "$dlopen" = yes; then
  1069. prev=
  1070. continue
  1071. else
  1072. # If libtool objects are unsupported, then we need to preload.
  1073. prev=dlprefiles
  1074. fi
  1075. fi
  1076. if test "$prev" = dlprefiles; then
  1077. # Preload the old-style object.
  1078. dlprefiles="$dlprefiles "`$echo "X$arg" | $Xsed -e "$lo2o"`
  1079. prev=
  1080. fi
  1081. libobjs="$libobjs $arg"
  1082. ;;
  1083. *.la)
  1084. # A libtool-controlled library.
  1085. dlname=
  1086. libdir=
  1087. library_names=
  1088. old_library=
  1089. # Check to see that this really is a libtool archive.
  1090. if (sed -e '2q' $arg | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
  1091. else
  1092. $echo "$modename: \`$arg' is not a valid libtool archive" 1>&2
  1093. exit 1
  1094. fi
  1095. # If the library was installed with an old release of libtool,
  1096. # it will not redefine variable installed.
  1097. installed=yes
  1098. # Read the .la file
  1099. # If there is no directory component, then add one.
  1100. case "$arg" in
  1101. */* | *\\*) . $arg ;;
  1102. *) . ./$arg ;;
  1103. esac
  1104. # Get the name of the library we link against.
  1105. linklib=
  1106. for l in $old_library $library_names; do
  1107. linklib="$l"
  1108. done
  1109. if test -z "$linklib"; then
  1110. $echo "$modename: cannot find name of link library for \`$arg'" 1>&2
  1111. exit 1
  1112. fi
  1113. # Find the relevant object directory and library name.
  1114. name=`$echo "X$arg" | $Xsed -e 's%^.*/%%' -e 's/\.la$//' -e 's/^lib//'`
  1115. if test "X$installed" = Xyes; then
  1116. dir="$libdir"
  1117. else
  1118. dir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
  1119. if test "X$dir" = "X$arg"; then
  1120. dir="$objdir"
  1121. else
  1122. dir="$dir/$objdir"
  1123. fi
  1124. fi
  1125. if test -n "$dependency_libs"; then
  1126. # Extract -R and -L from dependency_libs
  1127. temp_deplibs=
  1128. for deplib in $dependency_libs; do
  1129. case "$deplib" in
  1130. -R*) temp_xrpath=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
  1131. case " $rpath $xrpath " in
  1132. *" $temp_xrpath "*) ;;
  1133. *) xrpath="$xrpath $temp_xrpath";;
  1134. esac;;
  1135. -L*) case "$compile_command $temp_deplibs " in
  1136. *" $deplib "*) ;;
  1137. *) temp_deplibs="$temp_deplibs $deplib";;
  1138. esac
  1139. temp_dir=`$echo "X$deplib" | $Xsed -e 's/^-L//'`
  1140. case " $lib_search_path " in
  1141. *" $temp_dir "*) ;;
  1142. *) lib_search_path="$lib_search_path $temp_dir";;
  1143. esac
  1144. ;;
  1145. *) temp_deplibs="$temp_deplibs $deplib";;
  1146. esac
  1147. done
  1148. dependency_libs="$temp_deplibs"
  1149. fi
  1150. if test -z "$libdir"; then
  1151. # It is a libtool convenience library, so add in its objects.
  1152. convenience="$convenience $dir/$old_library"
  1153. old_convenience="$old_convenience $dir/$old_library"
  1154. deplibs="$deplibs$dependency_libs"
  1155. compile_command="$compile_command $dir/$old_library$dependency_libs"
  1156. finalize_command="$finalize_command $dir/$old_library$dependency_libs"
  1157. continue
  1158. fi
  1159. # This library was specified with -dlopen.
  1160. if test "$prev" = dlfiles; then
  1161. dlfiles="$dlfiles $arg"
  1162. if test -z "$dlname" || test "$dlopen" != yes || test "$build_libtool_libs" = no; then
  1163. # If there is no dlname, no dlopen support or we're linking statically,
  1164. # we need to preload.
  1165. prev=dlprefiles
  1166. else
  1167. # We should not create a dependency on this library, but we
  1168. # may need any libraries it requires.
  1169. compile_command="$compile_command$dependency_libs"
  1170. finalize_command="$finalize_command$dependency_libs"
  1171. prev=
  1172. continue
  1173. fi
  1174. fi
  1175. # The library was specified with -dlpreopen.
  1176. if test "$prev" = dlprefiles; then
  1177. # Prefer using a static library (so that no silly _DYNAMIC symbols
  1178. # are required to link).
  1179. if test -n "$old_library"; then
  1180. dlprefiles="$dlprefiles $dir/$old_library"
  1181. else
  1182. dlprefiles="$dlprefiles $dir/$linklib"
  1183. fi
  1184. prev=
  1185. fi
  1186. if test -n "$library_names" &&
  1187. { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
  1188. link_against_libtool_libs="$link_against_libtool_libs $arg"
  1189. if test -n "$shlibpath_var"; then
  1190. # Make sure the rpath contains only unique directories.
  1191. case "$temp_rpath " in
  1192. *" $dir "*) ;;
  1193. *) temp_rpath="$temp_rpath $dir" ;;
  1194. esac
  1195. fi
  1196. # We need an absolute path.
  1197. case "$dir" in
  1198. [\\/] | [A-Za-z]:[\\/]*) absdir="$dir" ;;
  1199. *)
  1200. absdir=`cd "$dir" && pwd`
  1201. if test -z "$absdir"; then
  1202. $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
  1203. $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
  1204. absdir="$dir"
  1205. fi
  1206. ;;
  1207. esac
  1208. # This is the magic to use -rpath.
  1209. # Skip directories that are in the system default run-time
  1210. # search path, unless they have been requested with -R.
  1211. case " $sys_lib_dlsearch_path " in
  1212. *" $absdir "*) ;;
  1213. *)
  1214. case "$compile_rpath " in
  1215. *" $absdir "*) ;;
  1216. *) compile_rpath="$compile_rpath $absdir"
  1217. esac
  1218. ;;
  1219. esac
  1220. case " $sys_lib_dlsearch_path " in
  1221. *" $libdir "*) ;;
  1222. *)
  1223. case "$finalize_rpath " in
  1224. *" $libdir "*) ;;
  1225. *) finalize_rpath="$finalize_rpath $libdir"
  1226. esac
  1227. ;;
  1228. esac
  1229. lib_linked=yes
  1230. case "$hardcode_action" in
  1231. immediate | unsupported)
  1232. if test "$hardcode_direct" = no; then
  1233. compile_command="$compile_command $dir/$linklib"
  1234. deplibs="$deplibs $dir/$linklib"
  1235. case "$host" in
  1236. *-*-cygwin* | *-*-mingw* | *-*-os2*)
  1237. dllsearchdir=`cd "$dir" && pwd || echo "$dir"`
  1238. if test -n "$dllsearchpath"; then
  1239. dllsearchpath="$dllsearchpath:$dllsearchdir"
  1240. else
  1241. dllsearchpath="$dllsearchdir"
  1242. fi
  1243. ;;
  1244. esac
  1245. elif test "$hardcode_minus_L" = no; then
  1246. case "$host" in
  1247. *-*-sunos*)
  1248. compile_shlibpath="$compile_shlibpath$dir:"
  1249. ;;
  1250. esac
  1251. case "$compile_command " in
  1252. *" -L$dir "*) ;;
  1253. *) compile_command="$compile_command -L$dir";;
  1254. esac
  1255. compile_command="$compile_command -l$name"
  1256. deplibs="$deplibs -L$dir -l$name"
  1257. elif test "$hardcode_shlibpath_var" = no; then
  1258. case ":$compile_shlibpath:" in
  1259. *":$dir:"*) ;;
  1260. *) compile_shlibpath="$compile_shlibpath$dir:";;
  1261. esac
  1262. compile_command="$compile_command -l$name"
  1263. deplibs="$deplibs -l$name"
  1264. else
  1265. lib_linked=no
  1266. fi
  1267. ;;
  1268. relink)
  1269. if test "$hardcode_direct" = yes; then
  1270. compile_command="$compile_command $absdir/$linklib"
  1271. deplibs="$deplibs $absdir/$linklib"
  1272. elif test "$hardcode_minus_L" = yes; then
  1273. case "$compile_command " in
  1274. *" -L$absdir "*) ;;
  1275. *) compile_command="$compile_command -L$absdir";;
  1276. esac
  1277. compile_command="$compile_command -l$name"
  1278. deplibs="$deplibs -L$absdir -l$name"
  1279. elif test "$hardcode_shlibpath_var" = yes; then
  1280. case ":$compile_shlibpath:" in
  1281. *":$absdir:"*) ;;
  1282. *) compile_shlibpath="$compile_shlibpath$absdir:";;
  1283. esac
  1284. compile_command="$compile_command -l$name"
  1285. deplibs="$deplibs -l$name"
  1286. else
  1287. lib_linked=no
  1288. fi
  1289. ;;
  1290. *)
  1291. lib_linked=no
  1292. ;;
  1293. esac
  1294. if test "$lib_linked" != yes; then
  1295. $echo "$modename: configuration error: unsupported hardcode properties"
  1296. exit 1
  1297. fi
  1298. # Finalize command for both is simple: just hardcode it.
  1299. if test "$hardcode_direct" = yes; then
  1300. finalize_command="$finalize_command $libdir/$linklib"
  1301. elif test "$hardcode_minus_L" = yes; then
  1302. case "$finalize_command " in
  1303. *" -L$libdir "*) ;;
  1304. *) finalize_command="$finalize_command -L$libdir";;
  1305. esac
  1306. finalize_command="$finalize_command -l$name"
  1307. elif test "$hardcode_shlibpath_var" = yes; then
  1308. case ":$finalize_shlibpath:" in
  1309. *":$libdir:"*) ;;
  1310. *) finalize_shlibpath="$finalize_shlibpath$libdir:";;
  1311. esac
  1312. finalize_command="$finalize_command -l$name"
  1313. else
  1314. # We cannot seem to hardcode it, guess we'll fake it.
  1315. case "$finalize_command " in
  1316. *" -L$dir "*) ;;
  1317. *) finalize_command="$finalize_command -L$libdir";;
  1318. esac
  1319. finalize_command="$finalize_command -l$name"
  1320. fi
  1321. else
  1322. # Transform directly to old archives if we don't build new libraries.
  1323. if test -n "$pic_flag" && test -z "$old_library"; then
  1324. $echo "$modename: cannot find static library for \`$arg'" 1>&2
  1325. exit 1
  1326. fi
  1327. # Here we assume that one of hardcode_direct or hardcode_minus_L
  1328. # is not unsupported. This is valid on all known static and
  1329. # shared platforms.
  1330. if test "$hardcode_direct" != unsupported; then
  1331. test -n "$old_library" && linklib="$old_library"
  1332. compile_command="$compile_command $dir/$linklib"
  1333. finalize_command="$finalize_command $dir/$linklib"
  1334. else
  1335. case "$compile_command " in
  1336. *" -L$dir "*) ;;
  1337. *) compile_command="$compile_command -L$dir";;
  1338. esac
  1339. compile_command="$compile_command -l$name"
  1340. case "$finalize_command " in
  1341. *" -L$dir "*) ;;
  1342. *) finalize_command="$finalize_command -L$dir";;
  1343. esac
  1344. finalize_command="$finalize_command -l$name"
  1345. fi
  1346. fi
  1347. # Add in any libraries that this one depends upon.
  1348. compile_command="$compile_command$dependency_libs"
  1349. finalize_command="$finalize_command$dependency_libs"
  1350. continue
  1351. ;;
  1352. # Some other compiler argument.
  1353. *)
  1354. # Unknown arguments in both finalize_command and compile_command need
  1355. # to be aesthetically quoted because they are evaled later.
  1356. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
  1357. case "$arg" in
  1358. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
  1359. arg="\"$arg\""
  1360. ;;
  1361. esac
  1362. ;;
  1363. esac
  1364. # Now actually substitute the argument into the commands.
  1365. if test -n "$arg"; then
  1366. compile_command="$compile_command $arg"
  1367. finalize_command="$finalize_command $arg"
  1368. fi
  1369. done
  1370. if test -n "$prev"; then
  1371. $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
  1372. $echo "$help" 1>&2
  1373. exit 1
  1374. fi
  1375. if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
  1376. eval arg=\"$export_dynamic_flag_spec\"
  1377. compile_command="$compile_command $arg"
  1378. finalize_command="$finalize_command $arg"
  1379. fi
  1380. oldlibs=
  1381. # calculate the name of the file, without its directory
  1382. outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
  1383. libobjs_save="$libobjs"
  1384. case "$output" in
  1385. "")
  1386. $echo "$modename: you must specify an output file" 1>&2
  1387. $echo "$help" 1>&2
  1388. exit 1
  1389. ;;
  1390. *.a | *.lib)
  1391. if test -n "$link_against_libtool_libs"; then
  1392. $echo "$modename: error: cannot link libtool libraries into archives" 1>&2
  1393. exit 1
  1394. fi
  1395. if test -n "$deplibs"; then
  1396. $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2
  1397. fi
  1398. if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
  1399. $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
  1400. fi
  1401. if test -n "$rpath"; then
  1402. $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2
  1403. fi
  1404. if test -n "$xrpath"; then
  1405. $echo "$modename: warning: \`-R' is ignored for archives" 1>&2
  1406. fi
  1407. if test -n "$vinfo"; then
  1408. $echo "$modename: warning: \`-version-info' is ignored for archives" 1>&2
  1409. fi
  1410. if test -n "$release"; then
  1411. $echo "$modename: warning: \`-release' is ignored for archives" 1>&2
  1412. fi
  1413. if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
  1414. $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2
  1415. fi
  1416. # Now set the variables for building old libraries.
  1417. build_libtool_libs=no
  1418. oldlibs="$output"
  1419. ;;
  1420. *.la)
  1421. # Make sure we only generate libraries of the form `libNAME.la'.
  1422. case "$outputname" in
  1423. lib*)
  1424. name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
  1425. eval libname=\"$libname_spec\"
  1426. ;;
  1427. *)
  1428. if test "$module" = no; then
  1429. $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
  1430. $echo "$help" 1>&2
  1431. exit 1
  1432. fi
  1433. if test "$need_lib_prefix" != no; then
  1434. # Add the "lib" prefix for modules if required
  1435. name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
  1436. eval libname=\"$libname_spec\"
  1437. else
  1438. libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
  1439. fi
  1440. ;;
  1441. esac
  1442. output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
  1443. if test "X$output_objdir" = "X$output"; then
  1444. output_objdir="$objdir"
  1445. else
  1446. output_objdir="$output_objdir/$objdir"
  1447. fi
  1448. if test -n "$objs"; then
  1449. $echo "$modename: cannot build libtool library \`$output' from non-libtool objects:$objs" 2>&1
  1450. exit 1
  1451. fi
  1452. # How the heck are we supposed to write a wrapper for a shared library?
  1453. if test -n "$link_against_libtool_libs"; then
  1454. $echo "$modename: error: cannot link shared libraries into libtool libraries" 1>&2
  1455. exit 1
  1456. fi
  1457. if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
  1458. $echo "$modename: warning: \`-dlopen' is ignored for libtool libraries" 1>&2
  1459. fi
  1460. set dummy $rpath
  1461. if test $# -gt 2; then
  1462. $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
  1463. fi
  1464. install_libdir="$2"
  1465. oldlibs=
  1466. if test -z "$rpath"; then
  1467. if test "$build_libtool_libs" = yes; then
  1468. # Building a libtool convenience library.
  1469. libext=al
  1470. oldlibs="$output_objdir/$libname.$libext $oldlibs"
  1471. build_libtool_libs=convenience
  1472. build_old_libs=yes
  1473. fi
  1474. dependency_libs="$deplibs"
  1475. if test -n "$vinfo"; then
  1476. $echo "$modename: warning: \`-version-info' is ignored for convenience libraries" 1>&2
  1477. fi
  1478. if test -n "$release"; then
  1479. $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2
  1480. fi
  1481. else
  1482. # Parse the version information argument.
  1483. IFS="${IFS= }"; save_ifs="$IFS"; IFS=':'
  1484. set dummy $vinfo 0 0 0
  1485. IFS="$save_ifs"
  1486. if test -n "$8"; then
  1487. $echo "$modename: too many parameters to \`-version-info'" 1>&2
  1488. $echo "$help" 1>&2
  1489. exit 1
  1490. fi
  1491. current="$2"
  1492. revision="$3"
  1493. age="$4"
  1494. # Check that each of the things are valid numbers.
  1495. case "$current" in
  1496. 0 | [1-9] | [1-9][0-9]*) ;;
  1497. *)
  1498. $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2
  1499. $echo "$modename: \`$vinfo' is not valid version information" 1>&2
  1500. exit 1
  1501. ;;
  1502. esac
  1503. case "$revision" in
  1504. 0 | [1-9] | [1-9][0-9]*) ;;
  1505. *)
  1506. $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2
  1507. $echo "$modename: \`$vinfo' is not valid version information" 1>&2
  1508. exit 1
  1509. ;;
  1510. esac
  1511. case "$age" in
  1512. 0 | [1-9] | [1-9][0-9]*) ;;
  1513. *)
  1514. $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2
  1515. $echo "$modename: \`$vinfo' is not valid version information" 1>&2
  1516. exit 1
  1517. ;;
  1518. esac
  1519. if test $age -gt $current; then
  1520. $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
  1521. $echo "$modename: \`$vinfo' is not valid version information" 1>&2
  1522. exit 1
  1523. fi
  1524. # Calculate the version variables.
  1525. major=
  1526. versuffix=
  1527. verstring=
  1528. case "$version_type" in
  1529. none) ;;
  1530. irix)
  1531. major=`expr $current - $age + 1`
  1532. versuffix="$major.$revision"
  1533. verstring="sgi$major.$revision"
  1534. # Add in all the interfaces that we are compatible with.
  1535. loop=$revision
  1536. while test $loop != 0; do
  1537. iface=`expr $revision - $loop`
  1538. loop=`expr $loop - 1`
  1539. verstring="sgi$major.$iface:$verstring"
  1540. done
  1541. ;;
  1542. linux)
  1543. major=.`expr $current - $age`
  1544. versuffix="$major.$age.$revision"
  1545. ;;
  1546. osf)
  1547. major=`expr $current - $age`
  1548. versuffix=".$current.$age.$revision"
  1549. verstring="$current.$age.$revision"
  1550. # Add in all the interfaces that we are compatible with.
  1551. loop=$age
  1552. while test $loop != 0; do
  1553. iface=`expr $current - $loop`
  1554. loop=`expr $loop - 1`
  1555. verstring="$verstring:${iface}.0"
  1556. done
  1557. # Make executables depend on our current version.
  1558. verstring="$verstring:${current}.0"
  1559. ;;
  1560. sunos)
  1561. major=".$current"
  1562. versuffix=".$current.$revision"
  1563. ;;
  1564. freebsd-aout)
  1565. major=".$current"
  1566. versuffix=".$current.$revision";
  1567. ;;
  1568. freebsd-elf)
  1569. major=".$current"
  1570. versuffix=".$current";
  1571. ;;
  1572. windows)
  1573. # Like Linux, but with '-' rather than '.', since we only
  1574. # want one extension on Windows 95.
  1575. major=`expr $current - $age`
  1576. versuffix="-$major-$age-$revision"
  1577. ;;
  1578. *)
  1579. $echo "$modename: unknown library version type \`$version_type'" 1>&2
  1580. echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
  1581. exit 1
  1582. ;;
  1583. esac
  1584. # Clear the version info if we defaulted, and they specified a release.
  1585. if test -z "$vinfo" && test -n "$release"; then
  1586. major=
  1587. verstring="0.0"
  1588. if test "$need_version" = no; then
  1589. versuffix=
  1590. else
  1591. versuffix=".0.0"
  1592. fi
  1593. fi
  1594. # Remove version info from name if versioning should be avoided
  1595. if test "$avoid_version" = yes && test "$need_version" = no; then
  1596. major=
  1597. versuffix=
  1598. verstring=""
  1599. fi
  1600. # Check to see if the archive will have undefined symbols.
  1601. if test "$allow_undefined" = yes; then
  1602. if test "$allow_undefined_flag" = unsupported; then
  1603. $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
  1604. build_libtool_libs=no
  1605. build_old_libs=yes
  1606. fi
  1607. else
  1608. # Don't allow undefined symbols.
  1609. allow_undefined_flag="$no_undefined_flag"
  1610. fi
  1611. dependency_libs="$deplibs"
  1612. case "$host" in
  1613. *-*-cygwin* | *-*-mingw* | *-*-os2* | *-*-beos*)
  1614. # these systems don't actually have a c library (as such)!
  1615. ;;
  1616. *-*-rhapsody*)
  1617. # rhapsody is a little odd...
  1618. deplibs="$deplibs -framework System"
  1619. ;;
  1620. *)
  1621. # Add libc to deplibs on all other systems.
  1622. deplibs="$deplibs -lc"
  1623. ;;
  1624. esac
  1625. fi
  1626. # Create the output directory, or remove our outputs if we need to.
  1627. if test -d $output_objdir; then
  1628. $show "${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*"
  1629. $run ${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*
  1630. else
  1631. $show "$mkdir $output_objdir"
  1632. $run $mkdir $output_objdir
  1633. status=$?
  1634. if test $status -ne 0 && test ! -d $output_objdir; then
  1635. exit $status
  1636. fi
  1637. fi
  1638. # Now set the variables for building old libraries.
  1639. if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
  1640. oldlibs="$oldlibs $output_objdir/$libname.$libext"
  1641. # Transform .lo files to .o files.
  1642. oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
  1643. fi
  1644. if test "$build_libtool_libs" = yes; then
  1645. # Transform deplibs into only deplibs that can be linked in shared.
  1646. name_save=$name
  1647. libname_save=$libname
  1648. release_save=$release
  1649. versuffix_save=$versuffix
  1650. major_save=$major
  1651. # I'm not sure if I'm treating the release correctly. I think
  1652. # release should show up in the -l (ie -lgmp5) so we don't want to
  1653. # add it in twice. Is that correct?
  1654. release=""
  1655. versuffix=""
  1656. major=""
  1657. newdeplibs=
  1658. droppeddeps=no
  1659. case "$deplibs_check_method" in
  1660. pass_all)
  1661. # Don't check for shared/static. Everything works.
  1662. # This might be a little naive. We might want to check
  1663. # whether the library exists or not. But this is on
  1664. # osf3 & osf4 and I'm not really sure... Just
  1665. # implementing what was already the behaviour.
  1666. newdeplibs=$deplibs
  1667. ;;
  1668. test_compile)
  1669. # This code stresses the "libraries are programs" paradigm to its
  1670. # limits. Maybe even breaks it. We compile a program, linking it
  1671. # against the deplibs as a proxy for the library. Then we can check
  1672. # whether they linked in statically or dynamically with ldd.
  1673. $rm conftest.c
  1674. cat > conftest.c <<EOF
  1675. int main() { return 0; }
  1676. EOF
  1677. $rm conftest
  1678. $CC -o conftest conftest.c $deplibs
  1679. if test $? -eq 0 ; then
  1680. ldd_output=`ldd conftest`
  1681. for i in $deplibs; do
  1682. name="`expr $i : '-l\(.*\)'`"
  1683. # If $name is empty we are operating on a -L argument.
  1684. if test "$name" != "" ; then
  1685. libname=`eval \\$echo \"$libname_spec\"`
  1686. deplib_matches=`eval \\$echo \"$library_names_spec\"`
  1687. set dummy $deplib_matches
  1688. deplib_match=$2
  1689. if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
  1690. newdeplibs="$newdeplibs $i"
  1691. else
  1692. droppeddeps=yes
  1693. echo
  1694. echo "*** Warning: This library needs some functionality provided by $i."
  1695. echo "*** I have the capability to make that library automatically link in when"
  1696. echo "*** you link to this library. But I can only do this if you have a"
  1697. echo "*** shared version of the library, which you do not appear to have."
  1698. fi
  1699. else
  1700. newdeplibs="$newdeplibs $i"
  1701. fi
  1702. done
  1703. else
  1704. # Error occured in the first compile. Let's try to salvage the situation:
  1705. # Compile a seperate program for each library.
  1706. for i in $deplibs; do
  1707. name="`expr $i : '-l\(.*\)'`"
  1708. # If $name is empty we are operating on a -L argument.
  1709. if test "$name" != "" ; then
  1710. $rm conftest
  1711. $CC -o conftest conftest.c $i
  1712. # Did it work?
  1713. if test $? -eq 0 ; then
  1714. ldd_output=`ldd conftest`
  1715. libname=`eval \\$echo \"$libname_spec\"`
  1716. deplib_matches=`eval \\$echo \"$library_names_spec\"`
  1717. set dummy $deplib_matches
  1718. deplib_match=$2
  1719. if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
  1720. newdeplibs="$newdeplibs $i"
  1721. else
  1722. droppeddeps=yes
  1723. echo
  1724. echo "*** Warning: This library needs some functionality provided by $i."
  1725. echo "*** I have the capability to make that library automatically link in when"
  1726. echo "*** you link to this library. But I can only do this if you have a"
  1727. echo "*** shared version of the library, which you do not appear to have."
  1728. fi
  1729. else
  1730. droppeddeps=yes
  1731. echo
  1732. echo "*** Warning! Library $i is needed by this library but I was not able to"
  1733. echo "*** make it link in! You will probably need to install it or some"
  1734. echo "*** library that it depends on before this library will be fully"
  1735. echo "*** functional. Installing it before continuing would be even better."
  1736. fi
  1737. else
  1738. newdeplibs="$newdeplibs $i"
  1739. fi
  1740. done
  1741. fi
  1742. ;;
  1743. file_magic*)
  1744. set dummy $deplibs_check_method
  1745. file_magic_regex="`expr \"$deplibs_check_method\" : \"$2 \(.*\)\"`"
  1746. for a_deplib in $deplibs; do
  1747. name="`expr $a_deplib : '-l\(.*\)'`"
  1748. # If $name is empty we are operating on a -L argument.
  1749. if test "$name" != "" ; then
  1750. libname=`eval \\$echo \"$libname_spec\"`
  1751. for i in $lib_search_path; do
  1752. potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
  1753. for potent_lib in $potential_libs; do
  1754. # Follow soft links.
  1755. if ls -lLd "$potent_lib" 2>/dev/null \
  1756. | grep " -> " >/dev/null; then
  1757. continue
  1758. fi
  1759. # The statement above tries to avoid entering an
  1760. # endless loop below, in case of cyclic links.
  1761. # We might still enter an endless loop, since a link
  1762. # loop can be closed while we follow links,
  1763. # but so what?
  1764. potlib="$potent_lib"
  1765. while test -h "$potlib" 2>/dev/null; do
  1766. potliblink=`ls -ld $potlib | sed 's/.* -> //'`
  1767. case "$potliblink" in
  1768. [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
  1769. *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
  1770. esac
  1771. done
  1772. if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
  1773. | sed 10q \
  1774. | egrep "$file_magic_regex" > /dev/null; then
  1775. newdeplibs="$newdeplibs $a_deplib"
  1776. a_deplib=""
  1777. break 2
  1778. fi
  1779. done
  1780. done
  1781. if test -n "$a_deplib" ; then
  1782. droppeddeps=yes
  1783. echo
  1784. echo "*** Warning: This library needs some functionality provided by $a_deplib."
  1785. echo "*** I have the capability to make that library automatically link in when"
  1786. echo "*** you link to this library. But I can only do this if you have a"
  1787. echo "*** shared version of the library, which you do not appear to have."
  1788. fi
  1789. else
  1790. # Add a -L argument.
  1791. newdeplibs="$newdeplibs $a_deplib"
  1792. fi
  1793. done # Gone through all deplibs.
  1794. ;;
  1795. none | unknown | *)
  1796. newdeplibs=""
  1797. if $echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
  1798. -e 's/ -[LR][^ ]*//g' -e 's/[ ]//g' |
  1799. grep . >/dev/null; then
  1800. echo
  1801. if test "X$deplibs_check_method" = "Xnone"; then
  1802. echo "*** Warning: inter-library dependencies are not supported in this platform."
  1803. else
  1804. echo "*** Warning: inter-library dependencies are not known to be supported."
  1805. fi
  1806. echo "*** All declared inter-library dependencies are being dropped."
  1807. droppeddeps=yes
  1808. fi
  1809. ;;
  1810. esac
  1811. versuffix=$versuffix_save
  1812. major=$major_save
  1813. release=$release_save
  1814. libname=$libname_save
  1815. name=$name_save
  1816. if test "$droppeddeps" = yes; then
  1817. if test "$module" = yes; then
  1818. echo
  1819. echo "*** Warning: libtool could not satisfy all declared inter-library"
  1820. echo "*** dependencies of module $libname. Therefore, libtool will create"
  1821. echo "*** a static module, that should work as long as the dlopening"
  1822. echo "*** application is linked with the -dlopen flag."
  1823. if test -z "$global_symbol_pipe"; then
  1824. echo
  1825. echo "*** However, this would only work if libtool was able to extract symbol"
  1826. echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
  1827. echo "*** not find such a program. So, this module is probably useless."
  1828. echo "*** \`nm' from GNU binutils and a full rebuild may help."
  1829. fi
  1830. if test "$build_old_libs" = no; then
  1831. oldlibs="$output_objdir/$libname.$libext"
  1832. build_libtool_libs=module
  1833. build_old_libs=yes
  1834. else
  1835. build_libtool_libs=no
  1836. fi
  1837. else
  1838. echo "*** The inter-library dependencies that have been dropped here will be"
  1839. echo "*** automatically added whenever a program is linked with this library"
  1840. echo "*** or is declared to -dlopen it."
  1841. fi
  1842. fi
  1843. # Done checking deplibs!
  1844. deplibs=$newdeplibs
  1845. fi
  1846. # All the library-specific variables (install_libdir is set above).
  1847. library_names=
  1848. old_library=
  1849. dlname=
  1850. # Test again, we may have decided not to build it any more
  1851. if test "$build_libtool_libs" = yes; then
  1852. # Get the real and link names of the library.
  1853. eval library_names=\"$library_names_spec\"
  1854. set dummy $library_names
  1855. realname="$2"
  1856. shift; shift
  1857. if test -n "$soname_spec"; then
  1858. eval soname=\"$soname_spec\"
  1859. else
  1860. soname="$realname"
  1861. fi
  1862. lib="$output_objdir/$realname"
  1863. for link
  1864. do
  1865. linknames="$linknames $link"
  1866. done
  1867. # Ensure that we have .o objects for linkers which dislike .lo
  1868. # (e.g. aix) in case we are running --disable-static
  1869. for obj in $libobjs; do
  1870. xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
  1871. if test "X$xdir" = "X$obj"; then
  1872. xdir="."
  1873. else
  1874. xdir="$xdir"
  1875. fi
  1876. baseobj=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
  1877. oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"`
  1878. if test ! -f $xdir/$oldobj; then
  1879. $show "(cd $xdir && ${LN_S} $baseobj $oldobj)"
  1880. $run eval '(cd $xdir && ${LN_S} $baseobj $oldobj)' || exit $?
  1881. fi
  1882. done
  1883. # Use standard objects if they are pic
  1884. test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
  1885. # Prepare the list of exported symbols
  1886. if test -z "$export_symbols"; then
  1887. if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
  1888. $show "generating symbol list for \`$libname.la'"
  1889. export_symbols="$output_objdir/$libname.exp"
  1890. $run $rm $export_symbols
  1891. eval cmds=\"$export_symbols_cmds\"
  1892. IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
  1893. for cmd in $cmds; do
  1894. IFS="$save_ifs"
  1895. $show "$cmd"
  1896. $run eval "$cmd" || exit $?
  1897. done
  1898. IFS="$save_ifs"
  1899. if test -n "$export_symbols_regex"; then
  1900. $show "egrep -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
  1901. $run eval 'egrep -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
  1902. $show "$mv \"${export_symbols}T\" \"$export_symbols\""
  1903. $run eval '$mv "${export_symbols}T" "$export_symbols"'
  1904. fi
  1905. fi
  1906. fi
  1907. if test -n "$export_symbols" && test -n "$include_expsyms"; then
  1908. $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
  1909. fi
  1910. if test -n "$convenience"; then
  1911. if test -n "$whole_archive_flag_spec"; then
  1912. eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
  1913. else
  1914. gentop="$output_objdir/${outputname}x"
  1915. $show "${rm}r $gentop"
  1916. $run ${rm}r "$gentop"
  1917. $show "mkdir $gentop"
  1918. $run mkdir "$gentop"
  1919. status=$?
  1920. if test $status -ne 0 && test ! -d "$gentop"; then
  1921. exit $status
  1922. fi
  1923. generated="$generated $gentop"
  1924. for xlib in $convenience; do
  1925. # Extract the objects.
  1926. case "$xlib" in
  1927. [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
  1928. *) xabs=`pwd`"/$xlib" ;;
  1929. esac
  1930. xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
  1931. xdir="$gentop/$xlib"
  1932. $show "${rm}r $xdir"
  1933. $run ${rm}r "$xdir"
  1934. $show "mkdir $xdir"
  1935. $run mkdir "$xdir"
  1936. status=$?
  1937. if test $status -ne 0 && test ! -d "$xdir"; then
  1938. exit $status
  1939. fi
  1940. $show "(cd $xdir && $AR x $xabs)"
  1941. $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
  1942. libobjs="$libobjs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP`
  1943. done
  1944. fi
  1945. fi
  1946. if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
  1947. eval flag=\"$thread_safe_flag_spec\"
  1948. linkopts="$linkopts $flag"
  1949. fi
  1950. # Do each of the archive commands.
  1951. if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
  1952. eval cmds=\"$archive_expsym_cmds\"
  1953. else
  1954. eval cmds=\"$archive_cmds\"
  1955. fi
  1956. IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
  1957. for cmd in $cmds; do
  1958. IFS="$save_ifs"
  1959. $show "$cmd"
  1960. $run eval "$cmd" || exit $?
  1961. done
  1962. IFS="$save_ifs"
  1963. # Create links to the real library.
  1964. for linkname in $linknames; do
  1965. if test "$realname" != "$linkname"; then
  1966. $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)"
  1967. $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $?
  1968. fi
  1969. done
  1970. # If -module or -export-dynamic was specified, set the dlname.
  1971. if test "$module" = yes || test "$export_dynamic" = yes; then
  1972. # On all known operating systems, these are identical.
  1973. dlname="$soname"
  1974. fi
  1975. fi
  1976. ;;
  1977. *.lo | *.o | *.obj)
  1978. if test -n "$link_against_libtool_libs"; then
  1979. $echo "$modename: error: cannot link libtool libraries into objects" 1>&2
  1980. exit 1
  1981. fi
  1982. if test -n "$deplibs"; then
  1983. $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2
  1984. fi
  1985. if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
  1986. $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2
  1987. fi
  1988. if test -n "$rpath"; then
  1989. $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2
  1990. fi
  1991. if test -n "$xrpath"; then
  1992. $echo "$modename: warning: \`-R' is ignored for objects" 1>&2
  1993. fi
  1994. if test -n "$vinfo"; then
  1995. $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2
  1996. fi
  1997. if test -n "$release"; then
  1998. $echo "$modename: warning: \`-release' is ignored for objects" 1>&2
  1999. fi
  2000. case "$output" in
  2001. *.lo)
  2002. if test -n "$objs"; then
  2003. $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
  2004. exit 1
  2005. fi
  2006. libobj="$output"
  2007. obj=`$echo "X$output" | $Xsed -e "$lo2o"`
  2008. ;;
  2009. *)
  2010. libobj=
  2011. obj="$output"
  2012. ;;
  2013. esac
  2014. # Delete the old objects.
  2015. $run $rm $obj $libobj
  2016. # Objects from convenience libraries. This assumes
  2017. # single-version convenience libraries. Whenever we create
  2018. # different ones for PIC/non-PIC, this we'll have to duplicate
  2019. # the extraction.
  2020. reload_conv_objs=
  2021. gentop=
  2022. # reload_cmds runs $LD directly, so let us get rid of
  2023. # -Wl from whole_archive_flag_spec
  2024. wl=
  2025. if test -n "$convenience"; then
  2026. if test -n "$whole_archive_flag_spec"; then
  2027. eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\"
  2028. else
  2029. gentop="$output_objdir/${obj}x"
  2030. $show "${rm}r $gentop"
  2031. $run ${rm}r "$gentop"
  2032. $show "mkdir $gentop"
  2033. $run mkdir "$gentop"
  2034. status=$?
  2035. if test $status -ne 0 && test ! -d "$gentop"; then
  2036. exit $status
  2037. fi
  2038. generated="$generated $gentop"
  2039. for xlib in $convenience; do
  2040. # Extract the objects.
  2041. case "$xlib" in
  2042. [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
  2043. *) xabs=`pwd`"/$xlib" ;;
  2044. esac
  2045. xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
  2046. xdir="$gentop/$xlib"
  2047. $show "${rm}r $xdir"
  2048. $run ${rm}r "$xdir"
  2049. $show "mkdir $xdir"
  2050. $run mkdir "$xdir"
  2051. status=$?
  2052. if test $status -ne 0 && test ! -d "$xdir"; then
  2053. exit $status
  2054. fi
  2055. $show "(cd $xdir && $AR x $xabs)"
  2056. $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
  2057. reload_conv_objs="$reload_objs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP`
  2058. done
  2059. fi
  2060. fi
  2061. # Create the old-style object.
  2062. reload_objs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs"
  2063. output="$obj"
  2064. eval cmds=\"$reload_cmds\"
  2065. IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
  2066. for cmd in $cmds; do
  2067. IFS="$save_ifs"
  2068. $show "$cmd"
  2069. $run eval "$cmd" || exit $?
  2070. done
  2071. IFS="$save_ifs"
  2072. # Exit if we aren't doing a library object file.
  2073. if test -z "$libobj"; then
  2074. if test -n "$gentop"; then
  2075. $show "${rm}r $gentop"
  2076. $run ${rm}r $gentop
  2077. fi
  2078. exit 0
  2079. fi
  2080. if test "$build_libtool_libs" != yes; then
  2081. if test -n "$gentop"; then
  2082. $show "${rm}r $gentop"
  2083. $run ${rm}r $gentop
  2084. fi
  2085. # Create an invalid libtool object if no PIC, so that we don't
  2086. # accidentally link it into a program.
  2087. $show "echo timestamp > $libobj"
  2088. $run eval "echo timestamp > $libobj" || exit $?
  2089. exit 0
  2090. fi
  2091. if test -n "$pic_flag"; then
  2092. # Only do commands if we really have different PIC objects.
  2093. reload_objs="$libobjs $reload_conv_objs"
  2094. output="$libobj"
  2095. eval cmds=\"$reload_cmds\"
  2096. IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
  2097. for cmd in $cmds; do
  2098. IFS="$save_ifs"
  2099. $show "$cmd"
  2100. $run eval "$cmd" || exit $?
  2101. done
  2102. IFS="$save_ifs"
  2103. else
  2104. # Just create a symlink.
  2105. $show $rm $libobj
  2106. $run $rm $libobj
  2107. xdir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'`
  2108. if test "X$xdir" = "X$libobj"; then
  2109. xdir="."
  2110. else
  2111. xdir="$xdir"
  2112. fi
  2113. baseobj=`$echo "X$libobj" | $Xsed -e 's%^.*/%%'`
  2114. oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"`
  2115. $show "(cd $xdir && $LN_S $oldobj $baseobj)"
  2116. $run eval '(cd $xdir && $LN_S $oldobj $baseobj)' || exit $?
  2117. fi
  2118. if test -n "$gentop"; then
  2119. $show "${rm}r $gentop"
  2120. $run ${rm}r $gentop
  2121. fi
  2122. exit 0
  2123. ;;
  2124. # Anything else should be a program.
  2125. *)
  2126. if test -n "$vinfo"; then
  2127. $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
  2128. fi
  2129. if test -n "$release"; then
  2130. $echo "$modename: warning: \`-release' is ignored for programs" 1>&2
  2131. fi
  2132. if test "$preload" = yes; then
  2133. if test "$dlopen" = unknown && test "$dlopen_self" = unknown &&
  2134. test "$dlopen_self_static" = unknown; then
  2135. $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support."
  2136. fi
  2137. fi
  2138. if test -n "$rpath$xrpath"; then
  2139. # If the user specified any rpath flags, then add them.
  2140. for libdir in $rpath $xrpath; do
  2141. # This is the magic to use -rpath.
  2142. case "$compile_rpath " in
  2143. *" $libdir "*) ;;
  2144. *) compile_rpath="$compile_rpath $libdir" ;;
  2145. esac
  2146. case "$finalize_rpath " in
  2147. *" $libdir "*) ;;
  2148. *) finalize_rpath="$finalize_rpath $libdir" ;;
  2149. esac
  2150. done
  2151. fi
  2152. # Now hardcode the library paths
  2153. rpath=
  2154. hardcode_libdirs=
  2155. for libdir in $compile_rpath $finalize_rpath; do
  2156. if test -n "$hardcode_libdir_flag_spec"; then
  2157. if test -n "$hardcode_libdir_separator"; then
  2158. if test -z "$hardcode_libdirs"; then
  2159. hardcode_libdirs="$libdir"
  2160. else
  2161. # Just accumulate the unique libdirs.
  2162. case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in
  2163. *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
  2164. ;;
  2165. *)
  2166. hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
  2167. ;;
  2168. esac
  2169. fi
  2170. else
  2171. eval flag=\"$hardcode_libdir_flag_spec\"
  2172. rpath="$rpath $flag"
  2173. fi
  2174. elif test -n "$runpath_var"; then
  2175. case "$perm_rpath " in
  2176. *" $libdir "*) ;;
  2177. *) perm_rpath="$perm_rpath $libdir" ;;
  2178. esac
  2179. fi
  2180. done
  2181. # Substitute the hardcoded libdirs into the rpath.
  2182. if test -n "$hardcode_libdir_separator" &&
  2183. test -n "$hardcode_libdirs"; then
  2184. libdir="$hardcode_libdirs"
  2185. eval rpath=\" $hardcode_libdir_flag_spec\"
  2186. fi
  2187. compile_rpath="$rpath"
  2188. rpath=
  2189. hardcode_libdirs=
  2190. for libdir in $finalize_rpath; do
  2191. if test -n "$hardcode_libdir_flag_spec"; then
  2192. if test -n "$hardcode_libdir_separator"; then
  2193. if test -z "$hardcode_libdirs"; then
  2194. hardcode_libdirs="$libdir"
  2195. else
  2196. # Just accumulate the unique libdirs.
  2197. case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in
  2198. *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
  2199. ;;
  2200. *)
  2201. hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
  2202. ;;
  2203. esac
  2204. fi
  2205. else
  2206. eval flag=\"$hardcode_libdir_flag_spec\"
  2207. rpath="$rpath $flag"
  2208. fi
  2209. elif test -n "$runpath_var"; then
  2210. case "$finalize_perm_rpath " in
  2211. *" $libdir "*) ;;
  2212. *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
  2213. esac
  2214. fi
  2215. done
  2216. # Substitute the hardcoded libdirs into the rpath.
  2217. if test -n "$hardcode_libdir_separator" &&
  2218. test -n "$hardcode_libdirs"; then
  2219. libdir="$hardcode_libdirs"
  2220. eval rpath=\" $hardcode_libdir_flag_spec\"
  2221. fi
  2222. finalize_rpath="$rpath"
  2223. output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
  2224. if test "X$output_objdir" = "X$output"; then
  2225. output_objdir="$objdir"
  2226. else
  2227. output_objdir="$output_objdir/$objdir"
  2228. fi
  2229. # Create the binary in the object directory, then wrap it.
  2230. if test ! -d $output_objdir; then
  2231. $show "$mkdir $output_objdir"
  2232. $run $mkdir $output_objdir
  2233. status=$?
  2234. if test $status -ne 0 && test ! -d $output_objdir; then
  2235. exit $status
  2236. fi
  2237. fi
  2238. if test -n "$libobjs" && test "$build_old_libs" = yes; then
  2239. # Transform all the library objects into standard objects.
  2240. compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
  2241. finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
  2242. fi
  2243. dlsyms=
  2244. if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
  2245. if test -n "$NM" && test -n "$global_symbol_pipe"; then
  2246. dlsyms="${outputname}S.c"
  2247. else
  2248. $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2
  2249. fi
  2250. fi
  2251. if test -n "$dlsyms"; then
  2252. case "$dlsyms" in
  2253. "") ;;
  2254. *.c)
  2255. # Discover the nlist of each of the dlfiles.
  2256. nlist="$output_objdir/${outputname}.nm"
  2257. $show "$rm $nlist ${nlist}S ${nlist}T"
  2258. $run $rm "$nlist" "${nlist}S" "${nlist}T"
  2259. # Parse the name list into a source file.
  2260. $show "creating $output_objdir/$dlsyms"
  2261. test -z "$run" && $echo > "$output_objdir/$dlsyms" "\
  2262. /* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */
  2263. /* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */
  2264. #ifdef __cplusplus
  2265. extern \"C\" {
  2266. #endif
  2267. /* Prevent the only kind of declaration conflicts we can make. */
  2268. #define lt_preloaded_symbols some_other_symbol
  2269. /* External symbol declarations for the compiler. */\
  2270. "
  2271. if test "$dlself" = yes; then
  2272. $show "generating symbol list for \`$output'"
  2273. test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist"
  2274. # Add our own program objects to the symbol list.
  2275. progfiles=`$echo "X$objs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
  2276. for arg in $progfiles; do
  2277. $show "extracting global C symbols from \`$arg'"
  2278. $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
  2279. done
  2280. if test -n "$exclude_expsyms"; then
  2281. $run eval 'egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
  2282. $run eval '$mv "$nlist"T "$nlist"'
  2283. fi
  2284. if test -n "$export_symbols_regex"; then
  2285. $run eval 'egrep -e "$export_symbols_regex" "$nlist" > "$nlist"T'
  2286. $run eval '$mv "$nlist"T "$nlist"'
  2287. fi
  2288. # Prepare the list of exported symbols
  2289. if test -z "$export_symbols"; then
  2290. export_symbols="$output_objdir/$output.exp"
  2291. $run $rm $export_symbols
  2292. $run eval "sed -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
  2293. else
  2294. $run eval "sed -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"'
  2295. $run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T'
  2296. $run eval 'mv "$nlist"T "$nlist"'
  2297. fi
  2298. fi
  2299. for arg in $dlprefiles; do
  2300. $show "extracting global C symbols from \`$arg'"
  2301. name=`echo "$arg" | sed -e 's%^.*/%%'`
  2302. $run eval 'echo ": $name " >> "$nlist"'
  2303. $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
  2304. done
  2305. if test -z "$run"; then
  2306. # Make sure we have at least an empty file.
  2307. test -f "$nlist" || : > "$nlist"
  2308. if test -n "$exclude_expsyms"; then
  2309. egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
  2310. $mv "$nlist"T "$nlist"
  2311. fi
  2312. # Try sorting and uniquifying the output.
  2313. if grep -v "^: " < "$nlist" | sort +2 | uniq > "$nlist"S; then
  2314. :
  2315. else
  2316. grep -v "^: " < "$nlist" > "$nlist"S
  2317. fi
  2318. if test -f "$nlist"S; then
  2319. eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"'
  2320. else
  2321. echo '/* NONE */' >> "$output_objdir/$dlsyms"
  2322. fi
  2323. $echo >> "$output_objdir/$dlsyms" "\
  2324. #undef lt_preloaded_symbols
  2325. #if defined (__STDC__) && __STDC__
  2326. # define lt_ptr_t void *
  2327. #else
  2328. # define lt_ptr_t char *
  2329. # define const
  2330. #endif
  2331. /* The mapping between symbol names and symbols. */
  2332. const struct {
  2333. const char *name;
  2334. lt_ptr_t address;
  2335. }
  2336. lt_preloaded_symbols[] =
  2337. {\
  2338. "
  2339. sed -n -e 's/^: \([^ ]*\) $/ {\"\1\", (lt_ptr_t) 0},/p' \
  2340. -e 's/^. \([^ ]*\) \([^ ]*\)$/ {"\2", (lt_ptr_t) \&\2},/p' \
  2341. < "$nlist" >> "$output_objdir/$dlsyms"
  2342. $echo >> "$output_objdir/$dlsyms" "\
  2343. {0, (lt_ptr_t) 0}
  2344. };
  2345. /* This works around a problem in FreeBSD linker */
  2346. #ifdef FREEBSD_WORKAROUND
  2347. static const void *lt_preloaded_setup() {
  2348. return lt_preloaded_symbols;
  2349. }
  2350. #endif
  2351. #ifdef __cplusplus
  2352. }
  2353. #endif\
  2354. "
  2355. fi
  2356. pic_flag_for_symtable=
  2357. case "$host" in
  2358. # compiling the symbol table file with pic_flag works around
  2359. # a FreeBSD bug that causes programs to crash when -lm is
  2360. # linked before any other PIC object. But we must not use
  2361. # pic_flag when linking with -static. The problem exists in
  2362. # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
  2363. *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
  2364. case "$compile_command " in
  2365. *" -static "*) ;;
  2366. *) pic_flag_for_symtable=" $pic_flag -DPIC -DFREEBSD_WORKAROUND";;
  2367. esac;;
  2368. *-*-hpux*)
  2369. case "$compile_command " in
  2370. *" -static "*) ;;
  2371. *) pic_flag_for_symtable=" $pic_flag -DPIC";;
  2372. esac
  2373. esac
  2374. # Now compile the dynamic symbol file.
  2375. $show "(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
  2376. $run eval '(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
  2377. # Clean up the generated files.
  2378. $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
  2379. $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
  2380. # Transform the symbol file into the correct name.
  2381. compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
  2382. finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
  2383. ;;
  2384. *)
  2385. $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
  2386. exit 1
  2387. ;;
  2388. esac
  2389. else
  2390. # We keep going just in case the user didn't refer to
  2391. # lt_preloaded_symbols. The linker will fail if global_symbol_pipe
  2392. # really was required.
  2393. # Nullify the symbol file.
  2394. compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
  2395. finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
  2396. fi
  2397. if test -z "$link_against_libtool_libs" || test "$build_libtool_libs" != yes; then
  2398. # Replace the output file specification.
  2399. compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
  2400. link_command="$compile_command$compile_rpath"
  2401. # We have no uninstalled library dependencies, so finalize right now.
  2402. $show "$link_command"
  2403. $run eval "$link_command"
  2404. status=$?
  2405. # Delete the generated files.
  2406. if test -n "$dlsyms"; then
  2407. $show "$rm $output_objdir/${outputname}S.${objext}"
  2408. $run $rm "$output_objdir/${outputname}S.${objext}"
  2409. fi
  2410. exit $status
  2411. fi
  2412. if test -n "$shlibpath_var"; then
  2413. # We should set the shlibpath_var
  2414. rpath=
  2415. for dir in $temp_rpath; do
  2416. case "$dir" in
  2417. [\\/]* | [A-Za-z]:[\\/]*)
  2418. # Absolute path.
  2419. rpath="$rpath$dir:"
  2420. ;;
  2421. *)
  2422. # Relative path: add a thisdir entry.
  2423. rpath="$rpath\$thisdir/$dir:"
  2424. ;;
  2425. esac
  2426. done
  2427. temp_rpath="$rpath"
  2428. fi
  2429. if test -n "$compile_shlibpath$finalize_shlibpath"; then
  2430. compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
  2431. fi
  2432. if test -n "$finalize_shlibpath"; then
  2433. finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
  2434. fi
  2435. compile_var=
  2436. finalize_var=
  2437. if test -n "$runpath_var"; then
  2438. if test -n "$perm_rpath"; then
  2439. # We should set the runpath_var.
  2440. rpath=
  2441. for dir in $perm_rpath; do
  2442. rpath="$rpath$dir:"
  2443. done
  2444. compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
  2445. fi
  2446. if test -n "$finalize_perm_rpath"; then
  2447. # We should set the runpath_var.
  2448. rpath=
  2449. for dir in $finalize_perm_rpath; do
  2450. rpath="$rpath$dir:"
  2451. done
  2452. finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
  2453. fi
  2454. fi
  2455. if test "$hardcode_action" = relink; then
  2456. # Fast installation is not supported
  2457. link_command="$compile_var$compile_command$compile_rpath"
  2458. relink_command="$finalize_var$finalize_command$finalize_rpath"
  2459. $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2
  2460. $echo "$modename: \`$output' will be relinked during installation" 1>&2
  2461. else
  2462. if test "$fast_install" != no; then
  2463. link_command="$finalize_var$compile_command$finalize_rpath"
  2464. if test "$fast_install" = yes; then
  2465. relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'`
  2466. else
  2467. # fast_install is set to needless
  2468. relink_command=
  2469. fi
  2470. else
  2471. link_command="$compile_var$compile_command$compile_rpath"
  2472. relink_command="$finalize_var$finalize_command$finalize_rpath"
  2473. fi
  2474. fi
  2475. # Replace the output file specification.
  2476. link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
  2477. # Delete the old output files.
  2478. $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname
  2479. $show "$link_command"
  2480. $run eval "$link_command" || exit $?
  2481. # Now create the wrapper script.
  2482. $show "creating $output"
  2483. # Quote the relink command for shipping.
  2484. if test -n "$relink_command"; then
  2485. relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
  2486. fi
  2487. # Quote $echo for shipping.
  2488. if test "X$echo" = "X$SHELL $0 --fallback-echo"; then
  2489. case "$0" in
  2490. [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $0 --fallback-echo";;
  2491. *) qecho="$SHELL `pwd`/$0 --fallback-echo";;
  2492. esac
  2493. qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
  2494. else
  2495. qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"`
  2496. fi
  2497. # Only actually do things if our run command is non-null.
  2498. if test -z "$run"; then
  2499. # win32 will think the script is a binary if it has
  2500. # a .exe suffix, so we strip it off here.
  2501. case $output in
  2502. *.exe) output=`echo $output|sed 's,.exe$,,'` ;;
  2503. esac
  2504. $rm $output
  2505. trap "$rm $output; exit 1" 1 2 15
  2506. $echo > $output "\
  2507. #! $SHELL
  2508. # $output - temporary wrapper script for $objdir/$outputname
  2509. # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
  2510. #
  2511. # The $output program cannot be directly executed until all the libtool
  2512. # libraries that it depends on are installed.
  2513. #
  2514. # This wrapper script should never be moved out of the build directory.
  2515. # If it is, it will not operate correctly.
  2516. # Sed substitution that helps us do robust quoting. It backslashifies
  2517. # metacharacters that are still active within double-quoted strings.
  2518. Xsed='sed -e 1s/^X//'
  2519. sed_quote_subst='$sed_quote_subst'
  2520. # The HP-UX ksh and POSIX shell print the target directory to stdout
  2521. # if CDPATH is set.
  2522. if test \"\${CDPATH+set}\" = set; then CDPATH=:; export CDPATH; fi
  2523. relink_command=\"$relink_command\"
  2524. # This environment variable determines our operation mode.
  2525. if test \"\$libtool_install_magic\" = \"$magic\"; then
  2526. # install mode needs the following variable:
  2527. link_against_libtool_libs='$link_against_libtool_libs'
  2528. else
  2529. # When we are sourced in execute mode, \$file and \$echo are already set.
  2530. if test \"\$libtool_execute_magic\" != \"$magic\"; then
  2531. echo=\"$qecho\"
  2532. file=\"\$0\"
  2533. # Make sure echo works.
  2534. if test \"X\$1\" = X--no-reexec; then
  2535. # Discard the --no-reexec flag, and continue.
  2536. shift
  2537. elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then
  2538. # Yippee, \$echo works!
  2539. :
  2540. else
  2541. # Restart under the correct shell, and then maybe \$echo will work.
  2542. exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
  2543. fi
  2544. fi\
  2545. "
  2546. $echo >> $output "\
  2547. # Find the directory that this script lives in.
  2548. thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
  2549. test \"x\$thisdir\" = \"x\$file\" && thisdir=.
  2550. # Follow symbolic links until we get to the real thisdir.
  2551. file=\`ls -ld \"\$file\" | sed -n 's/.*-> //p'\`
  2552. while test -n \"\$file\"; do
  2553. destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
  2554. # If there was a directory component, then change thisdir.
  2555. if test \"x\$destdir\" != \"x\$file\"; then
  2556. case \"\$destdir\" in
  2557. [\\/]* | [A-Za-z]:[\\/]*) thisdir=\"\$destdir\" ;;
  2558. *) thisdir=\"\$thisdir/\$destdir\" ;;
  2559. esac
  2560. fi
  2561. file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
  2562. file=\`ls -ld \"\$thisdir/\$file\" | sed -n 's/.*-> //p'\`
  2563. done
  2564. # Try to get the absolute directory name.
  2565. absdir=\`cd \"\$thisdir\" && pwd\`
  2566. test -n \"\$absdir\" && thisdir=\"\$absdir\"
  2567. "
  2568. if test "$fast_install" = yes; then
  2569. echo >> $output "\
  2570. program=lt-'$outputname'
  2571. progdir=\"\$thisdir/$objdir\"
  2572. if test ! -f \"\$progdir/\$program\" || \\
  2573. { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | sed 1q\`; \\
  2574. test \"X\$file\" != \"X\$progdir/\$program\"; }; then
  2575. file=\"\$\$-\$program\"
  2576. if test ! -d \"\$progdir\"; then
  2577. $mkdir \"\$progdir\"
  2578. else
  2579. $rm \"\$progdir/\$file\"
  2580. fi"
  2581. echo >> $output "\
  2582. # relink executable if necessary
  2583. if test -n \"\$relink_command\"; then
  2584. if (cd \"\$thisdir\" && eval \$relink_command); then :
  2585. else
  2586. $rm \"\$progdir/\$file\"
  2587. exit 1
  2588. fi
  2589. fi
  2590. $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
  2591. { $rm \"\$progdir/\$program\";
  2592. $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; }
  2593. $rm \"\$progdir/\$file\"
  2594. fi"
  2595. else
  2596. echo >> $output "\
  2597. program='$outputname'
  2598. progdir=\"\$thisdir/$objdir\"
  2599. "
  2600. fi
  2601. echo >> $output "\
  2602. if test -f \"\$progdir/\$program\"; then"
  2603. # Export our shlibpath_var if we have one.
  2604. if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
  2605. $echo >> $output "\
  2606. # Add our own library path to $shlibpath_var
  2607. $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
  2608. # Some systems cannot cope with colon-terminated $shlibpath_var
  2609. # The second colon is a workaround for a bug in BeOS R4 sed
  2610. $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
  2611. export $shlibpath_var
  2612. "
  2613. fi
  2614. # fixup the dll searchpath if we need to.
  2615. if test -n "$dllsearchpath"; then
  2616. $echo >> $output "\
  2617. # Add the dll search path components to the executable PATH
  2618. PATH=$dllsearchpath:\$PATH
  2619. "
  2620. fi
  2621. $echo >> $output "\
  2622. if test \"\$libtool_execute_magic\" != \"$magic\"; then
  2623. # Run the actual program with our arguments.
  2624. "
  2625. case $host in
  2626. # win32 systems need to use the prog path for dll
  2627. # lookup to work
  2628. *-*-cygwin*)
  2629. $echo >> $output "\
  2630. exec \$progdir/\$program \${1+\"\$@\"}
  2631. "
  2632. ;;
  2633. # Backslashes separate directories on plain windows
  2634. *-*-mingw | *-*-os2*)
  2635. $echo >> $output "\
  2636. exec \$progdir\\\\\$program \${1+\"\$@\"}
  2637. "
  2638. ;;
  2639. *)
  2640. $echo >> $output "\
  2641. # Export the path to the program.
  2642. PATH=\"\$progdir:\$PATH\"
  2643. export PATH
  2644. exec \$program \${1+\"\$@\"}
  2645. "
  2646. ;;
  2647. esac
  2648. $echo >> $output "\
  2649. \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\"
  2650. exit 1
  2651. fi
  2652. else
  2653. # The program doesn't exist.
  2654. \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2
  2655. \$echo \"This script is just a wrapper for \$program.\" 1>&2
  2656. echo \"See the $PACKAGE documentation for more information.\" 1>&2
  2657. exit 1
  2658. fi
  2659. fi\
  2660. "
  2661. chmod +x $output
  2662. fi
  2663. exit 0
  2664. ;;
  2665. esac
  2666. # See if we need to build an old-fashioned archive.
  2667. for oldlib in $oldlibs; do
  2668. if test "$build_libtool_libs" = convenience; then
  2669. oldobjs="$libobjs_save"
  2670. addlibs="$convenience"
  2671. build_libtool_libs=no
  2672. else
  2673. if test "$build_libtool_libs" = module; then
  2674. oldobjs="$libobjs_save"
  2675. build_libtool_libs=no
  2676. else
  2677. oldobjs="$objs "`$echo "X$libobjs_save" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`
  2678. fi
  2679. addlibs="$old_convenience"
  2680. fi
  2681. if test -n "$addlibs"; then
  2682. gentop="$output_objdir/${outputname}x"
  2683. $show "${rm}r $gentop"
  2684. $run ${rm}r "$gentop"
  2685. $show "mkdir $gentop"
  2686. $run mkdir "$gentop"
  2687. status=$?
  2688. if test $status -ne 0 && test ! -d "$gentop"; then
  2689. exit $status
  2690. fi
  2691. generated="$generated $gentop"
  2692. # Add in members from convenience archives.
  2693. for xlib in $addlibs; do
  2694. # Extract the objects.
  2695. case "$xlib" in
  2696. [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
  2697. *) xabs=`pwd`"/$xlib" ;;
  2698. esac
  2699. xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
  2700. xdir="$gentop/$xlib"
  2701. $show "${rm}r $xdir"
  2702. $run ${rm}r "$xdir"
  2703. $show "mkdir $xdir"
  2704. $run mkdir "$xdir"
  2705. status=$?
  2706. if test $status -ne 0 && test ! -d "$xdir"; then
  2707. exit $status
  2708. fi
  2709. $show "(cd $xdir && $AR x $xabs)"
  2710. $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
  2711. oldobjs="$oldobjs "`find $xdir -name \*.${objext} -print -o -name \*.lo -print | $NL2SP`
  2712. done
  2713. fi
  2714. # Do each command in the archive commands.
  2715. if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
  2716. eval cmds=\"$old_archive_from_new_cmds\"
  2717. else
  2718. # Ensure that we have .o objects in place in case we decided
  2719. # not to build a shared library, and have fallen back to building
  2720. # static libs even though --disable-static was passed!
  2721. for oldobj in $oldobjs; do
  2722. if test ! -f $oldobj; then
  2723. xdir=`$echo "X$oldobj" | $Xsed -e 's%/[^/]*$%%'`
  2724. if test "X$xdir" = "X$oldobj"; then
  2725. xdir="."
  2726. else
  2727. xdir="$xdir"
  2728. fi
  2729. baseobj=`$echo "X$oldobj" | $Xsed -e 's%^.*/%%'`
  2730. obj=`$echo "X$baseobj" | $Xsed -e "$o2lo"`
  2731. $show "(cd $xdir && ${LN_S} $obj $baseobj)"
  2732. $run eval '(cd $xdir && ${LN_S} $obj $baseobj)' || exit $?
  2733. fi
  2734. done
  2735. eval cmds=\"$old_archive_cmds\"
  2736. fi
  2737. IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
  2738. for cmd in $cmds; do
  2739. IFS="$save_ifs"
  2740. $show "$cmd"
  2741. $run eval "$cmd" || exit $?
  2742. done
  2743. IFS="$save_ifs"
  2744. done
  2745. if test -n "$generated"; then
  2746. $show "${rm}r$generated"
  2747. $run ${rm}r$generated
  2748. fi
  2749. # Now create the libtool archive.
  2750. case "$output" in
  2751. *.la)
  2752. old_library=
  2753. test "$build_old_libs" = yes && old_library="$libname.$libext"
  2754. $show "creating $output"
  2755. if test -n "$xrpath"; then
  2756. temp_xrpath=
  2757. for libdir in $xrpath; do
  2758. temp_xrpath="$temp_xrpath -R$libdir"
  2759. done
  2760. dependency_libs="$temp_xrpath $dependency_libs"
  2761. fi
  2762. # Only create the output if not a dry run.
  2763. if test -z "$run"; then
  2764. for installed in no yes; do
  2765. if test "$installed" = yes; then
  2766. if test -z "$install_libdir"; then
  2767. break
  2768. fi
  2769. output="$output_objdir/$outputname"i
  2770. fi
  2771. $rm $output
  2772. $echo > $output "\
  2773. # $outputname - a libtool library file
  2774. # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
  2775. #
  2776. # Please DO NOT delete this file!
  2777. # It is necessary for linking the library.
  2778. # The name that we can dlopen(3).
  2779. dlname='$dlname'
  2780. # Names of this library.
  2781. library_names='$library_names'
  2782. # The name of the static archive.
  2783. old_library='$old_library'
  2784. # Libraries that this one depends upon.
  2785. dependency_libs='$dependency_libs'
  2786. # Version information for $libname.
  2787. current=$current
  2788. age=$age
  2789. revision=$revision
  2790. # Is this an already installed library?
  2791. installed=$installed
  2792. # Directory that this library needs to be installed in:
  2793. libdir='$install_libdir'\
  2794. "
  2795. done
  2796. fi
  2797. # Do a symbolic link so that the libtool archive can be found in
  2798. # LD_LIBRARY_PATH before the program is installed.
  2799. $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)"
  2800. $run eval "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)" || exit $?
  2801. ;;
  2802. esac
  2803. exit 0
  2804. ;;
  2805. # libtool install mode
  2806. install)
  2807. modename="$modename: install"
  2808. # There may be an optional sh(1) argument at the beginning of
  2809. # install_prog (especially on Windows NT).
  2810. if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh; then
  2811. # Aesthetically quote it.
  2812. arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
  2813. case "$arg" in
  2814. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
  2815. arg="\"$arg\""
  2816. ;;
  2817. esac
  2818. install_prog="$arg "
  2819. arg="$1"
  2820. shift
  2821. else
  2822. install_prog=
  2823. arg="$nonopt"
  2824. fi
  2825. # The real first argument should be the name of the installation program.
  2826. # Aesthetically quote it.
  2827. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
  2828. case "$arg" in
  2829. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
  2830. arg="\"$arg\""
  2831. ;;
  2832. esac
  2833. install_prog="$install_prog$arg"
  2834. # We need to accept at least all the BSD install flags.
  2835. dest=
  2836. files=
  2837. opts=
  2838. prev=
  2839. install_type=
  2840. isdir=no
  2841. stripme=
  2842. for arg
  2843. do
  2844. if test -n "$dest"; then
  2845. files="$files $dest"
  2846. dest="$arg"
  2847. continue
  2848. fi
  2849. case "$arg" in
  2850. -d) isdir=yes ;;
  2851. -f) prev="-f" ;;
  2852. -g) prev="-g" ;;
  2853. -m) prev="-m" ;;
  2854. -o) prev="-o" ;;
  2855. -s)
  2856. stripme=" -s"
  2857. continue
  2858. ;;
  2859. -*) ;;
  2860. *)
  2861. # If the previous option needed an argument, then skip it.
  2862. if test -n "$prev"; then
  2863. prev=
  2864. else
  2865. dest="$arg"
  2866. continue
  2867. fi
  2868. ;;
  2869. esac
  2870. # Aesthetically quote the argument.
  2871. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
  2872. case "$arg" in
  2873. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
  2874. arg="\"$arg\""
  2875. ;;
  2876. esac
  2877. install_prog="$install_prog $arg"
  2878. done
  2879. if test -z "$install_prog"; then
  2880. $echo "$modename: you must specify an install program" 1>&2
  2881. $echo "$help" 1>&2
  2882. exit 1
  2883. fi
  2884. if test -n "$prev"; then
  2885. $echo "$modename: the \`$prev' option requires an argument" 1>&2
  2886. $echo "$help" 1>&2
  2887. exit 1
  2888. fi
  2889. if test -z "$files"; then
  2890. if test -z "$dest"; then
  2891. $echo "$modename: no file or destination specified" 1>&2
  2892. else
  2893. $echo "$modename: you must specify a destination" 1>&2
  2894. fi
  2895. $echo "$help" 1>&2
  2896. exit 1
  2897. fi
  2898. # Strip any trailing slash from the destination.
  2899. dest=`$echo "X$dest" | $Xsed -e 's%/$%%'`
  2900. # Check to see that the destination is a directory.
  2901. test -d "$dest" && isdir=yes
  2902. if test "$isdir" = yes; then
  2903. destdir="$dest"
  2904. destname=
  2905. else
  2906. destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'`
  2907. test "X$destdir" = "X$dest" && destdir=.
  2908. destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'`
  2909. # Not a directory, so check to see that there is only one file specified.
  2910. set dummy $files
  2911. if test $# -gt 2; then
  2912. $echo "$modename: \`$dest' is not a directory" 1>&2
  2913. $echo "$help" 1>&2
  2914. exit 1
  2915. fi
  2916. fi
  2917. case "$destdir" in
  2918. [\\/]* | [A-Za-z]:[\\/]*) ;;
  2919. *)
  2920. for file in $files; do
  2921. case "$file" in
  2922. *.lo) ;;
  2923. *)
  2924. $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
  2925. $echo "$help" 1>&2
  2926. exit 1
  2927. ;;
  2928. esac
  2929. done
  2930. ;;
  2931. esac
  2932. # This variable tells wrapper scripts just to set variables rather
  2933. # than running their programs.
  2934. libtool_install_magic="$magic"
  2935. staticlibs=
  2936. future_libdirs=
  2937. current_libdirs=
  2938. for file in $files; do
  2939. # Do each installation.
  2940. case "$file" in
  2941. *.a | *.lib)
  2942. # Do the static libraries later.
  2943. staticlibs="$staticlibs $file"
  2944. ;;
  2945. *.la)
  2946. # Check to see that this really is a libtool archive.
  2947. if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
  2948. else
  2949. $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
  2950. $echo "$help" 1>&2
  2951. exit 1
  2952. fi
  2953. library_names=
  2954. old_library=
  2955. # If there is no directory component, then add one.
  2956. case "$file" in
  2957. */* | *\\*) . $file ;;
  2958. *) . ./$file ;;
  2959. esac
  2960. # Add the libdir to current_libdirs if it is the destination.
  2961. if test "X$destdir" = "X$libdir"; then
  2962. case "$current_libdirs " in
  2963. *" $libdir "*) ;;
  2964. *) current_libdirs="$current_libdirs $libdir" ;;
  2965. esac
  2966. else
  2967. # Note the libdir as a future libdir.
  2968. case "$future_libdirs " in
  2969. *" $libdir "*) ;;
  2970. *) future_libdirs="$future_libdirs $libdir" ;;
  2971. esac
  2972. fi
  2973. dir="`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/"
  2974. test "X$dir" = "X$file/" && dir=
  2975. dir="$dir$objdir"
  2976. # See the names of the shared library.
  2977. set dummy $library_names
  2978. if test -n "$2"; then
  2979. realname="$2"
  2980. shift
  2981. shift
  2982. # Install the shared library and build the symlinks.
  2983. $show "$install_prog $dir/$realname $destdir/$realname"
  2984. $run eval "$install_prog $dir/$realname $destdir/$realname" || exit $?
  2985. if test $# -gt 0; then
  2986. # Delete the old symlinks, and create new ones.
  2987. for linkname
  2988. do
  2989. if test "$linkname" != "$realname"; then
  2990. $show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
  2991. $run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
  2992. fi
  2993. done
  2994. fi
  2995. # Do each command in the postinstall commands.
  2996. lib="$destdir/$realname"
  2997. eval cmds=\"$postinstall_cmds\"
  2998. IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
  2999. for cmd in $cmds; do
  3000. IFS="$save_ifs"
  3001. $show "$cmd"
  3002. $run eval "$cmd" || exit $?
  3003. done
  3004. IFS="$save_ifs"
  3005. fi
  3006. # Install the pseudo-library for information purposes.
  3007. name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
  3008. instname="$dir/$name"i
  3009. $show "$install_prog $instname $destdir/$name"
  3010. $run eval "$install_prog $instname $destdir/$name" || exit $?
  3011. # Maybe install the static library, too.
  3012. test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
  3013. ;;
  3014. *.lo)
  3015. # Install (i.e. copy) a libtool object.
  3016. # Figure out destination file name, if it wasn't already specified.
  3017. if test -n "$destname"; then
  3018. destfile="$destdir/$destname"
  3019. else
  3020. destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
  3021. destfile="$destdir/$destfile"
  3022. fi
  3023. # Deduce the name of the destination old-style object file.
  3024. case "$destfile" in
  3025. *.lo)
  3026. staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"`
  3027. ;;
  3028. *.o | *.obj)
  3029. staticdest="$destfile"
  3030. destfile=
  3031. ;;
  3032. *)
  3033. $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
  3034. $echo "$help" 1>&2
  3035. exit 1
  3036. ;;
  3037. esac
  3038. # Install the libtool object if requested.
  3039. if test -n "$destfile"; then
  3040. $show "$install_prog $file $destfile"
  3041. $run eval "$install_prog $file $destfile" || exit $?
  3042. fi
  3043. # Install the old object if enabled.
  3044. if test "$build_old_libs" = yes; then
  3045. # Deduce the name of the old-style object file.
  3046. staticobj=`$echo "X$file" | $Xsed -e "$lo2o"`
  3047. $show "$install_prog $staticobj $staticdest"
  3048. $run eval "$install_prog \$staticobj \$staticdest" || exit $?
  3049. fi
  3050. exit 0
  3051. ;;
  3052. *)
  3053. # Figure out destination file name, if it wasn't already specified.
  3054. if test -n "$destname"; then
  3055. destfile="$destdir/$destname"
  3056. else
  3057. destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
  3058. destfile="$destdir/$destfile"
  3059. fi
  3060. # Do a test to see if this is really a libtool program.
  3061. if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
  3062. link_against_libtool_libs=
  3063. relink_command=
  3064. # If there is no directory component, then add one.
  3065. case "$file" in
  3066. */* | *\\*) . $file ;;
  3067. *) . ./$file ;;
  3068. esac
  3069. # Check the variables that should have been set.
  3070. if test -z "$link_against_libtool_libs"; then
  3071. $echo "$modename: invalid libtool wrapper script \`$file'" 1>&2
  3072. exit 1
  3073. fi
  3074. finalize=yes
  3075. for lib in $link_against_libtool_libs; do
  3076. # Check to see that each library is installed.
  3077. libdir=
  3078. if test -f "$lib"; then
  3079. # If there is no directory component, then add one.
  3080. case "$lib" in
  3081. */* | *\\*) . $lib ;;
  3082. *) . ./$lib ;;
  3083. esac
  3084. fi
  3085. libfile="$libdir/`$echo "X$lib" | $Xsed -e 's%^.*/%%g'`"
  3086. if test -n "$libdir" && test ! -f "$libfile"; then
  3087. $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
  3088. finalize=no
  3089. fi
  3090. done
  3091. outputname=
  3092. if test "$fast_install" = no && test -n "$relink_command"; then
  3093. if test "$finalize" = yes && test -z "$run"; then
  3094. tmpdir="/tmp"
  3095. test -n "$TMPDIR" && tmpdir="$TMPDIR"
  3096. tmpdir="$tmpdir/libtool-$$"
  3097. if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then :
  3098. else
  3099. $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2
  3100. continue
  3101. fi
  3102. outputname="$tmpdir/$file"
  3103. # Replace the output file specification.
  3104. relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
  3105. $show "$relink_command"
  3106. if $run eval "$relink_command"; then :
  3107. else
  3108. $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
  3109. ${rm}r "$tmpdir"
  3110. continue
  3111. fi
  3112. file="$outputname"
  3113. else
  3114. $echo "$modename: warning: cannot relink \`$file'" 1>&2
  3115. fi
  3116. else
  3117. # Install the binary that we compiled earlier.
  3118. file=`$echo "X$file" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
  3119. fi
  3120. fi
  3121. $show "$install_prog$stripme $file $destfile"
  3122. $run eval "$install_prog\$stripme \$file \$destfile" || exit $?
  3123. test -n "$outputname" && ${rm}r "$tmpdir"
  3124. ;;
  3125. esac
  3126. done
  3127. for file in $staticlibs; do
  3128. name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
  3129. # Set up the ranlib parameters.
  3130. oldlib="$destdir/$name"
  3131. $show "$install_prog $file $oldlib"
  3132. $run eval "$install_prog \$file \$oldlib" || exit $?
  3133. # Do each command in the postinstall commands.
  3134. eval cmds=\"$old_postinstall_cmds\"
  3135. IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
  3136. for cmd in $cmds; do
  3137. IFS="$save_ifs"
  3138. $show "$cmd"
  3139. $run eval "$cmd" || exit $?
  3140. done
  3141. IFS="$save_ifs"
  3142. done
  3143. if test -n "$future_libdirs"; then
  3144. $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
  3145. fi
  3146. if test -n "$current_libdirs"; then
  3147. # Maybe just do a dry run.
  3148. test -n "$run" && current_libdirs=" -n$current_libdirs"
  3149. exec $SHELL $0 --finish$current_libdirs
  3150. exit 1
  3151. fi
  3152. exit 0
  3153. ;;
  3154. # libtool finish mode
  3155. finish)
  3156. modename="$modename: finish"
  3157. libdirs="$nonopt"
  3158. admincmds=
  3159. if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
  3160. for dir
  3161. do
  3162. libdirs="$libdirs $dir"
  3163. done
  3164. for libdir in $libdirs; do
  3165. if test -n "$finish_cmds"; then
  3166. # Do each command in the finish commands.
  3167. eval cmds=\"$finish_cmds\"
  3168. IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
  3169. for cmd in $cmds; do
  3170. IFS="$save_ifs"
  3171. $show "$cmd"
  3172. $run eval "$cmd" || admincmds="$admincmds
  3173. $cmd"
  3174. done
  3175. IFS="$save_ifs"
  3176. fi
  3177. if test -n "$finish_eval"; then
  3178. # Do the single finish_eval.
  3179. eval cmds=\"$finish_eval\"
  3180. $run eval "$cmds" || admincmds="$admincmds
  3181. $cmds"
  3182. fi
  3183. done
  3184. fi
  3185. # Exit here if they wanted silent mode.
  3186. test "$show" = : && exit 0
  3187. echo "----------------------------------------------------------------------"
  3188. echo "Libraries have been installed in:"
  3189. for libdir in $libdirs; do
  3190. echo " $libdir"
  3191. done
  3192. echo
  3193. echo "If you ever happen to want to link against installed libraries"
  3194. echo "in a given directory, LIBDIR, you must either use libtool, and"
  3195. echo "specify the full pathname of the library, or use \`-LLIBDIR'"
  3196. echo "flag during linking and do at least one of the following:"
  3197. if test -n "$shlibpath_var"; then
  3198. echo " - add LIBDIR to the \`$shlibpath_var' environment variable"
  3199. echo " during execution"
  3200. fi
  3201. if test -n "$runpath_var"; then
  3202. echo " - add LIBDIR to the \`$runpath_var' environment variable"
  3203. echo " during linking"
  3204. fi
  3205. if test -n "$hardcode_libdir_flag_spec"; then
  3206. libdir=LIBDIR
  3207. eval flag=\"$hardcode_libdir_flag_spec\"
  3208. echo " - use the \`$flag' linker flag"
  3209. fi
  3210. if test -n "$admincmds"; then
  3211. echo " - have your system administrator run these commands:$admincmds"
  3212. fi
  3213. if test -f /etc/ld.so.conf; then
  3214. echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
  3215. fi
  3216. echo
  3217. echo "See any operating system documentation about shared libraries for"
  3218. echo "more information, such as the ld(1) and ld.so(8) manual pages."
  3219. echo "----------------------------------------------------------------------"
  3220. exit 0
  3221. ;;
  3222. # libtool execute mode
  3223. execute)
  3224. modename="$modename: execute"
  3225. # The first argument is the command name.
  3226. cmd="$nonopt"
  3227. if test -z "$cmd"; then
  3228. $echo "$modename: you must specify a COMMAND" 1>&2
  3229. $echo "$help"
  3230. exit 1
  3231. fi
  3232. # Handle -dlopen flags immediately.
  3233. for file in $execute_dlfiles; do
  3234. if test ! -f "$file"; then
  3235. $echo "$modename: \`$file' is not a file" 1>&2
  3236. $echo "$help" 1>&2
  3237. exit 1
  3238. fi
  3239. dir=
  3240. case "$file" in
  3241. *.la)
  3242. # Check to see that this really is a libtool archive.
  3243. if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
  3244. else
  3245. $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
  3246. $echo "$help" 1>&2
  3247. exit 1
  3248. fi
  3249. # Read the libtool library.
  3250. dlname=
  3251. library_names=
  3252. # If there is no directory component, then add one.
  3253. case "$file" in
  3254. */* | *\\*) . $file ;;
  3255. *) . ./$file ;;
  3256. esac
  3257. # Skip this library if it cannot be dlopened.
  3258. if test -z "$dlname"; then
  3259. # Warn if it was a shared library.
  3260. test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'"
  3261. continue
  3262. fi
  3263. dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
  3264. test "X$dir" = "X$file" && dir=.
  3265. if test -f "$dir/$objdir/$dlname"; then
  3266. dir="$dir/$objdir"
  3267. else
  3268. $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
  3269. exit 1
  3270. fi
  3271. ;;
  3272. *.lo)
  3273. # Just add the directory containing the .lo file.
  3274. dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
  3275. test "X$dir" = "X$file" && dir=.
  3276. ;;
  3277. *)
  3278. $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2
  3279. continue
  3280. ;;
  3281. esac
  3282. # Get the absolute pathname.
  3283. absdir=`cd "$dir" && pwd`
  3284. test -n "$absdir" && dir="$absdir"
  3285. # Now add the directory to shlibpath_var.
  3286. if eval "test -z \"\$$shlibpath_var\""; then
  3287. eval "$shlibpath_var=\"\$dir\""
  3288. else
  3289. eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
  3290. fi
  3291. done
  3292. # This variable tells wrapper scripts just to set shlibpath_var
  3293. # rather than running their programs.
  3294. libtool_execute_magic="$magic"
  3295. # Check if any of the arguments is a wrapper script.
  3296. args=
  3297. for file
  3298. do
  3299. case "$file" in
  3300. -*) ;;
  3301. *)
  3302. # Do a test to see if this is really a libtool program.
  3303. if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
  3304. # If there is no directory component, then add one.
  3305. case "$file" in
  3306. */* | *\\*) . $file ;;
  3307. *) . ./$file ;;
  3308. esac
  3309. # Transform arg to wrapped name.
  3310. file="$progdir/$program"
  3311. fi
  3312. ;;
  3313. esac
  3314. # Quote arguments (to preserve shell metacharacters).
  3315. file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"`
  3316. args="$args \"$file\""
  3317. done
  3318. if test -z "$run"; then
  3319. if test -n "$shlibpath_var"; then
  3320. # Export the shlibpath_var.
  3321. eval "export $shlibpath_var"
  3322. fi
  3323. # Restore saved enviroment variables
  3324. if test "${save_LC_ALL+set}" = set; then
  3325. LC_ALL="$save_LC_ALL"; export LC_ALL
  3326. fi
  3327. if test "${save_LANG+set}" = set; then
  3328. LANG="$save_LANG"; export LANG
  3329. fi
  3330. # Now actually exec the command.
  3331. eval "exec \$cmd$args"
  3332. $echo "$modename: cannot exec \$cmd$args"
  3333. exit 1
  3334. else
  3335. # Display what would be done.
  3336. if test -n "$shlibpath_var"; then
  3337. eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
  3338. $echo "export $shlibpath_var"
  3339. fi
  3340. $echo "$cmd$args"
  3341. exit 0
  3342. fi
  3343. ;;
  3344. # libtool uninstall mode
  3345. uninstall)
  3346. modename="$modename: uninstall"
  3347. rm="$nonopt"
  3348. files=
  3349. for arg
  3350. do
  3351. case "$arg" in
  3352. -*) rm="$rm $arg" ;;
  3353. *) files="$files $arg" ;;
  3354. esac
  3355. done
  3356. if test -z "$rm"; then
  3357. $echo "$modename: you must specify an RM program" 1>&2
  3358. $echo "$help" 1>&2
  3359. exit 1
  3360. fi
  3361. for file in $files; do
  3362. dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
  3363. test "X$dir" = "X$file" && dir=.
  3364. name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
  3365. rmfiles="$file"
  3366. case "$name" in
  3367. *.la)
  3368. # Possibly a libtool archive, so verify it.
  3369. if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
  3370. . $dir/$name
  3371. # Delete the libtool libraries and symlinks.
  3372. for n in $library_names; do
  3373. rmfiles="$rmfiles $dir/$n"
  3374. done
  3375. test -n "$old_library" && rmfiles="$rmfiles $dir/$old_library"
  3376. $show "$rm $rmfiles"
  3377. $run $rm $rmfiles
  3378. if test -n "$library_names"; then
  3379. # Do each command in the postuninstall commands.
  3380. eval cmds=\"$postuninstall_cmds\"
  3381. IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
  3382. for cmd in $cmds; do
  3383. IFS="$save_ifs"
  3384. $show "$cmd"
  3385. $run eval "$cmd"
  3386. done
  3387. IFS="$save_ifs"
  3388. fi
  3389. if test -n "$old_library"; then
  3390. # Do each command in the old_postuninstall commands.
  3391. eval cmds=\"$old_postuninstall_cmds\"
  3392. IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
  3393. for cmd in $cmds; do
  3394. IFS="$save_ifs"
  3395. $show "$cmd"
  3396. $run eval "$cmd"
  3397. done
  3398. IFS="$save_ifs"
  3399. fi
  3400. # FIXME: should reinstall the best remaining shared library.
  3401. fi
  3402. ;;
  3403. *.lo)
  3404. if test "$build_old_libs" = yes; then
  3405. oldobj=`$echo "X$name" | $Xsed -e "$lo2o"`
  3406. rmfiles="$rmfiles $dir/$oldobj"
  3407. fi
  3408. $show "$rm $rmfiles"
  3409. $run $rm $rmfiles
  3410. ;;
  3411. *)
  3412. $show "$rm $rmfiles"
  3413. $run $rm $rmfiles
  3414. ;;
  3415. esac
  3416. done
  3417. exit 0
  3418. ;;
  3419. "")
  3420. $echo "$modename: you must specify a MODE" 1>&2
  3421. $echo "$generic_help" 1>&2
  3422. exit 1
  3423. ;;
  3424. esac
  3425. $echo "$modename: invalid operation mode \`$mode'" 1>&2
  3426. $echo "$generic_help" 1>&2
  3427. exit 1
  3428. fi # test -z "$show_help"
  3429. # We need to display help for each of the modes.
  3430. case "$mode" in
  3431. "") $echo \
  3432. "Usage: $modename [OPTION]... [MODE-ARG]...
  3433. Provide generalized library-building support services.
  3434. --config show all configuration variables
  3435. --debug enable verbose shell tracing
  3436. -n, --dry-run display commands without modifying any files
  3437. --features display basic configuration information and exit
  3438. --finish same as \`--mode=finish'
  3439. --help display this help message and exit
  3440. --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS]
  3441. --quiet same as \`--silent'
  3442. --silent don't print informational messages
  3443. --version print version information
  3444. MODE must be one of the following:
  3445. compile compile a source file into a libtool object
  3446. execute automatically set library path, then run a program
  3447. finish complete the installation of libtool libraries
  3448. install install libraries or executables
  3449. link create a library or an executable
  3450. uninstall remove libraries from an installed directory
  3451. MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for
  3452. a more detailed description of MODE."
  3453. exit 0
  3454. ;;
  3455. compile)
  3456. $echo \
  3457. "Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
  3458. Compile a source file into a libtool library object.
  3459. This mode accepts the following additional options:
  3460. -o OUTPUT-FILE set the output file name to OUTPUT-FILE
  3461. -static always build a \`.o' file suitable for static linking
  3462. COMPILE-COMMAND is a command to be used in creating a \`standard' object file
  3463. from the given SOURCEFILE.
  3464. The output file name is determined by removing the directory component from
  3465. SOURCEFILE, then substituting the C source code suffix \`.c' with the
  3466. library object suffix, \`.lo'."
  3467. ;;
  3468. execute)
  3469. $echo \
  3470. "Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]...
  3471. Automatically set library path, then run a program.
  3472. This mode accepts the following additional options:
  3473. -dlopen FILE add the directory containing FILE to the library path
  3474. This mode sets the library path environment variable according to \`-dlopen'
  3475. flags.
  3476. If any of the ARGS are libtool executable wrappers, then they are translated
  3477. into their corresponding uninstalled binary, and any of their required library
  3478. directories are added to the library path.
  3479. Then, COMMAND is executed, with ARGS as arguments."
  3480. ;;
  3481. finish)
  3482. $echo \
  3483. "Usage: $modename [OPTION]... --mode=finish [LIBDIR]...
  3484. Complete the installation of libtool libraries.
  3485. Each LIBDIR is a directory that contains libtool libraries.
  3486. The commands that this mode executes may require superuser privileges. Use
  3487. the \`--dry-run' option if you just want to see what would be executed."
  3488. ;;
  3489. install)
  3490. $echo \
  3491. "Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND...
  3492. Install executables or libraries.
  3493. INSTALL-COMMAND is the installation command. The first component should be
  3494. either the \`install' or \`cp' program.
  3495. The rest of the components are interpreted as arguments to that command (only
  3496. BSD-compatible install options are recognized)."
  3497. ;;
  3498. link)
  3499. $echo \
  3500. "Usage: $modename [OPTION]... --mode=link LINK-COMMAND...
  3501. Link object files or libraries together to form another library, or to
  3502. create an executable program.
  3503. LINK-COMMAND is a command using the C compiler that you would use to create
  3504. a program from several object files.
  3505. The following components of LINK-COMMAND are treated specially:
  3506. -all-static do not do any dynamic linking at all
  3507. -avoid-version do not add a version suffix if possible
  3508. -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
  3509. -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
  3510. -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
  3511. -export-symbols SYMFILE
  3512. try to export only the symbols listed in SYMFILE
  3513. -export-symbols-regex REGEX
  3514. try to export only the symbols matching REGEX
  3515. -LLIBDIR search LIBDIR for required installed libraries
  3516. -lNAME OUTPUT-FILE requires the installed library libNAME
  3517. -module build a library that can dlopened
  3518. -no-undefined declare that a library does not refer to external symbols
  3519. -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
  3520. -release RELEASE specify package release information
  3521. -rpath LIBDIR the created library will eventually be installed in LIBDIR
  3522. -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
  3523. -static do not do any dynamic linking of libtool libraries
  3524. -version-info CURRENT[:REVISION[:AGE]]
  3525. specify library version info [each variable defaults to 0]
  3526. All other options (arguments beginning with \`-') are ignored.
  3527. Every other argument is treated as a filename. Files ending in \`.la' are
  3528. treated as uninstalled libtool libraries, other files are standard or library
  3529. object files.
  3530. If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
  3531. only library objects (\`.lo' files) may be specified, and \`-rpath' is
  3532. required, except when creating a convenience library.
  3533. If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
  3534. using \`ar' and \`ranlib', or on Windows using \`lib'.
  3535. If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
  3536. is created, otherwise an executable program is created."
  3537. ;;
  3538. uninstall)
  3539. $echo \
  3540. "Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
  3541. Remove libraries from an installation directory.
  3542. RM is the name of the program to use to delete files associated with each FILE
  3543. (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
  3544. to RM.
  3545. If FILE is a libtool library, all the files associated with it are deleted.
  3546. Otherwise, only FILE itself is deleted using RM."
  3547. ;;
  3548. *)
  3549. $echo "$modename: invalid operation mode \`$mode'" 1>&2
  3550. $echo "$help" 1>&2
  3551. exit 1
  3552. ;;
  3553. esac
  3554. echo
  3555. $echo "Try \`$modename --help' for more information about other modes."
  3556. exit 0
  3557. # Local Variables:
  3558. # mode:shell-script
  3559. # sh-indentation:2
  3560. # End: