summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Pointner <equinox@helsinki.at>2015-05-08 16:36:38 (GMT)
committerChristian Pointner <equinox@helsinki.at>2015-05-08 16:36:38 (GMT)
commitfb6b8d1ef4b36c92089e89d467d77e2827f12472 (patch)
treecae4e5298919fdc89e32eeda2ae547185d32700d
parentc3ee7e51b1f065ed8cbd2033780913c8d650ab3f (diff)
build nows with clang as well
-rwxr-xr-xsrc/configure19
1 files changed, 16 insertions, 3 deletions
diff --git a/src/configure b/src/configure
index 0d92d8b..54c202d 100755
--- a/src/configure
+++ b/src/configure
@@ -23,8 +23,7 @@
TARGET=`uname -s`
EBUILD_COMPAT=0
-CFLAGS='-g -O2'
-LDFLAGS='-g -Wall -O2 -lpthread'
+USE_CLANG=0
LUA_DIR=''
LUA=''
@@ -42,6 +41,7 @@ print_usage() {
echo " --sysconfdir=<DIR> the path to the system configuration directory (default: $PREFIX/etc)"
echo " --libdir=<DIR> the path to the lua library directory (default: $PREFIX/lib/rhnop)"
echo " --with-lua=<DIR> use this lua tree instead of system default"
+ echo " --use-clang use clang/llvm as compiler/linker"
}
for arg
@@ -50,6 +50,9 @@ do
--target=*)
TARGET=${arg#--target=}
;;
+ --use-clang)
+ USE_CLANG=1
+ ;;
--prefix=*)
PREFIX=${arg#--prefix=}
;;
@@ -87,6 +90,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 -lpthread'
+ COMPILER='gcc'
+else
+ CFLAGS='-g -O2'
+ LDFLAGS='-g -O2 -lpthread'
+ COMPILER='clang'
+fi
+
rm -f config.h
rm -f include.mk
case $TARGET in
@@ -184,7 +197,7 @@ cat > include.mk <<EOF
# use ./configure instead
TARGET := '$TARGET'
-CC := gcc
+CC := $COMPILER
CFLAGS := $CFLAGS
LDFLAGS := $LDFLAGS
LUA := '$LUA'