diff --git a/configure.ac b/configure.ac index e57ef7c..f15a4ea 100644 --- a/configure.ac +++ b/configure.ac @@ -2145,16 +2145,27 @@ sys/kern_control.h sys/loadavg.h sys/lock.h sys/mkdev.h sys/modem.h \ sys/param.h sys/random.h sys/select.h sys/sendfile.h sys/socket.h sys/statvfs.h \ sys/stat.h sys/syscall.h sys/sys_domain.h sys/termio.h sys/time.h \ sys/times.h sys/types.h sys/uio.h sys/un.h sys/utsname.h sys/wait.h pty.h \ -libutil.h sys/resource.h netpacket/packet.h sysexits.h bluetooth.h \ +libutil.h sys/resource.h netpacket/packet.h sysexits.h \ linux/tipc.h linux/random.h spawn.h util.h alloca.h endian.h \ sys/endian.h sys/sysmacros.h linux/memfd.h sys/memfd.h sys/mman.h) AC_HEADER_DIRENT AC_HEADER_MAJOR +AC_ARG_WITH([bluetoothdir], + [AS_HELP_STRING([--with-bluetoothdir=DIR], [Path to bluetooth/bluetooth.h header])], + [bluetoothdir=$withval], + [bluetoothdir=""]) + +if test "$bluetoothdir" != "" +then + BLUETOOTH_CFLAGS="-I$bluetoothdir" + AC_SUBST([BLUETOOTH_CFLAGS], [$BLUETOOTH_CFLAGS]) +fi + # bluetooth/bluetooth.h has been known to not compile with -std=c99. # http://permalink.gmane.org/gmane.linux.bluez.kernel/22294 SAVE_CFLAGS=$CFLAGS -CFLAGS="-std=c99 $CFLAGS" +CFLAGS="-std=c99 $CFLAGS $BLUETOOTH_CFLAGS" AC_CHECK_HEADERS(bluetooth/bluetooth.h) CFLAGS=$SAVE_CFLAGS diff --git a/setup.py b/setup.py index 20d7f35..5d8ab7e 100644 --- a/setup.py +++ b/setup.py @@ -1041,15 +1041,18 @@ class PyBuildExt(build_ext): libraries=libs)) def detect_socket(self): + bluetooth_includes = [@bluetoothdir@] # socket(2) if not VXWORKS: self.add(Extension('_socket', ['socketmodule.c'], - depends=['socketmodule.h'])) + depends=['socketmodule.h'], + include_dirs=bluetooth_includes)) elif self.compiler.find_library_file(self.lib_dirs, 'net'): libs = ['net'] self.add(Extension('_socket', ['socketmodule.c'], depends=['socketmodule.h'], - libraries=libs)) + libraries=libs, + include_dirs=bluetooth_includes)) def detect_dbm_gdbm(self): # Modules that provide persistent dictionary-like semantics. You will @@ -2203,6 +2206,7 @@ class PyBuildExt(build_ext): return [v.strip() for v in value.split(sep) if v.strip()] openssl_includes = split_var('OPENSSL_INCLUDES', '-I') + openssl_includes = openssl_includes + (@bluetoothdir@,) openssl_libdirs = split_var('OPENSSL_LDFLAGS', '-L') openssl_libs = split_var('OPENSSL_LIBS', '-l') if not openssl_libs: