delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2003/01/05/09:21:46

Date: Sun, 05 Jan 2003 13:31:50 +0000
From: "Richard Dawe" <rich AT phekda DOT freeserve DOT co DOT uk>
Sender: rich AT phekda DOT freeserve DOT co DOT uk
To: djgpp-workers AT delorie DOT com
X-Mailer: Emacs 21.3.50 (via feedmail 8.3.emacs20_6 I) and Blat ver 1.8.6
Subject: m4 port: return program name as 'm4' not '/some/path/m4.exe' [PATCH]
Message-Id: <E18VAre-0000gx-00@phekda.freeserve.co.uk>
Reply-To: djgpp-workers AT delorie DOT com

Hello.

Below is a patch that makes m4 call itself 'm4' rather
than e.g.: /dev/env/DJDIR/bin/m4.exe. (All the fileutils do
a similar thing.)

autoconf 2.57's test suite relies on m4 calling itself 'm4'. Admittedly
this is not a very good reason for changing the program, but we've done
a similar thing for fileutils, so why not m4?

(Note that it's on my to-do list to add a crt0 flag for shortening
the program name. We talked about this, when I made a change for fileutils.)

The patch also uses /dev/env/DJDIR as the prefix and enables changeword
support. autoconf requires m4 to have changeword support, so it doesn't
make sense for it to be disabled by default.

Are there any objections to me updating the m4 packages with this patch?

Thanks, bye, Rich =]

--- gnu/m4-1.4/src/m4.c~0	2003-01-03 14:23:02.000000000 +0000
+++ gnu/m4-1.4/src/m4.c	2003-01-03 14:29:02.000000000 +0000
@@ -261,7 +261,28 @@ main (int argc, char *const *argv, char 
   macro_definition *defines;
   FILE *fp;
 
+#ifdef __DJGPP__
+  /* <rich AT phekda DOT freeserve DOT co DOT uk>: Eat any path information
+   * and extension. */
+  {
+    char *p, *my_program_name;
+
+    p = strrchr(argv[0], '/');
+    if (p == NULL)
+      p = argv[0];
+    else
+      p++;
+
+    my_program_name = strdup(p);
+    p = strrchr(my_program_name, '.');
+    if (p != NULL)
+      *p = '\0';
+
+    program_name = my_program_name;
+  }
+#else
   program_name = argv[0];
+#endif /* __DJGPP__ */
 
   include_init ();
   debug_init ();
--- gnu/m4-1.4/djgpp/config.bat~0	2003-01-05 13:26:46.000000000 +0000
+++ gnu/m4-1.4/djgpp/config.bat	2003-01-03 14:33:36.000000000 +0000
@@ -40,7 +40,7 @@ if not exist configure.orig cp -p %XSRC%
 update %XSRC%/djgpp/configure ./configure
 set CFLAGS=-O2 -g
 set INSTALL=${DJDIR}/bin/ginstall
-sh ./configure --prefix='${DJDIR}'
+sh ./configure --prefix=/dev/env/DJDIR --enable-changeword
 set CFLAGS=
 set INSTALL=
 set CONFIG_HEADERS=

- Raw text -


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