]> git.ipfire.org Git - thirdparty/chrony.git/commitdiff
configure: check for clang
authorMiroslav Lichvar <mlichvar@redhat.com>
Wed, 5 Apr 2017 11:10:40 +0000 (13:10 +0200)
committerMiroslav Lichvar <mlichvar@redhat.com>
Wed, 19 Apr 2017 11:03:10 +0000 (13:03 +0200)
Try clang as the C compiler before cc and use the same -W* CFLAGS as
with gcc.

configure

index 6a32a3fde26692360fa14897adb18109a731371e..53a0bb81c10fe2fd2597e86db5fd1c2ca8ac0771 100755 (executable)
--- a/configure
+++ b/configure
@@ -490,14 +490,16 @@ MYCPPFLAGS="$CPPFLAGS"
 MYLDFLAGS="$LDFLAGS"
 
 if [ "x$MYCC" = "x" ]; then
-  MYCC=gcc
-  if ! test_code "$MYCC" '' '' '' ''; then
-    MYCC=cc
-    if ! test_code "$MYCC" '' '' '' ''; then
+  for cc in gcc clang cc ""; do
+    if [ "x$cc" = "x" ]; then
       echo "error: no C compiler found"
       exit 1
     fi
-  fi
+    MYCC=$cc
+    if test_code "$MYCC" '' '' '' ''; then
+      break
+    fi
+  done
 else
   if ! test_code "$MYCC" '' '' '' ''; then
     echo "error: C compiler $MYCC cannot create executables"
@@ -509,7 +511,7 @@ if [ "x$MYCFLAGS" = "x" ]; then
   MYCFLAGS="-O2 -g"
 fi
 
-if [ "x$MYCC" = "xgcc" ]; then
+if [ "x$MYCC" = "xgcc" ] || [ "x$MYCC" = "xclang" ]; then
   MYCFLAGS="$MYCFLAGS -Wmissing-prototypes -Wall"
 fi