xref: /unit/configure (revision 235:467cff8f6def)
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
33
34CC=${CC:-cc}
35
36NXT_PID="nginext.pid"
37NXT_LOG="nginext.log"
38NXT_MODULES="modules"
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
86#define NXT_CONTROL_SOCK       "$NXT_CONTROL"
87
88#define NXT_USER               "$NXT_USER"
89#define NXT_GROUP              "$NXT_GROUP"
90
91END
92
93
94if [ $echo = echo ]; then
95    # Build a portable "echo" program that supports only "-n" option.
96    # This also tests C compiler ability to create executables.
97    . auto/echo/build
98fi
99
100
101nxt_have=NXT_UNIX . auto/have
102
103if [ $NXT_UNIX_DOMAIN = YES ]; then
104    nxt_have=NXT_HAVE_UNIX_DOMAIN . auto/have
105fi
106
107. auto/types
108. auto/clang
109. auto/atomic
110. auto/malloc
111. auto/mmap
112. auto/shmem
113. auto/time
114. auto/threads
115. auto/events
116. auto/sockets
117. auto/sendfile
118. auto/files
119. auto/unix
120. auto/os/conf
121. auto/ssltls
122. auto/pcre
123
124
125case "$NXT_SYSTEM_PLATFORM" in
126    i386 | amd64 | x86_64)
127        nxt_have=NXT_HAVE_LITTLE_ENDIAN . auto/have
128        nxt_have=NXT_HAVE_NONALIGNED . auto/have
129    ;;
130esac
131
132
133if [ $NXT_DEBUG = YES ]; then
134    nxt_have=NXT_DEBUG . auto/have
135fi
136
137
138. auto/test_build
139. auto/sources
140. auto/save
141
142# LOOK
143
144NXT_LIB_AUX_CFLAGS="$NXT_OPENSSL_CFLAGS $NXT_GNUTLS_CFLAGS \\
145                    $NXT_CYASSL_CFLAGS $NXT_POLARSSL_CFLAGS \\
146                    $NXT_PCRE_CFLAGS"
147
148NXT_LIB_AUX_LIBS="$NXT_OPENSSL_LIBS $NXT_GNUTLS_LIBS \\
149                    $NXT_CYASSL_LIBS $NXT_POLARSSL_LIBS \\
150                    $NXT_PCRE_LIB"
151
152. auto/make
153