bug-gnu-utils
[Top][All Lists]
Advanced

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

Re: Broken build attributed to (un)defined environ


From: Bruno Haible
Subject: Re: Broken build attributed to (un)defined environ
Date: Thu, 27 May 2004 16:39:18 +0200
User-agent: KMail/1.5

Michael Schloh von Bennewitz wrote:
> In many cases gettext requires the global variable 'environ' in libc, and
> many operating systems define this 'environ' in stdlib.h. Unfortunately,
> gettext simply assumes that it is defined there in all operating systems,
> leading to build failure in those which have no such definition in
> stdlib.h. ... the build broke on Solaris 10 at least

Before you explain your solution, you should explain what went wrong.
gettext is known to compile fine on Solaris 9. On this system
  - gettext's configure test says
        checking if environ is properly declared... no
  - libc contains the variable:
$ nm /usr/lib/libc.so.1 | grep environ
[4379]  |    772136|      24|OBJT |GLOB |0    |20     |__environ_lock
[3457]  |    296564|      56|FUNC |GLOB |0    |9      |__nis_get_environment
[1327]  |    296168|     340|FUNC |LOCL |0    |9      |__parse_environment
[4438]  |    772256|       4|OBJT |GLOB |0    |20     |_environ
[2982]  |    772256|       4|OBJT |WEAK |0    |20     |environ
[1328]  |    296508|      56|FUNC |LOCL |0    |9      |nss_get_environment

What is different on Solaris 10? You seem to say that it is not
declared in the header files there either; and I cannot believe that
the variable has been removed from libc in Solaris 10.

So if Solaris 9 and 10 are the same in this respect, the reasons, why you
see a failure on Solaris and I don't, must be different.

You have not mentioned:
  - The compiler with which you compile GNU gettext,
  - The compiler flags (CPPFLAGS, CFLAGS, LDFLAGS) that you set,
  - The command line arguments that you passed to the configure script,
  - The file whose compilation gave an error,
  - The compiler's error message on this file.

> I wrote a new Autoconf macro in 'configure.in', inserted the new Autoconf
> generated script code in 'configure', and test for a new identifier
> 'HAVE_DEFINED_ENVIRON'

Your autoconf macro appears to be equivalent to the one gettext already
uses, except that you search the declaration in <stdlib.h> whereas gettext's
macro looks for it in <unistd.h> (which is where glibc has it).

So what's the compilation failure that you observed coming from?

Bruno





reply via email to

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