xref: /unit/auto/os/conf (revision 335:8ca1d69ec3d8)
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.5"
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        NXT_EXEC_LINK="\$(CC)"
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_LIBM="-lm"
147        NXT_LIBS="$NXT_LIBRT $NXT_PTHREAD"
148    ;;
149
150    OpenBSD)
151        nxt_have=NXT_OPENBSD . auto/have
152
153        NXT_STATIC_LINK="ar -r -c"
154        NXT_SHARED_LINK="\$(CC) -shared"
155        NXT_SHARED_LOCAL_LINK="\$(CC) -shared"
156        NXT_MODULE_LINK="\$(CC) -shared"
157
158        NXT_EXEC_LINK="\$(CC)"
159        NXT_SHARED_LOCAL_EXEC_LINK=
160
161        NXT_LIB_STATIC="libnxt.a"
162        NXT_LIB_SHARED="libnxt.so"
163        NXT_LIB_SHARED_LOCAL="$NXT_BUILD_DIR/libnxt.so"
164
165        NXT_LIBM="-lm"
166        NXT_LIBS="$NXT_PTHREAD"
167    ;;
168
169    AIX)
170        nxt_have=NXT_AIX . auto/have
171
172        NXT_STATIC_LINK="ar -r -c"
173        NXT_SHARED_LINK="\$(CC) -G"
174        NXT_SHARED_LOCAL_LINK="\$(CC) -G"
175        NXT_MODULE_LINK="\$(CC) -G"
176
177        NXT_EXEC_LINK="\$(CC)"
178        NXT_SHARED_LOCAL_EXEC_LINK=
179
180        NXT_LIB_STATIC="libnxt.a"
181        NXT_LIB_SHARED="libnxt.so"
182        NXT_LIB_SHARED_LOCAL="$NXT_BUILD_DIR/libnxt.so"
183
184        NXT_LIBM="-lm"
185        NXT_LIBS="$NXT_PTHREAD"
186    ;;
187
188    HP-UX)
189        nxt_have=NXT_HPUX . auto/have
190
191        NXT_EXEC_LINK="\$(CC)"
192        NXT_SHARED_LOCAL_EXEC_LINK=
193
194        NXT_STATIC_LINK="ar -r -c"
195        NXT_SHARED_LINK="\$(CC) -shared"
196        NXT_SHARED_LOCAL_LINK="\$(CC) -shared"
197        NXT_MODULE_LINK="\$(CC) -shared"
198
199        NXT_LIB_STATIC="libnxt.a"
200        NXT_LIB_SHARED="libnxt.so"
201        NXT_LIB_SHARED_LOCAL="$NXT_BUILD_DIR/libnxt.so"
202
203        NXT_LIBM="-lm"
204        NXT_LIBS="$NXT_PTHREAD $NXT_LIBHG"
205    ;;
206
207    QNX)
208        nxt_have=NXT_QNX . auto/have
209
210        NXT_STATIC_LINK="ar -r -c"
211        NXT_SHARED_LINK="\$(CC) -shared"
212        NXT_SHARED_LOCAL_LINK="\$(CC) -shared"
213        NXT_MODULE_LINK="\$(CC) -shared"
214
215        NXT_EXEC_LINK="\$(CC)"
216        NXT_SHARED_LOCAL_EXEC_LINK=
217
218        NXT_LIB_STATIC="libnxt.a"
219        NXT_LIB_SHARED="libnxt.so"
220        NXT_LIB_SHARED_LOCAL="$NXT_BUILD_DIR/libnxt.so"
221
222        NXT_LIBM="-lm"
223        NXT_LIBS="$NXT_PTHREAD"
224    ;;
225
226    *)
227        NXT_STATIC_LINK="ar -r -c"
228        NXT_SHARED_LINK="\$(CC) -shared"
229        NXT_SHARED_LOCAL_LINK="\$(CC) -shared"
230        NXT_MODULE_LINK="\$(CC) -shared"
231
232        # "-Wl,-E" exports symbols of executable file.
233        NXT_EXEC_LINK="\$(CC) -Wl,-E"
234        NXT_SHARED_LOCAL_EXEC_LINK=
235
236        NXT_LIB_STATIC="libnxt.a"
237        NXT_LIB_SHARED="libnxt.so"
238        NXT_LIB_SHARED_LOCAL="$NXT_BUILD_DIR/libnxt.so"
239
240        NXT_LIBM="-lm"
241        NXT_LIBS="$NXT_LIBRT $NXT_LIBDL $NXT_PTHREAD"
242    ;;
243esac
244