nginx-0.1.0-2004-09-29-20:00:49 import; remove years from copyright
Igor Sysoev
17 years ago
0 | ||
1 | # Copyright (C) Igor Sysoev | |
2 | ||
0 | 3 | |
1 | 4 | CFLAGS="$CFLAGS $CC_OPT" |
2 | 5 | |
24 | 27 | # optimize for Pentium 4, gcc 3.x |
25 | 28 | CPU_OPT="-march=pentium4" |
26 | 29 | ;; |
30 | ||
31 | sparc64) | |
32 | # build 64-bit binary, sparcv9 only | |
33 | CPU_OPT="-m64" | |
34 | ;; | |
35 | ||
27 | 36 | esac |
28 | 37 | |
29 | 38 | # STUB for batch builds |
0 | 0 | #!/bin/sh |
1 | ||
2 | # Copyright (C) Igor Sysoev | |
3 | ||
1 | 4 | |
2 | 5 | . auto/options |
3 | 6 | . auto/init |
42 | 45 | have=NGX_SBIN_PATH value="\"$SBIN_PATH\"" . auto/define |
43 | 46 | have=NGX_CONF_PATH value="\"$CONF_PATH\"" . auto/define |
44 | 47 | have=NGX_PID_PATH value="\"$PID_PATH\"" . auto/define |
45 | have=NGX_ERROR_LOG_PATH value="\"$ERROR_LOG_PATH\"" . auto/define | |
48 | if [ ".$NGX_ERROR_LOG_PATH" != "." ]; then | |
49 | have=NGX_ERROR_LOG_PATH value="\"$ERROR_LOG_PATH\"" . auto/define | |
50 | fi | |
46 | 51 | have=NGX_HTTP_LOG_PATH value="\"$HTTP_LOG_PATH\"" . auto/define |
47 | 52 | |
48 | 53 | . auto/summary |
0 | ||
1 | # Copyright (C) Igor Sysoev | |
2 | ||
0 | 3 | |
1 | 4 | echo $ngx_n "checking for system endianess ..." $ngx_c |
2 | 5 | echo >> $NGX_ERR |
0 | ||
1 | # Copyright (C) Igor Sysoev | |
2 | ||
0 | 3 | |
1 | 4 | echo $ngx_n "checking for $ngx_feature ..." $ngx_c |
2 | 5 | echo >> $NGX_ERR |
0 | ||
1 | # Copyright (C) Igor Sysoev | |
2 | ||
0 | 3 | |
1 | 4 | echo $ngx_n "checking for $ngx_type printf() format ..." $ngx_c |
2 | 5 | echo >> $NGX_ERR |
0 | ||
1 | # Copyright (C) Igor Sysoev | |
2 | ||
0 | 3 | |
1 | 4 | echo $ngx_n "checking for $ngx_type printf() format ..." $ngx_c |
2 | 5 | echo >> $NGX_ERR |
0 | ||
1 | # Copyright (C) Igor Sysoev | |
2 | ||
0 | 3 | |
1 | 4 | echo $ngx_n "checking for $ngx_func ..." $ngx_c |
2 | 5 | echo >> $NGX_ERR |
0 | ||
1 | # Copyright (C) Igor Sysoev | |
2 | ||
0 | 3 | |
1 | 4 | ngx_inc="unistd.h"; . auto/inc |
2 | 5 | ngx_inc="inttypes.h"; . auto/inc |
0 | ||
1 | # Copyright (C) Igor Sysoev | |
2 | ||
0 | 3 | |
1 | 4 | echo $ngx_n "checking for $ngx_inc ..." $ngx_c |
2 | 5 | echo >> $NGX_ERR |
0 | ||
1 | # Copyright (C) Igor Sysoev | |
2 | ||
0 | 3 | |
1 | 4 | cat << END >> $MAKEFILE |
2 | 5 | install: |
17 | 20 | cp conf/nginx.conf `dirname $CONF_PATH`/nginx.conf.default |
18 | 21 | |
19 | 22 | test -d `dirname $PID_PATH` || mkdir -p `dirname $PID_PATH` |
20 | test -d `dirname $ERROR_LOG_PATH` || mkdir -p `dirname $ERROR_LOG_PATH` | |
23 | ||
21 | 24 | test -d `dirname $HTTP_LOG_PATH` || mkdir -p `dirname $HTTP_LOG_PATH` |
22 | 25 | |
23 | 26 | test -d $PREFIX/html || cp -r html $PREFIX |
24 | 27 | |
25 | 28 | #test -d $PREFIX/temp || mkdir -p $PREFIX/temp |
26 | 29 | END |
30 | ||
31 | ||
32 | if [ ".$ERROR_LOG_PATH" != "." ]; then | |
33 | cat << END >> $MAKEFILE | |
34 | ||
35 | test -d `dirname $ERROR_LOG_PATH` || mkdir -p `dirname $ERROR_LOG_PATH` | |
36 | END | |
37 | ||
38 | fi | |
27 | 39 | |
28 | 40 | |
29 | 41 | if test ! -f Makefile; then |
0 | ||
1 | # Copyright (C) Igor Sysoev | |
2 | ||
0 | 3 | |
1 | 4 | if [ $PCRE != NONE -a $PCRE != NO -a $PCRE != YES ]; then |
2 | 5 | . auto/lib/pcre/make |
0 | ||
1 | # Copyright (C) Igor Sysoev | |
2 | ||
0 | 3 | |
1 | 4 | CFLAGS = -nologo -MT -O2 -Ob1 -Oi -Gs $(LIBC) $(CPU_OPT) -D L_ENDIAN |
2 | 5 |
0 | ||
1 | # Copyright (C) Igor Sysoev | |
2 | ||
0 | 3 | |
1 | 4 | if [ $OPENSSL != NONE ]; then |
2 | 5 | CORE_INCS="$CORE_INCS $OPENSSL/include" |
0 | ||
1 | # Copyright (C) Igor Sysoev | |
2 | ||
0 | 3 | |
1 | 4 | CFLAGS = -q -O2 -tWM $(CPU_OPT) |
2 | 5 | PCREFLAGS = -DPCRE_STATIC -DPOSIX_MALLOC_THRESHOLD=10 |
0 | ||
1 | # Copyright (C) Igor Sysoev | |
2 | ||
0 | 3 | |
1 | 4 | CFLAGS = -O2 -Ob1 -Oi -Gs $(LIBC) $(CPU_OPT) |
2 | 5 | PCREFLAGS = -DPCRE_STATIC -DPOSIX_MALLOC_THRESHOLD=10 |
0 | ||
1 | # Copyright (C) Igor Sysoev | |
2 | ||
0 | 3 | |
1 | 4 | CFLAGS = -c -zq -bt=nt -ot -op -oi -oe -s -bm $(CPU_OPT) |
2 | 5 | PCREFLAGS = -DPCRE_STATIC -DPOSIX_MALLOC_THRESHOLD=10 |
0 | ||
1 | # Copyright (C) Igor Sysoev | |
2 | ||
0 | 3 | |
1 | 4 | echo $ngx_n "checking for $ngx_lib ..." $ngx_c |
2 | 5 | echo >> $NGX_ERR |
0 | ||
1 | # Copyright (C) Igor Sysoev | |
2 | ||
0 | 3 | |
1 | 4 | mkdir -p $OBJS/src/core $OBJS/src/event $OBJS/src/event/modules \ |
2 | 5 | $OBJS/src/os/unix $OBJS/src/os/win32 \ |
0 | ||
1 | # Copyright (C) Igor Sysoev | |
2 | ||
0 | 3 | |
1 | 4 | if [ $EVENT_SELECT = NO -a $EVENT_FOUND = NO ]; then |
2 | 5 | EVENT_SELECT=YES |
0 | ||
1 | # Copyright (C) Igor Sysoev | |
0 | 2 | |
1 | 3 | help=no |
2 | 4 | |
233 | 235 | ERROR_LOG_PATH=$PREFIX/logs/error.log |
234 | 236 | ;; |
235 | 237 | |
238 | .stderr) | |
239 | ERROR_LOG_PATH= | |
240 | ;; | |
241 | ||
236 | 242 | *) |
237 | 243 | ERROR_LOG_PATH=$PREFIX/$ERROR_LOG_PATH |
238 | 244 | ;; |
0 | ||
1 | # Copyright (C) Igor Sysoev | |
2 | ||
0 | 3 | |
1 | 4 | CORE_INCS="$UNIX_INCS" |
2 | 5 | CORE_DEPS="$UNIX_DEPS $FREEBSD_DEPS" |
61 | 64 | |
62 | 65 | echo " + using rfork()" |
63 | 66 | |
64 | # kqueue's EVFILT_SIGNAL is safe | |
65 | ||
66 | if [ $version -gt 460101 ]; then | |
67 | echo " + kqueue's EVFILT_SIGNAL is safe" | |
68 | have=HAVE_SAFE_EVFILT_SIGNAL . auto/have | |
69 | else | |
70 | echo "$0: error: the kqueue's EVFILT_SIGNAL is unsafe on this" | |
71 | echo "FreeBSD version, so --with-threads=rfork could not be used" | |
72 | echo | |
73 | ||
74 | exit 1 | |
75 | fi | |
67 | # # kqueue's EVFILT_SIGNAL is safe | |
68 | # | |
69 | # if [ $version -gt 460101 ]; then | |
70 | # echo " + kqueue's EVFILT_SIGNAL is safe" | |
71 | # have=HAVE_SAFE_EVFILT_SIGNAL . auto/have | |
72 | # else | |
73 | # echo "$0: error: the kqueue's EVFILT_SIGNAL is unsafe on this" | |
74 | # echo "FreeBSD version, so --with-threads=rfork could not be used" | |
75 | # echo | |
76 | # | |
77 | # exit 1 | |
78 | # fi | |
76 | 79 | fi |
77 | 80 | |
78 | 81 |
0 | ||
1 | # Copyright (C) Igor Sysoev | |
2 | ||
0 | 3 | |
1 | 4 | CORE_INCS="$UNIX_INCS" |
2 | 5 | CORE_DEPS="$UNIX_DEPS $LINUX_DEPS" |
14 | 17 | | sed -e 's/^.* \(.*\)$/\1/'` |
15 | 18 | |
16 | 19 | |
17 | # enable rt signals on Linux 2.2.19 and onward | |
20 | # enable the rt signals on Linux 2.2.19 and onward | |
18 | 21 | |
19 | 22 | if [ $version -ge 131609 -o $EVENT_RTSIG = YES ]; then |
20 | 23 | echo " + using rt signals" |
0 | ||
1 | # Copyright (C) Igor Sysoev | |
2 | ||
0 | 3 | |
1 | 4 | CORE_INCS="$UNIX_INCS" |
2 | 5 | CORE_DEPS="$UNIX_DEPS $SOLARIS_DEPS" |
0 | ||
1 | # Copyright (C) Igor Sysoev | |
2 | ||
0 | 3 | |
1 | 4 | CORE_MODULES="ngx_core_module ngx_errlog_module ngx_conf_module" |
2 | 5 |
0 | ||
1 | # Copyright (C) Igor Sysoev | |
2 | ||
0 | 3 | |
1 | 4 | echo |
2 | 5 | echo "Configuration summary" |
68 | 71 | echo " nginx binary file: $SBIN_PATH" |
69 | 72 | echo " nginx configuration file: $CONF_PATH" |
70 | 73 | echo " nginx pid file: $PID_PATH" |
71 | echo " nginx error log file: $ERROR_LOG_PATH" | |
74 | if [ ".$ERROR_LOG_PATH" != "." ]; then | |
75 | echo " nginx error log file: $ERROR_LOG_PATH" | |
76 | else | |
77 | echo " nginx logs errors to stderr" | |
78 | fi | |
72 | 79 | echo " nginx http access log file: $HTTP_LOG_PATH" |
73 | 80 | echo |
0 | ||
1 | # Copyright (C) Igor Sysoev | |
2 | ||
0 | 3 | |
1 | 4 | echo $ngx_n "checking for $ngx_type size ..." $ngx_c |
2 | 5 | echo >> $NGX_ERR |
0 | ||
1 | # Copyright (C) Igor Sysoev | |
2 | ||
0 | 3 | |
1 | 4 | echo $ngx_n "checking for $ngx_type ..." $ngx_c |
2 | 5 | echo >> $NGX_ERR |
0 | ||
1 | # Copyright (C) Igor Sysoev | |
2 | ||
0 | 3 | |
1 | 4 | echo $ngx_n "checking for uintptr_t ... " $ngx_c |
2 | 5 | echo >> $NGX_ERR |
0 | 0 | |
1 | 1 | /* |
2 | * Copyright (C) 2002-2004 Igor Sysoev | |
2 | * Copyright (C) Igor Sysoev | |
3 | 3 | */ |
4 | 4 | |
5 | 5 | |
94 | 94 | |
95 | 95 | ngx_uint_t ngx_max_module; |
96 | 96 | |
97 | ngx_uint_t ngx_use_stderr; | |
98 | ||
99 | 97 | |
100 | 98 | int main(int argc, char *const *argv) |
101 | 99 | { |
119 | 117 | |
120 | 118 | ngx_pid = ngx_getpid(); |
121 | 119 | |
122 | log = ngx_log_init_errlog(); | |
120 | if (!(log = ngx_log_init_errlog())) { | |
121 | return 1; | |
122 | } | |
123 | 123 | |
124 | 124 | #if (NGX_OPENSSL) |
125 | 125 | ngx_ssl_init(log); |
141 | 141 | |
142 | 142 | if (ngx_getopt(&ctx, &init_cycle) == NGX_ERROR) { |
143 | 143 | return 1; |
144 | } | |
145 | ||
146 | if (ngx_use_stderr) { | |
147 | log = ngx_log_init_errlog(); | |
148 | 144 | } |
149 | 145 | |
150 | 146 | if (ngx_os_init(log) == NGX_ERROR) { |
323 | 319 | |
324 | 320 | case 't': |
325 | 321 | ngx_test_config = 1; |
326 | break; | |
327 | ||
328 | case 's': | |
329 | ngx_use_stderr = 1; | |
330 | 322 | break; |
331 | 323 | |
332 | 324 | case 'c': |
0 | 0 | |
1 | 1 | /* |
2 | * Copyright (C) 2002-2004 Igor Sysoev | |
2 | * Copyright (C) Igor Sysoev | |
3 | 3 | */ |
4 | 4 | |
5 | 5 | |
28 | 28 | static ngx_connection_t dumb; |
29 | 29 | /* STUB */ |
30 | 30 | |
31 | #ifdef NGX_ERROR_LOG_PATH | |
31 | 32 | static ngx_str_t error_log = ngx_string(NGX_ERROR_LOG_PATH); |
33 | #else | |
34 | static ngx_str_t error_log = ngx_null_string; | |
35 | #endif | |
32 | 36 | |
33 | 37 | |
34 | 38 | ngx_cycle_t *ngx_init_cycle(ngx_cycle_t *old_cycle) |
0 | 0 | |
1 | 1 | /* |
2 | * Copyright (C) 2002-2004 Igor Sysoev | |
2 | * Copyright (C) Igor Sysoev | |
3 | 3 | */ |
4 | 4 | |
5 | 5 | |
111 | 111 | if (err) { |
112 | 112 | |
113 | 113 | if (len > max - 50) { |
114 | ||
114 | 115 | /* leave a space for an error code */ |
116 | ||
115 | 117 | len = max - 50; |
116 | 118 | errstr[len++] = '.'; |
117 | 119 | errstr[len++] = '.'; |
221 | 223 | #endif |
222 | 224 | |
223 | 225 | |
224 | #if 0 | |
225 | ||
226 | void ngx_log_stderr(ngx_event_t *ev) | |
227 | { | |
228 | char errstr[MAX_ERROR_STR]; | |
229 | ssize_t n; | |
230 | ngx_err_t err; | |
231 | ||
232 | for ( ;; ) { | |
233 | n = read((ngx_fd_t) ev->data, errstr, sizeof(errstr - 1)); | |
234 | ||
235 | if (n == -1) { | |
236 | err = ngx_errno; | |
237 | if (err == NGX_EAGAIN) { | |
238 | return; | |
239 | } | |
240 | ||
241 | ngx_log_error(NGX_LOG_ALERT, &ngx_log, err, "read() failed"); | |
242 | return; | |
243 | } | |
244 | ||
245 | if (n == 0) { | |
246 | ngx_log_error(NGX_LOG_ALERT, &ngx_log, 0, "stderr clolsed"); | |
247 | return; | |
248 | } | |
249 | ||
250 | errstr[n] = '\0'; | |
251 | ngx_log_error(NGX_LOG_STDERR, &ngx_log, 0, "%s", errstr); | |
252 | } | |
253 | } | |
254 | ||
255 | #endif | |
256 | ||
257 | ||
258 | 226 | |
259 | 227 | ngx_log_t *ngx_log_init_errlog() |
260 | 228 | { |
286 | 254 | ngx_log.file = &ngx_stderr; |
287 | 255 | ngx_log.log_level = NGX_LOG_ERR; |
288 | 256 | |
289 | #if 0 | |
257 | #ifdef NGX_ERROR_LOG_PATH | |
258 | ||
290 | 259 | fd = ngx_open_file(NGX_ERROR_LOG_PATH, NGX_FILE_RDWR, |
291 | 260 | NGX_FILE_CREATE_OR_OPEN|NGX_FILE_APPEND); |
292 | 261 | |
314 | 283 | } |
315 | 284 | |
316 | 285 | #endif |
286 | ||
317 | 287 | #endif |
318 | 288 | |
319 | 289 | return &ngx_log; |
404 | 374 | |
405 | 375 | value = cf->args->elts; |
406 | 376 | |
407 | if (value[1].len == 6 && ngx_strcmp(value[1].data, "stderr") == 0) { | |
408 | cf->cycle->new_log->file->fd = ngx_stderr.fd; | |
409 | cf->cycle->new_log->file->name.len = 0; | |
410 | cf->cycle->new_log->file->name.data = NULL; | |
411 | ||
412 | } else { | |
413 | cf->cycle->new_log->file->name = value[1]; | |
414 | ||
415 | if (ngx_conf_full_name(cf->cycle, &cf->cycle->new_log->file->name) | |
377 | cf->cycle->new_log->file->name = value[1]; | |
378 | ||
379 | if (ngx_conf_full_name(cf->cycle, &cf->cycle->new_log->file->name) | |
416 | 380 | == NGX_ERROR) |
417 | { | |
418 | return NGX_CONF_ERROR; | |
419 | } | |
381 | { | |
382 | return NGX_CONF_ERROR; | |
420 | 383 | } |
421 | 384 | |
422 | 385 | return ngx_set_error_log_levels(cf, cf->cycle->new_log); |