1 # ===========================================================================
2 # http://www.gnu.org/software/autoconf-archive/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>.
27 # Copyright (c) 2008 Francesco Salvestrini <salvestrini@users.sourceforge.net>
28 # Copyright (c) 2008 Dustin J. Mitchell <dustin@cs.uchicago.edu>
30 # Copying and distribution of this file, with or without modification, are
31 # permitted in any medium without royalty provided the copyright notice
32 # and this notice are preserved. This file is offered as-is, without any
37 AC_DEFUN([AX_WITH_PROG],[
40 pushdef([VARIABLE],$1)
41 pushdef([EXECUTABLE],$2)
42 pushdef([VALUE_IF_NOT_FOUND],$3)
43 pushdef([PATH_PROG],$4)
45 AC_ARG_VAR(VARIABLE,Absolute path to EXECUTABLE executable)
47 AS_IF(test -z "$VARIABLE",[
48 AC_MSG_CHECKING(whether EXECUTABLE executable path has been provided)
49 AC_ARG_WITH(EXECUTABLE,AS_HELP_STRING([--with-EXECUTABLE=[[[PATH]]]],absolute path to EXECUTABLE executable), [
50 AS_IF([test "$withval" != yes && test "$withval" != no],[
52 AC_MSG_RESULT($VARIABLE)
56 AS_IF([test "$withval" != no], [
57 AC_PATH_PROG([]VARIABLE[],[]EXECUTABLE[],[]VALUE_IF_NOT_FOUND[],[]PATH_PROG[])
62 AC_PATH_PROG([]VARIABLE[],[]EXECUTABLE[],[]VALUE_IF_NOT_FOUND[],[]PATH_PROG[])
67 popdef([VALUE_IF_NOT_FOUND])