Skip to contentSkip to conversation

autoconf: iconv

PATCH New Jakub Narebski 1 participant 3 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

cover 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(-)
Signature · 3 lines
Jakub Narebski
ShadeHawk on #git
Poland
#1 lore raw

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

---
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(-)
configure.ac +5 -2
index 482c849..8af276c 100644
@@ -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"
 #
Signature · 1 line
1.4.2
#2 lore raw

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

In reply to Jakub Narebski

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).

---
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(-)
config.mak.in +1 -1
index 2c8fd2c..fccde61 100644
@@ -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@
 
configure.ac +12 -1
index 8af276c..6a980a5 100644
@@ -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
 #
Signature · 1 line
1.4.2