Build installable versions of MicroPeak GUI
[fw/altos] / configure.ac
1 dnl
2 dnl  Copyright © 2008,2009 Keith Packard <keithp@keithp.com>
3 dnl
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.
8 dnl
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.
13 dnl
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.
17 dnl
18 dnl Process this file with autoconf to create configure.
19
20 AC_PREREQ(2.57)
21 AC_INIT([altos], 1.1.9.2)
22 AC_CONFIG_SRCDIR([src/core/ao.h])
23 AM_INIT_AUTOMAKE([foreign dist-bzip2])
24 AM_MAINTAINER_MODE
25
26 VERSION_DASH=`echo $VERSION | sed 's/\./-/g'`
27 AC_SUBST(VERSION_DASH)
28
29 dnl ==========================================================================
30
31 AM_CONFIG_HEADER(config.h)
32
33 AC_ARG_WITH(freetts, AS_HELP_STRING([--with-freetts=PATH],
34         [Set freetts class path (default /usr/share/java)]),
35         [FREETTS=$withval], [FREETTS=/usr/share/java])
36
37 AC_SUBST(FREETTS)
38
39 AC_ARG_WITH(jfreechart, AS_HELP_STRING([--with-jfreechart=PATH],
40         [Set jfreechart class path (default /usr/share/java)]),
41         [JFREECHART=$withval], [JFREECHART=/usr/share/java])
42
43 AC_SUBST(JFREECHART)
44
45 AC_ARG_WITH(jcommon, AS_HELP_STRING([--with-jcommon=PATH],
46         [Set jcommon class path (default /usr/share/java)]),
47         [JCOMMON=$withval], [JCOMMON=/usr/share/java])
48
49 AC_SUBST(JCOMMON)
50
51 AC_ARG_WITH(jvm, AS_HELP_STRING([--with-jvm-include=PATH],
52         [Set jvm include path for jni builds (default searches in /usr/lib/jvm)]),
53         [JVM_INCLUDE=$withval], [JVM_INCLUDE=auto])
54
55 if test "x$JVM_INCLUDE" = "xauto"; then
56         AC_MSG_CHECKING([JVM include files])
57         for jvm in default-java java-6-openjdk java-6-sun; do
58                 if test "x$JVM_INCLUDE" = "xauto"; then
59                         INCLUDE="/usr/lib/jvm/$jvm/include"
60                         if test -f "$INCLUDE"/jni.h; then
61                                 JVM_INCLUDE="$INCLUDE"
62                         fi
63                 fi
64         done
65         if test "x$JVM_INCLUDE" = "xauto"; then
66                 AC_MSG_ERROR([no JVM include files found])
67         fi
68         AC_MSG_RESULT([$JVM_INCLUDE])
69 fi
70
71 AC_SUBST(JVM_INCLUDE)
72
73 AC_ARG_WITH(android, AS_HELP_STRING([--with-android=PATH],
74         [Set android SDK path (default searches in a variety of places)]),
75         [ANDROID_SDK=$withval], [ANDROID_SDK=${ANDROID_SDK:-auto}])
76
77 echo ANDROID_SDK set to $ANDROID_SDK
78
79 if test "x$ANDROID_SDK" = "xauto"; then
80         AC_MSG_CHECKING([Android SDK files])
81         for sdk in ../android/android-sdk-linux ../android/android-sdk ../android-sdk ../android-sdk-linux $HOME/android; do
82                 if test "x$ANDROID_SDK" = "xauto"; then
83                         SDK="$sdk"
84                         if test -f "$SDK/SDK Readme.txt"; then
85                                 ANDROID_SDK=`readlink -m "$SDK"`
86                         fi
87                 fi
88         done
89         if test "x$ANDROID_SDK" = "xauto"; then
90                 AC_MSG_NOTICE([no Android SDK found])
91                 ANDROID_SDK=no
92         fi
93         AC_MSG_RESULT([$ANDROID_SDK])
94 fi
95
96 AM_CONDITIONAL([ANDROID], [test x$ANDROID_SDK != xno])
97
98 AC_SUBST(ANDROID_SDK)
99
100 AC_ARG_WITH(fat-dir, AS_HELP_STRING([--with-fat-dir=PATH],
101             [Set the directory to install the 'fat' distribution files to (defaults to not installing)]),
102             [FATDIR=$withval], [FATDIR=none])
103
104 AM_CONDITIONAL(FATINSTALL, [test "x$FATDIR" != "xnone"])
105
106 AC_SUBST(FATDIR)
107
108 AC_PROG_CC
109 AC_PROG_INSTALL
110 AC_PROG_LN_S
111 AC_PROG_LIBTOOL
112 PKG_PROG_PKG_CONFIG
113
114 CFLAGS="-g"
115 WARN_CFLAGS=""
116 if test "x$GCC" = "xyes"; then
117         WARN_CFLAGS="-Wall -Wpointer-arith -Wstrict-prototypes \
118         -Wmissing-prototypes -Wmissing-declarations \
119         -Wnested-externs -fno-strict-aliasing"
120         AC_DEFINE_UNQUOTED(HAVE_WARNING_CPP_DIRECTIVE,1,
121         [Can use #warning in C files])
122 fi
123 AC_SUBST(WARN_CFLAGS)
124
125 AC_CHECK_PROG([HAVE_SDCC], [sdcc], yes, no)
126 if test "x$HAVE_SDCC" = "xno"; then
127         AC_MSG_ERROR([Please install sdcc to build AltOs])
128 fi
129
130 AC_CHECK_PROG([HAVE_NICKLE], [nickle], yes, no)
131 if test "x$HAVE_NICKLE" = "xno"; then
132         AC_MSG_ERROR([Please install nickle to build AltOs])
133 fi
134
135 AC_CHECK_LIB(readline, readline)
136
137 PKG_CHECK_MODULES([LIBUSB], [libusb-1.0])
138
139 AC_CHECK_HEADERS(libelf.h libelf/libelf.h, [break])
140 AC_CHECK_HEADERS(gelf.h libelf/gelf.h, [break])
141
142 PKG_CHECK_MODULES([LIBSTLINK], [stlink], [HAVE_STLINK=yes], [HAVE_STLINK=no])
143
144 AM_CONDITIONAL([LIBSTLINK], [test x$HAVE_STLINK != xno])
145
146 AC_OUTPUT([
147 Makefile
148 altoslib/Makefile
149 altosuilib/Makefile
150 altosuilib/AltosUIVersion.java
151 altosui/Makefile
152 altosui/AltosVersion.java
153 altosui/Info.plist
154 libaltos/Makefile
155 micropeak/Makefile
156 micropeak/Info.plist
157 altosdroid/Makefile
158 altosdroid/local.properties
159 ao-tools/Makefile
160 ao-tools/lib/Makefile
161 ao-tools/ao-rawload/Makefile
162 ao-tools/ao-dbg/Makefile
163 ao-tools/ao-bitbang/Makefile
164 ao-tools/ao-eeprom/Makefile
165 ao-tools/ao-list/Makefile
166 ao-tools/ao-load/Makefile
167 ao-tools/ao-telem/Makefile
168 ao-tools/ao-stmload/Makefile
169 ao-tools/ao-send-telem/Makefile
170 ao-tools/ao-sky-flash/Makefile
171 ao-utils/Makefile
172 src/Version
173 ])