xm-djgpp.h revision 169689
1178825Sdfr/* Configuration for GCC for Intel 80386 running DJGPP.
2233294Sstas   Copyright (C) 1988, 1996, 1998, 1999, 2000, 2001, 2004
3233294Sstas   Free Software Foundation, Inc.
4233294Sstas
5178825SdfrThis file is part of GCC.
6233294Sstas
7233294SstasGCC is free software; you can redistribute it and/or modify
8233294Sstasit under the terms of the GNU General Public License as published by
9178825Sdfrthe Free Software Foundation; either version 2, or (at your option)
10233294Sstasany later version.
11233294Sstas
12178825SdfrGCC is distributed in the hope that it will be useful,
13233294Sstasbut WITHOUT ANY WARRANTY; without even the implied warranty of
14233294SstasMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15233294SstasGNU General Public License for more details.
16178825Sdfr
17233294SstasYou should have received a copy of the GNU General Public License
18233294Sstasalong with GCC; see the file COPYING.  If not, write to
19233294Sstasthe Free Software Foundation, 51 Franklin Street, Fifth Floor,
20178825SdfrBoston, MA 02110-1301, USA.  */
21233294Sstas
22233294Sstas/* Use semicolons to separate elements of a path.  */
23233294Sstas#define PATH_SEPARATOR ';'
24233294Sstas
25233294Sstas#define HOST_EXECUTABLE_SUFFIX ".exe"
26233294Sstas
27233294Sstas/* System dependent initialization for collect2
28233294Sstas   to tell system() to act like Unix.  */
29233294Sstas#define COLLECT2_HOST_INITIALIZATION \
30233294Sstas  do { __system_flags |= (__system_allow_multiple_cmds			\
31233294Sstas		          | __system_emulate_chdir); } while (0)
32178825Sdfr
33178825Sdfr/* Define a version appropriate for DOS.  */
34178825Sdfr#undef XREF_FILE_NAME
35178825Sdfr#define XREF_FILE_NAME(xref_file, file) \
36178825Sdfr  do { \
37178825Sdfr    const char xref_ext[] = ".gxref"; \
38178825Sdfr    strcpy (xref_file, file); \
39178825Sdfr    s = basename (xref_file); \
40178825Sdfr    t = strchr (s, '.'); \
41178825Sdfr    if (t) \
42178825Sdfr      strcpy (t, xref_ext); \
43233294Sstas    else \
44178825Sdfr      strcat (xref_file, xref_ext); \
45178825Sdfr  } while (0)
46233294Sstas
47233294Sstas#undef GCC_DRIVER_HOST_INITIALIZATION
48233294Sstas#define GCC_DRIVER_HOST_INITIALIZATION \
49178825Sdfr  do { \
50178825Sdfr    /* If the environment variable DJDIR is not defined, then DJGPP is not \
51178825Sdfr       installed correctly and GCC will quickly become confused with the \
52178825Sdfr       default prefix settings. Report the problem now so the user doesn't \
53178825Sdfr       receive deceptive "file not found" error messages later.  */ \
54178825Sdfr    char *djdir = getenv ("DJDIR"); \
55178825Sdfr    if (djdir == NULL) \
56233294Sstas      { \
57233294Sstas        /* DJDIR is automatically defined by the DJGPP environment config \
58178825Sdfr           file pointed to by the environment variable DJGPP. Examine DJGPP \
59233294Sstas           to try and figure out what's wrong.  */ \
60233294Sstas        char *djgpp = getenv ("DJGPP"); \
61233294Sstas        if (djgpp == NULL) \
62233294Sstas          fatal ("environment variable DJGPP not defined"); \
63178825Sdfr        else if (access (djgpp, R_OK) == 0) \
64178825Sdfr          fatal ("environment variable DJGPP points to missing file '%s'", \
65178825Sdfr                 djgpp); \
66233294Sstas        else \
67233294Sstas          fatal ("environment variable DJGPP points to corrupt file '%s'", \
68233294Sstas                  djgpp); \
69233294Sstas      } \
70233294Sstas  } while (0)
71233294Sstas
72233294Sstas/* Canonicalize paths containing '/dev/env/'; used in prefix.c.
73233294Sstas   _fixpath is a djgpp-specific function to canonicalize a path.
74233294Sstas   "/dev/env/DJDIR" evaluates to "c:/djgpp" if DJDIR is "c:/djgpp" for
75233294Sstas   example.  It removes any trailing '/', so add it back.  */
76233294Sstas/* We cannot free PATH below as it can point to string constant  */
77233294Sstas#define UPDATE_PATH_HOST_CANONICALIZE(PATH) \
78233294Sstas  if (memcmp ((PATH), "/dev/env/", sizeof("/dev/env/") - 1) == 0) \
79233294Sstas    {						\
80233294Sstas      static char fixed_path[FILENAME_MAX + 1];	\
81233294Sstas						\
82233294Sstas      _fixpath ((PATH), fixed_path);		\
83233294Sstas      strcat (fixed_path, "/");			\
84233294Sstas      (PATH) = xstrdup (fixed_path);		\
85233294Sstas    }
86233294Sstas