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