Imported Upstream version 2.4.2
[platform/upstream/libtool.git] / libtoolize.in
1 #! /bin/sh
2 # Generated from libtoolize.m4sh by GNU Autoconf 2.68.
3
4 # libtoolize (GNU libtool) 2.4.2
5 # Written by Gary V. Vaughan <gary@gnu.org>, 2003
6
7 # Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
8 # 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 libtoolize; see the file COPYING.  If not, a copy
24 # can be downloaded from http://www.gnu.org/licenses/gpl.html,
25 # or obtained by writing to the Free Software Foundation, Inc.,
26 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
27
28 # Usage: $progname [OPTION]...
29 #
30 # Prepare a package to use libtool.
31 #
32 #   -c, --copy          copy files rather than symlinking them
33 #       --debug         enable verbose shell tracing
34 #   -n, --dry-run       print commands rather than running them
35 #   -f, --force         replace existing files
36 #   -i, --install       copy missing auxiliary files
37 #       --ltdl[=DIR]    install libltdl sources [default: libltdl]
38 #       --no-warn       don't display warning messages
39 #       --nonrecursive  prepare ltdl for non-recursive make
40 #   -q, --quiet         work silently
41 #       --recursive     prepare ltdl for recursive make
42 #       --subproject    prepare ltdl to configure and build independently
43 #   -v, --verbose       verbosely report processing
44 #       --version       print version information and exit
45 #   -h, --help          print short or long help message
46 #
47 # The following space or comma delimited options can be passed to $progname
48 # via the environment variable LIBTOOLIZE_OPTIONS, unknown environment
49 # options are ignored:
50 #
51 #   --debug             enable verbose shell tracing
52 #   --no-warn           don't display warning messages
53 #   --quiet             work silently
54 #   --verbose           verbosely report processing
55 #
56 # You must `cd' to the top directory of your package before you run
57 # `$progname'.
58 #
59 # When reporting a bug, please describe a test case to reproduce it and
60 # include the following information:
61 #
62 #       host-triplet:   @host_triplet@
63 #       $progname:      (GNU libtool) 2.4.2
64 #       automake:               $automake_version
65 #       autoconf:               $autoconf_version
66 #
67 # Report bugs to <bug-libtool@gnu.org>.
68 # GNU libtool home page: <http://www.gnu.org/software/libtool/>.
69 # General help using GNU software: <http://www.gnu.org/gethelp/>.
70
71 : ${TAR=tar}
72
73 PROGRAM=libtoolize
74
75 # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
76 # is ksh but when the shell is invoked as "sh" and the current value of
77 # the _XPG environment variable is not equal to 1 (one), the special
78 # positional parameter $0, within a function call, is the name of the
79 # function.
80 progpath="$0"
81
82 ## -------------------- ##
83 ## M4sh Initialization. ##
84 ## -------------------- ##
85
86 # Be more Bourne compatible
87 DUALCASE=1; export DUALCASE # for MKS sh
88 if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then :
89   emulate sh
90   NULLCMD=:
91   # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
92   # is contrary to our usage.  Disable this feature.
93   alias -g '${1+"$@"}'='"$@"'
94   setopt NO_GLOB_SUBST
95 else
96   case `(set -o) 2>/dev/null` in #(
97   *posix*) :
98     set -o posix ;; #(
99   *) :
100      ;;
101 esac
102 fi
103
104
105 as_nl='
106 '
107 export as_nl
108 # Printing a long string crashes Solaris 7 /usr/bin/printf.
109 as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
110 as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo
111 as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo
112 # Prefer a ksh shell builtin over an external printf program on Solaris,
113 # but without wasting forks for bash or zsh.
114 if test -z "$BASH_VERSION$ZSH_VERSION" \
115     && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then
116   as_echo='print -r --'
117   as_echo_n='print -rn --'
118 elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
119   as_echo='printf %s\n'
120   as_echo_n='printf %s'
121 else
122   if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then
123     as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"'
124     as_echo_n='/usr/ucb/echo -n'
125   else
126     as_echo_body='eval expr "X$1" : "X\\(.*\\)"'
127     as_echo_n_body='eval
128       arg=$1;
129       case $arg in #(
130       *"$as_nl"*)
131         expr "X$arg" : "X\\(.*\\)$as_nl";
132         arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;;
133       esac;
134       expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl"
135     '
136     export as_echo_n_body
137     as_echo_n='sh -c $as_echo_n_body as_echo'
138   fi
139   export as_echo_body
140   as_echo='sh -c $as_echo_body as_echo'
141 fi
142
143 # The user is always right.
144 if test "${PATH_SEPARATOR+set}" != set; then
145   PATH_SEPARATOR=:
146   (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
147     (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
148       PATH_SEPARATOR=';'
149   }
150 fi
151
152
153 # IFS
154 # We need space, tab and new line, in precisely that order.  Quoting is
155 # there to prevent editors from complaining about space-tab.
156 # (If _AS_PATH_WALK were called with IFS unset, it would disable word
157 # splitting by setting IFS to empty value.)
158 IFS=" ""        $as_nl"
159
160 # Find who we are.  Look in the path if we contain no directory separator.
161 as_myself=
162 case $0 in #((
163   *[\\/]* ) as_myself=$0 ;;
164   *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
165 for as_dir in $PATH
166 do
167   IFS=$as_save_IFS
168   test -z "$as_dir" && as_dir=.
169     test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
170   done
171 IFS=$as_save_IFS
172
173      ;;
174 esac
175 # We did not find ourselves, most probably we were run as `sh COMMAND'
176 # in which case we are not to be found in the path.
177 if test "x$as_myself" = x; then
178   as_myself=$0
179 fi
180 if test ! -f "$as_myself"; then
181   $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
182   exit 1
183 fi
184
185 # Unset variables that we do not need and which cause bugs (e.g. in
186 # pre-3.0 UWIN ksh).  But do not cause bugs in bash 2.01; the "|| exit 1"
187 # suppresses any "Segmentation fault" message there.  '((' could
188 # trigger a bug in pdksh 5.2.14.
189 for as_var in BASH_ENV ENV MAIL MAILPATH
190 do eval test x\${$as_var+set} = xset \
191   && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || :
192 done
193 PS1='$ '
194 PS2='> '
195 PS4='+ '
196
197 # NLS nuisances.
198 LC_ALL=C
199 export LC_ALL
200 LANGUAGE=C
201 export LANGUAGE
202
203 # CDPATH.
204 (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
205
206 if test "x$CONFIG_SHELL" = x; then
207   as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then :
208   emulate sh
209   NULLCMD=:
210   # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which
211   # is contrary to our usage.  Disable this feature.
212   alias -g '\${1+\"\$@\"}'='\"\$@\"'
213   setopt NO_GLOB_SUBST
214 else
215   case \`(set -o) 2>/dev/null\` in #(
216   *posix*) :
217     set -o posix ;; #(
218   *) :
219      ;;
220 esac
221 fi
222 "
223   as_required="as_fn_return () { (exit \$1); }
224 as_fn_success () { as_fn_return 0; }
225 as_fn_failure () { as_fn_return 1; }
226 as_fn_ret_success () { return 0; }
227 as_fn_ret_failure () { return 1; }
228
229 exitcode=0
230 as_fn_success || { exitcode=1; echo as_fn_success failed.; }
231 as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; }
232 as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; }
233 as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; }
234 if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then :
235
236 else
237   exitcode=1; echo positional parameters were not saved.
238 fi
239 test x\$exitcode = x0 || exit 1"
240   as_suggested=""
241   if (eval "$as_required") 2>/dev/null; then :
242   as_have_required=yes
243 else
244   as_have_required=no
245 fi
246   if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then :
247
248 else
249   as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
250 as_found=false
251 for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
252 do
253   IFS=$as_save_IFS
254   test -z "$as_dir" && as_dir=.
255   as_found=:
256   case $as_dir in #(
257          /*)
258            for as_base in sh bash ksh sh5; do
259              # Try only shells that exist, to save several forks.
260              as_shell=$as_dir/$as_base
261              if { test -f "$as_shell" || test -f "$as_shell.exe"; } &&
262                     { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then :
263   CONFIG_SHELL=$as_shell as_have_required=yes
264                    break 2
265 fi
266            done;;
267        esac
268   as_found=false
269 done
270 $as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } &&
271               { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then :
272   CONFIG_SHELL=$SHELL as_have_required=yes
273 fi; }
274 IFS=$as_save_IFS
275
276
277       if test "x$CONFIG_SHELL" != x; then :
278   # We cannot yet assume a decent shell, so we have to provide a
279         # neutralization value for shells without unset; and this also
280         # works around shells that cannot unset nonexistent variables.
281         # Preserve -v and -x to the replacement shell.
282         BASH_ENV=/dev/null
283         ENV=/dev/null
284         (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
285         export CONFIG_SHELL
286         case $- in # ((((
287           *v*x* | *x*v* ) as_opts=-vx ;;
288           *v* ) as_opts=-v ;;
289           *x* ) as_opts=-x ;;
290           * ) as_opts= ;;
291         esac
292         exec "$CONFIG_SHELL" $as_opts "$as_myself" ${1+"$@"}
293 fi
294
295     if test x$as_have_required = xno; then :
296   $as_echo "$0: This script requires a shell more modern than all"
297   $as_echo "$0: the shells that I found on your system."
298   if test x${ZSH_VERSION+set} = xset ; then
299     $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should"
300     $as_echo "$0: be upgraded to zsh 4.3.4 or later."
301   else
302     $as_echo "$0: Please tell bug-autoconf@gnu.org about your system,
303 $0: including any error possibly output before this
304 $0: message. Then install a modern shell, or manually run
305 $0: the script under such a shell if you do have one."
306   fi
307   exit 1
308 fi
309 fi
310 fi
311 SHELL=${CONFIG_SHELL-/bin/sh}
312 export SHELL
313 # Unset more variables known to interfere with behavior of common tools.
314 CLICOLOR_FORCE= GREP_OPTIONS=
315 unset CLICOLOR_FORCE GREP_OPTIONS
316
317 ## --------------------- ##
318 ## M4sh Shell Functions. ##
319 ## --------------------- ##
320 # as_fn_unset VAR
321 # ---------------
322 # Portably unset VAR.
323 as_fn_unset ()
324 {
325   { eval $1=; unset $1;}
326 }
327 as_unset=as_fn_unset
328 ## -------------------- ##
329 ## Main body of script. ##
330 ## -------------------- ##
331
332
333
334
335 : ${CP="cp -f"}
336 test "${ECHO+set}" = set || ECHO=${as_echo-'printf %s\n'}
337 : ${EGREP="@EGREP@"}
338 : ${FGREP="@FGREP@"}
339 : ${GREP="@GREP@"}
340 : ${LN_S="@LN_S@"}
341 : ${MAKE="make"}
342 : ${MKDIR="mkdir"}
343 : ${MV="mv -f"}
344 : ${RM="rm -f"}
345 : ${SED="@SED@"}
346 : ${SHELL="${CONFIG_SHELL-/bin/sh}"}
347 : ${Xsed="$SED -e 1s/^X//"}
348
349 # Global variables:
350 EXIT_SUCCESS=0
351 EXIT_FAILURE=1
352 EXIT_MISMATCH=63  # $? = 63 is used to indicate version mismatch to missing.
353 EXIT_SKIP=77      # $? = 77 is used to indicate a skipped test to automake.
354
355 exit_status=$EXIT_SUCCESS
356
357 # Make sure IFS has a sensible default
358 lt_nl='
359 '
360 IFS="   $lt_nl"
361
362 dirname="s,/[^/]*$,,"
363 basename="s,^.*/,,"
364
365 # func_dirname file append nondir_replacement
366 # Compute the dirname of FILE.  If nonempty, add APPEND to the result,
367 # otherwise set result to NONDIR_REPLACEMENT.
368 func_dirname ()
369 {
370     func_dirname_result=`$ECHO "${1}" | $SED "$dirname"`
371     if test "X$func_dirname_result" = "X${1}"; then
372       func_dirname_result="${3}"
373     else
374       func_dirname_result="$func_dirname_result${2}"
375     fi
376 } # func_dirname may be replaced by extended shell implementation
377
378
379 # func_basename file
380 func_basename ()
381 {
382     func_basename_result=`$ECHO "${1}" | $SED "$basename"`
383 } # func_basename may be replaced by extended shell implementation
384
385
386 # func_dirname_and_basename file append nondir_replacement
387 # perform func_basename and func_dirname in a single function
388 # call:
389 #   dirname:  Compute the dirname of FILE.  If nonempty,
390 #             add APPEND to the result, otherwise set result
391 #             to NONDIR_REPLACEMENT.
392 #             value returned in "$func_dirname_result"
393 #   basename: Compute filename of FILE.
394 #             value retuned in "$func_basename_result"
395 # Implementation must be kept synchronized with func_dirname
396 # and func_basename. For efficiency, we do not delegate to
397 # those functions but instead duplicate the functionality here.
398 func_dirname_and_basename ()
399 {
400     # Extract subdirectory from the argument.
401     func_dirname_result=`$ECHO "${1}" | $SED -e "$dirname"`
402     if test "X$func_dirname_result" = "X${1}"; then
403       func_dirname_result="${3}"
404     else
405       func_dirname_result="$func_dirname_result${2}"
406     fi
407     func_basename_result=`$ECHO "${1}" | $SED -e "$basename"`
408 } # func_dirname_and_basename may be replaced by extended shell implementation
409
410
411 # func_stripname prefix suffix name
412 # strip PREFIX and SUFFIX off of NAME.
413 # PREFIX and SUFFIX must not contain globbing or regex special
414 # characters, hashes, percent signs, but SUFFIX may contain a leading
415 # dot (in which case that matches only a dot).
416 # func_strip_suffix prefix name
417 func_stripname ()
418 {
419     case ${2} in
420       .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;;
421       *)  func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;;
422     esac
423 } # func_stripname may be replaced by extended shell implementation
424
425
426 # These SED scripts presuppose an absolute path with a trailing slash.
427 pathcar='s,^/\([^/]*\).*$,\1,'
428 pathcdr='s,^/[^/]*,,'
429 removedotparts=':dotsl
430                 s@/\./@/@g
431                 t dotsl
432                 s,/\.$,/,'
433 collapseslashes='s@/\{1,\}@/@g'
434 finalslash='s,/*$,/,'
435
436 # func_normal_abspath PATH
437 # Remove doubled-up and trailing slashes, "." path components,
438 # and cancel out any ".." path components in PATH after making
439 # it an absolute path.
440 #             value returned in "$func_normal_abspath_result"
441 func_normal_abspath ()
442 {
443   # Start from root dir and reassemble the path.
444   func_normal_abspath_result=
445   func_normal_abspath_tpath=$1
446   func_normal_abspath_altnamespace=
447   case $func_normal_abspath_tpath in
448     "")
449       # Empty path, that just means $cwd.
450       func_stripname '' '/' "`pwd`"
451       func_normal_abspath_result=$func_stripname_result
452       return
453     ;;
454     # The next three entries are used to spot a run of precisely
455     # two leading slashes without using negated character classes;
456     # we take advantage of case's first-match behaviour.
457     ///*)
458       # Unusual form of absolute path, do nothing.
459     ;;
460     //*)
461       # Not necessarily an ordinary path; POSIX reserves leading '//'
462       # and for example Cygwin uses it to access remote file shares
463       # over CIFS/SMB, so we conserve a leading double slash if found.
464       func_normal_abspath_altnamespace=/
465     ;;
466     /*)
467       # Absolute path, do nothing.
468     ;;
469     *)
470       # Relative path, prepend $cwd.
471       func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath
472     ;;
473   esac
474   # Cancel out all the simple stuff to save iterations.  We also want
475   # the path to end with a slash for ease of parsing, so make sure
476   # there is one (and only one) here.
477   func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
478         -e "$removedotparts" -e "$collapseslashes" -e "$finalslash"`
479   while :; do
480     # Processed it all yet?
481     if test "$func_normal_abspath_tpath" = / ; then
482       # If we ascended to the root using ".." the result may be empty now.
483       if test -z "$func_normal_abspath_result" ; then
484         func_normal_abspath_result=/
485       fi
486       break
487     fi
488     func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \
489         -e "$pathcar"`
490     func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
491         -e "$pathcdr"`
492     # Figure out what to do with it
493     case $func_normal_abspath_tcomponent in
494       "")
495         # Trailing empty path component, ignore it.
496       ;;
497       ..)
498         # Parent dir; strip last assembled component from result.
499         func_dirname "$func_normal_abspath_result"
500         func_normal_abspath_result=$func_dirname_result
501       ;;
502       *)
503         # Actual path component, append it.
504         func_normal_abspath_result=$func_normal_abspath_result/$func_normal_abspath_tcomponent
505       ;;
506     esac
507   done
508   # Restore leading double-slash if one was found on entry.
509   func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result
510 }
511
512 # func_relative_path SRCDIR DSTDIR
513 # generates a relative path from SRCDIR to DSTDIR, with a trailing
514 # slash if non-empty, suitable for immediately appending a filename
515 # without needing to append a separator.
516 #             value returned in "$func_relative_path_result"
517 func_relative_path ()
518 {
519   func_relative_path_result=
520   func_normal_abspath "$1"
521   func_relative_path_tlibdir=$func_normal_abspath_result
522   func_normal_abspath "$2"
523   func_relative_path_tbindir=$func_normal_abspath_result
524
525   # Ascend the tree starting from libdir
526   while :; do
527     # check if we have found a prefix of bindir
528     case $func_relative_path_tbindir in
529       $func_relative_path_tlibdir)
530         # found an exact match
531         func_relative_path_tcancelled=
532         break
533         ;;
534       $func_relative_path_tlibdir*)
535         # found a matching prefix
536         func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir"
537         func_relative_path_tcancelled=$func_stripname_result
538         if test -z "$func_relative_path_result"; then
539           func_relative_path_result=.
540         fi
541         break
542         ;;
543       *)
544         func_dirname $func_relative_path_tlibdir
545         func_relative_path_tlibdir=${func_dirname_result}
546         if test "x$func_relative_path_tlibdir" = x ; then
547           # Have to descend all the way to the root!
548           func_relative_path_result=../$func_relative_path_result
549           func_relative_path_tcancelled=$func_relative_path_tbindir
550           break
551         fi
552         func_relative_path_result=../$func_relative_path_result
553         ;;
554     esac
555   done
556
557   # Now calculate path; take care to avoid doubling-up slashes.
558   func_stripname '' '/' "$func_relative_path_result"
559   func_relative_path_result=$func_stripname_result
560   func_stripname '/' '/' "$func_relative_path_tcancelled"
561   if test "x$func_stripname_result" != x ; then
562     func_relative_path_result=${func_relative_path_result}/${func_stripname_result}
563   fi
564
565   # Normalisation. If bindir is libdir, return empty string,
566   # else relative path ending with a slash; either way, target
567   # file name can be directly appended.
568   if test ! -z "$func_relative_path_result"; then
569     func_stripname './' '' "$func_relative_path_result/"
570     func_relative_path_result=$func_stripname_result
571   fi
572 }
573
574 # The name of this program:
575 func_dirname_and_basename "$progpath"
576 progname=$func_basename_result
577
578 # Make sure we have an absolute path for reexecution:
579 case $progpath in
580   [\\/]*|[A-Za-z]:\\*) ;;
581   *[\\/]*)
582      progdir=$func_dirname_result
583      progdir=`cd "$progdir" && pwd`
584      progpath="$progdir/$progname"
585      ;;
586   *)
587      save_IFS="$IFS"
588      IFS=${PATH_SEPARATOR-:}
589      for progdir in $PATH; do
590        IFS="$save_IFS"
591        test -x "$progdir/$progname" && break
592      done
593      IFS="$save_IFS"
594      test -n "$progdir" || progdir=`pwd`
595      progpath="$progdir/$progname"
596      ;;
597 esac
598
599 # Sed substitution that helps us do robust quoting.  It backslashifies
600 # metacharacters that are still active within double-quoted strings.
601 Xsed="${SED}"' -e 1s/^X//'
602 sed_quote_subst='s/\([`"$\\]\)/\\\1/g'
603
604 # Same as above, but do not quote variable references.
605 double_quote_subst='s/\(["`\\]\)/\\\1/g'
606
607 # Sed substitution that turns a string into a regex matching for the
608 # string literally.
609 sed_make_literal_regex='s,[].[^$\\*\/],\\&,g'
610
611 # Sed substitution that converts a w32 file name or path
612 # which contains forward slashes, into one that contains
613 # (escaped) backslashes.  A very naive implementation.
614 lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
615
616 # Re-`\' parameter expansions in output of double_quote_subst that were
617 # `\'-ed in input to the same.  If an odd number of `\' preceded a '$'
618 # in input to double_quote_subst, that '$' was protected from expansion.
619 # Since each input `\' is now two `\'s, look for any number of runs of
620 # four `\'s followed by two `\'s and then a '$'.  `\' that '$'.
621 bs='\\'
622 bs2='\\\\'
623 bs4='\\\\\\\\'
624 dollar='\$'
625 sed_double_backslash="\
626   s/$bs4/&\\
627 /g
628   s/^$bs2$dollar/$bs&/
629   s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g
630   s/\n//g"
631
632 # Standard options:
633 opt_dry_run=false
634 opt_help=false
635 opt_quiet=false
636 opt_verbose=false
637 opt_warning=:
638
639 # func_echo arg...
640 # Echo program name prefixed message, along with the current mode
641 # name if it has been set yet.
642 func_echo ()
643 {
644     $ECHO "$progname: ${opt_mode+$opt_mode: }$*"
645 }
646
647 # func_verbose arg...
648 # Echo program name prefixed message in verbose mode only.
649 func_verbose ()
650 {
651     $opt_verbose && func_echo ${1+"$@"}
652
653     # A bug in bash halts the script if the last line of a function
654     # fails when set -e is in force, so we need another command to
655     # work around that:
656     :
657 }
658
659 # func_echo_all arg...
660 # Invoke $ECHO with all args, space-separated.
661 func_echo_all ()
662 {
663     $ECHO "$*"
664 }
665
666 # func_error arg...
667 # Echo program name prefixed message to standard error.
668 func_error ()
669 {
670     $ECHO "$progname: ${opt_mode+$opt_mode: }"${1+"$@"} 1>&2
671 }
672
673 # func_warning arg...
674 # Echo program name prefixed warning message to standard error.
675 func_warning ()
676 {
677     $opt_warning && $ECHO "$progname: ${opt_mode+$opt_mode: }warning: "${1+"$@"} 1>&2
678
679     # bash bug again:
680     :
681 }
682
683 # func_fatal_error arg...
684 # Echo program name prefixed message to standard error, and exit.
685 func_fatal_error ()
686 {
687     func_error ${1+"$@"}
688     exit $EXIT_FAILURE
689 }
690
691 # func_fatal_help arg...
692 # Echo program name prefixed message to standard error, followed by
693 # a help hint, and exit.
694 func_fatal_help ()
695 {
696     func_error ${1+"$@"}
697     func_fatal_error "$help"
698 }
699 help="Try \`$progname --help' for more information."  ## default
700
701
702 # func_grep expression filename
703 # Check whether EXPRESSION matches any line of FILENAME, without output.
704 func_grep ()
705 {
706     $GREP "$1" "$2" >/dev/null 2>&1
707 }
708
709
710 # func_mkdir_p directory-path
711 # Make sure the entire path to DIRECTORY-PATH is available.
712 func_mkdir_p ()
713 {
714     my_directory_path="$1"
715     my_dir_list=
716
717     if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then
718
719       # Protect directory names starting with `-'
720       case $my_directory_path in
721         -*) my_directory_path="./$my_directory_path" ;;
722       esac
723
724       # While some portion of DIR does not yet exist...
725       while test ! -d "$my_directory_path"; do
726         # ...make a list in topmost first order.  Use a colon delimited
727         # list incase some portion of path contains whitespace.
728         my_dir_list="$my_directory_path:$my_dir_list"
729
730         # If the last portion added has no slash in it, the list is done
731         case $my_directory_path in */*) ;; *) break ;; esac
732
733         # ...otherwise throw away the child directory and loop
734         my_directory_path=`$ECHO "$my_directory_path" | $SED -e "$dirname"`
735       done
736       my_dir_list=`$ECHO "$my_dir_list" | $SED 's,:*$,,'`
737
738       save_mkdir_p_IFS="$IFS"; IFS=':'
739       for my_dir in $my_dir_list; do
740         IFS="$save_mkdir_p_IFS"
741         # mkdir can fail with a `File exist' error if two processes
742         # try to create one of the directories concurrently.  Don't
743         # stop in that case!
744         $MKDIR "$my_dir" 2>/dev/null || :
745       done
746       IFS="$save_mkdir_p_IFS"
747
748       # Bail out if we (or some other process) failed to create a directory.
749       test -d "$my_directory_path" || \
750         func_fatal_error "Failed to create \`$1'"
751     fi
752 }
753
754
755 # func_mktempdir [string]
756 # Make a temporary directory that won't clash with other running
757 # libtool processes, and avoids race conditions if possible.  If
758 # given, STRING is the basename for that directory.
759 func_mktempdir ()
760 {
761     my_template="${TMPDIR-/tmp}/${1-$progname}"
762
763     if test "$opt_dry_run" = ":"; then
764       # Return a directory name, but don't create it in dry-run mode
765       my_tmpdir="${my_template}-$$"
766     else
767
768       # If mktemp works, use that first and foremost
769       my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
770
771       if test ! -d "$my_tmpdir"; then
772         # Failing that, at least try and use $RANDOM to avoid a race
773         my_tmpdir="${my_template}-${RANDOM-0}$$"
774
775         save_mktempdir_umask=`umask`
776         umask 0077
777         $MKDIR "$my_tmpdir"
778         umask $save_mktempdir_umask
779       fi
780
781       # If we're not in dry-run mode, bomb out on failure
782       test -d "$my_tmpdir" || \
783         func_fatal_error "cannot create temporary directory \`$my_tmpdir'"
784     fi
785
786     $ECHO "$my_tmpdir"
787 }
788
789
790 # func_quote_for_eval arg
791 # Aesthetically quote ARG to be evaled later.
792 # This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT
793 # is double-quoted, suitable for a subsequent eval, whereas
794 # FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters
795 # which are still active within double quotes backslashified.
796 func_quote_for_eval ()
797 {
798     case $1 in
799       *[\\\`\"\$]*)
800         func_quote_for_eval_unquoted_result=`$ECHO "$1" | $SED "$sed_quote_subst"` ;;
801       *)
802         func_quote_for_eval_unquoted_result="$1" ;;
803     esac
804
805     case $func_quote_for_eval_unquoted_result in
806       # Double-quote args containing shell metacharacters to delay
807       # word splitting, command substitution and and variable
808       # expansion for a subsequent eval.
809       # Many Bourne shells cannot handle close brackets correctly
810       # in scan sets, so we specify it separately.
811       *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")
812         func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\""
813         ;;
814       *)
815         func_quote_for_eval_result="$func_quote_for_eval_unquoted_result"
816     esac
817 }
818
819
820 # func_quote_for_expand arg
821 # Aesthetically quote ARG to be evaled later; same as above,
822 # but do not quote variable references.
823 func_quote_for_expand ()
824 {
825     case $1 in
826       *[\\\`\"]*)
827         my_arg=`$ECHO "$1" | $SED \
828             -e "$double_quote_subst" -e "$sed_double_backslash"` ;;
829       *)
830         my_arg="$1" ;;
831     esac
832
833     case $my_arg in
834       # Double-quote args containing shell metacharacters to delay
835       # word splitting and command substitution for a subsequent eval.
836       # Many Bourne shells cannot handle close brackets correctly
837       # in scan sets, so we specify it separately.
838       *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")
839         my_arg="\"$my_arg\""
840         ;;
841     esac
842
843     func_quote_for_expand_result="$my_arg"
844 }
845
846
847 # func_show_eval cmd [fail_exp]
848 # Unless opt_silent is true, then output CMD.  Then, if opt_dryrun is
849 # not true, evaluate CMD.  If the evaluation of CMD fails, and FAIL_EXP
850 # is given, then evaluate it.
851 func_show_eval ()
852 {
853     my_cmd="$1"
854     my_fail_exp="${2-:}"
855
856     ${opt_silent-false} || {
857       func_quote_for_expand "$my_cmd"
858       eval "func_echo $func_quote_for_expand_result"
859     }
860
861     if ${opt_dry_run-false}; then :; else
862       eval "$my_cmd"
863       my_status=$?
864       if test "$my_status" -eq 0; then :; else
865         eval "(exit $my_status); $my_fail_exp"
866       fi
867     fi
868 }
869
870
871 # func_show_eval_locale cmd [fail_exp]
872 # Unless opt_silent is true, then output CMD.  Then, if opt_dryrun is
873 # not true, evaluate CMD.  If the evaluation of CMD fails, and FAIL_EXP
874 # is given, then evaluate it.  Use the saved locale for evaluation.
875 func_show_eval_locale ()
876 {
877     my_cmd="$1"
878     my_fail_exp="${2-:}"
879
880     ${opt_silent-false} || {
881       func_quote_for_expand "$my_cmd"
882       eval "func_echo $func_quote_for_expand_result"
883     }
884
885     if ${opt_dry_run-false}; then :; else
886       eval "$lt_user_locale
887             $my_cmd"
888       my_status=$?
889       eval "$lt_safe_locale"
890       if test "$my_status" -eq 0; then :; else
891         eval "(exit $my_status); $my_fail_exp"
892       fi
893     fi
894 }
895
896 # func_tr_sh
897 # Turn $1 into a string suitable for a shell variable name.
898 # Result is stored in $func_tr_sh_result.  All characters
899 # not in the set a-zA-Z0-9_ are replaced with '_'. Further,
900 # if $1 begins with a digit, a '_' is prepended as well.
901 func_tr_sh ()
902 {
903   case $1 in
904   [0-9]* | *[!a-zA-Z0-9_]*)
905     func_tr_sh_result=`$ECHO "$1" | $SED 's/^\([0-9]\)/_\1/; s/[^a-zA-Z0-9_]/_/g'`
906     ;;
907   * )
908     func_tr_sh_result=$1
909     ;;
910   esac
911 }
912
913
914 # func_version
915 # Echo version message to standard output and exit.
916 func_version ()
917 {
918     $opt_debug
919
920     $SED -n '/(C)/!b go
921         :more
922         /\./!{
923           N
924           s/\n# / /
925           b more
926         }
927         :go
928         /^# '$PROGRAM' (GNU /,/# warranty; / {
929         s/^# //
930         s/^# *$//
931         s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/
932         p
933      }' < "$progpath"
934      exit $?
935 }
936
937 # func_usage
938 # Echo short help message to standard output and exit.
939 func_usage ()
940 {
941     $opt_debug
942
943     $SED -n '/^# Usage:/,/^#  *.*--help/ {
944         s/^# //
945         s/^# *$//
946         s/\$progname/'$progname'/
947         p
948     }' < "$progpath"
949     echo
950     $ECHO "run \`$progname --help | more' for full usage"
951     exit $?
952 }
953
954 # func_help [NOEXIT]
955 # Echo long help message to standard output and exit,
956 # unless 'noexit' is passed as argument.
957 func_help ()
958 {
959     $opt_debug
960
961     $SED -n '/^# Usage:/,/# Report bugs to/ {
962         :print
963         s/^# //
964         s/^# *$//
965         s*\$progname*'$progname'*
966         s*\$host*'"$host"'*
967         s*\$SHELL*'"$SHELL"'*
968         s*\$LTCC*'"$LTCC"'*
969         s*\$LTCFLAGS*'"$LTCFLAGS"'*
970         s*\$LD*'"$LD"'*
971         s/\$with_gnu_ld/'"$with_gnu_ld"'/
972         s/\$automake_version/'"`(${AUTOMAKE-automake} --version) 2>/dev/null |$SED 1q`"'/
973         s/\$autoconf_version/'"`(${AUTOCONF-autoconf} --version) 2>/dev/null |$SED 1q`"'/
974         p
975         d
976      }
977      /^# .* home page:/b print
978      /^# General help using/b print
979      ' < "$progpath"
980     ret=$?
981     if test -z "$1"; then
982       exit $ret
983     fi
984 }
985
986 # func_missing_arg argname
987 # Echo program name prefixed message to standard error and set global
988 # exit_cmd.
989 func_missing_arg ()
990 {
991     $opt_debug
992
993     func_error "missing argument for $1."
994     exit_cmd=exit
995 }
996
997
998 # func_split_short_opt shortopt
999 # Set func_split_short_opt_name and func_split_short_opt_arg shell
1000 # variables after splitting SHORTOPT after the 2nd character.
1001 func_split_short_opt ()
1002 {
1003     my_sed_short_opt='1s/^\(..\).*$/\1/;q'
1004     my_sed_short_rest='1s/^..\(.*\)$/\1/;q'
1005
1006     func_split_short_opt_name=`$ECHO "$1" | $SED "$my_sed_short_opt"`
1007     func_split_short_opt_arg=`$ECHO "$1" | $SED "$my_sed_short_rest"`
1008 } # func_split_short_opt may be replaced by extended shell implementation
1009
1010
1011 # func_split_long_opt longopt
1012 # Set func_split_long_opt_name and func_split_long_opt_arg shell
1013 # variables after splitting LONGOPT at the `=' sign.
1014 func_split_long_opt ()
1015 {
1016     my_sed_long_opt='1s/^\(--[^=]*\)=.*/\1/;q'
1017     my_sed_long_arg='1s/^--[^=]*=//'
1018
1019     func_split_long_opt_name=`$ECHO "$1" | $SED "$my_sed_long_opt"`
1020     func_split_long_opt_arg=`$ECHO "$1" | $SED "$my_sed_long_arg"`
1021 } # func_split_long_opt may be replaced by extended shell implementation
1022
1023 exit_cmd=:
1024
1025
1026
1027
1028
1029 # ltdl can be installed to be self-contained (subproject, the default);
1030 # or to be configured by a parent project, either with a recursive or
1031 # nonrecursive automake driven make:
1032 ltdl_mode=
1033
1034 # Locations for important files:
1035 ltdldir=
1036
1037 # Parse environment options
1038 {
1039   my_sed_env_opt='1s/^\([^,:; ]*\).*$/\1/;q'
1040   my_sed_env_rest='1s/^[^,:; ]*[,:; ]*\(.*\)$/\1/;q'
1041
1042   while test -n "$LIBTOOLIZE_OPTIONS"; do
1043     opt=`echo "$LIBTOOLIZE_OPTIONS" | sed "$my_sed_env_opt"`
1044     LIBTOOLIZE_OPTIONS=`echo "$LIBTOOLIZE_OPTIONS" | sed "$my_sed_env_rest"`
1045
1046     case $opt in
1047       --debug|--no-warn|--quiet|--verbose)
1048                 envopts="${envopts+$envopts }$opt"                        ;;
1049       --*)      env_warning="${env_warning+$env_warning
1050 }unrecognized environment option \`$opt'"                                 ;;
1051       *)        func_fatal_help "garbled LIBTOOLIZE_OPTIONS near \`$opt'" ;;
1052     esac
1053   done
1054
1055   test -n "$envopts" && {
1056     func_quote_for_eval "$envopts"
1057     eval set dummy "$func_quote_for_eval_result" ${1+"$@"}
1058     shift
1059   }
1060 }
1061
1062
1063
1064 # Option defaults:
1065 opt_debug=:
1066 opt_copy=false
1067 opt_force=false
1068 opt_install=false
1069 opt_dry_run=false
1070 opt_quiet=false
1071 opt_verbose=false
1072 opt_warning=:
1073 opt_nonrecursive=false
1074 opt_recursive=false
1075 opt_standalone=false
1076 opt_ltdl="false"
1077
1078
1079 # Parse options once, thoroughly.  This comes as soon as possible in the
1080 # script to make things like `--version' happen as quickly as we can.
1081 {
1082   # this just eases exit handling
1083   while test $# -gt 0; do
1084     opt="$1"
1085     shift
1086     case $opt in
1087       --debug|-x)       opt_debug='set -x'
1088                         func_echo "enabling shell trace mode"
1089                         $opt_debug
1090                         ;;
1091       --copy|-c)
1092                         opt_copy=:
1093                         ;;
1094       --force|-f)
1095                         opt_force=:
1096                         ;;
1097       --install|-i)
1098                         opt_install=:
1099                         ;;
1100       --dry-run|--dryrun|-n)
1101                         opt_dry_run=:
1102 CP="func_echo_all $CP"
1103 test -n "$LN_S" && LN_S="func_echo_all $LN_S"
1104 MKDIR="func_echo_all $MKDIR"
1105 RM="func_echo_all $RM"
1106 TAR="func_echo_all $TAR"
1107                         ;;
1108       --quiet|--automake|-q)
1109                         opt_quiet=:
1110                         ;;
1111       --verbose|-v)
1112                         opt_verbose=:
1113                         ;;
1114       --no-warning|--no-warn)
1115                         opt_warning=false
1116                         ;;
1117       --nonrecursive|--non-recursive)
1118                         opt_nonrecursive=:
1119                         ;;
1120       --recursive)
1121                         opt_recursive=:
1122                         ;;
1123       --standalone)
1124                         opt_standalone=:
1125                         ;;
1126       --ltdl)
1127                         optarg="$1"
1128                         if test $# -gt 0; then
1129                             case $optarg in # ((
1130                                 -*) ;;
1131                                 *) opt_ltdl="$optarg"; shift ;;
1132                             esac
1133                         fi
1134 # This is tricky, since we're overloading $opt_ltdl to be the
1135 # optarg for --ltdl during option processing, but then stashing
1136 # the (optional) optarg in $ltdldir and reusing $opt_ltdl to
1137 # indicate that --ltdl was seen during option processing.  Also,
1138 # be careful that --ltdl=foo --ltdl=bar results in ltdldir=bar:
1139 case $opt_ltdl in
1140           false|:) ;;  # a bare '--ltdl' followed by another option
1141   *)       ltdldir=`$ECHO "$optarg" | $SED 's,/*$,,'` ;;
1142 esac
1143 opt_ltdl=:
1144                         ;;
1145
1146       -\?|-h)           func_usage                              ;;
1147       --help)           func_help                               ;;
1148       --version)        func_version                            ;;
1149
1150       # Separate optargs to long options:
1151       --*=*)
1152                         func_split_long_opt "$opt"
1153                         set dummy "$func_split_long_opt_name" "$func_split_long_opt_arg" ${1+"$@"}
1154                         shift
1155                         ;;
1156
1157       # Separate non-argument short options:
1158       -\?*|-h*|-c*|-f*|-i*|-n*|-q*|-v*)
1159                         func_split_short_opt "$opt"
1160                         set dummy "$func_split_short_opt_name" "-$func_split_short_opt_arg" ${1+"$@"}
1161                         shift
1162                         ;;
1163
1164       --)               break                                   ;;
1165       -*)               func_fatal_help "unrecognized option \`$opt'" ;;
1166       *)                set dummy "$opt" ${1+"$@"};     shift; break  ;;
1167     esac
1168   done
1169
1170   # Validate options:
1171
1172   # show any warnings saved by LIBTOOLIZE_OPTIONS parsing
1173   test -n "$env_warning" &&
1174     echo "$env_warning" |while read line; do func_warning "$line"; done
1175
1176   # validate $opt_nonrecursive, $opt_recursive and $opt_standalone
1177   if $opt_nonrecursive; then
1178     if $opt_recursive || $opt_standalone; then
1179       func_error "you can have at most one of --non-recursive, --recursive and --standalone"
1180     fi
1181     ltdl_mode=nonrecursive
1182   elif $opt_recursive; then
1183     $opt_standalone &&
1184       func_error "you can have at most one of --non-recursive, --recursive and --standalone"
1185     ltdl_mode=recursive
1186   elif $opt_standalone; then
1187     ltdl_mode=standalone
1188   fi
1189
1190   # any remaining arguments are an error
1191   test $# -gt 0 &&
1192     func_fatal_help "unknown additional arguments: \`${1+}'"
1193
1194
1195   # Bail if the options were screwed
1196   $exit_cmd $EXIT_FAILURE
1197 }
1198
1199
1200
1201
1202 # func_echo_once msg_var
1203 # Calls func_echo with the value of MSG_VAR, and then sets MSG_VAR="" so
1204 # that subsequent calls have no effect.
1205 func_echo_once ()
1206 {
1207     $opt_debug
1208     if test -n "$1"; then
1209       eval my_msg=\$$1
1210
1211       if test -n "$my_msg"; then
1212         func_echo "$my_msg"
1213         eval $1=""
1214       fi
1215     fi
1216 }
1217
1218
1219 # func_copy srcfile destfile [msg_var]
1220 # A wrapper for func_copy_cb that accepts arguments in the same order
1221 # as the cp(1) shell command.
1222 func_copy ()
1223 {
1224     $opt_debug
1225
1226     test -f "$1" || \
1227       { func_error "\`$1' not copied:  not a regular file"; return 1; }
1228
1229     func_dirname_and_basename "$1"
1230     my_f1=$func_basename_result
1231
1232     if test -d "$2"; then
1233
1234       func_copy_cb "$my_f1" \
1235         `$ECHO "$1" | $SED "$dirname"` "$2" "$3"
1236
1237     else
1238
1239       # Supporting this would mean changing the timestamp:
1240       func_dirname_and_basename "$2"
1241       my_tname=$func_basename_result
1242       test "X$my_f1" = "X$my_tname" \
1243         || func_fatal_error "func_copy() cannot change filename on copy"
1244
1245       func_copy_cb "$my_f1" \
1246         `$ECHO "$1" | $SED "$dirname"` \
1247         `$ECHO "$2" | $SED "$dirname"` \
1248         "$3"
1249
1250     fi
1251
1252     return $copy_return_status # set in func_copy_cb
1253 }
1254
1255
1256 # func_copy_cb filename srcdir destdir [msg_var]
1257 # If option `--copy' was specified, or soft-linking SRCFILE to DESTFILE fails,
1258 # then try to copy SRCFILE to DESTFILE (without changing the timestamp if
1259 # possible).
1260 func_copy_cb ()
1261 {
1262     $opt_debug
1263     my_file="$1"
1264     my_srcdir="$2"
1265     my_destdir="$3"
1266     my_msg_var="$4"
1267     copy_return_status=1
1268
1269     # Libtool is probably misinstalled if this happens:
1270     test -f "$my_srcdir/$my_file" ||
1271         func_fatal_error "\`$my_file' not found in \`$my_srcdir'"
1272
1273     case $opt_verbose in
1274       false) my_copy_msg="file \`$my_destdir/$my_file'"     ;;
1275       *)     my_copy_msg="file from \`$my_srcdir/$my_file'" ;;
1276     esac
1277     func_mkdir_p `$ECHO "$my_destdir/$my_file" | $SED "$dirname"`
1278
1279     $RM "$my_destdir/$my_file"
1280     if $opt_copy; then
1281       if { ( cd "$my_srcdir" && $TAR chf - "$my_file" ) 2>/dev/null \
1282            | ( umask 0 && cd "$my_destdir" && $TAR xf - ) >/dev/null 2>&1; } \
1283          && touch "$my_destdir/$my_file"; then
1284         $opt_quiet || func_echo_once "$my_msg_var"
1285         $opt_quiet || func_echo "copying $my_copy_msg"
1286         copy_return_status=0
1287       fi
1288     else
1289       if test "$my_file" = "aclocal.m4"; then
1290         if { ( cd "$my_srcdir" && $TAR chf - "$my_file" ) 2>/dev/null \
1291              | ( umask 0 && cd "$my_destdir" && $TAR xf - ) >/dev/null 2>&1 ; }
1292         then
1293           $opt_quiet || func_echo_once "$my_msg_var"
1294           $opt_quiet || func_echo "copying $my_copy_msg"
1295           copy_return_status=0
1296         fi
1297       else
1298         if $LN_S "$my_srcdir/$my_file" "$my_destdir/$my_file"; then
1299           $opt_quiet || func_echo_once "$my_msg_var"
1300           $opt_quiet || func_echo "linking $my_copy_msg"
1301           copy_return_status=0
1302         fi
1303       fi
1304     fi
1305     if test "$copy_return_status" != 0; then
1306       $opt_quiet || func_echo_once "$my_msg_var"
1307       func_error "can not copy \`$my_srcdir/$my_file' to \`$my_destdir/'"
1308       exit_status=$EXIT_FAILURE
1309     fi
1310 }
1311
1312
1313 # func_copy_some_files srcfile_spec srcdir destdir [msg_var] [cb=func_copy_cb]
1314 # Call COPY_CB for each regular file in SRCDIR named by the ':' delimited
1315 # names in SRCFILE_SPEC.  The odd calling convention is needed to allow
1316 # spaces in file and directory names.
1317 func_copy_some_files ()
1318 {
1319     $opt_debug
1320     my_srcfile_spec="$1"
1321     my_srcdir="$2"
1322     my_destdir="$3"
1323     my_msg_var="$4"
1324     my_copy_cb="${5-func_copy_cb}"
1325
1326     my_save_IFS="$IFS"
1327     IFS=:
1328     for my_filename in $my_srcfile_spec; do
1329       IFS="$my_save_IFS"
1330       if test -f "$my_srcdir/$my_filename"; then
1331         if test "X$my_copy_cb" = Xfunc_copy_cb; then
1332           $opt_force || if test -f "$my_destdir/$my_filename"; then
1333             $opt_quiet || func_echo_once "$my_msg_var"
1334             $opt_quiet \
1335               || func_error "\`$my_destdir/$my_filename' exists: use \`--force' to overwrite"
1336             continue
1337           fi
1338         fi
1339       else
1340         func_echo_once "$my_msg_var"
1341         func_fatal_error "\`$my_filename' not found in \`$my_srcdir'"
1342       fi
1343
1344       $my_copy_cb "$my_filename" "$my_srcdir" "$my_destdir" "$my_msg_var"
1345     done
1346     IFS="$my_save_IFS"
1347 }
1348
1349
1350 # func_fixup_Makefile srcfile srcdir destdir
1351 func_fixup_Makefile ()
1352 {
1353     $opt_debug
1354     my_filename="$1"
1355     my_srcdir="$2"
1356     my_destdir="$3"
1357     my_fixup_non_subpackage_script="\
1358       s,(LIBOBJS),(ltdl_LIBOBJS),g
1359       s,(LTLIBOBJS),(ltdl_LTLIBOBJS),g
1360       s,libltdl/configure.ac,,
1361       s,libltdl/configure,,
1362       s,libltdl/aclocal.m4,,
1363       s,libltdl/config-h.in,,
1364       s,libltdl/Makefile.am,,
1365       s,libltdl/Makefile.in,,
1366       /^[        ]*\\\\\$/d"
1367     case $my_filename in
1368       Makefile.am)
1369         my_fixup_non_subpackage_script=`echo "$my_fixup_non_subpackage_script" | \
1370                 sed 's,libltdl/,,'`
1371         my_fixup_inc_paths_script= ;;
1372       Makefile.inc)
1373         repl=$ltdldir
1374         repl_uscore=`$ECHO "$repl" | $SED 's,[/.+-],_,g'`
1375         my_fixup_inc_paths_script="\
1376           s,libltdl_,@repl_uscore@_,
1377           s,libltdl/,@repl@/,
1378           s,: libltdl/,: @repl@/,
1379           s, -Ilibltdl , -I@repl@ ,
1380           s,\\\$(libltdl_,\$(@repl_uscore@_,
1381           s,)/libltdl ,)/@repl@ ,
1382           s,@repl_uscore@,${repl_uscore},g
1383           s,@repl@,${repl},g"
1384         ;;
1385     esac
1386
1387     $RM "$my_destdir/$my_filename" 2>/dev/null
1388     $opt_quiet || func_echo "creating file \`$my_destdir/$my_filename'"
1389     if $opt_dry_run; then :;
1390     else
1391       $SED "$my_fixup_non_subpackage_script
1392             $my_fixup_inc_paths_script" \
1393         < "$my_srcdir/$my_filename" > "$my_destdir/$my_filename" ||
1394         func_fatal_error "cannot create $my_destdir/$my_filename"
1395     fi
1396 }
1397
1398 # func_scan_files
1399 # Scan configure.(ac|in) and aclocal.m4 (if present) for use of libltdl
1400 # and libtool.  Possibly running some of these tools if necessary.
1401 # Libtoolize affects the contents of aclocal.m4, and should be run before
1402 # aclocal, so we can't use configure --trace which relies on a consistent
1403 # configure.(ac|in) and aclocal.m4.
1404 func_scan_files ()
1405 {
1406     $opt_debug
1407     # Prefer configure.ac to configure.in
1408     test -f configure.ac && configure_ac=configure.ac
1409     test -f "$configure_ac" || configure_ac=
1410
1411     # Set local variables to reflect contents of configure.ac
1412     my_sed_scan_configure_ac='s,#.*$,,; s,^dnl .*$,,; s, dnl .*$,,;
1413         /AC_INIT/ {
1414             s,^.*$,seen_autoconf=:,
1415             p
1416         }
1417         d'
1418     test -z "$configure_ac" \
1419         || eval `$SED "$my_sed_scan_configure_ac" "$configure_ac"`
1420
1421     $seen_autoconf || {
1422         my_configure_ac=
1423         test -n "$configure_ac" && my_configure_ac="$configure_ac: "
1424         func_verbose "${my_configure_ac}not using Autoconf"
1425
1426         # Make sure ltdldir and ltdl_mode have sensible defaults
1427         # since we return early here:
1428         test -n "$ltdldir" || ltdldir=libltdl
1429         test -n "$ltdl_mode" || ltdl_mode=subproject
1430
1431         return
1432     }
1433
1434     # ---------------------------------------------------- #
1435     # Probe macro usage in configure.ac and/or aclocal.m4. #
1436     # ---------------------------------------------------- #
1437
1438     my_sed_traces='s,#.*$,,; s,^dnl .*$,,; s, dnl .*$,,
1439         s,^.*AC_REQUIRE(.*$,,; s,^.*m4_require(.*$,,;
1440         s,^.*m4_define(.*$,,
1441         s,^.*A[CU]_DEFUN(.*$,,; s,^.*m4_defun(.*$,,
1442         /AC_CONFIG_AUX_DIR(/ {
1443             s,^.*AC_CONFIG_AUX_DIR([[    ]*\([^])]*\).*$,ac_auxdir=\1,
1444             p
1445         }
1446         /AC_CONFIG_MACRO_DIR(/ {
1447             s,^.*AC_CONFIG_MACRO_DIR([[  ]*\([^])]*\).*$,ac_macrodir=\1,
1448             p
1449         }
1450         /_LT_CONFIG_LTDL_DIR(/d
1451         /LT_CONFIG_LTDL_DIR(/ {
1452             s,^.*LT_CONFIG_LTDL_DIR([[   ]*\([^])]*\).*$,ac_ltdldir=\1,
1453             p
1454         }
1455         /\[A[CM]_PROG_LIBTOOL/d
1456         /A[CM]_PROG_LIBTOOL/ {
1457             s,^.*$,seen_libtool=:,
1458             p
1459         }
1460         /the.*option into.*LT_INIT.*parameter/d
1461         /\[LT_INIT/d
1462         /LT_INIT/                {
1463             s,^.*$,seen_libtool=:,
1464             p
1465         }
1466         /\[LTDL_INIT/d
1467         /LTDL_INIT/          {
1468             s,^.*LTDL_INIT([[    ]*\([^])]*\).*$,ltdl_options="\1",
1469             s,^.*LTDL_INIT[      ]*$,seen_ltdl=:,
1470             p
1471         }
1472         /LT_WITH_LTDL/       {
1473             s,^.*$,seen_ltdl=:,
1474             p
1475         }
1476         /AC_LIB_LTDL/        {
1477             s,^.*$,seen_ltdl=:,
1478             p
1479         }
1480         /AC_WITH_LTDL/       {
1481             s,^.*$,seen_ltdl=:,
1482             p
1483         }
1484         d'
1485     eval `cat aclocal.m4 "$configure_ac" 2>/dev/null | $SED "$my_sed_traces"`
1486
1487
1488     # ----------------- #
1489     # Validate ltdldir. #
1490     # ----------------- #
1491
1492     ac_ltdldir=`$ECHO "$ac_ltdldir" | $SED 's,/*$,,'`
1493
1494     # If $configure_ac contains AC_CONFIG_LTDL_DIR, check that its
1495     # arguments were not given in terms of a shell variable!
1496     case "$ac_ltdldir" in
1497       *\$*)
1498         func_fatal_error "can not handle variables in LT_CONFIG_LTDL_DIR"
1499         ;;
1500     esac
1501
1502     # If neither --ltdl nor LT_CONFIG_LTDL_DIR are specified, default to
1503     # `libltdl'.  If both are specified, they must be the same.  Otherwise,
1504     # take the one that is given! (If LT_CONFIG_LTDL_DIR is not specified
1505     # we suggest adding it later in this code.)
1506     case x$ac_ltdldir,x$ltdldir in
1507       x,x)      ltdldir=libltdl         ;;
1508       x*,x)     ltdldir=$ac_ltdldir     ;;
1509       x,x*)     ltdldir=$ltdldir        ;;
1510       *)
1511         test x"$ac_ltdldir" = x"$ltdldir" || \
1512             func_fatal_error "--ltdl='$ltdldir' does not match LT_CONFIG_LTDL_DIR($ac_ltdldir)"
1513         ;;
1514     esac
1515
1516
1517     # ------------------- #
1518     # Validate ltdl_mode. #
1519     # ------------------- #
1520
1521     test -n "$ltdl_options" && seen_ltdl=:
1522
1523     # If $configure_ac contains LTDL_INIT, check that its
1524     # arguments were not given in terms of a shell variable!
1525     case "$ltdl_options" in
1526       *\$*)
1527         func_fatal_error "can not handle variables in LTDL_INIT"
1528         ;;
1529     esac
1530
1531     # Extract mode name from ltdl_options
1532     # FIXME: Diagnose multiple conflicting modes in ltdl_options
1533     ac_ltdl_mode=
1534     case " $ltdl_options " in
1535       *" nonrecursive "*)  ac_ltdl_mode=nonrecursive    ;;
1536       *" recursive "*)     ac_ltdl_mode=recursive       ;;
1537       *" subproject "*)    ac_ltdl_mode=subproject      ;;
1538     esac
1539
1540     # If neither --ltdl nor an LTDL_INIT mode are specified, default to
1541     # `subproject'.  If both are specified, they must be the same.  Otherwise,
1542     # take the one that is given!
1543     case x$ac_ltdl_mode,x$ltdl_mode in
1544       x,x)      ltdl_mode=subproject    ;;
1545       x*,x)     ltdl_mode=$ac_ltdl_mode ;;
1546       x,x*)     ltdl_mode=$ltdl_mode    ;;
1547       *)
1548         test x"$ac_ltdl_mode" = x"$ltdl_mode" || \
1549             func_fatal_error "--$ltdl_mode does not match LTDL_INIT($ac_ltdl_mode)"
1550         ;;
1551     esac
1552
1553     # ---------------- #
1554     # Validate auxdir. #
1555     # ---------------- #
1556
1557     if test -n "$ac_auxdir"; then
1558       # If $configure_ac contains AC_CONFIG_AUX_DIR, check that it was
1559       # not given in terms of a shell variable!
1560       case "$ac_auxdir" in
1561       *\$*)
1562         func_fatal_error "can not handle variables in AC_CONFIG_AUX_DIR"
1563         ;;
1564       *)
1565         auxdir=$ac_auxdir
1566         ;;
1567       esac
1568     else
1569       # Try to discover auxdir the same way it is discovered by configure.
1570       # Note that we default to the current directory.
1571       for dir in . .. ../..; do
1572         if test -f "$dir/install-sh"; then
1573           auxdir=$dir
1574           break
1575         elif test -f "$dir/install.sh"; then
1576           auxdir="$dir"
1577           break
1578         fi
1579       done
1580     fi
1581
1582     # Just use the current directory if all else fails.
1583     test -n "$auxdir" || auxdir=.
1584
1585
1586     # ------------------------------ #
1587     # Find local m4 macro directory. #
1588     # ------------------------------ #
1589
1590     # Hunt for ACLOCAL_AMFLAGS in `Makefile.am' for a `-I' argument.
1591
1592     my_sed_aclocal_flags='
1593         /^[      ]*ACLOCAL_[A-Z_]*FLAGS[         ]*=[    ]*/ {
1594             s,,,
1595             q
1596         }
1597         d'
1598     if test -f Makefile.am; then
1599       my_macrodir_is_next=false
1600       for arg in `$SED "$my_sed_aclocal_flags" Makefile.am`; do
1601         if $my_macrodir_is_next; then
1602           am_macrodir="$arg"
1603           break
1604         else
1605           case $arg in
1606             -I) my_macrodir_is_next=: ;;
1607             -I*)
1608               am_macrodir=`$ECHO "$arg" | sed 's,^-I,,'`
1609               break
1610               ;;
1611             *) my_macrodir_is_next=false ;;
1612           esac
1613         fi
1614       done
1615     fi
1616
1617     macrodir="$ac_macrodir"
1618     test -z "$macrodir" && macrodir="$am_macrodir"
1619
1620     if test -n "$am_macrodir" && test -n "$ac_macrodir"; then
1621       test "$am_macrodir" = "$ac_macrodir" \
1622         || func_fatal_error "AC_CONFIG_MACRO_DIR([$ac_macrodir]) conflicts with ACLOCAL_AMFLAGS=-I $am_macrodir."
1623     fi
1624 }
1625
1626 # func_included_files searchfile
1627 # Output INCLUDEFILE if SEARCHFILE m4_includes it, else output SEARCHFILE.
1628 func_included_files ()
1629 {
1630     $opt_debug
1631     my_searchfile="$1"
1632
1633     my_include_regex=
1634     my_sed_include='
1635         /^m4_include(\[.*\])$/ {
1636             s,^m4_include(\[\(.*\)\])$,\1,
1637             p
1638         }
1639         d'
1640
1641     if test -f "$my_searchfile"; then
1642       $ECHO "$my_searchfile"
1643
1644       # Only recurse when we don't care if all the variables we use get
1645       # trashed, since they are in global scope.
1646       for my_filename in `$SED "$my_sed_include" "$my_searchfile"`; do
1647         func_included_files $my_filename
1648       done
1649     fi
1650 }
1651
1652
1653 # func_serial filename [macro_regex]
1654 # Output the value of the serial number comment in FILENAME, where the
1655 # comment line must also match MACRO_REGEX, if given.
1656 func_serial ()
1657 {
1658     $opt_debug
1659     my_filename="$1"
1660     my_macro_regex="$2"
1661     my_sed_serial='
1662         /^# serial [1-9][0-9.]*[         ]*'"$my_macro_regex"'[  ]*$/ {
1663             s,^# serial \([1-9][0-9.]*\).*$,\1,
1664             q
1665         }
1666         d'
1667
1668     # Search FILENAME and all the files it m4_includes for a serial number
1669     # in the file that AC_DEFUNs MACRO_REGEX.
1670     my_serial=
1671     func_dirname_and_basename "$my_filename"
1672     my_filebase=$func_basename_result
1673     for my_file in `func_included_files "$my_filename"`; do
1674       if test -z "$my_macro_regex" ||
1675          test "$my_filename" = aclocal.m4 ||
1676          test "X$my_macro_regex" = "X$my_filebase" ||
1677          func_grep '^AC_DEFUN(\['"$my_macro_regex" "$my_file"
1678       then
1679         my_serial=`$SED -e "$my_sed_serial" "$my_file"`
1680         break
1681       fi
1682     done
1683
1684     # If the file has no serial number, we assume it's ancient.
1685     test -n "$my_serial" || my_serial=0
1686
1687     $ECHO "$my_serial"
1688 }
1689
1690
1691 # func_serial_max serial1 serial2
1692 # Compare (possibly multi-part, '.' delimited) serial numbers, and
1693 # return the largest in $func_serial_max_result.  If they are the
1694 # same, func_serial_max_result will be empty.
1695 func_serial_max ()
1696 {
1697     $opt_debug
1698     my_serial1="$1"
1699     my_serial2="$2"
1700
1701     my_sed_dot='s/\..*$//g'
1702     my_sed_rest='s/^[0-9][1-9]*\.*//'
1703     my_sed_digits='s/[^0-9.]//g'
1704
1705     # Incase they turn out to be the same, we'll set it to empty
1706     func_serial_max_result=
1707
1708     test "X$1$2" = X`$ECHO "$1$2" | $SED "$my_sed_digits"` || {
1709       func_error "serial numbers \`$1' or \`$2' contain non-digit chars"
1710       return
1711     }
1712
1713     while test -n "$my_serial1$my_serial2"; do
1714       my_serial1_part=`$ECHO "$my_serial1" | $SED "$my_sed_dot"`
1715       my_serial2_part=`$ECHO "$my_serial2" | $SED "$my_sed_dot"`
1716
1717       test -z "$my_serial1_part$my_serial2_part" \
1718         && break
1719
1720       test -z "$my_serial1_part" \
1721         && { func_serial_max_result="$2"; break; }
1722
1723       test -z "$my_serial2_part" \
1724         && { func_serial_max_result="$1"; break; }
1725
1726       test "$my_serial1_part" -gt "$my_serial2_part" \
1727         && { func_serial_max_result="$1"; break; }
1728
1729       test "$my_serial2_part" -gt "$my_serial1_part" \
1730         && { func_serial_max_result="$2"; break; }
1731
1732       my_serial1=`$ECHO "$my_serial1" | $SED "$my_sed_rest"`
1733       my_serial2=`$ECHO "$my_serial2" | $SED "$my_sed_rest"`
1734     done
1735 }
1736
1737
1738 # func_serial_update_check srcfile src_serial destfile dest_serial
1739 # Unless SRC_SERIAL is newer than DEST_SERIAL set $func_serial_update_check
1740 # to 'false'.
1741 func_serial_update_check ()
1742 {
1743     $opt_debug
1744     my_srcfile="$1"
1745     my_src_serial="$2"
1746     my_destfile="$3"
1747     my_dest_serial="$4"
1748     my_update_p=:
1749
1750     if test -f "$my_destfile"; then
1751       test "X$my_src_serial" = "X0" && {
1752         func_warning "no serial number on \`$my_srcfile', not copying."
1753         return
1754       }
1755
1756       # Determine whether the destination has an older serial.
1757       func_serial_max "$my_src_serial" "$my_dest_serial"
1758       test "X$my_src_serial" = "X$func_serial_max_result" || my_update_p=false
1759
1760       test "X$my_src_serial" = "X$func_serial_max_result" \
1761         && func_verbose "\`$my_srcfile' is serial $my_src_serial, greater than $my_dest_serial in \`$my_destfile'"
1762
1763       if test "X$my_dest_serial" = "X$func_serial_max_result"; then
1764         func_verbose "\`$my_srcfile' is serial $my_src_serial, less than $my_dest_serial in \`$my_destfile'"
1765         $opt_force || if test -n "$ac_macrodir$ac_ltdldir"; then
1766            func_error "\`$my_destfile' is newer: use \`--force' to overwrite"
1767         fi
1768       fi
1769     fi
1770
1771     func_serial_update_check_result="$my_update_p"
1772 }
1773
1774
1775 # func_aclocal_update_check filename
1776 # Unless serial number of FILENAME is newer than the matching serial number
1777 # in aclocal.m4, set $func_aclocal_update_check to 'false'.
1778 func_aclocal_update_check ()
1779 {
1780     $opt_debug
1781     my_srcfile="$aclocaldir/$1"
1782     my_destfile="aclocal.m4"
1783
1784     case $need in
1785       libtool.m4)
1786         my_src_serial=`func_serial "$my_srcfile" LT_INIT`
1787         my_dest_serial=`func_serial "$my_destfile" LT_INIT`
1788
1789         # Strictly, this libtoolize ought not to have to deal with ancient
1790         # serial formats, but we accept them here to be complete:
1791         test "X$my_src_serial" = "X0" &&
1792           my_src_serial=`func_serial "$my_srcfile" 'A[CM]_PROG_LIBTOOL'`
1793         test "X$my_dest_serial" = "X0" &&
1794           my_dest_serial=`func_serial "$my_destfile" 'A[CM]_PROG_LIBTOOL'`
1795         ;;
1796       ltdl.m4)
1797         my_src_serial=`func_serial "$my_srcfile" LTDL_INIT`
1798         my_dest_serial=`func_serial "$my_destfile" LTDL_INIT`
1799         ;;
1800       *)
1801         my_src_serial=`func_serial "$my_srcfile" "$need"`
1802         my_dest_serial=`func_serial "$my_destfile" "$need"`
1803         ;;
1804     esac
1805
1806     func_serial_update_check \
1807       "$my_srcfile" "$my_src_serial" "$my_destfile" "$my_dest_serial"
1808
1809     func_aclocal_update_check_result="$func_serial_update_check_result"
1810 }
1811
1812
1813 # func_serial_update filename srcdir destdir [msg_var] [macro_re] [old_macro_re]
1814 # Copy the FILENAME from a SRCDIR to DESTDIR provided that either FILENAME
1815 # has a newer serial number, or DESTFILE does not yet exist, or the user
1816 # specified `--force' at the command line.  If given, MACRO_REGEX or
1817 # OLD_MACRO_REGEX must match any text after "# serial N" in both files.
1818 func_serial_update ()
1819 {
1820     $opt_debug
1821     my_filename="$1"
1822     my_srcdir="$2"
1823     my_destdir="$3"
1824     my_msg_var="$4"
1825     my_macro_regex="$5"
1826     my_old_macro_regex="$6"
1827
1828     my_serial_update_p=:
1829     my_return_status=1
1830     my_srcfile="$my_srcdir/$my_filename"
1831     my_destfile="$my_destdir/$my_filename"
1832
1833     test -f "$my_srcfile" || func_fatal_error "\`$my_srcfile' does not exist."
1834
1835     if test -f "$my_destfile"; then
1836       my_src_serial=`func_serial "$my_srcfile" "$my_macro_regex"`
1837       my_dest_serial=`func_serial "$my_destfile" "$my_macro_regex"`
1838
1839       # Strictly, this libtoolize ought not to have to deal with ancient
1840       # serial formats, but we accept them here to be complete:
1841       test "X$my_src_serial" = "X0" &&
1842         my_src_serial=`func_serial "$my_srcfile" "$my_old_macro_regex"`
1843
1844       test "X$my_dest_serial" = "X0" &&
1845         my_dest_serial=`func_serial "$my_destfile" "$my_old_macro_regex"`
1846
1847       func_serial_update_check \
1848         "$my_srcfile" "$my_src_serial" "$my_destfile" "$my_dest_serial"
1849       my_serial_update_p="$func_serial_update_check_result"
1850     fi
1851
1852     if $my_serial_update_p || $opt_force; then
1853       func_copy "$my_srcfile" "$my_destfile" "$my_msg_var"
1854       my_return_status=$?
1855     elif $opt_force && test "X$my_dest_serial" = "X$my_src_serial"; then
1856       $opt_quiet || func_echo_once "$my_msg_var"
1857       $opt_quiet \
1858         || func_echo "\`$my_destfile' is already up to date."
1859     fi
1860
1861     # Do this after the copy for hand maintained `aclocal.m4', incase
1862     # it has `m4_include([DESTFILE])', so the copy effectively already
1863     # updated `aclocal.m4'.
1864     my_included_files=`func_included_files aclocal.m4`
1865     case `echo " $my_included_files " | $NL2SP` in
1866
1867       # Skip included files:
1868       *" $my_destfile "*) ;;
1869
1870       # Otherwise compare to aclocal.m4 serial number (func_serial
1871       # returns 0 for older macro serial numbers before we provided
1872       # serial tags, so the update message will be correctly given
1873       # if aclocal.m4 contains an untagged --i.e older-- macro file):
1874       *)
1875         if test -f aclocal.m4; then
1876           func_serial_max \
1877               "$my_src_serial" `func_serial aclocal.m4 "$my_macro_regex"`
1878           if test "X$my_src_serial" = "X$func_serial_max_result"; then
1879               func_echo_once "$my_msg_var"
1880               func_echo "You should add the contents of \`$my_destfile' to \`aclocal.m4'."
1881           fi
1882         fi
1883         ;;
1884     esac
1885     return $my_return_status
1886 }
1887
1888
1889 # func_keyword_update filename srcdir destdir sed_script [msg_var]
1890 # Copy the FILENAME from a SRCDIR to DESTDIR provided that either FILENAME
1891 # has a newer revision according to the serial number extracted by
1892 # SED_SCRIPT, or DESTFILE does not yet exist, or the user specified
1893 # `--force' at the command line.
1894 func_keyword_update ()
1895 {
1896     $opt_debug
1897     my_filename="$1"
1898     my_srcdir="$2"
1899     my_destdir="$3"
1900     my_sed_script="$4"
1901     my_msg_var="$5"
1902
1903     my_srcfile="$my_srcdir/$my_filename"
1904     my_destfile="$my_destdir/$my_filename"
1905
1906     my_keyword_update_p=:
1907
1908     test -f "$my_srcfile" || func_fatal_error "\`$my_srcfile' does not exist."
1909
1910     if test -f "$my_destfile"; then
1911       my_src_serial=`$SED -e "$my_sed_script" "$my_srcfile"`
1912       test -z "$my_src_serial" && {
1913         func_warning "no serial number in \`$my_srcfile', not copying."
1914         return
1915       }
1916
1917       my_dest_serial=`$SED -e "$my_sed_script" "$my_destfile"`
1918       test -n "$my_dest_serial" || my_dest_serial=0
1919
1920       func_serial_update_check \
1921          "$my_srcfile" "$my_src_serial" "$my_destfile" "$my_dest_serial"
1922       my_keyword_update_p="$func_serial_update_check_result"
1923     fi
1924
1925     if $my_keyword_update_p || $opt_force; then
1926       func_copy "$my_srcfile" "$my_destfile" "$my_msg_var"
1927     elif $opt_verbose || $opt_force && test "X$my_dest_serial" = "X$my_src_serial"; then
1928       func_echo_once "$my_msg_var"
1929       func_echo "\`$my_destfile' is already up to date."
1930     fi
1931 }
1932
1933
1934 # func_ltmain_update filename srcdir destdir [msg_var]
1935 # Copy the FILENAME from a SRCDIR to DESTDIR provided that either FILENAME
1936 # has a newer revision, or DESTFILE does not yet exist, or the user
1937 # specified `--force' at the command line.
1938 func_ltmain_update ()
1939 {
1940     $opt_debug
1941     my_sed_ltmain='
1942         /^package_revision='\''*[0-9][1-9.]*'\''*/ {
1943             s,^package_revision='\''*\([0-9.]*\)'\''*[   ]*$,\1,
1944             p
1945         }
1946         d'
1947
1948     func_keyword_update "$1" "$2" "$3" "$my_sed_ltmain" "$4"
1949
1950     return $my_return_status
1951 }
1952
1953
1954 # func_config_update filename srcdir destdir [msg_var]
1955 # Copy the FILENAME from a SRCDIR to DESTDIR provided that either FILENAME
1956 # has a newer timestamp, or DESTFILE does not yet exist, or the user
1957 # specified `--force' at the command line.
1958 func_config_update ()
1959 {
1960     $opt_debug
1961     my_sed_config='
1962         /^timestamp='\''*[0-9][1-9-]*'\''*/ {
1963             s,^timestamp='\''*\([0-9-]*\)'\''*,\1,
1964             s/-/./g
1965             p
1966         }
1967         d'
1968
1969     func_keyword_update "$1" "$2" "$3" "$my_sed_config" "$4"
1970
1971     return $my_return_status
1972 }
1973
1974
1975 # func_install_update filename srcdir destdir [msg_var]
1976 # Copy the FILENAME from a SRCDIR to DESTDIR provided that either FILENAME
1977 # has a newer timestamp, or DESTFILE does not yet exist, or the user
1978 # specified `--force' at the command line.
1979 func_install_update ()
1980 {
1981     $opt_debug
1982     my_sed_install='
1983         /^scriptversion='\''*[0-9][1-9.-]*'\''*/ {
1984             s,[#;].*,,
1985             s,^scriptversion='\''*\([0-9.-]*\)'\''*,\1,
1986             s/-/./g
1987             p
1988         }
1989         d'
1990
1991     func_keyword_update "$1" "$2" "$3" "$my_sed_install" "$4"
1992
1993     return $my_return_status
1994 }
1995
1996
1997 # func_massage_aclocal_DATA [glob_exclude]
1998 # @aclocal_DATA\@ is substituted as per its value in Makefile.am;
1999 # this function massages it into a suitable format for func_copy_some_files.
2000 func_massage_aclocal_DATA ()
2001 {
2002     $opt_debug
2003     pkgmacro_files=     # GLOBAL VAR
2004
2005     my_glob_exclude="$1"
2006
2007     # Massage a value for pkgmacro_files from the value used in Makefile.am.
2008     for my_filename in @aclocal_DATA@; do
2009       func_dirname_and_basename "$my_filename"
2010       my_filename=$func_basename_result
2011
2012       # ignore excluded filenames
2013       if test -n "$my_glob_exclude"; then
2014         my_cont=false
2015         eval 'case $my_filename in '$my_glob_exclude') my_cont=: ;; esac'
2016         $my_cont && continue
2017       fi
2018
2019       pkgmacro_files="$pkgmacro_files:$my_filename"
2020     done
2021
2022     # strip spurious leading `:'
2023     pkgmacro_files=`$ECHO "$pkgmacro_files" | $SED 's,^:*,,'`
2024 }
2025
2026
2027 # func_install_pkgmacro_subproject
2028 # Unless --quiet was passed, display a message. Then copy pkgmacro_files
2029 # from libtool installation tree to subproject libltdl tree.
2030 func_install_pkgmacro_subproject ()
2031 {
2032     $opt_debug
2033
2034     # Remove any lingering files that my have been installed by some
2035     # previous libtoolize release:
2036     $opt_force && for file in $all_pkgmacro_files; do
2037       test -f "$subproject_macrodir/$file" && func_verbose "rm -f '$subproject_macrodir/$file'"
2038       rm -f "$subproject_macrodir/$file"
2039     done
2040
2041     # Copy all the files from installed libltdl to this project, if the
2042     # user specified a macrodir.
2043     $opt_quiet || if test "x$macrodir" != "x$subproject_macrodir"; then
2044       pkgmacro_header="putting macros in \`$subproject_macrodir'."
2045     elif test -n "$subproject_macrodir"; then
2046       pkgmacro_header="putting macros in AC_CONFIG_MACRO_DIR, \`$subproject_macrodir'."
2047     fi
2048
2049     func_copy_some_files "argz.m4:libtool.m4:ltdl.m4:$pkgmacro_files" \
2050       "$aclocaldir" "$subproject_macrodir" pkgmacro_header
2051 }
2052
2053
2054 # func_install_pkgmacro_parent
2055 # Unless --quiet was passed, or AC_CONFIG_MACRO_DIR was not seen, display
2056 # a message.  Then update appropriate macros if newer ones are available
2057 # from the libtool installation tree.
2058 func_install_pkgmacro_parent ()
2059 {
2060     $opt_debug
2061
2062     # Remove any lingering files that my have been installed by some
2063     # previous libtoolize release:
2064     $opt_force && for file in $all_pkgmacro_files; do
2065       test -f "$macrodir/$file" && func_verbose "rm -f '$macrodir/$file'"
2066       rm -f "$macrodir/$file"
2067     done
2068
2069     # Copy all the files from installed libltdl to this project, if the
2070     # user specified a macrodir.
2071     $opt_quiet || if test -n "$ac_macrodir"; then
2072       my_pkgmacro_header="putting macros in AC_CONFIG_MACRO_DIR, \`$ac_macrodir'."
2073     elif test -n "$macrodir"; then
2074       my_pkgmacro_header="putting macros in \`$macrodir'."
2075     fi
2076
2077     if $opt_ltdl; then
2078       func_serial_update argz.m4 "$aclocaldir" "$macrodir" \
2079         my_pkgmacro_header argz.m4
2080     else
2081       func_verbose "Not copying \`$macrodir/argz.m4', libltdl not used."
2082     fi
2083
2084     func_serial_update  libtool.m4 "$aclocaldir" "$macrodir" \
2085       my_pkgmacro_header LT_INIT 'A[CM]_PROG_LIBTOOL'
2086
2087     if $opt_ltdl; then
2088       func_serial_update ltdl.m4 "$aclocaldir" "$macrodir" \
2089         my_pkgmacro_header 'LTDL_INIT'
2090     else
2091       func_verbose "Not copying \`$macrodir/ltdl.m4', libltdl not used."
2092     fi
2093
2094     my_save_IFS="$IFS"
2095     IFS=:
2096     for file in $pkgmacro_files; do
2097       IFS="$my_save_IFS"
2098       func_serial_update "$file" "$aclocaldir" "$macrodir" \
2099         my_pkgmacro_header "$file"
2100     done
2101     IFS="$my_save_IFS"
2102 }
2103
2104
2105 # func_install_pkgmacro_files
2106 # Install copies of the libtool and libltdl m4 macros into this package.
2107 func_install_pkgmacro_files ()
2108 {
2109     $opt_debug
2110
2111     # argz.m4, libtool.m4 and ltdl.m4 are handled specially:
2112     func_massage_aclocal_DATA 'argz.m4|libtool.m4|ltdl.m4'
2113
2114   # 1. Parent has separate macrodir to subproject ltdl:
2115     if $opt_ltdl && test "x$ltdl_mode" = "xsubproject" &&
2116        test -n "$macrodir" && test "x$macrodir" != "x$subproject_macrodir"
2117     then
2118       func_install_pkgmacro_parent
2119       func_install_pkgmacro_subproject
2120
2121   # 2. Parent shares macrodir with subproject ltdl:
2122     elif $opt_ltdl && test "x$ltdl_mode" = "xsubproject"
2123        # && test "x$macrodir" = "x$subproject_macrodir"
2124     then
2125       func_install_pkgmacro_subproject
2126
2127   # 3. Not a subproject, but macrodir was specified in parent:
2128     elif test -n "$macrodir"; then
2129       func_install_pkgmacro_parent
2130
2131   # 4. AC_CONFIG_MACRO_DIR was not specified:
2132     else
2133       func_verbose "AC_CONFIG_MACRO_DIR not defined, not copying libtool macros."
2134     fi
2135 }
2136
2137
2138 # func_massage_pkgltdl_files [glob_exclude]
2139 # @pkgltdl_files\@ is substituted as per its value in Makefile.am; this
2140 # function massages it into a suitable format for func_copy_some_files.
2141 func_massage_pkgltdl_files ()
2142 {
2143     $opt_debug
2144     pkgltdl_files=      # GLOBAL VAR
2145
2146     my_glob_exclude="$1"
2147
2148     # Massage a value for pkgltdl_files from the value used in Makefile.am
2149     for my_filename in @pkgltdl_files@; do
2150
2151       # Strip surplus leading 'libltdl/':
2152       my_filename=`expr "X$my_filename" : 'Xlibltdl/\(.*\)'`
2153
2154       # ignore excluded filenames
2155       if test -n "$my_glob_exclude"; then
2156         my_cont=false
2157         eval 'case $my_filename in '$my_glob_exclude') my_cont=: ;; esac'
2158         $my_cont && continue
2159       fi
2160
2161       # ignore duplicates
2162       case :$pkgltdl_files: in
2163         *:$my_filename:*) ;;
2164         *) pkgltdl_files="$pkgltdl_files:$my_filename" ;;
2165       esac
2166     done
2167
2168     # strip spurious leading `:'
2169     pkgltdl_files=`$ECHO "$pkgltdl_files" | $SED 's,^:*,,'`
2170 }
2171
2172
2173 # func_install_pkgltdl_files
2174 # Install copies of the libltdl files into this package.  Any auxiliary
2175 # or m4 macro files needed in the libltdl tree will also be copied by
2176 # func_install_pkgconfig_files and func_install_pkgmacro_files resp.
2177 func_install_pkgltdl_files ()
2178 {
2179     $opt_debug
2180     $opt_ltdl || return
2181
2182     # Remove any lingering files that my have been installed by some
2183     # previous libtoolize release:
2184     $opt_force && for file in $all_pkgltdl_files; do
2185       test -f "$ltdldir/$file" && func_verbose "rm -f '$ltdldir/$file'"
2186       rm -f "$ltdldir/$file"
2187     done
2188
2189     # Copy all the files from installed libltdl to this project, if the
2190     # user specified `--ltdl'.
2191     $opt_quiet || if test -n "$ac_ltdldir"; then
2192       pkgltdl_header="putting libltdl files in LT_CONFIG_LTDL_DIR, \`$ac_ltdldir'."
2193     elif test -n "$ltdldir"; then
2194       pkgltdl_header="putting libltdl files in \`$ltdldir'."
2195     fi
2196
2197     # These files are handled specially, depending on ltdl_mode:
2198     if test "x$ltdl_mode" = "xsubproject"; then
2199       func_massage_pkgltdl_files 'Makefile.inc'
2200     else
2201       func_massage_pkgltdl_files 'Makefile.am|Makefile.in*|aclocal.m4|config*'
2202     fi
2203
2204     func_copy_some_files "$pkgltdl_files" \
2205       "$pkgltdldir/libltdl" "$ltdldir" pkgltdl_header
2206
2207     # For recursive ltdl modes, copy a suitable Makefile.{am,inc}:
2208     case $ltdl_mode in
2209       recursive)
2210         func_fixup_Makefile "Makefile.am" "$pkgltdldir/libltdl" "$ltdldir"
2211         ;;
2212       nonrecursive)
2213         func_fixup_Makefile "Makefile.inc" "$pkgltdldir/libltdl" "$ltdldir"
2214         ;;
2215     esac
2216 }
2217
2218
2219 # func_massage_pkgconfig_files [glob_exclude]
2220 # @pkgconfig_files\@ is substituted as per its value in Makefile.am; this
2221 # function massages it into a suitable format for func_copy_some_files.
2222 func_massage_pkgconfig_files ()
2223 {
2224     $opt_debug
2225     pkgconfig_files=    # GLOBAL VAR
2226
2227     my_glob_exclude="$1"
2228
2229     # Massage a value for pkgconfig_files from the value used in Makefile.am
2230     for my_filename in @pkgconfig_files@; do
2231
2232       # ignore excluded filenames
2233       if test -n "$my_glob_exclude"; then
2234         my_cont=false
2235         eval 'case $my_filename in '$my_glob_exclude') my_cont=: ;; esac'
2236         $my_cont && continue
2237       fi
2238
2239       # ignore duplicates
2240       case :$pkgconfig_files: in
2241         *:$my_filename:*) ;;
2242         *) pkgconfig_files="$pkgconfig_files:$my_filename" ;;
2243       esac
2244     done
2245
2246     # strip spurious leading `:'
2247     pkgconfig_files=`$ECHO "$pkgconfig_files" | $SED 's,^:*,,'`
2248 }
2249
2250
2251 # func_install_pkgconfig_subproject
2252 # Unless --quiet was passed, display a message. Then copy pkgconfig_files
2253 # from libtool installation tree to subproject libltdl tree.
2254 func_install_pkgconfig_subproject ()
2255 {
2256     $opt_debug
2257
2258     # Remove any lingering files that my have been installed by some
2259     # previous libtoolize release:
2260     $opt_force && for file in $all_pkgconfig_files; do
2261       test -f "$subproject_auxdir/$file" && func_verbose "rm -f '$subproject_auxdir/$file'"
2262       rm -f "$subproject_auxdir/$file"
2263     done
2264
2265     # Copy all the files from installed libltdl to this project, if the
2266     # user specified an auxdir.
2267     $opt_quiet || if test "x$ac_auxdir" = "x$subproject_auxdir"; then
2268       pkgconfig_header="putting auxiliary files in AC_CONFIG_AUX_DIR, \`$subproject_auxdir'."
2269     elif test -n "$auxdir"; then
2270       pkgconfig_header="putting auxiliary files in \`$auxdir'."
2271     fi
2272
2273     func_copy_some_files "$pkgconfig_files" \
2274       "$pkgdatadir" "$ltdldir" pkgconfig_header
2275 }
2276
2277
2278 # func_install_pkgconfig_parent
2279 # Unless --quiet was passed, or AC_CONFIG_AUX_DIR was not seen, display a
2280 # message.  Then update appropriate auxiliary files if newer ones are
2281 # available from the libtool installation tree.
2282 func_install_pkgconfig_parent ()
2283 {
2284     $opt_debug
2285
2286     # Remove any lingering files that my have been installed by some
2287     # previous libtoolize release:
2288     $opt_force && for file in $all_pkgconfig_files; do
2289       test -f "$auxdir/$file" && func_verbose "rm -f '$auxdir/$file'"
2290       rm -f "$auxdir/$file"
2291     done
2292
2293     if test -n "$ac_auxdir"; then
2294       pkgconfig_header="putting auxiliary files in AC_CONFIG_AUX_DIR, \`$ac_auxdir'."
2295     elif test -n "$auxdir" || test "x$ltdldir" = "x."; then
2296       pkgconfig_header="putting auxiliary files in \`$auxdir'."
2297     fi
2298
2299     if $opt_install; then
2300       func_config_update config.guess \
2301         "$pkgdatadir/config" "$auxdir" pkgconfig_header
2302       func_config_update config.sub \
2303         "$pkgdatadir/config" "$auxdir" pkgconfig_header
2304       func_install_update install-sh \
2305         "$pkgdatadir/config" "$auxdir" pkgconfig_header
2306     fi
2307     func_ltmain_update ltmain.sh \
2308       "$pkgdatadir/config" "$auxdir" pkgconfig_header
2309 }
2310
2311
2312 # func_install_pkgconfig_files
2313 # Install copies of the auxiliary files into this package according to
2314 # the whether libltdl is included as a subproject, and whether the parent
2315 # shares the AC_CONFIG_AUX_DIR setting.
2316 func_install_pkgconfig_files ()
2317 {
2318     $opt_debug
2319     func_massage_pkgconfig_files
2320
2321   # 1. Parent shares auxdir with subproject ltdl:
2322     if $opt_ltdl && test "x$ltdl_mode" = "xsubproject" &&
2323        test "x$ac_auxdir" = "x$subproject_auxdir"
2324     then
2325       func_install_pkgconfig_subproject
2326
2327   # 2. Parent has separate auxdir to subproject ltdl:
2328     elif $opt_ltdl && test "x$ltdl_mode" = "xsubproject"
2329        # && test "x$auxdir" != "x$subproject_auxdir" is implied
2330     then
2331       if $seen_autoconf; then
2332         func_install_pkgconfig_parent
2333       fi
2334       func_install_pkgconfig_subproject
2335
2336   # 3. Not subproject, but AC_CONFIG_AUX_DIR was used in parent:
2337     elif test -n "$ac_auxdir" || test "x$auxdir" = "x."; then
2338       func_install_pkgconfig_parent
2339
2340   # 4. AC_CONFIG_AUX_DIR was not specified:
2341     else
2342       func_verbose "AC_CONFIG_AUX_DIR not defined, not copying libtool auxiliary files."
2343     fi
2344 }
2345
2346
2347 # func_nonemptydir_p dirvar
2348 # DIRVAR is the name of a variable to evaluate.  Unless DIRVAR names
2349 # a directory that exists and is non-empty abort with a diagnostic.
2350 func_nonemptydir_p ()
2351 {
2352     $opt_debug
2353     my_dirvar="$1"
2354     my_dir=`eval echo "\\\$$my_dirvar"`
2355
2356     # Is it a directory at all?
2357     test -d "$my_dir" \
2358       || func_fatal_error "\$$my_dirvar is not a directory: \`$my_dir'"
2359
2360     # check that the directories contents can be ls'ed
2361     test -n "`{ cd $my_dir && ls; } 2>/dev/null`" \
2362         || func_fatal_error "can not list files: \`$my_dir'"
2363 }
2364
2365
2366 # func_check_macros
2367 # Sanity check macros from aclocal.m4 against installed versions.
2368 func_check_macros ()
2369 {
2370     $opt_debug
2371     $opt_quiet && return
2372     $seen_autoconf || return
2373
2374     ac_config_macro_dir_advised=false
2375
2376     if test -n "$ac_macrodir$ltdldir" && test -z "$macrodir"; then
2377       my_ac_config_macro_srcdir="$aclocaldir"
2378       if $opt_ltdl && test "$macrodir" != "$subproject_macrodir"; then
2379         my_ac_config_macro_srcdir="$subproject_macrodir"
2380       fi
2381
2382       my_needed="libtool.m4 ltoptions.m4 ltversion.m4 ltsugar.m4 lt~obsolete.m4"
2383       $opt_ltdl && my_needed="$my_needed argz.m4 ltdl.m4"
2384
2385       if test -f "aclocal.m4"; then
2386         for need in $my_needed; do
2387           func_aclocal_update_check $need
2388           $func_aclocal_update_check_result && my_missing="$my_missing $need"
2389         done
2390       else
2391         my_missing="$my_needed"
2392       fi
2393
2394       if test -n "$my_missing"; then
2395         func_echo "You should add the contents of the following files to \`aclocal.m4':"
2396         for need in $my_missing; do
2397           func_echo "  \`$my_ac_config_macro_srcdir/$need'"
2398         done
2399
2400         if test "$my_ac_config_macro_srcdir" != "$aclocaldir"; then
2401           func_echo "or else add \`AC_CONFIG_MACRO_DIR([$subproject_macrodir])' to $configure_ac."
2402           ac_config_macro_dir_advised=:
2403         fi
2404       fi
2405     fi
2406
2407     ## ---------------------------------------------------------- ##
2408     ## Since we return early here when --no-warn was given:       ##
2409     ## DO NOT PUT ANYTHING BUT UPGRADE ADVICE MESSAGES BELOW HERE ##
2410     ## ---------------------------------------------------------- ##
2411
2412     $opt_warning || return
2413
2414     $seen_libtool ||
2415       func_echo "Remember to add \`LT_INIT' to $configure_ac."
2416
2417     # Suggest using LTDL_INIT if appropriate:
2418     $opt_ltdl && if test x$seen_ltdl != x:; then
2419       case $ltdl_mode in
2420         subproject) ltdl_init_args=""               ;;
2421         *)          ltdl_init_args="([$ltdl_mode])" ;;
2422       esac
2423       func_echo "Remember to add \`LTDL_INIT$ltdl_init_args' to $configure_ac."
2424     fi
2425
2426     if $opt_ltdl; then
2427       # Remind the user to call LT_CONFIG_LTDL_DIR:
2428       test -n "$ac_ltdldir" ||
2429         func_echo "Remember to add \`LT_CONFIG_LTDL_DIR([$ltdldir])' to \`$configure_ac'."
2430
2431       # For subproject mode, offer some suggestions for avoiding duplicate
2432       # files in a project that uses libltdl:
2433       if test "x$ltdl_mode" = "xsubproject"; then
2434         test "$subproject_auxdir" = "$auxdir" ||
2435           func_echo "Consider using \`AC_CONFIG_AUX_DIR([$subproject_auxdir])' in $configure_ac."
2436         $ac_config_macro_dir_advised || test "$subproject_macrodir" = "$macrodir" ||
2437           func_echo "Consider using \`AC_CONFIG_MACRO_DIR([$subproject_macrodir])' in $configure_ac."
2438         ac_config_macro_dir_advised=:
2439       fi
2440     fi
2441
2442     # Suggest modern idioms for storing autoconf macros:
2443     $ac_config_macro_dir_advised || if test -z "$ac_macrodir" || test x"$macrodir" = x.; then
2444       func_echo "Consider adding \`AC_CONFIG_MACRO_DIR([m4])' to $configure_ac and"
2445       func_echo "rerunning $progname, to keep the correct libtool macros in-tree."
2446       ac_config_macro_dir_advised=:
2447
2448     elif test -z "$ac_macrodir$ltdldir"; then
2449       func_echo "Consider adding \`AC_CONFIG_MACRO_DIR([$macrodir])' to $configure_ac,"
2450       func_echo "and rerunning $progname and aclocal."
2451       ac_config_macro_dir_advised=:
2452     fi
2453
2454     if test -z "$am_macrodir$macrodir"; then
2455       func_echo "Consider adding \`-I m4' to ACLOCAL_AMFLAGS in Makefile.am."
2456
2457     elif test -z "$am_macrodir"; then
2458       if $opt_ltdl && test "x$ltdl_mode" = "xsubproject" && test "$subproject_macrodir" != "$macrodir"; then
2459         func_echo "Consider adding \`-I $subproject_macrodir' to ACLOCAL_AMFLAGS in Makefile.am."
2460       else
2461         func_echo "Consider adding \`-I $macrodir' to ACLOCAL_AMFLAGS in Makefile.am."
2462       fi
2463     fi
2464
2465     # Don't trace for this, we're just checking the user didn't invoke it
2466     # directly from configure.ac.
2467     $SED 's,dnl .*$,,; s,# .*$,,' "$configure_ac" | grep AC_PROG_RANLIB >/dev/null &&
2468       func_echo "\`AC_PROG_RANLIB' is rendered obsolete by \`LT_INIT'"
2469
2470     # FIXME: Ensure ltmain.sh, libtool.m4 and ltdl.m4 are from the same release
2471 }
2472
2473
2474 ## ----------- ##
2475 ##    Main.    ##
2476 ## ----------- ##
2477
2478 {
2479   # Lists of all files libtoolize has ever installed.  These are removed
2480   # before installing the latest files when --force was passed to help
2481   # ensure a clean upgrade.
2482   # Do not remove config.guess nor config.sub, we don't install them
2483   # without --install, and the project may not be using Automake.
2484   all_pkgconfig_files="ltmain.sh"
2485   all_pkgmacro_files="argz.m4 libtool.m4 ltdl.m4 ltoptions.m4 ltsugar.m4 ltversion.in ltversion.m4 lt~obsolete.m4"
2486   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__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__dirent.c lt__strl.c lt_dlloader.c lt_error.c ltdl.c ltdl.h slist.c"
2487
2488   # Locations for important files:
2489   prefix=@prefix@
2490   datadir=@datadir@
2491   pkgdatadir=@pkgdatadir@
2492   pkgltdldir=@pkgdatadir@
2493   aclocaldir=@aclocaldir@
2494   auxdir=
2495   macrodir=
2496   configure_ac=configure.in
2497
2498   seen_autoconf=false
2499   seen_libtool=false
2500   seen_ltdl=false
2501
2502   # test EBCDIC or ASCII
2503   case `echo X|tr X '\101'` in
2504    A) # ASCII based system
2505       # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr
2506     SP2NL='tr \040 \012'
2507     NL2SP='tr \015\012 \040\040'
2508     ;;
2509    *) # EBCDIC based system
2510     SP2NL='tr \100 \n'
2511     NL2SP='tr \r\n \100\100'
2512     ;;
2513   esac
2514
2515   # Allow the user to override the master libtoolize repository:
2516   if test -n "$_lt_pkgdatadir"; then
2517     pkgltdldir="$_lt_pkgdatadir"
2518     pkgdatadir="$_lt_pkgdatadir/libltdl"
2519     aclocaldir="$_lt_pkgdatadir/libltdl/m4"
2520   fi
2521   func_nonemptydir_p pkgltdldir
2522   func_nonemptydir_p pkgdatadir
2523   func_nonemptydir_p aclocaldir
2524
2525   func_scan_files
2526
2527   case $ltdldir in
2528   .) ltdlprefix= ;;
2529   *) ltdlprefix=$ltdldir/ ;;
2530   esac
2531   subproject_auxdir=${ltdlprefix}config
2532   subproject_macrodir=${ltdlprefix}m4
2533
2534   # :::BE CAREFUL HERE:::
2535   # func_check_macros needs to check whether --ltdl was specified when
2536   # LTDL_INIT was not seen, so we can't just use one variable for both
2537   # conditions, or that check will be impossible.   No need to clutter the
2538   # rest of the code with '$opt_ltdl || $seen_ltdl' though, because we CAN
2539   # safely set opt_ltdl to true if LTDL_INIT was seen:
2540   $seen_ltdl && opt_ltdl=:
2541
2542   func_install_pkgconfig_files
2543   func_install_pkgmacro_files
2544   func_install_pkgltdl_files
2545
2546   func_check_macros
2547 }
2548
2549 exit $exit_status
2550
2551 # Local Variables:
2552 # mode:shell-script
2553 # sh-indentation:2
2554 # End:
2555