]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
configure: detect AppleIDN
authorDaniel Stenberg <daniel@haxx.se>
Mon, 5 Aug 2024 18:29:48 +0000 (20:29 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Tue, 6 Aug 2024 07:36:07 +0000 (09:36 +0200)
Follow-up to add22feeef07858307

Closes #14401

configure.ac

index a991a0d285f76585961527c011c82978ec8b4bd6..b28cce0da3d4d9981d86c8904b40ac3664a4d6b2 100644 (file)
@@ -2620,7 +2620,7 @@ if test "$want_winidn" = "yes"; then
 fi
 
 dnl **********************************************************************
-dnl Check for the presence of IDN libraries and headers
+dnl Check for the presence of libidn2
 dnl **********************************************************************
 
 AC_MSG_CHECKING([whether to build with libidn2])
@@ -2742,13 +2742,48 @@ if test "$want_idn" = "yes"; then
     fi
     LIBCURL_PC_REQUIRES_PRIVATE="libidn2 $LIBCURL_PC_REQUIRES_PRIVATE"
   else
-    AC_MSG_WARN([Cannot find libraries for IDN support: IDN disabled])
+    AC_MSG_WARN([Cannot find libidn2])
     CPPFLAGS="$clean_CPPFLAGS"
     LDFLAGS="$clean_LDFLAGS"
     LIBS="$clean_LIBS"
+    want_idn="no"
   fi
 fi
 
+dnl **********************************************************************
+dnl Check for the presence of AppleIDN
+dnl **********************************************************************
+
+AC_MSG_CHECKING([whether to build with Apple IDN])
+OPT_IDN="default"
+AC_ARG_WITH(apple-idn,
+AS_HELP_STRING([--with-apple-idn],[Enable AppleIDN])
+AS_HELP_STRING([--without-apple-idn],[Disable AppleIDN]),
+  [OPT_IDN=$withval])
+if test "x$tst_links_winidn" = "xyes" -o "x$want_idn" != "xno"; then
+  want_appleidn="no"
+else
+  case "$OPT_IDN" in
+    no)
+      dnl --without-apple-idn option used
+      AC_MSG_RESULT([no])
+      ;;
+    *)
+      AC_MSG_RESULT([yes, check])
+      AC_CHECK_LIB(icucore, uidna_nameToASCII_UTF8,
+      [
+        AC_CHECK_HEADERS(unicode/uidna.h,
+           curl_idn_msg="enabled (AppleIDN)"
+           AC_DEFINE(USE_APPLE_IDN, 1, [if AppleIDN])
+           AC_SUBST(USE_APPLE_IDN, [1])
+           AC_SUBST([IDN_ENABLED], [1])
+           LIBS="-licucore $LIBS"
+        )
+      ])
+      ;;
+  esac
+fi
+
 dnl **********************************************************************
 dnl Check for nghttp2
 dnl **********************************************************************