1
0
Fork 0

- removed dependency from libidn2

punycode encoding  comes from  an internal implementation  istead of
  using an C library.
This commit is contained in:
cage 2021-01-31 13:08:34 +01:00
parent 52393e2a5e
commit 0fc46fa1b5
13 changed files with 183 additions and 676 deletions

View File

@ -1,4 +1,4 @@
# Makefile.in generated by automake 1.16.2 from Makefile.am.
# Makefile.in generated by automake 1.16.3 from Makefile.am.
# @configure_input@
# Copyright (C) 1994-2020 Free Software Foundation, Inc.
@ -256,6 +256,8 @@ am__relativize = \
DIST_ARCHIVES = $(distdir).tar.gz
GZIP_ENV = --best
DIST_TARGETS = dist-gzip
# Exists only to be overridden by the user if desired.
AM_DISTCHECK_DVI_TARGET = dvi
distuninstallcheck_listfiles = find . -type f -print
am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \
| sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$'
@ -288,8 +290,6 @@ GMSGFMT = @GMSGFMT@
GMSGFMT_015 = @GMSGFMT_015@
GPG = @GPG@
GREP = @GREP@
IDN_CFLAGS = @IDN_CFLAGS@
IDN_LIBS = @IDN_LIBS@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
@ -321,9 +321,6 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PKG_CONFIG = @PKG_CONFIG@
PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
POSUB = @POSUB@
SED = @SED@
SET_MAKE = @SET_MAKE@
@ -845,7 +842,7 @@ distcheck: dist
$(DISTCHECK_CONFIGURE_FLAGS) \
--srcdir=../.. --prefix="$$dc_install_base" \
&& $(MAKE) $(AM_MAKEFLAGS) \
&& $(MAKE) $(AM_MAKEFLAGS) dvi \
&& $(MAKE) $(AM_MAKEFLAGS) $(AM_DISTCHECK_DVI_TARGET) \
&& $(MAKE) $(AM_MAKEFLAGS) check \
&& $(MAKE) $(AM_MAKEFLAGS) install \
&& $(MAKE) $(AM_MAKEFLAGS) installcheck \
@ -907,7 +904,8 @@ installdirs-am:
done
install: $(BUILT_SOURCES)
$(MAKE) $(AM_MAKEFLAGS) install-recursive
install-exec: install-exec-recursive
install-exec: $(BUILT_SOURCES)
$(MAKE) $(AM_MAKEFLAGS) install-exec-recursive
install-data: install-data-recursive
uninstall: uninstall-recursive
@ -1013,7 +1011,7 @@ uninstall-am: uninstall-binSCRIPTS uninstall-dist_confDATA \
uninstall-man: uninstall-man1
.MAKE: $(am__recursive_targets) all check install install-am \
install-strip
install-exec install-strip
.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am \
am--refresh check check-am clean clean-cscope clean-generic \

View File

@ -37,8 +37,7 @@
** Programs
+ to build the package:
xgettext;
a C compiler.
xgettext.
+ to install the package, including running the script to install
lisp libraries (~quick_quicklisp.sh~):
@ -86,14 +85,13 @@ manager of your distribution (~apt~, ~yum~ etc).
** Foreign (C language) library
- libssl (TLS socket)
- linidn2 (i18n domain name aka idna)
The C library should be installed with their header (~*.h~)
files. On Debian or derived system this means installing the
library package with the ~-dev~ suffix as shown below:
#+BEGIN_SRC sh
# apt-get install libssl-dev libidn2-dev
# apt-get install libssl-dev
#+END_SRC

View File

@ -76,7 +76,7 @@ Table of Contents
3.1 Programs
────────────
to build the package: xgettext; a C compiler.
to build the package: xgettext.
to install the package, including running the script to install lisp
libraries (`quick_quicklisp.sh'):
@ -128,14 +128,13 @@ Table of Contents
────────────────────────────────
• libssl (TLS socket)
• linidn2 (i18n domain name aka idna)
The C library should be installed with their header (`*.h') files.
On Debian or derived system this means installing the library
package with the `-dev' suffix as shown below:
┌────
│ # apt-get install libssl-dev libidn2-dev
│ # apt-get install libssl-dev
└────

289
aclocal.m4 vendored
View File

@ -1,4 +1,4 @@
# generated automatically by aclocal 1.16.2 -*- Autoconf -*-
# generated automatically by aclocal 1.16.3 -*- Autoconf -*-
# Copyright (C) 1996-2020 Free Software Foundation, Inc.
@ -86,282 +86,6 @@ AC_DEFUN([gt_INTL_MACOSX],
AC_SUBST([INTL_MACOSX_LIBS])
])
# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*-
# serial 12 (pkg-config-0.29.2)
dnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
dnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
dnl
dnl This program is free software; you can redistribute it and/or modify
dnl it under the terms of the GNU General Public License as published by
dnl the Free Software Foundation; either version 2 of the License, or
dnl (at your option) any later version.
dnl
dnl This program is distributed in the hope that it will be useful, but
dnl WITHOUT ANY WARRANTY; without even the implied warranty of
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
dnl General Public License for more details.
dnl
dnl You should have received a copy of the GNU General Public License
dnl along with this program; if not, write to the Free Software
dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
dnl 02111-1307, USA.
dnl
dnl As a special exception to the GNU General Public License, if you
dnl distribute this file as part of a program that contains a
dnl configuration script generated by Autoconf, you may include it under
dnl the same distribution terms that you use for the rest of that
dnl program.
dnl PKG_PREREQ(MIN-VERSION)
dnl -----------------------
dnl Since: 0.29
dnl
dnl Verify that the version of the pkg-config macros are at least
dnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's
dnl installed version of pkg-config, this checks the developer's version
dnl of pkg.m4 when generating configure.
dnl
dnl To ensure that this macro is defined, also add:
dnl m4_ifndef([PKG_PREREQ],
dnl [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])])
dnl
dnl See the "Since" comment for each macro you use to see what version
dnl of the macros you require.
m4_defun([PKG_PREREQ],
[m4_define([PKG_MACROS_VERSION], [0.29.2])
m4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
[m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
])dnl PKG_PREREQ
dnl PKG_PROG_PKG_CONFIG([MIN-VERSION])
dnl ----------------------------------
dnl Since: 0.16
dnl
dnl Search for the pkg-config tool and set the PKG_CONFIG variable to
dnl first found in the path. Checks that the version of pkg-config found
dnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is
dnl used since that's the first version where most current features of
dnl pkg-config existed.
AC_DEFUN([PKG_PROG_PKG_CONFIG],
[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
m4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
fi
if test -n "$PKG_CONFIG"; then
_pkg_min_version=m4_default([$1], [0.9.0])
AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
PKG_CONFIG=""
fi
fi[]dnl
])dnl PKG_PROG_PKG_CONFIG
dnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
dnl -------------------------------------------------------------------
dnl Since: 0.18
dnl
dnl Check to see whether a particular set of modules exists. Similar to
dnl PKG_CHECK_MODULES(), but does not set variables or print errors.
dnl
dnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
dnl only at the first occurence in configure.ac, so if the first place
dnl it's called might be skipped (such as if it is within an "if", you
dnl have to call PKG_CHECK_EXISTS manually
AC_DEFUN([PKG_CHECK_EXISTS],
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
if test -n "$PKG_CONFIG" && \
AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
m4_default([$2], [:])
m4_ifvaln([$3], [else
$3])dnl
fi])
dnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
dnl ---------------------------------------------
dnl Internal wrapper calling pkg-config via PKG_CONFIG and setting
dnl pkg_failed based on the result.
m4_define([_PKG_CONFIG],
[if test -n "$$1"; then
pkg_cv_[]$1="$$1"
elif test -n "$PKG_CONFIG"; then
PKG_CHECK_EXISTS([$3],
[pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
test "x$?" != "x0" && pkg_failed=yes ],
[pkg_failed=yes])
else
pkg_failed=untried
fi[]dnl
])dnl _PKG_CONFIG
dnl _PKG_SHORT_ERRORS_SUPPORTED
dnl ---------------------------
dnl Internal check to see if pkg-config supports short errors.
AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
_pkg_short_errors_supported=yes
else
_pkg_short_errors_supported=no
fi[]dnl
])dnl _PKG_SHORT_ERRORS_SUPPORTED
dnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
dnl [ACTION-IF-NOT-FOUND])
dnl --------------------------------------------------------------
dnl Since: 0.4.0
dnl
dnl Note that if there is a possibility the first call to
dnl PKG_CHECK_MODULES might not happen, you should be sure to include an
dnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
AC_DEFUN([PKG_CHECK_MODULES],
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
pkg_failed=no
AC_MSG_CHECKING([for $2])
_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
_PKG_CONFIG([$1][_LIBS], [libs], [$2])
m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
and $1[]_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.])
if test $pkg_failed = yes; then
AC_MSG_RESULT([no])
_PKG_SHORT_ERRORS_SUPPORTED
if test $_pkg_short_errors_supported = yes; then
$1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
else
$1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
fi
# Put the nasty error message in config.log where it belongs
echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
m4_default([$4], [AC_MSG_ERROR(
[Package requirements ($2) were not met:
$$1_PKG_ERRORS
Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.
_PKG_TEXT])[]dnl
])
elif test $pkg_failed = untried; then
AC_MSG_RESULT([no])
m4_default([$4], [AC_MSG_FAILURE(
[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.
_PKG_TEXT
To get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
])
else
$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
AC_MSG_RESULT([yes])
$3
fi[]dnl
])dnl PKG_CHECK_MODULES
dnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
dnl [ACTION-IF-NOT-FOUND])
dnl ---------------------------------------------------------------------
dnl Since: 0.29
dnl
dnl Checks for existence of MODULES and gathers its build flags with
dnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags
dnl and VARIABLE-PREFIX_LIBS from --libs.
dnl
dnl Note that if there is a possibility the first call to
dnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to
dnl include an explicit call to PKG_PROG_PKG_CONFIG in your
dnl configure.ac.
AC_DEFUN([PKG_CHECK_MODULES_STATIC],
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
_save_PKG_CONFIG=$PKG_CONFIG
PKG_CONFIG="$PKG_CONFIG --static"
PKG_CHECK_MODULES($@)
PKG_CONFIG=$_save_PKG_CONFIG[]dnl
])dnl PKG_CHECK_MODULES_STATIC
dnl PKG_INSTALLDIR([DIRECTORY])
dnl -------------------------
dnl Since: 0.27
dnl
dnl Substitutes the variable pkgconfigdir as the location where a module
dnl should install pkg-config .pc files. By default the directory is
dnl $libdir/pkgconfig, but the default can be changed by passing
dnl DIRECTORY. The user can override through the --with-pkgconfigdir
dnl parameter.
AC_DEFUN([PKG_INSTALLDIR],
[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
m4_pushdef([pkg_description],
[pkg-config installation directory @<:@]pkg_default[@:>@])
AC_ARG_WITH([pkgconfigdir],
[AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
[with_pkgconfigdir=]pkg_default)
AC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
m4_popdef([pkg_default])
m4_popdef([pkg_description])
])dnl PKG_INSTALLDIR
dnl PKG_NOARCH_INSTALLDIR([DIRECTORY])
dnl --------------------------------
dnl Since: 0.27
dnl
dnl Substitutes the variable noarch_pkgconfigdir as the location where a
dnl module should install arch-independent pkg-config .pc files. By
dnl default the directory is $datadir/pkgconfig, but the default can be
dnl changed by passing DIRECTORY. The user can override through the
dnl --with-noarch-pkgconfigdir parameter.
AC_DEFUN([PKG_NOARCH_INSTALLDIR],
[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
m4_pushdef([pkg_description],
[pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
AC_ARG_WITH([noarch-pkgconfigdir],
[AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
[with_noarch_pkgconfigdir=]pkg_default)
AC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
m4_popdef([pkg_default])
m4_popdef([pkg_description])
])dnl PKG_NOARCH_INSTALLDIR
dnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
dnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
dnl -------------------------------------------
dnl Since: 0.28
dnl
dnl Retrieves the value of the pkg-config variable for the given module.
AC_DEFUN([PKG_CHECK_VAR],
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
AC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
_PKG_CONFIG([$1], [variable="][$3]["], [$2])
AS_VAR_COPY([$1], [pkg_cv_][$1])
AS_VAR_IF([$1], [""], [$5], [$4])dnl
])dnl PKG_CHECK_VAR
# Copyright (C) 2002-2020 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
@ -377,7 +101,7 @@ AC_DEFUN([AM_AUTOMAKE_VERSION],
[am__api_version='1.16'
dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
dnl require some minimum version. Point them to the right macro.
m4_if([$1], [1.16.2], [],
m4_if([$1], [1.16.3], [],
[AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
])
@ -393,7 +117,7 @@ m4_define([_AM_AUTOCONF_VERSION], [])
# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
[AM_AUTOMAKE_VERSION([1.16.2])dnl
[AM_AUTOMAKE_VERSION([1.16.3])dnl
m4_ifndef([AC_AUTOCONF_VERSION],
[m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
@ -1045,12 +769,7 @@ AC_DEFUN([AM_MISSING_HAS_RUN],
[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
AC_REQUIRE_AUX_FILE([missing])dnl
if test x"${MISSING+set}" != xset; then
case $am_aux_dir in
*\ * | *\ *)
MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
*)
MISSING="\${SHELL} $am_aux_dir/missing" ;;
esac
MISSING="\${SHELL} '$am_aux_dir/missing'"
fi
# Use eval to expand $SHELL
if eval "$MISSING --is-lightweight"; then

238
configure vendored
View File

@ -597,11 +597,6 @@ BASH
GPG
CURL
LISP_COMPILER
IDN_LIBS
IDN_CFLAGS
PKG_CONFIG_LIBDIR
PKG_CONFIG_PATH
PKG_CONFIG
POSUB
LTLIBINTL
LIBINTL
@ -734,12 +729,7 @@ CFLAGS
LDFLAGS
LIBS
CPPFLAGS
CPP
PKG_CONFIG
PKG_CONFIG_PATH
PKG_CONFIG_LIBDIR
IDN_CFLAGS
IDN_LIBS'
CPP'
# Initialize some variables set by options.
@ -1398,13 +1388,6 @@ Some influential environment variables:
CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if
you have headers in a nonstandard directory <include dir>
CPP C preprocessor
PKG_CONFIG path to pkg-config utility
PKG_CONFIG_PATH
directories to add to pkg-config's search path
PKG_CONFIG_LIBDIR
path overriding pkg-config's built-in search path
IDN_CFLAGS C compiler flags for IDN, overriding pkg-config
IDN_LIBS linker flags for IDN, overriding pkg-config
Use these variables to override the choices made by `configure' or to help
it to find libraries and programs with nonstandard names/locations.
@ -2207,12 +2190,7 @@ program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"`
am_aux_dir=`cd "$ac_aux_dir" && pwd`
if test x"${MISSING+set}" != xset; then
case $am_aux_dir in
*\ * | *\ *)
MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
*)
MISSING="\${SHELL} $am_aux_dir/missing" ;;
esac
MISSING="\${SHELL} '$am_aux_dir/missing'"
fi
# Use eval to expand $SHELL
if eval "$MISSING --is-lightweight"; then
@ -6148,218 +6126,6 @@ $as_echo "#define HAVE_DCGETTEXT 1" >>confdefs.h
if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args.
set dummy ${ac_tool_prefix}pkg-config; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_path_PKG_CONFIG+:} false; then :
$as_echo_n "(cached) " >&6
else
case $PKG_CONFIG in
[\\/]* | ?:[\\/]*)
ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path.
;;
*)
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
;;
esac
fi
PKG_CONFIG=$ac_cv_path_PKG_CONFIG
if test -n "$PKG_CONFIG"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5
$as_echo "$PKG_CONFIG" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
fi
if test -z "$ac_cv_path_PKG_CONFIG"; then
ac_pt_PKG_CONFIG=$PKG_CONFIG
# Extract the first word of "pkg-config", so it can be a program name with args.
set dummy pkg-config; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_path_ac_pt_PKG_CONFIG+:} false; then :
$as_echo_n "(cached) " >&6
else
case $ac_pt_PKG_CONFIG in
[\\/]* | ?:[\\/]*)
ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path.
;;
*)
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
;;
esac
fi
ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG
if test -n "$ac_pt_PKG_CONFIG"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5
$as_echo "$ac_pt_PKG_CONFIG" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
if test "x$ac_pt_PKG_CONFIG" = x; then
PKG_CONFIG=""
else
case $cross_compiling:$ac_tool_warned in
yes:)
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
ac_tool_warned=yes ;;
esac
PKG_CONFIG=$ac_pt_PKG_CONFIG
fi
else
PKG_CONFIG="$ac_cv_path_PKG_CONFIG"
fi
fi
if test -n "$PKG_CONFIG"; then
_pkg_min_version=0.9.0
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5
$as_echo_n "checking pkg-config is at least version $_pkg_min_version... " >&6; }
if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
PKG_CONFIG=""
fi
fi
pkg_failed=no
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for libidn2" >&5
$as_echo_n "checking for libidn2... " >&6; }
if test -n "$IDN_CFLAGS"; then
pkg_cv_IDN_CFLAGS="$IDN_CFLAGS"
elif test -n "$PKG_CONFIG"; then
if test -n "$PKG_CONFIG" && \
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libidn2\""; } >&5
($PKG_CONFIG --exists --print-errors "libidn2") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
pkg_cv_IDN_CFLAGS=`$PKG_CONFIG --cflags "libidn2" 2>/dev/null`
test "x$?" != "x0" && pkg_failed=yes
else
pkg_failed=yes
fi
else
pkg_failed=untried
fi
if test -n "$IDN_LIBS"; then
pkg_cv_IDN_LIBS="$IDN_LIBS"
elif test -n "$PKG_CONFIG"; then
if test -n "$PKG_CONFIG" && \
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libidn2\""; } >&5
($PKG_CONFIG --exists --print-errors "libidn2") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
pkg_cv_IDN_LIBS=`$PKG_CONFIG --libs "libidn2" 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
IDN_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libidn2" 2>&1`
else
IDN_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libidn2" 2>&1`
fi
# Put the nasty error message in config.log where it belongs
echo "$IDN_PKG_ERRORS" >&5
as_fn_error $? "Package requirements (libidn2) were not met:
$IDN_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 IDN_CFLAGS
and IDN_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 IDN_CFLAGS
and IDN_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
IDN_CFLAGS=$pkg_cv_IDN_CFLAGS
IDN_LIBS=$pkg_cv_IDN_LIBS
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for SSL_get_version in -lssl" >&5
$as_echo_n "checking for SSL_get_version in -lssl... " >&6; }
if ${ac_cv_lib_ssl_SSL_get_version+:} false; then :

View File

@ -21,8 +21,6 @@ AM_INIT_AUTOMAKE([-Wall foreign])
AM_GNU_GETTEXT([external])
PKG_CHECK_MODULES([IDN], [libidn2])
AC_CHECK_LIB([ssl], [SSL_get_version], [], AC_MSG_ERROR([Can not find libssl.]))
AC_PATH_PROG([LISP_COMPILER],[sbcl],[no])

View File

@ -306,14 +306,14 @@
(fragment nil)
(client-certificate nil)
(certificate-key nil))
(let* ((iri (make-gemini-iri host
(let* ((iri (make-gemini-iri (idn:host-unicode->ascii host)
(percent-encode-path path)
:query (percent-encode-query query)
:port port
:fragment (percent-encode-fragment fragment)))
(ctx (cl+ssl:make-context :verify-mode cl+ssl:+ssl-verify-none+)))
(cl+ssl:with-global-context (ctx :auto-free-p t)
(let ((socket (usocket:socket-connect (idn:unicode->ascii host)
(let ((socket (usocket:socket-connect (idn:host-unicode->ascii host)
port
:element-type '(unsigned-byte 8))))
(unwind-protect

View File

@ -1,52 +0,0 @@
(in-package :idn)
(pkg-config-cflags "libidn2")
(include "idn2.h")
(cenum (idn2-rc)
((:ok "IDN2_OK"))
((:malloc "IDN2_MALLOC"))
((:no-codeset "IDN2_NO_CODESET"))
((:iconv-fail "IDN2_ICONV_FAIL"))
((:encoding-error "IDN2_ENCODING_ERROR"))
((:nfc "IDN2_NFC"))
((:punycode-bad-input "IDN2_PUNYCODE_BAD_INPUT"))
((:punycode-big-output "IDN2_PUNYCODE_BIG_OUTPUT"))
((:punycode-overflow "IDN2_PUNYCODE_OVERFLOW"))
((:too-big-domain "IDN2_TOO_BIG_DOMAIN"))
((:too-big-label "IDN2_TOO_BIG_LABEL"))
((:invalid-alabel "IDN2_INVALID_ALABEL"))
((:ualabel-mismatch "IDN2_UALABEL_MISMATCH"))
((:invalid-flags "IDN2_INVALID_FLAGS"))
((:not-nfc "IDN2_NOT_NFC"))
((:2hyphen "IDN2_2HYPHEN"))
((:hyphen-startend "IDN2_HYPHEN_STARTEND"))
((:leading-combining "IDN2_LEADING_COMBINING"))
((:disallowed "IDN2_DISALLOWED"))
((:contextj "IDN2_CONTEXTJ"))
((:contextj-no-rule "IDN2_CONTEXTJ_NO_RULE"))
((:contexto "IDN2_CONTEXTO"))
((:contexto-no-rule "IDN2_CONTEXTO_NO_RULE"))
((:unassigned "IDN2_UNASSIGNED"))
((:bidi "IDN2_BIDI"))
((:dot-in-label "IDN2_DOT_IN_LABEL"))
((:invalid-transitional "IDN2_INVALID_TRANSITIONAL"))
((:invalid-nontransitional "IDN2_INVALID_NONTRANSITIONAL")))
;;; this value does not exists for old version of the library, removing
;;; to allow compilation on old system
;; ((:alabel-roundtrip-failed "IDN2_ALABEL_ROUNDTRIP_FAILED")))
(cenum (flags)
((:nfc-input "IDN2_NFC_INPUT"))
((:alabel-roundtrip "IDN2_ALABEL_ROUNDTRIP"))
((:transitional "IDN2_TRANSITIONAL"))
((:nontransitional "IDN2_NONTRANSITIONAL"))
((:allow-unassigned "IDN2_ALLOW_UNASSIGNED"))
((:use-std3-ascii-rules "IDN2_USE_STD3_ASCII_RULES"))
((:no-tr46 "IDN2_NO_TR46")))
;;; this value does not exists for old version of the library, removing
;;; to allow compilation on old system
;; ((:no-alabel-roundtrip "IDN2_NO_ALABEL_ROUNDTRIP")))

View File

@ -1,89 +1,124 @@
(in-package :idn)
(cffi:define-foreign-library libidn2
(:unix (:or "libidn2.so.0" "libidn2.so"))
(t (:default "libmagic")))
(defgeneric basic-code-point-p (object))
(cffi:use-foreign-library libidn2)
(defmethod basic-code-point-p ((object character))
(basic-code-point-p (char-code object)))
;; int idn2_to_ascii_8z (const char * input, char ** output, int flags)
(defmethod basic-code-point-p ((object integer))
(<= 0 object #x7f))
(cffi:defcfun (idn2-to-ascii-8z "idn2_to_ascii_8z")
:int
(input :pointer)
(output :pointer)
(flags :int))
(defun digit->code-point (digit)
(code-char (cond
((<= 0 digit 25)
(+ 97 digit))
((<= 26 digit 35)
(+ (- digit 26) 48))
(t
(error "digit overflow")))))
;; int idn2_to_unicode_8z8z (const char *input, char **output, int flags)
(defun div (a b)
(floor (/ a b)))
(cffi:defcfun (idn2-to-unicode-8z8z "idn2_to_unicode_8z8z")
:int
(input :pointer)
(output :pointer)
(flags :int)) ; unused
(define-constant +base+ 36 :test #'=)
(define-condition punycode-conversion-error (error)
((host
:initarg :host
:reader host)
(error-code
:initarg :error-code
:reader error-code))
(:report (lambda (condition stream)
(format stream
"error converting ~a to ASCII (code: ~a)"
(host condition)
(error-code condition))))
(:documentation "Error conversion unicode -> ASCII"))
(define-constant +t-min+ 1 :test #'=)
(defun ->ascii-default-flags ()
(logior (cffi:foreign-enum-value 'flags :nontransitional)
(cffi:foreign-enum-value 'flags :nfc-input)))
(define-constant +t-max+ 26 :test #'=)
(defun unicode->ascii (host &optional (flags (->ascii-default-flags)))
(labels ((deref (ptr** index)
(cffi:mem-aref (cffi:mem-aref ptr** :pointer)
:char index)))
(cffi:with-foreign-string (input host)
(cffi:with-foreign-object (buf* :unsigned-char)
(cffi:with-foreign-object (buf** :pointer)
(setf (cffi:mem-ref buf** :pointer) buf*)
(let ((results (idn2-to-ascii-8z input buf** flags)))
(unwind-protect
(if (= (cffi:foreign-enum-value 'idn2-rc :ok)
results)
(with-output-to-string (punycode)
(loop for i from 0 while (/= (deref buf** i)
0)
do
(let ((octect (deref buf** i)))
(write-char (code-char octect) punycode))))
(error 'punycode-conversion-error
:host host
:error-code (cffi:foreign-enum-keyword 'idn2-rc results)))
(cffi:foreign-free (cffi:mem-aref buf** :pointer)))))))))
(define-constant +skew+ 38 :test #'=)
(define-constant +damp+ 700 :test #'=)
(defun ascii->unicode (host)
(labels ((deref (ptr** index)
(cffi:mem-aref (cffi:mem-aref ptr** :pointer)
:char index)))
(cffi:with-foreign-string (input host)
(cffi:with-foreign-object (buf* :unsigned-char)
(cffi:with-foreign-object (buf** :pointer)
(setf (cffi:mem-ref buf** :pointer) buf*)
(let ((results (idn2-to-unicode-8z8z input buf** 0)))
(unwind-protect
(if (= (cffi:foreign-enum-value 'idn2-rc :ok)
results)
(let ((octects (misc:make-array-frame 0 0 '(unsigned-byte 8))))
(loop for i from 0 while (/= (deref buf** i)
0)
do
(vector-push-extend (logand (deref buf** i) 255)
octects))
(babel:octets-to-string octects))
(error 'punycode-conversion-error
:host host
:error-code (cffi:foreign-enum-keyword 'idn2-rc results)))
(cffi:foreign-free (cffi:mem-aref buf** :pointer)))))))))
(define-constant +initial-bias+ 72 :test #'=)
(define-constant +delimiter+ #\- :test #'char=)
(define-constant +encoded-string-prefix+ "xn--" :test #'string=)
(define-constant +delta-overflow+ (1- (expt 2 26)) :test #'=)
(define-constant +initial-n+ #x80 :test #'=)
(defun unicode->ascii (unicode-text)
(let* ((n +initial-n+)
(delta 0)
(bias +initial-bias+)
(basic-code-points (remove-if-not #'basic-code-point-p unicode-text))
(h (length basic-code-points))
(b (length basic-code-points))
(output (if (> b 0)
(text-utils:strcat basic-code-points (string +delimiter+))
basic-code-points)))
(labels ((adapt (delta num-points first-time)
(if first-time
(setf delta (div delta +damp+))
(setf delta (div delta 2)))
(incf delta (div delta num-points))
(let ((k 0))
(loop while (> delta
(div (* (- +base+ +t-min+)
+t-max+)
2))
do
(setf delta (div delta (- +base+ +t-min+)))
(incf k +base+))
(+ k
(div (* (+ (- +base+ +t-min+) 1)
delta)
(+ delta +skew+)))))
(maybe-signal-overflow (delta)
(when (> delta +delta-overflow+)
(error "overflow detected"))))
(loop while (< h (length unicode-text)) do
(let ((minimum-code-greater-than-n (num:find-min (remove-if (lambda (a) (< a n))
(map 'list
#'char-code
unicode-text)))))
(setf delta (+ delta (* (- minimum-code-greater-than-n n)
(+ h 1))))
(maybe-signal-overflow delta)
(setf n minimum-code-greater-than-n)
(loop for character across unicode-text do
(let ((code-point (char-code character)))
(cond
((< code-point n)
(incf delta)
(maybe-signal-overflow delta))
((= code-point n)
(let ((q delta))
(loop named inner-loop for k from +base+ by +base+ do
(let ((tx (cond
((<= k bias)
+t-min+)
((>= k (+ bias +t-max+))
+t-max+)
(t
(- k bias)))))
(when (< q tx)
(return-from inner-loop))
(let ((new-char (digit->code-point (+ tx (rem (- q tx)
(- +base+ tx))))))
(setf output (text-utils:strcat output (string new-char))))
(setf q (div (- q tx)
(- +base+ tx)))))
(setf output (text-utils:strcat output (string (digit->code-point q))))
(setf bias (adapt delta (1+ h) (= h b)))
(setf delta 0)
(incf h))))))
(incf delta)
(incf n)))
(cond
((text-utils:string-empty-p output)
output)
((char= (alexandria:last-elt output) +delimiter+)
(misc:all-but-last-elt output))
(t
(text-utils:strcat +encoded-string-prefix+ output))))))
(defun host-unicode->ascii (unicode-host)
(if (find #\. unicode-host :test #'char=)
(let ((splitted (cl-ppcre:split "\\." unicode-host)))
(text-utils:join-with-strings (mapcar #'unicode->ascii splitted)
"."))
(unicode->ascii unicode-host)))

View File

@ -15,10 +15,12 @@
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
(defpackage :idn
(:use :cl)
(:use
:cl
:alexandria)
(:export
:unicode->ascii
:ascii->unicode))
:host-unicode->ascii
:host-ascii->unicode))
(defpackage :config
(:use :cl)

37
src/tests/idn-tests.lisp Normal file
View File

@ -0,0 +1,37 @@
;; tinmop: an humble gemini and pleroma client
;; Copyright (C) 2021 cage
;; This program is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with this program.
;; If not, see [[http://www.gnu.org/licenses/][http://www.gnu.org/licenses/]].
(in-package :idn-tests)
(defsuite idn-suite (all-suite))
(defun test-encode (unicode expected)
(string= (idn::host-unicode->ascii unicode)
expected))
(deftest test-unicode->ascii (idn-suite)
(assert-true (test-encode "إختبار" "xn--kgbechtv"))
(assert-true (test-encode "آزمایشی" "xn--hgbk6aj7f53bba"))
(assert-true (test-encode "测试" "xn--0zwm56d"))
(assert-true (test-encode "測試" "xn--g6w251d"))
(assert-true (test-encode "испытание" "xn--80akhbyknj4f"))
(assert-true (test-encode "परीक्षा" "xn--11b5bs3a9aj6g"))
(assert-true (test-encode "δοκιμή" "xn--jxalpdlp"))
(assert-true (test-encode "테스트" "xn--9t4b11yi5a" ))
(assert-true (test-encode "טעסט" "xn--deba0ad"))
(assert-true (test-encode "テスト" "xn--zckzah"))
(assert-true (test-encode "பரிட்சை" "xn--hlcj6aya9esc7a")))

View File

@ -110,3 +110,11 @@
:text-utils
:all-tests)
(:export))
(defpackage :idn-tests
(:use :cl
:clunit
:misc
:text-utils
:all-tests)
(:export))

View File

@ -21,7 +21,6 @@
:version "0.5.0"
:pathname "src"
:serial t
:defsystem-depends-on ("cffi-grovel")
:depends-on (:alexandria
:cl-ppcre
:tooter
@ -53,7 +52,6 @@
:percent-encoding
:uiop)
:components ((:file "package")
(:cffi-grovel-file "grovel-idn")
(:file "idn")
(:file "config")
(:file "constants")
@ -140,6 +138,7 @@
(:file "thread-window-tests")
(:file "gemini-parser-tests")
(:file "program-events-tests")
(:file "x509-tests")))))
(:file "x509-tests")
(:file "idn-tests")))))
;; (push :debug-mode *features*)