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"
MYCFLAGS="-O2 -g"
fi
-if [ "x$MYCC" = "xgcc" ]; then
+if [ "x$MYCC" = "xgcc" ] || [ "x$MYCC" = "xclang" ]; then
MYCFLAGS="$MYCFLAGS -Wmissing-prototypes -Wall"
fi