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