autoconf
[Top][All Lists]
Advanced

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

Re: Using AC_REPLACE_FUNCS


From: Stepan Kasal
Subject: Re: Using AC_REPLACE_FUNCS
Date: Thu, 26 May 2005 16:27:19 +0200
User-agent: Mutt/1.4.1i

Hoello
On Wed, May 25, 2005 at 05:55:11PM -0400, Nicolas Blais wrote:
> I do this by changing my software's code to the following:
> 
> #ifdef HAVE_SRANDOMDEV
>   srandomdev();
> #endif
> #ifndef HAVE_SRANDOMDEV
>   srandom(time(0));
> #endif

Or perhaps:

#ifdef HAVE_SRANDOMDEV
  srandomdev();
#else
  srandom(time(0));
#endif

I think this is not bad solution.  If you call this several times, you
can also do

#ifdef HAVE_SRANDOMDEV
# define SRANDOMDEV(x)  srandomdev()
#else
# define SRANDOMDEV(x)  srandom(time(0))
#endif

and then call
                SRANDOMDEV();
in your code.

> I'm hoping there is a better way to do this by using AC_REPLACE_FUNCS, 

The project gnulib on savannah (list address@hidden) is trying to
solve this type of problems.  But I'm not sure whether it's not an
overkill to use its infrastructure just for this single small problem.
Gnulib has replacements for many functions, but I think srandomdev is
not there (yet).

Have a nice day,
        Stepan Kasal




reply via email to

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