1dnl
2dnl Directory stuff for CUPS.
3dnl
4dnl Copyright 2007-2017 by Apple Inc.
5dnl Copyright 1997-2007 by Easy Software Products, all rights reserved.
6dnl
7dnl Licensed under Apache License v2.0.  See the file "LICENSE" for more information.
8dnl
9
10AC_PREFIX_DEFAULT(/)
11
12dnl Fix "prefix" variable if it hasn't been specified...
13if test "$prefix" = "NONE"; then
14	prefix="/"
15fi
16
17dnl Fix "exec_prefix" variable if it hasn't been specified...
18if test "$exec_prefix" = "NONE"; then
19	if test "$prefix" = "/"; then
20		exec_prefix="/usr"
21	else
22		exec_prefix="$prefix"
23	fi
24fi
25
26dnl Fix "bindir" variable...
27if test "$bindir" = "\${exec_prefix}/bin"; then
28	bindir="$exec_prefix/bin"
29fi
30
31AC_DEFINE_UNQUOTED(CUPS_BINDIR, "$bindir")
32
33dnl Fix "sbindir" variable...
34if test "$sbindir" = "\${exec_prefix}/sbin"; then
35	sbindir="$exec_prefix/sbin"
36fi
37
38AC_DEFINE_UNQUOTED(CUPS_SBINDIR, "$sbindir")
39
40dnl Fix "sharedstatedir" variable if it hasn't been specified...
41if test "$sharedstatedir" = "\${prefix}/com" -a "$prefix" = "/"; then
42	sharedstatedir="/usr/com"
43fi
44
45dnl Fix "datarootdir" variable if it hasn't been specified...
46if test "$datarootdir" = "\${prefix}/share"; then
47	if test "$prefix" = "/"; then
48		datarootdir="/usr/share"
49	else
50		datarootdir="$prefix/share"
51	fi
52fi
53
54dnl Fix "datadir" variable if it hasn't been specified...
55if test "$datadir" = "\${prefix}/share"; then
56	if test "$prefix" = "/"; then
57		datadir="/usr/share"
58	else
59		datadir="$prefix/share"
60	fi
61elif test "$datadir" = "\${datarootdir}"; then
62	datadir="$datarootdir"
63fi
64
65dnl Fix "includedir" variable if it hasn't been specified...
66if test "$includedir" = "\${prefix}/include" -a "$prefix" = "/"; then
67	includedir="/usr/include"
68fi
69
70dnl Fix "localstatedir" variable if it hasn't been specified...
71if test "$localstatedir" = "\${prefix}/var"; then
72	if test "$prefix" = "/"; then
73		if test "$host_os_name" = darwin; then
74			localstatedir="/private/var"
75		else
76			localstatedir="/var"
77		fi
78	else
79		localstatedir="$prefix/var"
80	fi
81fi
82
83dnl Fix "sysconfdir" variable if it hasn't been specified...
84if test "$sysconfdir" = "\${prefix}/etc"; then
85	if test "$prefix" = "/"; then
86		if test "$host_os_name" = darwin; then
87			sysconfdir="/private/etc"
88		else
89			sysconfdir="/etc"
90		fi
91	else
92		sysconfdir="$prefix/etc"
93	fi
94fi
95
96dnl Fix "libdir" variable...
97if test "$libdir" = "\${exec_prefix}/lib"; then
98	case "$host_os_name" in
99		linux*)
100			if test -d /usr/lib64 -a ! -d /usr/lib64/fakeroot; then
101				libdir="$exec_prefix/lib64"
102			fi
103			;;
104	esac
105fi
106
107dnl Setup private include directory...
108AC_ARG_WITH(privateinclude, [  --with-privateinclude   set path for private include files, default=none],privateinclude="$withval",privateinclude="")
109if test "x$privateinclude" != x -a "x$privateinclude" != xnone; then
110	PRIVATEINCLUDE="$privateinclude/cups"
111else
112	privateinclude=""
113	PRIVATEINCLUDE=""
114fi
115AC_SUBST(privateinclude)
116AC_SUBST(PRIVATEINCLUDE)
117
118dnl LPD sharing support...
119AC_ARG_WITH(lpdconfig, [  --with-lpdconfig        set URI for LPD config file],
120	LPDCONFIG="$withval", LPDCONFIG="")
121
122if test "x$LPDCONFIG" = x; then
123	if test -f /System/Library/LaunchDaemons/org.cups.cups-lpd.plist; then
124		LPDCONFIG="launchd:///System/Library/LaunchDaemons/org.cups.cups-lpd.plist"
125	elif test "x$XINETD" != x; then
126		LPDCONFIG="xinetd://$XINETD/cups-lpd"
127	fi
128fi
129
130if test "x$LPDCONFIG" = xoff; then
131	AC_DEFINE_UNQUOTED(CUPS_DEFAULT_LPD_CONFIG, "")
132else
133	AC_DEFINE_UNQUOTED(CUPS_DEFAULT_LPD_CONFIG, "$LPDCONFIG")
134fi
135
136dnl SMB sharing support...
137AC_ARG_WITH(smbconfig, [  --with-smbconfig        set URI for Samba config file],
138	SMBCONFIG="$withval", SMBCONFIG="")
139
140if test "x$SMBCONFIG" = x; then
141	if test -f /System/Library/LaunchDaemons/smbd.plist; then
142		SMBCONFIG="launchd:///System/Library/LaunchDaemons/smbd.plist"
143	else
144		for dir in /etc /etc/samba /usr/local/etc; do
145			if test -f $dir/smb.conf; then
146				SMBCONFIG="samba://$dir/smb.conf"
147				break
148			fi
149		done
150	fi
151fi
152
153if test "x$SMBCONFIG" = xoff; then
154	AC_DEFINE_UNQUOTED(CUPS_DEFAULT_SMB_CONFIG, "")
155else
156	AC_DEFINE_UNQUOTED(CUPS_DEFAULT_SMB_CONFIG, "$SMBCONFIG")
157fi
158
159dnl Setup default locations...
160# Cache data...
161AC_ARG_WITH(cachedir, [  --with-cachedir         set path for cache files],cachedir="$withval",cachedir="")
162
163if test x$cachedir = x; then
164	if test "x$host_os_name" = xdarwin; then
165		CUPS_CACHEDIR="$localstatedir/spool/cups/cache"
166	else
167		CUPS_CACHEDIR="$localstatedir/cache/cups"
168	fi
169else
170	CUPS_CACHEDIR="$cachedir"
171fi
172AC_DEFINE_UNQUOTED(CUPS_CACHEDIR, "$CUPS_CACHEDIR")
173AC_SUBST(CUPS_CACHEDIR)
174
175# Data files
176CUPS_DATADIR="$datadir/cups"
177AC_DEFINE_UNQUOTED(CUPS_DATADIR, "$datadir/cups")
178AC_SUBST(CUPS_DATADIR)
179
180# Icon directory
181AC_ARG_WITH(icondir, [  --with-icondir          set path for application icons],icondir="$withval",icondir="")
182
183if test "x$icondir" = x -a -d /usr/share/icons; then
184	ICONDIR="/usr/share/icons"
185else
186	ICONDIR="$icondir"
187fi
188
189AC_SUBST(ICONDIR)
190
191# Menu directory
192AC_ARG_WITH(menudir, [  --with-menudir          set path for application menus],menudir="$withval",menudir="")
193
194if test "x$menudir" = x -a -d /usr/share/applications; then
195	MENUDIR="/usr/share/applications"
196else
197	MENUDIR="$menudir"
198fi
199
200AC_SUBST(MENUDIR)
201
202# Documentation files
203AC_ARG_WITH(docdir, [  --with-docdir           set path for documentation],docdir="$withval",docdir="")
204
205if test x$docdir = x; then
206	CUPS_DOCROOT="$datadir/doc/cups"
207	docdir="$datadir/doc/cups"
208else
209	CUPS_DOCROOT="$docdir"
210fi
211
212AC_DEFINE_UNQUOTED(CUPS_DOCROOT, "$docdir")
213AC_SUBST(CUPS_DOCROOT)
214
215# Fonts
216AC_ARG_WITH(fontpath, [  --with-fontpath         set font path for pstoraster],fontpath="$withval",fontpath="")
217
218if test "x$fontpath" = "x"; then
219	CUPS_FONTPATH="$datadir/cups/fonts"
220else
221	CUPS_FONTPATH="$fontpath"
222fi
223
224AC_SUBST(CUPS_FONTPATH)
225AC_DEFINE_UNQUOTED(CUPS_FONTPATH, "$CUPS_FONTPATH")
226
227# Locale data
228if test "$localedir" = "\${datarootdir}/locale"; then
229	case "$host_os_name" in
230		linux* | gnu* | *bsd* | darwin*)
231			CUPS_LOCALEDIR="$datarootdir/locale"
232			;;
233
234		*)
235			# This is the standard System V location...
236			CUPS_LOCALEDIR="$exec_prefix/lib/locale"
237			;;
238	esac
239else
240	CUPS_LOCALEDIR="$localedir"
241fi
242
243AC_DEFINE_UNQUOTED(CUPS_LOCALEDIR, "$CUPS_LOCALEDIR")
244AC_SUBST(CUPS_LOCALEDIR)
245
246# Log files...
247AC_ARG_WITH(logdir, [  --with-logdir           set path for log files],logdir="$withval",logdir="")
248
249if test x$logdir = x; then
250	CUPS_LOGDIR="$localstatedir/log/cups"
251	AC_DEFINE_UNQUOTED(CUPS_LOGDIR, "$localstatedir/log/cups")
252else
253	CUPS_LOGDIR="$logdir"
254fi
255AC_DEFINE_UNQUOTED(CUPS_LOGDIR, "$CUPS_LOGDIR")
256AC_SUBST(CUPS_LOGDIR)
257
258# Longer-term spool data
259CUPS_REQUESTS="$localstatedir/spool/cups"
260AC_DEFINE_UNQUOTED(CUPS_REQUESTS, "$localstatedir/spool/cups")
261AC_SUBST(CUPS_REQUESTS)
262
263# Server executables...
264case "$host_os_name" in
265	*bsd* | darwin*)
266		# *BSD and Darwin (macOS)
267		INSTALL_SYSV=""
268		CUPS_SERVERBIN="$exec_prefix/libexec/cups"
269		;;
270	*)
271		# All others
272		INSTALL_SYSV="install-sysv"
273		CUPS_SERVERBIN="$exec_prefix/lib/cups"
274		;;
275esac
276
277AC_DEFINE_UNQUOTED(CUPS_SERVERBIN, "$CUPS_SERVERBIN")
278AC_SUBST(CUPS_SERVERBIN)
279AC_SUBST(INSTALL_SYSV)
280
281# Configuration files
282CUPS_SERVERROOT="$sysconfdir/cups"
283AC_DEFINE_UNQUOTED(CUPS_SERVERROOT, "$sysconfdir/cups")
284AC_SUBST(CUPS_SERVERROOT)
285
286# Transient run-time state
287AC_ARG_WITH(rundir, [  --with-rundir           set transient run-time state directory],CUPS_STATEDIR="$withval",[
288	case "$host_os_name" in
289		darwin*)
290			# Darwin (macOS)
291			CUPS_STATEDIR="$CUPS_SERVERROOT"
292			;;
293		*)
294			# All others
295			CUPS_STATEDIR="$localstatedir/run/cups"
296			;;
297	esac])
298AC_DEFINE_UNQUOTED(CUPS_STATEDIR, "$CUPS_STATEDIR")
299AC_SUBST(CUPS_STATEDIR)
300