xm-djgpp.h revision 169690
1351292Sdim/* Configuration for GCC for Intel 80386 running DJGPP.
2351292Sdim   Copyright (C) 1988, 1996, 1998, 1999, 2000, 2001, 2004
3351292Sdim   Free Software Foundation, Inc.
4351292Sdim
5351292SdimThis file is part of GCC.
6351292Sdim
7351292SdimGCC is free software; you can redistribute it and/or modify
8351292Sdimit under the terms of the GNU General Public License as published by
9351292Sdimthe Free Software Foundation; either version 2, or (at your option)
10351292Sdimany later version.
11351292Sdim
12351292SdimGCC is distributed in the hope that it will be useful,
13351292Sdimbut WITHOUT ANY WARRANTY; without even the implied warranty of
14351292SdimMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15351292SdimGNU General Public License for more details.
16351292Sdim
17351292SdimYou should have received a copy of the GNU General Public License
18351292Sdimalong with GCC; see the file COPYING.  If not, write to
19351292Sdimthe Free Software Foundation, 51 Franklin Street, Fifth Floor,
20351292SdimBoston, MA 02110-1301, USA.  */
21351292Sdim
22351292Sdim/* Use semicolons to separate elements of a path.  */
23351292Sdim#define PATH_SEPARATOR ';'
24351292Sdim
25351292Sdim#define HOST_EXECUTABLE_SUFFIX ".exe"
26351292Sdim
27351292Sdim/* System dependent initialization for collect2
28351292Sdim   to tell system() to act like Unix.  */
29351292Sdim#define COLLECT2_HOST_INITIALIZATION \
30351292Sdim  do { __system_flags |= (__system_allow_multiple_cmds			\
31351292Sdim		          | __system_emulate_chdir); } while (0)
32351292Sdim
33351292Sdim/* Define a version appropriate for DOS.  */
34351292Sdim#undef XREF_FILE_NAME
35351292Sdim#define XREF_FILE_NAME(xref_file, file) \
36351292Sdim  do { \
37351292Sdim    const char xref_ext[] = ".gxref"; \
38351292Sdim    strcpy (xref_file, file); \
39351292Sdim    s = basename (xref_file); \
40351292Sdim    t = strchr (s, '.'); \
41351292Sdim    if (t) \
42351292Sdim      strcpy (t, xref_ext); \
43351292Sdim    else \
44351292Sdim      strcat (xref_file, xref_ext); \
45351292Sdim  } while (0)
46351292Sdim
47351292Sdim#undef GCC_DRIVER_HOST_INITIALIZATION
48351292Sdim#define GCC_DRIVER_HOST_INITIALIZATION \
49351292Sdim  do { \
50351292Sdim    /* If the environment variable DJDIR is not defined, then DJGPP is not \
51351292Sdim       installed correctly and GCC will quickly become confused with the \
52351292Sdim       default prefix settings. Report the problem now so the user doesn't \
53351292Sdim       receive deceptive "file not found" error messages later.  */ \
54351292Sdim    char *djdir = getenv ("DJDIR"); \
55351292Sdim    if (djdir == NULL) \
56351292Sdim      { \
57351292Sdim        /* DJDIR is automatically defined by the DJGPP environment config \
58351292Sdim           file pointed to by the environment variable DJGPP. Examine DJGPP \
59351292Sdim           to try and figure out what's wrong.  */ \
60351292Sdim        char *djgpp = getenv ("DJGPP"); \
61351292Sdim        if (djgpp == NULL) \
62351292Sdim          fatal ("environment variable DJGPP not defined"); \
63351292Sdim        else if (access (djgpp, R_OK) == 0) \
64351292Sdim          fatal ("environment variable DJGPP points to missing file '%s'", \
65351292Sdim                 djgpp); \
66351292Sdim        else \
67351292Sdim          fatal ("environment variable DJGPP points to corrupt file '%s'", \
68351292Sdim                  djgpp); \
69351292Sdim      } \
70351292Sdim  } while (0)
71351292Sdim
72351292Sdim/* Canonicalize paths containing '/dev/env/'; used in prefix.c.
73351292Sdim   _fixpath is a djgpp-specific function to canonicalize a path.
74351292Sdim   "/dev/env/DJDIR" evaluates to "c:/djgpp" if DJDIR is "c:/djgpp" for
75351292Sdim   example.  It removes any trailing '/', so add it back.  */
76351292Sdim/* We cannot free PATH below as it can point to string constant  */
77351292Sdim#define UPDATE_PATH_HOST_CANONICALIZE(PATH) \
78351292Sdim  if (memcmp ((PATH), "/dev/env/", sizeof("/dev/env/") - 1) == 0) \
79351292Sdim    {						\
80351292Sdim      static char fixed_path[FILENAME_MAX + 1];	\
81351292Sdim						\
82351292Sdim      _fixpath ((PATH), fixed_path);		\
83351292Sdim      strcat (fixed_path, "/");			\
84351292Sdim      (PATH) = xstrdup (fixed_path);		\
85351292Sdim    }
86351292Sdim