summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Pointner <equinox@anylike.org>2012-09-25 11:27:20 +0000
committerChristian Pointner <equinox@anylike.org>2012-09-25 11:27:20 +0000
commit3890b431646b895647b06b202c8e73b1cd0e3679 (patch)
treedf858f308137637d57bc3854e5e68e08c719da4d
parentfixed -Wall (diff)
add support for clang
-rwxr-xr-xsrc/configure19
-rw-r--r--tools/bin2c.lua2
2 files changed, 17 insertions, 4 deletions
diff --git a/src/configure b/src/configure
index 680d22e..2dfb56d 100755
--- a/src/configure
+++ b/src/configure
@@ -32,8 +32,7 @@
TARGET=`uname -s`
EBUILD_COMPAT=0
-CFLAGS='-g -Wall -O2'
-LDFLAGS='-g -Wall -O2 -lm'
+USE_CLANG=0
CRYPTO_LIB='gnutls'
LUA_DIR=''
@@ -60,6 +59,7 @@ print_usage() {
echo " --no-examples dont't install example files"
echo " --use-openssl use openssl instead of gnutls"
echo " --with-lua=<DIR> use this lua tree instead of system default"
+ echo " --use-clang use clang/llvm as compiler/linker"
}
for arg
@@ -80,6 +80,9 @@ do
--mandir=*)
MANDIR=${arg#--mandir=}
;;
+ --use-clang)
+ USE_CLANG=1
+ ;;
--no-manpage)
INSTALLMANPAGE=0
;;
@@ -117,6 +120,16 @@ if [ -n "$ERRORS" ] && [ $EBUILD_COMPAT -ne 1 ]; then
exit 1
fi
+if [ $USE_CLANG -eq 0 ]; then
+ CFLAGS='-g -Wall -O2'
+ LDFLAGS='-g -Wall -O2 -lm'
+ COMPILER='gcc'
+else
+ CFLAGS='-g -O2'
+ LDFLAGS='-g -O2 -lm'
+ COMPILER='clang'
+fi
+
rm -f version.h
rm -f include.mk
case $TARGET in
@@ -244,7 +257,7 @@ cat > include.mk <<EOF
# use ./configure instead
TARGET := '$TARGET'
-CC := gcc
+CC := $COMPILER
CFLAGS := $CFLAGS
LDFLAGS := $LDFLAGS
LUA := '$LUA'
diff --git a/tools/bin2c.lua b/tools/bin2c.lua
index 8a61549..d5bf5e3 100644
--- a/tools/bin2c.lua
+++ b/tools/bin2c.lua
@@ -54,7 +54,7 @@ io.write([=[
#include "datatypes.h"
-const uint8_t ]=] , c_var_name, [=[[]={
+const char ]=] , c_var_name, [=[[]={
]=], dump(content), [=[
};