Set version to 1.3 in preparation for release
[fw/altos] / configure.ac
index 8024b7c602d674a538ef89026d20c76917676213..1d80376cc14f22342078277a700284ab4cfad932 100644 (file)
@@ -18,7 +18,7 @@ dnl
 dnl Process this file with autoconf to create configure.
 
 AC_PREREQ(2.57)
-AC_INIT([altos], 1.2.9.3)
+AC_INIT([altos], 1.3)
 AC_CONFIG_SRCDIR([src/core/ao.h])
 AM_INIT_AUTOMAKE([foreign dist-bzip2])
 AM_MAINTAINER_MODE
@@ -26,7 +26,6 @@ AM_MAINTAINER_MODE
 VERSION_DASH=`echo $VERSION | sed 's/\./-/g'`
 AC_SUBST(VERSION_DASH)
 
-
 dnl ==========================================================================
 dnl Java library versions
 
@@ -330,8 +329,30 @@ 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"
+       CFLAGS="-mmcu=attiny85"
+       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)
@@ -343,16 +364,50 @@ if test "x$HAVE_NICKLE" = "xno"; then
        AC_MSG_ERROR([Please install nickle to build AltOs])
 fi
 
-AC_CHECK_LIB(readline, readline)
+AC_ARG_WITH([readline],
+           [AS_HELP_STRING([--with-readline],
+                             [enable readline functionality in ao-dbg @<:@default=auto@:>@])],
+             [],
+             [with_readline=auto])
+                             
+LIBREADLINE_LIBS=
+
+if test x"$with_readline" != "xno"; then
+       AC_CHECK_LIB([readline], [main],
+                      [AC_SUBST([LIBREADLINE], ["-lreadline -lncurses"])
+                      AC_DEFINE([HAVE_LIBREADLINE], [1],
+                         [Define if you have libreadline])],
+                     [if test "x$with_readline" != xauto; then
+                        AC_MSG_ERROR([--with-readline was given, but test for readline failed])
+                      fi],
+                      -lncurses)
+fi
 
 PKG_CHECK_MODULES([LIBUSB], [libusb-1.0])
 
 AC_CHECK_HEADERS(libelf.h libelf/libelf.h, [break])
 AC_CHECK_HEADERS(gelf.h libelf/gelf.h, [break])
 
-PKG_CHECK_MODULES([LIBSTLINK], [stlink], [HAVE_STLINK=yes], [HAVE_STLINK=no])
+AC_ARG_WITH([stlink],
+           [AS_HELP_STRING([--with-stlink],
+                           [Build tools that use the stlink library (default: auto)])],
+           [],
+           [with_stlink=auto])
+
+if test x"$with_stlink" != "xno"; then
+       PKG_CHECK_MODULES([STLINK], [stlink], [HAVE_STLINK=yes], [HAVE_STLINK=no])
+       if test x"$HAVE_STLINK" = "xno" -a x"$with_stlink" != "xauto"; then
+               AC_MSG_ERROR([--with-stlink was given, but stlink was not found])
+       fi
+else
+       HAVE_STLINK=no
+fi
+
+if test x"$HAVE_STLINK" = "xyes"; then
+       AC_DEFINE(HAVE_STLINK,1,[Using STlink library])
+fi
 
-AM_CONDITIONAL([LIBSTLINK], [test x$HAVE_STLINK != xno])
+AM_CONDITIONAL([LIBSTLINK], [test x$HAVE_STLINK == xyes])
 
 AC_OUTPUT([
 Makefile
@@ -384,6 +439,9 @@ ao-tools/ao-sky-flash/Makefile
 ao-tools/ao-dumpflash/Makefile
 ao-tools/ao-edit-telem/Makefile
 ao-tools/ao-dump-up/Makefile
+ao-tools/ao-elftohex/Makefile
+ao-tools/ao-usbload/Makefile
+ao-tools/ao-flash/Makefile
 ao-utils/Makefile
 src/Version
 ])