| Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 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 |
| 4 | AC_SUBST(includedir) |
| 5 | AC_MSG_CHECKING(for primary include directory) |
| 6 | includedir=/usr/include |
| 7 | if test -n "$GCC" |
| 8 | then |
| 9 | >conftest.c |
| 10 | new_includedir=` |
| 11 | $CC -v -E conftest.c 2>&1 | $AWK ' |
| 12 | /^End of search list/ { print last; exit } |
| 13 | { last = [$]1 } |
| 14 | ' |
| 15 | ` |
| 16 | rm -f conftest.c |
| 17 | if test -n "$new_includedir" && test -d "$new_includedir" |
| 18 | then |
| 19 | includedir=$new_includedir |
| 20 | fi |
| 21 | fi |
| 22 | AC_MSG_RESULT($includedir) |
| 23 | ]) |
| 24 | |
| 25 | dnl ### A macro to automatically set different CC and HOSTCC if using gcc. |
| 26 | define(AC_PROG_HOSTCC, |
| 27 | [AC_SUBST(HOSTCC)dnl |
| 28 | if test -z "$HOSTCC" |
| 29 | then |
| 30 | HOSTCC="$CC" |
| 31 | if test -n "$GCC" |
| 32 | then |
| 33 | # Find out if gcc groks our host. |
| 34 | worked= |
| 35 | last= |
| 36 | for i in $1 |
| 37 | do |
| 38 | test "x$i" = "x$last" && continue |
| 39 | last="$i" |
| 40 | CC="$HOSTCC -b $i" |
| 41 | AC_MSG_CHECKING([for working $CC]) |
| 42 | AC_TRY_LINK(,, |
| 43 | worked=1 |
| 44 | break |
| 45 | ) |
| 46 | AC_MSG_RESULT(no) |
| 47 | done |
| 48 | if test -z "$worked" |
| 49 | then |
| 50 | CC="$HOSTCC" |
| 51 | else |
| 52 | AC_MSG_RESULT(yes) |
| 53 | fi |
| 54 | fi |
| 55 | fi |
| 56 | ]) |
| 57 | |
| 58 | dnl ### A macro to set gcc warning flags. |
| 59 | define(AC_WARNFLAGS, |
| 60 | [AC_SUBST(WARNFLAGS) |
| 61 | if test -z "$WARNFLAGS" |
| 62 | then |
| 63 | if test -n "$GCC" |
| 64 | then |
| 65 | # If we're using gcc we want warning flags. |
| 66 | WARNFLAGS=-Wall |
| 67 | fi |
| 68 | fi |
| 69 | ]) |
| 70 | |
| Wichert Akkerman | ea78f0f | 1999-11-29 15:34:02 +0000 | [diff] [blame] | 71 | dnl ### A macro to determine if we have a "MP" type procfs |
| 72 | AC_DEFUN(AC_MP_PROCFS, |
| 73 | [AC_MSG_CHECKING(for MP procfs) |
| 74 | AC_CACHE_VAL(ac_cv_mp_procfs, |
| 75 | [AC_TRY_RUN([ |
| 76 | #include <stdio.h> |
| 77 | #include <signal.h> |
| 78 | #include <sys/procfs.h> |
| 79 | |
| 80 | main() |
| 81 | { |
| 82 | int pid; |
| 83 | char proc[32]; |
| 84 | FILE *ctl; |
| 85 | FILE *status; |
| 86 | int cmd; |
| 87 | struct pstatus pstatus; |
| 88 | |
| 89 | if ((pid = fork()) == 0) { |
| 90 | pause(); |
| 91 | exit(0); |
| 92 | } |
| 93 | sprintf(proc, "/proc/%d/ctl", pid); |
| 94 | if ((ctl = fopen(proc, "w")) == NULL) |
| 95 | goto fail; |
| 96 | sprintf(proc, "/proc/%d/status", pid); |
| 97 | if ((status = fopen (proc, "r")) == NULL) |
| 98 | goto fail; |
| 99 | cmd = PCSTOP; |
| 100 | if (write (fileno (ctl), &cmd, sizeof cmd) < 0) |
| 101 | goto fail; |
| 102 | if (read (fileno (status), &pstatus, sizeof pstatus) < 0) |
| 103 | goto fail; |
| 104 | kill(pid, SIGKILL); |
| 105 | exit(0); |
| 106 | fail: |
| 107 | kill(pid, SIGKILL); |
| 108 | exit(1); |
| 109 | } |
| 110 | ], |
| 111 | ac_cv_mp_procfs=yes, |
| 112 | ac_cv_mp_procfs=no, |
| 113 | [ |
| 114 | # Guess or punt. |
| 115 | case "$host_os" in |
| 116 | svr4.2*|svr5*) |
| 117 | ac_cv_mp_procfs=yes |
| 118 | ;; |
| 119 | *) |
| 120 | ac_cv_mp_procfs=no |
| 121 | ;; |
| 122 | esac |
| 123 | ])]) |
| 124 | AC_MSG_RESULT($ac_cv_mp_procfs) |
| 125 | if test "$ac_cv_mp_procfs" = yes |
| 126 | then |
| 127 | AC_DEFINE(HAVE_MP_PROCFS) |
| 128 | fi |
| 129 | ]) |
| 130 | |
| Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 131 | dnl ### A macro to determine if procfs is pollable. |
| 132 | AC_DEFUN(AC_POLLABLE_PROCFS, |
| 133 | [AC_MSG_CHECKING(for pollable procfs) |
| 134 | AC_CACHE_VAL(ac_cv_pollable_procfs, |
| 135 | [AC_TRY_RUN([ |
| 136 | #include <stdio.h> |
| 137 | #include <signal.h> |
| 138 | #include <sys/procfs.h> |
| 139 | #include <sys/stropts.h> |
| 140 | #include <poll.h> |
| 141 | |
| Wichert Akkerman | ea78f0f | 1999-11-29 15:34:02 +0000 | [diff] [blame] | 142 | #ifdef HAVE_MP_PROCFS |
| 143 | #define PIOCSTOP PCSTOP |
| 144 | #define POLLWANT POLLWRNORM |
| 145 | #define PROC "/proc/%d/ctl" |
| 146 | #define PROC_MODE "w" |
| 147 | int IOCTL (int fd, int cmd, int arg) { |
| 148 | return write (fd, &cmd, sizeof cmd); |
| 149 | } |
| 150 | #else |
| 151 | #define POLLWANT POLLPRI |
| 152 | #define PROC "/proc/%d" |
| 153 | #define PROC_MODE "r+" |
| 154 | #define IOCTL ioctl |
| 155 | #endif |
| 156 | |
| Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 157 | main() |
| 158 | { |
| 159 | int pid; |
| 160 | char proc[32]; |
| 161 | FILE *pfp; |
| 162 | struct pollfd pfd; |
| 163 | |
| 164 | if ((pid = fork()) == 0) { |
| 165 | pause(); |
| 166 | exit(0); |
| 167 | } |
| Wichert Akkerman | ea78f0f | 1999-11-29 15:34:02 +0000 | [diff] [blame] | 168 | sprintf(proc, PROC, pid); |
| 169 | if ((pfp = fopen(proc, PROC_MODE)) == NULL) |
| Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 170 | goto fail; |
| Wichert Akkerman | ea78f0f | 1999-11-29 15:34:02 +0000 | [diff] [blame] | 171 | if (IOCTL(fileno(pfp), PIOCSTOP, NULL) < 0) |
| Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 172 | goto fail; |
| 173 | pfd.fd = fileno(pfp); |
| Wichert Akkerman | ea78f0f | 1999-11-29 15:34:02 +0000 | [diff] [blame] | 174 | pfd.events = POLLWANT; |
| Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 175 | if (poll(&pfd, 1, 0) < 0) |
| 176 | goto fail; |
| Wichert Akkerman | ea78f0f | 1999-11-29 15:34:02 +0000 | [diff] [blame] | 177 | if (!(pfd.revents & POLLWANT)) |
| Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 178 | goto fail; |
| 179 | kill(pid, SIGKILL); |
| 180 | exit(0); |
| 181 | fail: |
| 182 | kill(pid, SIGKILL); |
| 183 | exit(1); |
| 184 | } |
| 185 | ], |
| 186 | ac_cv_pollable_procfs=yes, |
| 187 | ac_cv_pollable_procfs=no, |
| 188 | [ |
| 189 | # Guess or punt. |
| 190 | case "$host_os" in |
| Wichert Akkerman | ea78f0f | 1999-11-29 15:34:02 +0000 | [diff] [blame] | 191 | solaris2*|irix5*|svr4.2uw*|svr5*) |
| Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 192 | ac_cv_pollable_procfs=yes |
| 193 | ;; |
| 194 | *) |
| 195 | ac_cv_pollable_procfs=no |
| 196 | ;; |
| 197 | esac |
| 198 | ])]) |
| 199 | AC_MSG_RESULT($ac_cv_pollable_procfs) |
| 200 | if test "$ac_cv_pollable_procfs" = yes |
| 201 | then |
| 202 | AC_DEFINE(HAVE_POLLABLE_PROCFS) |
| 203 | fi |
| 204 | ]) |
| 205 | |
| 206 | dnl ### A macro to determine if the prstatus structure has a pr_syscall member. |
| 207 | AC_DEFUN(AC_STRUCT_PR_SYSCALL, |
| 208 | [AC_MSG_CHECKING(for pr_syscall in struct prstatus) |
| 209 | AC_CACHE_VAL(ac_cv_struct_pr_syscall, |
| 210 | [AC_TRY_COMPILE([#include <sys/procfs.h>], |
| John Hughes | 2529971 | 2001-03-06 10:10:06 +0000 | [diff] [blame] | 211 | [#ifdef HAVE_MP_PROCFS |
| 212 | pstatus_t s; |
| 213 | s.pr_lwp.pr_syscall |
| 214 | #else |
| 215 | prstatus_t s; |
| 216 | s.pr_syscall |
| 217 | #endif], |
| Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 218 | ac_cv_struct_pr_syscall=yes, |
| 219 | ac_cv_struct_pr_syscall=no)]) |
| 220 | AC_MSG_RESULT($ac_cv_struct_pr_syscall) |
| 221 | if test "$ac_cv_struct_pr_syscall" = yes |
| 222 | then |
| 223 | AC_DEFINE(HAVE_PR_SYSCALL) |
| 224 | fi |
| 225 | ]) |
| 226 | |
| 227 | dnl ### A macro to detect the presence of the sig_atomic_t in signal.h |
| 228 | AC_DEFUN(AC_SIG_ATOMIC_T, |
| 229 | [AC_MSG_CHECKING(for sig_atomic_t in signal.h) |
| 230 | AC_CACHE_VAL(ac_cv_sig_atomic_t, |
| 231 | [AC_TRY_COMPILE([#include <signal.h>], |
| 232 | [sig_atomic_t x;], |
| 233 | ac_cv_sig_atomic_t=yes, |
| 234 | ac_cv_sig_atomic_t=no)]) |
| 235 | AC_MSG_RESULT($ac_cv_sig_atomic_t) |
| 236 | if test "$ac_cv_sig_atomic_t" = yes |
| 237 | then |
| 238 | AC_DEFINE(HAVE_SIG_ATOMIC_T) |
| 239 | fi |
| 240 | ]) |
| 241 | |
| John Hughes | 5826589 | 2001-10-18 15:13:53 +0000 | [diff] [blame] | 242 | dnl ### A macro to detect the presence of the siginfo_t in signal.h |
| 243 | AC_DEFUN(AC_SIGINFO_T, |
| 244 | [AC_MSG_CHECKING(for siginfo_t in signal.h) |
| 245 | AC_CACHE_VAL(ac_cv_siginfo_t, |
| 246 | [AC_TRY_COMPILE([#include <signal.h>], |
| 247 | [siginfo_t x;], |
| 248 | ac_cv_siginfo_t=yes, |
| 249 | ac_cv_siginfo_t=no)]) |
| 250 | AC_MSG_RESULT($ac_cv_siginfo_t) |
| 251 | if test "$ac_cv_siginfo_t" = yes |
| 252 | then |
| 253 | AC_DEFINE(HAVE_SIGINFO_T) |
| 254 | fi |
| 255 | ]) |
| 256 | |
| Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 257 | dnl ### A macro to determine if sys_errlist is declared. |
| 258 | AC_DEFUN(AC_DECL_SYS_ERRLIST, |
| 259 | [AC_MSG_CHECKING([for sys_errlist declaration]) |
| 260 | AC_CACHE_VAL(ac_cv_decl_sys_errlist, |
| 261 | [AC_TRY_COMPILE([#include <sys/types.h> |
| 262 | #include <errno.h> |
| 263 | #include <stdio.h> |
| 264 | /* Somebody might declare sys_errlist in unistd.h. */ |
| 265 | #ifdef HAVE_UNISTD_H |
| 266 | #include <unistd.h> |
| 267 | #endif], [char *msg = *(sys_errlist + 1);], |
| 268 | ac_cv_decl_sys_errlist=yes, ac_cv_decl_sys_errlist=no)])dnl |
| 269 | AC_MSG_RESULT($ac_cv_decl_sys_errlist) |
| 270 | if test $ac_cv_decl_sys_errlist = yes; then |
| 271 | AC_DEFINE(SYS_ERRLIST_DECLARED) |
| 272 | fi |
| 273 | ]) |
| 274 | |
| 275 | dnl ### A macro to determine if _sys_siglist is declared. |
| 276 | AC_DEFUN(AC_DECL__SYS_SIGLIST, |
| 277 | [AC_MSG_CHECKING([for _sys_siglist declaration]) |
| 278 | AC_CACHE_VAL(ac_cv_decl__sys_siglist, |
| 279 | [AC_TRY_COMPILE([#include <sys/types.h> |
| 280 | #include <signal.h> |
| 281 | /* Somebody might declare _sys_siglist in unistd.h. */ |
| 282 | #ifdef HAVE_UNISTD_H |
| 283 | #include <unistd.h> |
| 284 | #endif], [char *msg = *(_sys_siglist + 1);], |
| 285 | ac_cv_decl__sys_siglist=yes, ac_cv_decl__sys_siglist=no)])dnl |
| 286 | AC_MSG_RESULT($ac_cv_decl__sys_siglist) |
| 287 | if test $ac_cv_decl__sys_siglist = yes; then |
| 288 | AC_DEFINE(SYS_SIGLIST_DECLARED) |
| 289 | fi |
| 290 | ]) |
| 291 | |
| 292 | dnl ### A macro to determine if the msghdr structure has a msg_control member. |
| 293 | AC_DEFUN(AC_STRUCT_MSG_CONTROL, |
| 294 | [AC_MSG_CHECKING(for msg_control in struct msghdr) |
| 295 | AC_CACHE_VAL(ac_cv_struct_msg_control, |
| 296 | [AC_TRY_COMPILE([#include <sys/types.h> |
| 297 | #include <sys/socket.h>], |
| 298 | [#undef msg_control |
| 299 | struct msghdr m; m.msg_control;], |
| 300 | ac_cv_struct_msg_control=yes, |
| 301 | ac_cv_struct_msg_control=no)]) |
| 302 | AC_MSG_RESULT($ac_cv_struct_msg_control) |
| 303 | if test "$ac_cv_struct_msg_control" = yes |
| 304 | then |
| 305 | AC_DEFINE(HAVE_MSG_CONTROL) |
| 306 | fi |
| 307 | ]) |
| Ulrich Drepper | b8601b0 | 1999-12-24 08:02:15 +0000 | [diff] [blame] | 308 | |
| 309 | dnl ### A macro to determine whether stat64 is defined. |
| 310 | AC_DEFUN(AC_STAT64, |
| John Hughes | 8fe2c98 | 2001-03-06 09:45:18 +0000 | [diff] [blame] | 311 | [AC_MSG_CHECKING(for stat64 in (asm|sys)/stat.h) |
| Ulrich Drepper | b8601b0 | 1999-12-24 08:02:15 +0000 | [diff] [blame] | 312 | AC_CACHE_VAL(ac_cv_type_stat64, |
| John Hughes | 8fe2c98 | 2001-03-06 09:45:18 +0000 | [diff] [blame] | 313 | [AC_TRY_COMPILE([#ifdef linux |
| 314 | #include <asm/stat.h> |
| 315 | #else |
| 316 | #include <sys/stat.h> |
| 317 | #endif], |
| Ulrich Drepper | b8601b0 | 1999-12-24 08:02:15 +0000 | [diff] [blame] | 318 | [struct stat64 st;], |
| 319 | ac_cv_type_stat64=yes, |
| Wichert Akkerman | 5597f89 | 2000-01-27 00:41:54 +0000 | [diff] [blame] | 320 | ac_cv_type_stat64=no)]) |
| Ulrich Drepper | b8601b0 | 1999-12-24 08:02:15 +0000 | [diff] [blame] | 321 | AC_MSG_RESULT($ac_cv_type_stat64) |
| 322 | if test "$ac_cv_type_stat64" = yes |
| 323 | then |
| 324 | AC_DEFINE(HAVE_STAT64) |
| 325 | fi |
| 326 | ]) |
| Wichert Akkerman | 16a03d2 | 2000-08-10 02:14:04 +0000 | [diff] [blame] | 327 | |
| 328 | dnl ### A macro to determine whether we have long long |
| 329 | AC_DEFUN(AC_LONG_LONG, |
| 330 | [AC_MSG_CHECKING(for long long) |
| 331 | AC_CACHE_VAL(ac_cv_type_long_long, |
| 332 | [AC_TRY_COMPILE([], |
| 333 | [long long x = 20;], |
| 334 | ac_cv_type_long_long=yes, |
| 335 | ac_cv_type_long_long=no)]) |
| 336 | AC_MSG_RESULT($ac_cv_type_long_long) |
| 337 | if test "$ac_cv_type_long_long" = yes |
| 338 | then |
| 339 | AC_DEFINE(HAVE_LONG_LONG) |
| 340 | fi |
| 341 | ]) |
| Wichert Akkerman | f185065 | 2001-02-16 20:29:03 +0000 | [diff] [blame] | 342 | |
| John Hughes | 70623be | 2001-03-08 13:59:00 +0000 | [diff] [blame] | 343 | dnl ### A macro to determine if off_t is a long long |
| 344 | AC_DEFUN(AC_OFF_T_IS_LONG_LONG, |
| 345 | [AC_MSG_CHECKING(for long long off_t) |
| 346 | AC_CACHE_VAL(ac_cv_have_long_long_off_t, |
| 347 | [AC_TRY_RUN([#include <sys/types.h> |
| 348 | main () { |
| 349 | if (sizeof (off_t) == sizeof (long long) && |
| 350 | sizeof (off_t) > sizeof (long)) |
| 351 | return 0; |
| 352 | return 1; |
| 353 | } |
| 354 | ], |
| 355 | ac_cv_have_long_long_off_t=yes, |
| 356 | ac_cv_have_long_long_off_t=no, |
| 357 | [# Should try to guess here |
| 358 | ac_cv_have_long_long_off_t=no |
| 359 | ])]) |
| 360 | AC_MSG_RESULT($ac_cv_have_long_long_off_t) |
| 361 | if test "$ac_cv_have_long_long_off_t" = yes |
| 362 | then |
| 363 | AC_DEFINE(HAVE_LONG_LONG_OFF_T) |
| 364 | fi |
| 365 | ]) |
| 366 | |
| 367 | dnl ### A macro to determine if rlim_t is a long long |
| 368 | AC_DEFUN(AC_RLIM_T_IS_LONG_LONG, |
| 369 | [AC_MSG_CHECKING(for long long rlim_t) |
| 370 | AC_CACHE_VAL(ac_cv_have_long_long_rlim_t, |
| 371 | [AC_TRY_RUN([#include <sys/types.h> |
| 372 | #include <sys/time.h> |
| 373 | #include <sys/resource.h> |
| 374 | main () { |
| 375 | if (sizeof (rlim_t) == sizeof (long long) && |
| 376 | sizeof (rlim_t) > sizeof (long)) |
| 377 | return 0; |
| 378 | return 1; |
| 379 | } |
| 380 | ], |
| 381 | ac_cv_have_long_long_rlim_t=yes, |
| 382 | ac_cv_have_long_long_rlim_t=no, |
| 383 | [# Should try to guess here |
| 384 | ac_cv_have_long_long_rlim_t=no |
| 385 | ])]) |
| 386 | AC_MSG_RESULT($ac_cv_have_long_long_rlim_t) |
| 387 | if test "$ac_cv_have_long_long_rlim_t" = yes |
| 388 | then |
| 389 | AC_DEFINE(HAVE_LONG_LONG_RLIM_T) |
| 390 | fi |
| 391 | ]) |
| 392 | |
| Wichert Akkerman | f185065 | 2001-02-16 20:29:03 +0000 | [diff] [blame] | 393 | dnl ### A macro to determine whether sin6_scope_id is available. |
| 394 | AC_DEFUN(AC_SIN6_SCOPE_ID, |
| 395 | [AC_MSG_CHECKING(for sin6_scope_id in sockaddr_in6) |
| 396 | AC_CACHE_VAL(ac_cv_have_sin6_scope_id, |
| 397 | [AC_TRY_COMPILE([#include <netinet/in.h>], |
| 398 | [ struct sockaddr_in6 s; s.sin6_scope_id = 0; ], |
| 399 | ac_cv_have_sin6_scope_id=yes, |
| 400 | ac_cv_have_sin6_scope_id=no)]) |
| 401 | AC_MSG_RESULT($ac_cv_have_sin6_scope_id) |
| 402 | if test "$ac_cv_have_sin6_scope_id" = "yes" ; then |
| 403 | AC_DEFINE(HAVE_SIN6_SCOPE_ID) |
| 404 | else |
| 405 | AC_MSG_CHECKING(for sin6_scope_id in linux sockaddr_in6) |
| 406 | AC_CACHE_VAL(ac_cv_have_sin6_scope_id_linux, |
| 407 | [AC_TRY_COMPILE([#include <linux/in6.h>], |
| 408 | [ struct sockaddr_in6 s; s.sin6_scope_id = 0; ], |
| 409 | ac_cv_have_sin6_scope_id_linux=yes, |
| 410 | ac_cv_have_sin6_scope_id_linux=no)]) |
| 411 | AC_MSG_RESULT($ac_cv_have_sin6_scope_id_linux) |
| 412 | if test "$ac_cv_have_sin6_scope_id_linux" = "yes" ; then |
| 413 | AC_DEFINE(HAVE_SIN6_SCOPE_ID) |
| 414 | AC_DEFINE(HAVE_SIN6_SCOPE_ID_LINUX) |
| 415 | fi |
| 416 | fi |
| 417 | ]) |
| 418 | |
| John Hughes | c0fc3fd | 2001-03-08 16:10:40 +0000 | [diff] [blame] | 419 | dnl ### A macro to check for st_flags in struct stat |
| 420 | AC_DEFUN(AC_ST_FLAGS, |
| 421 | [AC_MSG_CHECKING(for st_flags in struct stat) |
| 422 | AC_CACHE_VAL(ac_cv_have_st_flags, |
| 423 | [AC_TRY_COMPILE([#include <sys/stat.h>], |
| 424 | [struct stat buf; |
| 425 | buf.st_flags = 0;], |
| 426 | ac_cv_have_st_flags=yes, |
| 427 | ac_cv_have_st_flags=no)]) |
| 428 | AC_MSG_RESULT($ac_cv_have_st_flags) |
| 429 | if test "$ac_cv_have_st_flags" = yes |
| 430 | then |
| 431 | AC_DEFINE(HAVE_ST_FLAGS) |
| 432 | fi |
| 433 | ]) |
| 434 | |
| 435 | dnl ### A macro to check for st_aclcnt in struct stat |
| 436 | AC_DEFUN(AC_ST_ACLCNT, |
| 437 | [AC_MSG_CHECKING(for st_aclcnt in struct stat) |
| 438 | AC_CACHE_VAL(ac_cv_have_st_aclcnt, |
| 439 | [AC_TRY_COMPILE([#include <sys/stat.h>], |
| 440 | [struct stat buf; |
| 441 | buf.st_aclcnt = 0;], |
| 442 | ac_cv_have_st_aclcnt=yes, |
| 443 | ac_cv_have_st_aclcnt=no)]) |
| 444 | AC_MSG_RESULT($ac_cv_have_st_aclcnt) |
| 445 | if test "$ac_cv_have_st_aclcnt" = yes |
| 446 | then |
| 447 | AC_DEFINE(HAVE_ST_ACLCNT) |
| 448 | fi |
| 449 | ]) |
| 450 | |
| 451 | dnl ### A macro to check for st_level in struct stat |
| 452 | AC_DEFUN(AC_ST_LEVEL, |
| 453 | [AC_MSG_CHECKING(for st_level in struct stat) |
| 454 | AC_CACHE_VAL(ac_cv_have_st_level, |
| 455 | [AC_TRY_COMPILE([#include <sys/stat.h>], |
| 456 | [struct stat buf; |
| 457 | buf.st_level = 0;], |
| 458 | ac_cv_have_st_level=yes, |
| 459 | ac_cv_have_st_level=no)]) |
| 460 | AC_MSG_RESULT($ac_cv_have_st_level) |
| 461 | if test "$ac_cv_have_st_level" = yes |
| 462 | then |
| 463 | AC_DEFINE(HAVE_ST_LEVEL) |
| 464 | fi |
| 465 | ]) |
| 466 | |
| 467 | dnl ### A macro to check for st_fstype in struct stat |
| 468 | AC_DEFUN(AC_ST_FSTYPE, |
| 469 | [AC_MSG_CHECKING(for st_fstype in struct stat) |
| 470 | AC_CACHE_VAL(ac_cv_have_st_fstype, |
| 471 | [AC_TRY_COMPILE([#include <sys/stat.h>], |
| 472 | [struct stat buf; |
| 473 | buf.st_fstype[0] = 0;], |
| 474 | ac_cv_have_st_fstype=yes, |
| 475 | ac_cv_have_st_fstype=no)]) |
| 476 | AC_MSG_RESULT($ac_cv_have_st_fstype) |
| 477 | if test "$ac_cv_have_st_fstype" = yes |
| 478 | then |
| 479 | AC_DEFINE(HAVE_ST_FSTYPE) |
| 480 | fi |
| 481 | ]) |
| 482 | |
| 483 | dnl ### A macro to check for st_gen in struct stat |
| 484 | AC_DEFUN(AC_ST_GEN, |
| 485 | [AC_MSG_CHECKING(for st_gen in struct stat) |
| 486 | AC_CACHE_VAL(ac_cv_have_st_gen, |
| 487 | [AC_TRY_COMPILE([#include <sys/stat.h>], |
| 488 | [struct stat buf; |
| 489 | buf.st_gen = 0;], |
| 490 | ac_cv_have_st_gen=yes, |
| 491 | ac_cv_have_st_gen=no)]) |
| 492 | AC_MSG_RESULT($ac_cv_have_st_gen) |
| 493 | if test "$ac_cv_have_st_gen" = yes |
| 494 | then |
| 495 | AC_DEFINE(HAVE_ST_GEN) |
| 496 | fi |
| 497 | ]) |
| 498 | |
| John Hughes | b8a85a4 | 2001-03-28 08:05:27 +0000 | [diff] [blame] | 499 | dnl ### A macro to determine endianness of long long |
| 500 | AC_DEFUN(AC_LITTLE_ENDIAN_LONG_LONG, |
| 501 | [AC_MSG_CHECKING(for little endian long long) |
| 502 | AC_CACHE_VAL(ac_cv_have_little_endian_long_long, |
| 503 | [AC_TRY_RUN([ |
| 504 | int main () { |
| 505 | union { |
| 506 | long long ll; |
| 507 | long l [2]; |
| 508 | } u; |
| 509 | u.ll = 0x12345678; |
| 510 | if (u.l[0] == 0x12345678) |
| 511 | return 0; |
| 512 | return 1; |
| 513 | } |
| 514 | ], |
| 515 | ac_cv_have_little_endian_long_long=yes, |
| 516 | ac_cv_have_little_endian_long_long=no, |
| 517 | [# Should try to guess here |
| 518 | ac_cv_have_little_endian_long_long=no |
| 519 | ])]) |
| 520 | AC_MSG_RESULT($ac_cv_have_little_endian_long_long) |
| 521 | if test "$ac_cv_have_little_endian_long_long" = yes |
| 522 | then |
| 523 | AC_DEFINE(HAVE_LITTLE_ENDIAN_LONG_LONG) |
| 524 | fi |
| 525 | ]) |
| 526 | |