tech-pkg archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Fixing lang/python311 by splitting off NIS module (Re: using pkg-config modules from host (Re: wip/py-numpy + blas))



Am Wed, 27 Dec 2023 13:47:50 -0500
schrieb Greg Troxel <gdt%lexort.com@localhost>:

> Why isn't that all "if linux"?

1. Probably because this is just my local hack while I was busy with
   elsethings.

2. Because it mirrors what the configure script does. Or at least
   enough to make it work for me. There is no check for Linux. And
   also, this is a details of glibc, not Linux. But I guess we don't
   care about systems where that difference matters (Debian/kFreeBSD,
   Linux with musl)?

I am not fully correct on point 2, anyhow. This is the respective logic
from configure.ac:


dnl libnsl dependencies include tirpc includes and lib
PKG_CHECK_MODULES([LIBNSL], [libnsl], [have_nis=yes], [
  LIBNSL_CFLAGS=${LIBNSL_CFLAGS-""}
  WITH_SAVE_ENV([
    AC_SEARCH_LIBS([yp_match], [nsl], [have_nis=yes], [have_nis=no])
  ])
  AS_CASE([$ac_cv_search_yp_match],
    [no], [libnsl=""],
    ["none required"], [libnsl=""],
    [libnsl="$ac_cv_search_yp_match"]
  )
  LIBNSL_LIBS=${LIBNSL_LIBS-$libnsl}
])

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


PY_STDLIB_MOD([nis],
  [], [test "$have_nis" = yes -a "$ac_cv_header_rpc_rpc_h" = yes],
  [$LIBNSL_CFLAGS], [$LIBNSL_LIBS])



So:

if HAVE_LIBNSL_PC
  have_nis=yes
else
  if search_lib libnsl with symbol yp_match
    have_nis=yes
    libnsl=libname_if_necessary
    if empty LIBNSL_LIBS
      LIBNSL_LIBS=$libnsl
    fi
  endif
endif

if have_nis
  check_header rpc/rpc.h with LIBNSL_CFLAGS
endif


if have_nis and found_header rpc/rpc.h
  enable_module nis
fi


It looks for libnsl using pkg-config, but failing that, _should_ find
it using AC_SEARCH_LIBS. Then, with the same CFLAGS, rpc/rpc.h is
supposed to be located.

It should work without pkg-config files. Now, there does it fail? It
does not find rpc/rpc.h. It would find tirpc/rpc/rpc.h. We could put
that into LIBNSL_CFLAGS. Or patch configure to search for the latter.
When the Makefile logic is made a bit more specific, we can detect if
rpc/rpc.h or tirpc/rpc.h is needed. The same issue covers usage of
libnsl headers with or without subdirectory.

Btw., my libnsl module indeed does specify the header prefix for
libtirpc. Weird, but that's what makes this configure code work.

$ pkg-config --cflags libnsl
-I/usr/include/tirpc

The same is returned for the libtirpc module. Here.

Well. Here is a smaller patch that is more correct:

Index: Makefile
===================================================================
RCS file: /cvsroot/pkgsrc/lang/python311/Makefile,v
retrieving revision 1.22
diff -u -r1.22 Makefile
--- Makefile	11 Dec 2023 10:23:42 -0000	1.22
+++ Makefile	27 Dec 2023 20:16:50 -0000
@@ -111,10 +111,16 @@
 PLIST.dbm=	yes
 .endif
 .for incdir in ${_OPSYS_INCLUDE_DIRS}
-.  if (exists(${incdir}/rpc/rpc.h) || exists(${incdir}/tirpc/rpc/rpc.h))
+.  if exists(${incdir}/rpc/rpc.h)
+HAVE_RPC_H=	yes
+.  elif exists(${incdir}/tirpc/rpc/rpc.h)
+CPPFLAGS+=	-I${incdir}/tirpc
 HAVE_RPC_H=	yes
 .  endif
-.  if (exists(${incdir}/rpcsvc/yp_prot.h) || exists(${incdir}/nsl/rpcsvc/yp_prot.h))
+.  if exists(${incdir}/rpcsvc/yp_prot.h)
+HAVE_YP_PROT_H=	yes
+.  elif exists(${incdir}/nsl/rpcsvc/yp_prot.h)
+CPPFLAGS+=	-I${incdir}/nsl
 HAVE_YP_PROT_H=	yes
 .  endif
 .endfor


Would that be good? I used CPPFLAGS instead of CFLAGS since configure
nags that compiler and preprocessor differ in finding the header
otherwise. It's more correct, anyway (although other include flags are
put into CFLAGS in the Makefile).


Alrighty then,

Thomas

-- 
Dr. Thomas Orgis
HPC @ Universität Hamburg


Home | Main Index | Thread Index | Old Index