1 /*************************************************
2 * Exim - an Internet mail transport agent *
3 *************************************************/
5 /* Copyright (c) The Exim Maintainers 2022 */
6 /* Copyright (c) University of Cambridge 1995 - 2018 */
7 /* See the file NOTICE for conditions of use and distribution. */
10 /*************************************************
11 * Build configuration header for Exim *
12 *************************************************/
14 /* This auxiliary program builds the file config.h by the following
17 First, it determines the size of off_t and time_t variables, and generates
18 macro code to define OFF_T_FMT and TIME_T_FMT as suitable formats, if they are
19 not already defined in the system-specific header file.
21 Then it reads Makefile, looking for certain OS-specific definitions which it
22 uses to define some specific macros. Finally, it reads the defaults file
25 The defaults file contains normal C #define statements for various macros; if
26 the name of a macro is found in the environment, the environment value replaces
27 the default. If the default #define does not contain any value, then that macro
28 is not copied to the created file unless there is some value in the
31 This program is compiled and run as part of the Make process and is not
32 normally called independently. */
39 #include <sys/types.h>
55 static const char *db_opts[] = { "", "USE_DB", "USE_GDBM", "USE_TDB", "USE_NDBM" };
57 static int have_ipv6 = 0;
58 static int have_iconv = 0;
60 static char errno_quota[256];
61 static char ostype[256];
64 /* If any entry is an initial substring of another, the longer one must
67 static have_item have_list[] = {
68 { "HAVE_IPV6", &have_ipv6 },
69 { "HAVE_ICONV", &have_iconv },
73 static save_item save_list[] = {
74 { "ERRNO_QUOTA", errno_quota },
81 /* Subroutine to check a string for precisely one instance of "%s". If not,
85 check_percent_ess(char *value, char *name)
88 char *p = strstr(value, "%s");
89 if (p != NULL) OK = strstr(p+2, "%s") == NULL;
92 printf("\n*** \"%s\" (%s) must contain precisely one occurrence of\n"
93 "*** \"%%s\". Please review your build-time configuration.\n\n/", value,
103 main(int argc, char **argv)
105 off_t test_off_t = 0;
106 time_t test_time_t = 0;
108 #if ! (__STDC_VERSION__ >= 199901L)
109 size_t test_size_t = 0;
110 ssize_t test_ssize_t = 0;
111 unsigned long test_ulong_t = 0L;
112 unsigned int test_uint_t = 0;
114 long test_long_t = 0;
115 long long test_longlong_t = 0;
119 int last_initial = 'A';
122 int in_local_makefile = 0;
123 int use_which_db = 0;
124 int use_which_db_in_local_makefile = 0;
125 int support_crypteq = 0;
130 printf("*** Buildconfig: called with incorrect arguments\n");
134 new = fopen("config.h", "wb");
137 printf("*** Buildconfig: failed to open config.h for output\n");
141 printf("Building configuration file config.h\n");
143 fprintf(new, "/*************************************************\n");
144 fprintf(new, "* Configuration header for Exim *\n");
145 fprintf(new, "*************************************************/\n\n");
147 fprintf(new, "/* This file was automatically generated from Makefile and "
148 "config.h.defaults,\n");
149 fprintf(new, "using values specified in the configuration file Local/Makefile.\n");
150 fprintf(new, "Do not edit it. Instead, edit Local/Makefile and "
151 "rerun make. */\n\n");
153 /* First, deal with the printing format for off_t variables. We assume that if
154 the size of off_t is greater than 4, "%lld" will be available as a format for
155 printing long long variables, and there will be support for the long long type.
156 This assumption is known to be OK for the common operating systems. */
158 fprintf(new, "#ifndef OFF_T_FMT\n");
159 if (sizeof(test_off_t) > sizeof(test_long_t))
160 fprintf(new, "# define OFF_T_FMT \"%%lld\"\n");
162 fprintf(new, "# define OFF_T_FMT \"%%ld\"\n");
163 fprintf(new, "#endif\n\n");
165 fprintf(new, "#ifndef LONGLONG_T\n");
166 if (sizeof(test_longlong_t) > sizeof(test_long_t))
167 fprintf(new, "# define LONGLONG_T long long int\n");
169 fprintf(new, "# define LONGLONG_T long int\n");
170 fprintf(new, "#endif\n\n");
172 /* Now do the same thing for time_t variables. If the length is greater than
173 4, we want to assume long long support (even if off_t was less than 4). If the
174 length is 4 or less, we can leave LONGLONG_T to whatever was defined above for
177 fprintf(new, "#ifndef TIME_T_FMT\n");
178 if (sizeof(test_time_t) > sizeof(test_long_t))
180 fprintf(new, "# define TIME_T_FMT \"%%lld\"\n");
181 fprintf(new, "# undef LONGLONG_T\n");
182 fprintf(new, "# define LONGLONG_T long long int\n");
185 fprintf(new, "# define TIME_T_FMT \"%%ld\"\n");
186 fprintf(new, "#endif\n\n");
188 fprintf(new, "#ifndef INO_T_FMT\n");
189 if (sizeof(test_ino_t) > sizeof(test_long_t))
190 fprintf(new, "# define INO_T_FMT \"%%llu\"\n");
192 fprintf(new, "# define INO_T_FMT \"%%lu\"\n");
193 fprintf(new, "#endif\n\n");
195 fprintf(new, "#ifndef PID_T_FMT\n");
196 fprintf(new, "# define PID_T_FMT \"%%lu\"\n");
197 fprintf(new, "#endif\n\n");
199 /* And for sizeof() results, size_t, which should with C99 be just %zu, deal
200 with C99 not being ubiquitous yet. Unfortunately. Assume ssize_t is same
201 size as size_t on C99; if someone comes up with a version where it's not, fix
204 #if __STDC_VERSION__ >= 199901L
205 fprintf(new, "#define SIZE_T_FMT \"%%zu\"\n");
206 fprintf(new, "#define SSIZE_T_FMT \"%%zd\"\n");
208 if (sizeof(test_size_t) > sizeof (test_ulong_t))
209 fprintf(new, "#define SIZE_T_FMT \"%%llu\"\n");
210 else if (sizeof(test_size_t) > sizeof (test_uint_t))
211 fprintf(new, "#define SIZE_T_FMT \"%%lu\"\n");
213 fprintf(new, "#define SIZE_T_FMT \"%%u\"\n");
215 if (sizeof(test_ssize_t) > sizeof(test_long_t))
216 fprintf(new, "#define SSIZE_T_FMT \"%%lld\"\n");
217 else if (sizeof(test_ssize_t) > sizeof(test_int_t))
218 fprintf(new, "#define SSIZE_T_FMT \"%%ld\"\n");
220 fprintf(new, "#define SSIZE_T_FMT \"%%d\"\n");
223 /* Now search the makefile for certain settings */
225 if (!(base = fopen("Makefile", "rb")))
227 printf("*** Buildconfig: failed to open Makefile\n");
232 errno_quota[0] = 0; /* no over-riding value set */
233 ostype[0] = 0; /* just in case */
236 while (fgets(buffer, sizeof(buffer), base) != NULL)
241 char *p = buffer + (int)strlen(buffer);
243 while (p > buffer && isspace((unsigned char)p[-1])) p--;
246 while (isspace((unsigned char)*p)) p++;
248 /* Notice when we hit the user's makefile */
250 if (strcmp(p, "# From Local/Makefile") == 0)
252 in_local_makefile = 1;
256 /* Remember the last DB option setting. If we hit two in the user's
257 Makefile, complain. */
259 for (i = 1; i < sizeof(db_opts)/sizeof(char *); i++)
261 int len = (int)strlen(db_opts[i]);
262 if (strncmp(p, db_opts[i], len) == 0 && (p[len] == ' ' || p[len] == '='))
264 if (in_local_makefile)
266 if (use_which_db_in_local_makefile)
268 printf("*** Only one of USE_DB, USE_GDBM, or USE_TDB should be "
269 "defined in Local/Makefile\n");
272 use_which_db_in_local_makefile = 1;
278 if (i < sizeof(db_opts)/sizeof(char *)) continue;
280 /* Items where we just save a boolean */
282 for (h = have_list; h->name != NULL; h++)
284 int len = (int)strlen(h->name);
285 if (strncmp(p, h->name, len) == 0)
288 while (isspace((unsigned char)*p)) p++;
291 printf("*** Buildconfig: syntax error in Makefile line %d\n", linecount);
294 while (isspace((unsigned char)*p)) p++;
295 if (strcmp(p, "YES") == 0 || strcmp(p, "yes") == 0) *(h->flag) = 1;
296 else *(h->flag) = 0; /* Must reset in case multiple instances */
301 if (h->name != NULL) continue;
303 /* Items where we save the complete string */
305 for (s = save_list; s->name != NULL; s++)
307 int len = (int)strlen(s->name);
308 if (strncmp(p, s->name, len) == 0)
311 while (isspace((unsigned char)*p)) p++;
314 printf("*** Buildconfig: syntax error in Makefile line %d\n", linecount);
317 while (isspace((unsigned char)*p)) p++;
323 fprintf(new, "#define HAVE_IPV6 %s\n",
324 have_ipv6? "TRUE" : "FALSE");
326 fprintf(new, "#define HAVE_ICONV %s\n",
327 have_iconv? "TRUE" : "FALSE");
329 if (errno_quota[0] != 0)
330 fprintf(new, "\n#define ERRNO_QUOTA %s\n", errno_quota);
332 if (strcmp(cc, "gcc") == 0 &&
333 (strstr(ostype, "IRIX") != NULL || strstr(ostype, "AIX") != NULL))
335 fprintf(new, "\n/* This switch includes the code to fix the inet_ntoa() */");
336 fprintf(new, "\n/* bug when using gcc on an IRIX or AIX system. */");
337 fprintf(new, "\n#define USE_INET_NTOA_FIX");
344 /* Now handle the macros listed in the defaults */
346 base = fopen("../src/config.h.defaults", "rb");
349 printf("*** Buildconfig: failed to open ../src/config.h.defaults\n");
354 while (fgets(buffer, sizeof(buffer), base) != NULL)
362 while (*p == ' ' || *p == '\t') p++;
364 if (strncmp(p, "#ifdef ", 7) == 0
365 || strncmp(p, "#ifndef ", 8) == 0
366 || strncmp(p, "#if ", 4) == 0
367 || strncmp(p, "#endif", 6) == 0
374 if (strncmp(p, "#define ", 8) != 0) continue;
377 while (*p == ' ' || *p == '\t') p++;
379 if (*p < last_initial) fprintf(new, "\n");
382 while (*p && (isalnum((unsigned char)*p) || *p == '_')) *q++ = *p++;
385 /* USE_DB, USE_GDBM, and USE_TDB are special cases. We want to have only
386 one of them set. The scan of the Makefile has saved which was the last one
389 for (i = 1; i < sizeof(db_opts)/sizeof(char *); i++)
390 if (strcmp(name, db_opts[i]) == 0)
392 if (use_which_db == i)
393 fprintf(new, "#define %s %.*syes\n", db_opts[i],
394 21 - (int)strlen(db_opts[i]), " ");
396 fprintf(new, "/* %s not set */\n", name);
399 if (i < sizeof(db_opts)/sizeof(char *)) continue;
401 /* EXIM_USER is a special case. We look in the environment for EXIM_USER or
402 EXIM_UID (the latter for backward compatibility with Exim 3). If the value is
403 not numeric, we look up the user, and default the GID if found. Otherwise,
404 EXIM_GROUP or EXIM_GID must be in the environment. */
406 if (strcmp(name, "EXIM_UID") == 0)
412 char *username = NULL;
413 char *groupname = NULL;
415 char *user = getenv("EXIM_USER");
416 char *group = getenv("EXIM_GROUP");
418 if (user == NULL) user = getenv("EXIM_UID");
419 if (group == NULL) group = getenv("EXIM_GID");
423 printf("\n*** EXIM_USER has not been defined in any of the Makefiles in "
424 "the\n \"Local\" directory. Please review your build-time "
425 "configuration.\n\n");
429 while (isspace((unsigned char)(*user))) user++;
432 printf("\n*** EXIM_USER is defined as an empty string in one of the "
433 "files\n in the \"Local\" directory. Please review your build-time"
434 "\n configuration.\n\n");
438 for (s = user; *s != 0; s++)
440 if (iscntrl((unsigned char)(*s)))
442 printf("\n*** EXIM_USER contains the control character 0x%02X in one "
443 "of the files\n in the \"Local\" directory. Please review your "
444 "build-time\n configuration.\n\n", *s);
449 /* Numeric uid given */
451 if (user[strspn(user, "0123456789")] == 0)
453 uid = (uid_t)atoi(user);
456 /* User name given. Normally, we look up the uid right away. However,
457 people building binary distributions sometimes want to retain the name till
458 runtime. This is supported if the name begins "ref:". */
460 else if (strncmp(user, "ref:", 4) == 0)
463 while (isspace(*user)) user++;
471 struct passwd *pw = getpwnam(user);
474 printf("\n*** User \"%s\" (specified in one of the Makefiles) does not "
475 "exist.\n Please review your build-time configuration.\n\n",
485 /* Use explicit group if set. */
489 while (isspace((unsigned char)(*group))) group++;
492 printf("\n*** EXIM_GROUP is defined as an empty string in one of "
493 "the files in the\n \"Local\" directory. ");
496 printf("If you want the Exim group to be taken from the\n "
497 "password data for the Exim user, just remove the EXIM_GROUP "
498 "setting.\n Otherwise, p");
500 else printf("EXIM_USER is defined numerically, so there is no"
501 "\n default for EXIM_GROUP and you must set it explicitly.\n P");
502 printf("lease review your build-time configuration.\n\n");
506 for (s = group; *s != 0; s++)
508 if (iscntrl((unsigned char)(*s)))
510 printf("\n*** EXIM_GROUP contains the control character 0x%02X in one "
511 "of the files\n in the \"Local\" directory. Please review your "
512 "build-time\n configuration.\n\n", *s);
517 /* Group name given. This may be by reference or to be looked up now,
520 if (strncmp(group, "ref:", 4) == 0)
523 while (isspace(*group)) group++;
527 else if (username != NULL)
532 else if (group[strspn(group, "0123456789")] == 0)
534 gid = (gid_t)atoi(group);
539 struct group *gr = getgrnam(group);
542 printf("\n*** Group \"%s\" (specified in one of the Makefiles) does "
543 "not exist.\n Please review your build-time configuration.\n\n",
551 /* Else trouble unless found in passwd file with user */
555 printf("\n*** No group set for Exim. Please review your build-time "
556 "configuration.\n\n");
560 /* security sanity checks
561 if ref: is being used, we can never be sure, but we can take reasonable
562 steps to filter out the most obvious ones. */
564 if ((!uid_not_set && uid == 0) ||
565 ((username != NULL) && (
566 (strcmp(username, "root") == 0) ||
567 (strcmp(username, "toor") == 0) )))
569 printf("\n*** Exim's internal user must not be root.\n\n");
573 /* Output user and group names or uid/gid. When names are set, uid/gid
574 are set to zero but will be replaced at runtime. */
576 if (username != NULL)
577 fprintf(new, "#define EXIM_USERNAME \"%s\"\n", username);
578 if (groupname != NULL)
579 fprintf(new, "#define EXIM_GROUPNAME \"%s\"\n", groupname);
581 fprintf(new, "#define EXIM_UID %d\n", (int)uid);
582 fprintf(new, "#define EXIM_GID %d\n", (int)gid);
586 /* CONFIGURE_OWNER and CONFIGURE_GROUP are special cases. We look in the
587 environment for first. If the value is not numeric, we look up the user or
588 group. A lot of this code is similar to that for EXIM_USER, but it's easier
589 to keep it separate. */
591 if (strcmp(name, "CONFIGURE_OWNER") == 0 ||
592 strcmp(name, "CONFIGURE_GROUP") == 0)
594 int isgroup = name[10] == 'G';
598 const char *username = NULL;
599 const char *user = getenv(name);
601 if (user == NULL) user = "";
602 while (isspace((unsigned char)(*user))) user++;
605 fprintf(new, "/* %s not set */\n", name);
609 for (s = user; *s != 0; s++)
611 if (iscntrl((unsigned char)(*s)))
613 printf("\n*** %s contains the control character 0x%02X in "
614 "one of the files\n in the \"Local\" directory. Please review "
615 "your build-time\n configuration.\n\n", name, *s);
620 /* Numeric uid given */
622 if (user[strspn(user, "0123456789")] == 0)
625 gid = (gid_t)atoi(user);
627 uid = (uid_t)atoi(user);
630 /* Name given. Normally, we look up the uid or gid right away. However,
631 people building binary distributions sometimes want to retain the name till
632 runtime. This is supported if the name begins "ref:". */
634 else if (strncmp(user, "ref:", 4) == 0)
637 while (isspace(*user)) user++;
642 struct group *gr = getgrnam(user);
645 printf("\n*** Group \"%s\" (specified in one of the Makefiles) does not "
646 "exist.\n Please review your build-time configuration.\n\n",
655 struct passwd *pw = getpwnam(user);
658 printf("\n*** User \"%s\" (specified in one of the Makefiles) does not "
659 "exist.\n Please review your build-time configuration.\n\n",
666 /* Output user and group names or uid/gid. When names are set, uid/gid
667 are set to zero but will be replaced at runtime. */
669 if (username != NULL)
672 fprintf(new, "#define CONFIGURE_GROUPNAME \"%s\"\n", username);
674 fprintf(new, "#define CONFIGURE_OWNERNAME \"%s\"\n", username);
678 fprintf(new, "#define CONFIGURE_GROUP %d\n", (int)gid);
680 fprintf(new, "#define CONFIGURE_OWNER %d\n", (int)uid);
684 /* FIXED_NEVER_USERS is another special case. Look up the uid values and
685 create suitable initialization data for a vector. */
687 if (strcmp(name, "FIXED_NEVER_USERS") == 0)
689 char *list = getenv("FIXED_NEVER_USERS");
692 fprintf(new, "#define FIXED_NEVER_USERS 0\n");
700 while (*p != 0) if (*p++ == ':') count++;
702 vector = malloc((count+1) * sizeof(uid_t));
703 vector[0] = (uid_t)count;
705 for (i = 1, j = 0; i <= count; list++, i++)
710 while (*list != 0 && *list != ':') list++;
711 strncpy(name, p, list-p);
718 else if (name[strspn(name, "0123456789")] == 0)
720 vector[j++] = (uid_t)atoi(name);
724 struct passwd *pw = getpwnam(name);
727 printf("\n*** User \"%s\" (specified for FIXED_NEVER_USERS in one of the Makefiles) does not "
728 "exist.\n Please review your build-time configuration.\n\n",
732 vector[j++] = pw->pw_uid;
735 fprintf(new, "#define FIXED_NEVER_USERS %d", j);
736 for (i = 0; i < j; i++) fprintf(new, ", %d", (unsigned int)vector[i]);
743 /* WITH_CONTENT_SCAN is another special case: it must be set if it or
744 EXPERIMENTAL_DCC is set. */
746 if (strcmp(name, "WITH_CONTENT_SCAN") == 0)
748 char *wcs = getenv("WITH_CONTENT_SCAN");
749 char *dcc = getenv("EXPERIMENTAL_DCC");
750 fprintf(new, wcs || dcc
751 ? "#define WITH_CONTENT_SCAN yes\n"
752 : "/* WITH_CONTENT_SCAN not set */\n");
756 /* DISABLE_DKIM is special; must be forced if DISABLE_TLS */
757 if (strcmp(name, "DISABLE_DKIM") == 0)
759 char *d_dkim = getenv("DISABLE_DKIM");
760 char *notls = getenv("DISABLE_TLS");
763 fprintf(new, "#define DISABLE_DKIM yes\n");
765 fprintf(new, "#define DISABLE_DKIM yes /* forced by lack of TLS */\n");
767 fprintf(new, "/* DISABLE_DKIM not set */\n");
771 /* Otherwise, check whether a value exists in the environment. Remember if
772 it is an AUTH setting or SUPPORT_CRYPTEQ. */
774 if ((value = getenv(name)) != NULL)
777 len = 21 - (int)strlen(name);
779 if (strncmp(name, "AUTH_", 5) == 0) have_auth = 1;
780 if (strncmp(name, "SUPPORT_CRYPTEQ", 15) == 0) support_crypteq = 1;
782 /* The text value of LDAP_LIB_TYPE refers to a macro that gets set. */
784 if (strcmp(name, "LDAP_LIB_TYPE") == 0)
786 if (strcmp(value, "NETSCAPE") == 0 ||
787 strcmp(value, "UMICHIGAN") == 0 ||
788 strcmp(value, "OPENLDAP1") == 0 ||
789 strcmp(value, "OPENLDAP2") == 0 ||
790 strcmp(value, "SOLARIS") == 0 ||
791 strcmp(value, "SOLARIS7") == 0) /* Compatibility */
793 fprintf(new, "#define LDAP_LIB_%s\n", value);
797 printf("\n*** LDAP_LIB_TYPE=%s is not a recognized LDAP library type."
798 "\n*** Please review your build-time configuration.\n\n", value);
803 else if (strcmp(name, "RADIUS_LIB_TYPE") == 0)
805 if (strcmp(value, "RADIUSCLIENT") == 0 ||
806 strcmp(value, "RADIUSCLIENTNEW") == 0 ||
807 strcmp(value, "RADLIB") == 0)
809 fprintf(new, "#define RADIUS_LIB_%s\n", value);
813 printf("\n*** RADIUS_LIB_TYPE=%s is not a recognized RADIUS library type."
814 "\n*** Please review your build-time configuration.\n\n", value);
819 /* Other macros get set to the environment value. */
823 fprintf(new, "#define %s ", name);
824 while(len-- > 0) fputc(' ', new);
826 /* LOG_FILE_PATH is now messy because it can be a path containing %s or
827 it can be "syslog" or ":syslog" or "syslog:path" or even "path:syslog". */
829 if (strcmp(name, "LOG_FILE_PATH") == 0)
835 char *sss = strchr(ss, ':');
838 strncpy(buffer, ss, sss-ss);
839 buffer[sss-ss] = 0; /* For empty case */
843 strncpy(buffer, ss, sizeof(buffer));
844 buffer[sizeof(buffer)-1] = 0;
846 pp = buffer + (int)strlen(buffer);
847 while (pp > buffer && isspace((unsigned char)pp[-1])) pp--;
849 if (buffer[0] != 0 && strcmp(buffer, "syslog") != 0)
850 check_percent_ess(buffer, name);
851 if (sss == NULL) break;
853 while (isspace((unsigned char)*ss)) ss++;
855 fprintf(new, "\"%s\"\n", value);
858 /* Timezone values HEADERS_CHARSET, TCP_WRAPPERS_DAEMON_NAME and
859 WHITELIST_D_MACROS get quoted */
861 else if (strcmp(name, "TIMEZONE_DEFAULT") == 0||
862 strcmp(name, "TCP_WRAPPERS_DAEMON_NAME") == 0||
863 strcmp(name, "HEADERS_CHARSET") == 0||
864 strcmp(name, "WHITELIST_D_MACROS") == 0)
865 fprintf(new, "\"%s\"\n", value);
867 /* GnuTLS constants; first is for debugging, others are tuning */
869 /* less than 0 is not-active; 0-9 are normal, API suggests higher
870 taken without problems */
871 else if (strcmp(name, "EXIM_GNUTLS_LIBRARY_LOG_LEVEL") == 0)
875 nv = strtol(value, &end, 10);
876 if (end != value && *end == '\0' && nv >= -1 && nv <= 100)
878 fprintf(new, "%s\n", value);
882 printf("Value of %s should be -1..9\n", name);
887 /* how many bits Exim, as a client, demands must be in D-H */
888 /* 1024 is a historical figure; some sites actually use lower, so we
889 permit the value to be lowered "dangerously" low, but not "insanely"
890 low. Though actually, 1024 is becoming "dangerous". */
891 else if ((strcmp(name, "EXIM_CLIENT_DH_MIN_MIN_BITS") == 0) ||
892 (strcmp(name, "EXIM_CLIENT_DH_DEFAULT_MIN_BITS") == 0) ||
893 (strcmp(name, "EXIM_SERVER_DH_BITS_PRE2_12") == 0))
897 nv = strtol(value, &end, 10);
898 if (end != value && *end == '\0' && nv >= 512 && nv < 500000)
900 fprintf(new, "%s\n", value);
904 printf("Unreasonable value (%s) of \"%s\".\n", value, name);
909 /* For others, quote any paths and don't quote anything else */
913 if (value[0] == '/') fprintf(new, "\"%s\"\n", value);
914 else fprintf(new, "%s\n", value);
919 /* Value not defined in the environment; use the default */
924 while (*p == ' ' || *p == '\t') p++;
925 if (*p != '\n') fputs(buffer, new); else
928 if (strcmp(name, "BIN_DIRECTORY") == 0 ||
929 strcmp(name, "CONFIGURE_FILE") == 0)
931 printf("\n*** %s has not been defined in any of the Makefiles in the\n"
932 " \"Local\" directory. "
933 "Please review your build-time configuration.\n\n", name);
937 if (strcmp(name, "TIMEZONE_DEFAULT") == 0)
939 char *tz = getenv("TZ");
940 fprintf(new, "#define TIMEZONE_DEFAULT ");
941 if (tz == NULL) fprintf(new, "NULL\n"); else
942 fprintf(new, "\"%s\"\n", tz);
945 else fprintf(new, "/* %s not set */\n", name);
952 /* If any AUTH macros were defined, ensure that SUPPORT_CRYPTEQ is also
956 if (!support_crypteq) fprintf(new, "/* Force SUPPORT_CRYPTEQ for AUTH */\n"
957 "#define SUPPORT_CRYPTEQ\n");
959 /* Check poll() for timer functionality.
960 Some OS' have released with it broken. */
963 struct timeval before, after;
966 gettimeofday(&before, NULL);
967 (void) poll(NULL, 0, 500);
968 gettimeofday(&after, NULL);
970 us = (after.tv_sec - before.tv_sec) * 1000000 +
971 (after.tv_usec - before.tv_usec);
974 fprintf(new, "#define NO_POLL_H\n");
979 fprintf(new, "\n/* End of config.h */\n");
984 /* End of buildconfig.c */