Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: def7fbf4a3
Fetching contributors…

Cannot retrieve contributors at this time

202 lines (198 sloc) 4.497 kb
Index: nginx-catap/nginx/auto/cc/clang
===================================================================
--- /dev/null
+++ nginx-catap/nginx/auto/cc/clang
@@ -0,0 +1,157 @@
+
+# Copyright (C) Kirill A. Korinskiy, base on gcc
+
+
+NGX_CLANG_VER=`$CC -v 2>&1 | grep 'clang version' 2>&1 \
+ | sed -e 's/^.* version \(.*\)/\1/'`
+
+echo " + clang version: $NGX_CLANG_VER"
+
+have=NGX_COMPILER value="\"clang $NGX_CLANG_VER\"" . auto/define
+
+
+# Solaris 7's /usr/ccs/bin/as does not support "-pipe"
+
+CC_TEST_FLAGS="-pipe"
+
+ngx_feature="gcc -pipe switch"
+ngx_feature_name=
+ngx_feature_run=no
+ngx_feature_incs=
+ngx_feature_path=
+ngx_feature_libs=
+ngx_feature_test=
+. auto/feature
+
+CC_TEST_FLAGS=
+
+if [ $ngx_found = yes ]; then
+ PIPE="-pipe"
+fi
+
+
+case "$NGX_MACHINE" in
+
+ sun4u | sun4v | sparc | sparc64 )
+ # "-mcpu=v9" enables the "casa" assembler instruction
+ CFLAGS="$CFLAGS -mcpu=v9"
+ ;;
+
+esac
+
+
+# optimizations
+
+#NGX_CLANG_OPT="-O2"
+#NGX_CLANG_OPT="-Os"
+
+#CFLAGS="$CFLAGS -fomit-frame-pointer"
+
+case $CPU in
+ pentium)
+ # optimize for Pentium and Athlon
+ 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, gcc 3.x
+ CPU_OPT="-march=pentium4"
+ NGX_CPU_CACHE_LINE=128
+ ;;
+
+ athlon)
+ # optimize for Athlon, gcc 3.x
+ CPU_OPT="-march=athlon"
+ NGX_CPU_CACHE_LINE=64
+ ;;
+
+ opteron)
+ # optimize for Opteron, gcc 3.x
+ CPU_OPT="-march=opteron"
+ NGX_CPU_CACHE_LINE=64
+ ;;
+
+ sparc32)
+ # build 32-bit UltraSparc binary
+ CPU_OPT="-m32"
+ CORE_LINK="$CORE_LINK -m32"
+ NGX_CPU_CACHE_LINE=64
+ ;;
+
+ sparc64)
+ # build 64-bit UltraSparc binary
+ CPU_OPT="-m64"
+ CORE_LINK="$CORE_LINK -m64"
+ NGX_CPU_CACHE_LINE=64
+ ;;
+
+ ppc64)
+ # build 64-bit PowerPC binary
+ CPU_OPT="-m64"
+ CPU_OPT="$CPU_OPT -falign-functions=32 -falign-labels=32"
+ CPU_OPT="$CPU_OPT -falign-loops=32 -falign-jumps=32"
+ CORE_LINK="$CORE_LINK -m64"
+ NGX_CPU_CACHE_LINE=128
+ ;;
+
+esac
+
+CC_AUX_FLAGS="$CC_AUX_FLAGS $CPU_OPT"
+
+CFLAGS="$CFLAGS $PIPE $CPU_OPT"
+
+if [ ".$PCRE_OPT" = "." ]; then
+ PCRE_OPT="-O2 -fomit-frame-pointer $PIPE $CPU_OPT"
+else
+ PCRE_OPT="$PCRE_OPT $PIPE"
+fi
+
+if [ ".$MD5_OPT" = "." ]; then
+ MD5_OPT="-O2 -fomit-frame-pointer $PIPE $CPU_OPT"
+else
+ MD5_OPT="$MD5_OPT $PIPE"
+fi
+
+if [ ".$ZLIB_OPT" = "." ]; then
+ ZLIB_OPT="-O2 -fomit-frame-pointer $PIPE $CPU_OPT"
+else
+ ZLIB_OPT="$ZLIB_OPT $PIPE"
+fi
+
+
+# warnings
+
+# -W requires at least -O
+CFLAGS="$CFLAGS ${NGX_CLANG_OPT} -W"
+
+CFLAGS="$CFLAGS -Wall -Wpointer-arith"
+#CFLAGS="$CFLAGS -Wconversion"
+#CFLAGS="$CFLAGS -Winline"
+
+
+# we have a lot of the unused function arguments
+CFLAGS="$CFLAGS -Wno-unused-parameter"
+CFLAGS="$CFLAGS -Wunused-function"
+CFLAGS="$CFLAGS -Wunused-variable"
+CFLAGS="$CFLAGS -Wunused-value"
+CFLAGS="$CFLAGS -Wno-unused"
+CFLAGS="$CFLAGS -Wall"
+
+
+# stop on warning
+CFLAGS="$CFLAGS -Werror"
+
+# debug
+CFLAGS="$CFLAGS -g"
+
+# DragonFly's gcc3 generates DWARF
+#CFLAGS="$CFLAGS -g -gstabs"
+
+CPP="$CC -E"
Index: nginx-catap/nginx/auto/cc/conf
===================================================================
--- nginx-catap.orig/nginx/auto/cc/conf
+++ nginx-catap/nginx/auto/cc/conf
@@ -55,6 +55,10 @@ else
. auto/cc/gcc
;;
+ clang)
+ . auto/cc/clang
+ ;;
+
icc)
# Intel C++ compiler 7.1, 8.0, 8.1
Index: nginx-catap/nginx/auto/cc/name
===================================================================
--- nginx-catap.orig/nginx/auto/cc/name
+++ nginx-catap/nginx/auto/cc/name
@@ -60,6 +60,11 @@ if `$CC -v 2>&1 | grep 'gcc version' >/d
echo " + using GNU C compiler"
else
+if `$CC -v 2>&1 | grep 'clang version' >/dev/null 2>&1`; then
+ NGX_CC_NAME=clang
+ echo " + using the Clang C and Objective-C compiler"
+
+else
if `$CC -V 2>&1 | grep '^Intel(R) C' >/dev/null 2>&1`; then
NGX_CC_NAME=icc
echo " + using Intel C++ compiler"
@@ -86,6 +91,7 @@ fi # acc
fi # ccc
fi # sunc
fi # icc
+fi # clang
fi # gcc
fi # bcc
fi # owc
Jump to Line
Something went wrong with that request. Please try again.