f17cd8
From a296141a45e5bea4e08358801011397c778bcc96 Mon Sep 17 00:00:00 2001
f17cd8
From: =?UTF-8?q?Petr=20Men=C5=A1=C3=ADk?= <pemensik@redhat.com>
f17cd8
Date: Tue, 3 Apr 2018 20:35:29 +0200
f17cd8
Subject: [PATCH] Remove -lidn2 from exported LIBS. Do not propagate it from
f17cd8
 isc-config.sh --libs isc.
f17cd8
f17cd8
---
f17cd8
 configure    | 18 +++++++++++++-----
f17cd8
 configure.in | 20 ++++++++++++++------
f17cd8
 2 files changed, 27 insertions(+), 11 deletions(-)
f17cd8
f17cd8
diff --git a/configure b/configure
f17cd8
index ce9f393..afec327 100755
f17cd8
--- a/configure
f17cd8
+++ b/configure
f17cd8
@@ -22856,6 +22856,7 @@ fi
f17cd8
 #
f17cd8
 
f17cd8
 LIBIDN2_CFLAGS=
f17cd8
+LIBIDN2_LDFLAGS=
f17cd8
 LIBIDN2_LIBS=
f17cd8
 
f17cd8
 # Check whether --with-libidn2 was given.
f17cd8
@@ -22869,20 +22870,23 @@ case $use_libidn2 in #(
f17cd8
   no) :
f17cd8
     : ;; #(
f17cd8
   yes) :
f17cd8
-
f17cd8
-	    LIBIDN2_LIBS="-lidn2"
f17cd8
-	 ;; #(
f17cd8
+    : ;; #(
f17cd8
   *) :
f17cd8
 
f17cd8
 	    LIBIDN2_CFLAGS="-I$use_libidn2/include"
f17cd8
-	    LIBIDN2_LIBS="-L$use_libidn2/lib -lidn2"
f17cd8
+	    LIBIDN2_LDFLAGS="-L$use_libidn2/lib"
f17cd8
 	 ;; #(
f17cd8
   *) :
f17cd8
      ;;
f17cd8
 esac
f17cd8
 
f17cd8
 if test "$use_libidn2" != "no"; then :
f17cd8
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing idn2_to_ascii_8z" >&5
f17cd8
+  save_CFLAGS="$CFLAGS"
f17cd8
+       save_LIBS="$LIBS"
f17cd8
+       save_LDFLAGS="$LDFLAGS"
f17cd8
+       CFLAGS="$LIBIDN2_CFLAGS $CFLAGS"
f17cd8
+       LDFLAGS="$LIBIDN2_LDFLAGS $LDFLAGS"
f17cd8
+       { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing idn2_to_ascii_8z" >&5
f17cd8
 $as_echo_n "checking for library containing idn2_to_ascii_8z... " >&6; }
f17cd8
 if ${ac_cv_search_idn2_to_ascii_8z+:} false; then :
f17cd8
   $as_echo_n "(cached) " >&6
f17cd8
@@ -22938,6 +22942,7 @@ if test "$ac_res" != no; then :
f17cd8
 
f17cd8
 $as_echo "#define WITH_LIBIDN2 1" >>confdefs.h
f17cd8
 
f17cd8
+                       LIBIDN2_LIBS="$LIBIDN2_LDFLAGS -lidn2"
f17cd8
 else
f17cd8
   as_fn_error $? "libidn2 requested, but not found" "$LINENO" 5
f17cd8
 fi
f17cd8
@@ -22967,6 +22972,9 @@ $as_echo "no" >&6; }
f17cd8
 fi
f17cd8
 rm -f core conftest.err conftest.$ac_objext \
f17cd8
     conftest$ac_exeext conftest.$ac_ext
f17cd8
+       CFLAGS="$save_CFLAGS"
f17cd8
+       LIBS="$save_LIBS"
f17cd8
+       LDFLAGS="$save_LDFLAGS"
f17cd8
 
f17cd8
 fi
f17cd8
 
f17cd8
diff --git a/configure.in b/configure.in
f17cd8
index 63988c9..873e14d 100644
f17cd8
--- a/configure.in
f17cd8
+++ b/configure.in
f17cd8
@@ -4904,23 +4904,28 @@ AC_SUBST(IDNKIT_LIBS)
f17cd8
 #
f17cd8
 
f17cd8
 LIBIDN2_CFLAGS=
f17cd8
+LIBIDN2_LDFLAGS=
f17cd8
 LIBIDN2_LIBS=
f17cd8
 AC_ARG_WITH(libidn2,
f17cd8
 	AS_HELP_STRING([--with-libidn2[=PATH]], [enable IDN support using GNU libidn2 [yes|no|path]]),
f17cd8
 	use_libidn2="$withval", use_libidn2="no")
f17cd8
 AS_CASE([$use_libidn2],
f17cd8
 	[no],[:],
f17cd8
-	[yes],[
f17cd8
-	    LIBIDN2_LIBS="-lidn2"
f17cd8
-	],
f17cd8
+	[yes],[:],
f17cd8
 	[*],[
f17cd8
 	    LIBIDN2_CFLAGS="-I$use_libidn2/include"
f17cd8
-	    LIBIDN2_LIBS="-L$use_libidn2/lib -lidn2"
f17cd8
+	    LIBIDN2_LDFLAGS="-L$use_libidn2/lib"
f17cd8
 	])
f17cd8
 
f17cd8
 AS_IF([test "$use_libidn2" != "no"],
f17cd8
-      [AC_SEARCH_LIBS([idn2_to_ascii_8z], [idn2],
f17cd8
-		      [AC_DEFINE(WITH_LIBIDN2, 1, [define if libidn2 support is to be included.])],
f17cd8
+      [save_CFLAGS="$CFLAGS"
f17cd8
+       save_LIBS="$LIBS"
f17cd8
+       save_LDFLAGS="$LDFLAGS"
f17cd8
+       CFLAGS="$LIBIDN2_CFLAGS $CFLAGS"
f17cd8
+       LDFLAGS="$LIBIDN2_LDFLAGS $LDFLAGS"
f17cd8
+       AC_SEARCH_LIBS([idn2_to_ascii_8z], [idn2],
f17cd8
+                      [AC_DEFINE(WITH_LIBIDN2, 1, [define if libidn2 support is to be included.])
f17cd8
+                       LIBIDN2_LIBS="$LIBIDN2_LDFLAGS -lidn2"],
f17cd8
 		      [AC_MSG_ERROR([libidn2 requested, but not found])])
f17cd8
        AC_MSG_CHECKING(whether libidn2 supports idn2_to_unicode_8zlz)
f17cd8
        AC_TRY_LINK([#include <idn2.h>],
f17cd8
@@ -4928,6 +4933,9 @@ AS_IF([test "$use_libidn2" != "no"],
f17cd8
 		   [AC_MSG_RESULT(yes)
f17cd8
 		    AC_DEFINE(WITH_IDN_OUT_SUPPORT, 1, [define if IDN output support is to be included.])],
f17cd8
 		   [AC_MSG_RESULT([no])])
f17cd8
+       CFLAGS="$save_CFLAGS"
f17cd8
+       LIBS="$save_LIBS"
f17cd8
+       LDFLAGS="$save_LDFLAGS"
f17cd8
       ])
f17cd8
 AC_SUBST([LIBIDN2_CFLAGS])
f17cd8
 AC_SUBST([LIBIDN2_LIBS])
f17cd8
-- 
f17cd8
2.14.3
f17cd8