]> git.ipfire.org Git - thirdparty/cups.git/blame - config-scripts/cups-directories.m4
Merge pull request #1316 from weblate/weblate-cups-cups
[thirdparty/cups.git] / config-scripts / cups-directories.m4
CommitLineData
ef416fc2 1dnl
5a1d7a17 2dnl Directory stuff for CUPS.
ef416fc2 3dnl
76b6aade 4dnl Copyright © 2020-2024 by OpenPrinting.
8cc87381
MS
5dnl Copyright © 2007-2017 by Apple Inc.
6dnl Copyright © 1997-2007 by Easy Software Products, all rights reserved.
ef416fc2 7dnl
e3101897 8dnl Licensed under Apache License v2.0. See the file "LICENSE" for more information.
ef416fc2 9dnl
10
ef416fc2 11dnl Fix "prefix" variable if it hasn't been specified...
a86819ab
MS
12AS_IF([test "$prefix" = NONE], [
13 # Default prefix isn't bound until AC_OUTPUT...
14 realprefix="/usr/local"
15], [
16 realprefix="$prefix"
8cc87381 17])
ef416fc2 18
19dnl Fix "exec_prefix" variable if it hasn't been specified...
8cc87381
MS
20AS_IF([test "$exec_prefix" = "NONE"], [
21 AS_IF([test "$prefix" = "/"], [
22 exec_prefix="/usr"
23 ], [
a86819ab 24 exec_prefix="$realprefix"
8cc87381
MS
25 ])
26])
ef416fc2 27
28dnl Fix "bindir" variable...
8cc87381
MS
29AS_IF([test "$bindir" = "\${exec_prefix}/bin"], [
30 bindir="$exec_prefix/bin"
31])
ef416fc2 32
8cc87381 33AC_DEFINE_UNQUOTED([CUPS_BINDIR], ["$bindir"], [Location of CUPS user programs.])
fa73b229 34
ef416fc2 35dnl Fix "sbindir" variable...
8cc87381
MS
36AS_IF([test "$sbindir" = "\${exec_prefix}/sbin"], [
37 sbindir="$exec_prefix/sbin"
38])
ef416fc2 39
8cc87381 40AC_DEFINE_UNQUOTED([CUPS_SBINDIR], ["$sbindir"], [Location of CUPS admin programs.])
ef416fc2 41
d09495fa 42dnl Fix "datarootdir" variable if it hasn't been specified...
8cc87381
MS
43AS_IF([test "$datarootdir" = "\${prefix}/share"], [
44 AS_IF([test "$prefix" = "/"], [
45 datarootdir="/usr/share"
46 ], [
a86819ab 47 datarootdir="$realprefix/share"
8cc87381
MS
48 ])
49])
d09495fa 50
ef416fc2 51dnl Fix "datadir" variable if it hasn't been specified...
8cc87381
MS
52AS_IF([test "$datadir" = "\${prefix}/share"], [
53 AS_IF([test "$prefix" = "/"], [
54 datadir="/usr/share"
55 ], [
a86819ab 56 datadir="$realprefix/share"
8cc87381
MS
57 ])
58], [test "$datadir" = "\${datarootdir}"], [
59 datadir="$datarootdir"
60])
ef416fc2 61
62dnl Fix "includedir" variable if it hasn't been specified...
a86819ab
MS
63AS_IF([test "$includedir" = "\${prefix}/include"], [
64 AS_IF([test "$prefix" = "/"], [
65 includedir="/usr/include/libcups2"
66 ], [
67 includedir="$realprefix/include/libcups2"
68 ])
8cc87381 69])
2e9bd60d
MS
70AS_IF([test "$includedir" != "/usr/include"], [
71 PKGCONFIG_CFLAGS="$PKGCONFIG_CFLAGS -I$includedir"
72])
ef416fc2 73
74dnl Fix "localstatedir" variable if it hasn't been specified...
8cc87381
MS
75AS_IF([test "$localstatedir" = "\${prefix}/var"], [
76 AS_IF([test "$prefix" = "/"], [
77 AS_IF([test "$host_os_name" = darwin], [
78 localstatedir="/private/var"
79 ], [
80 localstatedir="/var"
81 ])
82 ], [
a86819ab 83 localstatedir="$realprefix/var"
8cc87381
MS
84 ])
85])
ef416fc2 86
87dnl Fix "sysconfdir" variable if it hasn't been specified...
8cc87381
MS
88AS_IF([test "$sysconfdir" = "\${prefix}/etc"], [
89 AS_IF([test "$prefix" = "/"], [
90 AS_IF([test "$host_os_name" = darwin], [
91 sysconfdir="/private/etc"
92 ], [
93 sysconfdir="/etc"
94 ])
95 ], [
a86819ab 96 sysconfdir="$realprefix/etc"
8cc87381
MS
97 ])
98])
ef416fc2 99
c277e2f8 100dnl Fix "libdir" variable...
8cc87381
MS
101AS_IF([test "$libdir" = "\${exec_prefix}/lib"], [
102 AS_CASE(["$host_os_name"], [linux*], [
103 AS_IF([test -d /usr/lib64 -a ! -d /usr/lib64/fakeroot], [
104 libdir="$exec_prefix/lib64"
2e9bd60d
MS
105 ], [
106 libdir="$exec_prefix/lib"
8cc87381 107 ])
2e9bd60d
MS
108 ], [*], [
109 libdir="$exec_prefix/lib"
8cc87381
MS
110 ])
111])
2e9bd60d
MS
112AS_IF([test "$libdir" = "/usr/lib"], [
113 PKGCONFIG_LIBS="-lcups"
114], [
115 PKGCONFIG_LIBS="-L$libdir -lcups"
116])
2e4ff8af 117
ef416fc2 118dnl Setup default locations...
119# Cache data...
8cc87381
MS
120AC_ARG_WITH([cachedir], AS_HELP_STRING([--with-cachedir], [set path for cache files]), [
121 cachedir="$withval"
122], [
123 cachedir=""
124])
125
126AS_IF([test x$cachedir = x], [
127 AS_IF([test "x$host_os_name" = xdarwin], [
128 CUPS_CACHEDIR="$localstatedir/spool/cups/cache"
129 ], [
130 CUPS_CACHEDIR="$localstatedir/cache/cups"
131 ])
132], [
133 CUPS_CACHEDIR="$cachedir"
134])
135AC_DEFINE_UNQUOTED([CUPS_CACHEDIR], ["$CUPS_CACHEDIR"], [Location of cache files.])
136AC_SUBST([CUPS_CACHEDIR])
ef416fc2 137
138# Data files
139CUPS_DATADIR="$datadir/cups"
8cc87381
MS
140AC_DEFINE_UNQUOTED([CUPS_DATADIR], ["$datadir/cups"], [Location of data files.])
141AC_SUBST([CUPS_DATADIR])
ef416fc2 142
f7deaa1a 143# Icon directory
8cc87381
MS
144AC_ARG_WITH([icondir], AS_HELP_STRING([--with-icondir], [set path for application icons]), [
145 icondir="$withval"
146], [
147 icondir=""
148])
f7deaa1a 149
8cc87381
MS
150AS_IF([test "x$icondir" = x], [
151 ICONDIR="/usr/share/icons"
152], [
153 ICONDIR="$icondir"
154])
f7deaa1a 155
8cc87381 156AC_SUBST([ICONDIR])
f7deaa1a 157
158# Menu directory
8cc87381
MS
159AC_ARG_WITH([menudir], AS_HELP_STRING([--with-menudir], [set path for application menus]), [
160 menudir="$withval"
161], [
162 menudir=""
163])
f7deaa1a 164
8cc87381
MS
165AS_IF([test "x$menudir" = x], [
166 MENUDIR="/usr/share/applications"
167], [
168 MENUDIR="$menudir"
169])
f7deaa1a 170
8cc87381 171AC_SUBST([MENUDIR])
f7deaa1a 172
ef416fc2 173# Documentation files
8cc87381
MS
174AC_ARG_WITH([docdir], AS_HELP_STRING([--with-docdir], [set path for documentation]), [
175 docdir="$withval"
176], [
177 docdir=""
178])
179
180AS_IF([test x$docdir = x], [
181 CUPS_DOCROOT="$datadir/doc/cups"
182 docdir="$datadir/doc/cups"
183], [
184 CUPS_DOCROOT="$docdir"
185])
186
187AC_DEFINE_UNQUOTED([CUPS_DOCROOT], ["$docdir"], [Location of documentation files.])
188AC_SUBST([CUPS_DOCROOT])
ef416fc2 189
2e4ff8af 190# Locale data
8cc87381 191AS_IF([test "$localedir" = "\${datarootdir}/locale"], [
2bc20b79 192 AS_CASE(["$host_os_name"], [linux* | gnu* | *bsd* | darwin* | solaris*], [
8cc87381
MS
193 CUPS_LOCALEDIR="$datarootdir/locale"
194 ], [*], [
195 # This is the standard System V location...
196 CUPS_LOCALEDIR="$exec_prefix/lib/locale"
197 ])
198], [
199 CUPS_LOCALEDIR="$localedir"
200])
201
202AC_DEFINE_UNQUOTED([CUPS_LOCALEDIR], ["$CUPS_LOCALEDIR"], [Location of localization files.])
203AC_SUBST([CUPS_LOCALEDIR])
ef416fc2 204
3e573834 205
206# cups.pc file...
207AC_ARG_WITH([pkgconfpath], AS_HELP_STRING([--with-pkgconfpath], [set path for cups.pc file]), [
208 pkgconfpath="$withval"
209], [
210 pkgconfpath=""
211])
212
213AS_IF([test x$pkgconfpath = x], [
214 CUPS_PKGCONFPATH="$exec_prefix/lib/pkgconfig"
215], [
216 CUPS_PKGCONFPATH="$pkgconfpath"
217])
218AC_DEFINE_UNQUOTED([CUPS_PKGCONFPATH], ["$CUPS_PKGCONFPATH"], [Location of cups.pc file.])
219AC_SUBST([CUPS_PKGCONFPATH])
220
221
222
ef416fc2 223# Log files...
8cc87381
MS
224AC_ARG_WITH([logdir], AS_HELP_STRING([--with-logdir], [set path for log files]), [
225 logdir="$withval"
226], [
227 logdir=""
228])
229
230AS_IF([test x$logdir = x], [
231 CUPS_LOGDIR="$localstatedir/log/cups"
232], [
233 CUPS_LOGDIR="$logdir"
234])
235AC_DEFINE_UNQUOTED([CUPS_LOGDIR], ["$CUPS_LOGDIR"], [Location of log files.])
236AC_SUBST([CUPS_LOGDIR])
ef416fc2 237
238# Longer-term spool data
239CUPS_REQUESTS="$localstatedir/spool/cups"
8cc87381
MS
240AC_DEFINE_UNQUOTED([CUPS_REQUESTS], ["$localstatedir/spool/cups"], [Location of spool directory.])
241AC_SUBST([CUPS_REQUESTS])
ef416fc2 242
243# Server executables...
8cc87381
MS
244AS_CASE(["$host_os_name"], [*-gnu], [
245 # GNUs
246 INSTALL_SYSV="install-sysv"
247 CUPS_SERVERBIN="$exec_prefix/lib/cups"
248], [*bsd* | darwin*], [
249 # *BSD and Darwin (macOS)
250 INSTALL_SYSV=""
251 CUPS_SERVERBIN="$exec_prefix/libexec/cups"
252], [*], [
253 # All others
254 INSTALL_SYSV="install-sysv"
255 CUPS_SERVERBIN="$exec_prefix/lib/cups"
256])
257
258AC_DEFINE_UNQUOTED([CUPS_SERVERBIN], ["$CUPS_SERVERBIN"], [Location of server programs.])
259AC_SUBST([CUPS_SERVERBIN])
260AC_SUBST([INSTALL_SYSV])
ef416fc2 261
262# Configuration files
263CUPS_SERVERROOT="$sysconfdir/cups"
8cc87381
MS
264AC_DEFINE_UNQUOTED([CUPS_SERVERROOT], ["$sysconfdir/cups"], [Location of server configuration files.])
265AC_SUBST([CUPS_SERVERROOT])
ef416fc2 266
267# Transient run-time state
8cc87381
MS
268AC_ARG_WITH([rundir], AS_HELP_STRING([--with-rundir], [set transient run-time state directory]), [
269 CUPS_STATEDIR="$withval"
270], [
271 AS_CASE(["$host_os_name"], [darwin*], [
272 # Darwin (macOS)
273 CUPS_STATEDIR="$CUPS_SERVERROOT"
e1cfb900 274 ], [sunos* | solaris*], [
2bc20b79
MR
275 AS_IF([test -d /system/volatile], [
276 CUPS_STATEDIR="/system/volatile/cups"
e1cfb900
MR
277 ], [
278 CUPS_STATEDIR="$localstatedir/run/cups"
2bc20b79 279 ])
8cc87381
MS
280 ], [*], [
281 # All others
282 CUPS_STATEDIR="$localstatedir/run/cups"
283 ])
284])
285AC_DEFINE_UNQUOTED([CUPS_STATEDIR], ["$CUPS_STATEDIR"], [Location of transient state files.])
286AC_SUBST([CUPS_STATEDIR])