| 1 |
# PR_FUNC_SETGRENT_VOID |
| 2 |
# --------------------- |
| 3 |
# Check whether setgret returns void, and #define SETGRENT_VOID in |
| 4 |
# that case. |
| 5 |
AC_DEFUN([PR_FUNC_SETGRENT_VOID], |
| 6 |
[AC_CACHE_CHECK([whether setgrent returns void], [ac_cv_func_setgrent_void], |
| 7 |
[AC_RUN_IFELSE([ |
| 8 |
#include <sys/types.h> |
| 9 |
#include <grp.h> |
| 10 |
int main(int argc, char *argv[]) { |
| 11 |
int i = 0; |
| 12 |
getgrent(); |
| 13 |
i = setgrent(); |
| 14 |
return (i != 1); |
| 15 |
} |
| 16 |
], |
| 17 |
[ac_cv_func_setgrent_void=no], |
| 18 |
[ac_cv_func_setgrent_void=yes], |
| 19 |
[ac_cv_func_setgrent_void=yes], |
| 20 |
)]) |
| 21 |
|
| 22 |
if test $ac_cv_func_setgrent_void = yes; then |
| 23 |
AC_DEFINE(SETGRENT_VOID, 1, |
| 24 |
[Define to 1 if the `setgrent' function returns void instead of `int'.]) |
| 25 |
fi |
| 26 |
]) |
| 27 |
|
| 28 |
# PR_CHECK_CC_OPT |
| 29 |
# --------------------- |
| 30 |
# Check whether the C compiler accepts the given option |
| 31 |
AC_DEFUN(PR_CHECK_CC_OPT, |
| 32 |
[AC_MSG_CHECKING([whether ${CC-cc} accepts -[$1]]) |
| 33 |
echo 'void f(){}' > conftest.c |
| 34 |
if test -z "`${CC-cc} -c -$1 conftest.c 2>&1`"; then |
| 35 |
AC_MSG_RESULT(yes) |
| 36 |
CFLAGS="$CFLAGS -$1" |
| 37 |
else |
| 38 |
AC_MSG_RESULT(no) |
| 39 |
fi |
| 40 |
rm -fr conftest* |
| 41 |
]) |
| 42 |
|
| 43 |
# PR_CHECK_SS_FAMILY |
| 44 |
# --------------------- |
| 45 |
# Check which member of the struct sockaddr_storage contains the family |
| 46 |
# information |
| 47 |
AC_DEFUN([PR_CHECK_SS_FAMILY], |
| 48 |
[ |
| 49 |
AC_MSG_CHECKING([whether ss_family is defined]) |
| 50 |
AC_TRY_COMPILE([ |
| 51 |
#include <stdio.h> |
| 52 |
#include <unistd.h> |
| 53 |
#include <sys/types.h> |
| 54 |
#include <sys/socket.h> |
| 55 |
], |
| 56 |
[ |
| 57 |
do { |
| 58 |
struct sockaddr_storage a; |
| 59 |
(void) a.ss_family; |
| 60 |
} while(0) |
| 61 |
], |
| 62 |
[ |
| 63 |
AC_MSG_RESULT(yes) |
| 64 |
AC_DEFINE(HAVE_SS_FAMILY, 1, |
| 65 |
[Define if you have sockaddr_storage.ss_family.]) |
| 66 |
], |
| 67 |
[ |
| 68 |
AC_MSG_RESULT(no) |
| 69 |
AC_MSG_CHECKING([whether __ss_family is defined]) |
| 70 |
AC_TRY_COMPILE([ |
| 71 |
#include <stdio.h> |
| 72 |
#include <unistd.h> |
| 73 |
#include <sys/types.h> |
| 74 |
#include <sys/socket.h> |
| 75 |
], |
| 76 |
[ |
| 77 |
do { |
| 78 |
struct sockaddr_storage a; |
| 79 |
(void) a.__ss_family; |
| 80 |
} while(0) |
| 81 |
], |
| 82 |
[ |
| 83 |
AC_MSG_RESULT(yes) |
| 84 |
AC_DEFINE(HAVE___SS_FAMILY, 1, |
| 85 |
[Define if you have sockaddr_store.__ss_family.]) |
| 86 |
], |
| 87 |
[ |
| 88 |
AC_MSG_RESULT(no) |
| 89 |
]) |
| 90 |
]) |
| 91 |
]) |
| 92 |
|
| 93 |
# PR_CHECK_STRUCT_ADDRINFO |
| 94 |
# --------------------- |
| 95 |
# Check whether the system has a struct addrinfo defined |
| 96 |
AC_DEFUN([PR_CHECK_STRUCT_ADDRINFO], |
| 97 |
[AC_MSG_CHECKING([whether struct addrinfo is defined]) |
| 98 |
AC_TRY_COMPILE( |
| 99 |
[ #include <stdio.h> |
| 100 |
#ifdef HAVE_UNISTD_H |
| 101 |
# include <unistd.h> |
| 102 |
#endif |
| 103 |
#include <sys/types.h> |
| 104 |
#include <sys/socket.h> |
| 105 |
#include <netdb.h> |
| 106 |
], |
| 107 |
[do { |
| 108 |
struct addrinfo a; |
| 109 |
(void) a.ai_flags; |
| 110 |
} while(0) |
| 111 |
], |
| 112 |
[AC_MSG_RESULT(yes) |
| 113 |
AC_DEFINE(HAVE_STRUCT_ADDRINFO, 1, |
| 114 |
[Define if you have struct addrinfo]) |
| 115 |
], |
| 116 |
[AC_MSG_RESULT(no) |
| 117 |
]) |
| 118 |
]) |
| 119 |
|
| 120 |
# PR_CHECK_STRUCT_SS |
| 121 |
# --------------------- |
| 122 |
# Check whether the system has a struct sockaddr_storage defined |
| 123 |
AC_DEFUN([PR_CHECK_STRUCT_SS], |
| 124 |
[AC_MSG_CHECKING([whether struct sockaddr_storage is defined]) |
| 125 |
AC_TRY_COMPILE( |
| 126 |
[ #include <stdio.h> |
| 127 |
#ifdef HAVE_UNISTD_H |
| 128 |
# include <unistd.h> |
| 129 |
#endif |
| 130 |
#include <sys/types.h> |
| 131 |
#include <sys/socket.h> |
| 132 |
#include <netdb.h> |
| 133 |
], |
| 134 |
[do { |
| 135 |
struct sockaddr_storage ss; |
| 136 |
} while(0) |
| 137 |
], |
| 138 |
[AC_MSG_RESULT(yes) |
| 139 |
AC_DEFINE(HAVE_STRUCT_SS, 1, [Define if you have struct sockaddr_storage]) |
| 140 |
], |
| 141 |
[AC_MSG_RESULT(no) |
| 142 |
]) |
| 143 |
]) |
| 144 |
|
| 145 |
# PR_CHECK_SS_LEN |
| 146 |
# --------------------- |
| 147 |
# Check which member of the struct sockaddr_storage contains the length |
| 148 |
# information |
| 149 |
AC_DEFUN([PR_CHECK_SS_LEN], |
| 150 |
[ |
| 151 |
AC_MSG_CHECKING([whether ss_len is defined]) |
| 152 |
AC_TRY_COMPILE([ |
| 153 |
#include <stdio.h> |
| 154 |
#include <unistd.h> |
| 155 |
#include <sys/types.h> |
| 156 |
#include <sys/socket.h> |
| 157 |
], |
| 158 |
[ |
| 159 |
do { |
| 160 |
struct sockaddr_storage a; |
| 161 |
(void) a.ss_len; |
| 162 |
} while(0) |
| 163 |
], |
| 164 |
[ |
| 165 |
AC_MSG_RESULT(yes) |
| 166 |
AC_DEFINE(HAVE_SS_LEN, 1, |
| 167 |
[Define if you have sockaddr_storage.ss_len.]) |
| 168 |
], |
| 169 |
[ |
| 170 |
AC_MSG_RESULT(no) |
| 171 |
AC_MSG_CHECKING([whether __ss_len is defined]) |
| 172 |
AC_TRY_COMPILE([ |
| 173 |
#include <stdio.h> |
| 174 |
#include <unistd.h> |
| 175 |
#include <sys/types.h> |
| 176 |
#include <sys/socket.h> |
| 177 |
], |
| 178 |
[ |
| 179 |
do { |
| 180 |
struct sockaddr_storage a; |
| 181 |
(void) a.__ss_len; |
| 182 |
} while(0) |
| 183 |
], |
| 184 |
[ |
| 185 |
AC_MSG_RESULT(yes) |
| 186 |
AC_DEFINE(HAVE___SS_LEN, 1, |
| 187 |
[Define if you have sockaddr_storage.__ss_len.]) |
| 188 |
], |
| 189 |
[ |
| 190 |
AC_MSG_RESULT(no) |
| 191 |
]) |
| 192 |
]) |
| 193 |
]) |
| 194 |
|