xref: /unit/auto/os/conf (revision 1255:944efece387a)
10Sigor@sysoev.ru
20Sigor@sysoev.ru# Copyright (C) Igor Sysoev
30Sigor@sysoev.ru# Copyright (C) NGINX, Inc.
40Sigor@sysoev.ru
50Sigor@sysoev.ru
60Sigor@sysoev.ru# To support dynamically loaded modules libnxt library must be a shared
70Sigor@sysoev.ru# object itself because an application linked with static libnxt library
80Sigor@sysoev.ru# may lack code required by the modules.  Dynamic linkers allow to specify
90Sigor@sysoev.ru# relative path in SONAME library entry or in RPATH executable entry.
100Sigor@sysoev.ru#
110Sigor@sysoev.ru# Solaris 7, Linux 2.2, and FreeBSD 7.3 support $ORIGIN variable.
120Sigor@sysoev.ru# MacOSX supports @executable_path variable.
130Sigor@sysoev.ru# NetBSD does not support $ORIGIN variable.
140Sigor@sysoev.ru#
150Sigor@sysoev.ru# "ar -r" is enough to create a static library, ranlib is surplus.
160Sigor@sysoev.ru# "ar -c" disables the "creating archive" warning.
170Sigor@sysoev.ru
180Sigor@sysoev.ru
190Sigor@sysoev.rucase "$NXT_SYSTEM" in
200Sigor@sysoev.ru
210Sigor@sysoev.ru    Linux)
220Sigor@sysoev.ru        nxt_have=NXT_LINUX . auto/have
230Sigor@sysoev.ru
24*1255Svbart@nginx.com        NXT_STATIC_LINK="\$(AR) -r -c"
250Sigor@sysoev.ru        NXT_SHARED_LINK="\$(CC) -shared -Wl,-soname,libnxt.so"
260Sigor@sysoev.ru        NXT_SHARED_LOCAL_LINK="\$(CC) -shared \
270Sigor@sysoev.ru                               -Wl,-soname,\\\$\$ORIGIN/libnxt.so"
280Sigor@sysoev.ru        NXT_MODULE_LINK="\$(CC) -shared"
290Sigor@sysoev.ru
300Sigor@sysoev.ru        # "-Wl,-E" exports symbols of executable file.
310Sigor@sysoev.ru        NXT_EXEC_LINK="\$(CC) -Wl,-E"
320Sigor@sysoev.ru        NXT_SHARED_LOCAL_EXEC_LINK=
330Sigor@sysoev.ru
340Sigor@sysoev.ru        NXT_LIB_STATIC="libnxt.a"
350Sigor@sysoev.ru        NXT_LIB_SHARED="libnxt.so"
360Sigor@sysoev.ru        NXT_LIB_SHARED_LOCAL="$NXT_BUILD_DIR/libnxt.so"
370Sigor@sysoev.ru
38743Smax.romanov@nginx.com        NXT_LIB_UNIT_STATIC="libunit.a"
39743Smax.romanov@nginx.com
400Sigor@sysoev.ru        NXT_LIBM="-lm"
410Sigor@sysoev.ru        NXT_LIBS="$NXT_LIBRT $NXT_LIBDL $NXT_PTHREAD"
420Sigor@sysoev.ru    ;;
430Sigor@sysoev.ru
440Sigor@sysoev.ru    FreeBSD)
450Sigor@sysoev.ru        nxt_have=NXT_FREEBSD . auto/have
460Sigor@sysoev.ru
47*1255Svbart@nginx.com        NXT_STATIC_LINK="\$(AR) -r -c"
480Sigor@sysoev.ru        NXT_SHARED_LINK="\$(CC) -shared -Wl,-soname,libnxt.so"
490Sigor@sysoev.ru        NXT_SHARED_LOCAL_LINK="\$(CC) -shared \
500Sigor@sysoev.ru                               -Wl,-soname,\\\$\$ORIGIN/libnxt.so"
510Sigor@sysoev.ru        NXT_MODULE_LINK="\$(CC) -shared"
520Sigor@sysoev.ru
530Sigor@sysoev.ru        # "-Wl,-E" exports symbols of executable file.
540Sigor@sysoev.ru        NXT_EXEC_LINK="\$(CC) -Wl,-E"
550Sigor@sysoev.ru        # "-Wl,-z,origin" enables $ORIGIN processing.
560Sigor@sysoev.ru        NXT_SHARED_LOCAL_EXEC_LINK="-Wl,-z,origin"
570Sigor@sysoev.ru
580Sigor@sysoev.ru        NXT_LIB_STATIC="libnxt.a"
590Sigor@sysoev.ru        NXT_LIB_SHARED="libnxt.so"
600Sigor@sysoev.ru        NXT_LIB_SHARED_LOCAL="$NXT_BUILD_DIR/libnxt.so"
610Sigor@sysoev.ru
62743Smax.romanov@nginx.com        NXT_LIB_UNIT_STATIC="libunit.a"
63743Smax.romanov@nginx.com
640Sigor@sysoev.ru        NXT_LIBM="-lm"
65335Spluknet@nginx.com        NXT_LIBS="$NXT_LIBRT $NXT_PTHREAD"
660Sigor@sysoev.ru    ;;
670Sigor@sysoev.ru
680Sigor@sysoev.ru    SunOS)
690Sigor@sysoev.ru        nxt_have=NXT_SOLARIS . auto/have
700Sigor@sysoev.ru
710Sigor@sysoev.ru        case "$NXT_CC_NAME" in
720Sigor@sysoev.ru
730Sigor@sysoev.ru            SunC):
74*1255Svbart@nginx.com                NXT_STATIC_LINK="\$(AR) -r -c"
750Sigor@sysoev.ru                NXT_SHARED_LINK="\$(CC) -G -h libnxt.so"
760Sigor@sysoev.ru                NXT_SHARED_LOCAL_LINK="\$(CC) -G -h \\\$\$ORIGIN/libnxt.so"
770Sigor@sysoev.ru                NXT_MODULE_LINK="\$(CC) -G"
780Sigor@sysoev.ru            ;;
790Sigor@sysoev.ru
800Sigor@sysoev.ru            *)
81*1255Svbart@nginx.com                NXT_STATIC_LINK="\$(AR) -r -c"
820Sigor@sysoev.ru                NXT_SHARED_LINK="\$(CC) -shared -Wl,-soname,libnxt.so"
830Sigor@sysoev.ru                NXT_SHARED_LOCAL_LINK="\$(CC) -shared \
840Sigor@sysoev.ru                                       -Wl,-soname,\\\$\$ORIGIN/libnxt.so"
850Sigor@sysoev.ru                NXT_MODULE_LINK="\$(CC) -shared"
860Sigor@sysoev.ru            ;;
870Sigor@sysoev.ru        esac
880Sigor@sysoev.ru
890Sigor@sysoev.ru        NXT_LIB_STATIC="libnxt.a"
900Sigor@sysoev.ru        NXT_LIB_SHARED="libnxt.so"
910Sigor@sysoev.ru        NXT_LIB_SHARED_LOCAL="$NXT_BUILD_DIR/libnxt.so"
920Sigor@sysoev.ru
93743Smax.romanov@nginx.com        NXT_LIB_UNIT_STATIC="libunit.a"
94743Smax.romanov@nginx.com
950Sigor@sysoev.ru        NXT_EXEC_LINK="\$(CC)"
960Sigor@sysoev.ru        NXT_SHARED_LOCAL_EXEC_LINK=
970Sigor@sysoev.ru
980Sigor@sysoev.ru        NXT_LIBM="-lm"
990Sigor@sysoev.ru        NXT_LIBS="-lsocket $NXT_LIBSENDFILE"
1000Sigor@sysoev.ru        NXT_LIBS="$NXT_LIBS $NXT_LIBRT $NXT_LIBDL $NXT_PTHREAD"
1010Sigor@sysoev.ru    ;;
1020Sigor@sysoev.ru
1030Sigor@sysoev.ru    Darwin)
1040Sigor@sysoev.ru        nxt_have=NXT_MACOSX . auto/have
1050Sigor@sysoev.ru
1060Sigor@sysoev.ru        # HFS+ volumes are caseless by default.
1070Sigor@sysoev.ru        nxt_have=NXT_HAVE_CASELESS_FILESYSTEM . auto/have
1080Sigor@sysoev.ru
109*1255Svbart@nginx.com        NXT_STATIC_LINK="\$(AR) -r -c"
1100Sigor@sysoev.ru        NXT_SHARED_LINK="\$(CC) -dynamiclib"
1110Sigor@sysoev.ru        NXT_SHARED_LOCAL_LINK="\$(CC) -dynamiclib \
1120Sigor@sysoev.ru                               -install_name @executable_path/libnxt.dylib"
113216Sigor@sysoev.ru        NXT_MODULE_LINK="\$(CC) -dynamiclib -undefined dynamic_lookup"
1140Sigor@sysoev.ru
1150Sigor@sysoev.ru        NXT_EXEC_LINK="\$(CC)"
1160Sigor@sysoev.ru        NXT_SHARED_LOCAL_EXEC_LINK=
1170Sigor@sysoev.ru
1180Sigor@sysoev.ru        NXT_LIB_STATIC="libnxt.a"
1190Sigor@sysoev.ru        NXT_LIB_SHARED="libnxt.dylib"
1200Sigor@sysoev.ru        NXT_LIB_SHARED_LOCAL="$NXT_BUILD_DIR/libnxt.dylib"
1210Sigor@sysoev.ru
122743Smax.romanov@nginx.com        NXT_LIB_UNIT_STATIC="libunit.a"
123743Smax.romanov@nginx.com
1240Sigor@sysoev.ru        # MacOSX libm.dylib is a symlink to libSystem.dylib.
1250Sigor@sysoev.ru        NXT_LIBM=
1260Sigor@sysoev.ru        NXT_LIBS=
1270Sigor@sysoev.ru
1280Sigor@sysoev.ru    ;;
1290Sigor@sysoev.ru
1300Sigor@sysoev.ru    NetBSD)
1310Sigor@sysoev.ru        nxt_have=NXT_NETBSD . auto/have
1320Sigor@sysoev.ru
133*1255Svbart@nginx.com        NXT_STATIC_LINK="\$(AR) -r -c"
1340Sigor@sysoev.ru        NXT_SHARED_LINK="\$(CC) -shared"
1350Sigor@sysoev.ru        NXT_SHARED_LOCAL_LINK="\$(CC) -shared"
1360Sigor@sysoev.ru        NXT_MODULE_LINK="\$(CC) -shared"
1370Sigor@sysoev.ru
138420Spluknet@nginx.com        # "-Wl,-E" exports symbols of executable file.
139420Spluknet@nginx.com        NXT_EXEC_LINK="\$(CC) -Wl,-E"
1400Sigor@sysoev.ru        NXT_SHARED_LOCAL_EXEC_LINK=
1410Sigor@sysoev.ru
1420Sigor@sysoev.ru        NXT_LIB_STATIC="libnxt.a"
1430Sigor@sysoev.ru        NXT_LIB_SHARED="libnxt.so"
1440Sigor@sysoev.ru        NXT_LIB_SHARED_LOCAL="$NXT_BUILD_DIR/libnxt.so"
1450Sigor@sysoev.ru
146743Smax.romanov@nginx.com        NXT_LIB_UNIT_STATIC="libunit.a"
147743Smax.romanov@nginx.com
1480Sigor@sysoev.ru        NXT_LIBM="-lm"
149335Spluknet@nginx.com        NXT_LIBS="$NXT_LIBRT $NXT_PTHREAD"
1500Sigor@sysoev.ru    ;;
1510Sigor@sysoev.ru
1520Sigor@sysoev.ru    OpenBSD)
1530Sigor@sysoev.ru        nxt_have=NXT_OPENBSD . auto/have
1540Sigor@sysoev.ru
155*1255Svbart@nginx.com        NXT_STATIC_LINK="\$(AR) -r -c"
1560Sigor@sysoev.ru        NXT_SHARED_LINK="\$(CC) -shared"
1570Sigor@sysoev.ru        NXT_SHARED_LOCAL_LINK="\$(CC) -shared"
1580Sigor@sysoev.ru        NXT_MODULE_LINK="\$(CC) -shared"
1590Sigor@sysoev.ru
160644Spluknet@nginx.com        # "-Wl,-E" exports symbols of executable file.
161644Spluknet@nginx.com        NXT_EXEC_LINK="\$(CC) -Wl,-E"
1620Sigor@sysoev.ru        NXT_SHARED_LOCAL_EXEC_LINK=
1630Sigor@sysoev.ru
1640Sigor@sysoev.ru        NXT_LIB_STATIC="libnxt.a"
1650Sigor@sysoev.ru        NXT_LIB_SHARED="libnxt.so"
1660Sigor@sysoev.ru        NXT_LIB_SHARED_LOCAL="$NXT_BUILD_DIR/libnxt.so"
1670Sigor@sysoev.ru
168743Smax.romanov@nginx.com        NXT_LIB_UNIT_STATIC="libunit.a"
169743Smax.romanov@nginx.com
1700Sigor@sysoev.ru        NXT_LIBM="-lm"
1710Sigor@sysoev.ru        NXT_LIBS="$NXT_PTHREAD"
1720Sigor@sysoev.ru    ;;
1730Sigor@sysoev.ru
174461Sigor@sysoev.ru    DragonFly)
175461Sigor@sysoev.ru        nxt_have=NXT_DRAGONFLY . auto/have
176461Sigor@sysoev.ru
177*1255Svbart@nginx.com        NXT_STATIC_LINK="\$(AR) -r -c"
178461Sigor@sysoev.ru        NXT_SHARED_LINK="\$(CC) -shared"
179461Sigor@sysoev.ru        NXT_SHARED_LOCAL_LINK="\$(CC) -shared"
180461Sigor@sysoev.ru        NXT_MODULE_LINK="\$(CC) -shared"
181461Sigor@sysoev.ru
182461Sigor@sysoev.ru        # "-Wl,-E" exports symbols of executable file.
183461Sigor@sysoev.ru        NXT_EXEC_LINK="\$(CC) -Wl,-E"
184461Sigor@sysoev.ru        NXT_SHARED_LOCAL_EXEC_LINK=
185461Sigor@sysoev.ru
186461Sigor@sysoev.ru        NXT_LIB_STATIC="libnxt.a"
187461Sigor@sysoev.ru        NXT_LIB_SHARED="libnxt.so"
188461Sigor@sysoev.ru        NXT_LIB_SHARED_LOCAL="$NXT_BUILD_DIR/libnxt.so"
189461Sigor@sysoev.ru
190743Smax.romanov@nginx.com        NXT_LIB_UNIT_STATIC="libunit.a"
191743Smax.romanov@nginx.com
192461Sigor@sysoev.ru        NXT_LIBM="-lm"
193461Sigor@sysoev.ru        NXT_LIBS="$NXT_LIBRT $NXT_PTHREAD"
194461Sigor@sysoev.ru    ;;
195461Sigor@sysoev.ru
1960Sigor@sysoev.ru    AIX)
1970Sigor@sysoev.ru        nxt_have=NXT_AIX . auto/have
1980Sigor@sysoev.ru
199*1255Svbart@nginx.com        NXT_STATIC_LINK="\$(AR) -r -c"
2000Sigor@sysoev.ru        NXT_SHARED_LINK="\$(CC) -G"
2010Sigor@sysoev.ru        NXT_SHARED_LOCAL_LINK="\$(CC) -G"
2020Sigor@sysoev.ru        NXT_MODULE_LINK="\$(CC) -G"
2030Sigor@sysoev.ru
2040Sigor@sysoev.ru        NXT_EXEC_LINK="\$(CC)"
2050Sigor@sysoev.ru        NXT_SHARED_LOCAL_EXEC_LINK=
2060Sigor@sysoev.ru
2070Sigor@sysoev.ru        NXT_LIB_STATIC="libnxt.a"
2080Sigor@sysoev.ru        NXT_LIB_SHARED="libnxt.so"
2090Sigor@sysoev.ru        NXT_LIB_SHARED_LOCAL="$NXT_BUILD_DIR/libnxt.so"
2100Sigor@sysoev.ru
211743Smax.romanov@nginx.com        NXT_LIB_UNIT_STATIC="libunit.a"
212743Smax.romanov@nginx.com
2130Sigor@sysoev.ru        NXT_LIBM="-lm"
2140Sigor@sysoev.ru        NXT_LIBS="$NXT_PTHREAD"
2150Sigor@sysoev.ru    ;;
2160Sigor@sysoev.ru
2170Sigor@sysoev.ru    HP-UX)
2180Sigor@sysoev.ru        nxt_have=NXT_HPUX . auto/have
2190Sigor@sysoev.ru
2200Sigor@sysoev.ru        NXT_EXEC_LINK="\$(CC)"
2210Sigor@sysoev.ru        NXT_SHARED_LOCAL_EXEC_LINK=
2220Sigor@sysoev.ru
223*1255Svbart@nginx.com        NXT_STATIC_LINK="\$(AR) -r -c"
2240Sigor@sysoev.ru        NXT_SHARED_LINK="\$(CC) -shared"
2250Sigor@sysoev.ru        NXT_SHARED_LOCAL_LINK="\$(CC) -shared"
2260Sigor@sysoev.ru        NXT_MODULE_LINK="\$(CC) -shared"
2270Sigor@sysoev.ru
2280Sigor@sysoev.ru        NXT_LIB_STATIC="libnxt.a"
2290Sigor@sysoev.ru        NXT_LIB_SHARED="libnxt.so"
2300Sigor@sysoev.ru        NXT_LIB_SHARED_LOCAL="$NXT_BUILD_DIR/libnxt.so"
2310Sigor@sysoev.ru
232743Smax.romanov@nginx.com        NXT_LIB_UNIT_STATIC="libunit.a"
233743Smax.romanov@nginx.com
2340Sigor@sysoev.ru        NXT_LIBM="-lm"
2350Sigor@sysoev.ru        NXT_LIBS="$NXT_PTHREAD $NXT_LIBHG"
2360Sigor@sysoev.ru    ;;
2370Sigor@sysoev.ru
2380Sigor@sysoev.ru    QNX)
2390Sigor@sysoev.ru        nxt_have=NXT_QNX . auto/have
2400Sigor@sysoev.ru
241*1255Svbart@nginx.com        NXT_STATIC_LINK="\$(AR) -r -c"
2420Sigor@sysoev.ru        NXT_SHARED_LINK="\$(CC) -shared"
2430Sigor@sysoev.ru        NXT_SHARED_LOCAL_LINK="\$(CC) -shared"
2440Sigor@sysoev.ru        NXT_MODULE_LINK="\$(CC) -shared"
2450Sigor@sysoev.ru
2460Sigor@sysoev.ru        NXT_EXEC_LINK="\$(CC)"
2470Sigor@sysoev.ru        NXT_SHARED_LOCAL_EXEC_LINK=
2480Sigor@sysoev.ru
2490Sigor@sysoev.ru        NXT_LIB_STATIC="libnxt.a"
2500Sigor@sysoev.ru        NXT_LIB_SHARED="libnxt.so"
2510Sigor@sysoev.ru        NXT_LIB_SHARED_LOCAL="$NXT_BUILD_DIR/libnxt.so"
2520Sigor@sysoev.ru
253743Smax.romanov@nginx.com        NXT_LIB_UNIT_STATIC="libunit.a"
254743Smax.romanov@nginx.com
2550Sigor@sysoev.ru        NXT_LIBM="-lm"
2560Sigor@sysoev.ru        NXT_LIBS="$NXT_PTHREAD"
2570Sigor@sysoev.ru    ;;
2580Sigor@sysoev.ru
2590Sigor@sysoev.ru    *)
260*1255Svbart@nginx.com        NXT_STATIC_LINK="\$(AR) -r -c"
2610Sigor@sysoev.ru        NXT_SHARED_LINK="\$(CC) -shared"
2620Sigor@sysoev.ru        NXT_SHARED_LOCAL_LINK="\$(CC) -shared"
2630Sigor@sysoev.ru        NXT_MODULE_LINK="\$(CC) -shared"
2640Sigor@sysoev.ru
2650Sigor@sysoev.ru        # "-Wl,-E" exports symbols of executable file.
2660Sigor@sysoev.ru        NXT_EXEC_LINK="\$(CC) -Wl,-E"
2670Sigor@sysoev.ru        NXT_SHARED_LOCAL_EXEC_LINK=
2680Sigor@sysoev.ru
2690Sigor@sysoev.ru        NXT_LIB_STATIC="libnxt.a"
2700Sigor@sysoev.ru        NXT_LIB_SHARED="libnxt.so"
2710Sigor@sysoev.ru        NXT_LIB_SHARED_LOCAL="$NXT_BUILD_DIR/libnxt.so"
2720Sigor@sysoev.ru
273743Smax.romanov@nginx.com        NXT_LIB_UNIT_STATIC="libunit.a"
274743Smax.romanov@nginx.com
2750Sigor@sysoev.ru        NXT_LIBM="-lm"
2760Sigor@sysoev.ru        NXT_LIBS="$NXT_LIBRT $NXT_LIBDL $NXT_PTHREAD"
2770Sigor@sysoev.ru    ;;
2780Sigor@sysoev.ruesac
279