[PATCH] xdm: add definition for libbsd headers

Alive 4ever alive4ever at live.com
Sat Aug 13 01:36:43 UTC 2016


On Wed, Jul 27, 2016 at 12:42:43PM +0000, Alive 4ever wrote:
> Add HAVE_BSD_UNISTD_H and HAVE_BSD_STDLIB_H definition to include
> 'bsd/unistd.h' and 'bsd/stdlib.h' headers.
> 
> This fixes gcc 6.1.1 and clang 3.8.0 implicit function declaration error
> (setproctitle and arc4random) on Linux system with 'libbsd' headers under
> 'bsd' include directory.
> 
> Signed-off-by: Alif M. Ahmad <alive4ever at live.com>
> ---
>  configure.ac  | 4 ++++
>  xdm/choose.c  | 4 ++++
>  xdm/genauth.c | 4 ++++
>  xdm/session.c | 4 ++++
>  4 files changed, 16 insertions(+)
> 
> diff --git a/configure.ac b/configure.ac
> index 2cd2817..3fc1da9 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -68,12 +68,16 @@ AC_SEARCH_LIBS([getspnam], [sec gen shadow])
>  
>  # Function setproctitle() is in BSD -lutil or GNU systems -lbsd but N/A on Solaris
>  AC_SEARCH_LIBS([setproctitle], [util bsd])
> +AC_CHECK_HEADER([bsd/unistd.h],
> +	[AC_DEFINE(HAVE_BSD_UNISTD_H,1,[Define to 1 if you have 'bsd/unistd.h' header])])
>  
>  # Function setusercontext() is in BSD -lutil but N/A on Solaris or GNU systems
>  AC_SEARCH_LIBS([setusercontext], [util])
>  
>  # Function arc4random() is in BSD standard C or GNU systems -lbsd
>  AC_SEARCH_LIBS([arc4random], [bsd], [HAVE_ARC4RANDOM="yes"])
> +AC_CHECK_HEADER([bsd/stdlib.h],
> +	[AC_DEFINE(HAVE_BSD_STDLIB_H,1,[Define to 1 if you have 'bsd/stdlib.h' header])])
>  AC_SUBST(HAVE_ARC4RANDOM)
>  AM_CONDITIONAL(HAVE_ARC4RANDOM, test x$HAVE_ARC4RANDOM = xyes)
>  
> diff --git a/xdm/choose.c b/xdm/choose.c
> index f7472f5..16d9071 100644
> --- a/xdm/choose.c
> +++ b/xdm/choose.c
> @@ -35,6 +35,10 @@ in this Software without prior written authorization from The Open Group.
>  #include "dm.h"
>  #include "dm_error.h"
>  
> +#ifdef HAVE_BSD_UNISTD_H
> +#include <bsd/unistd.h>
> +#endif
> +
>  #ifdef XDMCP
>  
>  # include <X11/X.h>
> diff --git a/xdm/genauth.c b/xdm/genauth.c
> index f50be3b..b99cdc0 100644
> --- a/xdm/genauth.c
> +++ b/xdm/genauth.c
> @@ -43,6 +43,10 @@ from The Open Group.
>  #include <time.h>
>  #define Time_t time_t
>  
> +#ifdef HAVE_BSD_STDLIB_H
> +#include <bsd/stdlib.h>
> +#endif
> +
>  #ifdef HASXDMAUTH
>  static unsigned char	key[8];
>  #endif
> diff --git a/xdm/session.c b/xdm/session.c
> index 4f71d71..b20ceec 100644
> --- a/xdm/session.c
> +++ b/xdm/session.c
> @@ -37,6 +37,10 @@ from The Open Group.
>  # include "config.h"
>  #endif
>  
> +#ifdef HAVE_BSD_UNISTD_H
> +#include <bsd/unistd.h>
> +#endif
> +
>  #include "dm.h"
>  #include "dm_auth.h"
>  #include "dm_error.h"
> -- 
> 2.9.0
> 

In case this patch is forgotten, I bring it back here for review.



More information about the xorg-devel mailing list