>>>>> "Assar" == Assar Westerlund <[EMAIL PROTECTED]> writes:
Assar> Doing it this way seems to work, but is somewhat less that
Assar> perfect:
Assar> AC_CHECK_PROG(FOO, foo, $ac_dir/foo, foo-fail,
Assar> "$PATH:/magic/dir")
ac_dir is an internal data which may disapear.
Assar> So, what do people think.
Checkout AC_PATH_PROG in such a case. Either you want the full path,
or you don't, but mixing is probably not right. User with a broken
path should handle their own problems themselves.
Assar> - Should we add an extra argument that let's the user specify
Assar> additional directories?
No, PATH is here for this.
I've had similar requests from users and finally used the macros
below. The style is *very* bad, in fact, I'm quite ashamed, but I
wrote this long ago :)
# -*- Autoconf -*-
# Check for the existence of a program, resolving it either to the
# full name or short name.
# This is ugly work, don't use it.
# serial 1
dnl
AC_DEFUN(ad_ENABLE_PATHS,
[AC_MSG_CHECKING(whether paths should be hardcoded)
AC_ARG_ENABLE(paths,
[ --enable-paths hard code the path of the tools])
test "$enable_paths" = "yes" || enable_paths=no
AC_MSG_RESULT($enable_paths)])
dnl ad_CHECK_PROG(PROGRAM[, COMMENT ON FAILURE])
dnl defines $COM_PROGRAM to `#' if PROGRAM is not available, to `' otherwise
dnl and defines $PROGRAM to PROGRAM if paths should not be hardcoded,
dnl and to the path to PROGRAM otherwise.
AC_DEFUN(ad_CHECK_PROG,
[if test "$enable_paths" = "no"; then
AC_CHECK_PROG(COM_$1, $1, yes, no)
$1="$1";
if test "[$]COM_$1" = "yes"; then
COM_$1="";
else
COM_$1="#";
fi
else
AC_PATH_PROG($1, $1, [#])
if test "$1" = "#"; then # not found
$1="$1" # let the name of the program as path
COM_$1="#"
else
COM_$1=""
fi
fi
ifval([$2],
[if test "[$]COM_$1" = "#"; then
AC_MSG_WARN([============================================================
$2])
AC_MSG_WARN([============================================================])
fi])
AC_SUBST($1)
AC_SUBST(COM_$1)])
dnl ad_CHECK_PROG(PROGRAM[, COMMENT ON FAILURE])
dnl defines $COM_PROGRAM to `#' if PROGRAM is not available, to `' otherwise
dnl and defines $PROGRAM to PROGRAM if paths should not be hardcoded,
dnl and to the path to PROGRAM otherwise.
AC_DEFUN([ad_CHECK_PROGS],
[m4_foreach([AC_PROG], [$1], [ad_CHECK_PROG(AC_PROG, $2)])])