3 # AX_CHECK_SRP([action-if-found[, action-if-not-found]])
7 # Look for libsrp in a number of default locations, or in a provided location
8 # (via --with-srp=). Sets
13 # and calls ACTION-IF-FOUND or ACTION-IF-NOT-FOUND appropriately
17 # Copyright (c) 2021 Eivind Naess <eivnaes@yahoo.com>
19 # Copying and distribution of this file, with or without modification, are
20 # permitted in any medium without royalty provided the copyright notice
21 # and this notice are preserved. This file is offered as-is, without any
26 AC_DEFUN([AX_CHECK_SRP], [
28 [AS_HELP_STRING([--with-srp=DIR],
29 [With libsrp support, see http://srp.stanford.edu])],
33 srpdirs="/usr/local /usr/lib /usr"
44 if [ test "x${with_srp}" != "xno" ] ; then
46 for srpdir in $srpdirs; do
47 AC_MSG_CHECKING([for srp.h in $srpdir])
48 if test -f "$srpdir/include/srp.h"; then
49 SRP_CFLAGS="-I$srpdir/include"
50 SRP_LDFLAGS="-L$srpdir/lib"
58 # try the preprocessor and linker with our new flags,
59 # being careful not to pollute the global LIBS, LDFLAGS, and CPPFLAGS
61 AC_MSG_CHECKING([if compiling and linking against libsrp works])
64 save_LDFLAGS="$LDFLAGS"
65 save_CPPFLAGS="$CPPFLAGS"
66 LDFLAGS="$SRP_LDFLAGS $OPENSSL_LDFLAGS $LDFLAGS"
67 LIBS="$SRP_LIBS $OPENSSL_LIBS $LIBS"
68 CPPFLAGS="$SRP_CFLAGS $OPENSSL_INCLUDES $CPPFLAGS"
73 [SRP_use_engine(NULL);])],
83 CPPFLAGS="$save_CPPFLAGS"
84 LDFLAGS="$save_LDFLAGS"
87 AC_SUBST([SRP_CFLAGS])
89 AC_SUBST([SRP_LDFLAGS])
92 AM_CONDITIONAL(WITH_SRP, test "x${with_srp}" != "xno")