From 5578b3eb3721af42a97e57b1dceaf1657e4630a6 Mon Sep 17 00:00:00 2001 From: Pekka Riikonen Date: Sun, 27 Mar 2005 16:52:14 +0000 Subject: [PATCH] Added checks for GNU libidn. --- CHANGES | 2 + INSTALL | 8 +++ configure.in.pre | 144 ++++++++++++++++++++++++++++++++++++++++++++++- 3 files changed, 153 insertions(+), 1 deletion(-) diff --git a/CHANGES b/CHANGES index ecfaf672..114813a9 100644 --- a/CHANGES +++ b/CHANGES @@ -13,6 +13,8 @@ Sun Mar 27 19:02:48 EEST 2005 Pekka Riikonen GNU Libidn's stringprep, for now, so it is required now to compile SILC sources. Added lib/silcutil/silcstringprep.[ch]. + * Added checking for GNU Libidn and --with-libidn to configure. + Wed Mar 23 11:20:33 CET 2005 Jochen Eisinger * If the passphrases entered do not match while generating a new key, diff --git a/INSTALL b/INSTALL index 25b5ea04..acfbb37f 100644 --- a/INSTALL +++ b/INSTALL @@ -32,6 +32,14 @@ path in your system which contains lib/ and include/ for GMP library. GMP can be used as a fall-back if you have problems with the MPI library included within this package. +'--with-libidn[=DIR]' + + The SILC requires GNU Libidn for the stringprep() function. If your +system does not have it installed by default you will need to install it +and possibly give this option to specify its location. The DIR is the +upper path in your system which contains lib/ and include/ for libidn +(e.g. /usr/local). + '--with-iconv[=DIR]' If your system doesn't provide iconv() function in its native libraries diff --git a/configure.in.pre b/configure.in.pre index b463546d..f1973afe 100644 --- a/configure.in.pre +++ b/configure.in.pre @@ -704,6 +704,141 @@ if test x$mp_gmp = xfalse; then AC_MSG_RESULT(Using NSS MPI as a MP library.) fi +# GNU Libidn (for stringprep) support +# +check_libidn=true +has_libidn=false +SAVE_LIBS="$LIBS" +SAVE_CFLAGS="$CFLAGS" +SAVE_LDFLAGS="$LDFLAGS" +SAVE_CPPFLAGS="$CPPFLAGS" +AC_MSG_CHECKING(whether to implicit search for libidn) +AC_ARG_WITH(libidn, + [[ --with-libidn[=DIR] use libidn [search in DIR/include and DIR/lib]]], + [ + case "${withval}" in + no) + AC_MSG_RESULT(no) + AC_CHECK_HEADERS(stringprep.h, + [ + AC_CHECK_FUNC(stringprep, has_libidn=true) + ]) + check_libidn=false + ;; + *) + AC_MSG_RESULT(yes) + if test -d $withval/include; then + CPPFLAGS="$CPPFLAGS -I$withval/include" + CFLAGS="$CFLAGS -I$withval/include" + fi + if test -d $withval/lib; then + LDFLAGS="$LDFLAGS -L$withval/lib" + fi + ;; + esac + ], + [ + AC_MSG_RESULT(no) + AC_CHECK_HEADERS(stringprep.h, + [ + AC_CHECK_FUNCS(stringprep, + [ + has_libidn=true + check_libidn=false + ]) + ]) + ]) + +if test x$check_libidn = xtrue; then + AC_MSG_RESULT(Searching for libidn...) + + AC_CHECK_HEADERS(stringprep.h, + [ + LIBS="$LIBS -lidn" + AC_MSG_CHECKING(for stringprep in -lidn) + AC_TRY_LINK( + [ + #include + #include + ], + [ + (void)stringprep_locale_charset(); + ], + [ + echo "yes" + AC_DEFINE(HAVE_LIBIDN, 1, [Define if you have the stringprep() function.]) + has_libidn=true + check_libidn=false + ], + [ + echo "no" + LIBS="$SAVE_LIBS" + CFLAGS="$SAVE_CFLAGS" + LDFLAGS="$SAVE_LDFLAGS" + CPPFLAGS="$SAVE_CPPFLAGS" + ]) + ]) +fi + +if test x$check_libidn = xtrue; then + # search for idn library.. + SAVE_LIBS="$LIBS" + SAVE_CFLAGS="$CFLAGS" + SAVE_LDFLAGS="$LDFLAGS" + SAVE_CPPFLAGS="$CPPFLAGS" + + for dir in `echo "/usr/local /usr/pkg /usr/contrib"`; do + if test x$has_libidn = xfalse; then + AC_MSG_RESULT(searching in $dir...) + + if test -d $dir/include; then + CPPFLAGS="$CPPFLAGS -I$dir/include" + CFLAGS="$CFLAGS -I$dir/include" + fi + if test -d $dir/lib; then + LDFLAGS="$LDFLAGS -L$dir/lib" + fi + + # XXX + unset ac_cv_header__stringprep_h_ ac_cv_header_stringprep_h || true + + AC_CHECK_HEADERS(stringprep.h, + [ + LIBS="$LIBS -lidn" + AC_MSG_CHECKING(for stringprep in -lidn) + AC_TRY_LINK( + [ + #include + #include + ], + [ + (void)stringprep_locale_charset(); + ], + [ + echo "yes" + has_libidn=true + AC_DEFINE(HAVE_LIBIDN, 1, [Define if you have the stringprep() function.]) + ], + [ + echo "no" + has_libidn=false + + LIBS="$SAVE_LIBS" + CFLAGS="$SAVE_CFLAGS" + LDFLAGS="$SAVE_LDFLAGS" + CPPFLAGS="$SAVE_CPPFLAGS" + ]) + ], + [ + CFLAGS="$SAVE_CFLAGS" + LDFLAGS="$SAVE_LDFLAGS" + CPPFLAGS="$SAVE_CPPFLAGS" + ]) + fi + done +fi + + # iconv support # check_iconv=true @@ -750,7 +885,7 @@ AC_ARG_WITH(iconv, ]) if test x$check_iconv = xtrue; then - AC_MSG_RESULT(starting search...) + AC_MSG_RESULT(Searching for iconv...) # XXX unset ac_cv_header__iconv_h_ ac_cv_header_iconv_h || true @@ -884,6 +1019,7 @@ if test x$has_iconv = xtrue; then fi fi + # POSIX threads support # has_threads=false @@ -1252,9 +1388,15 @@ if test x$has_iconv = xfalse; then else iconv_support="yes" fi +if test x$has_libidn = xfalse; then + libidn_support="no" +else + libidn_support="yes" +fi echo " SIM support ...................: $sim_support" echo " IPv6 support ..................: $summary_ipv6" echo " Iconv support .................: $iconv_support" +echo " Idn support ...................: $libidn_support" if test x$want_asm = xfalse; then summary_asm="no" else -- 2.24.0