You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
gentoo-overlay/net-irc/atheme-services/files/atheme-services-6.0.9-crack...

78 lines
2.7 KiB

From 79f41f4e7647335beca977d852c6c83abebcc2bd Mon Sep 17 00:00:00 2001
From: Nathan Phillip Brink <binki@gentoo.org>
Date: Tue, 3 Jan 2012 01:47:31 +0000
Subject: [PATCH] Add --with-cracklib/--without-cracklib ./configure options and only pass -lcrack when compiling nickserv/cracklib module.
Being able to disable cracklib at ./configure time fixes an automagic
dependency (https://bugs.gentoo.org/397401 with original patch from
kensington). Only linking against cracklib when necessary hopefully
makes compilation and loading of modules slightly more efficient.
---
configure | 27 ++++++++++++++++++++++++++-
configure.ac | 16 +++++++++++++++-
extra.mk.in | 1 +
modules/nickserv/Makefile | 10 ++++++++++
4 files changed, 52 insertions(+), 2 deletions(-)
diff --git a/configure b/configure
index 63540aa..ee8d554 100755
diff --git a/configure.ac b/configure.ac
index 83c4aeb..a6d8b6e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -95,8 +95,22 @@ AC_SEARCH_LIBS(crypt, crypt, [POSIX_CRYPTC="posix.c"])
AC_SUBST(POSIX_CRYPTC)
CRACKLIB_C=""
-AC_SEARCH_LIBS(FascistCheck, crack, [CRACKLIB_C="cracklib.c"])
+CRACKLIB_LIBS=""
+AC_ARG_WITH([cracklib],
+ [AS_HELP_STRING([--with-cracklib], [Compile cracklib nickserv submodule for checking password strength.])],
+ [],
+ [with_cracklib="auto"])
+AS_IF([test "x$with_cracklib" != "xno"],
+ [LIBS_save="$LIBS"
+ AC_SEARCH_LIBS([FascistCheck], [crack],
+ [CRACKLIB_C="cracklib.c"
+ AS_IF([test "x$ac_cv_search_FascistCheck" != "xnone required"],
+ [CRACKLIB_LIBS="$ac_cv_search_FascistCheck"])],
+ [AS_IF([test "x$with_cracklib" != "xauto"],
+ [AC_MSG_ERROR([--with-cracklib was specified but cracklib could not be found.])])])
+ LIBS="$LIBS_save"])
AC_SUBST(CRACKLIB_C)
+AC_SUBST([CRACKLIB_LIBS])
AC_ARG_WITH([ldap],
[AS_HELP_STRING([--without-ldap],[Disable building ldap auth module.])],
diff --git a/extra.mk.in b/extra.mk.in
index cc6af70..2d01345 100644
--- a/extra.mk.in
+++ b/extra.mk.in
@@ -123,4 +123,5 @@ EGREP ?= @EGREP@
VERSION ?= @VERSION@
prefix ?= @prefix@
CRACKLIB_C ?= @CRACKLIB_C@
+CRACKLIB_LIBS ?= @CRACKLIB_LIBS@
CONTRIB_ENABLE ?= @CONTRIB_ENABLE@
diff --git a/modules/nickserv/Makefile b/modules/nickserv/Makefile
index 060f708..d2f7c4e 100644
--- a/modules/nickserv/Makefile
+++ b/modules/nickserv/Makefile
@@ -68,3 +68,13 @@ BASE_SRCS = \
SRCS = ${BASE_SRCS} ${EXTRA_SRCS}
CPPFLAGS += -I../../include
+
+# Custom rule for cracklib.c which is the only module to ever need
+# -lcrack.
+cracklib$(PLUGIN_SUFFIX): cracklib.c
+ ${COMPILE_STATUS}
+ if ${CC} -MMD -MP ${CFLAGS} ${PLUGIN_CFLAGS} ${CPPFLAGS} ${PLUGIN_LDFLAGS} ${LDFLAGS} -o $@ ${CRACKLIB_C} ${LIBS} ${CRACKLIB_LIBS}; then \
+ ${COMPILE_OK}; \
+ else \
+ ${COMPILE_FAILED}; \
+ fi
--
1.7.3.4