diff --git a/configure.ac b/configure.ac index c968d14..5b2793e 100644 --- a/configure.ac +++ b/configure.ac @@ -2205,16 +2205,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 linux/wait.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 bd5f736..9381135 100644 --- a/setup.py +++ b/setup.py @@ -1127,6 +1127,7 @@ class PyBuildExt(build_ext): libraries=libs)) def detect_socket(self): + bluetooth_includes = [@bluetoothdir@] # socket(2) if not VXWORKS: kwargs = {'depends': ['socketmodule.h']} @@ -1134,12 +1135,15 @@ class PyBuildExt(build_ext): # Issue #35569: Expose RFC 3542 socket options. kwargs['extra_compile_args'] = ['-D__APPLE_USE_RFC_3542'] - self.add(Extension('_socket', ['socketmodule.c'], **kwargs)) + self.add(Extension('_socket', ['socketmodule.c'], + include_dirs=bluetooth_includes, + **kwargs)) 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 @@ -2322,6 +2326,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: