Commit 89405b14 authored by William Gropp's avatar William Gropp
Browse files

[svn-r4096] Added _ALL_SOURCE as option for struct ifconf; needed for AIX

parent d25616b9
......@@ -29,6 +29,14 @@ static int dbg_ifname = 0;
#define _SVID_SOURCE
#endif
#ifdef USE_ALL_SOURCE_FOR_IFCONF
/* This is a very special case. Allow the use of some extensions for just
the rest of this file so that we can get the ifconf structure
This is needed for AIX.
*/
#define _ALL_SOURCE
#endif
#include "tcp_impl.h"
#include <sys/types.h>
......
......@@ -99,13 +99,10 @@ AC_ARG_WITH(ch3-rank-bits, [--with-ch3-rank-bits=16/32 Number of bits alloca
[ rankbits=$withval ],
[ rankbits=16 ])
AC_MSG_RESULT($rankbits)
if test "$rankbits" = "16" ; then
AC_DEFINE(CH3_RANK_BITS,16,[Define the number of CH3_RANK_BITS])
elif test "$rankbits" = "32" ; then
AC_DEFINE(CH3_RANK_BITS,32,[Define the number of CH3_RANK_BITS])
else
if test "$rankbits" != "16" -a "$rankbits" != "32" ; then
AC_MSG_ERROR(Only 16 or 32-bit ranks are supported)
fi
AC_DEFINE_UNQUOTED(CH3_RANK_BITS,$rankbits,[Define the number of CH3_RANK_BITS])
AC_CHECK_HEADERS(assert.h limits.h string.h sys/types.h sys/uio.h uuid/uuid.h \
time.h ctype.h unistd.h arpa/inet.h sys/socket.h net/if.h)
......@@ -141,6 +138,14 @@ fi
AC_C_BIGENDIAN
# If we need the socket code, see if we can use struct ifconf
# Some systems require special compile options or definitions, or
# special header files.
#
# To simplify this sequence of tests, we set
# pac_found_struct_ifconf
# to yes when we figure out how to get struct ifconf
pac_found_struct_ifconf=no
#
# sys/socket.h is needed on Solaris
AC_CACHE_CHECK([whether we can use struct ifconf],
pac_cv_have_struct_ifconf,[
......@@ -151,9 +156,10 @@ AC_TRY_COMPILE([
#endif
#include <net/if.h>
],[struct ifconf conftest;],
pac_cv_have_struct_ifconf=yes,pac_cv_have_struct_ifconf=no)])
[pac_cv_have_struct_ifconf=yes;pac_found_struct_ifconf=yes],
pac_cv_have_struct_ifconf=no)])
if test "$pac_cv_have_struct_ifconf" = "no" ; then
if test "$pac_found_struct_ifconf" = "no" ; then
# Try again with _SVID_SOURCE
AC_CACHE_CHECK([whether we can use struct ifconf with _SVID_SOURCE],
pac_cv_have_struct_ifconf_with_svid,[
......@@ -165,15 +171,14 @@ AC_TRY_COMPILE([
#endif
#include <net/if.h>
],[struct ifconf conftest;],
pac_cv_have_struct_ifconf_with_svid=yes,
pac_cv_have_struct_ifconf_with_svid=yes;pac_found_struct_ifconf=yes,
pac_cv_have_struct_ifconf_with_svid=no)])
if test "$pac_cv_have_struct_ifconf_with_svid" = yes ; then
AC_DEFINE(USE_SVIDSOURCE_FOR_IFCONF,1,[Define if _SVID_SOURCE needs to be defined for struct ifconf])
fi
fi
if test "$pac_cv_have_struct_ifconf" = "no" -a \
"$pac_cv_have_struct_ifconf_with_svid" = "no" ; then
if test "$pac_found_struct_ifconf" = "no" ; then
# Try again with undef _POSIX_C_SOURCE
AC_CACHE_CHECK([whether we can use struct ifconf without _POSIX_C_SOURCE],
pac_cv_have_struct_ifconf_without_posix,[
......@@ -185,16 +190,33 @@ AC_TRY_COMPILE([
#endif
#include <net/if.h>
],[struct ifconf conftest;],
pac_cv_have_struct_ifconf_without_posix=yes,
pac_cv_have_struct_ifconf_without_posix=yes;pac_found_struct_ifconf=yes,
pac_cv_have_struct_ifconf_without_posix=no)])
if test "$pac_cv_have_struct_ifconf_without_posix" = yes ; then
AC_DEFINE(USE_NOPOSIX_FOR_IFCONF,1,[Define if _POSIX_C_SOURCE needs to be undefined for struct ifconf])
fi
fi
if test "$pac_cv_have_struct_ifconf" = "yes" -o \
"$pac_cv_have_struct_ifconf_with_svid" = "yes" -o \
"$pac_cv_have_struct_ifconf_without_posix" ; then
if test "$pac_found_struct_ifconf" = "no" ; then
# Try again with _ALL_SOURCE
AC_CACHE_CHECK([whether we can use struct ifconf with _ALL_SOURCE],
pac_cv_have_struct_ifconf_with_svid,[
AC_TRY_COMPILE([
#define _ALL_SOURCE
#include <sys/types.h>
#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
#include <net/if.h>
],[struct ifconf conftest;],
pac_cv_have_struct_ifconf_with_all_source=yes;pac_found_struct_ifconf=yes,
pac_cv_have_struct_ifconf_with_all_source=no)])
if test "$pac_cv_have_struct_ifconf_with_all_source" = yes ; then
AC_DEFINE(USE_ALL_SOURCE_FOR_IFCONF,1,[Define if _ALL_SOURCE needs to be defined for struct ifconf])
fi
fi
if test "$pac_found_struct_ifconf" = "yes" ; then
AC_DEFINE(HAVE_STRUCT_IFCONF,1,[Define if struct ifconf can be used])
fi
#
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment