[PATCH BlueZ] build: use pkg-config to find readline

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hardcoding -lreadline won't do the right thing when other libraries
need to be linked too, which is the case when static linking.
pkg-config can take care of finding the right libraries for us, so use
it instead of checking for headers.
---
 Makefile.tools | 18 +++++++++---------
 configure.ac   |  3 +--
 2 files changed, 10 insertions(+), 11 deletions(-)

diff --git a/Makefile.tools b/Makefile.tools
index e60c31b1d..6d7fcffa1 100644
--- a/Makefile.tools
+++ b/Makefile.tools
@@ -18,7 +18,7 @@ client_bluetoothctl_SOURCES = client/main.c \
 					client/hci.h client/hci.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
@@ -380,7 +380,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
@@ -399,7 +399,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
 
@@ -506,7 +506,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
@@ -517,16 +517,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-mainloop.la \
-				-lreadline
+				$(READLINE_LIBS)
 if DEPRECATED
 noinst_PROGRAMS += attrib/gatttool
 
@@ -536,7 +536,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
@@ -586,5 +586,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 10d63d67f..cae4e6f0c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -330,8 +330,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")
 

base-commit: 50fb9042e1ad471115e21ed83daebae278594aa7
-- 
2.49.0





[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux