]> granicus.if.org Git - apache/commitdiff
The first part of the big autoconf patch. This replaces a bunch of
authorManoj Kasichainula <manoj@apache.org>
Mon, 29 Nov 1999 23:33:24 +0000 (23:33 +0000)
committerManoj Kasichainula <manoj@apache.org>
Mon, 29 Nov 1999 23:33:24 +0000 (23:33 +0000)
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

16 files changed:
include/ap_config.h
modules/metadata/mod_unique_id.c
modules/metadata/mod_usertrack.c
os/beos/beosd.h
os/unix/unixd.c
os/unix/unixd.h
os/win32/os.h
server/mpm/dexter/dexter.c
server/mpm/mpmt_beos/mpmt_beos.c
server/mpm/mpmt_pthread/mpmt_pthread.c
server/mpm/mpmt_pthread/scoreboard.h
server/mpm/prefork/prefork.c
server/mpm/prefork/scoreboard.h
server/mpm/spmt_os2/scoreboard.h
server/mpm/spmt_os2/spmt_os2.c
server/util.c

index 116156cb24f4fe1c5f567be5ffe3a82cf7aa2b63..82fc5dd67bbb2eb2d6d290b4327202fc87a7ccd0 100644 (file)
@@ -118,7 +118,7 @@ stat() properly */
 #endif
 
 #if !defined(QNX) && !defined(MPE) && !defined(WIN32) && !defined(TPF)
-#include <sys/param.h>
+/* #include <sys/param.h> */
 #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
 
index 5a0cac3d3d63092e525b97887586fa9aec3c1f45..aad98adc6782c1edcf2c899a6403275d4a403b6b 100644 (file)
@@ -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;
     }
index 2828352d3aa9f593f4b28e1357e880ac1b73e9ea..6e46bb89e102d78e3dd8da06853ed2f5e5bee0af 100644 (file)
@@ -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. */
index 868fba15810764b66b712593ecc9291538a1a9ce..b65cc661b9d014377a6945bb557c478b2432c1ee 100644 (file)
@@ -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"}, \
index 7a6b3add09841a4c40d494814576c26053743cfc..ee817c491ada65ca06e9e539615894a89aa8b9d0 100644 (file)
@@ -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, 
index 0f26ed04db0c380e98b900a760549538cdb94fd1..733c90b9278fd9cdad1c72b82d0d7b42a003f8d1 100644 (file)
@@ -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"}, \
index 4b3593929bc2837fec2da2149691198f36e9f50c..f0c58312536a5497db94e81c0904e7f689aa8189 100644 (file)
 #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
index bdf1d61495c7715c3ffb13b76ffc94ea08abebbf..c7146de8f34a77dd937cf12f0a269eabada492f4 100644 (file)
@@ -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");
        }
index 662bdaa8496e71668719eac54ccaace742acfe22..a26db6a4cc59f358d3be836d0615063eb95be8ae 100644 (file)
@@ -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");
        }
index 26dedf1156db8d522eb0cbff3257170f3650ef7b..c2f244654624fc17857814d0e2f0e58c2b8ca4f0 100644 (file)
@@ -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 */
index a5beeb1131b63d6a167cd9a02dcce3813a671196..c534350a768ead4d8c39b45c1df0b9983e33e001 100644 (file)
@@ -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
index 883050ee9937002b75bbb486810b3cbe3bc83011..3f0f87d96377b314c3edf33771998dbafa2a6942 100644 (file)
@@ -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 */
index a8f88e3f394c8514868d7d5c13f4dd6635b6d80f..9c60a7f50dd21913ff5d1582535cf2daa4d4fe25 100644 (file)
@@ -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
index bd6b54f380ee9710d9944784dea7e95a7307e0e1..762c2ffc8b188b3c161e75b0b90cac6dd6ef6124 100644 (file)
@@ -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
index 75de4becb6cb29f7ab624c322e3e821d184f7f8e..109dbb8ab6c2309afdd942ddea9c89f97451bf31 100644 (file)
@@ -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
index 8f797b1b406c08c052b59c053d0d58b7d180356a..28d45b1b79b765c4ec99498e716b5c678926a9da 100644 (file)
@@ -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);