Blob Blame History Raw
From a296141a45e5bea4e08358801011397c778bcc96 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Petr=20Men=C5=A1=C3=ADk?= <pemensik@redhat.com>
Date: Tue, 3 Apr 2018 20:35:29 +0200
Subject: [PATCH] Remove -lidn2 from exported LIBS. Do not propagate it from
 isc-config.sh --libs isc.

---
 configure    | 18 +++++++++++++-----
 configure.in | 20 ++++++++++++++------
 2 files changed, 27 insertions(+), 11 deletions(-)

diff --git a/configure b/configure
index ce9f393..afec327 100755
--- a/configure
+++ b/configure
@@ -22856,6 +22856,7 @@ fi
 #
 
 LIBIDN2_CFLAGS=
+LIBIDN2_LDFLAGS=
 LIBIDN2_LIBS=
 
 # Check whether --with-libidn2 was given.
@@ -22869,20 +22870,23 @@ case $use_libidn2 in #(
   no) :
     : ;; #(
   yes) :
-
-	    LIBIDN2_LIBS="-lidn2"
-	 ;; #(
+    : ;; #(
   *) :
 
 	    LIBIDN2_CFLAGS="-I$use_libidn2/include"
-	    LIBIDN2_LIBS="-L$use_libidn2/lib -lidn2"
+	    LIBIDN2_LDFLAGS="-L$use_libidn2/lib"
 	 ;; #(
   *) :
      ;;
 esac
 
 if test "$use_libidn2" != "no"; then :
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing idn2_to_ascii_8z" >&5
+  save_CFLAGS="$CFLAGS"
+       save_LIBS="$LIBS"
+       save_LDFLAGS="$LDFLAGS"
+       CFLAGS="$LIBIDN2_CFLAGS $CFLAGS"
+       LDFLAGS="$LIBIDN2_LDFLAGS $LDFLAGS"
+       { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing idn2_to_ascii_8z" >&5
 $as_echo_n "checking for library containing idn2_to_ascii_8z... " >&6; }
 if ${ac_cv_search_idn2_to_ascii_8z+:} false; then :
   $as_echo_n "(cached) " >&6
@@ -22938,6 +22942,7 @@ if test "$ac_res" != no; then :
 
 $as_echo "#define WITH_LIBIDN2 1" >>confdefs.h
 
+                       LIBIDN2_LIBS="$LIBIDN2_LDFLAGS -lidn2"
 else
   as_fn_error $? "libidn2 requested, but not found" "$LINENO" 5
 fi
@@ -22967,6 +22972,9 @@ $as_echo "no" >&6; }
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
+       CFLAGS="$save_CFLAGS"
+       LIBS="$save_LIBS"
+       LDFLAGS="$save_LDFLAGS"
 
 fi
 
diff --git a/configure.in b/configure.in
index 63988c9..873e14d 100644
--- a/configure.in
+++ b/configure.in
@@ -4904,23 +4904,28 @@ AC_SUBST(IDNKIT_LIBS)
 #
 
 LIBIDN2_CFLAGS=
+LIBIDN2_LDFLAGS=
 LIBIDN2_LIBS=
 AC_ARG_WITH(libidn2,
 	AS_HELP_STRING([--with-libidn2[=PATH]], [enable IDN support using GNU libidn2 [yes|no|path]]),
 	use_libidn2="$withval", use_libidn2="no")
 AS_CASE([$use_libidn2],
 	[no],[:],
-	[yes],[
-	    LIBIDN2_LIBS="-lidn2"
-	],
+	[yes],[:],
 	[*],[
 	    LIBIDN2_CFLAGS="-I$use_libidn2/include"
-	    LIBIDN2_LIBS="-L$use_libidn2/lib -lidn2"
+	    LIBIDN2_LDFLAGS="-L$use_libidn2/lib"
 	])
 
 AS_IF([test "$use_libidn2" != "no"],
-      [AC_SEARCH_LIBS([idn2_to_ascii_8z], [idn2],
-		      [AC_DEFINE(WITH_LIBIDN2, 1, [define if libidn2 support is to be included.])],
+      [save_CFLAGS="$CFLAGS"
+       save_LIBS="$LIBS"
+       save_LDFLAGS="$LDFLAGS"
+       CFLAGS="$LIBIDN2_CFLAGS $CFLAGS"
+       LDFLAGS="$LIBIDN2_LDFLAGS $LDFLAGS"
+       AC_SEARCH_LIBS([idn2_to_ascii_8z], [idn2],
+                      [AC_DEFINE(WITH_LIBIDN2, 1, [define if libidn2 support is to be included.])
+                       LIBIDN2_LIBS="$LIBIDN2_LDFLAGS -lidn2"],
 		      [AC_MSG_ERROR([libidn2 requested, but not found])])
        AC_MSG_CHECKING(whether libidn2 supports idn2_to_unicode_8zlz)
        AC_TRY_LINK([#include <idn2.h>],
@@ -4928,6 +4933,9 @@ AS_IF([test "$use_libidn2" != "no"],
 		   [AC_MSG_RESULT(yes)
 		    AC_DEFINE(WITH_IDN_OUT_SUPPORT, 1, [define if IDN output support is to be included.])],
 		   [AC_MSG_RESULT([no])])
+       CFLAGS="$save_CFLAGS"
+       LIBS="$save_LIBS"
+       LDFLAGS="$save_LDFLAGS"
       ])
 AC_SUBST([LIBIDN2_CFLAGS])
 AC_SUBST([LIBIDN2_LIBS])
-- 
2.14.3