Skip to content

Commit

Permalink
bpo-45847: Port nis module to PY_STDLIB_MOD (GH-29699)
Browse files Browse the repository at this point in the history
  • Loading branch information
tiran authored Nov 22, 2021
1 parent 7fd92a8 commit c6dec7e
Show file tree
Hide file tree
Showing 5 changed files with 350 additions and 44 deletions.
5 changes: 4 additions & 1 deletion Modules/Setup.stdlib.in
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
@MODULE__QUEUE_TRUE@_queue _queuemodule.c
@MODULE__RANDOM_TRUE@_random _randommodule.c
@MODULE__TYPING_TRUE@_typing _typingmodule.c
@MODULE__XXSUBINTERPRETERS_TRUE@_xxsubinterpreters __xxsubinterpretersmodule.c
@MODULE__XXSUBINTERPRETERS_TRUE@_xxsubinterpreters _xxsubinterpretersmodule.c
@MODULE__ZONEINFO_TRUE@_zoneinfo _zoneinfo.c

# needs libm
Expand Down 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
317 changes: 317 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,274 @@ 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=
save_CFLAGS=$CFLAGS
save_CPPFLAGS=$CPPFLAGS
save_LDFLAGS=$LDFLAGS
save_LIBS=$LIBS


{ $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


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


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=
save_CFLAGS=$CFLAGS
save_CPPFLAGS=$CPPFLAGS
save_LDFLAGS=$LDFLAGS
save_LIBS=$LIBS


{ $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


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


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 +21345,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 +22100,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
Loading

0 comments on commit c6dec7e

Please sign in to comment.