1b1577431f295cfde7470c86afb5e2e029409791
[platform/upstream/automake.git] / m4 / missing.m4
1 ## --------------------------------------------------------- ##
2 ## Fake the existence of programs that GNU maintainers use.  ##
3 ## --------------------------------------------------------- ##
4
5 # serial 2
6
7 # AM_MISSING_PROG(NAME, PROGRAM)
8 # ------------------------------
9 AC_DEFUN([AM_MISSING_PROG],
10 [AC_REQUIRE([AM_MISSING_HAS_RUN])
11 $1=${$1-"${am_missing_run}$2"}
12 AC_SUBST($1)])
13
14
15 # AM_MISSING_INSTALL_SH
16 # ---------------------
17 # Like AM_MISSING_PROG, but only looks for install-sh.
18 AC_DEFUN([AM_MISSING_INSTALL_SH],
19 [AC_REQUIRE([AM_MISSING_HAS_RUN])
20 if test -z "$install_sh"; then
21    for install_sh in "$ac_aux_dir/install-sh" \
22                      "$ac_aux_dir/install.sh" \
23                      "${am_missing_run}${ac_auxdir}/install-sh";
24    do
25      test -f "$install_sh" && break
26    done
27    # FIXME: an evil hack: we remove the SHELL invocation from
28    # install_sh because automake adds it back in.  Sigh.
29    install_sh=`echo $install_sh | sed -e 's/\${SHELL}//'`
30 fi
31 AC_SUBST(install_sh)])
32
33
34 # AM_MISSING_HAS_RUN
35 # ------------------
36 # Define MISSING if not defined so far and test if it supports --run.
37 # If it does, set am_missing_run to use it, otherwise, to nothing.
38 AC_DEFUN([AM_MISSING_HAS_RUN],
39 [test x"${MISSING+set}" = xset ||
40   MISSING="\${SHELL} `CDPATH=:; cd $ac_aux_dir && pwd`/missing"
41 # Use eval to expand $SHELL
42 if eval "$MISSING --run true"; then
43   am_missing_run="$MISSING --run "
44 else
45   am_missing_run=
46   am_backtick='`'
47   AC_MSG_WARN([${am_backtick}missing' script is too old or missing])
48 fi
49 ])