Subject: Re: bug#10155: OSX breakage

From: Eli Zaretskii <[email-masked]>
Date: Tue, 29 Nov 2011 19:30:30 +0200

> Date: Tue, 29 Nov 2011 08:58:34 -0800
> From: Paul Eggert <[email-masked]>
> CC: Chong Yidong <[email-masked]>, [email-masked], [email-masked], 
>  [email-masked], [email-masked], 
>  Eli Zaretskii <[email-masked]>
> 
> You're right, on further thought Emacs itself needn't use stdalign,
> and I've prepared a simpler patch (below) that omits all changes to
> src/*.  Gnulib now uses stdalign, though, and Emacs uses
> multiple Gnulib modules such as sha256 that use stdalign, so
> this patch still brings in the stdalign module for Gnulib's own
> purposes.

I understand that the only part needed for solving the problems with
the missing declaration of `environ' is this:

> === added file 'm4/environ.m4'
> --- m4/environ.m4	1970-01-01 00:00:00 +0000
> +++ m4/environ.m4	2011-11-29 16:38:21 +0000
> @@ -0,0 +1,47 @@
> +# environ.m4 serial 6
> +dnl Copyright (C) 2001-2004, 2006-2011 Free Software Foundation, Inc.
> +dnl This file is free software; the Free Software Foundation
> +dnl gives unlimited permission to copy and/or distribute it,
> +dnl with or without modifications, as long as this notice is preserved.
> +
> +AC_DEFUN_ONCE([gl_ENVIRON],
> +[
> +  AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
> +  dnl Persuade glibc <unistd.h> to declare environ.
> +  AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
> +
> +  AC_CHECK_HEADERS_ONCE([unistd.h])
> +  gt_CHECK_VAR_DECL(
> +    [#if HAVE_UNISTD_H
> +     #include <unistd.h>
> +     #endif
> +     /* mingw, BeOS, Haiku declare environ in <stdlib.h>, not in <unistd.h>.  */
> +     #include <stdlib.h>
> +    ],
> +    [environ])
> +  if test $gt_cv_var_environ_declaration != yes; then
> +    HAVE_DECL_ENVIRON=0
> +  fi
> +])

IOW, the reason why lib/unistd.in.h didn't do its job is that
HAVE_DECL_ENVIRON was not defined to zero.

If that is true, I wonder if we could have a much smaller change that
fixes just that single problem.