xm-djgpp.h revision 90075
1228753Smm/* Configuration for GNU C-compiler for Intel 80386 running DJGPP.
2228753Smm   Copyright (C) 1988, 1996, 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
3228753Smm
4228753SmmThis file is part of GNU CC.
5228753Smm
6228753SmmGNU CC is free software; you can redistribute it and/or modify
7228753Smmit under the terms of the GNU General Public License as published by
8228753Smmthe Free Software Foundation; either version 2, or (at your option)
9228753Smmany later version.
10228753Smm
11228753SmmGNU CC is distributed in the hope that it will be useful,
12228753Smmbut WITHOUT ANY WARRANTY; without even the implied warranty of
13228753SmmMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14228753SmmGNU General Public License for more details.
15228753Smm
16228753SmmYou should have received a copy of the GNU General Public License
17228753Smmalong with GNU CC; see the file COPYING.  If not, write to
18228753Smmthe Free Software Foundation, 59 Temple Place - Suite 330,
19228753SmmBoston, MA 02111-1307, USA.  */
20228753Smm
21228753Smm/* Use semicolons to separate elements of a path.  */
22228753Smm#define PATH_SEPARATOR ';'
23228753Smm
24228753Smm#define HOST_EXECUTABLE_SUFFIX ".exe"
25228753Smm
26228753Smm/* Even though we support "/", allow "\" since everybody tests both.  */
27228753Smm#define DIR_SEPARATOR '/'
28228753Smm#define DIR_SEPARATOR_2 '\\'
29228753Smm
30231200Smm/* Allow test for DOS drive names.  */
31228753Smm#define HAVE_DOS_BASED_FILE_SYSTEM
32228753Smm
33228753Smm/* System dependent initialization for collect2
34228753Smm   to tell system() to act like Unix.  */
35228753Smm#define COLLECT2_HOST_INITIALIZATION \
36228753Smm  do { __system_flags |= (__system_allow_multiple_cmds			\
37228753Smm		          | __system_emulate_chdir); } while (0)
38228753Smm
39228753Smm/* Define a version appropriate for DOS.  */
40228753Smm#undef XREF_FILE_NAME
41228753Smm#define XREF_FILE_NAME(xref_file, file) \
42228753Smm  do { \
43228753Smm    const char xref_ext[] = ".gxref"; \
44228753Smm    strcpy (xref_file, file); \
45228753Smm    s = basename (xref_file); \
46228753Smm    t = strchr (s, '.'); \
47228753Smm    if (t) \
48228753Smm      strcpy (t, xref_ext); \
49228753Smm    else \
50228753Smm      strcat (xref_file, xref_ext); \
51228753Smm  } while (0)
52228753Smm
53228753Smm/* Change /dev/env/DJDIR/prefix/dir/ to canonical form so gcc_exec_prefix
54228753Smm   is set properly in 'gcc.c'. It also helps to cut down the number of times
55228753Smm   the value of the DJGPP environment variable 'DJDIR' is evaluated.  */
56228753Smm#undef GCC_DRIVER_HOST_INITIALIZATION
57228753Smm#define GCC_DRIVER_HOST_INITIALIZATION \
58228753Smm  do { \
59228753Smm    /* If the environment variable DJDIR is not defined, then DJGPP is not \
60228753Smm       installed correctly and GCC will quickly become confused with the \
61228753Smm       default prefix settings. Report the problem now so the user doesn't \
62228753Smm       receive deceptive "file not found" error messages later.  */ \
63228753Smm    char *djdir = getenv ("DJDIR"); \
64228753Smm    if (djdir == NULL) \
65228753Smm      { \
66228753Smm        /* DJDIR is automatically defined by the DJGPP environment config \
67228753Smm           file pointed to by the environment variable DJGPP. Examine DJGPP \
68228753Smm           to try and figure out what's wrong.  */ \
69228753Smm        char *djgpp = getenv ("DJGPP"); \
70228753Smm        if (djgpp == NULL) \
71228753Smm          fatal ("environment variable DJGPP not defined"); \
72228753Smm        else if (access (djgpp, R_OK) == 0) \
73228753Smm          fatal ("environment variable DJGPP points to missing file '%s'", \
74228753Smm                 djgpp); \
75228753Smm        else \
76228753Smm          fatal ("environment variable DJGPP points to corrupt file '%s'", \
77228753Smm                  djgpp); \
78228753Smm      } \
79231200Smm    standard_exec_prefix = update_path (standard_exec_prefix, NULL); \
80231200Smm    standard_bindir_prefix = update_path (standard_bindir_prefix, NULL); \
81231200Smm    standard_startfile_prefix = update_path (standard_startfile_prefix, NULL); \
82231200Smm  } while (0)
83231200Smm
84231200Smm/* Canonicalize paths containing '/dev/env/'; used in prefix.c.
85231200Smm   _fixpath is a djgpp-specific function to canonicalize a path.
86231200Smm   "/dev/env/DJDIR" evaluates to "c:/djgpp" if DJDIR is "c:/djgpp" for
87231200Smm   example.  It removes any trailing '/', so add it back.  */
88231200Smm/* We cannot free PATH below as it can point to string constant  */
89231200Smm#define UPDATE_PATH_HOST_CANONICALIZE(PATH) \
90231200Smm  if (memcmp ((PATH), "/dev/env/", sizeof("/dev/env/") - 1) == 0) \
91231200Smm    {						\
92231200Smm      static char fixed_path[FILENAME_MAX + 1];	\
93231200Smm						\
94231200Smm      _fixpath ((PATH), fixed_path);		\
95231200Smm      strcat (fixed_path, "/");			\
96231200Smm      (PATH) = xstrdup (fixed_path);		\
97231200Smm    }
98231200Smm