annotate lib-src/ellcc.c @ 424:11054d720c21 r21-2-20

Import from CVS: tag r21-2-20
author cvs
date Mon, 13 Aug 2007 11:26:11 +0200
parents 697ef44129c6
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
388
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
1 /* ellcc.c - front-end for compiling Emacs modules
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
2 Copyright (C) 1998, 1999 J. Kean Johnston.
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
3
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
4 This file is part of XEmacs.
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
5
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
6 XEmacs is free software; you can redistribute it and/or modify it
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
7 under the terms of the GNU General Public License as published by the
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
8 Free Software Foundation; either version 2, or (at your option) any
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
9 later version.
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
10
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
11 XEmacs is distributed in the hope that it will be useful, but WITHOUT
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
12 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
14 for more details.
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
15
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
16 You should have received a copy of the GNU General Public License
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
17 along with XEmacs; see the file COPYING. If not, write to
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
19 Boston, MA 02111-1307, USA.
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
20
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
21 Author: J. Kean Johnston (jkj@sco.com).
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
22 Please mail bugs and suggestions to the XEmacs maintainer.
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
23 */
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
24
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
25 /*
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
26 Here's the scoop. We would really like this to be a shell script, but
424
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 412
diff changeset
27 the various Windows platforms don't have reliable scripting that suits
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 412
diff changeset
28 our needs. We don't want to rely on perl or some other such language
388
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
29 so we have to roll our own executable to act as a front-end for the
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
30 compiler.
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
31
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
32 This program is used to invoke the compiler, the linker and to generate
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
33 the module specific documentation and initialization code. We assume we
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
34 are in 'compile' mode unless we encounter an argument which tells us
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
35 that we're not. We take all arguments and pass them on directly to the
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
36 compiler, except for a few which are specific to this program:
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
37
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
38 --mode=VALUE This sets the program mode. VALUE can be one of
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
39 compile, link, init or verbose.
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
40 --mod-name=NAME Sets the module name to the string NAME.
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
41 --mod-title=TITLE Sets the module title to the string TITLE.
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
42 --mod-version=VER Sets the module version to the string VER.
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
43
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
44 The idea is that Makefiles will use ellcc as the compiler for making
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
45 dynamic Emacs modules, and life should be as simple as:
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
46
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
47 make CC=ellcc LD='ellcc --mode=link'
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
48
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
49 The only additional requirement is an entry in the Makefile to produce
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
50 the module initialization file, which will usually be something along
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
51 the lines of:
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
52
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
53 modinit.c: $(SRCS)
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
54 ellcc --mode=init --mod-name=\"$(MODNAME)\" \
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
55 --mod-title=\"$(MODTITLE)\" --mod-version=\"$(MODVERSION)\" \
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
56 -o $@ $(SRCS)
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
57
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
58 See the samples for more details.
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
59 */
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
60
424
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 412
diff changeset
61 #include <../src/config.h>
388
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
62 #include <stdio.h>
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
63 #include <stdlib.h>
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
64 #include <string.h>
424
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 412
diff changeset
65 #include <ctype.h>
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 412
diff changeset
66 #include <errno.h>
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 412
diff changeset
67 #include <sys/types.h>
388
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
68
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
69 #ifdef HAVE_UNISTD_H
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
70 # include <unistd.h>
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
71 #endif /* HAVE_UNISTD_H */
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
72
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
73 #define EMODULES_GATHER_VERSION
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
74 #include "emodules.h"
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
75 #include "ellcc.h"
388
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
76
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
77 #define DEBUG
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
78
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
79 #ifndef HAVE_SHLIB
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
80 int
424
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 412
diff changeset
81 main (int argc, char *argv[])
388
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
82 {
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
83 fprintf (stderr, "Dynamic modules not supported on this platform\n");
424
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 412
diff changeset
84 return EXIT_FAILURE;
388
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
85 }
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
86 #else
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
87
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
88 /*
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
89 * Try to figure out the commands we need to use to create shared objects,
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
90 * and how to compile for PIC mode.
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
91 */
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
92
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
93 /*
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
94 * xnew, xrnew -- allocate, reallocate storage
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
95 *
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
96 * SYNOPSIS: Type *xnew (int n, Type);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
97 * Type *xrnew (OldPointer, int n, Type);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
98 */
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
99 #ifdef chkmalloc
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
100 # include "chkmalloc.h"
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
101 # define xnew(n,Type) ((Type *) trace_malloc (__FILE__, __LINE__, \
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
102 (n) * sizeof (Type)))
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
103 # define xrnew(op,n,Type) ((Type *) trace_realloc (__FILE__, __LINE__, \
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
104 (op), (n) * sizeof (Type)))
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
105 #else
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
106 # define xnew(n,Type) ((Type *) xmalloc ((n) * sizeof (Type)))
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
107 # define xrnew(op,n,Type) ((Type *) xrealloc ((op), (n) * sizeof (Type)))
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
108 #endif
424
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 412
diff changeset
109 static void *xmalloc (size_t);
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 412
diff changeset
110 static void fatal (char *, char *);
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 412
diff changeset
111 static void add_to_argv (CONST char *);
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 412
diff changeset
112 static void do_compile_mode (void);
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 412
diff changeset
113 static void do_link_mode (void);
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 412
diff changeset
114 static void do_init_mode (void);
388
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
115
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
116 #define SSTR(S) ((S)?(S):"")
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
117
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
118 #define ELLCC_COMPILE_MODE 0
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
119 #define ELLCC_LINK_MODE 1
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
120 #define ELLCC_INIT_MODE 2
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
121
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
122 int ellcc_mode = ELLCC_COMPILE_MODE;
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
123 char *progname;
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
124 char *mod_name = (char *)0, *mod_version = (char *)0, *mod_title = (char *)0;
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
125 char *mod_output = (char *)0;
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
126 int verbose = 0;
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
127 char **exec_argv;
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
128 int exec_argc = 1, *exec_args;
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
129 int real_argc = 0;
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
130 int prog_argc;
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
131 char **prog_argv;
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
132
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
133 /*
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
134 * We allow the user to over-ride things in the environment
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
135 */
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
136 char *ellcc, *ellld, *ellcflags, *ellldflags, *ellpicflags, *elldllflags;
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
137 #define OVERENV(STR,EVAR,DFLT) \
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
138 STR = getenv(EVAR); \
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
139 if ((STR) == (char *)0) \
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
140 STR = DFLT
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
141
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
142 int
424
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 412
diff changeset
143 main (int argc, char *argv[])
388
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
144 {
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
145 char *tmp;
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
146 int i, done_mode = 0;
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
147
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
148 prog_argc = argc;
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
149 prog_argv = argv;
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
150
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
151 #if defined(MSDOS) || defined(WINDOWSNT)
424
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 412
diff changeset
152 tmp = strrchr (argv[0], '\\');
388
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
153 if (tmp != (char *)0)
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
154 tmp++;
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
155 #elif !defined (VMS)
424
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 412
diff changeset
156 tmp = strrchr (argv[0], '/');
388
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
157 if (tmp != (char *)0)
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
158 tmp++;
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
159 #else
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
160 tmp = argv[0];
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
161 #endif
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
162
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
163 if (tmp != (char *)0)
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
164 progname = tmp;
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
165 else
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
166 progname = argv[0];
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
167
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
168 tmp = &progname[strlen(progname)-2];
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
169 if (strcmp (tmp, "cc") == 0)
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
170 ellcc_mode = ELLCC_COMPILE_MODE;
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
171 else if (strcmp (tmp, "ld") == 0)
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
172 ellcc_mode = ELLCC_LINK_MODE;
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
173 else if (strcmp (tmp, "it") == 0)
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
174 ellcc_mode = ELLCC_INIT_MODE;
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
175
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
176 exec_argv = xnew(argc + 20, char *);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
177 exec_args = xnew(argc, int);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
178 for (i = 0; i < argc; i++)
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
179 exec_args[i] = -1;
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
180
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
181 if (argc < 2)
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
182 fatal ("too few arguments", (char *)0);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
183
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
184 exec_args[0] = 0;
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
185
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
186 for (i = 1; i < argc; i++)
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
187 {
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
188 if (strncmp (argv[i], "--mode=", 7) == 0)
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
189 {
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
190 char *modeopt = argv[i] + 7;
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
191
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
192 if (done_mode && strcmp (modeopt, "verbose"))
424
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 412
diff changeset
193 fatal ("more than one mode specified", (char *) 0);
388
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
194 if (strcmp (modeopt, "link") == 0)
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
195 {
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
196 done_mode++;
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
197 ellcc_mode = ELLCC_LINK_MODE;
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
198 }
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
199 else if (strcmp (modeopt, "compile") == 0)
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
200 {
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
201 done_mode++;
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
202 ellcc_mode = ELLCC_COMPILE_MODE;
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
203 }
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
204 else if (strcmp (modeopt, "init") == 0)
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
205 {
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
206 done_mode++;
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
207 ellcc_mode = ELLCC_INIT_MODE;
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
208 }
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
209 else if (strcmp (modeopt, "verbose") == 0)
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
210 verbose += 1;
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
211 }
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
212 else if (strcmp (argv[i], "--mod-location") == 0)
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
213 {
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
214 printf ("%s\n", ELLCC_MODDIR);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
215 return 0;
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
216 }
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
217 else if (strcmp (argv[i], "--mod-site-location") == 0)
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
218 {
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
219 printf ("%s\n", ELLCC_SITEMODS);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
220 return 0;
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
221 }
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
222 else if (strcmp (argv[i], "--mod-archdir") == 0)
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
223 {
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
224 printf ("%s\n", ELLCC_ARCHDIR);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
225 return 0;
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
226 }
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
227 else if (strcmp (argv[i], "--mod-config") == 0)
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
228 {
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
229 printf ("%s\n", ELLCC_CONFIG);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
230 return 0;
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
231 }
424
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 412
diff changeset
232 else if (strncmp (argv[i], "--mod-name=", 11) == 0)
388
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
233 mod_name = argv[i] + 11;
424
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 412
diff changeset
234 else if (strncmp (argv[i], "--mod-title=", 12) == 0)
388
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
235 mod_title = argv[i] + 12;
424
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 412
diff changeset
236 else if (strncmp (argv[i], "--mod-version=", 14) == 0)
388
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
237 mod_version = argv[i] + 14;
424
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 412
diff changeset
238 else if (strncmp (argv[i], "--mod-output=", 13) == 0)
388
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
239 mod_output = argv[i] + 13;
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
240 else
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
241 {
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
242 exec_args[exec_argc] = i;
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
243 exec_argc++;
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
244 }
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
245 }
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
246
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
247 if (ellcc_mode == ELLCC_LINK_MODE && mod_output == (char *)0)
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
248 fatal ("must specify --mod-output when linking", (char *)0);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
249 if (ellcc_mode == ELLCC_INIT_MODE && mod_output == (char *)0)
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
250 fatal ("must specify --mod-output when creating init file", (char *)0);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
251 if (ellcc_mode == ELLCC_INIT_MODE && mod_name == (char *)0)
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
252 fatal ("must specify --mod-name when creating init file", (char *)0);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
253
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
254 /*
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
255 * We now have the list of arguments to pass to the compiler or
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
256 * linker (or to process for doc files). We can do the real work
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
257 * now.
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
258 */
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
259 if (verbose)
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
260 printf ("ellcc driver version %s for EMODULES version %s (%ld)\n",
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
261 ELLCC_EMACS_VER, EMODULES_VERSION, EMODULES_REVISION);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
262 #ifdef DEBUG
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
263 if (verbose >= 2)
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
264 {
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
265 printf (" mode = %d (%s)\n", ellcc_mode,
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
266 ellcc_mode == ELLCC_COMPILE_MODE ? "compile" :
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
267 ellcc_mode == ELLCC_LINK_MODE ? "link" : "init");
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
268 printf (" module_name = \"%s\"\n", SSTR(mod_name));
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
269 printf (" module_title = \"%s\"\n", SSTR(mod_title));
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
270 printf (" module_version = \"%s\"\n", SSTR(mod_version));
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
271
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
272 printf (" CC = %s\n", ELLCC_CC);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
273 printf (" CFLAGS = %s\n", ELLCC_CFLAGS);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
274 printf (" CC PIC flags = %s\n", ELLCC_DLL_CFLAGS);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
275 printf (" LD = %s\n", ELLCC_DLL_LD);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
276 printf (" LDFLAGS = %s\n", ELLCC_DLL_LDFLAGS);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
277 printf (" architecture = %s\n", ELLCC_CONFIG);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
278 printf (" Include directory = %s/include\n", ELLCC_ARCHDIR);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
279 printf ("\n");
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
280 }
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
281 #endif
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
282
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
283 if (exec_argc < 2)
424
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 412
diff changeset
284 fatal ("too few arguments", (char *) 0);
388
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
285
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
286 /*
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
287 * Get the over-rides from the environment
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
288 */
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
289 OVERENV(ellcc, "ELLCC", ELLCC_CC);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
290 OVERENV(ellld, "ELLLD", ELLCC_DLL_LD);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
291 OVERENV(ellcflags, "ELLCFLAGS", ELLCC_CFLAGS);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
292 OVERENV(ellldflags, "ELLLDFLAGS", ELLCC_LDFLAGS);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
293 OVERENV(elldllflags, "ELLDLLFLAGS", ELLCC_DLL_LDFLAGS);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
294 OVERENV(ellpicflags, "ELLPICFLAGS", ELLCC_DLL_CFLAGS);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
295
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
296 if (ellcc_mode == ELLCC_COMPILE_MODE)
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
297 do_compile_mode();
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
298 else if (ellcc_mode == ELLCC_LINK_MODE)
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
299 do_link_mode();
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
300 else
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
301 do_init_mode();
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
302
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
303 /*
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
304 * The arguments to pass on to the desired program have now been set
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
305 * up and we can run the program.
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
306 */
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
307 if (verbose)
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
308 {
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
309 for (i = 0; i < real_argc; i++)
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
310 printf ("%s ", exec_argv[i]);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
311 printf ("\n");
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
312 fflush (stdout);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
313 }
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
314 exec_argv[real_argc] = (char *)0; /* Terminate argument list */
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
315
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
316 i = execvp (exec_argv[0], exec_argv);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
317 if (verbose)
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
318 printf ("%s exited with status %d\n", exec_argv[0], i);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
319 return i;
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
320 }
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
321
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
322 /* Like malloc but get fatal error if memory is exhausted. */
424
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 412
diff changeset
323 static void *
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 412
diff changeset
324 xmalloc (size_t size)
388
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
325 {
424
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 412
diff changeset
326 void *result = malloc (size);
388
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
327 if (result == NULL)
424
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 412
diff changeset
328 fatal ("virtual memory exhausted", (char *)0);
388
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
329 return result;
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
330 }
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
331
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
332 /* Print error message and exit. */
424
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 412
diff changeset
333 static void
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 412
diff changeset
334 fatal (char *s1, char *s2)
388
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
335 {
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
336 fprintf (stderr, "%s: ", progname);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
337 fprintf (stderr, s1, s2);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
338 fprintf (stderr, "\n");
424
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 412
diff changeset
339 exit (EXIT_FAILURE);
388
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
340 }
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
341
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
342 /*
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
343 * Add a string to the argument vector list that will be passed on down
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
344 * to the compiler or linker. We need to split individual words into
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
345 * arguments, taking quoting into account. This can get ugly.
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
346 */
424
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 412
diff changeset
347 static void
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 412
diff changeset
348 add_to_argv (CONST char *str)
388
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
349 {
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
350 int sm = 0;
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
351 CONST char *s = (CONST char *)0;
388
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
352
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
353 if ((str == (CONST char *)0) || (str[0] == '\0'))
388
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
354 return;
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
355
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
356 while (*str)
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
357 {
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
358 switch (sm)
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
359 {
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
360 case 0: /* Start of case - string leading whitespace */
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
361 if (isspace (*str))
388
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
362 str++;
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
363 else
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
364 {
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
365 sm = 1; /* Change state to non-whitespace */
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
366 s = str; /* Mark the start of THIS argument */
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
367 }
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
368 break;
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
369
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
370 case 1: /* Non-whitespace character. Mark the start */
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
371 if (isspace (*str))
388
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
372 {
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
373 /* Reached the end of the argument. Add it. */
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
374 int l = str-s;
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
375 exec_argv[real_argc] = xnew (l+2, char);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
376 strncpy (exec_argv[real_argc], s, l);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
377 exec_argv[real_argc][l] = '\0';
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
378 real_argc++;
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
379 sm = 0; /* Back to start state */
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
380 s = (CONST char *)0;
388
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
381 break;
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
382 }
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
383 else if (*str == '\\')
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
384 {
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
385 sm = 2; /* Escaped character */
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
386 str++;
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
387 break;
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
388 }
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
389 else if (*str == '\'')
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
390 {
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
391 /* Start of quoted string (single quotes) */
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
392 sm = 3;
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
393 }
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
394 else if (*str == '"')
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
395 {
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
396 /* Start of quoted string (double quotes) */
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
397 sm = 4;
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
398 }
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
399 else
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
400 {
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
401 /* This was just a normal character. Advance the pointer. */
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
402 str++;
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
403 }
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
404 break;
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
405
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
406 case 2: /* Escaped character */
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
407 str++; /* Preserve the quoted character */
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
408 sm = 1; /* Go back to gathering state */
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
409 break;
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
410
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
411 case 3: /* Inside single quoted string */
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
412 if (*str == '\'')
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
413 sm = 1;
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
414 str++;
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
415 break;
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
416
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
417 case 4: /* inside double quoted string */
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
418 if (*str == '"')
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
419 sm = 1;
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
420 str++;
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
421 break;
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
422 }
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
423 }
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
424
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
425 if (s != (CONST char *)0)
388
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
426 {
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
427 int l = str-s;
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
428 exec_argv[real_argc] = xnew (l+2, char);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
429 strncpy (exec_argv[real_argc], s, l);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
430 exec_argv[real_argc][l] = '\0';
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
431 real_argc++;
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 410
diff changeset
432 s = (CONST char *)0;
388
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
433 }
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
434 }
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
435
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
436 /*
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
437 * For compile mode, things are pretty straight forward. All we need to do
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
438 * is build up the argument vector and exec() it. We must just make sure
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
439 * that we get all of the required arguments in place.
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
440 */
424
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 412
diff changeset
441 static void
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 412
diff changeset
442 do_compile_mode (void)
388
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
443 {
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
444 int i;
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
445 char ts[4096]; /* Plenty big enough */
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
446
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
447 add_to_argv (ellcc);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
448 add_to_argv (ellcflags);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
449 add_to_argv (ellpicflags);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
450 add_to_argv ("-DPIC");
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
451 add_to_argv ("-DEMACS_MODULE");
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
452 #ifdef XEMACS
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
453 add_to_argv ("-DXEMACS_MODULE"); /* Cover both cases */
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
454 add_to_argv ("-Dxemacs");
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
455 #endif
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
456 add_to_argv ("-Demacs");
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
457 sprintf (ts, "-I%s/include", ELLCC_ARCHDIR);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
458 add_to_argv (ts);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
459 add_to_argv (ELLCC_CF_ALL);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
460 for (i = 1; i < exec_argc; i++)
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
461 exec_argv[real_argc++] = strdup (prog_argv[exec_args[i]]);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
462 }
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
463
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
464 /*
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
465 * For link mode, things are a little bit more complicated. We need to
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
466 * insert the linker commands first, replace any occurrence of ELLSONAME
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
467 * with the desired output file name, insert the output arguments, then
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
468 * all of the provided arguments, then the final post arguments. Once
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
469 * all of this has been done, the argument vector is ready to run.
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
470 */
424
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 412
diff changeset
471 static void
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 412
diff changeset
472 do_link_mode (void)
388
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
473 {
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
474 int i,x;
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
475 char *t, ts[4096]; /* Plenty big enough */
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
476
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
477 add_to_argv (ellld);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
478 add_to_argv (ellldflags);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
479 add_to_argv (elldllflags);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
480 add_to_argv (ELLCC_DLL_LDO);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
481 add_to_argv (mod_output);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
482 for (i = 1; i < exec_argc; i++)
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
483 exec_argv[real_argc++] = strdup (prog_argv[exec_args[i]]);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
484 add_to_argv (ELLCC_DLL_POST);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
485
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
486 /*
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
487 * Now go through each argument and replace ELLSONAME with mod_output.
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
488 */
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
489 for (i = 0; i < real_argc; i++)
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
490 {
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
491 x = 0;
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
492 ts[0] = '\0';
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
493
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
494 t = exec_argv[i];
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
495 while (*t)
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
496 {
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
497 if (*t == 'E')
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
498 {
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
499 if (strncmp (t, "ELLSONAME", 9) == 0)
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
500 {
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
501 strcat (ts, mod_output);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
502 t += 8;
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
503 x += strlen (mod_output);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
504 }
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
505 else
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
506 {
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
507 ts[x] = *t;
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
508 x++;
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
509 ts[x] = '\0';
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
510 }
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
511 }
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
512 else
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
513 {
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
514 ts[x] = *t;
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
515 x++;
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
516 ts[x] = '\0';
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
517 }
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
518 t++;
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
519 }
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
520 free (exec_argv[i]);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
521 exec_argv[i] = strdup (ts);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
522 }
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
523 }
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
524
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
525 /*
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
526 * In init mode, things are a bit easier. We assume that the only things
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
527 * passed on the command line are the names of source files which the
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
528 * make-doc program will be processing. We prepare the output file with
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
529 * the header information first, as make-doc will append to the file by
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
530 * special dispensation.
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
531 */
424
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 412
diff changeset
532 static void
11054d720c21 Import from CVS: tag r21-2-20
cvs
parents: 412
diff changeset
533 do_init_mode (void)
388
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
534 {
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
535 int i;
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
536 char ts[4096]; /* Plenty big enough */
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
537 char *mdocprog;
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
538 FILE *mout = fopen (mod_output, "w");
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
539
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
540 if (mout == (FILE *)0)
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
541 fatal ("failed to open output file", mod_output);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
542 fprintf (mout, "/* DO NOT EDIT - AUTOMATICALLY GENERATED */\n\n");
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
543 fprintf (mout, "#include <emodules.h>\n\n");
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
544 fprintf (mout, "const long emodule_compiler = %ld;\n", EMODULES_REVISION);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
545 fprintf (mout, "const char *emodule_name = \"%s\";\n", SSTR(mod_name));
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
546 fprintf (mout, "const char *emodule_version = \"%s\";\n", SSTR(mod_version));
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
547 fprintf (mout, "const char *emodule_title = \"%s\";\n", SSTR(mod_title));
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
548 fprintf (mout, "\n\n");
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
549 fprintf (mout, "void docs_of_%s()\n", SSTR(mod_name));
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
550 fclose (mout);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
551
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
552 sprintf (ts, "%s/make-docfile", ELLCC_ARCHDIR);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
553 OVERENV(mdocprog, "ELLMAKEDOC", ts);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
554 add_to_argv (mdocprog);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
555 sprintf (ts, "-E %s", mod_output);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
556 add_to_argv (ts);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
557 for (i = 1; i < exec_argc; i++)
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
558 exec_argv[real_argc++] = strdup (prog_argv[exec_args[i]]);
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
559 }
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
560
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
561 #endif /* HAVE_SHLIB */
aabb7f5b1c81 Import from CVS: tag r21-2-9
cvs
parents:
diff changeset
562