-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathconfigure.ac
198 lines (163 loc) · 5.43 KB
/
configure.ac
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
# Process this file with autoconf to produce a configure script.
AC_INIT(cbase, 1.3.7, [email protected])
AC_CONFIG_AUX_DIR([aux-build])
AC_CONFIG_MACRO_DIR([m4])
AM_INIT_AUTOMAKE
AM_CONFIG_HEADER([config.h])
# Checks for programs.
AC_PROG_CC
AC_PROG_LIBTOOL
# Checks for libraries.
AC_CHECK_LIB(crypt, crypt)
AC_CHECK_LIB(dl, dlopen)
AC_CHECK_LIB(pthread, pthread_create)
AC_CHECK_LIB(rt, sem_open)
AC_CHECK_LIB(rt, shm_open)
AC_CHECK_LIB(socket, socket)
AC_CHECK_LIB(nsl, gethostbyaddr)
AC_CHECK_LIB(util, openpty)
# Checks for header files.
AC_HEADER_DIRENT
AC_HEADER_STDC
AC_HEADER_SYS_WAIT
AC_CHECK_HEADERS([arpa/inet.h fcntl.h inttypes.h netdb.h netinet/in.h stdlib.h string.h sys/file.h sys/ioctl.h sys/time.h termios.h unistd.h stdint.h crypt.h stropts.h sys/socket.h])
# Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_TYPE_UID_T
AC_C_INLINE
AC_TYPE_MODE_T
AC_TYPE_OFF_T
AC_TYPE_PID_T
AC_TYPE_SIZE_T
AC_HEADER_TIME
AC_STRUCT_TM
AC_CHECK_MEMBERS([struct msghdr.msg_accrights, struct msghdr.msg_control],,,
[#include <sys/types.h>
#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif])
dnl Checks for POSIX socket types
AH_TEMPLATE([HAVE_TYPE_SOCKLEN_T], [Define if sys/socket.h or unistd.h defines socklen_t])
AC_MSG_CHECKING(for socklen_t in sys/socket.h or unistd.h)
AC_TRY_LINK([#include <sys/socket.h>
#include <unistd.h>],
[socklen_t t;],
AC_DEFINE(HAVE_TYPE_SOCKLEN_T)
AC_MSG_RESULT(yes),
AC_MSG_RESULT(no))
AH_TEMPLATE([HAVE_TYPE_IN_ADDR_T], [Define if netinet/in.h or sys/types.h defines in_addr_t])
AC_MSG_CHECKING(for in_addr_t in netinet/in.h or sys/types.h)
AC_TRY_LINK([#include <sys/types.h>
#include <netinet/in.h>],
[in_addr_t t;],
AC_DEFINE(HAVE_TYPE_IN_ADDR_T)
AC_MSG_RESULT(yes),
AC_MSG_RESULT(no))
AH_TEMPLATE([HAVE_TYPE_IN_PORT_T], [Define if netinet/in.h or sys/types.h defines in_port_t])
AC_MSG_CHECKING(for in_port_t in netinet/in.h or sys/types.h)
AC_TRY_LINK([#include <sys/types.h>
#include <netinet/in.h>],
[in_port_t t;],
AC_DEFINE(HAVE_TYPE_IN_PORT_T)
AC_MSG_RESULT(yes),
AC_MSG_RESULT(no))
dnl Checks for constant CMSG_SPACE
AC_MSG_CHECKING([for constant CMSG_SPACE])
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
#if HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
int a[CMSG_SPACE(int)];
]])], [
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_CONSTANT_CMSG_SPACE, 1, [Define to 1 if CMSG_SPACE is constant])
], [
AC_MSG_RESULT(no)
])
dnl Checks for gethostbyname_r & friends
AC_SEARCH_LIBS(gethostbyname_r, [socket nsl])
AC_SEARCH_LIBS(getservbyname_r, [socket nsl])
AH_TEMPLATE([HAVE_GETxxxxBYyyyy_R_POSIX], [Define if POSIX-style getXXXXbyYYYY_r functions are available.])
AC_MSG_CHECKING([for POSIX-style gethostbyXXXX_r and getservbyXXXX_r])
AC_TRY_LINK([
#define _POSIX_PTHREAD_SEMANTICS
#include <netdb.h>
#include <stddef.h>
],
[
struct hostent *he;
struct servent *se;
he = gethostbyname_r((const char *)NULL, (struct hostent *)NULL,
(char *)NULL, (int)0, (struct hostent **)NULL, (int *)NULL);
he = gethostbyaddr_r((const char *)NULL, (int)0, (int)0,
(struct hostent *)NULL, (char *)NULL, (int)0, (struct hostent **)NULL,
(int *)NULL);
se = getservbyname_r((const char *)NULL, (const char *)NULL,
(struct servent *)NULL, (char *)NULL, (int)0, (struct servent **)NULL);
se = getservbyport_r((int)0, (const char *)NULL,
(struct servent *)NULL, (char *)NULL, (int)0, (struct servent **)NULL);
],
AC_DEFINE(HAVE_GETxxxxBYyyyy_R_POSIX)
AC_MSG_RESULT(yes),
AC_MSG_RESULT(no)
)
AH_TEMPLATE([HAVE_GETxxxxBYyyyy_R_SUN], [Define if Solaris-style getXXXXbyYYYY_r functions are available.])
AC_MSG_CHECKING([for Solaris-style gethostbyXXXX_r and getservbyXXXX_r])
AC_TRY_LINK([
#define _POSIX_PTHREAD_SEMANTICS
#include <netdb.h>
#include <stddef.h>
],
[ struct hostent *he;
struct servent *se;
he = gethostbyname_r((const char *)NULL, (struct hostent *)NULL,
(char *)NULL, (int)0, (int *)NULL);
he = gethostbyaddr_r((const char *)NULL, (int)0, (int)0,
(struct hostent *)NULL, (char *)NULL, (int)0, (int *)NULL);
se = getservbyname_r((const char *)NULL, (const char *)NULL,
(struct servent *)NULL, (char *)NULL, (int)0);
se = getservbyport_r((int)0, (const char *)NULL,
(struct servent *)NULL, (char *)NULL, (int)0);
],
AC_DEFINE(HAVE_GETxxxxBYyyyy_R_SUN)
AC_MSG_RESULT(yes),
AC_MSG_RESULT(no)
)
dnl Checks for library functions.
AC_FUNC_CLOSEDIR_VOID
AC_FUNC_FORK
AC_PROG_GCC_TRADITIONAL
AC_FUNC_LSTAT
AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK
AC_FUNC_MKTIME
AC_FUNC_MMAP
AC_FUNC_REALLOC
AC_FUNC_SELECT_ARGTYPES
AC_FUNC_SETVBUF_REVERSED
AC_FUNC_STAT
AC_FUNC_STRFTIME
AC_FUNC_VPRINTF
AC_CHECK_FUNCS([dup2 flockfile ftruncate getcwd inet_ntoa localtime_r memmove memset mkdir munmap pathconf select socket strchr strerror strpbrk uname getgrnam_r sranddev])
dnl Check for expat XML parser library
AC_CHECK_HEADER(expat.h,have_expat_h=yes,have_expat_h=no)
AC_CHECK_LIB(expat, XML_ParserCreate,
[
LIBS="-lexpat $LIBS"
have_expat_lib=yes
],)
AH_TEMPLATE([HAVE_LIBEXPAT], [Define if the expat XML parser library is available])
if test "x$have_expat_h" = xyes && test "x$have_expat_lib" = xyes; then
AC_DEFINE(HAVE_LIBEXPAT)
else
cat <<EOF
*******************************************************************
You do not have the expat library, so the XML functions will not be
compiled.
You may obtain this library at:
http://www.jclark.com/xml/expat.html
*******************************************************************
EOF
fi
dnl AC_CONFIG_FILES([])
AC_OUTPUT([Makefile lib/Makefile lib/libcbase.pc lib/libcbase_mt.pc
doc/Makefile])