conf revision e18a033b
1
2# Copyright (C) Igor Sysoev
3# Copyright (C) Nginx, Inc.
4
5
6LINK="\$(CC)"
7
8MAIN_LINK=
9MODULE_LINK="-shared"
10
11ngx_include_opt="-I "
12ngx_compile_opt="-c"
13ngx_pic_opt="-fPIC"
14ngx_objout="-o "
15ngx_binout="-o "
16ngx_objext="o"
17ngx_binext=
18ngx_modext=".so"
19
20ngx_long_start=
21ngx_long_end=
22
23ngx_regex_dirsep="\/"
24ngx_dirsep='/'
25
26ngx_regex_cont=' \\\
27	'
28ngx_cont=' \
29	'
30ngx_tab=' \
31		'
32ngx_spacer=
33
34ngx_long_regex_cont=$ngx_regex_cont
35ngx_long_cont=$ngx_cont
36
37. auto/cc/name
38
39if test -n "$CFLAGS"; then
40
41    CC_TEST_FLAGS="$CFLAGS $NGX_CC_OPT"
42
43    case $NGX_CC_NAME in
44
45        ccc)
46            # Compaq C V6.5-207
47
48            ngx_include_opt="-I"
49        ;;
50
51        sunc)
52
53            MAIN_LINK=
54            MODULE_LINK="-G"
55
56            case "$NGX_MACHINE" in
57
58                i86pc)
59                    NGX_AUX=" src/os/unix/ngx_sunpro_x86.il"
60                ;;
61
62                sun4u | sun4v)
63                    NGX_AUX=" src/os/unix/ngx_sunpro_sparc64.il"
64                ;;
65
66            esac
67
68            case $CPU in
69
70                amd64)
71                    NGX_AUX=" src/os/unix/ngx_sunpro_amd64.il"
72                ;;
73
74            esac
75        ;;
76
77    esac
78
79else
80
81    case $NGX_CC_NAME in
82        gcc)
83            # gcc 2.7.2.3, 2.8.1, 2.95.4, egcs-1.1.2
84            #     3.0.4, 3.1.1, 3.2.3, 3.3.2, 3.3.3, 3.3.4, 3.4.0, 3.4.2
85            #     4.0.0, 4.0.1, 4.1.0
86
87            . auto/cc/gcc
88        ;;
89
90        clang)
91            # Clang C compiler
92
93            . auto/cc/clang
94        ;;
95
96        icc)
97            # Intel C++ compiler 7.1, 8.0, 8.1
98
99            . auto/cc/icc
100        ;;
101
102        sunc)
103            # Sun C 5.7 Patch 117837-04 2005/05/11
104
105            . auto/cc/sunc
106        ;;
107
108        ccc)
109            # Compaq C V6.5-207
110
111            . auto/cc/ccc
112        ;;
113
114        acc)
115            # aCC: HP ANSI C++ B3910B A.03.55.02
116
117            . auto/cc/acc
118        ;;
119
120        msvc*)
121            # MSVC++ 6.0 SP2, MSVC++ Toolkit 2003
122
123            . auto/cc/msvc
124        ;;
125
126        owc)
127            # Open Watcom C 1.0, 1.2
128
129            . auto/cc/owc
130        ;;
131
132        bcc)
133            # Borland C++ 5.5
134
135            . auto/cc/bcc
136        ;;
137
138    esac
139
140    CC_TEST_FLAGS="$CC_TEST_FLAGS $NGX_CC_OPT"
141
142fi
143
144CFLAGS="$CFLAGS $NGX_CC_OPT"
145NGX_TEST_LD_OPT="$NGX_LD_OPT"
146
147if [ "$NGX_PLATFORM" != win32 ]; then
148
149    if test -n "$NGX_LD_OPT"; then
150        ngx_feature=--with-ld-opt=\"$NGX_LD_OPT\"
151        ngx_feature_name=
152        ngx_feature_run=no
153        ngx_feature_incs=
154        ngx_feature_path=
155        ngx_feature_libs=
156        ngx_feature_test=
157        . auto/feature
158
159        if [ $ngx_found = no ]; then
160            echo $0: error: the invalid value in --with-ld-opt=\"$NGX_LD_OPT\"
161            echo
162            exit 1
163        fi
164    fi
165
166
167    ngx_feature="-Wl,-E switch"
168    ngx_feature_name=
169    ngx_feature_run=no
170    ngx_feature_incs=
171    ngx_feature_path=
172    ngx_feature_libs=-Wl,-E
173    ngx_feature_test=
174    . auto/feature
175
176    if [ $ngx_found = yes ]; then
177        MAIN_LINK="-Wl,-E"
178    fi
179
180
181    ngx_feature="gcc builtin atomic operations"
182    ngx_feature_name=NGX_HAVE_GCC_ATOMIC
183    ngx_feature_run=yes
184    ngx_feature_incs=
185    ngx_feature_path=
186    ngx_feature_libs=
187    ngx_feature_test="long  n = 0;
188                      if (!__sync_bool_compare_and_swap(&n, 0, 1))
189                          return 1;
190                      if (__sync_fetch_and_add(&n, 1) != 1)
191                          return 1;
192                      if (n != 2)
193                          return 1;
194                      __sync_synchronize();"
195    . auto/feature
196
197
198    if [ "$NGX_CC_NAME" = "ccc" ]; then
199        echo "checking for C99 variadic macros ... disabled"
200    else
201        ngx_feature="C99 variadic macros"
202        ngx_feature_name="NGX_HAVE_C99_VARIADIC_MACROS"
203        ngx_feature_run=yes
204        ngx_feature_incs="#include <stdio.h>
205#define var(dummy, ...)  sprintf(__VA_ARGS__)"
206        ngx_feature_path=
207        ngx_feature_libs=
208        ngx_feature_test="char  buf[30]; buf[0] = '0';
209                          var(0, buf, \"%d\", 1);
210                          if (buf[0] != '1') return 1"
211        . auto/feature
212     fi
213
214
215    ngx_feature="gcc variadic macros"
216    ngx_feature_name="NGX_HAVE_GCC_VARIADIC_MACROS"
217    ngx_feature_run=yes
218    ngx_feature_incs="#include <stdio.h>
219#define var(dummy, args...)  sprintf(args)"
220    ngx_feature_path=
221    ngx_feature_libs=
222    ngx_feature_test="char  buf[30]; buf[0] = '0';
223                      var(0, buf, \"%d\", 1);
224                      if (buf[0] != '1') return 1"
225    . auto/feature
226
227
228    ngx_feature="gcc builtin 64 bit byteswap"
229    ngx_feature_name="NGX_HAVE_GCC_BSWAP64"
230    ngx_feature_run=no
231    ngx_feature_incs=
232    ngx_feature_path=
233    ngx_feature_libs=
234    ngx_feature_test="if (__builtin_bswap64(0)) return 1"
235    . auto/feature
236
237
238#    ngx_feature="inline"
239#    ngx_feature_name=
240#    ngx_feature_run=no
241#    ngx_feature_incs="int inline f(void) { return 1 }"
242#    ngx_feature_path=
243#    ngx_feature_libs=
244#    ngx_feature_test=
245#    . auto/feature
246#
247#    if [ $ngx_found = yes ]; then
248#    fi
249
250fi
251