autoconf
[Top][All Lists]
Advanced

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

Detecting an adequate id program


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

Dear Autoconf list,

I have written an Autoconf test to detect an `id' program accepting -g -n and -u -n. This tests works fine on FreeBSD (7.2 and 8.1) and some version of Solaris, but not on some Linux. I am very unexperimented in writing Autoconf macros, so I would need some help to figure out what is going wrong and how to fix it. In advance, thanks!


I need a macro that checks for a `id' program able to print the user id and the the group id in symbolic form: the candidate program must pass the test

$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

when ac_cv_path_ID_v points to the candidate. Hence I wrote the following test:

-8<---
# AC_PROG_ID
# ----------
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<---

Of course, I did not write it all by myself, but copied an existing macro and modified what seemed to require it. When I tried my script at my workplace---where I have to use some version of Ubuntu, the variable `ID' was filled up with the value `no' while the `id' command passes the test---when I check it at the command line. My `configure' script was produced by GNU Autoconf 2.62.

Your help would be much appreciated!
--
Best regards,
Michael



reply via email to

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