From 72f8d399cb18c1d61e7548584c7b955ff26020c0 Mon Sep 17 00:00:00 2001 From: Michiel Broek Date: Sun, 27 May 2007 13:02:34 +0000 Subject: [PATCH] Another attempt to fix xxxBSD --- configure | 124 ++++++++++++++++++++++++++++++++++++++++++--------- configure.ac | 4 +- 2 files changed, 105 insertions(+), 23 deletions(-) diff --git a/configure b/configure index c4c881dc..89c44e54 100755 --- a/configure +++ b/configure @@ -9397,13 +9397,9 @@ _ACEOF fi done - -for ac_func in iconv_open -do -as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` -{ echo "$as_me:$LINENO: checking for $ac_func" >&5 -echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; } -if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then +{ echo "$as_me:$LINENO: checking for iconv_open" >&5 +echo $ECHO_N "checking for iconv_open... $ECHO_C" >&6; } +if test "${ac_cv_func_iconv_open+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF @@ -9412,12 +9408,12 @@ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -/* Define $ac_func to an innocuous variant, in case declares $ac_func. +/* Define iconv_open to an innocuous variant, in case declares iconv_open. For example, HP-UX 11i declares gettimeofday. */ -#define $ac_func innocuous_$ac_func +#define iconv_open innocuous_iconv_open /* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func (); below. + which can conflict with char iconv_open (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ @@ -9427,7 +9423,7 @@ cat >>conftest.$ac_ext <<_ACEOF # include #endif -#undef $ac_func +#undef iconv_open /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC @@ -9435,18 +9431,18 @@ cat >>conftest.$ac_ext <<_ACEOF #ifdef __cplusplus extern "C" #endif -char $ac_func (); +char iconv_open (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ -#if defined __stub_$ac_func || defined __stub___$ac_func +#if defined __stub_iconv_open || defined __stub___iconv_open choke me #endif int main () { -return $ac_func (); +return iconv_open (); ; return 0; } @@ -9485,27 +9481,111 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - eval "$as_ac_var=yes" + ac_cv_func_iconv_open=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - eval "$as_ac_var=no" + ac_cv_func_iconv_open=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi -ac_res=`eval echo '${'$as_ac_var'}'` - { echo "$as_me:$LINENO: result: $ac_res" >&5 -echo "${ECHO_T}$ac_res" >&6; } -if test `eval echo '${'$as_ac_var'}'` = yes; then +{ echo "$as_me:$LINENO: result: $ac_cv_func_iconv_open" >&5 +echo "${ECHO_T}$ac_cv_func_iconv_open" >&6; } +if test $ac_cv_func_iconv_open = yes; then + : +else + +{ echo "$as_me:$LINENO: checking for iconv_open in -liconv" >&5 +echo $ECHO_N "checking for iconv_open in -liconv... $ECHO_C" >&6; } +if test "${ac_cv_lib_iconv_iconv_open+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 iconv_open (); +int +main () +{ +return iconv_open (); + ; + 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); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (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_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (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_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_iconv_iconv_open=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_lib_iconv_iconv_open=no +fi + +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ echo "$as_me:$LINENO: result: $ac_cv_lib_iconv_iconv_open" >&5 +echo "${ECHO_T}$ac_cv_lib_iconv_iconv_open" >&6; } +if test $ac_cv_lib_iconv_iconv_open = yes; then cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +#define HAVE_LIBICONV 1 _ACEOF + LIBS="-liconv $LIBS" + +fi + + fi -done # diff --git a/configure.ac b/configure.ac index a9d5d24f..99fdd3de 100644 --- a/configure.ac +++ b/configure.ac @@ -228,7 +228,9 @@ AC_TYPE_SIGNAL AC_FUNC_UTIME_NULL AC_CHECK_FUNCS(gettimeofday re_comp select) AC_CHECK_FUNCS(getspnam initgroups updwtmp updwtmpx) -AC_CHECK_FUNCS(iconv_open) +AC_CHECK_FUNC(iconv_open,, + AC_CHECK_LIB(iconv, iconv_open) +) # # Check for usefull external programs