git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] configure: make iconv tests aware of user arguments

From
Ben Walton <bwalton@artsci.utoronto.ca>
Date
Mar 12, 2009, 19:20 UTC
Message-ID
<1236885612-22575-7-git-send-email-bwalton@artsci.utoronto.ca>
In-Reply-To
<1236885612-22575-6-git-send-email-bwalton@artsci.utoronto.ca>

--with-iconv is now taken into account when doing the tests for iconv. If the user requests alternate handling for libiconv, the -liconv test is run before the -lc test.

Signed-off-by: Ben Walton <bwalton@artsci.utoronto.ca>
---
 configure.ac |   48 ++++++++++++++++++++++++++++++++++--------------
 1 files changed, 34 insertions(+), 14 deletions(-)
diff --git a/configure.ac b/configure.ac
index f4b8e49..6fe4bfe 100644
--- a/configure.ac
+++ b/configure.ac
@@ -375,20 +375,35 @@ int main(void)
 	return 0;
 }
 ])
-AC_MSG_CHECKING([for iconv in -lc])
-AC_LINK_IFELSE(ICONVTEST_SRC,
+
+if test -n "$ICONVDIR"; then
+   lib_order="-liconv -lc"
+else
+   lib_order="-lc -liconv"
+fi
+
+NO_ICONV=YesPlease
+
+for l in $lib_order; do
+    if test "$l" = "-liconv"; then
+       NEEDS_LIBICONV=YesPlease
+    else
+       NEEDS_LIBICONV=
+    fi
+
+    old_LIBS="$LIBS"
+    LIBS="$LIBS $l"
+    AC_MSG_CHECKING([for iconv in $l])
+    AC_LINK_IFELSE(ICONVTEST_SRC,
 	[AC_MSG_RESULT([yes])
-	NEEDS_LIBICONV=],
-	[AC_MSG_RESULT([no])
-	old_LIBS="$LIBS"
-	LIBS="$LIBS -liconv"
-	AC_MSG_CHECKING([for iconv in -liconv])
-	AC_LINK_IFELSE(ICONVTEST_SRC,
-		[AC_MSG_RESULT([yes])
-		NEEDS_LIBICONV=YesPlease],
-		[AC_MSG_RESULT([no])
-		NO_ICONV=YesPlease])
-	LIBS="$old_LIBS"])
+	NO_ICONV=
+	break],
+	[AC_MSG_RESULT([no])])
+    LIBS="$old_LIBS"
+done
+
+#in case of break
+LIBS="$old_LIBS"
 
 GIT_UNSTASH_FLAGS($ICONVDIR)
 
@@ -455,13 +470,18 @@ int main(void)
 	return 0;
 }
 ]])
+
+GIT_STASH_FLAGS($ICONVDIR)
+
 AC_MSG_CHECKING([for old iconv()])
 AC_COMPILE_IFELSE(OLDICONVTEST_SRC,
 	[AC_MSG_RESULT([no])],
 	[AC_MSG_RESULT([yes])
 	OLD_ICONV=UnfortunatelyYes])
-AC_SUBST(OLD_ICONV)
 
+GIT_UNSTASH_FLAGS($ICONVDIR)
+
+AC_SUBST(OLD_ICONV)
 
 ## Checks for typedefs, structures, and compiler characteristics.
 AC_MSG_NOTICE([CHECKS for typedefs, structures, and compiler characteristics])
-- 
1.6.0.5
Previous: Ben WaltonNext: Ben Walton
Message 7 of 8 in “autoconf changes”
  1. Ben WaltonMar 12, 2009
  2. configure: ensure settings from user are also usable in the scriptBen Walton, Mar 12, 2009
  3. configure: reorganize flow of argument checksBen Walton, Mar 12, 2009
  4. configure: add macros to stash FLAG variablesBen Walton, Mar 12, 2009
  5. configure: wrap some library tests with GIT_STASH_FLAGSBen Walton, Mar 12, 2009
  6. configure: asciidoc version test cleanupBen Walton, Mar 12, 2009
  7. configure: make iconv tests aware of user argumentsBen Walton, Mar 12, 2009
  8. configure: rework pthread handling to allow for user defined flagsBen Walton, Mar 12, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.