]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Author: Francesco Salvestrini and Dustin J. Mitchell
authorAmos Jeffries <squid3@treenet.co.nz>
Tue, 12 Aug 2008 12:12:37 +0000 (00:12 +1200)
committerAmos Jeffries <squid3@treenet.co.nz>
Tue, 12 Aug 2008 12:12:37 +0000 (00:12 +1200)
Extend configure with ax_with_prog

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
if provided, unchanged otherwise.

NOTE: This macro is based upon the original AX_WITH_PYTHON macro from
      Dustin J. Mitchell <dustin@cs.uchicago.edu>.

COPYLEFT
   Copyright (c) 2008 Francesco Salvestrini <salvestrini@users.sourceforge.net>
   Copyright (c) 2008 Dustin J. Mitchell <dustin@cs.uchicago.edu>

acinclude.m4

index ec8cc4bd150501a118dda9963bf6be6ee1fdf9f0..3fa8a95a6f7a84964e6f5796fd4ffe03e5034c3b 100644 (file)
@@ -93,3 +93,76 @@ exit $res`
     HUGE_OBJECT_FLAG=""
   fi
 ]) # end of AC_DEFUN of AC_TEST_CHECKFORHUGEOBJECTS
+
+
+dnl ===========================================================================
+dnl              http://autoconf-archive.cryp.to/ax_with_prog.html
+dnl ===========================================================================
+dnl
+dnl SYNOPSIS
+dnl
+dnl   AX_WITH_PROG([VARIABLE],[program],[VALUE-IF-NOT-FOUND],[PATH])
+dnl
+dnl DESCRIPTION
+dnl
+dnl   Locates an installed program binary, placing the result in the precious
+dnl   variable VARIABLE. Accepts a present VARIABLE, then --with-program, and
+dnl   failing that searches for program in the given path (which defaults to
+dnl   the system path). If program is found, VARIABLE is set to the full path
+dnl   of the binary; if it is not found VARIABLE is set to VALUE-IF-NOT-FOUND
+dnl   if provided, unchanged otherwise.
+dnl
+dnl   A typical example could be the following one:
+dnl
+dnl         AX_WITH_PROG(PERL,perl)
+dnl
+dnl   NOTE: This macro is based upon the original AX_WITH_PYTHON macro from
+dnl   Dustin J. Mitchell <dustin@cs.uchicago.edu>.
+dnl
+dnl LAST MODIFICATION
+dnl
+dnl   2008-05-05
+dnl
+dnl COPYLEFT
+dnl
+dnl   Copyright (c) 2008 Francesco Salvestrini <salvestrini@users.sourceforge.net>
+dnl   Copyright (c) 2008 Dustin J. Mitchell <dustin@cs.uchicago.edu>
+dnl
+dnl   Copying and distribution of this file, with or without modification, are
+dnl   permitted in any medium without royalty provided the copyright notice
+dnl   and this notice are preserved.
+dnl
+AC_DEFUN([AX_WITH_PROG],[
+    AC_PREREQ([2.61])
+
+    pushdef([VARIABLE],$1)
+    pushdef([EXECUTABLE],$2)
+    pushdef([VALUE_IF_NOT_FOUND],$3)
+    pushdef([PATH_PROG],$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([PATH_PROG])
+    popdef([VALUE_IF_NOT_FOUND])
+    popdef([EXECUTABLE])
+    popdef([VARIABLE])
+])