OSDN Git Service

a0457b7af0aa7eeea9b9b10c1032a0ae8709867d
[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 /* 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 /* Change /dev/env/DJDIR/prefix/dir/ to canonical form so gcc_exec_prefix
47    is set properly in 'gcc.c'. It also helps to cut down the number of times
48    the value of the DJGPP environment variable 'DJDIR' is evaluated.  */
49 #undef GCC_DRIVER_HOST_INITIALIZATION
50 #define GCC_DRIVER_HOST_INITIALIZATION \
51   do { \
52     /* If the environment variable DJDIR is not defined, then DJGPP is not \
53        installed correctly and GCC will quickly become confused with the \
54        default prefix settings. Report the problem now so the user doesn't \
55        receive deceptive "file not found" error messages later.  */ \
56     char *djdir = getenv ("DJDIR"); \
57     if (djdir == NULL) \
58       { \
59         /* DJDIR is automatically defined by the DJGPP environment config \
60            file pointed to by the environment variable DJGPP. Examine DJGPP \
61            to try and figure out what's wrong.  */ \
62         char *djgpp = getenv ("DJGPP"); \
63         if (djgpp == NULL) \
64           fatal ("environment variable DJGPP not defined"); \
65         else if (access (djgpp, R_OK) == 0) \
66           fatal ("environment variable DJGPP points to missing file '%s'", \
67                  djgpp); \
68         else \
69           fatal ("environment variable DJGPP points to corrupt file '%s'", \
70                   djgpp); \
71       } \
72     standard_exec_prefix = update_path (standard_exec_prefix, NULL); \
73     standard_bindir_prefix = update_path (standard_bindir_prefix, NULL); \
74     standard_startfile_prefix = update_path (standard_startfile_prefix, NULL); \
75   } while (0)
76
77 /* Canonicalize paths containing '/dev/env/'; used in prefix.c.
78    _fixpath is a djgpp-specific function to canonicalize a path.
79    "/dev/env/DJDIR" evaluates to "c:/djgpp" if DJDIR is "c:/djgpp" for
80    example.  It removes any trailing '/', so add it back.  */
81 /* We cannot free PATH below as it can point to string constant  */
82 #define UPDATE_PATH_HOST_CANONICALIZE(PATH) \
83   if (memcmp ((PATH), "/dev/env/", sizeof("/dev/env/") - 1) == 0) \
84     {                                           \
85       static char fixed_path[FILENAME_MAX + 1]; \
86                                                 \
87       _fixpath ((PATH), fixed_path);            \
88       strcat (fixed_path, "/");                 \
89       (PATH) = xstrdup (fixed_path);            \
90     }