|
From: | Timothy Madden |
Subject: | Re: How to exit if program is not found |
Date: | Fri, 15 Jun 2012 16:16:36 +0300 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:10.0.5) Gecko/20120607 Thunderbird/10.0.5 |
On 06/14/2012 07:37 PM, Timothy Madden wrote:
On 06/14/2012 07:07 PM, Roger Pau Monné wrote:On Thu, Jun 14, 2012 at 5:01 PM, Timothy Madden<address@hidden> wrote:Hello I see in the info pages that autoconf macros check for various programs and set a variable if found, but how do I get the behaviour I see in most configure programs to exit with an error if a program is not found ?I usually use the following macro: AC_DEFUN([AX_PATH_PROG_OR_FAIL], [AC_PATH_PROG([$1], [$2], [no]) if test x"${$1}" == x"no" then AC_MSG_ERROR([Unable to find $2, please install $2]) fi]) So on my configure.ac I make the following calls: AX_PATH_PROG_OR_FAIL([PERL], [perl]) Where "PERL" is the name of the variable where to store the path, and "perl" is the name of the program to search for.How about the predefined programs ? AC_PROG_YACC might set YACC to 'bison -y', how would I check that 'bison -y' is found or is on path ?
I find that the following command command -v bison -yworks as expected and returns 0 if bison is found or non-zero if there is no bison.
What do you know about the portability of `command` ? Can I use it in my configure.ac ?
Or is there a better way to exit after AC_PROG_YACC if bison is not found ? Or to exit if AC_PROG_CXX does not find a C++ compiler ?
And really, is there no support in autoconf itself for this ?
Is there no flag or option to make the resulting configure exit automatically if any of the checks fail ?
Thank you, Timothy Madden
[Prev in Thread] | Current Thread | [Next in Thread] |