1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123
|
# -*- autoconf -*-
#########################################
##
# Checks for types
##
#########################################
##
# Standard checks:
##
# Checks for typedefs, structures, and compiler characteristics.
AC_TYPE_OFF_T
AC_TYPE_PID_T
AC_HEADER_TIME
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([],
[int x __attribute__((deprecated))])],
[attr="__attribute__((deprecated))"],
[attr="/**/"])
AC_DEFINE_UNQUOTED([NETSNMP_ATTRIBUTE_DEPRECATED], [${attr}],
[Used to make the compiler issue a warning about deprecated functions and variables])
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([],
[int x __attribute__((unused))])],
[attr="__attribute__((unused))"],
[attr="/**/"])
AC_DEFINE_UNQUOTED([NETSNMP_ATTRIBUTE_UNUSED], [${attr}],
[Used to suppress compiler warnings about unused functions and variables])
##
# More complex checks:
##
# Check for 'socklen_t', 'in_addr_t' and 'ssize_t'.
#
AC_CHECK_TYPES([socklen_t, in_addr_t, ssize_t],,,[
#if defined(HAVE_WINSOCK2_H) && defined(HAVE_WS2TCPIP_H)
#include <winsock2.h>
#include <ws2tcpip.h>
#endif
#include <stdlib.h>
#include <stddef.h>
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif])
if test "x$ac_cv_type_in_addr_t" != xyes; then
AC_DEFINE([in_addr_t], [unsigned long],
[in_addr_t definition if not defined in <netinet/in.h>. Must match the type of sockaddr_in::sin_addr])
fi
#
# Check for the type of the fifth argument of select()
#
netsnmp_save_CFLAGS=$CFLAGS
CFLAGS="$CFLAGS -Werror"
AC_MSG_CHECKING([for the type of the fifth argument of select()])
arg_type="struct timeval"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [])], [
# The compiler supports -Werror.
for t in "struct timeval" "struct __ms_timeval"; do
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([
#if defined(HAVE_WINSOCK2_H) && defined(HAVE_WS2TCPIP_H)
#include <winsock2.h>
#include <ws2tcpip.h>
#else
#ifdef HAVE_SYS_SELECT_H
#include <sys/select.h>
#endif
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
#endif
#endif
#include <stddef.h>
], [return select(0, NULL, NULL, NULL, ($t *)NULL)])],
[arg_type=$t; break])
done
], [
: # The compiler does not support -Werror.
])
AC_MSG_RESULT(${arg_type})
AC_DEFINE_UNQUOTED([NETSNMP_SELECT_TIMEVAL], [${arg_type}],
[Type of the fifth argument of select()])
AC_MSG_CHECKING([for the type of the third argument of ioctlsocket()])
arg_type=unknown
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [])], [
# The compiler supports -Werror.
for t in "unsigned int" "unsigned long"; do
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([
#if defined(HAVE_WINSOCK2_H) && defined(HAVE_WS2TCPIP_H)
#include <winsock2.h>
#include <ws2tcpip.h>
#else
#ifdef HAVE_SYS_SELECT_H
#include <sys/select.h>
#endif
#endif
#include <stddef.h>
], [return ioctlsocket(0, 0, ($t *)NULL)])],
[arg_type=$t; break])
done
], [
: # The compiler does not support -Werror.
])
AC_MSG_RESULT(${arg_type})
AC_DEFINE_UNQUOTED([NETSNMP_IOCTLSOCKET_ARG], [${arg_type}],
[Type of the third argument of ioctlsocket()])
CFLAGS=$netsnmp_save_CFLAGS
|