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.
23 AC_CONFIG_SRCDIR([src/kernel/ao.h])
24 AM_INIT_AUTOMAKE([foreign dist-bzip2])
27 RELEASE_DATE=2018-12-31
28 AC_SUBST(RELEASE_DATE)
30 VERSION_DASH=`echo $VERSION | sed 's/\./-/g'`
31 AC_SUBST(VERSION_DASH)
32 AC_SUBST(ANDROID_VERSION)
34 dnl ==========================================================================
35 dnl Java library versions
40 AC_SUBST(ALTOSLIB_VERSION)
41 AC_DEFINE(ALTOSLIB_VERSION,$ALTOSLIB_VERSION,[Version of the AltosLib package])
42 AC_SUBST(ALTOSUILIB_VERSION)
43 AC_DEFINE(ALTOSUILIB_VERSION,$ALTOSUILIB_VERSION,[Version of the AltosUILib package])
45 dnl ==========================================================================
47 AM_CONFIG_HEADER(config.h)
49 AC_ARG_WITH(freetts, AS_HELP_STRING([--with-freetts=PATH],
50 [Set freetts class path (default /usr/share/java)]),
51 [FREETTS=$withval], [FREETTS=/usr/share/java])
55 AC_ARG_WITH(jfreechart, AS_HELP_STRING([--with-jfreechart=PATH],
56 [Set jfreechart class path (default /usr/share/java)]),
57 [JFREECHART=$withval], [JFREECHART=/usr/share/java])
61 AC_ARG_WITH(jcommon, AS_HELP_STRING([--with-jcommon=PATH],
62 [Set jcommon class path (default /usr/share/java)]),
63 [JCOMMON=$withval], [JCOMMON=/usr/share/java])
67 AC_ARG_WITH(jvm, AS_HELP_STRING([--with-jvm=PATH],
68 [Set jvm path for java builds (default searches in /usr/lib/jvm)]),
69 [JVM=$withval], [JVM=auto])
71 if test "x$JVM" = "xauto"; then
72 AC_MSG_CHECKING([JVM])
73 for jvm in default-java java-6-openjdk java-7-openjdk java-8-openjdk java-9-openjdk java-10-openjdk java-11-openjdk java-12-openjdk java-13-openjdk java-6-sun java-8-openjdk-amd64; do
74 if test "x$JVM" = "xauto"; then
75 INCLUDE="/usr/lib/jvm/$jvm/include"
76 if test -f "$INCLUDE"/jni.h; then
77 JVM=/usr/lib/jvm/"$jvm"
81 if test "x$JVM" = "xauto"; then
82 AC_MSG_ERROR([no JVM files found])
87 AC_ARG_WITH(java-version, AS_HELP_STRING([--with-java-version=7],
88 [Set java language compatibility version (default is 7)]),
89 [JAVA_VERSION=$withval], [JAVA_VERSION=7])
91 JAVAC="$JVM"/bin/javac
93 JVM_INCLUDE="$JVM"/include
94 JAVAC_VERSION_FLAGS="-target 1.$JAVA_VERSION -source 1.$JAVA_VERSION"
100 AC_SUBST(JAVAC_VERSION_FLAGS)
103 AC_ARG_WITH(android, AS_HELP_STRING([--with-android=PATH],
104 [Set android SDK path (default searches in a variety of places)]),
105 [ANDROID_SDK=$withval], [ANDROID_SDK=${ANDROID_SDK:-auto}])
107 if test "x$ANDROID_SDK" = "xauto"; then
108 AC_MSG_CHECKING([Android SDK])
109 for sdk in ../android/android-sdk-linux ../android/android-sdk ../android-sdk ../android-sdk-linux $HOME/android; do
110 if test "x$ANDROID_SDK" = "xauto"; then
112 if test -f "$SDK/SDK Readme.txt"; then
113 ANDROID_SDK=`readlink -m "$SDK"`
117 if test "x$ANDROID_SDK" = "xauto"; then
118 AC_MSG_NOTICE([no Android SDK found])
121 AC_MSG_RESULT([$ANDROID_SDK])
123 if test "x$ANDROID_SDK" != "xno"; then
124 AC_MSG_CHECKING([Android SDK version])
125 SDK_VERSION=`grep -i '^Pkg.Revision=' $ANDROID_SDK/tools/source.properties | cut -f2- -d= | sed s/^r//`
126 SDK_MAJOR_VERSION="`echo $SDK_VERSION | sed 's/[[^0-9]].*//'`"
127 if test "$SDK_MAJOR_VERSION" -lt 17 ; then
128 AC_MSG_NOTICE([SDK version $SDK_VERSION is too old. Need >= r17])
131 AC_MSG_RESULT([$SDK_VERSION])
134 if test "x$ANDROID_SDK" != "xno"; then
135 AC_MSG_CHECKING([Android SDK API Level])
136 if test -f "$ANDROID_SDK/platforms/android-10/source.properties"; then
137 API_LEVEL=`sed -ne 's/^AndroidVersion.ApiLevel=//p' $ANDROID_SDK/platforms/android-10/source.properties`
138 if test "$API_LEVEL" = "10"; then
139 AC_MSG_RESULT([$API_LEVEL])
141 AC_MSG_NOTICE([API Level 10 not installed correctly.])
145 AC_MSG_NOTICE([API Level 10 not installed, but is required.])
149 if test "x$ANDROID_SDK" != "xno"; then
150 AC_MSG_CHECKING([Android SDK required extras])
151 if test -f "$ANDROID_SDK/extras/android/support/source.properties"; then
152 ANDROID_SUPPORT_LIB_NAME=`sed -ne 's/^Extra.NameDisplay=//p' $ANDROID_SDK/extras/android/support/source.properties`
153 if test -f "$ANDROID_SDK/extras/google/google_play_services/source.properties"; then
154 GOOGLE_PLAY_SERVICES_NAME=`sed -ne 's/^Extra.NameDisplay=//p' $ANDROID_SDK/extras/google/google_play_services/source.properties`
155 AC_MSG_RESULT([$ANDROID_SUPPORT_LIB_NAME, $GOOGLE_PLAY_SERVICES_NAME])
157 AC_MSG_NOTICE([Google Play Services library not installed.])
161 AC_MSG_NOTICE([Android Support Library not installed.])
167 if test "x$ANDROID_SDK" != "xno"; then
168 HAVE_ANDROID_SDK="yes"
169 if test -f "$HOME/altusmetrumllc/google-play-release.keystore" -a -f "$HOME/altusmetrumllc/google-play-passphrase"; then
173 HAVE_ANDROID_SDK="no"
176 AM_CONDITIONAL([ANDROID], [test x$ANDROID_SDK != xno])
177 AM_CONDITIONAL([ANDROID_RELEASE], [test x$ANDROID_RELEASE = xyes])
179 AC_SUBST(ANDROID_SDK)
181 AC_ARG_WITH(fat-dir, AS_HELP_STRING([--with-fat-dir=PATH],
182 [Set the directory to install the 'fat-install' distribution files to (defaults to no such target)]),
183 [FATDIR=$withval], [FATDIR=none])
185 AM_CONDITIONAL(FATINSTALL, [test "x$FATDIR" != "xnone"])
189 AC_ARG_WITH(google-key, AS_HELP_STRING([--with-google-key=PATH],
190 [Set the file to read the AltosDroid maps API key from (defaults to ~/altusmetrumllc/google-altosdroid-maps-api-key)]),
191 [GOOGLEKEYFILE=$withval], [GOOGLEKEYFILE=$HOME/altusmetrumllc/google-altosdroid-maps-api-key])
193 if test -r "$GOOGLEKEYFILE" -a -s "$GOOGLEKEYFILE"; then
194 GOOGLEKEY=`cat "$GOOGLEKEYFILE"`
195 HAVE_GOOGLE_KEY="yes"
201 WARN_CFLAGS="-Wall -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wnested-externs"
202 AC_SUBST(WARN_CFLAGS)
204 AC_ARG_ENABLE(faketime, AS_HELP_STRING([--enable-faketime],
205 [Use faketime program to ensure pdf files are reproducible (default=no)]),
206 [FAKETIME=$enableval], [FAKETIME=no])
208 AM_CONDITIONAL(FAKETIME, [test x$FAKETIME = xyes])
219 if test "x$GCC" = "xyes"; then
220 WARN_CFLAGS="-Wall -Wpointer-arith -Wstrict-prototypes \
221 -Wmissing-prototypes -Wmissing-declarations \
222 -Wnested-externs -fno-strict-aliasing"
223 AC_DEFINE_UNQUOTED(HAVE_WARNING_CPP_DIRECTIVE,1,
224 [Can use #warning in C files])
226 AC_SUBST(WARN_CFLAGS)
229 # Configure ARM compiler for STM32L and LPC11U14
232 AC_ARG_WITH([arm-cc],
233 [AS_HELP_STRING([--with-arm-cc],
234 [Name of ARM C compiler])],
238 if test "x$with_arm_cc" != "xno"; then
239 if test "x$with_arm_cc" = "xauto"; then
240 with_arm_cc="arm-none-eabi-gcc"
241 AC_CHECK_PROG([HAVE_ARM_CC],[$with_arm_cc], yes, no)
249 if test "x$HAVE_ARM_CC" = "xno"; then
250 AC_MSG_WARN([Arm compiler not found, ARM binaries will not be built])
254 AC_SUBST(HAVE_ARM_CC)
257 if test "x$HAVE_ARM_CC" = "xyes"; then
259 save_CFLAGS="$CFLAGS"
262 CFLAGS="-mthumb -mcpu=cortex-m0"
263 LIBS="-ffreestanding -nostdlib"
266 AC_MSG_CHECKING([if ]$ARM_CC[ supports cortex-m0])
267 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([int i;])],
268 [HAVE_ARM_M0_CC=yes],
270 AC_MSG_RESULT([$HAVE_ARM_M0_CC])
272 CFLAGS="-mthumb -mcpu=cortex-m3"
273 AC_MSG_CHECKING([if ]$ARM_CC[ supports cortex-m3])
274 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([int i;])],
275 [HAVE_ARM_M3_CC=yes],
277 AC_MSG_RESULT([$HAVE_ARM_M3_CC])
281 CFLAGS="$save_CFLAGS"
287 AC_SUBST(HAVE_ARM_M3_CC)
288 AC_SUBST(HAVE_ARM_M0_CC)
290 if test "x$HAVE_ARM_M3_CC" = "xno"; then
291 AC_MSG_WARN([No cortex-m3 arm compiler found, STM32L binaries will not be built])
294 if test "x$HAVE_ARM_M0_CC" = "xno"; then
295 AC_MSG_WARN([No cortex-m0 arm compiler found, LPC11U14 binaries will not be built])
298 AC_ARG_WITH([newlib-nano],
299 [AS_HELP_STRING([--with-newlib-nano],
300 [Root of newlib nano install])],
302 [with_newlib_nano=auto])
305 if test "x$with_newlib_nano" != "xno"; then
306 if test "x$with_newlib_nano" = "xauto"; then
307 for d in /usr/local/lib/newlib-nano /usr/lib/newlib-nano; do
308 if test "x$with_newlib_nano" = "xauto" -a -d "$d"; then
309 with_newlib_nano="$d"
318 if test "x$HAVE_NEWLIB_NANO" = "xno"; then
319 AC_MSG_WARN([No newlib-nano library found, ARM binaries will not be built])
323 NEWLIB_NANO="$with_newlib_nano"
326 AC_SUBST(HAVE_NEWLIB_NANO)
327 AC_SUBST(NEWLIB_NANO)
330 # Configure AVR compiler
333 AC_ARG_WITH([avr-cc],
334 [AS_HELP_STRING([--with-avr-cc],
335 [Name of AVR C compiler])],
339 if test "x$with_avr_cc" != "xno"; then
340 if test "x$with_avr_cc" = "xauto"; then
341 with_avr_cc="avr-gcc"
342 AC_CHECK_PROG([HAVE_AVR_CC],[$with_avr_cc], yes, no)
350 AC_ARG_WITH([avr-objcopy],
351 [AS_HELP_STRING([--with-avr-objcopy],
352 [Name of AVR objcopy])],
354 [with_avr_objcopy=auto])
356 if test "x$with_avr_objcopy" != "xno"; then
357 if test "x$with_avr_objcopy" = "xauto"; then
358 with_avr_objcopy="avr-objcopy"
359 AC_CHECK_PROG([HAVE_AVR_OBJCOPY],[$with_avr_objcopy], yes, no)
367 if test "x$HAVE_AVR_CC" = "xno" -o "x$HAVE_AVR_OBJCOPY" = "xno"; then
368 AC_MSG_WARN([AVR compiler and objcopy not found, atmel binaries will not be built])
372 save_CFLAGS="$CFLAGS"
376 CFLAGS="-mmcu=attiny85"
378 AC_MSG_CHECKING([if ]$with_avr_cc[ can link programs])
379 AC_LINK_IFELSE([AC_LANG_PROGRAM([])],
382 AC_MSG_RESULT([$AVR_LINK])
386 CFLAGS="$save_CFLAGS"
389 if test "x$AVR_LINK" = xyes; then
391 AVR_OBJCOPY=$with_avr_objcopy
398 AC_SUBST(AVR_OBJCOPY)
399 AC_SUBST(HAVE_AVR_CC)
401 AC_CHECK_PROG([HAVE_NICKLE], [nickle], yes, no)
402 if test "x$HAVE_NICKLE" = "xno"; then
403 AC_MSG_ERROR([Please install nickle to build AltOs])
406 AC_CHECK_PROG([HAVE_ASCIIDOCTOR_PDF], [asciidoctor-pdf], yes, no)
407 if test "x$HAVE_ASCIIDOCTOR_PDF" = "xno"; then
408 AC_MSG_WARN([asciidoctor-pdf not found, PDF docs will not be built])
410 AM_CONDITIONAL([ASCIIDOCTOR_PDF], [test x$HAVE_ASCIIDOCTOR_PDF != xno])
412 AC_ARG_WITH([strip-nondeterminism],
413 [AS_HELP_STRING([--with-strip-nondeterminism],
414 [Name of non-deterministic build data stripping tool])],
416 [with_strip_nondeterminism=auto])
418 if test "x$with_strip_nondeterminism" != "xno"; then
419 if test "x$with_strip_nondeterminism" = "xauto"; then
420 with_strip_nondeterminism="strip-nondeterminism"
421 AC_CHECK_PROG([HAVE_STRIP_NONDETERMINISM],[$with_strip_nondeterminism], yes, no)
423 HAVE_STRIP_NONDETERMINISM=yes
426 HAVE_STRIP_NONDETERMINISM=no
428 AM_CONDITIONAL([STRIP_NONDETERMINISM], [test x$HAVE_STRIP_NONDETERMINISM != xno])
429 AC_SUBST(STRIP_NONDETERMINISM, "$with_strip_nondeterminism")
431 PKG_CHECK_MODULES([JANSSON], [jansson])
433 AC_ARG_WITH([readline],
434 [AS_HELP_STRING([--with-readline],
435 [enable readline functionality in ao-dbg @<:@default=auto@:>@])],
437 [with_readline=auto])
441 if test x"$with_readline" != "xno"; then
442 AC_CHECK_LIB([readline], [main],
443 [AC_SUBST([LIBREADLINE], ["-lreadline -lncurses"])
444 AC_DEFINE([HAVE_LIBREADLINE], [1],
445 [Define if you have libreadline])],
446 [if test "x$with_readline" != xauto; then
447 AC_MSG_ERROR([--with-readline was given, but test for readline failed])
452 PKG_CHECK_MODULES([LIBUSB], [libusb-1.0])
454 AC_CHECK_HEADERS(libelf.h libelf/libelf.h, [break])
455 AC_CHECK_HEADERS(gelf.h libelf/gelf.h, [break])
457 AC_ARG_WITH([stlink],
458 [AS_HELP_STRING([--with-stlink],
459 [Build tools that use the stlink library (default: auto)])],
463 if test x"$with_stlink" != "xno"; then
464 PKG_CHECK_MODULES([STLINK], [stlink], [HAVE_STLINK=yes], [HAVE_STLINK=no])
465 if test x"$HAVE_STLINK" = "xno" -a x"$with_stlink" != "xauto"; then
466 AC_MSG_ERROR([--with-stlink was given, but stlink was not found])
472 if test x"$HAVE_STLINK" = "xyes"; then
473 AC_DEFINE(HAVE_STLINK,1,[Using STlink library])
476 AM_CONDITIONAL([LIBSTLINK], [test x$HAVE_STLINK = xyes])
478 AC_ARG_ENABLE([multi-arch],
479 [AS_HELP_STRING([--enable-multi-arch],
480 [enable building both i386 and amd64 libraries (default=auto)])],
481 [MULTI_ARCH=$enableval],
484 case x"$MULTI_ARCH" in
489 save_CFLAGS="$CFLAGS"
493 AC_MSG_CHECKING([if ]$CC[ ]$CFLAGS[ can link programs])
494 AC_LINK_IFELSE([AC_LANG_PROGRAM([])],
497 AC_MSG_RESULT([$M64_LINK])
499 AC_MSG_CHECKING([if ]$CC[ ]$CFLAGS[ can link programs])
500 AC_LINK_IFELSE([AC_LANG_PROGRAM([])],
503 AC_MSG_RESULT([$M32_LINK])
504 CFLAGS="$save_CFLAGS"
506 case x"$M64_LINK"x"$M32_LINK" in
527 AM_CONDITIONAL([MULTI_ARCH], [test x$MULTI_ARCH = xyes])
529 AC_ARG_ENABLE([install-shared-mime-info],
530 [AS_HELP_STRING([--disable-install-shared-mime-info],
531 [disable installing shared mime info files (default=yes)])],
532 [INSTALL_SHARED_MIME_INFO=$enableval],
533 [INSTALL_SHARED_MIME_INFO=yes])
535 AM_CONDITIONAL([INSTALL_SHARED_MIME_INFO], [test x$INSTALL_SHARED_MIME_INFO = xyes])
540 src/chaoskey-v1.0/org.altusmetrum.ChaosKey.metainfo.xml
543 altoslib/AltosVersion.java
548 altosui/altos-windows.nsi
552 micropeak/micropeak-windows.nsi
555 telegps/telegps-windows.nsi
557 altosdroid/local.properties
558 altosdroid/app/src/main/AndroidManifest.xml
560 ao-tools/lib/Makefile
561 ao-tools/ao-rawload/Makefile
562 ao-tools/ao-dbg/Makefile
563 ao-tools/ao-bitbang/Makefile
564 ao-tools/ao-eeprom/Makefile
565 ao-tools/ao-list/Makefile
566 ao-tools/ao-load/Makefile
567 ao-tools/ao-telem/Makefile
568 ao-tools/ao-stmload/Makefile
569 ao-tools/ao-send-telem/Makefile
570 ao-tools/ao-sky-flash/Makefile
571 ao-tools/ao-dumpflash/Makefile
572 ao-tools/ao-edit-telem/Makefile
573 ao-tools/ao-dump-up/Makefile
574 ao-tools/ao-elftohex/Makefile
575 ao-tools/ao-usbload/Makefile
576 ao-tools/ao-flash/Makefile
577 ao-tools/ao-test-igniter/Makefile
578 ao-tools/ao-test-baro/Makefile
579 ao-tools/ao-test-flash/Makefile
580 ao-tools/ao-cal-accel/Makefile
581 ao-tools/ao-cal-freq/Makefile
582 ao-tools/ao-test-gps/Makefile
583 ao-tools/ao-usbtrng/Makefile
584 ao-tools/ao-makebin/Makefile
587 map-server/altos-mapd/Makefile
588 map-server/altos-map/Makefile
589 map-server/altos-mapj/Makefile
593 echo " Package: ${PACKAGE_NAME} ${PACKAGE_VERSION}"
595 echo " Configuration"
596 echo " Arm compiler................: ${ARM_CC}"
597 echo " STM32L support..............: ${HAVE_ARM_M3_CC}"
598 echo " LPC11U14 support............: ${HAVE_ARM_M0_CC}"
599 echo " AVR compiler................: ${AVR_CC} ${AVR_OBJCOPY}"
600 echo " AVR support.................: ${HAVE_AVR_CC}"
601 echo " Android support.............: ${HAVE_ANDROID_SDK}"
602 echo " Android release support.....: ${ANDROID_RELEASE}"
603 echo " STlink support..............: ${HAVE_STLINK}"
604 echo " Newlib-nano support.........: ${NEWLIB_NANO}"
605 echo " i386 and amd64 libaltos.....: ${MULTI_ARCH}"
606 echo " install shared mime info....: ${INSTALL_SHARED_MIME_INFO}"
607 echo " Strip jar timestamps........: ${STRIP_NONDETERMINISM}"
610 echo " freetts.....................: ${FREETTS}"
611 echo " jfreechart..................: ${JFREECHART}"
612 echo " jcommon.....................: ${JCOMMON}"
613 echo " JVM include.................: ${JVM_INCLUDE}"
614 echo " AltosDroid maps API key.....: ${HAVE_GOOGLE_KEY}"
615 if test x${ANDROID_SDK} != "xno"; then
618 echo " Android SDK.................: ${ANDROID_SDK}"