-
Notifications
You must be signed in to change notification settings - Fork 55
/
Copy pathconfigure.ac
235 lines (198 loc) · 3.9 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
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
# Initate the Proxifier-For-Linux configure file
AC_INIT(Proxifier-For-Linux, [1.0], , , [https://github.com/m0hithreddy/Proxifier-For-Linux])
# Scripts install directory
AC_CONFIG_AUX_DIR([build-aux])
# Saftey checks to verify whether src directory is sane
AC_CONFIG_SRCDIR([src/proxifier.c])
AC_CHECK_FILES(
[${srcdir}/src/proxifier.c
${srcdir}/src/proxifier.h
${srcdir}/src/proxy.c
${srcdir}/src/proxy.h
${srcdir}/src/proxy_http.c
${srcdir}/src/proxy_http.h
${srcdir}/src/proxy_socket.c
${srcdir}/src/proxy_socket.h
${srcdir}/src/proxy_structures.c
${srcdir}/src/proxy_structures.h
${srcdir}/src/proxy_functions.c
${srcdir}/src/proxy_functions.h
${srcdir}/src/proxy_configuration.c
${srcdir}/src/proxy_configuration.h
${srcdir}/src/http.c
${srcdir}/src/http.h
${srcdir}/src/base64.c
${srcdir}/src/base64.h
${srcdir}/src/firewall.c
${srcdir}/src/firewall.h
${srcdir}/proxifier.conf],
[],
[AC_MSG_ERROR([Repository corrupted, redownload the source.])]
)
# Programs required for build
AC_PROG_CC
AC_PROG_INSTALL
AC_PROG_SED
AC_PROG_MKDIR_P
AC_CHECK_PROG([TXT2MAN],[txt2man],[yes])
if test "x${TXT2MAN}" != "xyes" ; then
AC_MSG_NOTICE([txt2man not found, no support for building man pages])
fi
AM_CONDITIONAL([TXT2MAN], [test "x${TXT2MAN}" = "xyes"])
# Some predefined header checks
AC_FUNC_MALLOC
# Checks for system headers
AC_CHECK_HEADERS(
[stdio.h \
stdlib.h \
string.h \
stddef.h \
stdint.h \
stdbool.h \
stdarg.h \
errno.h \
fcntl.h \
unistd.h \
signal.h \
limits.h \
netdb.h \
sys/socket.h \
sys/types.h \
sys/select.h \
sys/time.h \
sys/signalfd.h \
sys/wait.h \
netinet/in.h \
netinet/tcp.h \
arpa/inet.h \
linux/netfilter_ipv4.h],
[],
[AC_MSG_ERROR([${ac_header} is required but not found. Headers provided by libc, installed by default in all distributions.])]
)
# Checks for system funcs
AC_CHECK_FUNCS(
[printf \
atol \
exit \
fopen \
read \
strcmp \
strlen \
strstr \
strcasestr \
strncpy \
strncasecmp \
strcasecmp \
strdup \
execlp \
sigaddset \
sigemptyset \
sigwait \
fork \
waitpid \
memcpy \
malloc \
calloc \
memset \
fcntl \
signalfd \
select \
close \
recvfrom \
sendto \
memmem \
accept \
getsockopt \
inet_ntop \
snprintf \
htons \
htonl \
atoi \
free \
getaddrinfo \
socket \
bind \
getsockname \
listen \
connect \
write],
[],
[AC_MSG_ERROR([${ac_func} is required but not found. Should be included in libc, check the libc variant installed in your system.])]
)
#Checks for optional system functions
AC_CHECK_FUNCS(
[memndup],
[],
[]
)
# Checks for system symbols
AC_CHECK_DECLS(
[NULL,
LONG_MAX,
WIFEXITED,
WEXITSTATUS,
SIGCHLD,
SIGPIPE,
SIGRTMIN,
SIGTERM,
SIGINT,
SIG_BLOCK,
SOCK_DGRAM,
F_SETFL,
F_GETFL,
O_NONBLOCK,
FD_ZERO,
FD_SET,
FD_ISSET,
EINTR,
EAGAIN,
EWOULDBLOCK,
AI_PASSIVE,
SOL_IP,
SO_ORIGINAL_DST,
AF_INET,
INET_ADDRSTRLEN,
INET6_ADDRSTRLEN,
AF_INET6,
SOCK_STREAM,
EFAULT,
INADDR_LOOPBACK],
[],
[AC_MSG_ERROR([Symbol required but not found. Should be included in libc, check the libc variant installed in your system.])],
[[#include<stddef.h>
#include<limits.h>
#include<signal.h>
#include<fcntl.h>
#include<errno.h>
#include<sys/wait.h>
#include<sys/socket.h>
#include<netdb.h>
#include<linux/netfilter_ipv4.h>]]
)
# Pthread library checks
AC_CHECK_LIB(pthread, pthread_create, [], [AC_MSG_ERROR([-lpthread is required but not found. Installed by default in all distributions])])
AC_CHECK_FUNCS(
[pthread_create \
pthread_join \
pthread_mutex_init \
pthread_mutex_lock \
pthread_mutex_unlock \
pthread_mutex_destroy \
pthread_kill \
pthread_sigmask],
[],
[AC_MSG_ERROR([${ac_func} required but not found. Function provided by libpthread, installed by default in all distributions])]
)
AC_CHECK_DECLS(
[PTHREAD_MUTEX_INITIALIZER],
[],
[AC_MSG_ERROR([Symbol required but not found. Should be included in libpthread])],
[[#include<pthread.h>]]
)
# Make Makefile
AM_INIT_AUTOMAKE([subdir-objects])
AC_CONFIG_FILES([Makefile])
# Make config.h header file
AC_CONFIG_HEADERS([config.h])
# Conclude configure
AC_OUTPUT