1 dnl ### A macro to find the include directory, useful for cross-compiling.
2 AC_DEFUN(AC_INCLUDEDIR,
3 [AC_REQUIRE([AC_PROG_AWK])dnl
5 AC_MSG_CHECKING(for primary include directory)
6 includedir=/usr/include
11 $CC -v -E conftest.c 2>&1 | $AWK '
12 /^End of search list/ { print last; exit }
17 if test -n "$new_includedir" && test -d "$new_includedir"
19 includedir=$new_includedir
22 AC_MSG_RESULT($includedir)
25 dnl ### A macro to automatically set different CC and HOSTCC if using gcc.
26 define(AC_PROG_HOSTCC,
33 # Find out if gcc groks our host.
38 test "x$i" = "x$last" && continue
41 AC_MSG_CHECKING([for working $CC])
58 dnl ### A macro to set gcc warning flags.
61 if test -z "$WARNFLAGS"
65 # If we're using gcc we want warning flags.
71 dnl ### A macro to determine if procfs is pollable.
72 AC_DEFUN(AC_POLLABLE_PROCFS,
73 [AC_MSG_CHECKING(for pollable procfs)
74 AC_CACHE_VAL(ac_cv_pollable_procfs,
78 #include <sys/procfs.h>
79 #include <sys/stropts.h>
89 if ((pid = fork()) == 0) {
93 sprintf(proc, "/proc/%d", pid);
94 if ((pfp = fopen(proc, "r+")) == NULL)
96 if (ioctl(fileno(pfp), PIOCSTOP, NULL) < 0)
100 if (poll(&pfd, 1, 0) < 0)
102 if (!(pfd.revents & POLLPRI))
111 ac_cv_pollable_procfs=yes,
112 ac_cv_pollable_procfs=no,
117 ac_cv_pollable_procfs=yes
120 ac_cv_pollable_procfs=no
124 AC_MSG_RESULT($ac_cv_pollable_procfs)
125 if test "$ac_cv_pollable_procfs" = yes
127 AC_DEFINE(HAVE_POLLABLE_PROCFS)
131 dnl ### A macro to determine if the prstatus structure has a pr_syscall member.
132 AC_DEFUN(AC_STRUCT_PR_SYSCALL,
133 [AC_MSG_CHECKING(for pr_syscall in struct prstatus)
134 AC_CACHE_VAL(ac_cv_struct_pr_syscall,
135 [AC_TRY_COMPILE([#include <sys/procfs.h>],
136 [struct prstatus s; s.pr_syscall;],
137 ac_cv_struct_pr_syscall=yes,
138 ac_cv_struct_pr_syscall=no)])
139 AC_MSG_RESULT($ac_cv_struct_pr_syscall)
140 if test "$ac_cv_struct_pr_syscall" = yes
142 AC_DEFINE(HAVE_PR_SYSCALL)
146 dnl ### A macro to detect the presence of the sig_atomic_t in signal.h
147 AC_DEFUN(AC_SIG_ATOMIC_T,
148 [AC_MSG_CHECKING(for sig_atomic_t in signal.h)
149 AC_CACHE_VAL(ac_cv_sig_atomic_t,
150 [AC_TRY_COMPILE([#include <signal.h>],
152 ac_cv_sig_atomic_t=yes,
153 ac_cv_sig_atomic_t=no)])
154 AC_MSG_RESULT($ac_cv_sig_atomic_t)
155 if test "$ac_cv_sig_atomic_t" = yes
157 AC_DEFINE(HAVE_SIG_ATOMIC_T)
161 dnl ### A macro to determine if sys_errlist is declared.
162 AC_DEFUN(AC_DECL_SYS_ERRLIST,
163 [AC_MSG_CHECKING([for sys_errlist declaration])
164 AC_CACHE_VAL(ac_cv_decl_sys_errlist,
165 [AC_TRY_COMPILE([#include <sys/types.h>
168 /* Somebody might declare sys_errlist in unistd.h. */
171 #endif], [char *msg = *(sys_errlist + 1);],
172 ac_cv_decl_sys_errlist=yes, ac_cv_decl_sys_errlist=no)])dnl
173 AC_MSG_RESULT($ac_cv_decl_sys_errlist)
174 if test $ac_cv_decl_sys_errlist = yes; then
175 AC_DEFINE(SYS_ERRLIST_DECLARED)
179 dnl ### A macro to determine if _sys_siglist is declared.
180 AC_DEFUN(AC_DECL__SYS_SIGLIST,
181 [AC_MSG_CHECKING([for _sys_siglist declaration])
182 AC_CACHE_VAL(ac_cv_decl__sys_siglist,
183 [AC_TRY_COMPILE([#include <sys/types.h>
185 /* Somebody might declare _sys_siglist in unistd.h. */
188 #endif], [char *msg = *(_sys_siglist + 1);],
189 ac_cv_decl__sys_siglist=yes, ac_cv_decl__sys_siglist=no)])dnl
190 AC_MSG_RESULT($ac_cv_decl__sys_siglist)
191 if test $ac_cv_decl__sys_siglist = yes; then
192 AC_DEFINE(SYS_SIGLIST_DECLARED)
196 dnl ### A macro to determine if the msghdr structure has a msg_control member.
197 AC_DEFUN(AC_STRUCT_MSG_CONTROL,
198 [AC_MSG_CHECKING(for msg_control in struct msghdr)
199 AC_CACHE_VAL(ac_cv_struct_msg_control,
200 [AC_TRY_COMPILE([#include <sys/types.h>
201 #include <sys/socket.h>],
203 struct msghdr m; m.msg_control;],
204 ac_cv_struct_msg_control=yes,
205 ac_cv_struct_msg_control=no)])
206 AC_MSG_RESULT($ac_cv_struct_msg_control)
207 if test "$ac_cv_struct_msg_control" = yes
209 AC_DEFINE(HAVE_MSG_CONTROL)