configure.in | 85 ++++++++++++++++++++++++++++++++++++++++----------------
src/Makefile.am | 1
2 files changed, 63 insertions(+), 23 deletions(-)
New commits:
commit 2589207cfd4c7e948a4b50d7c07c13a3a52fe0aa
Author: Akira TAGOH <akira at tagoh.org>
Date: Tue Apr 10 18:34:11 2012 +0900
Bug 26830 - Add search for libiconv non-default directory
Add --with-libiconv, --with-libiconv-includes and --with-libiconv-lib
to specify the directory where libiconv might be installed.
diff --git a/configure.in b/configure.in
index ea44c14..c3476d3 100644
--- a/configure.in
+++ b/configure.in
@@ -138,33 +138,72 @@ AC_CHECK_FUNCS([geteuid getuid link memmove memset mkstemp
strchr strrchr strtol
#
# Checks for iconv
#
-AC_MSG_CHECKING([for a usable iconv])
-ICONV_LIBS=""
-AC_TRY_LINK([#include <iconv.h>],
- [iconv_open ("from", "to");],
- [use_iconv=1],
- [use_iconv=0])
-if test x$use_iconv = x1; then
- AC_MSG_RESULT([libc])
-else
- # try using libiconv
- fontconfig_save_libs="$LIBS"
- LIBS="$LIBS -liconv"
-
- AC_TRY_LINK([#include <iconv.h>],
- [iconv_open ("from", "to");],
- [use_iconv=1],
- [use_iconv=0])
-
- if test x$use_iconv = x1; then
- ICONV_LIBS="-liconv"
- AC_MSG_RESULT([libiconv])
+AC_ARG_WITH(libiconv,
+ [AC_HELP_STRING([--with-libiconv=DIR],
+ [Use libiconv in DIR])],
+ [libiconv_prefix=$withval],
+ [libiconv_prefix=auto])
+AC_ARG_WITH(libiconv-includes,
+ [AC_HELP_STRING([--with-libiconv-includes=DIR],
+ [Use libiconv includes in DIR])],
+ [libiconv_includes=$withval],
+ [libiconv_includes=auto])
+AC_ARG_WITH(libiconv-lib,
+ [AC_HELP_STRING([--with-libiconv-lib=DIR],
+ [Use libiconv library in DIR])],
+ [libiconv_lib=$withval],
+ [libiconv_lib=auto])
+
+# if none of libiconv,libiconv-includes,libiconv-libs are specified
+if test "$libiconv_prefix" != "auto" -o
"$libiconv_includes" != "auto" -o "$libiconv_lib"
!= "auto"; then
+ if test "$libiconv_includes" != "auto" -a -r
${libiconv_includes}/iconv.h; then
+ libiconv_cflags="-I${libiconv_includes}"
+ elif test "$libiconv_prefix" != "auto" -a -r
${libiconv_prefix}/include/iconv.h; then
+ libiconv_cflags="-I${libiconv_prefix}/include"
else
- AC_MSG_RESULT([no])
+ libiconv_cflags=""
fi
+ if test "$libiconv_lib" != "auto"; then
+ libiconv_lib="-L${libiconv_lib} -liconv"
+ elif test "$libiconv_prefix" != "auto"; then
+ libiconv_lib="-L${libiconv_prefix}/lib -liconv"
+ elif test "x$libiconv_cflags" != "x"; then
+ libiconv_lib="-liconv"
+ else
+ libiconv_lib=""
+ fi
+fi
- LIBS="$fontconfig_save_libs"
+use_iconv=0
+AC_MSG_CHECKING([for a usable iconv])
+if test "x$libiconv_cflags" != "x" -o
"x$libiconv_lib" != "x"; then
+ iconvsaved_CFLAGS="$CFLAGS"
+ iconvsaved_LIBS="$LIBS"
+ CFLAGS="$CFLAGS $libiconv_cflags"
+ LIBS="$LIBS $libiconv_lib"
+
+ AC_TRY_LINK([#include <iconv.h>],
+ [iconv_open ("from", "to");],
+ [iconv_type="libiconv"
+ use_iconv=1],
+ [use_iconv=0])
+
+ CFLAGS="$iconvsaved_CFLAGS"
+ LIBS="$iconvsaved_LIBS"
+ ICONV_CFLAGS="$libiconv_cflags"
+ ICONV_LIBS="$libiconv_lib"
fi
+if test "x$use_iconv" = "x0"; then
+ AC_TRY_LINK([#include <iconv.h>],
+ [iconv_open ("from", "to");],
+ [iconv_type="libc"
+ use_iconv=1],
+ [iconv_type="not found"
+ use_iconv=0])
+fi
+
+AC_MSG_RESULT([$iconv_type])
+AC_SUBST(ICONV_CFLAGS)
AC_SUBST(ICONV_LIBS)
AC_DEFINE_UNQUOTED(USE_ICONV,$use_iconv,[Use iconv.])
diff --git a/src/Makefile.am b/src/Makefile.am
index 591fc16..0bd0e3d 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -71,6 +71,7 @@ INCLUDES = \
-I$(top_srcdir) \
-I$(top_srcdir)/src \
$(FREETYPE_CFLAGS) \
+ $(ICONV_CFLAGS) \
$(LIBXML2_CFLAGS) \
$(EXPAT_CFLAGS) \
$(WARN_CFLAGS) \
On 10/04/2012 10:48, Akira TAGOH wrote:> configure.in | 85 ++++++++++++++++++++++++++++++++++++++++---------------- > src/Makefile.am | 1 > 2 files changed, 63 insertions(+), 23 deletions(-) > > New commits: > commit 2589207cfd4c7e948a4b50d7c07c13a3a52fe0aa > Author: Akira TAGOH <akira at tagoh.org> > Date: Tue Apr 10 18:34:11 2012 +0900 > > Bug 26830 - Add search for libiconv non-default directory > > Add --with-libiconv, --with-libiconv-includes and --with-libiconv-lib > to specify the directory where libiconv might be installed.Just to report that since this change, my tinderbox is somehow ending up with ''auto'' inside my Libs.private in fontconfig.pc, e.g. Libs.private: -lexpat -lfreetype -lz -lbz2 auto which causes things which depend on fontconfig to fail to build with "gcc: auto: No such file or directory", e.g [1] Cygwin uses a separate libiconv, but it looks like this isn''t handled correctly anymore. [1] http://tinderbox.freedesktop.org/builds/2012-04-13-0008/logs/x11perf/#build> diff --git a/configure.in b/configure.in > +# if none of libiconv,libiconv-includes,libiconv-libs are specified > +if test "$libiconv_prefix" != "auto" -o "$libiconv_includes" != "auto" -o "$libiconv_lib" != "auto"; thenShould this comment read "if any of" ?> + if test "$libiconv_includes" != "auto" -a -r ${libiconv_includes}/iconv.h; then > + libiconv_cflags="-I${libiconv_includes}" > + elif test "$libiconv_prefix" != "auto" -a -r ${libiconv_prefix}/include/iconv.h; then > + libiconv_cflags="-I${libiconv_prefix}/include" > else > - AC_MSG_RESULT([no]) > + libiconv_cflags="" > fi > + if test "$libiconv_lib" != "auto"; then > + libiconv_lib="-L${libiconv_lib} -liconv" > + elif test "$libiconv_prefix" != "auto"; then > + libiconv_lib="-L${libiconv_prefix}/lib -liconv" > + elif test "x$libiconv_cflags" != "x"; then > + libiconv_lib="-liconv" > + else > + libiconv_lib="" > + fi > +fi > > - LIBS="$fontconfig_save_libs" > +use_iconv=0 > +AC_MSG_CHECKING([for a usable iconv]) > +if test "x$libiconv_cflags" != "x" -o "x$libiconv_lib" != "x"; thenI think libiconv_lib can have the value "auto" here, which leads to the AC_TRY_LINK test failing, even though it shouldn''t> + iconvsaved_CFLAGS="$CFLAGS" > + iconvsaved_LIBS="$LIBS" > + CFLAGS="$CFLAGS $libiconv_cflags" > + LIBS="$LIBS $libiconv_lib" > + > + AC_TRY_LINK([#include <iconv.h>], > + [iconv_open ("from", "to");], > + [iconv_type="libiconv" > + use_iconv=1], > + [use_iconv=0]) > + > + CFLAGS="$iconvsaved_CFLAGS" > + LIBS="$iconvsaved_LIBS" > + ICONV_CFLAGS="$libiconv_cflags" > + ICONV_LIBS="$libiconv_lib" > fi > +if test "x$use_iconv" = "x0"; then > + AC_TRY_LINK([#include <iconv.h>], > + [iconv_open ("from", "to");], > + [iconv_type="libc" > + use_iconv=1], > + [iconv_type="not found" > + use_iconv=0]) > +fi > + > +AC_MSG_RESULT([$iconv_type]) > +AC_SUBST(ICONV_CFLAGS) > AC_SUBST(ICONV_LIBS) > AC_DEFINE_UNQUOTED(USE_ICONV,$use_iconv,[Use iconv.]) >
Thanks for reporting. On Thu, Apr 19, 2012 at 10:09 PM, Jon TURNEY <jon.turney at dronecode.org.uk> wrote:> [1] http://tinderbox.freedesktop.org/builds/2012-04-13-0008/logs/x11perf/#build > >> diff --git a/configure.in b/configure.in >> +# if none of libiconv,libiconv-includes,libiconv-libs are specified >> +if test "$libiconv_prefix" != "auto" -o "$libiconv_includes" != "auto" -o "$libiconv_lib" != "auto"; then > > Should this comment read "if any of" ?Right.>> +use_iconv=0 >> +AC_MSG_CHECKING([for a usable iconv]) >> +if test "x$libiconv_cflags" != "x" -o "x$libiconv_lib" != "x"; then > > I think libiconv_lib can have the value "auto" here, which leads to the > AC_TRY_LINK test failing, even though it shouldn''tYes, I''ll fix that shortly. Thanks, -- Akira TAGOH