Re: How to exit if program is not found

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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<terminatorul@xxxxxxxxx> 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 -y
works 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



_______________________________________________
Autoconf mailing list
Autoconf@xxxxxxx
https://lists.gnu.org/mailman/listinfo/autoconf



[Index of Archives]     [GCC Help]     [Kernel Discussion]     [RPM Discussion]     [Red Hat Development]     [Yosemite News]     [Linux USB]     [Samba]

  Powered by Linux