libtoolize 127 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332
  1. #! /bin/sh
  2. ## DO NOT EDIT - This file generated from libtoolize
  3. ## by inline-source v2014-01-03.01
  4. # Prepare a package to use libtool.
  5. # Written by Gary V. Vaughan <gary@gnu.org>, 2003
  6. # Copyright (C) 2003-2015 Free Software Foundation, Inc.
  7. # This is free software; see the source for copying conditions. There is NO
  8. # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  9. # Libtoolize is free software; you can redistribute it and/or modify
  10. # it under the terms of the GNU General Public License as published by
  11. # the Free Software Foundation; either version 2 of the License, or
  12. # (at your option) any later version.
  13. #
  14. # Libtoolize is distributed in the hope that it will be useful, but
  15. # WITHOUT ANY WARRANTY; without even the implied warranty of
  16. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. # GNU General Public License for more details.
  18. #
  19. # You should have received a copy of the GNU General Public License
  20. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  21. ## ------ ##
  22. ## Usage. ##
  23. ## ------ ##
  24. # Run './libtoolize --help' for help with using this script from the
  25. # command line.
  26. ## ------------------------------- ##
  27. ## User overridable command paths. ##
  28. ## ------------------------------- ##
  29. # After configure completes, it has a better idea of some of the
  30. # shell tools we need than the defaults used by the functions shared
  31. # with bootstrap, so set those here where they can still be over-
  32. # ridden by the user, but otherwise take precedence.
  33. : ${AUTOCONF="autoconf"}
  34. : ${AUTOMAKE="automake"}
  35. : ${EGREP="egrep"}
  36. : ${FGREP="fgrep"}
  37. : ${GREP="grep"}
  38. : ${LN_S="ln -s"}
  39. : ${SED="sed"}
  40. ## -------------------------- ##
  41. ## Source external libraries. ##
  42. ## -------------------------- ##
  43. # Much of our low-level functionality needs to be sourced from external
  44. # libraries, which are installed to $pkgauxdir under normal use, though
  45. # we also need to be able to find them in $srcdir during testing, or if
  46. # executed directly from the build tree.
  47. # Set a version string for this script.
  48. scriptversion=2015-01-20.17; # UTC
  49. # General shell script boiler plate, and helper functions.
  50. # Written by Gary V. Vaughan, 2004
  51. # Copyright (C) 2004-2015 Free Software Foundation, Inc.
  52. # This is free software; see the source for copying conditions. There is NO
  53. # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  54. # This program is free software; you can redistribute it and/or modify
  55. # it under the terms of the GNU General Public License as published by
  56. # the Free Software Foundation; either version 3 of the License, or
  57. # (at your option) any later version.
  58. # As a special exception to the GNU General Public License, if you distribute
  59. # this file as part of a program or library that is built using GNU Libtool,
  60. # you may include this file under the same distribution terms that you use
  61. # for the rest of that program.
  62. # This program is distributed in the hope that it will be useful,
  63. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  64. # MERCHANTABILITY or FITNES FOR A PARTICULAR PURPOSE. See the GNU
  65. # General Public License for more details.
  66. # You should have received a copy of the GNU General Public License
  67. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  68. # Please report bugs or propose patches to gary@gnu.org.
  69. ## ------ ##
  70. ## Usage. ##
  71. ## ------ ##
  72. # Evaluate this file near the top of your script to gain access to
  73. # the functions and variables defined here:
  74. #
  75. # . `echo "$0" | ${SED-sed} 's|[^/]*$||'`/build-aux/funclib.sh
  76. #
  77. # If you need to override any of the default environment variable
  78. # settings, do that before evaluating this file.
  79. ## -------------------- ##
  80. ## Shell normalisation. ##
  81. ## -------------------- ##
  82. # Some shells need a little help to be as Bourne compatible as possible.
  83. # Before doing anything else, make sure all that help has been provided!
  84. DUALCASE=1; export DUALCASE # for MKS sh
  85. if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then :
  86. emulate sh
  87. NULLCMD=:
  88. # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
  89. # is contrary to our usage. Disable this feature.
  90. alias -g '${1+"$@"}'='"$@"'
  91. setopt NO_GLOB_SUBST
  92. else
  93. case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac
  94. fi
  95. # NLS nuisances: We save the old values in case they are required later.
  96. _G_user_locale=
  97. _G_safe_locale=
  98. for _G_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
  99. do
  100. eval "if test set = \"\${$_G_var+set}\"; then
  101. save_$_G_var=\$$_G_var
  102. $_G_var=C
  103. export $_G_var
  104. _G_user_locale=\"$_G_var=\\\$save_\$_G_var; \$_G_user_locale\"
  105. _G_safe_locale=\"$_G_var=C; \$_G_safe_locale\"
  106. fi"
  107. done
  108. # CDPATH.
  109. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
  110. # Make sure IFS has a sensible default
  111. sp=' '
  112. nl='
  113. '
  114. IFS="$sp $nl"
  115. # There are apparently some retarded systems that use ';' as a PATH separator!
  116. if test "${PATH_SEPARATOR+set}" != set; then
  117. PATH_SEPARATOR=:
  118. (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
  119. (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
  120. PATH_SEPARATOR=';'
  121. }
  122. fi
  123. ## ------------------------- ##
  124. ## Locate command utilities. ##
  125. ## ------------------------- ##
  126. # func_executable_p FILE
  127. # ----------------------
  128. # Check that FILE is an executable regular file.
  129. func_executable_p ()
  130. {
  131. test -f "$1" && test -x "$1"
  132. }
  133. # func_path_progs PROGS_LIST CHECK_FUNC [PATH]
  134. # --------------------------------------------
  135. # Search for either a program that responds to --version with output
  136. # containing "GNU", or else returned by CHECK_FUNC otherwise, by
  137. # trying all the directories in PATH with each of the elements of
  138. # PROGS_LIST.
  139. #
  140. # CHECK_FUNC should accept the path to a candidate program, and
  141. # set $func_check_prog_result if it truncates its output less than
  142. # $_G_path_prog_max characters.
  143. func_path_progs ()
  144. {
  145. _G_progs_list=$1
  146. _G_check_func=$2
  147. _G_PATH=${3-"$PATH"}
  148. _G_path_prog_max=0
  149. _G_path_prog_found=false
  150. _G_save_IFS=$IFS; IFS=${PATH_SEPARATOR-:}
  151. for _G_dir in $_G_PATH; do
  152. IFS=$_G_save_IFS
  153. test -z "$_G_dir" && _G_dir=.
  154. for _G_prog_name in $_G_progs_list; do
  155. for _exeext in '' .EXE; do
  156. _G_path_prog=$_G_dir/$_G_prog_name$_exeext
  157. func_executable_p "$_G_path_prog" || continue
  158. case `"$_G_path_prog" --version 2>&1` in
  159. *GNU*) func_path_progs_result=$_G_path_prog _G_path_prog_found=: ;;
  160. *) $_G_check_func $_G_path_prog
  161. func_path_progs_result=$func_check_prog_result
  162. ;;
  163. esac
  164. $_G_path_prog_found && break 3
  165. done
  166. done
  167. done
  168. IFS=$_G_save_IFS
  169. test -z "$func_path_progs_result" && {
  170. echo "no acceptable sed could be found in \$PATH" >&2
  171. exit 1
  172. }
  173. }
  174. # We want to be able to use the functions in this file before configure
  175. # has figured out where the best binaries are kept, which means we have
  176. # to search for them ourselves - except when the results are already set
  177. # where we skip the searches.
  178. # Unless the user overrides by setting SED, search the path for either GNU
  179. # sed, or the sed that truncates its output the least.
  180. test -z "$SED" && {
  181. _G_sed_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/
  182. for _G_i in 1 2 3 4 5 6 7; do
  183. _G_sed_script=$_G_sed_script$nl$_G_sed_script
  184. done
  185. echo "$_G_sed_script" 2>/dev/null | sed 99q >conftest.sed
  186. _G_sed_script=
  187. func_check_prog_sed ()
  188. {
  189. _G_path_prog=$1
  190. _G_count=0
  191. printf 0123456789 >conftest.in
  192. while :
  193. do
  194. cat conftest.in conftest.in >conftest.tmp
  195. mv conftest.tmp conftest.in
  196. cp conftest.in conftest.nl
  197. echo '' >> conftest.nl
  198. "$_G_path_prog" -f conftest.sed <conftest.nl >conftest.out 2>/dev/null || break
  199. diff conftest.out conftest.nl >/dev/null 2>&1 || break
  200. _G_count=`expr $_G_count + 1`
  201. if test "$_G_count" -gt "$_G_path_prog_max"; then
  202. # Best one so far, save it but keep looking for a better one
  203. func_check_prog_result=$_G_path_prog
  204. _G_path_prog_max=$_G_count
  205. fi
  206. # 10*(2^10) chars as input seems more than enough
  207. test 10 -lt "$_G_count" && break
  208. done
  209. rm -f conftest.in conftest.tmp conftest.nl conftest.out
  210. }
  211. func_path_progs "sed gsed" func_check_prog_sed $PATH:/usr/xpg4/bin
  212. rm -f conftest.sed
  213. SED=$func_path_progs_result
  214. }
  215. # Unless the user overrides by setting GREP, search the path for either GNU
  216. # grep, or the grep that truncates its output the least.
  217. test -z "$GREP" && {
  218. func_check_prog_grep ()
  219. {
  220. _G_path_prog=$1
  221. _G_count=0
  222. _G_path_prog_max=0
  223. printf 0123456789 >conftest.in
  224. while :
  225. do
  226. cat conftest.in conftest.in >conftest.tmp
  227. mv conftest.tmp conftest.in
  228. cp conftest.in conftest.nl
  229. echo 'GREP' >> conftest.nl
  230. "$_G_path_prog" -e 'GREP$' -e '-(cannot match)-' <conftest.nl >conftest.out 2>/dev/null || break
  231. diff conftest.out conftest.nl >/dev/null 2>&1 || break
  232. _G_count=`expr $_G_count + 1`
  233. if test "$_G_count" -gt "$_G_path_prog_max"; then
  234. # Best one so far, save it but keep looking for a better one
  235. func_check_prog_result=$_G_path_prog
  236. _G_path_prog_max=$_G_count
  237. fi
  238. # 10*(2^10) chars as input seems more than enough
  239. test 10 -lt "$_G_count" && break
  240. done
  241. rm -f conftest.in conftest.tmp conftest.nl conftest.out
  242. }
  243. func_path_progs "grep ggrep" func_check_prog_grep $PATH:/usr/xpg4/bin
  244. GREP=$func_path_progs_result
  245. }
  246. ## ------------------------------- ##
  247. ## User overridable command paths. ##
  248. ## ------------------------------- ##
  249. # All uppercase variable names are used for environment variables. These
  250. # variables can be overridden by the user before calling a script that
  251. # uses them if a suitable command of that name is not already available
  252. # in the command search PATH.
  253. : ${CP="cp -f"}
  254. : ${ECHO="printf %s\n"}
  255. : ${EGREP="$GREP -E"}
  256. : ${FGREP="$GREP -F"}
  257. : ${LN_S="ln -s"}
  258. : ${MAKE="make"}
  259. : ${MKDIR="mkdir"}
  260. : ${MV="mv -f"}
  261. : ${RM="rm -f"}
  262. : ${SHELL="${CONFIG_SHELL-/bin/sh}"}
  263. ## -------------------- ##
  264. ## Useful sed snippets. ##
  265. ## -------------------- ##
  266. sed_dirname='s|/[^/]*$||'
  267. sed_basename='s|^.*/||'
  268. # Sed substitution that helps us do robust quoting. It backslashifies
  269. # metacharacters that are still active within double-quoted strings.
  270. sed_quote_subst='s|\([`"$\\]\)|\\\1|g'
  271. # Same as above, but do not quote variable references.
  272. sed_double_quote_subst='s/\(["`\\]\)/\\\1/g'
  273. # Sed substitution that turns a string into a regex matching for the
  274. # string literally.
  275. sed_make_literal_regex='s|[].[^$\\*\/]|\\&|g'
  276. # Sed substitution that converts a w32 file name or path
  277. # that contains forward slashes, into one that contains
  278. # (escaped) backslashes. A very naive implementation.
  279. sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
  280. # Re-'\' parameter expansions in output of sed_double_quote_subst that
  281. # were '\'-ed in input to the same. If an odd number of '\' preceded a
  282. # '$' in input to sed_double_quote_subst, that '$' was protected from
  283. # expansion. Since each input '\' is now two '\'s, look for any number
  284. # of runs of four '\'s followed by two '\'s and then a '$'. '\' that '$'.
  285. _G_bs='\\'
  286. _G_bs2='\\\\'
  287. _G_bs4='\\\\\\\\'
  288. _G_dollar='\$'
  289. sed_double_backslash="\
  290. s/$_G_bs4/&\\
  291. /g
  292. s/^$_G_bs2$_G_dollar/$_G_bs&/
  293. s/\\([^$_G_bs]\\)$_G_bs2$_G_dollar/\\1$_G_bs2$_G_bs$_G_dollar/g
  294. s/\n//g"
  295. ## ----------------- ##
  296. ## Global variables. ##
  297. ## ----------------- ##
  298. # Except for the global variables explicitly listed below, the following
  299. # functions in the '^func_' namespace, and the '^require_' namespace
  300. # variables initialised in the 'Resource management' section, sourcing
  301. # this file will not pollute your global namespace with anything
  302. # else. There's no portable way to scope variables in Bourne shell
  303. # though, so actually running these functions will sometimes place
  304. # results into a variable named after the function, and often use
  305. # temporary variables in the '^_G_' namespace. If you are careful to
  306. # avoid using those namespaces casually in your sourcing script, things
  307. # should continue to work as you expect. And, of course, you can freely
  308. # overwrite any of the functions or variables defined here before
  309. # calling anything to customize them.
  310. EXIT_SUCCESS=0
  311. EXIT_FAILURE=1
  312. EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing.
  313. EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake.
  314. # Allow overriding, eg assuming that you follow the convention of
  315. # putting '$debug_cmd' at the start of all your functions, you can get
  316. # bash to show function call trace with:
  317. #
  318. # debug_cmd='eval echo "${FUNCNAME[0]} $*" >&2' bash your-script-name
  319. debug_cmd=${debug_cmd-":"}
  320. exit_cmd=:
  321. # By convention, finish your script with:
  322. #
  323. # exit $exit_status
  324. #
  325. # so that you can set exit_status to non-zero if you want to indicate
  326. # something went wrong during execution without actually bailing out at
  327. # the point of failure.
  328. exit_status=$EXIT_SUCCESS
  329. # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
  330. # is ksh but when the shell is invoked as "sh" and the current value of
  331. # the _XPG environment variable is not equal to 1 (one), the special
  332. # positional parameter $0, within a function call, is the name of the
  333. # function.
  334. progpath=$0
  335. # The name of this program.
  336. progname=`$ECHO "$progpath" |$SED "$sed_basename"`
  337. # Make sure we have an absolute progpath for reexecution:
  338. case $progpath in
  339. [\\/]*|[A-Za-z]:\\*) ;;
  340. *[\\/]*)
  341. progdir=`$ECHO "$progpath" |$SED "$sed_dirname"`
  342. progdir=`cd "$progdir" && pwd`
  343. progpath=$progdir/$progname
  344. ;;
  345. *)
  346. _G_IFS=$IFS
  347. IFS=${PATH_SEPARATOR-:}
  348. for progdir in $PATH; do
  349. IFS=$_G_IFS
  350. test -x "$progdir/$progname" && break
  351. done
  352. IFS=$_G_IFS
  353. test -n "$progdir" || progdir=`pwd`
  354. progpath=$progdir/$progname
  355. ;;
  356. esac
  357. ## ----------------- ##
  358. ## Standard options. ##
  359. ## ----------------- ##
  360. # The following options affect the operation of the functions defined
  361. # below, and should be set appropriately depending on run-time para-
  362. # meters passed on the command line.
  363. opt_dry_run=false
  364. opt_quiet=false
  365. opt_verbose=false
  366. # Categories 'all' and 'none' are always available. Append any others
  367. # you will pass as the first argument to func_warning from your own
  368. # code.
  369. warning_categories=
  370. # By default, display warnings according to 'opt_warning_types'. Set
  371. # 'warning_func' to ':' to elide all warnings, or func_fatal_error to
  372. # treat the next displayed warning as a fatal error.
  373. warning_func=func_warn_and_continue
  374. # Set to 'all' to display all warnings, 'none' to suppress all
  375. # warnings, or a space delimited list of some subset of
  376. # 'warning_categories' to display only the listed warnings.
  377. opt_warning_types=all
  378. ## -------------------- ##
  379. ## Resource management. ##
  380. ## -------------------- ##
  381. # This section contains definitions for functions that each ensure a
  382. # particular resource (a file, or a non-empty configuration variable for
  383. # example) is available, and if appropriate to extract default values
  384. # from pertinent package files. Call them using their associated
  385. # 'require_*' variable to ensure that they are executed, at most, once.
  386. #
  387. # It's entirely deliberate that calling these functions can set
  388. # variables that don't obey the namespace limitations obeyed by the rest
  389. # of this file, in order that that they be as useful as possible to
  390. # callers.
  391. # require_term_colors
  392. # -------------------
  393. # Allow display of bold text on terminals that support it.
  394. require_term_colors=func_require_term_colors
  395. func_require_term_colors ()
  396. {
  397. $debug_cmd
  398. test -t 1 && {
  399. # COLORTERM and USE_ANSI_COLORS environment variables take
  400. # precedence, because most terminfo databases neglect to describe
  401. # whether color sequences are supported.
  402. test -n "${COLORTERM+set}" && : ${USE_ANSI_COLORS="1"}
  403. if test 1 = "$USE_ANSI_COLORS"; then
  404. # Standard ANSI escape sequences
  405. tc_reset=''
  406. tc_bold=''; tc_standout=''
  407. tc_red=''; tc_green=''
  408. tc_blue=''; tc_cyan=''
  409. else
  410. # Otherwise trust the terminfo database after all.
  411. test -n "`tput sgr0 2>/dev/null`" && {
  412. tc_reset=`tput sgr0`
  413. test -n "`tput bold 2>/dev/null`" && tc_bold=`tput bold`
  414. tc_standout=$tc_bold
  415. test -n "`tput smso 2>/dev/null`" && tc_standout=`tput smso`
  416. test -n "`tput setaf 1 2>/dev/null`" && tc_red=`tput setaf 1`
  417. test -n "`tput setaf 2 2>/dev/null`" && tc_green=`tput setaf 2`
  418. test -n "`tput setaf 4 2>/dev/null`" && tc_blue=`tput setaf 4`
  419. test -n "`tput setaf 5 2>/dev/null`" && tc_cyan=`tput setaf 5`
  420. }
  421. fi
  422. }
  423. require_term_colors=:
  424. }
  425. ## ----------------- ##
  426. ## Function library. ##
  427. ## ----------------- ##
  428. # This section contains a variety of useful functions to call in your
  429. # scripts. Take note of the portable wrappers for features provided by
  430. # some modern shells, which will fall back to slower equivalents on
  431. # less featureful shells.
  432. # func_append VAR VALUE
  433. # ---------------------
  434. # Append VALUE onto the existing contents of VAR.
  435. # We should try to minimise forks, especially on Windows where they are
  436. # unreasonably slow, so skip the feature probes when bash or zsh are
  437. # being used:
  438. if test set = "${BASH_VERSION+set}${ZSH_VERSION+set}"; then
  439. : ${_G_HAVE_ARITH_OP="yes"}
  440. : ${_G_HAVE_XSI_OPS="yes"}
  441. # The += operator was introduced in bash 3.1
  442. case $BASH_VERSION in
  443. [12].* | 3.0 | 3.0*) ;;
  444. *)
  445. : ${_G_HAVE_PLUSEQ_OP="yes"}
  446. ;;
  447. esac
  448. fi
  449. # _G_HAVE_PLUSEQ_OP
  450. # Can be empty, in which case the shell is probed, "yes" if += is
  451. # useable or anything else if it does not work.
  452. test -z "$_G_HAVE_PLUSEQ_OP" \
  453. && (eval 'x=a; x+=" b"; test "a b" = "$x"') 2>/dev/null \
  454. && _G_HAVE_PLUSEQ_OP=yes
  455. if test yes = "$_G_HAVE_PLUSEQ_OP"
  456. then
  457. # This is an XSI compatible shell, allowing a faster implementation...
  458. eval 'func_append ()
  459. {
  460. $debug_cmd
  461. eval "$1+=\$2"
  462. }'
  463. else
  464. # ...otherwise fall back to using expr, which is often a shell builtin.
  465. func_append ()
  466. {
  467. $debug_cmd
  468. eval "$1=\$$1\$2"
  469. }
  470. fi
  471. # func_append_quoted VAR VALUE
  472. # ----------------------------
  473. # Quote VALUE and append to the end of shell variable VAR, separated
  474. # by a space.
  475. if test yes = "$_G_HAVE_PLUSEQ_OP"; then
  476. eval 'func_append_quoted ()
  477. {
  478. $debug_cmd
  479. func_quote_for_eval "$2"
  480. eval "$1+=\\ \$func_quote_for_eval_result"
  481. }'
  482. else
  483. func_append_quoted ()
  484. {
  485. $debug_cmd
  486. func_quote_for_eval "$2"
  487. eval "$1=\$$1\\ \$func_quote_for_eval_result"
  488. }
  489. fi
  490. # func_append_uniq VAR VALUE
  491. # --------------------------
  492. # Append unique VALUE onto the existing contents of VAR, assuming
  493. # entries are delimited by the first character of VALUE. For example:
  494. #
  495. # func_append_uniq options " --another-option option-argument"
  496. #
  497. # will only append to $options if " --another-option option-argument "
  498. # is not already present somewhere in $options already (note spaces at
  499. # each end implied by leading space in second argument).
  500. func_append_uniq ()
  501. {
  502. $debug_cmd
  503. eval _G_current_value='`$ECHO $'$1'`'
  504. _G_delim=`expr "$2" : '\(.\)'`
  505. case $_G_delim$_G_current_value$_G_delim in
  506. *"$2$_G_delim"*) ;;
  507. *) func_append "$@" ;;
  508. esac
  509. }
  510. # func_arith TERM...
  511. # ------------------
  512. # Set func_arith_result to the result of evaluating TERMs.
  513. test -z "$_G_HAVE_ARITH_OP" \
  514. && (eval 'test 2 = $(( 1 + 1 ))') 2>/dev/null \
  515. && _G_HAVE_ARITH_OP=yes
  516. if test yes = "$_G_HAVE_ARITH_OP"; then
  517. eval 'func_arith ()
  518. {
  519. $debug_cmd
  520. func_arith_result=$(( $* ))
  521. }'
  522. else
  523. func_arith ()
  524. {
  525. $debug_cmd
  526. func_arith_result=`expr "$@"`
  527. }
  528. fi
  529. # func_basename FILE
  530. # ------------------
  531. # Set func_basename_result to FILE with everything up to and including
  532. # the last / stripped.
  533. if test yes = "$_G_HAVE_XSI_OPS"; then
  534. # If this shell supports suffix pattern removal, then use it to avoid
  535. # forking. Hide the definitions single quotes in case the shell chokes
  536. # on unsupported syntax...
  537. _b='func_basename_result=${1##*/}'
  538. _d='case $1 in
  539. */*) func_dirname_result=${1%/*}$2 ;;
  540. * ) func_dirname_result=$3 ;;
  541. esac'
  542. else
  543. # ...otherwise fall back to using sed.
  544. _b='func_basename_result=`$ECHO "$1" |$SED "$sed_basename"`'
  545. _d='func_dirname_result=`$ECHO "$1" |$SED "$sed_dirname"`
  546. if test "X$func_dirname_result" = "X$1"; then
  547. func_dirname_result=$3
  548. else
  549. func_append func_dirname_result "$2"
  550. fi'
  551. fi
  552. eval 'func_basename ()
  553. {
  554. $debug_cmd
  555. '"$_b"'
  556. }'
  557. # func_dirname FILE APPEND NONDIR_REPLACEMENT
  558. # -------------------------------------------
  559. # Compute the dirname of FILE. If nonempty, add APPEND to the result,
  560. # otherwise set result to NONDIR_REPLACEMENT.
  561. eval 'func_dirname ()
  562. {
  563. $debug_cmd
  564. '"$_d"'
  565. }'
  566. # func_dirname_and_basename FILE APPEND NONDIR_REPLACEMENT
  567. # --------------------------------------------------------
  568. # Perform func_basename and func_dirname in a single function
  569. # call:
  570. # dirname: Compute the dirname of FILE. If nonempty,
  571. # add APPEND to the result, otherwise set result
  572. # to NONDIR_REPLACEMENT.
  573. # value returned in "$func_dirname_result"
  574. # basename: Compute filename of FILE.
  575. # value retuned in "$func_basename_result"
  576. # For efficiency, we do not delegate to the functions above but instead
  577. # duplicate the functionality here.
  578. eval 'func_dirname_and_basename ()
  579. {
  580. $debug_cmd
  581. '"$_b"'
  582. '"$_d"'
  583. }'
  584. # func_echo ARG...
  585. # ----------------
  586. # Echo program name prefixed message.
  587. func_echo ()
  588. {
  589. $debug_cmd
  590. _G_message=$*
  591. func_echo_IFS=$IFS
  592. IFS=$nl
  593. for _G_line in $_G_message; do
  594. IFS=$func_echo_IFS
  595. $ECHO "$progname: $_G_line"
  596. done
  597. IFS=$func_echo_IFS
  598. }
  599. # func_echo_all ARG...
  600. # --------------------
  601. # Invoke $ECHO with all args, space-separated.
  602. func_echo_all ()
  603. {
  604. $ECHO "$*"
  605. }
  606. # func_echo_infix_1 INFIX ARG...
  607. # ------------------------------
  608. # Echo program name, followed by INFIX on the first line, with any
  609. # additional lines not showing INFIX.
  610. func_echo_infix_1 ()
  611. {
  612. $debug_cmd
  613. $require_term_colors
  614. _G_infix=$1; shift
  615. _G_indent=$_G_infix
  616. _G_prefix="$progname: $_G_infix: "
  617. _G_message=$*
  618. # Strip color escape sequences before counting printable length
  619. for _G_tc in "$tc_reset" "$tc_bold" "$tc_standout" "$tc_red" "$tc_green" "$tc_blue" "$tc_cyan"
  620. do
  621. test -n "$_G_tc" && {
  622. _G_esc_tc=`$ECHO "$_G_tc" | $SED "$sed_make_literal_regex"`
  623. _G_indent=`$ECHO "$_G_indent" | $SED "s|$_G_esc_tc||g"`
  624. }
  625. done
  626. _G_indent="$progname: "`echo "$_G_indent" | $SED 's|.| |g'`" " ## exclude from sc_prohibit_nested_quotes
  627. func_echo_infix_1_IFS=$IFS
  628. IFS=$nl
  629. for _G_line in $_G_message; do
  630. IFS=$func_echo_infix_1_IFS
  631. $ECHO "$_G_prefix$tc_bold$_G_line$tc_reset" >&2
  632. _G_prefix=$_G_indent
  633. done
  634. IFS=$func_echo_infix_1_IFS
  635. }
  636. # func_error ARG...
  637. # -----------------
  638. # Echo program name prefixed message to standard error.
  639. func_error ()
  640. {
  641. $debug_cmd
  642. $require_term_colors
  643. func_echo_infix_1 " $tc_standout${tc_red}error$tc_reset" "$*" >&2
  644. }
  645. # func_fatal_error ARG...
  646. # -----------------------
  647. # Echo program name prefixed message to standard error, and exit.
  648. func_fatal_error ()
  649. {
  650. $debug_cmd
  651. func_error "$*"
  652. exit $EXIT_FAILURE
  653. }
  654. # func_grep EXPRESSION FILENAME
  655. # -----------------------------
  656. # Check whether EXPRESSION matches any line of FILENAME, without output.
  657. func_grep ()
  658. {
  659. $debug_cmd
  660. $GREP "$1" "$2" >/dev/null 2>&1
  661. }
  662. # func_len STRING
  663. # ---------------
  664. # Set func_len_result to the length of STRING. STRING may not
  665. # start with a hyphen.
  666. test -z "$_G_HAVE_XSI_OPS" \
  667. && (eval 'x=a/b/c;
  668. test 5aa/bb/cc = "${#x}${x%%/*}${x%/*}${x#*/}${x##*/}"') 2>/dev/null \
  669. && _G_HAVE_XSI_OPS=yes
  670. if test yes = "$_G_HAVE_XSI_OPS"; then
  671. eval 'func_len ()
  672. {
  673. $debug_cmd
  674. func_len_result=${#1}
  675. }'
  676. else
  677. func_len ()
  678. {
  679. $debug_cmd
  680. func_len_result=`expr "$1" : ".*" 2>/dev/null || echo $max_cmd_len`
  681. }
  682. fi
  683. # func_mkdir_p DIRECTORY-PATH
  684. # ---------------------------
  685. # Make sure the entire path to DIRECTORY-PATH is available.
  686. func_mkdir_p ()
  687. {
  688. $debug_cmd
  689. _G_directory_path=$1
  690. _G_dir_list=
  691. if test -n "$_G_directory_path" && test : != "$opt_dry_run"; then
  692. # Protect directory names starting with '-'
  693. case $_G_directory_path in
  694. -*) _G_directory_path=./$_G_directory_path ;;
  695. esac
  696. # While some portion of DIR does not yet exist...
  697. while test ! -d "$_G_directory_path"; do
  698. # ...make a list in topmost first order. Use a colon delimited
  699. # list incase some portion of path contains whitespace.
  700. _G_dir_list=$_G_directory_path:$_G_dir_list
  701. # If the last portion added has no slash in it, the list is done
  702. case $_G_directory_path in */*) ;; *) break ;; esac
  703. # ...otherwise throw away the child directory and loop
  704. _G_directory_path=`$ECHO "$_G_directory_path" | $SED -e "$sed_dirname"`
  705. done
  706. _G_dir_list=`$ECHO "$_G_dir_list" | $SED 's|:*$||'`
  707. func_mkdir_p_IFS=$IFS; IFS=:
  708. for _G_dir in $_G_dir_list; do
  709. IFS=$func_mkdir_p_IFS
  710. # mkdir can fail with a 'File exist' error if two processes
  711. # try to create one of the directories concurrently. Don't
  712. # stop in that case!
  713. $MKDIR "$_G_dir" 2>/dev/null || :
  714. done
  715. IFS=$func_mkdir_p_IFS
  716. # Bail out if we (or some other process) failed to create a directory.
  717. test -d "$_G_directory_path" || \
  718. func_fatal_error "Failed to create '$1'"
  719. fi
  720. }
  721. # func_mktempdir [BASENAME]
  722. # -------------------------
  723. # Make a temporary directory that won't clash with other running
  724. # libtool processes, and avoids race conditions if possible. If
  725. # given, BASENAME is the basename for that directory.
  726. func_mktempdir ()
  727. {
  728. $debug_cmd
  729. _G_template=${TMPDIR-/tmp}/${1-$progname}
  730. if test : = "$opt_dry_run"; then
  731. # Return a directory name, but don't create it in dry-run mode
  732. _G_tmpdir=$_G_template-$$
  733. else
  734. # If mktemp works, use that first and foremost
  735. _G_tmpdir=`mktemp -d "$_G_template-XXXXXXXX" 2>/dev/null`
  736. if test ! -d "$_G_tmpdir"; then
  737. # Failing that, at least try and use $RANDOM to avoid a race
  738. _G_tmpdir=$_G_template-${RANDOM-0}$$
  739. func_mktempdir_umask=`umask`
  740. umask 0077
  741. $MKDIR "$_G_tmpdir"
  742. umask $func_mktempdir_umask
  743. fi
  744. # If we're not in dry-run mode, bomb out on failure
  745. test -d "$_G_tmpdir" || \
  746. func_fatal_error "cannot create temporary directory '$_G_tmpdir'"
  747. fi
  748. $ECHO "$_G_tmpdir"
  749. }
  750. # func_normal_abspath PATH
  751. # ------------------------
  752. # Remove doubled-up and trailing slashes, "." path components,
  753. # and cancel out any ".." path components in PATH after making
  754. # it an absolute path.
  755. func_normal_abspath ()
  756. {
  757. $debug_cmd
  758. # These SED scripts presuppose an absolute path with a trailing slash.
  759. _G_pathcar='s|^/\([^/]*\).*$|\1|'
  760. _G_pathcdr='s|^/[^/]*||'
  761. _G_removedotparts=':dotsl
  762. s|/\./|/|g
  763. t dotsl
  764. s|/\.$|/|'
  765. _G_collapseslashes='s|/\{1,\}|/|g'
  766. _G_finalslash='s|/*$|/|'
  767. # Start from root dir and reassemble the path.
  768. func_normal_abspath_result=
  769. func_normal_abspath_tpath=$1
  770. func_normal_abspath_altnamespace=
  771. case $func_normal_abspath_tpath in
  772. "")
  773. # Empty path, that just means $cwd.
  774. func_stripname '' '/' "`pwd`"
  775. func_normal_abspath_result=$func_stripname_result
  776. return
  777. ;;
  778. # The next three entries are used to spot a run of precisely
  779. # two leading slashes without using negated character classes;
  780. # we take advantage of case's first-match behaviour.
  781. ///*)
  782. # Unusual form of absolute path, do nothing.
  783. ;;
  784. //*)
  785. # Not necessarily an ordinary path; POSIX reserves leading '//'
  786. # and for example Cygwin uses it to access remote file shares
  787. # over CIFS/SMB, so we conserve a leading double slash if found.
  788. func_normal_abspath_altnamespace=/
  789. ;;
  790. /*)
  791. # Absolute path, do nothing.
  792. ;;
  793. *)
  794. # Relative path, prepend $cwd.
  795. func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath
  796. ;;
  797. esac
  798. # Cancel out all the simple stuff to save iterations. We also want
  799. # the path to end with a slash for ease of parsing, so make sure
  800. # there is one (and only one) here.
  801. func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
  802. -e "$_G_removedotparts" -e "$_G_collapseslashes" -e "$_G_finalslash"`
  803. while :; do
  804. # Processed it all yet?
  805. if test / = "$func_normal_abspath_tpath"; then
  806. # If we ascended to the root using ".." the result may be empty now.
  807. if test -z "$func_normal_abspath_result"; then
  808. func_normal_abspath_result=/
  809. fi
  810. break
  811. fi
  812. func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \
  813. -e "$_G_pathcar"`
  814. func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
  815. -e "$_G_pathcdr"`
  816. # Figure out what to do with it
  817. case $func_normal_abspath_tcomponent in
  818. "")
  819. # Trailing empty path component, ignore it.
  820. ;;
  821. ..)
  822. # Parent dir; strip last assembled component from result.
  823. func_dirname "$func_normal_abspath_result"
  824. func_normal_abspath_result=$func_dirname_result
  825. ;;
  826. *)
  827. # Actual path component, append it.
  828. func_append func_normal_abspath_result "/$func_normal_abspath_tcomponent"
  829. ;;
  830. esac
  831. done
  832. # Restore leading double-slash if one was found on entry.
  833. func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result
  834. }
  835. # func_notquiet ARG...
  836. # --------------------
  837. # Echo program name prefixed message only when not in quiet mode.
  838. func_notquiet ()
  839. {
  840. $debug_cmd
  841. $opt_quiet || func_echo ${1+"$@"}
  842. # A bug in bash halts the script if the last line of a function
  843. # fails when set -e is in force, so we need another command to
  844. # work around that:
  845. :
  846. }
  847. # func_relative_path SRCDIR DSTDIR
  848. # --------------------------------
  849. # Set func_relative_path_result to the relative path from SRCDIR to DSTDIR.
  850. func_relative_path ()
  851. {
  852. $debug_cmd
  853. func_relative_path_result=
  854. func_normal_abspath "$1"
  855. func_relative_path_tlibdir=$func_normal_abspath_result
  856. func_normal_abspath "$2"
  857. func_relative_path_tbindir=$func_normal_abspath_result
  858. # Ascend the tree starting from libdir
  859. while :; do
  860. # check if we have found a prefix of bindir
  861. case $func_relative_path_tbindir in
  862. $func_relative_path_tlibdir)
  863. # found an exact match
  864. func_relative_path_tcancelled=
  865. break
  866. ;;
  867. $func_relative_path_tlibdir*)
  868. # found a matching prefix
  869. func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir"
  870. func_relative_path_tcancelled=$func_stripname_result
  871. if test -z "$func_relative_path_result"; then
  872. func_relative_path_result=.
  873. fi
  874. break
  875. ;;
  876. *)
  877. func_dirname $func_relative_path_tlibdir
  878. func_relative_path_tlibdir=$func_dirname_result
  879. if test -z "$func_relative_path_tlibdir"; then
  880. # Have to descend all the way to the root!
  881. func_relative_path_result=../$func_relative_path_result
  882. func_relative_path_tcancelled=$func_relative_path_tbindir
  883. break
  884. fi
  885. func_relative_path_result=../$func_relative_path_result
  886. ;;
  887. esac
  888. done
  889. # Now calculate path; take care to avoid doubling-up slashes.
  890. func_stripname '' '/' "$func_relative_path_result"
  891. func_relative_path_result=$func_stripname_result
  892. func_stripname '/' '/' "$func_relative_path_tcancelled"
  893. if test -n "$func_stripname_result"; then
  894. func_append func_relative_path_result "/$func_stripname_result"
  895. fi
  896. # Normalisation. If bindir is libdir, return '.' else relative path.
  897. if test -n "$func_relative_path_result"; then
  898. func_stripname './' '' "$func_relative_path_result"
  899. func_relative_path_result=$func_stripname_result
  900. fi
  901. test -n "$func_relative_path_result" || func_relative_path_result=.
  902. :
  903. }
  904. # func_quote_for_eval ARG...
  905. # --------------------------
  906. # Aesthetically quote ARGs to be evaled later.
  907. # This function returns two values:
  908. # i) func_quote_for_eval_result
  909. # double-quoted, suitable for a subsequent eval
  910. # ii) func_quote_for_eval_unquoted_result
  911. # has all characters that are still active within double
  912. # quotes backslashified.
  913. func_quote_for_eval ()
  914. {
  915. $debug_cmd
  916. func_quote_for_eval_unquoted_result=
  917. func_quote_for_eval_result=
  918. while test 0 -lt $#; do
  919. case $1 in
  920. *[\\\`\"\$]*)
  921. _G_unquoted_arg=`printf '%s\n' "$1" |$SED "$sed_quote_subst"` ;;
  922. *)
  923. _G_unquoted_arg=$1 ;;
  924. esac
  925. if test -n "$func_quote_for_eval_unquoted_result"; then
  926. func_append func_quote_for_eval_unquoted_result " $_G_unquoted_arg"
  927. else
  928. func_append func_quote_for_eval_unquoted_result "$_G_unquoted_arg"
  929. fi
  930. case $_G_unquoted_arg in
  931. # Double-quote args containing shell metacharacters to delay
  932. # word splitting, command substitution and variable expansion
  933. # for a subsequent eval.
  934. # Many Bourne shells cannot handle close brackets correctly
  935. # in scan sets, so we specify it separately.
  936. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
  937. _G_quoted_arg=\"$_G_unquoted_arg\"
  938. ;;
  939. *)
  940. _G_quoted_arg=$_G_unquoted_arg
  941. ;;
  942. esac
  943. if test -n "$func_quote_for_eval_result"; then
  944. func_append func_quote_for_eval_result " $_G_quoted_arg"
  945. else
  946. func_append func_quote_for_eval_result "$_G_quoted_arg"
  947. fi
  948. shift
  949. done
  950. }
  951. # func_quote_for_expand ARG
  952. # -------------------------
  953. # Aesthetically quote ARG to be evaled later; same as above,
  954. # but do not quote variable references.
  955. func_quote_for_expand ()
  956. {
  957. $debug_cmd
  958. case $1 in
  959. *[\\\`\"]*)
  960. _G_arg=`$ECHO "$1" | $SED \
  961. -e "$sed_double_quote_subst" -e "$sed_double_backslash"` ;;
  962. *)
  963. _G_arg=$1 ;;
  964. esac
  965. case $_G_arg in
  966. # Double-quote args containing shell metacharacters to delay
  967. # word splitting and command substitution for a subsequent eval.
  968. # Many Bourne shells cannot handle close brackets correctly
  969. # in scan sets, so we specify it separately.
  970. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
  971. _G_arg=\"$_G_arg\"
  972. ;;
  973. esac
  974. func_quote_for_expand_result=$_G_arg
  975. }
  976. # func_stripname PREFIX SUFFIX NAME
  977. # ---------------------------------
  978. # strip PREFIX and SUFFIX from NAME, and store in func_stripname_result.
  979. # PREFIX and SUFFIX must not contain globbing or regex special
  980. # characters, hashes, percent signs, but SUFFIX may contain a leading
  981. # dot (in which case that matches only a dot).
  982. if test yes = "$_G_HAVE_XSI_OPS"; then
  983. eval 'func_stripname ()
  984. {
  985. $debug_cmd
  986. # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are
  987. # positional parameters, so assign one to ordinary variable first.
  988. func_stripname_result=$3
  989. func_stripname_result=${func_stripname_result#"$1"}
  990. func_stripname_result=${func_stripname_result%"$2"}
  991. }'
  992. else
  993. func_stripname ()
  994. {
  995. $debug_cmd
  996. case $2 in
  997. .*) func_stripname_result=`$ECHO "$3" | $SED -e "s%^$1%%" -e "s%\\\\$2\$%%"`;;
  998. *) func_stripname_result=`$ECHO "$3" | $SED -e "s%^$1%%" -e "s%$2\$%%"`;;
  999. esac
  1000. }
  1001. fi
  1002. # func_show_eval CMD [FAIL_EXP]
  1003. # -----------------------------
  1004. # Unless opt_quiet is true, then output CMD. Then, if opt_dryrun is
  1005. # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
  1006. # is given, then evaluate it.
  1007. func_show_eval ()
  1008. {
  1009. $debug_cmd
  1010. _G_cmd=$1
  1011. _G_fail_exp=${2-':'}
  1012. func_quote_for_expand "$_G_cmd"
  1013. eval "func_notquiet $func_quote_for_expand_result"
  1014. $opt_dry_run || {
  1015. eval "$_G_cmd"
  1016. _G_status=$?
  1017. if test 0 -ne "$_G_status"; then
  1018. eval "(exit $_G_status); $_G_fail_exp"
  1019. fi
  1020. }
  1021. }
  1022. # func_show_eval_locale CMD [FAIL_EXP]
  1023. # ------------------------------------
  1024. # Unless opt_quiet is true, then output CMD. Then, if opt_dryrun is
  1025. # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
  1026. # is given, then evaluate it. Use the saved locale for evaluation.
  1027. func_show_eval_locale ()
  1028. {
  1029. $debug_cmd
  1030. _G_cmd=$1
  1031. _G_fail_exp=${2-':'}
  1032. $opt_quiet || {
  1033. func_quote_for_expand "$_G_cmd"
  1034. eval "func_echo $func_quote_for_expand_result"
  1035. }
  1036. $opt_dry_run || {
  1037. eval "$_G_user_locale
  1038. $_G_cmd"
  1039. _G_status=$?
  1040. eval "$_G_safe_locale"
  1041. if test 0 -ne "$_G_status"; then
  1042. eval "(exit $_G_status); $_G_fail_exp"
  1043. fi
  1044. }
  1045. }
  1046. # func_tr_sh
  1047. # ----------
  1048. # Turn $1 into a string suitable for a shell variable name.
  1049. # Result is stored in $func_tr_sh_result. All characters
  1050. # not in the set a-zA-Z0-9_ are replaced with '_'. Further,
  1051. # if $1 begins with a digit, a '_' is prepended as well.
  1052. func_tr_sh ()
  1053. {
  1054. $debug_cmd
  1055. case $1 in
  1056. [0-9]* | *[!a-zA-Z0-9_]*)
  1057. func_tr_sh_result=`$ECHO "$1" | $SED -e 's/^\([0-9]\)/_\1/' -e 's/[^a-zA-Z0-9_]/_/g'`
  1058. ;;
  1059. * )
  1060. func_tr_sh_result=$1
  1061. ;;
  1062. esac
  1063. }
  1064. # func_verbose ARG...
  1065. # -------------------
  1066. # Echo program name prefixed message in verbose mode only.
  1067. func_verbose ()
  1068. {
  1069. $debug_cmd
  1070. $opt_verbose && func_echo "$*"
  1071. :
  1072. }
  1073. # func_warn_and_continue ARG...
  1074. # -----------------------------
  1075. # Echo program name prefixed warning message to standard error.
  1076. func_warn_and_continue ()
  1077. {
  1078. $debug_cmd
  1079. $require_term_colors
  1080. func_echo_infix_1 "${tc_red}warning$tc_reset" "$*" >&2
  1081. }
  1082. # func_warning CATEGORY ARG...
  1083. # ----------------------------
  1084. # Echo program name prefixed warning message to standard error. Warning
  1085. # messages can be filtered according to CATEGORY, where this function
  1086. # elides messages where CATEGORY is not listed in the global variable
  1087. # 'opt_warning_types'.
  1088. func_warning ()
  1089. {
  1090. $debug_cmd
  1091. # CATEGORY must be in the warning_categories list!
  1092. case " $warning_categories " in
  1093. *" $1 "*) ;;
  1094. *) func_internal_error "invalid warning category '$1'" ;;
  1095. esac
  1096. _G_category=$1
  1097. shift
  1098. case " $opt_warning_types " in
  1099. *" $_G_category "*) $warning_func ${1+"$@"} ;;
  1100. esac
  1101. }
  1102. # func_sort_ver VER1 VER2
  1103. # -----------------------
  1104. # 'sort -V' is not generally available.
  1105. # Note this deviates from the version comparison in automake
  1106. # in that it treats 1.5 < 1.5.0, and treats 1.4.4a < 1.4-p3a
  1107. # but this should suffice as we won't be specifying old
  1108. # version formats or redundant trailing .0 in bootstrap.conf.
  1109. # If we did want full compatibility then we should probably
  1110. # use m4_version_compare from autoconf.
  1111. func_sort_ver ()
  1112. {
  1113. $debug_cmd
  1114. printf '%s\n%s\n' "$1" "$2" \
  1115. | sort -t. -k 1,1n -k 2,2n -k 3,3n -k 4,4n -k 5,5n -k 6,6n -k 7,7n -k 8,8n -k 9,9n
  1116. }
  1117. # func_lt_ver PREV CURR
  1118. # ---------------------
  1119. # Return true if PREV and CURR are in the correct order according to
  1120. # func_sort_ver, otherwise false. Use it like this:
  1121. #
  1122. # func_lt_ver "$prev_ver" "$proposed_ver" || func_fatal_error "..."
  1123. func_lt_ver ()
  1124. {
  1125. $debug_cmd
  1126. test "x$1" = x`func_sort_ver "$1" "$2" | $SED 1q`
  1127. }
  1128. # Local variables:
  1129. # mode: shell-script
  1130. # sh-indentation: 2
  1131. # eval: (add-hook 'before-save-hook 'time-stamp)
  1132. # time-stamp-pattern: "10/scriptversion=%:y-%02m-%02d.%02H; # UTC"
  1133. # time-stamp-time-zone: "UTC"
  1134. # End:
  1135. #! /bin/sh
  1136. # Set a version string for this script.
  1137. scriptversion=2014-01-07.03; # UTC
  1138. # A portable, pluggable option parser for Bourne shell.
  1139. # Written by Gary V. Vaughan, 2010
  1140. # Copyright (C) 2010-2015 Free Software Foundation, Inc.
  1141. # This is free software; see the source for copying conditions. There is NO
  1142. # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  1143. # This program is free software: you can redistribute it and/or modify
  1144. # it under the terms of the GNU General Public License as published by
  1145. # the Free Software Foundation, either version 3 of the License, or
  1146. # (at your option) any later version.
  1147. # This program is distributed in the hope that it will be useful,
  1148. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  1149. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  1150. # GNU General Public License for more details.
  1151. # You should have received a copy of the GNU General Public License
  1152. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  1153. # Please report bugs or propose patches to gary@gnu.org.
  1154. ## ------ ##
  1155. ## Usage. ##
  1156. ## ------ ##
  1157. # This file is a library for parsing options in your shell scripts along
  1158. # with assorted other useful supporting features that you can make use
  1159. # of too.
  1160. #
  1161. # For the simplest scripts you might need only:
  1162. #
  1163. # #!/bin/sh
  1164. # . relative/path/to/funclib.sh
  1165. # . relative/path/to/options-parser
  1166. # scriptversion=1.0
  1167. # func_options ${1+"$@"}
  1168. # eval set dummy "$func_options_result"; shift
  1169. # ...rest of your script...
  1170. #
  1171. # In order for the '--version' option to work, you will need to have a
  1172. # suitably formatted comment like the one at the top of this file
  1173. # starting with '# Written by ' and ending with '# warranty; '.
  1174. #
  1175. # For '-h' and '--help' to work, you will also need a one line
  1176. # description of your script's purpose in a comment directly above the
  1177. # '# Written by ' line, like the one at the top of this file.
  1178. #
  1179. # The default options also support '--debug', which will turn on shell
  1180. # execution tracing (see the comment above debug_cmd below for another
  1181. # use), and '--verbose' and the func_verbose function to allow your script
  1182. # to display verbose messages only when your user has specified
  1183. # '--verbose'.
  1184. #
  1185. # After sourcing this file, you can plug processing for additional
  1186. # options by amending the variables from the 'Configuration' section
  1187. # below, and following the instructions in the 'Option parsing'
  1188. # section further down.
  1189. ## -------------- ##
  1190. ## Configuration. ##
  1191. ## -------------- ##
  1192. # You should override these variables in your script after sourcing this
  1193. # file so that they reflect the customisations you have added to the
  1194. # option parser.
  1195. # The usage line for option parsing errors and the start of '-h' and
  1196. # '--help' output messages. You can embed shell variables for delayed
  1197. # expansion at the time the message is displayed, but you will need to
  1198. # quote other shell meta-characters carefully to prevent them being
  1199. # expanded when the contents are evaled.
  1200. usage='$progpath [OPTION]...'
  1201. # Short help message in response to '-h' and '--help'. Add to this or
  1202. # override it after sourcing this library to reflect the full set of
  1203. # options your script accepts.
  1204. usage_message="\
  1205. --debug enable verbose shell tracing
  1206. -W, --warnings=CATEGORY
  1207. report the warnings falling in CATEGORY [all]
  1208. -v, --verbose verbosely report processing
  1209. --version print version information and exit
  1210. -h, --help print short or long help message and exit
  1211. "
  1212. # Additional text appended to 'usage_message' in response to '--help'.
  1213. long_help_message="
  1214. Warning categories include:
  1215. 'all' show all warnings
  1216. 'none' turn off all the warnings
  1217. 'error' warnings are treated as fatal errors"
  1218. # Help message printed before fatal option parsing errors.
  1219. fatal_help="Try '\$progname --help' for more information."
  1220. ## ------------------------- ##
  1221. ## Hook function management. ##
  1222. ## ------------------------- ##
  1223. # This section contains functions for adding, removing, and running hooks
  1224. # to the main code. A hook is just a named list of of function, that can
  1225. # be run in order later on.
  1226. # func_hookable FUNC_NAME
  1227. # -----------------------
  1228. # Declare that FUNC_NAME will run hooks added with
  1229. # 'func_add_hook FUNC_NAME ...'.
  1230. func_hookable ()
  1231. {
  1232. $debug_cmd
  1233. func_append hookable_fns " $1"
  1234. }
  1235. # func_add_hook FUNC_NAME HOOK_FUNC
  1236. # ---------------------------------
  1237. # Request that FUNC_NAME call HOOK_FUNC before it returns. FUNC_NAME must
  1238. # first have been declared "hookable" by a call to 'func_hookable'.
  1239. func_add_hook ()
  1240. {
  1241. $debug_cmd
  1242. case " $hookable_fns " in
  1243. *" $1 "*) ;;
  1244. *) func_fatal_error "'$1' does not accept hook functions." ;;
  1245. esac
  1246. eval func_append ${1}_hooks '" $2"'
  1247. }
  1248. # func_remove_hook FUNC_NAME HOOK_FUNC
  1249. # ------------------------------------
  1250. # Remove HOOK_FUNC from the list of functions called by FUNC_NAME.
  1251. func_remove_hook ()
  1252. {
  1253. $debug_cmd
  1254. eval ${1}_hooks='`$ECHO "\$'$1'_hooks" |$SED "s| '$2'||"`'
  1255. }
  1256. # func_run_hooks FUNC_NAME [ARG]...
  1257. # ---------------------------------
  1258. # Run all hook functions registered to FUNC_NAME.
  1259. # It is assumed that the list of hook functions contains nothing more
  1260. # than a whitespace-delimited list of legal shell function names, and
  1261. # no effort is wasted trying to catch shell meta-characters or preserve
  1262. # whitespace.
  1263. func_run_hooks ()
  1264. {
  1265. $debug_cmd
  1266. case " $hookable_fns " in
  1267. *" $1 "*) ;;
  1268. *) func_fatal_error "'$1' does not support hook funcions.n" ;;
  1269. esac
  1270. eval _G_hook_fns=\$$1_hooks; shift
  1271. for _G_hook in $_G_hook_fns; do
  1272. eval $_G_hook '"$@"'
  1273. # store returned options list back into positional
  1274. # parameters for next 'cmd' execution.
  1275. eval _G_hook_result=\$${_G_hook}_result
  1276. eval set dummy "$_G_hook_result"; shift
  1277. done
  1278. func_quote_for_eval ${1+"$@"}
  1279. func_run_hooks_result=$func_quote_for_eval_result
  1280. }
  1281. ## --------------- ##
  1282. ## Option parsing. ##
  1283. ## --------------- ##
  1284. # In order to add your own option parsing hooks, you must accept the
  1285. # full positional parameter list in your hook function, remove any
  1286. # options that you action, and then pass back the remaining unprocessed
  1287. # options in '<hooked_function_name>_result', escaped suitably for
  1288. # 'eval'. Like this:
  1289. #
  1290. # my_options_prep ()
  1291. # {
  1292. # $debug_cmd
  1293. #
  1294. # # Extend the existing usage message.
  1295. # usage_message=$usage_message'
  1296. # -s, --silent don'\''t print informational messages
  1297. # '
  1298. #
  1299. # func_quote_for_eval ${1+"$@"}
  1300. # my_options_prep_result=$func_quote_for_eval_result
  1301. # }
  1302. # func_add_hook func_options_prep my_options_prep
  1303. #
  1304. #
  1305. # my_silent_option ()
  1306. # {
  1307. # $debug_cmd
  1308. #
  1309. # # Note that for efficiency, we parse as many options as we can
  1310. # # recognise in a loop before passing the remainder back to the
  1311. # # caller on the first unrecognised argument we encounter.
  1312. # while test $# -gt 0; do
  1313. # opt=$1; shift
  1314. # case $opt in
  1315. # --silent|-s) opt_silent=: ;;
  1316. # # Separate non-argument short options:
  1317. # -s*) func_split_short_opt "$_G_opt"
  1318. # set dummy "$func_split_short_opt_name" \
  1319. # "-$func_split_short_opt_arg" ${1+"$@"}
  1320. # shift
  1321. # ;;
  1322. # *) set dummy "$_G_opt" "$*"; shift; break ;;
  1323. # esac
  1324. # done
  1325. #
  1326. # func_quote_for_eval ${1+"$@"}
  1327. # my_silent_option_result=$func_quote_for_eval_result
  1328. # }
  1329. # func_add_hook func_parse_options my_silent_option
  1330. #
  1331. #
  1332. # my_option_validation ()
  1333. # {
  1334. # $debug_cmd
  1335. #
  1336. # $opt_silent && $opt_verbose && func_fatal_help "\
  1337. # '--silent' and '--verbose' options are mutually exclusive."
  1338. #
  1339. # func_quote_for_eval ${1+"$@"}
  1340. # my_option_validation_result=$func_quote_for_eval_result
  1341. # }
  1342. # func_add_hook func_validate_options my_option_validation
  1343. #
  1344. # You'll alse need to manually amend $usage_message to reflect the extra
  1345. # options you parse. It's preferable to append if you can, so that
  1346. # multiple option parsing hooks can be added safely.
  1347. # func_options [ARG]...
  1348. # ---------------------
  1349. # All the functions called inside func_options are hookable. See the
  1350. # individual implementations for details.
  1351. func_hookable func_options
  1352. func_options ()
  1353. {
  1354. $debug_cmd
  1355. func_options_prep ${1+"$@"}
  1356. eval func_parse_options \
  1357. ${func_options_prep_result+"$func_options_prep_result"}
  1358. eval func_validate_options \
  1359. ${func_parse_options_result+"$func_parse_options_result"}
  1360. eval func_run_hooks func_options \
  1361. ${func_validate_options_result+"$func_validate_options_result"}
  1362. # save modified positional parameters for caller
  1363. func_options_result=$func_run_hooks_result
  1364. }
  1365. # func_options_prep [ARG]...
  1366. # --------------------------
  1367. # All initialisations required before starting the option parse loop.
  1368. # Note that when calling hook functions, we pass through the list of
  1369. # positional parameters. If a hook function modifies that list, and
  1370. # needs to propogate that back to rest of this script, then the complete
  1371. # modified list must be put in 'func_run_hooks_result' before
  1372. # returning.
  1373. func_hookable func_options_prep
  1374. func_options_prep ()
  1375. {
  1376. $debug_cmd
  1377. # Option defaults:
  1378. opt_verbose=false
  1379. opt_warning_types=
  1380. func_run_hooks func_options_prep ${1+"$@"}
  1381. # save modified positional parameters for caller
  1382. func_options_prep_result=$func_run_hooks_result
  1383. }
  1384. # func_parse_options [ARG]...
  1385. # ---------------------------
  1386. # The main option parsing loop.
  1387. func_hookable func_parse_options
  1388. func_parse_options ()
  1389. {
  1390. $debug_cmd
  1391. func_parse_options_result=
  1392. # this just eases exit handling
  1393. while test $# -gt 0; do
  1394. # Defer to hook functions for initial option parsing, so they
  1395. # get priority in the event of reusing an option name.
  1396. func_run_hooks func_parse_options ${1+"$@"}
  1397. # Adjust func_parse_options positional parameters to match
  1398. eval set dummy "$func_run_hooks_result"; shift
  1399. # Break out of the loop if we already parsed every option.
  1400. test $# -gt 0 || break
  1401. _G_opt=$1
  1402. shift
  1403. case $_G_opt in
  1404. --debug|-x) debug_cmd='set -x'
  1405. func_echo "enabling shell trace mode"
  1406. $debug_cmd
  1407. ;;
  1408. --no-warnings|--no-warning|--no-warn)
  1409. set dummy --warnings none ${1+"$@"}
  1410. shift
  1411. ;;
  1412. --warnings|--warning|-W)
  1413. test $# = 0 && func_missing_arg $_G_opt && break
  1414. case " $warning_categories $1" in
  1415. *" $1 "*)
  1416. # trailing space prevents matching last $1 above
  1417. func_append_uniq opt_warning_types " $1"
  1418. ;;
  1419. *all)
  1420. opt_warning_types=$warning_categories
  1421. ;;
  1422. *none)
  1423. opt_warning_types=none
  1424. warning_func=:
  1425. ;;
  1426. *error)
  1427. opt_warning_types=$warning_categories
  1428. warning_func=func_fatal_error
  1429. ;;
  1430. *)
  1431. func_fatal_error \
  1432. "unsupported warning category: '$1'"
  1433. ;;
  1434. esac
  1435. shift
  1436. ;;
  1437. --verbose|-v) opt_verbose=: ;;
  1438. --version) func_version ;;
  1439. -\?|-h) func_usage ;;
  1440. --help) func_help ;;
  1441. # Separate optargs to long options (plugins may need this):
  1442. --*=*) func_split_equals "$_G_opt"
  1443. set dummy "$func_split_equals_lhs" \
  1444. "$func_split_equals_rhs" ${1+"$@"}
  1445. shift
  1446. ;;
  1447. # Separate optargs to short options:
  1448. -W*)
  1449. func_split_short_opt "$_G_opt"
  1450. set dummy "$func_split_short_opt_name" \
  1451. "$func_split_short_opt_arg" ${1+"$@"}
  1452. shift
  1453. ;;
  1454. # Separate non-argument short options:
  1455. -\?*|-h*|-v*|-x*)
  1456. func_split_short_opt "$_G_opt"
  1457. set dummy "$func_split_short_opt_name" \
  1458. "-$func_split_short_opt_arg" ${1+"$@"}
  1459. shift
  1460. ;;
  1461. --) break ;;
  1462. -*) func_fatal_help "unrecognised option: '$_G_opt'" ;;
  1463. *) set dummy "$_G_opt" ${1+"$@"}; shift; break ;;
  1464. esac
  1465. done
  1466. # save modified positional parameters for caller
  1467. func_quote_for_eval ${1+"$@"}
  1468. func_parse_options_result=$func_quote_for_eval_result
  1469. }
  1470. # func_validate_options [ARG]...
  1471. # ------------------------------
  1472. # Perform any sanity checks on option settings and/or unconsumed
  1473. # arguments.
  1474. func_hookable func_validate_options
  1475. func_validate_options ()
  1476. {
  1477. $debug_cmd
  1478. # Display all warnings if -W was not given.
  1479. test -n "$opt_warning_types" || opt_warning_types=" $warning_categories"
  1480. func_run_hooks func_validate_options ${1+"$@"}
  1481. # Bail if the options were screwed!
  1482. $exit_cmd $EXIT_FAILURE
  1483. # save modified positional parameters for caller
  1484. func_validate_options_result=$func_run_hooks_result
  1485. }
  1486. ## ----------------- ##
  1487. ## Helper functions. ##
  1488. ## ----------------- ##
  1489. # This section contains the helper functions used by the rest of the
  1490. # hookable option parser framework in ascii-betical order.
  1491. # func_fatal_help ARG...
  1492. # ----------------------
  1493. # Echo program name prefixed message to standard error, followed by
  1494. # a help hint, and exit.
  1495. func_fatal_help ()
  1496. {
  1497. $debug_cmd
  1498. eval \$ECHO \""Usage: $usage"\"
  1499. eval \$ECHO \""$fatal_help"\"
  1500. func_error ${1+"$@"}
  1501. exit $EXIT_FAILURE
  1502. }
  1503. # func_help
  1504. # ---------
  1505. # Echo long help message to standard output and exit.
  1506. func_help ()
  1507. {
  1508. $debug_cmd
  1509. func_usage_message
  1510. $ECHO "$long_help_message"
  1511. exit 0
  1512. }
  1513. # func_missing_arg ARGNAME
  1514. # ------------------------
  1515. # Echo program name prefixed message to standard error and set global
  1516. # exit_cmd.
  1517. func_missing_arg ()
  1518. {
  1519. $debug_cmd
  1520. func_error "Missing argument for '$1'."
  1521. exit_cmd=exit
  1522. }
  1523. # func_split_equals STRING
  1524. # ------------------------
  1525. # Set func_split_equals_lhs and func_split_equals_rhs shell variables after
  1526. # splitting STRING at the '=' sign.
  1527. test -z "$_G_HAVE_XSI_OPS" \
  1528. && (eval 'x=a/b/c;
  1529. test 5aa/bb/cc = "${#x}${x%%/*}${x%/*}${x#*/}${x##*/}"') 2>/dev/null \
  1530. && _G_HAVE_XSI_OPS=yes
  1531. if test yes = "$_G_HAVE_XSI_OPS"
  1532. then
  1533. # This is an XSI compatible shell, allowing a faster implementation...
  1534. eval 'func_split_equals ()
  1535. {
  1536. $debug_cmd
  1537. func_split_equals_lhs=${1%%=*}
  1538. func_split_equals_rhs=${1#*=}
  1539. test "x$func_split_equals_lhs" = "x$1" \
  1540. && func_split_equals_rhs=
  1541. }'
  1542. else
  1543. # ...otherwise fall back to using expr, which is often a shell builtin.
  1544. func_split_equals ()
  1545. {
  1546. $debug_cmd
  1547. func_split_equals_lhs=`expr "x$1" : 'x\([^=]*\)'`
  1548. func_split_equals_rhs=
  1549. test "x$func_split_equals_lhs" = "x$1" \
  1550. || func_split_equals_rhs=`expr "x$1" : 'x[^=]*=\(.*\)$'`
  1551. }
  1552. fi #func_split_equals
  1553. # func_split_short_opt SHORTOPT
  1554. # -----------------------------
  1555. # Set func_split_short_opt_name and func_split_short_opt_arg shell
  1556. # variables after splitting SHORTOPT after the 2nd character.
  1557. if test yes = "$_G_HAVE_XSI_OPS"
  1558. then
  1559. # This is an XSI compatible shell, allowing a faster implementation...
  1560. eval 'func_split_short_opt ()
  1561. {
  1562. $debug_cmd
  1563. func_split_short_opt_arg=${1#??}
  1564. func_split_short_opt_name=${1%"$func_split_short_opt_arg"}
  1565. }'
  1566. else
  1567. # ...otherwise fall back to using expr, which is often a shell builtin.
  1568. func_split_short_opt ()
  1569. {
  1570. $debug_cmd
  1571. func_split_short_opt_name=`expr "x$1" : 'x-\(.\)'`
  1572. func_split_short_opt_arg=`expr "x$1" : 'x-.\(.*\)$'`
  1573. }
  1574. fi #func_split_short_opt
  1575. # func_usage
  1576. # ----------
  1577. # Echo short help message to standard output and exit.
  1578. func_usage ()
  1579. {
  1580. $debug_cmd
  1581. func_usage_message
  1582. $ECHO "Run '$progname --help |${PAGER-more}' for full usage"
  1583. exit 0
  1584. }
  1585. # func_usage_message
  1586. # ------------------
  1587. # Echo short help message to standard output.
  1588. func_usage_message ()
  1589. {
  1590. $debug_cmd
  1591. eval \$ECHO \""Usage: $usage"\"
  1592. echo
  1593. $SED -n 's|^# ||
  1594. /^Written by/{
  1595. x;p;x
  1596. }
  1597. h
  1598. /^Written by/q' < "$progpath"
  1599. echo
  1600. eval \$ECHO \""$usage_message"\"
  1601. }
  1602. # func_version
  1603. # ------------
  1604. # Echo version message to standard output and exit.
  1605. func_version ()
  1606. {
  1607. $debug_cmd
  1608. printf '%s\n' "$progname $scriptversion"
  1609. $SED -n '
  1610. /(C)/!b go
  1611. :more
  1612. /\./!{
  1613. N
  1614. s|\n# | |
  1615. b more
  1616. }
  1617. :go
  1618. /^# Written by /,/# warranty; / {
  1619. s|^# ||
  1620. s|^# *$||
  1621. s|\((C)\)[ 0-9,-]*[ ,-]\([1-9][0-9]* \)|\1 \2|
  1622. p
  1623. }
  1624. /^# Written by / {
  1625. s|^# ||
  1626. p
  1627. }
  1628. /^warranty; /q' < "$progpath"
  1629. exit $?
  1630. }
  1631. # Local variables:
  1632. # mode: shell-script
  1633. # sh-indentation: 2
  1634. # eval: (add-hook 'before-save-hook 'time-stamp)
  1635. # time-stamp-pattern: "10/scriptversion=%:y-%02m-%02d.%02H; # UTC"
  1636. # time-stamp-time-zone: "UTC"
  1637. # End:
  1638. #! /bin/sh
  1639. # Extract macro arguments from autotools input with GNU M4.
  1640. # Written by Gary V. Vaughan, 2010
  1641. #
  1642. # Copyright (C) 2010-2015 Free Software Foundation, Inc.
  1643. # This is free software; see the source for copying conditions. There is NO
  1644. # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  1645. # Make sure we've evaluated scripts we depend on.
  1646. test -z "$progpath" && . `echo "$0" |${SED-sed} 's|[^/]*$||'`/funclib.sh
  1647. test extract-trace = "$progname" && . `echo "$0" |${SED-sed} 's|[^/]*$||'`/options-parser
  1648. # Set a version string.
  1649. scriptversion=2015-01-20.17; # UTC
  1650. # This program is free software: you can redistribute it and/or modify
  1651. # it under the terms of the GNU General Public License as published by
  1652. # the Free Software Foundation, either version 3 of the License, or
  1653. # (at your option) any later version.
  1654. # This program is distributed in the hope that it will be useful,
  1655. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  1656. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  1657. # GNU General Public License for more details.
  1658. # You should have received a copy of the GNU General Public License
  1659. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  1660. # Please report bugs or propose patches to gary@gnu.org.
  1661. ## ------ ##
  1662. ## Usage. ##
  1663. ## ------ ##
  1664. # Run './extract-trace --help' for help with using this script from the
  1665. # command line.
  1666. #
  1667. # Or source first 'options-parser' and then this file into your own
  1668. # scripts in order to make use of the function and variable framework
  1669. # they define, and also to avoid the overhead of forking to run this
  1670. # script in its own process on every call.
  1671. ## ----------------- ##
  1672. ## Helper functions. ##
  1673. ## ----------------- ##
  1674. # This section contains the helper functions used by the rest of
  1675. # 'extract-trace'.
  1676. # func_autoconf_configure MAYBE-CONFIGURE-FILE
  1677. # --------------------------------------------
  1678. # Ensure that MAYBE-CONFIGURE-FILE is the name of a file in the current
  1679. # directory that contains an uncommented call to AC_INIT.
  1680. func_autoconf_configure ()
  1681. {
  1682. $debug_cmd
  1683. _G_sed_no_comment='
  1684. s|#.*$||
  1685. s|^dnl .*$||
  1686. s| dnl .*$||'
  1687. _G_ac_init=
  1688. # If we were passed a genuine file, make sure it calls AC_INIT.
  1689. test -f "$1" \
  1690. && _G_ac_init=`$SED "$_G_sed_no_comment" "$1" |$GREP AC_INIT`
  1691. # Otherwise it is not a genuine Autoconf input file.
  1692. test -n "$_G_ac_init"
  1693. _G_status=$?
  1694. test 0 -ne "$_G_status" \
  1695. && func_verbose "'$1' not using Autoconf"
  1696. (exit $_G_status)
  1697. }
  1698. # func_tool_version_output CMD [FATAL-ERROR-MSG]
  1699. # ----------------------------------------------
  1700. # Attempt to run 'CMD --version', discarding errors. The output can be
  1701. # ignored by redirecting stdout, and this function used simply to test
  1702. # whether the command exists and exits normally when passed a
  1703. # '--version' argument.
  1704. # When FATAL-ERROR-MSG is given, then this function will display the
  1705. # message and exit if running 'CMD --version' returns a non-zero exit
  1706. # status.
  1707. func_tool_version_output ()
  1708. {
  1709. $debug_cmd
  1710. _G_cmd=$1
  1711. _G_fatal_error_msg=$2
  1712. # Some tools, like 'git2cl' produce thousands of lines of output
  1713. # unless stdin is /dev/null - in that case we want to return
  1714. # successfully without saving all of that output. Other tools,
  1715. # such as 'help2man' exit with a non-zero status when stdin comes
  1716. # from /dev/null, so we re-execute without /dev/null if that
  1717. # happens. This means that occasionally, the output from both calls
  1718. # ends up in the result, but the alternative would be to discard the
  1719. # output from one call, and hope the other produces something useful.
  1720. { $_G_cmd --version </dev/null || $_G_cmd --version; } 2>/dev/null
  1721. _G_status=$?
  1722. test 0 -ne "$_G_status" && test -n "$_G_fatal_error_msg" \
  1723. && func_fatal_error "$_G_fatal_error_msg"
  1724. (exit $_G_status)
  1725. }
  1726. # func_tool_version_number CMD [FATAL-ERROR-MSG]
  1727. # ----------------------------------------------
  1728. # Pass arguments to func_tool_version_output, but set
  1729. # $func_tool_version_number_result to the last dot delimited digit string
  1730. # on the first line of output.
  1731. func_tool_version_number ()
  1732. {
  1733. $debug_cmd
  1734. _G_verout=`func_tool_version_output "$@"`
  1735. _G_status=$?
  1736. # A version number starts with a digit following a space on the first
  1737. # line of output from `--version`.
  1738. _G_verout=`echo "$_G_verout" |sed 1q`
  1739. if test -n "$_G_verout"; then
  1740. _G_vernum=`expr "$_G_verout" : '.* \([0-9][^ ]*\)'`
  1741. fi
  1742. if test -n "$_G_vernum"; then
  1743. printf '%s\n' "$_G_vernum"
  1744. else
  1745. printf '%s\n' "$_G_verout"
  1746. fi
  1747. (exit $_G_status)
  1748. }
  1749. # func_find_tool ENVVAR NAMES...
  1750. # ------------------------------
  1751. # Search for a required program. Use the value of ENVVAR, if set,
  1752. # otherwise find the first of the NAMES that can be run (i.e.,
  1753. # supports --version). If found, set ENVVAR to the program name,
  1754. # die otherwise.
  1755. func_find_tool ()
  1756. {
  1757. $debug_cmd
  1758. _G_find_tool_envvar=$1
  1759. shift
  1760. _G_find_tool_names=$@
  1761. eval "_G_find_tool_res=\$$_G_find_tool_envvar"
  1762. if test -n "$_G_find_tool_res"; then
  1763. _G_find_tool_error_prefix="\$$find_tool_envvar: "
  1764. else
  1765. _G_find_tool_res=
  1766. _G_bestver=
  1767. for _G_prog
  1768. do
  1769. _G_find_tool_save_IFS=$IFS
  1770. IFS=${PATH_SEPARATOR-:}
  1771. for _G_dir in $PATH; do
  1772. IFS=$_G_find_tool_save_IFS
  1773. _G_progpath=$_G_dir/$_G_prog
  1774. test -r "$_G_progpath" && {
  1775. _G_curver=`func_tool_version_number $_G_progpath`
  1776. case $_G_bestver,$_G_curver in
  1777. ,)
  1778. # first non--version responsive prog sticks!
  1779. test -n "$_G_progpath" || _G_find_tool_res=$_G_progpath
  1780. ;;
  1781. ,*)
  1782. # first --version responsive prog beats non--version responsive!
  1783. _G_find_tool_res=$_G_progpath
  1784. _G_bestver=$_G_curver
  1785. ;;
  1786. *,*)
  1787. # another --version responsive prog must be newer to beat previous one!
  1788. test "x$_G_curver" = "x$_G_bestver" \
  1789. || func_lt_ver "$_G_curver" "$_G_bestver" \
  1790. || {
  1791. _G_find_tool_res=$_G_progpath
  1792. _G_bestver=$_G_curver
  1793. }
  1794. ;;
  1795. esac
  1796. }
  1797. done
  1798. IFS=$_G_find_tool_save_IFS
  1799. done
  1800. fi
  1801. if test -n "$_G_find_tool_res"; then
  1802. func_tool_version_number >/dev/null $_G_find_tool_res "\
  1803. ${_G_find_tool_error_prefix}Cannot run '$_G_find_tool_res --version'"
  1804. # Make sure the result is exported to the environment for children
  1805. # to use.
  1806. eval "$_G_find_tool_envvar=\$_G_find_tool_res"
  1807. eval "export $_G_find_tool_envvar"
  1808. else
  1809. func_error "\
  1810. One of these is required:
  1811. $_G_find_tool_names"
  1812. fi
  1813. }
  1814. ## -------------------- ##
  1815. ## Resource management. ##
  1816. ## -------------------- ##
  1817. # This section contains definitions for functions that each ensure a
  1818. # particular resource (a file, or a non-empty configuration variable for
  1819. # example) is available, and if appropriate to extract default values
  1820. # from pertinent package files. Where a variable already has a non-
  1821. # empty value (as set by the package's 'bootstrap.conf'), that value is
  1822. # used in preference to deriving the default. Call them using their
  1823. # associated 'require_*' variable to ensure that they are executed, at
  1824. # most, once.
  1825. #
  1826. # It's entirely deliberate that calling these functions can set
  1827. # variables that don't obey the namespace limitations obeyed by the rest
  1828. # of this file, in order that that they be as useful as possible to
  1829. # callers.
  1830. # require_configure_ac
  1831. # --------------------
  1832. # Ensure that there is a 'configure.ac' or 'configure.in' file in the
  1833. # current directory that contains an uncommented call to AC_INIT, and
  1834. # that '$configure_ac' contains its name.
  1835. require_configure_ac=func_require_configure_ac
  1836. func_require_configure_ac ()
  1837. {
  1838. $debug_cmd
  1839. test -z "$configure_ac" \
  1840. && func_autoconf_configure configure.ac && configure_ac=configure.ac
  1841. test -z "$configure_ac" \
  1842. && func_autoconf_configure configure.in && configure_ac=configure.in
  1843. test -z "$configure_ac" \
  1844. || func_verbose "found '$configure_ac'"
  1845. require_configure_ac=:
  1846. }
  1847. # require_gnu_m4
  1848. # --------------
  1849. # Search for GNU M4, and export it in $M4.
  1850. require_gnu_m4=func_require_gnu_m4
  1851. func_require_gnu_m4 ()
  1852. {
  1853. $debug_cmd
  1854. test -n "$M4" || {
  1855. # Find the first m4 binary that responds to --version.
  1856. func_find_tool M4 gm4 gnum4 m4
  1857. }
  1858. test -n "$M4" || func_fatal_error "\
  1859. Please install GNU M4, or 'export M4=/path/to/gnu/m4'."
  1860. func_verbose "export M4='$M4'"
  1861. # Make sure the search result is visible to subshells
  1862. export M4
  1863. require_gnu_m4=:
  1864. }
  1865. ## --------------- ##
  1866. ## Core functions. ##
  1867. ## --------------- ##
  1868. # This section contains the high level functions used when calling this
  1869. # file as a script. 'func_extract_trace' is probably the only one that you
  1870. # won't want to replace if you source this file into your own script.
  1871. # func_extract_trace MACRO_NAMES [FILENAME]...
  1872. # --------------------------------------------
  1873. # set '$func_extract_trace_result' to a colon delimited list of arguments
  1874. # to any of the comma separated list of MACRO_NAMES in FILENAME. If no
  1875. # FILENAME is given, then '$configure_ac' is assumed.
  1876. func_extract_trace ()
  1877. {
  1878. $debug_cmd
  1879. $require_configure_ac
  1880. $require_gnu_m4
  1881. _G_m4_traces=`$ECHO "--trace=$1" |$SED 's%,% --trace=%g'`
  1882. _G_re_macros=`$ECHO "($1)" |$SED 's%,%|%g'`
  1883. _G_macros="$1"; shift
  1884. test $# -gt 0 || {
  1885. set dummy $configure_ac
  1886. shift
  1887. }
  1888. # Generate an error if the first file is missing
  1889. <"$1"
  1890. # Sadly, we can't use 'autom4te' tracing to extract macro arguments,
  1891. # because it complains about things we want to ignore at bootstrap
  1892. # time - like missing m4_include files; AC_PREREQ being newer than
  1893. # the installed autoconf; and returns nothing when tracing
  1894. # 'AM_INIT_AUTOMAKE' when aclocal hasn't been generated yet.
  1895. #
  1896. # The following tries to emulate a less persnickety version of (and
  1897. # due to not having to wait for Perl startup on every invocation,
  1898. # it's probably faster too):
  1899. #
  1900. # autom4te --language=Autoconf --trace=$my_macro:\$% "$@"
  1901. #
  1902. # First we give a minimal set of macro declarations to M4 to prime
  1903. # it for reading Autoconf macros, while still providing some of the
  1904. # functionality generally used at m4-time to supply dynamic
  1905. # arguments to Autocof functions, but without following
  1906. # 'm4_s?include' files.
  1907. _G_mini='
  1908. # Initialisation.
  1909. m4_changequote([,])
  1910. m4_define([m4_copy], [m4_define([$2], m4_defn([$1]))])
  1911. m4_define([m4_rename], [m4_copy([$1], [$2])m4_undefine([$1])])
  1912. # Disable these macros.
  1913. m4_undefine([m4_dnl])
  1914. m4_undefine([m4_include])
  1915. m4_undefine([m4_m4exit])
  1916. m4_undefine([m4_m4wrap])
  1917. m4_undefine([m4_maketemp])
  1918. # Copy and rename macros not handled by "m4 --prefix".
  1919. m4_define([dnl], [m4_builtin([dnl])])
  1920. m4_copy([m4_define], [m4_defun])
  1921. m4_rename([m4_ifelse], [m4_if])
  1922. m4_ifdef([m4_mkstemp], [m4_undefine([m4_mkstemp])])
  1923. m4_rename([m4_patsubst], [m4_bpatsubst])
  1924. m4_rename([m4_regexp], [m4_bregexp])
  1925. # "m4sugar.mini" - useful m4-time macros for dynamic arguments.
  1926. # If we discover packages that need more m4 macros defined in
  1927. # order to bootstrap correctly, add them here:
  1928. m4_define([m4_bmatch],
  1929. [m4_if([$#], 0, [], [$#], 1, [], [$#], 2, [$2],
  1930. [m4_if(m4_bregexp([$1], [$2]), -1,
  1931. [$0([$1], m4_shift3($@))], [$3])])])
  1932. m4_define([m4_ifndef], [m4_ifdef([$1], [$3], [$2])])
  1933. m4_define([m4_ifset],
  1934. [m4_ifdef([$1], [m4_ifval(m4_defn([$1]), [$2], [$3])], [$3])])
  1935. m4_define([m4_require], [$1])
  1936. m4_define([m4_shift3], [m4_shift(m4shift(m4shift($@)))])
  1937. # "autoconf.mini" - things from autoconf macros we care about.
  1938. m4_copy([m4_defun], [AC_DEFUN])
  1939. # Dummy definitions for the macros we want to trace.
  1940. # AM_INIT_AUTOMAKE at least produces no trace without this.
  1941. '
  1942. _G_save=$IFS
  1943. IFS=,
  1944. for _G_macro in $_G_macros; do
  1945. IFS=$_G_save
  1946. func_append _G_mini "AC_DEFUN([$_G_macro])$nl"
  1947. done
  1948. IFS=$_G_save
  1949. # We discard M4's stdout, but the M4 trace output from reading our
  1950. # "autoconf.mini" followed by any other files passed to this
  1951. # function is then scanned by sed to transform it into a colon
  1952. # delimited argument list assigned to a shell variable.
  1953. _G_transform='s|#.*$||; s|^dnl .*$||; s| dnl .*$||;'
  1954. # Unfortunately, alternation in regexp addresses doesn't work in at
  1955. # least BSD (and hence Mac OS X) sed, so we have to append a capture
  1956. # and print block for each traced macro to the sed transform script.
  1957. _G_save=$IFS
  1958. IFS=,
  1959. for _G_macro in $_G_macros; do
  1960. IFS=$_G_save
  1961. func_append _G_transform '
  1962. /^m4trace: -1- '"$_G_macro"'/ {
  1963. s|^m4trace: -1- '"$_G_macro"'[([]*||
  1964. s|], [[]|:|g
  1965. s|[])]*$|:|
  1966. s|\(.\):$|\1|
  1967. p
  1968. }'
  1969. done
  1970. IFS=$_G_save
  1971. # Save the command pipeline results for further use by callers of
  1972. # this function.
  1973. func_extract_trace_result=`$ECHO "$_G_mini" \
  1974. |$M4 -daq --prefix $_G_m4_traces - "$@" 2>&1 1>/dev/null \
  1975. |$SED -n -e "$_G_transform"`
  1976. }
  1977. # func_extract_trace_first MACRO_NAMES [FILENAME]...
  1978. # --------------------------------------------------
  1979. # Exactly like func_extract_trace, except that only the first argument
  1980. # to the first invocation of one of the comma separated MACRO_NAMES is
  1981. # returned in '$func_extract_trace_first_result'.
  1982. func_extract_trace_first ()
  1983. {
  1984. $debug_cmd
  1985. func_extract_trace ${1+"$@"}
  1986. func_extract_trace_first_result=`$ECHO "$func_extract_trace_result" \
  1987. |$SED -e 's|:.*$||g' -e 1q`
  1988. }
  1989. # func_main [ARG]...
  1990. # ------------------
  1991. func_main ()
  1992. {
  1993. $debug_cmd
  1994. # Configuration.
  1995. usage='$progname MACRO_NAME FILE [...]'
  1996. long_help_message='
  1997. The first argument to this program is the name of an autotools macro
  1998. whose arguments you want to extract by examining the files listed in the
  1999. remaining arguments using the same tool that Autoconf and Automake use,
  2000. GNU M4.
  2001. The arguments are returned separated by colons, with each traced call
  2002. on a separate line.'
  2003. # Option processing.
  2004. func_options "$@"
  2005. eval set dummy "$func_options_result"; shift
  2006. # Validate remaining non-option arguments.
  2007. test $# -gt 1 \
  2008. || func_fatal_help "not enough arguments"
  2009. # Pass non-option arguments to extraction function.
  2010. func_extract_trace "$@"
  2011. # Display results.
  2012. test -n "$func_extract_trace_result" \
  2013. && $ECHO "$func_extract_trace_result"
  2014. # The End.
  2015. exit $EXIT_SUCCESS
  2016. }
  2017. ## --------------------------- ##
  2018. ## Actually perform the trace. ##
  2019. ## --------------------------- ##
  2020. # Only call 'func_main' if this script was called directly.
  2021. test extract-trace = "$progname" && func_main "$@"
  2022. # Local variables:
  2023. # mode: shell-script
  2024. # sh-indentation: 2
  2025. # eval: (add-hook 'before-save-hook 'time-stamp)
  2026. # time-stamp-pattern: "20/scriptversion=%:y-%02m-%02d.%02H; # UTC"
  2027. # time-stamp-time-zone: "UTC"
  2028. # End:
  2029. # Set a version string.
  2030. scriptversion='(GNU libtool) 2.4.6'
  2031. ## ---------------- ##
  2032. ## Options parsing. ##
  2033. ## ---------------- ##
  2034. # Hook in the functions to make sure our own options are parsed during
  2035. # the option parsing loop.
  2036. usage='$progpath [OPTION]...'
  2037. # Short help message in response to '-h'.
  2038. usage_message="Options:
  2039. -c, --copy copy files rather than symlinking them
  2040. --debug enable verbose shell tracing
  2041. -n, --dry-run print commands rather than running them
  2042. -f, --force replace existing files
  2043. -i, --install copy missing auxiliary files
  2044. --ltdl[=DIR] install libltdl sources [default: libltdl]
  2045. --no-warnings equivalent to '-Wnone'
  2046. --nonrecursive prepare ltdl for non-recursive make
  2047. -q, --quiet work silently
  2048. --recursive prepare ltdl for recursive make
  2049. --subproject prepare ltdl to configure and build independently
  2050. -v, --verbose verbosely report processing
  2051. --version print version information and exit
  2052. -W, --warnings=CATEGORY
  2053. report the warnings falling in CATEGORY [all]
  2054. -h, --help print short or long help message
  2055. "
  2056. # Additional text appended to 'usage_message' in response to '--help'.
  2057. long_help_message=$long_help_message"
  2058. 'environment' show warnings about LIBTOOLIZE_OPTIONS content
  2059. 'file' show warnings about file copying and linking
  2060. The following space or comma delimited options can be passed to $progname
  2061. via the environment variable LIBTOOLIZE_OPTIONS, unknown environment
  2062. options are ignored:
  2063. --debug enable verbose shell tracing
  2064. --no-warnings don't display warning messages
  2065. --quiet work silently
  2066. --verbose verbosely report processing
  2067. You must 'cd' to the top directory of your package before you run
  2068. '$progname'.
  2069. When reporting a bug, please describe a test case to reproduce it and
  2070. include the following information:
  2071. host-triplet: x86_64-arago-linux-gnu
  2072. version: $progname (GNU libtool) 2.4.6
  2073. automake: `($AUTOMAKE --version) 2>/dev/null |$SED 1q`
  2074. autoconf: `($AUTOCONF --version) 2>/dev/null |$SED 1q`
  2075. Report bugs to <bug-libtool@gnu.org>.
  2076. GNU libtool home page: <http://www.gnu.org/software/libtool/>.
  2077. General help using GNU software: <http://www.gnu.org/gethelp/>.
  2078. "
  2079. warning_categories='environment file'
  2080. # libtoolize_environment_options [ARG]...
  2081. # ---------------------------------------
  2082. # Parse environment options.
  2083. libtoolize_environment_options ()
  2084. {
  2085. $debug_mode
  2086. my_sed_env_opt='1s/^\([^,:; ]*\).*$/\1/;q'
  2087. my_sed_env_rest='1s/^[^,:; ]*[,:; ]*\(.*\)$/\1/;q'
  2088. while test -n "$LIBTOOLIZE_OPTIONS"; do
  2089. opt=`echo "$LIBTOOLIZE_OPTIONS" | $SED "$my_sed_env_opt"`
  2090. LIBTOOLIZE_OPTIONS=`echo "$LIBTOOLIZE_OPTIONS" | $SED "$my_sed_env_rest"`
  2091. case $opt in
  2092. --debug|--no-warn|--no-warning|--no-warnings|--quiet|--verbose)
  2093. envopts="${envopts+$envopts }$opt" ;;
  2094. --*) env_warning="${env_warning+$env_warning
  2095. }unrecognized environment option '$opt'" ;;
  2096. *) func_fatal_help "garbled LIBTOOLIZE_OPTIONS near '$opt'" ;;
  2097. esac
  2098. done
  2099. # Pass back the updated list of options.
  2100. if test -n "$envopts"; then
  2101. func_quote_for_eval "$envopts" ${1+"$@"}
  2102. else
  2103. func_quote_for_eval ${1+"$@"}
  2104. fi
  2105. libtoolize_environment_options_result=$func_quote_for_eval_result
  2106. }
  2107. func_add_hook func_options_prep libtoolize_environment_options
  2108. # libtoolize_options_prep [ARG]...
  2109. # --------------------------------
  2110. # Preparation for options parsed by libtoolize.
  2111. libtoolize_options_prep ()
  2112. {
  2113. $debug_cmd
  2114. # Option defaults:
  2115. opt_copy=false
  2116. opt_dry_run=false
  2117. opt_force=false
  2118. opt_install=false
  2119. opt_ltdl=false
  2120. opt_nonrecursive=false
  2121. opt_quiet=false
  2122. opt_recursive=false
  2123. opt_subproject=false
  2124. ltdl_mode=
  2125. # Pass back the list of options.
  2126. func_quote_for_eval ${1+"$@"}
  2127. libtoolize_options_prep_result=$func_quote_for_eval_result
  2128. }
  2129. func_add_hook func_options_prep libtoolize_options_prep
  2130. # libtoolize_parse_options [ARG]...
  2131. # ---------------------------------
  2132. # Provide handling for libtoolize specific options.
  2133. libtoolize_parse_options ()
  2134. {
  2135. $debug_cmd
  2136. # Perform our own loop to consume as many options as possible in
  2137. # each iteration.
  2138. while test $# -gt 0; do
  2139. _G_opt=$1
  2140. shift
  2141. case $_G_opt in
  2142. --copy|-c) opt_copy=: ;;
  2143. --dry-run|--dryrun|-n)
  2144. $opt_dry_run || {
  2145. opt_dry_run=:
  2146. CP="func_echo_all $CP"
  2147. test -n "$LN_S" && LN_S="func_echo_all $LN_S"
  2148. MKDIR="func_echo_all $MKDIR"
  2149. RM="func_echo_all $RM"
  2150. }
  2151. ;;
  2152. --force|-f) opt_force=: ;;
  2153. --install|-i) opt_install=: ;;
  2154. --ltdl) opt_ltdl=:
  2155. if test 0 -lt $#; then
  2156. case $1 in
  2157. -*) ;;
  2158. *) ltdl_dir=`$ECHO "$1" | $SED 's|/*$||'`
  2159. shift
  2160. ;;
  2161. esac
  2162. fi
  2163. ;;
  2164. --nonrecursive|--non-recursive)
  2165. opt_nonrecursive=:
  2166. ;;
  2167. --quiet|--automake|-q) # --automake is for 1.5 compatibility
  2168. opt_quiet=: ;;
  2169. --recursive) opt_recursive=: ;;
  2170. --subproject) opt_subproject=: ;;
  2171. # Separate non-argument short options:
  2172. -c*|-f*|-i*|-n*|-q*)
  2173. func_split_short_opt "$_G_opt"
  2174. set dummy "$func_split_short_opt_name" \
  2175. "-$func_split_short_opt_arg" ${1+"$@"}
  2176. shift
  2177. ;;
  2178. # An option not handled by this hook function:
  2179. *) set dummy "$_G_opt" ${1+"$@"}; shift; break ;;
  2180. esac
  2181. done
  2182. # save modified positional parameters for caller
  2183. func_quote_for_eval ${1+"$@"}
  2184. libtoolize_parse_options_result=$func_quote_for_eval_result
  2185. }
  2186. func_add_hook func_parse_options libtoolize_parse_options
  2187. # libtoolize_validate_options [ARG]...
  2188. # ------------------------------------
  2189. # Perform any sanity checks on option settings and/or unconsumed
  2190. # arguments.
  2191. libtoolize_validate_options ()
  2192. {
  2193. # show any warnings saved by LIBTOOLIZE_OPTIONS parsing
  2194. test -n "$env_warning" && func_warning environment "$env_warning"
  2195. # validate $opt_nonrecursive, $opt_recursive and $opt_subproject
  2196. if $opt_nonrecursive; then
  2197. if $opt_recursive || $opt_subproject; then
  2198. func_error "you can have at most one of --non-recursive, --recursive and --subproject"
  2199. fi
  2200. ltdl_mode=nonrecursive
  2201. elif $opt_recursive; then
  2202. $opt_subproject &&
  2203. func_error "you can have at most one of --non-recursive, --recursive and --subproject"
  2204. ltdl_mode=recursive
  2205. elif $opt_subproject; then
  2206. ltdl_mode=subproject
  2207. fi
  2208. # any remaining arguments are an error
  2209. test 0 -lt $# &&
  2210. func_fatal_help "unknown additional arguments: '${1+$@}'"
  2211. # Pass back the empty argument list
  2212. func_quote_for_eval ${1+"$@"}
  2213. libtoolize_validate_options_result=$func_quote_for_eval_result
  2214. }
  2215. func_add_hook func_validate_options libtoolize_validate_options
  2216. # Process options as early as possible so that --help and --version
  2217. # can return quickly.
  2218. func_options ${1+"$@"}
  2219. eval set dummy "$func_options_result"; shift
  2220. # func_notquiet_once MSG_VAR
  2221. # --------------------------
  2222. # Call func_notquiet with the value of MSG_VAR, and then set MSG_VAR='' so
  2223. # that subsequent calls will have no effect.
  2224. func_notquiet_once ()
  2225. {
  2226. $debug_cmd
  2227. if test -n "$1"; then
  2228. eval my_msg=\$$1
  2229. if test -n "$my_msg"; then
  2230. func_notquiet "$my_msg"
  2231. eval $1=
  2232. fi
  2233. fi
  2234. }
  2235. # func_notquiet_hdr MSG_VAR ARG...
  2236. # --------------------------------
  2237. # With at least 1 non-empty ARG, call func_notquiet_once with MSG_VAR,
  2238. # and then func_notquiet with the remaining arguments.
  2239. func_notquiet_hdr ()
  2240. {
  2241. $debug_cmd
  2242. my_msg_var=$1; shift
  2243. test -n "$*" || return
  2244. func_notquiet_once "$my_msg_var"
  2245. func_notquiet "$*"
  2246. }
  2247. # func_notquiet_error_hdr MSG_VAR ARG...
  2248. # --------------------------------------
  2249. # Much the same as func_notquiet_header, but for (non-fatal) error
  2250. # messages.
  2251. func_notquiet_error_hdr ()
  2252. {
  2253. $debug_cmd
  2254. my_msg_var=$1; shift
  2255. test -n "$*" || return
  2256. func_notquiet_once "$my_msg_var"
  2257. func_error "$*"
  2258. exit_status=$EXIT_FAILURE
  2259. }
  2260. # func_copy FILENAME SRCDIR DESTDIR [MSG_VAR [FILTER]]
  2261. # ----------------------------------------------------
  2262. # If option '--copy' was specified, or soft-linking SRCFILE to DESTFILE
  2263. # fails, then try to copy SRCFILE to DESTFILE (making sure to update the
  2264. # timestamp so that a series of files with dependencies can be copied
  2265. # in the right order that their timestamps won't trigger rebuilds). If
  2266. # FILTER is non-empty, it is a sed script to apply to SRCFILE as it is
  2267. # copied. MSG_VAR names a variable for use with func_notquiet_hdr.
  2268. func_copy ()
  2269. {
  2270. $debug_cmd
  2271. my_filename=$1
  2272. my_srcdir=$2
  2273. my_destdir=$3
  2274. my_msg_var=$4
  2275. my_filter=$5
  2276. my_srcfile=$my_srcdir/$my_filename
  2277. my_destfile=$my_destdir/$my_filename
  2278. # Libtool is probably misinstalled if this happens:
  2279. test -f "$my_srcfile" || {
  2280. func_notquiet_error_hdr "$my_msg_var" "'$my_srcfile' not found"
  2281. return 1
  2282. }
  2283. # Require --force to remove existing $my_destfile.
  2284. $opt_force && $RM "$my_destfile"
  2285. test -f "$my_destfile" && {
  2286. func_notquiet_error_hdr "$my_msg_var" \
  2287. "'$my_destfile' exists: use '--force' to overwrite"
  2288. return 1
  2289. }
  2290. # Be careful to support 'func_copy dir/target srcbase destbase'.
  2291. func_dirname "$my_destfile"
  2292. func_mkdir_p "$func_dirname_result"
  2293. # Filters always take priority.
  2294. if test -n "$my_filter"; then
  2295. if $opt_dry_run || $SED -e "$my_filter" "$my_srcfile" > "$my_destfile" 2>/dev/null
  2296. then
  2297. func_notquiet_once "$my_msg_var"
  2298. if $opt_verbose; then
  2299. func_notquiet "$SED -e '$my_filter' $my_srcfile > $my_destfile"
  2300. else
  2301. func_notquiet "creating file '$my_destfile'"
  2302. fi
  2303. else
  2304. func_notquiet_error_hdr "$my_msg_var" "creating '$my_destfile' from '$my_srcfile' failed"
  2305. return 1
  2306. fi
  2307. return 0
  2308. fi
  2309. # Otherwise copy or link according to '--copy' option.
  2310. if $opt_copy; then
  2311. my_copycmd=$CP
  2312. my_copy_type=copying
  2313. else
  2314. my_copycmd=$LN_S
  2315. my_copy_type=linking
  2316. fi
  2317. my_copy_msg="$my_copy_type file '$my_destfile'"
  2318. $opt_verbose && my_copy_msg="$my_copycmd $my_srcfile $my_destdir"
  2319. if $opt_dry_run || $my_copycmd "$my_srcfile" "$my_destfile" 2>/dev/null
  2320. then
  2321. func_notquiet_hdr "$my_msg_var" "$my_copy_msg"
  2322. else
  2323. func_notquiet_error_hdr "$my_msg_var" \
  2324. "$my_copy_type '$my_srcdir/$my_filename' to '$my_destdir/' failed"
  2325. return 1
  2326. fi
  2327. }
  2328. # func_included_files SEARCHFILE
  2329. # ------------------------------
  2330. # Output INCLUDEFILE if SEARCHFILE m4_includes it, else output SEARCHFILE.
  2331. func_included_files ()
  2332. {
  2333. $debug_cmd
  2334. my_searchfile=$1
  2335. my_include_regex=
  2336. my_sed_include='
  2337. /^m4_include(\[.*\])$/ {
  2338. s|^m4_include(\[\(.*\)\])$|\1|
  2339. p
  2340. }
  2341. d'
  2342. if test -f "$my_searchfile"; then
  2343. $ECHO "$my_searchfile"
  2344. # Only recurse when we don't care if all the variables we use get
  2345. # trashed, since they are in global scope.
  2346. for my_filename in `$SED "$my_sed_include" "$my_searchfile"`; do
  2347. func_included_files $my_filename
  2348. done
  2349. fi
  2350. }
  2351. # func_serial FILENAME [MACRO_REGEX]
  2352. # ----------------------------------
  2353. # Output the value of the serial number comment in FILENAME, where the
  2354. # comment line must also match MACRO_REGEX, if given.
  2355. func_serial ()
  2356. {
  2357. $debug_cmd
  2358. my_filename=$1
  2359. my_macro_regex=$2
  2360. my_sed_serial='
  2361. /^# serial [1-9][0-9.]*[ ]*'"$my_macro_regex"'[ ]*$/ {
  2362. s|^# serial \([1-9][0-9.]*\).*$|\1|
  2363. q
  2364. }
  2365. d'
  2366. # Search FILENAME and all the files it m4_includes for a serial number
  2367. # in the file that AC_DEFUNs MACRO_REGEX.
  2368. my_serial=
  2369. func_dirname_and_basename "$my_filename"
  2370. my_filebase=$func_basename_result
  2371. for my_file in `func_included_files "$my_filename"`; do
  2372. if test -z "$my_macro_regex" ||
  2373. test aclocal.m4 = "$my_filename" ||
  2374. test "X$my_macro_regex" = "X$my_filebase" ||
  2375. func_grep '^AC_DEFUN(\['"$my_macro_regex" "$my_file"
  2376. then
  2377. my_serial=`$SED -e "$my_sed_serial" "$my_file"`
  2378. break
  2379. fi
  2380. done
  2381. # If the file has no serial number, we assume it's ancient.
  2382. test -n "$my_serial" || my_serial=0
  2383. $ECHO "$my_serial"
  2384. }
  2385. # func_serial_max SERIAL1 SERIAL2
  2386. # -------------------------------
  2387. # Compare (possibly multi-part, '.' delimited) serial numbers, and
  2388. # return the largest in $func_serial_max_result. If they are the
  2389. # same, func_serial_max_result will be empty.
  2390. func_serial_max ()
  2391. {
  2392. $debug_cmd
  2393. my_serial1=$1
  2394. my_serial2=$2
  2395. my_sed_dot='s/\..*$//g'
  2396. my_sed_rest='s/^[0-9][1-9]*\.*//'
  2397. my_sed_digits='s/[^0-9.]//g'
  2398. # Incase they turn out to be the same, we'll set it to empty
  2399. func_serial_max_result=
  2400. test "X$1$2" = X`$ECHO "$1$2" | $SED "$my_sed_digits"` || {
  2401. func_error "serial numbers '$1' or '$2' contain non-digit chars"
  2402. return
  2403. }
  2404. while test -n "$my_serial1$my_serial2"; do
  2405. my_serial1_part=`$ECHO "$my_serial1" | $SED "$my_sed_dot"`
  2406. my_serial2_part=`$ECHO "$my_serial2" | $SED "$my_sed_dot"`
  2407. test -z "$my_serial1_part$my_serial2_part" \
  2408. && break
  2409. test -z "$my_serial1_part" \
  2410. && { func_serial_max_result=$2; break; }
  2411. test -z "$my_serial2_part" \
  2412. && { func_serial_max_result=$1; break; }
  2413. test "$my_serial1_part" -gt "$my_serial2_part" \
  2414. && { func_serial_max_result=$1; break; }
  2415. test "$my_serial2_part" -gt "$my_serial1_part" \
  2416. && { func_serial_max_result=$2; break; }
  2417. my_serial1=`$ECHO "$my_serial1" | $SED "$my_sed_rest"`
  2418. my_serial2=`$ECHO "$my_serial2" | $SED "$my_sed_rest"`
  2419. done
  2420. }
  2421. # func_serial_update_check SRCFILE SRC_SERIAL DESTFILE DEST_SERIAL
  2422. # ----------------------------------------------------------------
  2423. # Unless SRC_SERIAL is newer than DEST_SERIAL set $func_serial_update_check
  2424. # to 'false'.
  2425. func_serial_update_check ()
  2426. {
  2427. $debug_cmd
  2428. $require_ac_ltdl_dir
  2429. $require_ac_macro_dir
  2430. my_srcfile=$1
  2431. my_src_serial=$2
  2432. my_destfile=$3
  2433. my_dest_serial=$4
  2434. my_update_p=:
  2435. if test -f "$my_destfile"; then
  2436. test 0 = "$my_src_serial" && {
  2437. func_warning file "no serial number on '$my_srcfile', not copying."
  2438. return
  2439. }
  2440. # Determine whether the destination has an older serial.
  2441. func_serial_max "$my_src_serial" "$my_dest_serial"
  2442. test "X$my_src_serial" = "X$func_serial_max_result" || my_update_p=false
  2443. test "X$my_src_serial" = "X$func_serial_max_result" \
  2444. && func_verbose "'$my_srcfile' is serial $my_src_serial, greater than $my_dest_serial in '$my_destfile'"
  2445. if test "X$my_dest_serial" = "X$func_serial_max_result"; then
  2446. func_verbose "'$my_srcfile' is serial $my_src_serial, less than $my_dest_serial in '$my_destfile'"
  2447. $opt_force || if test -n "$ac_macro_dir$ac_ltdl_dir"; then
  2448. func_error "'$my_destfile' is newer: use '--force' to overwrite"
  2449. fi
  2450. fi
  2451. fi
  2452. func_serial_update_check_result=$my_update_p
  2453. }
  2454. # func_aclocal_update_check FILENAME
  2455. # ----------------------------------
  2456. # Unless serial number of FILENAME is newer than the matching serial number
  2457. # in aclocal.m4, set $func_aclocal_update_check to 'false'.
  2458. func_aclocal_update_check ()
  2459. {
  2460. $debug_cmd
  2461. my_filename=$1
  2462. my_srcfile=$aclocaldir/$1
  2463. my_destfile=aclocal.m4
  2464. case $my_filename in
  2465. libtool.m4)
  2466. my_src_serial=`func_serial "$my_srcfile" LT_INIT`
  2467. my_dest_serial=`func_serial "$my_destfile" LT_INIT`
  2468. # Strictly, this libtoolize ought not to have to deal with ancient
  2469. # serial formats, but we accept them here to be complete:
  2470. test 0 = "$my_src_serial" &&
  2471. my_src_serial=`func_serial "$my_srcfile" 'A[CM]_PROG_LIBTOOL'`
  2472. test 0 = "$my_dest_serial" &&
  2473. my_dest_serial=`func_serial "$my_destfile" 'A[CM]_PROG_LIBTOOL'`
  2474. ;;
  2475. ltdl.m4)
  2476. my_src_serial=`func_serial "$my_srcfile" LTDL_INIT`
  2477. my_dest_serial=`func_serial "$my_destfile" LTDL_INIT`
  2478. ;;
  2479. *)
  2480. my_src_serial=`func_serial "$my_srcfile" "$my_filename"`
  2481. my_dest_serial=`func_serial "$my_destfile" "$my_filename"`
  2482. ;;
  2483. esac
  2484. func_serial_update_check \
  2485. "$my_srcfile" "$my_src_serial" "$my_destfile" "$my_dest_serial"
  2486. func_aclocal_update_check_result=$func_serial_update_check_result
  2487. }
  2488. # func_serial_update FILENAME SRCDIR DESTDIR [MSG_VAR] [MACRO_RE] [OLD_MACRO_RE]
  2489. # ------------------------------------------------------------------------------
  2490. # Copy the FILENAME from a SRCDIR to DESTDIR provided that either FILENAME
  2491. # has a newer serial number, or DESTFILE does not yet exist, or the user
  2492. # specified '--force' at the command line. If given, MACRO_REGEX or
  2493. # OLD_MACRO_REGEX must match any text after "# serial N" in both files.
  2494. func_serial_update ()
  2495. {
  2496. $debug_cmd
  2497. my_filename=$1
  2498. my_srcdir=$2
  2499. my_destdir=$3
  2500. my_msg_var=$4
  2501. my_macro_regex=$5
  2502. my_old_macro_regex=$6
  2503. my_serial_update_p=:
  2504. my_return_status=1
  2505. my_srcfile=$my_srcdir/$my_filename
  2506. my_destfile=$my_destdir/$my_filename
  2507. test -f "$my_srcfile" || func_fatal_error "'$my_srcfile' does not exist."
  2508. if test -f "$my_destfile"; then
  2509. my_src_serial=`func_serial "$my_srcfile" "$my_macro_regex"`
  2510. my_dest_serial=`func_serial "$my_destfile" "$my_macro_regex"`
  2511. # Strictly, this libtoolize ought not to have to deal with ancient
  2512. # serial formats, but we accept them here to be complete:
  2513. test 0 = "$my_src_serial" &&
  2514. my_src_serial=`func_serial "$my_srcfile" "$my_old_macro_regex"`
  2515. test 0 = "$my_dest_serial" &&
  2516. my_dest_serial=`func_serial "$my_destfile" "$my_old_macro_regex"`
  2517. func_serial_update_check \
  2518. "$my_srcfile" "$my_src_serial" "$my_destfile" "$my_dest_serial"
  2519. my_serial_update_p=$func_serial_update_check_result
  2520. fi
  2521. if $my_serial_update_p || $opt_force; then
  2522. $RM "$my_destfile"
  2523. func_copy "$my_filename" "$my_srcdir" "$my_destdir" "$my_msg_var"
  2524. my_return_status=$?
  2525. elif $opt_force && test "X$my_dest_serial" = "X$my_src_serial"; then
  2526. func_notquiet_hdr "$my_msg_var" "'$my_destfile' is already up to date."
  2527. fi
  2528. # Do this after the copy for hand maintained 'aclocal.m4', incase
  2529. # it has 'm4_include([DESTFILE])', so the copy effectively already
  2530. # updated 'aclocal.m4'.
  2531. my_included_files=`func_included_files aclocal.m4`
  2532. case `echo " "$my_included_files" "` in
  2533. # Skip included files:
  2534. *" $my_destfile "*) ;;
  2535. # Otherwise compare to aclocal.m4 serial number (func_serial
  2536. # returns 0 for older macro serial numbers before we provided
  2537. # serial tags, so the update message will be correctly given
  2538. # if aclocal.m4 contains an untagged --i.e older-- macro file):
  2539. *)
  2540. if test -f aclocal.m4; then
  2541. func_serial_max \
  2542. "$my_src_serial" `func_serial aclocal.m4 "$my_macro_regex"`
  2543. if test "X$my_src_serial" = "X$func_serial_max_result"; then
  2544. func_notquiet_hdr "$my_msg_var" \
  2545. "You should add the contents of '$my_destfile' to 'aclocal.m4'."
  2546. fi
  2547. fi
  2548. ;;
  2549. esac
  2550. return $my_return_status
  2551. }
  2552. # func_keyword_update FILENAME SRCDIR DESTDIR SED_SCRIPT [MSG_VAR]
  2553. # ----------------------------------------------------------------
  2554. # Copy the FILENAME from a SRCDIR to DESTDIR provided that either FILENAME
  2555. # has a newer revision according to the serial number extracted by
  2556. # SED_SCRIPT, or DESTFILE does not yet exist, or the user specified
  2557. # '--force' at the command line.
  2558. func_keyword_update ()
  2559. {
  2560. $debug_cmd
  2561. my_filename=$1
  2562. my_srcdir=$2
  2563. my_destdir=$3
  2564. my_sed_script=$4
  2565. my_msg_var=$5
  2566. my_srcfile=$my_srcdir/$my_filename
  2567. my_destfile=$my_destdir/$my_filename
  2568. my_keyword_update_p=:
  2569. test -f "$my_srcfile" || func_fatal_error "'$my_srcfile' does not exist."
  2570. if test -f "$my_destfile"; then
  2571. my_src_serial=`$SED -e "$my_sed_script" "$my_srcfile"`
  2572. test -z "$my_src_serial" && {
  2573. func_warning file "no serial number in '$my_srcfile', not copying."
  2574. return
  2575. }
  2576. my_dest_serial=`$SED -e "$my_sed_script" "$my_destfile"`
  2577. test -n "$my_dest_serial" || my_dest_serial=0
  2578. func_serial_update_check \
  2579. "$my_srcfile" "$my_src_serial" "$my_destfile" "$my_dest_serial"
  2580. my_keyword_update_p=$func_serial_update_check_result
  2581. fi
  2582. if $my_keyword_update_p || $opt_force; then
  2583. $RM "$my_destfile"
  2584. func_copy "$my_filename" "$my_srcdir" "$my_destdir" "$my_msg_var"
  2585. elif $opt_verbose || $opt_force && test "X$my_dest_serial" = "X$my_src_serial"; then
  2586. func_notquiet_hdr "$my_msg_var" "'$my_destfile' is already up to date."
  2587. fi
  2588. }
  2589. # func_ltmain_update FILENAME SRCDIR DESTDIR [MSG_VAR]
  2590. # ----------------------------------------------------
  2591. # Copy the FILENAME from a SRCDIR to DESTDIR provided that either FILENAME
  2592. # has a newer revision, or DESTFILE does not yet exist, or the user
  2593. # specified '--force' at the command line.
  2594. func_ltmain_update ()
  2595. {
  2596. $debug_cmd
  2597. my_sed_ltmain='
  2598. /^package_revision='\''*[0-9][1-9.]*'\''*/ {
  2599. s|^package_revision='\''*\([0-9.]*\)'\''*[ ]*$|\1|
  2600. p
  2601. }
  2602. d'
  2603. func_keyword_update "$1" "$2" "$3" "$my_sed_ltmain" "$4"
  2604. return $my_return_status
  2605. }
  2606. # func_config_update FILENAME SRCDIR DESTDIR [MSG_VAR]
  2607. # ----------------------------------------------------
  2608. # Copy the FILENAME from a SRCDIR to DESTDIR provided that either FILENAME
  2609. # has a newer timestamp, or DESTFILE does not yet exist, or the user
  2610. # specified '--force' at the command line.
  2611. func_config_update ()
  2612. {
  2613. $debug_cmd
  2614. my_sed_config='
  2615. /^timestamp='\''*[0-9][1-9-]*'\''*/ {
  2616. s|^timestamp='\''*\([0-9-]*\)'\''*|\1|
  2617. s|-|.|g
  2618. p
  2619. }
  2620. d'
  2621. func_keyword_update "$1" "$2" "$3" "$my_sed_config" "$4"
  2622. return $my_return_status
  2623. }
  2624. # func_install_update FILENAME SRCDIR DESTDIR [MSG_VAR]
  2625. # -----------------------------------------------------
  2626. # Copy the FILENAME from a SRCDIR to DESTDIR provided that either FILENAME
  2627. # has a newer timestamp, or DESTFILE does not yet exist, or the user
  2628. # specified '--force' at the command line.
  2629. func_install_update ()
  2630. {
  2631. $debug_cmd
  2632. my_sed_install='
  2633. /^scriptversion='\''*[0-9][1-9.-]*'\''*/ {
  2634. s|[#;].*||
  2635. s|^scriptversion='\''*\([0-9.-]*\)'\''*|\1|
  2636. s|-|.|g
  2637. p
  2638. }
  2639. d'
  2640. func_keyword_update "$1" "$2" "$3" "$my_sed_install" "$4"
  2641. return $my_return_status
  2642. }
  2643. # func_install_pkgmacro_files
  2644. # ---------------------------
  2645. # Install copies of the libtool and libltdl m4 macros into this package.
  2646. func_install_pkgmacro_files ()
  2647. {
  2648. $debug_cmd
  2649. $require_ac_macro_dir
  2650. $require_am_macro_dir
  2651. $require_ltdl_mode
  2652. $require_macro_dir
  2653. $opt_ltdl || test -n "$ac_macro_dir$am_macro_dir" || return
  2654. # Remove any lingering files that my have been installed by some
  2655. # previous libtoolize release:
  2656. $opt_force && for file in $all_pkgmacro_files; do
  2657. test -f "$macro_dir/$file" && func_verbose "rm -f '$macro_dir/$file'"
  2658. rm -f "$macro_dir/$file"
  2659. done
  2660. # Install the libltdl autoconf macros to this project's source tree.
  2661. $opt_quiet || if test -n "$ac_macro_dir"; then
  2662. my_pkgmacro_header="putting macros in AC_CONFIG_MACRO_DIRS, '$ac_macro_dir'."
  2663. else
  2664. my_pkgmacro_header="putting macros in '$macro_dir'."
  2665. fi
  2666. for file in $pkgmacro_files; do
  2667. case $file in
  2668. libtool.m4)
  2669. func_serial_update "$file" "$aclocaldir" "$macro_dir" \
  2670. my_pkgmacro_header LT_INIT 'A[CM]_PROG_LIBTOOL'
  2671. ;;
  2672. ltdl.m4)
  2673. if $opt_ltdl; then
  2674. func_serial_update "$file" "$aclocaldir" "$macro_dir" \
  2675. my_pkgmacro_header 'LTDL_INIT'
  2676. else
  2677. func_verbose "Not copying '$macro_dir/$file', libltdl not used."
  2678. fi
  2679. ;;
  2680. ltoptions.m4|ltsugar.m4|ltversion.m4|lt~obsolete.m4)
  2681. func_serial_update "$file" "$aclocaldir" "$macro_dir" \
  2682. my_pkgmacro_header "$file"
  2683. ;;
  2684. *)
  2685. if $opt_ltdl; then
  2686. func_serial_update "$file" "$aclocaldir" "$macro_dir" \
  2687. my_pkgmacro_header "$file"
  2688. else
  2689. func_verbose "Not copying '$macro_dir/$file', libltdl not used."
  2690. fi
  2691. ;;
  2692. esac
  2693. done
  2694. }
  2695. # func_install_pkgltdl_files
  2696. # --------------------------
  2697. # Install copies of the libltdl files into this package. Any auxiliary
  2698. # or m4 macro files needed in the libltdl tree will also be copied by
  2699. # func_install_pkgaux_files and func_install_pkgmacro_files resp.
  2700. func_install_pkgltdl_files ()
  2701. {
  2702. $debug_cmd
  2703. $opt_ltdl || return
  2704. $require_ac_ltdl_dir
  2705. $require_ltdl_dir
  2706. $require_ltdl_mode
  2707. # Remove any lingering files that my have been installed by some
  2708. # previous libtoolize release:
  2709. $opt_force && for file in $all_pkgltdl_files; do
  2710. test -f "$ltdl_dir/$file" && func_verbose "rm -f '$ltdl_dir/$file'"
  2711. rm -f "$ltdl_dir/$file"
  2712. done
  2713. # Copy all the files from installed libltdl to this project, if the
  2714. # user specified '--ltdl'.
  2715. $opt_quiet || if test -n "$ac_ltdl_dir"; then
  2716. pkgltdl_header="putting libltdl files in LT_CONFIG_LTDL_DIR, '$ac_ltdl_dir'."
  2717. else
  2718. pkgltdl_header="putting libltdl files in '$ltdl_dir'."
  2719. fi
  2720. $require_filter_Makefile_am
  2721. $require_filter_ltdl_mk
  2722. # Copy ltdl sources appropriate to the requested ltdl_mode.
  2723. for file in $pkgltdl_files; do
  2724. my_copy_filter=
  2725. case $file in
  2726. Makefile.am|Makefile.in)
  2727. test nonrecursive = "$ltdl_mode" && continue
  2728. my_copy_filter=$filter_Makefile_am
  2729. ;;
  2730. ltdl.mk)
  2731. test nonrecursive = "$ltdl_mode" || continue
  2732. my_copy_filter=$filter_ltdl_mk
  2733. ;;
  2734. aclocal.m4)
  2735. test subproject = "$ltdl_mode" && {
  2736. $require_filter_aclocal_m4
  2737. # Always copy aclocal.m4, otherwise regenerating it can
  2738. # overwrite the destination if it is symlinked.
  2739. ( opt_copy=:
  2740. func_copy "$file" "$pkgltdldir" "$ltdl_dir" \
  2741. pkgltdl_header "$filter_aclocal_m4"
  2742. )
  2743. }
  2744. continue
  2745. ;;
  2746. config-h.in)
  2747. test subproject = "$ltdl_mode" || continue
  2748. ;;
  2749. configure)
  2750. test subproject = "$ltdl_mode" && {
  2751. $require_filter_configure_ac
  2752. # Always copy configure, otherwise regenerating it can
  2753. # overwrite the destination if it is symlinked.
  2754. ( opt_copy=:
  2755. func_copy "$file" "$pkgltdldir" "$ltdl_dir" \
  2756. pkgltdl_header "$filter_configure_ac"
  2757. )
  2758. }
  2759. continue
  2760. ;;
  2761. configure.ac)
  2762. test subproject = "$ltdl_mode" || continue
  2763. $require_filter_configure_ac
  2764. my_copy_filter=$filter_configure_ac
  2765. ;;
  2766. esac
  2767. # Still here? Copy the file then, with selected filters.
  2768. func_copy "$file" "$pkgltdldir" "$ltdl_dir" \
  2769. pkgltdl_header "$my_copy_filter"
  2770. # FIXME: Remove in 2013
  2771. # (along with deprecation warning in func_check_macros)
  2772. test ltdl.mk = "$file" \
  2773. && func_grep "^-\?include $ltdl_dir/Makefile.inc\$" Makefile.am \
  2774. && mv "$ltdl_dir/$file" "$ltdl_dir/Makefile.inc" \
  2775. && func_notquiet "renaming file '$ltdl_dir/Makefile.inc'"
  2776. done
  2777. }
  2778. # func_install_pkgaux_files
  2779. # -------------------------
  2780. # Install copies of the auxiliary files into this package according to
  2781. # the whether libltdl is included as a subproject, and whether the parent
  2782. # shares the AC_CONFIG_AUX_DIR setting.
  2783. func_install_pkgaux_files ()
  2784. {
  2785. $debug_cmd
  2786. $require_ac_aux_dir
  2787. $require_aux_dir
  2788. $require_configure_ac
  2789. $require_ltdl_mode
  2790. # Remove any lingering files that my have been installed by some
  2791. # previous libtoolize release:
  2792. $opt_force && for file in $all_pkgaux_files; do
  2793. test -f "$aux_dir/$file" && func_verbose "rm -f '$aux_dir/$file'"
  2794. rm -f "$aux_dir/$file"
  2795. done
  2796. if test -n "$ac_aux_dir"; then
  2797. pkgaux_header="putting auxiliary files in AC_CONFIG_AUX_DIR, '$ac_aux_dir'."
  2798. else
  2799. pkgaux_header="putting auxiliary files in '$aux_dir'."
  2800. fi
  2801. for file in $pkgaux_files; do
  2802. case $file in
  2803. config.guess|config.sub)
  2804. $opt_install || test subproject = "$ltdl_mode" || continue
  2805. func_config_update "$file" "$pkgauxdir" "$aux_dir" pkgaux_header
  2806. ;;
  2807. install-sh)
  2808. $opt_install || test subproject = "$ltdl_mode" || continue
  2809. func_install_update "$file" "$pkgauxdir" "$aux_dir" pkgaux_header
  2810. ;;
  2811. ltmain.sh)
  2812. func_ltmain_update "$file" "$pkgauxdir" "$aux_dir" pkgaux_header
  2813. ;;
  2814. *)
  2815. test subproject = "$ltdl_mode" || continue
  2816. func_copy "$file" "$pkgauxdir" "$aux_dir" pkgaux_header
  2817. ;;
  2818. esac
  2819. done
  2820. # If the parent project is using Autoconf and linking with Libtool,
  2821. # even if subproject libltdl already has a copy, the parent project
  2822. # will still need to build libtool for its own purposes, and might
  2823. # need another copy of ltmain.sh if the parent didn't declare an
  2824. # AC_CONFIG_AUX_DIR.
  2825. pkgaux_hdr="putting another copy of auxiliary files in '.'"
  2826. test -f "$configure_ac" \
  2827. && test -z "$ac_aux_dir" \
  2828. && test subproject = "$ltdl_mode" \
  2829. && test "$aux_dir" = "$ltdl_dir" \
  2830. && func_ltmain_update "$file" "$pkgauxdir" . pkgaux_hdr
  2831. # FIXME: Remove in 2013.
  2832. # Very old parent projects using 'libtoolize --install --ltdl', and
  2833. # a top-level $configure_ac to build the ltdl subproject, but not
  2834. # using Automake themselves, might still be relying on the old
  2835. # behaviour of libtoolize to put a second copy of some 'Auxiliary
  2836. # Programs' needed by the top-level configure (instead of using
  2837. # the recommended method: 'automake --add-missing').
  2838. test -f "$configure_ac" \
  2839. && test subproject = "$ltdl_mode" \
  2840. && test "$aux_dir" = "$ltdl_dir" \
  2841. && func_config_update config.guess "$pkgauxdir" . pkgaux_hdr \
  2842. && func_config_update config.sub "$pkgauxdir" . pkgaux_hdr \
  2843. && func_install_update install-sh "$pkgauxdir" . pkgaux_hdr
  2844. }
  2845. # func_nonemptydir_p DIRVAR
  2846. # -------------------------
  2847. # DIRVAR is the name of a variable to evaluate. Unless DIRVAR names
  2848. # a directory that exists and is non-empty abort with a diagnostic.
  2849. func_nonemptydir_p ()
  2850. {
  2851. $debug_cmd
  2852. my_dirvar=$1
  2853. my_dir=`eval echo "\\\$$my_dirvar"`
  2854. # Is it a directory at all?
  2855. test -d "$my_dir" \
  2856. || func_fatal_error "\$$my_dirvar is not a directory: '$my_dir'"
  2857. # check that the directories contents can be ls'ed
  2858. test -n "`{ cd $my_dir && ls; } 2>/dev/null`" \
  2859. || func_fatal_error "cannot list files: '$my_dir'"
  2860. }
  2861. # func_check_macros
  2862. # -----------------
  2863. # Sanity check macros from aclocal.m4 against installed versions.
  2864. func_check_macros ()
  2865. {
  2866. $debug_cmd
  2867. $require_ac_ltdl_dir
  2868. $require_ac_macro_dir
  2869. $require_am_macro_dir
  2870. $require_aux_dir
  2871. $require_configure_ac
  2872. $require_ltdl_dir
  2873. $require_ltdl_mode
  2874. $require_macro_dir
  2875. $require_seen_ltdl
  2876. $require_seen_libtool
  2877. $opt_quiet && return
  2878. test -n "$configure_ac" || return
  2879. ac_config_macro_dir_advised=false
  2880. if test -z "$ac_macro_dir$am_macro_dir"; then
  2881. my_missing=
  2882. for file in $pkgmacro_files; do
  2883. case $file in
  2884. ltargz.m4|ltdl.m4) $opt_ltdl || continue ;;
  2885. esac
  2886. if test -f "aclocal.m4"; then
  2887. func_aclocal_update_check $file
  2888. $func_aclocal_update_check_result || continue
  2889. fi
  2890. my_missing="$my_missing $file"
  2891. done
  2892. if test -n "$my_missing"; then
  2893. func_echo "You should add the contents of the following files to 'aclocal.m4':"
  2894. for need in $my_missing; do
  2895. func_echo " '$aclocaldir/$need'"
  2896. done
  2897. fi
  2898. fi
  2899. ## ---------------------------------------------------------- ##
  2900. ## Since we return early here when --no-warn was given: ##
  2901. ## DO NOT PUT ANYTHING BUT UPGRADE ADVICE MESSAGES BELOW HERE ##
  2902. ## ---------------------------------------------------------- ##
  2903. test " none" = "$opt_warning_types" && return
  2904. $seen_libtool ||
  2905. func_echo "Remember to add 'LT_INIT' to $configure_ac."
  2906. # Suggest using LTDL_INIT if appropriate:
  2907. $opt_ltdl && if test : != "$seen_ltdl"; then
  2908. case $ltdl_mode in
  2909. subproject) ltdl_init_args= ;;
  2910. *) ltdl_init_args="([$ltdl_mode])" ;;
  2911. esac
  2912. func_echo "Remember to add 'LTDL_INIT$ltdl_init_args' to $configure_ac."
  2913. fi
  2914. if $opt_ltdl; then
  2915. # Remind the user to call LT_CONFIG_LTDL_DIR:
  2916. test -n "$ac_ltdl_dir" ||
  2917. func_echo "Remember to add 'LT_CONFIG_LTDL_DIR([$ltdl_dir])' to '$configure_ac'."
  2918. # For nonrecursive mode, warn about continued use of Makefile.inc:
  2919. # FIXME: Remove in 2013
  2920. # (along with last minute rename in func_install_pkgltdl_files)
  2921. if test nonrecursive = "$ltdl_mode"; then
  2922. if func_grep "^-\?include $ltdl_dir/Makefile.inc\$" Makefile.am;
  2923. then
  2924. func_error "Use of 'include $ltdl_dir/Makefile.inc' is deprecated!"
  2925. func_echo "Consider updating to use of 'include $ltdl_dir/ltdl.mk' in Makefile.am."
  2926. fi
  2927. fi
  2928. fi
  2929. # Suggest modern idioms for storing autoconf macros:
  2930. $ac_config_macro_dir_advised || if test -z "$macro_dir" || test . = "$macro_dir"; then
  2931. func_echo "Consider adding 'AC_CONFIG_MACRO_DIRS([m4])' to $configure_ac and"
  2932. func_echo "rerunning $progname, to keep the correct libtool macros in-tree."
  2933. ac_config_macro_dir_advised=:
  2934. elif test -z "$ac_macro_dir"; then
  2935. func_echo "Consider adding 'AC_CONFIG_MACRO_DIRS([$macro_dir])' to $configure_ac,"
  2936. func_echo "and rerunning $progname and aclocal."
  2937. ac_config_macro_dir_advised=:
  2938. fi
  2939. if test -z "$am_macro_dir$ac_macro_dir"; then
  2940. func_echo "Consider adding '-I m4' to ACLOCAL_AMFLAGS in Makefile.am."
  2941. elif test -z "$am_macro_dir"; then
  2942. func_echo "Consider adding '-I $macro_dir' to ACLOCAL_AMFLAGS in Makefile.am."
  2943. fi
  2944. # Don't trace for this, we're just checking the user didn't invoke it
  2945. # directly from configure.ac.
  2946. $SED 's|dnl .*$||; s|# .*$||' "$configure_ac" | $GREP AC_PROG_RANLIB >/dev/null &&
  2947. func_echo "'AC_PROG_RANLIB' is rendered obsolete by 'LT_INIT'"
  2948. # FIXME: Ensure ltmain.sh, libtool.m4 and ltdl.m4 are from the same release
  2949. }
  2950. ## ------------------##
  2951. ## Helper functions. ##
  2952. ## ------------------##
  2953. # This section contains the helper functions used by the rest of
  2954. # this script.
  2955. # func_autoconf_configure MAYBE-CONFIGURE-FILE
  2956. # --------------------------------------------
  2957. # Ensure that MAYBE-CONFIGURE-FILE is the name of a file in the current
  2958. # directory that contains an uncommented call to AC_INIT.
  2959. func_autoconf_configure ()
  2960. {
  2961. $debug_cmd
  2962. _G_sed_no_comment='s|#.*$||; s|^dnl .*$||; s| dnl .*$||;'
  2963. _G_ac_init=
  2964. # If we were passed a genuine file, make sure it calls AC_INIT.
  2965. test -f "$1" \
  2966. && _G_ac_init=`$SED "$_G_sed_no_comment" "$1" |$GREP AC_INIT`
  2967. # Otherwise it is not a genuine Autoconf input file.
  2968. test -n "$_G_ac_init"
  2969. _G_status=$?
  2970. test 0 -ne "$_G_status" \
  2971. && func_verbose "'$1' not using Autoconf"
  2972. (exit $_G_status)
  2973. }
  2974. # func_make_relative_dir_filter CURRDIR SRCDIR DESTDIR [PREFIX [SUFFIX]]
  2975. # ----------------------------------------------------------------------
  2976. # Make a sed script suitable for appending to a copy filter, which will
  2977. # replace occurrences of CURRDIR with the relative path from SRCDIR to
  2978. # DESTDIR if they are different, otherwise the result is the empty
  2979. # string:
  2980. #
  2981. # func_make_relative_dir_filter ltdl config ../build-aux
  2982. # => 's|\.\./build-aux|../config|g'
  2983. # func_make_relative_dir_filter ltdl ltdl/m4 ../m4
  2984. # => 's|\.\./m4|m4|g'
  2985. # func_make_relative_dir_filter libltdl build-aux ../build-aux
  2986. # => ''
  2987. #
  2988. # If PREFIX (and SUFFIX) are passed they are prepended (and appended)
  2989. # to the match and replacement expressions literally:
  2990. #
  2991. # func_make_relative_dir_filter ltdl ltdl/m4 ../m4 '-I ' ' '
  2992. # => 's|-I \.\./m4 |-I m4 |g'
  2993. func_make_relative_dir_filter ()
  2994. {
  2995. $debug_cmd
  2996. my_currdir=$1
  2997. my_srcdir=$2
  2998. my_destdir=$3
  2999. func_relative_path "$my_srcdir" "$my_destdir"
  3000. if test "$my_currdir" = "$func_relative_path_result"; then
  3001. func_make_relative_dir_filter_result=
  3002. else
  3003. my_match_currdir=`$ECHO "$my_currdir" |$SED "$sed_make_literal_regex"`
  3004. # Avoid substituting with 'dir/./file' when current dir is '.'.
  3005. if test . = "$my_currdir"; then
  3006. func_make_relative_dir_filter_result="
  3007. s|$4$my_match_currdir/$5|$4$5|g"
  3008. else
  3009. func_make_relative_dir_filter_result="
  3010. s|$4$my_match_currdir$5|$4$func_relative_path_result$5|g"
  3011. fi
  3012. fi
  3013. }
  3014. # func_make_relative_ltdl_filter CURRDIR DESTDIR [PREFIX [SUFFIX]]
  3015. # ----------------------------------------------------------------
  3016. # As 'func_make_relative_dir_filter' optimised for the common case where
  3017. # SRCDIR is '$ltdl_dir'.
  3018. func_make_relative_ltdl_filter ()
  3019. {
  3020. $debug_cmd
  3021. $require_ltdl_dir
  3022. func_make_relative_dir_filter "$1" "$ltdl_dir" "$2" "$3" "$4"
  3023. func_make_relative_ltdl_filter_result=$func_make_relative_dir_filter_result
  3024. }
  3025. ## -------------------- ##
  3026. ## Resource management. ##
  3027. ## -------------------- ##
  3028. # This section contains definitions for functions that each ensure a
  3029. # particular resource (a file, or a non-empty configuration variable for
  3030. # example) is available, and if appropriate to extract default values
  3031. # from pertinent package files. Where a variable already has a non-
  3032. # empty value (as set by the package's 'bootstrap.conf'), that value is
  3033. # used in preference to deriving the default. Call them using their
  3034. # associated 'require_*' variable to ensure that they are executed, at
  3035. # most, once.
  3036. #
  3037. # Some of the require functions are very similar, so we generate those
  3038. # as this file is sourced. They look complicated, but they are the same
  3039. # as normal function declarations wrapped in "eval '<definition>'", so
  3040. # that embedded single quotes need to be escaped, and wherever a symbol
  3041. # is generated, we drop out of the single quotes and expand a variable
  3042. # that holds the symbol.
  3043. #
  3044. # After that, the rest appear in asciibetical order.
  3045. for base in '' ltdl_; do
  3046. if test ltdl_ = "$base"; then p='$pkgltdldir/'; else p=; fi
  3047. # require_Makefile_am
  3048. # require_ltdl_Makefile_am
  3049. # ------------------------
  3050. # If not already set, set Makefile_am to 'Makefile.am' if that file is
  3051. # present in the current directory, and similarly for
  3052. # '$pkgltdldir/Makefile.am'.
  3053. r=${base}Makefile_am
  3054. v=require_$r
  3055. f=func_$v
  3056. eval $v'='$f'
  3057. '$f' ()
  3058. {
  3059. $debug_cmd
  3060. test -n "$'$r'" || '$r'='$p'Makefile.am
  3061. if test -f "$'$r'"; then
  3062. func_verbose "found '\'\$$r\''"
  3063. else
  3064. '$r'=
  3065. fi
  3066. '$v'=:
  3067. }'
  3068. o=$r
  3069. # require_aclocal_amflags
  3070. # require_ltdl_aclocal_amflags
  3071. # ----------------------------
  3072. # Extract '$aclocal_amflags' from 'Makefile.am' if present, and
  3073. # similarly for 'libltdl/Makefile.am'.
  3074. r=${base}aclocal_amflags
  3075. v=require_$r
  3076. f=func_$v
  3077. eval $v'='$f'
  3078. '$f' ()
  3079. {
  3080. $debug_cmd
  3081. $require_'$o'
  3082. test -n "$'$o'" && {
  3083. _G_sed_extract_aclocal_amflags='\''s|#.*$||
  3084. /^[ ]*ACLOCAL_AMFLAGS[ ]*=/ {
  3085. s|^.*=[ ]*\(.*\)|'$r'="\1"|
  3086. p
  3087. }'\''
  3088. _G_aclocal_flags_cmd=`$SED -n "$_G_sed_extract_aclocal_amflags" \
  3089. "$'$o'"`
  3090. eval "$_G_aclocal_flags_cmd"
  3091. test -n "$'$r'" && func_verbose "'$r'='\$$r\''"
  3092. }
  3093. '$v'=:
  3094. }'
  3095. o=$r
  3096. # require_am_macro_dir
  3097. # require_ltdl_am_macro_dir
  3098. # -------------------------
  3099. # Set am_macro_dir to the first directory specified in
  3100. # ACLOCAL_AMFLAGS from 'Makefile.am', and similarly for
  3101. # 'libltdl/Makefile.am'.
  3102. r=${base}am_macro_dir
  3103. v=require_$r
  3104. f=func_$v
  3105. eval $v'='$f'
  3106. '$f' ()
  3107. {
  3108. $debug_cmd
  3109. $require_'$o'
  3110. _G_minus_I_seen=false
  3111. for _G_arg in $'$o'; do
  3112. case $_G_minus_I_seen,$_G_arg in
  3113. :,*) '$r'=$_G_arg; break ;;
  3114. *,-I) _G_minus_I_seen=: ;;
  3115. *,-I*) '$r'=`expr x$_G_arg : '\''x-I\(.*\)$'\''`; break ;;
  3116. esac
  3117. done
  3118. test -n "$'$r'" && func_verbose "'$r'='\'\$$r\''"
  3119. '$v'=:
  3120. }'
  3121. o=$r
  3122. done
  3123. # require_ac_aux_dir
  3124. # ------------------
  3125. # Extract ac_aux_dir from AC_CONFIG_AUX_DIR.
  3126. require_ac_aux_dir=func_require_ac_aux_dir
  3127. func_require_ac_aux_dir ()
  3128. {
  3129. $debug_cmd
  3130. $require_configure_ac
  3131. test -n "$configure_ac" && {
  3132. func_extract_trace_first AC_CONFIG_AUX_DIR
  3133. ac_aux_dir=$func_extract_trace_first_result
  3134. case $ac_aux_dir in
  3135. *\$*)
  3136. func_fatal_error "\
  3137. cannot expand unknown variable in AC_CONFIG_AUX_DIR argument."
  3138. ;;
  3139. esac
  3140. }
  3141. test -n "$ac_aux_dir" && func_verbose "ac_aux_dir='$ac_aux_dir'"
  3142. require_ac_aux_dir=:
  3143. }
  3144. # require_ac_ltdl_dir
  3145. # -------------------
  3146. # Extract ac_ltdl_dir from LT_CONFIG_LTDL_DIR.
  3147. require_ac_ltdl_dir=func_require_ac_ltdl_dir
  3148. func_require_ac_ltdl_dir ()
  3149. {
  3150. $debug_cmd
  3151. $require_configure_ac
  3152. if test -n "$configure_ac"; then
  3153. func_extract_trace_first LT_CONFIG_LTDL_DIR
  3154. ac_ltdl_dir=$func_extract_trace_first_result
  3155. case $ac_ltdl_dir in
  3156. *\$*)
  3157. func_fatal_error "\
  3158. cannot expand unknown variable in LT_CONFIG_LTDL_DIR argument."
  3159. ;;
  3160. esac
  3161. fi
  3162. # Strip trailing slashes.
  3163. ac_ltdl_dir=`echo "$ac_ltdl_dir" |$SED 's|/*$||'`
  3164. require_ac_ltdl_dir=:
  3165. }
  3166. # require_ac_ltdl_mode
  3167. # --------------------
  3168. # Extract mode name from LTDL_INIT options.
  3169. require_ac_ltdl_mode=func_require_ac_ltdl_mode
  3170. func_require_ac_ltdl_mode ()
  3171. {
  3172. $debug_cmd
  3173. $require_ac_ltdl_options
  3174. case " $ac_ltdl_options " in
  3175. *" nonrecursive "*) ac_ltdl_mode=nonrecursive ;;
  3176. *" recursive "*) ac_ltdl_mode=recursive ;;
  3177. *" subproject "*) ac_ltdl_mode=subproject ;;
  3178. esac
  3179. require_ac_ltdl_mode=:
  3180. }
  3181. # require_ac_ltdl_options
  3182. # -----------------------
  3183. # Extract ac_ltdl_options from LTDL_INIT.
  3184. require_ac_ltdl_options=func_require_ac_ltdl_options
  3185. func_require_ac_ltdl_options ()
  3186. {
  3187. $debug_cmd
  3188. $require_configure_ac
  3189. if test -n "$configure_ac"; then
  3190. func_extract_trace_first LTDL_INIT
  3191. ac_ltdl_options=$func_extract_trace_first_result
  3192. case $ac_ltdl_options in
  3193. *\$*)
  3194. func_fatal_error "\
  3195. cannot expand unknown variable in LTDL_INIT argument."
  3196. ;;
  3197. esac
  3198. fi
  3199. require_ac_ltdl_mode=:
  3200. }
  3201. # require_ac_macro_dir
  3202. # --------------------
  3203. # Extract ac_macro_dir from AC_CONFIG_MACRO_DIRS.
  3204. require_ac_macro_dir=func_require_ac_macro_dir
  3205. func_require_ac_macro_dir ()
  3206. {
  3207. $debug_cmd
  3208. $require_configure_ac
  3209. if test -n "$configure_ac"; then
  3210. func_extract_trace_first AC_CONFIG_MACRO_DIRS
  3211. ac_macro_dir=`expr "x$func_extract_trace_first_result" : 'x\([^ ]*\)'`
  3212. test -n "$ac_macro_dir" || {
  3213. func_extract_trace_first AC_CONFIG_MACRO_DIR
  3214. ac_macro_dir=$func_extract_trace_first_result
  3215. }
  3216. fi
  3217. require_ac_macro_dir=:
  3218. }
  3219. # require_aux_dir
  3220. # ---------------
  3221. # Set aux_dir according to AC_CONFIG_AUX_DIR or else use the same
  3222. # heuristics as Autoconf to intuit an appropriate setting.
  3223. require_aux_dir=func_require_aux_dir
  3224. func_require_aux_dir ()
  3225. {
  3226. $debug_cmd
  3227. $require_ac_aux_dir
  3228. test -z "$aux_dir" && aux_dir=$ac_aux_dir
  3229. # Subproject ltdl without $configure_ac keeps pkgauxfiles in
  3230. # specified --ltdl optarg directory.
  3231. test -z "$aux_dir" && $opt_ltdl && {
  3232. $require_configure_ac
  3233. test -n "$configure_ac" || {
  3234. $require_ltdl_dir
  3235. $require_ltdl_mode
  3236. test subproject = "$ltdl_mode" && aux_dir=$ltdl_dir
  3237. }
  3238. }
  3239. test -z "$aux_dir" && {
  3240. # Try to intuit aux_dir using the same heuristic as Autoconf.
  3241. for _G_dir in . .. ../..; do
  3242. if test -f "$_G_dir/install-sh" || test -f "$_G_dir/install.sh"
  3243. then
  3244. aux_dir=$_G_dir
  3245. break
  3246. fi
  3247. done
  3248. }
  3249. # Use the current directory if all else fails.
  3250. test -z "$aux_dir" && aux_dir=.
  3251. require_aux_dir=:
  3252. }
  3253. # require_configure_ac
  3254. # --------------------
  3255. # Ensure that there is a 'configure.ac' or 'configure.in' file in this
  3256. # directory, and that '$configure_ac' contains its name.
  3257. require_configure_ac=func_require_configure_ac
  3258. func_require_configure_ac ()
  3259. {
  3260. $debug_cmd
  3261. test -z "$configure_ac" \
  3262. && func_autoconf_configure configure.ac && configure_ac=configure.ac
  3263. test -z "$configure_ac" \
  3264. && func_autoconf_configure configure.in && configure_ac=configure.in
  3265. test -z "$configure_ac" \
  3266. || func_verbose "found '$configure_ac'"
  3267. require_configure_ac=:
  3268. }
  3269. # require_filter_Makefile_am
  3270. # --------------------------
  3271. # Set 'filter_Makefile_am' ready for passing to func_copy when libltdl's
  3272. # stock Makefile.am contents need to be filtered to work in recursive
  3273. # mode.
  3274. require_filter_Makefile_am=func_require_filter_Makefile_am
  3275. func_require_filter_Makefile_am ()
  3276. {
  3277. $debug_cmd
  3278. $require_ltdl_mode
  3279. case $ltdl_mode in
  3280. recursive)
  3281. filter_Makefile_am='
  3282. /^[^#]/{
  3283. s|(LIBOBJS)|(ltdl_LIBOBJS)|g
  3284. s|(LTLIBOBJS)|(ltdl_LTLIBOBJS)|g
  3285. }'
  3286. ;;
  3287. subproject)
  3288. # Adjust default relative macro_dir paths.
  3289. $require_ltdl_am_macro_dir
  3290. func_make_relative_ltdl_filter "$ltdl_am_macro_dir" "$macro_dir" '-I '
  3291. test -z "$func_make_relative_ltdl_filter_result" || {
  3292. func_append filter_Makefile_am "
  3293. /^ACLOCAL_AMFLAGS = /{
  3294. $func_make_relative_ltdl_filter_result
  3295. }"
  3296. }
  3297. func_make_relative_ltdl_filter "$ltdl_am_macro_dir" "$macro_dir" 'dir)'
  3298. func_append filter_Makefile_am "$func_make_relative_ltdl_filter_result"
  3299. # Adjust default relative aux_dir paths.
  3300. $require_ltdl_ac_aux_dir
  3301. func_make_relative_ltdl_filter "$ltdl_ac_aux_dir" "$aux_dir"
  3302. func_append filter_Makefile_am "$func_make_relative_ltdl_filter_result"
  3303. ;;
  3304. esac
  3305. require_filter_Makefile_am=:
  3306. }
  3307. # require_filter_aclocal_m4
  3308. # -------------------------
  3309. # Set 'filter_aclocal_m4' ready for passing to func_copy when libltdl's
  3310. # stock aclocal.m4 contents need to be filtered to work in recursive
  3311. # mode.
  3312. require_filter_aclocal_m4=func_require_filter_aclocal_m4
  3313. func_require_filter_aclocal_m4 ()
  3314. {
  3315. $debug_cmd
  3316. $require_ltdl_am_macro_dir
  3317. func_make_relative_ltdl_filter "$ltdl_am_macro_dir" "$macro_dir"
  3318. test -z "$func_make_relative_ltdl_filter_result" || {
  3319. func_append filter_aclocal_m4 "
  3320. /^[m]4_include(/{
  3321. $func_make_relative_ltdl_filter_result
  3322. }"
  3323. }
  3324. require_filter_aclocal_m4=:
  3325. }
  3326. # require_filter_configure_ac
  3327. # ---------------------------
  3328. # Set 'filter_configure_ac' ready for passing to func_copy when
  3329. # libltdl's stock configure.ac contents need to be filtered to work in
  3330. # subproject mode.
  3331. require_filter_configure_ac=func_require_filter_configure_ac
  3332. func_require_filter_configure_ac ()
  3333. {
  3334. $debug_cmd
  3335. $require_ltdl_ac_aux_dir
  3336. func_make_relative_ltdl_filter "$ltdl_ac_aux_dir" "$aux_dir"
  3337. func_append filter_configure_ac "$func_make_relative_ltdl_filter_result"
  3338. require_filter_configure_ac=:
  3339. }
  3340. # require_filter_ltdl_mk
  3341. # ----------------------
  3342. # Set 'filter_ltdl_mk' ready for passing to func_copy in order for the
  3343. # contents of ltdl.mk to match the nonrecursive libltdl directory into
  3344. # which it is copied.
  3345. require_filter_ltdl_mk=func_require_filter_ltdl_mk
  3346. func_require_filter_ltdl_mk ()
  3347. {
  3348. $debug_cmd
  3349. $require_ltdl_dir
  3350. # Note that we strip comments right here, rather than rely on
  3351. # using a $SED that allows comments.
  3352. my_uscore=`$ECHO "$ltdl_dir" | $SED 's|[/.+-]|_|g'`
  3353. filter_ltdl_mk=`$ECHO '
  3354. /^[^#]/{
  3355. # Use only libltdl conditional objects.
  3356. s|(LIBOBJS)|(ltdl_LIBOBJS)|g
  3357. s|(LTLIBOBJS)|(ltdl_LTLIBOBJS)|g
  3358. # Convert libltdl path and variable sections to $ltdl_dir.
  3359. s|libltdl_|@my_uscore@_|
  3360. s|libltdl/|@ltdl_dir@/|
  3361. s|: libltdl/|: @ltdl_dir@/|
  3362. s| -Ilibltdl | -I@ltdl_dir@ |
  3363. s|\$(libltdl_|\$(@my_uscore@_|
  3364. s|)/libltdl |)/@ltdl_dir@ |
  3365. s|@my_uscore@|'"$my_uscore"'|g
  3366. s|@ltdl_dir@|'"$ltdl_dir"'|g
  3367. }' | $SED '/^[ ]*#/d;/^$/d'`
  3368. require_filter_ltdl_mk=:
  3369. }
  3370. # require_ltdl_ac_aux_dir
  3371. # -----------------------
  3372. # This needs to work in subproject mode, when GNU M4 may not be
  3373. # available and hence extract-trace can't be used. But since we
  3374. # installed libltdl/configure.ac, then we already know what value
  3375. # we used.
  3376. require_ltdl_ac_aux_dir=func_require_ltdl_ac_aux_dir
  3377. func_require_ltdl_ac_aux_dir ()
  3378. {
  3379. $debug_cmd
  3380. ltdl_ac_aux_dir="../build-aux"
  3381. func_verbose "ltdl_ac_aux_dir='$ltdl_ac_aux_dir'"
  3382. require_ltdl_ac_aux_dir=:
  3383. }
  3384. # require_ltdl_dir
  3385. # ----------------
  3386. # If both are specified, ensure both --ltdl=LTDL_DIR and
  3387. # LT_CONFIG_LTDL_DIR agree, and set ltdl_dir to the value of either.
  3388. require_ltdl_dir=func_require_ltdl_dir
  3389. func_require_ltdl_dir ()
  3390. {
  3391. $debug_cmd
  3392. $require_ac_ltdl_dir
  3393. test -z "$ltdl_dir" && ltdl_dir=$ac_ltdl_dir
  3394. test -z "$ltdl_dir" && $opt_ltdl && ltdl_dir=libltdl
  3395. if test -n "$ac_ltdl_dir"; then
  3396. test "$ac_ltdl_dir" = "$ltdl_dir" || func_fatal_error "\
  3397. --ltdl='$ltdl_dir' does not match LT_CONFIG_LTDL_DIR($ac_ltdl_dir)"
  3398. fi
  3399. require_ltdl_dir=:
  3400. }
  3401. # require_ltdl_mode
  3402. # -----------------
  3403. # If both are specified, ensure both command line setting and LTDL_INIT
  3404. # option agree, and set ltdl_mode to the value of either.
  3405. require_ltdl_mode=func_require_ltdl_mode
  3406. func_require_ltdl_mode ()
  3407. {
  3408. $debug_cmd
  3409. $require_ac_ltdl_mode
  3410. test -z "$ltdl_mode" && ltdl_mode=$ac_ltdl_mode
  3411. test -z "$ltdl_mode" && {
  3412. $require_ltdl_dir
  3413. test -n "$ltdl_dir" && ltdl_mode=subproject
  3414. }
  3415. if test -n "$ac_ltdl_mode"; then
  3416. test "$ac_ltdl_mode" = "$ltdl_mode" || func_fatal_error "\
  3417. --$ltdl_mode does not match LTDL_INIT($ac_ltdl_mode)"
  3418. fi
  3419. func_verbose "ltdl mode='$ltdl_mode'"
  3420. require_ltdl_mode=:
  3421. }
  3422. # require_macro_dir
  3423. # -----------------
  3424. # If both are specified, ensure both ACLOCAL_AMFLAGS and
  3425. # AC_CONFIG_MACRO_DIRS agree, and set macro_dir to the value of either.
  3426. require_macro_dir=func_require_macro_dir
  3427. func_require_macro_dir ()
  3428. {
  3429. $debug_cmd
  3430. $require_ac_macro_dir
  3431. $require_am_macro_dir
  3432. # AC_CONFIG_MACRO_DIRS takes precedence.
  3433. macro_dir=$ac_macro_dir
  3434. # Followed by first -I optarg from ACLOCAL_AMFLAGS.
  3435. test -z "$macro_dir" && macro_dir=$am_macro_dir
  3436. # Subproject ltdl without either of the above keeps macros in
  3437. # specified --ltdl optarg subdirectory.
  3438. test -z "$macro_dir" && $opt_ltdl && {
  3439. $require_ltdl_dir
  3440. $require_ltdl_mode
  3441. test subproject = "$ltdl_mode" && macro_dir=$ltdl_dir/m4
  3442. }
  3443. # Use ./m4 as the last resort.
  3444. test -z "$macro_dir" && macro_dir=m4
  3445. # Diagnose conflicts.
  3446. if test -n "$ac_macro_dir" && test -n "$am_macro_dir"; then
  3447. test "$ac_macro_dir" = "$am_macro_dir" || func_fatal_error "\
  3448. AC_CONFIG_MACRO_DIRS([$ac_macro_dir]) conflicts with ACLOCAL_AMFLAGS=-I $am_macro_dir."
  3449. fi
  3450. require_macro_dir=:
  3451. }
  3452. # require_seen_ltdl
  3453. # -----------------
  3454. # Determine from contents of $configure_ac whether this project contains
  3455. # libltdl.
  3456. require_seen_ltdl=func_require_seen_ltdl
  3457. func_require_seen_ltdl ()
  3458. {
  3459. $debug_cmd
  3460. $require_configure_ac
  3461. if test -n "$configure_ac"; then
  3462. func_extract_trace AC_LIB_LTDL,AC_WITH_LTDL,LT_WITH_LTDL,LTDL_INIT
  3463. test -n "$func_extract_trace_result" && seen_ltdl=:
  3464. fi
  3465. test -n "$seen_ltdl" || seen_ltdl=false
  3466. $seen_ltdl && func_verbose "found LTDL_INIT invocation"
  3467. require_seen_ltdl=:
  3468. }
  3469. # require_seen_libtool
  3470. # --------------------
  3471. # Determine from contents of $configure_ac whether this project is using
  3472. # Libtool to compile (some of) its objects.
  3473. require_seen_libtool=func_require_seen_libtool
  3474. func_require_seen_libtool ()
  3475. {
  3476. $debug_cmd
  3477. $require_configure_ac
  3478. if test -n "$configure_ac"; then
  3479. func_extract_trace AM_PROG_LIBTOOL,AC_PROG_LIBTOOL,LT_INIT
  3480. test -n "$func_extract_trace_result" && seen_libtool=:
  3481. fi
  3482. test -n "$seen_libtool" || seen_libtool=false
  3483. $seen_libtool && func_verbose "found LT_INIT invocation"
  3484. require_seen_libtool=:
  3485. }
  3486. ## ----------- ##
  3487. ## Main. ##
  3488. ## ----------- ##
  3489. {
  3490. # Lists of all files libtoolize has ever installed. These are removed
  3491. # before installing the latest files when --force was passed to help
  3492. # ensure a clean upgrade.
  3493. # Do not remove config.guess, config.sub or install-sh, we don't
  3494. # install them without --install, and the project may not be using
  3495. # Automake. Similarly, do not remove Gnulib files.
  3496. all_pkgaux_files="compile depcomp missing ltmain.sh"
  3497. all_pkgmacro_files="libtool.m4 ltargz.m4 ltdl.m4 ltoptions.m4 ltsugar.m4 ltversion.in ltversion.m4 lt~obsolete.m4"
  3498. all_pkgltdl_files="COPYING.LIB Makefile Makefile.in Makefile.inc Makefile.am README acinclude.m4 aclocal.m4 argz_.h argz.c config.h.in config-h.in configure configure.ac configure.in libltdl/lt__alloc.h libltdl/lt__argz.h libltdl/lt__dirent.h libltdl/lt__glibc.h libltdl/lt__private.h libltdl/lt__strl.h libltdl/lt_dlloader.h libltdl/lt_error.h libltdl/lt_system.h libltdl/slist.h loaders/dld_link.c loaders/dlopen.c loaders/dyld.c loaders/load_add_on.c loaders/loadlibrary.c loaders/preopen.c loaders/shl_load.c lt__alloc.c lt__argz.c lt__dirent.c lt__strl.c lt_dlloader.c lt_error.c ltdl.c ltdl.h ltdl.mk slist.c"
  3499. # Files installed by func_install_*, some files are missing from these
  3500. # lists deliberately because their respective func_install has to handle
  3501. # the missing filenames specially.
  3502. pkgaux_files="compile config.guess config.sub depcomp install-sh missing ltmain.sh"
  3503. pkgltdl_files="COPYING.LIB Makefile.am README configure.ac aclocal.m4 Makefile.in config-h.in configure libltdl/lt__alloc.h libltdl/lt__argz_.h libltdl/lt__dirent.h libltdl/lt__glibc.h libltdl/lt__private.h libltdl/lt__strl.h libltdl/lt_dlloader.h libltdl/lt_error.h libltdl/lt_system.h libltdl/slist.h loaders/dld_link.c loaders/dlopen.c loaders/dyld.c loaders/load_add_on.c loaders/loadlibrary.c loaders/preopen.c loaders/shl_load.c lt__alloc.c lt__argz.c lt__dirent.c lt__strl.c lt_dlloader.c lt_error.c ltdl.c ltdl.h ltdl.mk slist.c"
  3504. pkgmacro_files="libtool.m4 ltargz.m4 ltdl.m4 ltoptions.m4 ltsugar.m4 ltversion.m4 lt~obsolete.m4"
  3505. # Locations for important files:
  3506. prefix="/opt/ti-processor-sdk-linux-am335x-evm-04.02.00.09/linux-devkit/sysroots/x86_64-arago-linux/usr"
  3507. datadir="/opt/ti-processor-sdk-linux-am335x-evm-04.02.00.09/linux-devkit/sysroots/x86_64-arago-linux/usr/share"
  3508. pkgauxdir="/opt/ti-processor-sdk-linux-am335x-evm-04.02.00.09/linux-devkit/sysroots/x86_64-arago-linux/usr/share/libtool/build-aux"
  3509. pkgltdldir="/opt/ti-processor-sdk-linux-am335x-evm-04.02.00.09/linux-devkit/sysroots/x86_64-arago-linux/usr/share/libtool"
  3510. aclocaldir="/opt/ti-processor-sdk-linux-am335x-evm-04.02.00.09/linux-devkit/sysroots/x86_64-arago-linux/usr/share/aclocal"
  3511. # Allow the user to override the master libtoolize repository:
  3512. if test -n "$_lt_pkgdatadir"; then
  3513. pkgauxdir=$_lt_pkgdatadir/build-aux
  3514. pkgltdldir=$_lt_pkgdatadir/libltdl
  3515. aclocaldir=$_lt_pkgdatadir/m4
  3516. fi
  3517. func_nonemptydir_p pkgauxdir
  3518. func_nonemptydir_p pkgltdldir
  3519. func_nonemptydir_p aclocaldir
  3520. extract_trace=$pkgauxdir/extract-trace
  3521. # :::BE CAREFUL HERE:::
  3522. # func_check_macros needs to check whether --ltdl was specified when
  3523. # LTDL_INIT was not seen, so we can't just use one variable for both
  3524. # conditions, or that check will be impossible. No need to clutter the
  3525. # rest of the code with '$opt_ltdl || $seen_ltdl' though, because we CAN
  3526. # safely set opt_ltdl to true if LTDL_INIT was seen:
  3527. $require_seen_ltdl
  3528. $seen_ltdl && opt_ltdl=:
  3529. func_install_pkgaux_files
  3530. func_install_pkgmacro_files
  3531. func_install_pkgltdl_files
  3532. func_check_macros
  3533. }
  3534. exit $exit_status
  3535. # Local Variables:
  3536. # mode:shell-script
  3537. # sh-indentation:2
  3538. # End: