From: François Pinard Date: Thu, 13 Mar 2008 19:17:17 +0000 (-0400) Subject: Force -liconv if available X-Git-Tag: v3.7~230 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=216174dd571fec8ef2ff7f31e14315139422e95f;p=recode Force -liconv if available --- diff --git a/ChangeLog b/ChangeLog index c974cc9..1120e15 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2008-03-13 François Pinard + + * configure.ac: Force -liconv if libiconv is available. + 2008-03-10 François Pinard * tables.py: Add option -v. diff --git a/config.h.in b/config.h.in index 50769be..a6cbdf1 100644 --- a/config.h.in +++ b/config.h.in @@ -61,6 +61,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_LANGINFO_H +/* Define to 1 if you have the `iconv' library (-liconv). */ +#undef HAVE_LIBICONV + /* Define to 1 if you have the header file. */ #undef HAVE_LIMITS_H diff --git a/configure b/configure index d7a2831..72b82db 100755 --- a/configure +++ b/configure @@ -20806,6 +20806,77 @@ _ACEOF +{ echo "$as_me:$LINENO: checking for libiconv in -liconv" >&5 +echo $ECHO_N "checking for libiconv in -liconv... $ECHO_C" >&6; } +if test "${ac_cv_lib_iconv_libiconv+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-liconv $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char libiconv (); +int +main () +{ +return libiconv (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + ac_cv_lib_iconv_libiconv=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_lib_iconv_libiconv=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ echo "$as_me:$LINENO: result: $ac_cv_lib_iconv_libiconv" >&5 +echo "${ECHO_T}$ac_cv_lib_iconv_libiconv" >&6; } +if test $ac_cv_lib_iconv_libiconv = yes; then + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBICONV 1 +_ACEOF + + LIBS="-liconv $LIBS" + +fi + + diff --git a/configure.ac b/configure.ac index a3ce2f6..fba934a 100644 --- a/configure.ac +++ b/configure.ac @@ -23,6 +23,7 @@ AC_CHECK_HEADERS(limits.h locale.h memory.h stdbool.h stddef.h stdlib.h string.h AC_TYPE_SIGNAL jm_STRUCT_UTIMBUF +AC_CHECK_LIB(iconv, libiconv) AC_CHECK_FUNCS(dup2 mbrtowc rename setlocale strerror strndup wcrtomb) AC_REPLACE_FUNCS(strtol strtoul) AC_FUNC_ALLOCA