Debian Codegraph @

configure

raw ◀ ▶
1 Debian patch touch this file
1 #! /bin/sh
2
3 # configure script for apsfilter
4 # $ApsCVS: src/apsfilter/configure,v 1.1.2.8 2002/01/10 20:44:48 andreas Exp $
5
6 # these are the ".in" files
7 DOT_IN_FILES="\
8 HOWTO-BUGREPORTS \
9 SETUP \
10 Makefile \
11 bin/apsfilter \
12 bin/aps2file \
13 bin/apsfilter-bug \
14 bin/apspreview \
15 doc/handbook.html \
16 man/apsfilter.1 \
17 man/apsfilterrc.5 \
18 man/aps2file.1 \
19 man/apspreview.1 \
20 man/apsfilter-bug.1 \
21 setup/test.ps \
22 template/apsfilterrc \
23 "
24
25 prefix_default=/usr/local
26 old_ifs="${IFS= }" # one space and one tab character
27 confopts="$@"
28
29 unset prefix bindir datadir sysconfdir mandir docdir with_shell with_awk
30 unset with_sendmail quiet with_printcap with_spooldir
31
32 for option in "$@"; do
33 case "$option" in
34 -*=*) optarg=`echo "$option" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
35 *) optarg= ;;
36 esac
37
38 case "$option" in
39 --prefix=*) prefix="$optarg" ;;
40 --prefix) shift; prefix="$1" ;;
41
42 --bindir=*) bindir="$optarg" ;;
43 --bindir) shift; bindir="$1" ;;
44
45 --datadir=*) datadir="$optarg" ;;
46 --datadir) shift; datadir="$1" ;;
47
48 --sysconfdir=*) sysconfdir="$optarg" ;;
49 --sysconfdir) shift; sysconfdir="$1" ;;
50
51 --mandir=*) mandir="$optarg" ;;
52 --mandir) shift; mandir="$1" ;;
53
54 --docdir=*) docdir="$optarg" ;;
55 --docdir) shift; docdir="$1" ;;
56
57 --with-shell=*) with_shell="$optarg" ;;
58 --with-shell) shift; with_shell="$1" ;;
59
60 --with-awk=*) with_awk="$optarg" ;;
61 --with-awk) shift; with_awk="$1" ;;
62
63 --with-sendmail=*) with_sendmail="$optarg" ;;
64 --with-sendmail) shift; with_sendmail="$1" ;;
65
66 --with-printcap=*) with_printcap="$optarg" ;;
67 --with-printcap) shift; with_printcap="$1" ;;
68
69 --with-spooldir=*) with_spooldir="$optarg" ;;
70 --with-spooldir) shift; with_spooldir="$1" ;;
71
72 --quiet|--silent) quiet=set ;;
73
74 --help) cat <<EOF
75 Usage: configure [options]
76 Options: [defaults in brackets after descriptions]
77 Configuration:
78 --help print this message
79 --quiet, --silent do not print informational messages
80 Directory and file names:
81 --prefix=PREFIX install architecture-independent files in PREFIX
82 [$prefix_default]
83 --bindir=DIR user executables in DIR [PREFIX/bin]
84 --datadir=DATADIR read-only architecture-independent data in DATADIR
85 [PREFIX/share]
86 --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc]
87 --mandir=DIR man documentation in DIR [PREFIX/man]
88 --docdir=DIR regular documentation in DIR [DATADIR/doc]
89 Features and packages:
90 --with-shell=NAME use NAME as shell executable [autodetected]
91 --with-awk=NAME use NAME as awk executable [autodetected]
92 --with-sendmail=NAME use NAME as sendmail executable [autodetected]
93 --with-printcap=NAME use NAME as printcap database [/etc/printcap]
94 --with-spooldir=DIR use DIR as lpd spool directory [/var/spool/lpd]
95 EOF
96 exit 0 ;;
97
98 *) echo "configure: error: $option: invalid option" 1>&2
99 echo "use --help to show usage" 1>&2
100 exit 1 ;;
101 esac
102 done
103
104
105 # verbose output?
106
107 if test "$quiet"; then
108 exec 3>/dev/null
109 else
110 exec 3>&1
111 fi
112
113 # set variables according to defaults/arguments
114
115 . ./VERSION
116 echo "configuring apsfilter version $version-$branch..." 1>&3
117
118 test "$prefix" || prefix="$prefix_default"
119 test "$bindir" || bindir="$prefix/bin"
120 test "$datadir" || datadir="$prefix/share"
121 test "$sysconfdir" || sysconfdir="$prefix/etc"
122 test "$mandir" || mandir="$prefix/man"
123 test "$docdir" || docdir="$datadir/doc"
124 test "$with_printcap" || with_printcap=/etc/printcap
125 test "$with_spooldir" || with_spooldir=/var/spool/lpd
126
127 # autodetection
128
129 if test "$with_shell"; then
130 if test -x "$with_shell"; then
131 echo "using $with_shell as the shell executable" 1>&3
132 else
133 echo "configure: error: shell not found at $with_shell" 1>&2
134 exit 1
135 fi
136 else
137 # these shells should work (TM)
138 for name in bash bash2 pdksh zsh; do
139 IFS=":"
140 for dir in $PATH; do
141 test -x "$dir/$name" && { with_shell="$dir/$name"; break; }
142 done
143 IFS="$old_ifs"
144 echo "looking for a suitable shell: $name... $with_shell" 1>&3
145 test "$with_shell" && break
146 done
147 if test -z "$with_shell"; then
148 # fall back
149 with_shell=/bin/sh
150 echo "configure: warning: falling back to /bin/sh" 1>&2
151 echo "configure: you might want to use --with-shell" 1>&2
152 fi
153 fi
154
155 if test "$with_awk"; then
156 if test -x "$with_awk"; then
157 echo "using $with_awk as the awk executable" 1>&3
158 else
159 echo "configure: error: awk not found at $with_awk" 1>&2
160 exit 1
161 fi
162 else
163 # these awks should work (TM)
164 for name in gawk mawk nawk; do
165 IFS=":"
166 for dir in $PATH; do
167 test -x "$dir/$name" && { with_awk="$dir/$name"; break; }
168 done
169 IFS="$old_ifs"
170 echo "looking for a suitable awk: $name... $with_awk" 1>&3
171 test "$with_awk" && break
172 done
173 if test -z "$with_awk"; then
174 # fall back
175 IFS=":"
176 for dir in $PATH; do
177 test -x "$dir/awk" && { with_awk="$dir/awk"; break; }
178 done
179 IFS="$old_ifs"
180 if test "$with_awk"; then
181 echo "configure: warning: falling back to $with_awk" 1>&2
182 echo "configure: you might want to use --with-awk" 1>&2
183 else
184 echo "configure: error: no awk found; use --with-awk" 1>&2
185 exit 1
186 fi
187 fi
188 fi
189
190 if test "$with_sendmail"; then
191 if test -x "$with_sendmail"; then
192 echo "using $with_sendmail as the sendmail executable" 1>&3
193 else
•194 echo "configure: warning: sendmail not found at $with_sendmail" 1>&2
195 fi
196 else
197 IFS=":"
198 for path in /usr/sbin /usr/lib $PATH; do
199 test -x "$path/sendmail" && with_sendmail="$path/sendmail"
200 echo "looking for sendmail in $path... $with_sendmail" 1>&3
201 test "$with_sendmail" && break
202 done
203 IFS="$old_ifs"
204 if test ! -x "$with_sendmail"; then
205 echo "configure: error: no sendmail found; use --with-sendmail" 1>&2
206 exit 1
207 fi
208 fi
209
210
211 # substitute variables in files (foo.in -> foo)
212
213 for file in $DOT_IN_FILES
214 do
215 echo "creating $file..." 1>&3
216 sed < "${file}.in" > "$file" "s?@prefix@?$prefix?g; s?@bindir@?$bindir?g; \
217 s?@datadir@?$datadir?g; s?@sysconfdir@?$sysconfdir?g; s?@mandir@?$mandir?g; \
218 s?@shell@?$with_shell?g; s?@awk@?$with_awk?g; s?@sendmail@?$with_sendmail?g; \
219 s?@printcap@?$with_printcap?g; s?@spooldir@?$with_spooldir?g; \
220 s?@docdir@?$docdir?g; s?@VERSION@?$version?g; s?@branch@?$branch?g; \
221 s?@confopts@?${confopts:-none}?g; s?@DOT_IN_FILES@?$DOT_IN_FILES?g"
222 done
223
224 # make scripts executable
225
226 chmod 755 SETUP bin/apsfilter bin/aps2file bin/apsfilter-bug bin/apspreview
227
228
229 # summary
230
231 cat 1>&3 <<EOF
232
233 Using following values as defaults:
234 prefix $prefix
235 bindir $bindir
236 datadir $datadir
237 (will become $datadir/apsfilter)
238 sysconfdir $sysconfdir
239 (will become $sysconfdir/apsfilter)
240 mandir $mandir
241 docdir $docdir
242 (will become $docdir/apsfilter)
243
244 shell $with_shell
245 awk $with_awk
246 sendmail $with_sendmail
247 printcap $with_printcap
248 spooldir $with_spooldir
249
250 Now run "make install" to install apsfilter.
251 EOF