summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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'