summaryrefslogtreecommitdiffhomepage
path: root/auto/os/conf
blob: 6d86a849fc9d40a05c1622c15dd3149ce7223218 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243

# Copyright (C) Igor Sysoev
# Copyright (C) NGINX, Inc.


# To support dynamically loaded modules libnxt library must be a shared
# object itself because an application linked with static libnxt library
# may lack code required by the modules.  Dynamic linkers allow to specify
# relative path in SONAME library entry or in RPATH executable entry.
#
# Solaris 7, Linux 2.2, and FreeBSD 7.3 support $ORIGIN variable.
# MacOSX supports @executable_path variable.
# NetBSD does not support $ORIGIN variable.
#
# "ar -r" is enough to create a static library, ranlib is surplus.
# "ar -c" disables the "creating archive" warning.


case "$NXT_SYSTEM" in

    Linux)
        nxt_have=NXT_LINUX . auto/have

        NXT_STATIC_LINK="ar -r -c"
        NXT_SHARED_LINK="\$(CC) -shared -Wl,-soname,libnxt.so"
        NXT_SHARED_LOCAL_LINK="\$(CC) -shared \
                               -Wl,-soname,\\\$\$ORIGIN/libnxt.so"
        NXT_MODULE_LINK="\$(CC) -shared"

        # "-Wl,-E" exports symbols of executable file.
        NXT_EXEC_LINK="\$(CC) -Wl,-E"
        NXT_SHARED_LOCAL_EXEC_LINK=

        NXT_LIB_STATIC="libnxt.a"
        NXT_LIB_SHARED="libnxt.so"
        NXT_LIB_SHARED_LOCAL="$NXT_BUILD_DIR/libnxt.so"

        NXT_LIBM="-lm"
        NXT_LIBS="$NXT_LIBRT $NXT_LIBDL $NXT_PTHREAD"
    ;;

    FreeBSD)
        nxt_have=NXT_FREEBSD . auto/have

        NXT_STATIC_LINK="ar -r -c"
        NXT_SHARED_LINK="\$(CC) -shared -Wl,-soname,libnxt.so"
        NXT_SHARED_LOCAL_LINK="\$(CC) -shared \
                               -Wl,-soname,\\\$\$ORIGIN/libnxt.so"
        NXT_MODULE_LINK="\$(CC) -shared"

        # "-Wl,-E" exports symbols of executable file.
        NXT_EXEC_LINK="\$(CC) -Wl,-E"
        # "-Wl,-z,origin" enables $ORIGIN processing.
        NXT_SHARED_LOCAL_EXEC_LINK="-Wl,-z,origin"

        NXT_LIB_STATIC="libnxt.a"
        NXT_LIB_SHARED="libnxt.so"
        NXT_LIB_SHARED_LOCAL="$NXT_BUILD_DIR/libnxt.so"

        NXT_LIBM="-lm"
        NXT_LIBS="$NXT_PTHREAD"
    ;;

    SunOS)
        nxt_have=NXT_SOLARIS . auto/have

        case "$NXT_CC_NAME" in

            SunC):
                NXT_STATIC_LINK="ar -r -c"
                NXT_SHARED_LINK="\$(CC) -G -h libnxt.so"
                NXT_SHARED_LOCAL_LINK="\$(CC) -G -h \\\$\$ORIGIN/libnxt.so"
                NXT_MODULE_LINK="\$(CC) -G"
            ;;

            *)
                NXT_STATIC_LINK="ar -r -c"
                NXT_SHARED_LINK="\$(CC) -shared -Wl,-soname,libnxt.so"
                NXT_SHARED_LOCAL_LINK="\$(CC) -shared \
                                       -Wl,-soname,\\\$\$ORIGIN/libnxt.so"
                NXT_MODULE_LINK="\$(CC) -shared"
            ;;
        esac

        NXT_LIB_STATIC="libnxt.a"
        NXT_LIB_SHARED="libnxt.so"
        NXT_LIB_SHARED_LOCAL="$NXT_BUILD_DIR/libnxt.so"

        NXT_EXEC_LINK="\$(CC)"
        NXT_SHARED_LOCAL_EXEC_LINK=

        NXT_LIBM="-lm"
        NXT_LIBS="-lsocket $NXT_LIBSENDFILE"
        NXT_LIBS="$NXT_LIBS $NXT_LIBRT $NXT_LIBDL $NXT_PTHREAD"
    ;;

    Darwin)
        nxt_have=NXT_MACOSX . auto/have

        # HFS+ volumes are caseless by default.
        nxt_have=NXT_HAVE_CASELESS_FILESYSTEM . auto/have

        # MacOSX 10.6 (Snow Leopard) has deprecated ucontext(3).
        # MacOSX 10.7 (Lion) has deprecated system OpenSSL.
        # MAC_OS_X_VERSION_MIN_REQUIRED macro does not help.
        # "-rpath" is supported since MacOSX 10.5 (Leopard).
        NXT_CFLAGS="$NXT_CFLAGS -mmacosx-version-min=10.5"

        NXT_STATIC_LINK="ar -r -c"
        NXT_SHARED_LINK="\$(CC) -dynamiclib"
        NXT_SHARED_LOCAL_LINK="\$(CC) -dynamiclib \
                               -install_name @executable_path/libnxt.dylib"

        # Prior to MacOSX 10.5 (Leopard) only bundles could be unloaded.
        # NXT_MODULE_LINK="\$(CC) -bundle -undefined dynamic_lookup"
        NXT_MODULE_LINK="\$(CC) -dynamiclib -undefined dynamic_lookup"

        NXT_EXEC_LINK="\$(CC)"
        NXT_SHARED_LOCAL_EXEC_LINK=

        NXT_LIB_STATIC="libnxt.a"
        NXT_LIB_SHARED="libnxt.dylib"
        NXT_LIB_SHARED_LOCAL="$NXT_BUILD_DIR/libnxt.dylib"

        # MacOSX libm.dylib is a symlink to libSystem.dylib.
        NXT_LIBM=
        NXT_LIBS=

    ;;

    NetBSD)
        nxt_have=NXT_NETBSD . auto/have

        NXT_STATIC_LINK="ar -r -c"
        NXT_SHARED_LINK="\$(CC) -shared"
        NXT_SHARED_LOCAL_LINK="\$(CC) -shared"
        NXT_MODULE_LINK="\$(CC) -shared"

        NXT_EXEC_LINK="\$(CC)"
        NXT_SHARED_LOCAL_EXEC_LINK=

        NXT_LIB_STATIC="libnxt.a"
        NXT_LIB_SHARED="libnxt.so"
        NXT_LIB_SHARED_LOCAL="$NXT_BUILD_DIR/libnxt.so"

        NXT_LIBM="-lm"
        NXT_LIBS="$NXT_PTHREAD"
    ;;

    OpenBSD)
        nxt_have=NXT_OPENBSD . auto/have

        NXT_STATIC_LINK="ar -r -c"
        NXT_SHARED_LINK="\$(CC) -shared"
        NXT_SHARED_LOCAL_LINK="\$(CC) -shared"
        NXT_MODULE_LINK="\$(CC) -shared"

        NXT_EXEC_LINK="\$(CC)"
        NXT_SHARED_LOCAL_EXEC_LINK=

        NXT_LIB_STATIC="libnxt.a"
        NXT_LIB_SHARED="libnxt.so"
        NXT_LIB_SHARED_LOCAL="$NXT_BUILD_DIR/libnxt.so"

        NXT_LIBM="-lm"
        NXT_LIBS="$NXT_PTHREAD"
    ;;

    AIX)
        nxt_have=NXT_AIX . auto/have

        NXT_STATIC_LINK="ar -r -c"
        NXT_SHARED_LINK="\$(CC) -G"
        NXT_SHARED_LOCAL_LINK="\$(CC) -G"
        NXT_MODULE_LINK="\$(CC) -G"

        NXT_EXEC_LINK="\$(CC)"
        NXT_SHARED_LOCAL_EXEC_LINK=

        NXT_LIB_STATIC="libnxt.a"
        NXT_LIB_SHARED="libnxt.so"
        NXT_LIB_SHARED_LOCAL="$NXT_BUILD_DIR/libnxt.so"

        NXT_LIBM="-lm"
        NXT_LIBS="$NXT_PTHREAD"
    ;;

    HP-UX)
        nxt_have=NXT_HPUX . auto/have

        NXT_EXEC_LINK="\$(CC)"
        NXT_SHARED_LOCAL_EXEC_LINK=

        NXT_STATIC_LINK="ar -r -c"
        NXT_SHARED_LINK="\$(CC) -shared"
        NXT_SHARED_LOCAL_LINK="\$(CC) -shared"
        NXT_MODULE_LINK="\$(CC) -shared"

        NXT_LIB_STATIC="libnxt.a"
        NXT_LIB_SHARED="libnxt.so"
        NXT_LIB_SHARED_LOCAL="$NXT_BUILD_DIR/libnxt.so"

        NXT_LIBM="-lm"
        NXT_LIBS="$NXT_PTHREAD $NXT_LIBHG"
    ;;

    QNX)
        nxt_have=NXT_QNX . auto/have

        NXT_STATIC_LINK="ar -r -c"
        NXT_SHARED_LINK="\$(CC) -shared"
        NXT_SHARED_LOCAL_LINK="\$(CC) -shared"
        NXT_MODULE_LINK="\$(CC) -shared"

        NXT_EXEC_LINK="\$(CC)"
        NXT_SHARED_LOCAL_EXEC_LINK=

        NXT_LIB_STATIC="libnxt.a"
        NXT_LIB_SHARED="libnxt.so"
        NXT_LIB_SHARED_LOCAL="$NXT_BUILD_DIR/libnxt.so"

        NXT_LIBM="-lm"
        NXT_LIBS="$NXT_PTHREAD"
    ;;

    *)
        NXT_STATIC_LINK="ar -r -c"
        NXT_SHARED_LINK="\$(CC) -shared"
        NXT_SHARED_LOCAL_LINK="\$(CC) -shared"
        NXT_MODULE_LINK="\$(CC) -shared"

        # "-Wl,-E" exports symbols of executable file.
        NXT_EXEC_LINK="\$(CC) -Wl,-E"
        NXT_SHARED_LOCAL_EXEC_LINK=

        NXT_LIB_STATIC="libnxt.a"
        NXT_LIB_SHARED="libnxt.so"
        NXT_LIB_SHARED_LOCAL="$NXT_BUILD_DIR/libnxt.so"

        NXT_LIBM="-lm"
        NXT_LIBS="$NXT_LIBRT $NXT_LIBDL $NXT_PTHREAD"
    ;;
esac