This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: gcc-2.95.2, Next 4.2, gcc.c won't compile in state2
- To: mckelvey at fafnir dot com
- Subject: Re: gcc-2.95.2, Next 4.2, gcc.c won't compile in state2
- From: "Kaveh R. Ghazi" <ghazi at caip dot rutgers dot edu>
- Date: Fri, 19 Nov 1999 11:37:39 -0500 (EST)
- Cc: egcs-bugs at egcs dot cygnus dot com
> From: James McKelvey <mckelvey@fafnir.com>
> >
> > I think your problem occurs because configure did not detect putenv in
> > your system's libc. Normally, autoconf/configure would define
> > HAVE_PUTENV and this issue wouldn't arise because then gcc.c wouldn't
> > attempt to provide putenv for you. IMHO, I think it would be a better
> > approach to figure out why this happened and fix that instead.
> >
>
> My system doesn't have putenv, so I do need the one in gcc.c. The
> problem is that the gcc/stdlib.h is generated with a prototype for
> putenv that doesn't match the one in gcc.c. I searched all the
> system include files; no putenv anywhere.
> Jim
Oh okay, my bad. Although, if gcc is putting a declaration for putenv
in stdlib.h, it should be wrapped by __USE_FIXED_PROTOTYPES__ or
something like that. Isn't this the case?
Anyway, let's try another approach. :-)
The putenv function should be provided by libiberty.a if you don't
have it, so we don't need a copy in gcc.c. What happens if you simply
take out the definition of putenv in gcc.c?
E.g.:
--- gcc.c~ Fri Nov 19 11:24:12 1999
+++ gcc.c Fri Nov 19 11:26:37 1999
@@ -1841,61 +1841,6 @@ clear_failure_queue ()
failure_delete_queue = 0;
}
-/* Routine to add variables to the environment. We do this to pass
- the pathname of the gcc driver, and the directories search to the
- collect2 program, which is being run as ld. This way, we can be
- sure of executing the right compiler when collect2 wants to build
- constructors and destructors. Since the environment variables we
- use come from an obstack, we don't have to worry about allocating
- space for them. */
-
-#ifndef HAVE_PUTENV
-
-void
-putenv (str)
- char *str;
-{
-#ifndef VMS /* nor about VMS */
-
- extern char **environ;
- char **old_environ = environ;
- char **envp;
- int num_envs = 0;
- int name_len = 1;
- int str_len = strlen (str);
- char *p = str;
- int ch;
-
- while ((ch = *p++) != '\0' && ch != '=')
- name_len++;
-
- if (!ch)
- abort ();
-
- /* Search for replacing an existing environment variable, and
- count the number of total environment variables. */
- for (envp = old_environ; *envp; envp++)
- {
- num_envs++;
- if (!strncmp (str, *envp, name_len))
- {
- *envp = str;
- return;
- }
- }
-
- /* Add a new environment variable */
- environ = (char **) xmalloc (sizeof (char *) * (num_envs+2));
- *environ = str;
- memcpy ((char *) (environ + 1), (char *) old_environ,
- sizeof (char *) * (num_envs+1));
-
-#endif /* VMS */
-}
-
-#endif /* HAVE_PUTENV */
-
-
/* Build a list of search directories from PATHS.
PREFIX is a string to prepend to the list.
If CHECK_DIR_P is non-zero we ensure the directory exists.