Subject: building a package -- question about the configure stage
To: None <pkgsrc-users@netbsd.org>
From: Jan Danielsson <jan.m.danielsson@gmail.com>
List: pkgsrc-users
Date: 05/28/2007 07:17:43
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

Hello all,

   I'm trying to build a package for pigdin, and need some help
understanding the build system. Again.

   I get an error while compiling nat-pmp.c. The error indicates that
some macros are not available:

- -------------------
In file included from /usr/include/sys/sysctl.h:44,
                 from nat-pmp.c:42:
/usr/include/sys/ucred.h:49: error: `NGROUPS' undeclared here (not in a
function)
/usr/include/sys/ucred.h:59: error: `NGROUPS' undeclared here (not in a
function)
In file included from /usr/include/sys/sysctl.h:46,
                 from nat-pmp.c:42:
/usr/include/sys/proc.h:66: error: `MAXLOGNAME' undeclared here (not in
a function)
/usr/include/sys/proc.h:243: error: `MAXCOMLEN' undeclared here (not in
a function)
In file included from nat-pmp.c:42:
/usr/include/sys/sysctl.h:402: error: `MAXLOGNAME' undeclared here (not
in a function)
gmake[4]: *** [nat-pmp.lo] Error 1
- -------------------

   As far as I can gather, sys/ucred.h requires some values which are
available in sys/param.h, but it doesn't actually include it(?). I
checked nat-pmp.c, and found this:

- --------
#ifdef HAVE_SYS_SYSCTL_H
#include <sys/sysctl.h>
#endif
- --------

   Correct me if I'm wrong, but the HAVE_SYS_SYSCTRL_H is something
which is defined in the Makefile, through the automake/autoconf tools?

   Without actually understanding what I am doing, I searched around and
found this:

- --------
AC_CHECK_HEADERS(sys/sysctl.h sys/socket.h)
- --------

   .. in configure.ac. My thought was that perhaps I can add
sys/param.h, like so:

- --------
AC_CHECK_HEADERS(sys/sysctl.h sys/socket.h sys/param.h)
- --------

   Then I add a section:

- --------
#ifdef HAVE_SYS_PARAM_H
#include <sys/param.h>
#endif
- --------

   ..to nat-pmp.c, prior to the #include <sys/sysctl.h> causing the
compilation error.

   Am I correct in my assumptions so far?

   Assuming this is correct, my next guess is that my change to
configure.ac will never do any good, because the configure merely *runs*
the configure script, without actually generating it from the
configure.ac file. So, what I need to do is make sure that the configure
script is regenerated from the configure.ac file. (Please stop me if I'm
completely wrong here).

   Ergo, I need to run autoconf. The pkgsrc Guide stipulates that I need
to do something like this:

- --------
USE_TOOLS+=     autoconf

...

pre-configure:
      cd ${WRKSRC}; autoconf
- --------

   How are my guesses, so far? Please clear up any misconceptions.

- --
Kind regards,
Jan Danielsson

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (NetBSD)

iD8DBQFGWmX3uPlHKFfKXTYRCuenAJ9ACd5GMhYap9tFAF5mN3Kd9Inf6wCbBiTq
KuDHrwQuu61n9o2Ytt/MNoc=
=NKXL
-----END PGP SIGNATURE-----