]>
Commit | Line | Data |
---|---|---|
1 | ## Copyright (C) 1996-2015 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 | ||
8 | dnl =========================================================================== | |
9 | dnl http://autoconf-archive.cryp.to/ax_with_prog.html | |
10 | dnl =========================================================================== | |
11 | dnl | |
12 | dnl SYNOPSIS | |
13 | dnl | |
14 | dnl AX_WITH_PROG([VARIABLE],[program],[VALUE-IF-NOT-FOUND],[PATH]) | |
15 | dnl | |
16 | dnl DESCRIPTION | |
17 | dnl | |
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. | |
24 | dnl | |
25 | dnl A typical example could be the following one: | |
26 | dnl | |
27 | dnl AX_WITH_PROG(PERL,perl) | |
28 | dnl | |
29 | dnl NOTE: This macro is based upon the original AX_WITH_PYTHON macro from | |
30 | dnl Dustin J. Mitchell <dustin@cs.uchicago.edu>. | |
31 | dnl | |
32 | dnl LAST MODIFICATION | |
33 | dnl | |
34 | dnl 2008-05-05 | |
35 | dnl | |
36 | dnl COPYLEFT | |
37 | dnl | |
38 | dnl Copyright (c) 2008 Francesco Salvestrini <salvestrini@users.sourceforge.net> | |
39 | dnl Copyright (c) 2008 Dustin J. Mitchell <dustin@cs.uchicago.edu> | |
40 | dnl | |
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. | |
44 | dnl | |
45 | AC_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 | ]) |