This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

DJGPP config patch [June edition]


Hi guys,
It's just about been a month since I last posted my DJGPP config changes, so I'm 
reposting again to account for the minor changes made in the mean time and to sync 
against the latest CVS.

Also, the following Libiberty patch is still pending:
http://gcc.gnu.org/ml/gcc-patches/2000-05/msg00769.html

gcc/Changelog:

2000-06-22 Mark Elbrecht <snowball3@bigfoot.com>

        * x-djgpp: Delete code that conditionally modifies target_alias.
          Delete code that conditionally modifies 'version'.
          Delete X_CPPFLAGS. Add comment for SYSTEM_HEADER_DIR.
        * config/i386/xm-djgpp.h (GCC_DRIVER_HOST_INITIALIZATION): New macro.
        * gcc.c (main): Use it.
        * config/i386/xm-djgpp.h (UPDATE_PATH_HOST_CANONICALIZE): New macro.
        * prefix.c (update_path): Use it.
        * config/i386/djgpp.h (STANDARD_INCLUDE_DIR): Define.
          (MD_EXEC_PREFIX): Set to '/dev/env/DJDIR/bin/'.

config/Changelog:

2000-06-22 Mark Elbrecht <snowball3@bigfoot.com>

        * mh-djgpp: Conditionally set 'target_alias' to djgpp. Conditionally
          modify 'gcc_version'.

Index: egcs/gcc/gcc.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/gcc.c,v
retrieving revision 1.148
diff -c -p -r1.148 gcc.c
*** gcc.c	2000/06/18 02:37:02	1.148
--- gcc.c	2000/06/22 19:38:41
*************** main (argc, argv)
*** 5151,5156 ****
--- 5151,5161 ----
      --p;
    programname = p;
  
+ #ifdef GCC_DRIVER_HOST_INITIALIZATION
+   /* Perform host dependant initialization when needed.  */
+   GCC_DRIVER_HOST_INITIALIZATION;
+ #endif
+ 
  #ifdef HAVE_LC_MESSAGES
    setlocale (LC_MESSAGES, "");
  #endif
Index: egcs/gcc/prefix.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/prefix.c,v
retrieving revision 1.24
diff -c -p -r1.24 prefix.c
*** prefix.c	2000/02/13 19:59:29	1.24
--- prefix.c	2000/06/22 19:38:50
*************** update_path (path, key)
*** 298,303 ****
--- 298,308 ----
  	path = translate_name (path);
      }
  
+ #ifdef UPDATE_PATH_HOST_CANONICALIZE
+ /* Perform host dependant canonicalization when needed.  */
+ UPDATE_PATH_HOST_CANONICALIZE (path, key);
+ #endif
+ 
  #ifdef DIR_SEPARATOR_2
    /* Convert DIR_SEPARATOR_2 to DIR_SEPARATOR. */
    if (DIR_SEPARATOR != DIR_SEPARATOR_2)
Index: egcs/config/mh-djgpp
===================================================================
RCS file: /cvs/gcc/egcs/config/mh-djgpp,v
retrieving revision 1.2
diff -c -p -r1.2 mh-djgpp
*** mh-djgpp	1999/09/04 15:08:48	1.2
--- mh-djgpp	2000/06/22 19:38:56
***************
*** 2,4 ****
--- 2,19 ----
  # this requires that we set CFLAGS.
  # This used to set -fno-omit-frame-pointer.
  CFLAGS=-O2
+ 
+ # Shorten the target alias so when it is used to set 'libsubdir'
+ # the name will work in both short and long filename environments.
+ ifeq ($(findstring -pc-msdosdjgpp,$(target_alias)),-pc-msdosdjgpp)
+ target_alias=djgpp
+ endif
+ 
+ # The version string must be modified to contain just one dot
+ # because DOS filenames can only have one dot when long filenames
+ # are not available.
+ __version:=$(gcc_version)
+ __version:=$(subst ., ,$(__version))
+ ifeq ($(words $(__version)),3)
+ gcc_version=$(word 1,$(__version)).$(word 2,$(__version))$(word 3,$(__version))
+ endif
Index: egcs/gcc/config/i386/xm-djgpp.h
===================================================================
RCS file: /cvs/gcc/egcs/gcc/config/i386/xm-djgpp.h,v
retrieving revision 1.7
diff -c -p -r1.7 xm-djgpp.h
*** xm-djgpp.h	2000/05/11 06:18:26	1.7
--- xm-djgpp.h	2000/06/22 19:39:04
*************** Boston, MA 02111-1307, USA.  */
*** 54,56 ****
--- 54,113 ----
        strcat (xref_file, xref_ext); \
    } while (0)
  
+ /* Change /dev/env/DJDIR/prefix/dir/ to canonical form so gcc_exec_prefix
+    is set properly in 'gcc.c'. It also helps to cut down the number of times
+    the value of the DJGPP environment variable 'DJDIR' is evaluated.  */
+ #undef GCC_DRIVER_HOST_INITIALIZATION
+ #define GCC_DRIVER_HOST_INITIALIZATION \
+   do { \
+     /* If the environment variable DJDIR is not defined, then DJGPP is not \
+        installed correctly and GCC will quickly become confused with the \
+        default prefix settings. Report the problem now so the user doesn't \
+        receive deceptive "file not found" error messages later.  */ \
+     char *djdir = getenv ("DJDIR"); \
+     if (djdir == NULL) \
+       { \
+         /* DJDIR is automatically defined by the DJGPP environment config \
+            file pointed to by the environment variable DJGPP. Examine DJGPP \
+            to try and figure out what's wrong.  */ \
+         char *djgpp = getenv ("DJGPP"); \
+         if (djgpp == NULL) \
+           fatal ("Environment variable DJGPP not defined."); \
+         else if (access (djgpp, R_OK) == 0) \
+           fatal ("Environment variable DJGPP points to missing file '%s'.", \
+                  djgpp); \
+         else \
+           fatal ("Environment variable DJGPP points to corrupt file '%s'.", \
+                   djgpp); \
+       } \
+     standard_exec_prefix = update_path (standard_exec_prefix, NULL); \
+     standard_bindir_prefix = update_path (standard_bindir_prefix, NULL); \
+     standard_startfile_prefix = update_path (standard_startfile_prefix, NULL); \
+     md_exec_prefix = update_path (md_exec_prefix, NULL); \
+   } while (0)
+ 
+ /* Canonicalize paths containing '/dev/env/', especially those in
+    prefix.c.  */
+ #define UPDATE_PATH_HOST_CANONICALIZE(PATH, KEY) \
+   do { \
+     if (strncmp (PATH, "/dev/env/", sizeof("/dev/env/") - 1) == 0) \
+       { \
+         static char *djdir; \
+         static int djdir_len; \
+         static char fixed_path[FILENAME_MAX + 1]; \
+         char *new_path; \
+         /* The default prefixes all use '/dev/env/DJDIR', so optimize \
+            for this. All other uses of '/dev/env/' go through \
+            libc's canonicalization function.  */ \
+         _fixpath (PATH, fixed_path); \
+         /* _fixpath removes any trailing '/', so add it back.  */ \
+         strcat (fixed_path, "/"); \
+         new_path = xstrdup (fixed_path); \
+         PATH = new_path; \
+         return PATH; \
+       } \
+     /* If DIR_SEPARATOR_2 isn't in PATH, nothing more need be done.  */ \
+     if (strchr (PATH, DIR_SEPARATOR_2) == NULL) \
+       return PATH; \
+   } while (0)
+ 
Index: egcs/gcc/config/i386/djgpp.h
===================================================================
RCS file: /cvs/gcc/egcs/gcc/config/i386/djgpp.h,v
retrieving revision 1.14
diff -c -p -r1.14 djgpp.h
*** djgpp.h	2000/05/01 16:50:49	1.14
--- djgpp.h	2000/06/22 19:39:19
*************** along with GNU CC; see the file COPYING.
*** 18,24 ****
  the Free Software Foundation, 59 Temple Place - Suite 330,
  Boston, MA 02111-1307, USA.  */
  
- 
  #include "dbxcoff.h"
  
  /* Don't assume anything about the header files. */
--- 18,23 ----
*************** Boston, MA 02111-1307, USA.  */
*** 76,83 ****
  #undef TEXT_SECTION_ASM_OP
  #define TEXT_SECTION_ASM_OP "\t.section .text"
  
  /* Search for as.exe and ld.exe in DJGPP's binary directory. */ 
! #define MD_EXEC_PREFIX "$DJDIR/bin/"
  
  /* Correctly handle absolute filename detection in cp/xref.c */
  #define FILE_NAME_ABSOLUTE_P(NAME) \
--- 75,86 ----
  #undef TEXT_SECTION_ASM_OP
  #define TEXT_SECTION_ASM_OP "\t.section .text"
  
+ /* Tell GCC where our standard include directory is.  */
+ #undef STANDARD_INCLUDE_DIR
+ #define STANDARD_INCLUDE_DIR "/dev/env/DJDIR/include/"
+ 
  /* Search for as.exe and ld.exe in DJGPP's binary directory. */ 
! #define MD_EXEC_PREFIX "/dev/env/DJDIR/bin/"
  
  /* Correctly handle absolute filename detection in cp/xref.c */
  #define FILE_NAME_ABSOLUTE_P(NAME) \
Index: egcs/gcc/config/i386/x-djgpp
===================================================================
RCS file: /cvs/gcc/egcs/gcc/config/i386/x-djgpp,v
retrieving revision 1.2
diff -c -p -r1.2 x-djgpp
*** x-djgpp	1999/09/04 15:08:57	1.2
--- x-djgpp	2000/06/22 19:39:27
***************
*** 1,24 ****
! # translate the version string, so it can be used on DJGPP, where only
! # one dot in filename is allowed
! 
! # to avoid recursion when redefining $(version)
! _version:=$(version)
! __version=$(subst ., ,$(_version))
! version=$(word 1,$(__version))$(word 2,$(__version)).$(word 3,$(__version))
! 
  SYSTEM_HEADER_DIR=$(DJDIR)/include
- X_CPPFLAGS=-DSTANDARD_INCLUDE_DIR=\"\$$DJDIR/include\" \
- 	   -DSTANDARD_INCLUDE_COMPONENT=\"\"
  
- # when building a native compiler for DJGPP, make the target_alias
- # a shorter name, since otherwise it will produce some problems, when
- # using the same gcc once with long filenames and once with short (8+3)
- # filenames
- ifeq ($(findstring -pc-msdosdjgpp,$(target_alias)),-pc-msdosdjgpp)
- target_alias=djgpp
- endif
- 
  # on DJGPP the 'ln -s' does not work correctly
  LN = cp -p
  LN_S = cp -p
  
--- 1,8 ----
! # Location of DJGPP's header directory.
  SYSTEM_HEADER_DIR=$(DJDIR)/include
  
  # on DJGPP the 'ln -s' does not work correctly
  LN = cp -p
  LN_S = cp -p
+ 
  


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]