diff options
author | Igor Sysoev <igor@sysoev.ru> | 2017-01-17 20:00:00 +0300 |
---|---|---|
committer | Igor Sysoev <igor@sysoev.ru> | 2017-01-17 20:00:00 +0300 |
commit | 16cbf3c076a0aca6d47adaf3f719493674cf2363 (patch) | |
tree | e6530480020f62a2bdbf249988ec3e2a751d3927 /auto/os | |
download | unit-16cbf3c076a0aca6d47adaf3f719493674cf2363.tar.gz unit-16cbf3c076a0aca6d47adaf3f719493674cf2363.tar.bz2 |
Initial version.
Diffstat (limited to 'auto/os')
-rw-r--r-- | auto/os/conf | 243 | ||||
-rw-r--r-- | auto/os/test | 93 |
2 files changed, 336 insertions, 0 deletions
diff --git a/auto/os/conf b/auto/os/conf new file mode 100644 index 00000000..3db382c6 --- /dev/null +++ b/auto/os/conf @@ -0,0 +1,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" + 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. + # The minimum version allowed for i386 is 10.4 (Tiger). + NXT_CFLAGS="$NXT_CFLAGS -mmacosx-version-min=10.4" + + 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_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 diff --git a/auto/os/test b/auto/os/test new file mode 100644 index 00000000..36ce50ae --- /dev/null +++ b/auto/os/test @@ -0,0 +1,93 @@ + +# Copyright (C) Igor Sysoev +# Copyright (C) NGINX, Inc. + + +NXT_SYSTEM=`uname -s 2>/dev/null` + + +case "$NXT_SYSTEM" in + + Linux) + NXT_SYSTEM_VERSION=`uname -r 2>/dev/null` + # Linux uname -p can return "unknown". + NXT_SYSTEM_PLATFORM=`uname -m 2>/dev/null` + echo=echo + CC=${CC:-cc} + ;; + + FreeBSD | NetBSD | OpenBSD) + NXT_SYSTEM_VERSION=`uname -r 2>/dev/null` + NXT_SYSTEM_PLATFORM=`uname -m 2>/dev/null` + echo=echo + CC=${CC:-cc} + ;; + + SunOS) + NXT_SYSTEM_VERSION=`uname -r 2>/dev/null` + NXT_SYSTEM_PLATFORM=`uname -p 2>/dev/null` + echo=echo + CC=${CC:-gcc} + + NXT_TEST_CFLAGS="$NXT_TEST_CFLAGS -D_XOPEN_SOURCE" + NXT_TEST_CFLAGS="$NXT_TEST_CFLAGS -D_XOPEN_SOURCE_EXTENDED=1" + NXT_TEST_CFLAGS="$NXT_TEST_CFLAGS -D__EXTENSIONS__" + NXT_TEST_LIBS="-lsocket" + ;; + + Darwin) + NXT_SYSTEM_VERSION=`uname -r 2>/dev/null` + NXT_SYSTEM_PLATFORM=`uname -m 2>/dev/null` + echo=echo + CC=${CC:-cc} + + NXT_TEST_CFLAGS="$NXT_TEST_CFLAGS -mmacosx-version-min=10.4" + ;; + + AIX) + NXT_SYSTEM_VERSION="`uname -v 2>/dev/null`.`uname -r 2>/dev/null`" + NXT_SYSTEM_PLATFORM=`uname -p 2>/dev/null` + echo=echo + CC=${CC:-gcc} + ;; + + HP-UX) + NXT_SYSTEM_VERSION=`uname -r 2>/dev/null` + NXT_SYSTEM_PLATFORM=`uname -m 2>/dev/null` + echo=echo + CC=${CC:-gcc} + + NXT_TEST_CFLAGS="$NXT_TEST_CFLAGS -D_XOPEN_SOURCE" + NXT_TEST_CFLAGS="$NXT_TEST_CFLAGS -D_XOPEN_SOURCE_EXTENDED" + NXT_TEST_CFLAGS="$NXT_TEST_CFLAGS -D_HPUX_ALT_XOPEN_SOCKET_API" + ;; + + QNX) + NXT_SYSTEM_VERSION=`uname -r 2>/dev/null` + NXT_SYSTEM_PLATFORM=`uname -p 2>/dev/null` + echo=echo + CC=${CC:-gcc} + ;; + + MINGW*) + # MinGW /bin/sh builtin "echo" omits newline under Wine + # for some reason, so use a portable echo.c program built + # using MinGW GCC with only msvcrt.dll dependence. + + NXT_SYSTEM_VERSION=`uname -r 2>/dev/null` + NXT_SYSTEM_PLATFORM=`uname -m 2>/dev/null` + echo=auto/echo/echo.exe + CC=${CC:-cl} + NXT_WINDOWS=YES + ;; + + *) + NXT_SYSTEM_VERSION=`uname -r 2>/dev/null` + NXT_SYSTEM_PLATFORM=`uname -p 2>/dev/null` + echo=echo + CC=${CC:-gcc} + ;; + +esac + +$echo configuring for $NXT_SYSTEM $NXT_SYSTEM_VERSION $NXT_SYSTEM_PLATFORM |