File: configure

package info (click to toggle)
apsfilter 7.2.6-1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 2,544 kB
  • ctags: 61
  • sloc: sh: 457; ansic: 236; perl: 175; makefile: 157
file content (251 lines) | stat: -rwxr-xr-x 6,955 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
#! /bin/sh

# configure script for apsfilter
# $ApsCVS: src/apsfilter/configure,v 1.1.2.8 2002/01/10 20:44:48 andreas Exp $

# these are the ".in" files
DOT_IN_FILES="\
		HOWTO-BUGREPORTS \
		SETUP \
		Makefile \
		bin/apsfilter \
		bin/aps2file \
		bin/apsfilter-bug \
		bin/apspreview \
		doc/handbook.html \
		man/apsfilter.1 \
		man/apsfilterrc.5 \
		man/aps2file.1 \
		man/apspreview.1 \
		man/apsfilter-bug.1 \
		setup/test.ps \
		template/apsfilterrc \
		"

prefix_default=/usr/local
old_ifs="${IFS= 	}" # one space and one tab character
confopts="$@"

unset prefix bindir datadir sysconfdir mandir docdir with_shell with_awk
unset with_sendmail quiet with_printcap with_spooldir

for option in "$@"; do
    case "$option" in
	-*=*)	optarg=`echo "$option" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
	*)	optarg= ;;
    esac

    case "$option" in
	--prefix=*)		prefix="$optarg" ;;
	--prefix)		shift; prefix="$1" ;;

	--bindir=*)		bindir="$optarg" ;;
	--bindir)		shift; bindir="$1" ;;

	--datadir=*)		datadir="$optarg" ;;
	--datadir)		shift; datadir="$1" ;;

	--sysconfdir=*)		sysconfdir="$optarg" ;;
	--sysconfdir)		shift; sysconfdir="$1" ;;

	--mandir=*)		mandir="$optarg" ;;
	--mandir)		shift; mandir="$1" ;;

	--docdir=*)		docdir="$optarg" ;;
	--docdir)		shift; docdir="$1" ;;

	--with-shell=*)		with_shell="$optarg" ;;
	--with-shell)		shift; with_shell="$1" ;;

	--with-awk=*)		with_awk="$optarg" ;;
	--with-awk)		shift; with_awk="$1" ;;

	--with-sendmail=*)	with_sendmail="$optarg" ;;
	--with-sendmail)	shift; with_sendmail="$1" ;;

	--with-printcap=*)	with_printcap="$optarg" ;;
	--with-printcap)	shift; with_printcap="$1" ;;

	--with-spooldir=*)	with_spooldir="$optarg" ;;
	--with-spooldir)	shift; with_spooldir="$1" ;;

	--quiet|--silent)	quiet=set ;;

	--help)			cat <<EOF
Usage: configure [options]
Options: [defaults in brackets after descriptions]
Configuration:
  --help                  print this message
  --quiet, --silent       do not print informational messages
Directory and file names:
  --prefix=PREFIX         install architecture-independent files in PREFIX
			  [$prefix_default]
  --bindir=DIR            user executables in DIR [PREFIX/bin]
  --datadir=DATADIR       read-only architecture-independent data in DATADIR
                          [PREFIX/share]
  --sysconfdir=DIR        read-only single-machine data in DIR [PREFIX/etc]
  --mandir=DIR            man documentation in DIR [PREFIX/man]
  --docdir=DIR            regular documentation in DIR [DATADIR/doc]
Features and packages:
  --with-shell=NAME       use NAME as shell executable [autodetected]
  --with-awk=NAME         use NAME as awk executable [autodetected]
  --with-sendmail=NAME    use NAME as sendmail executable [autodetected]
  --with-printcap=NAME    use NAME as printcap database [/etc/printcap]
  --with-spooldir=DIR     use DIR as lpd spool directory [/var/spool/lpd]
EOF
				exit 0 ;;

	*)	echo "configure: error: $option: invalid option" 1>&2
		echo "use --help to show usage" 1>&2
		exit 1 ;;
    esac
done


# verbose output?

if test "$quiet"; then
    exec 3>/dev/null
else
    exec 3>&1
fi

# set variables according to defaults/arguments

. ./VERSION
echo "configuring apsfilter version $version-$branch..." 1>&3

test "$prefix"		|| prefix="$prefix_default"
test "$bindir"		|| bindir="$prefix/bin"
test "$datadir"		|| datadir="$prefix/share"
test "$sysconfdir"	|| sysconfdir="$prefix/etc"
test "$mandir"		|| mandir="$prefix/man"
test "$docdir"		|| docdir="$datadir/doc"
test "$with_printcap"	|| with_printcap=/etc/printcap
test "$with_spooldir"	|| with_spooldir=/var/spool/lpd

# autodetection

if test "$with_shell"; then
    if test -x "$with_shell"; then
	echo "using $with_shell as the shell executable" 1>&3
    else
	echo "configure: error: shell not found at $with_shell" 1>&2
	exit 1
    fi
else
    # these shells should work (TM)
    for name in bash bash2 pdksh zsh; do
	IFS=":"
	for dir in $PATH; do
	    test -x "$dir/$name" && { with_shell="$dir/$name"; break; }
	done
	IFS="$old_ifs"
	echo "looking for a suitable shell: $name... $with_shell" 1>&3
	test "$with_shell" && break
    done
    if test -z "$with_shell"; then
	# fall back
	with_shell=/bin/sh
	echo "configure: warning: falling back to /bin/sh" 1>&2
	echo "configure: you might want to use --with-shell" 1>&2
    fi
fi

if test "$with_awk"; then
    if test -x "$with_awk"; then
	echo "using $with_awk as the awk executable" 1>&3
    else
	echo "configure: error: awk not found at $with_awk" 1>&2
	exit 1
    fi
else
    # these awks should work (TM)
    for name in gawk mawk nawk; do
	IFS=":"
	for dir in $PATH; do
	    test -x "$dir/$name" && { with_awk="$dir/$name"; break; }
	done
	IFS="$old_ifs"
	echo "looking for a suitable awk: $name... $with_awk" 1>&3
	test "$with_awk" && break
    done
    if test -z "$with_awk"; then
	# fall back
	IFS=":"
	for dir in $PATH; do
	    test -x "$dir/awk" && { with_awk="$dir/awk"; break; }
	done
	IFS="$old_ifs"
	if test "$with_awk"; then
	    echo "configure: warning: falling back to $with_awk" 1>&2
	    echo "configure: you might want to use --with-awk" 1>&2
	else
	    echo "configure: error: no awk found; use --with-awk" 1>&2
	    exit 1
	fi
    fi
fi

if test "$with_sendmail"; then
    if test -x "$with_sendmail"; then
	echo "using $with_sendmail as the sendmail executable" 1>&3
    else
	echo "configure: warning: sendmail not found at $with_sendmail" 1>&2
    fi
else
    IFS=":"
    for path in /usr/sbin /usr/lib $PATH; do
	test -x "$path/sendmail" && with_sendmail="$path/sendmail"
	echo "looking for sendmail in $path... $with_sendmail" 1>&3
	test "$with_sendmail" && break
    done
    IFS="$old_ifs"
    if test ! -x "$with_sendmail"; then
	echo "configure: error: no sendmail found; use --with-sendmail" 1>&2
	exit 1
    fi
fi


# substitute variables in files (foo.in -> foo)

for file in $DOT_IN_FILES
do
    echo "creating $file..." 1>&3
    sed < "${file}.in" > "$file" "s?@prefix@?$prefix?g; s?@bindir@?$bindir?g; \
s?@datadir@?$datadir?g; s?@sysconfdir@?$sysconfdir?g; s?@mandir@?$mandir?g;   \
s?@shell@?$with_shell?g; s?@awk@?$with_awk?g; s?@sendmail@?$with_sendmail?g;  \
s?@printcap@?$with_printcap?g; s?@spooldir@?$with_spooldir?g;                 \
s?@docdir@?$docdir?g; s?@VERSION@?$version?g; s?@branch@?$branch?g;           \
s?@confopts@?${confopts:-none}?g; s?@DOT_IN_FILES@?$DOT_IN_FILES?g"
done

# make scripts executable

chmod 755 SETUP bin/apsfilter bin/aps2file bin/apsfilter-bug bin/apspreview


# summary

cat 1>&3 <<EOF

Using following values as defaults:
    prefix		$prefix
    bindir		$bindir
    datadir		$datadir
			(will become $datadir/apsfilter)
    sysconfdir		$sysconfdir
			(will become $sysconfdir/apsfilter)
    mandir		$mandir
    docdir		$docdir
			(will become $docdir/apsfilter)

    shell		$with_shell
    awk			$with_awk
    sendmail		$with_sendmail
    printcap		$with_printcap
    spooldir		$with_spooldir

Now run "make install" to install apsfilter.
EOF