openbsd-ports/devel/bison/patches/patch-src_output_c
espie 982bd4d9e4 retweak the evil bison hack to use our m4.
decide anything called "m4" is ours, so that gcc,-java builds consistently
again.
2012-04-14 12:22:25 +00:00

51 lines
1.4 KiB
Plaintext

$OpenBSD: patch-src_output_c,v 1.5 2012/04/14 12:22:25 espie Exp $
--- src/output.c.orig Sun May 14 22:40:35 2006
+++ src/output.c Fri Apr 13 20:38:39 2012
@@ -501,7 +501,8 @@ output_skeleton (void)
FILE *in;
FILE *out;
int filter_fd[2];
- char const *argv[6];
+ char const *argv[7];
+ int i;
pid_t pid;
/* Compute the names of the package data dir and skeleton file.
@@ -512,7 +513,7 @@ output_skeleton (void)
char *full_m4sugar;
char *full_skeleton;
char const *p;
- char const *m4 = (p = getenv ("M4")) ? p : M4;
+ char const *m4 = (p = getenv ("M4")) ? p : "/usr/bin/m4";
char const *pkgdatadir = (p = getenv ("BISON_PKGDATADIR")) ? p : PKGDATADIR;
size_t skeleton_size = strlen (skeleton) + 1;
size_t pkgdatadirlen = strlen (pkgdatadir);
@@ -534,12 +535,21 @@ output_skeleton (void)
fprintf (stderr, "running: %s %s - %s\n",
m4, full_m4sugar, full_skeleton);
- argv[0] = m4;
- argv[1] = full_m4sugar;
- argv[2] = "-";
- argv[3] = full_skeleton;
- argv[4] = trace_flag & trace_m4 ? "-dV" : NULL;
- argv[5] = NULL;
+ i = 0;
+ argv[i++] = m4;
+ p = strrchr(m4, '/');
+ if (p)
+ p++;
+ else
+ p = m4;
+ if (strcmp(p, "m4") == 0) {
+ argv[i++] = "-g";
+ }
+ argv[i++] = full_m4sugar;
+ argv[i++] = "-";
+ argv[i++] = full_skeleton;
+ argv[i++] = trace_flag & trace_m4 ? "-dV" : NULL;
+ argv[i++] = NULL;
init_subpipe ();
pid = create_subpipe (argv, filter_fd);