xref: /unit/configure (revision 234:e0f17b03f52b)
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#define NXT_MODULES            "$NXT_MODULES"
69
70#define NXT_CONTROL_SOCK       "$NXT_CONTROL"
71
72#define NXT_USER               "$NXT_USER"
73#define NXT_GROUP              "$NXT_GROUP"
74
75END
76
77
78if [ $echo = echo ]; then
79    # Build a portable "echo" program that supports only "-n" option.
80    # This also tests C compiler ability to create executables.
81    . auto/echo/build
82fi
83
84
85nxt_have=NXT_UNIX . auto/have
86
87if [ $NXT_UNIX_DOMAIN = YES ]; then
88    nxt_have=NXT_HAVE_UNIX_DOMAIN . auto/have
89fi
90
91. auto/types
92. auto/clang
93. auto/atomic
94. auto/malloc
95. auto/mmap
96. auto/shmem
97. auto/time
98. auto/threads
99. auto/events
100. auto/sockets
101. auto/sendfile
102. auto/files
103. auto/unix
104. auto/os/conf
105. auto/ssltls
106. auto/pcre
107
108
109case "$NXT_SYSTEM_PLATFORM" in
110    i386 | amd64 | x86_64)
111        nxt_have=NXT_HAVE_LITTLE_ENDIAN . auto/have
112        nxt_have=NXT_HAVE_NONALIGNED . auto/have
113    ;;
114esac
115
116
117if [ $NXT_DEBUG = YES ]; then
118    nxt_have=NXT_DEBUG . auto/have
119fi
120
121
122. auto/test_build
123. auto/sources
124. auto/save
125
126# LOOK
127
128NXT_LIB_AUX_CFLAGS="$NXT_OPENSSL_CFLAGS $NXT_GNUTLS_CFLAGS \\
129                    $NXT_CYASSL_CFLAGS $NXT_POLARSSL_CFLAGS \\
130                    $NXT_PCRE_CFLAGS"
131
132NXT_LIB_AUX_LIBS="$NXT_OPENSSL_LIBS $NXT_GNUTLS_LIBS \\
133                    $NXT_CYASSL_LIBS $NXT_POLARSSL_LIBS \\
134                    $NXT_PCRE_LIB"
135
136. auto/make
137