forked from lefcha/imapfilter
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfigure
More file actions
executable file
·255 lines (202 loc) · 5.99 KB
/
Copy pathconfigure
File metadata and controls
executable file
·255 lines (202 loc) · 5.99 KB
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
#!/bin/sh
# Default values
prefix="/usr/local"
bindir="$prefix/bin"
sharedir="$prefix/share/imapfilter"
mandir="$prefix/man"
ssltls="yes"
crammd5="yes"
incdirs="-I/usr/local/include"
libdirs="-L/usr/local/lib"
mycflags="$CFLAGS -Wall -O"
myldflags="$LDFLAGS"
libs="-lm -llua -lpcre"
libssl="-lssl"
libcrypto="-lcrypto"
defs="-DMAKEFILE_SHAREDIR='\"\$(SHAREDIR)\"'"
bin="imapfilter"
# Get options and arguments
while getopts "d:p:b:s:m:o:h" opt
do
case $opt in
d | p)
prefix=$OPTARG
bindir=$prefix/bin
sharedir=$prefix/share/imapfilter
mandir=$prefix/man
;;
b)
bindir=$OPTARG
;;
s)
sharedir=$OPTARG
;;
m)
mandir=$OPTARG
;;
o)
head=`echo $OPTARG | cut -d= -f1`
body=`echo $OPTARG | cut -d= -f2`
if [ $head = "ssltls" ]
then
if [ $body = "yes" ]; then ssltls="yes"
elif [ $body = "no" ]; then ssltls="no"
fi
elif [ $head = "crammd5" ]
then
if [ $body = "yes" ]; then crammd5="yes"
elif [ $body = "no" ]; then crammd5="no"
fi
fi
;;
h | *)
cat << EOF
Usage:
configure [-h] [-p prefix] [-b bindir] [-s sharedir] [-m mandir]
[-o option=argument]
Description:
-h This brief usage and description message.
-p prefix Installation path for program's files [$prefix]
-b bindir Installation path for binaries [$bindir]
-s sharedir Installation path for libraries [$sharedir]
-m mandir Installation path for manual pages [$mandir]
-o option=argument Enabling/disabling of program's compilation options.
Options:
ssltls Secure Socket Layer and Transport Layer Security \
[$ssltls]
crammd5 Challenge-Response Authentication Mechanism [$crammd5]
EOF
exit 1
;;
esac
done
# Print values
cat << EOF
Installation directory: $prefix
Binaries directory: $bindir
Architecture independent libraries: $sharedir
Manual pages directory: $mandir
Secure Socket Layer and Transport Layer Security: $ssltls
Challenge-Response Authentication Mechanism: $crammd5
EOF
# Defines
if [ $ssltls = "no" ]
then
defs="$defs -DNO_SSLTLS"
fi
if [ $crammd5 = "no" ]
then
defs="$defs -DNO_CRAMMD5"
fi
# Libraries
if [ $ssltls = "yes" ]
then
libs="$libs $libssl $libcrypto"
elif [ $crammd5 = "yes" ]
then
libs="$libs $libcrypto"
fi
# Binary name
uname -a | grep -qi cygwin
if [ $? = 0 ]
then
bin="imapfilter.exe"
fi
# Change to the source directory
cd src
# Backup of original Makefile
if [ ! -f .Makefile ]; then cp -f Makefile .Makefile; fi
# Write Makefile
mv -f Makefile Makefile~
cat > Makefile << EOF
DESTDIR =
BINDIR = $bindir
SHAREDIR = $sharedir
MANDIR = $mandir
INCDIRS = $incdirs
LIBDIRS = $libdirs
MYCFLAGS = $mycflags
MYLDFLAGS = $myldflags
DEFS = $defs
CFLAGS = \$(MYCFLAGS) \$(DEFS) \$(INCDIRS)
LDFLAGS = \$(MYLDFLAGS) \$(LIBDIRS)
LIBS = $libs
MAN_BIN = imapfilter.1
MAN_CONFIG = imapfilter_config.5
COMMON_LUA = common.lua
SET_LUA = set.lua
REGEX_LUA = regex.lua
ACCOUNT_LUA = account.lua
MAILBOX_LUA = mailbox.lua
MESSAGE_LUA = message.lua
OPTIONS_LUA = options.lua
AUXILIARY_LUA = auxiliary.lua
DEPRECATED_LUA = deprecated.lua
BIN = $bin
OBJ = auth.o buffer.o cert.o core.o file.o imap.o imapfilter.o list.o log.o \\
lua.o memory.o misc.o namespace.o pcre.o regexp.o request.o \\
response.o session.o signal.o socket.o system.o
all: \$(BIN)
\$(BIN): \$(OBJ)
\$(CC) -o \$(BIN) \$(LDFLAGS) \$(OBJ) \$(LIBS)
\$(OBJ): imapfilter.h
buffer.o imap.o imapfilter.o namespace.o request.o response.o: buffer.h
cert.o file.o imapfilter.o log.o lua.o: pathnames.h
imapfilter.o log.o session.o: list.h
imapfilter.o regexp.o response.o: regexp.h
auth.o cert.o imap.o imapfilter.o log.o request.o response.o session.o \\
socket.o: session.h
imapfilter.o: version.h
install: \$(BIN)
if test ! -d \$(DESTDIR)\$(BINDIR); then \\
mkdir -p \$(DESTDIR)\$(BINDIR); fi
cp -f \$(BIN) \$(DESTDIR)\$(BINDIR) && \\
chmod 0755 \$(DESTDIR)\$(BINDIR)/\$(BIN)
if test ! -d \$(DESTDIR)\$(SHAREDIR); then \\
mkdir -p \$(DESTDIR)\$(SHAREDIR); fi
cp -f \$(COMMON_LUA) \$(DESTDIR)\$(SHAREDIR) && \\
chmod 0644 \$(DESTDIR)\$(SHAREDIR)/\$(COMMON_LUA)
cp -f \$(SET_LUA) \$(DESTDIR)\$(SHAREDIR) && \\
chmod 0644 \$(DESTDIR)\$(SHAREDIR)/\$(SET_LUA)
cp -f \$(REGEX_LUA) \$(DESTDIR)\$(SHAREDIR) && \\
chmod 0644 \$(DESTDIR)\$(SHAREDIR)/\$(REGEX_LUA)
cp -f \$(ACCOUNT_LUA) \$(DESTDIR)\$(SHAREDIR) && \\
chmod 0644 \$(DESTDIR)\$(SHAREDIR)/\$(ACCOUNT_LUA)
cp -f \$(MAILBOX_LUA) \$(DESTDIR)\$(SHAREDIR) && \\
chmod 0644 \$(DESTDIR)\$(SHAREDIR)/\$(MAILBOX_LUA)
cp -f \$(MESSAGE_LUA) \$(DESTDIR)\$(SHAREDIR) && \\
chmod 0644 \$(DESTDIR)\$(SHAREDIR)/\$(MESSAGE_LUA)
cp -f \$(OPTIONS_LUA) \$(DESTDIR)\$(SHAREDIR) && \\
chmod 0644 \$(DESTDIR)\$(SHAREDIR)/\$(OPTIONS_LUA)
cp -f \$(AUXILIARY_LUA) \$(DESTDIR)\$(SHAREDIR) && \\
chmod 0644 \$(DESTDIR)\$(SHAREDIR)/\$(AUXILIARY_LUA)
cp -f \$(DEPRECATED_LUA) \$(DESTDIR)\$(SHAREDIR) && \\
chmod 0644 \$(DESTDIR)\$(SHAREDIR)/\$(DEPRECATED_LUA)
if test ! -d \$(DESTDIR)\$(MANDIR)/man1; then \\
mkdir -p \$(DESTDIR)\$(MANDIR)/man1; fi
cp -f ../doc/\$(MAN_BIN) \$(DESTDIR)\$(MANDIR)/man1 && \\
chmod 0644 \$(DESTDIR)\$(MANDIR)/man1/\$(MAN_BIN)
if test ! -d \$(DESTDIR)\$(MANDIR)/man5; then \\
mkdir -p \$(DESTDIR)\$(MANDIR)/man5; fi
cp -f ../doc/\$(MAN_CONFIG) \$(DESTDIR)\$(MANDIR)/man5 && \\
chmod 0644 \$(DESTDIR)\$(MANDIR)/man5/\$(MAN_CONFIG)
deinstall:
rm -f \$(DESTDIR)\$(BINDIR)/\$(BIN) \\
\$(DESTDIR)\$(SHAREDIR)/\$(COMMON_LUA) \\
\$(DESTDIR)\$(SHAREDIR)/\$(SET_LUA) \\
\$(DESTDIR)\$(SHAREDIR)/\$(REGEX_LUA) \\
\$(DESTDIR)\$(SHAREDIR)/\$(ACCOUNT_LUA) \\
\$(DESTDIR)\$(SHAREDIR)/\$(MAILBOX_LUA) \\
\$(DESTDIR)\$(SHAREDIR)/\$(MESSAGE_LUA) \\
\$(DESTDIR)\$(SHAREDIR)/\$(OPTIONS_LUA) \\
\$(DESTDIR)\$(SHAREDIR)/\$(AUXILIARY_LUA) \\
\$(DESTDIR)\$(SHAREDIR)/\$(DEPRECATED_LUA) \\
\$(DESTDIR)\$(MANDIR)/man1/\$(MAN_BIN) \\
\$(DESTDIR)\$(MANDIR)/man5/\$(MAN_CONFIG)
uninstall: deinstall
clean:
rm -f \$(OBJ) \$(BIN) imapfilter.core core *.orig *.BAK *~
distclean: clean
@if test -f .Makefile; then mv -f .Makefile Makefile; fi
EOF
exit 0