1 ## Copyright (C) 1996-2015 The Squid Software Foundation and contributors
3 ## Squid software is distributed under GPLv2+ license and includes
4 ## contributions from numerous individuals and organizations.
5 ## Please see the COPYING and CONTRIBUTORS files for details.
8 dnl ===========================================================================
9 dnl http://autoconf-archive.cryp.to/ax_with_prog.html
10 dnl ===========================================================================
14 dnl AX_WITH_PROG([VARIABLE],[program],[VALUE-IF-NOT-FOUND],[PATH])
18 dnl Locates an installed program binary, placing the result in the precious
19 dnl variable VARIABLE. Accepts a present VARIABLE, then --with-program, and
20 dnl failing that searches for program in the given path (which defaults to
21 dnl the system path). If program is found, VARIABLE is set to the full path
22 dnl of the binary; if it is not found VARIABLE is set to VALUE-IF-NOT-FOUND
23 dnl if provided, unchanged otherwise.
25 dnl A typical example could be the following one:
27 dnl AX_WITH_PROG(PERL,perl)
29 dnl NOTE: This macro is based upon the original AX_WITH_PYTHON macro from
30 dnl Dustin J. Mitchell <dustin@cs.uchicago.edu>.
38 dnl Copyright (c) 2008 Francesco Salvestrini <salvestrini@users.sourceforge.net>
39 dnl Copyright (c) 2008 Dustin J. Mitchell <dustin@cs.uchicago.edu>
41 dnl Copying and distribution of this file, with or without modification, are
42 dnl permitted in any medium without royalty provided the copyright notice
43 dnl and this notice are preserved.
45 AC_DEFUN([AX_WITH_PROG],[
48 pushdef([VARIABLE],$1)
49 pushdef([EXECUTABLE],$2)
50 pushdef([VALUE_IF_NOT_FOUND],$3)
51 pushdef([PATH_PROG],$4)
53 AC_ARG_VAR(VARIABLE,Absolute path to EXECUTABLE executable)
55 AS_IF(test -z "$VARIABLE",[
56 AC_MSG_CHECKING(whether EXECUTABLE executable path has been provided)
57 AC_ARG_WITH(EXECUTABLE,AS_HELP_STRING([--with-EXECUTABLE=[[[[PATH]]]]],absolute path to EXECUTABLE executable), [
58 AS_IF([test "$withval" != "yes"],[
60 AC_MSG_RESULT($VARIABLE)
69 AS_IF(test -z "$VARIABLE",[
70 AC_PATH_PROG([]VARIABLE[],[]EXECUTABLE[],[]VALUE_IF_NOT_FOUND[],[]PATH_PROG[])
75 popdef([VALUE_IF_NOT_FOUND])