1 /*************************************************
2 * Exim - an Internet mail transport agent *
3 *************************************************/
5 /* Copyright (c) University of Cambridge 1995 - 2018 */
6 /* See the file NOTICE for conditions of use and distribution. */
9 /*************************************************
10 * Build configuration header for Exim *
11 *************************************************/
13 /* This auxiliary program builds the file config.h by the following
16 First, it determines the size of off_t and time_t variables, and generates
17 macro code to define OFF_T_FMT and TIME_T_FMT as suitable formats, if they are
18 not already defined in the system-specific header file.
20 Then it reads Makefile, looking for certain OS-specific definitions which it
21 uses to define some specific macros. Finally, it reads the defaults file
24 The defaults file contains normal C #define statements for various macros; if
25 the name of a macro is found in the environment, the environment value replaces
26 the default. If the default #define does not contain any value, then that macro
27 is not copied to the created file unless there is some value in the
30 This program is compiled and run as part of the Make process and is not
31 normally called independently. */
38 #include <sys/types.h>
54 static const char *db_opts[] = { "", "USE_DB", "USE_GDBM", "USE_TDB" };
56 static int have_ipv6 = 0;
57 static int have_iconv = 0;
59 static char errno_quota[256];
60 static char ostype[256];
63 /* If any entry is an initial substring of another, the longer one must
66 static have_item have_list[] = {
67 { "HAVE_IPV6", &have_ipv6 },
68 { "HAVE_ICONV", &have_iconv },
72 static save_item save_list[] = {
73 { "ERRNO_QUOTA", errno_quota },
80 /* Subroutine to check a string for precisely one instance of "%s". If not,
84 check_percent_ess(char *value, char *name)
87 char *p = strstr(value, "%s");
88 if (p != NULL) OK = strstr(p+2, "%s") == NULL;
91 printf("\n*** \"%s\" (%s) must contain precisely one occurrence of\n"
92 "*** \"%%s\". Please review your build-time configuration.\n\n/", value,
102 main(int argc, char **argv)
104 off_t test_off_t = 0;
105 time_t test_time_t = 0;
107 #if ! (__STDC_VERSION__ >= 199901L)
108 size_t test_size_t = 0;
109 ssize_t test_ssize_t = 0;
110 unsigned long test_ulong_t = 0L;
111 unsigned int test_uint_t = 0;
113 long test_long_t = 0;
114 long long test_longlong_t = 0;
118 int last_initial = 'A';
121 int in_local_makefile = 0;
122 int use_which_db = 0;
123 int use_which_db_in_local_makefile = 0;
124 int support_crypteq = 0;
129 printf("*** Buildconfig: called with incorrect arguments\n");
133 new = fopen("config.h", "wb");
136 printf("*** Buildconfig: failed to open config.h for output\n");
140 printf("Building configuration file config.h\n");
142 fprintf(new, "/*************************************************\n");
143 fprintf(new, "* Configuration header for Exim *\n");
144 fprintf(new, "*************************************************/\n\n");
146 fprintf(new, "/* This file was automatically generated from Makefile and "
147 "config.h.defaults,\n");
148 fprintf(new, "using values specified in the configuration file Local/Makefile.\n");
149 fprintf(new, "Do not edit it. Instead, edit Local/Makefile and "
150 "rerun make. */\n\n");
152 /* First, deal with the printing format for off_t variables. We assume that if
153 the size of off_t is greater than 4, "%lld" will be available as a format for
154 printing long long variables, and there will be support for the long long type.
155 This assumption is known to be OK for the common operating systems. */
157 fprintf(new, "#ifndef OFF_T_FMT\n");
158 if (sizeof(test_off_t) > sizeof(test_long_t))
159 fprintf(new, "# define OFF_T_FMT \"%%lld\"\n");
161 fprintf(new, "# define OFF_T_FMT \"%%ld\"\n");
162 fprintf(new, "#endif\n\n");
164 fprintf(new, "#ifndef LONGLONG_T\n");
165 if (sizeof(test_longlong_t) > sizeof(test_long_t))
166 fprintf(new, "# define LONGLONG_T long long int\n");
168 fprintf(new, "# define LONGLONG_T long int\n");
169 fprintf(new, "#endif\n\n");
171 /* Now do the same thing for time_t variables. If the length is greater than
172 4, we want to assume long long support (even if off_t was less than 4). If the
173 length is 4 or less, we can leave LONGLONG_T to whatever was defined above for
176 fprintf(new, "#ifndef TIME_T_FMT\n");
177 if (sizeof(test_time_t) > sizeof(test_long_t))
179 fprintf(new, "# define TIME_T_FMT \"%%lld\"\n");
180 fprintf(new, "# undef LONGLONG_T\n");
181 fprintf(new, "# define LONGLONG_T long long int\n");
184 fprintf(new, "# define TIME_T_FMT \"%%ld\"\n");
185 fprintf(new, "#endif\n\n");
187 fprintf(new, "#ifndef INO_T_FMT\n");
188 if (sizeof(test_ino_t) > sizeof(test_long_t))
189 fprintf(new, "# define INO_T_FMT \"%%llu\"\n");
191 fprintf(new, "# define INO_T_FMT \"%%lu\"\n");
192 fprintf(new, "#endif\n\n");
194 fprintf(new, "#ifndef PID_T_FMT\n");
195 fprintf(new, "# define PID_T_FMT \"%%lu\"\n");
196 fprintf(new, "#endif\n\n");
198 /* And for sizeof() results, size_t, which should with C99 be just %zu, deal
199 with C99 not being ubiquitous yet. Unfortunately. Assume ssize_t is same
200 size as size_t on C99; if someone comes up with a version where it's not, fix
203 #if __STDC_VERSION__ >= 199901L
204 fprintf(new, "#define SIZE_T_FMT \"%%zu\"\n");
205 fprintf(new, "#define SSIZE_T_FMT \"%%zd\"\n");
207 if (sizeof(test_size_t) > sizeof (test_ulong_t))
208 fprintf(new, "#define SIZE_T_FMT \"%%llu\"\n");
209 else if (sizeof(test_size_t) > sizeof (test_uint_t))
210 fprintf(new, "#define SIZE_T_FMT \"%%lu\"\n");
212 fprintf(new, "#define SIZE_T_FMT \"%%u\"\n");
214 if (sizeof(test_ssize_t) > sizeof(test_long_t))
215 fprintf(new, "#define SSIZE_T_FMT \"%%lld\"\n");
216 else if (sizeof(test_ssize_t) > sizeof(test_int_t))
217 fprintf(new, "#define SSIZE_T_FMT \"%%ld\"\n");
219 fprintf(new, "#define SSIZE_T_FMT \"%%d\"\n");
222 /* Now search the makefile for certain settings */
224 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++)
391 if (strcmp(name, db_opts[i]) == 0)
393 if (use_which_db == i)
394 fprintf(new, "#define %s %.*syes\n", db_opts[i],
395 21 - (int)strlen(db_opts[i]), " ");
397 fprintf(new, "/* %s not set */\n", name);
401 if (i < sizeof(db_opts)/sizeof(char *)) continue;
403 /* EXIM_USER is a special case. We look in the environment for EXIM_USER or
404 EXIM_UID (the latter for backward compatibility with Exim 3). If the value is
405 not numeric, we look up the user, and default the GID if found. Otherwise,
406 EXIM_GROUP or EXIM_GID must be in the environment. */
408 if (strcmp(name, "EXIM_UID") == 0)
414 char *username = NULL;
415 char *groupname = NULL;
417 char *user = getenv("EXIM_USER");
418 char *group = getenv("EXIM_GROUP");
420 if (user == NULL) user = getenv("EXIM_UID");
421 if (group == NULL) group = getenv("EXIM_GID");
425 printf("\n*** EXIM_USER has not been defined in any of the Makefiles in "
426 "the\n \"Local\" directory. Please review your build-time "
427 "configuration.\n\n");
431 while (isspace((unsigned char)(*user))) user++;
434 printf("\n*** EXIM_USER is defined as an empty string in one of the "
435 "files\n in the \"Local\" directory. Please review your build-time"
436 "\n configuration.\n\n");
440 for (s = user; *s != 0; s++)
442 if (iscntrl((unsigned char)(*s)))
444 printf("\n*** EXIM_USER contains the control character 0x%02X in one "
445 "of the files\n in the \"Local\" directory. Please review your "
446 "build-time\n configuration.\n\n", *s);
451 /* Numeric uid given */
453 if (user[strspn(user, "0123456789")] == 0)
455 uid = (uid_t)atoi(user);
458 /* User name given. Normally, we look up the uid right away. However,
459 people building binary distributions sometimes want to retain the name till
460 runtime. This is supported if the name begins "ref:". */
462 else if (strncmp(user, "ref:", 4) == 0)
465 while (isspace(*user)) user++;
473 struct passwd *pw = getpwnam(user);
476 printf("\n*** User \"%s\" (specified in one of the Makefiles) does not "
477 "exist.\n Please review your build-time configuration.\n\n",
487 /* Use explicit group if set. */
491 while (isspace((unsigned char)(*group))) group++;
494 printf("\n*** EXIM_GROUP is defined as an empty string in one of "
495 "the files in the\n \"Local\" directory. ");
498 printf("If you want the Exim group to be taken from the\n "
499 "password data for the Exim user, just remove the EXIM_GROUP "
500 "setting.\n Otherwise, p");
502 else printf("EXIM_USER is defined numerically, so there is no"
503 "\n default for EXIM_GROUP and you must set it explicitly.\n P");
504 printf("lease review your build-time configuration.\n\n");
508 for (s = group; *s != 0; s++)
510 if (iscntrl((unsigned char)(*s)))
512 printf("\n*** EXIM_GROUP contains the control character 0x%02X in one "
513 "of the files\n in the \"Local\" directory. Please review your "
514 "build-time\n configuration.\n\n", *s);
519 /* Group name given. This may be by reference or to be looked up now,
522 if (strncmp(group, "ref:", 4) == 0)
525 while (isspace(*group)) group++;
529 else if (username != NULL)
534 else if (group[strspn(group, "0123456789")] == 0)
536 gid = (gid_t)atoi(group);
541 struct group *gr = getgrnam(group);
544 printf("\n*** Group \"%s\" (specified in one of the Makefiles) does "
545 "not exist.\n Please review your build-time configuration.\n\n",
553 /* Else trouble unless found in passwd file with user */
557 printf("\n*** No group set for Exim. Please review your build-time "
558 "configuration.\n\n");
562 /* security sanity checks
563 if ref: is being used, we can never be sure, but we can take reasonable
564 steps to filter out the most obvious ones. */
566 if ((!uid_not_set && uid == 0) ||
567 ((username != NULL) && (
568 (strcmp(username, "root") == 0) ||
569 (strcmp(username, "toor") == 0) )))
571 printf("\n*** Exim's internal user must not be root.\n\n");
575 /* Output user and group names or uid/gid. When names are set, uid/gid
576 are set to zero but will be replaced at runtime. */
578 if (username != NULL)
579 fprintf(new, "#define EXIM_USERNAME \"%s\"\n", username);
580 if (groupname != NULL)
581 fprintf(new, "#define EXIM_GROUPNAME \"%s\"\n", groupname);
583 fprintf(new, "#define EXIM_UID %d\n", (int)uid);
584 fprintf(new, "#define EXIM_GID %d\n", (int)gid);
588 /* CONFIGURE_OWNER and CONFIGURE_GROUP are special cases. We look in the
589 environment for first. If the value is not numeric, we look up the user or
590 group. A lot of this code is similar to that for EXIM_USER, but it's easier
591 to keep it separate. */
593 if (strcmp(name, "CONFIGURE_OWNER") == 0 ||
594 strcmp(name, "CONFIGURE_GROUP") == 0)
596 int isgroup = name[10] == 'G';
600 const char *username = NULL;
601 const char *user = getenv(name);
603 if (user == NULL) user = "";
604 while (isspace((unsigned char)(*user))) user++;
607 fprintf(new, "/* %s not set */\n", name);
611 for (s = user; *s != 0; s++)
613 if (iscntrl((unsigned char)(*s)))
615 printf("\n*** %s contains the control character 0x%02X in "
616 "one of the files\n in the \"Local\" directory. Please review "
617 "your build-time\n configuration.\n\n", name, *s);
622 /* Numeric uid given */
624 if (user[strspn(user, "0123456789")] == 0)
627 gid = (gid_t)atoi(user);
629 uid = (uid_t)atoi(user);
632 /* Name given. Normally, we look up the uid or gid right away. However,
633 people building binary distributions sometimes want to retain the name till
634 runtime. This is supported if the name begins "ref:". */
636 else if (strncmp(user, "ref:", 4) == 0)
639 while (isspace(*user)) user++;
644 struct group *gr = getgrnam(user);
647 printf("\n*** Group \"%s\" (specified in one of the Makefiles) does not "
648 "exist.\n Please review your build-time configuration.\n\n",
657 struct passwd *pw = getpwnam(user);
660 printf("\n*** User \"%s\" (specified in one of the Makefiles) does not "
661 "exist.\n Please review your build-time configuration.\n\n",
668 /* Output user and group names or uid/gid. When names are set, uid/gid
669 are set to zero but will be replaced at runtime. */
671 if (username != NULL)
674 fprintf(new, "#define CONFIGURE_GROUPNAME \"%s\"\n", username);
676 fprintf(new, "#define CONFIGURE_OWNERNAME \"%s\"\n", username);
680 fprintf(new, "#define CONFIGURE_GROUP %d\n", (int)gid);
682 fprintf(new, "#define CONFIGURE_OWNER %d\n", (int)uid);
686 /* FIXED_NEVER_USERS is another special case. Look up the uid values and
687 create suitable initialization data for a vector. */
689 if (strcmp(name, "FIXED_NEVER_USERS") == 0)
691 char *list = getenv("FIXED_NEVER_USERS");
694 fprintf(new, "#define FIXED_NEVER_USERS 0\n");
702 while (*p != 0) if (*p++ == ':') count++;
704 vector = malloc((count+1) * sizeof(uid_t));
705 vector[0] = (uid_t)count;
707 for (i = 1, j = 0; i <= count; list++, i++)
712 while (*list != 0 && *list != ':') list++;
713 strncpy(name, p, list-p);
720 else if (name[strspn(name, "0123456789")] == 0)
722 vector[j++] = (uid_t)atoi(name);
726 struct passwd *pw = getpwnam(name);
729 printf("\n*** User \"%s\" (specified for FIXED_NEVER_USERS in one of the Makefiles) does not "
730 "exist.\n Please review your build-time configuration.\n\n",
734 vector[j++] = pw->pw_uid;
737 fprintf(new, "#define FIXED_NEVER_USERS %d", j);
738 for (i = 0; i < j; i++) fprintf(new, ", %d", (unsigned int)vector[i]);
745 /* WITH_CONTENT_SCAN is another special case: it must be set if it or
746 EXPERIMENTAL_DCC is set. */
748 if (strcmp(name, "WITH_CONTENT_SCAN") == 0)
750 char *wcs = getenv("WITH_CONTENT_SCAN");
751 char *dcc = getenv("EXPERIMENTAL_DCC");
752 fprintf(new, wcs || dcc
753 ? "#define WITH_CONTENT_SCAN yes\n"
754 : "/* WITH_CONTENT_SCAN not set */\n");
758 /* DISABLE_DKIM is special; must be forced if DISABLE_TLS */
759 if (strcmp(name, "DISABLE_DKIM") == 0)
761 char *d_dkim = getenv("DISABLE_DKIM");
762 char *notls = getenv("DISABLE_TLS");
765 fprintf(new, "#define DISABLE_DKIM yes\n");
767 fprintf(new, "#define DISABLE_DKIM yes /* forced by lack of TLS */\n");
769 fprintf(new, "/* DISABLE_DKIM not set */\n");
773 /* Otherwise, check whether a value exists in the environment. Remember if
774 it is an AUTH setting or SUPPORT_CRYPTEQ. */
776 if ((value = getenv(name)) != NULL)
779 len = 21 - (int)strlen(name);
781 if (strncmp(name, "AUTH_", 5) == 0) have_auth = 1;
782 if (strncmp(name, "SUPPORT_CRYPTEQ", 15) == 0) support_crypteq = 1;
784 /* The text value of LDAP_LIB_TYPE refers to a macro that gets set. */
786 if (strcmp(name, "LDAP_LIB_TYPE") == 0)
788 if (strcmp(value, "NETSCAPE") == 0 ||
789 strcmp(value, "UMICHIGAN") == 0 ||
790 strcmp(value, "OPENLDAP1") == 0 ||
791 strcmp(value, "OPENLDAP2") == 0 ||
792 strcmp(value, "SOLARIS") == 0 ||
793 strcmp(value, "SOLARIS7") == 0) /* Compatibility */
795 fprintf(new, "#define LDAP_LIB_%s\n", value);
799 printf("\n*** LDAP_LIB_TYPE=%s is not a recognized LDAP library type."
800 "\n*** Please review your build-time configuration.\n\n", value);
805 else if (strcmp(name, "RADIUS_LIB_TYPE") == 0)
807 if (strcmp(value, "RADIUSCLIENT") == 0 ||
808 strcmp(value, "RADIUSCLIENTNEW") == 0 ||
809 strcmp(value, "RADLIB") == 0)
811 fprintf(new, "#define RADIUS_LIB_%s\n", value);
815 printf("\n*** RADIUS_LIB_TYPE=%s is not a recognized RADIUS library type."
816 "\n*** Please review your build-time configuration.\n\n", value);
821 /* Other macros get set to the environment value. */
825 fprintf(new, "#define %s ", name);
826 while(len-- > 0) fputc(' ', new);
828 /* LOG_FILE_PATH is now messy because it can be a path containing %s or
829 it can be "syslog" or ":syslog" or "syslog:path" or even "path:syslog". */
831 if (strcmp(name, "LOG_FILE_PATH") == 0)
837 char *sss = strchr(ss, ':');
840 strncpy(buffer, ss, sss-ss);
841 buffer[sss-ss] = 0; /* For empty case */
845 strncpy(buffer, ss, sizeof(buffer));
846 buffer[sizeof(buffer)-1] = 0;
848 pp = buffer + (int)strlen(buffer);
849 while (pp > buffer && isspace((unsigned char)pp[-1])) pp--;
851 if (buffer[0] != 0 && strcmp(buffer, "syslog") != 0)
852 check_percent_ess(buffer, name);
853 if (sss == NULL) break;
855 while (isspace((unsigned char)*ss)) ss++;
857 fprintf(new, "\"%s\"\n", value);
860 /* Timezone values HEADERS_CHARSET, TCP_WRAPPERS_DAEMON_NAME and
861 WHITELIST_D_MACROS get quoted */
863 else if (strcmp(name, "TIMEZONE_DEFAULT") == 0||
864 strcmp(name, "TCP_WRAPPERS_DAEMON_NAME") == 0||
865 strcmp(name, "HEADERS_CHARSET") == 0||
866 strcmp(name, "WHITELIST_D_MACROS") == 0)
867 fprintf(new, "\"%s\"\n", value);
869 /* GnuTLS constants; first is for debugging, others are tuning */
871 /* less than 0 is not-active; 0-9 are normal, API suggests higher
872 taken without problems */
873 else if (strcmp(name, "EXIM_GNUTLS_LIBRARY_LOG_LEVEL") == 0)
877 nv = strtol(value, &end, 10);
878 if (end != value && *end == '\0' && nv >= -1 && nv <= 100)
880 fprintf(new, "%s\n", value);
884 printf("Value of %s should be -1..9\n", name);
889 /* how many bits Exim, as a client, demands must be in D-H */
890 /* 1024 is a historical figure; some sites actually use lower, so we
891 permit the value to be lowered "dangerously" low, but not "insanely"
892 low. Though actually, 1024 is becoming "dangerous". */
893 else if ((strcmp(name, "EXIM_CLIENT_DH_MIN_MIN_BITS") == 0) ||
894 (strcmp(name, "EXIM_CLIENT_DH_DEFAULT_MIN_BITS") == 0) ||
895 (strcmp(name, "EXIM_SERVER_DH_BITS_PRE2_12") == 0))
899 nv = strtol(value, &end, 10);
900 if (end != value && *end == '\0' && nv >= 512 && nv < 500000)
902 fprintf(new, "%s\n", value);
906 printf("Unreasonable value (%s) of \"%s\".\n", value, name);
911 /* For others, quote any paths and don't quote anything else */
915 if (value[0] == '/') fprintf(new, "\"%s\"\n", value);
916 else fprintf(new, "%s\n", value);
921 /* Value not defined in the environment; use the default */
926 while (*p == ' ' || *p == '\t') p++;
927 if (*p != '\n') fputs(buffer, new); else
930 if (strcmp(name, "BIN_DIRECTORY") == 0 ||
931 strcmp(name, "CONFIGURE_FILE") == 0)
933 printf("\n*** %s has not been defined in any of the Makefiles in the\n"
934 " \"Local\" directory. "
935 "Please review your build-time configuration.\n\n", name);
939 if (strcmp(name, "TIMEZONE_DEFAULT") == 0)
941 char *tz = getenv("TZ");
942 fprintf(new, "#define TIMEZONE_DEFAULT ");
943 if (tz == NULL) fprintf(new, "NULL\n"); else
944 fprintf(new, "\"%s\"\n", tz);
947 else fprintf(new, "/* %s not set */\n", name);
954 /* If any AUTH macros were defined, ensure that SUPPORT_CRYPTEQ is also
958 if (!support_crypteq) fprintf(new, "/* Force SUPPORT_CRYPTEQ for AUTH */\n"
959 "#define SUPPORT_CRYPTEQ\n");
961 /* Check poll() for timer functionality.
962 Some OS' have released with it broken. */
965 struct timeval before, after;
968 gettimeofday(&before, NULL);
969 (void) poll(NULL, 0, 500);
970 gettimeofday(&after, NULL);
972 us = (after.tv_sec - before.tv_sec) * 1000000 +
973 (after.tv_usec - before.tv_usec);
976 fprintf(new, "#define NO_POLL_H\n");
981 fprintf(new, "\n/* End of config.h */\n");
986 /* End of buildconfig.c */