[nginx] svn commit: r4800 - in branches/stable-1.2: . auto/cc

mdounin at mdounin.ru mdounin at mdounin.ru
Mon Aug 6 17:10:35 UTC 2012


Author: mdounin
Date: 2012-08-06 17:10:35 +0000 (Mon, 06 Aug 2012)
New Revision: 4800
URL: http://trac.nginx.org/nginx/changeset/4800/nginx

Log:
Merge of r4763: added the Clang compiler support.

The -Werror is commented out to not break builds on Linux.


Added:
   branches/stable-1.2/auto/cc/clang
Modified:
   branches/stable-1.2/
   branches/stable-1.2/auto/cc/conf
   branches/stable-1.2/auto/cc/name

Index: branches/stable-1.2
===================================================================
--- branches/stable-1.2	2012-08-06 17:07:28 UTC (rev 4799)
+++ branches/stable-1.2	2012-08-06 17:10:35 UTC (rev 4800)

Property changes on: branches/stable-1.2
___________________________________________________________________
Modified: svn:mergeinfo
## -1 +1 ##
-/trunk:4611-4632,4636-4657,4671-4672,4674-4676,4682,4684-4699,4704-4706,4713,4736-4738,4740-4741,4754,4756-4762,4768
+/trunk:4611-4632,4636-4657,4671-4672,4674-4676,4682,4684-4699,4704-4706,4713,4736-4738,4740-4741,4754,4756-4763,4768
\ No newline at end of property
Copied: branches/stable-1.2/auto/cc/clang (from rev 4763, trunk/auto/cc/clang)
===================================================================
--- branches/stable-1.2/auto/cc/clang	                        (rev 0)
+++ branches/stable-1.2/auto/cc/clang	2012-08-06 17:10:35 UTC (rev 4800)
@@ -0,0 +1,98 @@
+
+# Copyright (C) Nginx, Inc.
+
+
+# clang
+
+
+NGX_CLANG_VER=`$CC -v 2>&1 | grep 'clang version' 2>&1 \
+                           | sed -e 's/^.*clang version \(.*\)/\1/'`
+
+echo " + clang version: $NGX_CLANG_VER"
+
+have=NGX_COMPILER value="\"clang $NGX_CLANG_VER\"" . auto/define
+
+
+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 [ ".$MD5_OPT" = "." ]; then
+    MD5_OPT="-O2 -pipe $CPU_OPT"
+else
+    MD5_OPT="$MD5_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 -Wmissing-prototypes"
+
+# we have a lot of unused function arguments
+CFLAGS="$CFLAGS -Wno-unused-parameter"
+
+# stop on warning
+#CFLAGS="$CFLAGS -Werror"
+
+# debug
+CFLAGS="$CFLAGS -g"
+
+if [ ".$CPP" = "." ]; then
+    CPP="$CC -E"
+fi

Modified: branches/stable-1.2/auto/cc/conf
===================================================================
--- branches/stable-1.2/auto/cc/conf	2012-08-06 17:07:28 UTC (rev 4799)
+++ branches/stable-1.2/auto/cc/conf	2012-08-06 17:10:35 UTC (rev 4800)
@@ -56,6 +56,12 @@
             . auto/cc/gcc
         ;;
 
+        clang)
+            # Clang C compiler
+
+            . auto/cc/clang
+        ;;
+
         icc)
             # Intel C++ compiler 7.1, 8.0, 8.1
 

Modified: branches/stable-1.2/auto/cc/name
===================================================================
--- branches/stable-1.2/auto/cc/name	2012-08-06 17:07:28 UTC (rev 4799)
+++ branches/stable-1.2/auto/cc/name	2012-08-06 17:10:35 UTC (rev 4800)
@@ -67,6 +67,10 @@
     NGX_CC_NAME=gcc
     echo " + using GNU C compiler"
 
+elif `$CC -v 2>&1 | grep 'clang version' >/dev/null 2>&1`; then
+    NGX_CC_NAME=clang
+    echo " + using Clang C compiler"
+
 elif `$CC -V 2>&1 | grep 'Sun C' >/dev/null 2>&1`; then
     NGX_CC_NAME=sunc
     echo " + using Sun C compiler"



More information about the nginx-devel mailing list