URL: https://github.com/freeipa/freeipa/pull/494 Author: lslebodn Title: #494: Support client-only build Action: opened
PR body: """ How to test: * autoreconf -if * ./configure --disable-server * make srpms * mock --rebuild dist/rpms/freeipa-4.4.90.*.src.rpm --resultdir . * mock --rebuild dist/rpms/freeipa-4.4.90.*.src.rpm --resultdir . --without=server """ To pull the PR as Git branch: git remote add ghfreeipa https://github.com/freeipa/freeipa git fetch ghfreeipa pull/494/head:pr494 git checkout pr494
From b4e0d5ed62bfdb09e1a329e35a15e8cb138026ab Mon Sep 17 00:00:00 2001 From: Lukas Slebodnik <lsleb...@redhat.com> Date: Wed, 22 Feb 2017 09:39:08 +0100 Subject: [PATCH 01/14] CONFIGURE: Decrease dependency on libini_config libini_config is used only in ipa-getkeytab and it uses only functions from libini_config-1.1 sh$ objdump -p /usr/sbin/ipa-getkeytab | grep INI_CONFIG 0x00acdc20 0x00 04 INI_CONFIG_1.1.0 There is not any reason ho have dependency for higher version and lower dependency will allow to build client only on older distributions. --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 44dc11b..246803f 100644 --- a/configure.ac +++ b/configure.ac @@ -265,7 +265,7 @@ AC_SUBST(LIBINTL_LIBS) dnl --------------------------------------------------------------------------- dnl - Check for libini_config dnl --------------------------------------------------------------------------- -PKG_CHECK_MODULES([INI], [ini_config >= 1.2.0]) +PKG_CHECK_MODULES([INI], [ini_config >= 1.1.0]) dnl --------------------------------------------------------------------------- dnl - Check for systemd directories From be1e3f5b8764e03355a45b52a6fb0df9c0b408d8 Mon Sep 17 00:00:00 2001 From: Lukas Slebodnik <lsleb...@redhat.com> Date: Wed, 22 Feb 2017 09:39:20 +0100 Subject: [PATCH 02/14] CONFIGURE: Properly detect libpopt on el7 libpopt added pkg-config file in 1.16 but there are still distributions which has older version of library (el6, el7). And new features from libpopt are not used anywhere. Configure should try to detect as much as possible and users should not use workarounds with explicitely enabled variables as parameters e.g. ./configure POPT_LIBS="-lpopt " --- configure.ac | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 246803f..0a23fd2 100644 --- a/configure.ac +++ b/configure.ac @@ -235,7 +235,13 @@ PKG_CHECK_MODULES([SSSNSSIDMAP], [sss_nss_idmap >= 1.13.90]) dnl --------------------------------------------------------------------------- dnl - Check for POPT dnl --------------------------------------------------------------------------- -PKG_CHECK_MODULES([POPT], [popt]) +POPT_LIBS= +PKG_CHECK_MODULES([POPT], [popt], [], + [AC_CHECK_HEADER([popt.h], [], [AC_MSG_ERROR([popt.h not found])]) + AC_CHECK_LIB([popt], [poptGetContext], [POPT_LIBS="-lpopt"]) + AC_SUBST(POPT_LIBS) + ] +) dnl --------------------------------------------------------------------------- dnl - Check for SASL From 811080737684c2e1fcab425616ec0a6f7d5a2dee Mon Sep 17 00:00:00 2001 From: Lukas Slebodnik <lsleb...@redhat.com> Date: Wed, 22 Feb 2017 09:39:25 +0100 Subject: [PATCH 03/14] CONFIGURE: Improve detection of xmlrpc_c flags The pkg-config files for xmlrpc_c libraries are shipped just in fedora/rhel due to downstream patch. Debian does not have pkg-config files for xmlrpc_c. Therefore we need to fallback to older method of detection XMLRPC_*FLAGS which was reverted by the commit 1e0143c159134337a00a91d4ae64e614f72da62e --- configure.ac | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 0a23fd2..821ae21 100644 --- a/configure.ac +++ b/configure.ac @@ -251,7 +251,20 @@ PKG_CHECK_MODULES([SASL], [libsasl2]) dnl --------------------------------------------------------------------------- dnl - Check for XMLRPC-C dnl --------------------------------------------------------------------------- -PKG_CHECK_MODULES([XMLRPC], [xmlrpc xmlrpc_client xmlrpc_util]) +PKG_CHECK_MODULES([XMLRPC], [xmlrpc xmlrpc_client xmlrpc_util], [], + [try_xmlrpc_fallback=true]) +if test x"$try_xmlrpc_fallback" = xtrue; then + XMLRPC_LIBS= + AC_CHECK_HEADER([xmlrpc-c/base.h], [], + [AC_MSG_ERROR([xmlrpc-c/base.h not found])]) + + AC_CHECK_LIB([xmlrpc_client], [xmlrpc_client_init2], + [XMLRPC_LIBS="-lxmlrpc -lxmlrpc_client -lxmlrpc_util"]) + if test "x$XMLRPC_LIBS" = "x" ; then + AC_MSG_ERROR([xmlrpc-c not found]) + fi + AC_SUBST(XMLRPC_LIBS) +fi dnl --------------------------------------------------------------------------- dnl - Check for libintl From 34ebfdef2ca8578a6345de508c7dda1ce9c46ae8 Mon Sep 17 00:00:00 2001 From: Lukas Slebodnik <lsleb...@redhat.com> Date: Wed, 22 Feb 2017 09:39:31 +0100 Subject: [PATCH 04/14] CONFIGURE: Remove manual detection of libintl The gettext provided macro AM_GNU_GETTEXT checks for required header file "libintl.h" and also provide variable with linker flags LTLIBINTL. The detection is more robus an platform independent. It can also detect situation when gettext is not part of glibc and external library is required. This patch simplify detection and improve portability. --- client/Makefile.am | 6 +++--- configure.ac | 15 --------------- 2 files changed, 3 insertions(+), 18 deletions(-) diff --git a/client/Makefile.am b/client/Makefile.am index b6c9dea..f186111 100644 --- a/client/Makefile.am +++ b/client/Makefile.am @@ -58,7 +58,7 @@ ipa_getkeytab_LDADD = \ $(LDAP_LIBS) \ $(SASL_LIBS) \ $(POPT_LIBS) \ - $(LIBINTL_LIBS) \ + $(LTLIBINTL) \ $(INI_LIBS) \ $(NULL) @@ -70,7 +70,7 @@ ipa_rmkeytab_SOURCES = \ ipa_rmkeytab_LDADD = \ $(KRB5_LIBS) \ $(POPT_LIBS) \ - $(LIBINTL_LIBS) \ + $(LTLIBINTL) \ $(NULL) ipa_join_SOURCES = \ @@ -85,7 +85,7 @@ ipa_join_LDADD = \ $(SASL_LIBS) \ $(XMLRPC_LIBS) \ $(POPT_LIBS) \ - $(LIBINTL_LIBS) \ + $(LTLIBINTL) \ $(NULL) SUBDIRS = \ diff --git a/configure.ac b/configure.ac index 821ae21..c50f146 100644 --- a/configure.ac +++ b/configure.ac @@ -267,21 +267,6 @@ if test x"$try_xmlrpc_fallback" = xtrue; then fi dnl --------------------------------------------------------------------------- -dnl - Check for libintl -dnl --------------------------------------------------------------------------- -SAVE_LIBS="$LIBS" -LIBINTL_LIBS= -AC_CHECK_HEADER(libintl.h, [], [AC_MSG_ERROR([libintl.h not found, please install xgettext])]) -AC_SEARCH_LIBS([bindtextdomain], [libintl],[], []) -if test "x$ac_cv_search_bindtextdomain" = "xno" ; then - AC_MSG_ERROR([libintl is not found and your libc does not support gettext, please install xgettext]) -elif test "x$ac_cv_search_bindtextdomain" != "xnone required" ; then - LIBINTL_LIBS="$ac_cv_search_bindtextdomain" -fi -LIBS="$SAVELIBS" -AC_SUBST(LIBINTL_LIBS) - -dnl --------------------------------------------------------------------------- dnl - Check for libini_config dnl --------------------------------------------------------------------------- PKG_CHECK_MODULES([INI], [ini_config >= 1.1.0]) From 3ffa0b51db2b9531da358f4b05f9ed233b7f91d6 Mon Sep 17 00:00:00 2001 From: Lukas Slebodnik <lsleb...@redhat.com> Date: Wed, 22 Feb 2017 09:39:37 +0100 Subject: [PATCH 05/14] CONFIGURE: Remove unused check for UNLINK It was used to replace value in ipa-opts.socket but it was removed in the commit d05d1115e409962fee3576a4bfc5cecfacef4fd3 --- configure.ac | 5 ----- daemons/ipa-otpd/Makefile.am | 1 - 2 files changed, 6 deletions(-) diff --git a/configure.ac b/configure.ac index c50f146..ac2ff49 100644 --- a/configure.ac +++ b/configure.ac @@ -300,11 +300,6 @@ AC_ARG_WITH([sysconfenvdir], AC_SUBST([sysconfenvdir]) dnl --------------------------------------------------------------------------- -dnl - Check for program paths -dnl --------------------------------------------------------------------------- -AC_PATH_PROG(UNLINK, unlink, [AC_MSG_ERROR([unlink not found])]) - -dnl --------------------------------------------------------------------------- dnl - Set the data install directory since we don't use pkgdatadir dnl --------------------------------------------------------------------------- diff --git a/daemons/ipa-otpd/Makefile.am b/daemons/ipa-otpd/Makefile.am index 9ba6237..1603e73 100644 --- a/daemons/ipa-otpd/Makefile.am +++ b/daemons/ipa-otpd/Makefile.am @@ -11,7 +11,6 @@ ipa_otpd_SOURCES = bind.c forward.c main.c parse.c query.c queue.c stdio.c %.socket: %.socket.in @sed -e 's|@krb5rundir[@]|$(krb5rundir)|g' \ - -e 's|@UNLINK[@]|@UNLINK@|g' \ $< > $@ %.service: %.service.in From a1321abbdb2cf510e0f36c65d2af0fb6329d2e23 Mon Sep 17 00:00:00 2001 From: Lukas Slebodnik <lsleb...@redhat.com> Date: Wed, 22 Feb 2017 09:39:42 +0100 Subject: [PATCH 06/14] CONFIGURE: Check for python module setuptools It is required for installation of python modules therefore it should be checked at aonfigure time. GEN ipasetup.py make[3]: Leaving directory `/workdir/freeipa' cd .; /usr/bin/python setup.py \ "--verbose" \ build \ --build-base "/workdir/freeipa/ipaclient/build" Traceback (most recent call last): File "setup.py", line 29, in <module> from ipasetup import ipasetup # noqa: E402 File "/workdir/freeipa/ipasetup.py", line 20, in <module> from setuptools.command.build_py import build_py as setuptools_build_py ImportError: No module named setuptools.command.build_py --- configure.ac | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/configure.ac b/configure.ac index ac2ff49..11d5944 100644 --- a/configure.ac +++ b/configure.ac @@ -121,6 +121,15 @@ if test "x$PYTHON" = "x" ; then AC_MSG_ERROR([Python not found]) fi +AC_MSG_CHECKING($(basename $PYTHON) module setuptools ) +$PYTHON -c "import setuptools" 2>/dev/null +if test $? -eq 0; then + AC_MSG_RESULT([yes]) +else + AC_MSG_RESULT([no]) + AC_MSG_ERROR([$PYTHON module setuptools is required for installation]) +fi + dnl --------------------------------------------------------------------------- dnl Check for ndr_krb5pac and other samba libraries dnl --------------------------------------------------------------------------- From 6776993334f0a2addb3aeeba9e4f7125e342bd5c Mon Sep 17 00:00:00 2001 From: Lukas Slebodnik <lsleb...@redhat.com> Date: Wed, 22 Feb 2017 09:39:58 +0100 Subject: [PATCH 07/14] ipa_pwd: remove unnecessary dependency on dirsrv plugins "dirsrv/slapi-plugin.h" is unnecessary for build of ipa_pwd. This patch allow us to move DIRSRV to daemon only dependencies --- util/ipa_pwd.h | 3 +++ util/ipa_pwd_ntlm.c | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/util/ipa_pwd.h b/util/ipa_pwd.h index 15041c4..b3ee750 100644 --- a/util/ipa_pwd.h +++ b/util/ipa_pwd.h @@ -22,6 +22,9 @@ #pragma once +#include <stdint.h> +#include <time.h> /* for time_t */ + /* 90 days default pwd max lifetime */ #define IPAPWD_DEFAULT_PWDLIFE (90 * 24 *3600) #define IPAPWD_DEFAULT_MINLEN 0 diff --git a/util/ipa_pwd_ntlm.c b/util/ipa_pwd_ntlm.c index e7acb9b..263816d 100644 --- a/util/ipa_pwd_ntlm.c +++ b/util/ipa_pwd_ntlm.c @@ -24,10 +24,11 @@ * */ +#include <stdlib.h> #include <stdbool.h> +#include <string.h> #include <iconv.h> #include <openssl/md4.h> -#include <dirsrv/slapi-plugin.h> #include "ipa_pwd.h" From 42fb9b1c6b8bdeb5faf75427d3ee7d5e3140c92a Mon Sep 17 00:00:00 2001 From: Lukas Slebodnik <lsleb...@redhat.com> Date: Wed, 22 Feb 2017 09:40:06 +0100 Subject: [PATCH 08/14] ipaplatform: Create alias for CentOS CentOS and rhel are equivalent but configure time detection failed configure: error: IPA platform centos is not supported --- ipaplatform/Makefile.am | 2 ++ ipaplatform/centos | 1 + 2 files changed, 3 insertions(+) create mode 120000 ipaplatform/centos diff --git a/ipaplatform/Makefile.am b/ipaplatform/Makefile.am index 8be72b2..774eba8 100644 --- a/ipaplatform/Makefile.am +++ b/ipaplatform/Makefile.am @@ -1 +1,3 @@ include $(top_srcdir)/Makefile.python.am + +EXTRA_DIST=centos diff --git a/ipaplatform/centos b/ipaplatform/centos new file mode 120000 index 0000000..4d08279 --- /dev/null +++ b/ipaplatform/centos @@ -0,0 +1 @@ +redhat \ No newline at end of file From d86cc67036520a77e350513ef802e4c557a8e018 Mon Sep 17 00:00:00 2001 From: Lukas Slebodnik <lsleb...@redhat.com> Date: Wed, 22 Feb 2017 09:40:18 +0100 Subject: [PATCH 09/14] CONFIGURE: Modernize configure.ac script Most of autoconf macros has implicit parameters [action-if-found], [action-if-not-found]. They were not used on many places and configure script tried to check result of tests from ac_cv_* variables. Sometimes variable was checked twice and there was error in both cases. (the 2nd check was a dead code) e.g. ac_cv_header_dirsrv_slapi-plugin_h This patch also fixed mixed horizontal tabs and spaces. It also fixes ver long lines which was difficult to read. Resolves: https://fedorahosted.org/freeipa/ticket/6517 --- configure.ac | 232 ++++++++++++++++++++++++++++++----------------------------- 1 file changed, 117 insertions(+), 115 deletions(-) diff --git a/configure.ac b/configure.ac index 11d5944..1665ce3 100644 --- a/configure.ac +++ b/configure.ac @@ -39,19 +39,12 @@ dnl --------------------------------------------------------------------------- # Need to hack CPPFLAGS to be able to correctly detetct slapi-plugin.h SAVE_CPPFLAGS=$CPPFLAGS CPPFLAGS=$NSPR_CFLAGS -AC_CHECK_HEADER(dirsrv/slapi-plugin.h) -if test "x$ac_cv_header_dirsrv_slapi-plugin_h" = "xno" ; then - AC_MSG_ERROR([Required 389-ds header not available (389-ds-base-devel)]) -fi -AC_CHECK_HEADER(dirsrv/repl-session-plugin.h) -if test "x$ac_cv_header_dirsrv_repl_session_plugin_h" = "xno" ; then - AC_MSG_ERROR([Required 389-ds header not available (389-ds-base-devel)]) -fi -CPPFLAGS=$SAVE_CPPFLAGS +AC_CHECK_HEADER([dirsrv/slapi-plugin.h], [], + [AC_MSG_ERROR([Required 389-ds header not available (389-ds-base-devel)])]) -if test "x$ac_cv_header_dirsrv_slapi_plugin_h" = "xno" ; then - AC_MSG_ERROR([Required DS slapi plugin header not available (fedora-ds-base-devel)]) -fi +AC_CHECK_HEADER([dirsrv/repl-session-plugin.h], [], + [AC_MSG_ERROR([Required 389-ds header not available (389-ds-base-devel)])]) +CPPFLAGS=$SAVE_CPPFLAGS dnl --------------------------------------------------------------------------- dnl - Check for KRB5 @@ -67,21 +60,22 @@ AC_SUBST(krb5rundir) AC_CHECK_HEADER(kdb.h, [], [AC_MSG_ERROR([kdb.h not found])]) AC_CHECK_MEMBER( - [kdb_vftabl.free_principal], - [AC_DEFINE([HAVE_KDB_FREEPRINCIPAL], [1], - [KDB driver API has free_principal callback])], - [AC_MSG_NOTICE([KDB driver API has no free_principal callback])], - [[#include <kdb.h>]]) + [kdb_vftabl.free_principal], + [AC_DEFINE([HAVE_KDB_FREEPRINCIPAL], [1], + [KDB driver API has free_principal callback])], + [AC_MSG_NOTICE([KDB driver API has no free_principal callback])], + [[#include <kdb.h>]]) AC_CHECK_MEMBER( - [kdb_vftabl.free_principal_e_data], - [AC_DEFINE([HAVE_KDB_FREEPRINCIPAL_EDATA], [1], - [KDB driver API has free_principal_e_data callback])], - [AC_MSG_NOTICE([KDB driver API has no free_principal_e_data callback])], - [[#include <kdb.h>]]) + [kdb_vftabl.free_principal_e_data], + [AC_DEFINE([HAVE_KDB_FREEPRINCIPAL_EDATA], [1], + [KDB driver API has free_principal_e_data callback])], + [AC_MSG_NOTICE([KDB driver API has no free_principal_e_data callback])], + [[#include <kdb.h>]]) if test "x$ac_cv_member_kdb_vftabl_free_principal" = "xno" \ - -a "x$ac_cv_member_kdb_vftable_free_principal_e_data" = "xno" ; then - AC_MSG_WARN([KDB driver API does not allow to free Kerberos principal data.]) + -a "x$ac_cv_member_kdb_vftable_free_principal_e_data" = "xno" ; then + AC_MSG_WARN([KDB driver API does not allow to free Kerberos ] + [principal data.]) AC_MSG_WARN([KDB driver will leak memory on Kerberos principal use]) AC_MSG_WARN([See https://github.com/krb5/krb5/pull/596 for details]) fi @@ -114,12 +108,8 @@ dnl - Check for Python dnl --------------------------------------------------------------------------- AC_MSG_NOTICE([Checking for Python]) -have_python=no -AM_PATH_PYTHON(2.7) - -if test "x$PYTHON" = "x" ; then - AC_MSG_ERROR([Python not found]) -fi +AM_PATH_PYTHON([2.7], [], + [AC_MSG_ERROR([Python not found])]) AC_MSG_CHECKING($(basename $PYTHON) module setuptools ) $PYTHON -c "import setuptools" 2>/dev/null @@ -141,7 +131,8 @@ PKG_CHECK_MODULES([NDRPAC], [ndr_krb5pac]) PKG_CHECK_MODULES([NDRNBT], [ndr_nbt]) PKG_CHECK_MODULES([NDR], [ndr]) PKG_CHECK_MODULES([SAMBAUTIL], [samba-util]) -SAMBA40EXTRA_LIBPATH="-L`$PKG_CONFIG --variable=libdir samba-util`/samba -Wl,-rpath=`$PKG_CONFIG --variable=libdir samba-util`/samba" +SMB_INTERNAL_LIBDIR="$($PKG_CONFIG --variable=libdir samba-util)/samba" +SAMBA40EXTRA_LIBPATH="-L$SMB_INTERNAL_LIBDIR -Wl,-rpath=$SMB_INTERNAL_LIBDIR" AC_SUBST(SAMBA40EXTRA_LIBPATH) bck_cflags="$CFLAGS" @@ -167,21 +158,24 @@ if test "x$LIB_PDB_NAME" = "xpdb" ; then AC_CHECK_LIB([$LIBPDB_NAME], [make_pdb_method], [HAVE_LIBPDB=1], - [AC_MSG_ERROR([Neither libpdb nor libsamba-passdb does have make_pdb_method])], + [AC_MSG_ERROR([Neither libpdb nor libsamba-passdb does have ] + [make_pdb_method])], [$SAMBA40EXTRA_LIBPATH]) fi AC_SUBST(LIBPDB_NAME) -AC_CHECK_LIB([$LIBPDB_NAME],[pdb_enum_upn_suffixes], - [AC_DEFINE([HAVE_PDB_ENUM_UPN_SUFFIXES], [1], [Ability to enumerate UPN suffixes])], - [AC_MSG_WARN([libpdb does not have pdb_enum_upn_suffixes, no support for realm domains in ipasam])], +AC_CHECK_LIB([$LIBPDB_NAME], [pdb_enum_upn_suffixes], + [AC_DEFINE([HAVE_PDB_ENUM_UPN_SUFFIXES], [1], + [Ability to enumerate UPN suffixes])], + [AC_MSG_WARN([libpdb does not have pdb_enum_upn_suffixes, ] + [no support for realm domains in ipasam])], [$SAMBA40EXTRA_LIBPATH]) dnl --------------------------------------------------------------------------- dnl Check for libunistring dnl --------------------------------------------------------------------------- -AC_CHECK_HEADERS([unicase.h],,AC_MSG_ERROR([Could not find unicase.h])) +AC_CHECK_HEADERS([unicase.h], [], AC_MSG_ERROR([Could not find unicase.h])) AC_CHECK_LIB([unistring], [ulc_casecmp], [UNISTRING_LIBS="-lunistring"], @@ -199,7 +193,8 @@ dnl --------------------------------------------------------------------------- PKG_CHECK_EXISTS(cmocka, [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]) + [AC_MSG_WARN([Header files stdarg.h stddef.h setjmp.h are required ] + [by cmocka]) cmocka_required_headers="no" ] ) @@ -211,7 +206,8 @@ PKG_CHECK_EXISTS(cmocka, ) AM_CONDITIONAL([HAVE_CMOCKA], [test x$have_cmocka = xyes]) -dnl A macro to check presence of a cwrap (http://cwrap.org) wrapper on the system +dnl A macro to check presence of a cwrap (http://cwrap.org) wrapper +dnl on the system dnl Usage: dnl AM_CHECK_WRAPPER(name, conditional) dnl If the cwrap library is found, sets the HAVE_$name conditional @@ -227,7 +223,8 @@ AC_DEFUN([AM_CHECK_WRAPPER], ], [ AC_MSG_RESULT([no]) - AC_MSG_WARN([cwrap library $1 not found, some tests will not run]) + AC_MSG_WARN([cwrap library $1 not found, some tests ] + [will not run]) ]) AM_CONDITIONAL($2, [ test x$FOUND_WRAPPER = x1]) @@ -284,28 +281,32 @@ dnl --------------------------------------------------------------------------- dnl - Check for systemd directories dnl --------------------------------------------------------------------------- PKG_CHECK_EXISTS([systemd], [], [AC_MSG_ERROR([systemd not found])]) +def_systemdsystemunitdir=$($PKG_CONFIG --define-variable=prefix='${prefix}' \ + --variable=systemdsystemunitdir systemd) AC_ARG_WITH([systemdsystemunitdir], - AS_HELP_STRING([--with-systemdsystemunitdir=DIR], - [Directory for systemd service files]), - [systemdsystemunitdir=$with_systemdsystemunitdir], - [systemdsystemunitdir=$($PKG_CONFIG --define-variable=prefix='${prefix}' --variable=systemdsystemunitdir systemd)]) + [AS_HELP_STRING([--with-systemdsystemunitdir=DIR], + [Directory for systemd service files])], + [systemdsystemunitdir=$with_systemdsystemunitdir], + [systemdsystemunitdir=$def_systemdsystemunitdir]) AC_SUBST([systemdsystemunitdir]) +def_systemdtmpfilesdir=$($PKG_CONFIG --define-variable=prefix='${prefix}' \ + --variable=tmpfilesdir systemd) AC_ARG_WITH([systemdtmpfilesdir], - AS_HELP_STRING([--with-systemdtmpfilesdir=DIR], - [Directory for systemd-tmpfiles configuration files]), - [systemdtmpfilesdir=$with_systemdtmpfilesdir], - [systemdtmpfilesdir=$($PKG_CONFIG --define-variable=prefix='${prefix}' --variable=tmpfilesdir systemd)]) + [AS_HELP_STRING([--with-systemdtmpfilesdir=DIR], + [Directory for systemd-tmpfiles configuration files])], + [systemdtmpfilesdir=$with_systemdtmpfilesdir], + [systemdtmpfilesdir=$def_systemdtmpfilesdir]) AC_SUBST([systemdtmpfilesdir]) dnl --------------------------------------------------------------------------- dnl - Get /etc/sysconfig directory path dnl --------------------------------------------------------------------------- AC_ARG_WITH([sysconfenvdir], - AS_HELP_STRING([--with-sysconfenvdir=DIR], - [Directory for daemon environment files]), - [sysconfenvdir=$with_sysconfenvdir], - [sysconfenvdir="${sysconfdir}/sysconfig"]) + [AS_HELP_STRING([--with-sysconfenvdir=DIR], + [Directory for daemon environment files])], + [sysconfenvdir=$with_sysconfenvdir], + [sysconfenvdir="${sysconfdir}/sysconfig"]) AC_SUBST([sysconfenvdir]) dnl --------------------------------------------------------------------------- @@ -322,27 +323,26 @@ dnl Translations dnl --------------------------------------------------------------------------- # POTFILES.in needs to be created before calling AM_GNU_GETTEXT AC_CONFIG_COMMANDS([po/POTFILES.in], - [find_start_pwd=`pwd` && dnl - cd "${ac_abs_top_srcdir}" && dnl strip prefixes from find - find . dnl - -path "./rpmbuild" -prune -o dnl - -path "./${PACKAGE}-*" -prune -o dnl dist directories - -path '*/build' -prune -o dnl Python builds - -path '*/dist' -prune -o dnl Python dists - -path './conf*' -prune -o dnl generated by configure - -name '*.py' -print -o dnl - -name '*.c' -print -o dnl - -name '*.h' -print dnl - > po/POTFILES.in && dnl - cd "${find_start_pwd}"]) + [find_start_pwd=`pwd` && dnl + cd "${ac_abs_top_srcdir}" && dnl strip prefixes from find + find . dnl + -path "./rpmbuild" -prune -o dnl + -path "./${PACKAGE}-*" -prune -o dnl dist directories + -path '*/build' -prune -o dnl Python builds + -path '*/dist' -prune -o dnl Python dists + -path './conf*' -prune -o dnl generated by configure + -name '*.py' -print -o dnl + -name '*.c' -print -o dnl + -name '*.h' -print dnl + > po/POTFILES.in && dnl + cd "${find_start_pwd}"]) AC_SUBST(GETTEXT_DOMAIN, [ipa]) AM_GNU_GETTEXT_VERSION([0.18.2]) AM_GNU_GETTEXT([external]) dnl integrate our custom hacks into gettextize infrastructure AC_CONFIG_COMMANDS([po/Makefile-hackit], - [echo "include Makefile.hack" dnl - >> "${ac_abs_top_srcdir}/po/Makefile"]) + [echo "include Makefile.hack" >> "${ac_abs_top_srcdir}/po/Makefile"]) AC_PROG_MKDIR_P AC_PROG_AWK @@ -358,25 +358,24 @@ dnl --------------------------------------------------------------------------- dnl IPA platform dnl --------------------------------------------------------------------------- AC_ARG_WITH([ipaplatform], - [AC_HELP_STRING([--with-ipaplatform], - [IPA platform module to use])], - [IPAPLATFORM=${withval}], - [IPAPLATFORM=""]) + [AC_HELP_STRING([--with-ipaplatform], [IPA platform module to use])], + [IPAPLATFORM=${withval}], + [IPAPLATFORM=""]) AC_MSG_CHECKING([supported IPA platform]) if test "x${IPAPLATFORM}" == "x"; then - if test -r "/etc/os-release"; then - IPAPLATFORM=$(. /etc/os-release; echo "$ID") - else - AC_MSG_ERROR([unable to read /etc/os-release]) - fi - if test "x${IPAPLATFORM}" == "x"; then - AC_MSG_ERROR([unable to find ID variable in /etc/os-release]) - fi + if test -r "/etc/os-release"; then + IPAPLATFORM=$(. /etc/os-release; echo "$ID") + else + AC_MSG_ERROR([unable to read /etc/os-release]) + fi + if test "x${IPAPLATFORM}" == "x"; then + AC_MSG_ERROR([unable to find ID variable in /etc/os-release]) + fi fi if test ! -d "${srcdir}/ipaplatform/${IPAPLATFORM}"; then - AC_MSG_ERROR([IPA platform ${IPAPLATFORM} is not supported]) + AC_MSG_ERROR([IPA platform ${IPAPLATFORM} is not supported]) fi AC_SUBST([IPAPLATFORM]) @@ -387,21 +386,23 @@ dnl --------------------------------------------------------------------------- dnl Version information from VERSION.m4 and command line dnl --------------------------------------------------------------------------- dnl Are we in source tree? -AM_CONDITIONAL([IS_GIT_SNAPSHOT], [test "IPA_VERSION_IS_GIT_SNAPSHOT" == "yes"]) +AM_CONDITIONAL([IS_GIT_SNAPSHOT], + [test "IPA_VERSION_IS_GIT_SNAPSHOT" == "yes"]) AM_COND_IF([IS_GIT_SNAPSHOT], [ - AC_MSG_CHECKING([if source directory is a Git reposistory]) - if test ! -e "${srcdir}/.git"; then - AC_MSG_ERROR([Git reposistory is required by VERSION.m4 IPA_VERSION_IS_GIT_SNAPSHOT but not found]) - else - AC_MSG_RESULT([yes]) - fi + AC_MSG_CHECKING([if source directory is a Git reposistory]) + if test ! -e "${srcdir}/.git"; then + AC_MSG_ERROR([Git reposistory is required by VERSION.m4 ] + [IPA_VERSION_IS_GIT_SNAPSHOT but not found]) + else + AC_MSG_RESULT([yes]) + fi ]) AC_ARG_WITH([vendor-suffix], - AS_HELP_STRING([--with-vendor-suffix=STRING], - [Vendor string used by package system, e.g. "-1.fc24"]), - [VENDOR_SUFFIX=${withval}], - [VENDOR_SUFFIX=""]) + [AS_HELP_STRING([--with-vendor-suffix=STRING], + [Vendor string used by package system, e.g. "-1.fc24"])], + [VENDOR_SUFFIX=${withval}], + [VENDOR_SUFFIX=""]) AC_SUBST([API_VERSION], [IPA_API_VERSION]) AC_SUBST([DATA_VERSION], [IPA_DATA_VERSION]) @@ -418,16 +419,17 @@ dnl --------------------------------------------------------------------------- # Turn on the additional warnings last, so -Werror doesn't affect other tests. -AC_ARG_ENABLE(more-warnings, - [AC_HELP_STRING([--enable-more-warnings], - [Maximum compiler warnings])], - set_more_warnings="$enableval",[ - if test -d $srcdir/../.hg; then - set_more_warnings=yes - else - set_more_warnings=no - fi - ]) +AC_ARG_ENABLE([more-warnings], + [AC_HELP_STRING([--enable-more-warnings], + [Maximum compiler warnings])], + [set_more_warnings="$enableval"], + [ if test -d $srcdir/../.hg; then + set_more_warnings=yes + else + set_more_warnings=no + fi + ] +) AC_MSG_CHECKING(for more warnings) if test "$GCC" = "yes" -a "$set_more_warnings" != "no"; then AC_MSG_RESULT(yes) @@ -463,20 +465,19 @@ dnl --------------------------------------------------------------------------- dnl Linters dnl --------------------------------------------------------------------------- AC_ARG_ENABLE([i18ntests], - AC_HELP_STRING([--disable-i18ntests], - [do not execute ipatests/i18n.py - (depends on python-polib)]), - , - [enable_i18ntests="yes"] + [AC_HELP_STRING( + [--disable-i18ntests], + [do not execute ipatests/i18n.py (depends on python-polib)])], + [], + [enable_i18ntests="yes"] ) AC_SUBST([i18ntests]) AM_CONDITIONAL([WITH_POLINT], [test "x${enable_i18ntests}" == "xyes"]) AC_ARG_ENABLE([pylint], - AS_HELP_STRING([--disable-pylint], - [skip Pylint in make lint target]), - [PYLINT=$enableval], - [PYLINT=yes] + [AS_HELP_STRING([--disable-pylint], [skip Pylint in make lint target])], + [PYLINT=$enableval], + [PYLINT=yes] ) if test x$PYLINT != xno; then AC_MSG_CHECKING([for Pylint]) @@ -492,15 +493,15 @@ AM_CONDITIONAL([WITH_PYLINT], [test "x${PYLINT}" != "xno"]) AC_ARG_WITH([jslint], - AS_HELP_STRING([--with-jslint=[FILE]], - [path to JavaScript linter. Default is autodetection of - utility "jsl" ]), + AS_HELP_STRING([--with-jslint=[FILE]], + [path to JavaScript linter. Default is autodetection of ] + [utility "jsl" ]), dnl --without-jslint will set JSLINT=no [JSLINT=$with_jslint], [AC_PATH_PROG([JSLINT], [jsl])] ) if test "x${JSLINT}" == "x"; then - AC_MSG_ERROR([cannot find JS lint]) + AC_MSG_ERROR([cannot find JS lint]) fi AC_SUBST([JSLINT]) AM_CONDITIONAL([WITH_JSLINT], [test "x${JSLINT}" != "xno"]) @@ -519,7 +520,8 @@ AC_CONFIG_LINKS([ipaplatform/__init__.py:ipaplatform/$IPAPLATFORM/__init__.py ipaplatform/paths.py:ipaplatform/$IPAPLATFORM/paths.py ipaplatform/services.py:ipaplatform/$IPAPLATFORM/services.py ipaplatform/tasks.py:ipaplatform/$IPAPLATFORM/tasks.py - ]) + ] +) AC_CONFIG_FILES([ Makefile @@ -596,7 +598,7 @@ echo " IPA Server $VERSION ======================== - vendor version: ${VERSION}${VENDOR_SUFFIX} + vendor version: ${VERSION}${VENDOR_SUFFIX} prefix: ${prefix} exec_prefix: ${exec_prefix} libdir: ${libdir} From e08a6e99b21eda751672ef2b4572f2d1ac1337e9 Mon Sep 17 00:00:00 2001 From: Lukas Slebodnik <lsleb...@redhat.com> Date: Wed, 22 Feb 2017 09:40:23 +0100 Subject: [PATCH 10/14] CONFIGURE: Move server related dependencies to separate files The separate file server.m4/unit_tests.m4 were created as a copy of configure.ac and client parts from server.m4/unit_tests.m4 and server parts from configure.ac were removed in file diff tool. Resolves: https://fedorahosted.org/freeipa/ticket/6517 --- configure.ac | 193 +++------------------------------------------------------- server.m4 | 144 +++++++++++++++++++++++++++++++++++++++++++ unit_tests.m4 | 48 +++++++++++++++ 3 files changed, 200 insertions(+), 185 deletions(-) create mode 100644 server.m4 create mode 100644 unit_tests.m4 diff --git a/configure.ac b/configure.ac index 1665ce3..ab35108 100644 --- a/configure.ac +++ b/configure.ac @@ -33,52 +33,10 @@ PKG_CHECK_MODULES([NSPR], [nspr]) PKG_CHECK_MODULES([NSS], [nss]) dnl --------------------------------------------------------------------------- -dnl - Check for DS slapi plugin -dnl --------------------------------------------------------------------------- - -# Need to hack CPPFLAGS to be able to correctly detetct slapi-plugin.h -SAVE_CPPFLAGS=$CPPFLAGS -CPPFLAGS=$NSPR_CFLAGS -AC_CHECK_HEADER([dirsrv/slapi-plugin.h], [], - [AC_MSG_ERROR([Required 389-ds header not available (389-ds-base-devel)])]) - -AC_CHECK_HEADER([dirsrv/repl-session-plugin.h], [], - [AC_MSG_ERROR([Required 389-ds header not available (389-ds-base-devel)])]) -CPPFLAGS=$SAVE_CPPFLAGS - -dnl --------------------------------------------------------------------------- dnl - Check for KRB5 dnl --------------------------------------------------------------------------- PKG_CHECK_MODULES([KRB5], [krb5]) -AC_CHECK_HEADER(krad.h, [], [AC_MSG_ERROR([krad.h not found])]) -AC_CHECK_LIB(krad, main, [], [AC_MSG_ERROR([libkrad not found])]) -KRAD_LIBS="-lkrad" -krb5rundir="${localstatedir}/run/krb5kdc" -AC_SUBST(KRAD_LIBS) -AC_SUBST(krb5rundir) - -AC_CHECK_HEADER(kdb.h, [], [AC_MSG_ERROR([kdb.h not found])]) -AC_CHECK_MEMBER( - [kdb_vftabl.free_principal], - [AC_DEFINE([HAVE_KDB_FREEPRINCIPAL], [1], - [KDB driver API has free_principal callback])], - [AC_MSG_NOTICE([KDB driver API has no free_principal callback])], - [[#include <kdb.h>]]) -AC_CHECK_MEMBER( - [kdb_vftabl.free_principal_e_data], - [AC_DEFINE([HAVE_KDB_FREEPRINCIPAL_EDATA], [1], - [KDB driver API has free_principal_e_data callback])], - [AC_MSG_NOTICE([KDB driver API has no free_principal_e_data callback])], - [[#include <kdb.h>]]) - -if test "x$ac_cv_member_kdb_vftabl_free_principal" = "xno" \ - -a "x$ac_cv_member_kdb_vftable_free_principal_e_data" = "xno" ; then - AC_MSG_WARN([KDB driver API does not allow to free Kerberos ] - [principal data.]) - AC_MSG_WARN([KDB driver will leak memory on Kerberos principal use]) - AC_MSG_WARN([See https://github.com/krb5/krb5/pull/596 for details]) -fi dnl --------------------------------------------------------------------------- dnl - Check for OpenLDAP SDK @@ -99,11 +57,6 @@ dnl --------------------------------------------------------------------------- PKG_CHECK_MODULES([CRYPTO], [libcrypto]) dnl --------------------------------------------------------------------------- -dnl - Check for UUID library -dnl --------------------------------------------------------------------------- -PKG_CHECK_MODULES([UUID], [uuid]) - -dnl --------------------------------------------------------------------------- dnl - Check for Python dnl --------------------------------------------------------------------------- @@ -121,124 +74,6 @@ else fi dnl --------------------------------------------------------------------------- -dnl Check for ndr_krb5pac and other samba libraries -dnl --------------------------------------------------------------------------- - -PKG_PROG_PKG_CONFIG() -PKG_CHECK_MODULES([TALLOC], [talloc]) -PKG_CHECK_MODULES([TEVENT], [tevent]) -PKG_CHECK_MODULES([NDRPAC], [ndr_krb5pac]) -PKG_CHECK_MODULES([NDRNBT], [ndr_nbt]) -PKG_CHECK_MODULES([NDR], [ndr]) -PKG_CHECK_MODULES([SAMBAUTIL], [samba-util]) -SMB_INTERNAL_LIBDIR="$($PKG_CONFIG --variable=libdir samba-util)/samba" -SAMBA40EXTRA_LIBPATH="-L$SMB_INTERNAL_LIBDIR -Wl,-rpath=$SMB_INTERNAL_LIBDIR" -AC_SUBST(SAMBA40EXTRA_LIBPATH) - -bck_cflags="$CFLAGS" -CFLAGS="$NDRPAC_CFLAGS" -AC_CHECK_MEMBER( - [struct PAC_DOMAIN_GROUP_MEMBERSHIP.domain_sid], - [AC_DEFINE([HAVE_STRUCT_PAC_DOMAIN_GROUP_MEMBERSHIP], [1], - [struct PAC_DOMAIN_GROUP_MEMBERSHIP is available.])], - [AC_MSG_NOTICE([struct PAC_DOMAIN_GROUP_MEMBERSHIP is not available])], - [[#include <ndr.h> - #include <gen_ndr/krb5pac.h>]]) - -CFLAGS="$bck_cflags" - -LIBPDB_NAME="" -AC_CHECK_LIB([samba-passdb], - [make_pdb_method], - [LIBPDB_NAME="samba-passdb"; HAVE_LIBPDB=1], - [LIBPDB_NAME="pdb"], - [$SAMBA40EXTRA_LIBPATH]) - -if test "x$LIB_PDB_NAME" = "xpdb" ; then - AC_CHECK_LIB([$LIBPDB_NAME], - [make_pdb_method], - [HAVE_LIBPDB=1], - [AC_MSG_ERROR([Neither libpdb nor libsamba-passdb does have ] - [make_pdb_method])], - [$SAMBA40EXTRA_LIBPATH]) -fi - -AC_SUBST(LIBPDB_NAME) - -AC_CHECK_LIB([$LIBPDB_NAME], [pdb_enum_upn_suffixes], - [AC_DEFINE([HAVE_PDB_ENUM_UPN_SUFFIXES], [1], - [Ability to enumerate UPN suffixes])], - [AC_MSG_WARN([libpdb does not have pdb_enum_upn_suffixes, ] - [no support for realm domains in ipasam])], - [$SAMBA40EXTRA_LIBPATH]) - -dnl --------------------------------------------------------------------------- -dnl Check for libunistring -dnl --------------------------------------------------------------------------- -AC_CHECK_HEADERS([unicase.h], [], AC_MSG_ERROR([Could not find unicase.h])) -AC_CHECK_LIB([unistring], - [ulc_casecmp], - [UNISTRING_LIBS="-lunistring"], - [AC_MSG_ERROR([libunistring does not have ulc_casecmp])]) -AC_SUBST(UNISTRING_LIBS) - -dnl --------------------------------------------------------------------------- -dnl Check for libverto -dnl --------------------------------------------------------------------------- -PKG_CHECK_MODULES([LIBVERTO], [libverto]) - -dnl --------------------------------------------------------------------------- -dnl - Check for cmocka unit test framework http://cmocka.cryptomilk.org/ -dnl --------------------------------------------------------------------------- -PKG_CHECK_EXISTS(cmocka, - [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 library found, cmocka tests will not be built])] -) -AM_CONDITIONAL([HAVE_CMOCKA], [test x$have_cmocka = xyes]) - -dnl A macro to check presence of a cwrap (http://cwrap.org) wrapper -dnl 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], -[ - FOUND_WRAPPER=0 - - AC_MSG_CHECKING([for $1]) - PKG_CHECK_EXISTS([$1], - [ - AC_MSG_RESULT([yes]) - FOUND_WRAPPER=1 - ], - [ - AC_MSG_RESULT([no]) - AC_MSG_WARN([cwrap library $1 not found, some tests ] - [will not run]) - ]) - - AM_CONDITIONAL($2, [ test x$FOUND_WRAPPER = x1]) -]) - -AM_CHECK_WRAPPER(nss_wrapper, HAVE_NSS_WRAPPER) - -dnl -- dirsrv is needed for the extdom unit tests -- -PKG_CHECK_MODULES([DIRSRV], [dirsrv >= 1.3.0]) -dnl -- sss_idmap is needed by the extdom exop -- -PKG_CHECK_MODULES([SSSIDMAP], [sss_idmap]) -PKG_CHECK_MODULES([SSSNSSIDMAP], [sss_nss_idmap >= 1.13.90]) - -dnl --------------------------------------------------------------------------- dnl - Check for POPT dnl --------------------------------------------------------------------------- POPT_LIBS= @@ -278,26 +113,14 @@ dnl --------------------------------------------------------------------------- PKG_CHECK_MODULES([INI], [ini_config >= 1.1.0]) dnl --------------------------------------------------------------------------- -dnl - Check for systemd directories -dnl --------------------------------------------------------------------------- -PKG_CHECK_EXISTS([systemd], [], [AC_MSG_ERROR([systemd not found])]) -def_systemdsystemunitdir=$($PKG_CONFIG --define-variable=prefix='${prefix}' \ - --variable=systemdsystemunitdir systemd) -AC_ARG_WITH([systemdsystemunitdir], - [AS_HELP_STRING([--with-systemdsystemunitdir=DIR], - [Directory for systemd service files])], - [systemdsystemunitdir=$with_systemdsystemunitdir], - [systemdsystemunitdir=$def_systemdsystemunitdir]) -AC_SUBST([systemdsystemunitdir]) - -def_systemdtmpfilesdir=$($PKG_CONFIG --define-variable=prefix='${prefix}' \ - --variable=tmpfilesdir systemd) -AC_ARG_WITH([systemdtmpfilesdir], - [AS_HELP_STRING([--with-systemdtmpfilesdir=DIR], - [Directory for systemd-tmpfiles configuration files])], - [systemdtmpfilesdir=$with_systemdtmpfilesdir], - [systemdtmpfilesdir=$def_systemdtmpfilesdir]) -AC_SUBST([systemdtmpfilesdir]) +dnl - Check for server dependencies +dnl --------------------------------------------------------------------------- +m4_include([server.m4]) + +dnl cmocka and nss_wrapper are optional dependencies used only in server +dnl but they use AM_CONDITIONAL which need to be executed every time +dnl it simpler to have them directly in configure.ac +m4_include([unit_tests.m4]) dnl --------------------------------------------------------------------------- dnl - Get /etc/sysconfig directory path diff --git a/server.m4 b/server.m4 new file mode 100644 index 0000000..9e283c0 --- /dev/null +++ b/server.m4 @@ -0,0 +1,144 @@ +dnl --------------------------------------------------------------------------- +dnl - Check for DS slapi plugin +dnl --------------------------------------------------------------------------- + +# Need to hack CPPFLAGS to be able to correctly detetct slapi-plugin.h +SAVE_CPPFLAGS=$CPPFLAGS +CPPFLAGS=$NSPR_CFLAGS +AC_CHECK_HEADER([dirsrv/slapi-plugin.h], [], + [AC_MSG_ERROR([Required 389-ds header not available (389-ds-base-devel)])]) + +AC_CHECK_HEADER([dirsrv/repl-session-plugin.h], [], + [AC_MSG_ERROR([Required 389-ds header not available (389-ds-base-devel)])]) +CPPFLAGS=$SAVE_CPPFLAGS + +dnl --------------------------------------------------------------------------- +dnl - Check for KRB5 (libkrad, kdb.h) +dnl --------------------------------------------------------------------------- + +AC_CHECK_HEADER(krad.h, [], [AC_MSG_ERROR([krad.h not found])]) +AC_CHECK_LIB(krad, main, [], [AC_MSG_ERROR([libkrad not found])]) +KRAD_LIBS="-lkrad" +krb5rundir="${localstatedir}/run/krb5kdc" +AC_SUBST(KRAD_LIBS) +AC_SUBST(krb5rundir) + +AC_CHECK_HEADER(kdb.h, [], [AC_MSG_ERROR([kdb.h not found])]) +AC_CHECK_MEMBER( + [kdb_vftabl.free_principal], + [AC_DEFINE([HAVE_KDB_FREEPRINCIPAL], [1], + [KDB driver API has free_principal callback])], + [AC_MSG_NOTICE([KDB driver API has no free_principal callback])], + [[#include <kdb.h>]]) +AC_CHECK_MEMBER( + [kdb_vftabl.free_principal_e_data], + [AC_DEFINE([HAVE_KDB_FREEPRINCIPAL_EDATA], [1], + [KDB driver API has free_principal_e_data callback])], + [AC_MSG_NOTICE([KDB driver API has no free_principal_e_data callback])], + [[#include <kdb.h>]]) + +if test "x$ac_cv_member_kdb_vftabl_free_principal" = "xno" \ + -a "x$ac_cv_member_kdb_vftable_free_principal_e_data" = "xno" ; then + AC_MSG_WARN([KDB driver API does not allow to free Kerberos ] + [principal data.]) + AC_MSG_WARN([KDB driver will leak memory on Kerberos principal use]) + AC_MSG_WARN([See https://github.com/krb5/krb5/pull/596 for details]) +fi + +dnl --------------------------------------------------------------------------- +dnl - Check for UUID library +dnl --------------------------------------------------------------------------- +PKG_CHECK_MODULES([UUID], [uuid]) + +dnl --------------------------------------------------------------------------- +dnl Check for ndr_krb5pac and other samba libraries +dnl --------------------------------------------------------------------------- + +PKG_PROG_PKG_CONFIG() +PKG_CHECK_MODULES([TALLOC], [talloc]) +PKG_CHECK_MODULES([TEVENT], [tevent]) +PKG_CHECK_MODULES([NDRPAC], [ndr_krb5pac]) +PKG_CHECK_MODULES([NDRNBT], [ndr_nbt]) +PKG_CHECK_MODULES([NDR], [ndr]) +PKG_CHECK_MODULES([SAMBAUTIL], [samba-util]) +SMB_INTERNAL_LIBDIR="$($PKG_CONFIG --variable=libdir samba-util)/samba" +SAMBA40EXTRA_LIBPATH="-L$SMB_INTERNAL_LIBDIR -Wl,-rpath=$SMB_INTERNAL_LIBDIR" +AC_SUBST(SAMBA40EXTRA_LIBPATH) + +bck_cflags="$CFLAGS" +CFLAGS="$NDRPAC_CFLAGS" +AC_CHECK_MEMBER( + [struct PAC_DOMAIN_GROUP_MEMBERSHIP.domain_sid], + [AC_DEFINE([HAVE_STRUCT_PAC_DOMAIN_GROUP_MEMBERSHIP], [1], + [struct PAC_DOMAIN_GROUP_MEMBERSHIP is available.])], + [AC_MSG_NOTICE([struct PAC_DOMAIN_GROUP_MEMBERSHIP is not available])], + [[#include <ndr.h> + #include <gen_ndr/krb5pac.h>]]) + +CFLAGS="$bck_cflags" + +LIBPDB_NAME="" +AC_CHECK_LIB([samba-passdb], + [make_pdb_method], + [LIBPDB_NAME="samba-passdb"; HAVE_LIBPDB=1], + [LIBPDB_NAME="pdb"], + [$SAMBA40EXTRA_LIBPATH]) + +if test "x$LIB_PDB_NAME" = "xpdb" ; then + AC_CHECK_LIB([$LIBPDB_NAME], + [make_pdb_method], + [HAVE_LIBPDB=1], + [AC_MSG_ERROR([Neither libpdb nor libsamba-passdb does have ] + [make_pdb_method])], + [$SAMBA40EXTRA_LIBPATH]) +fi + +AC_SUBST(LIBPDB_NAME) + +AC_CHECK_LIB([$LIBPDB_NAME], [pdb_enum_upn_suffixes], + [AC_DEFINE([HAVE_PDB_ENUM_UPN_SUFFIXES], [1], + [Ability to enumerate UPN suffixes])], + [AC_MSG_WARN([libpdb does not have pdb_enum_upn_suffixes, ] + [no support for realm domains in ipasam])], + [$SAMBA40EXTRA_LIBPATH]) + +dnl --------------------------------------------------------------------------- +dnl Check for libunistring +dnl --------------------------------------------------------------------------- +AC_CHECK_HEADERS([unicase.h], [], AC_MSG_ERROR([Could not find unicase.h])) +AC_CHECK_LIB([unistring], + [ulc_casecmp], + [UNISTRING_LIBS="-lunistring"], + [AC_MSG_ERROR([libunistring does not have ulc_casecmp])]) +AC_SUBST(UNISTRING_LIBS) + +dnl --------------------------------------------------------------------------- +dnl Check for libverto +dnl --------------------------------------------------------------------------- +PKG_CHECK_MODULES([LIBVERTO], [libverto]) + +dnl -- sss_idmap is needed by the extdom exop -- +PKG_CHECK_MODULES([SSSIDMAP], [sss_idmap]) +PKG_CHECK_MODULES([SSSNSSIDMAP], [sss_nss_idmap >= 1.14.0]) + +dnl --------------------------------------------------------------------------- +dnl - Check for systemd directories +dnl --------------------------------------------------------------------------- +PKG_CHECK_EXISTS([systemd], [], [AC_MSG_ERROR([systemd not found])]) +def_systemdsystemunitdir=$($PKG_CONFIG --define-variable=prefix='${prefix}' \ + --variable=systemdsystemunitdir systemd) +AC_ARG_WITH([systemdsystemunitdir], + [AS_HELP_STRING([--with-systemdsystemunitdir=DIR], + [Directory for systemd service files])], + [systemdsystemunitdir=$with_systemdsystemunitdir], + [systemdsystemunitdir=$def_systemdsystemunitdir]) +AC_SUBST([systemdsystemunitdir]) + +def_systemdtmpfilesdir=$($PKG_CONFIG --define-variable=prefix='${prefix}' \ + --variable=tmpfilesdir systemd) +AC_ARG_WITH([systemdtmpfilesdir], + [AS_HELP_STRING([--with-systemdtmpfilesdir=DIR], + [Directory for systemd-tmpfiles configuration files])], + [systemdtmpfilesdir=$with_systemdtmpfilesdir], + [systemdtmpfilesdir=$def_systemdtmpfilesdir]) +AC_SUBST([systemdtmpfilesdir]) diff --git a/unit_tests.m4 b/unit_tests.m4 new file mode 100644 index 0000000..bf3cde0 --- /dev/null +++ b/unit_tests.m4 @@ -0,0 +1,48 @@ +dnl --------------------------------------------------------------------------- +dnl - Check for cmocka unit test framework http://cmocka.cryptomilk.org/ +dnl --------------------------------------------------------------------------- +PKG_CHECK_EXISTS(cmocka, + [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 library found, cmocka tests will not be built])] +) +AM_CONDITIONAL([HAVE_CMOCKA], [test x$have_cmocka = xyes]) + +dnl -- dirsrv is needed for the extdom unit tests -- +AS_IF([test x$have_cmocka = xyes], + [PKG_CHECK_MODULES([DIRSRV], [dirsrv >= 1.3.0])]) + +dnl A macro to check presence of a cwrap (http://cwrap.org) wrapper +dnl 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], +[ + FOUND_WRAPPER=0 + + AC_MSG_CHECKING([for $1]) + PKG_CHECK_EXISTS([$1], + [ + AC_MSG_RESULT([yes]) + FOUND_WRAPPER=1 + ], + [ + AC_MSG_RESULT([no]) + AC_MSG_WARN([cwrap library $1 not found, some tests ] + [will not run]) + ]) + + AM_CONDITIONAL($2, [ test x$FOUND_WRAPPER = x1]) +]) + +AM_CHECK_WRAPPER(nss_wrapper, HAVE_NSS_WRAPPER) From 8efc6c74503ed82ecd21b9f03126fa034cc37e58 Mon Sep 17 00:00:00 2001 From: Lukas Slebodnik <lsleb...@redhat.com> Date: Wed, 22 Feb 2017 09:40:31 +0100 Subject: [PATCH 11/14] BUILD: Allow to build/install just client parts This patch adds new configure time option --enable-server which is enabled by default. If you want to run client-only part of freeIPA then you can run --enable-server=no or --disable-server. Disabling server also disable related lint checks to reduce dependencies for client-only build. Resolves: https://fedorahosted.org/freeipa/ticket/6517 --- Makefile.am | 9 ++++++++- configure.ac | 33 +++++++++++++++++++++++++-------- 2 files changed, 33 insertions(+), 9 deletions(-) diff --git a/Makefile.am b/Makefile.am index 30ad9bb..fd90f29 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,7 +1,14 @@ ACLOCAL_AMFLAGS = -I m4 IPACLIENT_SUBDIRS = ipaclient ipalib ipapython -SUBDIRS = asn1 util client contrib daemons init install $(IPACLIENT_SUBDIRS) ipaplatform ipaserver ipatests po + +if ENABLE_SERVER + SERVER_SUBDIRS = daemons init install ipaserver ipatests +endif + +SUBDIRS = asn1 util client contrib $(IPACLIENT_SUBDIRS) ipaplatform po \ + $(SERVER_SUBDIRS) \ + $(NULL) MOSTLYCLEANFILES = ipasetup.pyc ipasetup.pyo \ ignore_import_errors.pyc ignore_import_errors.pyo \ diff --git a/configure.ac b/configure.ac index ab35108..813c4c6 100644 --- a/configure.ac +++ b/configure.ac @@ -115,7 +115,20 @@ PKG_CHECK_MODULES([INI], [ini_config >= 1.1.0]) dnl --------------------------------------------------------------------------- dnl - Check for server dependencies dnl --------------------------------------------------------------------------- -m4_include([server.m4]) +AC_ARG_ENABLE([server], + [AS_HELP_STRING([--enable-server], + [Enable server support. [Default: yes]])], + [enable_server="${enableval}"], + [enable_server=yes]) +if test x"$enable_server" != xyes -a x"$enable_server" != xno; then + AC_MSG_ERROR([Unexpected value $enable_server for --enable-server. ] + [Allowed is yes or no]) +fi + +AM_CONDITIONAL([ENABLE_SERVER], [test x"$enable_server" = xyes]) +if test x"$enable_server" = xyes; then + m4_include([server.m4]) +fi dnl cmocka and nss_wrapper are optional dependencies used only in server dnl but they use AM_CONDITIONAL which need to be executed every time @@ -292,7 +305,7 @@ AC_ARG_ENABLE([i18ntests], [--disable-i18ntests], [do not execute ipatests/i18n.py (depends on python-polib)])], [], - [enable_i18ntests="yes"] + [enable_i18ntests=$enable_server] ) AC_SUBST([i18ntests]) AM_CONDITIONAL([WITH_POLINT], [test "x${enable_i18ntests}" == "xyes"]) @@ -300,7 +313,7 @@ AM_CONDITIONAL([WITH_POLINT], [test "x${enable_i18ntests}" == "xyes"]) AC_ARG_ENABLE([pylint], [AS_HELP_STRING([--disable-pylint], [skip Pylint in make lint target])], [PYLINT=$enableval], - [PYLINT=yes] + [PYLINT=$enable_server] ) if test x$PYLINT != xno; then AC_MSG_CHECKING([for Pylint]) @@ -323,7 +336,7 @@ dnl --without-jslint will set JSLINT=no [JSLINT=$with_jslint], [AC_PATH_PROG([JSLINT], [jsl])] ) -if test "x${JSLINT}" == "x"; then +if test "x$enable_server" = "xyes" -a "x${JSLINT}" = "x"; then AC_MSG_ERROR([cannot find JS lint]) fi AC_SUBST([JSLINT]) @@ -431,14 +444,18 @@ echo " sysconfenvdir: ${sysconfenvdir} localstatedir: ${localstatedir} datadir: ${datadir} - krb5rundir: ${krb5rundir} - systemdsystemunitdir: ${systemdsystemunitdir} - systemdtmpfilesdir: ${systemdtmpfilesdir} source code location: ${srcdir} compiler: ${CC} cflags: ${CFLAGS} LDAP libs: ${LDAP_LIBS} KRB5 libs: ${KRB5_LIBS} - KRAD libs: ${KRAD_LIBS} OpenSSL crypto libs: ${CRYPTO_LIBS} + server support: ${enable_server} " +AS_IF([test x"$enable_server" = xyes], [ +echo "\ + krb5rundir: ${krb5rundir} + systemdsystemunitdir: ${systemdsystemunitdir} + systemdtmpfilesdir: ${systemdtmpfilesdir} + KRAD libs: ${KRAD_LIBS}" +]) From 654857ba5d705cd147723622ecebfb9a58a82183 Mon Sep 17 00:00:00 2001 From: Lukas Slebodnik <lsleb...@redhat.com> Date: Wed, 22 Feb 2017 09:40:36 +0100 Subject: [PATCH 12/14] SPEC: Fix dependencies for client only build Some packages from client-only build were in server section and vice versa. There are few unused build requirements: autoconf, automake, libtool, gettext-devel because autoreconf is not executes as part of build process. But They might be usefull in downstream when configure related patches are backported. Resolves: https://fedorahosted.org/freeipa/ticket/6517 --- freeipa.spec.in | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/freeipa.spec.in b/freeipa.spec.in index 5c835ca..9b9e364 100644 --- a/freeipa.spec.in +++ b/freeipa.spec.in @@ -75,17 +75,20 @@ BuildRequires: automake BuildRequires: libtool BuildRequires: gettext BuildRequires: gettext-devel +BuildRequires: nspr-devel +BuildRequires: nss-devel +BuildRequires: openssl-devel BuildRequires: python-devel %if 0%{?with_python3} BuildRequires: python3-devel %endif # with_python3 +BuildRequires: libini_config-devel +BuildRequires: cyrus-sasl-devel +%if ! %{ONLY_CLIENT} # %{_unitdir}, %{_tmpfilesdir} BuildRequires: systemd # systemd-tmpfiles which is executed from make install requires apache user BuildRequires: httpd -BuildRequires: libini_config-devel -BuildRequires: cyrus-sasl-devel -%if ! %{ONLY_CLIENT} # 1.3.3.9: DS_Sleep (https://fedorahosted.org/389/ticket/48005) BuildRequires: 389-ds-base-devel >= 1.3.3.9 BuildRequires: svrcore-devel @@ -96,9 +99,6 @@ BuildRequires: samba-devel >= 2:4.0.0 %endif BuildRequires: libtalloc-devel BuildRequires: libtevent-devel -BuildRequires: nspr-devel -BuildRequires: nss-devel -BuildRequires: openssl-devel BuildRequires: libuuid-devel BuildRequires: libsss_idmap-devel # 1.14.0: sss_nss_getnamebycert (https://fedorahosted.org/sssd/ticket/2897) From dd41aaecf5187e15a00bba71f6ac44109af0d0d3 Mon Sep 17 00:00:00 2001 From: Lukas Slebodnik <lsleb...@redhat.com> Date: Wed, 22 Feb 2017 09:40:43 +0100 Subject: [PATCH 13/14] SPEC: Fix client-inly packaging * the make target client-check was removed as part of build system refactoring 0a17155e5b0434d4cab4d1696fac7f5ef88f0808 * the directory /usr/share/ipa was removed from freeipa-client-common because packge didn't contain and files there * python3 installation of client-only build was fixed as well Resolves: https://fedorahosted.org/freeipa/ticket/6517 --- freeipa.spec.in | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/freeipa.spec.in b/freeipa.spec.in index 9b9e364..5de88e6 100644 --- a/freeipa.spec.in +++ b/freeipa.spec.in @@ -1,6 +1,17 @@ +# rpmbuild --rebuild --without server freeipa.src.rpm +# +# The server build is enabled by default. Set --without or change +# bcond_with server for client only build. +%bcond_without server + # Define ONLY_CLIENT to only make the ipa-client and ipa-python # subpackages -%{!?ONLY_CLIENT:%global ONLY_CLIENT 0} +%if %{with server} + %global ONLY_CLIENT 0 +%else + %global ONLY_CLIENT 1 + %global disable_server_option --disable-server +%endif %if 0%{?rhel} %global with_python3 0 @@ -791,7 +802,8 @@ find \ -exec sed -i -e '1 s|^#!.*\bpython[^ ]*|#!%{__python2}|' {} \; %configure --with-vendor-suffix=-%{release} \ %{enable_pylint_option} \ - %{?without_jslint_option} + %{?without_jslint_option} \ + %{?disable_server_option} # -Onone is workaround for https://bugzilla.redhat.com/show_bug.cgi?id=1398405 %make_build -Onone @@ -809,7 +821,8 @@ find \ -exec sed -i -e '1 s|^#!.*\bpython[^ ]*|#!%{__python3}|' {} \; %configure --with-vendor-suffix=-%{release} \ %{enable_pylint_option} \ - %{?without_jslint_option} + %{?without_jslint_option} \ + %{?disable_server_option} popd %endif # with_python3 @@ -817,7 +830,7 @@ popd %if ! %{ONLY_CLIENT} make %{?_smp_mflags} check VERBOSE=yes LIBDIR=%{_libdir} %else -make %{?_smp_mflags} client-check VERBOSE=yes LIBDIR=%{_libdir} +make %{?_smp_mflags} check VERBOSE=yes LIBDIR=%{_libdir} %endif # ONLY_CLIENT @@ -843,20 +856,25 @@ pushd %{_builddir}/freeipa-%{version}-python3 (cd ipalib && %make_install) (cd ipaplatform && %make_install) (cd ipapython && %make_install) +%if ! %{ONLY_CLIENT} (cd ipaserver && %make_install) (cd ipatests && %make_install) +%endif popd +%if ! %{ONLY_CLIENT} mv %{buildroot}%{_bindir}/ipa-run-tests %{buildroot}%{_bindir}/ipa-run-tests-%{python3_version} mv %{buildroot}%{_bindir}/ipa-test-config %{buildroot}%{_bindir}/ipa-test-config-%{python3_version} mv %{buildroot}%{_bindir}/ipa-test-task %{buildroot}%{_bindir}/ipa-test-task-%{python3_version} ln -s %{_bindir}/ipa-run-tests-%{python3_version} %{buildroot}%{_bindir}/ipa-run-tests-3 ln -s %{_bindir}/ipa-test-config-%{python3_version} %{buildroot}%{_bindir}/ipa-test-config-3 ln -s %{_bindir}/ipa-test-task-%{python3_version} %{buildroot}%{_bindir}/ipa-test-task-3 +%endif %endif # with_python3 # Python 2 installation %make_install +%if ! %{ONLY_CLIENT} mv %{buildroot}%{_bindir}/ipa-run-tests %{buildroot}%{_bindir}/ipa-run-tests-%{python2_version} mv %{buildroot}%{_bindir}/ipa-test-config %{buildroot}%{_bindir}/ipa-test-config-%{python2_version} mv %{buildroot}%{_bindir}/ipa-test-task %{buildroot}%{_bindir}/ipa-test-task-%{python2_version} @@ -867,6 +885,7 @@ ln -s %{_bindir}/ipa-test-task-%{python2_version} %{buildroot}%{_bindir}/ipa-tes ln -s %{_bindir}/ipa-run-tests-%{python2_version} %{buildroot}%{_bindir}/ipa-run-tests ln -s %{_bindir}/ipa-test-config-%{python2_version} %{buildroot}%{_bindir}/ipa-test-config ln -s %{_bindir}/ipa-test-task-%{python2_version} %{buildroot}%{_bindir}/ipa-test-task +%endif # remove files which are useful only for make uninstall @@ -1385,7 +1404,6 @@ fi %ghost %config(noreplace) %{_sysconfdir}/ipa/nssdb/secmod.db %ghost %config(noreplace) %{_sysconfdir}/ipa/nssdb/pwdfile.txt %ghost %config(noreplace) %{_sysconfdir}/pki/ca-trust/source/ipa.p11-kit -%dir %{_usr}/share/ipa %dir %{_localstatedir}/lib/ipa-client %dir %{_localstatedir}/lib/ipa-client/sysrestore %{_mandir}/man5/default.conf.5* From aece4c3c82d8010dc9c6c3ef4e7168362560528e Mon Sep 17 00:00:00 2001 From: Lukas Slebodnik <lsleb...@redhat.com> Date: Wed, 22 Feb 2017 09:40:50 +0100 Subject: [PATCH 14/14] BUILD: Add possibility to optionally install ipatests Packagers does not have a use case for installation of ipatests with client only build because integration tests require server and unit tests can be executed as part of build process. But tox uses virtualenv and unit test must be installed for execution. This patch add new configure time option to install tests. --- Makefile.am | 7 ++++++- configure.ac | 9 +++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/Makefile.am b/Makefile.am index fd90f29..865b68a 100644 --- a/Makefile.am +++ b/Makefile.am @@ -3,11 +3,16 @@ ACLOCAL_AMFLAGS = -I m4 IPACLIENT_SUBDIRS = ipaclient ipalib ipapython if ENABLE_SERVER - SERVER_SUBDIRS = daemons init install ipaserver ipatests + SERVER_SUBDIRS = daemons init install ipaserver +endif + +if WITH_TESTS + TEST_SUBDIRS = ipatests endif SUBDIRS = asn1 util client contrib $(IPACLIENT_SUBDIRS) ipaplatform po \ $(SERVER_SUBDIRS) \ + $(TEST_SUBDIRS) \ $(NULL) MOSTLYCLEANFILES = ipasetup.pyc ipasetup.pyo \ diff --git a/configure.ac b/configure.ac index 813c4c6..fc561db 100644 --- a/configure.ac +++ b/configure.ac @@ -130,6 +130,14 @@ if test x"$enable_server" = xyes; then m4_include([server.m4]) fi +AC_ARG_WITH([tests], + [AC_HELP_STRING([--with-tests], + [Whether to install ipatests. ] + [Default inherited from --disable-server])], + [with_tests=$withval], + [with_tests=$enable_server]) +AM_CONDITIONAL([WITH_TESTS], [test x"$with_tests" = xyes]) + dnl cmocka and nss_wrapper are optional dependencies used only in server dnl but they use AM_CONDITIONAL which need to be executed every time dnl it simpler to have them directly in configure.ac @@ -451,6 +459,7 @@ echo " KRB5 libs: ${KRB5_LIBS} OpenSSL crypto libs: ${CRYPTO_LIBS} server support: ${enable_server} + ipatests: ${with_tests} " AS_IF([test x"$enable_server" = xyes], [ echo "\
-- Manage your subscription for the Freeipa-devel mailing list: https://www.redhat.com/mailman/listinfo/freeipa-devel Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code