3 # AMANDA_CHECK_TYPE(type, replacement-type, header)
7 # Like AC_CHECK_TYPE, where action-if-not-found DEFINEs $1 to $2.
9 # 'header' must be a single header name, or blank to use the default
12 AC_DEFUN([AMANDA_CHECK_TYPE], [
13 AC_REQUIRE([AC_HEADER_STDC])
14 AC_CHECK_TYPE($1, [], [
15 AC_DEFINE($1, $2, [Type for $1, if it is not defined by the system])
16 ], ifelse($3, [], [], [
32 # Check whether pid_t is a long, int, or short. DEFINE PRINTF_PID_T to the
33 # corresponding printf format.
35 AC_DEFUN([AMANDA_TYPE_PID_T], [
36 AC_REQUIRE([AC_HEADER_STDC])
37 AC_REQUIRE([AC_TYPE_PID_T])
38 AC_CACHE_CHECK([for pid_t type], amanda_cv_pid_type,
40 amanda_cv_pid_type=unknown
41 if test "$ac_cv_type_pid_t" = no; then
42 amanda_cv_pid_type=int
44 for TEST_amanda_cv_pid_type in long short int; do
45 if test $amanda_cv_pid_type = unknown; then
46 AC_EGREP_CPP(typedef.*${TEST_amanda_cv_pid_type}.*pid_t,
48 #include <sys/types.h>
54 amanda_cv_pid_type=$TEST_amanda_cv_pid_type)
56 if test $amanda_cv_pid_type = unknown; then
57 AC_EGREP_CPP(ZZZZ.*${TEST_amanda_cv_pid_type},
59 #include <sys/types.h>
66 amanda_cv_pid_type=$TEST_amanda_cv_pid_type)
69 if test $amanda_cv_pid_type = unknown; then
70 amanda_cv_pid_type=int
74 case $amanda_cv_pid_type in
75 int) AC_DEFINE_UNQUOTED(PRINTF_PID_T,"%d",[Define to printf formatting string to print a PID. ]) ;;
76 long) AC_DEFINE_UNQUOTED(PRINTF_PID_T,"%ld") ;;
77 short) AC_DEFINE_UNQUOTED(PRINTF_PID_T,"%d") ;;
88 # Test for the presence of <sys/wait.h>, 'union wait', arg-type of 'wait()'.
89 # by T.E.Dickey" , Jim Spath <jspath@mail.bcpl.lib.md.us>
91 # DEFINEs WAIT_USES_UNION if 'union wait' is found. Note that many systems
92 # support *both* 'union wait' and 'int' using a transparent union.
96 # FIXME: These tests should have been in autoconf 1.11!
98 # Note that we cannot simply grep for 'union wait' in the wait.h file,
99 # because some Posix systems turn this on only when a BSD variable is
100 # defined. Since I'm trying to do without special defines, I'll live
101 # with the default behavior of the include-file.
103 # I do _2_ compile checks, because we may have union-wait, but the
104 # prototype for 'wait()' may want an int.
106 # Don't use HAVE_UNION_WAIT, because the autoconf documentation implies
107 # that if we've got union-wait, we'll automatically use it.
109 # Garrett Wollman adds:
110 # The tests described above don't quite do the right thing,
111 # since some systems have hacks which allow `union wait' to
112 # still work even though `int' is preferred (and generates
113 # fewer warnings). Since all of these systems use prototypes,
114 # we can use the prototype of wait(2) to disambiguate them.
116 # Alexandre Oliva adds:
117 # A single compile check is enough. If we don't have union wait,
118 # it's obvious that the test will fail, and that we must use int.
119 # If we do, the prototype (on STDC systems) and WIFEXITED will tell
120 # whether we're supposed to be using union wait instead of int.
122 AC_DEFUN([CF_WAIT], [
123 AC_REQUIRE([AC_TYPE_PID_T])
124 AC_HAVE_HEADERS(sys/wait.h wait.h)
125 AC_CACHE_CHECK([whether wait uses union wait], [cf_cv_arg_union_wait], [
127 #include <sys/types.h>
130 # include <sys/wait.h>
138 pid_t wait(union wait *);
142 wait(&x); i = WIFEXITED(x)
143 ], [cf_cv_arg_union_wait=yes], [cf_cv_arg_union_wait=no])])
144 if test $cf_cv_arg_union_wait = yes; then
145 AC_DEFINE(WAIT_USES_UNION,1,
146 [Defined if wait() puts the status in a union wait instead of int. ])
156 # Test for the presence of <sys/wait.h>, 'union wait', arg-type of 'wait()'.
157 # by T.E.Dickey" , Jim Spath <jspath@mail.bcpl.lib.md.us>
159 # DEFINEs WAIT_USES_INT if an int result type is found.
161 AC_DEFUN([CF_WAIT_INT], [
162 AC_REQUIRE([AC_TYPE_PID_T])
163 AC_HAVE_HEADERS(sys/wait.h wait.h)
164 AC_CACHE_CHECK([whether wait uses int], [cf_cv_arg_int], [
166 #include <sys/types.h>
169 # include <sys/wait.h>
181 wait(&x); i = WIFEXITED(x)
182 ], [cf_cv_arg_int=yes], [cf_cv_arg_int=no])])
183 if test $cf_cv_arg_int = yes; then
184 AC_DEFINE(WAIT_USES_INT,1,
185 [Defined if wait() puts the status in a int instead of a union wait. ])