OSDN Git Service

2013.10.24
[uclinux-h8/uClinux-dist.git] / user / tinyproxy / acinclude.m4
1 dnl Taken from Unix Network Programming, W. Richard Stevens
2
3 dnl ##################################################################
4 dnl We cannot use the AC_CHECK_TYPE macros becasue AC_CHECK_TYPE
5 dnl #includes only <sys/types.h>, <stdlib.h>, and <stddef.h>.
6 dnl Unfortunately, many implementations today hide typedefs in wierd
7 dnl locations: Solaris 2.5.1 has uint8_t and uint32_t in <pthread.h>.
8 dnl SunOS 4.1.x has int8_t in <sys/bittypes.h>.
9 dnl So we define our own macro AC_UNP_CHECK_TYPE that does the same
10 dnl #includes as "unp.h", and then looks for the typedef.
11 dnl
12 dnl This macro should be invoked after all the header checks have been
13 dnl performed, since we #include "confdefs.h" below, and then use the
14 dnl HAVE_foo_H values that is can #define.
15 dnl
16 AC_DEFUN([AC_UNP_CHECK_TYPE],
17          [AC_MSG_CHECKING(if $1 defined)
18           AC_CACHE_VAL(ac_cv_type_$1,
19                 [AC_TRY_COMPILE(
20 [
21 #include        "confdefs.h"    /* the header built by configure so far */
22 #ifdef  HAVE_SYS_TYPES_H
23 #  include      <sys/types.h>
24 #endif
25 #ifdef  HAVE_SYS_SOCKET_H
26 #  include      <sys/socket.h>
27 #endif
28 #ifdef  HAVE_SYS_TIME_H
29 #  include      <sys/time.h>
30 #endif
31 #ifdef  HAVE_NETINET_IN_H
32 #  include      <netinet/in.h>
33 #endif
34 #ifdef  HAVE_ARPA_INET_H
35 #  include      <arpa/inet.h>
36 #endif
37 #ifdef  HAVE_ERRNO_H
38 #  include      <errno.h>
39 #endif
40 #ifdef  HAVE_FCNTL_H
41 #  include      <fcntl.h>
42 #endif
43 #ifdef  HAVE_NETDB_H
44 #  include      <netdb.h>
45 #endif
46 #ifdef  HAVE_SIGNAL_H
47 #  include      <signal.h>
48 #endif
49 #ifdef  HAVE_STDIO_H
50 #  include      <stdio.h>
51 #endif
52 #ifdef  HAVE_STDLIB_H
53 #  include      <stdlib.h>
54 #endif
55 #ifdef  HAVE_STRING_H
56 #  include      <string.h>
57 #endif
58 #ifdef  HAVE_SYS_STAT_H
59 #  include      <sys/stat.h>
60 #endif
61 #ifdef  HAVE_SYS_UIO_H
62 #  include      <sys/uio.h>
63 #endif
64 #ifdef  HAVE_UNISTD_H
65 #  include      <unistd.h>
66 #endif
67 #ifdef  HAVE_SYS_WAIT_H
68 #  include      <sys/wait.h>
69 #endif
70 #ifdef  HAVE_SYS_UN_H
71 #  include      <sys/un.h>
72 #endif
73 #ifdef  HAVE_SYS_SELECT_H
74 #  include      <sys/select.h>
75 #endif
76 #ifdef  HAVE_STRINGS_H
77 #  include      <strings.h>
78 #endif
79 #ifdef  HAVE_SYS_IOCTL_H
80 #  include      <sys/ioctl.h>
81 #endif
82 #ifdef  HAVE_SYS_FILIO_H
83 #  include      <sys/filio.h>
84 #endif
85 #ifdef  HAVE_SYS_SOCKIO_H
86 #  include      <sys/sockio.h>
87 #endif
88 #ifdef  HAVE_PTHREAD_H
89 #  include      <pthread.h>
90 #endif
91 #ifdef  HAVE_STDINT_H
92 #  include      <stdint.h>
93 #endif
94 ],
95                 [ $1 foo ],
96                 [ac_cv_type_$1=yes],
97                 [ac_cv_type_$1=no])])
98         AC_MSG_RESULT([$ac_cv_type_$1])
99         if test $ac_cv_type_$1 = no ; then
100                 AH_TEMPLATE([$1], [Defined with the proper type.])
101                 AC_DEFINE($1, $2)
102         fi
103 ])