autoconf
[Top][All Lists]
Advanced

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

checking whether a list of commands exists (e.g. gawk mail rcp) all with


From: linuxjetaime
Subject: checking whether a list of commands exists (e.g. gawk mail rcp) all with one macro, how?
Date: Thu, 8 Nov 2007 03:29:46 -0800 (PST)

Hi all,
first of all,
i need to check if one command exists in the path, find its path (unless the
user specified --with-xxx)
so i write(in configure.in) for the command 'gawk'

AC_ARG_WITH(gawk, [  --with-gawk=FULLPATH       set full path to gawk
(default /usr/bin/gawk)],[GAWKPATH="$withval"])

AC_PATH_PROG(GAWKPATH, gawk,no, $PATH)
if test $GAWKPATH = no; then
        AC_MSG_ERROR([can not find gawk if you know where it is specify it
at command line using --with-gawk=])
fi

Question 1: is this correct? (i copied from the net somewhere and it works
ok i think)
Question 2: is there a macro which does all this?
e.g. AC_FIND_PROG(gawk ...)
and save us the hassle of typing all the above

The last question is : I have a list of commands to search for (gawk perl
rsh rcp tar gzip gunzip) etc.
is there a macro which takes a list in?
i tried to do (with my limited knowlegde of sh and autoconf, sorry):

for exe in       gawk cp hostname perl rcp mail mv cat mkdir rsh gzip gunzip
tar sleep; do
        exeUpper=`echo $exe | tr a-z A-Z`
     AC_ARG_WITH(${exe}, [  --with-$exe=FULLPATH       set full path to
command $exe (default /usr/bin/$exe)], [${exeUpper}PATH="$withval"])
        AC_PATH_PROG(${exeUpper}PATH, $exe,no, $PATH)
        if test ${exeUpper}PATH = no; then
                AC_MSG_ERROR([can not find $exe if you know where it is
specify it at command line using --with-$exe=])
        fi
done            
       but i get various errors, the most obvious one with using ${exe} as
the first arg of AC_ARG_WITH (it takes it verbatim as ${exe}, and not its
contents, i.e. gawk)
anyway this is the idea, anybody done that or prepare to do it if there is a
real need for it?
(btw is AC_ARG_WITH defined in an m4 file? or is it builtin?)

thank you guys,
andreas
-- 
View this message in context: 
http://www.nabble.com/checking-whether-a-list-of-commands-exists-%28e.g.-gawk-mail-rcp%29-all-with-one-macro%2C-how--tf4770414.html#a13645376
Sent from the Gnu - Autoconf - General mailing list archive at Nabble.com.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]