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