Skip to content

Commit

Permalink
Make editline and lowdown optional in configure.ac
Browse files Browse the repository at this point in the history
  • Loading branch information
Ericson2314 committed Dec 20, 2023
1 parent 8e64cd5 commit a3d71fb
Showing 1 changed file with 45 additions and 9 deletions.
54 changes: 45 additions & 9 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -254,14 +254,29 @@ PKG_CHECK_MODULES([LIBCURL], [libcurl], [CXXFLAGS="$LIBCURL_CFLAGS $CXXFLAGS"])
# Look for editline, a required dependency.
# The the libeditline.pc file was added only in libeditline >= 1.15.2,
# see https://github.com/troglobit/editline/commit/0a8f2ef4203c3a4a4726b9dd1336869cd0da8607,
# but e.g. Ubuntu 16.04 has an older version, so we fall back to searching for
# editline.h when the pkg-config approach fails.
PKG_CHECK_MODULES([EDITLINE], [libeditline], [CXXFLAGS="$EDITLINE_CFLAGS $CXXFLAGS"], [
AC_CHECK_HEADERS([editline.h], [true],
[AC_MSG_ERROR([Nix requires libeditline; it was found neither via pkg-config nor its normal header.])])
AC_SEARCH_LIBS([readline read_history], [editline], [],
[AC_MSG_ERROR([Nix requires libeditline; it was not found via pkg-config, but via its header, but required functions do not work. Maybe it is too old? >= 1.14 is required.])])
])
# Older versions are no longer supported.
AC_ARG_ENABLE(
editline,
AS_HELP_STRING([--enable-editline],[Enable nice line editting in the nix repl [default=auto]]),
[],
[enable_editline=auto])
AS_CASE(["$enable_editline"],
[yes | auto],
[
PKG_CHECK_MODULES(
[EDITLINE],
[libeditline],
[CXXFLAGS="$EDITLINE_CFLAGS $CXXFLAGS"],
[
AS_IF([test "x$enable_editline" == "xyes"],[
AC_MSG_ERROR([You passed --enable-editline=yes, requiring libeditline, but it was not found.])
])
])
],
[no],
[],
[*],
[AC_MSG_ERROR([bad value $enable_editline for --enable-editline])])
# Look for libsodium.
PKG_CHECK_MODULES([SODIUM], [libsodium], [CXXFLAGS="$SODIUM_CFLAGS $CXXFLAGS"])
Expand Down Expand Up @@ -369,7 +384,28 @@ PKG_CHECK_MODULES([NLOHMANN_JSON], [nlohmann_json >= 3.9])
# Look for lowdown library.
PKG_CHECK_MODULES([LOWDOWN], [lowdown >= 0.9.0], [CXXFLAGS="$LOWDOWN_CFLAGS $CXXFLAGS"])
AC_ARG_ENABLE(
lowdown,
AS_HELP_STRING([--enable-lowdown],[Enable editline for in-process docs support]]),
[],
[enable_lowdown=auto])
AS_CASE(["$enable_lowdown"],
[yes | auto],
[
PKG_CHECK_MODULES(
[LOWDOWN],
[liblowdown >= 0.9.0],
[CXXFLAGS="$LOWDOWN_CFLAGS $CXXFLAGS"],
[
AS_IF([test "x$enable_lowdown" == "xyes"],[
AC_MSG_ERROR([You passed --enable-lowdown=yes, requiring liblowdown, but it was not found.])
])
])
],
[no],
[],
[*],
[AC_MSG_ERROR([bad value $enable_lowdown for --enable-lowdown])])
# Look for libgit2.
Expand Down

0 comments on commit a3d71fb

Please sign in to comment.