A minor code clean-up and a comment fix for the CSA patch arising
[exim.git] / src / src / buildconfig.c
CommitLineData
7766a4f0 1/* $Cambridge: exim/src/src/buildconfig.c,v 1.7 2005/03/29 14:19:21 ph10 Exp $ */
059ec3d9
PH
2
3/*************************************************
4* Exim - an Internet mail transport agent *
5*************************************************/
6
c988f1f4 7/* Copyright (c) University of Cambridge 1995 - 2005 */
059ec3d9
PH
8/* See the file NOTICE for conditions of use and distribution. */
9
10
11/*************************************************
12* Build configuration header for Exim *
13*************************************************/
14
15/* This auxiliary program builds the file config.h by the following
16process:
17
18First it reads Makefile, looking for certain OS-specific definitions which it
19uses to define macros. Then it reads the defaults file config.h.defaults.
20
21The defaults file contains normal C #define statements for various macros; if
22the name of a macro is found in the environment, the environment value replaces
23the default. If the default #define does not contain any value, then that macro
24is not copied to the created file unless there is some value in the
25environment.
26
27This program is compiled and run as part of the Make process and is not
28normally called independently. */
29
30
31#include <ctype.h>
32#include <stdio.h>
33#include <stdlib.h>
34#include <string.h>
35#include <sys/types.h>
36#include <pwd.h>
37#include <grp.h>
38
39typedef struct {
40 char *name;
41 int *flag;
42} have_item;
43
44typedef struct {
45 char *name;
46 char *data;
47} save_item;
48
49static char *db_opts[] = { "", "USE_DB", "USE_GDBM", "USE_TDB" };
50
51static int have_ipv6 = 0;
52static int have_iconv = 0;
53
54static char errno_quota[256];
55static char ostype[256];
56static char cc[256];
57
58/* If any entry is an initial substring of another, the longer one must
59appear first. */
60
61static have_item have_list[] = {
62 { "HAVE_IPV6", &have_ipv6 },
63 { "HAVE_ICONV", &have_iconv },
64 { NULL, NULL}
65};
66
67static save_item save_list[] = {
68 { "ERRNO_QUOTA", errno_quota },
69 { "OSTYPE", ostype },
70 { "CC", cc },
71 { NULL, NULL}
72};
73
74
75/* Subroutine to check a string for precisely one instance of "%s". If not,
76bomb out. */
77
78void
79check_percent_ess(char *value, char *name)
80{
81int OK = 0;
82char *p = strstr(value, "%s");
83if (p != NULL) OK = strstr(p+2, "%s") == NULL;
84if (!OK)
85 {
86 printf("\n*** \"%s\" (%s) must contain precisely one occurrence of\n"
87 "*** \"%%s\". Please review your build-time configuration.\n\n/", value,
88 name);
89 exit(1);
90 }
91}
92
93
94/* Main program */
95
96int
97main(int argc, char **argv)
98{
99FILE *base;
100FILE *new;
101int last_initial = 'A';
102int linecount = 0;
103int have_auth = 0;
104int in_local_makefile = 0;
105int use_which_db = 0;
106int use_which_db_in_local_makefile = 0;
107int support_crypteq = 0;
108char buffer[1024];
109
110if (argc != 1)
111 {
112 printf("*** Buildconfig: called with incorrect arguments\n");
113 exit(1);
114 }
115
116new = fopen("config.h", "wb");
117if (new == NULL)
118 {
119 printf("*** Buildconfig: failed to open config.h for output\n");
120 exit(1);
121 }
122
123printf("Building configuration file config.h\n");
124
125fprintf(new, "/*************************************************\n");
126fprintf(new, "* Configuration header for Exim *\n");
127fprintf(new, "*************************************************/\n\n");
128
129fprintf(new, "/* This file was automatically generated from Makefile and "
130 "config.h.defaults,\n");
131fprintf(new, "using values specified in the configuration file Local/Makefile.\n");
132fprintf(new, "Do not edit it. Instead, edit Local/Makefile and "
133 "rerun make. */\n\n");
134
135/* First, search the makefile for certain settings */
136
137base = fopen("Makefile", "rb");
138if (base == NULL)
139 {
140 printf("*** Buildconfig: failed to open Makefile\n");
141 fclose(new);
142 exit(1);
143 }
144
145errno_quota[0] = 0; /* no over-riding value set */
146ostype[0] = 0; /* just in case */
147cc[0] = 0;
148
149while (fgets(buffer, sizeof(buffer), base) != NULL)
150 {
151 int i;
152 have_item *h;
153 save_item *s;
154 char *p = buffer + (int)strlen(buffer);
155 linecount++;
156 while (p > buffer && isspace((unsigned char)p[-1])) p--;
157 *p = 0;
158 p = buffer;
159 while (isspace((unsigned char)*p)) p++;
160
161 /* Notice when we hit the user's makefile */
162
163 if (strcmp(p, "# From Local/Makefile") == 0)
164 {
165 in_local_makefile = 1;
166 continue;
167 }
168
169 /* Remember the last DB option setting. If we hit two in the user's
170 Makefile, complain. */
171
172 for (i = 1; i < sizeof(db_opts)/sizeof(char *); i++)
173 {
174 int len = (int)strlen(db_opts[i]);
175 if (strncmp(p, db_opts[i], len) == 0 && (p[len] == ' ' || p[len] == '='))
176 {
177 if (in_local_makefile)
178 {
179 if (use_which_db_in_local_makefile)
180 {
181 printf("*** Only one of USE_DB, USE_GDBM, or USE_TDB should be "
182 "defined in Local/Makefile\n");
183 exit(1);
184 }
185 use_which_db_in_local_makefile = 1;
186 }
187 use_which_db = i;
188 break;
189 }
190 }
191 if (i < sizeof(db_opts)/sizeof(char *)) continue;
192
193 /* Items where we just save a boolean */
194
195 for (h = have_list; h->name != NULL; h++)
196 {
197 int len = (int)strlen(h->name);
198 if (strncmp(p, h->name, len) == 0)
199 {
200 p += len;
201 while (isspace((unsigned char)*p)) p++;
202 if (*p++ != '=')
203 {
204 printf("*** Buildconfig: syntax error in Makefile line %d\n", linecount);
205 exit(1);
206 }
207 while (isspace((unsigned char)*p)) p++;
208 if (strcmp(p, "YES") == 0 || strcmp(p, "yes") == 0) *(h->flag) = 1;
209 else *(h->flag) = 0; /* Must reset in case multiple instances */
210 break;
211 }
212 }
213
214 if (h->name != NULL) continue;
215
216 /* Items where we save the complete string */
217
218 for (s = save_list; s->name != NULL; s++)
219 {
220 int len = (int)strlen(s->name);
221 if (strncmp(p, s->name, len) == 0)
222 {
223 p += len;
224 while (isspace((unsigned char)*p)) p++;
225 if (*p++ != '=')
226 {
227 printf("*** Buildconfig: syntax error in Makefile line %d\n", linecount);
228 exit(1);
229 }
230 while (isspace((unsigned char)*p)) p++;
231 strcpy(s->data, p);
232 }
233 }
234 }
235
236fprintf(new, "#define HAVE_IPV6 %s\n",
237 have_ipv6? "TRUE" : "FALSE");
238
239fprintf(new, "#define HAVE_ICONV %s\n",
240 have_iconv? "TRUE" : "FALSE");
241
242if (errno_quota[0] != 0)
243 fprintf(new, "\n#define ERRNO_QUOTA %s\n", errno_quota);
244
245if (strcmp(cc, "gcc") == 0 && strstr(ostype, "IRIX") != NULL)
246 {
247 fprintf(new, "\n/* This switch includes the code to fix the inet_ntoa() */");
248 fprintf(new, "\n/* bug when using gcc on an IRIX system. */");
249 fprintf(new, "\n#define USE_INET_NTOA_FIX");
250 }
251
252fprintf(new, "\n");
253fclose(base);
254
255
256/* Now handle the macros listed in the defaults */
257
258base = fopen("../src/config.h.defaults", "rb");
259if (base == NULL)
260 {
261 printf("*** Buildconfig: failed to open ../src/config.h.defaults\n");
262 fclose(new);
263 exit(1);
264 }
265
266while (fgets(buffer, sizeof(buffer), base) != NULL)
267 {
268 int i;
269 char name[256];
270 char *value;
271 char *p = buffer;
272 char *q = name;
273
274 while (*p == ' ' || *p == '\t') p++;
275
276 if (strncmp(p, "#define ", 8) != 0) continue;
277
278 p += 8;
279 while (*p == ' ' || *p == '\t') p++;
280
281 if (*p < last_initial) fprintf(new, "\n");
282 last_initial = *p;
283
284 while (*p && (isalnum((unsigned char)*p) || *p == '_')) *q++ = *p++;
285 *q = 0;
286
287 /* USE_DB, USE_GDBM, and USE_TDB are special cases. We want to have only
288 one of them set. The scan of the Makefile has saved which was the last one
289 encountered. */
290
291 for (i = 1; i < sizeof(db_opts)/sizeof(char *); i++)
292 {
293 if (strcmp(name, db_opts[i]) == 0)
294 {
295 if (use_which_db == i)
296 fprintf(new, "#define %s %.*syes\n", db_opts[i],
297 21 - (int)strlen(db_opts[i]), " ");
298 else
299 fprintf(new, "/* %s not set */\n", name);
300 break;
301 }
302 }
303 if (i < sizeof(db_opts)/sizeof(char *)) continue;
304
305 /* EXIM_USER is a special case. We look in the environment for EXIM_USER or
306 EXIM_UID (the latter for backward compatibility with Exim 3). If the value is
307 not numeric, we look up the user, and default the GID if found. Otherwise,
308 EXIM_GROUP or EXIM_GID must be in the environment. */
309
310 if (strcmp(name, "EXIM_UID") == 0)
311 {
312 uid_t uid = 0;
313 gid_t gid = 0;
314 int gid_set = 0;
315 char *username = NULL;
316 char *groupname = NULL;
317 char *s;
318 char *user = getenv("EXIM_USER");
319 char *group = getenv("EXIM_GROUP");
320
321 if (user == NULL) user = getenv("EXIM_UID");
322 if (group == NULL) group = getenv("EXIM_GID");
323
324 if (user == NULL)
325 {
326 printf("\n*** EXIM_USER has not been defined in any of the Makefiles in "
327 "the\n \"Local\" directory. Please review your build-time "
328 "configuration.\n\n");
329 return 1;
330 }
331
332 while (isspace((unsigned char)(*user))) user++;
333 if (*user == 0)
334 {
335 printf("\n*** EXIM_USER is defined as an empty string in one of the "
336 "files\n in the \"Local\" directory. Please review your build-time"
337 "\n configuration.\n\n");
338 return 1;
339 }
340
341 for (s = user; *s != 0; s++)
342 {
343 if (iscntrl((unsigned char)(*s)))
344 {
345 printf("\n*** EXIM_USER contains the control character 0x%02X in one "
346 "of the files\n in the \"Local\" directory. Please review your "
347 "build-time\n configuration.\n\n", *s);
348 return 1;
349 }
350 }
351
352 /* Numeric uid given */
353
354 if (user[strspn(user, "0123456789")] == 0)
355 {
356 uid = (uid_t)atoi(user);
357 }
358
359 /* User name given. Normally, we look up the uid right away. However,
360 people building binary distributions sometimes want to retain the name till
361 runtime. This is supported if the name begins "ref:". */
362
363 else if (strncmp(user, "ref:", 4) == 0)
364 {
365 user += 4;
366 while (isspace(*user)) user++;
367 username = user;
368 gid_set = 1;
369 }
370
371 else
372 {
373 struct passwd *pw = getpwnam(user);
374 if (pw == NULL)
375 {
376 printf("\n*** User \"%s\" (specified in one of the Makefiles) does not "
377 "exist.\n Please review your build-time configuration.\n\n",
378 user);
379 return 1;
380 }
381
382 uid = pw->pw_uid;
383 gid = pw->pw_gid;
384 gid_set = 1;
385 }
386
387 /* Use explicit group if set. */
388
389 if (group != NULL)
390 {
391 while (isspace((unsigned char)(*group))) group++;
392 if (*group == 0)
393 {
394 printf("\n*** EXIM_GROUP is defined as an empty string in one of "
395 "the files in the\n \"Local\" directory. ");
396 if (gid_set)
397 {
398 printf("If you want the Exim group to be taken from the\n "
399 "password data for the Exim user, just remove the EXIM_GROUP "
400 "setting.\n Otherwise, p");
401 }
402 else printf("EXIM_USER is defined numerically, so there is no"
403 "\n default for EXIM_GROUP and you must set it explicitly.\n P");
404 printf("lease review your build-time configuration.\n\n");
405 return 1;
406 }
407
408 for (s = group; *s != 0; s++)
409 {
410 if (iscntrl((unsigned char)(*s)))
411 {
412 printf("\n*** EXIM_GROUP contains the control character 0x%02X in one "
413 "of the files\n in the \"Local\" directory. Please review your "
414 "build-time\n configuration.\n\n", *s);
415 return 1;
416 }
417 }
418
419 /* Group name given. This may be by reference or to be looked up now,
420 as for user. */
421
422 if (strncmp(group, "ref:", 4) == 0)
423 {
424 group += 4;
425 while (isspace(*group)) group++;
426 groupname = group;
427 }
428
429 else if (username != NULL)
430 {
431 groupname = group;
432 }
433
434 else if (group[strspn(group, "0123456789")] == 0)
435 {
436 gid = (gid_t)atoi(group);
437 }
438
439 else
440 {
441 struct group *gr = getgrnam(group);
442 if (gr == NULL)
443 {
444 printf("\n*** Group \"%s\" (specified in one of the Makefiles) does "
445 "not exist.\n Please review your build-time configuration.\n\n",
446 group);
447 return 1;
448 }
449 gid = gr->gr_gid;
450 }
451 }
452
453 /* Else trouble unless found in passwd file with user */
454
455 else if (!gid_set)
456 {
457 printf("\n*** No group set for Exim. Please review your build-time "
458 "configuration.\n\n");
459 return 1;
460 }
461
462 /* Output user and group names or uid/gid. When names are set, uid/gid
463 are set to zero but will be replaced at runtime. */
464
465 if (username != NULL)
466 fprintf(new, "#define EXIM_USERNAME \"%s\"\n", username);
467 if (groupname != NULL)
468 fprintf(new, "#define EXIM_GROUPNAME \"%s\"\n", groupname);
469
470 fprintf(new, "#define EXIM_UID %d\n", (int)uid);
471 fprintf(new, "#define EXIM_GID %d\n", (int)gid);
472 continue;
473 }
474
35edf2ff
PH
475 /* CONFIGURE_OWNER and CONFIGURE_GROUP are special cases. We look in the
476 environment for first. If the value is not numeric, we look up the user or
477 group. A lot of this code is similar to that for EXIM_USER, but it's easier
478 to keep it separate. */
059ec3d9 479
35edf2ff
PH
480 if (strcmp(name, "CONFIGURE_OWNER") == 0 ||
481 strcmp(name, "CONFIGURE_GROUP") == 0)
059ec3d9 482 {
8e669ac1 483 int isgroup = name[10] == 'G';
059ec3d9 484 uid_t uid = 0;
8e669ac1 485 gid_t gid = 0;
059ec3d9
PH
486 char *s;
487 char *username = NULL;
35edf2ff 488 char *user = getenv(name);
059ec3d9
PH
489
490 if (user == NULL) user = "";
491 while (isspace((unsigned char)(*user))) user++;
492 if (*user == 0)
493 {
494 fprintf(new, "/* %s not set */\n", name);
495 continue;
496 }
497
498 for (s = user; *s != 0; s++)
499 {
500 if (iscntrl((unsigned char)(*s)))
501 {
35edf2ff 502 printf("\n*** %s contains the control character 0x%02X in "
059ec3d9 503 "one of the files\n in the \"Local\" directory. Please review "
35edf2ff 504 "your build-time\n configuration.\n\n", name, *s);
059ec3d9
PH
505 return 1;
506 }
507 }
508
509 /* Numeric uid given */
510
511 if (user[strspn(user, "0123456789")] == 0)
512 {
35edf2ff
PH
513 if (isgroup)
514 gid = (gid_t)atoi(user);
8e669ac1 515 else
35edf2ff 516 uid = (uid_t)atoi(user);
059ec3d9
PH
517 }
518
35edf2ff 519 /* Name given. Normally, we look up the uid or gid right away. However,
059ec3d9
PH
520 people building binary distributions sometimes want to retain the name till
521 runtime. This is supported if the name begins "ref:". */
522
523 else if (strncmp(user, "ref:", 4) == 0)
524 {
525 user += 4;
526 while (isspace(*user)) user++;
527 username = user;
528 }
529
35edf2ff
PH
530 else if (isgroup)
531 {
532 struct group *gr = getgrnam(user);
533 if (gr == NULL)
534 {
535 printf("\n*** Group \"%s\" (specified in one of the Makefiles) does not "
536 "exist.\n Please review your build-time configuration.\n\n",
537 user);
538 return 1;
539 }
540 gid = gr->gr_gid;
541 }
542
059ec3d9
PH
543 else
544 {
545 struct passwd *pw = getpwnam(user);
546 if (pw == NULL)
547 {
548 printf("\n*** User \"%s\" (specified in one of the Makefiles) does not "
549 "exist.\n Please review your build-time configuration.\n\n",
550 user);
551 return 1;
552 }
059ec3d9
PH
553 uid = pw->pw_uid;
554 }
555
556 /* Output user and group names or uid/gid. When names are set, uid/gid
557 are set to zero but will be replaced at runtime. */
558
559 if (username != NULL)
35edf2ff
PH
560 {
561 if (isgroup)
562 fprintf(new, "#define CONFIGURE_GROUPNAME \"%s\"\n", username);
8e669ac1 563 else
35edf2ff
PH
564 fprintf(new, "#define CONFIGURE_OWNERNAME \"%s\"\n", username);
565 }
8e669ac1 566
35edf2ff
PH
567 if (isgroup)
568 fprintf(new, "#define CONFIGURE_GROUP %d\n", (int)gid);
8e669ac1 569 else
35edf2ff 570 fprintf(new, "#define CONFIGURE_OWNER %d\n", (int)uid);
059ec3d9
PH
571 continue;
572 }
573
574 /* FIXED_NEVER_USERS is another special case. Look up the uid values and
575 create suitable initialization data for a vector. */
576
577 if (strcmp(name, "FIXED_NEVER_USERS") == 0)
578 {
579 char *list = getenv("FIXED_NEVER_USERS");
580 if (list == NULL)
581 {
582 fprintf(new, "#define FIXED_NEVER_USERS 0\n");
583 }
584 else
585 {
586 int count = 1;
926e1192 587 int i, j;
059ec3d9
PH
588 uid_t *vector;
589 char *p = list;
590 while (*p != 0) if (*p++ == ':') count++;
591
592 vector = malloc((count+1) * sizeof(uid_t));
593 vector[0] = (uid_t)count;
594
926e1192 595 for (i = 1, j = 0; i <= count; list++, i++)
059ec3d9
PH
596 {
597 char name[64];
8e669ac1 598
059ec3d9
PH
599 p = list;
600 while (*list != 0 && *list != ':') list++;
601 strncpy(name, p, list-p);
602 name[list-p] = 0;
8e669ac1 603
926e1192
PH
604 if (name[0] == 0)
605 {
8e669ac1
PH
606 continue;
607 }
926e1192 608 else if (name[strspn(name, "0123456789")] == 0)
059ec3d9 609 {
926e1192 610 vector[j++] = (uid_t)atoi(name);
059ec3d9
PH
611 }
612 else
613 {
614 struct passwd *pw = getpwnam(name);
615 if (pw == NULL)
616 {
617 printf("\n*** User \"%s\" (specified for FIXED_NEVER_USERS in one of the Makefiles) does not "
618 "exist.\n Please review your build-time configuration.\n\n",
619 name);
620 return 1;
621 }
926e1192 622 vector[j++] = pw->pw_uid;
059ec3d9
PH
623 }
624 }
926e1192
PH
625 fprintf(new, "#define FIXED_NEVER_USERS %d", j);
626 for (i = 0; i < j; i++) fprintf(new, ", %d", (unsigned int)vector[i]);
627 fprintf(new, "\n");
059ec3d9
PH
628 }
629 continue;
630 }
631
8e669ac1
PH
632 /* WITH_CONTENT_SCAN is another special case: it must be set if either it or
633 WITH_OLD_DEMIME is set. */
c6e692d7
PH
634
635 if (strcmp(name, "WITH_CONTENT_SCAN") == 0)
636 {
637 char *wcs = getenv("WITH_CONTENT_SCAN");
638 char *wod = getenv("WITH_OLD_DEMIME");
639 if (wcs != NULL || wod != NULL)
640 fprintf(new, "#define WITH_CONTENT_SCAN yes\n");
641 else fprintf(new, "/* WITH_CONTENT_SCAN not set */\n");
642 continue;
8e669ac1 643 }
c6e692d7 644
059ec3d9
PH
645 /* Otherwise, check whether a value exists in the environment. Remember if
646 it is an AUTH setting or SUPPORT_CRYPTEQ. */
647
648 if ((value = getenv(name)) != NULL)
649 {
650 int len;
651 len = 21 - (int)strlen(name);
652
653 if (strncmp(name, "AUTH_", 5) == 0) have_auth = 1;
654 if (strncmp(name, "SUPPORT_CRYPTEQ", 15) == 0) support_crypteq = 1;
655
656 /* The text value of LDAP_LIB_TYPE refers to a macro that gets set. */
657
658 if (strcmp(name, "LDAP_LIB_TYPE") == 0)
659 {
660 if (strcmp(value, "NETSCAPE") == 0 ||
661 strcmp(value, "UMICHIGAN") == 0 ||
662 strcmp(value, "OPENLDAP1") == 0 ||
663 strcmp(value, "OPENLDAP2") == 0 ||
664 strcmp(value, "SOLARIS") == 0 ||
665 strcmp(value, "SOLARIS7") == 0) /* Compatibility */
666 {
667 fprintf(new, "#define LDAP_LIB_%s\n", value);
668 }
669 else
670 {
671 printf("\n*** LDAP_LIB_TYPE=%s is not a recognized LDAP library type."
672 "\n*** Please review your build-time configuration.\n\n", value);
673 return 1;
674 }
675 }
676
677 else if (strcmp(name, "RADIUS_LIB_TYPE") == 0)
678 {
679 if (strcmp(value, "RADIUSCLIENT") == 0 ||
7766a4f0 680 strcmp(value, "RADIUSCLIENTNEW") == 0 ||
059ec3d9
PH
681 strcmp(value, "RADLIB") == 0)
682 {
683 fprintf(new, "#define RADIUS_LIB_%s\n", value);
684 }
685 else
686 {
687 printf("\n*** RADIUS_LIB_TYPE=%s is not a recognized RADIUS library type."
688 "\n*** Please review your build-time configuration.\n\n", value);
689 return 1;
690 }
691 }
692
693 /* Other macros get set to the environment value. */
694
695 else
696 {
697 fprintf(new, "#define %s ", name);
698 while(len-- > 0) fputc(' ', new);
699
700 /* LOG_FILE_PATH is now messy because it can be a path containing %s or
701 it can be "syslog" or ":syslog" or "syslog:path" or even "path:syslog". */
702
703 if (strcmp(name, "LOG_FILE_PATH") == 0)
704 {
705 char *ss = value;
706 for(;;)
707 {
708 char *pp;
709 char *sss = strchr(ss, ':');
710 if (sss != NULL)
711 {
712 strncpy(buffer, ss, sss-ss);
713 buffer[sss-ss] = 0; /* For empty case */
714 }
715 else strcpy(buffer, ss);
716 pp = buffer + (int)strlen(buffer);
717 while (pp > buffer && isspace((unsigned char)pp[-1])) pp--;
718 *pp = 0;
719 if (buffer[0] != 0 && strcmp(buffer, "syslog") != 0)
720 check_percent_ess(buffer, name);
721 if (sss == NULL) break;
722 ss = sss + 1;
723 while (isspace((unsigned char)*ss)) ss++;
724 }
725 fprintf(new, "\"%s\"\n", value);
726 }
727
728 /* Timezone values and HEADERS_CHARSET get quoted */
729
730 else if (strcmp(name, "TIMEZONE_DEFAULT") == 0||
731 strcmp(name, "HEADERS_CHARSET") == 0)
732 fprintf(new, "\"%s\"\n", value);
733
734 /* For others, quote any paths and don't quote anything else */
735
736 else
737 {
738 if (value[0] == '/') fprintf(new, "\"%s\"\n", value);
739 else fprintf(new, "%s\n", value);
740 }
741 }
742 }
743
744 /* Value not defined in the environment; use the default */
745
746 else
747 {
748 char *t = p;
749 while (*p == ' ' || *p == '\t') p++;
750 if (*p != '\n') fputs(buffer, new); else
751 {
752 *t = 0;
753 if (strcmp(name, "BIN_DIRECTORY") == 0 ||
754 strcmp(name, "CONFIGURE_FILE") == 0)
755 {
756 printf("\n*** %s has not been defined in any of the Makefiles in the\n"
757 " \"Local\" directory. "
758 "Please review your build-time configuration.\n\n", name);
759 return 1;
760 }
761
762 if (strcmp(name, "TIMEZONE_DEFAULT") == 0)
763 {
764 char *tz = getenv("TZ");
765 fprintf(new, "#define TIMEZONE_DEFAULT ");
766 if (tz == NULL) fprintf(new, "NULL\n"); else
767 fprintf(new, "\"%s\"\n", tz);
768 }
769
770 else fprintf(new, "/* %s not set */\n", name);
771 }
772 }
773 }
774
775fclose(base);
776
777/* If any AUTH macros were defined, ensure that SUPPORT_CRYPTEQ is also
778defined. */
779
780if (have_auth)
781 {
782 if (!support_crypteq) fprintf(new, "/* Force SUPPORT_CRYPTEQ for AUTH */\n"
783 "#define SUPPORT_CRYPTEQ\n");
784 }
785
786/* End off */
787
788fprintf(new, "\n/* End of config.h */\n");
789fclose(new);
790return 0;
791}
792
793/* End of buildconfig.c */