[PATCH] Add autoconf test for struct sockaddr_storage.ss_family.

Gerald (Jerry) Carter jerry at samba.org
Mon Oct 22 19:22:29 GMT 2007


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Ignore this one.  Ends up causing problems on OS X.
Sorry.  Should have waited for a complete build before
sending it.




jerry


Gerald (Jerry) Carter wrote:
> AIX 5.2 has sockaddr_storage.ss_family but AIX 5.3 has
> sockaddr_storage.__ss_family.  A complete fix would test
> for a __ss_family field as well and then add the #define as
> necessary.
> ---
>  source/configure.in         |   20 ++++++++++++++++++--
>  source/include/includes.h   |    4 ++++
>  source/include/interfaces.h |    4 ++++
>  3 files changed, 26 insertions(+), 2 deletions(-)
> 
> diff --git a/source/configure.in b/source/configure.in
> index a96e2d9..d9ab2c1 100644
> --- a/source/configure.in
> +++ b/source/configure.in
> @@ -1,4 +1,4 @@
> -dnl Process this file with autoconf to produce a configure script.
> +>dnl Process this file with autoconf to produce a configure script.
>  
>  dnl We must use autotools 2.53 or above
>  AC_PREREQ(2.53)
> @@ -3048,7 +3048,23 @@ freeaddrinfo(ai);
>  ],
>  samba_cv_HAVE_IPV6=yes,samba_cv_HAVE_IPV6=no)])
>  if test x"$samba_cv_HAVE_IPV6" = x"yes"; then
> -    AC_DEFINE(HAVE_IPV6,1,[Whether the system has IPv6 support])
> +   AC_DEFINE(HAVE_IPV6,1,[Whether the system has IPv6 support])
> +
> +   dnl Check for struct sockaddr_storage.ss_family which is 
> +   dnl missing on AIX 5.3
> +   AC_CACHE_CHECK([for sockaddr_storage.ss_familiy support],samba_cv_HAVE_SA_SS_FAMILY,[
> +   AC_TRY_COMPILE([
> +   #include <sys/socket.h>
> +   #include <sys/types.h>
> +   #include <netdb.h>],
> +   [
> +   struct sockaddr_storage sa_store;
> +   sa_store.ss_family = AF_INET6;
> +   ],
> +   samba_cv_HAVE_SA_SS_FAMILY=yes,samba_cv_HAVE_SA_SS_FAMILY=no)])
> +   if test x"$samba_cv_HAVE_SA_SS_FAMILY" = x"yes"; then
> +      AC_DEFINE(HAVE_SA_SS_FAMILY,1,[Whether the system supports struct sockaddr_storage.ss_family])
> +   fi
>  fi
>  
>  ################################################
> diff --git a/source/include/includes.h b/source/include/includes.h
> index 0d51c3d..49e6586 100644
> --- a/source/include/includes.h
> +++ b/source/include/includes.h
> @@ -895,6 +895,10 @@ int setresgid(gid_t rgid, gid_t egid, gid_t sgid);
>  #define MAXHOSTNAMELEN 254
>  #endif
>  
> +#ifndef HAVE_SA_SS_FAMILY
> +#define ss_family   __ss_family
> +#endif
> +
>  /* yuck, I'd like a better way of doing this */
>  #define DIRP_SIZE (256 + 32)
>  
> diff --git a/source/include/interfaces.h b/source/include/interfaces.h
> index 66ea151..a884d25 100644
> --- a/source/include/interfaces.h
> +++ b/source/include/interfaces.h
> @@ -5,6 +5,10 @@
>  
>  #define MAX_INTERFACES 128
>  
> +#ifndef HAVE_SA_SS_FAMILY
> +#define ss_family   __ss_family
> +#endif
> +
>  struct iface_struct {
>  	char name[16];
>  	int flags;


- --
=====================================================================
Samba                                    ------- http://www.samba.org
Centeris                         -----------  http://www.centeris.com
"What man is a man who does not make the world better?"      --Balian
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFHHPh1IR7qMdg1EfYRAq+tAJ9ZZebxuUcRbtf+60I0p3EHls19NACfTa19
4M0JgIsw+DLDGxdg6EWb7+A=
=vTjm
-----END PGP SIGNATURE-----


More information about the samba-technical mailing list