❦ 12 décembre 2015 18:35 +0100, Guillem Jover <guil...@debian.org> :

>>  ❦ 12 décembre 2015 14:23 +0100, Guillem Jover <guil...@debian.org> :
>> > This is due to the overlays, some headers now expect declarations from
>> > the overlayed headers, bu they are not requsting them and just use the
>> > system ones. I've added a unit test to catch this in the future, and
>> > will be fixing it for an upload targetted for later today.
>> 
>> Do you mean that if we hit this bug, we are doing something wrong?
>
> Not at all, sorry for the possible confusing wording.
>
>> I am including bsd/unistd.h, shouldn't I?
>
> That's fine, and it is supported, although it makes portability harder.
>
> The problem is that bsd/unistd.h now requires internally bsd/sys/cdefs.h,
> and it only includes sys/cdefs.h, which in your case is the system
> sys/cdefs.h not the overlaid bsd/sys/cdefs.h, which would get transparently
> used if using «pkg-config --cflags libbsd-overlay» for example.
>
> The overlay is intended to be used to make portability easier, so that the
> code can work out-of-the-box on BSD and non-BSD systems.

OK. I am using this:

# setproctitle (maybe through libbsd [until 0.5, it is only a stub function])
AC_SEARCH_LIBS([setproctitle], [util bsd])
AC_REPLACE_FUNCS([setproctitle])
AC_CHECK_FUNCS([setproctitle_init])

case " $LIBS " in
     *\ -lbsd\ *)
        AC_DEFINE(HAVE_LIBBSD, 1, [Define if libbsd is used])
        ;;
esac

Then:

#ifdef HAVE_LIBBSD
# include <bsd/stdio.h>
# include <bsd/string.h>
# include <bsd/unistd.h>
#endif

#if !HAVE_SETPROCTITLE
void setproctitle(const char *fmt, ...) __attribute__ ((format (printf, 1, 2)));
#endif

My own setproctitle is just an empty stub. So, now, the best way seems
to be able to just use PKG_CHECK_MODULES([BSD], [libbsd-overlay]),
right? Is there something special to do to know if I can use
setproctitle_init or should I test for its presence?
-- 
Use self-identifying input.  Allow defaults.  Echo both on output.
            - The Elements of Programming Style (Kernighan & Plauger)

Attachment: signature.asc
Description: PGP signature

Reply via email to