xm-djgpp.h revision 90075
150472Speter/* Configuration for GNU C-compiler for Intel 80386 running DJGPP.
238738Sbrian   Copyright (C) 1988, 1996, 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
337Srgrimes
437SrgrimesThis file is part of GNU CC.
537Srgrimes
67356SjoergGNU CC is free software; you can redistribute it and/or modify
718689Sacheit under the terms of the GNU General Public License as published by
818689Sachethe Free Software Foundation; either version 2, or (at your option)
918689Sacheany later version.
1045232Sbrian
1145232SbrianGNU CC is distributed in the hope that it will be useful,
1218689Sachebut WITHOUT ANY WARRANTY; without even the implied warranty of
1318689SacheMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1418689SacheGNU General Public License for more details.
1598978Smaxim
16256097SdesYou should have received a copy of the GNU General Public License
17256097Sdesalong with GNU CC; see the file COPYING.  If not, write to
18256097Sdesthe Free Software Foundation, 59 Temple Place - Suite 330,
1945232SbrianBoston, MA 02111-1307, USA.  */
20256097Sdes
21127234Smaxim/* Use semicolons to separate elements of a path.  */
22131343Smaxim#define PATH_SEPARATOR ';'
23147069Smaxim
2437Srgrimes#define HOST_EXECUTABLE_SUFFIX ".exe"
2545232Sbrian
26243752Srwatson/* Even though we support "/", allow "\" since everybody tests both.  */
2796156Smaxim#define DIR_SEPARATOR '/'
28218119Smaxim#define DIR_SEPARATOR_2 '\\'
2918689Sache
30/* Allow test for DOS drive names.  */
31#define HAVE_DOS_BASED_FILE_SYSTEM
32
33/* System dependent initialization for collect2
34   to tell system() to act like Unix.  */
35#define COLLECT2_HOST_INITIALIZATION \
36  do { __system_flags |= (__system_allow_multiple_cmds			\
37		          | __system_emulate_chdir); } while (0)
38
39/* Define a version appropriate for DOS.  */
40#undef XREF_FILE_NAME
41#define XREF_FILE_NAME(xref_file, file) \
42  do { \
43    const char xref_ext[] = ".gxref"; \
44    strcpy (xref_file, file); \
45    s = basename (xref_file); \
46    t = strchr (s, '.'); \
47    if (t) \
48      strcpy (t, xref_ext); \
49    else \
50      strcat (xref_file, xref_ext); \
51  } while (0)
52
53/* Change /dev/env/DJDIR/prefix/dir/ to canonical form so gcc_exec_prefix
54   is set properly in 'gcc.c'. It also helps to cut down the number of times
55   the value of the DJGPP environment variable 'DJDIR' is evaluated.  */
56#undef GCC_DRIVER_HOST_INITIALIZATION
57#define GCC_DRIVER_HOST_INITIALIZATION \
58  do { \
59    /* If the environment variable DJDIR is not defined, then DJGPP is not \
60       installed correctly and GCC will quickly become confused with the \
61       default prefix settings. Report the problem now so the user doesn't \
62       receive deceptive "file not found" error messages later.  */ \
63    char *djdir = getenv ("DJDIR"); \
64    if (djdir == NULL) \
65      { \
66        /* DJDIR is automatically defined by the DJGPP environment config \
67           file pointed to by the environment variable DJGPP. Examine DJGPP \
68           to try and figure out what's wrong.  */ \
69        char *djgpp = getenv ("DJGPP"); \
70        if (djgpp == NULL) \
71          fatal ("environment variable DJGPP not defined"); \
72        else if (access (djgpp, R_OK) == 0) \
73          fatal ("environment variable DJGPP points to missing file '%s'", \
74                 djgpp); \
75        else \
76          fatal ("environment variable DJGPP points to corrupt file '%s'", \
77                  djgpp); \
78      } \
79    standard_exec_prefix = update_path (standard_exec_prefix, NULL); \
80    standard_bindir_prefix = update_path (standard_bindir_prefix, NULL); \
81    standard_startfile_prefix = update_path (standard_startfile_prefix, NULL); \
82  } while (0)
83
84/* Canonicalize paths containing '/dev/env/'; used in prefix.c.
85   _fixpath is a djgpp-specific function to canonicalize a path.
86   "/dev/env/DJDIR" evaluates to "c:/djgpp" if DJDIR is "c:/djgpp" for
87   example.  It removes any trailing '/', so add it back.  */
88/* We cannot free PATH below as it can point to string constant  */
89#define UPDATE_PATH_HOST_CANONICALIZE(PATH) \
90  if (memcmp ((PATH), "/dev/env/", sizeof("/dev/env/") - 1) == 0) \
91    {						\
92      static char fixed_path[FILENAME_MAX + 1];	\
93						\
94      _fixpath ((PATH), fixed_path);		\
95      strcat (fixed_path, "/");			\
96      (PATH) = xstrdup (fixed_path);		\
97    }
98