2 dnl Copyright © 2008,2009 Keith Packard <keithp@keithp.com>
4 dnl This program is free software; you can redistribute it and/or modify
5 dnl it under the terms of the GNU General Public License as published by
6 dnl the Free Software Foundation; either version 2 of the License, or
7 dnl (at your option) any later version.
9 dnl This program is distributed in the hope that it will be useful, but
10 dnl WITHOUT ANY WARRANTY; without even the implied warranty of
11 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 dnl General Public License for more details.
14 dnl You should have received a copy of the GNU General Public License along
15 dnl with this program; if not, write to the Free Software Foundation, Inc.,
16 dnl 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
18 dnl Process this file with autoconf to create configure.
22 AC_INIT([altos], 1.2.1)
26 AC_CONFIG_SRCDIR([src/core/ao.h])
27 AM_INIT_AUTOMAKE([foreign dist-bzip2])
30 VERSION_DASH=`echo $VERSION | sed 's/\./-/g'`
31 AC_SUBST(VERSION_DASH)
33 dnl ==========================================================================
34 dnl Java library versions
39 AC_SUBST(ALTOSLIB_VERSION)
40 AC_DEFINE(ALTOSLIB_VERSION,$ALTOSLIB_VERSION,[Version of the AltosLib package])
41 AC_SUBST(ALTOSUILIB_VERSION)
42 AC_DEFINE(ALTOSUILIB_VERSION,$ALTOSUILIB_VERSION,[Version of the AltosUILib package])
44 dnl ==========================================================================
46 AM_CONFIG_HEADER(config.h)
48 AC_ARG_WITH(freetts, AS_HELP_STRING([--with-freetts=PATH],
49 [Set freetts class path (default /usr/share/java)]),
50 [FREETTS=$withval], [FREETTS=/usr/share/java])
54 AC_ARG_WITH(jfreechart, AS_HELP_STRING([--with-jfreechart=PATH],
55 [Set jfreechart class path (default /usr/share/java)]),
56 [JFREECHART=$withval], [JFREECHART=/usr/share/java])
60 AC_ARG_WITH(jcommon, AS_HELP_STRING([--with-jcommon=PATH],
61 [Set jcommon class path (default /usr/share/java)]),
62 [JCOMMON=$withval], [JCOMMON=/usr/share/java])
66 AC_ARG_WITH(jvm, AS_HELP_STRING([--with-jvm-include=PATH],
67 [Set jvm include path for jni builds (default searches in /usr/lib/jvm)]),
68 [JVM_INCLUDE=$withval], [JVM_INCLUDE=auto])
70 if test "x$JVM_INCLUDE" = "xauto"; then
71 AC_MSG_CHECKING([JVM include files])
72 for jvm in default-java java-6-openjdk java-6-sun; do
73 if test "x$JVM_INCLUDE" = "xauto"; then
74 INCLUDE="/usr/lib/jvm/$jvm/include"
75 if test -f "$INCLUDE"/jni.h; then
76 JVM_INCLUDE="$INCLUDE"
80 if test "x$JVM_INCLUDE" = "xauto"; then
81 AC_MSG_ERROR([no JVM include files found])
83 AC_MSG_RESULT([$JVM_INCLUDE])
88 AC_ARG_WITH(android, AS_HELP_STRING([--with-android=PATH],
89 [Set android SDK path (default searches in a variety of places)]),
90 [ANDROID_SDK=$withval], [ANDROID_SDK=${ANDROID_SDK:-auto}])
92 if test "x$ANDROID_SDK" = "xauto"; then
93 AC_MSG_CHECKING([Android SDK])
94 for sdk in ../android/android-sdk-linux ../android/android-sdk ../android-sdk ../android-sdk-linux $HOME/android; do
95 if test "x$ANDROID_SDK" = "xauto"; then
97 if test -f "$SDK/SDK Readme.txt"; then
98 ANDROID_SDK=`readlink -m "$SDK"`
102 if test "x$ANDROID_SDK" = "xauto"; then
103 AC_MSG_NOTICE([no Android SDK found])
106 AC_MSG_RESULT([$ANDROID_SDK])
108 if test "x$ANDROID_SDK" != "xno"; then
109 AC_MSG_CHECKING([Android SDK version])
110 SDK_VERSION=`grep -i '^Pkg.Revision=' $ANDROID_SDK/tools/source.properties | cut -f2- -d= | sed s/^r//`
111 SDK_MAJOR_VERSION="`echo $SDK_VERSION | sed 's/[[^0-9]].*//'`"
112 if test "$SDK_MAJOR_VERSION" -lt 17 ; then
113 AC_MSG_NOTICE([SDK version $SDK_VERSION is too old. Need >= r17])
116 AC_MSG_RESULT([$SDK_VERSION])
119 if test "x$ANDROID_SDK" != "xno"; then
120 AC_MSG_CHECKING([Android SDK API Level])
121 if test -f "$ANDROID_SDK/platforms/android-10/source.properties"; then
122 API_LEVEL=`sed -ne 's/^AndroidVersion.ApiLevel=//p' $ANDROID_SDK/platforms/android-10/source.properties`
123 if test "$API_LEVEL" = "10"; then
124 AC_MSG_RESULT([$API_LEVEL])
126 AC_MSG_NOTICE([API Level 10 not installed correctly.])
130 AC_MSG_NOTICE([API Level 10 not installed, but is required.])
134 if test "x$ANDROID_SDK" != "xno"; then
135 AC_MSG_CHECKING([Android SDK required extras])
136 if test -f "$ANDROID_SDK/extras/android/support/source.properties"; then
137 ANDROID_SUPPORT_LIB_NAME=`sed -ne 's/^Extra.NameDisplay=//p' $ANDROID_SDK/extras/android/support/source.properties`
138 if test -f "$ANDROID_SDK/extras/google/google_play_services/source.properties"; then
139 GOOGLE_PLAY_SERVICES_NAME=`sed -ne 's/^Extra.NameDisplay=//p' $ANDROID_SDK/extras/google/google_play_services/source.properties`
140 AC_MSG_RESULT([$ANDROID_SUPPORT_LIB_NAME, $GOOGLE_PLAY_SERVICES_NAME])
142 AC_MSG_NOTICE([Google Play Services library not installed.])
146 AC_MSG_NOTICE([Android Support Library not installed.])
151 if test "x$ANDROID_SDK" != "xno"; then
152 HAVE_ANDROID_SDK="yes"
154 HAVE_ANDROID_SDK="no"
157 AM_CONDITIONAL([ANDROID], [test x$ANDROID_SDK != xno])
159 AC_SUBST(ANDROID_SDK)
161 AC_ARG_WITH(fat-dir, AS_HELP_STRING([--with-fat-dir=PATH],
162 [Set the directory to install the 'fat' distribution files to (defaults to not installing)]),
163 [FATDIR=$withval], [FATDIR=none])
165 AM_CONDITIONAL(FATINSTALL, [test "x$FATDIR" != "xnone"])
177 if test "x$GCC" = "xyes"; then
178 WARN_CFLAGS="-Wall -Wpointer-arith -Wstrict-prototypes \
179 -Wmissing-prototypes -Wmissing-declarations \
180 -Wnested-externs -fno-strict-aliasing"
181 AC_DEFINE_UNQUOTED(HAVE_WARNING_CPP_DIRECTIVE,1,
182 [Can use #warning in C files])
184 AC_SUBST(WARN_CFLAGS)
191 [AS_HELP_STRING([--with-sdcc],
196 if test "x$with_sdcc" != "xno"; then
197 if test "x$with_sdcc" = "xauto"; then
199 AC_CHECK_PROG([HAVE_SDCC],[$with_sdcc], yes, no)
207 if test "x$HAVE_SDCC" = "xno"; then
208 AC_MSG_WARN([SDCC not found, cc1111 binaries will not be built])
217 # Configure ARM compiler for STM32L and LPC11U14
220 AC_ARG_WITH([arm-cc],
221 [AS_HELP_STRING([--with-arm-cc],
222 [Name of ARM C compiler])],
226 if test "x$with_arm_cc" != "xno"; then
227 if test "x$with_arm_cc" = "xauto"; then
228 with_arm_cc="arm-none-eabi-gcc"
229 AC_CHECK_PROG([HAVE_ARM_CC],[$with_arm_cc], yes, no)
237 if test "x$HAVE_ARM_CC" = "xno"; then
238 AC_MSG_WARN([Arm compiler not found, ARM binaries will not be built])
242 AC_SUBST(HAVE_ARM_CC)
245 if test -d pdclib -a x"$HAVE_ARM_CC" = xyes; then
246 PDCLIB_ROOT='$(TOPDIR)/../pdclib-root'
247 PDCLIB_INCLUDES='-I$(TOPDIR)/../pdclib-root/include'
248 PDCLIB_LIBS_M0='-L$(TOPDIR)/../pdclib-root/lib -lpdclib-cortex-m0'
249 PDCLIB_LIBS_M3='-L$(TOPDIR)/../pdclib-root/lib -lpdclib-cortex-m3'
253 PDCLIB_LIBS_M0='-lpdclib-cortex-m0'
254 PDCLIB_LIBS_M3='-lpdclib-cortex-m3'
258 AM_CONDITIONAL(PDCLIB, [test x$HAVE_PDCLIB = xyes])
260 AC_SUBST(PDCLIB_INCLUDES)
261 AC_SUBST(PDCLIB_LIBS_M0)
262 AC_SUBST(PDCLIB_LIBS_M3)
263 AC_SUBST(PDCLIB_ROOT)
264 AC_SUBST(HAVE_PDCLIB)
266 if test "x$HAVE_ARM_CC" = "xyes"; then
268 save_CFLAGS="$CFLAGS"
271 CFLAGS="-mthumb -mcpu=cortex-m0"
272 LIBS="-ffreestanding -nostdlib"
275 AC_MSG_CHECKING([if ]$ARM_CC[ supports cortex-m0])
276 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([int i;])],
277 [HAVE_ARM_M0_CC=yes],
279 AC_MSG_RESULT([$HAVE_ARM_M0_CC])
281 CFLAGS="-mthumb -mcpu=cortex-m3"
282 AC_MSG_CHECKING([if ]$ARM_CC[ supports cortex-m3])
283 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([int i;])],
284 [HAVE_ARM_M3_CC=yes],
286 AC_MSG_RESULT([$HAVE_ARM_M3_CC])
288 if test x$HAVE_PDCLIB != xyes; then
289 AC_CHECK_LIB(pdclib-cortex-m0,memcpy,
293 AC_CHECK_LIB(pdclib-cortex-m3,memcpy,
300 CFLAGS="$save_CFLAGS"
306 AC_SUBST(HAVE_ARM_M3_CC)
307 AC_SUBST(HAVE_ARM_M0_CC)
309 if test "x$HAVE_ARM_M3_CC" = "xno"; then
310 AC_MSG_WARN([No cortex-m3 arm compiler found, STM32L binaries will not be built])
313 if test "x$HAVE_ARM_M0_CC" = "xno"; then
314 AC_MSG_WARN([No cortex-m0 arm compiler found, LPC11U14 binaries will not be built])
318 # Configure AVR compiler
321 AC_ARG_WITH([avr-cc],
322 [AS_HELP_STRING([--with-avr-cc],
323 [Name of AVR C compiler])],
327 if test "x$with_avr_cc" != "xno"; then
328 if test "x$with_avr_cc" = "xauto"; then
329 with_avr_cc="avr-gcc"
330 AC_CHECK_PROG([HAVE_AVR_CC],[$with_avr_cc], yes, no)
338 AC_ARG_WITH([avr-objcopy],
339 [AS_HELP_STRING([--with-avr-objcopy],
340 [Name of AVR objcopy])],
342 [with_avr_objcopy=auto])
344 if test "x$with_avr_objcopy" != "xno"; then
345 if test "x$with_avr_objcopy" = "xauto"; then
346 with_avr_objcopy="avr-objcopy"
347 AC_CHECK_PROG([HAVE_AVR_OBJCOPY],[$with_avr_objcopy], yes, no)
355 if test "x$HAVE_AVR_CC" = "xno" -o "x$HAVE_AVR_OBJCOPY" = "xno"; then
356 AC_MSG_WARN([AVR compiler and objcopy not found, atmel binaries will not be built])
360 save_CFLAGS="$CFLAGS"
364 CFLAGS="-mmcu=attiny85"
366 AC_MSG_CHECKING([if ]$with_avr_cc[ can link programs])
367 AC_LINK_IFELSE([AC_LANG_PROGRAM([])],
370 AC_MSG_RESULT([$AVR_LINK])
374 CFLAGS="$save_CFLAGS"
377 if test "x$AVR_LINK" = xyes; then
379 AVR_OBJCOPY=$with_avr_objcopy
386 AC_SUBST(AVR_OBJCOPY)
387 AC_SUBST(HAVE_AVR_CC)
389 AC_CHECK_PROG([HAVE_NICKLE], [nickle], yes, no)
390 if test "x$HAVE_NICKLE" = "xno"; then
391 AC_MSG_ERROR([Please install nickle to build AltOs])
394 AC_ARG_WITH([readline],
395 [AS_HELP_STRING([--with-readline],
396 [enable readline functionality in ao-dbg @<:@default=auto@:>@])],
398 [with_readline=auto])
402 if test x"$with_readline" != "xno"; then
403 AC_CHECK_LIB([readline], [main],
404 [AC_SUBST([LIBREADLINE], ["-lreadline -lncurses"])
405 AC_DEFINE([HAVE_LIBREADLINE], [1],
406 [Define if you have libreadline])],
407 [if test "x$with_readline" != xauto; then
408 AC_MSG_ERROR([--with-readline was given, but test for readline failed])
413 PKG_CHECK_MODULES([LIBUSB], [libusb-1.0])
415 AC_CHECK_HEADERS(libelf.h libelf/libelf.h, [break])
416 AC_CHECK_HEADERS(gelf.h libelf/gelf.h, [break])
418 AC_ARG_WITH([stlink],
419 [AS_HELP_STRING([--with-stlink],
420 [Build tools that use the stlink library (default: auto)])],
424 if test x"$with_stlink" != "xno"; then
425 PKG_CHECK_MODULES([STLINK], [stlink], [HAVE_STLINK=yes], [HAVE_STLINK=no])
426 if test x"$HAVE_STLINK" = "xno" -a x"$with_stlink" != "xauto"; then
427 AC_MSG_ERROR([--with-stlink was given, but stlink was not found])
433 if test x"$HAVE_STLINK" = "xyes"; then
434 AC_DEFINE(HAVE_STLINK,1,[Using STlink library])
437 AM_CONDITIONAL([LIBSTLINK], [test x$HAVE_STLINK == xyes])
444 altosuilib/AltosUIVersion.java
447 altosui/altos-windows.nsi
451 micropeak/micropeak-windows.nsi
453 altosdroid/local.properties
455 ao-tools/lib/Makefile
456 ao-tools/ao-rawload/Makefile
457 ao-tools/ao-dbg/Makefile
458 ao-tools/ao-bitbang/Makefile
459 ao-tools/ao-eeprom/Makefile
460 ao-tools/ao-list/Makefile
461 ao-tools/ao-load/Makefile
462 ao-tools/ao-telem/Makefile
463 ao-tools/ao-stmload/Makefile
464 ao-tools/ao-send-telem/Makefile
465 ao-tools/ao-sky-flash/Makefile
466 ao-tools/ao-dumpflash/Makefile
467 ao-tools/ao-edit-telem/Makefile
468 ao-tools/ao-dump-up/Makefile
469 ao-tools/ao-elftohex/Makefile
470 ao-tools/ao-usbload/Makefile
471 ao-tools/ao-flash/Makefile
477 echo " Package: ${PACKAGE_NAME} ${PACKAGE_VERSION}"
479 echo " Configuration"
480 echo " Arm compiler................: ${ARM_CC}"
481 echo " STM32L support..............: ${HAVE_ARM_M3_CC}"
482 echo " LPC11U14 support............: ${HAVE_ARM_M0_CC}"
483 echo " SDCC........................: ${SDCC}"
484 echo " CC1111 support..............: ${HAVE_SDCC}"
485 echo " AVR compiler................: ${AVR_CC} ${AVR_OBJCOPY}"
486 echo " AVR support.................: ${HAVE_AVR_CC}"
487 echo " Android support.............: ${HAVE_ANDROID_SDK}"
488 echo " STlink support..............: ${HAVE_STLINK}"
489 echo " Local pdclib................: ${HAVE_PDCLIB}"
492 echo " freetts.....................: ${FREETTS}"
493 echo " jfreechart..................: ${JFREECHART}"
494 echo " jcommon.....................: ${JCOMMON}"
495 echo " JVM include.................: ${JVM_INCLUDE}"
496 if test x${ANDROID_SDK} != "xno"; then
499 echo " Android SDK.................: ${ANDROID_SDK}"