Commit 97be8f06 by Stan Cox Committed by Stan Cox

gcc.c, cccp.c, cpplib.c, collect2.c (GET_ENVIRONMENT): Added.

From-SVN: r18914
parent 216be67c
Mon Mar 30 13:11:05 1998 Stan Cox <scox@cygnus.com>
* libgcc2.c: (__main, __do_global_dtors, __do_global_ctors):
For __CYGWIN32__ use the versions in winsup/dcrt0.cc.
* gcc.c, cccp.c, cpplib.c, collect2.c (GET_ENVIRONMENT): Added.
cygwin32 can override this to allow both unix and win32 style PATHs.
* i386/xm-cygwin32.h (GET_ENVIRONMENT): Defined to allow win32
style environment paths.
Mon Mar 30 14:43:20 1998 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> Mon Mar 30 14:43:20 1998 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* Makefile.in (cppalloc.o, cpperror.o, cppexp.o, cpphash.o, * Makefile.in (cppalloc.o, cpperror.o, cppexp.o, cpphash.o,
......
...@@ -83,6 +83,10 @@ extern char *rindex (); ...@@ -83,6 +83,10 @@ extern char *rindex ();
extern char *getenv (); extern char *getenv ();
#endif #endif
#ifndef GET_ENVIRONMENT
#define GET_ENVIRONMENT(ENV_VALUE,ENV_NAME) ENV_VALUE = getenv (ENV_NAME)
#endif
#if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7) #if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7)
# define __attribute__(x) # define __attribute__(x)
#endif #endif
...@@ -1705,7 +1709,7 @@ main (argc, argv) ...@@ -1705,7 +1709,7 @@ main (argc, argv)
/* Some people say that CPATH should replace the standard include dirs, /* Some people say that CPATH should replace the standard include dirs,
but that seems pointless: it comes before them, so it overrides them but that seems pointless: it comes before them, so it overrides them
anyway. */ anyway. */
cp = getenv ("CPATH"); GET_ENVIRONMENT (cp, "CPATH");
if (cp && ! no_standard_includes) if (cp && ! no_standard_includes)
path_include (cp); path_include (cp);
...@@ -1888,16 +1892,16 @@ main (argc, argv) ...@@ -1888,16 +1892,16 @@ main (argc, argv)
switch ((objc << 1) + cplusplus) switch ((objc << 1) + cplusplus)
{ {
case 0: case 0:
epath = getenv ("C_INCLUDE_PATH"); GET_ENVIRONMENT (epath, "C_INCLUDE_PATH");
break; break;
case 1: case 1:
epath = getenv ("CPLUS_INCLUDE_PATH"); GET_ENVIRONMENT (epath, "CPLUS_INCLUDE_PATH");
break; break;
case 2: case 2:
epath = getenv ("OBJC_INCLUDE_PATH"); GET_ENVIRONMENT (epath, "OBJC_INCLUDE_PATH");
break; break;
case 3: case 3:
epath = getenv ("OBJCPLUS_INCLUDE_PATH"); GET_ENVIRONMENT (epath, "OBJCPLUS_INCLUDE_PATH");
break; break;
} }
/* If the environment var for this language is set, /* If the environment var for this language is set,
......
...@@ -31,6 +31,25 @@ Boston, MA 02111-1307, USA. */ ...@@ -31,6 +31,25 @@ Boston, MA 02111-1307, USA. */
/* Even though we support "/", allow "\" since everybody tests both. */ /* Even though we support "/", allow "\" since everybody tests both. */
#define DIR_SEPARATOR '\\' #define DIR_SEPARATOR '\\'
/* If we allow both '/' and '\' as dir separators, then
allow both unix and win32 PATH syntax */
#undef GET_ENVIRONMENT
#define GET_ENVIRONMENT(ENV_VALUE,ENV_NAME) \
{ \
char *epath; \
char *win32epath; \
\
epath = win32epath = getenv (ENV_NAME); \
/* if we have a posix path list, convert to win32 path list */ \
if (epath != NULL && *epath != 0 && cygwin32_posix_path_list_p (epath)) \
{ \
win32epath = (char *) xmalloc \
(cygwin32_posix_to_win32_path_list_buf_size (epath)); \
cygwin32_posix_to_win32_path_list (epath, win32epath); \
} \
ENV_VALUE = win32epath; \
}
#define PATH_SEPARATOR ';' #define PATH_SEPARATOR ';'
/* This is needed so that protoize will compile. */ /* This is needed so that protoize will compile. */
......
...@@ -39,6 +39,10 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ ...@@ -39,6 +39,10 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "cpphash.h" #include "cpphash.h"
#include "gansidecl.h" #include "gansidecl.h"
#ifndef GET_ENVIRONMENT
#define GET_ENVIRONMENT(ENV_VALUE,ENV_NAME) ENV_VALUE = getenv (ENV_NAME)
#endif
extern char *update_path (); extern char *update_path ();
#ifndef O_RDONLY #ifndef O_RDONLY
...@@ -5691,7 +5695,7 @@ cpp_start_read (pfile, fname) ...@@ -5691,7 +5695,7 @@ cpp_start_read (pfile, fname)
/* Some people say that CPATH should replace the standard include dirs, /* Some people say that CPATH should replace the standard include dirs,
but that seems pointless: it comes before them, so it overrides them but that seems pointless: it comes before them, so it overrides them
anyway. */ anyway. */
p = (char *) getenv ("CPATH"); GET_ENVIRONMENT (p, "CPATH");
if (p != 0 && ! opts->no_standard_includes) if (p != 0 && ! opts->no_standard_includes)
path_include (pfile, p); path_include (pfile, p);
...@@ -5821,16 +5825,16 @@ cpp_start_read (pfile, fname) ...@@ -5821,16 +5825,16 @@ cpp_start_read (pfile, fname)
switch ((opts->objc << 1) + opts->cplusplus) switch ((opts->objc << 1) + opts->cplusplus)
{ {
case 0: case 0:
epath = getenv ("C_INCLUDE_PATH"); GET_ENVIRONMENT (epath, "C_INCLUDE_PATH");
break; break;
case 1: case 1:
epath = getenv ("CPLUS_INCLUDE_PATH"); GET_ENVIRONMENT (epath, "CPLUS_INCLUDE_PATH");
break; break;
case 2: case 2:
epath = getenv ("OBJC_INCLUDE_PATH"); GET_ENVIRONMENT (epath, "OBJC_INCLUDE_PATH");
break; break;
case 3: case 3:
epath = getenv ("OBJCPLUS_INCLUDE_PATH"); GET_ENVIRONMENT (epath, "OBJCPLUS_INCLUDE_PATH");
break; break;
} }
/* If the environment var for this language is set, /* If the environment var for this language is set,
......
...@@ -122,6 +122,10 @@ static char dir_separator_str[] = {DIR_SEPARATOR, 0}; ...@@ -122,6 +122,10 @@ static char dir_separator_str[] = {DIR_SEPARATOR, 0};
#define obstack_chunk_alloc xmalloc #define obstack_chunk_alloc xmalloc
#define obstack_chunk_free free #define obstack_chunk_free free
#ifndef GET_ENVIRONMENT
#define GET_ENVIRONMENT(ENV_VALUE,ENV_NAME) ENV_VALUE = getenv (ENV_NAME)
#endif
extern char *choose_temp_base PROTO((void)); extern char *choose_temp_base PROTO((void));
#ifndef HAVE_STRERROR #ifndef HAVE_STRERROR
...@@ -2358,7 +2362,7 @@ process_command (argc, argv) ...@@ -2358,7 +2362,7 @@ process_command (argc, argv)
int have_o = 0; int have_o = 0;
int lang_n_infiles = 0; int lang_n_infiles = 0;
gcc_exec_prefix = getenv ("GCC_EXEC_PREFIX"); GET_ENVIRONMENT (gcc_exec_prefix, "GCC_EXEC_PREFIX");
n_switches = 0; n_switches = 0;
n_infiles = 0; n_infiles = 0;
...@@ -2400,7 +2404,7 @@ process_command (argc, argv) ...@@ -2400,7 +2404,7 @@ process_command (argc, argv)
/* COMPILER_PATH and LIBRARY_PATH have values /* COMPILER_PATH and LIBRARY_PATH have values
that are lists of directory names with colons. */ that are lists of directory names with colons. */
temp = getenv ("COMPILER_PATH"); GET_ENVIRONMENT (temp, "COMPILER_PATH");
if (temp) if (temp)
{ {
char *startp, *endp; char *startp, *endp;
...@@ -2434,7 +2438,7 @@ process_command (argc, argv) ...@@ -2434,7 +2438,7 @@ process_command (argc, argv)
} }
} }
temp = getenv ("LIBRARY_PATH"); GET_ENVIRONMENT (temp, "LIBRARY_PATH");
if (temp && *cross_compile == '0') if (temp && *cross_compile == '0')
{ {
char *startp, *endp; char *startp, *endp;
...@@ -2467,7 +2471,7 @@ process_command (argc, argv) ...@@ -2467,7 +2471,7 @@ process_command (argc, argv)
} }
/* Use LPATH like LIBRARY_PATH (for the CMU build program). */ /* Use LPATH like LIBRARY_PATH (for the CMU build program). */
temp = getenv ("LPATH"); GET_ENVIRONMENT (temp, "LPATH");
if (temp && *cross_compile == '0') if (temp && *cross_compile == '0')
{ {
char *startp, *endp; char *startp, *endp;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment