1AC_DEFUN([_ONMS_FIND_IP_HEADERS], [ 2 if test -z "$_ONMS_TESTED_IP_HEADERS"; then 3 AC_CHECK_HEADERS([sys/types.h sys/socket.h netinet/in.h netinet/in_systm.h netinet/ip.h netinet/ip_icmp.h netinet/icmp6.h winsock2.h ws2tcpip.h win32/icmp.h], [], [], [ 4 #ifdef HAVE_SYS_TYPES_H 5 #include <sys/types.h> 6 #endif 7 8 #ifdef HAVE_SYS_SOCKET_H 9 #include <sys/socket.h> 10 #endif 11 12 #ifdef HAVE_WINSOCK2_H 13 #include <winsock2.h> 14 #endif 15 16 #ifdef HAVE_WINSOCK2_H 17 #include <winsock2.h> 18 #endif 19 20 #ifdef HAVE_WS2TCPIP_H 21 #include <ws2tcpip.h> 22 #endif 23 24 #ifdef HAVE_NETINET_IN_H 25 #include <netinet/in.h> 26 #endif 27 28 #ifdef HAVE_NETINET_IN_SYSTM_H 29 #include <netinet/in_systm.h> 30 #endif 31 32 #ifdef HAVE_NETINET_IP_H 33 #include <netinet/ip.h> 34 #endif 35 36 #ifdef HAVE_NETINET_IP_ICMP_H 37 #include <netinet/ip_icmp.h> 38 #endif 39]) 40 _ONMS_TESTED_IP_HEADERS=yes 41 fi 42]) 43 44AC_DEFUN([_ONMS_TRY_COMPILE], [ 45 _ONMS_FIND_IP_HEADERS 46 AC_TRY_COMPILE( 47 [ 48 #ifdef HAVE_SYS_TYPES_H 49 #include <sys/types.h> 50 #endif 51 52 #ifdef HAVE_SYS_SOCKET_H 53 #include <sys/socket.h> 54 #endif 55 56 #ifdef HAVE_NETINET_IN_H 57 #include <netinet/in.h> 58 #endif 59 60 #ifdef HAVE_NETINET_IN_SYSTM_H 61 #include <netinet/in_systm.h> 62 #endif 63 64 #ifdef HAVE_NETINET_IP_H 65 #include <netinet/ip.h> 66 #endif 67 68 #ifdef HAVE_NETINET_IP_ICMP_H 69 #include <netinet/ip_icmp.h> 70 #endif 71 72 #ifdef HAVE_WINSOCK2_H 73 #include <winsock2.h> 74 #endif 75 76 #ifdef HAVE_WS2TCPIP_H 77 #include <ws2tcpip.h> 78 #endif 79 80 #ifdef __WIN32__ 81 #ifdef HAVE_WIN32_ICMP_H 82 #include "win32/icmp.h" 83 #endif 84 #endif 85 86 $1 87 ], 88 [ $2 ], 89 [ $3 ], 90 [ $4 ] 91 ) 92 ] 93) 94 95dnl check for a struct based on the first argument 96AC_DEFUN([ONMS_CHECK_IP_STRUCT], 97 [ 98 _ONMS_FIND_IP_HEADERS 99 AC_CHECK_TYPE( 100 [struct $1], 101 [ 102 AC_DEFINE( 103 AS_TR_CPP([HAVE_STRUCT_$1]), 104 [1], 105 [struct $1 needed for IP headers] 106 ) 107 ], 108 [], 109 [ 110 #ifdef HAVE_SYS_TYPES_H 111 #include <sys/types.h> 112 #endif 113 114 #ifdef HAVE_SYS_SOCKET_H 115 #include <sys/socket.h> 116 #endif 117 118 #ifdef HAVE_NETINET_IN_H 119 #include <netinet/in.h> 120 #endif 121 122 #ifdef HAVE_NETINET_IN_SYSTM_H 123 #include <netinet/in_systm.h> 124 #endif 125 126 #ifdef HAVE_NETINET_IP_H 127 #include <netinet/ip.h> 128 #endif 129 130 #ifdef HAVE_NETINET_IP_ICMP_H 131 #include <netinet/ip_icmp.h> 132 #endif 133 134 #ifdef HAVE_WINSOCK2_H 135 #include <winsock2.h> 136 #endif 137 138 #ifdef HAVE_WS2TCPIP_H 139 #include <ws2tcpip.h> 140 #endif 141 142 #ifdef __WIN32__ 143 #ifdef HAVE_WIN32_ICMP_H 144 #include "win32/icmp.h" 145 #endif 146 #endif 147 148 $2 149 ] 150 ) 151 ] 152) 153 154dnl check for an entry in the IP struct 155AC_DEFUN([ONMS_CHECK_IP_STRUCT_ENTRY], 156 [ 157 AC_MSG_CHECKING([for ip->$2]) 158 _ONMS_TRY_COMPILE( 159 [], 160 [ 161 #if defined(HAVE_STRUCT_IP) 162 struct ip ip; 163 #elif defined(HAVE_STRUCT_IPHDR) 164 struct iphdr ip; 165 #endif 166 167 ip.$2 = 0; 168 ], 169 [ 170 AC_DEFINE( 171 AS_TR_CPP([ONMS_IP_$1]), 172 [$2], 173 [the $2 entry in the IP struct] 174 ) 175 AC_MSG_RESULT(yes) 176 ], 177 AC_MSG_RESULT(no) 178 ) 179 ] 180) 181 182dnl check for an entry in the ICMP struct 183AC_DEFUN([ONMS_CHECK_ICMP_STRUCT_ENTRY], 184 [ 185 AC_MSG_CHECKING([for icmp->$2]) 186 _ONMS_TRY_COMPILE( 187 [], 188 [ 189 #if defined(HAVE_STRUCT_ICMP) 190 struct icmp icmp; 191 #elif defined(HAVE_STRUCT_ICMPHDR) 192 struct icmphdr icmp; 193 #endif 194 195 icmp.$2 = 0; 196 ], 197 [ 198 AC_DEFINE( 199 AS_TR_CPP([ICMP_$1]), 200 [$2], 201 [the $2 entry in the ICMP struct] 202 ) 203 AC_MSG_RESULT(yes) 204 ], 205 AC_MSG_RESULT(no) 206 ) 207 ] 208) 209