xref: /unit/configure (revision 246:f7cb63f38fd0)
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=}
21
22# STUB
23NXT_BUILD_DIR=build
24
25NXT_AUTOTEST=$NXT_BUILD_DIR/autotest
26NXT_AUTOCONF_ERR=$NXT_BUILD_DIR/autoconf.err
27NXT_AUTOCONF_DATA=$NXT_BUILD_DIR/autoconf.data
28NXT_AUTO_CONFIG_H=$NXT_BUILD_DIR/nxt_auto_config.h
29NXT_MAKEFILE=$NXT_BUILD_DIR/Makefile
30NXT_BIN=nginext
31
32
33CC=${CC:-cc}
34
35NXT_PID="nginext.pid"
36NXT_LOG="nginext.log"
37NXT_MODULES="modules/"
38NXT_CONTROL="unix:control.unit.sock"
39NXT_USER="nobody"
40NXT_GROUP=
41
42nxt_module=${1:-""}
43
44case $nxt_module in
45    --help)
46        . auto/help
47        exit 0
48    ;;
49
50    ""|--*)
51    ;;
52
53    unit)
54        shift
55    ;;
56
57    *)
58        . auto/modules/conf
59        exit 0
60    ;;
61esac
62
63
64. auto/os/test
65. auto/options
66
67test -d $NXT_BUILD_DIR || mkdir $NXT_BUILD_DIR
68
69> $NXT_AUTOCONF_ERR
70> $NXT_AUTO_CONFIG_H
71
72. auto/cc/test
73
74
75cat << END >> $NXT_AUTO_CONFIG_H
76
77#define NXT_CONFIGURE_OPTIONS  "$NXT_CONFIGURE_OPTIONS"
78#define NXT_SYSTEM_VERSION     "$NXT_SYSTEM $NXT_SYSTEM_VERSION $NXT_SYSTEM_PLATFORM"
79#define NXT_COMPILER_VERSION   "$NXT_CC_VERSION"
80
81#define NXT_PID                "$NXT_PID"
82#define NXT_LOG                "$NXT_LOG"
83#define NXT_MODULES            "$NXT_MODULES"
84
85#define NXT_CONTROL_SOCK       "$NXT_CONTROL"
86
87#define NXT_USER               "$NXT_USER"
88#define NXT_GROUP              "$NXT_GROUP"
89
90END
91
92
93if [ $echo = echo ]; then
94    # Build a portable "echo" program that supports only "-n" option.
95    # This also tests C compiler ability to create executables.
96    . auto/echo/build
97fi
98
99
100nxt_have=NXT_UNIX . auto/have
101
102if [ $NXT_UNIX_DOMAIN = YES ]; then
103    nxt_have=NXT_HAVE_UNIX_DOMAIN . auto/have
104fi
105
106. auto/types
107. auto/clang
108. auto/atomic
109. auto/malloc
110. auto/mmap
111. auto/shmem
112. auto/time
113. auto/threads
114. auto/events
115. auto/sockets
116. auto/sendfile
117. auto/files
118. auto/unix
119. auto/os/conf
120. auto/ssltls
121. auto/pcre
122
123
124case "$NXT_SYSTEM_PLATFORM" in
125    i386 | amd64 | x86_64)
126        nxt_have=NXT_HAVE_LITTLE_ENDIAN . auto/have
127        nxt_have=NXT_HAVE_NONALIGNED . auto/have
128    ;;
129esac
130
131
132if [ $NXT_DEBUG = YES ]; then
133    nxt_have=NXT_DEBUG . auto/have
134fi
135
136
137. auto/test_build
138. auto/sources
139. auto/save
140
141# LOOK
142
143NXT_LIB_AUX_CFLAGS="$NXT_OPENSSL_CFLAGS $NXT_GNUTLS_CFLAGS \\
144                    $NXT_CYASSL_CFLAGS $NXT_POLARSSL_CFLAGS \\
145                    $NXT_PCRE_CFLAGS"
146
147NXT_LIB_AUX_LIBS="$NXT_OPENSSL_LIBS $NXT_GNUTLS_LIBS \\
148                    $NXT_CYASSL_LIBS $NXT_POLARSSL_LIBS \\
149                    $NXT_PCRE_LIB"
150
151. auto/make
152. auto/summary
153