/[imapfilter]/imapfilter/config
ViewVC logotype

Contents of /imapfilter/config

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.25 - (show annotations)
Sat Feb 7 23:54:16 2004 UTC (20 years, 1 month ago) by lefcha
Branch: MAIN
Changes since 1.24: +0 -21 lines
Removed CHECK_PERMISSIONS compilation option and added variable to control permissions checking.

1 #!/bin/sh
2
3 # Default values
4
5 destdir="/usr/local"
6 bindir="$destdir/bin"
7 mandir="$destdir/man"
8
9 debug="yes"
10 encpasswds="yes"
11 ssltls="yes"
12 cram="yes"
13
14 libs=""
15 libssl="-lssl"
16 libcrypto="-lcrypto"
17
18 cflags=""
19 ldflags=""
20
21 interactive="no"
22
23
24 # Get options and arguments
25
26 while getopts "hid:b:m:o:" opt
27 do
28 case $opt in
29 d)
30 destdir=$OPTARG
31 bindir=$destdir/bin
32 mandir=$destdir/man
33 ;;
34 b)
35 bindir=$OPTARG
36 ;;
37 m)
38 mandir=$OPTARG
39 ;;
40 o)
41 head=`echo $OPTARG | cut -d= -f1`
42 body=`echo $OPTARG | cut -d= -f2`
43 if [ $head = "debug" ]
44 then
45 if [ $body = "yes" ]; then debug="yes"
46 elif [ $body = "no" ]; then debug="no"
47 fi
48 elif [ $head = "encpasswds" ]
49 then
50 if [ $body = "yes" ]; then encpasswds="yes"
51 elif [ $body = "no" ]; then encpasswds="no"
52 fi
53 elif [ $head = "ssltls" ]
54 then
55 if [ $body = "yes" ]; then ssltls="yes"
56 elif [ $body = "no" ]; then ssltls="no"
57 fi
58 elif [ $head = "cram" ]
59 then
60 if [ $body = "yes" ]; then cram="yes"
61 elif [ $body = "no" ]; then cram="no"
62 fi
63 fi
64 ;;
65 i)
66 interactive="yes"
67 ;;
68 h | *)
69 cat << EOF
70 Usage:
71 config [-hi] [-d destdir] [-b bindir] [-m mandir] [-o option=argument]
72
73 Description:
74 -h This brief usage and description message.
75 -i Interactive mode.
76 -d destdir Installation path for program's files [$destdir]
77 -b bindir Installation path for binaries [$bindir]
78 -m mandir Installation path for manual pages [$mandir]
79 -o option=argument Enabling/disabling of program's options.
80
81 Options:
82 debug Debugging information, useful during development [$debug]
83 encpasswds Encrypted passwords support [$encpasswds]
84 ssltls Secure Socket Layer and Transport Layer Security [$ssltls]
85 cram Challenge-Response Authentication Mechanism [$cram]
86 EOF
87 exit 1
88 ;;
89 esac
90 done
91
92
93 # Interactive or non-interactive mode
94
95 if [ $interactive = "yes" ]
96 then
97 printf "Destination directory [$destdir]: "
98 read tmp
99 if [ -n "$tmp" ]; then destdir="$tmp"; fi
100
101 printf "Binaries directory [$bindir]: "
102 read tmp
103 if [ -n "$tmp" ]; then bindir="$tmp"; fi
104
105 printf "Manual pages directory [$mandir]: "
106 read tmp
107 if [ -n "$tmp" ]; then mandir="$tmp"; fi
108
109 printf "Debugging information [$debug]: "
110 read tmp
111 if [ -n "$tmp" ]; then debug="$tmp"; fi
112
113 printf "Encrypted passwords support [$encpasswds]: "
114 read tmp
115 if [ -n "$tmp" ]; then encpasswds="$tmp"; fi
116
117 printf "Secure Socket Layer and Transport Layer Security [$ssltls]: "
118 read tmp
119 if [ -n "$tmp" ]; then ssltls="$tmp"; fi
120
121 printf "Challenge-Response Authentication Mechanism [$cram]: "
122 read tmp
123 if [ -n "$tmp" ]; then cram="$tmp"; fi
124 else
125 cat << EOF
126 Destination directory: $destdir
127 Binaries directory: $bindir
128 Manual pages directory: $mandir
129 Debugging information: $debug
130 Encrypted passwords support: $encpasswds
131 Secure Socket Layer and Transport Layer Security: $ssltls
132 Challenge-Response Authentication Mechanism: $cram
133 EOF
134 fi
135
136
137 # Libraries
138
139 if [ $ssltls = "yes" ]
140 then
141 libs="$libs $libssl $libcrypto"
142 elif [ $encpasswds = "yes" ] || [ $cram = "yes" ]
143 then
144 libs="$libs $libcrypto"
145 fi
146
147
148 # C flags
149
150 if [ $debug = "yes" ]
151 then
152 cflags="-g"
153 else
154 cflags="-O"
155 fi
156
157
158 # Backup of original Makefile and config.h
159
160 if [ ! -f .Makefile ]; then cp -f Makefile .Makefile; fi
161 if [ ! -f .config.h ]; then cp -f config.h .config.h; fi
162
163
164 # Write Makefile
165
166 mv -f Makefile Makefile~
167
168 cat > Makefile << EOF
169 CC = cc
170 CFLAGS = $cflags
171 LDFLAGS =
172
173 DESTDIR = $destdir
174 BINDIR = $bindir
175 MANDIR = $mandir
176
177 MAN_BIN = imapfilter.1
178 MAN_RC = imapfilterrc.5
179
180 BIN = imapfilter
181 OBJ = account.o action.o auth.o buffer.o cert.o destroy.o file.o filter.o \\
182 imap.o imapfilter.o lock.o log.o match.o memory.o misc.o parse.o \\
183 passwd.o response.o request.o socket.o tty.o
184
185 LIBS = $libs
186
187 all: imapfilter
188
189 imapfilter: \$(OBJ)
190 \$(CC) \$(LIBS) \$(LDFLAGS) -o \$(BIN) \$(OBJ)
191
192 account.o action.o auth.o buffer.o cert.o destroy.o file.o filter.o imap.o \\
193 imapfilter.o lock.o log.o match.o memory.o parse.o passwd.o \\
194 request.o response.o socket.o tty.o: config.h imapfilter.h
195 account.o destroy.o filter.o imapfilter.o match.o: account.h
196 destroy.o filter.o imapfilter.o match.o: filter.h
197 account.o filter.o: struct.h
198 buffer.o imap.o imapfilter.o response.o: buffer.h
199 cert.o file.o lock.o parse.o: pathnames.h
200 imapfilter.o: version.h
201
202 install: imapfilter
203 if test ! -d \$(BINDIR); then mkdir -p \$(BINDIR); fi
204 cp -f \$(BIN) \$(BINDIR) && chmod 0755 \$(BINDIR)/\$(BIN)
205 if test ! -d \$(MANDIR)/man1; then mkdir -p \$(MANDIR)/man1; fi
206 cp -f \$(MAN_BIN) \$(MANDIR)/man1 && chmod 0644 \$(MANDIR)/man1/\$(MAN_BIN)
207 if test ! -d \$(MANDIR)/man5; then mkdir -p \$(MANDIR)/man5; fi
208 cp -f \$(MAN_RC) \$(MANDIR)/man5 && chmod 0644 \$(MANDIR)/man5/\$(MAN_RC)
209
210 deinstall:
211 rm -f \$(BINDIR)/\$(BIN) \$(MANDIR)/man1/\$(MAN_BIN) \$(MANDIR)/man5/\$(MAN_RC)
212
213 uninstall: deinstall
214
215 clean:
216 rm -f \$(OBJ) \$(BIN) imapfilter.core core *.BAK *~
217
218 distclean: clean
219 @if test -f .Makefile; then mv -f .Makefile Makefile; fi
220 @if test -f .config.h; then mv -f .config.h config.h; fi
221 EOF
222
223
224 # Write config.h
225
226 mv -f config.h config.h~
227
228 echo "#ifndef CONFIG_H" > config.h
229 echo "#define CONFIG_H" >> config.h
230 echo >> config.h; echo >> config.h
231
232 echo "/* Debugging information. */" >> config.h
233 if [ $debug = "yes" ]
234 then
235 echo "#define DEBUG" >> config.h
236 else
237 echo "#undef DEBUG" >> config.h
238 fi
239 echo >> config.h
240
241 echo "/* Encrypted passwords support. */" >> config.h
242 if [ $encpasswds = "yes" ]
243 then
244 echo "#define ENCRYPTED_PASSWORDS" >> config.h
245 else
246 echo "#undef ENCRYPTED_PASSWORDS" >> config.h
247 fi
248 echo >> config.h
249
250 echo "/* Secure Socket Layer and Transport Layer Security support. */" >> config.h
251 if [ $ssltls = "yes" ]
252 then
253 echo "#define SSL_TLS" >> config.h
254 else
255 echo "#undef SSL_TLS" >> config.h
256 fi
257 echo >> config.h
258
259 echo "/* Challenge-Response Authentication Mechanism support. */" >> config.h
260 if [ $cram = "yes" ]
261 then
262 echo "#define CRAM_MD5" >> config.h
263 else
264 echo "#undef CRAM_MD5" >> config.h
265 fi
266
267 echo >> config.h; echo >> config.h
268 echo "#endif /* CONFIG_H */" >> config.h
269
270
271 exit 0

webmaster@linux.gr
ViewVC Help
Powered by ViewVC 1.1.26