Skip to content

Commit 24ff9a4

Browse files
abadgerbenjaminp
authored andcommitted
[2.7] closes bpo-14353: Fix detection of bind_textdomain_codeset in libintl. (GH-13265)
In Python-2.7, we were only searching for bind_textdomain_codeset in libc. We should have also checked for it in libintl. This change from Mel Flynn https://bugs.python.org/file24918/python27-configure.in.patch fixes that.
1 parent 7b5dca8 commit 24ff9a4

File tree

4 files changed

+66
-3
lines changed

4 files changed

+66
-3
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Fix detection of the bind_textdomain_codeset function for building gettext
2+
support into the locale module.

configure

Lines changed: 59 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9051,6 +9051,64 @@ $as_echo "#define WITH_LIBINTL 1" >>confdefs.h
90519051
90529052
fi
90539053
9054+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing bind_textdomain_codeset" >&5
9055+
$as_echo_n "checking for library containing bind_textdomain_codeset... " >&6; }
9056+
if ${ac_cv_search_bind_textdomain_codeset+:} false; then :
9057+
$as_echo_n "(cached) " >&6
9058+
else
9059+
ac_func_search_save_LIBS=$LIBS
9060+
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
9061+
/* end confdefs.h. */
9062+
9063+
/* Override any GCC internal prototype to avoid an error.
9064+
Use char because int might match the return type of a GCC
9065+
builtin and then its argument prototype would still apply. */
9066+
#ifdef __cplusplus
9067+
extern "C"
9068+
#endif
9069+
char bind_textdomain_codeset ();
9070+
int
9071+
main ()
9072+
{
9073+
return bind_textdomain_codeset ();
9074+
;
9075+
return 0;
9076+
}
9077+
_ACEOF
9078+
for ac_lib in '' intl; do
9079+
if test -z "$ac_lib"; then
9080+
ac_res="none required"
9081+
else
9082+
ac_res=-l$ac_lib
9083+
LIBS="-l$ac_lib $ac_func_search_save_LIBS"
9084+
fi
9085+
if ac_fn_c_try_link "$LINENO"; then :
9086+
ac_cv_search_bind_textdomain_codeset=$ac_res
9087+
fi
9088+
rm -f core conftest.err conftest.$ac_objext \
9089+
conftest$ac_exeext
9090+
if ${ac_cv_search_bind_textdomain_codeset+:} false; then :
9091+
break
9092+
fi
9093+
done
9094+
if ${ac_cv_search_bind_textdomain_codeset+:} false; then :
9095+
9096+
else
9097+
ac_cv_search_bind_textdomain_codeset=no
9098+
fi
9099+
rm conftest.$ac_ext
9100+
LIBS=$ac_func_search_save_LIBS
9101+
fi
9102+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_bind_textdomain_codeset" >&5
9103+
$as_echo "$ac_cv_search_bind_textdomain_codeset" >&6; }
9104+
ac_res=$ac_cv_search_bind_textdomain_codeset
9105+
if test "$ac_res" != no; then :
9106+
test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
9107+
9108+
$as_echo "#define HAVE_BIND_TEXTDOMAIN_CODESET 1" >>confdefs.h
9109+
9110+
fi
9111+
90549112
90559113
# checks for system dependent C++ extensions support
90569114
case "$ac_sys_system" in
@@ -10588,7 +10646,7 @@ fi
1058810646
$as_echo "MACHDEP_OBJS" >&6; }
1058910647
1059010648
# checks for library functions
10591-
for ac_func in alarm setitimer getitimer bind_textdomain_codeset chown \
10649+
for ac_func in alarm setitimer getitimer chown \
1059210650
clock confstr ctermid execv fchmod fchown fork fpathconf ftime ftruncate \
1059310651
gai_strerror getgroups getlogin getloadavg getpeername getpgid getpid \
1059410652
getentropy \

configure.ac

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2440,6 +2440,9 @@ fi
24402440
AC_CHECK_LIB(intl, textdomain,
24412441
AC_DEFINE(WITH_LIBINTL, 1,
24422442
[Define to 1 if libintl is needed for locale functions.]))
2443+
AC_SEARCH_LIBS(bind_textdomain_codeset, intl,
2444+
AC_DEFINE(HAVE_BIND_TEXTDOMAIN_CODESET, 1,
2445+
[Define to 1 if bind_textdomain_codeset is available.]))
24432446

24442447
# checks for system dependent C++ extensions support
24452448
case "$ac_sys_system" in
@@ -3117,7 +3120,7 @@ fi
31173120
AC_MSG_RESULT(MACHDEP_OBJS)
31183121

31193122
# checks for library functions
3120-
AC_CHECK_FUNCS(alarm setitimer getitimer bind_textdomain_codeset chown \
3123+
AC_CHECK_FUNCS(alarm setitimer getitimer chown \
31213124
clock confstr ctermid execv fchmod fchown fork fpathconf ftime ftruncate \
31223125
gai_strerror getgroups getlogin getloadavg getpeername getpgid getpid \
31233126
getentropy \

pyconfig.h.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373
/* Define if GCC supports __attribute__((format(PyArg_ParseTuple, 2, 3))) */
7474
#undef HAVE_ATTRIBUTE_FORMAT_PARSETUPLE
7575

76-
/* Define to 1 if you have the `bind_textdomain_codeset' function. */
76+
/* Define to 1 if bind_textdomain_codeset is available. */
7777
#undef HAVE_BIND_TEXTDOMAIN_CODESET
7878

7979
/* Define to 1 if you have the <bluetooth/bluetooth.h> header file. */

0 commit comments

Comments
 (0)