2 # Generated from tests/defs.m4sh by GNU Autoconf 2.68.
4 # defs -- Defines for Libtool testing environment.
6 # Copyright (C) 2003, 2004, 2005, 2007, 2008, 2009, 2010 Free Software
8 # Written by Gord Matzigkeit, 1996
9 # Rewritten by Gary V. Vaughan, 2003
11 # This file is part of GNU Libtool.
13 # GNU Libtool is free software; you can redistribute it and/or
14 # modify it under the terms of the GNU General Public License as
15 # published by the Free Software Foundation; either version 2 of
16 # the License, or (at your option) any later version.
18 # GNU Libtool is distributed in the hope that it will be useful,
19 # but WITHOUT ANY WARRANTY; without even the implied warranty of
20 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 # GNU General Public License for more details.
23 # You should have received a copy of the GNU General Public License
24 # along with GNU Libtool; see the file COPYING. If not, a copy
25 # can be downloaded from http://www.gnu.org/licenses/gpl.html,
26 # or obtained by writing to the Free Software Foundation, Inc.,
27 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
30 # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
31 # is ksh but when the shell is invoked as "sh" and the current value of
32 # the _XPG environment variable is not equal to 1 (one), the special
33 # positional parameter $0, within a function call, is the name of the
37 ## -------------------- ##
38 ## M4sh Initialization. ##
39 ## -------------------- ##
41 # Be more Bourne compatible
42 DUALCASE=1; export DUALCASE # for MKS sh
43 if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then :
46 # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
47 # is contrary to our usage. Disable this feature.
48 alias -g '${1+"$@"}'='"$@"'
51 case `(set -o) 2>/dev/null` in #(
63 # Printing a long string crashes Solaris 7 /usr/bin/printf.
64 as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
65 as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo
66 as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo
67 # Prefer a ksh shell builtin over an external printf program on Solaris,
68 # but without wasting forks for bash or zsh.
69 if test -z "$BASH_VERSION$ZSH_VERSION" \
70 && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then
72 as_echo_n='print -rn --'
73 elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
77 if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then
78 as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"'
79 as_echo_n='/usr/ucb/echo -n'
81 as_echo_body='eval expr "X$1" : "X\\(.*\\)"'
86 expr "X$arg" : "X\\(.*\\)$as_nl";
87 arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;;
89 expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl"
92 as_echo_n='sh -c $as_echo_n_body as_echo'
95 as_echo='sh -c $as_echo_body as_echo'
98 # The user is always right.
99 if test "${PATH_SEPARATOR+set}" != set; then
101 (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
102 (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
109 # We need space, tab and new line, in precisely that order. Quoting is
110 # there to prevent editors from complaining about space-tab.
111 # (If _AS_PATH_WALK were called with IFS unset, it would disable word
112 # splitting by setting IFS to empty value.)
115 # Find who we are. Look in the path if we contain no directory separator.
118 *[\\/]* ) as_myself=$0 ;;
119 *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
123 test -z "$as_dir" && as_dir=.
124 test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
130 # We did not find ourselves, most probably we were run as `sh COMMAND'
131 # in which case we are not to be found in the path.
132 if test "x$as_myself" = x; then
135 if test ! -f "$as_myself"; then
136 $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
140 # Unset variables that we do not need and which cause bugs (e.g. in
141 # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1"
142 # suppresses any "Segmentation fault" message there. '((' could
143 # trigger a bug in pdksh 5.2.14.
144 for as_var in BASH_ENV ENV MAIL MAILPATH
145 do eval test x\${$as_var+set} = xset \
146 && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || :
159 (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
161 if test "x$CONFIG_SHELL" = x; then
162 as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then :
165 # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which
166 # is contrary to our usage. Disable this feature.
167 alias -g '\${1+\"\$@\"}'='\"\$@\"'
170 case \`(set -o) 2>/dev/null\` in #(
178 as_required="as_fn_return () { (exit \$1); }
179 as_fn_success () { as_fn_return 0; }
180 as_fn_failure () { as_fn_return 1; }
181 as_fn_ret_success () { return 0; }
182 as_fn_ret_failure () { return 1; }
185 as_fn_success || { exitcode=1; echo as_fn_success failed.; }
186 as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; }
187 as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; }
188 as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; }
189 if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then :
192 exitcode=1; echo positional parameters were not saved.
194 test x\$exitcode = x0 || exit 1"
196 if (eval "$as_required") 2>/dev/null; then :
201 if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then :
204 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
206 for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
209 test -z "$as_dir" && as_dir=.
213 for as_base in sh bash ksh sh5; do
214 # Try only shells that exist, to save several forks.
215 as_shell=$as_dir/$as_base
216 if { test -f "$as_shell" || test -f "$as_shell.exe"; } &&
217 { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then :
218 CONFIG_SHELL=$as_shell as_have_required=yes
225 $as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } &&
226 { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then :
227 CONFIG_SHELL=$SHELL as_have_required=yes
232 if test "x$CONFIG_SHELL" != x; then :
233 # We cannot yet assume a decent shell, so we have to provide a
234 # neutralization value for shells without unset; and this also
235 # works around shells that cannot unset nonexistent variables.
236 # Preserve -v and -x to the replacement shell.
239 (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
242 *v*x* | *x*v* ) as_opts=-vx ;;
247 exec "$CONFIG_SHELL" $as_opts "$as_myself" ${1+"$@"}
250 if test x$as_have_required = xno; then :
251 $as_echo "$0: This script requires a shell more modern than all"
252 $as_echo "$0: the shells that I found on your system."
253 if test x${ZSH_VERSION+set} = xset ; then
254 $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should"
255 $as_echo "$0: be upgraded to zsh 4.3.4 or later."
257 $as_echo "$0: Please tell bug-autoconf@gnu.org about your system,
258 $0: including any error possibly output before this
259 $0: message. Then install a modern shell, or manually run
260 $0: the script under such a shell if you do have one."
266 SHELL=${CONFIG_SHELL-/bin/sh}
268 # Unset more variables known to interfere with behavior of common tools.
269 CLICOLOR_FORCE= GREP_OPTIONS=
270 unset CLICOLOR_FORCE GREP_OPTIONS
272 ## --------------------- ##
273 ## M4sh Shell Functions. ##
274 ## --------------------- ##
277 # Portably unset VAR.
280 { eval $1=; unset $1;}
283 ## -------------------- ##
284 ## Main body of script. ##
285 ## -------------------- ##
291 test "${ECHO+set}" = set || ECHO=${as_echo-'printf %s\n'}
301 : ${SHELL="${CONFIG_SHELL-/bin/sh}"}
302 : ${Xsed="$SED -e 1s/^X//"}
307 EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing.
308 EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake.
310 exit_status=$EXIT_SUCCESS
312 # Make sure IFS has a sensible default
317 dirname="s,/[^/]*$,,"
320 # func_dirname file append nondir_replacement
321 # Compute the dirname of FILE. If nonempty, add APPEND to the result,
322 # otherwise set result to NONDIR_REPLACEMENT.
325 func_dirname_result=`$ECHO "${1}" | $SED "$dirname"`
326 if test "X$func_dirname_result" = "X${1}"; then
327 func_dirname_result="${3}"
329 func_dirname_result="$func_dirname_result${2}"
331 } # func_dirname may be replaced by extended shell implementation
337 func_basename_result=`$ECHO "${1}" | $SED "$basename"`
338 } # func_basename may be replaced by extended shell implementation
341 # func_dirname_and_basename file append nondir_replacement
342 # perform func_basename and func_dirname in a single function
344 # dirname: Compute the dirname of FILE. If nonempty,
345 # add APPEND to the result, otherwise set result
346 # to NONDIR_REPLACEMENT.
347 # value returned in "$func_dirname_result"
348 # basename: Compute filename of FILE.
349 # value retuned in "$func_basename_result"
350 # Implementation must be kept synchronized with func_dirname
351 # and func_basename. For efficiency, we do not delegate to
352 # those functions but instead duplicate the functionality here.
353 func_dirname_and_basename ()
355 # Extract subdirectory from the argument.
356 func_dirname_result=`$ECHO "${1}" | $SED -e "$dirname"`
357 if test "X$func_dirname_result" = "X${1}"; then
358 func_dirname_result="${3}"
360 func_dirname_result="$func_dirname_result${2}"
362 func_basename_result=`$ECHO "${1}" | $SED -e "$basename"`
363 } # func_dirname_and_basename may be replaced by extended shell implementation
366 # func_stripname prefix suffix name
367 # strip PREFIX and SUFFIX off of NAME.
368 # PREFIX and SUFFIX must not contain globbing or regex special
369 # characters, hashes, percent signs, but SUFFIX may contain a leading
370 # dot (in which case that matches only a dot).
371 # func_strip_suffix prefix name
375 .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;;
376 *) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;;
378 } # func_stripname may be replaced by extended shell implementation
381 # These SED scripts presuppose an absolute path with a trailing slash.
382 pathcar='s,^/\([^/]*\).*$,\1,'
383 pathcdr='s,^/[^/]*,,'
384 removedotparts=':dotsl
388 collapseslashes='s@/\{1,\}@/@g'
389 finalslash='s,/*$,/,'
391 # func_normal_abspath PATH
392 # Remove doubled-up and trailing slashes, "." path components,
393 # and cancel out any ".." path components in PATH after making
394 # it an absolute path.
395 # value returned in "$func_normal_abspath_result"
396 func_normal_abspath ()
398 # Start from root dir and reassemble the path.
399 func_normal_abspath_result=
400 func_normal_abspath_tpath=$1
401 func_normal_abspath_altnamespace=
402 case $func_normal_abspath_tpath in
404 # Empty path, that just means $cwd.
405 func_stripname '' '/' "`pwd`"
406 func_normal_abspath_result=$func_stripname_result
409 # The next three entries are used to spot a run of precisely
410 # two leading slashes without using negated character classes;
411 # we take advantage of case's first-match behaviour.
413 # Unusual form of absolute path, do nothing.
416 # Not necessarily an ordinary path; POSIX reserves leading '//'
417 # and for example Cygwin uses it to access remote file shares
418 # over CIFS/SMB, so we conserve a leading double slash if found.
419 func_normal_abspath_altnamespace=/
422 # Absolute path, do nothing.
425 # Relative path, prepend $cwd.
426 func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath
429 # Cancel out all the simple stuff to save iterations. We also want
430 # the path to end with a slash for ease of parsing, so make sure
431 # there is one (and only one) here.
432 func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
433 -e "$removedotparts" -e "$collapseslashes" -e "$finalslash"`
435 # Processed it all yet?
436 if test "$func_normal_abspath_tpath" = / ; then
437 # If we ascended to the root using ".." the result may be empty now.
438 if test -z "$func_normal_abspath_result" ; then
439 func_normal_abspath_result=/
443 func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \
445 func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
447 # Figure out what to do with it
448 case $func_normal_abspath_tcomponent in
450 # Trailing empty path component, ignore it.
453 # Parent dir; strip last assembled component from result.
454 func_dirname "$func_normal_abspath_result"
455 func_normal_abspath_result=$func_dirname_result
458 # Actual path component, append it.
459 func_normal_abspath_result=$func_normal_abspath_result/$func_normal_abspath_tcomponent
463 # Restore leading double-slash if one was found on entry.
464 func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result
467 # func_relative_path SRCDIR DSTDIR
468 # generates a relative path from SRCDIR to DSTDIR, with a trailing
469 # slash if non-empty, suitable for immediately appending a filename
470 # without needing to append a separator.
471 # value returned in "$func_relative_path_result"
472 func_relative_path ()
474 func_relative_path_result=
475 func_normal_abspath "$1"
476 func_relative_path_tlibdir=$func_normal_abspath_result
477 func_normal_abspath "$2"
478 func_relative_path_tbindir=$func_normal_abspath_result
480 # Ascend the tree starting from libdir
482 # check if we have found a prefix of bindir
483 case $func_relative_path_tbindir in
484 $func_relative_path_tlibdir)
485 # found an exact match
486 func_relative_path_tcancelled=
489 $func_relative_path_tlibdir*)
490 # found a matching prefix
491 func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir"
492 func_relative_path_tcancelled=$func_stripname_result
493 if test -z "$func_relative_path_result"; then
494 func_relative_path_result=.
499 func_dirname $func_relative_path_tlibdir
500 func_relative_path_tlibdir=${func_dirname_result}
501 if test "x$func_relative_path_tlibdir" = x ; then
502 # Have to descend all the way to the root!
503 func_relative_path_result=../$func_relative_path_result
504 func_relative_path_tcancelled=$func_relative_path_tbindir
507 func_relative_path_result=../$func_relative_path_result
512 # Now calculate path; take care to avoid doubling-up slashes.
513 func_stripname '' '/' "$func_relative_path_result"
514 func_relative_path_result=$func_stripname_result
515 func_stripname '/' '/' "$func_relative_path_tcancelled"
516 if test "x$func_stripname_result" != x ; then
517 func_relative_path_result=${func_relative_path_result}/${func_stripname_result}
520 # Normalisation. If bindir is libdir, return empty string,
521 # else relative path ending with a slash; either way, target
522 # file name can be directly appended.
523 if test ! -z "$func_relative_path_result"; then
524 func_stripname './' '' "$func_relative_path_result/"
525 func_relative_path_result=$func_stripname_result
529 # The name of this program:
530 func_dirname_and_basename "$progpath"
531 progname=$func_basename_result
533 # Make sure we have an absolute path for reexecution:
535 [\\/]*|[A-Za-z]:\\*) ;;
537 progdir=$func_dirname_result
538 progdir=`cd "$progdir" && pwd`
539 progpath="$progdir/$progname"
543 IFS=${PATH_SEPARATOR-:}
544 for progdir in $PATH; do
546 test -x "$progdir/$progname" && break
549 test -n "$progdir" || progdir=`pwd`
550 progpath="$progdir/$progname"
554 # Sed substitution that helps us do robust quoting. It backslashifies
555 # metacharacters that are still active within double-quoted strings.
556 Xsed="${SED}"' -e 1s/^X//'
557 sed_quote_subst='s/\([`"$\\]\)/\\\1/g'
559 # Same as above, but do not quote variable references.
560 double_quote_subst='s/\(["`\\]\)/\\\1/g'
562 # Sed substitution that turns a string into a regex matching for the
564 sed_make_literal_regex='s,[].[^$\\*\/],\\&,g'
566 # Sed substitution that converts a w32 file name or path
567 # which contains forward slashes, into one that contains
568 # (escaped) backslashes. A very naive implementation.
569 lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
571 # Re-`\' parameter expansions in output of double_quote_subst that were
572 # `\'-ed in input to the same. If an odd number of `\' preceded a '$'
573 # in input to double_quote_subst, that '$' was protected from expansion.
574 # Since each input `\' is now two `\'s, look for any number of runs of
575 # four `\'s followed by two `\'s and then a '$'. `\' that '$'.
580 sed_double_backslash="\
584 s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g
595 # Echo program name prefixed message, along with the current mode
596 # name if it has been set yet.
599 $ECHO "$progname: ${opt_mode+$opt_mode: }$*"
602 # func_verbose arg...
603 # Echo program name prefixed message in verbose mode only.
606 $opt_verbose && func_echo ${1+"$@"}
608 # A bug in bash halts the script if the last line of a function
609 # fails when set -e is in force, so we need another command to
614 # func_echo_all arg...
615 # Invoke $ECHO with all args, space-separated.
622 # Echo program name prefixed message to standard error.
625 $ECHO "$progname: ${opt_mode+$opt_mode: }"${1+"$@"} 1>&2
628 # func_warning arg...
629 # Echo program name prefixed warning message to standard error.
632 $opt_warning && $ECHO "$progname: ${opt_mode+$opt_mode: }warning: "${1+"$@"} 1>&2
638 # func_fatal_error arg...
639 # Echo program name prefixed message to standard error, and exit.
646 # func_fatal_help arg...
647 # Echo program name prefixed message to standard error, followed by
648 # a help hint, and exit.
652 func_fatal_error "$help"
654 help="Try \`$progname --help' for more information." ## default
657 # func_grep expression filename
658 # Check whether EXPRESSION matches any line of FILENAME, without output.
661 $GREP "$1" "$2" >/dev/null 2>&1
665 # func_mkdir_p directory-path
666 # Make sure the entire path to DIRECTORY-PATH is available.
669 my_directory_path="$1"
672 if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then
674 # Protect directory names starting with `-'
675 case $my_directory_path in
676 -*) my_directory_path="./$my_directory_path" ;;
679 # While some portion of DIR does not yet exist...
680 while test ! -d "$my_directory_path"; do
681 # ...make a list in topmost first order. Use a colon delimited
682 # list incase some portion of path contains whitespace.
683 my_dir_list="$my_directory_path:$my_dir_list"
685 # If the last portion added has no slash in it, the list is done
686 case $my_directory_path in */*) ;; *) break ;; esac
688 # ...otherwise throw away the child directory and loop
689 my_directory_path=`$ECHO "$my_directory_path" | $SED -e "$dirname"`
691 my_dir_list=`$ECHO "$my_dir_list" | $SED 's,:*$,,'`
693 save_mkdir_p_IFS="$IFS"; IFS=':'
694 for my_dir in $my_dir_list; do
695 IFS="$save_mkdir_p_IFS"
696 # mkdir can fail with a `File exist' error if two processes
697 # try to create one of the directories concurrently. Don't
699 $MKDIR "$my_dir" 2>/dev/null || :
701 IFS="$save_mkdir_p_IFS"
703 # Bail out if we (or some other process) failed to create a directory.
704 test -d "$my_directory_path" || \
705 func_fatal_error "Failed to create \`$1'"
710 # func_mktempdir [string]
711 # Make a temporary directory that won't clash with other running
712 # libtool processes, and avoids race conditions if possible. If
713 # given, STRING is the basename for that directory.
716 my_template="${TMPDIR-/tmp}/${1-$progname}"
718 if test "$opt_dry_run" = ":"; then
719 # Return a directory name, but don't create it in dry-run mode
720 my_tmpdir="${my_template}-$$"
723 # If mktemp works, use that first and foremost
724 my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
726 if test ! -d "$my_tmpdir"; then
727 # Failing that, at least try and use $RANDOM to avoid a race
728 my_tmpdir="${my_template}-${RANDOM-0}$$"
730 save_mktempdir_umask=`umask`
733 umask $save_mktempdir_umask
736 # If we're not in dry-run mode, bomb out on failure
737 test -d "$my_tmpdir" || \
738 func_fatal_error "cannot create temporary directory \`$my_tmpdir'"
745 # func_quote_for_eval arg
746 # Aesthetically quote ARG to be evaled later.
747 # This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT
748 # is double-quoted, suitable for a subsequent eval, whereas
749 # FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters
750 # which are still active within double quotes backslashified.
751 func_quote_for_eval ()
755 func_quote_for_eval_unquoted_result=`$ECHO "$1" | $SED "$sed_quote_subst"` ;;
757 func_quote_for_eval_unquoted_result="$1" ;;
760 case $func_quote_for_eval_unquoted_result in
761 # Double-quote args containing shell metacharacters to delay
762 # word splitting, command substitution and and variable
763 # expansion for a subsequent eval.
764 # Many Bourne shells cannot handle close brackets correctly
765 # in scan sets, so we specify it separately.
766 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
767 func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\""
770 func_quote_for_eval_result="$func_quote_for_eval_unquoted_result"
775 # func_quote_for_expand arg
776 # Aesthetically quote ARG to be evaled later; same as above,
777 # but do not quote variable references.
778 func_quote_for_expand ()
782 my_arg=`$ECHO "$1" | $SED \
783 -e "$double_quote_subst" -e "$sed_double_backslash"` ;;
789 # Double-quote args containing shell metacharacters to delay
790 # word splitting and command substitution for a subsequent eval.
791 # Many Bourne shells cannot handle close brackets correctly
792 # in scan sets, so we specify it separately.
793 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
798 func_quote_for_expand_result="$my_arg"
802 # func_show_eval cmd [fail_exp]
803 # Unless opt_silent is true, then output CMD. Then, if opt_dryrun is
804 # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
805 # is given, then evaluate it.
811 ${opt_silent-false} || {
812 func_quote_for_expand "$my_cmd"
813 eval "func_echo $func_quote_for_expand_result"
816 if ${opt_dry_run-false}; then :; else
819 if test "$my_status" -eq 0; then :; else
820 eval "(exit $my_status); $my_fail_exp"
826 # func_show_eval_locale cmd [fail_exp]
827 # Unless opt_silent is true, then output CMD. Then, if opt_dryrun is
828 # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
829 # is given, then evaluate it. Use the saved locale for evaluation.
830 func_show_eval_locale ()
835 ${opt_silent-false} || {
836 func_quote_for_expand "$my_cmd"
837 eval "func_echo $func_quote_for_expand_result"
840 if ${opt_dry_run-false}; then :; else
841 eval "$lt_user_locale
844 eval "$lt_safe_locale"
845 if test "$my_status" -eq 0; then :; else
846 eval "(exit $my_status); $my_fail_exp"
852 # Turn $1 into a string suitable for a shell variable name.
853 # Result is stored in $func_tr_sh_result. All characters
854 # not in the set a-zA-Z0-9_ are replaced with '_'. Further,
855 # if $1 begins with a digit, a '_' is prepended as well.
859 [0-9]* | *[!a-zA-Z0-9_]*)
860 func_tr_sh_result=`$ECHO "$1" | $SED 's/^\([0-9]\)/_\1/; s/[^a-zA-Z0-9_]/_/g'`
871 : ${AUTOCONF="autoconf"}
872 : ${AUTORECONF="autoreconf"}
873 : ${LIBTOOL="./libtool"}
875 # Sed that helps us avoid accidentally triggering echo(1) options like -n.
876 Xsed="$SED -e 1s/^X//"
878 # Disable usage of config.site for autoconf, unless DJGPP is present.
879 # The DJGPP port of autoconf requires config.site, to work correctly.
880 if test -z "$DJGPP"; then
881 CONFIG_SITE=/nonexistent
884 # How verbose should we be? Default is test output in log file.
885 # Setting VERBOSE=debug puts the shell in debug mode.
894 if test -z "$srcdir"; then
895 srcdir=`$ECHO "$0" | $SED "$dirname; s,/tests\$,,"`
896 test "$srcdir" = "$0" && srcdir=.
900 # Echo message with prefix.
903 func_echo "=== " ${1+"$@"}
907 # Echo message to standard error, and skip the rest of this test.
915 # Echo message to standard error, and fail this test.
918 func_fatal_error ${1+"$@"}
921 # func_get_config varname_list src [failp] [regex]
927 my_failp="false"; test -z "$3" || my_failp=:
931 if test -z "$my_regex"; then
939 for my_varname in $my_varname_list; do
940 if $my_build_regex; then
941 $my_first || my_regex="$my_regex|"
943 my_regex="$my_regex$my_varname"
945 eval $my_varname=NONE
947 $my_build_regex && my_regex="$my_regex)="
948 eval `eval "$my_src" | eval "$EGREP \"$my_regex\""`
950 for my_varname in $my_varname_list; do
951 if eval test x\"\$$my_varname\" = xNONE; then
952 func_error "$my_varname not set in \`$my_src'"
953 $my_failp && my_exitp=:
957 $my_exitp && exit $EXIT_FAILURE
961 # Extract some variables from the libtool configuration.
962 func_get_config "objext
969 build_alias" "$LIBTOOL --config" ": fatal"
976 # An absolute path to a test installation directory.
977 func_mkdir_p "$prefix"
978 prefix=`cd $prefix && pwd`
985 test -d $prefix && rm -rf $prefix
990 # Make sure a directory exists, and then change to it.
996 # Maybe we have a VPATH build, in which case, create a new subdir.
997 func_mkdir_p "$my_dir"
999 # Change to our build directory.
1000 cd "$my_dir" || func_fatal_error "couldn't cd to \`$my_dir'"
1004 # func_require prereq file [...]
1005 # If FILE does not exist, give a fatal error regarding running PREREQ first.
1009 my_prereq="$1"; shift
1012 for my_file in $my_files; do
1013 test -f "$my_file" \
1014 || func_skip "You must run ${my_prereq}.test before running $0"
1018 # func_configure_nofail [args ...]
1019 # Configure the demonstration.
1020 func_configure_nofail ()
1024 func_dirname_and_basename "`pwd`"
1025 my_dir=$func_basename_result
1026 my_testdir="$srcdir/tests/$my_dir"
1027 conf_status=$EXIT_FAILURE
1029 test -n "$my_args" && my_args=" $my_args"
1030 my_args="--srcdir="\""$my_testdir"\"" --prefix="\""$prefix"\""$my_args"
1031 test -n "$host_alias" && my_args="$my_args --host=\"$host_alias\""
1032 test -n "$build_alias" && my_args="$my_args --build=\"$build_alias\""
1034 func_msg "Configuring in $my_dir"
1036 test -f "$my_testdir/configure" || ${AUTORECONF} --force --install $my_testdir
1037 if test -f "$my_testdir/configure"; then
1039 eval func_msg $SHELL "$my_testdir/configure" $my_args
1040 if eval $SHELL "$my_testdir/configure" $my_args; then
1041 conf_status=$EXIT_SUCCESS
1043 func_msg "FAILED: Configuring in $my_testdir"
1049 # func_configure [args ...]
1050 # Configure the demonstration, fail on error.
1053 func_configure_nofail ${1+"$@"}
1054 if test "$conf_status" -eq "$EXIT_FAILURE"; then
1059 # func_check_static_shared staticp sharedp
1060 # Determine whether the generated libtool script is configured properly
1061 # for the expected STATICP and SHAREDP library building
1062 func_check_static_shared ()
1068 if func_grep "^build_old_libs=$staticp" libtool &&
1069 func_grep "^build_libtool_libs=$sharedp" libtool; then :
1077 # func_make [args ...]
1078 # Do the actual build.
1083 func_dirname_and_basename "`pwd`"
1084 func_msg "Running \`$MAKE $my_args' in $func_basename_result"
1086 eval $MAKE $my_args || exit $EXIT_FAIL
1091 # Possibly clean up the distribution.
1092 func_make_distclean ()
1095 if test -f Makefile; then
1098 rm -rf autom4te.cache config.cache
1102 # func_make_uninstall
1103 # See that there were no files leftover in $prefix.
1104 # Ignore dotfiles, so that .nfsXXX files don't screw up the test.
1105 func_make_uninstall ()
1110 leftovers=`find $prefix ! -type d ! -name '.*' -print`
1111 if test -n "$leftovers"; then
1112 func_msg "Leftover after make uninstall:"
1119 # func_exec_init mode
1123 func_dirname_and_basename "`pwd`"
1124 func_msg "Executing $1 programs in $func_basename_result"
1126 # Windows hosts search for dlls in the command path
1127 PATH=$prefix/lib:$PATH
1129 exec_status=$EXIT_SUCCESS
1132 # func_exec_check program [msg ...]
1133 # Check to see if PROGRAM was built. If not display MSG.
1139 if test -f "$my_program"; then :
1142 func_error "$0: $my_program did not build ${1+$@}"
1143 exec_status=$EXIT_FAILURE
1147 # func_exec program [exp_output] [msg ...]
1148 # Check to see if PROGRAM really runs, and produces EXP_OUTPUT if given.
1149 # If not display MSG.
1155 func_dirname_and_basename "`pwd`"
1156 my_dir=$func_basename_result
1158 test -n "$my_exp_output" \
1159 && my_exp_output="| $EGREP -e "\""$my_exp_output"\"
1161 if eval $my_program $my_exp_output; then :
1164 test "x$1" = x || shift
1165 func_error "$0: cannot execute $my_program ${1+$@}"
1167 if test "$build" != "$host"; then
1168 func_msg "This may be ok since you seem to be cross-compiling."
1169 exec_status=$EXIT_SKIP
1171 # Simple check to see if they are superuser.
1172 if test $exec_status = $EXIT_FAILURE || test -w /; then :
1174 func_msg "You may need to run $0 as the superuser."
1176 exec_status=$EXIT_FAILURE
1181 # Shared global variables for test scripts
1182 prefix=./_inst-`echo "$0" | sed 's,.*/,,; s,-.*,,'`
1183 srcdir=`cd $srcdir && pwd`
1184 m4dir=$srcdir/libltdl/m4
1185 auxdir=$srcdir/libltdl/config
1186 scripts="$auxdir/ltmain.m4sh $srcdir/libtoolize.m4sh"
1188 # Unset some MAKE... variables that may cause $MAKE to act like a
1189 # recursively invoked sub-make. Any $MAKE invocation in a test is
1190 # conceptually an independent invocation.
1191 unset MFLAGS MAKEFLAGS MAKELEVEL __MKLVL__ MAKE_JOBS_FIFO
1193 # On AIX, shared libraries remain loaded in memory after use if they
1194 # are world-readable, until root issues slibclean. On NFS, this causes
1195 # a testsuite rerun to fail to clean up test group directories. Avoid
1196 # this with a suitable umask. Do not do this on other systems, for
1197 # example HP-UX suffers unless shared libraries are mode 555.
1199 aix*) umask o-rwx ;;
1202 func_msg "Running $progname"