aboutsummaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorNils Gillmann <ng0@n0.is>2018-10-21 17:48:50 +0000
committerChristian Grothoff <christian@grothoff.org>2018-10-25 12:01:28 +0200
commit0a97ba60f4f09558b0c2a4b8d2c09e6ff7bfd112 (patch)
treece9503de2771a0a41016c870014ff2ac108e8e7b /configure.ac
parent70b9b7a3845340c2ea67c115fd81215dee59e870 (diff)
downloadgnunet-0a97ba60f4f09558b0c2a4b8d2c09e6ff7bfd112.tar.gz
gnunet-0a97ba60f4f09558b0c2a4b8d2c09e6ff7bfd112.zip
libidn + libidn2 support, as proposed by WJ Liu / multiSnow in a github gist.
Signed-off-by: Nils Gillmann <ng0@n0.is>
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac139
1 files changed, 121 insertions, 18 deletions
diff --git a/configure.ac b/configure.ac
index e9e540419..e36d0b2d3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -827,28 +827,131 @@ fi
827# restore LIBS 827# restore LIBS
828LIBS=$SAVE_LIBS 828LIBS=$SAVE_LIBS
829 829
830# libidn and libidn2. The ideal goal is this:
831# check for libidn2, if it doesn't exist check for libidn
832# if both exist, prefer libidn2
833# if none exist, fail and message that libidn or libidn2
834# is required with a preference for libidn2.
835# TODO: What we have right here can probably be improved.
836my_with_libidn=1
837AC_ARG_WITH(libidn,
838 AS_HELP_STRING([--with-libidn=pathname],
839 [Support IDN (needs libidn)]),
840 [],
841 [withval="yes"])
842if test x_$withval = x_yes; then
843 for dir in /usr/local /opt/local /usr/pkg /usr/sfw; do
844 if test -f "$dir/include/idna.h"; then
845 CFLAGS="$CFLAGS -I$dir/include"
846 LDFLAGS="$LDFLAGS -L$dir/lib"
847 AC_MSG_NOTICE([Found libidn in $dir])
848 break
849 fi
850 if test -f "$dir/include/idn/idna.h"; then
851 CFLAGS="$CFLAGS -I$dir/include/idn"
852 LDFLAGS="$LDFLAGS -L$dir/lib"
853 AC_MSG_NOTICE([Found libidn in $dir])
854 break
855 fi
856 done
857 if test -f "/usr/include/idn/idna.h"; then
858 CFLAGS="$CFLAGS -I/usr/include/idn"
859 #LDFLAGS="$LDFLAGS -L/usr/lib"
860 AC_MSG_NOTICE([Found libidn in /usr])
861 fi
862else
863 if test x_$withval != x_no; then
864 CFLAGS="$CFLAGS -I$withval/include"
865 LDFLAGS="$LDFLAGS -L$withval/lib"
866 else
867 my_with_libidn=0
868 fi
869fi
830 870
831# libidn 871my_with_libidn2=1
832AC_MSG_CHECKING([if Libidn can be used]) 872AC_ARG_WITH(libidn2,
833AC_ARG_WITH(libidn, AC_HELP_STRING([--with-libidn=[DIR]], 873 AS_HELP_STRING([--with-libidn2=pathname],
834 [Support IDN (needs GNU Libidn)]), 874 [Support IDN (needs libidn2)]),
835libidn=$withval, libidn=yes) 875 [],
836if test "$libidn" != "no"; then 876 [withval="yes"])
837 if test "$libidn" != "yes"; then 877if test x_$withval = x_yes; then
838 LDFLAGS="${LDFLAGS} -L$libidn/lib" 878 for dir in /usr/local /opt/local /usr/pkg /usr/sfw; do
839 CPPFLAGS="${CPPFLAGS} -I$libidn/include" 879 if test -f "$dir/include/idn2.h"; then
840 fi 880 CFLAGS="$CFLAGS -I$dir/include"
881 LDFLAGS="$LDFLAGS -L$dir/lib"
882 AC_MSG_NOTICE([Found libidn2 in $dir])
883 break
884 fi
885 if test -f "$dir/include/idn2/idn2.h"; then
886 CFLAGS="$CFLAGS -I$dir/include/idn2"
887 LDFLAGS="$LDFLAGS -L$dir/lib"
888 AC_MSG_NOTICE([Found libidn2 in $dir])
889 break
890 fi
891 done
892 if test -f "/usr/include/idn2/idn2.h"; then
893 CFLAGS="$CFLAGS -I/usr/include/idn2"
894 #LDFLAGS="$LDFLAGS -L/usr/lib"
895 AC_MSG_NOTICE([Found libidn2 in /usr])
896 fi
897else
898 if test x_$withval != x_no; then
899 CFLAGS="$CFLAGS -I$withval/include"
900 LDFLAGS="$LDFLAGS -L$withval/lib"
901 else
902 my_with_libidn2=0
903 fi
841fi 904fi
842libidn=no 905
843AC_CHECK_HEADER(idna.h, 906AC_MSG_CHECKING([if libidn can be used])
844 AC_CHECK_LIB(idn, stringprep_check_version, 907# Check for LIBIDNs
845 [libidn=yes LIBS="${LIBS} -lidn"], []), []) 908there_can_only_be_one=1
846if test "$libidn" != "yes"; then 909
847 AC_MSG_FAILURE([GNUnet requires libidn. 910working_libidn2=0
848libidn-1.13 should be sufficient, newer versions work too.]) 911if test $my_with_libidn2 = 1
912then
913 AC_MSG_NOTICE([Checking for libidn2])
914 AC_CHECK_LIB([idn2],
915 [idn2_to_unicode_8z8z],
916 [working_libidn2=1
917 LIBS="-lidn2 $LIBS"
918 AC_DEFINE_UNQUOTED([HAVE_LIBIDN2],
919 [1],
920 [Define to 1 if you have 'libidn2' (-lidn).])],
921 [MISSING_DEPS="${MISSING_DEPS}${MISSING_SEP}libidn2"
922 MISSING_SEP=", "])
923fi
924if test $working_libidn2 = 0
925then
926 if test $my_with_libidn = 1
927 then
928 AC_MSG_NOTICE([Checking for libidn])
929 AC_CHECK_LIB([idn],
930 [idna_to_ascii_8z],
931 [LIBS="-lidn $LIBS"
932 AC_DEFINE_UNQUOTED([HAVE_LIBIDN],
933 [1],
934 [Define to 1 if you have 'libidn' (-lidn).])],
935 [there_can_only_be_one=0])
936 else
937 if test $my_with_libidn2 = 1
938 then
939 there_can_only_be_one=0
940 AC_MSG_FAILURE([* There can only be one libidn.
941 * Provide either libidn >= 1.13
942 * or
943 * libidn2 to the configure
944 * script via
945 * --with-libidn2
946 * --with-libidn])
947 fi
948 fi
849fi 949fi
850AC_MSG_RESULT($libidn)
851 950
951if test $there_can_only_be_one = 0
952then
953 AC_MSG_FAILURE([Missing dependencies: $MISSING_DEPS])
954fi
852 955
853# test for zlib 956# test for zlib
854SAVE_LDFLAGS=$LDFLAGS 957SAVE_LDFLAGS=$LDFLAGS