/[imapfilter]/imapfilter/config
ViewVC logotype

Annotation of /imapfilter/config

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (hide annotations)
Fri Nov 9 16:55:48 2001 UTC (22 years, 5 months ago) by lefcha
Branch: MAIN
CVS Tags: release-0_7
Branch point for: release-0_7-patches
Changes since 1.1: +2 -0 lines
A small change.

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

webmaster@linux.gr
ViewVC Help
Powered by ViewVC 1.1.26