00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #include "config.h"
00023 #include "system.h"
00024 #include "coretypes.h"
00025 #include "tm.h"
00026
00027 #include "safe-ctype.h"
00028 #include <string.h>
00029
00030
00031
00032
00033 static void add_mingw (void);
00034 static void set_mingw (void) __attribute__ ((constructor));
00035
00036 static void
00037 add_mingw (void)
00038 {
00039 char **av;
00040 char *p;
00041 for (av = cvt_to_mingw; *av; av++)
00042 {
00043 int sawcygwin = 0;
00044 while ((p = strstr (*av, "-cygwin")))
00045 {
00046 char *over = p + sizeof ("-cygwin") - 1;
00047 memmove (over + 1, over, strlen (over));
00048 memcpy (p, "-mingw32", sizeof("-mingw32") - 1);
00049 p = ++over;
00050 while (ISALNUM (*p))
00051 p++;
00052 strcpy (over, p);
00053 sawcygwin = 1;
00054 }
00055 if (!sawcygwin && !strstr (*av, "mingw"))
00056 strcat (*av, CYGWIN_MINGW_SUBDIR);
00057 }
00058 }
00059
00060
00061 static void
00062 set_mingw (void)
00063 {
00064 char *env = getenv ("GCC_CYGWIN_MINGW");
00065 if (env && *env == '1')
00066 add_mingw ();
00067 }