autoconf
[Top][All Lists]
Advanced

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

Re: Detecting an adequate id program


From: Michael Grünewald
Subject: Re: Detecting an adequate id program
Date: Sun, 14 Nov 2010 12:51:23 +0100
User-agent: Mozilla/5.0 (X11; U; FreeBSD amd64; en-US; rv:1.9.1.10) Gecko/20100630 SeaMonkey/2.0.5

Dear Ralf,

thank you for your very much detailed answer, it was helpful!

Ralf Wildenhues wrote:
* Michael Grünewald wrote on Fri, Nov 12, 2010 at 09:51:55PM CET:
AC_DEFUN([AC_PROG_ID],
[AC_CACHE_CHECK([for id that handles -g, -u and -n], ac_cv_path_ID,
   [ac_cv_path_ID=no
for ac_cv_path_ID_v in id /usr/xpg4/bin/id 'command -p id'; do
     if test "$ac_cv_path_ID" = "no"; then
       ( $ac_cv_path_ID_v -g&&  $ac_cv_path_ID_v -g -n&&
$ac_cv_path_ID_v -u&&  $ac_cv_path_ID_v -u -n ) 2>&- 1>&-&&
ac_cv_path_ID="$ac_cv_path_ID_v"
     fi
done;])
ID="$ac_cv_path_ID"
AC_SUBST([ID])
])
-8<---
Redirect standard output and standard error to /dev/null rather than
closing them; if you close them the program gets an error when writing
to the file descriptor, and those 'id' programs which pass the test are
in fact the buggier ones.  ;-)

Indeed you are right! I modified the snippet according to your recommandataion and it gives satisfying results now.


The standard Autoconf way to write this would be to use AC_CHECK_PROG or
AC_PATH_PROG rather than open-coding it;

I found description for these macros in the info manual for Autoconf, but I could not figure out how to use them in my situation. It seems to me that these macros check for the availablity of some program while I need to choose between several plausbile alternatives, given that they do not all have the same capabilities.

For me, the problem is that `id -u -n' and `id -g -n' do not work on the Solaris installations I used: I had to use `/usr/xpg4/bin/id' or `command -p id' instead.


Your help was much appreciated,
thank you!


Note: the `reply to all' in my mailer did not add your name in the recipients list. Is this a broken behaviour of my mailer or did you set some headers to require this?
--
Michael



reply via email to

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