autoconf
[Top][All Lists]
Advanced

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

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


From: linuxjetaime
Subject: Re: checking whether a list of commands exists (e.g. gawk mail rcp) all with one macro, how?
Date: Mon, 12 Nov 2007 06:35:59 -0800 (PST)



Jason Curl-4 wrote:
> 
> linuxjetaime wrote:
>> 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"])
>>   
> I see in my built configure files, without even specifying [GN]AWK it 
> looks for it in anycase. Is the result of that good enough?
> 
> Indeed is fine, but  gawk is an example, I need to do the same for lot's
> of others e.g. sleep, gzip etc.
> 
>> 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
>>   
> 
> As far as I understand, the macro below (from Jason) checks for a command
> and its alternatives which all of them form a list.
> the first one to be found goes into $1 the VARIABLE
> I want to just simplify my life and instead of checking for commands x, y
> and z and place them in variables
> X_IS_AT, Y_IS_AT, Z_IS_AT or if not found look at --with-x, --with-y,
> --with-z *separately* i.e. with one AC_CHECK_PROG for each command, to
> automate the procedure as follows:
> check(VAR_POSTFIX, list of commands)
> (i.e. check("_IS_AT", sleep, gzip, tar))
> and creates a variable SLEEP_IS_AT =/usr/bin/sleep,
> GZIP_IS_AT=... etc.
> 
> i have done my configure.in in the way Jason suggests (thanks!) and all is
> well, but i am still bugged by even more automation as above.
> thanks again,
> andreas
> 
> Jason wrote:
> There are some great examples as part of the autoconf package. For 
> example, I looked at /usr/share/autoconf/acgeneral.m4
> 
> I found:
> dnl AC_PATH_PROGS(VARIABLE, PROGS-TO-CHECK-FOR [, VALUE-IF-NOT-FOUND
> dnl               [, PATH]])
> AC_DEFUN(AC_PATH_PROGS,
> [for ac_prog in $2
> do
> AC_PATH_PROG($1, [$]ac_prog, , $4)
> test -n "[$]$1" && break
> done
> ifelse([$3], , , [test -n "[$]$1" || $1="$3"
> ])])
> 
> Isn't this similar to what you want to do?
> 
> Cheers,
> Jason.
> 
> 
> _______________________________________________
> Autoconf mailing list
> address@hidden
> http://lists.gnu.org/mailman/listinfo/autoconf
> 
> 

-- 
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#a13706611
Sent from the Gnu - Autoconf - General mailing list archive at Nabble.com.





reply via email to

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