You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
angie/SOURCES/configure-accelerator.patch

1544 lines
40 KiB

# HG changeset patch
# User Vladimir Khomutov <vl@wbsrv.ru>
# Date 1721036673 -10800
# Mon Jul 15 12:44:33 2024 +0300
# Node ID 1a5ebc8fd6df82e6f6c53306cfb858e674e7a664
# Parent 0b88485f70ed6715b9b48ef1b19529262168a312
Configure: makefile generator optimizations.
The generator makes multiple sed(1) calls, even when not really needed.
The code is thrashed with multiple copies of regular expressions making
it hard to read.
Most sed calls are replaced with shell builtins and moved into functions, each
performing clear task, making the rest of the code easier to read. Functions
save results to variables instead of echoing.
The most often and useless case: replacing slash with configured directory
separator (which is also slash on UNIX platform) using sed(1) is optimized.
* * *
Configure: avoid calling external tools.
Avoid calling tr(1) when converting feature/include name to macro.
* * *
Configure: separate compile and linking steps.
This allows to cache compilation results using ccache.
* * *
Configure: use auto/define instead of direct access.
* * *
Configure: test for C compiler presence is moved to cc/conf.
The test has nothing to do with the compiler name and makes it harder
to cache the script result in the following patch.
* * *
Configure: feature cache.
If requested by --feature-cache[=path] configuration option, results of
each autotest performed on a first run are captured and saved as files.
Upon the second invocation, instead of performing actual feature test,
a cached result is used.
The test must set ngx_found and provide convenient way to capture other
execution results (i.e. set variables, auto/have calls etc).
When reading cache results, configure script does not invoke any system
commands/compilers/tools that may affect resulting configuration.
diff --git a/auto/cache b/auto/cache
new file mode 100644
--- /dev/null
+++ b/auto/cache
@@ -0,0 +1,74 @@
+
+# Copyright (C) 2024 Web Server LLC
+
+
+if [ $NGX_FEATURE_CACHE = YES ]; then
+ NGX_FC_PATH=$NGX_OBJS
+
+elif [ $NGX_FEATURE_CACHE != NO ]; then
+
+ NGX_FC_PATH=${NGX_FEATURE_CACHE}
+ mkdir -p $NGX_FC_PATH
+fi
+
+
+# tries to load cache for current autotest environment
+check_cache()
+{
+ if [ $NGX_FEATURE_CACHE = NO ]; then
+ return 1
+ fi
+
+ # remove chars non-suitable for filename and limit length to 64
+
+ OPTIND=1
+ ngx_uniq=
+ N=0
+
+ while getopts ":" opt "-$1"; do
+ case "$OPTARG" in
+ [A-Za-z0-9])
+ ngx_uniq=${ngx_uniq}$OPTARG
+ ;;
+ *)
+ ngx_uniq=${ngx_uniq}_
+ ;;
+ esac
+
+ N=$(($N + 1))
+
+ if [ $N -gt 64 ]; then
+ break
+ fi
+ done
+
+ NGX_AUTOTEST_CACHE=$NGX_FC_PATH/$2.$ngx_uniq.cache
+
+ if [ -f $NGX_AUTOTEST_CACHE ]; then
+
+ . $NGX_AUTOTEST_CACHE
+
+ if [ $ngx_found = yes ]; then
+ echo "using cached $1 ... found"
+ else
+ echo "using cached $1 ... not found"
+ fi
+
+ return 0
+
+ else
+ return 1
+ fi
+}
+
+
+cache_output_start()
+{
+ exec 3>&1 1>$NGX_AUTOTEST_CACHE
+}
+
+
+cache_output_end()
+{
+ exec 1>&3 3>&-
+}
diff --git a/auto/cc/clang b/auto/cc/clang
--- a/auto/cc/clang
+++ b/auto/cc/clang
@@ -1,18 +1,11 @@
+# Copyright (C) 2024 Web Server LLC
# Copyright (C) Nginx, Inc.
# clang
-
-NGX_CLANG_VER=`$CC -v 2>&1 | grep 'version' 2>&1 \
- | sed -n -e 's/^.*clang version \(.*\)/\1/p' \
- -e 's/^.*LLVM version \(.*\)/\1/p'`
-
-echo " + clang version: $NGX_CLANG_VER"
-
-have=NGX_COMPILER value="\"clang $NGX_CLANG_VER\"" . auto/define
-
+. auto/cc/clang.version
CC_TEST_FLAGS="-pipe"
diff --git a/auto/cc/clang.version b/auto/cc/clang.version
new file mode 100644
--- /dev/null
+++ b/auto/cc/clang.version
@@ -0,0 +1,28 @@
+
+# Copyright (C) 2024 Web Server LLC
+# Copyright (C) Nginx, Inc.
+
+
+if check_cache "clang version" "cc"; then
+ return
+fi
+
+NGX_CLANG_VER=`$CC -v 2>&1 | grep 'version' 2>&1 \
+ | sed -n -e 's/^.*clang version \(.*\)/\1/p' \
+ -e 's/^.*LLVM version \(.*\)/\1/p'`
+
+echo " + clang version: $NGX_CLANG_VER"
+
+have=NGX_COMPILER value="\"clang $NGX_CLANG_VER\"" . auto/define
+
+if [ $NGX_FEATURE_CACHE = NO ]; then
+ return
+fi
+
+cache_output_start
+
+echo "ngx_found=yes"
+echo "NGX_CLANG_VER=\"$NGX_CLANG_VER\""
+echo 'have=NGX_COMPILER value="\"clang $NGX_CLANG_VER\"" . auto/define'
+
+cache_output_end
diff --git a/auto/cc/conf b/auto/cc/conf
--- a/auto/cc/conf
+++ b/auto/cc/conf
@@ -35,6 +35,26 @@ ngx_spacer=
ngx_long_regex_cont=$ngx_regex_cont
ngx_long_cont=$ngx_cont
+
+if [ "$NGX_PLATFORM" != win32 ]; then
+
+ ngx_feature="C compiler"
+ ngx_feature_name=
+ ngx_feature_run=yes
+ ngx_feature_incs=
+ ngx_feature_path=
+ ngx_feature_libs=
+ ngx_feature_test=
+ . auto/feature
+
+ if [ $ngx_found = no ]; then
+ echo
+ echo $0: error: C compiler $CC is not found
+ echo
+ exit 1
+ fi
+fi
+
. auto/cc/name
if test -n "$CFLAGS"; then
diff --git a/auto/cc/gcc b/auto/cc/gcc
--- a/auto/cc/gcc
+++ b/auto/cc/gcc
@@ -1,20 +1,10 @@
+# Copyright (C) 2024 Web Server LLC
# Copyright (C) Igor Sysoev
# Copyright (C) Nginx, Inc.
-# gcc 2.7.2.3, 2.8.1, 2.95.4, egcs-1.1.2
-# 3.0.4, 3.1.1, 3.2.3, 3.3.2, 3.3.3, 3.3.4, 3.4.0, 3.4.2
-# 4.0.0, 4.0.1, 4.1.0
-
-
-NGX_GCC_VER=`$CC -v 2>&1 | grep 'gcc version' 2>&1 \
- | sed -e 's/^.* version \(.*\)/\1/'`
-
-echo " + gcc version: $NGX_GCC_VER"
-
-have=NGX_COMPILER value="\"gcc $NGX_GCC_VER\"" . auto/define
-
+. auto/cc/gcc.version
# Solaris 7's /usr/ccs/bin/as does not support "-pipe"
diff --git a/auto/cc/gcc.version b/auto/cc/gcc.version
new file mode 100644
--- /dev/null
+++ b/auto/cc/gcc.version
@@ -0,0 +1,33 @@
+
+# Copyright (C) 2024 Web Server LLC
+# Copyright (C) Igor Sysoev
+# Copyright (C) Nginx, Inc.
+
+
+if check_cache "gcc version" "cc"; then
+ return
+fi
+
+# gcc 2.7.2.3, 2.8.1, 2.95.4, egcs-1.1.2
+# 3.0.4, 3.1.1, 3.2.3, 3.3.2, 3.3.3, 3.3.4, 3.4.0, 3.4.2
+# 4.0.0, 4.0.1, 4.1.0
+
+
+NGX_GCC_VER=`$CC -v 2>&1 | grep 'gcc version' 2>&1 \
+ | sed -e 's/^.* version \(.*\)/\1/'`
+
+echo " + gcc version: $NGX_GCC_VER"
+
+have=NGX_COMPILER value="\"gcc $NGX_GCC_VER\"" . auto/define
+
+if [ $NGX_FEATURE_CACHE = NO ]; then
+ return
+fi
+
+cache_output_start
+
+echo "ngx_found=yes"
+echo "NGX_GCC_VER=\"$NGX_GCC_VER\""
+echo 'have=NGX_COMPILER value="\"gcc $NGX_GCC_VER\"" . auto/define'
+
+cache_output_end
diff --git a/auto/cc/name b/auto/cc/name
--- a/auto/cc/name
+++ b/auto/cc/name
@@ -1,29 +1,13 @@
+# Copyright (C) 2024 Web Server LLC
# Copyright (C) Igor Sysoev
# Copyright (C) Nginx, Inc.
-if [ "$NGX_PLATFORM" != win32 ]; then
-
- ngx_feature="C compiler"
- ngx_feature_name=
- ngx_feature_run=yes
- ngx_feature_incs=
- ngx_feature_path=
- ngx_feature_libs=
- ngx_feature_test=
- . auto/feature
-
- if [ $ngx_found = no ]; then
- echo
- echo $0: error: C compiler $CC is not found
- echo
- exit 1
- fi
-
+if check_cache "compiler name" "cc"; then
+ return
fi
-
if [ "$CC" = cl ]; then
NGX_CC_NAME=msvc
echo " + using Microsoft Visual C++ compiler"
@@ -68,3 +52,14 @@ else
NGX_CC_NAME=unknown
fi
+
+if [ $NGX_FEATURE_CACHE = NO ]; then
+ return
+fi
+
+cache_output_start
+
+echo "ngx_found=yes"
+echo "NGX_CC_NAME=$NGX_CC_NAME"
+
+cache_output_end
diff --git a/auto/endianness b/auto/endianness
--- a/auto/endianness
+++ b/auto/endianness
@@ -1,8 +1,13 @@
+# Copyright (C) 2024 Web Server LLC
# Copyright (C) Igor Sysoev
# Copyright (C) Nginx, Inc.
+if check_cache "little endian" "endianness"; then
+ return
+fi
+
echo $ngx_n "checking for system byte ordering ...$ngx_c"
cat << END >> $NGX_AUTOCONF_ERR
@@ -12,6 +17,7 @@ checking for system byte ordering
END
+ngx_found=no
cat << END > $NGX_AUTOTEST.c
@@ -26,8 +32,10 @@ int main(void) {
END
-ngx_test="$CC $CC_TEST_FLAGS $CC_AUX_FLAGS \
- -o $NGX_AUTOTEST $NGX_AUTOTEST.c $NGX_LD_OPT $ngx_feature_libs"
+ngx_test="($CC -c $CC_TEST_FLAGS $CC_AUX_FLAGS \
+ -o $NGX_AUTOTEST.o $NGX_AUTOTEST.c && \
+ $CC $CC_TEST_FLAGS $CC_AUX_FLAGS \
+ -o $NGX_AUTOTEST $NGX_AUTOTEST.o $NGX_LD_OPT $ngx_feature_libs)"
eval "$ngx_test >> $NGX_AUTOCONF_ERR 2>&1"
@@ -35,6 +43,7 @@ if [ -x $NGX_AUTOTEST ]; then
if $NGX_AUTOTEST >/dev/null 2>&1; then
echo " little endian"
have=NGX_HAVE_LITTLE_ENDIAN . auto/have
+ ngx_found=yes
else
echo " big endian"
fi
@@ -48,3 +57,17 @@ else
echo "$0: error: cannot detect system byte ordering"
exit 1
fi
+
+if [ $NGX_FEATURE_CACHE = NO ]; then
+ return
+fi
+
+cache_output_start
+
+echo "ngx_found=$ngx_found"
+
+if [ $ngx_found = yes ]; then
+ echo "have=NGX_HAVE_LITTLE_ENDIAN . auto/have"
+fi
+
+cache_output_end
diff --git a/auto/feature b/auto/feature
--- a/auto/feature
+++ b/auto/feature
@@ -1,8 +1,13 @@
+# Copyright (C) 2024 Web Server LLC
# Copyright (C) Igor Sysoev
# Copyright (C) Nginx, Inc.
+if check_cache "$ngx_feature" "feature"; then
+ return
+fi
+
echo $ngx_n "checking for $ngx_feature ...$ngx_c"
cat << END >> $NGX_AUTOCONF_ERR
@@ -13,10 +18,12 @@ checking for $ngx_feature
END
ngx_found=no
+ngx_add_have=no
+ngx_add_value=no
if test -n "$ngx_feature_name"; then
- ngx_have_feature=`echo $ngx_feature_name \
- | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ`
+ name2macro "$ngx_feature_name"
+ ngx_have_feature="$res"
fi
if test -n "$ngx_feature_path"; then
@@ -39,8 +46,10 @@ int main(void) {
END
-ngx_test="$CC $CC_TEST_FLAGS $CC_AUX_FLAGS $ngx_feature_inc_path \
- -o $NGX_AUTOTEST $NGX_AUTOTEST.c $NGX_TEST_LD_OPT $ngx_feature_libs"
+ngx_test="($CC -c $CC_TEST_FLAGS $CC_AUX_FLAGS $ngx_feature_inc_path \
+ -o $NGX_AUTOTEST.o $NGX_AUTOTEST.c && \
+ $CC $CC_TEST_FLAGS $CC_AUX_FLAGS \
+ -o $NGX_AUTOTEST $NGX_AUTOTEST.o $NGX_TEST_LD_OPT $ngx_feature_libs)"
ngx_feature_inc_path=
@@ -59,6 +68,7 @@ if [ -x $NGX_AUTOTEST ]; then
if test -n "$ngx_feature_name"; then
have=$ngx_have_feature . auto/have
+ ngx_add_have=yes
fi
else
@@ -72,13 +82,9 @@ if [ -x $NGX_AUTOTEST ]; then
echo " found"
ngx_found=yes
- cat << END >> $NGX_AUTO_CONFIG_H
+ have="$ngx_feature_name" value="$($NGX_AUTOTEST)" . auto/define
+ ngx_add_value=$value
-#ifndef $ngx_feature_name
-#define $ngx_feature_name `$NGX_AUTOTEST`
-#endif
-
-END
else
echo " found but is not working"
fi
@@ -95,6 +101,7 @@ END
if test -n "$ngx_feature_name"; then
have=$ngx_have_feature . auto/have
+ ngx_add_have=yes
fi
fi
;;
@@ -105,6 +112,7 @@ END
if test -n "$ngx_feature_name"; then
have=$ngx_have_feature . auto/have
+ ngx_add_have=yes
fi
;;
@@ -121,3 +129,21 @@ else
fi
rm -rf $NGX_AUTOTEST*
+
+if [ $NGX_FEATURE_CACHE = NO ]; then
+ return
+fi
+
+cache_output_start
+
+echo "ngx_found=$ngx_found"
+
+if [ $ngx_add_have = yes ]; then
+ echo "have=$ngx_have_feature . auto/have"
+fi
+
+if [ $ngx_add_value != no ]; then
+ echo "have=\"$ngx_feature_name\" value=\"$ngx_add_value\" . auto/define"
+fi
+
+cache_output_end
diff --git a/auto/include b/auto/include
--- a/auto/include
+++ b/auto/include
@@ -1,8 +1,13 @@
+# Copyright (C) 2024 Web Server LLC
# Copyright (C) Igor Sysoev
# Copyright (C) Nginx, Inc.
+if check_cache "$ngx_include" "include"; then
+ return
+fi
+
echo $ngx_n "checking for $ngx_include ...$ngx_c"
cat << END >> $NGX_AUTOCONF_ERR
@@ -27,7 +32,8 @@ int main(void) {
END
-ngx_test="$CC -o $NGX_AUTOTEST $NGX_AUTOTEST.c"
+ngx_test="($CC -c -o $NGX_AUTOTEST.o $NGX_AUTOTEST.c && \
+ $CC -o $NGX_AUTOTEST $NGX_AUTOTEST.o)"
eval "$ngx_test >> $NGX_AUTOCONF_ERR 2>&1"
@@ -37,9 +43,8 @@ if [ -x $NGX_AUTOTEST ]; then
echo " found"
- ngx_name=`echo $ngx_include \
- | tr abcdefghijklmnopqrstuvwxyz/. ABCDEFGHIJKLMNOPQRSTUVWXYZ__`
-
+ name2macro "$ngx_include"
+ ngx_name="$res"
have=NGX_HAVE_$ngx_name . auto/have_headers
@@ -56,3 +61,18 @@ else
fi
rm -rf $NGX_AUTOTEST*
+
+if [ $NGX_FEATURE_CACHE = NO ]; then
+ return
+fi
+
+cache_output_start
+
+echo "ngx_found=$ngx_found"
+
+if [ $ngx_found = yes ]; then
+ echo "have=NGX_HAVE_$ngx_name . auto/have_headers"
+ echo "NGX_INCLUDE_$ngx_name='#include <$ngx_include>'"
+fi
+
+cache_output_end
diff --git a/auto/make b/auto/make
--- a/auto/make
+++ b/auto/make
@@ -1,8 +1,96 @@
+# Copyright (C) 2024 Web Server LLC
# Copyright (C) Igor Sysoev
# Copyright (C) Nginx, Inc.
+dirsep()
+{
+ if [ "$ngx_dirsep" = "/" ]; then
+ res="$@"
+ return
+ fi
+
+ res=$(echo "$@" | sed -e "s/\//$ngx_regex_dirsep/g")
+}
+
+
+fmt_link()
+{
+ dirsep "$@"
+ res="$ngx_long_cont$res"
+}
+
+
+fmt_list()
+{
+ first="$1"
+ shift
+ last=
+
+ for i in $@; do
+ last="$last$prefix$i"
+ done
+
+ dirsep "$first$last"
+}
+
+
+fmt_incs()
+{
+ prefix="$ngx_cont$ngx_include_opt" fmt_list "$@"
+}
+
+
+fmt_deps()
+{
+ prefix="$ngx_cont" fmt_list "$@"
+}
+
+
+fmt_objs()
+{
+ prefix="$ngx_long_cont" fmt_list "$@"
+}
+
+
+src2obj()
+{
+ res=
+ case $1 in
+ *.c) res="${1%.c}.$ngx_objext" ;;
+ *.cc) res="${1%.cc}.$ngx_objext" ;;
+ *.cpp) res="${1%.cpp}.$ngx_objext";;
+ *.S) res="${1%.S}.$ngx_objext" ;;
+ *) res="$1" ;;
+ esac
+
+ res="$NGX_OBJS$ngx_dirsep$res"
+}
+
+
+srcs2objs()
+{
+ res=
+
+ for i in $@; do
+ case $i in
+ *.c) i="${i%.c}.$ngx_objext" ;;
+ *.cc) i="${i%.cc}.$ngx_objext" ;;
+ *.cpp) i="${i%.cpp}.$ngx_objext";;
+ *.S) i="${i%.S}.$ngx_objext" ;;
+ *) i="$i" ;;
+ esac
+
+ if [ -n "$res" ]; then
+ res="$res $NGX_OBJS/$i"
+ else
+ res="$NGX_OBJS/$i"
+ fi
+ done
+}
+
+
echo "creating $NGX_MAKEFILE"
mkdir -p $NGX_OBJS/src/core $NGX_OBJS/src/event $NGX_OBJS/src/event/modules \
@@ -15,8 +103,8 @@ mkdir -p $NGX_OBJS/src/core $NGX_OBJS/sr
$NGX_OBJS/src/misc
-ngx_objs_dir=$NGX_OBJS$ngx_regex_dirsep
-ngx_use_pch=`echo $NGX_USE_PCH | sed -e "s/\//$ngx_regex_dirsep/g"`
+dirsep "$NGX_USE_PCH"
+ngx_use_pch=$res
cat << END > $NGX_MAKEFILE
@@ -38,9 +126,8 @@ fi
# ALL_INCS, required by the addons and by OpenWatcom C precompiled headers
-ngx_incs=`echo $CORE_INCS $NGX_OBJS $HTTP_INCS $MAIL_INCS $STREAM_INCS\
- | sed -e "s/ *\([^ ][^ ]*\)/$ngx_regex_cont$ngx_include_opt\1/g" \
- -e "s/\//$ngx_regex_dirsep/g"`
+fmt_incs $CORE_INCS $NGX_OBJS $HTTP_INCS $MAIL_INCS $STREAM_INCS
+ngx_incs=$res
cat << END >> $NGX_MAKEFILE
@@ -54,13 +141,11 @@ ngx_all_srcs="$CORE_SRCS"
# the core dependencies and include paths
-ngx_deps=`echo $CORE_DEPS $NGX_AUTO_CONFIG_H $NGX_PCH \
- | sed -e "s/ *\([^ ][^ ]*\)/$ngx_regex_cont\1/g" \
- -e "s/\//$ngx_regex_dirsep/g"`
+fmt_deps $CORE_DEPS $NGX_AUTO_CONFIG_H $NGX_PCH
+ngx_deps=$res
-ngx_incs=`echo $CORE_INCS $NGX_OBJS \
- | sed -e "s/ *\([^ ][^ ]*\)/$ngx_regex_cont$ngx_include_opt\1/g" \
- -e "s/\//$ngx_regex_dirsep/g"`
+fmt_incs $CORE_INCS $NGX_OBJS
+ngx_incs=$res
cat << END >> $NGX_MAKEFILE
@@ -78,13 +163,11 @@ if [ $HTTP = YES ]; then
ngx_all_srcs="$ngx_all_srcs $HTTP_SRCS"
- ngx_deps=`echo $HTTP_DEPS \
- | sed -e "s/ *\([^ ][^ ]*\)/$ngx_regex_cont\1/g" \
- -e "s/\//$ngx_regex_dirsep/g"`
+ fmt_deps $HTTP_DEPS
+ ngx_deps=$res
- ngx_incs=`echo $HTTP_INCS \
- | sed -e "s/ *\([^ ][^ ]*\)/$ngx_regex_cont$ngx_include_opt\1/g" \
- -e "s/\//$ngx_regex_dirsep/g"`
+ fmt_incs $HTTP_INCS
+ ngx_incs=$res
cat << END >> $NGX_MAKEFILE
@@ -106,13 +189,11 @@ if [ $MAIL != NO ]; then
ngx_all_srcs="$ngx_all_srcs $MAIL_SRCS"
fi
- ngx_deps=`echo $MAIL_DEPS \
- | sed -e "s/ *\([^ ][^ ]*\)/$ngx_regex_cont\1/g" \
- -e "s/\//$ngx_regex_dirsep/g"`
+ fmt_deps $MAIL_DEPS
+ ngx_deps=$res
- ngx_incs=`echo $MAIL_INCS \
- | sed -e "s/ *\([^ ][^ ]*\)/$ngx_regex_cont$ngx_include_opt\1/g" \
- -e "s/\//$ngx_regex_dirsep/g"`
+ fmt_incs $MAIL_INCS
+ ngx_incs=$res
cat << END >> $NGX_MAKEFILE
@@ -134,13 +215,11 @@ if [ $STREAM != NO ]; then
ngx_all_srcs="$ngx_all_srcs $STREAM_SRCS"
fi
- ngx_deps=`echo $STREAM_DEPS \
- | sed -e "s/ *\([^ ][^ ]*\)/$ngx_regex_cont\1/g" \
- -e "s/\//$ngx_regex_dirsep/g"`
+ fmt_deps $STREAM_DEPS
+ ngx_deps=$res
- ngx_incs=`echo $STREAM_INCS \
- | sed -e "s/ *\([^ ][^ ]*\)/$ngx_regex_cont$ngx_include_opt\1/g" \
- -e "s/\//$ngx_regex_dirsep/g"`
+ fmt_incs $STREAM_INCS
+ ngx_incs=$res
cat << END >> $NGX_MAKEFILE
@@ -170,7 +249,8 @@ fi
# angie
-ngx_all_srcs=`echo $ngx_all_srcs | sed -e "s/\//$ngx_regex_dirsep/g"`
+dirsep $ngx_all_srcs
+ngx_all_srcs=$res
for ngx_src in $NGX_ADDON_SRCS
do
@@ -178,49 +258,45 @@ do
test -d $NGX_OBJS/$ngx_obj || mkdir -p $NGX_OBJS/$ngx_obj
- ngx_obj=`echo $ngx_obj/\`basename $ngx_src\` \
- | sed -e "s/\//$ngx_regex_dirsep/g"`
+ dirsep $ngx_obj/`basename $ngx_src`; ngx_obj=$res
ngx_all_srcs="$ngx_all_srcs $ngx_obj"
done
-ngx_all_objs=`echo $ngx_all_srcs \
- | sed -e "s#\([^ ]*\.\)cpp#$NGX_OBJS\/\1$ngx_objext#g" \
- -e "s#\([^ ]*\.\)cc#$NGX_OBJS\/\1$ngx_objext#g" \
- -e "s#\([^ ]*\.\)c#$NGX_OBJS\/\1$ngx_objext#g" \
- -e "s#\([^ ]*\.\)S#$NGX_OBJS\/\1$ngx_objext#g"`
+srcs2objs $ngx_all_srcs
+ngx_all_objs=$res
-ngx_modules_c=`echo $NGX_MODULES_C | sed -e "s/\//$ngx_regex_dirsep/g"`
+dirsep $NGX_MODULES_C
+ngx_modules_c=$res
-ngx_modules_obj=`echo $ngx_modules_c | sed -e "s/\(.*\.\)c/\1$ngx_objext/"`
+ngx_modules_obj=${ngx_modules_c%.c}.$ngx_objext
if test -n "$NGX_RES"; then
ngx_res=$NGX_RES
else
ngx_res="$NGX_RC $NGX_ICONS"
- ngx_rcc=`echo $NGX_RCC | sed -e "s/\//$ngx_regex_dirsep/g"`
+ dirsep $NGX_RCC
+ ngx_rcc=$res
fi
-ngx_deps=`echo $ngx_all_objs $ngx_modules_obj $ngx_res $LINK_DEPS \
- | sed -e "s/ *\([^ ][^ ]*\)/$ngx_regex_cont\1/g" \
- -e "s/\//$ngx_regex_dirsep/g"`
+fmt_deps $ngx_all_objs $ngx_modules_obj $ngx_res $LINK_DEPS
+ngx_deps=$res
-ngx_objs=`echo $ngx_all_objs $ngx_modules_obj \
- | sed -e "s/ *\([^ ][^ ]*\)/$ngx_long_regex_cont\1/g" \
- -e "s/\//$ngx_regex_dirsep/g"`
+fmt_objs $ngx_all_objs $ngx_modules_obj
+ngx_objs=$res
ngx_libs=
if test -n "$NGX_LD_OPT$CORE_LIBS"; then
- ngx_libs=`echo $NGX_LD_OPT $CORE_LIBS \
- | sed -e "s/\//$ngx_regex_dirsep/g" -e "s/^/$ngx_long_regex_cont/"`
+ fmt_link $NGX_LD_OPT $CORE_LIBS
+ ngx_libs=$res
fi
-ngx_link=${CORE_LINK:+`echo $CORE_LINK \
- | sed -e "s/\//$ngx_regex_dirsep/g" -e "s/^/$ngx_long_regex_cont/"`}
+fmt_link $CORE_LINK
+ngx_link=${CORE_LINK:+$res}
-ngx_main_link=${MAIN_LINK:+`echo $MAIN_LINK \
- | sed -e "s/\//$ngx_regex_dirsep/g" -e "s/^/$ngx_long_regex_cont/"`}
+fmt_link $MAIN_LINK
+ngx_main_link=${MAIN_LINK:+$res}
cat << END >> $NGX_MAKEFILE
@@ -258,12 +334,8 @@ END
for ngx_src in $CORE_SRCS
do
- ngx_src=`echo $ngx_src | sed -e "s/\//$ngx_regex_dirsep/g"`
- ngx_obj=`echo $ngx_src \
- | sed -e "s#^\(.*\.\)cpp\\$#$ngx_objs_dir\1$ngx_objext#g" \
- -e "s#^\(.*\.\)cc\\$#$ngx_objs_dir\1$ngx_objext#g" \
- -e "s#^\(.*\.\)c\\$#$ngx_objs_dir\1$ngx_objext#g" \
- -e "s#^\(.*\.\)S\\$#$ngx_objs_dir\1$ngx_objext#g"`
+ dirsep $ngx_src; ngx_src=$res
+ src2obj $ngx_src; ngx_obj=$res
cat << END >> $NGX_MAKEFILE
@@ -289,12 +361,8 @@ if [ $HTTP = YES ]; then
for ngx_source in $HTTP_SRCS
do
- ngx_src=`echo $ngx_source | sed -e "s/\//$ngx_regex_dirsep/g"`
- ngx_obj=`echo $ngx_src \
- | sed -e "s#^\(.*\.\)cpp\\$#$ngx_objs_dir\1$ngx_objext#g" \
- -e "s#^\(.*\.\)cc\\$#$ngx_objs_dir\1$ngx_objext#g" \
- -e "s#^\(.*\.\)c\\$#$ngx_objs_dir\1$ngx_objext#g" \
- -e "s#^\(.*\.\)S\\$#$ngx_objs_dir\1$ngx_objext#g"`
+ dirsep $ngx_source; ngx_src=$res
+ src2obj $ngx_src; ngx_obj=$res
if [ $ngx_source = src/http/modules/perl/ngx_http_perl_module.c ]; then
@@ -331,12 +399,8 @@ if [ $MAIL = YES ]; then
for ngx_src in $MAIL_SRCS
do
- ngx_src=`echo $ngx_src | sed -e "s/\//$ngx_regex_dirsep/g"`
- ngx_obj=`echo $ngx_src \
- | sed -e "s#^\(.*\.\)cpp\\$#$ngx_objs_dir\1$ngx_objext#g" \
- -e "s#^\(.*\.\)cc\\$#$ngx_objs_dir\1$ngx_objext#g" \
- -e "s#^\(.*\.\)c\\$#$ngx_objs_dir\1$ngx_objext#g" \
- -e "s#^\(.*\.\)S\\$#$ngx_objs_dir\1$ngx_objext#g"`
+ dirsep $ngx_src; ngx_src=$res
+ src2obj $ngx_src; ngx_obj=$res
cat << END >> $NGX_MAKEFILE
@@ -361,12 +425,8 @@ if [ $STREAM = YES ]; then
for ngx_src in $STREAM_SRCS
do
- ngx_src=`echo $ngx_src | sed -e "s/\//$ngx_regex_dirsep/g"`
- ngx_obj=`echo $ngx_src \
- | sed -e "s#^\(.*\.\)cpp\\$#$ngx_objs_dir\1$ngx_objext#g" \
- -e "s#^\(.*\.\)cc\\$#$ngx_objs_dir\1$ngx_objext#g" \
- -e "s#^\(.*\.\)c\\$#$ngx_objs_dir\1$ngx_objext#g" \
- -e "s#^\(.*\.\)S\\$#$ngx_objs_dir\1$ngx_objext#g"`
+ dirsep $ngx_src; ngx_src=$res
+ src2obj $ngx_src; ngx_obj=$res
cat << END >> $NGX_MAKEFILE
@@ -387,12 +447,8 @@ if test -n "$MISC_SRCS"; then
for ngx_src in $MISC_SRCS
do
- ngx_src=`echo $ngx_src | sed -e "s/\//$ngx_regex_dirsep/g"`
- ngx_obj=`echo $ngx_src \
- | sed -e "s#^\(.*\.\)cpp\\$#$ngx_objs_dir\1$ngx_objext#g" \
- -e "s#^\(.*\.\)cc\\$#$ngx_objs_dir\1$ngx_objext#g" \
- -e "s#^\(.*\.\)c\\$#$ngx_objs_dir\1$ngx_objext#g" \
- -e "s#^\(.*\.\)S\\$#$ngx_objs_dir\1$ngx_objext#g"`
+ dirsep $ngx_src; ngx_src=$res
+ src2obj $ngx_src; ngx_obj=$res
cat << END >> $NGX_MAKEFILE
@@ -415,16 +471,9 @@ if test -n "$NGX_ADDON_SRCS"; then
do
ngx_obj="addon/`basename \`dirname $ngx_src\``"
- ngx_obj=`echo $ngx_obj/\`basename $ngx_src\` \
- | sed -e "s/\//$ngx_regex_dirsep/g"`
-
- ngx_obj=`echo $ngx_obj \
- | sed -e "s#^\(.*\.\)cpp\\$#$ngx_objs_dir\1$ngx_objext#g" \
- -e "s#^\(.*\.\)cc\\$#$ngx_objs_dir\1$ngx_objext#g" \
- -e "s#^\(.*\.\)c\\$#$ngx_objs_dir\1$ngx_objext#g" \
- -e "s#^\(.*\.\)S\\$#$ngx_objs_dir\1$ngx_objext#g"`
-
- ngx_src=`echo $ngx_src | sed -e "s/\//$ngx_regex_dirsep/g"`
+ dirsep $ngx_obj/`basename $ngx_src`; ngx_obj=$res
+ src2obj $ngx_obj; ngx_obj=$res
+ dirsep $ngx_src; ngx_src=$res
cat << END >> $NGX_MAKEFILE
@@ -454,9 +503,8 @@ fi
if test -n "$NGX_RES"; then
- ngx_res=`echo "$NGX_RES: $NGX_RC $NGX_ICONS" \
- | sed -e "s/\//$ngx_regex_dirsep/g"`
- ngx_rcc=`echo $NGX_RCC | sed -e "s/\//$ngx_regex_dirsep/g"`
+ dirsep "$NGX_RES: $NGX_RC $NGX_ICONS"; ngx_res=$res
+ dirsep $NGX_RCC; ngx_rcc=$res
cat << END >> $NGX_MAKEFILE
@@ -474,11 +522,12 @@ if test -n "$NGX_PCH"; then
echo "#include <ngx_config.h>" > $NGX_OBJS/ngx_pch.c
ngx_pch="src/core/ngx_config.h $OS_CONFIG $NGX_OBJS/ngx_auto_config.h"
- ngx_pch=`echo "$NGX_PCH: $ngx_pch" | sed -e "s/\//$ngx_regex_dirsep/g"`
+ dirsep "$NGX_PCH: $ngx_pch"
+ ngx_pch=$res
ngx_src="\$(CC) \$(CFLAGS) $NGX_BUILD_PCH $ngx_compile_opt \$(ALL_INCS)"
ngx_src="$ngx_src $ngx_objout$NGX_OBJS/ngx_pch.obj $NGX_OBJS/ngx_pch.c"
- ngx_src=`echo $ngx_src | sed -e "s/\//$ngx_regex_dirsep/g"`
+ dirsep $ngx_src; ngx_src=$res
cat << END >> $NGX_MAKEFILE
@@ -563,10 +612,9 @@ END
END
- ngx_modules_c=`echo $ngx_modules_c | sed -e "s/\//$ngx_regex_dirsep/g"`
+ dirsep $ngx_modules_c; ngx_modules_c=$res
- ngx_modules_obj=`echo $ngx_modules_c \
- | sed -e "s/\(.*\.\)c/\1$ngx_objext/"`
+ ngx_modules_obj=${ngx_modules_c%.c}.$ngx_objext
ngx_module_objs=
for ngx_src in $ngx_module_srcs $ngx_module_shrd
@@ -585,19 +633,14 @@ END
ngx_module_objs="$ngx_module_objs $ngx_obj"
done
- ngx_module_objs=`echo $ngx_module_objs \
- | sed -e "s#\([^ ]*\.\)cpp#$NGX_OBJS\/\1$ngx_objext#g" \
- -e "s#\([^ ]*\.\)cc#$NGX_OBJS\/\1$ngx_objext#g" \
- -e "s#\([^ ]*\.\)c#$NGX_OBJS\/\1$ngx_objext#g" \
- -e "s#\([^ ]*\.\)S#$NGX_OBJS\/\1$ngx_objext#g"`
+ srcs2objs $ngx_module_objs
+ ngx_module_objs=$res
- ngx_deps=`echo $ngx_module_objs $ngx_modules_obj $LINK_DEPS \
- | sed -e "s/ *\([^ ][^ ]*\)/$ngx_regex_cont\1/g" \
- -e "s/\//$ngx_regex_dirsep/g"`
+ fmt_deps $ngx_module_objs $ngx_modules_obj $LINK_DEPS
+ ngx_deps=$res
- ngx_objs=`echo $ngx_module_objs $ngx_modules_obj \
- | sed -e "s/ *\([^ ][^ ]*\)/$ngx_long_regex_cont\1/g" \
- -e "s/\//$ngx_regex_dirsep/g"`
+ fmt_objs $ngx_module_objs $ngx_modules_obj
+ ngx_objs=$res
ngx_obj=$NGX_OBJS$ngx_dirsep$ngx_module$ngx_modext
@@ -607,15 +650,15 @@ END
ngx_libs=
if test -n "$NGX_LD_OPT$ngx_module_libs"; then
- ngx_libs=`echo $NGX_LD_OPT $ngx_module_libs \
- | sed -e "s/\//$ngx_regex_dirsep/g" -e "s/^/$ngx_long_regex_cont/"`
+ fmt_link $NGX_LD_OPT $ngx_module_libs
+ ngx_libs=$res
fi
- ngx_link=${CORE_LINK:+`echo $CORE_LINK \
- | sed -e "s/\//$ngx_regex_dirsep/g" -e "s/^/$ngx_long_regex_cont/"`}
+ fmt_link $CORE_LINK
+ ngx_link=${CORE_LINK:+$res}
- ngx_module_link=${MODULE_LINK:+`echo $MODULE_LINK \
- | sed -e "s/\//$ngx_regex_dirsep/g" -e "s/^/$ngx_long_regex_cont/"`}
+ fmt_link $MODULE_LINK
+ ngx_module_link=${MODULE_LINK:+$res}
cat << END >> $NGX_MAKEFILE
@@ -635,22 +678,16 @@ END
do
case "$ngx_source" in
src/*)
- ngx_obj=`echo $ngx_source | sed -e "s/\//$ngx_regex_dirsep/g"`
+ dirsep $ngx_source; ngx_obj=$res
;;
*)
ngx_obj="addon/`basename \`dirname $ngx_source\``"
- ngx_obj=`echo $ngx_obj/\`basename $ngx_source\` \
- | sed -e "s/\//$ngx_regex_dirsep/g"`
+ dirsep $ngx_obj/`basename $ngx_source`; ngx_obj=$res
;;
esac
- ngx_obj=`echo $ngx_obj \
- | sed -e "s#^\(.*\.\)cpp\\$#$ngx_objs_dir\1$ngx_objext#g" \
- -e "s#^\(.*\.\)cc\\$#$ngx_objs_dir\1$ngx_objext#g" \
- -e "s#^\(.*\.\)c\\$#$ngx_objs_dir\1$ngx_objext#g" \
- -e "s#^\(.*\.\)S\\$#$ngx_objs_dir\1$ngx_objext#g"`
-
- ngx_src=`echo $ngx_source | sed -e "s/\//$ngx_regex_dirsep/g"`
+ src2obj $ngx_obj; ngx_obj=$res
+ dirsep $ngx_source; ngx_src=$res
if [ $ngx_source = src/http/modules/perl/ngx_http_perl_module.c ]; then
diff --git a/auto/options b/auto/options
--- a/auto/options
+++ b/auto/options
@@ -18,6 +18,8 @@ NGX_USER=
NGX_GROUP=
NGX_BUILD=
+NGX_FEATURE_CACHE=NO
+
CC=${CC:-cc}
CPP=
NGX_OBJS=objs
@@ -229,6 +231,9 @@ do
--user=*) NGX_USER="$value" ;;
--group=*) NGX_GROUP="$value" ;;
+ --feature-cache) NGX_FEATURE_CACHE=YES ;;
+ --feature-cache=*) NGX_FEATURE_CACHE=$value ;;
+
--crossbuild=*) NGX_PLATFORM="$value" ;;
--build=*) NGX_BUILD="$value" ;;
@@ -494,6 +499,9 @@ cat << END
--group=GROUP set non-privileged group for
worker processes
+ --feature-cache enable configure feature cache
+ --feature-cache=path use configure feature cache at given path
+
--build=NAME set build name
--builddir=DIR set build directory
diff --git a/auto/os/freebsd b/auto/os/freebsd
--- a/auto/os/freebsd
+++ b/auto/os/freebsd
@@ -1,4 +1,5 @@
+# Copyright (C) 2024 Web Server LLC
# Copyright (C) Igor Sysoev
# Copyright (C) Nginx, Inc.
@@ -12,17 +13,7 @@ CORE_SRCS="$UNIX_SRCS $FREEBSD_SRCS"
ngx_spacer='
'
-
-# __FreeBSD_version and sysctl kern.osreldate are the best ways
-# to determine whether some capability exists and is safe to use.
-# __FreeBSD_version is used for the testing of the build environment.
-# sysctl kern.osreldate is used for the testing of the kernel capabilities.
-
-version=`grep "#define __FreeBSD_version" /usr/include/osreldate.h \
- | sed -e 's/^.* \(.*\)$/\1/'`
-
-osreldate=`/sbin/sysctl -n kern.osreldate`
-
+. auto/os/freebsd.version
# setproctitle() in libutil
diff --git a/auto/os/freebsd.version b/auto/os/freebsd.version
new file mode 100644
--- /dev/null
+++ b/auto/os/freebsd.version
@@ -0,0 +1,31 @@
+
+# Copyright (C) 2024 Web Server LLC
+# Copyright (C) Igor Sysoev
+# Copyright (C) Nginx, Inc.
+
+
+if check_cache "freebsd version" "os"; then
+ return
+fi
+
+# __FreeBSD_version and sysctl kern.osreldate are the best ways
+# to determine whether some capability exists and is safe to use.
+# __FreeBSD_version is used for the testing of the build environment.
+# sysctl kern.osreldate is used for the testing of the kernel capabilities.
+
+version=`grep "#define __FreeBSD_version" /usr/include/osreldate.h \
+ | sed -e 's/^.* \(.*\)$/\1/'`
+
+osreldate=`/sbin/sysctl -n kern.osreldate`
+
+if [ $NGX_FEATURE_CACHE = NO ]; then
+ return
+fi
+
+cache_output_start
+
+echo "ngx_found=yes"
+echo "version=\"$version\""
+echo "osreldate=\"$osreldate\""
+
+cache_output_end
diff --git a/auto/os/linux b/auto/os/linux
--- a/auto/os/linux
+++ b/auto/os/linux
@@ -1,4 +1,5 @@
+# Copyright (C) 2024 Web Server LLC
# Copyright (C) Igor Sysoev
# Copyright (C) Nginx, Inc.
@@ -15,16 +16,7 @@ ngx_spacer='
cc_aux_flags="$CC_AUX_FLAGS"
CC_AUX_FLAGS="$cc_aux_flags -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64"
-
-# Linux kernel version
-
-version=$((`uname -r \
- | sed -n -e 's/^\([0-9][0-9]*\)\.\([0-9][0-9]*\)\.\([0-9][0-9]*\).*/ \
- \1*256*256+\2*256+\3/p' \
- -e 's/^\([0-9][0-9]*\)\.\([0-9][0-9]*\).*/\1*256*256+\2*256/p'`))
-
-version=${version:-0}
-
+. auto/os/linux.kernel_version
# posix_fadvise64() had been implemented in 2.5.60
diff --git a/auto/os/linux.kernel_version b/auto/os/linux.kernel_version
new file mode 100644
--- /dev/null
+++ b/auto/os/linux.kernel_version
@@ -0,0 +1,29 @@
+
+# Copyright (C) 2024 Web Server LLC
+# Copyright (C) Igor Sysoev
+# Copyright (C) Nginx, Inc.
+
+
+if check_cache "kernel version" "os"; then
+ return
+fi
+
+# Linux kernel version
+
+version=$((`uname -r \
+ | sed -n -e 's/^\([0-9][0-9]*\)\.\([0-9][0-9]*\)\.\([0-9][0-9]*\).*/ \
+ \1*256*256+\2*256+\3/p' \
+ -e 's/^\([0-9][0-9]*\)\.\([0-9][0-9]*\).*/\1*256*256+\2*256/p'`))
+
+version=${version:-0}
+
+if [ $NGX_FEATURE_CACHE = NO ]; then
+ return
+fi
+
+cache_output_start
+
+echo "ngx_found=yes"
+echo "version=\"$version\""
+
+cache_output_end
diff --git a/auto/platform b/auto/platform
new file mode 100644
--- /dev/null
+++ b/auto/platform
@@ -0,0 +1,39 @@
+
+# Copyright (C) 2024 Web Server LLC
+# Copyright (C) Igor Sysoev
+# Copyright (C) Nginx, Inc.
+
+
+if check_cache "OS info" "os"; then
+ return
+fi
+
+echo "checking for OS"
+
+NGX_SYSTEM=`uname -s 2>/dev/null`
+NGX_RELEASE=`uname -r 2>/dev/null`
+NGX_MACHINE=`uname -m 2>/dev/null`
+
+echo " + $NGX_SYSTEM $NGX_RELEASE $NGX_MACHINE"
+
+NGX_PLATFORM="$NGX_SYSTEM:$NGX_RELEASE:$NGX_MACHINE";
+
+case "$NGX_SYSTEM" in
+ MINGW32_* | MINGW64_* | MSYS_*)
+ NGX_PLATFORM=win32
+ ;;
+esac
+
+if [ $NGX_FEATURE_CACHE = NO ]; then
+ return
+fi
+
+cache_output_start
+
+echo "ngx_found=yes"
+echo "NGX_SYSTEM=\"$NGX_SYSTEM\""
+echo "NGX_RELEASE=\"$NGX_RELEASE\""
+echo "NGX_MACHINE=\"$NGX_MACHINE\""
+echo "NGX_PLATFORM=\"$NGX_PLATFORM\""
+
+cache_output_end
diff --git a/auto/types/sizeof b/auto/types/sizeof
--- a/auto/types/sizeof
+++ b/auto/types/sizeof
@@ -1,8 +1,13 @@
+# Copyright (C) 2024 Web Server LLC
# Copyright (C) Igor Sysoev
# Copyright (C) Nginx, Inc.
+if check_cache "$ngx_type" "sizeof"; then
+ return
+fi
+
echo $ngx_n "checking for $ngx_type size ...$ngx_c"
cat << END >> $NGX_AUTOCONF_ERR
@@ -33,8 +38,10 @@ int main(void) {
END
-ngx_test="$CC $CC_TEST_FLAGS $CC_AUX_FLAGS \
- -o $NGX_AUTOTEST $NGX_AUTOTEST.c $NGX_LD_OPT $ngx_feature_libs"
+ngx_test="($CC -c $CC_TEST_FLAGS $CC_AUX_FLAGS \
+ -o $NGX_AUTOTEST.o $NGX_AUTOTEST.c && \
+ $CC $CC_TEST_FLAGS $CC_AUX_FLAGS \
+ -o $NGX_AUTOTEST $NGX_AUTOTEST.o $NGX_LD_OPT $ngx_feature_libs)"
eval "$ngx_test >> $NGX_AUTOCONF_ERR 2>&1"
@@ -74,3 +81,16 @@ esac
rm -rf $NGX_AUTOTEST*
+
+if [ $NGX_FEATURE_CACHE = NO ]; then
+ return
+fi
+
+cache_output_start
+
+echo "ngx_found=yes"
+echo "ngx_size=$ngx_size"
+echo "ngx_max_value=$ngx_max_value"
+echo "ngx_max_len='$ngx_max_len'"
+
+cache_output_end
diff --git a/auto/types/typedef b/auto/types/typedef
--- a/auto/types/typedef
+++ b/auto/types/typedef
@@ -1,8 +1,13 @@
+# Copyright (C) 2024 Web Server LLC
# Copyright (C) Igor Sysoev
# Copyright (C) Nginx, Inc.
+if check_cache "$ngx_type" "typedef"; then
+ return
+fi
+
echo $ngx_n "checking for $ngx_type ...$ngx_c"
cat << END >> $NGX_AUTOCONF_ERR
@@ -34,8 +39,10 @@ int main(void) {
END
- ngx_test="$CC $CC_TEST_FLAGS $CC_AUX_FLAGS \
- -o $NGX_AUTOTEST $NGX_AUTOTEST.c $NGX_LD_OPT $ngx_feature_libs"
+ ngx_test="($CC -c $CC_TEST_FLAGS $CC_AUX_FLAGS \
+ -o $NGX_AUTOTEST.o $NGX_AUTOTEST.c && \
+ $CC $CC_TEST_FLAGS $CC_AUX_FLAGS \
+ -o $NGX_AUTOTEST $NGX_AUTOTEST.o $NGX_LD_OPT $ngx_feature_libs)"
eval "$ngx_test >> $NGX_AUTOCONF_ERR 2>&1"
@@ -80,3 +87,17 @@ fi
if [ $ngx_found != yes ]; then
echo "typedef $ngx_found $ngx_type;" >> $NGX_AUTO_CONFIG_H
fi
+
+if [ $NGX_FEATURE_CACHE = NO ]; then
+ return
+fi
+
+cache_output_start
+
+echo "ngx_found=yes"
+
+if [ $ngx_found != yes ]; then
+ echo "echo \"typedef $ngx_found $ngx_type;\" >> \$NGX_AUTO_CONFIG_H"
+fi
+
+cache_output_end
diff --git a/auto/types/uintptr_t b/auto/types/uintptr_t
--- a/auto/types/uintptr_t
+++ b/auto/types/uintptr_t
@@ -1,8 +1,13 @@
+# Copyright (C) 2024 Web Server LLC
# Copyright (C) Igor Sysoev
# Copyright (C) Nginx, Inc.
+if check_cache "uintptr_t type" "uintptr_t"; then
+ return
+fi
+
echo $ngx_n "checking for uintptr_t ...$ngx_c"
cat << END >> $NGX_AUTOCONF_ERR
@@ -26,8 +31,10 @@ int main(void) {
END
-ngx_test="$CC $CC_TEST_FLAGS $CC_AUX_FLAGS \
- -o $NGX_AUTOTEST $NGX_AUTOTEST.c $NGX_LD_OPT"
+ngx_test="($CC -c $CC_TEST_FLAGS $CC_AUX_FLAGS \
+ -o $NGX_AUTOTEST.o $NGX_AUTOTEST.c && \
+ $CC $CC_TEST_FLAGS $CC_AUX_FLAGS \
+ -o $NGX_AUTOTEST $NGX_AUTOTEST.o $NGX_LD_OPT)"
eval "$ngx_test >> $NGX_AUTOCONF_ERR 2>&1"
@@ -48,3 +55,23 @@ if [ $found = no ]; then
echo "typedef $found uintptr_t;" >> $NGX_AUTO_CONFIG_H
echo "typedef $found intptr_t;" | sed -e 's/u//g' >> $NGX_AUTO_CONFIG_H
fi
+
+if [ $NGX_FEATURE_CACHE = NO ]; then
+ return
+fi
+
+cache_output_start
+
+echo "ngx_found=yes"
+
+if [ $found = yes ]; then
+ cache_output_end
+ return
+fi
+
+sfound=$(echo $found | sed -e 's/u//g')
+
+echo "echo \"typedef $found uintptr_t;\" >> \$NGX_AUTO_CONFIG_H"
+echo "echo \"typedef $sfound intptr_t;\" >> \$NGX_AUTO_CONFIG_H"
+
+cache_output_end
diff --git a/auto/unix b/auto/unix
--- a/auto/unix
+++ b/auto/unix
@@ -1,4 +1,5 @@
+# Copyright (C) 2024 Web Server LLC
# Copyright (C) Igor Sysoev
# Copyright (C) Nginx, Inc.
@@ -6,24 +7,7 @@
NGX_USER=${NGX_USER:-nobody}
if [ -z "$NGX_GROUP" ]; then
- if [ $NGX_USER = nobody ]; then
- if grep nobody /etc/group 2>&1 >/dev/null; then
- echo "checking for nobody group ... found"
- NGX_GROUP=nobody
- else
- echo "checking for nobody group ... not found"
-
- if grep nogroup /etc/group 2>&1 >/dev/null; then
- echo "checking for nogroup group ... found"
- NGX_GROUP=nogroup
- else
- echo "checking for nogroup group ... not found"
- NGX_GROUP=nobody
- fi
- fi
- else
- NGX_GROUP=$NGX_USER
- fi
+ . auto/unix.group
fi
diff --git a/auto/unix.group b/auto/unix.group
new file mode 100644
--- /dev/null
+++ b/auto/unix.group
@@ -0,0 +1,39 @@
+
+# Copyright (C) 2024 Web Server LLC
+# Copyright (C) Igor Sysoev
+# Copyright (C) Nginx, Inc.
+
+
+if check_cache "unix group" "os"; then
+ return
+fi
+
+if [ $NGX_USER = nobody ]; then
+ if grep nobody /etc/group 2>&1 >/dev/null; then
+ echo "checking for nobody group ... found"
+ NGX_GROUP=nobody
+ else
+ echo "checking for nobody group ... not found"
+
+ if grep nogroup /etc/group 2>&1 >/dev/null; then
+ echo "checking for nogroup group ... found"
+ NGX_GROUP=nogroup
+ else
+ echo "checking for nogroup group ... not found"
+ NGX_GROUP=nobody
+ fi
+ fi
+else
+ NGX_GROUP=$NGX_USER
+fi
+
+if [ $NGX_FEATURE_CACHE = NO ]; then
+ return
+fi
+
+cache_output_start
+
+echo "ngx_found=yes"
+echo "NGX_GROUP=$NGX_GROUP"
+
+cache_output_end
diff --git a/auto/utils b/auto/utils
new file mode 100644
--- /dev/null
+++ b/auto/utils
@@ -0,0 +1,33 @@
+
+# Copyright (C) 2024 Web Server LLC
+
+
+name2macro()
+{
+ case "$1" in
+ *[a-z/.]*)
+ ;;
+ *)
+ res=$1
+ return
+ ;;
+ esac
+
+ OPTIND=1
+ res=
+
+ while getopts ":" opt "-$1"; do
+ r=
+ case "$OPTARG" in
+ "a") r="A" ;; "b") r="B" ;; "c") r="C" ;; "d") r="D" ;;
+ "e") r="E" ;; "f") r="F" ;; "g") r="G" ;; "h") r="H" ;;
+ "i") r="I" ;; "j") r="J" ;; "k") r="K" ;; "l") r="L" ;;
+ "m") r="M" ;; "n") r="N" ;; "o") r="O" ;; "p") r="P" ;;
+ "q") r="Q" ;; "r") r="R" ;; "s") r="S" ;; "t") r="T" ;;
+ "u") r="U" ;; "v") r="V" ;; "w") r="W" ;; "x") r="X" ;;
+ "y") r="Y" ;; "z") r="Z" ;; "/") r="_" ;; ".") r="_" ;;
+ *) r="${OPTARG}" ;;
+ esac
+ res="$res$r"
+ done
+}
diff --git a/configure b/configure
--- a/configure
+++ b/configure
@@ -10,6 +10,8 @@ export LC_ALL
. auto/options
. auto/init
+. auto/utils
+. auto/cache
. auto/sources
test -d $NGX_OBJS || mkdir -p $NGX_OBJS
@@ -26,21 +28,7 @@ fi
if test -z "$NGX_PLATFORM"; then
- echo "checking for OS"
-
- NGX_SYSTEM=`uname -s 2>/dev/null`
- NGX_RELEASE=`uname -r 2>/dev/null`
- NGX_MACHINE=`uname -m 2>/dev/null`
-
- echo " + $NGX_SYSTEM $NGX_RELEASE $NGX_MACHINE"
-
- NGX_PLATFORM="$NGX_SYSTEM:$NGX_RELEASE:$NGX_MACHINE";
-
- case "$NGX_SYSTEM" in
- MINGW32_* | MINGW64_* | MSYS_*)
- NGX_PLATFORM=win32
- ;;
- esac
+ . auto/platform
else
echo "building for $NGX_PLATFORM"