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.
21 AC_INIT([altos], 1.3.2.2)
22 AC_CONFIG_SRCDIR([src/kernel/ao.h])
23 AM_INIT_AUTOMAKE([foreign dist-bzip2])
26 VERSION_DASH=`echo $VERSION | sed 's/\./-/g'`
27 AC_SUBST(VERSION_DASH)
29 dnl ==========================================================================
30 dnl Java library versions
35 AC_SUBST(ALTOSLIB_VERSION)
36 AC_DEFINE(ALTOSLIB_VERSION,$ALTOSLIB_VERSION,[Version of the AltosLib package])
37 AC_SUBST(ALTOSUILIB_VERSION)
38 AC_DEFINE(ALTOSUILIB_VERSION,$ALTOSUILIB_VERSION,[Version of the AltosUILib package])
40 dnl ==========================================================================
42 AM_CONFIG_HEADER(config.h)
44 AC_ARG_WITH(freetts, AS_HELP_STRING([--with-freetts=PATH],
45 [Set freetts class path (default /usr/share/java)]),
46 [FREETTS=$withval], [FREETTS=/usr/share/java])
50 AC_ARG_WITH(jfreechart, AS_HELP_STRING([--with-jfreechart=PATH],
51 [Set jfreechart class path (default /usr/share/java)]),
52 [JFREECHART=$withval], [JFREECHART=/usr/share/java])
56 AC_ARG_WITH(jcommon, AS_HELP_STRING([--with-jcommon=PATH],
57 [Set jcommon class path (default /usr/share/java)]),
58 [JCOMMON=$withval], [JCOMMON=/usr/share/java])
62 AC_ARG_WITH(jvm, AS_HELP_STRING([--with-jvm-include=PATH],
63 [Set jvm include path for jni builds (default searches in /usr/lib/jvm)]),
64 [JVM_INCLUDE=$withval], [JVM_INCLUDE=auto])
66 if test "x$JVM_INCLUDE" = "xauto"; then
67 AC_MSG_CHECKING([JVM include files])
68 for jvm in default-java java-6-openjdk java-6-sun; do
69 if test "x$JVM_INCLUDE" = "xauto"; then
70 INCLUDE="/usr/lib/jvm/$jvm/include"
71 if test -f "$INCLUDE"/jni.h; then
72 JVM_INCLUDE="$INCLUDE"
76 if test "x$JVM_INCLUDE" = "xauto"; then
77 AC_MSG_ERROR([no JVM include files found])
79 AC_MSG_RESULT([$JVM_INCLUDE])
84 AC_ARG_WITH(android, AS_HELP_STRING([--with-android=PATH],
85 [Set android SDK path (default searches in a variety of places)]),
86 [ANDROID_SDK=$withval], [ANDROID_SDK=${ANDROID_SDK:-auto}])
88 if test "x$ANDROID_SDK" = "xauto"; then
89 AC_MSG_CHECKING([Android SDK])
90 for sdk in ../android/android-sdk-linux ../android/android-sdk ../android-sdk ../android-sdk-linux $HOME/android; do
91 if test "x$ANDROID_SDK" = "xauto"; then
93 if test -f "$SDK/SDK Readme.txt"; then
94 ANDROID_SDK=`readlink -m "$SDK"`
98 if test "x$ANDROID_SDK" = "xauto"; then
99 AC_MSG_NOTICE([no Android SDK found])
102 AC_MSG_RESULT([$ANDROID_SDK])
104 if test "x$ANDROID_SDK" != "xno"; then
105 AC_MSG_CHECKING([Android SDK version])
106 SDK_VERSION=`grep -i '^Pkg.Revision=' $ANDROID_SDK/tools/source.properties | cut -f2- -d= | sed s/^r//`
107 SDK_MAJOR_VERSION="`echo $SDK_VERSION | sed 's/[[^0-9]].*//'`"
108 if test "$SDK_MAJOR_VERSION" -lt 17 ; then
109 AC_MSG_NOTICE([SDK version $SDK_VERSION is too old. Need >= r17])
112 AC_MSG_RESULT([$SDK_VERSION])
115 if test "x$ANDROID_SDK" != "xno"; then
116 AC_MSG_CHECKING([Android SDK API Level])
117 if test -f "$ANDROID_SDK/platforms/android-10/source.properties"; then
118 API_LEVEL=`sed -ne 's/^AndroidVersion.ApiLevel=//p' $ANDROID_SDK/platforms/android-10/source.properties`
119 if test "$API_LEVEL" = "10"; then
120 AC_MSG_RESULT([$API_LEVEL])
122 AC_MSG_NOTICE([API Level 10 not installed correctly.])
126 AC_MSG_NOTICE([API Level 10 not installed, but is required.])
130 if test "x$ANDROID_SDK" != "xno"; then
131 AC_MSG_CHECKING([Android SDK required extras])
132 if test -f "$ANDROID_SDK/extras/android/support/source.properties"; then
133 ANDROID_SUPPORT_LIB_NAME=`sed -ne 's/^Extra.NameDisplay=//p' $ANDROID_SDK/extras/android/support/source.properties`
134 if test -f "$ANDROID_SDK/extras/google/google_play_services/source.properties"; then
135 GOOGLE_PLAY_SERVICES_NAME=`sed -ne 's/^Extra.NameDisplay=//p' $ANDROID_SDK/extras/google/google_play_services/source.properties`
136 AC_MSG_RESULT([$ANDROID_SUPPORT_LIB_NAME, $GOOGLE_PLAY_SERVICES_NAME])
138 AC_MSG_NOTICE([Google Play Services library not installed.])
142 AC_MSG_NOTICE([Android Support Library not installed.])
147 if test "x$ANDROID_SDK" != "xno"; then
148 HAVE_ANDROID_SDK="yes"
150 HAVE_ANDROID_SDK="no"
153 AM_CONDITIONAL([ANDROID], [test x$ANDROID_SDK != xno])
155 AC_SUBST(ANDROID_SDK)
157 AC_ARG_WITH(fat-dir, AS_HELP_STRING([--with-fat-dir=PATH],
158 [Set the directory to install the 'fat' distribution files to (defaults to not installing)]),
159 [FATDIR=$withval], [FATDIR=none])
161 AM_CONDITIONAL(FATINSTALL, [test "x$FATDIR" != "xnone"])
165 AC_ARG_WITH(google-key, AS_HELP_STRING([--with-google-key=PATH],
166 [Set the file to read the google maps API key from (defaults to ~/altusmetrumllc/google-maps-api-key)]),
167 [GOOGLEKEYFILE=$withval], [GOOGLEKEYFILE=$HOME/altusmetrumllc/google-maps-api-key])
169 if test -r "$GOOGLEKEYFILE" -a -s "$GOOGLEKEYFILE"; then
170 GOOGLEKEY='"'`cat "$GOOGLEKEYFILE"`'"'
171 HAVE_GOOGLE_KEY="yes"
187 if test "x$GCC" = "xyes"; then
188 WARN_CFLAGS="-Wall -Wpointer-arith -Wstrict-prototypes \
189 -Wmissing-prototypes -Wmissing-declarations \
190 -Wnested-externs -fno-strict-aliasing"
191 AC_DEFINE_UNQUOTED(HAVE_WARNING_CPP_DIRECTIVE,1,
192 [Can use #warning in C files])
194 AC_SUBST(WARN_CFLAGS)
201 [AS_HELP_STRING([--with-sdcc],
206 if test "x$with_sdcc" != "xno"; then
207 if test "x$with_sdcc" = "xauto"; then
209 AC_CHECK_PROG([HAVE_SDCC],[$with_sdcc], yes, no)
217 if test "x$HAVE_SDCC" = "xno"; then
218 AC_MSG_WARN([SDCC not found, cc1111 binaries will not be built])
227 # Configure ARM compiler for STM32L and LPC11U14
230 AC_ARG_WITH([arm-cc],
231 [AS_HELP_STRING([--with-arm-cc],
232 [Name of ARM C compiler])],
236 if test "x$with_arm_cc" != "xno"; then
237 if test "x$with_arm_cc" = "xauto"; then
238 with_arm_cc="arm-none-eabi-gcc"
239 AC_CHECK_PROG([HAVE_ARM_CC],[$with_arm_cc], yes, no)
247 if test "x$HAVE_ARM_CC" = "xno"; then
248 AC_MSG_WARN([Arm compiler not found, ARM binaries will not be built])
252 AC_SUBST(HAVE_ARM_CC)
255 if test -d pdclib -a x"$HAVE_ARM_CC" = xyes; then
256 PDCLIB_ROOT='$(TOPDIR)/../pdclib-root'
257 PDCLIB_INCLUDES='-I$(TOPDIR)/../pdclib-root/include'
258 PDCLIB_LIBS_M0='-L$(TOPDIR)/../pdclib-root/lib -lpdclib-cortex-m0'
259 PDCLIB_LIBS_M3='-L$(TOPDIR)/../pdclib-root/lib -lpdclib-cortex-m3'
263 PDCLIB_LIBS_M0='-lpdclib-cortex-m0'
264 PDCLIB_LIBS_M3='-lpdclib-cortex-m3'
268 AM_CONDITIONAL(PDCLIB, [test x$HAVE_PDCLIB = xyes])
270 AC_SUBST(PDCLIB_INCLUDES)
271 AC_SUBST(PDCLIB_LIBS_M0)
272 AC_SUBST(PDCLIB_LIBS_M3)
273 AC_SUBST(PDCLIB_ROOT)
274 AC_SUBST(HAVE_PDCLIB)
276 if test "x$HAVE_ARM_CC" = "xyes"; then
278 save_CFLAGS="$CFLAGS"
281 CFLAGS="-mthumb -mcpu=cortex-m0"
282 LIBS="-ffreestanding -nostdlib"
285 AC_MSG_CHECKING([if ]$ARM_CC[ supports cortex-m0])
286 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([int i;])],
287 [HAVE_ARM_M0_CC=yes],
289 AC_MSG_RESULT([$HAVE_ARM_M0_CC])
291 CFLAGS="-mthumb -mcpu=cortex-m3"
292 AC_MSG_CHECKING([if ]$ARM_CC[ supports cortex-m3])
293 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([int i;])],
294 [HAVE_ARM_M3_CC=yes],
296 AC_MSG_RESULT([$HAVE_ARM_M3_CC])
298 if test x$HAVE_PDCLIB != xyes; then
299 AC_CHECK_LIB(pdclib-cortex-m0,memcpy,
303 AC_CHECK_LIB(pdclib-cortex-m3,memcpy,
310 CFLAGS="$save_CFLAGS"
316 AC_SUBST(HAVE_ARM_M3_CC)
317 AC_SUBST(HAVE_ARM_M0_CC)
319 if test "x$HAVE_ARM_M3_CC" = "xno"; then
320 AC_MSG_WARN([No cortex-m3 arm compiler found, STM32L binaries will not be built])
323 if test "x$HAVE_ARM_M0_CC" = "xno"; then
324 AC_MSG_WARN([No cortex-m0 arm compiler found, LPC11U14 binaries will not be built])
328 # Configure AVR compiler
331 AC_ARG_WITH([avr-cc],
332 [AS_HELP_STRING([--with-avr-cc],
333 [Name of AVR C compiler])],
337 if test "x$with_avr_cc" != "xno"; then
338 if test "x$with_avr_cc" = "xauto"; then
339 with_avr_cc="avr-gcc"
340 AC_CHECK_PROG([HAVE_AVR_CC],[$with_avr_cc], yes, no)
348 AC_ARG_WITH([avr-objcopy],
349 [AS_HELP_STRING([--with-avr-objcopy],
350 [Name of AVR objcopy])],
352 [with_avr_objcopy=auto])
354 if test "x$with_avr_objcopy" != "xno"; then
355 if test "x$with_avr_objcopy" = "xauto"; then
356 with_avr_objcopy="avr-objcopy"
357 AC_CHECK_PROG([HAVE_AVR_OBJCOPY],[$with_avr_objcopy], yes, no)
365 if test "x$HAVE_AVR_CC" = "xno" -o "x$HAVE_AVR_OBJCOPY" = "xno"; then
366 AC_MSG_WARN([AVR compiler and objcopy not found, atmel binaries will not be built])
370 save_CFLAGS="$CFLAGS"
374 CFLAGS="-mmcu=attiny85"
376 AC_MSG_CHECKING([if ]$with_avr_cc[ can link programs])
377 AC_LINK_IFELSE([AC_LANG_PROGRAM([])],
380 AC_MSG_RESULT([$AVR_LINK])
384 CFLAGS="$save_CFLAGS"
387 if test "x$AVR_LINK" = xyes; then
389 AVR_OBJCOPY=$with_avr_objcopy
396 AC_SUBST(AVR_OBJCOPY)
397 AC_SUBST(HAVE_AVR_CC)
399 AC_CHECK_PROG([HAVE_NICKLE], [nickle], yes, no)
400 if test "x$HAVE_NICKLE" = "xno"; then
401 AC_MSG_ERROR([Please install nickle to build AltOs])
404 AC_ARG_WITH([readline],
405 [AS_HELP_STRING([--with-readline],
406 [enable readline functionality in ao-dbg @<:@default=auto@:>@])],
408 [with_readline=auto])
412 if test x"$with_readline" != "xno"; then
413 AC_CHECK_LIB([readline], [main],
414 [AC_SUBST([LIBREADLINE], ["-lreadline -lncurses"])
415 AC_DEFINE([HAVE_LIBREADLINE], [1],
416 [Define if you have libreadline])],
417 [if test "x$with_readline" != xauto; then
418 AC_MSG_ERROR([--with-readline was given, but test for readline failed])
423 PKG_CHECK_MODULES([LIBUSB], [libusb-1.0])
425 AC_CHECK_HEADERS(libelf.h libelf/libelf.h, [break])
426 AC_CHECK_HEADERS(gelf.h libelf/gelf.h, [break])
428 AC_ARG_WITH([stlink],
429 [AS_HELP_STRING([--with-stlink],
430 [Build tools that use the stlink library (default: auto)])],
434 if test x"$with_stlink" != "xno"; then
435 PKG_CHECK_MODULES([STLINK], [stlink], [HAVE_STLINK=yes], [HAVE_STLINK=no])
436 if test x"$HAVE_STLINK" = "xno" -a x"$with_stlink" != "xauto"; then
437 AC_MSG_ERROR([--with-stlink was given, but stlink was not found])
443 if test x"$HAVE_STLINK" = "xyes"; then
444 AC_DEFINE(HAVE_STLINK,1,[Using STlink library])
447 AM_CONDITIONAL([LIBSTLINK], [test x$HAVE_STLINK = xyes])
449 AC_ARG_ENABLE([multi-arch],
450 [AS_HELP_STRING([--enable-multi-arch],
451 [enable building both i386 and amd64 libraries (default=auto)])],
452 [MULTI_ARCH=$enableval],
455 case x"$MULTI_ARCH" in
460 save_CFLAGS="$CFLAGS"
464 AC_MSG_CHECKING([if ]$CC[ ]$CFLAGS[ can link programs])
465 AC_LINK_IFELSE([AC_LANG_PROGRAM([])],
468 AC_MSG_RESULT([$M64_LINK])
470 AC_MSG_CHECKING([if ]$CC[ ]$CFLAGS[ can link programs])
471 AC_LINK_IFELSE([AC_LANG_PROGRAM([])],
474 AC_MSG_RESULT([$M32_LINK])
475 CFLAGS="$save_CFLAGS"
477 case x"$M64_LINK"x"$M32_LINK" in
498 AM_CONDITIONAL([MULTI_ARCH], [test x$MULTI_ARCH = xyes])
506 altosuilib/AltosUIVersion.java
509 altosui/altos-windows.nsi
513 micropeak/micropeak-windows.nsi
516 telegps/telegps-windows.nsi
518 altosdroid/local.properties
520 ao-tools/lib/Makefile
521 ao-tools/ao-rawload/Makefile
522 ao-tools/ao-dbg/Makefile
523 ao-tools/ao-bitbang/Makefile
524 ao-tools/ao-eeprom/Makefile
525 ao-tools/ao-list/Makefile
526 ao-tools/ao-load/Makefile
527 ao-tools/ao-telem/Makefile
528 ao-tools/ao-stmload/Makefile
529 ao-tools/ao-send-telem/Makefile
530 ao-tools/ao-sky-flash/Makefile
531 ao-tools/ao-dumpflash/Makefile
532 ao-tools/ao-edit-telem/Makefile
533 ao-tools/ao-dump-up/Makefile
534 ao-tools/ao-elftohex/Makefile
535 ao-tools/ao-usbload/Makefile
536 ao-tools/ao-flash/Makefile
542 echo " Package: ${PACKAGE_NAME} ${PACKAGE_VERSION}"
544 echo " Configuration"
545 echo " Arm compiler................: ${ARM_CC}"
546 echo " STM32L support..............: ${HAVE_ARM_M3_CC}"
547 echo " LPC11U14 support............: ${HAVE_ARM_M0_CC}"
548 echo " SDCC........................: ${SDCC}"
549 echo " CC1111 support..............: ${HAVE_SDCC}"
550 echo " AVR compiler................: ${AVR_CC} ${AVR_OBJCOPY}"
551 echo " AVR support.................: ${HAVE_AVR_CC}"
552 echo " Android support.............: ${HAVE_ANDROID_SDK}"
553 echo " STlink support..............: ${HAVE_STLINK}"
554 echo " Local pdclib................: ${HAVE_PDCLIB}"
555 echo " i386 and amd64 libaltos.....: ${MULTI_ARCH}"
558 echo " freetts.....................: ${FREETTS}"
559 echo " jfreechart..................: ${JFREECHART}"
560 echo " jcommon.....................: ${JCOMMON}"
561 echo " JVM include.................: ${JVM_INCLUDE}"
562 echo " Google maps API key.........: ${HAVE_GOOGLE_KEY}"
563 if test x${ANDROID_SDK} != "xno"; then
566 echo " Android SDK.................: ${ANDROID_SDK}"