-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathconfigure.in
More file actions
296 lines (263 loc) · 12.3 KB
/
configure.in
File metadata and controls
296 lines (263 loc) · 12.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
AC_PREREQ(2.60)
AC_INIT(BTstack, 0.1)
AC_CONFIG_AUX_DIR(config)
AM_INIT_AUTOMAKE(BTstack,0.1)
AC_ARG_WITH(hci-transport, [AS_HELP_STRING([--with-hci-transport=transportType], [Specify BT type to use: h4, usb (not supported yet])], HCI_TRANSPORT=$withval, HCI_TRANSPORT="h4")
AC_ARG_WITH(uart-device, [AS_HELP_STRING([--with-uart-device=uartDevice], [Specify BT UART device to use])], UART_DEVICE=$withval, UART_DEVICE="DEFAULT")
AC_ARG_WITH(uart-speed, [AS_HELP_STRING([--with-uart-speed=uartSpeed], [Specify BT UART speed to use])], UART_SPEED=$withval, UART_SPEED="115200")
AC_ARG_ENABLE(powermanagement, [AS_HELP_STRING([--disable-powermanagement],[Disable powermanagement])], USE_POWERMANAGEMENT=$enableval, USE_POWERMANAGEMENT="yes")
AC_ARG_ENABLE(android, [AS_HELP_STRING([--enable-android],[Enable Android mode])], USE_ANDROID=$enableval, USE_ANDROID="no")
AC_ARG_ENABLE(bluetool, [AS_HELP_STRING([--disable-bluetool],[Disable init of Bluetooth module by BlueTool])], USE_BLUETOOL=$enableval, USE_BLUETOOL="DEFAULT")
AC_ARG_ENABLE(springboard, [AS_HELP_STRING([--disable-springboard],[Disable display of BTstack status in SpringBoard])], USE_SPRINGBOARD=$enableval, USE_SPRINGBOARD="DEFAULT")
AC_ARG_ENABLE(launchd, [AS_HELP_STRING([--enable-launchd],[Compiles BTdaemon for use by launchd])], USE_LAUNCHD=$enableval, USE_LAUNCHD="no")
AC_ARG_WITH(prefsbundle, [AS_HELP_STRING([--with-prefsbundle],[Compiles iPhone Preferences Bundle])], USE_PREFSBUNDLE=$enableval, USE_PREFSBUNDLE="no")
AC_ARG_WITH(iphone-ip, [AS_HELP_STRING([--with-iphone-ip=192.168.1.5], [Specify IP address used by iPhone for installation (not supported yet)])], IPHONE_IP=$withval, IPHONE_IP="")
AC_ARG_WITH(vendor-id, [AS_HELP_STRING([--with-vendor-id=vendorID], [Specify USB BT Dongle vendorID])], USB_VENDOR_ID=$withval, USB_VENDOR_ID="")
AC_ARG_WITH(product-id, [AS_HELP_STRING([--with-product-id=productID], [Specify USB BT Dongle productID])], USB_PRODUCT_ID=$withval, USB_PRODUCT_ID="")
AC_ARG_ENABLE(ldid, [AS_HELP_STRING([--enable-ldid], [Code sign binaries with ldid])], USE_LDID=$enableval, USE_LDID_ID="no")
AC_ARG_WITH(developer-path, [AS_HELP_STRING([--with-developer-path=path],
[Specify toolchain path])], DEVELOPER_PATH=$withval, DEVELOPER_PATH="/Developer/Platforms/iPhoneOS.platform/Developer")
AC_ARG_WITH(sdk-version, [AS_HELP_STRING([--with-sdk-version=3.0], [Specify SDK version])], SDK_VERSION=$withval, SDK_VERSION="3.0")
AC_ARG_WITH(gcc-version, [AS_HELP_STRING([--with-gcc-version=4.2.1], [Specify GCC version])], GCC_VERSION=$withval, GCC_VERSION="4.2.1")
# BUILD/HOST/TARGET
AC_CANONICAL_HOST
# Checks for programs.
AC_PROG_CC
AC_PROG_CPP
AC_PROG_OBJC
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET
# use capitals for transport type
if test "x$HCI_TRANSPORT" = xusb; then
HCI_TRANSPORT="USB"
fi
if test "x$HCI_TRANSPORT" = xh4; then
HCI_TRANSPORT="H4"
fi
# validate USB support
if test "x$HCI_TRANSPORT" = xUSB; then
# pkg-config needed
PKG_PROG_PKG_CONFIG
# libusb installed?
PKG_CHECK_MODULES([LIBUSB], [libusb-1.0], HAVE_LIBUSB="yes", HAVE_LIBUSB="no")
if test "$HAVE_LIBUSB" == "no" ; then
AC_MSG_ERROR(USB Transport requested but libusb-1.0 not found using pkg-config. Please set PKG_CONFIG_PATH correctly and/or install libusb-1.0 from your distribution or from http://libusb.sourceforge.net/api-1.0/)
fi
if test -z "$USB_VENDOR_ID" ; then
AC_MSG_ERROR(USB Transport requested but USB_VENDOR_ID not set. Please specify vendor ID of your USB dongle using --with-vendor-id=0x1234)
fi
if test -z "$USB_PRODUCT_ID" ; then
AC_MSG_ERROR(USB Transport requested but USB_PRODUCT_ID not set. Please specify product ID of your USB dongle using --with-product-id=0x1234)
fi
CFLAGS="$CFLAGS $LIBUSB_CFLAGS"
LDFLAGS="$LDFLAGS $LIBUSB_LIBS"
fi
AM_CONDITIONAL(HAVE_LIBUSB, [test "x$HAVE_LIBUSB" == "xyes"])
echo
echo "BTstack configured for HCI $HCI_TRANSPORT Transport"
HAVE_SO_NOSIGPIPE="no"
RUN_LOOP_SOURCES="run_loop_posix.c"
case "$host_os" in
darwin*)
RUN_LOOP_SOURCES="$RUN_LOOP_SOURCES run_loop_cocoa.m"
LDFLAGS="$LDFLAGS -framework CoreFoundation -framework Foundation"
USE_COCOA_RUN_LOOP="yes"
BTSTACK_LIB_LDFLAGS="-dynamiclib -install_name \$(prefix)/lib/libBTstack.dylib"
BTSTACK_LIB_EXTENSION="dylib"
REMOTE_DEVICE_DB_SOURCES="remote_device_db_iphone.m"
REMOTE_DEVICE_DB="remote_device_db_iphone"
HAVE_SO_NOSIGPIPE="yes";
;;
*)
USE_COCOA_RUN_LOOP="no"
BTSTACK_LIB_LDFLAGS="-shared -Wl,-rpath,\$(prefix)/lib"
BTSTACK_LIB_EXTENSION="so"
REMOTE_DEVICE_DB_SOURCES="remote_device_db_memory.c"
REMOTE_DEVICE_DB="remote_device_db_memory"
;;
esac
# iPhone/iPod touch cross-compilation for darwin
SDK_PATH="$DEVELOPER_PATH/SDKs/iPhoneOS$SDK_VERSION.sdk"
if test "x$target" = xiphone; then
# Default DARWIN compiler version
darwin_v='9'
# Set up check for newest compiler:
if test -e "$DEVELOPER_PATH/usr/bin/arm-apple-darwin10-gcc-$GCC_VERSION"; then
darwin_v='10'
fi
# Set up check for even newer compiler:
if test -e "$DEVELOPER_PATH/usr/bin/arm-apple-darwin10-llvm-gcc-$GCC_VERSION"; then
compiler_prefix='-llvm'
darwin_v='10'
fi
REMOTE_DEVICE_DB_SOURCES="remote_device_db_iphone.m"
REMOTE_DEVICE_DB="remote_device_db_iphone"
USE_COCOA_RUN_LOOP="yes"
HAVE_SO_NOSIGPIPE="yes";
PLATFORM_SOURCES="bt_control_iphone.m platform_iphone.m"
case "$host_os" in
darwin*)
echo "Cross-compiling for iPhone/iPod touch using Apple's iPhone SDK $SDK_VERSION, GCC $GCC_VERSION"
echo "SDK path: $SDK_PATH"
echo "iPhone IP for install-iphone target: $IPHONE_IP"
CC="$DEVELOPER_PATH/usr/bin/arm-apple-darwin$darwin_v$compiler_prefix-gcc-$GCC_VERSION"
OBJC="$DEVELOPER_PATH/usr/bin/arm-apple-darwin$darwin_v$compiler_prefix-g++-$GCC_VERSION"
CFLAGS="$CFLAGS -g"
CPPFLAGS="$CPPFLAGS -isysroot $SDK_PATH"
LDFLAGS="$LDFLAGS -framework Foundation -framework CoreFoundation -framework UIKit -lobjc"
LDFLAGS="$LDFLAGS -L$SDK_PATH/System/Library/Frameworks/IOKit.framework/Versions/A -lIOKit"
LDFLAGS="$LDFLAGS $SDK_PATH/System/Library/PrivateFrameworks/BluetoothManager.framework/BluetoothManager"
;;
linux*)
echo "Cross-compiling for iPhone/iPod touch using Apple's iPhone SDK $SDK_VERSION, GCC $GCC_VERSION"
echo "SDK path: $SDK_PATH"
echo "iPhone IP for install-iphone target: $IPHONE_IP"
# also have cocoa run loop
RUN_LOOP_SOURCES="$RUN_LOOP_SOURCES run_loop_cocoa.m"
# handle sdk written in lower case for people that followed:
# http://code.google.com/p/iphonedevonlinux/wiki/Installation
if test -e "$DEVELOPER_PATH/sdks/iPhoneOS$SDK_VERSION.sdk" ; then
SDK_PATH="$DEVELOPER_PATH/sdks/iPhoneOS$SDK_VERSION.sdk"
fi
CC="$DEVELOPER_PATH/pre/bin/arm-apple-darwin$darwin_v-gcc-$GCC_VERSION"
OBJC="$DEVELOPER_PATH/pre/bin/arm-apple-darwin$darwin_v-g++"
CFLAGS="$CFLAGS -g"
CPPFLAGS="$CPPFLAGS -isysroot $SDK_PATH"
LDFLAGS="$LDFLAGS -framework Foundation -framework CoreFoundation -framework UIKit -lobjc"
LDFLAGS="$LDFLAGS -L$SDK_PATH/System/Library/Frameworks/IOKit.framework/Versions/A -lIOKit"
LDFLAGS="$LDFLAGS $SDK_PATH/System/Library/PrivateFrameworks/BluetoothManager.framework/BluetoothManager"
BTSTACK_LIB_LDFLAGS="-dynamiclib -install_name \$(prefix)/lib/libBTstack.dylib"
BTSTACK_LIB_EXTENSION="dylib"
;;
*)
AC_MSG_ERROR(Don't know how to compile without Apple's iPhone SDK, sorry.)
;;
esac
if test "x$UART_DEVICE" = xDEFAULT ; then
UART_DEVICE=/dev/tty.bluetooth
fi
if test "x$USE_BLUETOOL" = xDEFAULT ; then
USE_BLUETOOL="yes"
echo "USE_BLUETOOL: $USE_BLUETOOL"
fi
if test "x$USE_SPRINGBOARD" = xDEFAULT ; then
USE_SPRINGBOARD="yes"
fi
if test "x$USE_LDID" = xyes ; then
USE_LDID=""
echo "USE_LDID: yes"
else
USE_LDID="#"
echo "USE_LDID: no"
fi
else
# cannot compile for iOS with strict-prototypes because of warnings in SDK 2.0
CPPFLAGS="$CPPFLAGS -Wstrict-prototypes"
case "$host_os" in
darwin*)
# on Mac, create universal - helps to build 32-bit iPhone Simulator apps on 64-bit machines
LDFLAGS="$LDFLAGS -framework CoreFoundation"
;;
esac
USE_LDID="#"
if test "x$UART_DEVICE" = xDEFAULT ; then
UART_DEVICE=/dev/ttyS0
fi
if test "x$USE_SPRINGBOARD" = xDEFAULT ; then
USE_SPRINGBOARD="no"
fi
fi
# treat warnings seriously
CPPFLAGS="$CPPFLAGS -Werror -Wall -Wpointer-arith"
AM_CONDITIONAL(USE_ANDROID, [test "x$USE_ANDROID" == "xyes"])
AM_CONDITIONAL(USE_SPRINGBOARD, [test "x$USE_SPRINGBOARD" == "xyes"])
AM_CONDITIONAL(USE_BLUETOOL, [test "x$USE_BLUETOOL" == "xyes"])
AM_CONDITIONAL(USE_POWERMANAGEMENT, [test "x$USE_POWERMANAGEMENT" == "xyes"])
AM_CONDITIONAL(USE_PREFSBUNDLE, [test "x$USE_PREFSBUNDLE" == "xyes"])
# summary
echo "CC: $CC"
echo "CPPFLAGS: $CPPFLAGS"
echo "LDFLAGS: $LDFLAGS"
if test "x$HCI_TRANSPORT" = xUSB; then
echo "USB_PRODUCT_ID: $USB_PRODUCT_ID"
echo "USB_VENDOR_ID: $USB_VENDOR_ID"
echo "LIBUSB_CFLAGS: $LIBUSB_CFLAGS"
echo "LIBUSB_LIBS: $LIBUSB_LIBS"
else
echo "UART_DEVICE: $UART_DEVICE"
echo "UART_SPEED: $UART_SPEED"
fi
echo "PLATFORM_SOURCES: $PLATFORM_SOURCES"
echo "USE_LAUNCHD: $USE_LAUNCHD"
echo "USE_SPRINGBOARD: $USE_SPRINGBOARD"
echo "USE_PREFSBUNDLE: $USE_PREFSBUNDLE"
echo "USE_POWERMANAGEMENT: $USE_POWERMANAGEMENT"
echo "USE_COCOA_RUN_LOOP: $USE_COCOA_RUN_LOOP"
echo "USE_ANDROID: $USE_ANDROID"
echo "REMOTE_DEVICE_DB: $REMOTE_DEVICE_DB"
echo "HAVE_SO_NOSIGPIPE: $HAVE_SO_NOSIGPIPE"
echo
echo
# create config.h
echo "// config.h created by configure for BTstack " `date`> config.h
if test "x$HCI_TRANSPORT" = xUSB; then
USB_SOURCES=hci_transport_usb.c
echo "#define HAVE_TRANSPORT_USB" >> config.h
echo "#define USB_PRODUCT_ID $USB_PRODUCT_ID" >> config.h
echo "#define USB_VENDOR_ID $USB_VENDOR_ID" >> config.h
else
echo "#define HAVE_TRANSPORT_H4" >> config.h
echo "#define UART_DEVICE \"$UART_DEVICE\"" >> config.h
echo "#define UART_SPEED $UART_SPEED" >> config.h
if test "x$USE_BLUETOOL" = xyes; then
echo "#define USE_BLUETOOL" >> config.h
fi
if test "x$USE_POWERMANAGEMENT" = xyes; then
echo "#define USE_POWERMANAGEMENT" >> config.h
fi
fi
if test "x$USE_SPRINGBOARD" = xyes; then
SPRINGBOARD_ACCESS_SOURCES="../SpringBoardAccess/SpringBoardAccess.c"
echo "#define USE_SPRINGBOARD" >> config.h
fi
if test "x$USE_LAUNCHD" = xyes; then
echo "#define USE_LAUNCHD" >> config.h
fi
if test "x$USE_COCOA_RUN_LOOP" = xyes; then
echo "#define USE_COCOA_RUN_LOOP" >> config.h
fi
echo "#define USE_POSIX_RUN_LOOP" >> config.h
echo "#define HAVE_SDP" >> config.h
echo "#define HAVE_RFCOMM" >> config.h
if test ! -z "$REMOTE_DEVICE_DB" ; then
echo "#define REMOTE_DEVICE_DB $REMOTE_DEVICE_DB" >> config.h
fi
if test "x$HAVE_SO_NOSIGPIPE" == xyes ; then
echo "#define HAVE_SO_NOSIGPIPE" >> config.h
fi
if test "x$USE_ANDROID" == xyes; then
echo "#define ANDROID" >> config.h
fi
# often not present for embedded
echo "#define HAVE_TIME" >> config.h
echo "#define HAVE_MALLOC" >> config.h
echo "#define HAVE_BZERO" >> config.h
echo "#define ENABLE_LOG_INFO " >> config.h
echo "#define ENABLE_LOG_ERROR" >> config.h
echo "#define HCI_ACL_PAYLOAD_SIZE 1021" >> config.h
AC_SUBST(IPHONE_IP)
AC_SUBST(HAVE_LIBUSB)
AC_SUBST(USE_LDID)
AC_SUBST(REMOTE_DEVICE_DB_SOURCES)
AC_SUBST(USB_SOURCES)
AC_SUBST(PLATFORM_SOURCES)
AC_SUBST(SPRINGBOARD_ACCESS_SOURCES)
AC_SUBST(RUN_LOOP_SOURCES)
AC_SUBST(CFLAGS)
AC_SUBST(CPPFLAGS)
AC_SUBST(BTSTACK_LIB_LDFLAGS)
AC_SUBST(BTSTACK_LIB_EXTENSION)
AC_OUTPUT(Makefile src/Makefile example/Makefile PatchBlueTool/Makefile SpringBoardAccess/Makefile)