xref: /unit/configure (revision 2150:393e49268716)
1#!/bin/sh
2
3# Copyright (C) Igor Sysoev
4# Copyright (C) NGINX, Inc.
5
6
7# Disable localized program messages.
8LC_ALL=C
9export LC_ALL
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
22NXT_BUILD_DIR=${NXT_BUILD_DIR:-build}
23
24NXT_AUTOTEST=$NXT_BUILD_DIR/autotest
25NXT_AUTOCONF_ERR=$NXT_BUILD_DIR/autoconf.err
26NXT_AUTOCONF_DATA=$NXT_BUILD_DIR/autoconf.data
27NXT_AUTO_CONFIG_H=$NXT_BUILD_DIR/nxt_auto_config.h
28NXT_VERSION_H=$NXT_BUILD_DIR/nxt_version.h
29NXT_MAKEFILE=$NXT_BUILD_DIR/Makefile
30
31CC=${CC:-cc}
32
33NXT_DAEMON=unitd
34NXT_BINDIR="bin"
35NXT_SBINDIR="sbin"
36NXT_LIBDIR="lib"
37NXT_INCDIR="include"
38NXT_MANDIR="share/man"
39NXT_MODULES="modules"
40NXT_STATE="state"
41NXT_TMP="tmp"
42NXT_PID="unit.pid"
43NXT_LOG="unit.log"
44NXT_CONTROL="unix:control.unit.sock"
45NXT_USER="nobody"
46NXT_GROUP=
47
48nxt_module=${1:-""}
49
50case $nxt_module in
51    ""|--*)
52    ;;
53
54    unit)
55        shift
56    ;;
57
58    *)
59        . auto/modules/conf
60        exit 0
61    ;;
62esac
63
64
65. ./version
66. auto/os/test
67. auto/options
68
69test -d $NXT_BUILD_DIR || mkdir $NXT_BUILD_DIR
70
71> $NXT_AUTOCONF_ERR
72> $NXT_AUTO_CONFIG_H
73
74. auto/cc/test
75
76
77cat << END >> $NXT_AUTO_CONFIG_H
78
79#define NXT_CONFIGURE_OPTIONS  "$NXT_CONFIGURE_OPTIONS"
80#define NXT_SYSTEM_VERSION     "$NXT_SYSTEM $NXT_SYSTEM_VERSION $NXT_SYSTEM_PLATFORM"
81#define NXT_COMPILER_VERSION   "$NXT_CC_VERSION"
82
83#define NXT_PID                "$NXT_PID"
84#define NXT_LOG                "$NXT_LOG"
85#define NXT_MODULES            "$NXT_MODULES"
86#define NXT_STATE              "$NXT_STATE"
87#define NXT_TMP                "$NXT_TMP"
88
89#define NXT_CONTROL_SOCK       "$NXT_CONTROL"
90
91#define NXT_USER               "$NXT_USER"
92#define NXT_GROUP              "$NXT_GROUP"
93
94END
95
96
97if [ $echo = echo ]; then
98    # Build a portable "echo" program that supports only "-n" option.
99    # This also tests C compiler ability to create executables.
100    . auto/echo/build
101fi
102
103
104nxt_have=NXT_UNIX . auto/have
105
106if [ $NXT_UNIX_DOMAIN = YES ]; then
107    nxt_have=NXT_HAVE_UNIX_DOMAIN . auto/have
108fi
109
110NXT_LIBRT=
111
112. auto/types
113. auto/clang
114. auto/atomic
115. auto/malloc
116. auto/mmap
117. auto/shmem
118. auto/time
119. auto/threads
120. auto/events
121. auto/sockets
122. auto/sendfile
123. auto/files
124. auto/unix
125. auto/os/conf
126. auto/ssltls
127
128if [ $NXT_REGEX = YES ]; then
129    . auto/pcre
130fi
131
132. auto/isolation
133. auto/capability
134
135
136case "$NXT_SYSTEM_PLATFORM" in
137    i386 | amd64 | x86_64)
138        nxt_have=NXT_HAVE_LITTLE_ENDIAN . auto/have
139        nxt_have=NXT_HAVE_NONALIGNED . auto/have
140    ;;
141esac
142
143
144if [ $NXT_DEBUG = YES ]; then
145    nxt_debug=1
146else
147    nxt_debug=0
148fi
149
150cat << END >> $NXT_AUTO_CONFIG_H
151
152#ifndef NXT_DEBUG
153#define NXT_DEBUG  $nxt_debug
154#endif
155
156#define NXT_SHM_PREFIX  "$NXT_SHM_PREFIX"
157
158END
159
160. auto/test_build
161. auto/sources
162. auto/save
163
164# LOOK
165
166NXT_LIB_AUX_CFLAGS="$NXT_OPENSSL_CFLAGS $NXT_GNUTLS_CFLAGS \\
167                    $NXT_CYASSL_CFLAGS $NXT_POLARSSL_CFLAGS \\
168                    $NXT_PCRE_CFLAGS"
169
170NXT_LIB_AUX_LIBS="$NXT_OPENSSL_LIBS $NXT_GNUTLS_LIBS \\
171                    $NXT_CYASSL_LIBS $NXT_POLARSSL_LIBS \\
172                    $NXT_PCRE_LIB"
173
174. auto/make
175. auto/summary
176