Upstream-PR: https://github.com/Radmind/radmind/pull/336 Upstream-PR: https://github.com/voretaq7/radmind/pull/1 From 335a7f35847da2ae366028cbc3fbdd01779f9d37 Mon Sep 17 00:00:00 2001 From: orbea Date: Thu, 12 May 2022 14:25:56 -0700 Subject: [PATCH 2/4] Fix autoreconf-2.71 --- configure.ac | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/configure.ac b/configure.ac index 38896af..3bbdabb 100644 --- a/configure.ac +++ b/configure.ac @@ -69,8 +69,8 @@ if test x$libc_inet_aton != xyes; then AC_CHECK_LIB(resolv, inet_aton) fi if test x$host_vendor = xapply; then - AC_CHECK_LIB(c, lchown, [AC_DEFINE(HAVE_LCHOWN)], []) - AC_CHECK_LIB(c, lchmod, [AC_DEFINE(HAVE_LCHMOD)], []) + AC_CHECK_LIB(c, lchown, [AC_DEFINE([HAVE_LCHOWN], [], [lchown])]) + AC_CHECK_LIB(c, lchmod, [AC_DEFINE([HAVE_LCHMOD], [], [lchmod])]) fi AC_CHECK_LIB(nsl, gethostbyaddr) AC_CHECK_LIB([socket], [socket]) @@ -78,7 +78,7 @@ AC_CHECK_LIB([ssl], [SSL_accept], , [CHECK_SSL]) AC_CHECK_HEADER([openssl/ssl.h], [], [AC_MSG_ERROR([header file is required for this software. You may be running RedHat 9. If so, see the FAQ or the README for further instructions.])]) AC_CHECK_LIB([crypto], [SSLeay_version], , [CHECK_SSL]) -AC_CHECK_LIB([crypto], [X509_VERIFY_PARAM_set_flags], [AC_DEFINE(HAVE_X509_VERIFY_PARAM)], []) +AC_CHECK_LIB([crypto], [X509_VERIFY_PARAM_set_flags], [AC_DEFINE([HAVE_X509_VERIFY_PARAM], [], [X509_verify_param])]) # PAM AC_ARG_WITH([pam], AC_HELP_STRING([--with-pam=PATH], [Pluggable Authentication Module support (default: /usr)]), [], with_pam=/usr) @@ -88,12 +88,12 @@ if test x_"$with_pam" != x_no; then AC_CHECK_LIB([pam], [pam_start], [ AC_CHECK_HEADERS(pam/pam_appl.h, , [AC_CHECK_HEADERS(security/pam_appl.h)]) - AC_DEFINE(HAVE_LIBPAM) + AC_DEFINE([HAVE_LIBPAM], [], [libpam]) LIBS="$LIBS -lpam"; ] ) fi -AC_CHECK_HEADER([dns_sd.h], [AC_DEFINE(HAVE_DNSSD)], [], []) +AC_CHECK_HEADER([dns_sd.h], [AC_DEFINE([HAVE_DNSSD], [], [dnssd])]) AC_CHECK_LIB(dns_sd, DNSServiceRegister) CHECK_ZLIB From dd731c6e7b55d62cf93df8d6c872a736785b3ac1 Mon Sep 17 00:00:00 2001 From: orbea Date: Thu, 12 May 2022 15:41:38 -0700 Subject: [PATCH 3/4] Makefile.in: Use mkdir -p Silences trivial non-fatal errors during make --- Makefile.in | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/Makefile.in b/Makefile.in index 158a7cb..300f64c 100644 --- a/Makefile.in +++ b/Makefile.in @@ -256,10 +256,10 @@ VERSION=$(shell date +%Y%m%d) DISTDIR=radmind-${VERSION} dist : distclean - mkdir ../${DISTDIR} + mkdir -p ../${DISTDIR} tar -h -c -f - -X EXCLUDE . | tar xpf - -C ../${DISTDIR} echo ${VERSION} > ../${DISTDIR}/VERSION - -mkdir ../${DISTDIR}/tmp + -mkdir -p ../${DISTDIR}/tmp for i in ${MANTARGETS}; do \ sed -e 's@_RADMIND_BUILD_DATE@${RADMIND_BUILD_DATE}@g' \ ../${DISTDIR}/man/$$i > ../${DISTDIR}/tmp/$$i; \ @@ -269,7 +269,7 @@ dist : distclean (cd .. && tar cvfz ${DISTDIR}.tar.gz ${DISTDIR}) rash : FRC - -mkdir tmp + -mkdir -p tmp sed -e 's@_RADMIND_HOST@${RADMIND_HOST}@g' \ -e 's@_RADMIND_AUTHLEVEL@${RADMIND_AUTHLEVEL}@g' \ -e 's@_RADMIND_PREAPPLY@${PREAPPLYDIR}@g' \ @@ -283,8 +283,8 @@ rash : FRC ${srcdir}/ra.sh > tmp/ra.sh; man : FRC - -mkdir tmp - -mkdir tmp/man + -mkdir -p tmp + -mkdir -p tmp/man pwd for i in ${MANTARGETS}; do \ sed -e 's@_RADMIND_PATH@${RADMINDDIR}@g' \ @@ -308,15 +308,15 @@ install : all man rash ${INSTALL} -m 0755 -c tmp/ra.sh ${DESTDIR}/${BINDIR}/ -mkdir -p ${DESTDIR}/${prefix} -mkdir -p ${DESTDIR}/${MANDIR} - -mkdir ${DESTDIR}/${MANDIR}/man1 + -mkdir -p ${DESTDIR}/${MANDIR}/man1 for i in ${MAN1TARGETS}; do \ ${INSTALL} -m 0644 -c tmp/man/$$i ${DESTDIR}/${MANDIR}/man1/; \ done - -mkdir ${DESTDIR}/${MANDIR}/man5 + -mkdir -p ${DESTDIR}/${MANDIR}/man5 for i in ${MAN5TARGETS}; do \ ${INSTALL} -m 0644 -c tmp/man/$$i ${DESTDIR}/${MANDIR}/man5/; \ done - -mkdir ${DESTDIR}/${MANDIR}/man8 + -mkdir -p ${DESTDIR}/${MANDIR}/man8 for i in ${MAN8TARGETS}; do \ ${INSTALL} -m 0644 -c tmp/man/$$i ${DESTDIR}/${MANDIR}/man8/; \ done @@ -333,8 +333,8 @@ PKGSRCDIR=`pwd` INFOLIST= $(wildcard OS_X/*.plist) info : - -mkdir tmp - -mkdir tmp/OS_X + -mkdir -p tmp + -mkdir -p tmp/OS_X for i in ${INFOLIST}; do \ sed -e 's@_RADMIND_VERSION@${VERSION}@g' \ $$i > tmp/$$i; \ From 2a20542a9367fc9c7f34d275a471da1e503a78b1 Mon Sep 17 00:00:00 2001 From: orbea Date: Fri, 13 May 2022 00:07:30 -0700 Subject: [PATCH 4/4] Use pkg-config to remove legacy macros The legacy macros CHECK_ZLIB and CHECK_SSL add many instances of hardcoded -L/usr/lib which is problematic on newer systems. It is better to use pkg-config so they are always found where expected. Also removed some totally broken legacy osx macros. --- Makefile.in | 5 +++-- configure.ac | 21 +++++++++++---------- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/Makefile.in b/Makefile.in index 300f64c..48ef9d2 100644 --- a/Makefile.in +++ b/Makefile.in @@ -39,11 +39,12 @@ INCPATH= @CPPFLAGS@ -I${srcdir}/libsnet -I. OPTOPTS= @OPTOPTS@ CC= @CC@ DEFS= -LIBS= -lsnet @LIBS@ +LIBS= -lsnet @LIBS@ @ssl_LIBS@ @zlib_LIBS@ LDFLAGS= -Llibsnet/.libs @LDFLAGS@ ${LIBS} INSTALL= @INSTALL@ -CFLAGS= ${DEFS} ${OPTOPTS} @CFLAGS@ ${INCPATH} +CFLAGS= ${DEFS} ${OPTOPTS} ${INCPATH} \ + @ssl_CFLAGS@ @zlib_CFLAGS@ @CFLAGS@ BINTARGETS= fsdiff ktcheck lapply lcksum lcreate lmerge lfdiff repo \ twhich lsort diff --git a/configure.ac b/configure.ac index 3bbdabb..8a96de3 100644 --- a/configure.ac +++ b/configure.ac @@ -46,12 +46,6 @@ AC_SYS_LARGEFILE AC_CHECK_SIZEOF(off_t) AC_CHECK_SIZEOF(time_t) -# check early to make any required changes to environment for following tests. -CHECK_UNIVERSAL_BINARIES - -# mute Mac OS X's helpful notices that using dylib OpenSSL -MACOSX_MUTE_DEPRECATION_WARNINGS - # Checks for header files # glibc 2.25 still includes sys/sysmacros.h in sys/types.h but emits @@ -74,17 +68,20 @@ if test x$host_vendor = xapply; then fi AC_CHECK_LIB(nsl, gethostbyaddr) AC_CHECK_LIB([socket], [socket]) -AC_CHECK_LIB([ssl], [SSL_accept], , [CHECK_SSL]) + +PKG_CHECK_MODULES([ssl], [openssl], + [AC_DEFINE([HAVE_LIBSSL], [1], [libssl])]) +AC_SUBST([ssl_LIBS]) +AC_SUBST([ssl_CFLAGS]) + AC_CHECK_HEADER([openssl/ssl.h], [], [AC_MSG_ERROR([header file is required for this software. You may be running RedHat 9. If so, see the FAQ or the README for further instructions.])]) -AC_CHECK_LIB([crypto], [SSLeay_version], , [CHECK_SSL]) AC_CHECK_LIB([crypto], [X509_VERIFY_PARAM_set_flags], [AC_DEFINE([HAVE_X509_VERIFY_PARAM], [], [X509_verify_param])]) # PAM AC_ARG_WITH([pam], AC_HELP_STRING([--with-pam=PATH], [Pluggable Authentication Module support (default: /usr)]), [], with_pam=/usr) if test x_"$with_pam" != x_no; then CPPFLAGS="${CPPFLAGS} -I$with_pam/include" - LDFLAGS="${LDFLAGS} -L$with_pam/lib" AC_CHECK_LIB([pam], [pam_start], [ AC_CHECK_HEADERS(pam/pam_appl.h, , [AC_CHECK_HEADERS(security/pam_appl.h)]) @@ -96,7 +93,11 @@ fi AC_CHECK_HEADER([dns_sd.h], [AC_DEFINE([HAVE_DNSSD], [], [dnssd])]) AC_CHECK_LIB(dns_sd, DNSServiceRegister) -CHECK_ZLIB +PKG_CHECK_MODULES([zlib], [zlib], + [AC_DEFINE([HAVE_ZLIB], [1], [zlib])], + [AC_MSG_WARN(zlib.pc not found, building without zlib support)]) +AC_SUBST([zlib_LIBS]) +AC_SUBST([zlib_CFLAGS]) # HPUX lacks wait4 and strtoll AC_CHECK_FUNCS(wait4 strtoll) From d31a1c234e7d4f4d630c720024df8bdf911b1de4 Mon Sep 17 00:00:00 2001 From: orbea Date: Sat, 14 May 2022 03:30:35 -0700 Subject: [PATCH 5/6] Disable sasl for libsnet This was previously set in aclocal.m4 --- configure.ac | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 8a96de3..60a56fb 100644 --- a/configure.ac +++ b/configure.ac @@ -113,7 +113,9 @@ if test x_"$OPTOPTS" = x_; then fi AC_SUBST(OPTOPTS) -SET_NO_SASL +ac_configure_args="$ac_configure_args --enable-sasl=no"; +AC_MSG_RESULT([Disabling SASL for libsnet]) + AC_CONFIG_SUBDIRS(libsnet) AC_CONFIG_FILES(Makefile) AC_OUTPUT -- 2.35.1 From 66e0cb1c85e16ff70cf68c27e39ae2ec31487183 Mon Sep 17 00:00:00 2001 From: orbea Date: Sat, 14 May 2022 09:33:31 -0700 Subject: [PATCH 6/6] Add AC_ARG_ENABLE options for pam, ssl and zlib --- Makefile.in | 4 +-- configure.ac | 89 ++++++++++++++++++++++++++++++++++++++++------------ 2 files changed, 71 insertions(+), 22 deletions(-) diff --git a/Makefile.in b/Makefile.in index ca01832..b2ef2b6 100644 --- a/Makefile.in +++ b/Makefile.in @@ -39,12 +39,12 @@ INCPATH= @CPPFLAGS@ -I${srcdir}/libsnet -I. OPTOPTS= @OPTOPTS@ CC= @CC@ DEFS= -LIBS= -lsnet @LIBS@ @ssl_LIBS@ @zlib_LIBS@ +LIBS= -lsnet @LIBS@ @pam_LIBS@ @ssl_LIBS@ @zlib_LIBS@ LDFLAGS= -Llibsnet/.libs @LDFLAGS@ ${LIBS} INSTALL= @INSTALL@ CFLAGS= ${DEFS} ${OPTOPTS} ${INCPATH} \ - @ssl_CFLAGS@ @zlib_CFLAGS@ @CFLAGS@ + @pam_CFLAGS@ @ssl_CFLAGS@ @zlib_CFLAGS@ @CFLAGS@ BINTARGETS= fsdiff ktcheck lapply lcksum lcreate lmerge lfdiff repo \ twhich lsort diff --git a/configure.ac b/configure.ac index 60a56fb..8c9b916 100644 --- a/configure.ac +++ b/configure.ac @@ -56,6 +56,25 @@ CFLAGS="$HOST_CFLAGS -Werror" AC_HEADER_MAJOR CFLAGS="$SAVED_CFLAGS" +# Enable features. + +AC_ARG_ENABLE([pam], + AS_HELP_STRING([--enable-pam], [Build with pam @<:@default=yes@:>@]), + [AS_CASE(${enableval}, [yes], [], [no], [], + [AC_MSG_ERROR([bad value '${enableval}' for --enable-pam])])], + [enable_pam=check]) + +AC_ARG_ENABLE([ssl], + AS_HELP_STRING([--enable-ssl], [Build with openssl @<:@default=yes@:>@]), + [AS_CASE(${enableval}, [yes], [], [no], [], + [AC_MSG_ERROR([bad value '${enableval}' for --enable-ssl])])], + [enable_ssl=check]) + +AC_ARG_ENABLE([zlib], + AS_HELP_STRING([--enable-zlib], [Build with zlib @<:@default=yes@:>@]), + [AS_CASE(${enableval}, [yes], [], [no], [], + [AC_MSG_ERROR([bad value '${enableval}' for --enable-zlib])])], + [enable_zlib=check]) # Checks for libraries. AC_CHECK_LIB(c, inet_aton, libc_inet_aton=yes) @@ -69,35 +88,65 @@ fi AC_CHECK_LIB(nsl, gethostbyaddr) AC_CHECK_LIB([socket], [socket]) -PKG_CHECK_MODULES([ssl], [openssl], - [AC_DEFINE([HAVE_LIBSSL], [1], [libssl])]) -AC_SUBST([ssl_LIBS]) -AC_SUBST([ssl_CFLAGS]) +# Checks for pam. +AS_IF([test x$enable_pam != xno], + [PKG_CHECK_MODULES([pam], [pam], + [AC_CHECK_HEADERS([pam/pam_appl.h], + [], [AC_CHECK_HEADERS([security/pam_appl.h])])] + [AC_DEFINE([HAVE_LIBPAM], [1], [libpam])], + [AS_IF([test x$enable_pam != xyes], + [AC_MSG_WARN([cannot find pam.pc, disabling pam support])], + [enable_pam=error]) + ]) + ]) + +AS_IF([test x$enable_pam = xerror], + [AC_MSG_ERROR([cannot find pam.pc and pam support requested])]) + +AM_CONDITIONAL([ENABLE_PAM], [test x$enable_pam = xyes]) +AC_SUBST([pam_CFLAGS]) +AC_SUBST([pam_LIBS]) + +# Checks for openssl. +AS_IF([test x$enable_ssl != xno], + [PKG_CHECK_MODULES([ssl], [openssl], + [AC_DEFINE([HAVE_LIBSSL], [1], [libssl])], + [AS_IF([test x$enable_ssl != xyes], + [AC_MSG_WARN([cannot find openssl.pc, disabling libssl support])], + [enable_ssl=error]) + ]) + ]) AC_CHECK_HEADER([openssl/ssl.h], [], [AC_MSG_ERROR([header file is required for this software. You may be running RedHat 9. If so, see the FAQ or the README for further instructions.])]) AC_CHECK_LIB([crypto], [X509_VERIFY_PARAM_set_flags], [AC_DEFINE([HAVE_X509_VERIFY_PARAM], [], [X509_verify_param])]) -# PAM -AC_ARG_WITH([pam], AC_HELP_STRING([--with-pam=PATH], [Pluggable Authentication Module support (default: /usr)]), [], with_pam=/usr) -if test x_"$with_pam" != x_no; then - CPPFLAGS="${CPPFLAGS} -I$with_pam/include" - AC_CHECK_LIB([pam], [pam_start], - [ - AC_CHECK_HEADERS(pam/pam_appl.h, , [AC_CHECK_HEADERS(security/pam_appl.h)]) - AC_DEFINE([HAVE_LIBPAM], [], [libpam]) - LIBS="$LIBS -lpam"; - ] - ) -fi +AS_IF([test x$enable_ssl = xerror], + [AC_MSG_ERROR([cannot find openssl.pc and libssl support requested])]) + +AM_CONDITIONAL([ENABLE_LIBSSL], [test x$enable_ssl = xyes]) +AC_SUBST([ssl_CFLAGS]) +AC_SUBST([ssl_LIBS]) + AC_CHECK_HEADER([dns_sd.h], [AC_DEFINE([HAVE_DNSSD], [], [dnssd])]) AC_CHECK_LIB(dns_sd, DNSServiceRegister) -PKG_CHECK_MODULES([zlib], [zlib], - [AC_DEFINE([HAVE_ZLIB], [1], [zlib])], - [AC_MSG_WARN(zlib.pc not found, building without zlib support)]) -AC_SUBST([zlib_LIBS]) +# Checks for zlib. +AS_IF([test x$enable_zlib != xno], + [PKG_CHECK_MODULES([zlib], [zlib], + [AC_DEFINE([HAVE_ZLIB], [1], [zlib])], + [AS_IF([test x$enable_zlib != xyes], + [AC_MSG_WARN([cannot find zlib.pc, disabling zlib support])], + [enable_zlib=error]) + ]) + ]) + +AS_IF([test x$enable_zlib = xerror], + [AC_MSG_ERROR([cannot find zlib.pc and zlib support requested])]) + +AM_CONDITIONAL([ENABLE_ZLIB], [test x$enable_zlib = xyes]) AC_SUBST([zlib_CFLAGS]) +AC_SUBST([zlib_LIBS]) # HPUX lacks wait4 and strtoll AC_CHECK_FUNCS(wait4 strtoll) -- 2.35.1