]> granicus.if.org Git - mutt/commitdiff
Fix unistring library configure test.
authorKevin McCarthy <kevin@8t8.us>
Sun, 21 Apr 2019 18:00:23 +0000 (11:00 -0700)
committerKevin McCarthy <kevin@8t8.us>
Sun, 21 Apr 2019 21:34:06 +0000 (14:34 -0700)
The "action-if-found" argument of AC_SEARCH_LIBS is run even if the
result is "none required" (i.e. the test function is already in LIBS,
in this case -lidn2).

This was causing "-lunistring" to be appended on a system without the
library installed, generating a build error.  Fix the test to not
append the library for the "none required" case.

Thanks to Fabrice Fontaine for reporting this issue and helping me
test the fix.

configure.ac

index 75943eee4be103f7e6f1cc1c3cb91bae31a86288..102ddea26103c15add48bff53867f6d6dff564e3 100644 (file)
@@ -1401,10 +1401,16 @@ if test "x$with_idn2" != "xno"; then
 
     AC_SEARCH_LIBS([idn2_check_version], [idn2], [
       AC_DEFINE([HAVE_LIBIDN2], 1, [Define to 1 if you have the GNU idn2 library])
-      dnl -lunistring is needed for static linking
-      AC_SEARCH_LIBS([u8_strconv_from_locale], [unistring], [LIBS="$LIBS -lunistring"])
       MUTTLIBS="$MUTTLIBS $LIBS"
 
+      dnl -lunistring is needed for static linking, and has to come
+      dnl after the -lidn2
+      AC_SEARCH_LIBS([u8_strconv_from_locale], [unistring], [
+            if test "$ac_cv_search_u8_strconv_from_locale" != "none required"; then
+              MUTTLIBS="$MUTTLIBS -lunistring"
+            fi
+      ])
+
       dnl libidn2 >= 2.0.0 declares compatibility macros in idn2.h
       LIBS="$LIBS $LIBICONV"
       AC_CHECK_DECL([idna_to_unicode_8z8z],