summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Pointner <equinox@anytun.org>2014-06-22 23:47:20 (GMT)
committerChristian Pointner <equinox@anytun.org>2014-06-22 23:47:20 (GMT)
commitbcb7bacbfefac35ebe27b8ded9cc94663478081f (patch)
treedb6c54f1bc13e96fddac438dcdff1a53ce574f16
parentfac90fc49e667b18522b442ff15edd3bb8eb804b (diff)
parentf4c22a3670d0640616844c3a0487aa308a8dd5f4 (diff)
merged clang branch
-rw-r--r--README3
-rwxr-xr-xsrc/configure22
-rw-r--r--src/networkAddress.cpp2
-rw-r--r--src/networkPrefix.h1
4 files changed, 22 insertions, 6 deletions
diff --git a/README b/README
index 66a8e12..746bd7e 100644
--- a/README
+++ b/README
@@ -25,6 +25,9 @@ common:
libboost-system-dev
libboost-regex-dev
+if you want clang as compiler
+ clang
+
if you want to rebuild the manpage:
asciidoc
diff --git a/src/configure b/src/configure
index a8fe6b1..4c84a9d 100755
--- a/src/configure
+++ b/src/configure
@@ -35,10 +35,10 @@ TARGET=`uname -s`
EBUILD_COMPAT=0
-CXXFLAGS='-g -Wall -O2'
-LDFLAGS='-g -Wall -O2'
CROSS_PREFIX=''
+USE_CLANG=0
+
CRYPTO_LIB='gcrypt'
PASSPHRASE=1
ROUTING=1
@@ -81,6 +81,7 @@ print_usage() {
echo " --with-gcrypt=<PREFIX> don't use systemwide gcrypt"
echo " --with-nettle=<PREFIX> don't use systemwide nettle"
echo " --with-openssl=<PREFIX> don't use systemwide openssl"
+ echo " --use-clang use clang/llvm as compiler/linker"
}
for arg
@@ -89,6 +90,9 @@ do
--target=*)
TARGET=${arg#--target=}
;;
+ --use-clang)
+ USE_CLANG=1
+ ;;
--prefix=*)
PREFIX=${arg#--prefix=}
;;
@@ -174,6 +178,16 @@ if [ -n "$ERRORS" ] && [ $EBUILD_COMPAT -ne 1 ]; then
exit 1
fi
+if [ $USE_CLANG -eq 0 ]; then
+ CXXFLAGS='-g -Wall -O2'
+ LDFLAGS='-g -Wall -O2'
+ COMPILER='g++'
+else
+ CXXFLAGS='-g -O2'
+ LDFLAGS='-g -O2'
+ COMPILER='clang++'
+fi
+
rm -f include.mk
rm -f version.h
case $TARGET in
@@ -299,9 +313,9 @@ cat > include.mk <<EOF
# use ./configure instead
TARGET = $TARGET
-CXX = ${CROSS_PREFIX}g++
+CXX = ${CROSS_PREFIX}$COMPILER
CXXFLAGS = $CXXFLAGS
-LD = ${CROSS_PREFIX}g++
+LD = ${CROSS_PREFIX}$COMPILER
LDFLAGS = $LDFLAGS
STRIP = ${CROSS_PREFIX}strip
INSTALL = install
diff --git a/src/networkAddress.cpp b/src/networkAddress.cpp
index a035fd6..370c81a 100644
--- a/src/networkAddress.cpp
+++ b/src/networkAddress.cpp
@@ -177,7 +177,7 @@ ethernet_bytes_type NetworkAddress::to_bytes_ethernet() const
boost::array<unsigned char,6> result;
uint64_t ether=ethernet_address_;
for(int i = 0; i < 6; i++) {
- result[i] = (unsigned char)(ether && 0xff);
+ result[i] = (unsigned char)(ether & 0xff);
ether >>= 8;
}
return result;
diff --git a/src/networkPrefix.h b/src/networkPrefix.h
index 9b18708..a57ca04 100644
--- a/src/networkPrefix.h
+++ b/src/networkPrefix.h
@@ -51,7 +51,6 @@ public:
bool operator<(const NetworkPrefix& s) const;
private:
- operator NetworkAddress();
void operator=(const NetworkPrefix& s);
uint8_t length_;
friend class boost::serialization::access;