OSDN Git Service

gcc.c, cccp.c, cpplib.c, collect2.c (GET_ENVIRONMENT): Added.
authorscox <scox@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 30 Mar 1998 14:35:36 +0000 (14:35 +0000)
committerscox <scox@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 30 Mar 1998 14:35:36 +0000 (14:35 +0000)
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@18914 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/cccp.c
gcc/config/i386/xm-cygwin32.h
gcc/cpplib.c
gcc/gcc.c

index 516c61a..89538bd 100644 (file)
@@ -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,
index a989bbe..ac7ae8a 100644 (file)
@@ -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,
index 8f8db60..c83b076 100644 (file)
@@ -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.  */
index 88c2e85..8528861 100644 (file)
@@ -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,
index d68f404..ac0b36c 100644 (file)
--- 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;