/[imapfilter]/imapfilter/config
ViewVC logotype

Contents of /imapfilter/config

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.8.2.2 - (show annotations)
Mon Sep 30 01:22:04 2002 UTC (21 years, 6 months ago) by lefcha
Branch: release-0_8-patches
Changes since 1.8.2.1: +12 -1 lines
CFLAGS change according to DEBUG and safer compile flags.

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 checkperms="yes"
11 memlock="yes"
12 encpasswds="yes"
13 ssl="yes"
14
15 libs=""
16 libenc="-lcrypto"
17 libssl="-lssl -lcrypto"
18
19 cflags=""
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 = "checkperms" ]
49 then
50 if [ $body = "yes" ]; then checkperms="yes"
51 elif [ $body = "no" ]; then checkperms="no"
52 fi
53 elif [ $head = "memlock" ]
54 then
55 if [ $body = "yes" ]; then memlock="yes"
56 elif [ $body = "no" ]; then memlock="no"
57 fi
58 elif [ $head = "encpasswds" ]
59 then
60 if [ $body = "yes" ]; then encpasswds="yes"
61 elif [ $body = "no" ]; then encpasswds="no"
62 fi
63 elif [ $head = "ssl" ]
64 then
65 if [ $body = "yes" ]; then ssl="yes"
66 elif [ $body = "no" ]; then ssl="no"
67 fi
68 fi
69 ;;
70 i)
71 interactive="yes"
72 ;;
73 h | *)
74 cat << EOF
75 Usage:
76 config [-hi] [-d destdir] [-b bindir] [-m mandir] [-o option=argument]
77
78 Description:
79 -h This brief usage and description message.
80 -i Interactive mode.
81 -d destdir Installation path for program's files [/usr/local]
82 -b bindir Installation path for binaries [\$destdir/bin]
83 -m mandir Installation path for manual pages [\$destdir/man]
84 -o option=argument Enabling/disabling of program's options.
85
86 Options:
87 debug Debugging information, useful during development [yes]
88 checkperms Configuration file's permissions checking [yes]
89 memlock Try to lock memory pages to avoid swapping [yes]
90 encpasswds Encrypted passwords support [yes]
91 ssl Secure Socket Layer and Transport Layer Security [yes]
92 EOF
93 exit 1
94 ;;
95 esac
96 done
97
98
99 # Interactive or non-interactive mode
100
101 if [ $interactive = "yes" ]
102 then
103 printf "Destination directory [$destdir]: "
104 read tmp
105 if [ -n "$tmp" ]; then destdir="$tmp"; fi
106
107 printf "Binaries directory [$bindir]: "
108 read tmp
109 if [ -n "$tmp" ]; then bindir="$tmp"; fi
110
111 printf "Manual pages directory [$mandir]: "
112 read tmp
113 if [ -n "$tmp" ]; then mandir="$tmp"; fi
114
115 printf "Debugging information [$debug]: "
116 read tmp
117 if [ -n "$tmp" ]; then debug="$tmp"; fi
118
119 printf "Configuration file permissions checking [$checkperms]: "
120 read tmp
121 if [ -n "$tmp" ]; then checkperms="$tmp"; fi
122
123 printf "Try to lock memory pages to avoid swapping [$memlock]: "
124 read tmp
125 if [ -n "$tmp" ]; then memlock="$tmp"; fi
126
127 printf "Encrypted passwords support: "
128 read tmp
129 if [ -n "$tmp" ]; then encpasswds="$tmp"; fi
130
131 printf "Secure Socket Layer and Transport Layer Security [$ssl]: "
132 read tmp
133 if [ -n "$tmp" ]; then ssl="$tmp"; fi
134 else
135 cat << EOF
136 Destination directory: $destdir
137 Binaries directory: $bindir
138 Manual pages directory: $mandir
139 Debugging information: $debug
140 Configuration file permissions checking: $checkperms
141 Try to lock memory pages to avoid swapping: $memlock
142 Encrypted passwords support: $encpasswds
143 Secure Socket Layer and Transport Layer Security: $ssl
144 EOF
145 fi
146
147
148 # Libraries
149
150 if [ $ssl = "yes" ]
151 then
152 libs="$libs $libssl"
153 elif [ $encpasswds = "yes" ]
154 then
155 libs="$libs $libenc"
156 fi
157
158
159 # C flags
160
161 if [ $debug = "yes" ]
162 then
163 cflags="-g"
164 else
165 cflags="-O"
166 fi
167
168
169 # Backup of original Makefile and config.h
170
171 if [ ! -f .Makefile ]; then cp Makefile .Makefile; fi
172 if [ ! -f .config.h ]; then cp config.h .config.h; fi
173
174
175 # Write Makefile
176
177 mv Makefile Makefile~
178
179 cat > Makefile << EOF
180 CC = cc
181 CFLAGS = $cflags
182
183 DESTDIR = $destdir
184 BINDIR = $bindir
185 MANDIR = $mandir
186
187 INSTALL = install -c
188 INST_DIR = install -d
189 INST_BIN = \$(INSTALL) -m 755
190 INST_DOC = \$(INSTALL) -m 644
191
192 MAN_BIN = imapfilter.1
193 MAN_RC = imapfilterrc.5
194
195 BIN = imapfilter
196 OBJ = data.o file.o imap.o imapfilter.o lock.o log.o memory.o misc.o \\
197 passwd.o response.o request.o socket.o tty.o
198
199 LIBS = $libs
200
201 imapfilter: \$(OBJ)
202 \$(CC) \$(LIBS) \$(CFLAGS) -o \$(BIN) \$(OBJ)
203
204 data.o file.o imap.o imapfilter.o lock.o log.o response.o request.o \\
205 memory.o passwd.o socket.o tty.o: imapfilter.h config.h
206 data.o imapfilter.o imap.o file.o passwd.o request.o socket.o: data.h
207
208 install: imapfilter
209 if test ! -d \$(BINDIR); then \$(INST_DIR) \$(BINDIR); fi
210 \$(INST_BIN) \$(BIN) \$(BINDIR)
211 if test ! -d \$(MANDIR)/man1; then \$(INST_DIR) \$(MANDIR)/man1; fi
212 \$(INST_DOC) \$(MAN_BIN) \$(MANDIR)/man1
213 if test ! -d \$(MANDIR)/man5; then \$(INST_DIR) \$(MANDIR)/man5; fi
214 \$(INST_DOC) \$(MAN_RC) \$(MANDIR)/man5
215
216 uninstall:
217 rm -f \$(BINDIR)/\$(BIN) \$(MANDIR)/man1/\$(MAN_BIN) \$(MANDIR)/man5/\$(MAN_RC)
218
219 clean:
220 rm -f \$(OBJ) \$(BIN) imapfilter.core core *.BAK *~
221
222 distclean: clean
223 @if test -f .Makefile; then mv .Makefile Makefile; fi
224 @if test -f .config.h; then mv .config.h config.h; fi
225
226 .PHONY : install uninstall clean distclean
227 EOF
228
229
230 # Write config.h
231
232 mv config.h config.h~
233
234 echo "/* Debugging information. */" > config.h
235 if [ $debug = "yes" ]
236 then
237 echo "#define DEBUG" >> config.h
238 else
239 echo "#undef DEBUG" >> config.h
240 fi
241 echo >> config.h
242
243 echo "/* Configuration file's permissions checking. */" >> config.h
244 if [ $checkperms = "yes" ]
245 then
246 echo "#define CHECK_PERMISSIONS" >> config.h
247 else
248 echo "#undef CHECK_PERMISSIONS" >> config.h
249 fi
250 echo >> config.h
251
252 echo "/* Try to lock memory pages to avoid swapping. */" >> config.h
253 if [ $memlock = "yes" ]
254 then
255 echo "#define MEMORY_LOCK" >> config.h
256 else
257 echo "#undef MEMORY_LOCK" >> config.h
258 fi
259 echo >> config.h
260
261 echo "/* Encrypted passwords support. */" >> config.h
262 if [ $encpasswds = "yes" ]
263 then
264 echo "#define ENCRYPTED_PASSWORDS" >> config.h
265 else
266 echo "#undef ENCRYPTED_PASSWORDS" >> config.h
267 fi
268 echo >> config.h
269
270 echo "/* Secure Socket Layer and Transport Layer Security support. */" >> config.h
271 if [ $ssl = "yes" ]
272 then
273 echo "#define SSL_TLS" >> config.h
274 else
275 echo "#undef SSL_TLS" >> config.h
276 fi
277
278
279 exit 0

webmaster@linux.gr
ViewVC Help
Powered by ViewVC 1.1.26