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