-
Notifications
You must be signed in to change notification settings - Fork 16
/
configure.ac
178 lines (165 loc) · 5.33 KB
/
configure.ac
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
dnl Process this file with autoconf to produce a configure script.
AC_INIT(db/source/driver/ljet4.xml)
# If the user didn't specify the $sysconfdir on the command line, let it
# be /etc, not /usr/local/etc or /usr/etc
if [[ x$sysconfdir = 'x${prefix}/etc' ]]; then
sysconfdir=/etc
fi
# Checks for programs.
AC_PROG_INSTALL
AC_PROG_MAKE_SET
SBINSEARCHPATH=/usr/sbin:/sbin:/usr/local/sbin:/etc/sbin
BINSEARCHPATH=/usr/bin:/bin:/usr/local/bin
DATASEARCHPATH=/usr/share:/usr/local/share:/usr/lib:/usr/local/lib:/opt
BSB=$BINSEARCHPATH:$SBINSEARCHPATH
FM_PATH_DIRS(CUPS_PPDS,cups/model,CUPS_PPDS_NOT_FOUND,$DATASEARCHPATH)
AC_PATH_PROG(GZIP,gzip,GZIP_NOT_FOUND,$BSB)
# disable PPD file compression
AC_MSG_CHECKING(PPD file gzip compression)
AC_ARG_ENABLE( gzip-ppds,
[ --disable-gzip-ppds disable gzipping of custom PPD files],
[
if test "$enableval" = "yes" ; then
GZIP_PPDS=yes;
else
GZIP_PPDS=no;
fi
],
[
if test "$GZIP" != "GZIP_NOT_FOUND" ; then
GZIP_PPDS=yes;
else
GZIP_PPDS=no;
fi
],
)
AC_MSG_RESULT($GZIP_PPDS)
AC_SUBST(GZIP_PPDS)
# disable linking custom PPD files to CUPS PPDs (/usr/share/cups/model)
AC_MSG_CHECKING(making PPD files available to CUPS)
AC_ARG_ENABLE( ppds-to-cups,
[ --disable-ppds-to-cups disable making custom PPDs available to CUPS],
[
if test "$enableval" = "yes" ; then
PPDS_TO_CUPS=yes;
else
PPDS_TO_CUPS=no;
fi
],
[
if test "$CUPS_PPDS" != "CUPS_PPDS_NOT_FOUND" ; then
PPDS_TO_CUPS=yes;
else
PPDS_TO_CUPS=no;
fi
],
)
AC_MSG_RESULT($PPDS_TO_CUPS)
AC_SUBST(PPDS_TO_CUPS)
# look for driver XMLs to include...
AC_ARG_WITH(drivers,
[ --with-drivers=LIST Drivers to include, separated by commas.
Either list the drivers or use aliases:
ALL = all drivers
NOOBSOLETES =
no drivers marked obsolete
NOEMPTYCMDLINE =
no drivers without invocation
command line
ONLYRECOMMENDED =
no drivers which are not
recommended for at least one
printer
You can mix both variants, e.g.
--with-drivers=ALL,NOOBSOLETES,gutenprint
would include all drivers except obsoletes, but
"gutenprint" is included even being obsolete
(list is treated from the left to the right).
Aliases must be uppercase (a 3rd party driver
might have the same name).
Default: NOOBSOLETES],
drivers="$withval",drivers="NOOBSOLETES")
AC_ARG_WITH(driversfile,
[ --with-driversfile=FILE Drivers to support from file, separated by newlines.],
driversfile="$withval",driversfile="")
if test "x$driversfile" != x; then
# Add drivers from file...
drivers="`tr '\n' ',' <$driversfile`"
fi
# If first item in the driver list is an excluding alias, assume that
# we want to exclude these items from all drivers
if `echo $drivers | egrep '^\s*(NO|ONLY)' > /dev/null`; then
drivers="ALL,$drivers"
fi
# Check which driver XML files we will install
DRIVERXMLS="";
while test -n "$drivers"; do
if echo $drivers |grep "," >/dev/null; then
THIS="`echo $drivers |sed -e 's/,.*//'`"
drivers="`echo $drivers |sed -e \"s/$THIS,//\"`"
else
THIS=$drivers
drivers=""
fi
case "$THIS" in
ALL)
# ALL = PRINTERS + FILES...
DRIVERXMLS=`cd db/source/driver/; ls -1 *.xml`
;;
NOOBSOLETES)
OBSOLETEXMLS=`cd db/source/driver/; grep -li '< *obsolete.*/ *>' *.xml`
while test -n "$OBSOLETEXMLS"; do
if echo $OBSOLETEXMLS |grep " " >/dev/null; then
REMOVE="`echo $OBSOLETEXMLS |sed -e 's/ .*//'`"
OBSOLETEXMLS="`echo $OBSOLETEXMLS |sed -e \"s/$REMOVE //\"`"
else
REMOVE=$OBSOLETEXMLS
OBSOLETEXMLS=""
fi
DRIVERXMLS=`echo $DRIVERXMLS | sed -e "s/$REMOVE *//"`
done
;;
NOEMPTYCMDLINE)
EMPTYCMDLINEXMLS=`cd db/source/driver/; grep -li '< *prototype *> *< */prototype *>' *.xml`
EMPTYCMDLINEXMLS="$EMPTYCMDLINEXMLS `cd db/source/driver/; grep -li '< *prototype */ *>' *.xml`"
EMPTYCMDLINEXMLS="$EMPTYCMDLINEXMLS `cd db/source/driver/; grep -Li '< *prototype' *.xml`"
while test -n "$EMPTYCMDLINEXMLS"; do
if echo $EMPTYCMDLINEXMLS |grep " " >/dev/null; then
REMOVE="`echo $EMPTYCMDLINEXMLS |sed -e 's/ .*//'`"
EMPTYCMDLINEXMLS="`echo $EMPTYCMDLINEXMLS |sed -e \"s/$REMOVE //\"`"
else
REMOVE=$EMPTYCMDLINEXMLS
EMPTYCMDLINEXMLS=""
fi
DRIVERXMLS=`echo $DRIVERXMLS | sed -e "s/$REMOVE *//"`
done
;;
ONLYRECOMMENDED)
DRIVERXMLS2='';
RECOMMENDEDXMLS=`grep '<driver>' db/source/printer/*.xml | perl -p -e 's:^.*<driver>(.*?)</driver>.*$:$1.xml:' | grep -v ':' | grep -v '^\.xml' | sort | uniq`
while test -n "$RECOMMENDEDXMLS"; do
if echo $RECOMMENDEDXMLS |grep " " >/dev/null; then
KEEP="`echo $RECOMMENDEDXMLS |sed -e 's/ .*//'`"
RECOMMENDEDXMLS="`echo $RECOMMENDEDXMLS |sed -e \"s/$KEEP //\"`"
else
KEEP=$RECOMMENDEDXMLS
RECOMMENDEDXMLS=""
fi
if echo $DRIVERXMLS | grep $KEEP >/dev/null; then
DRIVERXMLS2="$DRIVERXMLS2 $KEEP"
fi
done
DRIVERXMLS=$DRIVERXMLS2
;;
*)
# It's a driver name (or a user messup)
DRIVERXMLS="$DRIVERXMLS $THIS.xml"
;;
esac
done
AC_SUBST(DRIVERXMLS)
AC_CONFIG_FILES(Makefile)
AC_OUTPUT
# Finished
echo "Finished configuring."
echo "Type 'make install' to install the package."