threads / patch / 5510

patch, 2 partsautoconf: Set NO_ICONV if iconv is found neither in libc, nor in libiconv

Subject: [PATCH 1/2] autoconf: Set NO_ICONV if iconv is found neither in libc, nor in libiconv

## tl;dr

3 messages between Sep 7, 2006 and Sep 7, 2006. Diffs are folded; open one to read it.

replies: 2people: 1as markdown or json

Jakub Narebski· Sep 7, 2006, 11:47 UTC · lore

[PATCH 0/2] autoconf: iconv

Those two patches add support for remaining iconv related compilation variables, namely NO_ICONV and ICONVDIR to configure.ac. First patch sets NO_ICONV if no iconv implementation was found (autodetection), second adds --without-iconv/--with-iconv=PATH option to generated ./configure script (user input).

This series is based on my earlier autoconf series "[PATCH 0/5] Some autoconf patches", but with little editing of config.mak.in patch in the PATCH 2/2 they could be applied on top of 'next' branch.

Shortlog:
 [PATCH 1/2] autoconf: Set NO_ICONV if iconv is found neither in libc, nor in libiconv
 [PATCH 2/2] autoconf: Add support for setting NO_ICONV and ICONVDIR
Diffstat:
 config.mak.in |    2 +-
 configure.ac  |   18 ++++++++++++++++--
 2 files changed, 17 insertions(+), 3 deletions(-)
-- 
Jakub Narebski
ShadeHawk on #git
Poland
Jakub Narebski· Sep 7, 2006, 11:48 UTC · re: Jakub Narebski · lore
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
---
This patch only adds NO_ICONV=YesPlease, and it never unsets
NO_ICONV. This doesn't matter now because there is no setting
NO_ICONV value in Makefile (no architecture/system based detection).
 configure.ac |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)
Show changes to configure.ac +5 −2
diff --git a/configure.ac b/configure.ac
index 482c849..8af276c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -143,9 +143,12 @@ AC_CHECK_LIB([expat], [XML_ParserCreate]
 AC_SUBST(NO_EXPAT)
 #
 # Define NEEDS_LIBICONV if linking with libc is not enough (Darwin).
+# Define NO_ICONV if neither libc nor libiconv support iconv.
 AC_CHECK_LIB([c], [iconv],
-[NEEDS_LIBICONV=],
-[NEEDS_LIBICONV=YesPlease])
+	[NEEDS_LIBICONV=],
+	AC_CHECK_LIB([iconv], [iconv],
+		[NEEDS_LIBICONV=YesPlease],
+		[GIT_CONF_APPEND_LINE([NO_ICONV=YesPlease])]))
 AC_SUBST(NEEDS_LIBICONV)
 test -n "$NEEDS_LIBICONV" && LIBS="$LIBS -liconv"
 #
-- 
1.4.2
Jakub Narebski· Sep 7, 2006, 11:48 UTC · re: Jakub Narebski · lore

[PATCH 2/2] autoconf: Add support for setting NO_ICONV and ICONVDIR

Add support for ./configure options --without-iconv (if neither libc nor libiconv properly support iconv), and for --with-iconv=PATH (to set prefix to libiconv library and headers, used only when NEED_LIBICONV is set). While at it, make ./configure set or unset NO_ICONV always (it is not autodetected in Makefile).

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
---
The config.mak.in patch just adds or uncomments 
NO_ICONV=@NO_ICONV@

at the end of the file. If there is conflict during applying this part of patchset (for example "autoconf: Add some commented out variables to config.mak.in" and "autoconf: Preliminary check for working mmap" are not applied), just modify config.mak.in to have this line at the end.

 config.mak.in |    2 +-
 configure.ac  |   13 ++++++++++++-
 2 files changed, 13 insertions(+), 2 deletions(-)
Show changes to 2 files +13 −2

config.mak.in, configure.ac

diff --git a/config.mak.in b/config.mak.in
index 2c8fd2c..fccde61 100644
--- a/config.mak.in
+++ b/config.mak.in
@@ -38,5 +38,5 @@ NO_STRCASESTR=@NO_STRCASESTR@
 NO_STRLCPY=@NO_STRLCPY@
 NO_SETENV=@NO_SETENV@
 NO_MMAP=@NO_MMAP@
-#NO_ICONV=@NO_ICONV@
+NO_ICONV=@NO_ICONV@
 
diff --git a/configure.ac b/configure.ac
index 8af276c..6a980a5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -148,8 +148,9 @@ AC_CHECK_LIB([c], [iconv],
 	[NEEDS_LIBICONV=],
 	AC_CHECK_LIB([iconv], [iconv],
 		[NEEDS_LIBICONV=YesPlease],
-		[GIT_CONF_APPEND_LINE([NO_ICONV=YesPlease])]))
+		[NO_ICONV=YesPlease]))
 AC_SUBST(NEEDS_LIBICONV)
+AC_SUBST(NO_ICONV)
 test -n "$NEEDS_LIBICONV" && LIBS="$LIBS -liconv"
 #
 # Define NEEDS_SOCKET if linking with libc is not enough (SunOS,
@@ -350,6 +351,16 @@ # specify your own (or DarwinPort's) inc
 # library directories by defining CFLAGS and LDFLAGS appropriately.
 #
 # Define NO_MMAP if you want to avoid mmap.
+#
+# Define NO_ICONV if your libc does not properly support iconv.
+AC_ARG_WITH(iconv,
+AS_HELP_STRING([--without-iconv],
+[if your architecture doesn't properly support iconv])
+AS_HELP_STRING([--with-iconv=PATH],
+[PATH is prefix for libiconv library and headers])
+AS_HELP_STRING([],
+[used only if you need linking with libiconv]),
+GIT_PARSE_WITH(iconv))
 
 ## --enable-FEATURE[=ARG] and --disable-FEATURE
 #
-- 
1.4.2

← back to recent threads