Files

92 lines
3.7 KiB
Diff

# Adjusted version of https://lore.kernel.org/linux-bluetooth/20250703182908.2370130-1-hi@alyssa.is/raw
diff --git a/Makefile.tools b/Makefile.tools
index 2080f0978..885371de9 100644
--- a/Makefile.tools
+++ b/Makefile.tools
@@ -19,7 +19,7 @@ client_bluetoothctl_SOURCES = client/main.c \
client/telephony.h client/telephony.c
client_bluetoothctl_LDADD = lib/libbluetooth-internal.la \
gdbus/libgdbus-internal.la src/libshared-glib.la \
- $(GLIB_LIBS) $(DBUS_LIBS) -lreadline
+ $(GLIB_LIBS) $(DBUS_LIBS) $(READLINE_LIBS)
endif
if ZSH_COMPLETIONS
@@ -385,7 +385,7 @@ tools_meshctl_SOURCES = tools/meshctl.c \
tools/mesh-gatt/onoff-model.c
tools_meshctl_LDADD = gdbus/libgdbus-internal.la src/libshared-glib.la \
lib/libbluetooth-internal.la \
- $(GLIB_LIBS) $(DBUS_LIBS) -ljson-c -lreadline
+ $(GLIB_LIBS) $(DBUS_LIBS) -ljson-c $(READLINE_LIBS)
EXTRA_DIST += tools/mesh-gatt/local_node.json tools/mesh-gatt/prov_db.json
endif
@@ -404,7 +404,7 @@ tools_mesh_cfgclient_SOURCES = tools/mesh-cfgclient.c \
mesh/crypto.h mesh/crypto.c
tools_mesh_cfgclient_LDADD = lib/libbluetooth-internal.la src/libshared-ell.la \
- $(ell_ldadd) -ljson-c -lreadline
+ $(ell_ldadd) -ljson-c $(READLINE_LIBS)
bin_PROGRAMS += tools/mesh-cfgtest
@@ -512,7 +512,7 @@ noinst_PROGRAMS += tools/btmgmt tools/obex-client-tool tools/obex-server-tool \
tools_obex_client_tool_SOURCES = $(gobex_sources) $(btio_sources) \
tools/obex-client-tool.c
tools_obex_client_tool_LDADD = lib/libbluetooth-internal.la \
- src/libshared-glib.la $(GLIB_LIBS) -lreadline
+ src/libshared-glib.la $(GLIB_LIBS) $(READLINE_LIBS)
tools_obex_server_tool_SOURCES = $(gobex_sources) $(btio_sources) \
tools/obex-server-tool.c
@@ -523,16 +523,16 @@ tools_bluetooth_player_SOURCES = tools/bluetooth-player.c client/print.c \
client/player.c
tools_bluetooth_player_LDADD = gdbus/libgdbus-internal.la \
src/libshared-glib.la \
- $(GLIB_LIBS) $(DBUS_LIBS) -lreadline
+ $(GLIB_LIBS) $(DBUS_LIBS) $(READLINE_LIBS)
tools_obexctl_SOURCES = tools/obexctl.c
tools_obexctl_LDADD = gdbus/libgdbus-internal.la src/libshared-glib.la \
- $(GLIB_LIBS) $(DBUS_LIBS) -lreadline
+ $(GLIB_LIBS) $(DBUS_LIBS) $(READLINE_LIBS)
tools_btmgmt_SOURCES = tools/btmgmt.c src/uuid-helper.c client/display.c \
client/mgmt.c
tools_btmgmt_LDADD = lib/libbluetooth-internal.la src/libshared-glib.la \
- $(GLIB_LIBS) -lreadline
+ $(GLIB_LIBS) $(READLINE_LIBS)
if DEPRECATED
noinst_PROGRAMS += attrib/gatttool
@@ -542,7 +542,7 @@ attrib_gatttool_SOURCES = attrib/gatttool.c attrib/att.c attrib/gatt.c \
attrib/utils.c src/log.c client/display.c \
client/display.h
attrib_gatttool_LDADD = lib/libbluetooth-internal.la \
- src/libshared-glib.la $(GLIB_LIBS) -lreadline
+ src/libshared-glib.la $(GLIB_LIBS) $(READLINE_LIBS)
endif
endif
@@ -592,5 +592,5 @@ tools/btpclient.$(OBJEXT): src/libshared-ell.la ell/internal
tools_btpclientctl_SOURCES = tools/btpclientctl.c client/display.c
tools_btpclientctl_LDADD = src/libshared-mainloop.la src/libshared-glib.la \
- lib/libbluetooth-internal.la -lreadline
+ lib/libbluetooth-internal.la $(READLINE_LIBS)
endif
diff --git a/configure.ac b/configure.ac
index 52de7d665..f110ab103 100644
--- a/configure.ac
+++ b/configure.ac
@@ -338,8 +338,7 @@ AC_ARG_ENABLE(client, AS_HELP_STRING([--disable-client],
AM_CONDITIONAL(CLIENT, test "${enable_client}" != "no")
if (test "${enable_client}" != "no" || test "${enable_mesh}" = "yes"); then
- AC_CHECK_HEADERS(readline/readline.h, enable_readline=yes,
- AC_MSG_ERROR(readline header files are required))
+ PKG_CHECK_MODULES([READLINE], [readline], enable_readline=yes)
fi
AM_CONDITIONAL(READLINE, test "${enable_readline}" = "yes")