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