summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2013-10-10 09:47:52 -0700
committerKeith Packard <keithp@keithp.com>2013-10-10 09:47:52 -0700
commit2296175eff9e4286eaf44451690701a46595987e (patch)
treeae5fb7ee2d867ed726ca9d4949201a4aeaac305a
parentaa169b80039728e35b0dec3be66a8483d48a3458 (diff)
Make sure the AVR compiler can actually link stuff
avr-gcc was broken for a while, causing all linking to fail. Check for that and don't try to build avr bits in that case. Signed-off-by: Keith Packard <keithp@keithp.com>
-rw-r--r--configure.ac25
1 files changed, 23 insertions, 2 deletions
diff --git a/configure.ac b/configure.ac
index 8024b7c6..28a673c5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -330,8 +330,29 @@ if test "x$HAVE_AVR_CC" = "xno" -o "x$HAVE_AVR_OBJCOPY" = "xno"; then
AC_MSG_WARN([AVR compiler and objcopy not found, atmel binaries will not be built])
HAVE_AVR_CC=no
else
- AVR_CC=$with_avr_cc
- AVR_OBJCOPY=$with_avr_objcopy
+ save_CC="$CC"
+ save_CFLAGS="$CFLAGS"
+ save_LIBS="$LIBS"
+
+ CC="$with_avr_cc"
+ AC_LANG_PUSH([C])
+ AC_MSG_CHECKING([if ]$with_avr_cc[ can link programs])
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([])],
+ [AVR_LINK=yes],
+ [AVR_LINK=no])
+ AC_MSG_RESULT([$AVR_LINK])
+ AC_LANG_POP([C])
+
+ LIBS="$save_LIBS"
+ CFLAGS="$save_CFLAGS"
+ CC="$save_CC"
+
+ if test "x$AVR_LINK" = xyes; then
+ AVR_CC=$with_avr_cc
+ AVR_OBJCOPY=$with_avr_objcopy
+ else
+ HAVE_AVR_CC=no;
+ fi
fi
AC_SUBST(AVR_CC)