delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2000/05/15/19:29:32

From: "Mark E." <snowball3 AT bigfoot DOT com>
To: djgpp-workers AT delorie DOT com
Date: Mon, 15 May 2000 19:05:20 -0400
MIME-Version: 1.0
Subject: Fw: DJGPP config changes part 2 of 2
Message-ID: <39204A70.12816.84C5F5@localhost>
X-mailer: Pegasus Mail for Win32 (v3.12c)
Reply-To: djgpp-workers AT delorie DOT com

This is part 2 of what I'm planning to send to the gcc maintains. Let me know 
of any problems you find.

--------------------------------------------

This is the one with the more ambitious set of changes. The biggest change is 
that it allows hosts to provide their own canonicalization routine to 
update_path in prefix.c. DJGPP then uses this to canonicalize 
'/dev/env/DJDIR/foo/bar/' to 'c:/djgpp/foo/bar/' (assuming DJDIR is set to 
c:/djgpp). Previously, one would use something like 'sh ./configure --
prefix=\$\{DJDIR}', but it's almost impossible for ${DJDIR} to survive 
without being evaluated.

gcc/Changelog:

2000-05-15 Mark Elbrecht <snowball3 AT bigfoot DOT com>

	* 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.
	  When DIR_SEPARATOR_2 is defined, don't convert DIR_SEPARATOR_2 to
	  DIR_SEPARATOR if the string doesn't contain DIR_SEPARATOR.
	  When DIR_SEPARATOR is defined and not equal to '/', don't convert
	  DIR_SEPARATOR to '/' if the string doesn't contain DIR_SEPARATOR.
	* config/i386/djgpp.h (STANDARD_INCLUDE_DIR): Define.
	  (MD_EXEC_PREFIX): Set to '/dev/env/DJDIR/bin/'.

Index: egcs/gcc/gcc.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/gcc.c,v
retrieving revision 1.143
diff -c -p -r1.143 gcc.c
*** gcc.c	2000/05/09 21:55:11	1.143
--- gcc.c	2000/05/15 21:57:20
*************** main (argc, argv)
*** 5145,5150 ****
--- 5145,5155 ----
      --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/05/15 21:57:39
*************** update_path (path, key)
*** 298,325 ****
  	path = translate_name (path);
      }
  
  #ifdef DIR_SEPARATOR_2
    /* Convert DIR_SEPARATOR_2 to DIR_SEPARATOR. */
    if (DIR_SEPARATOR != DIR_SEPARATOR_2)
      {
!       char *new_path = xstrdup (path);
!       path = new_path;
!       do {
! 	if (*new_path == DIR_SEPARATOR_2)
! 	  *new_path = DIR_SEPARATOR;
!       } while (*new_path++);
      }
  #endif
        
  #if defined (DIR_SEPARATOR) && !defined (DIR_SEPARATOR_2)
    if (DIR_SEPARATOR != '/')
      {
!       char *new_path = xstrdup (path);
!       path = new_path;
!       do {
! 	if (*new_path == '/')
! 	  *new_path = DIR_SEPARATOR;
!       } while (*new_path++);
      }
  #endif
  
--- 298,348 ----
  	path = translate_name (path);
      }
  
+ #ifdef UPDATE_PATH_HOST_CANONICALIZE
+ /* Perform host dependant canonicalization when needed.  */
+ UPDATE_PATH_HOST_CANONICALIZE;
+ #endif
+   
  #ifdef DIR_SEPARATOR_2
    /* Convert DIR_SEPARATOR_2 to DIR_SEPARATOR. */
    if (DIR_SEPARATOR != DIR_SEPARATOR_2)
      {
!       /* No need to fix path if it does not contain DIR_SEPARATOR_2.  */
!       char *sep = strchr (path, DIR_SEPARATOR_2);
!       if (sep)
!         {
!           char *new_path = xstrdup (path);
!           int start = (sep - path);
! 
!           path = new_path;
!           /* Start at first match.  */
!           new_path += start;
!           do {
!             if (*new_path == DIR_SEPARATOR_2)
!               *new_path = DIR_SEPARATOR;
!           } while (*new_path++);
!         }
      }
  #endif
        
  #if defined (DIR_SEPARATOR) && !defined (DIR_SEPARATOR_2)
    if (DIR_SEPARATOR != '/')
      {
!       /* No need to fix path if it does not contain DIR_SEPARATOR.  */
!       char *sep = strchr (path, DIR_SEPARATOR);
!       if (sep)
!         {
!           char *new_path = xstrdup (path);
!           int start = (sep - path);
! 
!           path = new_path;
!           /* Start at first match.  */
!           new_path += start;
!           do {
!             if (*new_path == '/')
!               *new_path = DIR_SEPARATOR;
!           } while (*new_path++);
!         }
      }
  #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/05/15 21:57:59
*************** Boston, MA 02111-1307, USA.  */
*** 54,56 ****
--- 54,103 ----
        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 { \
+     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 \
+   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.  */ \
+         if (strncmp (path + 9, "DJDIR/", sizeof ("DJDIR/") - 1) == 0) \
+           { \
+             if (djdir == NULL) \
+             { \
+               djdir = getenv ("DJDIR"); \
+               djdir_len = strlen (djdir); \
+             } \
+             memcpy (fixed_path, djdir, djdir_len); \
+             strcpy (fixed_path + djdir_len, path + 14); \
+           } \
+         else \
+           { \
+             _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; \
+       } \
+   } 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/05/15 21:58:11
*************** 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) \


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019