1132718Skan/* Configuration for GCC for Intel 80386 running DJGPP.
2169689Skan   Copyright (C) 1988, 1996, 1998, 1999, 2000, 2001, 2004
3169689Skan   Free Software Foundation, Inc.
452284Sobrien
5132718SkanThis file is part of GCC.
652284Sobrien
7132718SkanGCC is free software; you can redistribute it and/or modify
852284Sobrienit under the terms of the GNU General Public License as published by
952284Sobrienthe Free Software Foundation; either version 2, or (at your option)
1052284Sobrienany later version.
1152284Sobrien
12132718SkanGCC is distributed in the hope that it will be useful,
1352284Sobrienbut WITHOUT ANY WARRANTY; without even the implied warranty of
1452284SobrienMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1552284SobrienGNU General Public License for more details.
1652284Sobrien
1752284SobrienYou should have received a copy of the GNU General Public License
18132718Skanalong with GCC; see the file COPYING.  If not, write to
19169689Skanthe Free Software Foundation, 51 Franklin Street, Fifth Floor,
20169689SkanBoston, MA 02110-1301, USA.  */
2152284Sobrien
2252284Sobrien/* Use semicolons to separate elements of a path.  */
2352284Sobrien#define PATH_SEPARATOR ';'
2452284Sobrien
2590075Sobrien#define HOST_EXECUTABLE_SUFFIX ".exe"
2652284Sobrien
2790075Sobrien/* System dependent initialization for collect2
2852284Sobrien   to tell system() to act like Unix.  */
2952284Sobrien#define COLLECT2_HOST_INITIALIZATION \
3052284Sobrien  do { __system_flags |= (__system_allow_multiple_cmds			\
3152284Sobrien		          | __system_emulate_chdir); } while (0)
3252284Sobrien
3390075Sobrien/* Define a version appropriate for DOS.  */
3490075Sobrien#undef XREF_FILE_NAME
3590075Sobrien#define XREF_FILE_NAME(xref_file, file) \
3690075Sobrien  do { \
3790075Sobrien    const char xref_ext[] = ".gxref"; \
3890075Sobrien    strcpy (xref_file, file); \
3990075Sobrien    s = basename (xref_file); \
4090075Sobrien    t = strchr (s, '.'); \
4190075Sobrien    if (t) \
4290075Sobrien      strcpy (t, xref_ext); \
4390075Sobrien    else \
4490075Sobrien      strcat (xref_file, xref_ext); \
4590075Sobrien  } while (0)
4690075Sobrien
4790075Sobrien#undef GCC_DRIVER_HOST_INITIALIZATION
4890075Sobrien#define GCC_DRIVER_HOST_INITIALIZATION \
4990075Sobrien  do { \
5090075Sobrien    /* If the environment variable DJDIR is not defined, then DJGPP is not \
5190075Sobrien       installed correctly and GCC will quickly become confused with the \
5290075Sobrien       default prefix settings. Report the problem now so the user doesn't \
5390075Sobrien       receive deceptive "file not found" error messages later.  */ \
5490075Sobrien    char *djdir = getenv ("DJDIR"); \
5590075Sobrien    if (djdir == NULL) \
5690075Sobrien      { \
5790075Sobrien        /* DJDIR is automatically defined by the DJGPP environment config \
5890075Sobrien           file pointed to by the environment variable DJGPP. Examine DJGPP \
5990075Sobrien           to try and figure out what's wrong.  */ \
6090075Sobrien        char *djgpp = getenv ("DJGPP"); \
6190075Sobrien        if (djgpp == NULL) \
6290075Sobrien          fatal ("environment variable DJGPP not defined"); \
6390075Sobrien        else if (access (djgpp, R_OK) == 0) \
6490075Sobrien          fatal ("environment variable DJGPP points to missing file '%s'", \
6590075Sobrien                 djgpp); \
6690075Sobrien        else \
6790075Sobrien          fatal ("environment variable DJGPP points to corrupt file '%s'", \
6890075Sobrien                  djgpp); \
6990075Sobrien      } \
7090075Sobrien  } while (0)
7190075Sobrien
7290075Sobrien/* Canonicalize paths containing '/dev/env/'; used in prefix.c.
7390075Sobrien   _fixpath is a djgpp-specific function to canonicalize a path.
7490075Sobrien   "/dev/env/DJDIR" evaluates to "c:/djgpp" if DJDIR is "c:/djgpp" for
7590075Sobrien   example.  It removes any trailing '/', so add it back.  */
7690075Sobrien/* We cannot free PATH below as it can point to string constant  */
7790075Sobrien#define UPDATE_PATH_HOST_CANONICALIZE(PATH) \
7890075Sobrien  if (memcmp ((PATH), "/dev/env/", sizeof("/dev/env/") - 1) == 0) \
7990075Sobrien    {						\
8090075Sobrien      static char fixed_path[FILENAME_MAX + 1];	\
8190075Sobrien						\
8290075Sobrien      _fixpath ((PATH), fixed_path);		\
8390075Sobrien      strcat (fixed_path, "/");			\
8490075Sobrien      (PATH) = xstrdup (fixed_path);		\
8590075Sobrien    }
86