| 1 |
# =========================================================================== |
| 2 |
# http://www.gnu.org/software/autoconf-archive/ax_with_prog.html |
| 3 |
# =========================================================================== |
| 4 |
# |
| 5 |
# SYNOPSIS |
| 6 |
# |
| 7 |
# AX_WITH_PROG([VARIABLE],[program],[VALUE-IF-NOT-FOUND],[PATH]) |
| 8 |
# |
| 9 |
# DESCRIPTION |
| 10 |
# |
| 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. |
| 17 |
# |
| 18 |
# A typical example could be the following one: |
| 19 |
# |
| 20 |
# AX_WITH_PROG(PERL,perl) |
| 21 |
# |
| 22 |
# NOTE: This macro is based upon the original AX_WITH_PYTHON macro from |
| 23 |
# Dustin J. Mitchell <[email protected]>. |
| 24 |
# |
| 25 |
# LICENSE |
| 26 |
# |
| 27 |
# Copyright (c) 2008 Francesco Salvestrini <[email protected]> |
| 28 |
# Copyright (c) 2008 Dustin J. Mitchell <[email protected]> |
| 29 |
# |
| 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 |
| 33 |
# warranty. |
| 34 |
|
| 35 |
#serial 16 |
| 36 |
|
| 37 |
AC_DEFUN([AX_WITH_PROG],[ |
| 38 |
AC_PREREQ([2.61]) |
| 39 |
|
| 40 |
pushdef([VARIABLE],$1) |
| 41 |
pushdef([EXECUTABLE],$2) |
| 42 |
pushdef([VALUE_IF_NOT_FOUND],$3) |
| 43 |
pushdef([PATH_PROG],$4) |
| 44 |
|
| 45 |
AC_ARG_VAR(VARIABLE,Absolute path to EXECUTABLE executable) |
| 46 |
|
| 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],[ |
| 51 |
VARIABLE="$withval" |
| 52 |
AC_MSG_RESULT($VARIABLE) |
| 53 |
],[ |
| 54 |
VARIABLE="" |
| 55 |
AC_MSG_RESULT([no]) |
| 56 |
AS_IF([test "$withval" != no], [ |
| 57 |
AC_PATH_PROG([]VARIABLE[],[]EXECUTABLE[],[]VALUE_IF_NOT_FOUND[],[]PATH_PROG[]) |
| 58 |
]) |
| 59 |
]) |
| 60 |
],[ |
| 61 |
AC_MSG_RESULT([no]) |
| 62 |
AC_PATH_PROG([]VARIABLE[],[]EXECUTABLE[],[]VALUE_IF_NOT_FOUND[],[]PATH_PROG[]) |
| 63 |
]) |
| 64 |
]) |
| 65 |
|
| 66 |
popdef([PATH_PROG]) |
| 67 |
popdef([VALUE_IF_NOT_FOUND]) |
| 68 |
popdef([EXECUTABLE]) |
| 69 |
popdef([VARIABLE]) |
| 70 |
]) |