metasploit_payloads-mettle 0.5.3 → 0.5.4

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