-
Notifications
You must be signed in to change notification settings - Fork 96
/
configure
executable file
·213 lines (188 loc) · 8.19 KB
/
configure
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
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
#!/bin/sh
#
# $Id: configure,v 1.97 2010/04/12 17:59:20 tho Exp $
export makl_conf_h="include/u/libu_conf.h"
# Be sure MAKL_DIR is there.
if [ -z "${MAKL_DIR}" ]; then
echo "====================================================================="
echo " WARNING: it seems that MaKL is not installed/configured in your "
echo " environment. "
echo " See http://www.koanlogic.com/makl/index.html "
echo " for download, installation and configuration information. "
echo "====================================================================="
exit 1
fi
# MaKL preamble
. "${MAKL_DIR}"/cf/makl.init
makl_args_init "$@"
# command line options (see relevant mk_* files in build/)
. build/mk_cflags
. build/mk_modules
. build/mk_support
. build/mk_compat
# General settings (version is read from the VERSION file)
makl_pkg_name "libu"
makl_pkg_version
# top level source directory
makl_set_var_mk "SRCDIR" "`pwd`"
# Set variables depending on host OS (assume UNIX by default)
makl_set_var_h "OS_UNIX"
makl_set_var_h "U_PATH_SEPARATOR" "'/'"
target=`makl_target_name`
case ${target} in
*mingw*)
makl_unset_var "OS_UNIX"
makl_set_var "OS_WIN"
# use the hex value to avoid backspace escaping madness
makl_set_var_h "U_PATH_SEPARATOR" "0x5c"
makl_set_var_mk "SHLIB_NO_UNDEFINED_SYMS"
makl_add_var_mk "LDFLAGS" "-lwsock32"
;;
*cygwin*)
makl_set_var_mk "SHLIB_NO_UNDEFINED_SYMS"
makl_set_var_h "RB_INHIBIT_MMAP"
;;
sunos*)
makl_add_var_mk "LDFLAGS" "-lsocket -lnsl"
;;
darwin*)
makl_set_var_mk "OS_DARWIN"
makl_set_var_mk "SHLIB_LDFLAGS" "-undefined suppress -flat_namespace"
;;
linux*)
makl_set_var "OS_LINUX"
;;
minix*)
makl_append_var_mk "CFLAGS" "-D_POSIX_SOURCE"
makl_set_var "OS_MINIX"
;;
esac
# C Flags
makl_append_var_mk "CFLAGS" "-DHAVE_CONF_H -I`pwd`/include"
# Binary dependencies
makl_optional 1 "featx" "doxygen"
## Function dependencies
makl_checktype 0 "long double"
makl_checktype 0 "long long"
makl_checktype 0 "intmax_t" "<stdint.h>"
makl_checktype 0 "_Bool" "<stdbool.h>"
makl_checktype 0 "float _Complex" "<complex.h>"
makl_checktype 0 "double _Complex" "<complex.h>"
makl_checktype 0 "long double _Complex" "<complex.h>"
makl_checktype 0 "pid_t" "<sys/types.h>"
makl_checktype 0 "ssize_t" "<sys/types.h>"
makl_checktype 0 "socklen_t" \
"<sys/types.h>" \
"<sys/socket.h>"
makl_checktype 0 "in_addr_t" \
"<sys/types.h>" \
"<sys/socket.h>" \
"<netinet/in.h>" \
"<arpa/inet.h>"
makl_checktype 0 "struct rusage" "<sys/types.h>" "<sys/resource.h>"
makl_checksymbol 0 "TCP_NODELAY" "<sys/types.h>" "<netinet/tcp.h>"
makl_checksymbol 0 "INET_ADDRSTRLEN" "<netinet/in.h>"
makl_checksymbol 0 "SO_BROADCAST" "<sys/socket.h>"
makl_checksymbol 0 "MAP_FIXED" "<sys/mman.h>"
makl_checkfunc 0 "daemon" 2 "" "<stdlib.h>"
makl_checkfunc 0 "setsockopt" 5 "" "<sys/types.h>" \
"<sys/socket.h>"
makl_checkfunc 0 "getsockopt" 5 "" "<sys/types.h>" \
"<sys/socket.h>"
makl_checkfunc 0 "getpid" 0 "" "<unistd.h>"
makl_checkfunc 0 "link" 2 "" "<unistd.h>"
makl_checkfunc 0 "unlink" 1 "" "<unistd.h>"
makl_checkfunc 0 "sleep" 1 "" "<unistd.h>"
makl_checkfunc 0 "mkstemps" 2 "" "<unistd.h>"
makl_checkfunc 0 "setenv" 3 "" "<stdlib.h>"
makl_checkfunc 0 "mmap" 6 "" "<sys/types.h>" \
"<sys/mman.h>"
makl_checkfunc 0 "fcntl" 3 "" "<fcntl.h>"
makl_checkfunc 0 "sysconf" 1 "" "<unistd.h>"
makl_checkfunc 0 "getpagesize" 0 "" "<unistd.h>"
makl_checkfunc 0 "fnmatch" 3 "" "<fnmatch.h>"
makl_checkfunc 0 "strtok_r" 3 "" "<string.h>"
makl_checkfunc 0 "strsep" 2 "" "<string.h>"
makl_checkfunc 0 "strlcpy" 3 "" "<string.h>"
makl_checkfunc 0 "strlcat" 3 "" "<string.h>"
makl_checkfunc 0 "strtod" 2 "" "<stdlib.h>"
makl_checkfunc 0 "gettimeofday" 2 "" "<sys/time.h>"
makl_checkfunc 0 "timegm" 1 "" "<time.h>"
makl_checkfunc 0 "syslog" 2 "" "<syslog.h>"
makl_checkfunc 0 "vsyslog" 3 "" "<syslog.h>"
makl_checkfunc 0 "strtoumax" 3 "" "<inttypes.h>"
makl_checkfunc 0 "getaddrinfo" 4 "" "<netdb.h>"
makl_checkfunc 0 "uname" 1 "" "<sys/utsname.h>"
makl_checkfunc 0 "fork" 0 "" "<unistd.h>"
makl_checkfunc 0 "wait3" 3 "" "<sys/wait.h>"
makl_checkfunc 0 "wait" 1 "" "<sys/wait.h>"
makl_checkfunc 0 "sigaction" 3 "" "<signal.h>"
makl_checkfunc 0 "setitimer" 3 "" "<sys/time.h>"
makl_checkfunc 0 "isfinite" 1 "" "<math.h>"
makl_func_strerror_r 0
makl_checkheader 0 "complex" "<complex.h>"
makl_checkheader 0 "unistd" "<unistd.h>"
makl_checkheader 0 "stdlib" "<stdlib.h>"
makl_checkheader 0 "paths" "<paths.h>"
makl_checkheader 0 "sysuio" "<sys/uio.h>" "<sys/types.h>"
makl_checkheader 0 "strings" "<strings.h>"
makl_checkheader 0 "sys_socket" "<sys/socket.h>" "<sys/types.h>"
makl_checkheader 0 "netinet_in" "<netinet/in.h>" "<sys/types.h>"
makl_checkheader 0 "netinet_tcp" "<netinet/tcp.h>" "<sys/types.h>"
makl_checktmzone 0
makl_checkextvar 0 "optarg"
makl_checkextvar 0 "optind"
makl_checkinline 0
if [ $? -ne 0 ]; then
makl_append_var_mk "CFLAGS" "-Dinline="
fi
# Handle command-line arguments
makl_args_handle "$@"
# check for IPv4, IPv6 and Unix socket support
# these checks are disabled when --no_net is requested
if [ -z "`makl_get_var_h "NO_NET"`" ]
then
if [ -z "`makl_get_var_h "OS_WIN"`" ]
then
makl_checktype 1 "struct sockaddr_in" \
"<sys/types.h> <sys/socket.h> <netinet/in.h>"
fi
# check for IPv6 support (in case --no_ipv6 was not specified)
if [ -z "`makl_get_var_h "NO_IPV6"`" ]
then
makl_checktype 0 "struct sockaddr_in6" \
"<sys/types.h> <sys/socket.h> <netinet/in.h>"
if [ $? -ne 0 ]
then
makl_set_var "NO_IPV6"
elif [ "`makl_get_var_h "OS_LINUX"`" ]
then
# struct addrinfo is picked up from netdb header only
# in case _GNU_SOURCE is defined.
makl_append_var_mk "CFLAGS" "-D_GNU_SOURCE"
fi
fi
# check for Unix socket support (in case --no_unixsock was not specified)
if [ -z "`makl_get_var_h "NO_UNIXSOCK"`" ]
then
makl_checktype 0 "struct sockaddr_un" \
"<sys/types.h> <sys/socket.h> <netinet/in.h> <sys/un.h>"
[ $? -ne 0 ] && makl_set_var "NO_UNIXSOCK"
fi
# check for SCTP protocol support (in case --no_sctp was not specified)
if [ -z "`makl_get_var_h "NO_SCTP"`" ]
then
makl_checkheader 0 "netinet_sctp" \
"<netinet/sctp.h>" "<sys/types.h>"
[ $? -ne 0 ] && makl_set_var "NO_SCTP"
fi
fi
if [ -z "`makl_get_var_mk "LIBU_DEBUG"`" ]; then
makl_append_var_mk "CFLAGS" "-O2"
fi
# Install headers in a private subdir
makl_set_var "INCDIR" "`makl_get_var_mk \"INCDIR\"`/u"
# apply substitutions
makl_file_sub "doc/doxy/libu.doxy"
# MaKL closing
. "${MAKL_DIR}"/cf/makl.term