summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Pointner <equinox@anytun.org>2014-06-22 23:46:50 +0000
committerChristian Pointner <equinox@anytun.org>2014-06-22 23:46:50 +0000
commitf4c22a3670d0640616844c3a0487aa308a8dd5f4 (patch)
treedb6c54f1bc13e96fddac438dcdff1a53ce574f16 /src
parentcreated branch for clang port (diff)
added support for clang
fixed for NetworkAdress and NetworkPrefix
Diffstat (limited to 'src')
-rwxr-xr-xsrc/configure22
-rw-r--r--src/networkAddress.cpp2
-rw-r--r--src/networkPrefix.h1
3 files changed, 19 insertions, 6 deletions
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;