1 # ===========================================================================
2 # http://autoconf-archive.cryp.to/ax_with_prog.html
3 # ===========================================================================
7 # AX_WITH_PROG([VARIABLE],[program],[VALUE-IF-NOT-FOUND],[PATH])
11 # Locates an installed program binary, placing the result in the precious
12 # variable VARIABLE. Accepts a present VARIABLE, then --with-program, and
13 # failing that searches for program in the given path (which defaults to
14 # the system path). If program is found, VARIABLE is set to the full path
15 # of the binary; if it is not found VARIABLE is set to VALUE-IF-NOT-FOUND
16 # if provided, unchanged otherwise.
18 # A typical example could be the following one:
20 # AX_WITH_PROG(PERL,perl)
22 # NOTE: This macro is based upon the original AX_WITH_PYTHON macro from
23 # Dustin J. Mitchell <dustin@cs.uchicago.edu>.
31 # Copyright (c) 2008 Francesco Salvestrini <salvestrini@users.sourceforge.net>
32 # Copyright (c) 2008 Dustin J. Mitchell <dustin@cs.uchicago.edu>
34 # Copying and distribution of this file, with or without modification, are
35 # permitted in any medium without royalty provided the copyright notice
36 # and this notice are preserved.
38 AC_DEFUN([AX_WITH_PROG],[
41 pushdef([VARIABLE],$1)
42 pushdef([EXECUTABLE],$2)
43 pushdef([VALUE_IF_NOT_FOUND],$3)
44 pushdef([PATH_PROG],$4)
46 AC_ARG_VAR(VARIABLE,Absolute path to EXECUTABLE executable)
48 AS_IF(test -z "$VARIABLE",[
49 AC_MSG_CHECKING(whether EXECUTABLE executable path has been provided)
50 AC_ARG_WITH(EXECUTABLE,AS_HELP_STRING([--with-EXECUTABLE=[[[[PATH]]]]],absolute path to EXECUTABLE executable), [
51 AS_IF([test "$withval" != "yes"],[
53 AC_MSG_RESULT($VARIABLE)
62 AS_IF(test -z "$VARIABLE",[
63 AC_PATH_PROG([]VARIABLE[],[]EXECUTABLE[],[]VALUE_IF_NOT_FOUND[],[]PATH_PROG[])
68 popdef([VALUE_IF_NOT_FOUND])