OSDN Git Service

2e5260e3e2358e73cfccd27d71ccbc48d6b189fe
[pf3gnuchains/gcc-fork.git] / gcc / config / i386 / xm-djgpp.h
1 /* Configuration for GNU C-compiler for Intel 80386 running DJGPP.
2    Copyright (C) 1988, 1996, 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
3
4 This file is part of GNU CC.
5
6 GNU CC is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
9 any later version.
10
11 GNU CC is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with GNU CC; see the file COPYING.  If not, write to
18 the Free Software Foundation, 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA.  */
20
21 /* Use semicolons to separate elements of a path.  */
22 #define PATH_SEPARATOR ';'
23
24 #define HOST_EXECUTABLE_SUFFIX ".exe"
25
26 /* Even though we support "/", allow "\" since everybody tests both.  */
27 #define DIR_SEPARATOR '/'
28 #define DIR_SEPARATOR_2 '\\'
29
30 /* Allow test for DOS drive names.  */
31 #define HAVE_DOS_BASED_FILE_SYSTEM
32
33 /* System dependant initialization for collect2
34    to tell system() to act like Unix.  */
35 #define COLLECT2_HOST_INITIALIZATION \
36   do { __system_flags |= (__system_allow_multiple_cmds                  \
37                           | __system_emulate_chdir); } while (0)
38
39 /* Define a version appropriate for DOS.  */
40 #undef XREF_FILE_NAME
41 #define XREF_FILE_NAME(xref_file, file) \
42   do { \
43     const char xref_ext[] = ".gxref"; \
44     strcpy (xref_file, file); \
45     s = basename (xref_file); \
46     t = strchr (s, '.'); \
47     if (t) \
48       strcpy (t, xref_ext); \
49     else \
50       strcat (xref_file, xref_ext); \
51   } while (0)
52
53 /* Change /dev/env/DJDIR/prefix/dir/ to canonical form so gcc_exec_prefix
54    is set properly in 'gcc.c'. It also helps to cut down the number of times
55    the value of the DJGPP environment variable 'DJDIR' is evaluated.  */
56 #undef GCC_DRIVER_HOST_INITIALIZATION
57 #define GCC_DRIVER_HOST_INITIALIZATION \
58   do { \
59     /* If the environment variable DJDIR is not defined, then DJGPP is not \
60        installed correctly and GCC will quickly become confused with the \
61        default prefix settings. Report the problem now so the user doesn't \
62        receive deceptive "file not found" error messages later.  */ \
63     char *djdir = getenv ("DJDIR"); \
64     if (djdir == NULL) \
65       { \
66         /* DJDIR is automatically defined by the DJGPP environment config \
67            file pointed to by the environment variable DJGPP. Examine DJGPP \
68            to try and figure out what's wrong.  */ \
69         char *djgpp = getenv ("DJGPP"); \
70         if (djgpp == NULL) \
71           fatal ("Environment variable DJGPP not defined."); \
72         else if (access (djgpp, R_OK) == 0) \
73           fatal ("Environment variable DJGPP points to missing file '%s'.", \
74                  djgpp); \
75         else \
76           fatal ("Environment variable DJGPP points to corrupt file '%s'.", \
77                   djgpp); \
78       } \
79     standard_exec_prefix = update_path (standard_exec_prefix, NULL); \
80     standard_bindir_prefix = update_path (standard_bindir_prefix, NULL); \
81     standard_startfile_prefix = update_path (standard_startfile_prefix, NULL); \
82   } while (0)
83
84 /* Canonicalize paths containing '/dev/env/'; used in prefix.c.
85    _fixpath is a djgpp-specific function to canonicalize a path.
86    "/dev/env/DJDIR" evaluates to "c:/djgpp" if DJDIR is "c:/djgpp" for
87    example.  It removes any trailing '/', so add it back.  */
88 /* We cannot free PATH below as it can point to string constant  */
89 #define UPDATE_PATH_HOST_CANONICALIZE(PATH) \
90   if (memcmp ((PATH), "/dev/env/", sizeof("/dev/env/") - 1) == 0) \
91     {                                           \
92       static char fixed_path[FILENAME_MAX + 1]; \
93                                                 \
94       _fixpath ((PATH), fixed_path);            \
95       strcat (fixed_path, "/");                 \
96       (PATH) = xstrdup (fixed_path);            \
97     }