Update 'configure' for libiconv detection; only set HAVE_ICONV_H if header exists *and* an impl we can link with exists.

This commit is contained in:
Brian Cox 2016-05-06 23:33:04 -07:00
parent add9c7f6b9
commit 778c397d48
2 changed files with 118 additions and 3 deletions

114
configure vendored
View File

@ -5308,7 +5308,7 @@ fi
done
for ac_header in unistd.h syslog.h iconv.h langinfo.h sys/statfs.h
for ac_header in unistd.h syslog.h langinfo.h sys/statfs.h
do :
as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
@ -6103,6 +6103,118 @@ fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for iconv in -lc" >&5
$as_echo_n "checking for iconv in -lc... " >&6; }
if ${ac_cv_lib_c_iconv+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-lc $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* 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 ();
int
main ()
{
return iconv ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_lib_c_iconv=yes
else
ac_cv_lib_c_iconv=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_c_iconv" >&5
$as_echo "$ac_cv_lib_c_iconv" >&6; }
if test "x$ac_cv_lib_c_iconv" = xyes; then :
for ac_header in iconv.h
do :
ac_fn_c_check_header_mongrel "$LINENO" "iconv.h" "ac_cv_header_iconv_h" "$ac_includes_default"
if test "x$ac_cv_header_iconv_h" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_ICONV_H 1
_ACEOF
fi
done
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for iconv in -liconv" >&5
$as_echo_n "checking for iconv in -liconv... " >&6; }
if ${ac_cv_lib_iconv_iconv+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-liconv $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* 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 ();
int
main ()
{
return iconv ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_lib_iconv_iconv=yes
else
ac_cv_lib_iconv_iconv=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_iconv_iconv" >&5
$as_echo "$ac_cv_lib_iconv_iconv" >&6; }
if test "x$ac_cv_lib_iconv_iconv" = xyes; then :
LIBS="-liconv $LIBS"
for ac_header in iconv.h
do :
ac_fn_c_check_header_mongrel "$LINENO" "iconv.h" "ac_cv_header_iconv_h" "$ac_includes_default"
if test "x$ac_cv_header_iconv_h" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_ICONV_H 1
_ACEOF
fi
done
else
:
fi
fi
ac_ext=cpp
ac_cpp='$CXXCPP $CPPFLAGS'

View File

@ -64,7 +64,7 @@ AC_CHECK_HEADERS(sys/mount.h,,,
#endif
]])
AC_CHECK_HEADERS(sys/ustat.h sys/sysmacros.h sys/syslog.h)
AC_CHECK_HEADERS(unistd.h syslog.h iconv.h langinfo.h sys/statfs.h)
AC_CHECK_HEADERS(unistd.h syslog.h langinfo.h sys/statfs.h)
AC_CHECK_HEADERS(signum.h bits/signum.h, break )
AC_CHECK_HEADERS(stdarg.h varargs.h, break )
@ -128,9 +128,12 @@ AC_CHECK_LIB(c, gethostbyname, [:], [
]) ])
dnl iconv? check the usual locations
AC_CHECK_LIB(c, iconv, [:], [
AC_CHECK_LIB(c, iconv, [
AC_CHECK_HEADERS(iconv.h)
], [
AC_CHECK_LIB(iconv, iconv, [
LIBS="-liconv $LIBS"
AC_CHECK_HEADERS(iconv.h)
], [:]) ])
dnl check for stl library