xref: /unit/auto/os/conf (revision 1255:944efece387a)
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_LIB_UNIT_STATIC="libunit.a"
39
40        NXT_LIBM="-lm"
41        NXT_LIBS="$NXT_LIBRT $NXT_LIBDL $NXT_PTHREAD"
42    ;;
43
44    FreeBSD)
45        nxt_have=NXT_FREEBSD . auto/have
46
47        NXT_STATIC_LINK="\$(AR) -r -c"
48        NXT_SHARED_LINK="\$(CC) -shared -Wl,-soname,libnxt.so"
49        NXT_SHARED_LOCAL_LINK="\$(CC) -shared \
50                               -Wl,-soname,\\\$\$ORIGIN/libnxt.so"
51        NXT_MODULE_LINK="\$(CC) -shared"
52
53        # "-Wl,-E" exports symbols of executable file.
54        NXT_EXEC_LINK="\$(CC) -Wl,-E"
55        # "-Wl,-z,origin" enables $ORIGIN processing.
56        NXT_SHARED_LOCAL_EXEC_LINK="-Wl,-z,origin"
57
58        NXT_LIB_STATIC="libnxt.a"
59        NXT_LIB_SHARED="libnxt.so"
60        NXT_LIB_SHARED_LOCAL="$NXT_BUILD_DIR/libnxt.so"
61
62        NXT_LIB_UNIT_STATIC="libunit.a"
63
64        NXT_LIBM="-lm"
65        NXT_LIBS="$NXT_LIBRT $NXT_PTHREAD"
66    ;;
67
68    SunOS)
69        nxt_have=NXT_SOLARIS . auto/have
70
71        case "$NXT_CC_NAME" in
72
73            SunC):
74                NXT_STATIC_LINK="\$(AR) -r -c"
75                NXT_SHARED_LINK="\$(CC) -G -h libnxt.so"
76                NXT_SHARED_LOCAL_LINK="\$(CC) -G -h \\\$\$ORIGIN/libnxt.so"
77                NXT_MODULE_LINK="\$(CC) -G"
78            ;;
79
80            *)
81                NXT_STATIC_LINK="\$(AR) -r -c"
82                NXT_SHARED_LINK="\$(CC) -shared -Wl,-soname,libnxt.so"
83                NXT_SHARED_LOCAL_LINK="\$(CC) -shared \
84                                       -Wl,-soname,\\\$\$ORIGIN/libnxt.so"
85                NXT_MODULE_LINK="\$(CC) -shared"
86            ;;
87        esac
88
89        NXT_LIB_STATIC="libnxt.a"
90        NXT_LIB_SHARED="libnxt.so"
91        NXT_LIB_SHARED_LOCAL="$NXT_BUILD_DIR/libnxt.so"
92
93        NXT_LIB_UNIT_STATIC="libunit.a"
94
95        NXT_EXEC_LINK="\$(CC)"
96        NXT_SHARED_LOCAL_EXEC_LINK=
97
98        NXT_LIBM="-lm"
99        NXT_LIBS="-lsocket $NXT_LIBSENDFILE"
100        NXT_LIBS="$NXT_LIBS $NXT_LIBRT $NXT_LIBDL $NXT_PTHREAD"
101    ;;
102
103    Darwin)
104        nxt_have=NXT_MACOSX . auto/have
105
106        # HFS+ volumes are caseless by default.
107        nxt_have=NXT_HAVE_CASELESS_FILESYSTEM . auto/have
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        NXT_MODULE_LINK="\$(CC) -dynamiclib -undefined dynamic_lookup"
114
115        NXT_EXEC_LINK="\$(CC)"
116        NXT_SHARED_LOCAL_EXEC_LINK=
117
118        NXT_LIB_STATIC="libnxt.a"
119        NXT_LIB_SHARED="libnxt.dylib"
120        NXT_LIB_SHARED_LOCAL="$NXT_BUILD_DIR/libnxt.dylib"
121
122        NXT_LIB_UNIT_STATIC="libunit.a"
123
124        # MacOSX libm.dylib is a symlink to libSystem.dylib.
125        NXT_LIBM=
126        NXT_LIBS=
127
128    ;;
129
130    NetBSD)
131        nxt_have=NXT_NETBSD . auto/have
132
133        NXT_STATIC_LINK="\$(AR) -r -c"
134        NXT_SHARED_LINK="\$(CC) -shared"
135        NXT_SHARED_LOCAL_LINK="\$(CC) -shared"
136        NXT_MODULE_LINK="\$(CC) -shared"
137
138        # "-Wl,-E" exports symbols of executable file.
139        NXT_EXEC_LINK="\$(CC) -Wl,-E"
140        NXT_SHARED_LOCAL_EXEC_LINK=
141
142        NXT_LIB_STATIC="libnxt.a"
143        NXT_LIB_SHARED="libnxt.so"
144        NXT_LIB_SHARED_LOCAL="$NXT_BUILD_DIR/libnxt.so"
145
146        NXT_LIB_UNIT_STATIC="libunit.a"
147
148        NXT_LIBM="-lm"
149        NXT_LIBS="$NXT_LIBRT $NXT_PTHREAD"
150    ;;
151
152    OpenBSD)
153        nxt_have=NXT_OPENBSD . auto/have
154
155        NXT_STATIC_LINK="\$(AR) -r -c"
156        NXT_SHARED_LINK="\$(CC) -shared"
157        NXT_SHARED_LOCAL_LINK="\$(CC) -shared"
158        NXT_MODULE_LINK="\$(CC) -shared"
159
160        # "-Wl,-E" exports symbols of executable file.
161        NXT_EXEC_LINK="\$(CC) -Wl,-E"
162        NXT_SHARED_LOCAL_EXEC_LINK=
163
164        NXT_LIB_STATIC="libnxt.a"
165        NXT_LIB_SHARED="libnxt.so"
166        NXT_LIB_SHARED_LOCAL="$NXT_BUILD_DIR/libnxt.so"
167
168        NXT_LIB_UNIT_STATIC="libunit.a"
169
170        NXT_LIBM="-lm"
171        NXT_LIBS="$NXT_PTHREAD"
172    ;;
173
174    DragonFly)
175        nxt_have=NXT_DRAGONFLY . auto/have
176
177        NXT_STATIC_LINK="\$(AR) -r -c"
178        NXT_SHARED_LINK="\$(CC) -shared"
179        NXT_SHARED_LOCAL_LINK="\$(CC) -shared"
180        NXT_MODULE_LINK="\$(CC) -shared"
181
182        # "-Wl,-E" exports symbols of executable file.
183        NXT_EXEC_LINK="\$(CC) -Wl,-E"
184        NXT_SHARED_LOCAL_EXEC_LINK=
185
186        NXT_LIB_STATIC="libnxt.a"
187        NXT_LIB_SHARED="libnxt.so"
188        NXT_LIB_SHARED_LOCAL="$NXT_BUILD_DIR/libnxt.so"
189
190        NXT_LIB_UNIT_STATIC="libunit.a"
191
192        NXT_LIBM="-lm"
193        NXT_LIBS="$NXT_LIBRT $NXT_PTHREAD"
194    ;;
195
196    AIX)
197        nxt_have=NXT_AIX . auto/have
198
199        NXT_STATIC_LINK="\$(AR) -r -c"
200        NXT_SHARED_LINK="\$(CC) -G"
201        NXT_SHARED_LOCAL_LINK="\$(CC) -G"
202        NXT_MODULE_LINK="\$(CC) -G"
203
204        NXT_EXEC_LINK="\$(CC)"
205        NXT_SHARED_LOCAL_EXEC_LINK=
206
207        NXT_LIB_STATIC="libnxt.a"
208        NXT_LIB_SHARED="libnxt.so"
209        NXT_LIB_SHARED_LOCAL="$NXT_BUILD_DIR/libnxt.so"
210
211        NXT_LIB_UNIT_STATIC="libunit.a"
212
213        NXT_LIBM="-lm"
214        NXT_LIBS="$NXT_PTHREAD"
215    ;;
216
217    HP-UX)
218        nxt_have=NXT_HPUX . auto/have
219
220        NXT_EXEC_LINK="\$(CC)"
221        NXT_SHARED_LOCAL_EXEC_LINK=
222
223        NXT_STATIC_LINK="\$(AR) -r -c"
224        NXT_SHARED_LINK="\$(CC) -shared"
225        NXT_SHARED_LOCAL_LINK="\$(CC) -shared"
226        NXT_MODULE_LINK="\$(CC) -shared"
227
228        NXT_LIB_STATIC="libnxt.a"
229        NXT_LIB_SHARED="libnxt.so"
230        NXT_LIB_SHARED_LOCAL="$NXT_BUILD_DIR/libnxt.so"
231
232        NXT_LIB_UNIT_STATIC="libunit.a"
233
234        NXT_LIBM="-lm"
235        NXT_LIBS="$NXT_PTHREAD $NXT_LIBHG"
236    ;;
237
238    QNX)
239        nxt_have=NXT_QNX . auto/have
240
241        NXT_STATIC_LINK="\$(AR) -r -c"
242        NXT_SHARED_LINK="\$(CC) -shared"
243        NXT_SHARED_LOCAL_LINK="\$(CC) -shared"
244        NXT_MODULE_LINK="\$(CC) -shared"
245
246        NXT_EXEC_LINK="\$(CC)"
247        NXT_SHARED_LOCAL_EXEC_LINK=
248
249        NXT_LIB_STATIC="libnxt.a"
250        NXT_LIB_SHARED="libnxt.so"
251        NXT_LIB_SHARED_LOCAL="$NXT_BUILD_DIR/libnxt.so"
252
253        NXT_LIB_UNIT_STATIC="libunit.a"
254
255        NXT_LIBM="-lm"
256        NXT_LIBS="$NXT_PTHREAD"
257    ;;
258
259    *)
260        NXT_STATIC_LINK="\$(AR) -r -c"
261        NXT_SHARED_LINK="\$(CC) -shared"
262        NXT_SHARED_LOCAL_LINK="\$(CC) -shared"
263        NXT_MODULE_LINK="\$(CC) -shared"
264
265        # "-Wl,-E" exports symbols of executable file.
266        NXT_EXEC_LINK="\$(CC) -Wl,-E"
267        NXT_SHARED_LOCAL_EXEC_LINK=
268
269        NXT_LIB_STATIC="libnxt.a"
270        NXT_LIB_SHARED="libnxt.so"
271        NXT_LIB_SHARED_LOCAL="$NXT_BUILD_DIR/libnxt.so"
272
273        NXT_LIB_UNIT_STATIC="libunit.a"
274
275        NXT_LIBM="-lm"
276        NXT_LIBS="$NXT_LIBRT $NXT_LIBDL $NXT_PTHREAD"
277    ;;
278esac
279