Subject: Re: autoconf doesn't find getopt
To: None <tech-pkg@netbsd.org>
From: Martti Kuparinen <martti.kuparinen@iki.fi>
List: tech-pkg
Date: 07/16/2001 13:57:45
Ok, here's the error from config.log:

configure:1657: checking for getopt
configure:1685: cc -o conftest -I/usr/pkgsrc/security/stunnel/work/.buildlink/in
clude -O2 -Wall -I/usr/include -I/usr/pkgsrc/security/stunnel/work/.buildlink/in
clude  -L/usr/pkgsrc/security/stunnel/work/.buildlink/lib  -Wl,-R/usr/pkg/lib -W
l,-R/usr/pkg/lib conftest.c -lwrap  -L/usr/lib -lssl -lcrypto 1>&5
/usr/lib/libwrap.so: undefined reference to `allow_severity'
/usr/lib/libwrap.so: undefined reference to `deny_severity'
collect2: ld returned 1 exit status
configure: failed program was:
#line 1662 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
    which can conflict with char getopt(); below.  */
#include <assert.h>
/* Override any gcc2 internal prototype to avoid an error.  */
/* We use char because int might match the return type of a gcc2
    builtin and then its argument prototype would still apply.  */
char getopt();

int main() {

/* The GNU C library defines this for functions which it implements
    to always fail with ENOSYS.  Some functions are actually named
    something starting with __ and the normal name is an alias.  */
#if defined (__stub_getopt) || defined (__stub___getopt)
choke me
#else
getopt();
#endif

; return 0; }


Without tcp wrapper (--without-tcp-wrappers) functions are found as
normal. From hosts_access(5):

    The  allow_severity  and deny_severity variables determine
    how accepted and rejected requests  may  be  logged.  They
    must  be  provided  by  the  caller and may be modified by
    rules in the access control tables.

This means that configure.in must declare these two variables
or the linking phase fails when libwrap is linked in. What is
the correct method to include those two ints in the following
AC_CHECK_FUNCS statements:

    dnl Checks for library functions.
    AC_CHECK_FUNCS(getopt snprintf vsnprintf openpty _getpty daemon waitpid)

And why don't I need anything special in FreeBSD, i.e. things work
without patching anything? Because I'm running 1.5W?

As a temporary fix I moved the libwrap test aftereverything else...

Martti

---
Martti Kuparinen <martti.kuparinen@iki.fi>
http://www.iki.fi/~kuparine/