/[imapfilter]/imapfilter/config
ViewVC logotype

Contents of /imapfilter/config

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.5 - (show annotations)
Fri Jan 25 17:10:17 2002 UTC (22 years, 2 months ago) by lefcha
Branch: MAIN
Changes since 1.4: +18 -1 lines
Merged changes from version 0.7.2.

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

webmaster@linux.gr
ViewVC Help
Powered by ViewVC 1.1.26