build: Allow building with libedit instead readline

This commit is contained in:
Marcel Holtmann 2023-04-21 06:33:02 +02:00
parent 8f668cc3a8
commit 8f0420c533
2 changed files with 26 additions and 8 deletions

View File

@ -150,6 +150,14 @@ ell_shared = ell/useful.h ell/asn1-private.h
ell_libell_internal_la_SOURCES = $(ell_headers) $(ell_sources) $(ell_shared)
endif
if LIBEDIT
client_cflags = $(LIBEDIT_CFLAGS)
client_ldadd = $(LIBEDIT_LIBS)
else
client_cflags =
client_ldadd = $(READLINE_LIBS)
endif
bin_PROGRAMS =
libexec_PROGRAMS =
noinst_PROGRAMS =
@ -308,7 +316,7 @@ client_iwctl_SOURCES = client/main.c \
src/util.c src/util.h \
src/band.c src/band.h
client_iwctl_LDADD = $(ell_ldadd) $(READLINE_LIBS)
client_iwctl_LDADD = $(ell_ldadd) $(client_ldadd)
if MANUAL_PAGES
man_MANS += client/iwctl.1
@ -544,7 +552,7 @@ unit_test_client_SOURCES = unit/test-client.c \
client/display.h client/display.c \
client/network.h client/network.c \
client/properties.h client/properties.c
unit_test_client_LDADD = $(ell_ldadd) $(READLINE_LIBS)
unit_test_client_LDADD = $(ell_ldadd) $(client_ldadd)
endif
unit_test_sae_SOURCES = unit/test-sae.c \
@ -586,7 +594,7 @@ EXTRA_DIST = src/genbuiltin src/iwd.service.in src/net.connman.iwd.service \
$(patsubst %.5,%.rst, \
$(patsubst %.8,%.rst,$(manual_pages))))
AM_CFLAGS = $(ell_cflags) -fvisibility=hidden \
AM_CFLAGS = $(ell_cflags) $(client_cflags) -fvisibility=hidden \
-DUNITDIR=\""$(top_srcdir)/unit/"\" \
-DCERTDIR=\""$(top_builddir)/unit/"\"

View File

@ -153,11 +153,17 @@ AC_ARG_ENABLE([client], AS_HELP_STRING([--disable-client],
[don't install iwctl client utility]),
[enable_client=${enableval}])
if (test "${enable_client}" != "no"); then
AC_CHECK_HEADERS(readline/readline.h, enable_readline=yes,
AC_MSG_ERROR(readline header files are required))
PKG_CHECK_MODULES(READLINE, readline, dummy=yes, READLINE_LIBS=-lreadline)
AC_SUBST(READLINE_CFLAGS)
AC_SUBST(READLINE_LIBS)
if (test "${enable_libedit}" = "yes"); then
PKG_CHECK_MODULES(LIBEDIT, libedit, dummy=yes,
AC_MSG_ERROR(Editline library is required))
AC_SUBST(LIBEDIT_CFLAGS)
AC_SUBST(LIBEDIT_LIBS)
else
PKG_CHECK_MODULES(READLINE, readline, dummy=yes,
AC_MSG_ERROR(Readline library is required))
AC_SUBST(READLINE_CFLAGS)
AC_SUBST(READLINE_LIBS)
fi
fi
AM_CONDITIONAL(CLIENT, test "${enable_client}" != "no")
@ -274,6 +280,10 @@ if (test "${enable_external_ell}" = "yes"); then
fi
AM_CONDITIONAL(EXTERNAL_ELL, test "${enable_external_ell}" = "yes")
AC_ARG_ENABLE([libedit], AS_HELP_STRING([--enable-libedit],
[enable Editline library instead of Readline]),
[enable_libedit=${enableval}])
AM_CONDITIONAL(LIBEDIT, test "${enable_libedit}" = "yes")
AC_ARG_ENABLE([wired], AS_HELP_STRING([--enable-wired],
[enable Ethernet authentication support]),