/[imapfilter]/imapfilter/config
ViewVC logotype

Contents of /imapfilter/config

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.27 - (show annotations)
Fri Feb 13 12:17:15 2004 UTC (20 years, 1 month ago) by lefcha
Branch: MAIN
CVS Tags: HEAD
Changes since 1.26: +1 -1 lines
Stylistic changes.

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

webmaster@linux.gr
ViewVC Help
Powered by ViewVC 1.1.26