dnl Configure template for the scorepw package
|
|
|
|
AC_INIT([scorepw], [0.2.1], [devel@incenp.org])
|
|
AC_CONFIG_SRCDIR([configure.ac])
|
|
AC_CONFIG_MACRO_DIR([m4])
|
|
AC_CONFIG_AUX_DIR([config])
|
|
AC_CONFIG_HEADERS([config.h])
|
|
AC_CONFIG_LIBOBJ_DIR([lib])
|
|
AC_USE_SYSTEM_EXTENSIONS
|
|
AM_INIT_AUTOMAKE([foreign])
|
|
|
|
dnl Check for development tools
|
|
AC_PROG_CC
|
|
AC_PROG_RANLIB
|
|
AC_PROG_INSTALL
|
|
|
|
dnl Check for some non-ubiquitous functions
|
|
ICP_CHECK_NOTCH_FUNCS
|
|
|
|
dnl Check for zxcvbn library
|
|
AC_ARG_WITH([zxcvbn-c],
|
|
[AS_HELP_STRING([--with-zxcvbn-c],
|
|
[Use Zxcvbn-C estimator @<:@default=check@:>@])],
|
|
[],
|
|
[with_zxcvbn_c=check])
|
|
AS_IF([test "x$with_zxcvbn_c" != xno],
|
|
[AC_CHECK_HEADER([zxcvbn.h],
|
|
[AC_CHECK_LIB([zxcvbn],[ZxcvbnMatch],
|
|
[have_zxcvbn=yes
|
|
LIBS="$LIBS -lzxcvbn"
|
|
AC_DEFINE([HAVE_ZXCVBN],[1],
|
|
[Define if zxcvbn is available.])],
|
|
[have_zxcvbn=no])],
|
|
[have_zxcvbn=no])],
|
|
[have_zxcvbn=no])
|
|
AS_IF([test "x$have_zxcvbn" = xno && test "x$with_zxcvbn_c" != xcheck && test "x$with_zxcvbn_c" != xno],
|
|
[AC_MSG_FAILURE([--with-zxcvbn-c was given, but Zxcvbn-C was not found])])
|
|
|
|
dnl Check for zxcvbn-cpp library
|
|
AC_ARG_WITH([zxcvbn-cpp],
|
|
[AS_HELP_STRING([--with-zxcvbn-cpp],
|
|
[Use Zxcvbn-CPP estimator @<:@default=check@:>@])],
|
|
[],
|
|
[with_zxcvbn_cpp=check])
|
|
AS_IF([test "x$with_zxcvbn_cpp" != xno],
|
|
[AC_CHECK_HEADER([zxcvbn/zxcvbn.h],
|
|
[AC_CHECK_LIB([zxcvbncpp],[zxcvbn_password_strength],
|
|
[have_zxcvbncpp=yes
|
|
LIBS="$LIBS -lzxcvbncpp"
|
|
AC_DEFINE([HAVE_ZXCVBNCPP],[1],
|
|
[Define if zxcvbncpp is available])],
|
|
[have_zxcvbncpp=no])],
|
|
[have_zxcvbncpp=no])],
|
|
[have_zxcvbncpp=no])
|
|
AS_IF([test "x$have_zxcvbncpp" = xno && test "x$with_zxcvbn_cpp" != xcheck && test "x$with_zxcvbn_cpp" != xno],
|
|
[AC_MSG_FAILURE(--with-zxcvbn-cpp was given, but Zxcvbn-CPP was not found)])
|
|
|
|
dnl Check for pwquality library
|
|
AC_ARG_WITH([pwquality],
|
|
[AS_HELP_STRING([--with-pwquality],
|
|
[Use libpwquality estimator @<:@default=check@:>@])],
|
|
[],
|
|
[with_pwquality=check])
|
|
AS_IF([test "x$with_pwquality" != xno],
|
|
[AC_CHECK_HEADER([pwquality.h],
|
|
[AC_CHECK_LIB([pwquality],[pwquality_check],
|
|
[have_pwquality=yes
|
|
LIBS="$LIBS -lpwquality"
|
|
AC_DEFINE([HAVE_PWQUALITY],[1],
|
|
[Define if pwquality is available.])],
|
|
[have_pwquality=no])],
|
|
[have_pwquality=no])],
|
|
[have_pwquality=no])
|
|
AS_IF([test "x$have_pwquality" = xno && test "x$with_pwquality" != xheck && test "x$with_pwquality" != xno],
|
|
[AC_MSG_FAILURE([--with-pwquality was given, but libpwquality was not found])])
|
|
|
|
dnl Check number of available backends
|
|
num_backends=0
|
|
AS_IF([test "x$have_zxcvbn" = xyes], [AS_VAR_ARITH([num_backends], [$num_backends + 1])])
|
|
AS_IF([test "x$have_zxcvbncpp" = xyes], [AS_VAR_ARITH([num_backends], [$num_backends + 1])])
|
|
AS_IF([test "x$have_pwquality" = xyes], [AS_VAR_ARITH([num_backends], [$num_backends + 1])])
|
|
AS_IF([test "x$num_backends" = x0],
|
|
[AC_MSG_ERROR([[
|
|
***
|
|
*** No password strength estimation library found. You need
|
|
*** at least one of the following libraries:
|
|
***
|
|
*** zxcvbn-c
|
|
*** zxcvbn-cpp
|
|
*** pwquality
|
|
***]])])
|
|
AC_DEFINE_UNQUOTED([NUM_BACKENDS], [$num_backends],
|
|
[Define the number of available backends.])
|
|
|
|
dnl Internal dictionary
|
|
AC_ARG_WITH([dict],
|
|
[AS_HELP_STRING([--with-dict=file],
|
|
[Embed supplied dictionary in the program])],
|
|
[], [with_dict=no])
|
|
AM_CONDITIONAL([INTERNAL_DICT], [test "x$with_dict" != xno])
|
|
AS_IF([test "x$with_dict" != xno],
|
|
[AC_SUBST([INTERNAL_DICT_FILE], ["$with_dict"])
|
|
AC_DEFINE([HAVE_INTERNAL_DICT], [1],
|
|
[Define if a dictionary is embedded into the program.])])
|
|
|
|
dnl I18N support
|
|
AM_GNU_GETTEXT([external])
|
|
AM_GNU_GETTEXT_VERSION(0.19.8)
|
|
AH_BOTTOM([#ifdef ENABLE_NLS
|
|
#include <libintl.h>
|
|
#define _(a) gettext(a)
|
|
#define n(a, b, c) ngettext(a, b, c)
|
|
#else
|
|
#define _(a) a
|
|
#define n(a, b, c) ((c) > 1 ? (b) : (a))
|
|
#define bindtextdomain(a, b)
|
|
#define textdomain(a)
|
|
#endif])
|
|
|
|
dnl Output files
|
|
AC_CONFIG_FILES([Makefile lib/Makefile po/Makefile.in src/Makefile
|
|
man/Makefile man/scorepw.1])
|
|
AC_OUTPUT
|
|
|
|
dnl Summary
|
|
echo "
|
|
${PACKAGE_NAME} version ${PACKAGE_VERSION}
|
|
Configuration complete
|
|
|
|
Prefix '${prefix}'
|
|
Compiler: '${CC} ${CFLAGS} ${CPPFLAGS}'
|
|
|
|
Password strength estimation libraries:
|
|
Zxcvbn-C: ..... $have_zxcvbn
|
|
Zxcvbn-CPP: ... $have_zxcvbncpp
|
|
Pwquality: .... $have_pwquality
|
|
|
|
Internal dictionary: $with_dict
|
|
|
|
"
|