mirror of
https://github.com/nginx/nginx.git
synced 2026-04-27 09:07:33 -04:00
Some checks failed
buildbot / buildbot (push) Has been cancelled
For certain compilers we embed the compiler version used to build nginx in the binary, retrievable via 'nginx -V', e.g. $ ./objs/nginx -V ... built by gcc 15.2.1 20250808 (Red Hat 15.2.1-1) (GCC) ... However if the CFLAGS environment variable is set this would be omitted. This is due to the compiler specific auto/cc files not being run when the CFLAGS environment variable is set, this is so entities can set their own compiler flags, and thus the NGX_COMPILER variable isn't set. Nonetheless it is a useful thing to have so re-work the auto scripts to move the version gathering out of the individual auto/cc/$NGX_CC_NAME files and merge them into auto/cc/name. Link: <https://github.com/nginx/nginx/issues/878>
90 lines
1.5 KiB
Text
90 lines
1.5 KiB
Text
|
|
# Copyright (C) Nginx, Inc.
|
|
|
|
|
|
# clang
|
|
|
|
|
|
CC_TEST_FLAGS="-pipe"
|
|
|
|
|
|
# optimizations
|
|
|
|
#NGX_CLANG_OPT="-O2"
|
|
#NGX_CLANG_OPT="-Oz"
|
|
NGX_CLANG_OPT="-O"
|
|
|
|
case $CPU in
|
|
pentium)
|
|
# optimize for Pentium
|
|
CPU_OPT="-march=pentium"
|
|
NGX_CPU_CACHE_LINE=32
|
|
;;
|
|
|
|
pentiumpro | pentium3)
|
|
# optimize for Pentium Pro, Pentium II and Pentium III
|
|
CPU_OPT="-march=pentiumpro"
|
|
NGX_CPU_CACHE_LINE=32
|
|
;;
|
|
|
|
pentium4)
|
|
# optimize for Pentium 4
|
|
CPU_OPT="-march=pentium4"
|
|
NGX_CPU_CACHE_LINE=128
|
|
;;
|
|
|
|
athlon)
|
|
# optimize for Athlon
|
|
CPU_OPT="-march=athlon"
|
|
NGX_CPU_CACHE_LINE=64
|
|
;;
|
|
|
|
opteron)
|
|
# optimize for Opteron
|
|
CPU_OPT="-march=opteron"
|
|
NGX_CPU_CACHE_LINE=64
|
|
;;
|
|
|
|
esac
|
|
|
|
CC_AUX_FLAGS="$CC_AUX_FLAGS $CPU_OPT"
|
|
|
|
|
|
CFLAGS="$CFLAGS -pipe $CPU_OPT"
|
|
|
|
if [ ".$PCRE_OPT" = "." ]; then
|
|
PCRE_OPT="-O2 -pipe $CPU_OPT"
|
|
else
|
|
PCRE_OPT="$PCRE_OPT -pipe"
|
|
fi
|
|
|
|
if [ ".$ZLIB_OPT" = "." ]; then
|
|
ZLIB_OPT="-O2 -pipe $CPU_OPT"
|
|
else
|
|
ZLIB_OPT="$ZLIB_OPT -pipe"
|
|
fi
|
|
|
|
|
|
# warnings
|
|
|
|
CFLAGS="$CFLAGS $NGX_CLANG_OPT -Wall -Wextra -Wpointer-arith"
|
|
CFLAGS="$CFLAGS -Wconditional-uninitialized"
|
|
#CFLAGS="$CFLAGS -Wmissing-prototypes"
|
|
|
|
# we have a lot of unused function arguments
|
|
CFLAGS="$CFLAGS -Wno-unused-parameter"
|
|
|
|
# deprecated system OpenSSL library on OS X
|
|
if [ "$NGX_SYSTEM" = "Darwin" ]; then
|
|
CFLAGS="$CFLAGS -Wno-deprecated-declarations"
|
|
fi
|
|
|
|
# stop on warning
|
|
CFLAGS="$CFLAGS -Werror"
|
|
|
|
# debug
|
|
CFLAGS="$CFLAGS -g"
|
|
|
|
if [ ".$CPP" = "." ]; then
|
|
CPP="$CC -E"
|
|
fi
|