xref: /unit/auto/os/conf (revision 644:44f8dcca7f58)
1
2# Copyright (C) Igor Sysoev
3# Copyright (C) NGINX, Inc.
4
5
6# To support dynamically loaded modules libnxt library must be a shared
7# object itself because an application linked with static libnxt library
8# may lack code required by the modules.  Dynamic linkers allow to specify
9# relative path in SONAME library entry or in RPATH executable entry.
10#
11# Solaris 7, Linux 2.2, and FreeBSD 7.3 support $ORIGIN variable.
12# MacOSX supports @executable_path variable.
13# NetBSD does not support $ORIGIN variable.
14#
15# "ar -r" is enough to create a static library, ranlib is surplus.
16# "ar -c" disables the "creating archive" warning.
17
18
19case "$NXT_SYSTEM" in
20
21    Linux)
22        nxt_have=NXT_LINUX . auto/have
23
24        NXT_STATIC_LINK="ar -r -c"
25        NXT_SHARED_LINK="\$(CC) -shared -Wl,-soname,libnxt.so"
26        NXT_SHARED_LOCAL_LINK="\$(CC) -shared \
27                               -Wl,-soname,\\\$\$ORIGIN/libnxt.so"
28        NXT_MODULE_LINK="\$(CC) -shared"
29
30        # "-Wl,-E" exports symbols of executable file.
31        NXT_EXEC_LINK="\$(CC) -Wl,-E"
32        NXT_SHARED_LOCAL_EXEC_LINK=
33
34        NXT_LIB_STATIC="libnxt.a"
35        NXT_LIB_SHARED="libnxt.so"
36        NXT_LIB_SHARED_LOCAL="$NXT_BUILD_DIR/libnxt.so"
37
38        NXT_LIBM="-lm"
39        NXT_LIBS="$NXT_LIBRT $NXT_LIBDL $NXT_PTHREAD"
40    ;;
41
42    FreeBSD)
43        nxt_have=NXT_FREEBSD . auto/have
44
45        NXT_STATIC_LINK="ar -r -c"
46        NXT_SHARED_LINK="\$(CC) -shared -Wl,-soname,libnxt.so"
47        NXT_SHARED_LOCAL_LINK="\$(CC) -shared \
48                               -Wl,-soname,\\\$\$ORIGIN/libnxt.so"
49        NXT_MODULE_LINK="\$(CC) -shared"
50
51        # "-Wl,-E" exports symbols of executable file.
52        NXT_EXEC_LINK="\$(CC) -Wl,-E"
53        # "-Wl,-z,origin" enables $ORIGIN processing.
54        NXT_SHARED_LOCAL_EXEC_LINK="-Wl,-z,origin"
55
56        NXT_LIB_STATIC="libnxt.a"
57        NXT_LIB_SHARED="libnxt.so"
58        NXT_LIB_SHARED_LOCAL="$NXT_BUILD_DIR/libnxt.so"
59
60        NXT_LIBM="-lm"
61        NXT_LIBS="$NXT_LIBRT $NXT_PTHREAD"
62    ;;
63
64    SunOS)
65        nxt_have=NXT_SOLARIS . auto/have
66
67        case "$NXT_CC_NAME" in
68
69            SunC):
70                NXT_STATIC_LINK="ar -r -c"
71                NXT_SHARED_LINK="\$(CC) -G -h libnxt.so"
72                NXT_SHARED_LOCAL_LINK="\$(CC) -G -h \\\$\$ORIGIN/libnxt.so"
73                NXT_MODULE_LINK="\$(CC) -G"
74            ;;
75
76            *)
77                NXT_STATIC_LINK="ar -r -c"
78                NXT_SHARED_LINK="\$(CC) -shared -Wl,-soname,libnxt.so"
79                NXT_SHARED_LOCAL_LINK="\$(CC) -shared \
80                                       -Wl,-soname,\\\$\$ORIGIN/libnxt.so"
81                NXT_MODULE_LINK="\$(CC) -shared"
82            ;;
83        esac
84
85        NXT_LIB_STATIC="libnxt.a"
86        NXT_LIB_SHARED="libnxt.so"
87        NXT_LIB_SHARED_LOCAL="$NXT_BUILD_DIR/libnxt.so"
88
89        NXT_EXEC_LINK="\$(CC)"
90        NXT_SHARED_LOCAL_EXEC_LINK=
91
92        NXT_LIBM="-lm"
93        NXT_LIBS="-lsocket $NXT_LIBSENDFILE"
94        NXT_LIBS="$NXT_LIBS $NXT_LIBRT $NXT_LIBDL $NXT_PTHREAD"
95    ;;
96
97    Darwin)
98        nxt_have=NXT_MACOSX . auto/have
99
100        # HFS+ volumes are caseless by default.
101        nxt_have=NXT_HAVE_CASELESS_FILESYSTEM . auto/have
102
103        # MacOSX 10.6 (Snow Leopard) has deprecated ucontext(3).
104        # MacOSX 10.7 (Lion) has deprecated system OpenSSL.
105        # MAC_OS_X_VERSION_MIN_REQUIRED macro does not help.
106        # "-rpath" is supported since MacOSX 10.5 (Leopard).
107        NXT_CFLAGS="$NXT_CFLAGS -mmacosx-version-min=10.6"
108
109        NXT_STATIC_LINK="ar -r -c"
110        NXT_SHARED_LINK="\$(CC) -dynamiclib"
111        NXT_SHARED_LOCAL_LINK="\$(CC) -dynamiclib \
112                               -install_name @executable_path/libnxt.dylib"
113
114        # Prior to MacOSX 10.5 (Leopard) only bundles could be unloaded.
115        # NXT_MODULE_LINK="\$(CC) -bundle -undefined dynamic_lookup"
116        NXT_MODULE_LINK="\$(CC) -dynamiclib -undefined dynamic_lookup"
117
118        NXT_EXEC_LINK="\$(CC)"
119        NXT_SHARED_LOCAL_EXEC_LINK=
120
121        NXT_LIB_STATIC="libnxt.a"
122        NXT_LIB_SHARED="libnxt.dylib"
123        NXT_LIB_SHARED_LOCAL="$NXT_BUILD_DIR/libnxt.dylib"
124
125        # MacOSX libm.dylib is a symlink to libSystem.dylib.
126        NXT_LIBM=
127        NXT_LIBS=
128
129    ;;
130
131    NetBSD)
132        nxt_have=NXT_NETBSD . auto/have
133
134        NXT_STATIC_LINK="ar -r -c"
135        NXT_SHARED_LINK="\$(CC) -shared"
136        NXT_SHARED_LOCAL_LINK="\$(CC) -shared"
137        NXT_MODULE_LINK="\$(CC) -shared"
138
139        # "-Wl,-E" exports symbols of executable file.
140        NXT_EXEC_LINK="\$(CC) -Wl,-E"
141        NXT_SHARED_LOCAL_EXEC_LINK=
142
143        NXT_LIB_STATIC="libnxt.a"
144        NXT_LIB_SHARED="libnxt.so"
145        NXT_LIB_SHARED_LOCAL="$NXT_BUILD_DIR/libnxt.so"
146
147        NXT_LIBM="-lm"
148        NXT_LIBS="$NXT_LIBRT $NXT_PTHREAD"
149    ;;
150
151    OpenBSD)
152        nxt_have=NXT_OPENBSD . auto/have
153
154        NXT_STATIC_LINK="ar -r -c"
155        NXT_SHARED_LINK="\$(CC) -shared"
156        NXT_SHARED_LOCAL_LINK="\$(CC) -shared"
157        NXT_MODULE_LINK="\$(CC) -shared"
158
159        # "-Wl,-E" exports symbols of executable file.
160        NXT_EXEC_LINK="\$(CC) -Wl,-E"
161        NXT_SHARED_LOCAL_EXEC_LINK=
162
163        NXT_LIB_STATIC="libnxt.a"
164        NXT_LIB_SHARED="libnxt.so"
165        NXT_LIB_SHARED_LOCAL="$NXT_BUILD_DIR/libnxt.so"
166
167        NXT_LIBM="-lm"
168        NXT_LIBS="$NXT_PTHREAD"
169    ;;
170
171    DragonFly)
172        nxt_have=NXT_DRAGONFLY . auto/have
173
174        NXT_STATIC_LINK="ar -r -c"
175        NXT_SHARED_LINK="\$(CC) -shared"
176        NXT_SHARED_LOCAL_LINK="\$(CC) -shared"
177        NXT_MODULE_LINK="\$(CC) -shared"
178
179        # "-Wl,-E" exports symbols of executable file.
180        NXT_EXEC_LINK="\$(CC) -Wl,-E"
181        NXT_SHARED_LOCAL_EXEC_LINK=
182
183        NXT_LIB_STATIC="libnxt.a"
184        NXT_LIB_SHARED="libnxt.so"
185        NXT_LIB_SHARED_LOCAL="$NXT_BUILD_DIR/libnxt.so"
186
187        NXT_LIBM="-lm"
188        NXT_LIBS="$NXT_LIBRT $NXT_PTHREAD"
189    ;;
190
191    AIX)
192        nxt_have=NXT_AIX . auto/have
193
194        NXT_STATIC_LINK="ar -r -c"
195        NXT_SHARED_LINK="\$(CC) -G"
196        NXT_SHARED_LOCAL_LINK="\$(CC) -G"
197        NXT_MODULE_LINK="\$(CC) -G"
198
199        NXT_EXEC_LINK="\$(CC)"
200        NXT_SHARED_LOCAL_EXEC_LINK=
201
202        NXT_LIB_STATIC="libnxt.a"
203        NXT_LIB_SHARED="libnxt.so"
204        NXT_LIB_SHARED_LOCAL="$NXT_BUILD_DIR/libnxt.so"
205
206        NXT_LIBM="-lm"
207        NXT_LIBS="$NXT_PTHREAD"
208    ;;
209
210    HP-UX)
211        nxt_have=NXT_HPUX . auto/have
212
213        NXT_EXEC_LINK="\$(CC)"
214        NXT_SHARED_LOCAL_EXEC_LINK=
215
216        NXT_STATIC_LINK="ar -r -c"
217        NXT_SHARED_LINK="\$(CC) -shared"
218        NXT_SHARED_LOCAL_LINK="\$(CC) -shared"
219        NXT_MODULE_LINK="\$(CC) -shared"
220
221        NXT_LIB_STATIC="libnxt.a"
222        NXT_LIB_SHARED="libnxt.so"
223        NXT_LIB_SHARED_LOCAL="$NXT_BUILD_DIR/libnxt.so"
224
225        NXT_LIBM="-lm"
226        NXT_LIBS="$NXT_PTHREAD $NXT_LIBHG"
227    ;;
228
229    QNX)
230        nxt_have=NXT_QNX . auto/have
231
232        NXT_STATIC_LINK="ar -r -c"
233        NXT_SHARED_LINK="\$(CC) -shared"
234        NXT_SHARED_LOCAL_LINK="\$(CC) -shared"
235        NXT_MODULE_LINK="\$(CC) -shared"
236
237        NXT_EXEC_LINK="\$(CC)"
238        NXT_SHARED_LOCAL_EXEC_LINK=
239
240        NXT_LIB_STATIC="libnxt.a"
241        NXT_LIB_SHARED="libnxt.so"
242        NXT_LIB_SHARED_LOCAL="$NXT_BUILD_DIR/libnxt.so"
243
244        NXT_LIBM="-lm"
245        NXT_LIBS="$NXT_PTHREAD"
246    ;;
247
248    *)
249        NXT_STATIC_LINK="ar -r -c"
250        NXT_SHARED_LINK="\$(CC) -shared"
251        NXT_SHARED_LOCAL_LINK="\$(CC) -shared"
252        NXT_MODULE_LINK="\$(CC) -shared"
253
254        # "-Wl,-E" exports symbols of executable file.
255        NXT_EXEC_LINK="\$(CC) -Wl,-E"
256        NXT_SHARED_LOCAL_EXEC_LINK=
257
258        NXT_LIB_STATIC="libnxt.a"
259        NXT_LIB_SHARED="libnxt.so"
260        NXT_LIB_SHARED_LOCAL="$NXT_BUILD_DIR/libnxt.so"
261
262        NXT_LIBM="-lm"
263        NXT_LIBS="$NXT_LIBRT $NXT_LIBDL $NXT_PTHREAD"
264    ;;
265esac
266