From: Manoj Kasichainula Date: Mon, 29 Nov 1999 23:33:24 +0000 (+0000) Subject: The first part of the big autoconf patch. This replaces a bunch of X-Git-Tag: 1.3.10~148 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a7a251cb299582b1bc37bc939fecf2dbe5324afb;p=apache The first part of the big autoconf patch. This replaces a bunch of NEED_* macros with HAVE_* macros to be more consistent with autoconf. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@84186 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/include/ap_config.h b/include/ap_config.h index 116156cb24..82fc5dd67b 100644 --- a/include/ap_config.h +++ b/include/ap_config.h @@ -118,7 +118,7 @@ stat() properly */ #endif #if !defined(QNX) && !defined(MPE) && !defined(WIN32) && !defined(TPF) -#include +/* #include */ #endif /* Define one of these according to your system. */ @@ -1352,29 +1352,80 @@ long vfprintf(FILE *, const char *, va_list); #endif /* SUNOS_LIB_PROTOTYPES */ +/* + * Transition macros from old-style configuration to autoconf + */ +#ifndef HAVE_CONFIG_H + +#if !defined(NO_KILLPG) && !defined(HAVE_KILLPG) +#define HAVE_KILLPG +#endif + +#if !defined(NEED_STRDUP) && !defined(HAVE_STRDUP) +#define HAVE_STRDUP +#endif + +#if !defined(NEED_STRCASECMP) && !defined(HAVE_STRCASECMP) +#define HAVE_STRCASECMP +#endif + +#if !defined(NEED_STRNCASECMP) && !defined(HAVE_STRNCASECMP) +#define HAVE_STRNCASECMP +#endif + +#if !defined(NEED_STRSTR) && !defined(HAVE_STRSTR) +#define HAVE_STRSTR +#endif + +#if !defined(NEED_INITGROUPS) && !defined(HAVE_INITGROUPS) +#define HAVE_INITGROUPS +#endif + +#if !defined(NEED_WAITPID) && !defined(HAVE_WAITPID) +#define HAVE_WAITPID +#endif + +#if !defined(NEED_STRERROR) && !defined(HAVE_STRERROR) +#define HAVE_STRERROR +#endif + +#if !defined(NEED_DIFFTIME) && !defined(HAVE_DIFFTIME) +#define HAVE_DIFFTIME +#endif + +#if !defined(NEED_GETTIMEOFDAY) && !defined(HAVE_GETTIMEOFDAY) +#define HAVE_GETTIMEOFDAY +#endif + +#if !defined(NEED_SETSID) && !defined(HAVE_SETSID) +#define HAVE_SETSID +#endif + +#endif /* HAVE_CONFIG_H */ + /* The assumption is that when the functions are missing, * then there's no matching prototype available either. * Declare what is needed exactly as the replacement routines implement it. */ -#ifdef NEED_STRDUP +#ifndef HAVE_STRDUP extern char *strdup (const char *str); #endif -#ifdef NEED_STRCASECMP +#ifndef HAVE_STRCASECMP extern int strcasecmp (const char *a, const char *b); #endif -#ifdef NEED_STRNCASECMP +#ifndef HAVE_STRNCASECMP extern int strncasecmp (const char *a, const char *b, int n); #endif -#ifdef NEED_INITGROUPS +#ifndef HAVE_INITGROUPS extern int initgroups(const char *name, gid_t basegid); #endif -#ifdef NEED_WAITPID +#ifndef HAVE_WAITPID extern int waitpid(pid_t pid, int *statusp, int options); #endif -#ifdef NEED_STRERROR +#ifndef HAVE_STRERROR extern char *strerror (int err); #endif -#ifdef NEED_DIFFTIME +#ifndef HAVE_DIFFTIME extern double difftime(time_t time1, time_t time0); #endif diff --git a/modules/metadata/mod_unique_id.c b/modules/metadata/mod_unique_id.c index 5a0cac3d3d..aad98adc67 100644 --- a/modules/metadata/mod_unique_id.c +++ b/modules/metadata/mod_unique_id.c @@ -168,7 +168,7 @@ static void unique_id_global_init(server_rec *s, ap_context_t *p) #endif char str[MAXHOSTNAMELEN + 1]; struct hostent *hent; -#ifndef NO_GETTIMEOFDAY +#ifdef HAVE_GETTIMEOFDAY struct timeval tv; #endif @@ -231,7 +231,7 @@ static void unique_id_global_init(server_rec *s, ap_context_t *p) * But protecting against it is relatively cheap. We just sleep into the * next second. */ -#ifdef NO_GETTIMEOFDAY +#ifndef HAVE_GETTIMEOFDAY sleep(1); #else if (gettimeofday(&tv, NULL) == -1) { @@ -248,7 +248,7 @@ static void unique_id_global_init(server_rec *s, ap_context_t *p) static void unique_id_child_init(server_rec *s, ap_context_t *p) { pid_t pid; -#ifndef NO_GETTIMEOFDAY +#ifdef HAVE_GETTIMEOFDAY struct timeval tv; #endif @@ -282,7 +282,7 @@ static void unique_id_child_init(server_rec *s, ap_context_t *p) * against restart problems, and a little less protection against a clock * going backwards in time. */ -#ifndef NO_GETTIMEOFDAY +#ifdef HAVE_GETTIMEOFDAY if (gettimeofday(&tv, NULL) == -1) { cur_unique_id.counter = 0; } diff --git a/modules/metadata/mod_usertrack.c b/modules/metadata/mod_usertrack.c index 2828352d3a..6e46bb89e1 100644 --- a/modules/metadata/mod_usertrack.c +++ b/modules/metadata/mod_usertrack.c @@ -132,7 +132,7 @@ static void make_cookie(request_rec *r) { cookie_log_state *cls = ap_get_module_config(r->server->module_config, &usertrack_module); -#if defined(NO_GETTIMEOFDAY) && !defined(NO_TIMES) +#if !defined(HAVE_GETTIMEOFDAY) && !defined(NO_TIMES) clock_t mpe_times; struct tms mpe_tms; #elif !defined(WIN32) @@ -148,7 +148,7 @@ static void make_cookie(request_rec *r) dcfg = ap_get_module_config(r->per_dir_config, &usertrack_module); -#if defined(NO_GETTIMEOFDAY) && !defined(NO_TIMES) +#if !defined(HAVE_GETTIMEOFDAY) && !defined(NO_TIMES) /* We lack gettimeofday(), so we must use time() to obtain the epoch seconds, and then times() to obtain CPU clock ticks (milliseconds). Combine this together to obtain a hopefully unique cookie ID. */ diff --git a/os/beos/beosd.h b/os/beos/beosd.h index 868fba1581..b65cc661b9 100644 --- a/os/beos/beosd.h +++ b/os/beos/beosd.h @@ -85,6 +85,8 @@ const char *beosd_set_group(cmd_parms *cmd, void *dummy, char *arg); #define INIT_SIGLIST() /* nothing */ +#define beosd_killpg(x, y) (kill (-(x), (y))) + #define UNIX_DAEMON_COMMANDS \ { "User", beosd_set_user, NULL, RSRC_CONF, TAKE1, \ "Effective user id for this server"}, \ diff --git a/os/unix/unixd.c b/os/unix/unixd.c index 7a6b3add09..ee817c491a 100644 --- a/os/unix/unixd.c +++ b/os/unix/unixd.c @@ -82,7 +82,7 @@ void unixd_detach(void) } RAISE_SIGSTOP(DETACH); #endif -#ifndef NO_SETSID +#ifdef HAVE_SETSID if ((pgrp = setsid()) == -1) { perror("setsid"); ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, diff --git a/os/unix/unixd.h b/os/unix/unixd.h index 0f26ed04db..733c90b927 100644 --- a/os/unix/unixd.h +++ b/os/unix/unixd.h @@ -89,7 +89,10 @@ const char *unixd_set_group(cmd_parms *cmd, void *dummy, char *arg); #ifdef SYS_SIGLIST /* platform has sys_siglist[] */ #define INIT_SIGLIST() /* nothing */ -#else /* platform has no sys_siglist[], define our own */ +#elif defined(SYS_SIGLIST_DECLARED) /* from autoconf */ +#define INIT_SIGLIST() /* nothing */ +#define SYS_SIGLIST sys_siglist +#else #define NEED_AP_SYS_SIGLIST extern const char *ap_sys_siglist[NumSIG]; #define SYS_SIGLIST ap_sys_siglist @@ -97,6 +100,12 @@ void unixd_siglist_init(void); #define INIT_SIGLIST() unixd_siglist_init(); #endif /* platform has sys_siglist[] */ +#ifdef HAVE_KILLPG +#define unixd_killpg(x, y) (killpg ((x), (y))) +#else /* HAVE_KILLPG */ +#define unixd_killpg(x, y) (kill (-(x), (y))) +#endif /* HAVE_KILLPG */ + #define UNIX_DAEMON_COMMANDS \ { "User", unixd_set_user, NULL, RSRC_CONF, TAKE1, \ "Effective user id for this server"}, \ diff --git a/os/win32/os.h b/os/win32/os.h index 4b3593929b..f0c5831253 100644 --- a/os/win32/os.h +++ b/os/win32/os.h @@ -98,10 +98,9 @@ #endif #define CASE_BLIND_FILESYSTEM #define NO_WRITEV -#define NO_SETSID #define NO_USE_SIGACTION #define NO_TIMES -#define NO_GETTIMEOFDAY +/* #undef HAVE_GETTIMEOFDAY */ #define USE_LONGJMP #define HAVE_MMAP #define USE_MMAP_SCOREBOARD diff --git a/server/mpm/dexter/dexter.c b/server/mpm/dexter/dexter.c index bdf1d61495..c7146de8f3 100644 --- a/server/mpm/dexter/dexter.c +++ b/server/mpm/dexter/dexter.c @@ -1392,7 +1392,7 @@ int ap_mpm_run(ap_context_t *_pconf, ap_context_t *plog, server_rec *s) /* Time to gracefully shut down: * Kill child processes, tell them to call child_exit, etc... */ - if (ap_killpg(getpgrp(), SIGTERM) < 0) { + if (unixd_killpg(getpgrp(), SIGTERM) < 0) { ap_log_error(APLOG_MARK, APLOG_WARNING, errno, server_conf, "killpg SIGTERM"); } @@ -1453,7 +1453,7 @@ int ap_mpm_run(ap_context_t *_pconf, ap_context_t *plog, server_rec *s) * and a SIGHUP, we may as well use the same signal, because some user * pthreads are stealing signals from us left and right. */ - if (ap_killpg(getpgrp(), SIGTERM) < 0) { + if (unixd_killpg(getpgrp(), SIGTERM) < 0) { ap_log_error(APLOG_MARK, APLOG_WARNING, errno, server_conf, "killpg SIGTERM"); } diff --git a/server/mpm/mpmt_beos/mpmt_beos.c b/server/mpm/mpmt_beos/mpmt_beos.c index 662bdaa849..a26db6a4cc 100644 --- a/server/mpm/mpmt_beos/mpmt_beos.c +++ b/server/mpm/mpmt_beos/mpmt_beos.c @@ -1119,7 +1119,7 @@ int ap_mpm_run(ap_context_t *_pconf, ap_context_t *plog, server_rec *s) /* Time to gracefully shut down: * Kill child processes, tell them to call child_exit, etc... */ - if (ap_killpg(getpgrp(), SIGTERM) < 0) { + if (beosd_killpg(getpgrp(), SIGTERM) < 0) { ap_log_error(APLOG_MARK, APLOG_WARNING, errno, server_conf, "killpg SIGTERM"); } @@ -1175,7 +1175,7 @@ int ap_mpm_run(ap_context_t *_pconf, ap_context_t *plog, server_rec *s) * and a SIGHUP, we may as well use the same signal, because some user * pthreads are stealing signals from us left and right. */ - if (ap_killpg(getpgrp(), SIGTERM) < 0) { + if (beosd_killpg(getpgrp(), SIGTERM) < 0) { ap_log_error(APLOG_MARK, APLOG_WARNING, errno, server_conf, "killpg SIGTERM"); } diff --git a/server/mpm/mpmt_pthread/mpmt_pthread.c b/server/mpm/mpmt_pthread/mpmt_pthread.c index 26dedf1156..c2f2446546 100644 --- a/server/mpm/mpmt_pthread/mpmt_pthread.c +++ b/server/mpm/mpmt_pthread/mpmt_pthread.c @@ -1406,7 +1406,7 @@ int ap_mpm_run(ap_context_t *_pconf, ap_context_t *plog, server_rec *s) /* Time to gracefully shut down: * Kill child processes, tell them to call child_exit, etc... */ - if (ap_killpg(getpgrp(), SIGTERM) < 0) { + if (unixd_killpg(getpgrp(), SIGTERM) < 0) { ap_log_error(APLOG_MARK, APLOG_WARNING, errno, server_conf, "killpg SIGTERM"); } reclaim_child_processes(1); /* Start with SIGTERM */ @@ -1477,7 +1477,7 @@ int ap_mpm_run(ap_context_t *_pconf, ap_context_t *plog, server_rec *s) * and a SIGHUP, we may as well use the same signal, because some user * pthreads are stealing signals from us left and right. */ - if (ap_killpg(getpgrp(), SIGTERM) < 0) { + if (unixd_killpg(getpgrp(), SIGTERM) < 0) { ap_log_error(APLOG_MARK, APLOG_WARNING, errno, server_conf, "killpg SIGTERM"); } reclaim_child_processes(1); /* Start with SIGTERM */ diff --git a/server/mpm/mpmt_pthread/scoreboard.h b/server/mpm/mpmt_pthread/scoreboard.h index a5beeb1131..c534350a76 100644 --- a/server/mpm/mpmt_pthread/scoreboard.h +++ b/server/mpm/mpmt_pthread/scoreboard.h @@ -147,7 +147,7 @@ typedef struct { unsigned long my_bytes_served; unsigned long conn_bytes; unsigned short conn_count; -#if defined(NO_GETTIMEOFDAY) +#ifndef HAVE_GETTIMEOFDAY clock_t start_time; clock_t stop_time; #else diff --git a/server/mpm/prefork/prefork.c b/server/mpm/prefork/prefork.c index 883050ee99..3f0f87d963 100644 --- a/server/mpm/prefork/prefork.c +++ b/server/mpm/prefork/prefork.c @@ -1474,7 +1474,7 @@ static void update_scoreboard_global(void) void ap_time_process_request(int child_num, int status) { short_score *ss; -#if defined(NO_GETTIMEOFDAY) && !defined(NO_TIMES) +#if !defined(HAVE_GETTIMEOFDAY) && !defined(NO_TIMES) struct tms tms_blk; #endif @@ -1485,7 +1485,7 @@ void ap_time_process_request(int child_num, int status) ss = &ap_scoreboard_image->servers[child_num]; if (status == START_PREQUEST) { -#if defined(NO_GETTIMEOFDAY) +#if !defined(HAVE_GETTIMEOFDAY) #ifndef NO_TIMES if ((ss->start_time = times(&tms_blk)) == -1) #endif /* NO_TIMES */ @@ -1497,7 +1497,7 @@ void ap_time_process_request(int child_num, int status) #endif } else if (status == STOP_PREQUEST) { -#if defined(NO_GETTIMEOFDAY) +#if !defined(HAVE_GETTIMEOFDAY) #ifndef NO_TIMES if ((ss->stop_time = times(&tms_blk)) == -1) #endif @@ -2702,7 +2702,7 @@ int ap_mpm_run(ap_context_t *_pconf, ap_context_t *plog, server_rec *s) /* Time to gracefully shut down: * Kill child processes, tell them to call child_exit, etc... */ - if (ap_killpg(getpgrp(), SIGTERM) < 0) { + if (unixd_killpg(getpgrp(), SIGTERM) < 0) { ap_log_error(APLOG_MARK, APLOG_WARNING, errno, server_conf, "killpg SIGTERM"); } reclaim_child_processes(1); /* Start with SIGTERM */ @@ -2748,7 +2748,7 @@ int ap_mpm_run(ap_context_t *_pconf, ap_context_t *plog, server_rec *s) "SIGUSR1 received. Doing graceful restart"); /* kill off the idle ones */ - if (ap_killpg(getpgrp(), SIGUSR1) < 0) { + if (unixd_killpg(getpgrp(), SIGUSR1) < 0) { ap_log_error(APLOG_MARK, APLOG_WARNING, errno, server_conf, "killpg SIGUSR1"); } #ifndef SCOREBOARD_FILE @@ -2767,7 +2767,7 @@ int ap_mpm_run(ap_context_t *_pconf, ap_context_t *plog, server_rec *s) } else { /* Kill 'em off */ - if (ap_killpg(getpgrp(), SIGHUP) < 0) { + if (unixd_killpg(getpgrp(), SIGHUP) < 0) { ap_log_error(APLOG_MARK, APLOG_WARNING, errno, server_conf, "killpg SIGHUP"); } reclaim_child_processes(0); /* Not when just starting up */ diff --git a/server/mpm/prefork/scoreboard.h b/server/mpm/prefork/scoreboard.h index a8f88e3f39..9c60a7f50d 100644 --- a/server/mpm/prefork/scoreboard.h +++ b/server/mpm/prefork/scoreboard.h @@ -142,7 +142,7 @@ typedef struct { unsigned long my_bytes_served; unsigned long conn_bytes; unsigned short conn_count; -#if defined(NO_GETTIMEOFDAY) +#if !defined(HAVE_GETTIMEOFDAY) clock_t start_time; clock_t stop_time; #else diff --git a/server/mpm/spmt_os2/scoreboard.h b/server/mpm/spmt_os2/scoreboard.h index bd6b54f380..762c2ffc8b 100644 --- a/server/mpm/spmt_os2/scoreboard.h +++ b/server/mpm/spmt_os2/scoreboard.h @@ -136,7 +136,7 @@ typedef struct { unsigned long my_bytes_served; unsigned long conn_bytes; unsigned short conn_count; -#if defined(NO_GETTIMEOFDAY) +#if !defined(HAVE_GETTIMEOFDAY) clock_t start_time; clock_t stop_time; #else diff --git a/server/mpm/spmt_os2/spmt_os2.c b/server/mpm/spmt_os2/spmt_os2.c index 75de4becb6..109dbb8ab6 100644 --- a/server/mpm/spmt_os2/spmt_os2.c +++ b/server/mpm/spmt_os2/spmt_os2.c @@ -429,7 +429,7 @@ int ap_update_child_status(int child_num, int status, request_rec *r) void ap_time_process_request(int child_num, int status) { short_score *ss; -#if defined(NO_GETTIMEOFDAY) && !defined(NO_TIMES) +#if !defined(HAVE_GETTIMEOFDAY) && !defined(NO_TIMES) struct tms tms_blk; #endif @@ -439,7 +439,7 @@ void ap_time_process_request(int child_num, int status) ss = &ap_scoreboard_image->servers[child_num]; if (status == START_PREQUEST) { -#if defined(NO_GETTIMEOFDAY) +#if !defined(HAVE_GETTIMEOFDAY) #ifndef NO_TIMES if ((ss->start_time = times(&tms_blk)) == -1) #endif /* NO_TIMES */ @@ -451,7 +451,7 @@ void ap_time_process_request(int child_num, int status) #endif } else if (status == STOP_PREQUEST) { -#if defined(NO_GETTIMEOFDAY) +#if !defined(HAVE_GETTIMEOFDAY) #ifndef NO_TIMES if ((ss->stop_time = times(&tms_blk)) == -1) #endif diff --git a/server/util.c b/server/util.c index 8f797b1b40..28d45b1b79 100644 --- a/server/util.c +++ b/server/util.c @@ -1700,7 +1700,7 @@ API_EXPORT(int) ap_is_url(const char *u) return (x ? 1 : 0); /* If the first character is ':', it's broken, too */ } -#ifdef NEED_STRDUP +#ifndef HAVE_STRDUP char *strdup(const char *str) { char *sdup; @@ -1716,7 +1716,7 @@ char *strdup(const char *str) #endif /* The following two routines were donated for SVR4 by Andreas Vogel */ -#ifdef NEED_STRCASECMP +#ifndef HAVE_STRCASECMP int strcasecmp(const char *a, const char *b) { const char *p = a; @@ -1735,7 +1735,7 @@ int strcasecmp(const char *a, const char *b) #endif -#ifdef NEED_STRNCASECMP +#ifndef HAVE_STRNCASECMP int strncasecmp(const char *a, const char *b, int n) { const char *p = a; @@ -1756,7 +1756,7 @@ int strncasecmp(const char *a, const char *b, int n) #endif /* The following routine was donated for UTS21 by dwd@bell-labs.com */ -#ifdef NEED_STRSTR +#ifndef HAVE_STRSTR char *strstr(char *s1, char *s2) { char *p1, *p2; @@ -1785,7 +1785,7 @@ char *strstr(char *s1, char *s2) } #endif -#ifdef NEED_INITGROUPS +#ifndef HAVE_INITGROUPS int initgroups(const char *name, gid_t basegid) { #if defined(QNX) || defined(MPE) || defined(BEOS) || defined(_OSD_POSIX) || defined(TPF) || defined(__TANDEM) @@ -1816,7 +1816,7 @@ int initgroups(const char *name, gid_t basegid) } #endif /* def NEED_INITGROUPS */ -#ifdef NEED_WAITPID +#ifndef HAVE_WAITPID /* From ikluft@amdahl.com * this is not ideal but it works for SVR3 variants * Modified by dwd@bell-labs.com to call wait3 instead of wait because @@ -2094,7 +2094,7 @@ char *ap_double_quotes(ap_context_t *p, char *str) #endif -#ifdef NEED_STRERROR +#ifndef HAVE_STRERROR char * strerror(int err) { @@ -2107,7 +2107,7 @@ char * } #endif -#if defined(NEED_DIFFTIME) +#ifndef HAVE_DIFFTIME double difftime(time_t time1, time_t time0) { return (time1 - time0);