summaryrefslogtreecommitdiff
path: root/m4/ax_with_prog.m4
diff options
context:
space:
mode:
authorFrancesco Salvestrini <salvestrini@gmail.com>2008-01-28 22:33:11 +0100
committerPeter Simons <simons@cryp.to>2008-01-28 22:33:11 +0100
commit19261af95b76b5ea6834a0ac8572a54cb4afdffd (patch)
tree90ba75daa959989ce2a7a836a03a232046a10bba /m4/ax_with_prog.m4
parent6a7f8adbafa4ea1fdd5af0ad9ec4a27c2d7952a0 (diff)
downloadautoconf-archive-19261af95b76b5ea6834a0ac8572a54cb4afdffd.tar.gz
Major re-factoring of Perl, Guile, Python, and Ruby detection macros.
The new submission AX_WITH_PROG generalizes the technique employed by the original AX_WITH_PYTHON to allow for detecting generic executables. Based on that macro, trivial wrappers are provided for finding installed versions of Perl, Guile, Python, and Ruby. NOTE: The earlier version of AX_WITH_PYTHON performed a version check. The AX_WITH_PROG-based macros don't do that. Instead, separate macros are available for Perl, Guile, Python, and Ruby that check the version of a given executable in a second, independent step.
Diffstat (limited to 'm4/ax_with_prog.m4')
-rw-r--r--m4/ax_with_prog.m494
1 files changed, 94 insertions, 0 deletions
diff --git a/m4/ax_with_prog.m4 b/m4/ax_with_prog.m4
new file mode 100644
index 0000000..28d1a39
--- /dev/null
+++ b/m4/ax_with_prog.m4
@@ -0,0 +1,94 @@
+##### http://autoconf-archive.cryp.to/ax_with_prog.html
+#
+# SYNOPSIS
+#
+# AX_PROG_WITH([VARIABLE],[program],[PATH],[VALUE-IF-NOT-FOUND])
+#
+# DESCRIPTION
+#
+# Locates an installed program binary, placing the result in the
+# precious variable VARIABLE. Accepts a present VARIABLE, then
+# --with-program, and failing that searches for program in the given
+# path (which defaults to the system path). If program is found,
+# VARIABLE is set to the full path of the binary; if it is not found,
+# VARIABLE is set to VALUE-IF-NOT-FOUND, which defaults to 'program'.
+#
+# A typical example could be the following one:
+#
+# AX_WITH_PROG(PERL,perl)
+#
+# NOTE: This macro is based upon the original AX_WITH_PYTHON macro
+# from Dustin J. Mitchell <dustin@cs.uchicago.edu>.
+#
+# LAST MODIFICATION
+#
+# 2008-01-27
+#
+# COPYLEFT
+#
+# Copyright (c) 2008 Francesco Salvestrini <salvestrini@users.sourceforge.net>
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+#
+# As a special exception, the respective Autoconf Macro's copyright
+# owner gives unlimited permission to copy, distribute and modify the
+# configure scripts that are the output of Autoconf when processing
+# the Macro. You need not follow the terms of the GNU General Public
+# License when using or distributing such scripts, even though
+# portions of the text of the Macro appear in them. The GNU General
+# Public License (GPL) does govern all other use of the material that
+# constitutes the Autoconf Macro.
+#
+# This special exception to the GPL applies to versions of the
+# Autoconf Macro released by the Autoconf Macro Archive. When you
+# make and distribute a modified version of the Autoconf Macro, you
+# may extend this special exception to the GPL to apply to your
+# modified version as well.
+
+AC_DEFUN([AX_WITH_PROG],[
+ AC_PREREQ([2.61])
+
+ pushdef([VARIABLE],$1)
+ pushdef([EXECUTABLE],$2)
+ pushdef([PATH_PROG],$3)
+ pushdef([VALUE_IF_NOT_FOUND],$4)
+
+ AC_ARG_VAR(VARIABLE,Absolute path to EXECUTABLE executable)
+
+ AS_IF(test -z "$VARIABLE",[
+ AC_MSG_CHECKING(whether EXECUTABLE executable path has been provided)
+ AC_ARG_WITH(EXECUTABLE,AS_HELP_STRING([--with-EXECUTABLE=[[[[PATH]]]]],absolute path to EXECUTABLE executable), [
+ AS_IF([test "$withval" != "yes"],[
+ VARIABLE="$withval"
+ AC_MSG_RESULT($VARIABLE)
+ ],[
+ VARIABLE=""
+ AC_MSG_RESULT([no])
+ ])
+ ],[
+ AC_MSG_RESULT([no])
+ ])
+
+ AS_IF(test -z "$VARIABLE",[
+ AC_PATH_PROG([]VARIABLE[],[]EXECUTABLE[],[]VALUE_IF_NOT_FOUND[],[]PATH_PROG[])
+ ])
+ ])
+
+ popdef([VALUE_IF_NOT_FOUND])
+ popdef([PATH_PROG])
+ popdef([EXECUTABLE])
+ popdef([VARIABLE])
+])