OSDN Git Service

2010-04-06 Kai Tietz <kai.tietz@onevision.com>
[pf3gnuchains/gcc-fork.git] / gcc / config / i386 / xm-djgpp.h
1 /* Configuration for GCC for Intel 80386 running DJGPP.
2    Copyright (C) 1988, 1996, 1998, 1999, 2000, 2001, 2004, 2007
3    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 /* Use semicolons to separate elements of a path.  */
22 #define PATH_SEPARATOR ';'
23
24 #define HOST_EXECUTABLE_SUFFIX ".exe"
25
26 /* System dependent initialization for collect2
27    to tell system() to act like Unix.  */
28 #define COLLECT2_HOST_INITIALIZATION \
29   do { __system_flags |= (__system_allow_multiple_cmds                  \
30                           | __system_emulate_chdir); } while (0)
31
32 /* Define a version appropriate for DOS.  */
33 #undef XREF_FILE_NAME
34 #define XREF_FILE_NAME(xref_file, file) \
35   do { \
36     const char xref_ext[] = ".gxref"; \
37     strcpy (xref_file, file); \
38     s = basename (xref_file); \
39     t = strchr (s, '.'); \
40     if (t) \
41       strcpy (t, xref_ext); \
42     else \
43       strcat (xref_file, xref_ext); \
44   } while (0)
45
46 #undef GCC_DRIVER_HOST_INITIALIZATION
47 #define GCC_DRIVER_HOST_INITIALIZATION \
48   do { \
49     /* If the environment variable DJDIR is not defined, then DJGPP is not \
50        installed correctly and GCC will quickly become confused with the \
51        default prefix settings. Report the problem now so the user doesn't \
52        receive deceptive "file not found" error messages later.  */ \
53     char *djdir = getenv ("DJDIR"); \
54     if (djdir == NULL) \
55       { \
56         /* DJDIR is automatically defined by the DJGPP environment config \
57            file pointed to by the environment variable DJGPP. Examine DJGPP \
58            to try and figure out what's wrong.  */ \
59         char *djgpp = getenv ("DJGPP"); \
60         if (djgpp == NULL) \
61           fatal ("environment variable DJGPP not defined"); \
62         else if (access (djgpp, R_OK) == 0) \
63           fatal ("environment variable DJGPP points to missing file '%s'", \
64                  djgpp); \
65         else \
66           fatal ("environment variable DJGPP points to corrupt file '%s'", \
67                   djgpp); \
68       } \
69   } while (0)
70
71 /* Canonicalize paths containing '/dev/env/'; used in prefix.c.
72    _fixpath is a djgpp-specific function to canonicalize a path.
73    "/dev/env/DJDIR" evaluates to "c:/djgpp" if DJDIR is "c:/djgpp" for
74    example.  It removes any trailing '/', so add it back.  */
75 /* We cannot free PATH below as it can point to string constant  */
76 #define UPDATE_PATH_HOST_CANONICALIZE(PATH) \
77   if (memcmp ((PATH), "/dev/env/", sizeof("/dev/env/") - 1) == 0) \
78     {                                           \
79       static char fixed_path[FILENAME_MAX + 1]; \
80                                                 \
81       _fixpath ((PATH), fixed_path);            \
82       strcat (fixed_path, "/");                 \
83       (PATH) = xstrdup (fixed_path);            \
84     }