Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
bpo-45847: Port nis module to PY_STDLIB_MOD_SIMPLE
Signed-off-by: Christian Heimes <[email protected]>
  • Loading branch information
tiran committed Nov 22, 2021
commit d592dd9f9e46938a4577f5fefd2dbbbee39b78d7
3 changes: 3 additions & 0 deletions Modules/Setup.stdlib.in
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,9 @@
@MODULE_FCNTL_TRUE@fcntl fcntlmodule.c
@MODULE_GRP_TRUE@grp grpmodule.c
@MODULE_MMAP_TRUE@mmap mmapmodule.c
# FreeBSD: nis/yp APIs are in libc
# Linux: glibc has deprecated SUN RPC, APIs are in libnsl and libtirpc (bpo-32521)
@MODULE_NIS_TRUE@nis nismodule.c
# needs sys/soundcard.h or linux/soundcard.h (Linux, FreeBSD)
@MODULE_OSSAUDIODEV_TRUE@ossaudiodev ossaudiodev.c
@MODULE_RESOURCE_TRUE@resource resource.c
Expand Down
291 changes: 291 additions & 0 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -648,6 +648,8 @@ MODULE_ZLIB_FALSE
MODULE_ZLIB_TRUE
MODULE__SQLITE3_FALSE
MODULE__SQLITE3_TRUE
MODULE_NIS_FALSE
MODULE_NIS_TRUE
MODULE__DECIMAL_FALSE
MODULE__DECIMAL_TRUE
MODULE__BLAKE2_FALSE
Expand Down Expand Up @@ -787,6 +789,8 @@ TCLTK_LIBS
TCLTK_INCLUDES
LIBSQLITE3_LIBS
LIBSQLITE3_CFLAGS
LIBNSL_LIBS
LIBNSL_CFLAGS
LIBMPDEC_INTERNAL
LIBMPDEC_LDFLAGS
LIBMPDEC_CFLAGS
Expand Down Expand Up @@ -1014,6 +1018,8 @@ LIBS
CPPFLAGS
CPP
PROFILE_TASK
LIBNSL_CFLAGS
LIBNSL_LIBS
LIBSQLITE3_CFLAGS
LIBSQLITE3_LIBS
ZLIB_CFLAGS
Expand Down Expand Up @@ -1795,6 +1801,9 @@ Some influential environment variables:
CPP C preprocessor
PROFILE_TASK
Python args for PGO generation task
LIBNSL_CFLAGS
C compiler flags for LIBNSL, overriding pkg-config
LIBNSL_LIBS linker flags for LIBNSL, overriding pkg-config
LIBSQLITE3_CFLAGS
C compiler flags for LIBSQLITE3, overriding pkg-config
LIBSQLITE3_LIBS
Expand Down Expand Up @@ -11071,6 +11080,248 @@ if test "$have_glibc_memmove_bug" = yes; then
fi



pkg_failed=no
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for LIBNSL" >&5
$as_echo_n "checking for LIBNSL... " >&6; }

if test -n "$LIBNSL_CFLAGS"; then
pkg_cv_LIBNSL_CFLAGS="$LIBNSL_CFLAGS"
elif test -n "$PKG_CONFIG"; then
if test -n "$PKG_CONFIG" && \
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libnsl\""; } >&5
($PKG_CONFIG --exists --print-errors "libnsl") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
pkg_cv_LIBNSL_CFLAGS=`$PKG_CONFIG --cflags "libnsl" 2>/dev/null`
test "x$?" != "x0" && pkg_failed=yes
else
pkg_failed=yes
fi
else
pkg_failed=untried
fi
if test -n "$LIBNSL_LIBS"; then
pkg_cv_LIBNSL_LIBS="$LIBNSL_LIBS"
elif test -n "$PKG_CONFIG"; then
if test -n "$PKG_CONFIG" && \
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libnsl\""; } >&5
($PKG_CONFIG --exists --print-errors "libnsl") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
pkg_cv_LIBNSL_LIBS=`$PKG_CONFIG --libs "libnsl" 2>/dev/null`
test "x$?" != "x0" && pkg_failed=yes
else
pkg_failed=yes
fi
else
pkg_failed=untried
fi



if test $pkg_failed = yes; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }

if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
_pkg_short_errors_supported=yes
else
_pkg_short_errors_supported=no
fi
if test $_pkg_short_errors_supported = yes; then
LIBNSL_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libnsl" 2>&1`
else
LIBNSL_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libnsl" 2>&1`
fi
# Put the nasty error message in config.log where it belongs
echo "$LIBNSL_PKG_ERRORS" >&5


LIBNSL_CFLAGS=
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing yp_match" >&5
$as_echo_n "checking for library containing yp_match... " >&6; }
if ${ac_cv_search_yp_match+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_func_search_save_LIBS=$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 yp_match ();
int
main ()
{
return yp_match ();
;
return 0;
}
_ACEOF
for ac_lib in '' nsl; do
if test -z "$ac_lib"; then
ac_res="none required"
else
ac_res=-l$ac_lib
LIBS="-l$ac_lib $ac_func_search_save_LIBS"
fi
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_search_yp_match=$ac_res
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext
if ${ac_cv_search_yp_match+:} false; then :
break
fi
done
if ${ac_cv_search_yp_match+:} false; then :

else
ac_cv_search_yp_match=no
fi
rm conftest.$ac_ext
LIBS=$ac_func_search_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_yp_match" >&5
$as_echo "$ac_cv_search_yp_match" >&6; }
ac_res=$ac_cv_search_yp_match
if test "$ac_res" != no; then :
test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
have_nis=yes
else
have_nis=no
fi

case $ac_cv_search_yp_match in #(
no) :
LIBNSL_LIBS= ;; #(
"none required") :
LIBNSL_LIBS= ;; #(
*) :
LIBNSL_LIBS=$ac_cv_search_yp_match
;;
esac

elif test $pkg_failed = untried; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }

LIBNSL_CFLAGS=
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing yp_match" >&5
$as_echo_n "checking for library containing yp_match... " >&6; }
if ${ac_cv_search_yp_match+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_func_search_save_LIBS=$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 yp_match ();
int
main ()
{
return yp_match ();
;
return 0;
}
_ACEOF
for ac_lib in '' nsl; do
if test -z "$ac_lib"; then
ac_res="none required"
else
ac_res=-l$ac_lib
LIBS="-l$ac_lib $ac_func_search_save_LIBS"
fi
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_search_yp_match=$ac_res
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext
if ${ac_cv_search_yp_match+:} false; then :
break
fi
done
if ${ac_cv_search_yp_match+:} false; then :

else
ac_cv_search_yp_match=no
fi
rm conftest.$ac_ext
LIBS=$ac_func_search_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_yp_match" >&5
$as_echo "$ac_cv_search_yp_match" >&6; }
ac_res=$ac_cv_search_yp_match
if test "$ac_res" != no; then :
test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
have_nis=yes
else
have_nis=no
fi

case $ac_cv_search_yp_match in #(
no) :
LIBNSL_LIBS= ;; #(
"none required") :
LIBNSL_LIBS= ;; #(
*) :
LIBNSL_LIBS=$ac_cv_search_yp_match
;;
esac

else
LIBNSL_CFLAGS=$pkg_cv_LIBNSL_CFLAGS
LIBNSL_LIBS=$pkg_cv_LIBNSL_LIBS
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
have_nis=yes
fi

if test "x$have_nis" = xyes; then :

save_CFLAGS=$CFLAGS
save_CPPFLAGS=$CPPFLAGS
save_LDFLAGS=$LDFLAGS
save_LIBS=$LIBS


CPPFLAGS="$LIBNSL_CFLAGS $CFLAGS"
for ac_header in rpc/rpc.h
do :
ac_fn_c_check_header_mongrel "$LINENO" "rpc/rpc.h" "ac_cv_header_rpc_rpc_h" "$ac_includes_default"
if test "x$ac_cv_header_rpc_rpc_h" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_RPC_RPC_H 1
_ACEOF

fi

done


CFLAGS=$save_CFLAGS
CPPFLAGS=$save_CPPFLAGS
LDFLAGS=$save_LDFLAGS
LIBS=$save_LIBS



fi


pkg_failed=no
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for LIBSQLITE3" >&5
$as_echo_n "checking for LIBSQLITE3... " >&6; }
Expand Down Expand Up @@ -21068,6 +21319,42 @@ fi
$as_echo "$py_cv_module__decimal" >&6; }


{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for stdlib extension module nis" >&5
$as_echo_n "checking for stdlib extension module nis... " >&6; }
case $py_stdlib_not_available in #(
*nis*) :
py_cv_module_nis=n/a ;; #(
*) :
if true; then :
if test "$have_nis" = yes -a "$ac_cv_header_rpc_rpc_h" = yes; then :
py_cv_module_nis=yes
else
py_cv_module_nis=missing
fi
else
py_cv_module_nis=disabled
fi
;;
esac
as_fn_append MODULE_BLOCK "MODULE_NIS=$py_cv_module_nis$as_nl"
if test "x$py_cv_module_nis" = xyes; then :

as_fn_append MODULE_BLOCK "MODULE_NIS_CFLAGS=$LIBNSL_CFLAGS$as_nl"
as_fn_append MODULE_BLOCK "MODULE_NIS_LDFLAGS=$LIBNSL_LIBS$as_nl"

fi
if test "$py_cv_module_nis" = yes; then
MODULE_NIS_TRUE=
MODULE_NIS_FALSE='#'
else
MODULE_NIS_TRUE='#'
MODULE_NIS_FALSE=
fi

{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $py_cv_module_nis" >&5
$as_echo "$py_cv_module_nis" >&6; }


{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for stdlib extension module _sqlite3" >&5
$as_echo_n "checking for stdlib extension module _sqlite3... " >&6; }
case $py_stdlib_not_available in #(
Expand Down Expand Up @@ -21787,6 +22074,10 @@ if test -z "${MODULE__DECIMAL_TRUE}" && test -z "${MODULE__DECIMAL_FALSE}"; then
as_fn_error $? "conditional \"MODULE__DECIMAL\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
if test -z "${MODULE_NIS_TRUE}" && test -z "${MODULE_NIS_FALSE}"; then
as_fn_error $? "conditional \"MODULE_NIS\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
if test -z "${MODULE__SQLITE3_TRUE}" && test -z "${MODULE__SQLITE3_FALSE}"; then
as_fn_error $? "conditional \"MODULE__SQLITE3\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
Expand Down
23 changes: 23 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -3191,6 +3191,26 @@ if test "$have_glibc_memmove_bug" = yes; then
AS_VAR_APPEND([LIBMPDEC_CFLAGS], [" -U_FORTIFY_SOURCE"])
fi


dnl check for NIS / libnsl dependencies
dnl libnsl dependencies include tirpc includes and lib
PKG_CHECK_MODULES([LIBNSL], [libnsl], [have_nis=yes], [
LIBNSL_CFLAGS=
AC_SEARCH_LIBS([yp_match], [nsl], [have_nis=yes], [have_nis=no])
AS_CASE([$ac_cv_search_yp_match],
[no], [LIBNSL_LIBS=],
["none required"], [LIBNSL_LIBS=],
[LIBNSL_LIBS=$ac_cv_search_yp_match]
)
])

AS_VAR_IF([have_nis], [yes], [
WITH_SAVE_ENV([
CPPFLAGS="$LIBNSL_CFLAGS $CFLAGS"
AC_CHECK_HEADERS([rpc/rpc.h])
])
])

dnl Check for SQLite library. Use pkg-config if available.
PKG_CHECK_MODULES(
[LIBSQLITE3], [sqlite3 >= 3.7.15], [], [
Expand Down Expand Up @@ -6166,6 +6186,9 @@ PY_STDLIB_MOD([_sha3], [test "$with_builtin_sha3" = yes])
PY_STDLIB_MOD([_blake2], [test "$with_builtin_blake2" = yes])

PY_STDLIB_MOD([_decimal], [], [], [$LIBMPDEC_CFLAGS], [$LIBMPDEC_LDFLAGS])
PY_STDLIB_MOD([nis],
[], [test "$have_nis" = yes -a "$ac_cv_header_rpc_rpc_h" = yes],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AFAICS, header check for rpc/rpc.h is missing.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's right there:

AS_VAR_IF([have_nis], [yes], [
  WITH_SAVE_ENV([
    CPPFLAGS="$LIBNSL_CFLAGS $CFLAGS"
    AC_CHECK_HEADERS([rpc/rpc.h])
  ])
])

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤦🏻

[$LIBNSL_CFLAGS], [$LIBNSL_LIBS])
PY_STDLIB_MOD([_sqlite3],
[test "$have_sqlite3" = "yes"],
[test "$have_supported_sqlite3" = "yes"],
Expand Down
3 changes: 3 additions & 0 deletions pyconfig.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -896,6 +896,9 @@
/* Define if you have readline 4.0 */
#undef HAVE_RL_RESIZE_TERMINAL

/* Define to 1 if you have the <rpc/rpc.h> header file. */
#undef HAVE_RPC_RPC_H

/* Define to 1 if you have the `rtpSpawn' function. */
#undef HAVE_RTPSPAWN

Expand Down
Loading