2009-07-09 20:00:44 +00:00
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
AC_PREREQ(2.60)
2009-07-11 09:23:51 +00:00
AC_INIT(BTstack, 0.1)
2009-09-15 19:43:17 +00:00
AC_CONFIG_AUX_DIR(config)
2009-07-11 09:23:51 +00:00
AM_INIT_AUTOMAKE(BTstack,0.1)
2009-07-09 20:00:44 +00:00
2009-07-11 10:37:48 +00:00
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")
2009-07-10 19:08:22 +00:00
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(bluetool, [AS_HELP_STRING([--disable-bluetool],[Disable init of Bluetooth module by BlueTool])], USE_BLUETOOL=$enableval, USE_BLUETOOL="DEFAULT")
2009-08-15 21:31:23 +00:00
AC_ARG_ENABLE(springboard, [AS_HELP_STRING([--disable-springboard],[Disable display of BTstack status in SpringBoard])], USE_SPRINGBOARD=$enableval, USE_SPRINGBOARD="DEFAULT")
2009-10-07 20:17:19 +00:00
AC_ARG_ENABLE(launchd, [AS_HELP_STRING([--enable-launchd],[Compiles BTdaemon for use by launchd])], USE_LAUNCHD=$enableval, USE_LAUNCHD="no")
2011-04-30 20:11:20 +00:00
AC_ARG_WITH(prefsbundle, [AS_HELP_STRING([--with-prefsbundle],[Compiles iPhone Preferences Bundle])], USE_PREFSBUNDLE=$enableval, USE_PREFSBUNDLE="no")
2009-07-11 10:37:48 +00:00
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="")
2009-07-09 20:00:44 +00:00
AC_ARG_WITH(vendor-id, [AS_HELP_STRING([--with-vendor-id=vendorID], [Specify USB BT Dongle vendorID])], USB_VENDOR_ID=$withval, USB_VENDOR_ID="")
2010-09-01 22:08:53 +00:00
AC_ARG_WITH(product-id, [AS_HELP_STRING([--with-product-id=productID], [Specify USB BT Dongle productID])], USB_PRODUCT_ID=$withval, USB_PRODUCT_ID="")
2009-10-05 21:52:43 +00:00
AC_ARG_ENABLE(ldid, [AS_HELP_STRING([--enable-ldid], [Code sign binaries with ldid])], USE_LDID=$enableval, USE_LDID_ID="no")
2010-03-02 20:09:12 +00:00
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=2.0], [Specify SDK version])], SDK_VERSION=$withval, SDK_VERSION="2.0")
2010-11-05 18:43:02 +00:00
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")
2009-07-11 09:42:53 +00:00
2009-07-09 20:00:44 +00:00
# BUILD/HOST/TARGET
AC_CANONICAL_HOST
# Checks for programs.
AC_PROG_CC
AC_PROG_CPP
2009-08-15 21:31:23 +00:00
AC_PROG_OBJC
2009-07-09 20:00:44 +00:00
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET
2009-07-11 09:42:53 +00:00
# use capitals for transport type
2009-07-09 20:00:44 +00:00
if test "x$HCI_TRANSPORT" = xusb; then
2009-07-10 19:08:22 +00:00
HCI_TRANSPORT="USB"
2009-07-11 09:36:29 +00:00
fi
if test "x$HCI_TRANSPORT" = xh4; then
HCI_TRANSPORT="H4"
fi
2009-07-11 09:42:53 +00:00
# validate USB support
2009-07-11 09:36:29 +00:00
if test "x$HCI_TRANSPORT" = xUSB; then
2009-07-11 09:42:53 +00:00
# pkg-config needed
PKG_PROG_PKG_CONFIG
# libusb installed?
2010-07-01 19:24:29 +00:00
PKG_CHECK_MODULES([LIBUSB], [libusb-1.0], HAVE_LIBUSB="yes", HAVE_LIBUSB="no")
2009-07-11 09:42:53 +00:00
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
2009-07-09 20:00:44 +00:00
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
2009-07-11 09:36:29 +00:00
CFLAGS="$CFLAGS $LIBUSB_CFLAGS"
LDFLAGS="$LDFLAGS $LIBUSB_LIBS"
2009-07-09 20:00:44 +00:00
fi
2009-07-11 09:42:53 +00:00
AM_CONDITIONAL(HAVE_LIBUSB, [test "x$HAVE_LIBUSB" == "xyes"])
2009-07-09 20:00:44 +00:00
echo
2009-07-10 19:08:22 +00:00
echo "BTstack configured for HCI $HCI_TRANSPORT Transport"
2011-06-04 15:06:30 +00:00
HAVE_SO_NOSIGPIPE="no"
2010-07-04 13:56:43 +00:00
RUN_LOOP_SOURCES="run_loop_posix.c run_loop_embedded.c"
2009-10-07 20:17:19 +00:00
case "$host_os" in
darwin*)
RUN_LOOP_SOURCES="$RUN_LOOP_SOURCES run_loop_cocoa.m"
2010-09-01 22:08:53 +00:00
LDFLAGS="$LDFLAGS -framework CoreFoundation -framework Foundation"
2009-10-07 20:17:19 +00:00
USE_COCOA_RUN_LOOP="yes"
2009-11-23 20:28:00 +00:00
BTSTACK_LIB_LDFLAGS="-dynamiclib -install_name \$(prefix)/lib/libBTstack.dylib"
BTSTACK_LIB_EXTENSION="dylib"
2010-09-01 22:08:53 +00:00
REMOTE_DEVICE_DB_SOURCES="remote_device_db_iphone.m"
REMOTE_DEVICE_DB="remote_device_db_iphone"
2011-06-04 15:06:30 +00:00
HAVE_SO_NOSIGPIPE="yes";
2009-10-07 20:17:19 +00:00
;;
*)
2009-11-23 19:56:28 +00:00
USE_COCOA_RUN_LOOP="no"
2009-11-23 20:28:00 +00:00
BTSTACK_LIB_LDFLAGS="-shared -Wl,-rpath,\$(prefix)/lib"
BTSTACK_LIB_EXTENSION="so"
2011-06-04 15:13:14 +00:00
REMOTE_DEVICE_DB_SOURCES="remote_device_db_memory.c"
2011-06-04 14:54:40 +00:00
REMOTE_DEVICE_DB="remote_device_db_memory"
2009-10-07 20:17:19 +00:00
;;
esac
2009-07-10 19:08:22 +00:00
# iPhone/iPod touch cross-compilation for darwin
2009-07-11 10:37:48 +00:00
SDK_PATH="$DEVELOPER_PATH/SDKs/iPhoneOS$SDK_VERSION.sdk"
2009-07-10 19:08:22 +00:00
if test "x$target" = xiphone; then
2010-08-16 20:06:40 +00:00
# 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
2011-06-04 14:51:24 +00:00
REMOTE_DEVICE_DB_SOURCES="remote_device_db_iphone.m"
REMOTE_DEVICE_DB="remote_device_db_iphone"
USE_COCOA_RUN_LOOP="yes"
2011-06-04 15:06:30 +00:00
HAVE_SO_NOSIGPIPE="yes";
2011-06-04 15:25:59 +00:00
PLATFORM_SOURCES="bt_control_iphone.m platform_iphone.m"
2011-06-04 14:51:24 +00:00
2009-07-11 10:37:48 +00:00
case "$host_os" in
darwin*)
2010-03-02 20:09:12 +00:00
echo "Cross-compiling for iPhone/iPod touch using Apple's iPhone SDK $SDK_VERSION, GCC $GCC_VERSION"
echo "SDK path: $SDK_PATH"
2009-07-11 10:37:48 +00:00
echo "iPhone IP for install-iphone target: $IPHONE_IP"
2011-06-04 14:51:24 +00:00
2010-07-01 19:22:58 +00:00
CC="$DEVELOPER_PATH/usr/bin/arm-apple-darwin$darwin_v-gcc-$GCC_VERSION"
OBJC="$DEVELOPER_PATH/usr/bin/arm-apple-darwin$darwin_v-g++-$GCC_VERSION"
2009-07-11 10:37:48 +00:00
CFLAGS="$CFLAGS -g"
2009-08-19 19:06:47 +00:00
CPPFLAGS="$CPPFLAGS -I$SDK_PATH/usr/include"
2010-07-01 19:22:58 +00:00
CPPFLAGS="$CPPFLAGS -I$SDK_PATH/usr/lib/gcc/arm-apple-darwin$darwin_v/$GCC_VERSION/include"
2009-08-19 19:06:47 +00:00
CPPFLAGS="$CPPFLAGS -F$SDK_PATH/System/Library/Frameworks"
2010-03-02 20:09:12 +00:00
LDFLAGS="$LDFLAGS -F$SDK_PATH/System/Library/Frameworks"
LDFLAGS="$LDFLAGS -L$SDK_PATH/usr/lib -framework Foundation -framework CoreFoundation -framework UIKit"
LDFLAGS="$LDFLAGS -L$SDK_PATH/System/Library/Frameworks/IOKit.framework/Versions/A"
LDFLAGS="$LDFLAGS $SDK_PATH/System/Library/PrivateFrameworks/BluetoothManager.framework/BluetoothManager"
LDFLAGS="$LDFLAGS -lIOKit -lobjc"
;;
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"
2010-03-23 08:35:50 +00:00
2011-06-04 14:51:24 +00:00
# also have cocoa run loop
RUN_LOOP_SOURCES="$RUN_LOOP_SOURCES run_loop_cocoa.m"
2010-03-23 08:35:50 +00:00
# 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
2010-07-01 19:22:58 +00:00
CC="$DEVELOPER_PATH/pre/bin/arm-apple-darwin$darwin_v-gcc-$GCC_VERSION"
OBJC="$DEVELOPER_PATH/pre/bin/arm-apple-darwin$darwin_v-g++"
2010-03-02 20:09:12 +00:00
CFLAGS="$CFLAGS -g"
CPPFLAGS="$CPPFLAGS -I$SDK_PATH/usr/include"
2010-07-01 19:22:58 +00:00
CPPFLAGS="$CPPFLAGS -I$SDK_PATH/usr/lib/gcc/arm-apple-darwin$darwin_v/$GCC_VERSION/include"
2010-03-02 20:09:12 +00:00
CPPFLAGS="$CPPFLAGS -F$SDK_PATH/System/Library/Frameworks"
2009-08-19 19:06:47 +00:00
LDFLAGS="$LDFLAGS -F$SDK_PATH/System/Library/Frameworks"
2010-01-23 22:43:42 +00:00
LDFLAGS="$LDFLAGS -L$SDK_PATH/usr/lib -framework Foundation -framework CoreFoundation -framework UIKit"
2009-07-11 10:37:48 +00:00
LDFLAGS="$LDFLAGS -L$SDK_PATH/System/Library/Frameworks/IOKit.framework/Versions/A"
2010-01-10 13:21:19 +00:00
LDFLAGS="$LDFLAGS $SDK_PATH/System/Library/PrivateFrameworks/BluetoothManager.framework/BluetoothManager"
2010-02-08 19:01:28 +00:00
LDFLAGS="$LDFLAGS -lIOKit -lobjc"
2011-06-04 14:51:24 +00:00
BTSTACK_LIB_LDFLAGS="-dynamiclib -install_name \$(prefix)/lib/libBTstack.dylib"
BTSTACK_LIB_EXTENSION="dylib"
2009-07-11 10:37:48 +00:00
;;
*)
AC_MSG_ERROR(Don't know how to compile without Apple's iPhone SDK, sorry.)
;;
esac
2009-07-10 19:08:22 +00:00
if test "x$UART_DEVICE" = xDEFAULT ; then
2010-08-23 21:07:45 +00:00
UART_DEVICE=/dev/tty.bluetooth
2009-07-10 19:08:22 +00:00
fi
if test "x$USE_BLUETOOL" = xDEFAULT ; then
USE_BLUETOOL="yes"
2009-08-28 20:37:48 +00:00
echo "USE_BLUETOOL: $USE_BLUETOOL"
2009-07-10 19:08:22 +00:00
fi
2009-10-07 20:17:19 +00:00
2009-08-15 21:31:23 +00:00
if test "x$USE_SPRINGBOARD" = xDEFAULT ; then
USE_SPRINGBOARD="yes"
fi
2009-08-28 20:37:48 +00:00
2009-09-28 20:53:02 +00:00
if test "x$USE_LDID" = xyes ; then
USE_LDID=""
echo "USE_LDID: yes"
else
USE_LDID="#"
echo "USE_LDID: no"
2010-08-30 17:42:23 +00:00
fi
2011-06-04 15:25:59 +00:00
2009-07-10 19:08:22 +00:00
else
2010-03-02 20:34:32 +00:00
case "$host_os" in
darwin*)
# on Mac, create universal - helps to build 32-bit iPhone Simulator apps on 64-bit machines
LDFLAGS="$LDFLAGS -arch ppc -arch i386 -arch x86_64 -framework CoreFoundation"
;;
esac
2009-10-05 21:52:43 +00:00
USE_LDID="#"
2009-07-16 19:00:56 +00:00
if test "x$UART_DEVICE" = xDEFAULT ; then
2009-07-10 19:08:22 +00:00
UART_DEVICE=/dev/ttyS0
fi
2009-10-07 20:17:19 +00:00
if test "x$USE_SPRINGBOARD" = xDEFAULT ; then
USE_SPRINGBOARD="no"
fi
2009-07-10 19:08:22 +00:00
fi
2009-10-07 20:17:19 +00:00
2011-06-06 14:35:23 +00:00
# treat warnings seriously
CPPFLAGS="$CPPFLAGS -Werror -Wall -Wpointer-arith -Wstrict-prototypes"
2009-09-15 21:11:28 +00:00
AM_CONDITIONAL(USE_SPRINGBOARD, [test "x$USE_SPRINGBOARD" == "xyes"])
2010-06-08 20:53:15 +00:00
AM_CONDITIONAL(USE_BLUETOOL, [test "x$USE_BLUETOOL" == "xyes"])
2011-04-30 20:11:20 +00:00
AM_CONDITIONAL(USE_PREFSBUNDLE, [test "x$USE_PREFSBUNDLE" == "xyes"])
2009-07-10 19:08:22 +00:00
# summary
2011-06-06 14:35:23 +00:00
# echo "CFLAGS: $CFLAGS"
echo "CPPFLAGS: $CPPFLAGS"
echo "LDFLAGS: $LDFLAGS"
2009-07-11 09:36:29 +00:00
if test "x$HCI_TRANSPORT" = xUSB; then
2009-09-28 20:53:02 +00:00
echo "USB_PRODUCT_ID: $USB_PRODUCT_ID"
echo "USB_VENDOR_ID: $USB_VENDOR_ID"
echo "LIBUSB_CFLAGS: $LIBUSB_CFLAGS"
echo "LIBUSB_LIBS: $LIBUSB_LIBS"
2009-07-09 20:00:44 +00:00
else
2009-10-07 20:17:19 +00:00
echo "UART_DEVICE: $UART_DEVICE"
echo "UART_SPEED: $UART_SPEED"
2009-07-09 20:00:44 +00:00
fi
2009-10-07 20:17:19 +00:00
2011-06-06 14:35:23 +00:00
2011-06-04 15:25:59 +00:00
echo "PLATFORM_SOURCES: $PLATFORM_SOURCES"
2009-10-07 20:17:19 +00:00
echo "USE_LAUNCHD: $USE_LAUNCHD"
echo "USE_SPRINGBOARD: $USE_SPRINGBOARD"
2011-04-30 20:11:20 +00:00
echo "USE_PREFSBUNDLE: $USE_PREFSBUNDLE"
2009-10-07 20:17:19 +00:00
echo "USE_COCOA_RUN_LOOP: $USE_COCOA_RUN_LOOP"
2010-08-30 18:44:50 +00:00
echo "REMOTE_DEVICE_DB: $REMOTE_DEVICE_DB"
2011-06-04 15:06:30 +00:00
echo "HAVE_SO_NOSIGPIPE: $HAVE_SO_NOSIGPIPE"
2009-10-07 20:17:19 +00:00
echo
2009-07-09 20:00:44 +00:00
echo
# create config.h
echo "// config.h created by configure for BTstack " `date`> config.h
2009-07-11 09:36:29 +00:00
if test "x$HCI_TRANSPORT" = xUSB; then
2009-10-17 22:38:48 +00:00
USB_SOURCES=hci_transport_usb.c
2009-07-09 20:00:44 +00:00
echo "#define HAVE_TRANSPORT_USB" >> config.h
2009-07-11 10:37:48 +00:00
echo "#define USB_PRODUCT_ID $USB_PRODUCT_ID" >> config.h
echo "#define USB_VENDOR_ID $USB_VENDOR_ID" >> config.h
2009-07-09 20:00:44 +00:00
else
echo "#define HAVE_TRANSPORT_H4" >> config.h
2009-07-11 10:37:48 +00:00
echo "#define UART_DEVICE \"$UART_DEVICE\"" >> config.h
echo "#define UART_SPEED $UART_SPEED" >> config.h
2009-07-10 19:08:22 +00:00
if test "x$USE_BLUETOOL" = xyes; then
echo "#define USE_BLUETOOL" >> config.h
fi
2009-10-07 20:17:19 +00:00
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
2009-07-09 20:00:44 +00:00
fi
2010-07-04 16:20:27 +00:00
echo "#define USE_POSIX_RUN_LOOP" >> config.h
2010-07-04 16:30:50 +00:00
echo "#define HAVE_SDP" >> config.h
2011-04-30 20:30:05 +00:00
echo "#define HAVE_RFCOMM" >> config.h
2010-08-30 19:55:59 +00:00
if test ! -z "$REMOTE_DEVICE_DB" ; then
echo "#define REMOTE_DEVICE_DB $REMOTE_DEVICE_DB" >> config.h
2010-08-30 17:42:23 +00:00
fi
2011-06-04 15:06:30 +00:00
if test "x$HAVE_SO_NOSIGPIPE" == xyes ; then
echo "#define HAVE_SO_NOSIGPIPE" >> config.h
fi
2011-06-05 09:52:03 +00:00
# often not present for embedded
echo "#define HAVE_TIME" >> config.h
echo "#define HAVE_BZERO" >> config.h
2009-07-11 10:37:48 +00:00
AC_SUBST(IPHONE_IP)
2009-07-09 20:00:44 +00:00
AC_SUBST(HAVE_LIBUSB)
2009-09-28 20:53:02 +00:00
AC_SUBST(USE_LDID)
2010-08-30 18:44:50 +00:00
AC_SUBST(REMOTE_DEVICE_DB_SOURCES)
2009-10-17 22:38:48 +00:00
AC_SUBST(USB_SOURCES)
2011-06-04 15:25:59 +00:00
AC_SUBST(PLATFORM_SOURCES)
2009-09-22 22:31:58 +00:00
AC_SUBST(SPRINGBOARD_ACCESS_SOURCES)
2009-10-07 20:17:19 +00:00
AC_SUBST(RUN_LOOP_SOURCES)
2011-06-06 14:35:23 +00:00
AC_SUBST(CFLAGS)
AC_SUBST(CPPFLAGS)
2009-11-23 20:28:00 +00:00
AC_SUBST(BTSTACK_LIB_LDFLAGS)
AC_SUBST(BTSTACK_LIB_EXTENSION)
2010-06-08 20:53:15 +00:00
AC_OUTPUT(Makefile src/Makefile example/Makefile PatchBlueTool/Makefile SpringBoardAccess/Makefile)