0
|
1 # This mimics ac_func_accept_argtypes.m4
|
|
2
|
|
3 check_include_files(sys/types.h HAVE_SYS_TYPES_H)
|
|
4 check_include_files(sys/socket.h HAVE_SYS_SOCKET_H)
|
|
5
|
|
6 if(HAVE_SYS_TYPES_H)
|
|
7 set(INCLUDE_SYS_TYPES_H "#include <sys/types.h>")
|
|
8 endif(HAVE_SYS_TYPES_H)
|
|
9
|
|
10 if(HAVE_SYS_SOCKET_H)
|
|
11 set(INCLUDE_SYS_SOCKET_H "#include <sys/socket.h>")
|
|
12 endif(HAVE_SYS_SOCKET_H)
|
|
13
|
|
14 message(STATUS "Looking for accept function args")
|
|
15 set(CMAKE_REQUIRED_QUIET 1)
|
|
16 foreach(ac_cv_func_accept_return "int" "unsigned int PASCAL" "SOCKET WSAAPI")
|
|
17 foreach(ac_cv_func_accept_arg1 "int" "unsigned int" "SOCKET")
|
|
18 foreach(ac_cv_func_accept_arg2 "struct sockaddr *" "const struct sockaddr *" "void *")
|
|
19 foreach(ac_cv_func_accept_arg3 "int" "size_t" "socklen_t" "unsigned int" "void")
|
|
20 unset(AC_FUNC_ACCEPT CACHE)
|
|
21 CHECK_C_SOURCE_COMPILES("
|
|
22 ${INCLUDE_SYS_TYPES_H}
|
|
23 ${INCLUDE_SYS_SOCKET_H}
|
|
24 extern ${ac_cv_func_accept_return} accept (${ac_cv_func_accept_arg1}, ${ac_cv_func_accept_arg2}, ${ac_cv_func_accept_arg3} *);
|
|
25 int main(void)
|
|
26 {
|
|
27 return 0;
|
|
28 }
|
|
29 " AC_FUNC_ACCEPT)
|
|
30 if(AC_FUNC_ACCEPT)
|
|
31 set(ACCEPT_TYPE_RETURN ${ac_cv_func_accept_return})
|
|
32 set(ACCEPT_TYPE_ARG1 ${ac_cv_func_accept_arg1})
|
|
33 set(ACCEPT_TYPE_ARG2 ${ac_cv_func_accept_arg2})
|
|
34 set(ACCEPT_TYPE_ARG3 ${ac_cv_func_accept_arg3})
|
|
35 break()
|
|
36 endif(AC_FUNC_ACCEPT)
|
|
37 endforeach(ac_cv_func_accept_arg3)
|
|
38 if(AC_FUNC_ACCEPT)
|
|
39 break()
|
|
40 endif(AC_FUNC_ACCEPT)
|
|
41 endforeach(ac_cv_func_accept_arg2)
|
|
42 if(AC_FUNC_ACCEPT)
|
|
43 break()
|
|
44 endif(AC_FUNC_ACCEPT)
|
|
45 endforeach(ac_cv_func_accept_arg1)
|
|
46 if(AC_FUNC_ACCEPT)
|
|
47 break()
|
|
48 endif(AC_FUNC_ACCEPT)
|
|
49 endforeach(ac_cv_func_accept_return)
|
|
50 unset(CMAKE_REQUIRED_QUIET)
|
|
51
|
|
52 if(NOT AC_FUNC_ACCEPT)
|
|
53 message(ERROR "could not determine argument types")
|
|
54 endif(NOT AC_FUNC_ACCEPT)
|
|
55 if(ac_cv_func_accept_arg3 EQUAL "void")
|
|
56 set(ac_cv_func_accept_arg3 "int")
|
|
57 endif(ac_cv_func_accept_arg3 EQUAL "void")
|
|
58
|
|
59 message(STATUS "Looking for accept function args - found ${ACCEPT_TYPE_RETURN}, ${ACCEPT_TYPE_ARG1}, ${ACCEPT_TYPE_ARG2}, ${ACCEPT_TYPE_ARG3} *")
|