1## Copyright (C) 1996-2021 The Squid Software Foundation and contributors 2## 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. 6## 7 8dnl =========================================================================== 9dnl http://autoconf-archive.cryp.to/ax_with_prog.html 10dnl =========================================================================== 11dnl 12dnl SYNOPSIS 13dnl 14dnl AX_WITH_PROG([VARIABLE],[program],[VALUE-IF-NOT-FOUND],[PATH]) 15dnl 16dnl DESCRIPTION 17dnl 18dnl Locates an installed program binary, placing the result in the precious 19dnl variable VARIABLE. Accepts a present VARIABLE, then --with-program, and 20dnl failing that searches for program in the given path (which defaults to 21dnl the system path). If program is found, VARIABLE is set to the full path 22dnl of the binary; if it is not found VARIABLE is set to VALUE-IF-NOT-FOUND 23dnl if provided, unchanged otherwise. 24dnl 25dnl A typical example could be the following one: 26dnl 27dnl AX_WITH_PROG(PERL,perl) 28dnl 29dnl NOTE: This macro is based upon the original AX_WITH_PYTHON macro from 30dnl Dustin J. Mitchell <dustin@cs.uchicago.edu>. 31dnl 32dnl LAST MODIFICATION 33dnl 34dnl 2008-05-05 35dnl 36dnl COPYLEFT 37dnl 38dnl Copyright (c) 2008 Francesco Salvestrini <salvestrini@users.sourceforge.net> 39dnl Copyright (c) 2008 Dustin J. Mitchell <dustin@cs.uchicago.edu> 40dnl 41dnl Copying and distribution of this file, with or without modification, are 42dnl permitted in any medium without royalty provided the copyright notice 43dnl and this notice are preserved. 44dnl 45AC_DEFUN([AX_WITH_PROG],[ 46 AC_PREREQ([2.61]) 47 48 pushdef([VARIABLE],$1) 49 pushdef([EXECUTABLE],$2) 50 pushdef([VALUE_IF_NOT_FOUND],$3) 51 pushdef([PATH_PROG],$4) 52 53 AC_ARG_VAR(VARIABLE,Absolute path to EXECUTABLE executable) 54 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"],[ 59 VARIABLE="$withval" 60 AC_MSG_RESULT($VARIABLE) 61 ],[ 62 VARIABLE="" 63 AC_MSG_RESULT([no]) 64 ]) 65 ],[ 66 AC_MSG_RESULT([no]) 67 ]) 68 69 AS_IF(test -z "$VARIABLE",[ 70 AC_PATH_PROG([]VARIABLE[],[]EXECUTABLE[],[]VALUE_IF_NOT_FOUND[],[]PATH_PROG[]) 71 ]) 72 ]) 73 74 popdef([PATH_PROG]) 75 popdef([VALUE_IF_NOT_FOUND]) 76 popdef([EXECUTABLE]) 77 popdef([VARIABLE]) 78]) 79