xref: /unit/auto/os/conf (revision 0:a63ceefd6ab0)
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        NXT_MODULE_LINK="\$(CC) -shared"
30
31        # "-Wl,-E" exports symbols of executable file.
32        NXT_EXEC_LINK="\$(CC) -Wl,-E"
33        NXT_SHARED_LOCAL_EXEC_LINK=
34
35        NXT_LIB_STATIC="libnxt.a"
36        NXT_LIB_SHARED="libnxt.so"
37        NXT_LIB_SHARED_LOCAL="$NXT_BUILD_DIR/libnxt.so"
38
39        NXT_LIBM="-lm"
40        NXT_LIBS="$NXT_LIBRT $NXT_LIBDL $NXT_PTHREAD"
41    ;;
42
43    FreeBSD)
44        nxt_have=NXT_FREEBSD . auto/have
45
46        NXT_STATIC_LINK="ar -r -c"
47        NXT_SHARED_LINK="\$(CC) -shared -Wl,-soname,libnxt.so"
48        NXT_SHARED_LOCAL_LINK="\$(CC) -shared \
49                               -Wl,-soname,\\\$\$ORIGIN/libnxt.so"
50        NXT_MODULE_LINK="\$(CC) -shared"
51
52        # "-Wl,-E" exports symbols of executable file.
53        NXT_EXEC_LINK="\$(CC) -Wl,-E"
54        # "-Wl,-z,origin" enables $ORIGIN processing.
55        NXT_SHARED_LOCAL_EXEC_LINK="-Wl,-z,origin"
56
57        NXT_LIB_STATIC="libnxt.a"
58        NXT_LIB_SHARED="libnxt.so"
59        NXT_LIB_SHARED_LOCAL="$NXT_BUILD_DIR/libnxt.so"
60
61        NXT_LIBM="-lm"
62        NXT_LIBS="$NXT_PTHREAD"
63    ;;
64
65    SunOS)
66        nxt_have=NXT_SOLARIS . auto/have
67
68        case "$NXT_CC_NAME" in
69
70            SunC):
71                NXT_STATIC_LINK="ar -r -c"
72                NXT_SHARED_LINK="\$(CC) -G -h libnxt.so"
73                NXT_SHARED_LOCAL_LINK="\$(CC) -G -h \\\$\$ORIGIN/libnxt.so"
74                NXT_MODULE_LINK="\$(CC) -G"
75            ;;
76
77            *)
78                NXT_STATIC_LINK="ar -r -c"
79                NXT_SHARED_LINK="\$(CC) -shared -Wl,-soname,libnxt.so"
80                NXT_SHARED_LOCAL_LINK="\$(CC) -shared \
81                                       -Wl,-soname,\\\$\$ORIGIN/libnxt.so"
82                NXT_MODULE_LINK="\$(CC) -shared"
83            ;;
84        esac
85
86        NXT_LIB_STATIC="libnxt.a"
87        NXT_LIB_SHARED="libnxt.so"
88        NXT_LIB_SHARED_LOCAL="$NXT_BUILD_DIR/libnxt.so"
89
90        NXT_EXEC_LINK="\$(CC)"
91        NXT_SHARED_LOCAL_EXEC_LINK=
92
93        NXT_LIBM="-lm"
94        NXT_LIBS="-lsocket $NXT_LIBSENDFILE"
95        NXT_LIBS="$NXT_LIBS $NXT_LIBRT $NXT_LIBDL $NXT_PTHREAD"
96    ;;
97
98    Darwin)
99        nxt_have=NXT_MACOSX . auto/have
100
101        # HFS+ volumes are caseless by default.
102        nxt_have=NXT_HAVE_CASELESS_FILESYSTEM . auto/have
103
104        # MacOSX 10.6 (Snow Leopard) has deprecated ucontext(3).
105        # MacOSX 10.7 (Lion) has deprecated system OpenSSL.
106        # MAC_OS_X_VERSION_MIN_REQUIRED macro does not help.
107        # The minimum version allowed for i386 is 10.4 (Tiger).
108        NXT_CFLAGS="$NXT_CFLAGS -mmacosx-version-min=10.4"
109
110        NXT_STATIC_LINK="ar -r -c"
111        NXT_SHARED_LINK="\$(CC) -dynamiclib"
112        NXT_SHARED_LOCAL_LINK="\$(CC) -dynamiclib \
113                               -install_name @executable_path/libnxt.dylib"
114
115        # Prior to MacOSX 10.5 (Leopard) only bundles could be unloaded.
116        NXT_MODULE_LINK="\$(CC) -bundle -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_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