OSDN Git Service

7de34d24b7a0f206395c536333511a4490b5496e
[pf3gnuchains/gcc-fork.git] / gcc / config / i386 / cygwin1.c
1 /* Helper routines for cygwin-specific command-line parsing.
2    Contributed by Christopher Faylor (cgf@redhat.com)
3    Copyright 2003, 2005, 2007, 2008 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 #include <string.h>
26
27 void
28 mingw_scan (int argc ATTRIBUTE_UNUSED,
29             const char *const *argv,
30             const char **spec_machine)
31 {
32   putenv (xstrdup ("GCC_CYGWIN_MINGW=0"));
33  
34   while (*++argv)
35     if (strcmp (*argv, "-mno-win32") == 0)
36       putenv (xstrdup ("GCC_CYGWIN_WIN32=0"));
37     else if (strcmp (*argv, "-mwin32") == 0)
38       putenv (xstrdup ("GCC_CYGWIN_WIN32=1"));
39     else if (strcmp (*argv, "-mno-cygwin") == 0)
40       {
41         char *p = strstr (*spec_machine, "-cygwin");
42         if (p)
43           {
44             int len = p - *spec_machine;
45             char *s = XNEWVEC (char, strlen (*spec_machine) + 3);
46             memcpy (s, *spec_machine, len);
47             strcpy (s + len, "-mingw32");
48             *spec_machine = s;
49           }
50         putenv (xstrdup ("GCC_CYGWIN_MINGW=1"));
51       }
52   return;
53 }