1
0
mirror of https://github.com/unrealircd/unrealircd.git synced 2026-07-02 08:06:36 +02:00

Fix libargon2 autodetection (system lib).

This commit is contained in:
Bram Matthys
2018-12-10 08:19:41 +01:00
parent 942da806dd
commit 9fdd93f0e4
2 changed files with 87 additions and 99 deletions
Vendored
+80 -95
View File
@@ -8058,7 +8058,86 @@ fi
fi
if test "x$with_system_argon2" = "xno"; then :
has_system_argon2="no"
if test "x$with_system_argon2" = "xyes"; then :
pkg_failed=no
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ARGON2" >&5
$as_echo_n "checking for ARGON2... " >&6; }
if test -n "$ARGON2_CFLAGS"; then
pkg_cv_ARGON2_CFLAGS="$ARGON2_CFLAGS"
elif test -n "$PKG_CONFIG"; then
if test -n "$PKG_CONFIG" && \
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libargon2\""; } >&5
($PKG_CONFIG --exists --print-errors "libargon2") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
pkg_cv_ARGON2_CFLAGS=`$PKG_CONFIG --cflags "libargon2" 2>/dev/null`
test "x$?" != "x0" && pkg_failed=yes
else
pkg_failed=yes
fi
else
pkg_failed=untried
fi
if test -n "$ARGON2_LIBS"; then
pkg_cv_ARGON2_LIBS="$ARGON2_LIBS"
elif test -n "$PKG_CONFIG"; then
if test -n "$PKG_CONFIG" && \
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libargon2\""; } >&5
($PKG_CONFIG --exists --print-errors "libargon2") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
pkg_cv_ARGON2_LIBS=`$PKG_CONFIG --libs "libargon2" 2>/dev/null`
test "x$?" != "x0" && pkg_failed=yes
else
pkg_failed=yes
fi
else
pkg_failed=untried
fi
if test $pkg_failed = yes; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
_pkg_short_errors_supported=yes
else
_pkg_short_errors_supported=no
fi
if test $_pkg_short_errors_supported = yes; then
ARGON2_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libargon2" 2>&1`
else
ARGON2_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libargon2" 2>&1`
fi
# Put the nasty error message in config.log where it belongs
echo "$ARGON2_PKG_ERRORS" >&5
has_system_argon2=no
elif test $pkg_failed = untried; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
has_system_argon2=no
else
ARGON2_CFLAGS=$pkg_cv_ARGON2_CFLAGS
ARGON2_LIBS=$pkg_cv_ARGON2_LIBS
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
has_system_argon2=yes
if test "x$PRIVATELIBDIR" != "x"; then :
rm -f "$PRIVATELIBDIR/"libargon2*
fi
fi
fi
if test "$has_system_argon2" = "no"; then :
argon2_version="20181209"
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: extracting Argon2 library" >&5
@@ -8090,100 +8169,6 @@ ARGON2_LIBS="-L$PRIVATELIBDIR -largon2 -lrt -ldl"
cd $cur_dir
else
pkg_failed=no
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ARGON2" >&5
$as_echo_n "checking for ARGON2... " >&6; }
if test -n "$ARGON2_CFLAGS"; then
pkg_cv_ARGON2_CFLAGS="$ARGON2_CFLAGS"
elif test -n "$PKG_CONFIG"; then
if test -n "$PKG_CONFIG" && \
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libargon2 >= 0\""; } >&5
($PKG_CONFIG --exists --print-errors "libargon2 >= 0") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
pkg_cv_ARGON2_CFLAGS=`$PKG_CONFIG --cflags "libargon2 >= 0" 2>/dev/null`
test "x$?" != "x0" && pkg_failed=yes
else
pkg_failed=yes
fi
else
pkg_failed=untried
fi
if test -n "$ARGON2_LIBS"; then
pkg_cv_ARGON2_LIBS="$ARGON2_LIBS"
elif test -n "$PKG_CONFIG"; then
if test -n "$PKG_CONFIG" && \
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libargon2 >= 0\""; } >&5
($PKG_CONFIG --exists --print-errors "libargon2 >= 0") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
pkg_cv_ARGON2_LIBS=`$PKG_CONFIG --libs "libargon2 >= 0" 2>/dev/null`
test "x$?" != "x0" && pkg_failed=yes
else
pkg_failed=yes
fi
else
pkg_failed=untried
fi
if test $pkg_failed = yes; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
_pkg_short_errors_supported=yes
else
_pkg_short_errors_supported=no
fi
if test $_pkg_short_errors_supported = yes; then
ARGON2_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libargon2 >= 0" 2>&1`
else
ARGON2_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libargon2 >= 0" 2>&1`
fi
# Put the nasty error message in config.log where it belongs
echo "$ARGON2_PKG_ERRORS" >&5
as_fn_error $? "Package requirements (libargon2 >= 0) were not met:
$ARGON2_PKG_ERRORS
Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.
Alternatively, you may set the environment variables ARGON2_CFLAGS
and ARGON2_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details." "$LINENO" 5
elif test $pkg_failed = untried; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it
is in your PATH or set the PKG_CONFIG environment variable to the full
path to pkg-config.
Alternatively, you may set the environment variables ARGON2_CFLAGS
and ARGON2_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.
To get pkg-config, see <http://pkg-config.freedesktop.org/>.
See \`config.log' for more details" "$LINENO" 5; }
else
ARGON2_CFLAGS=$pkg_cv_ARGON2_CFLAGS
ARGON2_LIBS=$pkg_cv_ARGON2_LIBS
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
fi
fi
has_system_cares="no"
+7 -4
View File
@@ -838,7 +838,13 @@ dnl use pkgconfig for pcre2:
PKG_CHECK_MODULES([PCRE2], libpcre2-8 >= 10.00)
])
AS_IF([test "x$with_system_argon2" = "xno"],[
dnl Use system argon2 when available, unless --without-system-argon2
has_system_argon2="no"
AS_IF([test "x$with_system_argon2" = "xyes"],[
PKG_CHECK_MODULES([ARGON2], [libargon2],[has_system_argon2=yes
AS_IF([test "x$PRIVATELIBDIR" != "x"], [rm -f "$PRIVATELIBDIR/"libargon2*])],[has_system_argon2=no])])
AS_IF([test "$has_system_argon2" = "no"],[
dnl REMEMBER TO CHANGE WITH A NEW ARGON2 RELEASE!
argon2_version="20181209"
AC_MSG_RESULT(extracting Argon2 library)
@@ -868,9 +874,6 @@ AC_SUBST(ARGON2_CFLAGS)
ARGON2_LIBS="-L$PRIVATELIBDIR -largon2 -lrt -ldl"
AC_SUBST(ARGON2_LIBS)
cd $cur_dir
],[
dnl use pkgconfig for argon2:
PKG_CHECK_MODULES([ARGON2], libargon2 >= 0)
])
dnl Use system c-ares when available, unless --without-system-cares.