On 21.09.2010 13:49, Tamas TEVESZ wrote:
On Tue, 21 Sep 2010, Andreas Tscharner wrote:
> > if (strlcat is in libc)
> > define HAVE_STRLCAT
> > else if (strlcat is in libbsd)
> > define HAVE_STRLCAT
> > define HAVE_LIBBSD
> > add -lbsd to LIBS (wutil libs)
> > else
> > just move along
> >
> > and likewise for strlcpy (or, up to you, we could just assume
> > whereever there's strlcat, there's also strlcpy, and only check for
> > one of them).
> >
> > anyone likes a nice challenge? :)
>
> What about AC_CHECK_LIB? As far as I can see, it looks like you could use
it
> and it does by default what you need.
> For detailed information see here:
> http://www.gnu.org/software/hello/manual/autoconf/Libraries.html
yep, theoretically i know, practically i couldn't ;) i tried. what i
was unable to describe the autoconf way is that in the `strlcat is in
libbsd' case there are two actions to take, define both HAVE_STRLCAT
and HAVE_LIBBSD (the libs addition could probably be shoved in later).
AC_CHECK_LIB(c, strlcat,
[STRLCAT_IN_LIBC="yes"],
[STRLCAT_IN_LIBC="no"])
AC_CHECK_LIB(bsd, strlcat,
[STRLCAT_IN_LIBBSD="yes"],
[STRLCAT_IN_LIBBSD="no"])
...
...
AM_CONDITIONAL(HAVE_STRLCAT, test "$STRLCAT_IN_LIBC" = "yes")
AM_CONDITIONAL(HAVE_STRLCAT, test "$STRLCAT_IN_LIBBSD" = "yes")
AM_CONDITIONAL(HAVE_LIBBSD, test "$STRLCAT_IN_LIBBSD" = "yes")
Not very elegant and I could not test it...
Best regards
Andreas
--
("`-''-/").___..--''"`-._
`o_ o ) `-. ( ).`-.__.`)
(_Y_.)' ._ ) `._ `. ``-..-'
_..`--'_..-_/ /--'_.' .'
(il).-'' (li).' ((!.-'
Andreas Tscharner [email protected] ICQ-No. 14356454
--
To unsubscribe, send mail to [email protected].