From acf0b5e279d7a5154c32cac5e0ca820685bd01de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arsen=20Arsenovi=C4=87?= Date: Sun, 27 Nov 2022 16:08:38 +0100 Subject: [PATCH] configure: Add --with s for automagic dependencies --- Upstreamed after release, see https://gitlab.com/nbdkit/nbdkit/-/merge_requests/18/pipelines configure.ac | 109 +++++++++++++++++++++++++++++++++++---------------- 1 file changed, 76 insertions(+), 33 deletions(-) diff --git a/configure.ac b/configure.ac index c379edfb..5a64ed88 100644 --- a/configure.ac +++ b/configure.ac @@ -604,22 +604,40 @@ AC_MSG_RESULT([$is_glibc_234]) AM_CONDITIONAL([HAVE_GLIBC_234], [test "x$is_glibc_234" = "xyes"]) dnl Check for SELinux socket labelling (optional). -PKG_CHECK_MODULES([LIBSELINUX], [libselinux], [ - AC_SUBST([LIBSELINUX_CFLAGS]) - AC_SUBST([LIBSELINUX_LIBS]) - AC_DEFINE([HAVE_LIBSELINUX],[1],[libselinux found at compile time.]) -], [ - AC_MSG_WARN([libselinux not found, SELinux socket labelling support will be disabled.]) +AC_ARG_WITH([selinux], + AS_HELP_STRING([--without-selinux], [disable SELinux support, used for socket labelling @<:@default=check@:>@])) +AS_IF([test "x$with_selinux" != xno], [ + PKG_CHECK_MODULES([LIBSELINUX], [libselinux], [ + AC_SUBST([LIBSELINUX_CFLAGS]) + AC_SUBST([LIBSELINUX_LIBS]) + AC_DEFINE([HAVE_LIBSELINUX],[1],[libselinux found at compile time.]) + ], [AC_MSG_WARN([libselinux not found, sockets will not be labeled.])]) +]) + +AS_IF([test "x$with_selinux" = xyes && test "x$LIBSELINUX_LIBS" = x], [ + AC_MSG_ERROR([selinux requested but not found]) ]) dnl Check for GnuTLS (optional, for TLS support). -PKG_CHECK_MODULES([GNUTLS], [gnutls >= 3.3.0], [ - AC_SUBST([GNUTLS_CFLAGS]) - AC_SUBST([GNUTLS_LIBS]) - AC_DEFINE([HAVE_GNUTLS],[1],[gnutls found at compile time.]) -], [ - AC_MSG_WARN([gnutls not found or < 3.3.0, TLS support will be disabled.]) +AC_ARG_WITH([gnutls], + [AS_HELP_STRING([--without-gnutls], [disable TLS support via GnuTLS @<:@default=check@:>@])], + [], + [: m4_divert_text([DEFAULTS], [with_manpages=check])]) + +AS_IF([test "x$with_gnutls" != xno], [ + PKG_CHECK_MODULES([GNUTLS], [gnutls >= 3.3.0], [ + AC_SUBST([GNUTLS_CFLAGS]) + AC_SUBST([GNUTLS_LIBS]) + AC_DEFINE([HAVE_GNUTLS],[1],[gnutls found at compile time.]) + ], [ + AC_MSG_WARN([gnutls not found or < 3.3.0, TLS support will be disabled.]) + ]) ]) + +AS_IF([test "x$with_gnutls" = xyes && test x"$GNUTLS_LIBS" = x], [ + AC_MSG_ERROR([gnutls requested but not found]) +]) + AM_CONDITIONAL([HAVE_GNUTLS], [test "x$GNUTLS_LIBS" != "x"]) AS_IF([test "x$GNUTLS_LIBS" != "x"],[ @@ -733,34 +751,59 @@ AM_CONDITIONAL([USE_LINKER_SCRIPT], [test "x$use_linker_script" = "xyes"]) dnl Bash completion. -PKG_CHECK_MODULES([BASH_COMPLETION], [bash-completion >= 2.0], [ - bash_completion=yes - AC_MSG_CHECKING([for bash-completions directory]) - m4_ifdef([PKG_CHECK_VAR],[ - PKG_CHECK_VAR(bashcompdir, [bash-completion], [completionsdir]) +AC_ARG_WITH([bash-completions], + [AS_HELP_STRING([--without-bash-completions], [disable installing bash completions @<:@default=check@:>@])], + [], + [: m4_divert_text([DEFAULTS], [with_readline=check])]) + +AS_IF([test "x$with_bash_completions" != xno], [ + PKG_CHECK_MODULES([BASH_COMPLETION], [bash-completion >= 2.0], [ + bash_completion=yes + AC_MSG_CHECKING([for bash-completions directory]) + m4_ifdef([PKG_CHECK_VAR],[ + PKG_CHECK_VAR(bashcompdir, [bash-completion], [completionsdir]) + ]) + AS_IF([test -z "$bashcompdir"], [ + bashcompdir="${sysconfdir}/bash_completion.d" + ]) + AC_MSG_RESULT([$bashcompdir]) + AC_SUBST([bashcompdir]) + ],[ + bash_completion=no + AC_MSG_WARN([bash-completion not installed]) ]) - AS_IF([test -z "$bashcompdir"], [ - bashcompdir="${sysconfdir}/bash_completion.d" - ]) - AC_MSG_RESULT([$bashcompdir]) - AC_SUBST([bashcompdir]) -],[ - bash_completion=no - AC_MSG_WARN([bash-completion not installed]) ]) + +AS_IF([test "x$bash_completion" = xno && test "x$with_bash_completions" = xyes], [ + AC_MSG_ERROR([bash-completions requested but required packages not found]) +]) + AM_CONDITIONAL([HAVE_BASH_COMPLETION],[test "x$bash_completion" = "xyes"]) dnl Check we have enough to run podwrapper. -AC_CHECK_PROG([PERL],[perl],[perl],[no]) -AS_IF([test "x$PERL" != "xno"],[ - AC_MSG_CHECKING([if we have perl Pod::Man and Pod::Simple]) - AS_IF([$PERL -MPod::Man -MPod::Simple -e 1 >&AS_MESSAGE_LOG_FD 2>&1],[ - enable_pod=yes - ],[ - enable_pod=no + +AC_ARG_WITH([manpages], + [AS_HELP_STRING([--without-manpages], [Do not build man pages @<:@default=check@:>@])], + [], + [: m4_divert_text([DEFAULTS], [with_manpages=check])]) + +enable_pod=no +AC_CHECK_PROGS([PERL], [perl], []) + +AS_IF([test "x$enable_manpages" != xno], [ + AS_IF([test "x$PERL" != "x"],[ + AC_MSG_CHECKING([if we have perl Pod::Man and Pod::Simple]) + AS_IF([$PERL -MPod::Man -MPod::Simple -e 1 >&AS_MESSAGE_LOG_FD 2>&1],[ + enable_pod=yes + ]) + AC_MSG_RESULT([$enable_pod]) ]) - AC_MSG_RESULT([$enable_pod]) ]) + +AS_IF([test "x$enable_pod" = xno && test "x$enable_manpages" = xyes], [ + AC_MSG_ERROR([man-pages requested but required packages not found]) +]) + AM_CONDITIONAL([HAVE_POD], [test "x$PERL" != "xno" && test "x$enable_pod" = "xyes"]) -- 2.38.1