summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/ChangeLog11
-rw-r--r--gcc/cccp.c14
-rw-r--r--gcc/config/i386/xm-cygwin32.h19
-rw-r--r--gcc/cpplib.c14
-rw-r--r--gcc/gcc.c12
5 files changed, 56 insertions, 14 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 516c61ab3de..89538bd47fd 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,14 @@
+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>
* Makefile.in (cppalloc.o, cpperror.o, cppexp.o, cpphash.o,
diff --git a/gcc/cccp.c b/gcc/cccp.c
index a989bbe814e..ac7ae8a99e1 100644
--- a/gcc/cccp.c
+++ b/gcc/cccp.c
@@ -83,6 +83,10 @@ extern char *rindex ();
extern char *getenv ();
#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)
# define __attribute__(x)
#endif
@@ -1705,7 +1709,7 @@ main (argc, argv)
/* Some people say that CPATH should replace the standard include dirs,
but that seems pointless: it comes before them, so it overrides them
anyway. */
- cp = getenv ("CPATH");
+ GET_ENVIRONMENT (cp, "CPATH");
if (cp && ! no_standard_includes)
path_include (cp);
@@ -1888,16 +1892,16 @@ main (argc, argv)
switch ((objc << 1) + cplusplus)
{
case 0:
- epath = getenv ("C_INCLUDE_PATH");
+ GET_ENVIRONMENT (epath, "C_INCLUDE_PATH");
break;
case 1:
- epath = getenv ("CPLUS_INCLUDE_PATH");
+ GET_ENVIRONMENT (epath, "CPLUS_INCLUDE_PATH");
break;
case 2:
- epath = getenv ("OBJC_INCLUDE_PATH");
+ GET_ENVIRONMENT (epath, "OBJC_INCLUDE_PATH");
break;
case 3:
- epath = getenv ("OBJCPLUS_INCLUDE_PATH");
+ GET_ENVIRONMENT (epath, "OBJCPLUS_INCLUDE_PATH");
break;
}
/* If the environment var for this language is set,
diff --git a/gcc/config/i386/xm-cygwin32.h b/gcc/config/i386/xm-cygwin32.h
index 8f8db60e4b2..c83b076351a 100644
--- a/gcc/config/i386/xm-cygwin32.h
+++ b/gcc/config/i386/xm-cygwin32.h
@@ -31,6 +31,25 @@ Boston, MA 02111-1307, USA. */
/* Even though we support "/", allow "\" since everybody tests both. */
#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 ';'
/* This is needed so that protoize will compile. */
diff --git a/gcc/cpplib.c b/gcc/cpplib.c
index 88c2e85509d..8528861282a 100644
--- a/gcc/cpplib.c
+++ b/gcc/cpplib.c
@@ -39,6 +39,10 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "cpphash.h"
#include "gansidecl.h"
+#ifndef GET_ENVIRONMENT
+#define GET_ENVIRONMENT(ENV_VALUE,ENV_NAME) ENV_VALUE = getenv (ENV_NAME)
+#endif
+
extern char *update_path ();
#ifndef O_RDONLY
@@ -5691,7 +5695,7 @@ cpp_start_read (pfile, fname)
/* Some people say that CPATH should replace the standard include dirs,
but that seems pointless: it comes before them, so it overrides them
anyway. */
- p = (char *) getenv ("CPATH");
+ GET_ENVIRONMENT (p, "CPATH");
if (p != 0 && ! opts->no_standard_includes)
path_include (pfile, p);
@@ -5821,16 +5825,16 @@ cpp_start_read (pfile, fname)
switch ((opts->objc << 1) + opts->cplusplus)
{
case 0:
- epath = getenv ("C_INCLUDE_PATH");
+ GET_ENVIRONMENT (epath, "C_INCLUDE_PATH");
break;
case 1:
- epath = getenv ("CPLUS_INCLUDE_PATH");
+ GET_ENVIRONMENT (epath, "CPLUS_INCLUDE_PATH");
break;
case 2:
- epath = getenv ("OBJC_INCLUDE_PATH");
+ GET_ENVIRONMENT (epath, "OBJC_INCLUDE_PATH");
break;
case 3:
- epath = getenv ("OBJCPLUS_INCLUDE_PATH");
+ GET_ENVIRONMENT (epath, "OBJCPLUS_INCLUDE_PATH");
break;
}
/* If the environment var for this language is set,
diff --git a/gcc/gcc.c b/gcc/gcc.c
index d68f404b273..ac0b36c10bc 100644
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -122,6 +122,10 @@ static char dir_separator_str[] = {DIR_SEPARATOR, 0};
#define obstack_chunk_alloc xmalloc
#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));
#ifndef HAVE_STRERROR
@@ -2358,7 +2362,7 @@ process_command (argc, argv)
int have_o = 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_infiles = 0;
@@ -2400,7 +2404,7 @@ process_command (argc, argv)
/* COMPILER_PATH and LIBRARY_PATH have values
that are lists of directory names with colons. */
- temp = getenv ("COMPILER_PATH");
+ GET_ENVIRONMENT (temp, "COMPILER_PATH");
if (temp)
{
char *startp, *endp;
@@ -2434,7 +2438,7 @@ process_command (argc, argv)
}
}
- temp = getenv ("LIBRARY_PATH");
+ GET_ENVIRONMENT (temp, "LIBRARY_PATH");
if (temp && *cross_compile == '0')
{
char *startp, *endp;
@@ -2467,7 +2471,7 @@ process_command (argc, argv)
}
/* Use LPATH like LIBRARY_PATH (for the CMU build program). */
- temp = getenv ("LPATH");
+ GET_ENVIRONMENT (temp, "LPATH");
if (temp && *cross_compile == '0')
{
char *startp, *endp;