/[imapfilter]/imapfilter/config
ViewVC logotype

Annotation of /imapfilter/config

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.25 - (hide annotations)
Sat Feb 7 23:54:16 2004 UTC (20 years, 2 months 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 lefcha 1.1 #!/bin/sh
2    
3 lefcha 1.2 # Default values
4    
5 lefcha 1.1 destdir="/usr/local"
6     bindir="$destdir/bin"
7     mandir="$destdir/man"
8    
9     debug="yes"
10 lefcha 1.4 encpasswds="yes"
11 lefcha 1.20 ssltls="yes"
12 lefcha 1.19 cram="yes"
13 lefcha 1.1
14     libs=""
15 lefcha 1.19 libssl="-lssl"
16     libcrypto="-lcrypto"
17 lefcha 1.1
18 lefcha 1.10 cflags=""
19 lefcha 1.17 ldflags=""
20 lefcha 1.10
21 lefcha 1.1 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 lefcha 1.5 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 lefcha 1.6 elif [ $head = "encpasswds" ]
49     then
50     if [ $body = "yes" ]; then encpasswds="yes"
51 lefcha 1.8 elif [ $body = "no" ]; then encpasswds="no"
52 lefcha 1.6 fi
53 lefcha 1.20 elif [ $head = "ssltls" ]
54 lefcha 1.5 then
55 lefcha 1.20 if [ $body = "yes" ]; then ssltls="yes"
56     elif [ $body = "no" ]; then ssltls="no"
57 lefcha 1.5 fi
58 lefcha 1.19 elif [ $head = "cram" ]
59     then
60     if [ $body = "yes" ]; then cram="yes"
61     elif [ $body = "no" ]; then cram="no"
62     fi
63 lefcha 1.5 fi
64 lefcha 1.1 ;;
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 lefcha 1.15 -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 lefcha 1.1 -o option=argument Enabling/disabling of program's options.
80    
81     Options:
82 lefcha 1.14 debug Debugging information, useful during development [$debug]
83     encpasswds Encrypted passwords support [$encpasswds]
84 lefcha 1.20 ssltls Secure Socket Layer and Transport Layer Security [$ssltls]
85 lefcha 1.19 cram Challenge-Response Authentication Mechanism [$cram]
86 lefcha 1.1 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 lefcha 1.9 printf "Destination directory [$destdir]: "
98 lefcha 1.1 read tmp
99     if [ -n "$tmp" ]; then destdir="$tmp"; fi
100    
101 lefcha 1.9 printf "Binaries directory [$bindir]: "
102 lefcha 1.1 read tmp
103     if [ -n "$tmp" ]; then bindir="$tmp"; fi
104    
105 lefcha 1.9 printf "Manual pages directory [$mandir]: "
106 lefcha 1.1 read tmp
107     if [ -n "$tmp" ]; then mandir="$tmp"; fi
108    
109 lefcha 1.9 printf "Debugging information [$debug]: "
110 lefcha 1.1 read tmp
111     if [ -n "$tmp" ]; then debug="$tmp"; fi
112    
113 lefcha 1.14 printf "Encrypted passwords support [$encpasswds]: "
114 lefcha 1.4 read tmp
115     if [ -n "$tmp" ]; then encpasswds="$tmp"; fi
116    
117 lefcha 1.20 printf "Secure Socket Layer and Transport Layer Security [$ssltls]: "
118 lefcha 1.1 read tmp
119 lefcha 1.20 if [ -n "$tmp" ]; then ssltls="$tmp"; fi
120 lefcha 1.19
121     printf "Challenge-Response Authentication Mechanism [$cram]: "
122     read tmp
123     if [ -n "$tmp" ]; then cram="$tmp"; fi
124 lefcha 1.1 else
125     cat << EOF
126     Destination directory: $destdir
127     Binaries directory: $bindir
128     Manual pages directory: $mandir
129     Debugging information: $debug
130 lefcha 1.4 Encrypted passwords support: $encpasswds
131 lefcha 1.20 Secure Socket Layer and Transport Layer Security: $ssltls
132     Challenge-Response Authentication Mechanism: $cram
133 lefcha 1.1 EOF
134     fi
135    
136    
137     # Libraries
138    
139 lefcha 1.20 if [ $ssltls = "yes" ]
140 lefcha 1.1 then
141 lefcha 1.19 libs="$libs $libssl $libcrypto"
142 lefcha 1.24 elif [ $encpasswds = "yes" ] || [ $cram = "yes" ]
143 lefcha 1.4 then
144 lefcha 1.19 libs="$libs $libcrypto"
145 lefcha 1.1 fi
146    
147    
148 lefcha 1.10 # C flags
149    
150     if [ $debug = "yes" ]
151     then
152     cflags="-g"
153     else
154     cflags="-O"
155     fi
156    
157 lefcha 1.4
158 lefcha 1.1 # Backup of original Makefile and config.h
159    
160 lefcha 1.13 if [ ! -f .Makefile ]; then cp -f Makefile .Makefile; fi
161     if [ ! -f .config.h ]; then cp -f config.h .config.h; fi
162 lefcha 1.1
163    
164     # Write Makefile
165    
166 lefcha 1.13 mv -f Makefile Makefile~
167 lefcha 1.1
168     cat > Makefile << EOF
169     CC = cc
170 lefcha 1.10 CFLAGS = $cflags
171 lefcha 1.16 LDFLAGS =
172 lefcha 1.1
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 lefcha 1.22 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 lefcha 1.1
185     LIBS = $libs
186    
187 lefcha 1.22 all: imapfilter
188    
189 lefcha 1.1 imapfilter: \$(OBJ)
190 lefcha 1.16 \$(CC) \$(LIBS) \$(LDFLAGS) -o \$(BIN) \$(OBJ)
191 lefcha 1.1
192 lefcha 1.22 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 lefcha 1.1
202     install: imapfilter
203 lefcha 1.11 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 lefcha 1.12 if test ! -d \$(MANDIR)/man5; then mkdir -p \$(MANDIR)/man5; fi
208 lefcha 1.11 cp -f \$(MAN_RC) \$(MANDIR)/man5 && chmod 0644 \$(MANDIR)/man5/\$(MAN_RC)
209 lefcha 1.1
210 lefcha 1.22 deinstall:
211 lefcha 1.1 rm -f \$(BINDIR)/\$(BIN) \$(MANDIR)/man1/\$(MAN_BIN) \$(MANDIR)/man5/\$(MAN_RC)
212 lefcha 1.22
213     uninstall: deinstall
214 lefcha 1.1
215     clean:
216     rm -f \$(OBJ) \$(BIN) imapfilter.core core *.BAK *~
217    
218     distclean: clean
219 lefcha 1.11 @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 lefcha 1.1 EOF
222    
223    
224     # Write config.h
225    
226 lefcha 1.13 mv -f config.h config.h~
227 lefcha 1.1
228 lefcha 1.23 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 lefcha 1.1 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 lefcha 1.4 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 lefcha 1.1 fi
248     echo >> config.h
249    
250     echo "/* Secure Socket Layer and Transport Layer Security support. */" >> config.h
251 lefcha 1.20 if [ $ssltls = "yes" ]
252 lefcha 1.1 then
253     echo "#define SSL_TLS" >> config.h
254     else
255     echo "#undef SSL_TLS" >> config.h
256 lefcha 1.19 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 lefcha 1.1 fi
266 lefcha 1.23
267     echo >> config.h; echo >> config.h
268     echo "#endif /* CONFIG_H */" >> config.h
269 lefcha 1.1
270    
271     exit 0

webmaster@linux.gr
ViewVC Help
Powered by ViewVC 1.1.26