pkgsrc-Users archive

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

Re: building a package -- question about the configure stage



Jan Danielsson wrote:

> - --------
> #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?

Those HAVE_* macros typically reside in the file config.h, created by
the configure script from config.h.in. I bet nat-pmp.c contains a line

  #include "config.h"

at the start of the file.

>    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.

Correct, but you also need to add

  #undef HAVE_SYS_PARAM_H

to config.h.in if doesn't contain this line already. I _think_ running
"autoheader" (see below) will do this for you.

Personally, I would put the check for HAVE_SYS_PARAM_H _inside_ the
check for HAVE_SYS_SYSCTL_H. That's where your problem occurs now.

>    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).

Correct.

>    Ergo, I need to run autoconf. The pkgsrc Guide stipulates that I need
> to do something like this:
> 
> - --------
> USE_TOOLS+=     autoconf
...
>    How are my guesses, so far? Please clear up any misconceptions.

Good reasoning skills, I would say :-)

Actually, the package does not really _depend_ on autoconf and company.
If everything had worked ok, you would not need to have autoconf
installed on your machine, so why should any other user of your finished
package?
Thus, the package for pkgsrc should not depend on autoconf because this
generation of "configure" from "configure.ac" needs to happen only once,
on your machine.
The software already provides a mostly working "configure" script,
all you have to do is provide patches for configure.ac (to be sent
upstream when your package is completely finished and their correct
working is verified), config.h.in and configure.
As soon as a new release of the software appears, the (hopefully)
integrated patch for configure.ac makes the three patches in pkgsrc
obsolete.

You install autoconf yourself, change configure.ac, run

  $ aclocal
  $ autoheader
  $ autoconf

inside WRKSRC yourself and put the differences between
config.h.in.orig/config.h.in, configure.ac.orig/configure.ac and
configure.orig/configure in your package directory "patches".

If you like, you can also take the opportunity to read some more about
autoconf in the info pages supplied by the autoconf package.

  $ info Autoconf

Typing 'q' quits the info program, '?' shows the available keys for
navigation.

ciao
     Klaus



Home | Main Index | Thread Index | Old Index