-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigure.ac
181 lines (149 loc) · 7.75 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
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
AC_PREREQ(2.59)
AC_INIT(FULL-PACKAGE-NAME, VERSION, BUG-REPORT-ADDRESS)
AC_CONFIG_SRCDIR([src/SS5Main.c])
AC_CONFIG_HEADER([include/config.h])
OS=`uname -s`
if test "$OS" = "FreeBSD"; then
lib_path_base="/usr/local/lib"
conf_path_base="/usr/local/etc/opt"
bin_path_base="/usr/local/sbin"
doc_path_base="/usr/local/share/doc"
man_path_base="/usr/share/man"
else
lib_path_base="/usr/lib"
conf_path_base="/etc/opt"
bin_path_base="/usr/sbin"
doc_path_base="/usr/share/doc"
man_path_base="/usr/share/man"
fi;
log_path_base="/var/log/ss5"
trc_path_base="/var/log/ss5"
# Checks for programs.
AC_PROG_CC
AC_PROG_INSTALL
# Checks for libraries.
# FIXME: Replace `main' with a function in `-ldl':
AC_CHECK_LIB([dl], [main])
# FIXME: Replace `main' with a function in `-lldap':
AC_CHECK_LIB([ldap], [main])
# FIXME: Replace `main' with a function in `-lpam':
AC_CHECK_LIB([pam], [main])
# FIXME: Replace `main' with a function in `-lpam_misc':
AC_CHECK_LIB([pam_misc], [main])
# FIXME: Replace `main' with a function in `-lpthread':
AC_CHECK_LIB([pthread], [main])
# FIXME: Replace `main' with a function in `-ssl':
AC_CHECK_LIB([ssl], [main])
# Checks for header files.
AC_HEADER_STDC
AC_HEADER_SYS_WAIT
# Checks for OS
if (test "$OS" != "SunOS") && (test "$OS" != "FreeBSD"); then
AC_CHECK_HEADERS([arpa/inet.h fcntl.h netdb.h netinet/in.h stdlib.h string.h sys/ioctl.h sys/socket.h sys/time.h syslog.h unistd.h \
security/pam_misc.h security/pam_appl.h],,[AC_MSG_ERROR(*** Some of the headers weren't found ***)])
else
AC_CHECK_HEADERS([arpa/inet.h fcntl.h netdb.h netinet/in.h stdlib.h string.h sys/ioctl.h sys/socket.h sys/time.h syslog.h unistd.h])
fi;
# Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_C_INLINE
AC_TYPE_PID_T
AC_HEADER_TIME
# Checks for library functions.
AC_FUNC_FORK
AC_PROG_GCC_TRADITIONAL
AC_FUNC_REALLOC
AC_FUNC_SELECT_ARGTYPES
AC_FUNC_STRFTIME
AC_CHECK_FUNCS([bzero gethostbyname gettimeofday inet_ntoa memset select socket strdup strtol])
# Arguments for compiling
#
AC_ARG_WITH(debug, [ --with-debug] Turn on debugging flags, [if test "$withval" == "yes"; then EXTRA_CFLAGS="$EXTRA_CFLAGS -ggdb -Wall -Wextra -pedantic -fno-strict-aliasing " ; else EXTRA_CFLAGS="" ; fi])
AC_ARG_WITH(epollio, [ --with-epollio] Turn on EPOLL IO, [if test "$withval" == "yes"; then EXTRA_CFLAGS="$EXTRA_CFLAGS -D EPOLL_IO " ; else EXTRA_CFLAGS="" ; fi])
AC_ARG_WITH(gssapi, [ --with-gssapi] Turn on gssapi support, [gssapi="$withval"], [gssapi="no"])
if test "$gssapi" != "no"; then
if test "$OS" = "SunOS"; then
EXTRA_LIBS=" -lgss ";
AC_CHECK_LIB([gss], [main])
else
AC_CHECK_LIB([gssapi], [main],[EXTRA_LIBS=" -lgssapi "],[])
AC_CHECK_LIB([gssglue], [main],[EXTRA_LIBS=" -lgssglue "],[])
fi;
EXTRA_CFLAGS="$EXTRA_CFLAGS -DSS5_USE_GSSAPI ";
fi;
AC_ARG_WITH(mysql, [ --with-mysql] Turn on mysql support, [mysql="$withval"], [mysql="no"])
if test "$mysql" != "no"; then
EXTRA_LIBS="$EXTRA_LIBS `mysql_config --libs`";
EXTRA_CFLAGS="$EXTRA_CFLAGS -DSS5_USE_MYSQL ";
fi;
AC_ARG_WITH(configfile, [ --with-configfile=val] Set the location of config file, [SS5_CONFIG_FILE="$withval"]; AC_DEFINE_UNQUOTED(SS5_CONFIG_FILE, "$withval"))
AC_ARG_WITH(passwordfile, [ --with-passwordfile=val] Set the location of password file, [SS5_PASSWORD_FILE="$withval"]; AC_DEFINE_UNQUOTED(SS5_PASSWORD_FILE, "$withval"))
AC_ARG_WITH(logfile, [ --with-logfile=val] Set the location of log file, [SS5_LOG_FILE="$withval"]; AC_DEFINE_UNQUOTED(SS5_LOG_FILE, "$withval"))
AC_ARG_WITH(profilepath, [ --with-profilepath=val] Set the location of profile path, [SS5_PROFILE_PATH="$withval"]; AC_DEFINE_UNQUOTED(SS5_PROFILE_PATH, "$withval"))
AC_ARG_WITH(libpath, [ --with-libpath=val] Set the location of ss5 modules, [SS5_LIB_PATH="$withval"]; [lib_path_base="$withval"]; AC_DEFINE_UNQUOTED(SS5_LIB_PATH, "$withval"))
AC_ARG_WITH(tracepath, [ --with-tracepath=val] Set the location of ss5 trace files, [SS5_TRACE_PATH="$withval"]; AC_DEFINE_UNQUOTED(SS5_TRACE_PATH, "$withval"))
AC_ARG_WITH(defaultaddr, [ --with-defaultaddr=val] Set default bind address, [SS5_DEFAULT_ADDR="$withval"]; AC_DEFINE_UNQUOTED(SS5_DEFAULT_ADDR, "$withval"))
AC_ARG_WITH(defaultport, [ --with-defaultport=val] Set default bind port, [SS5_DEFAULT_PORT="$withval"]; AC_DEFINE_UNQUOTED(SS5_DEFAULT_PORT, "$withval"))
AC_ARG_WITH(defaultuser, [ --with-defaultuser=val] Set default user process, [SS5_DEFAULT_USER="$withval"]; AC_DEFINE_UNQUOTED(SS5_DEFAULT_USER, "$withval"))
# Arguments for installing
#
AC_ARG_WITH(confpathbase, [ --with-confpathbase=val] Set install location of ss5 config files, [conf_path_base="$withval"])
AC_ARG_WITH(binpathbase, [ --with-binpathbase=val] Set install location of ss5 binary files, [bin_path_base="$withval"])
AC_ARG_WITH(docpathbase, [ --with-docpathbase=val] Set install location of ss5 doc files, [doc_path_base="$withval"])
AC_ARG_WITH(manpathbase, [ --with-manpathbase=val] Set install location of ss5 man files, [man_path_base="$withval"])
AC_ARG_WITH(logpathbase, [ --with-logpathbase=val] Set install location of ss5 log files, [log_path_base="$withval"])
AC_ARG_WITH(tracepathbase, [ --with-tracepathbase=val] Set install location of ss5 trc files, [trc_path_base="$withval"])
# Checks for OS
if test "$OS" = "Linux"; then
CFLAGS="$CFLAGS -DLINUX -D_FILE_OFFSET_BITS=64"
LIBS="-rdynamic -ldl -lssl -lldap -lpam -lpam_misc -lcrypto"
fi;
if test "$OS" = "SunOS"; then
CFLAGS="$CFLAGS -DSOLARIS -fPIC -O2 -L/usr/local/lib -R/usr/local/lib"
LIBS="-lsocket -lnsl -lssl -ldl -lldap -lpam"
fi;
if test "$OS" = "FreeBSD"; then
CFLAGS="$CFLAGS -DFREEBSD -pthread -export-dynamic -I/usr/local/include"
LIBS="-lpam -lldap -lc -L /usr/local/lib"
CPP="g++"
fi;
AC_SUBST(CFLAGS)
AC_SUBST(LIBS)
AC_SUBST(EXTRA_CFLAGS)
AC_SUBST(EXTRA_LIBS)
AC_SUBST(SS5_CONFIG_FILE)
AC_SUBST(SS5_PASSWORD_FILE)
AC_SUBST(SS5_PROFILE_PATH)
AC_SUBST(SS5_LIB_PATH)
AC_SUBST(SS5_TRACE_PATH)
AC_SUBST(SS5_LOG_FILE)
AC_SUBST(SS5_DEFAULT_ADDR)
AC_SUBST(SS5_DEFAULT_PORT)
AC_SUBST(SS5_DEFAULT_USER)
AC_SUBST(lib_path_base)
AC_SUBST(conf_path_base)
AC_SUBST(bin_path_base)
AC_SUBST(doc_path_base)
AC_SUBST(man_path_base)
AC_SUBST(log_path_base)
AC_SUBST(trc_path_base)
AC_SUBST(OS)
AC_CONFIG_FILES([Makefile]
[modules/Makefile]
[modules/mod_authen/Makefile:build/mod_top.mk:modules/mod_authen/Makefile.in:build/mod_bot.mk]
[modules/mod_author/Makefile:build/mod_top.mk:modules/mod_author/Makefile.in:build/mod_bot.mk]
[modules/mod_balance/Makefile:build/mod_top2.mk:modules/mod_balance/Makefile.in:build/mod_bot2.mk]
[modules/mod_bandwidth/Makefile:build/mod_top.mk:modules/mod_bandwidth/Makefile.in:build/mod_bot.mk]
[modules/mod_dump/Makefile:build/mod_top.mk:modules/mod_dump/Makefile.in:build/mod_bot.mk]
[modules/mod_filter/Makefile:build/mod_top.mk:modules/mod_filter/Makefile.in:build/mod_bot.mk]
[modules/mod_log/Makefile:build/mod_top.mk:modules/mod_log/Makefile.in:build/mod_bot.mk]
[modules/mod_proxy/Makefile:build/mod_top.mk:modules/mod_proxy/Makefile.in:build/mod_bot.mk]
[modules/mod_socks4/Makefile:build/mod_top.mk:modules/mod_socks4/Makefile.in:build/mod_bot.mk]
[modules/mod_socks5/Makefile:build/mod_top.mk:modules/mod_socks5/Makefile.in:build/mod_bot.mk]
[modules/mod_statistics/Makefile:build/mod_top2.mk:modules/mod_statistics/Makefile.in:build/mod_bot2.mk]
[common/Makefile]
[src/Makefile]
)
AC_OUTPUT