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