gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] [gnunet] branch master updated (70b9b7a38 -> b64879a11)


From: gnunet
Subject: [GNUnet-SVN] [gnunet] branch master updated (70b9b7a38 -> b64879a11)
Date: Thu, 25 Oct 2018 12:01:30 +0200

This is an automated email from the git hooks/post-receive script.

grothoff pushed a change to branch master
in repository gnunet.

    from 70b9b7a38 clarify license of test scripts
     new 0a97ba60f libidn + libidn2 support, as proposed by WJ Liu / multiSnow 
in a github gist.
     new b64879a11 fix -lidn(2) linkage by adding missing AM_CONDITIONAL and 
missing endif statements

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 README               |   5 +-
 configure.ac         | 143 ++++++++++++++++++++++++++++++++++++++++++++-------
 po/POTFILES.in       |   1 -
 src/util/Makefile.am |  19 ++++++-
 src/util/dnsparser.c |   6 ++-
 5 files changed, 152 insertions(+), 22 deletions(-)

diff --git a/README b/README
index 0498e3def..3a2870279 100644
--- a/README
+++ b/README
@@ -36,7 +36,10 @@ These are the direct dependencies for running GNUnet:
 - libcurl            >= 7.35.0      (alternative to libgnurl)
 - libunistring       >= 0.9.2
 - gnutls             >= 3.2.12      (highly recommended a gnutls linked 
against libunbound)
-- libidn             >= 1.0
+- libidn:
+  - libidn2 (prefered)
+  or
+  - libidn             >= 1.0
 - libextractor       >= 0.6.1       (highly recommended)
 - openssl            >= 1.0         (binary, used to generate X.509 
certificate)
 - libltdl            >= 2.2         (part of GNU libtool)
diff --git a/configure.ac b/configure.ac
index e9e540419..f0ab98390 100644
--- a/configure.ac
+++ b/configure.ac
@@ -827,28 +827,135 @@ fi
 # restore LIBS
 LIBS=$SAVE_LIBS
 
+# libidn and libidn2. The ideal goal is this:
+# check for libidn2, if it doesn't exist check for libidn
+# if both exist, prefer libidn2
+# if none exist, fail and message that libidn or libidn2
+# is required with a preference for libidn2.
+# TODO: What we have right here can probably be improved.
+my_with_libidn=1
+AC_ARG_WITH(libidn,
+            AS_HELP_STRING([--with-libidn=pathname],
+                           [Support IDN (needs libidn)]),
+            [],
+            [withval="yes"])
+if test x_$withval = x_yes; then
+   for dir in /usr/local /opt/local /usr/pkg /usr/sfw; do
+       if test -f "$dir/include/idna.h"; then
+          CFLAGS="$CFLAGS -I$dir/include"
+          LDFLAGS="$LDFLAGS -L$dir/lib"
+          AC_MSG_NOTICE([Found libidn in $dir])
+          break
+       fi
+       if test -f "$dir/include/idn/idna.h"; then
+          CFLAGS="$CFLAGS -I$dir/include/idn"
+          LDFLAGS="$LDFLAGS -L$dir/lib"
+          AC_MSG_NOTICE([Found libidn in $dir])
+          break
+       fi
+   done
+   if test -f "/usr/include/idn/idna.h"; then
+          CFLAGS="$CFLAGS -I/usr/include/idn"
+          #LDFLAGS="$LDFLAGS -L/usr/lib"
+          AC_MSG_NOTICE([Found libidn in /usr])
+   fi
+else
+        if test x_$withval != x_no; then
+           CFLAGS="$CFLAGS -I$withval/include"
+           LDFLAGS="$LDFLAGS -L$withval/lib"
+        else
+           my_with_libidn=0
+        fi
+fi
 
-# libidn
-AC_MSG_CHECKING([if Libidn can be used])
-AC_ARG_WITH(libidn, AC_HELP_STRING([--with-libidn=[DIR]],
-                                    [Support IDN (needs GNU Libidn)]),
-libidn=$withval, libidn=yes)
-if test "$libidn" != "no"; then
-  if test "$libidn" != "yes"; then
-     LDFLAGS="${LDFLAGS} -L$libidn/lib"
-     CPPFLAGS="${CPPFLAGS} -I$libidn/include"
-  fi
+my_with_libidn2=1
+AC_ARG_WITH(libidn2,
+            AS_HELP_STRING([--with-libidn2=pathname],
+                           [Support IDN (needs libidn2)]),
+            [],
+            [withval="yes"])
+if test x_$withval = x_yes; then
+   for dir in /usr/local /opt/local /usr/pkg /usr/sfw; do
+       if test -f "$dir/include/idn2.h"; then
+          CFLAGS="$CFLAGS -I$dir/include"
+          LDFLAGS="$LDFLAGS -L$dir/lib"
+          AC_MSG_NOTICE([Found libidn2 in $dir])
+          break
+       fi
+       if test -f "$dir/include/idn2/idn2.h"; then
+          CFLAGS="$CFLAGS -I$dir/include/idn2"
+          LDFLAGS="$LDFLAGS -L$dir/lib"
+          AC_MSG_NOTICE([Found libidn2 in $dir])
+          break
+       fi
+   done
+   if test -f "/usr/include/idn2/idn2.h"; then
+      CFLAGS="$CFLAGS -I/usr/include/idn2"
+      #LDFLAGS="$LDFLAGS -L/usr/lib"
+      AC_MSG_NOTICE([Found libidn2 in /usr])
+   fi
+else
+        if test x_$withval != x_no; then
+           CFLAGS="$CFLAGS -I$withval/include"
+           LDFLAGS="$LDFLAGS -L$withval/lib"
+        else
+                my_with_libidn2=0
+        fi
 fi
-libidn=no
-AC_CHECK_HEADER(idna.h,
-  AC_CHECK_LIB(idn, stringprep_check_version,
-    [libidn=yes LIBS="${LIBS} -lidn"], []), [])
-if test "$libidn" != "yes"; then
-  AC_MSG_FAILURE([GNUnet requires libidn.
-libidn-1.13 should be sufficient, newer versions work too.])
+
+AC_MSG_CHECKING([if libidn can be used])
+# Check for LIBIDNs
+there_can_only_be_one=1
+
+working_libidn1=0
+working_libidn2=0
+if test $my_with_libidn2 = 1
+then
+        AC_MSG_NOTICE([Checking for libidn2])
+        AC_CHECK_LIB([idn2],
+                     [idn2_to_unicode_8z8z],
+                     [working_libidn2=1
+                     LIBS="-lidn2 $LIBS"
+                    AC_DEFINE_UNQUOTED([HAVE_LIBIDN2],
+                                        [1],
+                                        [Define to 1 if you have 'libidn2' 
(-lidn).])],
+                     [MISSING_DEPS="${MISSING_DEPS}${MISSING_SEP}libidn2"
+                     MISSING_SEP=", "])
+fi
+AM_CONDITIONAL(HAVE_LIBIDN2, test x$working_libidn2 = x1)
+if test $working_libidn2 = 0
+then
+        if test $my_with_libidn = 1
+        then
+                AC_MSG_NOTICE([Checking for libidn])
+                AC_CHECK_LIB([idn],
+                             [idna_to_ascii_8z],
+                             [working_libidn1=1
+                            LIBS="-lidn $LIBS"                      
+                             AC_DEFINE_UNQUOTED([HAVE_LIBIDN],
+                                                [1],
+                                                [Define to 1 if you have 
'libidn' (-lidn).])],
+                             [there_can_only_be_one=0])
+        else
+                if test $my_with_libidn2 = 1
+                then
+                        there_can_only_be_one=0
+                        AC_MSG_FAILURE([* There can only be one libidn.
+                                        * Provide either libidn >= 1.13
+                                        * or
+                                        * libidn2 to the configure
+                                        * script via
+                                        * --with-libidn2
+                                        * --with-libidn])
+                fi
+        fi
 fi
-AC_MSG_RESULT($libidn)
+AM_CONDITIONAL(HAVE_LIBIDN, test x$working_libidn1 = x1)
 
+if test $there_can_only_be_one = 0
+then
+    AC_MSG_FAILURE([Missing dependencies: $MISSING_DEPS])
+fi
 
 # test for zlib
 SAVE_LDFLAGS=$LDFLAGS
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 36cc7cdff..bb785afd9 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -524,7 +524,6 @@ src/fs/fs_api.h
 src/include/gnunet_common.h
 src/include/gnunet_mq_lib.h
 src/include/gnunet_time_lib.h
-src/rps/rps-test_util.h
 src/scalarproduct/scalarproduct.h
 src/testbed/testbed_api.h
 src/testbed/testbed_api_operations.h
diff --git a/src/util/Makefile.am b/src/util/Makefile.am
index b0f45b1da..fc5a4648c 100644
--- a/src/util/Makefile.am
+++ b/src/util/Makefile.am
@@ -122,12 +122,29 @@ libgnunetutil_la_SOURCES = \
   tun.c \
   speedup.c speedup.h
 
+if HAVE_LIBIDN
+  LIBIDN= -lidn
+else
+  LIBIDN=
+endif
+
+if HAVE_LIBIDN2
+  LIBIDN2= -lidn2
+else
+  LIBIDN2=
+endif
+
 libgnunetutil_la_LIBADD = \
   $(GCLIBADD) $(WINLIB) \
   $(LIBGCRYPT_LIBS) \
   $(LTLIBICONV) \
   $(LTLIBINTL) \
-  -lltdl -lidn $(Z_LIBS) -lunistring $(XLIB) $(PTHREAD)
+  -lltdl \
+  $(LIBIDN) $(LIBIDN2) \
+  $(Z_LIBS) \
+  -lunistring \
+  $(XLIB) \
+  $(PTHREAD)
 
 libgnunetutil_la_LDFLAGS = \
   $(GN_LIB_LDFLAGS) \
diff --git a/src/util/dnsparser.c b/src/util/dnsparser.c
index 24f1b18cf..79d723f12 100644
--- a/src/util/dnsparser.c
+++ b/src/util/dnsparser.c
@@ -17,13 +17,17 @@
  */
 
 /**
- * @file dns/dnsparser.c
+ * @file util/dnsparser.c
  * @brief helper library to parse DNS packets.
  * @author Philipp Toelke
  * @author Christian Grothoff
  */
 #include "platform.h"
+#if defined(HAVE_LIBIDN2)
+#include <idn2.h>
+#elif defined(HAVE_LIBIDN)
 #include <idna.h>
+#endif
 #if WINDOWS
 #include <idn-free.h>
 #endif

-- 
To stop receiving notification emails like this one, please contact
address@hidden



reply via email to

[Prev in Thread] Current Thread [Next in Thread]