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.6.5)
23 AC_CONFIG_SRCDIR([src/kernel/ao.h])
24 AM_INIT_AUTOMAKE([foreign dist-bzip2])
27 VERSION_DASH=`echo $VERSION | sed 's/\./-/g'`
28 AC_SUBST(VERSION_DASH)
29 AC_SUBST(ANDROID_VERSION)
31 dnl ==========================================================================
32 dnl Java library versions
37 AC_SUBST(ALTOSLIB_VERSION)
38 AC_DEFINE(ALTOSLIB_VERSION,$ALTOSLIB_VERSION,[Version of the AltosLib package])
39 AC_SUBST(ALTOSUILIB_VERSION)
40 AC_DEFINE(ALTOSUILIB_VERSION,$ALTOSUILIB_VERSION,[Version of the AltosUILib package])
42 dnl ==========================================================================
44 AM_CONFIG_HEADER(config.h)
46 AC_ARG_WITH(freetts, AS_HELP_STRING([--with-freetts=PATH],
47 [Set freetts class path (default /usr/share/java)]),
48 [FREETTS=$withval], [FREETTS=/usr/share/java])
52 AC_ARG_WITH(jfreechart, AS_HELP_STRING([--with-jfreechart=PATH],
53 [Set jfreechart class path (default /usr/share/java)]),
54 [JFREECHART=$withval], [JFREECHART=/usr/share/java])
58 AC_ARG_WITH(jcommon, AS_HELP_STRING([--with-jcommon=PATH],
59 [Set jcommon class path (default /usr/share/java)]),
60 [JCOMMON=$withval], [JCOMMON=/usr/share/java])
64 AC_ARG_WITH(jvm, AS_HELP_STRING([--with-jvm-include=PATH],
65 [Set jvm include path for jni builds (default searches in /usr/lib/jvm)]),
66 [JVM_INCLUDE=$withval], [JVM_INCLUDE=auto])
68 if test "x$JVM_INCLUDE" = "xauto"; then
69 AC_MSG_CHECKING([JVM include files])
70 for jvm in default-java java-6-openjdk java-6-sun; do
71 if test "x$JVM_INCLUDE" = "xauto"; then
72 INCLUDE="/usr/lib/jvm/$jvm/include"
73 if test -f "$INCLUDE"/jni.h; then
74 JVM_INCLUDE="$INCLUDE"
78 if test "x$JVM_INCLUDE" = "xauto"; then
79 AC_MSG_ERROR([no JVM include files found])
81 AC_MSG_RESULT([$JVM_INCLUDE])
86 AC_ARG_WITH(android, AS_HELP_STRING([--with-android=PATH],
87 [Set android SDK path (default searches in a variety of places)]),
88 [ANDROID_SDK=$withval], [ANDROID_SDK=${ANDROID_SDK:-auto}])
90 if test "x$ANDROID_SDK" = "xauto"; then
91 AC_MSG_CHECKING([Android SDK])
92 for sdk in ../android/android-sdk-linux ../android/android-sdk ../android-sdk ../android-sdk-linux $HOME/android; do
93 if test "x$ANDROID_SDK" = "xauto"; then
95 if test -f "$SDK/SDK Readme.txt"; then
96 ANDROID_SDK=`readlink -m "$SDK"`
100 if test "x$ANDROID_SDK" = "xauto"; then
101 AC_MSG_NOTICE([no Android SDK found])
104 AC_MSG_RESULT([$ANDROID_SDK])
106 if test "x$ANDROID_SDK" != "xno"; then
107 AC_MSG_CHECKING([Android SDK version])
108 SDK_VERSION=`grep -i '^Pkg.Revision=' $ANDROID_SDK/tools/source.properties | cut -f2- -d= | sed s/^r//`
109 SDK_MAJOR_VERSION="`echo $SDK_VERSION | sed 's/[[^0-9]].*//'`"
110 if test "$SDK_MAJOR_VERSION" -lt 17 ; then
111 AC_MSG_NOTICE([SDK version $SDK_VERSION is too old. Need >= r17])
114 AC_MSG_RESULT([$SDK_VERSION])
117 if test "x$ANDROID_SDK" != "xno"; then
118 AC_MSG_CHECKING([Android SDK API Level])
119 if test -f "$ANDROID_SDK/platforms/android-10/source.properties"; then
120 API_LEVEL=`sed -ne 's/^AndroidVersion.ApiLevel=//p' $ANDROID_SDK/platforms/android-10/source.properties`
121 if test "$API_LEVEL" = "10"; then
122 AC_MSG_RESULT([$API_LEVEL])
124 AC_MSG_NOTICE([API Level 10 not installed correctly.])
128 AC_MSG_NOTICE([API Level 10 not installed, but is required.])
132 if test "x$ANDROID_SDK" != "xno"; then
133 AC_MSG_CHECKING([Android SDK required extras])
134 if test -f "$ANDROID_SDK/extras/android/support/source.properties"; then
135 ANDROID_SUPPORT_LIB_NAME=`sed -ne 's/^Extra.NameDisplay=//p' $ANDROID_SDK/extras/android/support/source.properties`
136 if test -f "$ANDROID_SDK/extras/google/google_play_services/source.properties"; then
137 GOOGLE_PLAY_SERVICES_NAME=`sed -ne 's/^Extra.NameDisplay=//p' $ANDROID_SDK/extras/google/google_play_services/source.properties`
138 AC_MSG_RESULT([$ANDROID_SUPPORT_LIB_NAME, $GOOGLE_PLAY_SERVICES_NAME])
140 AC_MSG_NOTICE([Google Play Services library not installed.])
144 AC_MSG_NOTICE([Android Support Library not installed.])
150 if test "x$ANDROID_SDK" != "xno"; then
151 HAVE_ANDROID_SDK="yes"
152 if test -f "$HOME/altusmetrumllc/google-play-release.keystore" -a -f "$HOME/altusmetrumllc/google-play-passphrase"; then
156 HAVE_ANDROID_SDK="no"
159 AM_CONDITIONAL([ANDROID], [test x$ANDROID_SDK != xno])
160 AM_CONDITIONAL([ANDROID_RELEASE], [test x$ANDROID_RELEASE = xyes])
162 AC_SUBST(ANDROID_SDK)
164 AC_ARG_WITH(fat-dir, AS_HELP_STRING([--with-fat-dir=PATH],
165 [Set the directory to install the 'fat' distribution files to (defaults to not installing)]),
166 [FATDIR=$withval], [FATDIR=none])
168 AM_CONDITIONAL(FATINSTALL, [test "x$FATDIR" != "xnone"])
172 AC_ARG_WITH(google-key, AS_HELP_STRING([--with-google-key=PATH],
173 [Set the file to read the google maps API key from (defaults to ~/altusmetrumllc/google-maps-api-key)]),
174 [GOOGLEKEYFILE=$withval], [GOOGLEKEYFILE=$HOME/altusmetrumllc/google-maps-api-key])
176 if test -r "$GOOGLEKEYFILE" -a -s "$GOOGLEKEYFILE"; then
177 GOOGLEKEY=`cat "$GOOGLEKEYFILE"`
178 HAVE_GOOGLE_KEY="yes"
194 if test "x$GCC" = "xyes"; then
195 WARN_CFLAGS="-Wall -Wpointer-arith -Wstrict-prototypes \
196 -Wmissing-prototypes -Wmissing-declarations \
197 -Wnested-externs -fno-strict-aliasing"
198 AC_DEFINE_UNQUOTED(HAVE_WARNING_CPP_DIRECTIVE,1,
199 [Can use #warning in C files])
201 AC_SUBST(WARN_CFLAGS)
208 [AS_HELP_STRING([--with-sdcc],
213 if test "x$with_sdcc" != "xno"; then
214 if test "x$with_sdcc" = "xauto"; then
216 AC_CHECK_PROG([HAVE_SDCC],[$with_sdcc], yes, no)
224 if test "x$HAVE_SDCC" = "xno"; then
225 AC_MSG_WARN([SDCC not found, cc1111 binaries will not be built])
234 # Configure ARM compiler for STM32L and LPC11U14
237 AC_ARG_WITH([arm-cc],
238 [AS_HELP_STRING([--with-arm-cc],
239 [Name of ARM C compiler])],
243 if test "x$with_arm_cc" != "xno"; then
244 if test "x$with_arm_cc" = "xauto"; then
245 with_arm_cc="arm-none-eabi-gcc"
246 AC_CHECK_PROG([HAVE_ARM_CC],[$with_arm_cc], yes, no)
254 if test "x$HAVE_ARM_CC" = "xno"; then
255 AC_MSG_WARN([Arm compiler not found, ARM binaries will not be built])
259 AC_SUBST(HAVE_ARM_CC)
262 if test -d pdclib -a x"$HAVE_ARM_CC" = xyes; then
263 PDCLIB_ROOT='$(TOPDIR)/../pdclib-root'
264 PDCLIB_INCLUDES='-I$(TOPDIR)/../pdclib-root/include'
265 PDCLIB_LIBS_M0='-L$(TOPDIR)/../pdclib-root/lib -lpdclib-cortex-m0'
266 PDCLIB_LIBS_M3='-L$(TOPDIR)/../pdclib-root/lib -lpdclib-cortex-m3'
270 PDCLIB_LIBS_M0='-lpdclib-cortex-m0'
271 PDCLIB_LIBS_M3='-lpdclib-cortex-m3'
275 AM_CONDITIONAL(PDCLIB, [test x$HAVE_PDCLIB = xyes])
277 AC_SUBST(PDCLIB_INCLUDES)
278 AC_SUBST(PDCLIB_LIBS_M0)
279 AC_SUBST(PDCLIB_LIBS_M3)
280 AC_SUBST(PDCLIB_ROOT)
281 AC_SUBST(HAVE_PDCLIB)
283 if test "x$HAVE_ARM_CC" = "xyes"; then
285 save_CFLAGS="$CFLAGS"
288 CFLAGS="-mthumb -mcpu=cortex-m0"
289 LIBS="-ffreestanding -nostdlib"
292 AC_MSG_CHECKING([if ]$ARM_CC[ supports cortex-m0])
293 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([int i;])],
294 [HAVE_ARM_M0_CC=yes],
296 AC_MSG_RESULT([$HAVE_ARM_M0_CC])
298 CFLAGS="-mthumb -mcpu=cortex-m3"
299 AC_MSG_CHECKING([if ]$ARM_CC[ supports cortex-m3])
300 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([int i;])],
301 [HAVE_ARM_M3_CC=yes],
303 AC_MSG_RESULT([$HAVE_ARM_M3_CC])
305 if test x$HAVE_PDCLIB != xyes; then
306 AC_CHECK_LIB(pdclib-cortex-m0,memcpy,
310 AC_CHECK_LIB(pdclib-cortex-m3,memcpy,
317 CFLAGS="$save_CFLAGS"
323 AC_SUBST(HAVE_ARM_M3_CC)
324 AC_SUBST(HAVE_ARM_M0_CC)
326 if test "x$HAVE_ARM_M3_CC" = "xno"; then
327 AC_MSG_WARN([No cortex-m3 arm compiler found, STM32L binaries will not be built])
330 if test "x$HAVE_ARM_M0_CC" = "xno"; then
331 AC_MSG_WARN([No cortex-m0 arm compiler found, LPC11U14 binaries will not be built])
335 # Configure AVR compiler
338 AC_ARG_WITH([avr-cc],
339 [AS_HELP_STRING([--with-avr-cc],
340 [Name of AVR C compiler])],
344 if test "x$with_avr_cc" != "xno"; then
345 if test "x$with_avr_cc" = "xauto"; then
346 with_avr_cc="avr-gcc"
347 AC_CHECK_PROG([HAVE_AVR_CC],[$with_avr_cc], yes, no)
355 AC_ARG_WITH([avr-objcopy],
356 [AS_HELP_STRING([--with-avr-objcopy],
357 [Name of AVR objcopy])],
359 [with_avr_objcopy=auto])
361 if test "x$with_avr_objcopy" != "xno"; then
362 if test "x$with_avr_objcopy" = "xauto"; then
363 with_avr_objcopy="avr-objcopy"
364 AC_CHECK_PROG([HAVE_AVR_OBJCOPY],[$with_avr_objcopy], yes, no)
372 if test "x$HAVE_AVR_CC" = "xno" -o "x$HAVE_AVR_OBJCOPY" = "xno"; then
373 AC_MSG_WARN([AVR compiler and objcopy not found, atmel binaries will not be built])
377 save_CFLAGS="$CFLAGS"
381 CFLAGS="-mmcu=attiny85"
383 AC_MSG_CHECKING([if ]$with_avr_cc[ can link programs])
384 AC_LINK_IFELSE([AC_LANG_PROGRAM([])],
387 AC_MSG_RESULT([$AVR_LINK])
391 CFLAGS="$save_CFLAGS"
394 if test "x$AVR_LINK" = xyes; then
396 AVR_OBJCOPY=$with_avr_objcopy
403 AC_SUBST(AVR_OBJCOPY)
404 AC_SUBST(HAVE_AVR_CC)
406 AC_CHECK_PROG([HAVE_NICKLE], [nickle], yes, no)
407 if test "x$HAVE_NICKLE" = "xno"; then
408 AC_MSG_ERROR([Please install nickle to build AltOs])
411 AC_ARG_WITH([readline],
412 [AS_HELP_STRING([--with-readline],
413 [enable readline functionality in ao-dbg @<:@default=auto@:>@])],
415 [with_readline=auto])
419 if test x"$with_readline" != "xno"; then
420 AC_CHECK_LIB([readline], [main],
421 [AC_SUBST([LIBREADLINE], ["-lreadline -lncurses"])
422 AC_DEFINE([HAVE_LIBREADLINE], [1],
423 [Define if you have libreadline])],
424 [if test "x$with_readline" != xauto; then
425 AC_MSG_ERROR([--with-readline was given, but test for readline failed])
430 PKG_CHECK_MODULES([LIBUSB], [libusb-1.0])
432 AC_CHECK_HEADERS(libelf.h libelf/libelf.h, [break])
433 AC_CHECK_HEADERS(gelf.h libelf/gelf.h, [break])
435 AC_ARG_WITH([stlink],
436 [AS_HELP_STRING([--with-stlink],
437 [Build tools that use the stlink library (default: auto)])],
441 if test x"$with_stlink" != "xno"; then
442 PKG_CHECK_MODULES([STLINK], [stlink], [HAVE_STLINK=yes], [HAVE_STLINK=no])
443 if test x"$HAVE_STLINK" = "xno" -a x"$with_stlink" != "xauto"; then
444 AC_MSG_ERROR([--with-stlink was given, but stlink was not found])
450 if test x"$HAVE_STLINK" = "xyes"; then
451 AC_DEFINE(HAVE_STLINK,1,[Using STlink library])
454 AM_CONDITIONAL([LIBSTLINK], [test x$HAVE_STLINK = xyes])
456 AC_ARG_ENABLE([multi-arch],
457 [AS_HELP_STRING([--enable-multi-arch],
458 [enable building both i386 and amd64 libraries (default=auto)])],
459 [MULTI_ARCH=$enableval],
462 case x"$MULTI_ARCH" in
467 save_CFLAGS="$CFLAGS"
471 AC_MSG_CHECKING([if ]$CC[ ]$CFLAGS[ can link programs])
472 AC_LINK_IFELSE([AC_LANG_PROGRAM([])],
475 AC_MSG_RESULT([$M64_LINK])
477 AC_MSG_CHECKING([if ]$CC[ ]$CFLAGS[ can link programs])
478 AC_LINK_IFELSE([AC_LANG_PROGRAM([])],
481 AC_MSG_RESULT([$M32_LINK])
482 CFLAGS="$save_CFLAGS"
484 case x"$M64_LINK"x"$M32_LINK" in
505 AM_CONDITIONAL([MULTI_ARCH], [test x$MULTI_ARCH = xyes])
507 AC_ARG_ENABLE([install-shared-mime-info],
508 [AS_HELP_STRING([--disable-install-shared-mime-info],
509 [disable installing shared mime info files (default=yes)])],
510 [INSTALL_SHARED_MIME_INFO=$enableval],
511 [INSTALL_SHARED_MIME_INFO=yes])
513 AM_CONDITIONAL([INSTALL_SHARED_MIME_INFO], [test x$INSTALL_SHARED_MIME_INFO = xyes])
519 altoslib/AltosVersion.java
524 altosui/altos-windows.nsi
528 micropeak/micropeak-windows.nsi
531 telegps/telegps-windows.nsi
533 altosdroid/local.properties
534 altosdroid/AndroidManifest.xml
536 ao-tools/lib/Makefile
537 ao-tools/ao-rawload/Makefile
538 ao-tools/ao-dbg/Makefile
539 ao-tools/ao-bitbang/Makefile
540 ao-tools/ao-eeprom/Makefile
541 ao-tools/ao-list/Makefile
542 ao-tools/ao-load/Makefile
543 ao-tools/ao-telem/Makefile
544 ao-tools/ao-stmload/Makefile
545 ao-tools/ao-send-telem/Makefile
546 ao-tools/ao-sky-flash/Makefile
547 ao-tools/ao-dumpflash/Makefile
548 ao-tools/ao-edit-telem/Makefile
549 ao-tools/ao-dump-up/Makefile
550 ao-tools/ao-elftohex/Makefile
551 ao-tools/ao-usbload/Makefile
552 ao-tools/ao-flash/Makefile
553 ao-tools/ao-test-igniter/Makefile
554 ao-tools/ao-test-baro/Makefile
555 ao-tools/ao-test-flash/Makefile
556 ao-tools/ao-cal-accel/Makefile
557 ao-tools/ao-cal-freq/Makefile
558 ao-tools/ao-test-gps/Makefile
559 ao-tools/ao-usbtrng/Makefile
560 ao-tools/ao-chaosread/Makefile
561 ao-tools/ao-makebin/Makefile
567 echo " Package: ${PACKAGE_NAME} ${PACKAGE_VERSION}"
569 echo " Configuration"
570 echo " Arm compiler................: ${ARM_CC}"
571 echo " STM32L support..............: ${HAVE_ARM_M3_CC}"
572 echo " LPC11U14 support............: ${HAVE_ARM_M0_CC}"
573 echo " SDCC........................: ${SDCC}"
574 echo " CC1111 support..............: ${HAVE_SDCC}"
575 echo " AVR compiler................: ${AVR_CC} ${AVR_OBJCOPY}"
576 echo " AVR support.................: ${HAVE_AVR_CC}"
577 echo " Android support.............: ${HAVE_ANDROID_SDK}"
578 echo " Android release support.....: ${ANDROID_RELEASE}"
579 echo " STlink support..............: ${HAVE_STLINK}"
580 echo " Local pdclib................: ${HAVE_PDCLIB}"
581 echo " i386 and amd64 libaltos.....: ${MULTI_ARCH}"
582 echo " install shared mime info....: ${INSTALL_SHARED_MIME_INFO}"
585 echo " freetts.....................: ${FREETTS}"
586 echo " jfreechart..................: ${JFREECHART}"
587 echo " jcommon.....................: ${JCOMMON}"
588 echo " JVM include.................: ${JVM_INCLUDE}"
589 echo " Google maps API key.........: ${HAVE_GOOGLE_KEY}"
590 if test x${ANDROID_SDK} != "xno"; then
593 echo " Android SDK.................: ${ANDROID_SDK}"