xref: /unit/configure (revision 231:6832cdee961e)
1#!/bin/sh
2
3# Copyright (C) Igor Sysoev
4# Copyright (C) NGINX, Inc.
5
6
7# Disable localized program messages.
8LANG=C
9export LANG
10
11# Stop on error exit status.
12set -e
13
14# Stop on uninitialized variable.
15set -u
16
17# Initialize variables with null values if they are not defined.
18CFLAGS=${CFLAGS=}
19NXT_TEST_CFLAGS=${NXT_TEST_CFLAGS=}
20NXT_TEST_LIBS=${NXT_TEST_LIBS=}
21NXT_UNIT_TEST_TARGETS=${NXT_UNIT_TEST_TARGETS=}
22
23# STUB
24NXT_BUILD_DIR=build
25
26NXT_AUTOTEST=$NXT_BUILD_DIR/autotest
27NXT_AUTOCONF_ERR=$NXT_BUILD_DIR/autoconf.err
28NXT_AUTOCONF_DATA=$NXT_BUILD_DIR/autoconf.data
29NXT_AUTO_CONFIG_H=$NXT_BUILD_DIR/nxt_auto_config.h
30NXT_MAKEFILE=$NXT_BUILD_DIR/Makefile
31NXT_BIN=nginext
32
33nxt_module=${1:-no}
34
35case $nxt_module in
36    no|--*)
37    ;;
38
39    unit)
40        shift
41    ;;
42
43    *)
44        . auto/modules/conf
45        exit 0
46    ;;
47esac
48
49. auto/os/test
50. auto/options
51
52test -d $NXT_BUILD_DIR || mkdir $NXT_BUILD_DIR
53
54> $NXT_AUTOCONF_ERR
55> $NXT_AUTO_CONFIG_H
56
57. auto/cc/test
58
59
60cat << END >> $NXT_AUTO_CONFIG_H
61
62#define NXT_CONFIGURE_OPTIONS  "$NXT_CONFIGURE_OPTIONS"
63#define NXT_SYSTEM_VERSION     "$NXT_SYSTEM $NXT_SYSTEM_VERSION $NXT_SYSTEM_PLATFORM"
64#define NXT_COMPILER_VERSION   "$NXT_CC_VERSION"
65
66#define NXT_PID                "$NXT_PID"
67#define NXT_LOG                "$NXT_LOG"
68
69END
70
71
72if [ $echo = echo ]; then
73    # Build a portable "echo" program that supports only "-n" option.
74    # This also tests C compiler ability to create executables.
75    . auto/echo/build
76fi
77
78
79nxt_have=NXT_UNIX . auto/have
80
81if [ $NXT_UNIX_DOMAIN = YES ]; then
82    nxt_have=NXT_HAVE_UNIX_DOMAIN . auto/have
83fi
84
85. auto/types
86. auto/clang
87. auto/atomic
88. auto/malloc
89. auto/mmap
90. auto/shmem
91. auto/time
92. auto/threads
93. auto/events
94. auto/sockets
95. auto/sendfile
96. auto/files
97. auto/unix
98. auto/os/conf
99. auto/ssltls
100. auto/pcre
101
102
103case "$NXT_SYSTEM_PLATFORM" in
104    i386 | amd64 | x86_64)
105        nxt_have=NXT_HAVE_LITTLE_ENDIAN . auto/have
106        nxt_have=NXT_HAVE_NONALIGNED . auto/have
107    ;;
108esac
109
110
111if [ $NXT_DEBUG = YES ]; then
112    nxt_have=NXT_DEBUG . auto/have
113fi
114
115
116. auto/test_build
117. auto/sources
118. auto/save
119
120# LOOK
121
122NXT_LIB_AUX_CFLAGS="$NXT_OPENSSL_CFLAGS $NXT_GNUTLS_CFLAGS \\
123                    $NXT_CYASSL_CFLAGS $NXT_POLARSSL_CFLAGS \\
124                    $NXT_PCRE_CFLAGS"
125
126NXT_LIB_AUX_LIBS="$NXT_OPENSSL_LIBS $NXT_GNUTLS_LIBS \\
127                    $NXT_CYASSL_LIBS $NXT_POLARSSL_LIBS \\
128                    $NXT_PCRE_LIB"
129
130. auto/make
131