diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 05:31:45 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 05:31:45 +0000 |
commit | 74aa0bc6779af38018a03fd2cf4419fe85917904 (patch) | |
tree | 9cb0681aac9a94a49c153d5823e7a55d1513d91f /src/external | |
parent | Initial commit. (diff) | |
download | sssd-74aa0bc6779af38018a03fd2cf4419fe85917904.tar.xz sssd-74aa0bc6779af38018a03fd2cf4419fe85917904.zip |
Adding upstream version 2.9.4.upstream/2.9.4
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/external')
47 files changed, 2141 insertions, 0 deletions
diff --git a/src/external/ax_valgrind_check.m4 b/src/external/ax_valgrind_check.m4 new file mode 100644 index 0000000..1c1c0cd --- /dev/null +++ b/src/external/ax_valgrind_check.m4 @@ -0,0 +1,235 @@ +# =========================================================================== +# https://www.gnu.org/software/autoconf-archive/ax_valgrind_check.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_VALGRIND_DFLT(memcheck|helgrind|drd|sgcheck, on|off) +# AX_VALGRIND_CHECK() +# +# DESCRIPTION +# +# AX_VALGRIND_CHECK checks whether Valgrind is present and, if so, allows +# running `make check` under a variety of Valgrind tools to check for +# memory and threading errors. +# +# Defines VALGRIND_CHECK_RULES which should be substituted in your +# Makefile; and $enable_valgrind which can be used in subsequent configure +# output. VALGRIND_ENABLED is defined and substituted, and corresponds to +# the value of the --enable-valgrind option, which defaults to being +# enabled if Valgrind is installed and disabled otherwise. Individual +# Valgrind tools can be disabled via --disable-valgrind-<tool>, the +# default is configurable via the AX_VALGRIND_DFLT command or is to use +# all commands not disabled via AX_VALGRIND_DFLT. All AX_VALGRIND_DFLT +# calls must be made before the call to AX_VALGRIND_CHECK. +# +# If unit tests are written using a shell script and automake's +# LOG_COMPILER system, the $(VALGRIND) variable can be used within the +# shell scripts to enable Valgrind, as described here: +# +# https://www.gnu.org/software/gnulib/manual/html_node/Running-self_002dtests-under-valgrind.html +# +# Usage example: +# +# configure.ac: +# +# AX_VALGRIND_DFLT([sgcheck], [off]) +# AX_VALGRIND_CHECK +# +# Makefile.am: +# +# @VALGRIND_CHECK_RULES@ +# VALGRIND_SUPPRESSIONS_FILES = my-project.supp +# EXTRA_DIST = my-project.supp +# +# This results in a "check-valgrind" rule being added to any Makefile.am +# which includes "@VALGRIND_CHECK_RULES@" (assuming the module has been +# configured with --enable-valgrind). Running `make check-valgrind` in +# that directory will run the module's test suite (`make check`) once for +# each of the available Valgrind tools (out of memcheck, helgrind and drd) +# while the sgcheck will be skipped unless enabled again on the +# commandline with --enable-valgrind-sgcheck. The results for each check +# will be output to test-suite-$toolname.log. The target will succeed if +# there are zero errors and fail otherwise. +# +# Alternatively, a "check-valgrind-$TOOL" rule will be added, for $TOOL in +# memcheck, helgrind, drd and sgcheck. These are useful because often only +# some of those tools can be ran cleanly on a codebase. +# +# The macro supports running with and without libtool. +# +# LICENSE +# +# Copyright (c) 2014, 2015, 2016 Philip Withnall <philip.withnall@collabora.co.uk> +# +# Copying and distribution of this file, with or without modification, are +# permitted in any medium without royalty provided the copyright notice +# and this notice are preserved. This file is offered as-is, without any +# warranty. + +#serial 15 + +dnl Configured tools +m4_define([valgrind_tool_list], [[memcheck], [helgrind], [drd], [sgcheck]]) +m4_set_add_all([valgrind_exp_tool_set], [sgcheck]) +m4_foreach([vgtool], [valgrind_tool_list], + [m4_define([en_dflt_valgrind_]vgtool, [on])]) + +AC_DEFUN([AX_VALGRIND_DFLT],[ + m4_define([en_dflt_valgrind_$1], [$2]) +])dnl + +AC_DEFUN([AX_VALGRIND_CHECK],[ + dnl Check for --enable-valgrind + AC_ARG_ENABLE([valgrind], + [AS_HELP_STRING([--enable-valgrind], [Whether to enable Valgrind on the unit tests])], + [enable_valgrind=$enableval],[enable_valgrind=]) + + AS_IF([test "$enable_valgrind" != "no"],[ + # Check for Valgrind. + AC_CHECK_PROG([VALGRIND],[valgrind],[valgrind]) + AS_IF([test "$VALGRIND" = ""],[ + AS_IF([test "$enable_valgrind" = "yes"],[ + AC_MSG_ERROR([Could not find valgrind; either install it or reconfigure with --disable-valgrind]) + ],[ + enable_valgrind=no + ]) + ],[ + enable_valgrind=yes + ]) + ]) + + AM_CONDITIONAL([VALGRIND_ENABLED],[test "$enable_valgrind" = "yes"]) + AC_SUBST([VALGRIND_ENABLED],[$enable_valgrind]) + + # Check for Valgrind tools we care about. + [valgrind_enabled_tools=] + m4_foreach([vgtool],[valgrind_tool_list],[ + AC_ARG_ENABLE([valgrind-]vgtool, + m4_if(m4_defn([en_dflt_valgrind_]vgtool),[off],dnl +[AS_HELP_STRING([--enable-valgrind-]vgtool, [Whether to use ]vgtool[ during the Valgrind tests])],dnl +[AS_HELP_STRING([--disable-valgrind-]vgtool, [Whether to skip ]vgtool[ during the Valgrind tests])]), + [enable_valgrind_]vgtool[=$enableval], + [enable_valgrind_]vgtool[=]) + AS_IF([test "$enable_valgrind" = "no"],[ + enable_valgrind_]vgtool[=no], + [test "$enable_valgrind_]vgtool[" ]dnl +m4_if(m4_defn([en_dflt_valgrind_]vgtool), [off], [= "yes"], [!= "no"]),[ + AC_CACHE_CHECK([for Valgrind tool ]vgtool, + [ax_cv_valgrind_tool_]vgtool,[ + ax_cv_valgrind_tool_]vgtool[=no + m4_set_contains([valgrind_exp_tool_set],vgtool, + [m4_define([vgtoolx],[exp-]vgtool)], + [m4_define([vgtoolx],vgtool)]) + AS_IF([`$VALGRIND --tool=]vgtoolx[ --help >/dev/null 2>&1`],[ + ax_cv_valgrind_tool_]vgtool[=yes + ]) + ]) + AS_IF([test "$ax_cv_valgrind_tool_]vgtool[" = "no"],[ + AS_IF([test "$enable_valgrind_]vgtool[" = "yes"],[ + AC_MSG_ERROR([Valgrind does not support ]vgtool[; reconfigure with --disable-valgrind-]vgtool) + ],[ + enable_valgrind_]vgtool[=no + ]) + ],[ + enable_valgrind_]vgtool[=yes + ]) + ]) + AS_IF([test "$enable_valgrind_]vgtool[" = "yes"],[ + valgrind_enabled_tools="$valgrind_enabled_tools ]m4_bpatsubst(vgtool,[^exp-])[" + ]) + AC_SUBST([ENABLE_VALGRIND_]vgtool,[$enable_valgrind_]vgtool) + ]) + AC_SUBST([valgrind_tools],["]m4_join([ ], valgrind_tool_list)["]) + AC_SUBST([valgrind_enabled_tools],[$valgrind_enabled_tools]) + +[VALGRIND_CHECK_RULES=' +# Valgrind check +# +# Optional: +# - VALGRIND_SUPPRESSIONS_FILES: Space-separated list of Valgrind suppressions +# files to load. (Default: empty) +# - VALGRIND_FLAGS: General flags to pass to all Valgrind tools. +# (Default: --num-callers=30) +# - VALGRIND_$toolname_FLAGS: Flags to pass to Valgrind $toolname (one of: +# memcheck, helgrind, drd, sgcheck). (Default: various) + +# Optional variables +VALGRIND_SUPPRESSIONS ?= $(addprefix --suppressions=,$(VALGRIND_SUPPRESSIONS_FILES)) +VALGRIND_FLAGS ?= --num-callers=30 +VALGRIND_memcheck_FLAGS ?= --leak-check=full --show-reachable=no +VALGRIND_helgrind_FLAGS ?= --history-level=approx +VALGRIND_drd_FLAGS ?= +VALGRIND_sgcheck_FLAGS ?= + +# Internal use +valgrind_log_files = $(addprefix test-suite-,$(addsuffix .log,$(valgrind_tools))) + +valgrind_memcheck_flags = --tool=memcheck $(VALGRIND_memcheck_FLAGS) +valgrind_helgrind_flags = --tool=helgrind $(VALGRIND_helgrind_FLAGS) +valgrind_drd_flags = --tool=drd $(VALGRIND_drd_FLAGS) +valgrind_sgcheck_flags = --tool=exp-sgcheck $(VALGRIND_sgcheck_FLAGS) + +valgrind_quiet = $(valgrind_quiet_$(V)) +valgrind_quiet_ = $(valgrind_quiet_$(AM_DEFAULT_VERBOSITY)) +valgrind_quiet_0 = --quiet +valgrind_v_use = $(valgrind_v_use_$(V)) +valgrind_v_use_ = $(valgrind_v_use_$(AM_DEFAULT_VERBOSITY)) +valgrind_v_use_0 = @echo " USE " $(patsubst check-valgrind-%,%,$''@):; + +# Support running with and without libtool. +ifneq ($(LIBTOOL),) +valgrind_lt = $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=execute +else +valgrind_lt = +endif + +# Use recursive makes in order to ignore errors during check +check-valgrind: +ifeq ($(VALGRIND_ENABLED),yes) + $(A''M_V_at)$(MAKE) $(AM_MAKEFLAGS) -k \ + $(foreach tool, $(valgrind_enabled_tools), check-valgrind-$(tool)) +else + @echo "Need to reconfigure with --enable-valgrind" +endif + +# Valgrind running +VALGRIND_TESTS_ENVIRONMENT = \ + $(TESTS_ENVIRONMENT) \ + env VALGRIND=$(VALGRIND) \ + G_SLICE=always-malloc,debug-blocks \ + G_DEBUG=fatal-warnings,fatal-criticals,gc-friendly + +VALGRIND_LOG_COMPILER = \ + $(valgrind_lt) \ + $(VALGRIND) $(VALGRIND_SUPPRESSIONS) --error-exitcode=1 $(VALGRIND_FLAGS) + +define valgrind_tool_rule = +check-valgrind-$(1): +ifeq ($$(VALGRIND_ENABLED)-$$(ENABLE_VALGRIND_$(1)),yes-yes) + $$(valgrind_v_use)$$(MAKE) check-TESTS \ + TESTS_ENVIRONMENT="$$(VALGRIND_TESTS_ENVIRONMENT)" \ + LOG_COMPILER="$$(VALGRIND_LOG_COMPILER)" \ + LOG_FLAGS="$$(valgrind_$(1)_flags)" \ + TEST_SUITE_LOG=test-suite-$(1).log +else ifeq ($$(VALGRIND_ENABLED),yes) + @echo "Need to reconfigure with --enable-valgrind-$(1)" +else + @echo "Need to reconfigure with --enable-valgrind" +endif +endef + +$(foreach tool,$(valgrind_tools),$(eval $(call valgrind_tool_rule,$(tool)))) + +A''M_DISTCHECK_CONFIGURE_FLAGS ?= +A''M_DISTCHECK_CONFIGURE_FLAGS += --disable-valgrind + +MOSTLYCLEANFILES ?= +MOSTLYCLEANFILES += $(valgrind_log_files) + +.PHONY: check-valgrind $(add-prefix check-valgrind-,$(valgrind_tools)) +'] + + AC_SUBST([VALGRIND_CHECK_RULES]) + m4_ifdef([_AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE([VALGRIND_CHECK_RULES])]) +]) diff --git a/src/external/cifsidmap.m4 b/src/external/cifsidmap.m4 new file mode 100644 index 0000000..0aac8fa --- /dev/null +++ b/src/external/cifsidmap.m4 @@ -0,0 +1,19 @@ +AC_ARG_ENABLE([cifs-idmap-plugin], + [AS_HELP_STRING([--disable-cifs-idmap-plugin], + [do not build CIFS idmap plugin])], + [build_cifs_idmap_plugin=$enableval], + [build_cifs_idmap_plugin=yes]) + +AS_IF([test x$build_cifs_idmap_plugin = xyes], + [AC_CHECK_HEADER([cifsidmap.h], [], + [AC_MSG_ERROR([ +You must have the cifsidmap header installed to build the idmap plugin. +If you want to build sssd withoud cifsidmap plugin then specify +--disable-cifs-idmap-plugin when running configure.])]) + ]) + +AM_CONDITIONAL([BUILD_CIFS_IDMAP_PLUGIN], + [test x$build_cifs_idmap_plugin = xyes]) + +AM_COND_IF([BUILD_CIFS_IDMAP_PLUGIN], + [AC_DEFINE_UNQUOTED(HAVE_CIFS_IDMAP_PLUGIN, 1, [Build with cifs idmap plugin])]) diff --git a/src/external/crypto.m4 b/src/external/crypto.m4 new file mode 100644 index 0000000..b21645d --- /dev/null +++ b/src/external/crypto.m4 @@ -0,0 +1,30 @@ +AC_DEFUN([AM_CHECK_LIBCRYPTO], + [PKG_CHECK_MODULES([CRYPTO],[libcrypto]) + PKG_CHECK_MODULES([SSL],[libssl]) +]) + +AC_MSG_CHECKING([whether OpenSSL's x400Address is ASN1_STRING]) +SAVE_CFLAGS=$CFLAGS +CFLAGS="$CFLAGS -Werror -Wall -Wextra" +AC_COMPILE_IFELSE( + [AC_LANG_SOURCE([ + #include <openssl/x509v3.h> + + int main(void) + { + GENERAL_NAME gn = { 0 }; + + return ASN1_STRING_length(gn.d.x400Address); + } + ])], + [ + AC_MSG_RESULT([yes]) + AC_DEFINE([HAVE_X400ADDRESS_STRING], + [1], + [whether OpenSSL's x400Address is ASN1_STRING])], + [ + AC_MSG_RESULT([no]) + AC_MSG_WARN([OpenSSL's x400Address is not of ASN1_STRING type]) + ]) + +CFLAGS=$SAVE_CFLAGS diff --git a/src/external/cwrap.m4 b/src/external/cwrap.m4 new file mode 100644 index 0000000..6e3487c --- /dev/null +++ b/src/external/cwrap.m4 @@ -0,0 +1,35 @@ +dnl A macro to check presence of a cwrap wrapper on the system +dnl Usage: +dnl AM_CHECK_WRAPPER(name, conditional) +dnl If the cwrap library is found, sets the HAVE_$name conditional +AC_DEFUN([AM_CHECK_WRAPPER], +[ + AC_MSG_CHECKING([for $1]) + PKG_CHECK_EXISTS([$1], + [ + AC_MSG_RESULT([yes]) + AC_SUBST([$2], [yes]) + ], + [ + AC_MSG_RESULT([no]) + AC_SUBST([$2], [no]) + AC_MSG_WARN([cwrap library $1 not found, some tests will not run]) + ]) + + AM_CONDITIONAL($2, [ test x$$2 = xyes]) +]) + +AC_DEFUN([AM_CHECK_UID_WRAPPER], +[ + AM_CHECK_WRAPPER(uid_wrapper, HAVE_UID_WRAPPER) +]) + +AC_DEFUN([AM_CHECK_NSS_WRAPPER], +[ + AM_CHECK_WRAPPER(nss_wrapper, HAVE_NSS_WRAPPER) +]) + +AC_DEFUN([AM_CHECK_PAM_WRAPPER], +[ + AM_CHECK_WRAPPER(pam_wrapper, HAVE_PAM_WRAPPER) +]) diff --git a/src/external/docbook.m4 b/src/external/docbook.m4 new file mode 100644 index 0000000..acdc89a --- /dev/null +++ b/src/external/docbook.m4 @@ -0,0 +1,32 @@ +dnl Checks for tools needed to generate manual pages +AC_DEFUN([CHECK_XML_TOOLS], +[ + AC_PATH_PROG([XSLTPROC], [xsltproc]) + if test ! -x "$XSLTPROC"; then + AC_MSG_ERROR([Could not find xsltproc]) + fi + + AC_PATH_PROG([XMLLINT], [xmllint]) + if test ! -x "$XMLLINT"; then + AC_MSG_ERROR([Could not find xmllint]) + fi +]) + +dnl Usage: +dnl CHECK_STYLESHEET_URI(FILE, URI, [FRIENDLY-NAME], [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) +dnl Checks if the XML catalog given by FILE exists and +dnl if a particular URI appears in the XML catalog +AC_DEFUN([CHECK_STYLESHEET], +[ + AS_IF([test -f "$1"], [], [AC_MSG_ERROR([could not find XML catalog])]) + + AC_MSG_CHECKING([for ifelse([$3],,[$2],[$3]) in XML catalog]) + if AC_RUN_LOG([$XSLTPROC --catalogs --nonet --noout "$2" >&2]); then + AC_MSG_RESULT([yes]) + m4_ifval([$4], [$4], [:]) + else + AC_MSG_RESULT([no]) + m4_ifval([$5], [$5], [:]) + fi +]) + diff --git a/src/external/inotify.m4 b/src/external/inotify.m4 new file mode 100644 index 0000000..3ae5ae3 --- /dev/null +++ b/src/external/inotify.m4 @@ -0,0 +1,34 @@ +dnl A macro to check if inotify works +AC_DEFUN([AM_CHECK_INOTIFY], +[ + AC_CHECK_HEADERS([sys/inotify.h]) + + AC_MSG_CHECKING([whether sys/inotify.h actually works]) + AC_LINK_IFELSE( + [AC_LANG_SOURCE([ +#ifdef HAVE_SYS_INOTIFY_H +#include <sys/inotify.h> +#endif +int main () { + return (-1 == inotify_init()); +}])], + [AC_MSG_RESULT([yes]); inotify_works=yes], + [AC_MSG_RESULT([no])] + ) + + SSS_AC_EXPAND_LIB_DIR() + AS_IF([test x"$inotify_works" != xyes], + [AC_CHECK_LIB([inotify], + [inotify_init], + [INOTIFY_LIBS="$sss_extra_libdir -linotify" + inotify_works=yes], + [inotify_works=no], + [$sss_extra_libdir])] + ) + + AS_IF([test x"$inotify_works" = xyes], + [AC_DEFINE_UNQUOTED([HAVE_INOTIFY], [1], [Inotify works])]) + AC_SUBST(INOTIFY_LIBS) + + AM_CONDITIONAL([HAVE_INOTIFY], [test x"$inotify_works" = xyes]) +]) diff --git a/src/external/intgcheck.m4 b/src/external/intgcheck.m4 new file mode 100644 index 0000000..d73c5df --- /dev/null +++ b/src/external/intgcheck.m4 @@ -0,0 +1,92 @@ +AC_CHECK_PROG([HAVE_FAKEROOT], [fakeroot], [yes], [no]) + +dnl Check for variable and fail unless value is "yes" +dnl The second argument will be printed in error message in case of error +dnl Usage: +dnl SSS_INTGCHECK_REQ(variable, message) + +AC_DEFUN([SSS_INTGCHECK_REQ], [ + AS_IF([test x$$1 = xyes], , [ + AC_MSG_ERROR([cannot enable integration tests: $2 not found])]) +]) + +dnl Check for python variable and fail/warn unless value is "yes" +dnl The second argument will be printed in error message in case of error +dnl Any value in 3rd argument will make change error to info +dnl Usage: +dnl SSS_INTGCHECK_PYTHON_REQ(variable, message, [non_fatal]) + +AC_DEFUN([SSS_INTGCHECK_PYTHON_REQ], [ + AS_IF([test x$$1 = xyes], [], + [sss_have_py_intg_deps=no + AS_IF([test -n "$3"], + [AC_MSG_NOTICE([missing python dependency for integration tests: $2 not found])], + [AC_MSG_ERROR([cannot enable integration tests: $2 not found])]) + ]) +]) + +dnl Check for variable and fail unless value is "yes" +dnl The second argument will be printed in error message in case of error +dnl Usage: +dnl SSS_CHECK_PYTHON_INTG_REQ(python_version, [non_fatal]) +AC_DEFUN([SSS_CHECK_PYTHON_INTG_REQ], [ + sss_have_py_intg_deps="no" + + SSS_INTGCHECK_PYTHON_REQ([HAVE_PYTHON$1_BINDINGS], + [sssd python$1 bindings], [$2]) + + AS_IF([test x$HAVE_PYTHON$1_BINDINGS = xyes], + [SSS_CHECK_PYTEST([$PYTHON$1], [PY$1_PYTEST]) + []AM_PYTHON$1_MODULE([ldap]) + []AM_PYTHON$1_MODULE([ldb]) + []AM_PYTHON$1_MODULE([requests]) + []AM_PYTHON$1_MODULE([dbus]) + []AM_PYTHON$1_MODULE([psutil]) + + sss_have_py_intg_deps="yes" + + SSS_INTGCHECK_PYTHON_REQ([HAVE_PY$1_PYTEST], + [python$1 pytest], [$2]) + SSS_INTGCHECK_PYTHON_REQ([HAVE_PY$1MOD_LDAP], + [python$1 module ldap], [$2]) + SSS_INTGCHECK_PYTHON_REQ([HAVE_PY$1MOD_LDB], + [python$1 module ldb], [$2]) + SSS_INTGCHECK_PYTHON_REQ([HAVE_PY$1MOD_REQUESTS], + [python$1 module requests], [$2]) + SSS_INTGCHECK_PYTHON_REQ([HAVE_PY$1MOD_DBUS], + [python$1 module dbus], [$2]) + SSS_INTGCHECK_PYTHON_REQ([HAVE_PY$1MOD_PSUTIL], + [python$1 module psutil], [$2])]) + + AS_IF([test "x$sss_have_py_intg_deps" = xyes], + [HAVE_PYTHON_INTG_DEPS=yes + PYTHON_EXEC_INTG=$PYTHON$1 + AC_SUBST(PYTHON_EXEC_INTG)], + [HAVE_PYTHON_INTG_DEPS=no]) + unset sss_have_py_intg_deps +]) + +AC_DEFUN([SSS_ENABLE_INTGCHECK_REQS], [ + AC_ARG_ENABLE(intgcheck-reqs, + [AS_HELP_STRING([--enable-intgcheck-reqs], + [enable checking for integration test requirements [default=no]])], + [enable_intgcheck_reqs="$enableval"], + [enable_intgcheck_reqs="no"]) + if test x"$enable_intgcheck_reqs" = xyes; then + SSS_INTGCHECK_REQ([HAVE_UID_WRAPPER], [uid_wrapper]) + SSS_INTGCHECK_REQ([HAVE_NSS_WRAPPER], [nss_wrapper]) + SSS_INTGCHECK_REQ([HAVE_PAM_WRAPPER], [pam_wrapper]) + SSS_INTGCHECK_REQ([HAVE_SLAPD], [slapd]) + SSS_INTGCHECK_REQ([HAVE_LDAPMODIFY], [ldapmodify]) + SSS_INTGCHECK_REQ([HAVE_FAKEROOT], [fakeroot]) + + SSS_CHECK_PYTHON_INTG_REQ([3], [just_warning]) + + AS_IF([test "x$HAVE_PYTHON_INTG_DEPS" = xyes], [], + dnl fallback to python2 checks due to missing + dnl python3 dependencies for intgcheck + [SSS_CHECK_PYTHON_INTG_REQ([2])]) + fi +]) + +AM_CONDITIONAL([INTG_BUILD], [test x"$enable_intgcheck_reqs" = xyes]) diff --git a/src/external/krb5.m4 b/src/external/krb5.m4 new file mode 100644 index 0000000..1dfdbe9 --- /dev/null +++ b/src/external/krb5.m4 @@ -0,0 +1,133 @@ +AC_SUBST(KRB5_CFLAGS) +AC_SUBST(KRB5_LIBS) + +if test x$KRB5_LIBS != x; then + KRB5_PASSED_LIBS=$KRB5_LIBS +fi + +if test x$KRB5_CFLAGS != x; then + KRB5_PASSED_CFLAGS=$KRB5_CFLAGS +fi + +AC_PATH_TOOL(KRB5_CONFIG, krb5-config) +AC_MSG_CHECKING(for working krb5-config) +if test -x "$KRB5_CONFIG"; then + KRB5_CFLAGS="`$KRB5_CONFIG --cflags`" + KRB5_LIBS="`$KRB5_CONFIG --libs`" + AC_MSG_RESULT(yes) +else + AC_MSG_RESULT([no]) + if test x$KRB5_PASSED_LIBS = x; then + AC_MSG_ERROR([Please install MIT kerberos devel package]) + fi +fi + +if test x$KRB5_PASSED_LIBS != x; then + KRB5_LIBS=$KRB5_PASSED_LIBS +fi + +if test x$KRB5_PASSED_CFLAGS != x; then + KRB5_CFLAGS=$KRB5_PASSED_CFLAGS +fi + +AC_ARG_VAR([KRB5_CFLAGS], [C compiler flags for kerberos, overriding krb5-config])dnl +AC_ARG_VAR([KRB5_LIBS], [linker flags for kerberos, overriding krb5-config])dnl + +SAVE_CFLAGS=$CFLAGS +SAVE_LIBS=$LIBS +CFLAGS="$CFLAGS $KRB5_CFLAGS" +LIBS="$LIBS $KRB5_LIBS" +AC_CHECK_HEADERS([krb5.h krb5/krb5.h]) +AC_CHECK_TYPES([krb5_ticket_times, krb5_times, krb5_trace_info], [], [], + [ #ifdef HAVE_KRB5_KRB5_H + #include <krb5/krb5.h> + #else + #include <krb5.h> + #endif + ]) +AC_CHECK_FUNCS([krb5_get_init_creds_opt_alloc krb5_get_error_message \ + krb5_free_unparsed_name \ + krb5_get_init_creds_opt_set_expire_callback \ + krb5_get_init_creds_opt_set_fast_ccache_name \ + krb5_get_init_creds_opt_set_fast_flags \ + krb5_get_init_creds_opt_set_canonicalize \ + krb5_get_init_creds_opt_set_responder \ + krb5_parse_name_flags \ + krb5_unparse_name_flags \ + krb5_get_init_creds_opt_set_change_password_prompt \ + krb5_free_keytab_entry_contents \ + krb5_kt_free_entry \ + krb5_princ_realm \ + krb5_get_time_offsets \ + krb5_principal_get_realm \ + krb5_cc_cache_match \ + krb5_timestamp_to_sfstring \ + krb5_set_trace_callback \ + krb5_find_authdata \ + krb5_kt_have_content \ + krb5_cc_get_full_name \ + krb5_unmarshal_credentials]) +CFLAGS=$SAVE_CFLAGS +LIBS=$SAVE_LIBS +CFLAGS="$CFLAGS $KRB5_CFLAGS" +LIBS="$LIBS $KRB5_LIBS" + +if test x$ac_cv_header_krb5_h != xyes -a x$ac_cv_header_krb5_krb5_h != xyes +then + AC_MSG_ERROR(you must have Kerberos 5 header files to build sssd) +fi + +AC_ARG_ENABLE([krb5-locator-plugin], + [AS_HELP_STRING([--disable-krb5-locator-plugin], + [do not build Kerberos locator plugin])], + [build_locator=$enableval], + [build_locator=yes]) + +AC_CHECK_HEADER([krb5/locate_plugin.h], + [have_locate_plugin=yes], + [have_locate_plugin=no] + [AC_MSG_NOTICE([Kerberos locator plugin cannot be built])], + [ #ifdef HAVE_KRB5_KRB5_H + #include <krb5/krb5.h> + #else + #include <krb5.h> + #endif + ]) +AM_CONDITIONAL([BUILD_KRB5_LOCATOR_PLUGIN], + [test x$have_locate_plugin = xyes -a x$build_locator = xyes]) +AM_COND_IF([BUILD_KRB5_LOCATOR_PLUGIN], + [AC_DEFINE_UNQUOTED(HAVE_KRB5_LOCATOR_PLUGIN, 1, [Build with krb5 locator plugin])]) + +AC_CHECK_HEADER([krb5/localauth_plugin.h], + [have_localauth_plugin=yes], + [have_localauth_plugin=no] + [AC_MSG_NOTICE([Kerberos localauth plugin cannot be built])], + [ #ifdef HAVE_KRB5_KRB5_H + #include <krb5/krb5.h> + #else + #include <krb5.h> + #endif + ]) +AM_CONDITIONAL([BUILD_KRB5_LOCALAUTH_PLUGIN], + [test x$have_localauth_plugin = xyes]) +AM_COND_IF([BUILD_KRB5_LOCALAUTH_PLUGIN], + [AC_DEFINE_UNQUOTED(HAVE_KRB5_LOCALAUTH_PLUGIN, 1, [Build with krb5 localauth plugin])]) + +AC_ARG_ENABLE([kcm-renewal], + [AS_HELP_STRING([--disable-kcm-renewal], + [do not build support for kcm renewals])], + [build_kcm_renewal=$enableval], + [build_kcm_renewal=yes]) + +if test x$build_kcm_renewal = xyes -a x$ac_cv_func_krb5_unmarshal_credentials != xyes +then + AC_MSG_WARN([krb5 unmarshalling function not available, fallback to building without KCM renewals]) +fi + +AM_CONDITIONAL([BUILD_KCM_RENEWAL], + [test x$build_kcm_renewal = xyes -a x$ac_cv_func_krb5_unmarshal_credentials = xyes]) +AM_COND_IF([BUILD_KCM_RENEWAL], + [AC_DEFINE_UNQUOTED(HAVE_KCM_RENEWAL, 1, [Build with kcm renewals])]) + +CFLAGS=$SAVE_CFLAGS +LIBS=$SAVE_LIBS diff --git a/src/external/ldap.m4 b/src/external/ldap.m4 new file mode 100644 index 0000000..f42023c --- /dev/null +++ b/src/external/ldap.m4 @@ -0,0 +1,97 @@ +dnl AC_SUBST(LDAP_LIBS) +dnl +dnl AC_CHECK_HEADERS(lber.h ldap.h, , AC_MSG_ERROR("could not locate LDAP header files please install devel package")) +dnl +dnl AC_CHECK_LIB(lber, main, LDAP_LIBS="-llber $LDAP_LIBS") +dnl AC_CHECK_LIB(ldap, main, LDAP_LIBS="-lldap $LDAP_LIBS") +dnl +dnl --------------------------------------------------------------------------- +dnl - Check for Mozilla LDAP or OpenLDAP SDK +dnl --------------------------------------------------------------------------- + +for p in /usr/include/openldap24 /usr/local/include; do + if test -f "${p}/ldap.h"; then + OPENLDAP_CFLAGS="${OPENLDAP_CFLAGS} -I${p}" + break; + fi +done + +for p in /usr/lib64/openldap24 /usr/lib/openldap24 /usr/local/lib ; do + if test -f "${p}/libldap.so"; then + OPENLDAP_LIBS="${OPENLDAP_LIBS} -L${p}" + break; + fi +done + +SAVE_CFLAGS=$CFLAGS +SAVE_LIBS=$LIBS +CFLAGS="$CFLAGS $OPENLDAP_CFLAGS" +LIBS="$LIBS $OPENLDAP_LIBS" +AC_CHECK_LIB(ldap, ldap_search, with_ldap=yes) +dnl Check for other libraries we need to link with to get the main routines. +test "$with_ldap" != "yes" && { AC_CHECK_LIB(ldap, ldap_open, [with_ldap=yes with_ldap_lber=yes], , -llber) } +test "$with_ldap" != "yes" && { AC_CHECK_LIB(ldap, ldap_open, [with_ldap=yes with_ldap_lber=yes with_ldap_krb=yes], , -llber -lkrb) } +test "$with_ldap" != "yes" && { AC_CHECK_LIB(ldap, ldap_open, [with_ldap=yes with_ldap_lber=yes with_ldap_krb=yes with_ldap_des=yes], , -llber -lkrb -ldes) } +CFLAGS=$SAVE_CFLAGS +LIBS=$SAVE_LIBS +dnl Recently, we need -lber even though the main routines are elsewhere, +dnl because otherwise we get link errors w.r.t. ber_pvt_opt_on. So just +dnl check for that (it's a variable not a fun but that doesn't seem to +dnl matter in these checks) and stick in -lber if so. Can't hurt (even to +dnl stick it in always shouldn't hurt, I don't think) ... #### Someone who +dnl #### understands LDAP needs to fix this properly. +test "$with_ldap_lber" != "yes" && { AC_CHECK_LIB(lber, ber_pvt_opt_on, with_ldap_lber=yes) } + +if test "$with_ldap" = "yes"; then + if test "$with_ldap_des" = "yes" ; then + OPENLDAP_LIBS="${OPENLDAP_LIBS} -ldes" + fi + if test "$with_ldap_krb" = "yes" ; then + OPENLDAP_LIBS="${OPENLDAP_LIBS} -lkrb" + fi + if test "$with_ldap_lber" = "yes" ; then + OPENLDAP_LIBS="${OPENLDAP_LIBS} -llber" + fi + OPENLDAP_LIBS="${OPENLDAP_LIBS} -lldap" +else + AC_MSG_ERROR([OpenLDAP not found]) +fi + +AC_SUBST(OPENLDAP_LIBS) +AC_SUBST(OPENLDAP_CFLAGS) + +SAVE_CFLAGS=$CFLAGS +SAVE_LIBS=$LIBS +CFLAGS="$CFLAGS $OPENLDAP_CFLAGS" +LIBS="$LIBS $OPENLDAP_LIBS" +AC_CHECK_FUNCS([ldap_control_create ldap_init_fd \ + ldap_create_deref_control_value \ + ldap_parse_derefresponse_control \ + ldap_derefresponse_free \ + ldap_is_ldapc_url]) +AC_CHECK_MEMBERS([struct ldap_conncb.lc_arg], + [AC_RUN_IFELSE( + [AC_LANG_PROGRAM( + [[ #include <ldap.h> ]], + [[ + struct ldap_conncb cb; + return ldap_set_option(NULL, LDAP_OPT_CONNECT_CB, &cb); + ]] )], + [AC_DEFINE([HAVE_LDAP_CONNCB], [1], + [Define if LDAP connection callbacks are available])], + [AC_MSG_WARN([Found broken callback implementation])], + [])], + [], [[#include <ldap.h>]]) + +AC_CHECK_TYPE([LDAPDerefRes], + [], + [AC_MSG_ERROR([The OpenLDAP version found does not contain the required type LDAPDerefRes])], + [[#include <ldap.h>]]) + +CFLAGS=$SAVE_CFLAGS +LIBS=$SAVE_LIBS + +AC_PATH_PROG([SLAPD], [slapd], , + [$PATH$PATH_SEPARATOR/usr/sbin$PATH_SEPARATOR]) +AS_IF([test -n "$SLAPD"], [HAVE_SLAPD=yes], [HAVE_SLAPD=no]) +AC_CHECK_PROG([HAVE_LDAPMODIFY], [ldapmodify], [yes], [no]) diff --git a/src/external/libcares.m4 b/src/external/libcares.m4 new file mode 100644 index 0000000..0a764d3 --- /dev/null +++ b/src/external/libcares.m4 @@ -0,0 +1,15 @@ +AC_SUBST(CARES_LIBS) +AC_SUBST(CARES_CFLAGS) + +PKG_CHECK_MODULES([CARES], [libcares], [found_libcares=yes], [found_libcares=no]) + +SSS_AC_EXPAND_LIB_DIR() +AS_IF([test x"$found_libcares" != xyes], + [AC_CHECK_HEADERS([ares.h], + [AC_CHECK_LIB([cares], + [ares_init], + [CARES_LIBS="-L$sss_extra_libdir -lcares"], + [AC_MSG_ERROR([No usable c-ares library found])], + [-L$sss_extra_libdir])], + [AC_MSG_ERROR([c-ares header files are not installed])])] +) diff --git a/src/external/libcmocka.m4 b/src/external/libcmocka.m4 new file mode 100644 index 0000000..230aa92 --- /dev/null +++ b/src/external/libcmocka.m4 @@ -0,0 +1,18 @@ +dnl A macro to check presence of cmocka on the system +AC_DEFUN([AM_CHECK_CMOCKA], +[ + PKG_CHECK_EXISTS(cmocka >= 1.0.0, + [AC_CHECK_HEADERS([stdarg.h stddef.h setjmp.h], + [], dnl We are only intrested in action-if-not-found + [AC_MSG_WARN([Header files stdarg.h stddef.h setjmp.h are required by cmocka]) + cmocka_required_headers="no" + ] + ) + AS_IF([test x"$cmocka_required_headers" != x"no"], + [PKG_CHECK_MODULES([CMOCKA], [cmocka], [have_cmocka="yes"])] + )], + dnl PKG_CHECK_EXISTS ACTION-IF-NOT-FOUND + [AC_MSG_WARN([No libcmocka-1.0.0 or newer library found, cmocka tests will not be built])] + ) + AM_CONDITIONAL([HAVE_CMOCKA], [test x$have_cmocka = xyes]) +]) diff --git a/src/external/libcurl.m4 b/src/external/libcurl.m4 new file mode 100644 index 0000000..4d28d59 --- /dev/null +++ b/src/external/libcurl.m4 @@ -0,0 +1,4 @@ +AC_SUBST(CURL_LIBS) +AC_SUBST(CURL_CFLAGS) + +PKG_CHECK_MODULES([CURL], [libcurl], [found_libcurl=yes], [found_libcurl=no]) diff --git a/src/external/libdhash.m4 b/src/external/libdhash.m4 new file mode 100644 index 0000000..2ca5136 --- /dev/null +++ b/src/external/libdhash.m4 @@ -0,0 +1,9 @@ +AC_SUBST(DHASH_CFLAGS) +AC_SUBST(DHASH_LIBS) + +PKG_CHECK_MODULES(DHASH, + dhash >= 0.4.2, + , + AC_MSG_ERROR("Please install libdhash-devel") + ) + diff --git a/src/external/libgssapi_krb5.m4 b/src/external/libgssapi_krb5.m4 new file mode 100644 index 0000000..67f3c46 --- /dev/null +++ b/src/external/libgssapi_krb5.m4 @@ -0,0 +1,8 @@ +AC_SUBST(GSSAPI_KRB5_CFLAGS) +AC_SUBST(GSSAPI_KRB5_LIBS) + +PKG_CHECK_MODULES(GSSAPI_KRB5, + krb5-gssapi, + , + AC_MSG_ERROR("Please install krb5-devel") + ) diff --git a/src/external/libini_config.m4 b/src/external/libini_config.m4 new file mode 100644 index 0000000..a2bba42 --- /dev/null +++ b/src/external/libini_config.m4 @@ -0,0 +1,48 @@ +PKG_CHECK_MODULES(INI_CONFIG_V0, [ + ini_config >= 0.6.1], [ + + INI_CONFIG_CFLAGS="$INI_CONFIG_V0_CFLAGS" + INI_CONFIG_LIBS="$INI_CONFIG_V0_LIBS" + HAVE_LIBINI_CONFIG_V0=1 + AC_DEFINE_UNQUOTED(HAVE_LIBINI_CONFIG_V0, 1, [libini_config version 0.6.1 or greater]) + PKG_CHECK_MODULES(INI_CONFIG_V1, [ + ini_config >= 1.0.0], [ + + INI_CONFIG_CFLAGS="$INI_CONFIG_V1_CFLAGS" + INI_CONFIG_LIBS="$INI_CONFIG_V1_LIBS" + HAVE_LIBINI_CONFIG_V1=1 + AC_DEFINE_UNQUOTED(HAVE_LIBINI_CONFIG_V1, 1, [libini_config version 1.0.0 or greater]) + PKG_CHECK_MODULES(INI_CONFIG_V1_1, [ + ini_config >= 1.1.0], [ + + INI_CONFIG_CFLAGS="$INI_CONFIG_V1_1_CFLAGS" + INI_CONFIG_LIBS="$INI_CONFIG_V1_1_LIBS" + HAVE_LIBINI_CONFIG_V1_1=1 + AC_DEFINE_UNQUOTED(HAVE_LIBINI_CONFIG_V1_1, 1, [libini_config version 1.1.0 or greater]) + PKG_CHECK_MODULES(INI_CONFIG_V1_3, [ + ini_config >= 1.3.0], [ + + INI_CONFIG_CFLAGS="$INI_CONFIG_V1_3_CFLAGS" + INI_CONFIG_LIBS="$INI_CONFIG_V1_3_LIBS" + HAVE_LIBINI_CONFIG_V1_3=1 + AC_DEFINE_UNQUOTED(HAVE_LIBINI_CONFIG_V1_3, 1, + [libini_config version 1.3.0 or greater]) + ], [ + AC_MSG_WARN([libini_config-devel >= 1.3.0 not available, using older version]) + ] + ) + ], [ + AC_MSG_WARN([libini_config-devel >= 1.1.0 not available, using older version]) + ] + ) + ], [ + AC_MSG_WARN([libini_config-devel >= 1.0.0 not available, using older version]) + ] + ) + ], [ + AC_MSG_ERROR([Please install libini_config-devel]) + ] +) + +AC_SUBST(INI_CONFIG_CFLAGS) +AC_SUBST(INI_CONFIG_LIBS) diff --git a/src/external/libjansson.m4 b/src/external/libjansson.m4 new file mode 100644 index 0000000..6262cd9 --- /dev/null +++ b/src/external/libjansson.m4 @@ -0,0 +1,16 @@ +AC_SUBST(JANSSON_LIBS) +AC_SUBST(JANSSON_CFLAGS) + +PKG_CHECK_MODULES([JANSSON], [jansson], [found_jansson=yes], [found_jansson=no]) + +SSS_AC_EXPAND_LIB_DIR() +AS_IF([test x"$found_jansson" != xyes], + [AC_CHECK_HEADERS([jansson.h], + [AC_CHECK_LIB([jansson], + [jansson_loads], + [JANSSON_LIBS="-L$sss_extra_libdir -ljansson"], + [AC_MSG_ERROR([libjansson missing jansson_loads])], + [-L$sss_extra_libdir -ljanson])], + [AC_MSG_ERROR([You must have the header file jansson.h installed])] + )] +) diff --git a/src/external/libjose.m4 b/src/external/libjose.m4 new file mode 100644 index 0000000..fe28cee --- /dev/null +++ b/src/external/libjose.m4 @@ -0,0 +1,4 @@ +AC_SUBST(JOSE_LIBS) +AC_SUBST(JOSE_CFLAGS) + +PKG_CHECK_MODULES([JOSE], [jose], [found_jose=yes], [found_jose=no]) diff --git a/src/external/libkeyutils.m4 b/src/external/libkeyutils.m4 new file mode 100644 index 0000000..5753d77 --- /dev/null +++ b/src/external/libkeyutils.m4 @@ -0,0 +1,11 @@ +AC_SUBST(KEYUTILS_LIBS) + +AC_CHECK_HEADERS([keyutils.h], + [AC_CHECK_LIB([keyutils], [add_key], + [AC_DEFINE(USE_KEYRING, 1, [Define if the keyring should be used]) + KEYUTILS_LIBS="-lkeyutils" + ], + [AC_MSG_WARN([No usable keyutils library found])] + )], + [AC_MSG_WARN([keyutils header files are not available])] +) diff --git a/src/external/libkrad.m4 b/src/external/libkrad.m4 new file mode 100644 index 0000000..3b9709e --- /dev/null +++ b/src/external/libkrad.m4 @@ -0,0 +1,4 @@ +AC_CHECK_HEADER(krad.h, [], [AC_MSG_ERROR([krad.h not found])]) +AC_CHECK_LIB(krad, krad_packet_get_attr, [ ], [AC_MSG_ERROR([libkrad not found])]) +KRAD_LIBS="-lkrad" +AC_SUBST(KRAD_LIBS) diff --git a/src/external/libldb.m4 b/src/external/libldb.m4 new file mode 100644 index 0000000..e8285a9 --- /dev/null +++ b/src/external/libldb.m4 @@ -0,0 +1,45 @@ +AC_SUBST(LDB_CFLAGS) +AC_SUBST(LDB_LIBS) + +PKG_CHECK_MODULES(LDB, ldb >= 0.9.2) + +SAVE_CFLAGS=$CFLAGS +CFLAGS="$CFLAGS $LDB_CFLAGS" +AC_CHECK_HEADERS(ldb.h ldb_module.h, + [AC_CHECK_LIB(ldb, ldb_init, [LDB_LIBS="-lldb"], , -ltevent -ltdb -ldl -lldap) ], + [AC_MSG_ERROR([LDB header files are not installed])] +) +CFLAGS=$SAVE_CFLAGS + +AC_ARG_WITH([ldb-lib-dir], + [AC_HELP_STRING([--with-ldb-lib-dir=PATH], + [Path to store ldb modules [${libdir}/ldb]] + ) + ] + ) + +if test x"$with_ldb_lib_dir" != x; then + ldblibdir=$with_ldb_lib_dir +else + ldblibdir="`$PKG_CONFIG --variable=modulesdir ldb`" + if ! test -d $ldblibdir; then + ldblibdir="${libdir}/ldb" + fi +fi + +AC_MSG_CHECKING([feature ldb runtime version check]) +AC_ARG_ENABLE(ldb-version-check, + [AS_HELP_STRING([--enable-ldb-version-check], + [compile with ldb runtime version check [default=no]])], + enable_ldb_version_check="$enableval", + enable_ldb_version_check="no") +if test x"$enable_ldb_version_check" = xyes ; then + AC_MSG_RESULT([yes]) + AC_DEFINE([SSS_LDB_VERSION_CHECK], [1], + [Define to 1 if you want ldb version check.]) +else + AC_MSG_RESULT([no]) +fi + +AC_MSG_NOTICE([ldb lib directory: $ldblibdir]) +AC_SUBST(ldblibdir) diff --git a/src/external/libnfsidmap.m4 b/src/external/libnfsidmap.m4 new file mode 100644 index 0000000..676e2f9 --- /dev/null +++ b/src/external/libnfsidmap.m4 @@ -0,0 +1,29 @@ +AC_SUBST(NFSIDMAP_OBJ) +AC_SUBST(NFSIDMAP_CFLAGS) +AC_SUBST(NFSIDMAP_LIBS) + +AS_IF([test x"$with_nfsv4_idmap" = xyes], [ + PKG_CHECK_MODULES([NFSIDMAP], [libnfsidmap], [found_nfsidmap=yes], + [found_nfsidmap=no]) + + SSS_AC_EXPAND_LIB_DIR() + AS_IF([test x"$found_nfsidmap" != xyes], + [AC_CHECK_HEADER([nfsidmap.h], + [AC_CHECK_LIB([nfsidmap], + [nfs4_init_name_mapping], + [NFSIDMAP_LIBS="-L$sss_extra_libdir -lnfsidmap"], + [AC_MSG_ERROR([libnfsidmap missing nfs4_init_name_mapping])], + [-L$sss_extra_libdir])], + [AC_MSG_ERROR([libnfsidmap header files are not installed] +If you want to build sssd without nfs idmap pluging then specify +--without-nfsv4-idmapd-plugin when running configure.)])]) + + AC_CHECK_HEADERS([nfsidmap_plugin.h], [], [], + [#ifdef HAVE_STDLIB_H +# include <stdlib.h> +#endif +#ifdef HAVE_STDINT_H +# include <stdint.h> +#endif +#include <nfsidmap.h>]) +]) diff --git a/src/external/libnl.m4 b/src/external/libnl.m4 new file mode 100644 index 0000000..25be3f1 --- /dev/null +++ b/src/external/libnl.m4 @@ -0,0 +1,88 @@ +dnl A macro to check if this particular version of libnl supports particular common libnl functions +AC_DEFUN([AM_CHECK_LIBNL_FCS], +[ + AC_CHECK_LIB($1, + [nl_socket_add_membership], + [AC_DEFINE([HAVE_NL_SOCKET_ADD_MEMBERSHIP], 1, [Does libnl have nl_socket_add_membership?]) + ], + ) + + AC_CHECK_LIB($1, + [nl_socket_modify_cb], + [AC_DEFINE([HAVE_NL_SOCKET_MODIFY_CB], 1, [Does libnl have nl_socket_modify_cb?]) + ], + ) + + AC_CHECK_LIB($1, + [rtnl_route_get_oif], + [AC_DEFINE([HAVE_RTNL_ROUTE_GET_OIF], 1, [Does libnl have rtnl_route_get_oif?]) + ], + ) + + AC_CHECK_LIB($1, + [nl_set_passcred], + [AC_DEFINE([HAVE_NL_SET_PASSCRED], 1, [Does libnl have nl_set_passcred?]) + ], + ) + + AC_CHECK_LIB($1, + [nl_socket_set_passcred], + [AC_DEFINE([HAVE_NL_SOCKET_SET_PASSCRED], 1, [Does libnl have nl_socket_set_passcred?]) + ], + ) +]) + +dnl A macro to check the availability and version of libnetlink +AC_DEFUN([AM_CHECK_LIBNL1], +[ + PKG_CHECK_MODULES(LIBNL1, libnl-1 >= 1.1,[ + + HAVE_LIBNL=1 + HAVE_LIBNL1=1 + + LIBNL_CFLAGS="$LIBNL1_CFLAGS" + LIBNL_LIBS="$LIBNL1_LIBS" + + AC_DEFINE_UNQUOTED(HAVE_LIBNL, 1, [Build with libnetlink support]) + AC_DEFINE_UNQUOTED(HAVE_LIBNL1, 1, [Libnetlink version = 1]) + + AC_MSG_NOTICE([Building with libnl]) + + AC_CHECK_HEADERS(netlink.h) + AC_CHECK_LIB(nl, nl_connect, [ LIBNL_LIBS="-lnl" ], [AC_MSG_ERROR([libnl is required])]) + + AM_CHECK_LIBNL_FCS(nl) + + + ],[AC_MSG_WARN([Netlink v1 support unavailable or too old])]) + + AC_SUBST(LIBNL_CFLAGS) + AC_SUBST(LIBNL_LIBS) +]) + +dnl A macro to check the availability of libnetlink version 3 + +AC_DEFUN([AM_CHECK_LIBNL3], +[ + PKG_CHECK_MODULES(LIBNL3, [ + libnl-3.0 >= 3.0 + libnl-route-3.0 >= 3.0], [ + + HAVE_LIBNL=1 + HAVE_LIBNL3=1 + + LIBNL_CFLAGS="$LIBNL3_CFLAGS" + LIBNL_LIBS="$LIBNL3_LIBS" + + AC_DEFINE_UNQUOTED(HAVE_LIBNL, 1, [Build with libnetlink support]) + AC_DEFINE_UNQUOTED(HAVE_LIBNL3, 1, [Libnetlink version = 3]) + + AC_MSG_NOTICE([Building with libnl3]) + + AM_CHECK_LIBNL_FCS(nl-3) + + ],[AC_MSG_WARN([Netlink v3 support unavailable or too old])]) + + AC_SUBST(LIBNL_CFLAGS) + AC_SUBST(LIBNL_LIBS) +]) diff --git a/src/external/libpasskey.m4 b/src/external/libpasskey.m4 new file mode 100644 index 0000000..281611e --- /dev/null +++ b/src/external/libpasskey.m4 @@ -0,0 +1,15 @@ +AC_SUBST(PASSKEY_LIBS) +AC_SUBST(PASSKEY_CFLAGS) + +PKG_CHECK_MODULES([FIDO2], [libfido2], [found_passkey=yes], [found_passkey=no]) + +SSS_AC_EXPAND_LIB_DIR() +AS_IF([test x"$found_passkey" = xyes], + [AC_CHECK_HEADER([fido.h], + [AC_CHECK_LIB([fido2], + [es256_pk_from_EVP_PKEY], + [found_passkey=yes] [PASSKEY_LIBS="-lfido2"], + [found_passkey=no])], + [found_passkey=no] + )] +) diff --git a/src/external/libpcre.m4 b/src/external/libpcre.m4 new file mode 100644 index 0000000..d4d50e8 --- /dev/null +++ b/src/external/libpcre.m4 @@ -0,0 +1,29 @@ +AC_SUBST(PCRE_LIBS) +AC_SUBST(PCRE_CFLAGS) + +PKG_CHECK_MODULES( + [PCRE], + [libpcre2-8], + [ + found_libpcre=yes + AC_DEFINE( + [PCRE2_CODE_UNIT_WIDTH], + 8, + [Define libpcre2 unit size] + ) + ], + [ + found_libpcre=no + ] +) + +SSS_AC_EXPAND_LIB_DIR() +AS_IF([test x"$found_libpcre" != xyes], + [AC_CHECK_HEADERS([pcre2.h], + [AC_CHECK_LIB([libpcre2-8], + [pcre2_compile], + [PCRE_LIBS="-L$sss_extra_libdir -lpcre2-8"], + [AC_MSG_ERROR([No usable PCRE2 library found])], + [-L$sss_extra_libdir])], + [AC_MSG_ERROR([pcre2 header files are not installed])])] +) diff --git a/src/external/libpopt.m4 b/src/external/libpopt.m4 new file mode 100644 index 0000000..e6a3e71 --- /dev/null +++ b/src/external/libpopt.m4 @@ -0,0 +1,15 @@ +AC_SUBST(POPT_LIBS) +AC_SUBST(POPT_CFLAGS) + +PKG_CHECK_MODULES([POPT], [popt], [found_popt=yes], [found_popt=no]) + +SSS_AC_EXPAND_LIB_DIR() +AS_IF([test x"$found_popt" != xyes], + [AC_CHECK_HEADERS([popt.h], + [AC_CHECK_LIB([popt], + [poptGetContext], + [POPT_LIBS="-L$sss_extra_libdir -lpopt"], + [AC_MSG_ERROR([POPT library must support poptGetContext])], + [-L$sss_extra_libdir])], + [AC_MSG_ERROR([POPT header files are not installed])])] +) diff --git a/src/external/libresolv.m4 b/src/external/libresolv.m4 new file mode 100644 index 0000000..225cf2b --- /dev/null +++ b/src/external/libresolv.m4 @@ -0,0 +1,12 @@ +AC_SUBST(RESOLV_CFLAGS) +AC_SUBST(RESOLV_LIBS) + +# Some unit tests require libresolv to fake DNS packets +SSS_AC_EXPAND_LIB_DIR() +AC_CHECK_LIB([resolv], + [ns_name_compress], + [RESOLV_LIBS="-L$sss_extra_libdir -lresolv"], + [AC_MSG_WARN([No libresolv detected, some tests will not run])], + [-L$sss_extra_libdir]) + +AM_CONDITIONAL([HAVE_LIBRESOLV], [test x"$RESOLV_LIBS" != "x"]) diff --git a/src/external/libtalloc.m4 b/src/external/libtalloc.m4 new file mode 100644 index 0000000..06a1b29 --- /dev/null +++ b/src/external/libtalloc.m4 @@ -0,0 +1,15 @@ +AC_SUBST(TALLOC_CFLAGS) +AC_SUBST(TALLOC_LIBS) + +PKG_CHECK_MODULES([TALLOC], [talloc], [found_talloc=yes], [found_talloc=no]) + +SSS_AC_EXPAND_LIB_DIR() +AS_IF([test x"$found_talloc" != xyes], + [AC_CHECK_HEADER([talloc.h], + [AC_CHECK_LIB([talloc], + [talloc_init], + [TALLOC_LIBS="-L$sss_extra_libdir -ltalloc"], + [AC_MSG_ERROR([libtalloc missing talloc_init])], + [-L$sss_extra_libdir])], + [AC_MSG_ERROR([libtalloc header files are not installed])])] +) diff --git a/src/external/libtdb.m4 b/src/external/libtdb.m4 new file mode 100644 index 0000000..f740d05 --- /dev/null +++ b/src/external/libtdb.m4 @@ -0,0 +1,15 @@ +AC_SUBST(TDB_CFLAGS) +AC_SUBST(TDB_LIBS) + +PKG_CHECK_MODULES([TDB], [tdb >= 1.1.3], [found_tdb=yes], [found_tdb=no]) + +SSS_AC_EXPAND_LIB_DIR() +AS_IF([test x"$found_tdb" != xyes], + [AC_CHECK_HEADERS([tdb.h], + [AC_CHECK_LIB([tdb], + [tdb_repack], + [TDB_LIBS="-L$sss_extra_libdir -ltdb"], + [AC_MSG_ERROR([library TDB must support tdb_repack])], + [-L$sss_extra_libdir])], + [AC_MSG_ERROR([tdb header files are not installed])])] +) diff --git a/src/external/libtevent.m4 b/src/external/libtevent.m4 new file mode 100644 index 0000000..25d43d3 --- /dev/null +++ b/src/external/libtevent.m4 @@ -0,0 +1,44 @@ +AC_SUBST(TEVENT_CFLAGS) +AC_SUBST(TEVENT_LIBS) + +PKG_CHECK_MODULES([TEVENT], [tevent], [found_tevent=yes], [found_tevent=no]) + +SSS_AC_EXPAND_LIB_DIR() +AS_IF([test x"$found_tevent" != xyes], + [AC_CHECK_HEADER([tevent.h], + [AC_CHECK_LIB([tevent], + [tevent_context_init], + [TEVENT_LIBS="-L$sss_extra_libdir -ltevent -ltalloc"], + [AC_MSG_ERROR([libtevent missing tevent_context_init])], + [-L$sss_extra_libdir -ltalloc])], + [AC_MSG_ERROR([tevent header files are not installed])])] +) + +SAVE_CFLAGS=$CFLAGS +SAVE_LIBS=$LIBS +CFLAGS="$CFLAGS $TEVENT_CFLAGS" +LIBS="$LIBS $TEVENT_LIBS" +build_chain_id=yes +AC_CHECK_FUNCS([tevent_set_trace_fd_callback \ + tevent_set_trace_signal_callback \ + tevent_set_trace_timer_callback \ + tevent_set_trace_immediate_callback \ + tevent_fd_set_tag \ + tevent_fd_get_tag \ + tevent_signal_set_tag \ + tevent_signal_get_tag \ + tevent_timer_set_tag \ + tevent_timer_get_tag \ + tevent_immediate_set_tag \ + tevent_immediate_get_tag], + [], + [build_chain_id=no]) +CFLAGS=$SAVE_CFLAGS +LIBS=$SAVE_LIBS + +if test x$build_chain_id = xyes +then + AC_DEFINE(BUILD_CHAIN_ID, 1, [Build chain id]) +else + AC_MSG_NOTICE([Chain id support is disabled due to missing dependencies in tevent]) +fi diff --git a/src/external/libunistring.m4 b/src/external/libunistring.m4 new file mode 100644 index 0000000..bbc92b3 --- /dev/null +++ b/src/external/libunistring.m4 @@ -0,0 +1,31 @@ +SSS_AC_EXPAND_LIB_DIR() + +AC_CHECK_HEADERS([unistr.h], + [AC_CHECK_LIB([unistring], + [u8_strlen], + [UNISTRING_LIBS="-lunistring"], + [AC_MSG_ERROR([No usable libunistring library found])], + [-L$sss_extra_libdir])], + [AC_MSG_ERROR([libunistring header files are not installed])] +) + +AC_CHECK_HEADERS([unicase.h], + [AC_CHECK_LIB([unistring], + [u8_casecmp], + [UNISTRING_LIBS="-lunistring"], + [AC_MSG_ERROR([No usable libunistring library found])], + [-L$sss_extra_libdir])], + [AC_MSG_ERROR([libunistring header files are not installed])] +) + +AC_CHECK_HEADERS([unistr.h], + [AC_CHECK_LIB([unistring], + [u8_check], + [UNISTRING_LIBS="-lunistring"], + [AC_MSG_ERROR([No usable libunistring library found])], + [-L$sss_extra_libdir])], + [AC_MSG_ERROR([libunistring header files are not installed])] +) + + +UNISTRING_LIBS="-L$sss_extra_libdir $UNISTRING_LIBS " diff --git a/src/external/libuuid.m4 b/src/external/libuuid.m4 new file mode 100644 index 0000000..323521c --- /dev/null +++ b/src/external/libuuid.m4 @@ -0,0 +1,17 @@ +AC_SUBST(UUID_LIBS) +AC_SUBST(UUID_CFLAGS) + +PKG_CHECK_MODULES([UUID], [uuid], [found_uuid=yes], [found_uuid=no]) + +SSS_AC_EXPAND_LIB_DIR() +AS_IF([test x"$found_uuid" != xyes], + [AC_CHECK_HEADERS([uuid/uuid.h], + [AC_CHECK_LIB([uuid], + [uuid_generate], + [UUID_LIBS="-L$sss_extra_libdir -luuid"], + [AC_MSG_ERROR([libuuid missing uuid_generate])], + [-L$sss_extra_libdir -luuid])], + [AC_MSG_ERROR([ +You must have the header file uuid.h installed to build sssd +with KCM responder. If you want to build sssd without KCM responder +then specify --without-kcm when running configure.])])]) diff --git a/src/external/nsupdate.m4 b/src/external/nsupdate.m4 new file mode 100644 index 0000000..a137f38 --- /dev/null +++ b/src/external/nsupdate.m4 @@ -0,0 +1,18 @@ +AC_PATH_PROG(NSUPDATE, nsupdate) +AC_MSG_CHECKING(for executable nsupdate) +if test -x "$NSUPDATE"; then + AC_DEFINE_UNQUOTED([NSUPDATE_PATH], ["$NSUPDATE"], [The path to nsupdate]) + AC_MSG_RESULT(yes) + + AC_MSG_CHECKING(for nsupdate 'realm' support') + if AC_RUN_LOG([echo realm |$NSUPDATE >&2]); then + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + AC_MSG_ERROR([nsupdate does not support 'realm']) + fi + +else + AC_MSG_RESULT([no]) + AC_MSG_ERROR([nsupdate is not available]) +fi diff --git a/src/external/p11-kit.m4 b/src/external/p11-kit.m4 new file mode 100644 index 0000000..eb0474f --- /dev/null +++ b/src/external/p11-kit.m4 @@ -0,0 +1,4 @@ +AC_SUBST(P11_KIT_CFLAGS) +AC_SUBST(P11_KIT_LIBS) + +PKG_CHECK_MODULES([P11_KIT], [p11-kit-1 >= 0.23.3]) diff --git a/src/external/pac_responder.m4 b/src/external/pac_responder.m4 new file mode 100644 index 0000000..9072718 --- /dev/null +++ b/src/external/pac_responder.m4 @@ -0,0 +1,44 @@ +AC_ARG_ENABLE([pac-responder], + [AS_HELP_STRING([--enable-pac-responder], + [build pac responder])], + [build_pac_responder=$enableval], + [build_pac_responder=yes]) + +krb5_version_ok=no +if test x$build_pac_responder = xyes +then + AC_PATH_PROG(KRB5_CONFIG, krb5-config) + AC_MSG_CHECKING(for supported MIT krb5 version) + KRB5_VERSION="`$KRB5_CONFIG --version`" + case $KRB5_VERSION in + Kerberos\ 5\ release\ 1.9* | \ + Kerberos\ 5\ release\ 1.10* | \ + Kerberos\ 5\ release\ 1.11* | \ + Kerberos\ 5\ release\ 1.12* | \ + Kerberos\ 5\ release\ 1.13* | \ + Kerberos\ 5\ release\ 1.14* | \ + Kerberos\ 5\ release\ 1.15* | \ + Kerberos\ 5\ release\ 1.16* | \ + Kerberos\ 5\ release\ 1.17* | \ + Kerberos\ 5\ release\ 1.18* | \ + Kerberos\ 5\ release\ 1.19* | \ + Kerberos\ 5\ release\ 1.20* | \ + Kerberos\ 5\ release\ 1.21*) + krb5_version_ok=yes + AC_MSG_RESULT([yes]) + ;; + *) + AC_MSG_RESULT([no]) + AC_MSG_WARN([Cannot build authdata plugin with this version of + MIT Kerberos, please use 1.9.x or later]) + esac +fi + +if test x$with_samba != xyes +then + AC_MSG_WARN([Cannot build PAC responder without Samba]) +fi + +AM_CONDITIONAL([BUILD_PAC_RESPONDER], [test x$build_pac_responder = xyes -a x$with_samba = xyes -a x$krb5_version_ok = xyes ]) +AM_COND_IF([BUILD_PAC_RESPONDER], + [AC_DEFINE_UNQUOTED(HAVE_PAC_RESPONDER, 1, [Build with the PAC responder])]) diff --git a/src/external/pam.m4 b/src/external/pam.m4 new file mode 100644 index 0000000..0dc7f19 --- /dev/null +++ b/src/external/pam.m4 @@ -0,0 +1,41 @@ +AC_SUBST(PAM_LIBS) +AC_SUBST(PAM_MISC_LIBS) + +AC_CHECK_HEADERS([security/pam_appl.h security/pam_modules.h], + [AC_CHECK_LIB([pam], [pam_get_item], + [PAM_LIBS="-lpam"], + [AC_MSG_ERROR([PAM must support pam_get_item])])], + [AC_MSG_ERROR([PAM development libraries not installed])] +) + +AC_CHECK_HEADERS([security/pam_ext.h security/pam_modutil.h]) +AC_CHECK_HEADERS([security/pam_misc.h security/_pam_macros.h]) +AC_CHECK_HEADERS([security/openpam.h],,,[ + #ifdef HAVE_SECURITY_PAM_APPL_H + #include <security/pam_appl.h> + #endif + ]) + +AC_CHECK_LIB([pam_misc], [misc_conv], + [PAM_MISC_LIBS="-lpam_misc"]) + +dnl save LIBS to restore later +save_LIBS="$LIBS" +LIBS="$PAM_LIBS" + +AC_CHECK_FUNCS(pam_modutil_getlogin pam_vsyslog) + +dnl restore LIBS +LIBS="$save_LIBS" + +PKG_CHECK_MODULES([GDM_PAM_EXTENSIONS], [gdm-pam-extensions], + [found_gdm_pam_extensions=yes], + [AC_MSG_NOTICE([gdm-pam-extensions were not found. gdm support +for multiple certificates will not be build. +])]) + +AC_SUBST(GDM_PAM_EXTENSIONS_CFLAGS) + +AS_IF([test x"$found_gdm_pam_extensions" = xyes], + [AC_DEFINE_UNQUOTED(HAVE_GDM_PAM_EXTENSIONS, 1, + [Build with gdm-pam-extensions support])]) diff --git a/src/external/pkg.m4 b/src/external/pkg.m4 new file mode 100644 index 0000000..568127f --- /dev/null +++ b/src/external/pkg.m4 @@ -0,0 +1,156 @@ +# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- +# +# Copyright © 2004 Scott James Remnant <scott@netsplit.com>. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, see <http://www.gnu.org/licenses/>. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# PKG_PROG_PKG_CONFIG([MIN-VERSION]) +# ---------------------------------- +AC_DEFUN([PKG_PROG_PKG_CONFIG], +[m4_pattern_forbid([^_?PKG_[A-Z_]+$]) +m4_pattern_allow([^PKG_CONFIG(_PATH)?$]) +AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl +if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then + AC_PATH_TOOL([PKG_CONFIG], [pkg-config]) +fi +if test -n "$PKG_CONFIG"; then + _pkg_min_version=m4_default([$1], [0.9.0]) + AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version]) + if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + PKG_CONFIG="" + fi + +fi[]dnl +])# PKG_PROG_PKG_CONFIG + +# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) +# +# Check to see whether a particular set of modules exists. Similar +# to PKG_CHECK_MODULES(), but does not set variables or print errors. +# +# +# Similar to PKG_CHECK_MODULES, make sure that the first instance of +# this or PKG_CHECK_MODULES is called, or make sure to call +# PKG_CHECK_EXISTS manually +# -------------------------------------------------------------- +AC_DEFUN([PKG_CHECK_EXISTS], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl +if test -n "$PKG_CONFIG" && \ + AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then + m4_ifval([$2], [$2], [:]) +m4_ifvaln([$3], [else + $3])dnl +fi]) + + +# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES]) +# --------------------------------------------- +m4_define([_PKG_CONFIG], +[if test -n "$PKG_CONFIG"; then + if test -n "$$1"; then + pkg_cv_[]$1="$$1" + else + PKG_CHECK_EXISTS([$3], + [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`], + [pkg_failed=yes]) + fi +else + pkg_failed=untried +fi[]dnl +])# _PKG_CONFIG + +# _PKG_SHORT_ERRORS_SUPPORTED +# ----------------------------- +AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG]) +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi[]dnl +])# _PKG_SHORT_ERRORS_SUPPORTED + + +# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], +# [ACTION-IF-NOT-FOUND]) +# +# +# Note that if there is a possibility the first call to +# PKG_CHECK_MODULES might not happen, you should be sure to include an +# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac +# +# +# -------------------------------------------------------------- +AC_DEFUN([PKG_CHECK_MODULES], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl +AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl +AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl + +pkg_failed=no +AC_MSG_CHECKING([for $1]) + +_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2]) +_PKG_CONFIG([$1][_LIBS], [libs], [$2]) + +m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS +and $1[]_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details.]) + +if test $pkg_failed = yes; then + _PKG_SHORT_ERRORS_SUPPORTED + if test $_pkg_short_errors_supported = yes; then + $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "$2"` + else + $1[]_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"` + fi + # Put the nasty error message in config.log where it belongs + echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD + + ifelse([$4], , [AC_MSG_ERROR(dnl +[Package requirements ($2) were not met: + +$$1_PKG_ERRORS + +Consider adjusting the PKG_CONFIG_PATH environment variable if you +installed software in a non-standard prefix. + +_PKG_TEXT +])], + [AC_MSG_RESULT([no]) + $4]) +elif test $pkg_failed = untried; then + ifelse([$4], , [AC_MSG_FAILURE(dnl +[The pkg-config script could not be found or is too old. Make sure it +is in your PATH or set the PKG_CONFIG environment variable to the full +path to pkg-config. + +_PKG_TEXT + +To get pkg-config, see <http://www.freedesktop.org/software/pkgconfig>.])], + [$4]) +else + $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS + $1[]_LIBS=$pkg_cv_[]$1[]_LIBS + AC_MSG_RESULT([yes]) + ifelse([$3], , :, [$3]) +fi[]dnl +])# PKG_CHECK_MODULES diff --git a/src/external/platform.m4 b/src/external/platform.m4 new file mode 100644 index 0000000..7585362 --- /dev/null +++ b/src/external/platform.m4 @@ -0,0 +1,56 @@ +AC_ARG_WITH([os], + [AC_HELP_STRING([--with-os=OS_TYPE], [Type of your operation system (fedora|redhat|suse|gentoo)])] + ) +osname="" +if test x"$with_os" != x ; then + if test x"$with_os" = xfedora || \ + test x"$with_os" = xredhat || \ + test x"$with_os" = xsuse || \ + test x"$with_os" = xgentoo || \ + test x"$with_os" = xdebian ; then + osname=$with_os + else + AC_MSG_ERROR([Illegal value -$with_os- for option --with-os]) + fi +fi + +if test x"$osname" = x ; then + if test -f /etc/fedora-release ; then + osname="fedora" + elif test -f /etc/redhat-release ; then + osname="redhat" + elif test -f /etc/SuSE-release ; then + osname="suse" + elif test -f /etc/debian_version ; then + osname="debian" + elif test -f /etc/gentoo-release ; then + osname="gentoo" + fi + + AC_MSG_NOTICE([Detected operating system type: $osname]) +fi + +AM_CONDITIONAL([HAVE_FEDORA], [test x"$osname" = xfedora]) +AM_CONDITIONAL([HAVE_REDHAT], [test x"$osname" = xredhat]) +AM_CONDITIONAL([HAVE_SUSE], [test x"$osname" = xsuse]) +AM_CONDITIONAL([HAVE_DEBIAN], [test x"$osname" = xdebian]) +AM_CONDITIONAL([HAVE_GENTOO], [test x"$osname" = xgentoo]) + +AS_CASE([$osname], + [redhat], [AC_DEFINE_UNQUOTED([HAVE_REDHAT], 1, [Build with redhat config])], + [fedora], [AC_DEFINE_UNQUOTED([HAVE_FEDORA], 1, [Build with fedora config])], + [suse], [AC_DEFINE_UNQUOTED([HAVE_SUSE], 1, [Build with suse config])], + [gentoo], [AC_DEFINE_UNQUOTED([HAVE_GENTOO], 1, [Build with gentoo config])], + [debian], [AC_DEFINE_UNQUOTED([HAVE_DEBIAN], 1, [Build with debian config])], + [AC_MSG_NOTICE([Build with $osname config])]) + +AC_CHECK_MEMBERS([struct ucred.pid, struct ucred.uid, struct ucred.gid], , , + [[#include <sys/socket.h>]]) + +if test x"$ac_cv_member_struct_ucred_pid" = xyes -a \ + x"$ac_cv_member_struct_ucred_uid" = xyes -a \ + x"$ac_cv_member_struct_ucred_gid" = xyes ; then + AC_DEFINE([HAVE_UCRED], [1], [Define if struct ucred is available]) +else + AC_MSG_WARN([struct ucred is not available]) +fi diff --git a/src/external/python.m4 b/src/external/python.m4 new file mode 100644 index 0000000..6a62835 --- /dev/null +++ b/src/external/python.m4 @@ -0,0 +1,186 @@ +dnl Check for python-config and substitute needed CFLAGS and LDFLAGS +dnl Usage: +dnl AM_PYTHON_CONFIG(python_with_major_version) +dnl argument python_with_major_version should be either python2 or python3 +dnl This function sets the PYTHON_CFLAGS, PYTHON_LIBS and PYTHON_INCLUDES +dnl variables + +AC_DEFUN([AM_PYTHON_CONFIG], +[ + AC_PATH_PROG([PYTHON_CONFIG], [python$PYTHON_VERSION-config]) + AS_IF([test x"$PYTHON_CONFIG" = x], + AC_MSG_ERROR([ +The program python$PYTHON_VERSION-config was not found in search path. +Please ensure that it is installed and its directory is included in the search +path. If you want to build sssd without $1 bindings then specify +--without-$1-bindings when running configure.])) + + PYTHON_CFLAGS="` $PYTHON_CONFIG --cflags`" + PYTHON_LIBS="` $PYTHON_CONFIG --libs`" + PYTHON_INCLUDES="` $PYTHON_CONFIG --includes`" + # With python3.8 it is expected that C extension do not link against + # libpythonX.Y anymore but only the application loading the extension links + # the library. pyhton3.8-config adds a new option --embed for this use + # case. See + # https://docs.python.org/dev/whatsnew/3.8.html#debug-build-uses-the-same-abi-as-release-build + # for details. Since the dlopen-test checks the python modules as well we + # have to make sure that it links libpythonX.Y. + # + # To build the Python modules PYTHON_LIBS must be used, python-config will + # take care that this does not include libpythonX.Y for Python3.8. + # + # For our dlopen-test PYTHON_DLOPEN_LIB must be used. It is either empty or + # contains libpythonX.Y if needed. + + $PYTHON_CONFIG --libs --embed 1> /dev/null 2> /dev/null + if test $? -eq 0; then + PYTHON_DLOPEN_LIB="` $PYTHON_CONFIG --libs --embed | grep -o -- '-lpython@<:@^ @:>@*' |sed -e 's/^-l/lib/'`" + if test x"$PYTHON_DLOPEN_LIB" != x; then + python_lib_paths="` $PYTHON_CONFIG --ldflags | grep -o -- '-L/@<:@^ @:>@*' | sed -e 's/^-L//'`" + for p in $python_lib_paths; do + if test -e $p"/"$PYTHON_DLOPEN_LIB; then + PYTHON_DLOPEN_LIB=$p"/"$PYTHON_DLOPEN_LIB + break + fi + done + PYTHON_DLOPEN_LIB=$PYTHON_DLOPEN_LIB".so" + AC_DEFINE_UNQUOTED([PYTHON_DLOPEN_LIB], ["$PYTHON_DLOPEN_LIB"], [The path of libpython for dlopen-tests]) + fi + fi +]) + +dnl Taken from GNOME sources +dnl a macro to check for ability to create python extensions +dnl AM_CHECK_PYTHON_HEADERS([ACTION-IF-POSSIBLE], [ACTION-IF-NOT-POSSIBLE]) +AC_DEFUN([AM_CHECK_PYTHON_HEADERS], +[ + AC_REQUIRE([AM_PATH_PYTHON]) + AC_MSG_CHECKING(for headers required to compile python extensions) + + dnl check if the headers exist: + save_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS $PYTHON_INCLUDES" + AC_TRY_CPP([#include <Python.h>],dnl + [AC_MSG_RESULT([found]) + $1],dnl + [AC_MSG_RESULT([not found]) + $2]) + CPPFLAGS="$save_CPPFLAGS" +]) + +dnl Clean variables after detection of python +AC_DEFUN([SSS_CLEAN_PYTHON_VARIABLES], +[ + unset pyexecdir pkgpyexecdir pythondir pgkpythondir + unset PYTHON PYTHON_CFLAGS PYTHON_LIBS PYTHON_INCLUDES + unset PYTHON_VERSION PYTHON_CONFIG + + dnl removed cached variables, required for reusing of AM_PATH_PYTHON + unset am_cv_pathless_PYTHON ac_cv_path_PYTHON am_cv_python_version + unset am_cv_python_platform am_cv_python_pythondir am_cv_python_pyexecdir + unset ac_cv_path_PYTHON_CONFIG +]) + +dnl =========================================================================== +dnl http://www.gnu.org/software/autoconf-archive/ax_python_module.html +dnl =========================================================================== +dnl +dnl SYNOPSIS +dnl +dnl AM_PYTHON2_MODULE(modname[, fatal]) +dnl +dnl DESCRIPTION +dnl +dnl Checks for Python 2 module. +dnl +dnl If fatal is non-empty then absence of a module will trigger an error. +dnl +dnl LICENSE +dnl +dnl Copyright (c) 2008 Andrew Collier +dnl +dnl Copying and distribution of this file, with or without modification, are +dnl permitted in any medium without royalty provided the copyright notice +dnl and this notice are preserved. This file is offered as-is, without any +dnl warranty. +AC_DEFUN([AM_PYTHON2_MODULE],[ + if test x"$PYTHON2" = x; then + if test -n "$2"; then + AC_MSG_ERROR([cannot look for $1 module: Python 2 not found]) + else + AC_MSG_NOTICE([cannot look for $1 module: Python 2 not found]) + eval AS_TR_CPP(HAVE_PY2MOD_$1)=no + fi + else + AC_MSG_CHECKING($(basename $PYTHON2) module: $1) + $PYTHON2 -c "import $1" 2>/dev/null + if test $? -eq 0; then + AC_MSG_RESULT(yes) + eval AS_TR_CPP(HAVE_PY2MOD_$1)=yes + else + AC_MSG_RESULT(no) + eval AS_TR_CPP(HAVE_PY2MOD_$1)=no + # + if test -n "$2" + then + AC_MSG_ERROR(failed to find required module $1) + exit 1 + fi + fi + fi +]) + +AC_DEFUN([AM_PYTHON3_MODULE],[ + if test x"$PYTHON3" = x; then + if test -n "$2"; then + AC_MSG_ERROR([cannot look for $1 module: Python 3 not found]) + else + AC_MSG_NOTICE([cannot look for $1 module: Python 3 not found]) + eval AS_TR_CPP(HAVE_PY3MOD_$1)=no + fi + else + AC_MSG_CHECKING($(basename $PYTHON3) module: $1) + $PYTHON3 -c "import $1" 2>/dev/null + if test $? -eq 0; then + AC_MSG_RESULT(yes) + eval AS_TR_CPP(HAVE_PY3MOD_$1)=yes + else + AC_MSG_RESULT(no) + eval AS_TR_CPP(HAVE_PY3MOD_$1)=no + # + if test -n "$2" + then + AC_MSG_ERROR(failed to find required module $1) + exit 1 + fi + fi + fi +]) + +dnl SYNOPSIS +dnl +dnl SSS_CHECK_PYTEST(python_interpreter, have_suffix) +dnl +dnl DESCRIPTION +dnl +dnl Checks for pytest +AC_DEFUN([SSS_CHECK_PYTEST],[ + if test x"$1" = x; then + if test -n "$2"; then + AC_MSG_ERROR([cannot look for pytest: $(basename $1) not found]) + else + AC_MSG_NOTICE([cannot look for pytest module: $(basename $1) not found]) + eval AS_TR_CPP(HAVE_$2)=no + fi + else + AC_MSG_CHECKING($(basename $1) pytest) + $1 -m pytest --version 2>/dev/null + if test $? -eq 0; then + AC_MSG_RESULT(yes) + eval AS_TR_CPP(HAVE_$2)=yes + else + AC_MSG_RESULT(no) + eval AS_TR_CPP(HAVE_$2)=no + fi + fi +]) diff --git a/src/external/samba.m4 b/src/external/samba.m4 new file mode 100644 index 0000000..23e5291 --- /dev/null +++ b/src/external/samba.m4 @@ -0,0 +1,168 @@ +AC_SUBST(NDR_NBT_CFLAGS) +AC_SUBST(NDR_NBT_LIBS) +AC_SUBST(SMBCLIENT_CFLAGS) +AC_SUBST(SMBCLIENT_LIBS) +AC_SUBST(NDR_KRB5PAC_CFLAGS) +AC_SUBST(NDR_KRB5PAC_LIBS) + +if test x"$with_samba" = xyes; then + PKG_CHECK_MODULES(NDR_NBT, ndr_nbt, , + AC_MSG_ERROR([[Please install Samba 4 NDR NBT development libraries. +Samba 4 libraries are necessary for building ad and ipa provider. +If you do not want to build these providers it is possible to build SSSD +without them. In this case, you will need to execute configure script +with argument --without-samba + ]])) + + PKG_CHECK_MODULES(NDR_KRB5PAC, ndr_krb5pac, , + AC_MSG_ERROR([[Please install Samba 4 NDR KRB5PAC development libraries. +Samba 4 libraries are necessary for building ad and ipa provider. +If you do not want to build these providers it is possible to build SSSD +without them. In this case, you will need to execute configure script +with argument --without-samba + ]])) + + PKG_CHECK_MODULES(SMBCLIENT, smbclient, , + AC_MSG_ERROR([[Please install libsmbclient development libraries. +libsmbclient libraries are necessary for building ad and ipa provider. +If you do not want to build these providers it is possible to build SSSD +without them. In this case, you will need to execute configure script +with argument --without-samba + ]])) + + PKG_CHECK_MODULES(SAMBA_UTIL, samba-util, , + AC_MSG_ERROR([[Please install libsamba-util development libraries. +libsamba-util libraries are necessary for building ad and ipa provider. +If you do not want to build these providers it is possible to build SSSD +without them. In this case, you will need to execute configure script +with argument --without-samba + ]])) + + if test x"$HAVE_LIBINI_CONFIG_V1_1" != x1; then + AC_MSG_ERROR([[Please install libini_config development libraries +v1.1.0, or newer. libini_config libraries are necessary for building ipa +provider, as well as for building gpo-based access control in ad provider. If +you do not want to build these providers it is possible to build SSSD without +them. In this case, you will need to execute configure script with argument +--without-samba + ]]) + fi + + AC_ARG_WITH([smb-idmap-interface-version], + [AC_HELP_STRING([--with-smb-idmap-interface-version=[5|6]], + [Idmap interface version of installed Samba] + ) + ] + ) + + if test x"$with_smb_idmap_interface_version" != x; then + if test x"$with_smb_idmap_interface_version" = x5 -o x"$with_smb_idmap_interface_version" = x6; then + idmap_test_result=$with_smb_idmap_interface_version + else + AC_MSG_ERROR([Illegal value -$with_smb_idmap_interface_version- for option --with-smb-idmap-interface-version]) + fi + else + + AC_MSG_CHECKING([Samba's idmap plugin interface version]) + sambalibdir="`$PKG_CONFIG --variable=libdir smbclient`"/samba + SAVE_CFLAGS=$CFLAGS + SAVE_LIBS=$LIBS + CFLAGS="$CFLAGS $SMBCLIENT_CFLAGS $NDR_NBT_CFLAGS $NDR_KRB5PAC_CFLAGS" + LIBS="$LIBS -L${sambalibdir} -lidmap-samba4 -Wl,-rpath ${sambalibdir}" + AC_RUN_IFELSE( + [AC_LANG_SOURCE([ +#include <stdlib.h> +#include <stdint.h> +#include <stdbool.h> +#include <tevent.h> +#include <core/ntstatus.h> + +struct winbindd_domain; + +/* overwrite some winbind internal functions */ +struct winbindd_domain *find_domain_from_name(const char *domain_name) +{ + return NULL; +} + +bool get_global_winbindd_state_offline(void) { + return false; +} + +struct tevent_context *winbind_event_context(void) +{ + return NULL; +} + +struct idmap_methods; + +NTSTATUS smb_register_idmap(int version, const char *name, struct idmap_methods *methods); + +int main(void) +{ + int v; + NTSTATUS ret; + + /* Check the versions we know about */ + for (v = 5; v <= 6; v++) { + ret = smb_register_idmap(v, NULL, NULL); + if (!NT_STATUS_EQUAL(ret, NT_STATUS_OBJECT_TYPE_MISMATCH)) { + return v; + } + } + + return -1; +}])], + [AC_MSG_ERROR([idmap version test program is not expected to return 0])], + [idmap_test_result=$?; AC_MSG_RESULT([idmap test result is: $idmap_test_result])] + ) + fi + + CFLAGS=$SAVE_CFLAGS + LIBS=$SAVE_LIBS + + if test $idmap_test_result -eq 5 -o $idmap_test_result -eq 6 ; then + idmap_version=$idmap_test_result + else + AC_MSG_ERROR([Cannot determine Samba's idmap interface version, please use --with-smb-idmap-interface-version]) + fi + AC_MSG_NOTICE([Samba's idmap interface version: $idmap_version]) + AC_DEFINE_UNQUOTED(SMB_IDMAP_INTERFACE_VERSION, $idmap_version, + [Detected version of Samba's idmap plugin interface]) + + samba_major_version=`printf '#include <samba/version.h>\nSAMBA_VERSION_MAJOR' | $CPP $SMBCLIENT_CFLAGS -P -` + samba_minor_version=`printf '#include <samba/version.h>\nSAMBA_VERSION_MINOR' | $CPP $SMBCLIENT_CFLAGS -P -` + samba_release_version=`printf '#include <samba/version.h>\nSAMBA_VERSION_RELEASE' | $CPP $SMBCLIENT_CFLAGS -P -` + AC_MSG_NOTICE([Samba version: $samba_major_version $samba_minor_version $samba_release_version]) + if ([[ $samba_major_version -gt 4 ]]) || + ([[ $samba_major_version -eq 4 ]] && [[ $samba_minor_version -ge 8 ]]) || + ([[ $samba_major_version -eq 4 ]] && [[ $samba_minor_version -eq 7 ]] && [[ $samba_release_version -ge 4 ]]); then + AC_DEFINE_UNQUOTED(SMB_IDMAP_DOMAIN_HAS_DOM_SID, 1, + [Samba's struct idmap_domain has dom_sid member]) + AC_MSG_NOTICE([Samba's struct idmap_domain has dom_sid member]) + else + AC_MSG_NOTICE([Samba's struct idmap_domain does not have dom_sid member]) + fi + + if ([[ $samba_major_version -gt 4 ]]) || + ([[ $samba_major_version -eq 4 ]] && [[ $samba_minor_version -ge 12 ]]); then + AC_DEFINE_UNQUOTED(SMB_HAS_NEW_NDR_PULL_STEAL_SWITCH, 1, + [Samba's new push/pull switch functions]) + AC_MSG_NOTICE([Samba has support for new ndr_push_steal_switch_value and ndr_pull_steal_switch_value functions]) + else + AC_MSG_NOTICE([Samba supports old ndr_pull_steal_switch_value and ndr_pull_steal_switch_value functions]) + fi +fi + +SAVE_CFLAGS=$CFLAGS +CFLAGS="$CFLAGS $SMBCLIENT_CFLAGS $NDR_NBT_CFLAGS $NDR_KRB5PAC_CFLAGS" +AC_CHECK_MEMBERS([struct PAC_LOGON_INFO.resource_groups], , , + [[ #include <ndr.h> + #include <gen_ndr/krb5pac.h> + #include <gen_ndr/krb5pac.h>]]) +AC_CHECK_MEMBERS([struct PAC_UPN_DNS_INFO.ex], , + [AC_MSG_NOTICE([union PAC_UPN_DNS_INFO_EX is not available, PAC checks will be limited])], + [[ #include <ndr.h> + #include <gen_ndr/krb5pac.h> + #include <gen_ndr/krb5pac.h>]]) +CFLAGS=$SAVE_CFLAGS diff --git a/src/external/sasl.m4 b/src/external/sasl.m4 new file mode 100644 index 0000000..791a835 --- /dev/null +++ b/src/external/sasl.m4 @@ -0,0 +1,15 @@ +AC_SUBST(SASL_LIBS) +AC_SUBST(SASL_CFLAGS) + +PKG_CHECK_MODULES([SASL], [libsasl2], [found_sasl=yes], [found_sasl=no]) + +SSS_AC_EXPAND_LIB_DIR() +AS_IF([test x"$found_sasl" != xyes], + [AC_CHECK_HEADERS([sasl/sasl.h], + [AC_CHECK_LIB([sasl2], + [sasl_client_init], + [SASL_LIBS="-L$sss_extra_libdir -lsasl2"], + [AC_MSG_ERROR([SASL library must support sasl_client_init])], + [-L$sss_extra_libdir])], + [AC_MSG_ERROR([SASL header files are not installed])])] +) diff --git a/src/external/selinux.m4 b/src/external/selinux.m4 new file mode 100644 index 0000000..d1b961a --- /dev/null +++ b/src/external/selinux.m4 @@ -0,0 +1,25 @@ +dnl A macro to check the availability of SELinux +AC_DEFUN([AM_CHECK_SELINUX], +[ + AC_CHECK_HEADERS(selinux/selinux.h, + [AC_CHECK_LIB(selinux, is_selinux_enabled, + [SELINUX_LIBS="-lselinux"], + [AC_MSG_ERROR([SELinux library is missing])] + ) + ], + [AC_MSG_ERROR([SELinux headers are missing])]) + AC_SUBST(SELINUX_LIBS) +]) + +dnl A macro to check the availability of SELinux management library +AC_DEFUN([AM_CHECK_SEMANAGE], +[ + AC_CHECK_HEADERS(semanage/semanage.h, + [AC_CHECK_LIB(semanage, semanage_handle_create, + [SEMANAGE_LIBS="-lsemanage"], + [AC_MSG_ERROR([libsemanage is missing])] + ) + ], + [AC_MSG_ERROR([libsemanage is missing])]) + AC_SUBST(SEMANAGE_LIBS) +]) diff --git a/src/external/service.m4 b/src/external/service.m4 new file mode 100644 index 0000000..b69760f --- /dev/null +++ b/src/external/service.m4 @@ -0,0 +1,13 @@ +AC_DEFUN([CHECK_SERVICE_EXECUTABLE], + [ AC_PATH_PROG([SERVICE], [service], [], [/sbin:/usr/sbin]) + AC_MSG_CHECKING(for the executable \"service\") + if test -x "$SERVICE"; then + AC_DEFINE(HAVE_SERVICE, 1, [Whether the service command is available]) + AC_DEFINE_UNQUOTED([SERVICE_PATH], ["$SERVICE"], [The path to service]) + AC_MSG_RESULT(yes) + else + AC_MSG_RESULT([no]) + AC_MSG_WARN([the service executable is not available]) + fi + ] +) diff --git a/src/external/signal.m4 b/src/external/signal.m4 new file mode 100644 index 0000000..747c7db --- /dev/null +++ b/src/external/signal.m4 @@ -0,0 +1 @@ +AC_CHECK_FUNCS(sigprocmask sigblock sigaction getpgrp prctl) diff --git a/src/external/sizes.m4 b/src/external/sizes.m4 new file mode 100644 index 0000000..0b6b630 --- /dev/null +++ b/src/external/sizes.m4 @@ -0,0 +1,51 @@ +# Solaris needs HAVE_LONG_LONG defined +AC_CHECK_TYPES(long long) + +AC_CHECK_SIZEOF(int) +AC_CHECK_SIZEOF(char) +AC_CHECK_SIZEOF(short) +AC_CHECK_SIZEOF(long) +AC_CHECK_SIZEOF(long long) +AC_CHECK_SIZEOF(uid_t) +AC_CHECK_SIZEOF(gid_t) +AC_CHECK_SIZEOF(id_t) +AC_CHECK_SIZEOF(time_t) + +if test $ac_cv_sizeof_long_long -lt 8 ; then +AC_MSG_ERROR([SSSD requires long long of 64-bits]) +fi + +AC_CHECK_TYPE(uint_t, unsigned int) +AC_CHECK_TYPE(int8_t, char) +AC_CHECK_TYPE(uint8_t, unsigned char) +AC_CHECK_TYPE(int16_t, short) +AC_CHECK_TYPE(uint16_t, unsigned short) + +if test $ac_cv_sizeof_int -eq 4 ; then +AC_CHECK_TYPE(int32_t, int) +AC_CHECK_TYPE(uint32_t, unsigned int) +elif test $ac_cv_size_long -eq 4 ; then +AC_CHECK_TYPE(int32_t, long) +AC_CHECK_TYPE(uint32_t, unsigned long) +else +AC_MSG_ERROR([LIBREPLACE no 32-bit type found]) +fi + +AC_CHECK_TYPE(int64_t, long long) +AC_CHECK_TYPE(uint64_t, unsigned long long) + +AC_CHECK_TYPE(size_t, unsigned int) +AC_CHECK_TYPE(ssize_t, int) + +AC_CHECK_SIZEOF(off_t) +AC_CHECK_SIZEOF(size_t) +AC_CHECK_SIZEOF(ssize_t) + + +AC_CHECK_TYPES([intptr_t], + [], + [AC_DEFINE_UNQUOTED([intptr_t], [long long], + [Define to `long long' + if <stdint.h> does not define.])]) +AC_CHECK_TYPE(uintptr_t, unsigned long long) +AC_CHECK_TYPE(ptrdiff_t, unsigned long long) diff --git a/src/external/systemd.m4 b/src/external/systemd.m4 new file mode 100644 index 0000000..a0e2049 --- /dev/null +++ b/src/external/systemd.m4 @@ -0,0 +1,61 @@ +if test x"$with_syslog" = xjournald || \ + test x"$with_initscript" = xsystemd; then + + dnl A macro to check presence of systemd on the system + PKG_CHECK_EXISTS([systemd], + [HAVE_SYSTEMD=yes], + [HAVE_SYSTEMD=no]) + + dnl Libraries libsystemd-journal and libsystem-login are deprecarted + dnl since systemd 209 and are removed in systemd 230. The library libsystemd + dnl is replacement of libsystemd-{login,journal,daemon,id128} libraries + PKG_CHECK_EXISTS([libsystemd], + [HAVE_LIBSYSTEMD=yes], + [HAVE_LIBSYSTEMD=no]) + + AS_IF([test x$HAVE_LIBSYSTEMD = xyes], + [login_lib_name=libsystemd], + [login_lib_name=libsystemd-login]) + + AS_IF([test x$HAVE_SYSTEMD = xyes], + [AC_DEFINE_UNQUOTED([HAVE_SYSTEMD], 1, [Build with systemd support])], + [AC_MSG_NOTICE([Build without systemd support])]) + + AS_IF([test x$HAVE_SYSTEMD = xyes], + [PKG_CHECK_MODULES( + [SYSTEMD_LOGIN], + [$login_lib_name], + [AC_DEFINE_UNQUOTED([HAVE_SYSTEMD_LOGIN], 1, + [Build with $login_lib_name support])], + [AC_MSG_NOTICE([Build without $login_lib_name support])])], + [AC_MSG_NOTICE([Build without $login_lib_name support])]) + + AS_IF([test x$HAVE_LIBSYSTEMD = xyes], + [daemon_lib_name=libsystemd], + [daemon_lib_name=libsystemd-daemon]) + + AS_IF([test x$HAVE_SYSTEMD = xyes], + [PKG_CHECK_MODULES( + [SYSTEMD_DAEMON], + [$daemon_lib_name], + [AC_DEFINE_UNQUOTED([HAVE_SYSTEMD_DAEMON], 1, + [Build with $daemon_lib_name support])], + [AC_MSG_NOTICE([Build without $daemon_lib_name support])])], + [AC_MSG_NOTICE([Build without $daemon_lib_name support])]) + + dnl A macro to check presence of journald on the system + AC_DEFUN([AM_CHECK_JOURNALD], + [ + AS_IF([test x$HAVE_LIBSYSTEMD = xyes], + [journal_lib_name=libsystemd], + [journal_lib_name=libsystemd-journal]) + + PKG_CHECK_MODULES(JOURNALD, [$journal_lib_name], + [AC_DEFINE_UNQUOTED([WITH_JOURNALD], 1, + [journald is available])]) + dnl Some older versions of pkg-config might not set these automatically + dnl while setting CFLAGS and LIBS manually twice doesn't hurt. + AC_SUBST([JOURNALD_CFLAGS]) + AC_SUBST([JOURNALD_LIBS]) + ]) +fi diff --git a/src/external/systemtap.m4 b/src/external/systemtap.m4 new file mode 100644 index 0000000..d1caa20 --- /dev/null +++ b/src/external/systemtap.m4 @@ -0,0 +1,35 @@ +dnl A macro to check the availability of systemtap user-space probes +AC_DEFUN([AM_CHECK_SYSTEMTAP], +[ + AC_ARG_ENABLE([systemtap], + [AS_HELP_STRING([--enable-systemtap], + [Enable inclusion of systemtap trace support])], + [ENABLE_SYSTEMTAP="${enableval}"], [ENABLE_SYSTEMTAP='no']) + + if test "x${ENABLE_SYSTEMTAP}" = xyes; then + AC_CHECK_PROGS(DTRACE, dtrace) + if test -z "$DTRACE"; then + AC_MSG_ERROR([dtrace not found]) + fi + + AC_CHECK_HEADER([sys/sdt.h], [SDT_H_FOUND='yes'], + [SDT_H_FOUND='no'; + AC_MSG_ERROR([systemtap support needs sys/sdt.h header])]) + + AC_DEFINE([HAVE_SYSTEMTAP], [1], [Define to 1 if systemtap is enabled]) + HAVE_SYSTEMTAP=1 + + AC_ARG_WITH([tapset-install-dir], + [AS_HELP_STRING([--with-tapset-install-dir], + [The absolute path where the tapset dir will be installed])], + [if test "x${withval}" = x; then + tapset_dir="\$(datadir)/systemtap/tapset" + else + tapset_dir="${withval}" + fi], + [tapset_dir="\$(datadir)/systemtap/tapset"]) + AC_SUBST(tapset_dir) + fi + + AM_CONDITIONAL([BUILD_SYSTEMTAP], [test x$HAVE_SYSTEMTAP = x1]) +]) diff --git a/src/external/test_ca.m4 b/src/external/test_ca.m4 new file mode 100644 index 0000000..a1b77d7 --- /dev/null +++ b/src/external/test_ca.m4 @@ -0,0 +1,68 @@ +dnl Check for tools needed to run the test CA +AC_DEFUN([AM_CHECK_TEST_CA], +[ + AC_PATH_PROG([OPENSSL], [openssl]) + if test ! -x "$OPENSSL"; then + AC_MSG_NOTICE([Could not find openssl]) + fi + + AC_PATH_PROG([SSH_KEYGEN], [ssh-keygen]) + if test ! -x "$SSH_KEYGEN"; then + AC_MSG_NOTICE([Could not find ssh-keygen]) + else + AC_MSG_CHECKING([for -m option of ssh-keygen]) + if AC_RUN_LOG([$SSH_KEYGEN --help 2>&1 |grep -- '-m ' > /dev/null]); then + AC_MSG_RESULT([yes]) + else + SSH_KEYGEN="" + AC_MSG_RESULT([no]) + fi + fi + + for p in "$(eval echo ${libdir})"/softhsm/libsofthsm2.so \ + "$(eval echo ${libdir})"/pkcs11/libsofthsm2.so \ + /usr/lib*/pkcs11/libsofthsm2.so \ + /usr/lib/*-linux-gnu*/softhsm/libsofthsm2.so \ + /usr/lib/softhsm/libsofthsm2.so; do + if test -f "${p}"; then + SOFTHSM2_PATH="${p}" + break; + fi + done + if test -n "$SOFTHSM2_PATH"; then + AC_SUBST(SOFTHSM2_PATH) + AC_DEFINE_UNQUOTED(SOFTHSM2_PATH, "$SOFTHSM2_PATH" , + [Path to softhsm2 PKCS#11 module]) + AC_MSG_NOTICE([Using softhsm2 PKCS11 module: $SOFTHSM2_PATH]) + else + AC_MSG_NOTICE([Could not find softhsm2 PKCS11 module]) + fi + + AC_PATH_PROG([SOFTHSM2_UTIL], [softhsm2-util]) + if test ! -x "$SOFTHSM2_UTIL"; then + AC_MSG_NOTICE([Could not find softhsm2-util]) + fi + + AC_PATH_PROG([P11TOOL], [p11tool]) + if test ! -x "$P11TOOL"; then + AC_MSG_NOTICE([Could not find p11tool]) + fi + + AM_CONDITIONAL([BUILD_TEST_CA], [test -x "$OPENSSL" -a -x "$SSH_KEYGEN" -a -r "$SOFTHSM2_PATH" -a -x "$SOFTHSM2_UTIL" -a -x "$P11TOOL"]) + + AM_COND_IF([BUILD_TEST_CA], + [AC_DEFINE_UNQUOTED(HAVE_TEST_CA, 1, + [Build with certificates from test CA])], + [AC_MSG_WARN([Test CA cannot be build, skiping some tests])]) + + AC_PATH_PROG([FAKETIME], [faketime]) + if test ! -x "$FAKETIME"; then + AC_MSG_NOTICE([Could not find faketime]) + fi + AM_CONDITIONAL([HAVE_FAKETIME], [test -x "$FAKETIME"]) + + AM_COND_IF([HAVE_FAKETIME], + [AC_DEFINE_UNQUOTED(HAVE_FAKETIME, 1, + [Using faketime for some tests])], + [AC_MSG_WARN([faketime not available, skiping some tests])]) +]) |