tech-pkg archive

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

Re: Optionally make compat socklen_t default to int in bootstrap?



On Tue, Apr 19, 2016 at 03:56:42AM +0000, David Holland wrote:
> But whatever, that was twenty years ago. And the right thing to do is
> probe it in the configure script.

The compile test itself is simple, but I guess we need to wrap it inside
a test wether -Wall -Werror works.

The fragment below gives "1" on NetBSD and "0" on SunOS.

Martin


CFLAGS="$CFLAGS -Wall -Werror"
AC_MSG_CHECKING([wether third argument of getsockname is unsigned])
 nb_cv_sockarg_unsigned=no
 AC_TRY_COMPILE([
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <unistd.h>
#include <sys/types.h>
],[
  unsigned int l;
  getsockname(0, 0, &l);
],
 nb_cv_sockarg_unsigned=1)
 if test "$nb_cv_sockarg_unsigned" = no; then
 AC_TRY_COMPILE([
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <unistd.h>
#include <sys/types.h>
],[
  int l;
  getsockname(0, 0, &l);
],
 nb_cv_sockarg_unsigned=0)
 fi
 AC_DEFINE_UNQUOTED(NB_SOCKARG_UNSIGNED, $nb_cv_sockarg_unsigned,
                    [Define wether getsockname() third argument is unsigned])
 AC_MSG_RESULT([$nb_cv_sockarg_unsigned])



Home | Main Index | Thread Index | Old Index