2009-07-09 20:00:44 +00:00
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
AC_PREREQ(2.60)
2014-09-04 19:57:29 +00:00
AC_INIT([BTstack], 0.1)
2009-09-15 19:43:17 +00:00
AC_CONFIG_AUX_DIR(config)
2014-09-04 19:57:29 +00:00
AM_INIT_AUTOMAKE
2009-07-09 20:00:44 +00:00
2014-09-04 19:24:00 +00:00
AC_ARG_WITH(hci-transport, [AS_HELP_STRING([--with-hci-transport=transportType], [Specify BT type to use: h4, usb])], 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")
2011-08-04 21:25:43 +00:00
AC_ARG_ENABLE(powermanagement, [AS_HELP_STRING([--disable-powermanagement],[Disable powermanagement])], USE_POWERMANAGEMENT=$enableval, USE_POWERMANAGEMENT="yes")
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")
2013-06-04 10:10:50 +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="0")
2014-09-04 15:29:15 +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="0")
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
2014-09-04 19:24:00 +00:00
# iPhone/iPod touch cross-compilation uses theos
SDK_PATH="$DEVELOPER_PATH/SDKs/iPhoneOS$SDK_VERSION.sdk"
if test "x$target" = xiphone; then
echo "Cross-compiling for iPhone/iPod touch uses theos"
./config-iphone.sh
exit 0
fi
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
2014-09-18 21:01:07 +00:00
LIBUSB_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"
2014-09-04 19:24:00 +00:00
# from platform/posix/src
BTSTACK_ROOT="../../../"
RUN_LOOP_SOURCES="$BTSTACK_ROOT/platforms/posix/src/run_loop_posix.c"
2009-10-07 20:17:19 +00:00
case "$host_os" in
darwin*)
2014-09-04 19:24:00 +00:00
RUN_LOOP_SOURCES="$RUN_LOOP_SOURCES $BTSTACK_ROOT/platforms/cocoa/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"
2014-09-04 19:24:00 +00:00
REMOTE_DEVICE_DB_SOURCES="$BTSTACK_ROOT/platforms/cocoa/remote_device_db_cocoa.m"
2010-09-01 22:08:53 +00:00
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
;;
2014-11-09 21:49:42 +00:00
mingw*)
echo "Building on mingw32"
USE_COCOA_RUN_LOOP="no"
LDFLAGS="$LDFLAGS -lws2_32"
BTSTACK_LIB_LDFLAGS="-shared"
BTSTACK_LIB_EXTENSION="dll"
REMOTE_DEVICE_DB_SOURCES="$BTSTACK_ROOT/src/remote_device_db_memory.c"
REMOTE_DEVICE_DB="remote_device_db_memory"
;;
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"
2014-09-07 20:00:37 +00:00
REMOTE_DEVICE_DB_SOURCES="$BTSTACK_ROOT/src/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
2011-06-06 14:35:23 +00:00
# treat warnings seriously
2014-09-18 20:54:40 +00:00
CFLAGS="$CFLAGS -Werror -Wall -Wpointer-arith"
2011-06-06 14:35:23 +00:00
2011-08-04 21:25:43 +00:00
AM_CONDITIONAL(USE_POWERMANAGEMENT, [test "x$USE_POWERMANAGEMENT" == "xyes"])
2009-07-10 19:08:22 +00:00
# summary
2011-06-06 14:35:23 +00:00
2011-10-31 18:37:00 +00:00
echo "CC: $CC"
2014-09-18 20:54:40 +00:00
echo "CFLAGS: $CFLAGS"
2011-06-06 14:35:23 +00:00
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"
2014-09-18 21:01:07 +00:00
echo "LIBUSB_LDFLAGS: $LIBUSB_LDFLAGS"
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-08-04 21:25:43 +00:00
echo "USE_POWERMANAGEMENT: $USE_POWERMANAGEMENT"
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
2014-01-19 16:45:57 +00:00
# create btstack-config.h
2014-08-15 21:30:40 +00:00
rm -f btstack-config.h
2014-10-14 20:00:04 +00:00
echo "//" >> btstack-config.h
echo "// btstack-config.h" >> btstack-config.h
echo "// created by configure for BTstack " >> btstack-config.h
echo "//" `date` >> btstack-config.h
echo "//" >> btstack-config.h
echo >> btstack-config.h
echo "#ifndef __BTSTACK_CONFIG" >> btstack-config.h
echo "#define __BTSTACK_CONFIG" >> btstack-config.h
echo >> btstack-config.h
2009-07-11 09:36:29 +00:00
if test "x$HCI_TRANSPORT" = xUSB; then
2014-09-07 20:00:37 +00:00
USB_SOURCES=hci_transport_h2_libusb.c
2014-01-19 16:45:57 +00:00
echo "#define HAVE_TRANSPORT_USB" >> btstack-config.h
echo "#define USB_PRODUCT_ID $USB_PRODUCT_ID" >> btstack-config.h
echo "#define USB_VENDOR_ID $USB_VENDOR_ID" >> btstack-config.h
2009-07-09 20:00:44 +00:00
else
2014-01-19 16:45:57 +00:00
echo "#define HAVE_TRANSPORT_H4" >> btstack-config.h
echo "#define UART_DEVICE \"$UART_DEVICE\"" >> btstack-config.h
echo "#define UART_SPEED $UART_SPEED" >> btstack-config.h
2009-07-10 19:08:22 +00:00
if test "x$USE_BLUETOOL" = xyes; then
2014-01-19 16:45:57 +00:00
echo "#define USE_BLUETOOL" >> btstack-config.h
2009-07-10 19:08:22 +00:00
fi
2011-08-04 21:25:43 +00:00
if test "x$USE_POWERMANAGEMENT" = xyes; then
2014-01-19 16:45:57 +00:00
echo "#define USE_POWERMANAGEMENT" >> btstack-config.h
2011-08-04 21:25:43 +00:00
fi
2009-10-07 20:17:19 +00:00
fi
if test "x$USE_COCOA_RUN_LOOP" = xyes; then
2014-01-19 16:45:57 +00:00
echo "#define USE_COCOA_RUN_LOOP" >> btstack-config.h
2009-07-09 20:00:44 +00:00
fi
2014-01-19 16:45:57 +00:00
echo "#define USE_POSIX_RUN_LOOP" >> btstack-config.h
echo "#define HAVE_SDP" >> btstack-config.h
echo "#define HAVE_RFCOMM" >> btstack-config.h
2010-08-30 19:55:59 +00:00
if test ! -z "$REMOTE_DEVICE_DB" ; then
2014-01-19 16:45:57 +00:00
echo "#define REMOTE_DEVICE_DB $REMOTE_DEVICE_DB" >> btstack-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
2014-01-19 16:45:57 +00:00
echo "#define HAVE_SO_NOSIGPIPE" >> btstack-config.h
2011-06-04 15:06:30 +00:00
fi
2011-06-05 09:52:03 +00:00
# often not present for embedded
2014-01-19 16:45:57 +00:00
echo "#define HAVE_TIME" >> btstack-config.h
echo "#define HAVE_MALLOC" >> btstack-config.h
echo "#define HAVE_BZERO" >> btstack-config.h
2014-06-03 20:56:58 +00:00
echo "#define HAVE_BLE" >> btstack-config.h
2014-01-19 16:45:57 +00:00
echo "#define ENABLE_LOG_INFO " >> btstack-config.h
echo "#define ENABLE_LOG_ERROR" >> btstack-config.h
echo "#define HCI_ACL_PAYLOAD_SIZE 1021" >> btstack-config.h
2014-01-19 17:23:08 +00:00
echo "#define SDP_DES_DUMP" >> btstack-config.h
2014-10-14 20:00:04 +00:00
echo >> btstack-config.h
echo "#endif" >> btstack-config.h
2011-06-05 09:52:03 +00:00
2009-07-09 20:00:44 +00:00
AC_SUBST(HAVE_LIBUSB)
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)
2009-10-07 20:17:19 +00:00
AC_SUBST(RUN_LOOP_SOURCES)
2011-06-06 14:35:23 +00:00
AC_SUBST(CFLAGS)
2014-09-18 21:01:07 +00:00
AC_SUBST(CPPFLAGS)
2009-11-23 20:28:00 +00:00
AC_SUBST(BTSTACK_LIB_LDFLAGS)
AC_SUBST(BTSTACK_LIB_EXTENSION)
2014-09-18 21:01:07 +00:00
AC_SUBST(LIBUSB_CFLAGS)
AC_SUBST(LIBUSB_LDFLAGS)
2014-09-23 07:29:25 +00:00
AC_OUTPUT(Makefile platforms/posix/src/Makefile example/daemon/Makefile)