0
|
1 /* Helper routines for cygwin-specific command-line parsing.
|
|
2 Contributed by Christopher Faylor (cgf@redhat.com)
|
|
3 Copyright 2003, 2007 Free Software Foundation, Inc.
|
|
4
|
|
5 This file is part of GCC.
|
|
6
|
|
7 GCC is free software; you can redistribute it and/or modify
|
|
8 it under the terms of the GNU General Public License as published by
|
|
9 the Free Software Foundation; either version 3, or (at your option)
|
|
10 any later version.
|
|
11
|
|
12 GCC is distributed in the hope that it will be useful,
|
|
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
15 GNU General Public License for more details.
|
|
16
|
|
17 You should have received a copy of the GNU General Public License
|
|
18 along with GCC; see the file COPYING3. If not see
|
|
19 <http://www.gnu.org/licenses/>. */
|
|
20
|
|
21 #include "config.h"
|
|
22 #include "system.h"
|
|
23 #include "coretypes.h"
|
|
24 #include "tm.h"
|
|
25
|
|
26 #include "safe-ctype.h"
|
|
27 #include <string.h>
|
|
28
|
|
29 /*
|
|
30 static void remove_w32api (void);
|
|
31 */
|
|
32 static void add_mingw (void);
|
|
33 static void set_mingw (void) __attribute__ ((constructor));
|
|
34
|
|
35 static void
|
|
36 add_mingw (void)
|
|
37 {
|
|
38 char **av;
|
|
39 char *p;
|
|
40 for (av = cvt_to_mingw; *av; av++)
|
|
41 {
|
|
42 int sawcygwin = 0;
|
|
43 while ((p = strstr (*av, "-cygwin")))
|
|
44 {
|
|
45 char *over = p + sizeof ("-cygwin") - 1;
|
|
46 memmove (over + 1, over, strlen (over));
|
|
47 memcpy (p, "-mingw32", sizeof("-mingw32") - 1);
|
|
48 p = ++over;
|
|
49 while (ISALNUM (*p))
|
|
50 p++;
|
|
51 strcpy (over, p);
|
|
52 sawcygwin = 1;
|
|
53 }
|
|
54 if (!sawcygwin && !strstr (*av, "mingw"))
|
|
55 strcat (*av, CYGWIN_MINGW_SUBDIR);
|
|
56 }
|
|
57 }
|
|
58
|
|
59
|
|
60 static void
|
|
61 set_mingw (void)
|
|
62 {
|
|
63 char *env = getenv ("GCC_CYGWIN_MINGW");
|
|
64 if (env && *env == '1')
|
|
65 add_mingw ();
|
|
66 }
|