mirror of
https://gitlab.com/chrony/chrony.git
synced 2025-12-04 03:25:07 -05:00
configure: check for clang
Try clang as the C compiler before cc and use the same -W* CFLAGS as with gcc.
This commit is contained in:
12
configure
vendored
12
configure
vendored
@@ -490,14 +490,16 @@ MYCPPFLAGS="$CPPFLAGS"
|
|||||||
MYLDFLAGS="$LDFLAGS"
|
MYLDFLAGS="$LDFLAGS"
|
||||||
|
|
||||||
if [ "x$MYCC" = "x" ]; then
|
if [ "x$MYCC" = "x" ]; then
|
||||||
MYCC=gcc
|
for cc in gcc clang cc ""; do
|
||||||
if ! test_code "$MYCC" '' '' '' ''; then
|
if [ "x$cc" = "x" ]; then
|
||||||
MYCC=cc
|
|
||||||
if ! test_code "$MYCC" '' '' '' ''; then
|
|
||||||
echo "error: no C compiler found"
|
echo "error: no C compiler found"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
MYCC=$cc
|
||||||
|
if test_code "$MYCC" '' '' '' ''; then
|
||||||
|
break
|
||||||
fi
|
fi
|
||||||
|
done
|
||||||
else
|
else
|
||||||
if ! test_code "$MYCC" '' '' '' ''; then
|
if ! test_code "$MYCC" '' '' '' ''; then
|
||||||
echo "error: C compiler $MYCC cannot create executables"
|
echo "error: C compiler $MYCC cannot create executables"
|
||||||
@@ -509,7 +511,7 @@ if [ "x$MYCFLAGS" = "x" ]; then
|
|||||||
MYCFLAGS="-O2 -g"
|
MYCFLAGS="-O2 -g"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "x$MYCC" = "xgcc" ]; then
|
if [ "x$MYCC" = "xgcc" ] || [ "x$MYCC" = "xclang" ]; then
|
||||||
MYCFLAGS="$MYCFLAGS -Wmissing-prototypes -Wall"
|
MYCFLAGS="$MYCFLAGS -Wmissing-prototypes -Wall"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user