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