forked from pzs-ng/pzs-ng
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigure.in
275 lines (240 loc) · 10.9 KB
/
configure.in
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
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
dnl Process this file with autoconf to produce a configure script.
AC_INIT
AC_CONFIG_HEADER(config.h)
#AC_PREFIX_DEFAULT(/glftpd/)
AC_CANONICAL_BUILD
AC_CANONICAL_HOST
dnl Checks for programs.
AC_PROG_CC
if [[ "$CC" = "gcc" ]]; then
CFLAGS="$CFLAGS -W -Wall -Wundef -Wshadow -Wpointer-arith -Wcast-align -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Winline"
fi
AC_PROG_GREP
if [[ -z "$GREP" ]]; then AC_MSG_ERROR([Couldn't find grep, quitting!]); fi
AC_PROG_EGREP
if [[ -z "$EGREP" ]]; then AC_MSG_ERROR([Couldn't find egrep or grep with -E option, quitting!]); fi
AC_PROG_SED
if [[ -z "$SED" ]]; then AC_MSG_ERROR([Couldn't find sed, quitting!]); fi
AC_CHECK_PROG(STRINGS, strings, strings)
if [[ -z "$STRINGS" ]]; then AC_MSG_ERROR([Couldn't find strings, quitting!]); fi
AC_CHECK_PROG(CUT, cut, cut)
if [[ -z "$CUT" ]]; then AC_MSG_ERROR([Couldn't find cut, quitting!]); fi
AC_CHECK_PROG(TR, tr, tr)
if [[ -z "$TR" ]]; then AC_MSG_ERROR([Couldn't find tr, quitting!]); fi
AC_CHECK_PROG(CP, cp, cp)
if [[ -z "$CP" ]]; then AC_MSG_ERROR([Couldn't find cp, quitting!]); fi
AC_CHECK_PROG(RM, rm, rm)
if [[ -z "$RM" ]]; then AC_MSG_ERROR([Couldn't find rm, quitting!]); fi
AC_CHECK_PROG(FILE, file, file)
if [[ -z "$FILE" ]]; then AC_MSG_ERROR([Couldn't find file, quitting!]); fi
AC_CHECK_PROG(INSTALL, install, install)
if [[ -z "$INSTALL" ]]; then AC_MSG_ERROR([Couldn't find install, quitting!]); fi
AC_CHECK_PROG(MAKE, make, make)
if [[ -z "$MAKE" ]]; then AC_MSG_ERROR([Couldn't find make, quitting!]); fi
AC_CHECK_PROG(UNAME, uname, uname)
if [[ -z "$UNAME" ]]; then AC_MSG_ERROR([Couldn't find uname, quitting!]); fi
dnl Checks for libraries.
LCRYPT=""; PASSCHK=""
if [[ $($UNAME -s) != "OpenBSD" ]]; then
#AC_CHECK_LIB(crypt, crypt, LCRYPT="-lcrypt", AC_MSG_ERROR([[Couldn't find libcrypt, quitting!]]))
AC_CHECK_LIB(crypt, crypt, LCRYPT="-lcrypt")
fi
AH_TEMPLATE([PZSNG_SSL_EXT], [Define to 1 to if you have the required SSL-libs in place])
PZSNG_SSL
if [[ -n "$SSL_LIBS" ]]; then
PASSCHK="passchk"
PASSCHK2="passchk-install"
fi
dnl Checks for header files.
AC_HEADER_TIME
AC_HEADER_DIRENT
AC_HEADER_STDC
AC_CHECK_HEADERS(pwd.h regex.h fnmatch.h fcntl.h errno.h, , AC_MSG_ERROR([[Couldn't find required header, quitting!]]))
AC_CHECK_HEADERS(sys/ipc.h sys/param.h sys/shm.h sys/time.h sys/uio.h sys/wait.h, , AC_MSG_ERROR([[Couldn't find required header, quitting!]]))
AC_CHECK_HEADERS(hsregex.h, CFLAGS="$CFLAGS -DUSE_HSREGEX")
dnl Checks for library functions.
AC_CHECK_FUNC(strlcpy, [AC_DEFINE(HAVE_STRLCPY, 1, [Define to 1 if you have the strlcpy() function available])])
dnl Checks for typedefs, structures, and compiler characteristics.
dnl This one isn't used yet.
dnl Features
dnl OS :)
case $host in
*-solaris*)
CFLAGS="$CFLAGS -D_SunOS_"
SUNOBJS="strsep.o scandir.o"
;;
*bsd*)
CFLAGS="$CFLAGS -D_BSD_"
;;
*darwin*)
CFLAGS="$CFLAGS -D_OSX_"
;;
esac
dnl sitestat5
AC_ARG_ENABLE(ss5, AS_HELP_STRING([--enable-ss5], [compiles the zipscript for use with SiteStat 5]), [
CFLAGS="$CFLAGS -D_WITH_SS5"
! [[ -f zipscript/conf/zsconfig.h ]] && $CP -i zipscript/conf/zsconfig.h.ss5.dist zipscript/conf/zsconfig.h
]
)
dnl glftpd-specific
AC_ARG_ENABLE(glftpd-specific,
AS_HELP_STRING([--disable-glftpd-specific], [Disable glftpd-specific features, so that it works under wzdftpd/cuftpd]),
[GLFTPD_SPECIFIC="$enableval"],
[GLFTPD_SPECIFIC="yes"]
)
dnl noformat
NOFORMAT="-D_WITH_NOFORMAT"
AC_ARG_ENABLE(format, AS_HELP_STRING([--enable-format], [compiles the zipscript to format the output]), NOFORMAT="")
dnl expert
AC_ARG_ENABLE(expert, AS_HELP_STRING([--enable-expert], [expert mode - uses full config]), [
! [[ -f zipscript/conf/zsconfig.h ]] && $CP -i zipscript/conf/zsconfig.h.complete zipscript/conf/zsconfig.h
]
)
dnl altwho
ALTWHO="-D_WITH_ALTWHO"
AC_ARG_ENABLE(altwho, AS_HELP_STRING([--disable-altwho], [compiles the sitewho to not use an alternative output on single user who lookups]), ALTWHO="")
dnl flac_headers
AC_ARG_ENABLE(flac, AS_HELP_STRING([--disable-flac], [disable flacinfo support]), , [enable_flac=check])
FLAC_HEADERS=""
AS_IF([test "x$enable_flac" != xno], [
AC_CHECK_HEADERS([FLAC/metadata.h FLAC/format.h],[AC_SUBST([FLAC_HEADERS], ["-DHAVE_FLAC_HEADERS"])
AC_SUBST([LDFLAGS], ["$LDFLAGS -lFLAC"])],
[if test "x$enable_flac" != xcheck; then
AC_MSG_ERROR([Couldn't find required flacheaders. Install libflac development files if you want to have flacinfo support.])
fi]
)])
dnl Static linking :)
AC_ARG_ENABLE(static, AS_HELP_STRING([--enable-static], [enable static linking of zs-c]), CFLAGS="$CFLAGS -static"; static="yes")
if test "$static" = "yes"; then
AC_MSG_RESULT([NOTICE: linking statically (--enable-static).])
else
AC_MSG_RESULT([NOTICE: linking dynamically.])
fi
dnl Install-path
AC_ARG_WITH(install-path,
AS_HELP_STRING([--with-install-path=PATH],
[specify nondefault path to install software (/glftpd per default)]),
INSTALLPATH="$withval")
dnl for compatability
if [[ "x$INSTALLPATH" = "x" ]]; then
AC_ARG_WITH(glpath,
AS_HELP_STRING([--with-glpath=PATH],
[specify nondefault path to install software (/glftpd per default) (USE --with-install-path INSTEAD!)]),
INSTALLPATH="$withval", INSTALLPATH="/glftpd")
fi
dnl GL version =)
if [[ "x$GLFTPD_SPECIFIC" = "xyes" ]]; then
AC_ARG_ENABLE(gl132, AS_HELP_STRING([--enable-gl132], [disable autodetect of glversion, and compile bot binaries for glftpd 1.32]),
GLVERSION="-DGLVERSION=13232"
AC_MSG_RESULT([NOTICE: compiling bot binaries for glftpd 1.32. (--enable-gl132).]),
GLVERSION="detect")
if [[ "$GLVERSION" = "detect" ]]; then
AC_ARG_ENABLE(gl200, AS_HELP_STRING([--enable-gl200], [disable autodetect of glversion, and compile bot binaries for glftpd 2.00]),
GLVERSION="-DGLVERSION=20032"
AC_MSG_RESULT([NOTICE: compiling bot binaries for glftpd 2.00. (--enable-gl200).]),
GLVERSION="detect")
if [[ "$GLVERSION" = "detect" ]]; then
AC_ARG_ENABLE(gl201, AS_HELP_STRING([--enable-gl201], [disable autodetect of glversion, and compile bot binaries for glftpd 2.01]),
GLVERSION="-DGLVERSION=20132"
AC_MSG_RESULT([NOTICE: compiling bot binaries for glftpd 2.01. (--enable-gl201).]),
GLVERSION="detect")
if [[ "$GLVERSION" = "detect" ]]; then
AC_ARG_ENABLE(gl201-64, AS_HELP_STRING([--enable-gl201-64], [disable autodetect of glversion, and compile bot binaries for glftpd 2.01 64bit]),
GLVERSION="-DGLVERSION=20164"
AC_MSG_RESULT([NOTICE: compiling bot binaries for glftpd 2.01 64bit. (--enable-gl201-64).]),
GLVERSION="detect")
if [[ "$GLVERSION" = "detect" ]]; then
AC_ARG_ENABLE(gl202-32, AS_HELP_STRING([--enable-gl202-32], [disable autodetect of glversion, and compile bot binaries for glftpd 2.02 32bit and above]),
GLVERSION="-DGLVERSION=20232"
AC_MSG_RESULT([NOTICE: compiling bot binaries for glftpd 2.02 32bit and above. (--enable-gl202-32).]),
GLVERSION="detect")
if [[ "$GLVERSION" = "detect" ]]; then
AC_ARG_ENABLE(gl202-64, AS_HELP_STRING([--enable-gl202-64], [disable autodetect of glversion, and compile bot binaries for glftpd 2.02 64bit and above]),
GLVERSION="-DGLVERSION=20264"
AC_MSG_RESULT([NOTICE: compiling bot binaries for glftpd 2.02 64bit and above. (--enable-gl202-64).]),
GLVERSION="detect")
fi
fi
fi
fi
fi
if [[ "$GLVERSION" = "detect" ]]; then
if [[ ! -d "$INSTALLPATH" ] || [ ! -x "${INSTALLPATH}/bin/glftpd" ]]; then
AC_MSG_ERROR([Invalid glpath "$INSTALLPATH". Use ./configure --with-install-path=PATH with a valid path! (or --enable-gl(132|200|201|201-64|202-32|202-64) to disable autodetect).
If you're NOT using glftpd, use --disable-glftpd-specific. Quitting!])
fi
glversion="`$STRINGS $INSTALLPATH/bin/glftpd | $GREP -i '^glftpd ' | $CUT -c8-11 | $TR -d '.'``$FILE $INSTALLPATH/bin/glftpd | $CUT -d':' -f2 | $CUT -c6,7`"
if [[ `echo "$glversion" | $EGREP "^(13232|20032|(20[1-9](32|64)))$"` ]]; then
glusevers="$glversion"
if [[ `echo "$glversion" | $EGREP "20[2-9]32"` ]]; then
glusevers="20232"
else
if [[ `echo "$glversion" | $EGREP "20[2-9]64"` ]]; then
glusevers="20264"
fi
fi
GLVERSION="-DGLVERSION=$glusevers"
glversion="`echo "$glversion" | $SED 's/^\(.\)\(.*\)\(..\)$/\1\.\2 \3bit/'`"
AC_MSG_RESULT([NOTICE: detected glversion, compiling bot binaries for glftpd $glversion.])
else
AC_MSG_ERROR([Couldn't detect glversion, please run ./configure --enable-gl132 or --enable-gl200 or --enable-gl201 or enable-gl201-64 or --enable-gl202-32 or --enable-gl202-64. Quitting!])
fi
fi
AC_SUBST(GLVERSION)
USING_GLFTPD="-DUSING_GLFTPD=1"
SITEWHO="swho"
SHOWLOG="showlog"
SHOWLOG_INSTALL="showlog-install"
fi
AC_SUBST(USING_GLFTPD)
AC_SUBST(SITEWHO)
AC_SUBST(SHOWLOG)
AC_SUBST(SHOWLOG_INSTALL)
AC_SUBST(SUNOBJS)
AC_SUBST(NOFORMAT)
AC_SUBST(ALTWHO)
AC_SUBST(INSTALLPATH)
AC_SUBST(STATIC)
AC_SUBST(LCRYPT)
AC_SUBST(LCRYPTO)
AC_SUBST(PASSCHK)
AC_SUBST(PASSCHK2)
AC_SUBST(MAKE)
AC_CONFIG_FILES([Makefile zipscript/src/Makefile zipscript/utils/Makefile sitebot/src/Makefile sitewho/Makefile sitewho/sitewho.conf lib/Makefile lib/strl/Makefile])
AC_OUTPUT
if [[ ! -f zipscript/conf/zsconfig.h ]]; then
if [[ "x$USING_GLFTPD" == "x" ]]; then
$CP -i zipscript/conf/zsconfig.h.dist-nonglftpd zipscript/conf/zsconfig.h
else
$CP -i zipscript/conf/zsconfig.h.dist zipscript/conf/zsconfig.h
fi
fi
if [[ "$PASSCHK" = "" ]]; then
AC_MSG_RESULT(
$( echo )
libcrypt/OpenSSL not found. Not building passchk)
fi
AC_MSG_RESULT(
$( echo )
The makefiles are now configured. Next up you need to edit
zipscript/conf/zsconfig.h to fit your needs. Please see
README.ZSCONFIG for a complete list of options.
)
if [[ "x$FLAC_HEADERS" != "x" ]]; then
AC_MSG_RESULT(
$( echo )ATTENTION! You are compiling with FLAC support enabled.
This requires third party libs to be accessible in your chroot.
For this you are advised to run libcopy.sh after installation.
)
fi
if [[ "x$GLFTPD_SPECIFIC" = "xyes" ]]; then
RESULT="Also be sure to edit sitewho/sitewho.conf. The conf has
all config options for the sitewho binary.
When done type 'make' to compile.
"
else
RESULT="You've compiled pzs-ng in "ftpd-agnostic" mode, this means
that all glftpd-specific features have been disabled. Good luck!
"
fi
AC_MSG_RESULT($RESULT)